Commit 62d33505 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent e694c798
...@@ -2788,9 +2788,6 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne ...@@ -2788,9 +2788,6 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne
RtlAppendUnicodeToString( new_name, name ); RtlAppendUnicodeToString( new_name, name );
status = open_dll_file( new_name, pwm, mapping, image_info, id ); status = open_dll_file( new_name, pwm, mapping, image_info, id );
if (status != STATUS_DLL_NOT_FOUND) goto done; 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; new_name->Length = len;
RtlAppendUnicodeToString( new_name, L"\\programs\\" ); RtlAppendUnicodeToString( new_name, L"\\programs\\" );
...@@ -2799,9 +2796,6 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne ...@@ -2799,9 +2796,6 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne
RtlAppendUnicodeToString( new_name, name ); RtlAppendUnicodeToString( new_name, name );
status = open_dll_file( new_name, pwm, mapping, image_info, id ); status = open_dll_file( new_name, pwm, mapping, image_info, id );
if (status != STATUS_DLL_NOT_FOUND) goto done; 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 ); RtlFreeUnicodeString( new_name );
} }
......
...@@ -1720,16 +1720,6 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename, ...@@ -1720,16 +1720,6 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename,
SECTION_IMAGE_INFORMATION info; SECTION_IMAGE_INFORMATION info;
enum loadorder loadorder; 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 ); init_unicode_string( &nt_name, filename );
loadorder = get_load_order( &nt_name ); loadorder = get_load_order( &nt_name );
...@@ -1742,6 +1732,7 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename, ...@@ -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) 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; if (loadorder == LO_NATIVE) return STATUS_DLL_NOT_FOUND;
loadorder = LO_BUILTIN; /* builtin with no fallback since mapping a fake dll is not useful */ loadorder = LO_BUILTIN; /* builtin with no fallback since mapping a fake dll is not useful */
} }
......
...@@ -253,8 +253,7 @@ static int read_file( const WCHAR *name, void **data, SIZE_T *size ) ...@@ -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) st.st_size - header_size ) == st.st_size - header_size)
{ {
*data = file_buffer; *data = file_buffer;
if ((lstrlenW(name) > 2 && !wcscmp( name + lstrlenW(name) - 2, L"16" )) || if (lstrlenW(name) > 2 && !wcscmp( name + lstrlenW(name) - 2, L"16" ))
(lstrlenW(name) > 7 && !wcscmp( name + lstrlenW(name) - 7, L"16.fake" )))
extract_16bit_image( nt, data, size ); extract_16bit_image( nt, data, size );
ret = 1; ret = 1;
} }
...@@ -432,11 +431,11 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size ) ...@@ -432,11 +431,11 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
len = lstrlenW( name ); len = lstrlenW( name );
if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(L"\\programs") + len + 1; if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(L"\\programs") + len + 1;
while ((path = enum_load_path( i++ ))) maxlen = max( maxlen, lstrlenW(path) ); 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; 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 ); lstrcpyW( file + pos, name );
file[--pos] = '\\'; file[--pos] = '\\';
...@@ -451,8 +450,6 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size ) ...@@ -451,8 +450,6 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
ptr = prepend( ptr, L"\\dlls", 5 ); ptr = prepend( ptr, L"\\dlls", 5 );
ptr = prepend( ptr, build_dir, lstrlenW(build_dir) ); ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
if ((res = read_file( ptr, &data, size ))) goto done; 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 */ /* now as a program */
ptr = file + pos; ptr = file + pos;
...@@ -463,8 +460,6 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size ) ...@@ -463,8 +460,6 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
ptr = prepend( ptr, L"\\programs", 9 ); ptr = prepend( ptr, L"\\programs", 9 );
ptr = prepend( ptr, build_dir, lstrlenW(build_dir) ); ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
if ((res = read_file( ptr, &data, size ))) goto done; 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; file[pos + len + 1] = 0;
...@@ -888,7 +883,7 @@ static void register_fake_dll( const WCHAR *name, const void *data, size_t size, ...@@ -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 */ /* 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; int ret;
SIZE_T size; SIZE_T size;
...@@ -899,7 +894,6 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL de ...@@ -899,7 +894,6 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL de
WCHAR *end = name + lstrlenW(name); WCHAR *end = name + lstrlenW(name);
SIZE_T len = end - name; SIZE_T len = end - name;
if (ext) lstrcpyW( end, ext );
if (!(ret = read_file( file, &data, &size ))) if (!(ret = read_file( file, &data, &size )))
{ {
*end = 0; *end = 0;
...@@ -987,16 +981,11 @@ static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *wildcard, ...@@ -987,16 +981,11 @@ static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *wildcard,
{ {
lstrcatW( name, L"\\" ); lstrcatW( name, L"\\" );
lstrcatW( name, data.name ); lstrcatW( name, data.name );
if (wcschr( data.name, '.' )) /* module possibly already has an extension */ if (wcschr( data.name, '.' ) && install_fake_dll( dest, file, delete, &delay_copy ))
{ continue;
if (install_fake_dll( dest, file, NULL, delete, &delay_copy )) continue;
if (install_fake_dll( dest, file, L".fake", delete, &delay_copy )) continue;
}
lstrcatW( name, default_ext ); 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 )); while (!_wfindnext( handle, &data ));
_findclose( handle ); _findclose( handle );
...@@ -1014,7 +1003,7 @@ static BOOL create_wildcard_dlls( const WCHAR *dirname, const WCHAR *wildcard, B ...@@ -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; 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) ); 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 (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen * sizeof(WCHAR) ))) return FALSE;
if (!(dest = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(dirname) + max_dll_name_len) * sizeof(WCHAR) ))) if (!(dest = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(dirname) + max_dll_name_len) * sizeof(WCHAR) )))
......
...@@ -2731,9 +2731,7 @@ static void output_source_idl( struct makefile *make, struct incl_file *source, ...@@ -2731,9 +2731,7 @@ static void output_source_idl( struct makefile *make, struct incl_file *source,
for (i = 0; i < source->importlibdeps.count; i++) for (i = 0; i < source->importlibdeps.count; i++)
{ {
struct makefile *submake = find_importlib_module( source->importlibdeps.str[i] ); struct makefile *submake = find_importlib_module( source->importlibdeps.str[i] );
const char *module = submake->module; output_filename( obj_dir_path( submake, submake->module ));
if (*dll_ext && !submake->is_cross) module = strmake( "%s.fake", module );
output_filename( obj_dir_path( submake, module ));
} }
output( "\n" ); output( "\n" );
} }
...@@ -3221,11 +3219,10 @@ static void output_fake_module( struct makefile *make ) ...@@ -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" )); 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 )); strarray_add( &make->all_targets, make->module );
add_install_rule( make, make->module, strmake( "%s.fake", make->module ), add_install_rule( make, make->module, make->module, strmake( "d%s/%s", pe_dir, 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 ); if (spec_file) output_filename( spec_file );
output_filenames_obj_dir( make, make->res_files ); output_filenames_obj_dir( make, make->res_files );
output_filename( tools_path( make, "winebuild" )); output_filename( tools_path( make, "winebuild" ));
......
...@@ -688,8 +688,6 @@ int open_typelib( const char *name ) ...@@ -688,8 +688,6 @@ int open_typelib( const char *name )
if (strendswith( name, ".dll" )) namelen -= 4; if (strendswith( name, ".dll" )) namelen -= 4;
TRYOPEN( strmake( "%.*s/%.*s/%s", (int)strlen(dlldirs.str[i]) - 2, dlldirs.str[i], TRYOPEN( strmake( "%.*s/%.*s/%s", (int)strlen(dlldirs.str[i]) - 2, dlldirs.str[i],
namelen, name, name )); namelen, name, name ));
TRYOPEN( strmake( "%.*s/%.*s/%s.fake", (int)strlen(dlldirs.str[i]) - 2, dlldirs.str[i],
namelen, name, name ));
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment