Running Image Viewer from Windows XP on Modern Windows
I have a folder with old pictures that I collected in zero. I transfer from computer to computer along with all my files with each upgrade, occasionally I go to notify me. But each time I was a little embarrassed that the standard Windows 7 viewer did not show GIF animation, although my memory told me that during the time of XP the animation was shown without problems. During the next attack of nostalgia, I decided to launch the viewer from XP on Windows 7. After overcoming a number of obstacles, I am now sure that GIF-animation was really supported there! And most importantly - now I can watch my old folder with pictures in the authentic Windows XP Image Viewer interface, which creates a more suitable atmosphere =)
Download: shimgvw_xp32.7z (includes the binary and launcher source code, plus shimgvw.dll from English-language Windows XP SP3).
The standard image viewer in Windows XP is not a regular application. It is located in the shimgvw.dll library, and you cannot start it directly - you need at least rundll32 (the path to the existing image file is required):
But this trick does not work when you try to run shimgvw.dll from Windows XP to Windows 7 and newer - shimgvw.dll cannot boot, it needs compatibility mode with Windows XP to work correctly. This can be achieved by setting the appropriate compatibility mode for the rundll32 copy, but compatibility with XP implies raising the application rights to maximum, which causes the appearance of the UAC dialog at each launch, which we would like to avoid.
A small dance with the debugger made it possible to find out the reason - during the boot process, shimgvw.dll subsequently tries to import several functions from shunimpl.dll, where obsolete shell functions are stored, and the latter refuses to load by default if ATOM "FailObsoleteShellAPIs" is missing (this ATOM allows loading the library , but then all obsolete functions simply return an error code). XP compatibility mode, among other things, installs this ATOM, so the viewer starts up.
It was decided to write a small loader that adds ATOM "FailObsoleteShellAPIs", asks which picture to open (if the path was not passed in the parameters), and then transfers control to shimgvw.dll. The viewer works fine (i.e., the original task was completed), so I didn’t investigate what old functions are imported from shunimpl.dll and when they are used - apparently, they don’t do anything critical for the viewer to work.
Since to implement the loader, you do not need anything other than a small number of WinAPI functions, I decided to build a project using Clang as an experiment without using runtime (earlier I always used MSVC for such dances). Thus, we have an executable file of 14 kilobytes in size, of which 9 kilobytes was spent on the icon. If someone also likes to do mini-applications without dependencies on non-standard libraries - this project can serve as a small example, as is done with the help of Clang.
Download: shimgvw_xp32.7z (includes the binary and launcher source code, plus shimgvw.dll from English-language Windows XP SP3).
How was this done?
The standard image viewer in Windows XP is not a regular application. It is located in the shimgvw.dll library, and you cannot start it directly - you need at least rundll32 (the path to the existing image file is required):
rundll32 c:\windows\system32\shimgvw.dll,ImageView_Fullscreen c:\test.gif
But this trick does not work when you try to run shimgvw.dll from Windows XP to Windows 7 and newer - shimgvw.dll cannot boot, it needs compatibility mode with Windows XP to work correctly. This can be achieved by setting the appropriate compatibility mode for the rundll32 copy, but compatibility with XP implies raising the application rights to maximum, which causes the appearance of the UAC dialog at each launch, which we would like to avoid.
A small dance with the debugger made it possible to find out the reason - during the boot process, shimgvw.dll subsequently tries to import several functions from shunimpl.dll, where obsolete shell functions are stored, and the latter refuses to load by default if ATOM "FailObsoleteShellAPIs" is missing (this ATOM allows loading the library , but then all obsolete functions simply return an error code). XP compatibility mode, among other things, installs this ATOM, so the viewer starts up.
It was decided to write a small loader that adds ATOM "FailObsoleteShellAPIs", asks which picture to open (if the path was not passed in the parameters), and then transfers control to shimgvw.dll. The viewer works fine (i.e., the original task was completed), so I didn’t investigate what old functions are imported from shunimpl.dll and when they are used - apparently, they don’t do anything critical for the viewer to work.
Since to implement the loader, you do not need anything other than a small number of WinAPI functions, I decided to build a project using Clang as an experiment without using runtime (earlier I always used MSVC for such dances). Thus, we have an executable file of 14 kilobytes in size, of which 9 kilobytes was spent on the icon. If someone also likes to do mini-applications without dependencies on non-standard libraries - this project can serve as a small example, as is done with the help of Clang.