ntdll: Mark native subsystem images as such,
don't allow to execute a driver
Paul Chitescu
paulc at voip.null.ro
Thu Dec 14 13:53:23 CST 2006
Changelog: ntdll: Mark native subsystem images as such, don't allow to execute
a driver.
Identifying native images is also the first step in implementing loading of
drivers.
-------------- next part --------------
--- ./dlls/ntdll/loader.c.orig 7 Dec 2006 20:24:35 -0000 1.144
+++ ./dlls/ntdll/loader.c 14 Dec 2006 19:46:49 -0000
@@ -656,6 +656,11 @@
else p = wm->ldr.FullDllName.Buffer;
RtlInitUnicodeString( &wm->ldr.BaseDllName, p );
+ if (nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE)
+ {
+ wm->ldr.Flags |= LDR_IMAGE_IS_NATIVE;
+ }
+
if (nt->FileHeader.Characteristics & IMAGE_FILE_DLL)
{
wm->ldr.Flags |= LDR_IMAGE_IS_DLL;
@@ -2123,9 +2128,9 @@
/* allocate the modref for the main exe (if not already done) */
wm = get_modref( peb->ImageBaseAddress );
assert( wm );
- if (wm->ldr.Flags & LDR_IMAGE_IS_DLL)
+ if (wm->ldr.Flags & (LDR_IMAGE_IS_DLL|LDR_IMAGE_IS_NATIVE))
{
- ERR("%s is a dll, not an executable\n", debugstr_w(wm->ldr.FullDllName.Buffer) );
+ ERR("%s is a dll or driver, not an executable\n", debugstr_w(wm->ldr.FullDllName.Buffer) );
exit(1);
}
wm->ldr.LoadCount = -1; /* can't unload main exe */
--- ./include/winternl.h.orig 13 Dec 2006 16:04:27 -0000 1.189
+++ ./include/winternl.h 14 Dec 2006 19:46:53 -0000
@@ -2334,6 +2335,7 @@
#define LDR_MODULE_REBASED 0x00200000
/* these ones is Wine specific */
+#define LDR_IMAGE_IS_NATIVE 0x20000000
#define LDR_DONT_RESOLVE_REFS 0x40000000
#define LDR_WINE_INTERNAL 0x80000000
More information about the wine-patches
mailing list