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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-11-20 13:07:47 +01:00
parent e694c798b6
commit 62d335053f
5 changed files with 13 additions and 44 deletions

View File

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

View File

@ -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 */
}

View File

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

View File

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

View File

@ -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
{