-
December 22nd, 2009, 04:52 AM
#1
[RESOLVED] CRegKey::RecursiveDeleteKey() issue
I'm trying a recursive deleting using RecursiveDeleteKey() from CRegKey ATL class. I succeed to get the HKEY valid handler and then using the same path for recursive delete.
Code:
if(RegOpenKeyEx(key, szSubKey, 0, dwAccess, &hKey) == ERROR_SUCCESS)
{
CRegKey key;
key.Attach(hKey);
LONG lRes = key.RecurseDeleteKey(szSubKey);
if (ERROR_SUCCESS != lRes)
{
// FAILL!!!
}
}
I don't understand wky hKey is ok from RegOpenKeyEx() runs ok and RecurseDeleteKey() is not ok.
OS is WinXP SP3 x64 and szSubKey it's a HKEY_CURRENT_USER registry path.
-
December 22nd, 2009, 04:59 AM
#2
Re: CRegKey::RecursiveDeleteKey() issue
And what is the Last Errror that you get in case of failure ?
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 05:24 AM
#3
Re: CRegKey::RecursiveDeleteKey() issue
Code:
#define ERROR_FILE_NOT_FOUND 2L
I tried to send the path without the last registry key node and that last key node name to pass to RecursiveDeleteKey().
RecursiveDeleteKey() returned ok but the key was not deleted.
-
December 22nd, 2009, 06:13 AM
#4
Re: CRegKey::RecursiveDeleteKey() issue
So you got the solution ?
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 06:22 AM
#5
Re: CRegKey::RecursiveDeleteKey() issue
Unfortunately, not yet. I'm still searching...
I tried to call DeleteSubKey() for inside subkey but it returns the same error value.
I'll change the thread's title when I'll find the solution and I'll post it here, too.
-
December 22nd, 2009, 06:24 AM
#6
Re: CRegKey::RecursiveDeleteKey() issue
If you have the ATL source code installed, you should be able to debug it inside and see what exactly is failing, can you try stepping inside the RecurseDeleteKey once ?
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 06:26 AM
#7
Re: CRegKey::RecursiveDeleteKey() issue
I did it, too.
That's how I got the name of constant error code.
-
December 22nd, 2009, 06:28 AM
#8
Re: CRegKey::RecursiveDeleteKey() issue
Then what function is failing inside the RecurseDeleteKey ?
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 06:29 AM
#9
Re: CRegKey::RecursiveDeleteKey() issue
What are you passing in dwAccess ?
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 06:38 AM
#10
Re: CRegKey::RecursiveDeleteKey() issue
With other tests even if RecursiveDeleteKey(only_key_name_without_path) returned 0 (ERROR_SUCCESS) the key was not remove (has other subkeys). That's why I try to use DeleteSubKey() too.
Debuging into CRegKey::RecurseDeleteKey() I observed that RegEnumKeyEx() didn't returned ERROR_SUCCESS and didn't entered into that while().
I'll be back later with other news.
-
December 22nd, 2009, 06:38 AM
#11
Re: CRegKey::RecursiveDeleteKey() issue
Originally Posted by Krishnaa
What are you passing in dwAccess ?
I pass KEY_ALL_ACCESS.
-
December 22nd, 2009, 06:59 AM
#12
Re: CRegKey::RecursiveDeleteKey() issue
Can you try isolating the problem in a sample that I can debug in my env ?
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 10:07 AM
#13
Re: CRegKey::RecursiveDeleteKey() issue
There was no issues in my last delete code...
The problem was that after delete operation. That key was regenerated in other project part.
Krishnaa , thanks a lot for your time and energy!
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
|