[ Moderator’s Note: Follow the instructions below at your own risk. While they shouldn’t cause any issues if followed properly, no official support will be provided for any such user-modified EXE. The last official Sumatra PDF version for WinXP is 3.1.2. ]
Hello,
I just registered here to show you how to binary-hack Sumatra PDF 3.2 in its portable version to work on Windows XP and Server 2003. That includes the 64-bit version in regards to Windows XP x64 and Windows Server 2003 x64. This might not be interesting for 99% of the user base, but I still wanted to share this.
First, you’ll need NTCore’s CFF Explorer. That’s what we’ll use to modify the PE32/PE32+ header of the program to change the header properties “MajorSubsystemVersion” and “MinorSubsystemVersion”, which correspond to the NT kernel version. Also, we’ll use it to modify the load-time DLL import table of the binary program to hard-remove a dependency on d2d1.dll (this part is essentially software vandalism!).
d2d1.dll is some kind of glue-layer library to make Direct2D work on modern systems, or at least I suspect it to be. I’m not sure. Since we don’t need such a thing on XP, ripping the link to its exported symbols out forcefully might work, right?
Open up CFF Explorer and load SumatraPDF-3.2-64.exe or SumatraPDF-3.2-32.exe into it, depending on whether it’s 32 or 64-bit XP/2003 you wanna run it on. Click on the “Optional Header” thing under “NT Headers”, see here:
Here you can see, that the MajorSubsystemVersion is 0005, with the MinorSubsystemVersion being 0002 (already modified!). That corresponds to Windows Server 2003 or XP x64, which run on the Windows NT 5.2 kernel. 32-bit XP would need 0005 and 0001 here (NT 5.1). This will be set to 0006 and 0000 by default (Windows NT 6.0, which means Win Vista). Modify it to match your target platform. Keep the leading zeroes!
Now, click on the “Import Directory” folder. This is the load-time DLL import table. So, the table that specifies which DLLs the program should load and which functions to import from them at load-time (=when you start the program). Find d2d1.dll, right-click it, and pick “Delete Import Descriptor”:
Now click save, and confirm to overwrite the .exe.
Congratulations, you have just vandalized a beautiful piece of software. That concludes the hack, nothing else is needed, at least not for version 3.2:
Cheers!