locked
Security with CreateProcess() RRS feed

  • Question


  • I have an installation program that copys a single executable file into a directory that the user chooses and creates a shortcut to that executable.  It thens asks the user if they want to launch the executable to save them the step of finding and clicking the shortcut.  This executable will copy more files from a network service into the directory the user chose.

    This works fine except that the security settings on the files it saves are different depending on whether the user ran the program directly from the installation program or whether they run the executable separately from the shortcut.  When running from the installation program (through a CreateProcess() call), the executable copies its files from the network service properly, but sets the security of the files can't be overwritten by a later run of the executable.  When running from the shortcut, the security is set correctly so the files it saves can be overridden.

    I suspect that I need to do something with the SecurityAttributes flags on my CreateProcess call so that it can write files with correct security, but I can't find references for how to set this.  Here are some more details that may help:

    1) This happens on Windows 7 and I think it happens on Vista with UAC enabled.
    2) When the installation program is run, it correctly prompts the user to confirm that they want to allow the program to make changes to the computer.  It just doesn't seem that that authority is transferred to the program that is run using CreateProcess().
    3) The program run from CreateProcess can write files, it just sets the security on those files differently than if the user had run the program themselves.
    4) I have even tried specifically setting the security attributes of the files that are created.  This seems to be ignored when run from CreateProcess().

    Any ideas?

    Thanks,
    Jason
    Wednesday, December 2, 2009 6:22 PM

All replies

  • Hi,

    In which language do you do this?
    C# or native Win32 C++?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Saturday, January 2, 2010 3:26 PM