How to run Windows Photo Viewer in Safe Mode?
Quick analysis
During its startup phase, Windows Photo Viewer uses the GetSystemMetrics
API function to check whether the system was started in safe mode. If that's the case, it will display the following message:
Windows Photo Viewer does not work in safe mode. If you want to view pictures or videos, restart your computer normally.
The actual code is located inside the PhotoViewer.dll
library file, which can be usually found in these folders:
-
Windows Vista
C:\Program Files\Windows Photo Gallery
-
Windows 7 and later
C:\Program Files\Windows Photo Viewer
Further reading
Workaround
Use Paint or a third-party image viewer such as IrfanView, XnView, or FastStone Image Viewer.
Patching the limitation
The library file can be patched in order to fool the viewer into thinking the operating system wasn't started in safe mode. Despite what the warning message says, all features except printing appear to be working fine.
Note While the patch might have some side effects, it doesn't seem the case according to my tests.
-
Open the program folder, which is usually located here:
C:\Program Files\Windows Photo Viewer
Copy the
PhotoViewer.dll
file to the desktop, and rename it toPhotoViewer2.dll
.Open
PhotoViewer2.dll
file using a hex editor (e.g. HxD).Go to the proper hexadecimal offset. See below.
Change the first two bytes there to
3BC0
, and save the changes.Copy the saved file to the program folder.
-
Open an elevated command prompt, type or paste the following command, and press Enter:
cd /d "%programfiles%\Windows Photo Viewer"
-
Replace the original library with the patched one by running these commands:
taskkill /im explorer.exe /f takeown /f PhotoViewer.dll /a icacls PhotoViewer.dll /grant:r *S-1-5-32-544:F ren PhotoViewer.dll PhotoViewer.dll.old ren PhotoViewer2.dll PhotoViewer.dll start explorer
Offsets
-
Windows Vista SP2 x86 (32-bit)
0x19741
-
Windows Vista SP2 x64 (64-bit)
0x252F8
-
Windows 7 SP1 x86 (32-bit)
0x9DFF
-
Windows 7 SP1 x64 (64-bit)
0x689E6
-
Windows 8 x86 (32-bit)
0x711DE
-
Windows 8 x64 (64-bit)
0x8E785
-
Windows 8.1 x86 (32-bit)
0x70CF9
-
Windows 8.1 x64 (64-bit)
0x8E3F9
Screenshots
Before
After
Click for larger view.
Related videos on Youtube
Mark Rowe
Updated on September 18, 2022Comments
-
Mark Rowe over 1 year
How can I get Windows Photo Viewer to run in Safe Mode? I'm running Microsoft Windows 7.
-
yiwei over 10 yearsCan't you just navigate to the photo viewer application file and run it?
-
yiwei over 10 yearsAhh okay. Sorry I didn't know that. Can you use any other photo viewer? Or do you have to use the windows one?
-
-
Mark Rowe about 9 yearsHi thanks for your help here but i can't find my relevant Offset.