How to run Windows Photo Viewer in Safe Mode?

7,882

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.

  1. Open the program folder, which is usually located here:

     C:\Program Files\Windows Photo Viewer
    
  2. Copy the PhotoViewer.dll file to the desktop, and rename it to PhotoViewer2.dll.

  3. Open PhotoViewer2.dll file using a hex editor (e.g. HxD).

  4. Go to the proper hexadecimal offset. See below.

  5. Change the first two bytes there to 3BC0, and save the changes.

  6. Copy the saved file to the program folder.

  7. Open an elevated command prompt, type or paste the following command, and press Enter:

    cd /d "%programfiles%\Windows Photo Viewer"
    
  8. 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

Screenshot 1

After

Screenshot 2

Click for larger view.

Share:
7,882

Related videos on Youtube

Mark Rowe
Author by

Mark Rowe

Updated on September 18, 2022

Comments

  • Mark Rowe
    Mark Rowe over 1 year

    How can I get Windows Photo Viewer to run in Safe Mode? I'm running Microsoft Windows 7.

    Screenshot

    • yiwei
      yiwei over 10 years
      Can't you just navigate to the photo viewer application file and run it?
    • yiwei
      yiwei over 10 years
      Ahh 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
    Mark Rowe about 9 years
    Hi thanks for your help here but i can't find my relevant Offset.