Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TRegistry and CreateKey Problem

Status
Not open for further replies.

dakkarin

Instructor
Nov 11, 2005
76
TR
Hi
I have written a program that needs to add a key under hkey local machine-system-.......
but whatever i try to do i always failed does anyone know is there a way to supress this permission staff or is there a way to add administrator password to tregistry

here is my code


Code:
                AnsiString clientyolu=Application->ExeName;
                reg->RootKey=HKEY_LOCAL_MACHINE;
                reg->OpenKey("System",false);
                reg->OpenKey("CurrentControlSet",false);
                reg->OpenKey("Services",false);
                reg->OpenKey("BelarcClient",false);
                if (!reg->KeyExists("Parameters"))
                {
                        reg->OpenKey("Parameters",true);
                        reg->WriteString("Application",clientyolu);
                }
                else
                {
                        AnsiString hata = "Key Var";
                        Application->MessageBoxA(hata.c_str(),"Hata",MB_OK);
                }
                reg->CloseKey();


Liars Do Not Fear The Truth If There Are Enough Liars
 
Since the registry needs correct permissions to update I suspect that there isn't an easy work-around. Maybe running the program with "RUNAS" might work.


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top