Skip to content

Commit

Permalink
Use regular RegCloseKey
Browse files Browse the repository at this point in the history
  • Loading branch information
jgajek committed Sep 23, 2016
1 parent a27e4a4 commit 1642caa
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions hook_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "log.h"
#include "config.h"

HOOKDEF(LONG, WINAPI, RegCloseKey,
__in HKEY hKey
) {
LONG ret = Old_RegCloseKey(hKey);
LOQ_zero("registry", "p", "Handle", hKey);
return ret;
}

HOOKDEF(LONG, WINAPI, RegOpenKeyExA,
__in HKEY hKey,
__in_opt LPCTSTR lpSubKey,
Expand Down Expand Up @@ -62,8 +54,8 @@ HOOKDEF(LONG, WINAPI, RegOpenKeyExA,
if (!wcsicmp(keypath, hidden_keys[i])) {
lasterror_t errors;
// clean up state to avoid leaking information
if (ret == ERROR_SUCCESS && phkResult && Old_RegCloseKey) {
Old_RegCloseKey(*phkResult);
if (ret == ERROR_SUCCESS && phkResult) {
RegCloseKey(*phkResult);
*phkResult = saved_hkey;
}
ret = errors.Win32Error = ERROR_FILE_NOT_FOUND;
Expand Down Expand Up @@ -111,8 +103,8 @@ HOOKDEF(LONG, WINAPI, RegOpenKeyExW,
if (!wcsicmp(keypath, hidden_keys[i])) {
lasterror_t errors;
// clean up state to avoid leaking information
if (ret == ERROR_SUCCESS && phkResult && Old_RegCloseKey) {
Old_RegCloseKey(*phkResult);
if (ret == ERROR_SUCCESS && phkResult) {
RegCloseKey(*phkResult);
*phkResult = saved_hkey;
}
ret = errors.Win32Error = ERROR_FILE_NOT_FOUND;
Expand Down Expand Up @@ -629,6 +621,14 @@ HOOKDEF(LONG, WINAPI, RegQueryInfoKeyW,
return ret;
}

HOOKDEF(LONG, WINAPI, RegCloseKey,
__in HKEY hKey
) {
LONG ret = Old_RegCloseKey(hKey);
LOQ_zero("registry", "p", "Handle", hKey);
return ret;
}

HOOKDEF(LONG, WINAPI, RegNotifyChangeKeyValue,
_In_ HKEY hKey,
_In_ BOOL bWatchSubtree,
Expand Down

0 comments on commit 1642caa

Please sign in to comment.