none
EndUpdateResource() changes the permissions of the executable at hUpdate RRS feed

  • Question

  • I have created a simple executable which was compiled with an RC file (containing the version information for the application, for example 1.0.0.1). As a second step I wanted to be able to change the version of the executable without needing to change the values in the RC file and recompile the original executable.

    Some digging through Win32 APIs showed that GetFileVersionInfo(), BeginUpdateResource(), UpdateResource() and EndUpdateResource() can be used for what I am trying to achieve. I have managed to successfully change the version information of my executable by using the above functions but one peculiarity was noted: the permissions of the executable are changed if EndUpdateResource() is made not to discard the changes.

    My computer is part of a domain and I am logged in using my domain profile, so files in my profile have some permissions related to the domain (for example, users in my domain have Read & Execute permissions on my original executable). When EndUpdateResource() is executed with fDiscard = FALSE all domain permissions are removed and only three permissions in the executable remain: SYSTEM, local administrators and an entry for my user.

    Is this behavior expected, can it cause any problems, is it a well-known bug or should I just stray away from using these APIs to change the version information of a compiled executable?

    Tuesday, May 28, 2013 2:01 PM

All replies

  • Thank you for your reply. No additional software was installed, in fact the project in your post does not change the permissions of the file.

    The most annoying part is that even if I don't change anything in the the version of the executable and just make a simple program with BeginUpdateResource() and EndUpdateResource(handle, FALSE), the permissions still get changed.


    • Edited by CSMCMXL Wednesday, May 29, 2013 8:50 AM
    Wednesday, May 29, 2013 8:47 AM