Results 1 to 3 of 3

Thread: [vb6] Patch Icon/Cursor Resource File Entries

Hybrid View

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width