Alexandre Julliard : winedevice: Fix up protections before writing to the NT header.

Alexandre Julliard julliard at winehq.org
Tue Jun 15 13:46:50 CDT 2010


Module: wine
Branch: master
Commit: fe1360252fea60fc0b0fe55635e53aaaf793de99
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fe1360252fea60fc0b0fe55635e53aaaf793de99

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun 15 14:29:25 2010 +0200

winedevice: Fix up protections before writing to the NT header.

---

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

diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index bd65654..e0cd07b 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -100,7 +100,10 @@ static HMODULE load_driver_module( const WCHAR *name )
                 if (!rel) goto error;
             }
             /* make sure we don't try again */
+            size = FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + nt->FileHeader.SizeOfOptionalHeader;
+            VirtualProtect( nt, size, PAGE_READWRITE, &old );
             nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = 0;
+            VirtualProtect( nt, size, old, NULL );
         }
     }
 




More information about the wine-cvs mailing list