PC Review


Reply
Thread Tools Rate Thread

Admin vs Other accounts (XP)

 
 
Micus
Guest
Posts: n/a
 
      5th Dec 2006
Hi All,

I've created a software package. I can install it (for everyone) in the
administrator account and it works great. I then switch to another
non-administrator account and open the application but the program fails to
read any values in the registry. I'm storing the value in the
HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If not,
what root key should I put these values in? This is happening on a Win XP
machine, although I will need to have it install on a 2000 machine as well.

For those who are c++ Win32 savvy, here is the function:

double CRegistry::ReadString(cString strName, double fDefault)
{
HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
cString m_strCurrentPath = "Software\\MyApp\\Settings";
HKEY hKey;
DWORD dwType = REG_SZ;

if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;

if (::RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
&dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;

return fDefault;
}

Thank you - Micus



 
Reply With Quote
 
 
 
 
NewScience
Guest
Posts: n/a
 
      6th Dec 2006
Most users cannot access that key unless Security Permissions are set for
Everyone to READ (at least).
If you want users to be able to copntrol their own environment, READ/WRITE
from HKEY_CURRENT_USER\Software\MyApp\Settings

"Micus" <no@way> wrote in message
news:(E-Mail Removed)...
> Hi All,
>
> I've created a software package. I can install it (for everyone) in the
> administrator account and it works great. I then switch to another
> non-administrator account and open the application but the program fails
> to
> read any values in the registry. I'm storing the value in the
> HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If
> not,
> what root key should I put these values in? This is happening on a Win XP
> machine, although I will need to have it install on a 2000 machine as
> well.
>
> For those who are c++ Win32 savvy, here is the function:
>
> double CRegistry::ReadString(cString strName, double fDefault)
> {
> HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
> cString m_strCurrentPath = "Software\\MyApp\\Settings";
> HKEY hKey;
> DWORD dwType = REG_SZ;
>
> if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
> KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;
>
> if (::RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
> &dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;
>
> return fDefault;
> }
>
> Thank you - Micus
>
>
>



 
Reply With Quote
 
Dave Patrick
Guest
Posts: n/a
 
      6th Dec 2006
Try setting up failure auditing on the local machine hive. Run regedt32.exe
then browse to HKLM, then
Edit|Permissions|Advanced|Auditing|Add|"everyone"|OK then check the "Failed"
box on Full Control, Set Value, Create Subkey, Enumerate Subkey, Delete,
Create Link

Then try again logged on as a normal user. Then check the Event log security
for errors.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Micus" wrote:
> Hi All,
>
> I've created a software package. I can install it (for everyone) in the
> administrator account and it works great. I then switch to another
> non-administrator account and open the application but the program fails
> to
> read any values in the registry. I'm storing the value in the
> HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If
> not,
> what root key should I put these values in? This is happening on a Win XP
> machine, although I will need to have it install on a 2000 machine as
> well.
>
> For those who are c++ Win32 savvy, here is the function:
>
> double CRegistry::ReadString(cString strName, double fDefault)
> {
> HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
> cString m_strCurrentPath = "Software\\MyApp\\Settings";
> HKEY hKey;
> DWORD dwType = REG_SZ;
>
> if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
> KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;
>
> if (::RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
> &dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;
>
> return fDefault;
> }
>
> Thank you - Micus
>
>
>


 
Reply With Quote
 
Micus
Guest
Posts: n/a
 
      6th Dec 2006
Thanks for both of your responses. You've given me a starting point to
finding a solution. I've posted a similar question in the vc.language news
group and the response pointed to using HKEY_CURRENT_USER as well. I wish
there was a 'HKEY_CURRENT_USER\Everyone\Software' key...

Thanks again - Micus


"Micus" <no@way> wrote in message
news:(E-Mail Removed)...
> Hi All,
>
> I've created a software package. I can install it (for everyone) in

the
> administrator account and it works great. I then switch to another
> non-administrator account and open the application but the program fails

to
> read any values in the registry. I'm storing the value in the
> HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If

not,
> what root key should I put these values in? This is happening on a Win XP
> machine, although I will need to have it install on a 2000 machine as

well.
>
> For those who are c++ Win32 savvy, here is the function:
>
> double CRegistry::ReadString(cString strName, double fDefault)
> {
> HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
> cString m_strCurrentPath = "Software\\MyApp\\Settings";
> HKEY hKey;
> DWORD dwType = REG_SZ;
>
> if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
> KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;
>
> if (::RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
> &dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;
>
> return fDefault;
> }
>
> Thank you - Micus
>
>
>



 
Reply With Quote
 
Dave Patrick
Guest
Posts: n/a
 
      7th Dec 2006
You're welcome.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Micus" wrote:
> Thanks for both of your responses. You've given me a starting point to
> finding a solution. I've posted a similar question in the vc.language news
> group and the response pointed to using HKEY_CURRENT_USER as well. I wish
> there was a 'HKEY_CURRENT_USER\Everyone\Software' key...
>
> Thanks again - Micus
>
>
> "Micus" <no@way> wrote in message
> news:(E-Mail Removed)...
>> Hi All,
>>
>> I've created a software package. I can install it (for everyone) in

> the
>> administrator account and it works great. I then switch to another
>> non-administrator account and open the application but the program fails

> to
>> read any values in the registry. I'm storing the value in the
>> HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If

> not,
>> what root key should I put these values in? This is happening on a Win XP
>> machine, although I will need to have it install on a 2000 machine as

> well.
>>
>> For those who are c++ Win32 savvy, here is the function:
>>
>> double CRegistry::ReadString(cString strName, double fDefault)
>> {
>> HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
>> cString m_strCurrentPath = "Software\\MyApp\\Settings";
>> HKEY hKey;
>> DWORD dwType = REG_SZ;
>>
>> if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
>> KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;
>>
>> if (::RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
>> &dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;
>>
>> return fDefault;
>> }
>>
>> Thank you - Micus
>>
>>
>>

>
>


 
Reply With Quote
 
Micus
Guest
Posts: n/a
 
      9th Dec 2006
If anyone's interested,

There were two problems and they weren't easy to find while switching
between accounts and trying to debug code. Opening a key in HKLM, as
implemented in my class using KEY_ALL_ACCESS, will fail when the app is
installed by the admin the called by a non-admin account. Solved this by
adding a GetAccessRights() method which finds the access allowed by the
user. All other registry interaction except the product key was placed in
HKCU. Everything seems to be humming along for now.

Regards,
M

"Dave Patrick" <(E-Mail Removed)> wrote in message
news:6AF05DB2-9C33-4DBF-88D4-(E-Mail Removed)...
> You're welcome.
>
> --
>
> Regards,
>
> Dave Patrick ....Please no email replies - reply in newsgroup.
> Microsoft Certified Professional
> Microsoft MVP [Windows]
> http://www.microsoft.com/protect
>
> "Micus" wrote:
> > Thanks for both of your responses. You've given me a starting point to
> > finding a solution. I've posted a similar question in the vc.language

news
> > group and the response pointed to using HKEY_CURRENT_USER as well. I

wish
> > there was a 'HKEY_CURRENT_USER\Everyone\Software' key...
> >
> > Thanks again - Micus
> >
> >
> > "Micus" <no@way> wrote in message
> > news:(E-Mail Removed)...
> >> Hi All,
> >>
> >> I've created a software package. I can install it (for everyone) in

> > the
> >> administrator account and it works great. I then switch to another
> >> non-administrator account and open the application but the program

fails
> > to
> >> read any values in the registry. I'm storing the value in the
> >> HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If

> > not,
> >> what root key should I put these values in? This is happening on a Win

XP
> >> machine, although I will need to have it install on a 2000 machine as

> > well.
> >>
> >> For those who are c++ Win32 savvy, here is the function:
> >>
> >> double CRegistry::ReadString(cString strName, double fDefault)
> >> {
> >> HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
> >> cString m_strCurrentPath = "Software\\MyApp\\Settings";
> >> HKEY hKey;
> >> DWORD dwType = REG_SZ;
> >>
> >> if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
> >> KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;
> >>
> >> if (::RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
> >> &dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;
> >>
> >> return fDefault;
> >> }
> >>
> >> Thank you - Micus
> >>
> >>
> >>

> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Admin accounts =?Utf-8?B?a3JzOTYxMw==?= Windows XP Help 4 1st Jun 2007 09:43 PM
user accounts not displayed in local groups and user accounts utility in admin tools m2 Windows XP General 2 31st May 2007 05:55 AM
SyncToy and Admin/non-admin accounts =?Utf-8?B?Tmlja0I=?= Windows XP Photos 1 21st Jul 2006 12:51 PM
Rename Computer Accounts using Non-Admin Accounts Mike Windows XP General 0 28th Jun 2004 09:52 PM
Non Admin Accounts Can't Use IE Darren Windows XP Security 6 10th Nov 2003 08:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:16 AM.