Alexandre Julliard : makefiles: Don't append .fake extension to fake dlls.

Alexandre Julliard julliard at winehq.org
Mon Nov 22 16:05:16 CST 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Nov 20 13:07:47 2021 +0100

makefiles: Don't append .fake extension to fake dlls.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/loader.c      |  6 ------
 dlls/ntdll/unix/loader.c | 11 +----------
 dlls/setupapi/fakedll.c  | 27 ++++++++-------------------
 tools/makedep.c          | 11 ++++-------
 tools/widl/widl.c        |  2 --
 5 files changed, 13 insertions(+), 44 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index a754579bf54..5cf538f3319 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2788,9 +2788,6 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne
         RtlAppendUnicodeToString( new_name, name );
         status = open_dll_file( new_name, pwm, mapping, image_info, id );
         if (status != STATUS_DLL_NOT_FOUND) goto done;
-        RtlAppendUnicodeToString( new_name, L".fake" );
-        status = open_dll_file( new_name, pwm, mapping, image_info, id );
-        if (status != STATUS_DLL_NOT_FOUND) goto done;
 
         new_name->Length = len;
         RtlAppendUnicodeToString( new_name, L"\\programs\\" );
@@ -2799,9 +2796,6 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne
         RtlAppendUnicodeToString( new_name, name );
         status = open_dll_file( new_name, pwm, mapping, image_info, id );
         if (status != STATUS_DLL_NOT_FOUND) goto done;
-        RtlAppendUnicodeToString( new_name, L".fake" );
-        status = open_dll_file( new_name, pwm, mapping, image_info, id );
-        if (status != STATUS_DLL_NOT_FOUND) goto done;
         RtlFreeUnicodeString( new_name );
     }
 
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 3d26da194e4..00b07edb1f3 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -1720,16 +1720,6 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename,
     SECTION_IMAGE_INFORMATION info;
     enum loadorder loadorder;
 
-    /* remove .fake extension if present */
-    if (image_info->image_flags & IMAGE_FLAGS_WineFakeDll)
-    {
-        static const WCHAR fakeW[] = {'.','f','a','k','e',0};
-        WCHAR *ext = wcsrchr( filename, '.' );
-
-        TRACE( "%s is a fake Wine dll\n", debugstr_w(filename) );
-        if (ext && !wcsicmp( ext, fakeW )) *ext = 0;
-    }
-
     init_unicode_string( &nt_name, filename );
     loadorder = get_load_order( &nt_name );
 
@@ -1742,6 +1732,7 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename,
     }
     else if (image_info->image_flags & IMAGE_FLAGS_WineFakeDll)
     {
+        TRACE( "%s is a fake Wine dll\n", debugstr_w(filename) );
         if (loadorder == LO_NATIVE) return STATUS_DLL_NOT_FOUND;
         loadorder = LO_BUILTIN;  /* builtin with no fallback since mapping a fake dll is not useful */
     }
diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c
index 8ff29fb4f92..a4b8df4dfb4 100644
--- a/dlls/setupapi/fakedll.c
+++ b/dlls/setupapi/fakedll.c
@@ -253,8 +253,7 @@ static int read_file( const WCHAR *name, void **data, SIZE_T *size )
               st.st_size - header_size ) == st.st_size - header_size)
     {
         *data = file_buffer;
-        if ((lstrlenW(name) > 2 && !wcscmp( name + lstrlenW(name) - 2, L"16" )) ||
-            (lstrlenW(name) > 7 && !wcscmp( name + lstrlenW(name) - 7, L"16.fake" )))
+        if (lstrlenW(name) > 2 && !wcscmp( name + lstrlenW(name) - 2, L"16" ))
             extract_16bit_image( nt, data, size );
         ret = 1;
     }
@@ -432,11 +431,11 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
     len = lstrlenW( name );
     if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(L"\\programs") + len + 1;
     while ((path = enum_load_path( i++ ))) maxlen = max( maxlen, lstrlenW(path) );
-    maxlen += ARRAY_SIZE(pe_dir) + len + ARRAY_SIZE(L".fake");
+    maxlen += ARRAY_SIZE(pe_dir) + len + 1;
 
     if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen * sizeof(WCHAR) ))) return NULL;
 
-    pos = maxlen - len - ARRAY_SIZE(L".fake");
+    pos = maxlen - len - 1;
     lstrcpyW( file + pos, name );
     file[--pos] = '\\';
 
@@ -451,8 +450,6 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
         ptr = prepend( ptr, L"\\dlls", 5 );
         ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
         if ((res = read_file( ptr, &data, size ))) goto done;
-        lstrcpyW( file + pos + len + 1, L".fake" );
-        if ((res = read_file( ptr, &data, size ))) goto done;
 
         /* now as a program */
         ptr = file + pos;
@@ -463,8 +460,6 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
         ptr = prepend( ptr, L"\\programs", 9 );
         ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
         if ((res = read_file( ptr, &data, size ))) goto done;
-        lstrcpyW( file + pos + len + 1, L".fake" );
-        if ((res = read_file( ptr, &data, size ))) goto done;
     }
 
     file[pos + len + 1] = 0;
@@ -888,7 +883,7 @@ static void register_fake_dll( const WCHAR *name, const void *data, size_t size,
 }
 
 /* copy a fake dll file to the dest directory */
-static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL delete, struct list *delay_copy )
+static int install_fake_dll( WCHAR *dest, WCHAR *file, BOOL delete, struct list *delay_copy )
 {
     int ret;
     SIZE_T size;
@@ -899,7 +894,6 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL de
     WCHAR *end = name + lstrlenW(name);
     SIZE_T len = end - name;
 
-    if (ext) lstrcpyW( end, ext );
     if (!(ret = read_file( file, &data, &size )))
     {
         *end = 0;
@@ -987,16 +981,11 @@ static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *wildcard,
         {
             lstrcatW( name, L"\\" );
             lstrcatW( name, data.name );
-            if (wcschr( data.name, '.' )) /* module possibly already has an extension */
-            {
-                if (install_fake_dll( dest, file, NULL, delete, &delay_copy )) continue;
-                if (install_fake_dll( dest, file, L".fake", delete, &delay_copy )) continue;
-            }
+            if (wcschr( data.name, '.' ) && install_fake_dll( dest, file, delete, &delay_copy ))
+                continue;
             lstrcatW( name, default_ext );
-            if (install_fake_dll( dest, file, NULL, delete, &delay_copy )) continue;
-            if (install_fake_dll( dest, file, L".fake", delete, &delay_copy )) continue;
         }
-        else install_fake_dll( dest, file, NULL, delete, &delay_copy );
+        install_fake_dll( dest, file, delete, &delay_copy );
     }
     while (!_wfindnext( handle, &data ));
     _findclose( handle );
@@ -1014,7 +1003,7 @@ static BOOL create_wildcard_dlls( const WCHAR *dirname, const WCHAR *wildcard, B
 
     if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(L"\\programs") + 1;
     for (i = 0; (path = enum_load_path(i)); i++) maxlen = max( maxlen, lstrlenW(path) );
-    maxlen += 2 * max_dll_name_len + 2 + ARRAY_SIZE(pe_dir) + 10; /* ".dll.fake" */
+    maxlen += 2 * max_dll_name_len + 2 + ARRAY_SIZE(pe_dir) + 10; /* ".dll" */
     if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen * sizeof(WCHAR) ))) return FALSE;
 
     if (!(dest = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(dirname) + max_dll_name_len) * sizeof(WCHAR) )))
diff --git a/tools/makedep.c b/tools/makedep.c
index 99f824d5f8b..acc8f49bfba 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -2731,9 +2731,7 @@ static void output_source_idl( struct makefile *make, struct incl_file *source,
     for (i = 0; i < source->importlibdeps.count; i++)
     {
         struct makefile *submake = find_importlib_module( source->importlibdeps.str[i] );
-        const char *module = submake->module;
-        if (*dll_ext && !submake->is_cross) module = strmake( "%s.fake", module );
-        output_filename( obj_dir_path( submake, module ));
+        output_filename( obj_dir_path( submake, submake->module ));
     }
     output( "\n" );
 }
@@ -3221,11 +3219,10 @@ static void output_fake_module( struct makefile *make )
 
     if (!make->is_exe) spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" ));
 
-    strarray_add( &make->all_targets, strmake( "%s.fake", make->module ));
-    add_install_rule( make, make->module, strmake( "%s.fake", make->module ),
-                      strmake( "d%s/%s", pe_dir, make->module ));
+    strarray_add( &make->all_targets, make->module );
+    add_install_rule( make, make->module, make->module, strmake( "d%s/%s", pe_dir, make->module ));
 
-    output( "%s.fake:", obj_dir_path( make, make->module ));
+    output( "%s:", obj_dir_path( make, make->module ));
     if (spec_file) output_filename( spec_file );
     output_filenames_obj_dir( make, make->res_files );
     output_filename( tools_path( make, "winebuild" ));
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index aa73601233f..0b5f07236f0 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -688,8 +688,6 @@ int open_typelib( const char *name )
             if (strendswith( name, ".dll" )) namelen -= 4;
             TRYOPEN( strmake( "%.*s/%.*s/%s", (int)strlen(dlldirs.str[i]) - 2, dlldirs.str[i],
                               namelen, name, name ));
-            TRYOPEN( strmake( "%.*s/%.*s/%s.fake", (int)strlen(dlldirs.str[i]) - 2, dlldirs.str[i],
-                              namelen, name, name ));
         }
         else
         {




More information about the wine-cvs mailing list