Why windows 7 is rubbish
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Isn't it possible (during installation) to set the access level of a key? So that anyone can read/write the HKLM key without interacting with UAC?
Best wishes, Hans
-
Isn't it possible (during installation) to set the access level of a key? So that anyone can read/write the HKLM key without interacting with UAC?
Best wishes, Hans
That's a good question, I guess I should look at my installer package to see if it supports that. Is such a setting permanent, because in my case, someone could install, and run the registration app later. My big fear would be that trying to do this, might cause the installer to just not run at all.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Can the key be deployed out as an MSI via the group policy? I think they run as the SYSTEM user.
-
That's a good question, I guess I should look at my installer package to see if it supports that. Is such a setting permanent, because in my case, someone could install, and run the registration app later. My big fear would be that trying to do this, might cause the installer to just not run at all.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I believe you can change the access level later, but I don't know what privilege you would need. I'm pretty sure setting the access level at install time would solve your problem.
Best wishes, Hans
-
I believe you can change the access level later, but I don't know what privilege you would need. I'm pretty sure setting the access level at install time would solve your problem.
Best wishes, Hans
If an msi can do that, without having to right click and run as admin, then that seems counter intuitive to me, given that my app can't. If there's a way I can test for every possible Windows 7 configuration to make sure my users can use the msi, then I'll probably do it, but it worries me, because it's all obviously flaky to start with.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
If an msi can do that, without having to right click and run as admin, then that seems counter intuitive to me, given that my app can't. If there's a way I can test for every possible Windows 7 configuration to make sure my users can use the msi, then I'll probably do it, but it worries me, because it's all obviously flaky to start with.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I can't access MSDN right now, but I believe there are exceptions made for installers.
Best wishes, Hans
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
In C#, the code throws an exception indicating insufficient access rights if I try to write to LocalMachine
FTFY (I assume)
FILETIME to time_t
| FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy -
If an msi can do that, without having to right click and run as admin, then that seems counter intuitive to me, given that my app can't. If there's a way I can test for every possible Windows 7 configuration to make sure my users can use the msi, then I'll probably do it, but it worries me, because it's all obviously flaky to start with.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
what installer are you using? I know that NSIS can do this with a simple "RequestExecutionLevel admin" at the top. scratch that, I misread the suggestion. However, with my dealings in C++, I know that my app certainly gets errors in Vista/Weven when I try to write or read from a registry setting the user doesn't have access to.
-
If an msi can do that, without having to right click and run as admin, then that seems counter intuitive to me, given that my app can't. If there's a way I can test for every possible Windows 7 configuration to make sure my users can use the msi, then I'll probably do it, but it worries me, because it's all obviously flaky to start with.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
but it worries me, because it's all obviously flaky to start with
I understand your concern, but in this particular case I think it works well. This technique is what stopped the rioting of the UAC wars. :)
Best wishes, Hans
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
:sigh: Time to use Unix or Apple and let let me tell you, you'll be begging to come back. In windows YOU CAN NOT write to local machine unless you are Admin, this is by design and a security feature to stop malicous code.
-
That's a good question, I guess I should look at my installer package to see if it supports that. Is such a setting permanent, because in my case, someone could install, and run the registration app later. My big fear would be that trying to do this, might cause the installer to just not run at all.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
You'd still have to run 'As Administrator' when launching the install program.
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Wouldn't you have the same issue logged in as a limited XP user? I'm pretty sure you can't write to HKLM in that case either.
-
You'd still have to run 'As Administrator' when launching the install program.
Then it's useless. I tried creating a manifest that runs as admin and it did not help.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Wouldn't you have the same issue logged in as a limited XP user? I'm pretty sure you can't write to HKLM in that case either.
Well, I guess it's possible, although not common, for an XP machine to be locked down so that software needs to be installed again for each user.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Christian Graus wrote:
but it worries me, because it's all obviously flaky to start with
I understand your concern, but in this particular case I think it works well. This technique is what stopped the rioting of the UAC wars. :)
Best wishes, Hans
No, it does not work. The msi ran fine, but I still can't write to that key.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, I guess it's possible, although not common, for an XP machine to be locked down so that software needs to be installed again for each user.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
The registry is evil, don't use it.
-
Well, I guess it's possible, although not common, for an XP machine to be locked down so that software needs to be installed again for each user.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
We see limited-user XP setups all the time, especially with larger customers who have thousands of desktops (I work in the automotive industry so I'm talking about companies like Mercedes-Benz, BMW, etc.) I don't use the registry any more tbh - I've gone back to using INI files! Much less hassle and easier to support because they can be sent via email and edited by hand without danger of breaking something else.
-
Apparently, the person reading the registry key I need to write, has found that his code works in Weven ( he's in C++ ) and it just writes to CurrentUser instead of LocalMachine. In C#, the code crashes if I try to write to LocalMachine, unless the user right clicks and runs as admin. Not much good for an auto run installer app, or even just a general user app. So, now my app will need to be registered by every user who uses it, or we need to change the registration mechanism.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
That's not new at all; in fact writing to HKLM from a user app has been deprecated behaviour since at least Windows 2000 (along with writing to Program Files etc.). It's just that it wasn't enforced until 2006 when Vista arrived (the redirect to HKCU is for backward compatibility for badly behaved apps). I'm a bit surprised you're only discovering this now, to be honest.
Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"