|
-
Oct 15th, 2017, 07:49 PM
#1
Re: [vb6] Patch Icon/Cursor Resource File Entries
Just FYI. The Icon Directory Entry within a resource is slightly different than what you'd see in an icon/cursor file. In a resource the structure is 14 bytes whereas in a file, it is 16 bytes. And the content between the two is also a bit different.
Resource Icons 14 byte structure
1 byte for width (actual)
1 byte for height (actual)
1 byte for color count
1 reserved byte
2 bytes for planes
2 bytes for bit count/depth
4 bytes for image data size
2 bytes for a numerical ID
Resource Cursors 14 byte structure
2 bytes for width (actual)
2 bytes for height (actual height doubled)
2 bytes for planes
2 bytes for bit count/depth
4 bytes for image data size
2 bytes for a numerical ID
Icon/Cursor File 16 byte structure
1 byte for width (actual)
1 byte for height (actual)
1 byte for color count
1 reserved byte
2 bytes for planes (icons) else 2 bytes for cursor X hotspot
2 bytes for bit count/depth (icons) else 2 bytes for cursor Y hotspot
4 bytes for image data size
4 bytes for offset into file where image data starts
The only thing I am not 100% sure on is whether cursors greater than 255 pixels would be entered in the structure as 256+ or 0 as is the case with icons. Since 256x256 and larger cursors are not commonplace, kinda hard to find a true example. If I can find such a credible example, the attached project may need to be tweaked for that specific case.
Edited: Wrote a quick script to process all binaries in the system32 folder. Found two dlls, ExplorerFrame.dll & comctl32.dll, that have cursors of 128x128. The heights (doubled) were written as 256, not zero. I tweaked the attached project to write large cursors using the same logic.
Last edited by LaVolpe; Oct 21st, 2017 at 03:19 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|