Re: How to raise rights...
- From: "Christian Kaiser" <bchk@xxxxxx>
- Date: Thu, 7 Jul 2005 09:35:43 +0200
Eugene,
the code is appended...
When I logon as LOGON_NETWORK, the code issues
ERROR: RegOpenKeyEx() failed: 'Class does not exist. (00000583)'
When I use LOGON_INTERACTIVE instead, no error is issued. So there IS a
difference. LOGON_NETWORK does not let me access the local registry?
Christian
-----------
if (UtilSetupLogonImpersonatedUser(argv[1],argv[2],NULL,"Hallo","Welt",NULL)
== 0) // LogonUser...
{
UtilSetupImpersonateUser(NULL,TRUE); // Impersonate...
{
HKEY hBase;
LONG lRes;
lRes =
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software",0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|KEY_CREATE_SUB_KEY,&hBase);
if (lRes != ERROR_SUCCESS)
{
printf("ERROR: RegOpenKeyEx() failed:
'%s'\n",(LPCTSTR)String::GetLastError());
}
else
{
HKEY hSub;
DWORD dwDisp;
lRes =
RegCreateKeyEx(hBase,"combit",0,"",REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hBase,&dwDisp);
if (lRes != ERROR_SUCCESS)
{
printf("reg create error: '%s'\n",(LPCTSTR)String::GetLastError());
}
else
{
RegCloseKey(hSub);
}
RegCloseKey(hBase);
}
}
UtilSetupImpersonateUser(NULL,FALSE); // RevokeToSelf
UtilSetupLogoffImpersonatedUser(); // CloseHandle
}
"Eugene Gershnik" <gershnik@xxxxxxxxxxx> wrote in message
news:uK8bOWlgFHA.2424@xxxxxxxxxxxxxxxxxxxxxxx
> Christian Kaiser wrote:
>> I cannot use the SSPI login that you suggest, as LOGON_NETWORK does
>> not give me the right to write into HKEY_LOCAL_MACHINE (at least my
>> test say so). Especially when I start an OLE server to register
>> itself ("app.exe /register"), I need LOGON_INTERACTIVE, I guess.
>
> Logon type has (almost) nothing to do with rights. Unless somebody
> specifically denied access to "Network" in a DACL there shouldn't be any
> difference. The simplest check is to use regedit remotely ("Connect
> network
> registry"). If it allows you to change relevant keys the netwrok logon on
> a
> local box should be as good.
> Most likely you had some other kind of problem.
>
>> OK, let me rewrite my question :))) If the admin token is the current
>> token of a thread, and CreateProcess is called in that thread, may I
>> assume the new process inherits that token?
>
> Yes. That's how all these runas, cmdasuser etc. work.
>
> --
> Eugene
> http://www.gershnik.com
>
>
>
>
.
- Follow-Ups:
- Re: How to raise rights...
- From: Eugene Gershnik
- Re: How to raise rights...
- References:
- How to raise rights...
- From: Christian Kaiser
- Re: How to raise rights...
- From: Eugene Gershnik
- Re: How to raise rights...
- From: Christian Kaiser
- Re: How to raise rights...
- From: Eugene Gershnik
- Re: How to raise rights...
- From: Christian Kaiser
- Re: How to raise rights...
- From: Eugene Gershnik
- Re: How to raise rights...
- From: Christian Kaiser
- Re: How to raise rights...
- From: Eugene Gershnik
- How to raise rights...
- Prev by Date: Re: how to read binary data from INI file ?
- Next by Date: Re: How to raise rights...
- Previous by thread: Re: How to raise rights...
- Next by thread: Re: How to raise rights...
- Index(es):
Relevant Pages
|