Autostart FAIL

Hello Commulity,
i had my program add itself to the registry.
It creates a text file on its place with ofstream.(C:\)
If you run the application, it creates the file.
But if it is autostarted by the computer, it does not. WHY?

Note: Yes, i have looked up if the process is running properly when the comp starts.
How do you try to write the file: with absolute or relative path?

If it's a relative path it might try to create a file where it is not allowed (missing rights)
Starting with Windows Vista, UAC depreciates lowers the security token for any process that startup automatically (that isn't a service) when a user logs in. This includes entries in "HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Run" etc.

Have your application echo the return value of "GetLastError()" to the console or Event Viewer, I bet you get a '5' back.

EDIT: There is also LUA: http://en.wikipedia.org/wiki/Principle_of_least_privilege so even if the user that is signing in has permissions to write to that drive, the start up process would need to be elevated before it would be able to.
Last edited on
THX coder777, i got it.
Topic archived. No new replies allowed.