diff options
author | George Hazan <ghazan@miranda.im> | 2019-12-11 20:50:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-12-11 20:50:32 +0300 |
commit | c4b49b47f845eb7db6f80f1f1fa313f0ec592279 (patch) | |
tree | bb8530ff9b272d2ef6a0c6a4356b104a282b899a | |
parent | 06038dc1d0e03adb40777d13656e82efe9045e84 (diff) |
code cleaning
-rw-r--r-- | libs/libmdbx/src/src/elements/osal.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libs/libmdbx/src/src/elements/osal.c b/libs/libmdbx/src/src/elements/osal.c index 33fead5005..ae99fa05bb 100644 --- a/libs/libmdbx/src/src/elements/osal.c +++ b/libs/libmdbx/src/src/elements/osal.c @@ -1750,14 +1750,7 @@ static uint64_t windows_bootime(void) { typedef LSTATUS (APIENTRY *pfnRegGetValueW)(HKEY, LPCWSTR, LPCWSTR, DWORD, LPDWORD, PVOID, LPDWORD); static pfnRegGetValueW fnRegGetValueW = nullptr; -static LSTATUS APIENTRY stubRegGetValueW( - HKEY hkey, - LPCWSTR lpSubKey, - LPCWSTR lpValue, - DWORD dwFlags, - LPDWORD pdwType, - PVOID pvData, - LPDWORD pcbData) +static LSTATUS APIENTRY stubRegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData) { HKEY tmp; LSTATUS rc = RegOpenKeyW(hkey, lpSubKey, &tmp); @@ -1766,6 +1759,11 @@ static LSTATUS APIENTRY stubRegGetValueW( DWORD dwType = (dwFlags == RRF_RT_ANY) ? REG_SZ : REG_DWORD; rc = RegQueryValueExW(tmp, lpValue, 0, &dwType, pvData, pcbData); + if (rc != 0 && dwFlags == RRF_RT_DWORD) { + rc = 0; + *(DWORD *)pvData = 0xBABAEBA; + *pcbData = sizeof(DWORD); + } RegCloseKey(tmp); return rc; } @@ -1779,8 +1777,7 @@ static LSTATUS mdbx_RegGetValue(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, fnRegGetValueW = stubRegGetValueW; } - LSTATUS rc = - fnRegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData); + LSTATUS rc = fnRegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData); if (rc != ERROR_FILE_NOT_FOUND) return rc; |