14 August 2020
Adobe Photoshop 7 might be a million years old, but I still find it useful to touch up scanned images. That's all well and good, but annoyingly it gets upset if you have a hard disk bigger than it expects.
With at least 1TB available on a 2TB disk.
There must be some sort of 48-bit truncation within Photoshop 7, because it uses the Windows API GetDiskFreeSpaceEx, and that reports plenty of free space. Fed up with copying images to other disks and back just to make it work, I wondered if I could insert some sort of shim between Photoshop and the API to cap it at a smaller figure.
I created a new DLL project, and exported my own WINAPI GetDiskFreeSpaceExA with the same parameters. It passed the arguments to the real GetDiskFreeSpaceExA, and checked that the result wasn't bigger than 2GB. If so, they were capped. The values were then returned.
I intended to put it in Photoshop's program folder and redirect the call to the kernel, but there was a problem. Trying to shim kernel32.dll won't work - it is protected from DLL redirection, even if a .local file is used.
Fortunately, it was possible to modify the Import Address Table to use the call from my DLL instead. The program IAT AutoPatcher made this a piece of cake. Saved and done.
Now anytime I attempt to save with Photoshop, it works as expected. Yay!
© Andrew Nile 2018-2024. Privacy