Today’s probably the worst day I’ve had for quite some time. I didn’t sleep well last night. I’ve been feeling dizzy since this morning. I haven’t had much appetite for breakfast or lunch. And yet, today I finally resolved the problem that’s been bugging me for at least two weeks. How ironic !
To replace the logon screen, LogonSwitcher is modifying several images in resource dlls (I’m preparing an article on that). Some of the images in those resources are stored as “Image” resources and others as “Bitmap” resources. The first kind is easy to replace. Just open the file, map the contents and copy the bits to the resource. Done ! But the latter is a little bit more complicated.
You can have store several formats in “Bitmap” resources. The two I’m using are BMP and PNG. BMP are easy, you just have to remove the header and copy the contents of the file to the resource. But with PNG files, that doesn’t work…
I’ve been trying to make it work for more than a week with no luck, trying several things… What doesn’t help is that I haven’t been able to find any documentation on that precise subject. There is a lot of info on updating resources, but nothing specifically for PNG files. Or at least I couldn’t find it.
Finally, the actual working solution is 23 lines long 🙁 Gahhhhhhhh !
I learned way more that I would have liked about win32 resources, PE, DIB, bitmaps formats. Not that there is anything wrong with learning new things, but with pure win32 programming, the more you learn about it, the more you realize that you know almost nothing. And that’s discouraging.
PS: if that sounds like incoherent rambling, re-read the first paragraph 🙂