Getting rid of security questions when accessing registry Vista, Win 7 [modified]
-
Dear developers I'm finishing a simple but useful tool and have a serious problem - when I start my app and access windows registry to create value in RUN key or check if already created (for registering my app to startup) in Vista or 7 it always show a "Do you want to allow...to make changes to your computer?" message which must be confirmed. How can I get rid of this confirmation boxes? When I confirm the needs, the app registeres itself into startup but after restart it don't run. The key and value is already in registry. This problem occurs on Win 7 and Vista, XP is fine. I'm writing to hkey_local_machine/software/microsoft/.../run Need I upgrade my compiler to build versions for Vista or Win 7 which can run as Administrator? I'm using my old but legal VC++ ver7 / 2003 and have C++ 2008 Express too. Thank you
modified on Monday, March 8, 2010 9:23 PM
-
Dear developers I'm finishing a simple but useful tool and have a serious problem - when I start my app and access windows registry to create value in RUN key or check if already created (for registering my app to startup) in Vista or 7 it always show a "Do you want to allow...to make changes to your computer?" message which must be confirmed. How can I get rid of this confirmation boxes? When I confirm the needs, the app registeres itself into startup but after restart it don't run. The key and value is already in registry. This problem occurs on Win 7 and Vista, XP is fine. I'm writing to hkey_local_machine/software/microsoft/.../run Need I upgrade my compiler to build versions for Vista or Win 7 which can run as Administrator? I'm using my old but legal VC++ ver7 / 2003 and have C++ 2008 Express too. Thank you
modified on Monday, March 8, 2010 9:23 PM
tibiz wrote:
Need I upgrade my compiler to build versions for Vista or Win 7 which can run as Administrator?
you need to run the EXE as administrator (or at least with elevated permissions). or, turn off the UAC. but don't expect your users to do either.
-
Dear developers I'm finishing a simple but useful tool and have a serious problem - when I start my app and access windows registry to create value in RUN key or check if already created (for registering my app to startup) in Vista or 7 it always show a "Do you want to allow...to make changes to your computer?" message which must be confirmed. How can I get rid of this confirmation boxes? When I confirm the needs, the app registeres itself into startup but after restart it don't run. The key and value is already in registry. This problem occurs on Win 7 and Vista, XP is fine. I'm writing to hkey_local_machine/software/microsoft/.../run Need I upgrade my compiler to build versions for Vista or Win 7 which can run as Administrator? I'm using my old but legal VC++ ver7 / 2003 and have C++ 2008 Express too. Thank you
modified on Monday, March 8, 2010 9:23 PM
Well, the UAC stuff is there SPECIFICALLY to make sure a user gives permission for such activities. Let's assume that your application DoWonderfulThings.exe does something, erm, wonderful. Let's also assume that you have a backdoor to bypass UAC, so wonderful things can happen a lot. eg, an API called
I_Am_Wonderful ()
. Let's also assume that I write an application called DoEvilStuff. What's to stop me telling lies (I am evil, after all) and also using theI_Am_Wonderful ()
API? This sort of control rightly belongs to the user - not to application developers who can't be trusted. If all you are doing is checking if a registry value is already there, open the key with read access, not read and write. If you want to write there, then open the key again with write access, and cope with the warnings. This sort of thing should be done at setup time anyway. Or you could install a service that sits quietly consuming negligible resources, just to act as a background actor for you. Or... But all this stuff should require permission from the user... Did you pay for their machine? Didn't think so. I'm probably a heretic, but I *like* UAC. It forces software writers to shape up, or look bad. My only regret is that it didn't exist earlier. I started 32 bit development and immediately started using HKLM/HKCU properly, and have very rarely hit any security issues. Iain. ps, rant over...I have now moved to Sweden for love (awwww).
-
Well, the UAC stuff is there SPECIFICALLY to make sure a user gives permission for such activities. Let's assume that your application DoWonderfulThings.exe does something, erm, wonderful. Let's also assume that you have a backdoor to bypass UAC, so wonderful things can happen a lot. eg, an API called
I_Am_Wonderful ()
. Let's also assume that I write an application called DoEvilStuff. What's to stop me telling lies (I am evil, after all) and also using theI_Am_Wonderful ()
API? This sort of control rightly belongs to the user - not to application developers who can't be trusted. If all you are doing is checking if a registry value is already there, open the key with read access, not read and write. If you want to write there, then open the key again with write access, and cope with the warnings. This sort of thing should be done at setup time anyway. Or you could install a service that sits quietly consuming negligible resources, just to act as a background actor for you. Or... But all this stuff should require permission from the user... Did you pay for their machine? Didn't think so. I'm probably a heretic, but I *like* UAC. It forces software writers to shape up, or look bad. My only regret is that it didn't exist earlier. I started 32 bit development and immediately started using HKLM/HKCU properly, and have very rarely hit any security issues. Iain. ps, rant over...I have now moved to Sweden for love (awwww).
ok, I disabled any registry checking but my app still won't run at windows startup on Vista and W7 :confused: On XP works properly. Any ideas?
-
tibiz wrote:
Need I upgrade my compiler to build versions for Vista or Win 7 which can run as Administrator?
you need to run the EXE as administrator (or at least with elevated permissions). or, turn off the UAC. but don't expect your users to do either.
no, I can't require from users to turn off the UAC. my app must run at startup like anything other (antivirus, mouse or bluetooth resident, ...). But it won't ...
-
ok, I disabled any registry checking but my app still won't run at windows startup on Vista and W7 :confused: On XP works properly. Any ideas?
Does you application consist of Manifest?
-
Does you application consist of Manifest?
it's without manifests
-
it's without manifests
If application is running under vista or winows 7 it require manifiest to be added. Check out the link [^] A sample Manifest file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Winweb.appname"
type="win32"
/>
<description>Your app description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>level="requireAdministrator" makes the application to be launched with administrative previlages.
-
If application is running under vista or winows 7 it require manifiest to be added. Check out the link [^] A sample Manifest file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Winweb.appname"
type="win32"
/>
<description>Your app description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>level="requireAdministrator" makes the application to be launched with administrative previlages.
the content of manifest file is linked to executabe by linker or must be distributed into the same folder where the app's executable is running from?
-
the content of manifest file is linked to executabe by linker or must be distributed into the same folder where the app's executable is running from?
tibiz wrote:
the content of manifest file is linked to executabe by linker or must be distributed into the same folder where the app's executable is running from?
Since, you are using VS2003, the manifest file can be linked to the executable.
modified on Wednesday, March 10, 2010 12:19 AM