[Wine-patches] winedevice: Prevent crash (eterbug #3223).

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Пт Янв 30 15:17:37 MSK 2009


----------- следующая часть -----------
From 01c8ce484b088e88343a8c2c262104f1b95de4fd Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Fri, 30 Jan 2009 14:36:38 +0300
Subject: [PATCH] winedevice: Prevent crash (eterbug #3223).

---
 programs/winedevice/device.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index 27461f9..83c0b92 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -94,6 +94,8 @@ static HMODULE load_driver_module( const WCHAR *name )
 
         if ((rel = RtlImageDirectoryEntryToData( module, TRUE, IMAGE_DIRECTORY_ENTRY_BASERELOC, &size )))
         {
+            DWORD *dir_ptr;
+
             WINE_TRACE( "%s: relocating from %p to %p\n",
                         wine_dbgstr_w(name), (char *)module - delta, module );
             end = (IMAGE_BASE_RELOCATION *)((char *)rel + size);
@@ -107,7 +109,10 @@ static HMODULE load_driver_module( const WCHAR *name )
                 if (!rel) goto error;
             }
             /* make sure we don't try again */
-            nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = 0;
+            dir_ptr = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
+            VirtualProtect( dir_ptr, sizeof(*dir_ptr), PAGE_READWRITE, &old );
+            *dir_ptr = 0;
+            VirtualProtect( dir_ptr, sizeof(*dir_ptr), old, NULL );
         }
     }
 
-- 
1.6.0.2.GIT



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