Article View: borland.public.cppbuilder.nativeapi
Article #8721Re: Getting admistrator priviliges temporarily
From: Fatih Ekinci
Date: Wed, 29 Sep 2004 09:31
Date: Wed, 29 Sep 2004 09:31
30 lines
1856 bytes
1856 bytes
I really appreciate your help and patience. Here is the code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
HKEY key;
LONG retval;
DWORD myvalue = 3;
retval = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\aaa", NULL,
KEY_WRITE, &key);
if (retval==ERROR_SUCCESS) {
retval = RegSetValueEx(key, "ValueName", 0, REG_DWORD,
(PBYTE)&myvalue, sizeof(myvalue));
if (retval==ERROR_SUCCESS) {
MessageBox (NULL, "RegSetValueEx operation OK!", "Registry
operation", MB_OK);
}
else MessageBox (NULL, "RegSetValueEx operation failed!", "Registry
operation", MB_OK);
}
else MessageBox (NULL, "RegOpenKeyEx operation failed!", "Registry
operation", MB_OK);
RegCloseKey(key);
}
Thanks again!
Fatih
Technical Details
Message-ID:
<415a81cd@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!ecngs!feeder.ecngs.de!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41566608@newsgroups.borland.com> <4156a465$1@newsgroups.borland.com> <415880b8@newsgroups.borland.com> <41592480$1@newsgroups.borland.com> <4159c77b@newsgroups.borland.com> <4159c88d$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f4e17b02ce5b6ff3 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Fatih Ekinci" <fekinci42@ttnet.net.tr> Newsgroups: borland.public.cppbuilder.nativeapi References: <41566608@newsgroups.borland.com> <4156a465$1@newsgroups.borland.com> <415880b8@newsgroups.borland.com> <41592480$1@newsgroups.borland.com> <4159c77b@newsgroups.borland.com> <4159c88d$1@newsgroups.borland.com> Subject: Re: Getting admistrator priviliges temporarily Date: Wed, 29 Sep 2004 12:31:39 +0300 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 81.212.0.176 Message-ID: <415a81cd@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1096450509 81.212.0.176 (29 Sep 2004 02:35:09 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!ecngs!feeder.ecngs.de!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail