|
-
December 6th, 2003, 06:15 AM
#1
Reading value from registry
Hi,
My application reads the ProxyServer string value from registry. When I run it directly, by clicking the exe, it works.
But when I run the application as a process that spawns from a service it is not querying values from registry.
RegOpenKeyEx works but RegQueryValueEx is not working and
FormatMessage gives "operation completed successfully".
Why?
-
December 6th, 2003, 12:29 PM
#2
What is the exact registry key and value you are trying to read?
How is the app spawned by the service?
What are the credentials used by the service?
Perhaps you could also post the code in question.
Thought for the day/week/month/year:
Windows System Error 4006:
Replication with a nonconfigured partner is not allowed.
-
December 6th, 2003, 01:51 PM
#3
Well...post the code snippet.
In addition, you might want to take a look at the following FAQs:
-
December 7th, 2003, 12:12 PM
#4
Originally posted by vicodin451
What is the exact registry key and value you are trying to read?
How is the app spawned by the service?
What are the credentials used by the service?
Perhaps you could also post the code in question.
Registry 'String Value' I'm querying is "ProxyServer".
The value will be in the format ipaddress ortnumber.
I'm using CreateProcess to start Host.exe from a service program.
The code for createprocess is below:
-----------------------------------------------------
STARTUPINFO sinfo;
memset (&sinfo, 0, sizeof(sinfo));
char* cCmdLine = new char[MAX_PATH+1];
sinfo.cb = sizeof(STARTUPINFO);
sinfo.lpReserved = NULL;
sinfo.lpDesktop = TEXT("WinSta0\\Default");
sinfo.lpTitle =NULL;
sinfo.dwFlags = STARTF_RUNFULLSCREEN|STARTF_USESHOWWINDOW;
sinfo.cbReserved2 = 0;
sinfo.lpReserved2 = NULL;
sinfo.wShowWindow = SW_SHOW;
CreateProcess("e:\\a\\host.exe",
NULL,
NULL,
NULL,
TRUE,
CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&sinfo,
&pinfo);
----------------------------------
-
December 7th, 2003, 06:10 PM
#5
Double-check and ensure you are using GetLastError properly to ensure you are getting the relevant error code. You might actually be getting an Access Denied error.
Services run using a login that has restricted access. Probably the service does not have access to the registry key. Find the documentation of services that describes the access that services get by default and how to modify that and/or how to grant access to the service to the registry as needed.
Last edited by Sam Hobbs; December 7th, 2003 at 06:12 PM.
-
December 11th, 2003, 06:46 AM
#6
Originally posted by Sam Hobbs
Find the documentation of services that describes the access that services get by default and how to modify that and/or how to grant access to the service to the registry as needed.
From where can I get the documentation for granting access to the service to the registry?
Last edited by joscollin; December 11th, 2003 at 06:48 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|