From 85358f11fd312fb530e39930e8ec278fa3b34449 Mon Sep 17 00:00:00 2001 From: Vitaly Lipatov Date: Fri, 7 Apr 2017 11:16:45 +0300 Subject: [PATCH 2/2] add fast hack for RegQueryValueEx HKEY_PERFORMANCE_DATA (eterbug #11712) To: wine-patches --- dlls/advapi32/registry.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index e32f48a..000ae96 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -37,6 +37,7 @@ #include "winerror.h" #include "winternl.h" #include "winuser.h" +#include "winperf.h" #include "sddl.h" #include "advapi32_misc.h" @@ -1502,6 +1503,41 @@ LSTATUS WINAPI RegQueryValueExW( HKEY hkey, LPCWSTR name, LPDWORD reserved, LPDW (count && data) ? *count : 0 ); if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER; + + /* Etersoft hack (eterbug #11712) */ + if (hkey == HKEY_PERFORMANCE_DATA) { + status = STATUS_SUCCESS; + if (*count < sizeof(PERF_DATA_BLOCK)) { + FIXME("HKEY_PERF ERROR_MORE_DATA: %d but needed %d\n", *count, sizeof(PERF_DATA_BLOCK)); + *count = sizeof(PERF_DATA_BLOCK); + return ERROR_MORE_DATA; + } + { + PERF_DATA_BLOCK *pdb = (PERF_DATA_BLOCK *)data; + LARGE_INTEGER li; + li.QuadPart = 0L; + pdb->Signature[0] = 'P'; + pdb->Signature[1] = 'E'; + pdb->Signature[2] = 'R'; + pdb->Signature[3] = 'F'; + pdb->LittleEndian = 1; /* little endian */ + pdb->Version = 1; + pdb->Revision = 1; + pdb->TotalByteLength = sizeof(*pdb); + pdb->HeaderLength = sizeof(*pdb); + pdb->NumObjectTypes = 0; + pdb->PerfTime = li; + pdb->PerfFreq = li; // can be 0 + pdb->PerfTime100nSec = li; + pdb->SystemNameLength = 0; + pdb->SystemNameOffset = 0; + *count = sizeof(PERF_DATA_BLOCK); + FIXME("PERF_DATA_BLOCK %d\n", *count); + } + return RtlNtStatusToDosError(status); + } + /* END of Etersoft hack */ + if (!(hkey = get_special_root_hkey( hkey, 0 ))) return ERROR_INVALID_HANDLE; RtlInitUnicodeString( &name_str, name ); @@ -1592,6 +1628,41 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWO hkey, debugstr_a(name), reserved, type, data, count, count ? *count : 0 ); if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER; + + /* Etersoft hack (eterbug #11712) */ + if (hkey == HKEY_PERFORMANCE_DATA) { + status = STATUS_SUCCESS; + if (*count < sizeof(PERF_DATA_BLOCK)) { + FIXME("HKEY_PERF ERROR_MORE_DATA: %d but needed %d\n", *count, sizeof(PERF_DATA_BLOCK)); + *count = sizeof(PERF_DATA_BLOCK); + return ERROR_MORE_DATA; + } + { + PERF_DATA_BLOCK *pdb = (PERF_DATA_BLOCK *)data; + LARGE_INTEGER li; + li.QuadPart = 0L; + pdb->Signature[0] = 'P'; + pdb->Signature[1] = 'E'; + pdb->Signature[2] = 'R'; + pdb->Signature[3] = 'F'; + pdb->LittleEndian = 1; /* little endian */ + pdb->Version = 1; + pdb->Revision = 1; + pdb->TotalByteLength = sizeof(*pdb); + pdb->HeaderLength = sizeof(*pdb); + pdb->NumObjectTypes = 0; + pdb->PerfTime = li; + pdb->PerfFreq = li; // can be 0 + pdb->PerfTime100nSec = li; + pdb->SystemNameLength = 0; + pdb->SystemNameOffset = 0; + *count = sizeof(PERF_DATA_BLOCK); + FIXME("PERF_DATA_BLOCK %d\n", *count); + } + return RtlNtStatusToDosError(status); + } + /* END of Etersoft hack */ + if (!(hkey = get_special_root_hkey( hkey, 0 ))) return ERROR_INVALID_HANDLE; if (count) datalen = *count; -- 2.10.2