You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Patch "Out of memory" exception when opening images containing an unknown color profile
4
3
5
4
Tested on:
@@ -9,27 +8,22 @@ Windows 10 Pro Version 1903 Build 18362.356
9
8
Windows 10 Version 22H2 Build 19045.2486
10
9
Windows 11 Pro 10.0.22000 build 22000
11
10
```
12
-
# Why?
13
11
14
-
Why not?
15
-
Windows Photo Viewer is EOL but i like it and a lot of people still use it. Besides, on like a fresh install of Windows 7 you have nothing else to open images (except Paint).
12
+
### Why?
16
13
17
-
# Before you start
14
+
Why not?
15
+
Windows Photo Viewer is EOL but i like it and a lot of people still use it. Besides, on a fresh install of Windows 7 you have nothing else to open images (except Paint).
18
16
19
-
To patch the dll or replace it you'll have to give yourself full permissions to the file and folder.
17
+
### Before you start
20
18
21
-
1) Take ownership of ImagingEngine.dll.
22
-
2) Give your user "Complete access" permissions to ImagingEngine.dll.
23
-
3) Copy ImagingEngine.dll to a folder you have full access to (Desktop for example).
24
-
4) Patch the dll.
25
-
5) Copy back the dll.
19
+
The DLL we need to patch (ImagingEngine.dll) is usually located in ```"C:\Program Files\Windows Photo Viewer\"``` or ```"C:\Program Files (x86)\Windows Photo Viewer\"```.
20
+
I suggest patching both the x86 and x64 dll, most of the times Windows uses the x86 one even if you are in a x64 environment
26
21
27
-
I suggest patching both the x86 and x64 dll, most of the times Windows uses the x86 one even if you are in a x64 environment.
28
-
Sometimes the antivirus may flag the .exe but it's a false positive, please add it to the exclusions list.
22
+
Note that sometimes the antivirus may flag the .exe but it's a false positive and you can safely add it to the exclusions list.
29
23
30
-
# How does it work?
24
+
###How does it work?
31
25
32
-
When the image contains an unknown icc profile Windows Photo Viewer tries to perform color mapping by calling **CreateMultiProfileTransform** but fails. We can patch the check to ignore the invalid icc profile.
26
+
When the image contains an unknown icc profile Windows Photo Viewer tries to perform color mapping by calling **CreateMultiProfileTransform** but fails, we can patch the check to ignore the invalid icc profile and move on.
33
27
What happens if we ignore the invalid profile? Does it use the default one? I really don't know, I only know it starts working.
34
28
35
29
The function flow looks like this:
@@ -45,7 +39,7 @@ The function flow looks like this:
45
39
46
40
Changing the check from JNE to JMP opens the image correctly. Ignoring exceptions maybe but do we care? I think not.
47
41
48
-
# Wanna make your own patch?
42
+
###Wanna make your own patch?
49
43
50
44
1) Open PhotoViewer. ```rundll32.exe [path to PhotoViewer.dll],ImageView_Fullscreen [path to image]```
51
45
@@ -57,10 +51,8 @@ Changing the check from JNE to JMP opens the image correctly. Ignoring exception
57
51
4) Search for an intermodular call to **CreateMultiProfileTransform**
58
52
5) Change the **JNE** to **JMP**
59
53
60
-
# Alternative method (patch the single image instead of the software)
61
-
62
-
You can edit the image with an hex editor like HxD and "corrupt the profile indication".
54
+
### Alternative method (patch the single image instead of the software)
63
55
56
+
You can edit the image with an hex editor like HxD and corrupt the color profile indication.
64
57
Search for the string **ICC_PROFILE** and just change a random letter (for example make it ICC_aROFILE).
65
-
66
-
You can now normally open the image on every computer without needing the patch
58
+
You can now normally open the image on every computer without needing the patch
0 commit comments