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

This commit is contained in:
Alexandre Julliard 2010-06-15 14:29:25 +02:00
parent 903488b354
commit fe1360252f
1 changed files with 3 additions and 0 deletions

View File

@ -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 );
}
}