Moving to Vista
-
I'm having a bit of trouble getting my c# app to work on Vista. There is some data my app must store that is common to all users of the machine. In the past, I just stuck that information in the registry. In Vista, however, the keys I try to stick in the registry end up in a "virtual store" rather than where I tried to put them. The problem is that while the location I request is under the HKEY_LOCAL_MACHINE root, the virtual store is under the HKEY_CURRENT_USER root, so the data is no longer common to all users. Any advice on how to proceed? I'd prefer a solution that didn't involve popping up a Window begging the user for extra rights, since it's vital that this functions regardless of the way a user might respond in such a popup. Thank you!
-
I'm having a bit of trouble getting my c# app to work on Vista. There is some data my app must store that is common to all users of the machine. In the past, I just stuck that information in the registry. In Vista, however, the keys I try to stick in the registry end up in a "virtual store" rather than where I tried to put them. The problem is that while the location I request is under the HKEY_LOCAL_MACHINE root, the virtual store is under the HKEY_CURRENT_USER root, so the data is no longer common to all users. Any advice on how to proceed? I'd prefer a solution that didn't involve popping up a Window begging the user for extra rights, since it's vital that this functions regardless of the way a user might respond in such a popup. Thank you!
Vista doesn't allow user apps to store stuff in the registry. The data is stored in the user's app folder. I don't know what hoops you have to go through to make data available to everyone that uses a given machine. Have you tried google? -- modified at 17:35 Thursday 18th October, 2007 This should get you started... http://www.computerperformance.co.uk/vista/vista_appdata.htm[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
Vista doesn't allow user apps to store stuff in the registry. The data is stored in the user's app folder. I don't know what hoops you have to go through to make data available to everyone that uses a given machine. Have you tried google? -- modified at 17:35 Thursday 18th October, 2007 This should get you started... http://www.computerperformance.co.uk/vista/vista_appdata.htm[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001Thanks! The folders discussed by that guy are per-user, but it was still a good direction for me to start looking in as you suggested. After poking around more deeply it appears that one can get a common folder to dump data into with the following command: string dataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Path.DirectorySeparatorChar + myCompanyName; Of course if anyone knows of a better place to dump per-machine data, please let me know! Thanks again!
-
Thanks! The folders discussed by that guy are per-user, but it was still a good direction for me to start looking in as you suggested. After poking around more deeply it appears that one can get a common folder to dump data into with the following command: string dataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Path.DirectorySeparatorChar + myCompanyName; Of course if anyone knows of a better place to dump per-machine data, please let me know! Thanks again!
AFAIK that is the right place, not just for Vista, as MSDN describes it: "CommonApplicationData: The directory that serves as a common repository for application- specific data that is used by all users " :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
I'm having a bit of trouble getting my c# app to work on Vista. There is some data my app must store that is common to all users of the machine. In the past, I just stuck that information in the registry. In Vista, however, the keys I try to stick in the registry end up in a "virtual store" rather than where I tried to put them. The problem is that while the location I request is under the HKEY_LOCAL_MACHINE root, the virtual store is under the HKEY_CURRENT_USER root, so the data is no longer common to all users. Any advice on how to proceed? I'd prefer a solution that didn't involve popping up a Window begging the user for extra rights, since it's vital that this functions regardless of the way a user might respond in such a popup. Thank you!
Use the SHGetSpecialFolderPath() api call with the nFolder parameter set to either: For per user app data (e.g. C:\Documents and Settings\username\Application Data) CSIDL_APPDATA or for app data common to all users (e.g. C:\Documents and Settings\All Users\Application Data) CSIDL_COMMON_APPDATA regards,
Jonathan Wilkes Darka[Xanya.net]
-
Thanks! The folders discussed by that guy are per-user, but it was still a good direction for me to start looking in as you suggested. After poking around more deeply it appears that one can get a common folder to dump data into with the following command: string dataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Path.DirectorySeparatorChar + myCompanyName; Of course if anyone knows of a better place to dump per-machine data, please let me know! Thanks again!
-
Vista doesn't allow user apps to store stuff in the registry. The data is stored in the user's app folder. I don't know what hoops you have to go through to make data available to everyone that uses a given machine. Have you tried google? -- modified at 17:35 Thursday 18th October, 2007 This should get you started... http://www.computerperformance.co.uk/vista/vista_appdata.htm[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001John, nice article and site. Thanks. :) Flynn
If we can't corrupt the youth of today,
the adults of tomorrow will be no fun...