Hello,i am writting a driver,and i used installshield V6.1,in it i write
some code to remove registry information,i did in Win98,but in WIN2K or
WinXP,it cann’t be leted.How can i do?
Thanks!
Some of the Keys needs Admin Priv.
Are you deleting HKLM*…
Try this
void DeleteWithinKey(HKEY hKey) {
DWORD vlen, typ;
int rv;
TCHAR name[256];
do{
vlen = sizeof(name);
rv = RegEnumValue(hKey, 0, name, &vlen, 0, &typ, NULL, NULL);
if(rv == ERROR_SUCCESS) {
RegDeleteValue(hKey,name);
}
} while(rv == ERROR_SUCCESS);
for(; {
vlen = sizeof(name);
rv = RegEnumKeyEx(hKey,0,name,&vlen, 0,NULL,NULL,NULL);
if(rv != ERROR_SUCCESS) break;
HKEY h;
rv = RegOpenKeyEx(hKey,name,0, KEY_ALL_ACCESS,&h);
if(rv == ERROR_SUCCESS) {
DeleteWithinKey(h);
RegCloseKey(h);
}
RegDeleteKey(hKey,name);
}
}; // end DeleteWithinKey
Win9x would let you just delete the high key and it does the enumeration,
but NT based systems require you to go ‘down’ to each level and delete it
yourself.
Regards,
Chuck
mailto:xxxxx@cleanreg.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@sunplus.com.cn
Sent: Saturday, September 28, 2002 12:51 AM
To: NT Developers Interest List
Subject: [ntdev] ??: [ntdev] Re: Who can tell me how to delete
registry information in Win2K/XP