[Wine-patches] [eterhack eter-2.0.0 1/2] kernel32: Hack for starting LicenceServer (eterbug #7400).

Alexander Morozov amorozov на etersoft.ru
Пн Май 21 18:14:25 MSK 2012


---
 dlls/kernel32/virtual.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/virtual.c b/dlls/kernel32/virtual.c
index bddd638..b111592 100644
--- a/dlls/kernel32/virtual.c
+++ b/dlls/kernel32/virtual.c
@@ -42,6 +42,8 @@
 #include "psapi.h"
 #include "wine/exception.h"
 #include "wine/debug.h"
+#define ETERCHECK
+#include "wine/etersoft.h"
 
 #include "kernel_private.h"
 
@@ -238,7 +240,18 @@ BOOL WINAPI VirtualProtect( LPVOID addr, SIZE_T size, DWORD new_prot, LPDWORD ol
 BOOL WINAPI VirtualProtectEx( HANDLE process, LPVOID addr, SIZE_T size,
     DWORD new_prot, LPDWORD old_prot )
 {
-    NTSTATUS status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot );
+    NTSTATUS status;
+
+    if (size == 4 && etercheck_process_name( "LicenceServer.exe" ))
+    {
+        HMODULE kernel32;
+
+        GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+                            (LPCWSTR)DeviceIoControl, &kernel32 );
+        if (GetProcAddress( kernel32, "DeviceIoControl" ) == addr)
+            return FALSE;
+    }
+    status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot );
     if (status) SetLastError( RtlNtStatusToDosError(status) );
     return !status;
 }
-- 
1.7.9.7



Подробная информация о списке рассылки Wine-patches