Skip to content

Commit

Permalink
Fix delete key when using CREG_AUTOOPEN flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Majdi Sobain authored and Majdi Sobain committed May 12, 2017
1 parent 3a8f8df commit 1992738
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file modified bin/ring_wincreg.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions creg_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ void CRegistry::OpenParentnDelete(HKEY Rootkey, LPTSTR SubKEy) {
for (int i = _tcslen(SubKEy)-1; i >= 0; i--) {
if ( i == 0 ) {
_tcscpy(sSubKey, SubKEy);
Open(TEXT(""), _hRootKey, KEY_WRITE);
Open(TEXT(""), _hRootKey, KEY_WRITE, true); // *** true added to avoid reset access rights in case of CREG_AUTOOPEN flag usage
SHDeleteKey(hKey, sSubKey);
Close();
break;
Expand All @@ -1416,7 +1416,7 @@ void CRegistry::OpenParentnDelete(HKEY Rootkey, LPTSTR SubKEy) {
_tcsncpy(ParentSubKey, SubKEy, i);
ParentSubKey[i] = 0;
_tcscpy(sSubKey, (SubKEy+i+1));
Open(ParentSubKey, _hRootKey, KEY_WRITE);
Open(ParentSubKey, _hRootKey, KEY_WRITE, true); // *** true added to avoid reset access rights in case of CREG_AUTOOPEN flag usage
SHDeleteKey(hKey, sSubKey);
Close();
break;
Expand Down

0 comments on commit 1992738

Please sign in to comment.