Alexandre Julliard : ntdll: Check for DLL files when creating new processes.

Alexandre Julliard julliard at winehq.org
Tue Apr 6 15:50:12 CDT 2021


Module: wine
Branch: master
Commit: 89db25afda90d1d5d57787398ba80fcf4f5abb5f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=89db25afda90d1d5d57787398ba80fcf4f5abb5f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr  6 12:24:38 2021 +0200

ntdll: Check for DLL files when creating new processes.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50912
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/env.c     | 6 +++++-
 dlls/ntdll/unix/process.c | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index ab2e828dacd..5b4a2254659 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -1917,7 +1917,11 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params(void)
     env[env_pos++] = 0;
 
     status = load_main_exe( NULL, main_argv[1], curdir, &image, &module, &image_info );
-    if (!status && image_info.Machine != current_machine) status = STATUS_INVALID_IMAGE_FORMAT;
+    if (!status)
+    {
+        if (image_info.ImageCharacteristics & IMAGE_FILE_DLL) status = STATUS_INVALID_IMAGE_FORMAT;
+        if (image_info.Machine != current_machine) status = STATUS_INVALID_IMAGE_FORMAT;
+    }
 
     if (status)  /* try launching it through start.exe */
     {
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c
index b020e15eaee..54410261c91 100644
--- a/dlls/ntdll/unix/process.c
+++ b/dlls/ntdll/unix/process.c
@@ -365,6 +365,7 @@ static NTSTATUS get_pe_file_info( UNICODE_STRING *path, HANDLE *handle, pe_image
         }
         SERVER_END_REQ;
         NtClose( mapping );
+        if (info->image_charact & IMAGE_FILE_DLL) return STATUS_INVALID_IMAGE_FORMAT;
     }
     else if (status == STATUS_INVALID_IMAGE_NOT_MZ)
     {




More information about the wine-cvs mailing list