winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2019
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
803 discussions
Start a n
N
ew thread
Alexandre Julliard : setupapi: Add support for installing PE builtins as fake dlls.
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: 510e746718bb11f45fff58517582e72c09f1055a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=510e746718bb11f45fff5851…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 22 11:40:41 2019 +0200 setupapi: Add support for installing PE builtins as fake dlls. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/setupapi/fakedll.c | 53 ++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c index e0d012a..260eb1e 100644 --- a/dlls/setupapi/fakedll.c +++ b/dlls/setupapi/fakedll.c @@ -51,6 +51,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi); +static const char builtin_signature[] = "Wine builtin DLL"; static const char fakedll_signature[] = "Wine placeholder DLL"; static const unsigned int file_alignment = 512; @@ -191,14 +192,15 @@ failed: /* read in the contents of a file into the global file buffer */ /* return 1 on success, 0 on nonexistent file, -1 on other error */ -static int read_file( const char *name, void **data, SIZE_T *size ) +static int read_file( const char *name, void **data, SIZE_T *size, BOOL expect_builtin ) { struct stat st; int fd, ret = -1; size_t header_size; IMAGE_DOS_HEADER *dos; IMAGE_NT_HEADERS *nt; - const size_t min_size = sizeof(*dos) + sizeof(fakedll_signature) + + const char *signature = expect_builtin ? builtin_signature : fakedll_signature; + const size_t min_size = sizeof(*dos) + 32 + FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader.MajorLinkerVersion ); if ((fd = open( name, O_RDONLY | O_BINARY )) == -1) return 0; @@ -220,8 +222,8 @@ static int read_file( const char *name, void **data, SIZE_T *size ) if (pread( fd, file_buffer, header_size, 0 ) != header_size) goto done; dos = file_buffer; if (dos->e_magic != IMAGE_DOS_SIGNATURE) goto done; - if (dos->e_lfanew < sizeof(fakedll_signature)) goto done; - if (memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) )) goto done; + if (dos->e_lfanew < strlen(signature) + 1) goto done; + if (memcmp( dos + 1, signature, strlen(signature) + 1 )) goto done; if (dos->e_lfanew + FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader.MajorLinkerVersion) > header_size) goto done; nt = (IMAGE_NT_HEADERS *)((char *)file_buffer + dos->e_lfanew); @@ -354,14 +356,15 @@ static BOOL is_fake_dll( HANDLE h ) { IMAGE_DOS_HEADER *dos; DWORD size; - BYTE buffer[sizeof(*dos) + sizeof(fakedll_signature)]; + BYTE buffer[sizeof(*dos) + 32]; if (!ReadFile( h, buffer, sizeof(buffer), &size, NULL ) || size != sizeof(buffer)) return FALSE; dos = (IMAGE_DOS_HEADER *)buffer; if (dos->e_magic != IMAGE_DOS_SIGNATURE) return FALSE; if (dos->e_lfanew < size) return FALSE; - return !memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) ); + return (!memcmp( dos + 1, builtin_signature, sizeof(builtin_signature) ) || + !memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) )); } /* create directories leading to a given file */ @@ -417,33 +420,39 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size ) if (build_dir) { - strcpy( file + pos + len + 1, ".fake" ); - /* try as a dll */ ptr = file + pos; namelen = len + 1; + file[pos + len + 1] = 0; if (namelen > 4 && !memcmp( ptr + namelen - 4, ".dll", 4 )) namelen -= 4; ptr = prepend( ptr, ptr, namelen ); ptr = prepend( ptr, "/dlls", sizeof("/dlls") - 1 ); ptr = prepend( ptr, build_dir, strlen(build_dir) ); - if ((res = read_file( ptr, &data, size ))) goto done; + if ((res = read_file( ptr, &data, size, TRUE ))) goto done; + strcpy( file + pos + len + 1, ".fake" ); + if ((res = read_file( ptr, &data, size, FALSE ))) goto done; /* now as a program */ ptr = file + pos; namelen = len + 1; + file[pos + len + 1] = 0; if (namelen > 4 && !memcmp( ptr + namelen - 4, ".exe", 4 )) namelen -= 4; ptr = prepend( ptr, ptr, namelen ); ptr = prepend( ptr, "/programs", sizeof("/programs") - 1 ); ptr = prepend( ptr, build_dir, strlen(build_dir) ); - if ((res = read_file( ptr, &data, size ))) goto done; + if ((res = read_file( ptr, &data, size, TRUE ))) goto done; + strcpy( file + pos + len + 1, ".fake" ); + if ((res = read_file( ptr, &data, size, FALSE ))) goto done; } file[pos + len + 1] = 0; for (i = 0; (path = wine_dll_enum_load_path( i )); i++) { + ptr = prepend( file + pos, path, strlen(path) ); + if ((res = read_file( ptr, &data, size, TRUE ))) break; ptr = prepend( file + pos, "/fakedlls", sizeof("/fakedlls") - 1 ); ptr = prepend( ptr, path, strlen(path) ); - if ((res = read_file( ptr, &data, size ))) break; + if ((res = read_file( ptr, &data, size, FALSE ))) break; } done: @@ -842,7 +851,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 void install_fake_dll( WCHAR *dest, char *file, const char *ext ) +static int install_fake_dll( WCHAR *dest, char *file, const char *ext, BOOL expect_builtin ) { int ret; SIZE_T size; @@ -852,8 +861,8 @@ static void install_fake_dll( WCHAR *dest, char *file, const char *ext ) char *name = strrchr( file, '/' ) + 1; char *end = name + strlen(name); - if (ext) strcpy( end, ext ); - if (!(ret = read_file( file, &data, &size ))) return; + strcpy( end, ext ); + if (!(ret = read_file( file, &data, &size, expect_builtin ))) return 0; if (end > name + 2 && !strncmp( end - 2, "16", 2 )) end -= 2; /* remove "16" suffix */ dll_name_AtoW( destname, name, end - name ); @@ -875,10 +884,11 @@ static void install_fake_dll( WCHAR *dest, char *file, const char *ext ) } } *destname = 0; /* restore it for next file */ + return ret; } /* find and install all fake dlls in a given lib directory */ -static void install_lib_dir( WCHAR *dest, char *file, const char *default_ext ) +static void install_lib_dir( WCHAR *dest, char *file, const char *default_ext, BOOL expect_builtin ) { DIR *dir; struct dirent *de; @@ -898,9 +908,10 @@ static void install_lib_dir( WCHAR *dest, char *file, const char *default_ext ) strcat( name, "/" ); strcat( name, de->d_name ); if (!strchr( de->d_name, '.' )) strcat( name, default_ext ); - install_fake_dll( dest, file, ".fake" ); + if (!install_fake_dll( dest, file, "", expect_builtin )) + install_fake_dll( dest, file, ".fake", FALSE ); } - else install_fake_dll( dest, file, NULL ); + else install_fake_dll( dest, file, "", expect_builtin ); } closedir( dir ); } @@ -931,16 +942,18 @@ static BOOL create_wildcard_dlls( const WCHAR *dirname ) { strcpy( file, build_dir ); strcat( file, "/dlls" ); - install_lib_dir( dest, file, ".dll" ); + install_lib_dir( dest, file, ".dll", TRUE ); strcpy( file, build_dir ); strcat( file, "/programs" ); - install_lib_dir( dest, file, ".exe" ); + install_lib_dir( dest, file, ".exe", TRUE ); } for (i = 0; (path = wine_dll_enum_load_path( i )); i++) { strcpy( file, path ); + install_lib_dir( dest, file, NULL, TRUE ); + strcpy( file, path ); strcat( file, "/fakedlls" ); - install_lib_dir( dest, file, NULL ); + install_lib_dir( dest, file, NULL, FALSE ); } HeapFree( GetProcessHeap(), 0, file ); HeapFree( GetProcessHeap(), 0, dest );
1
0
0
0
Alexandre Julliard : ntdll: Add support for loading PE builtin dlls.
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: 948fc851867da01f09c84ad83df6f4eddc74fdf3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=948fc851867da01f09c84ad8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 22 11:36:54 2019 +0200 ntdll: Add support for loading PE builtin dlls. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 231 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 208 insertions(+), 23 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=948fc851867da01f09c8…
1
0
0
0
Alexandre Julliard : ntdll: Only pass the NT path name to open_dll_file().
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: ea9cc97e2ef3133d2da7b48d8c11786fe61abbbe URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ea9cc97e2ef3133d2da7b48d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 22 11:36:39 2019 +0200 ntdll: Only pass the NT path name to open_dll_file(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index fa8d1f8..de218c7 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1991,7 +1991,7 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info ) * * Open a file for a new dll. Helper for find_dll_file. */ -static NTSTATUS open_dll_file( const WCHAR *name, UNICODE_STRING *nt_name, WINE_MODREF **pwm, +static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm, void **module, pe_image_info_t *image_info, struct stat *st ) { FILE_BASIC_INFORMATION info; @@ -2003,9 +2003,6 @@ static NTSTATUS open_dll_file( const WCHAR *name, UNICODE_STRING *nt_name, WINE_ HANDLE handle, mapping; int fd, needs_close; - nt_name->Buffer = NULL; - if ((status = RtlDosPathNameToNtPathName_U_WithStatus( name, nt_name, NULL, NULL ))) return status; - if ((*pwm = find_fullname_module( nt_name ))) return STATUS_SUCCESS; attr.Length = sizeof(attr); @@ -2397,7 +2394,11 @@ static NTSTATUS search_dll_file( LPCWSTR paths, LPCWSTR search, UNICODE_STRING * memcpy( name, paths, len * sizeof(WCHAR) ); if (len && name[len - 1] != '\\') name[len++] = '\\'; strcpyW( name + len, search ); - status = open_dll_file( name, nt_name, pwm, module, image_info, st ); + + nt_name->Buffer = NULL; + if ((status = RtlDosPathNameToNtPathName_U_WithStatus( name, nt_name, NULL, NULL ))) goto done; + + status = open_dll_file( nt_name, pwm, module, image_info, st ); if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) found_image = TRUE; else if (status != STATUS_DLL_NOT_FOUND) goto done; RtlFreeUnicodeString( nt_name ); @@ -2466,8 +2467,8 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, if (RtlDetermineDosPathNameType_U( libname ) == RELATIVE_PATH) status = search_dll_file( load_path, libname, nt_name, pwm, module, image_info, st ); - else - status = open_dll_file( libname, nt_name, pwm, module, image_info, st ); + else if (!(status = RtlDosPathNameToNtPathName_U_WithStatus( libname, nt_name, NULL, NULL ))) + status = open_dll_file( nt_name, pwm, module, image_info, st ); if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) status = STATUS_INVALID_IMAGE_FORMAT;
1
0
0
0
Alexandre Julliard : ntdll: Move open_dll_file() to avoid forward declarations.
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: f7cf3c18064b07ac01bc42ebdf8773ea83327e3e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f7cf3c18064b07ac01bc42eb…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 22 11:34:55 2019 +0200 ntdll: Move open_dll_file() to avoid forward declarations. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 158 ++++++++++++++++++++++++++-------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index d7dbe57..fa8d1f8 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1986,6 +1986,85 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info ) } +/*********************************************************************** + * open_dll_file + * + * Open a file for a new dll. Helper for find_dll_file. + */ +static NTSTATUS open_dll_file( const WCHAR *name, UNICODE_STRING *nt_name, WINE_MODREF **pwm, + void **module, pe_image_info_t *image_info, struct stat *st ) +{ + FILE_BASIC_INFORMATION info; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + LARGE_INTEGER size; + SIZE_T len = 0; + NTSTATUS status; + HANDLE handle, mapping; + int fd, needs_close; + + nt_name->Buffer = NULL; + if ((status = RtlDosPathNameToNtPathName_U_WithStatus( name, nt_name, NULL, NULL ))) return status; + + if ((*pwm = find_fullname_module( nt_name ))) return STATUS_SUCCESS; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.ObjectName = nt_name; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + if ((status = NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, + FILE_SHARE_READ | FILE_SHARE_DELETE, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE ))) + { + if (status != STATUS_OBJECT_PATH_NOT_FOUND && + status != STATUS_OBJECT_NAME_NOT_FOUND && + !NtQueryAttributesFile( &attr, &info )) + { + /* if the file exists but failed to open, report the error */ + return status; + } + /* otherwise continue searching */ + return STATUS_DLL_NOT_FOUND; + } + + if (!server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )) + { + fstat( fd, st ); + if (needs_close) close( fd ); + if ((*pwm = find_fileid_module( st ))) + { + TRACE( "%s is the same file as existing module %p %s\n", debugstr_w( nt_name->Buffer ), + (*pwm)->ldr.BaseAddress, debugstr_w( (*pwm)->ldr.FullDllName.Buffer )); + NtClose( handle ); + return STATUS_SUCCESS; + } + } + + size.QuadPart = 0; + status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | + SECTION_MAP_READ | SECTION_MAP_EXECUTE, + NULL, &size, PAGE_EXECUTE_READ, SEC_IMAGE, handle ); + NtClose( handle ); + + if (!status) + { + status = virtual_map_section( mapping, module, 0, 0, NULL, &len, + PAGE_EXECUTE_READ, image_info ); + if (status == STATUS_IMAGE_NOT_AT_BASE) status = STATUS_SUCCESS; + NtClose( mapping ); + } + if (!status && !is_valid_binary( *module, image_info )) + { + TRACE( "%s is for arch %x, continuing search\n", debugstr_us(nt_name), image_info->machine ); + NtUnmapViewOfSection( NtCurrentProcess(), *module ); + status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; + } + return status; +} + + /****************************************************************************** * load_native_dll (internal) */ @@ -2289,85 +2368,6 @@ done: /*********************************************************************** - * open_dll_file - * - * Open a file for a new dll. Helper for find_dll_file. - */ -static NTSTATUS open_dll_file( const WCHAR *name, UNICODE_STRING *nt_name, WINE_MODREF **pwm, - void **module, pe_image_info_t *image_info, struct stat *st ) -{ - FILE_BASIC_INFORMATION info; - OBJECT_ATTRIBUTES attr; - IO_STATUS_BLOCK io; - LARGE_INTEGER size; - SIZE_T len = 0; - NTSTATUS status; - HANDLE handle, mapping; - int fd, needs_close; - - nt_name->Buffer = NULL; - if ((status = RtlDosPathNameToNtPathName_U_WithStatus( name, nt_name, NULL, NULL ))) return status; - - if ((*pwm = find_fullname_module( nt_name ))) return STATUS_SUCCESS; - - attr.Length = sizeof(attr); - attr.RootDirectory = 0; - attr.Attributes = OBJ_CASE_INSENSITIVE; - attr.ObjectName = nt_name; - attr.SecurityDescriptor = NULL; - attr.SecurityQualityOfService = NULL; - if ((status = NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, - FILE_SHARE_READ | FILE_SHARE_DELETE, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE ))) - { - if (status != STATUS_OBJECT_PATH_NOT_FOUND && - status != STATUS_OBJECT_NAME_NOT_FOUND && - !NtQueryAttributesFile( &attr, &info )) - { - /* if the file exists but failed to open, report the error */ - return status; - } - /* otherwise continue searching */ - return STATUS_DLL_NOT_FOUND; - } - - if (!server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )) - { - fstat( fd, st ); - if (needs_close) close( fd ); - if ((*pwm = find_fileid_module( st ))) - { - TRACE( "%s is the same file as existing module %p %s\n", debugstr_w( nt_name->Buffer ), - (*pwm)->ldr.BaseAddress, debugstr_w( (*pwm)->ldr.FullDllName.Buffer )); - NtClose( handle ); - return STATUS_SUCCESS; - } - } - - size.QuadPart = 0; - status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | - SECTION_MAP_READ | SECTION_MAP_EXECUTE, - NULL, &size, PAGE_EXECUTE_READ, SEC_IMAGE, handle ); - NtClose( handle ); - - if (!status) - { - status = virtual_map_section( mapping, module, 0, 0, NULL, &len, - PAGE_EXECUTE_READ, image_info ); - if (status == STATUS_IMAGE_NOT_AT_BASE) status = STATUS_SUCCESS; - NtClose( mapping ); - } - if (!status && !is_valid_binary( *module, image_info )) - { - TRACE( "%s is for arch %x, continuing search\n", debugstr_us(nt_name), image_info->machine ); - NtUnmapViewOfSection( NtCurrentProcess(), *module ); - status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; - } - return status; -} - - -/*********************************************************************** * search_dll_file * * Search for dll in the specified paths.
1
0
0
0
Alexandre Julliard : server: Add flag for builtin dlls in the image information.
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: 546fa12755dd0d1d9618214fb02ef9fa5fa6c943 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=546fa12755dd0d1d9618214f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 22 11:34:25 2019 +0200 server: Add flag for builtin dlls in the image information. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/virtual.c | 2 +- include/wine/server_protocol.h | 1 + server/mapping.c | 7 +++++-- server/protocol.def | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index fb6ede6..78973a8 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -3203,7 +3203,7 @@ void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMA info->DllCharacteristics = pe_info->dll_charact; info->Machine = pe_info->machine; info->ImageContainsCode = pe_info->contains_code; - info->u.ImageFlags = pe_info->image_flags & ~IMAGE_FLAGS_WineFakeDll; + info->u.ImageFlags = pe_info->image_flags & ~(IMAGE_FLAGS_WineBuiltin|IMAGE_FLAGS_WineFakeDll); info->LoaderFlags = pe_info->loader_flags; info->ImageFileSize = pe_info->file_size; info->CheckSum = pe_info->checksum; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index c3d1bb6..9e26aa4 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -720,6 +720,7 @@ typedef struct #define IMAGE_FLAGS_ImageDynamicallyRelocated 0x04 #define IMAGE_FLAGS_ImageMappedFlat 0x08 #define IMAGE_FLAGS_BaseBelow4gb 0x10 +#define IMAGE_FLAGS_WineBuiltin 0x40 #define IMAGE_FLAGS_WineFakeDll 0x80 struct rawinput_device diff --git a/server/mapping.c b/server/mapping.c index ddc8be8..3480724 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -558,6 +558,7 @@ static int load_clr_header( IMAGE_COR20_HEADER *hdr, size_t va, size_t size, int /* retrieve the mapping parameters for an executable (PE) image */ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_size, int unix_fd ) { + static const char builtin_signature[] = "Wine builtin DLL"; static const char fakedll_signature[] = "Wine placeholder DLL"; IMAGE_COR20_HEADER clr; @@ -565,7 +566,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s struct { IMAGE_DOS_HEADER dos; - char buffer[sizeof(fakedll_signature)]; + char buffer[32]; } mz; struct { @@ -702,7 +703,9 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s mapping->image.gp = 0; /* FIXME */ mapping->image.file_size = file_size; mapping->image.loader_flags = clr_va && clr_size; - if (mz_size == sizeof(mz) && !memcmp( mz.buffer, fakedll_signature, sizeof(fakedll_signature) )) + if (mz_size == sizeof(mz) && !memcmp( mz.buffer, builtin_signature, sizeof(builtin_signature) )) + mapping->image.image_flags |= IMAGE_FLAGS_WineBuiltin; + else if (mz_size == sizeof(mz) && !memcmp( mz.buffer, fakedll_signature, sizeof(fakedll_signature) )) mapping->image.image_flags |= IMAGE_FLAGS_WineFakeDll; /* load the section headers */ diff --git a/server/protocol.def b/server/protocol.def index 888e22f..79e9802 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -736,6 +736,7 @@ typedef struct #define IMAGE_FLAGS_ImageDynamicallyRelocated 0x04 #define IMAGE_FLAGS_ImageMappedFlat 0x08 #define IMAGE_FLAGS_BaseBelow4gb 0x10 +#define IMAGE_FLAGS_WineBuiltin 0x40 #define IMAGE_FLAGS_WineFakeDll 0x80 struct rawinput_device
1
0
0
0
Alexandre Julliard : winegcc: Add option to put a builtin dll signature in the DOS header of PE files.
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: 11ee7a7051e86395e3697491f8fed345ac4b6940 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=11ee7a7051e86395e3697491…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 22 11:34:14 2019 +0200 winegcc: Add option to put a builtin dll signature in the DOS header of PE files. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/winegcc/winegcc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 674d1a3..46b67ce 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -205,6 +205,7 @@ struct options int compile_only; int force_pointer_size; int large_address_aware; + int wine_builtin; int unwind_tables; int strip; const char* wine_objdir; @@ -515,6 +516,28 @@ static int check_platform( struct options *opts, const char *file ) return ret; } +static void make_wine_builtin( const char *file ) +{ + static const char wine_magic[32] = "Wine builtin DLL"; + int fd; + struct + { + unsigned short e_magic; + unsigned short unused[29]; + unsigned int e_lfanew; + } header; + + if ((fd = open( file, O_RDWR | O_BINARY )) == -1) error( "Failed to add signature to %s\n", file ); + + if (read( fd, &header, sizeof(header) ) == sizeof(header) && !memcmp( &header.e_magic, "MZ", 2 )) + { + if (header.e_lfanew < sizeof(header) + sizeof(wine_magic)) + error( "Not enough space (%x) for Wine signature\n", header.e_lfanew ); + write( fd, wine_magic, sizeof(wine_magic) ); + } + close( fd ); +} + static const char *get_multiarch_dir( enum target_cpu cpu ) { switch(cpu) @@ -1131,6 +1154,8 @@ static void build(struct options* opts) spawn(opts->prefix, link_args, 0); strarray_free (link_args); + if (is_pe && opts->wine_builtin) make_wine_builtin( output_path ); + /* set the base address with prelink if linker support is not present */ if (opts->prelink && !opts->target) { @@ -1549,6 +1574,11 @@ int main(int argc, char **argv) opts.large_address_aware = 1; continue; } + if (!strcmp(Wl->base[j], "--wine-builtin")) + { + opts.wine_builtin = 1; + continue; + } if (!strcmp(Wl->base[j], "--subsystem") && j < Wl->size - 1) { opts.subsystem = strdup( Wl->base[++j] );
1
0
0
0
Nikolay Sivov : mfreadwrite: Handle some of stream state change events.
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: f8fff8b29731ab55065260e25ce6f2722367f808 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f8fff8b29731ab55065260e2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 22 10:52:30 2019 +0300 mfreadwrite: Handle some of stream state change events. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfreadwrite/main.c | 64 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c index 490f238..e396dcd 100644 --- a/dlls/mfreadwrite/main.c +++ b/dlls/mfreadwrite/main.c @@ -385,6 +385,46 @@ failed: return hr; } +static HRESULT source_reader_media_stream_state_handler(struct source_reader *reader, IMFMediaStream *stream, + MediaEventType event) +{ + unsigned int i; + HRESULT hr; + DWORD id; + + if (FAILED(hr = media_stream_get_id(stream, &id))) + { + WARN("Unidentified stream %p, hr %#x.\n", stream, hr); + return hr; + } + + for (i = 0; i < reader->stream_count; ++i) + { + if (id == reader->streams[i].id) + { + EnterCriticalSection(&reader->streams[i].cs); + + switch (event) + { + case MEEndOfStream: + reader->streams[i].state = STREAM_STATE_EOS; + break; + case MEStreamSeeked: + case MEStreamStarted: + reader->streams[i].state = STREAM_STATE_READY; + break; + default: + ; + } + + LeaveCriticalSection(&reader->streams[i].cs); + break; + } + } + + return S_OK; +} + static HRESULT WINAPI source_reader_stream_events_callback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) { struct source_reader *reader = impl_from_stream_callback_IMFAsyncCallback(iface); @@ -409,6 +449,11 @@ static HRESULT WINAPI source_reader_stream_events_callback_Invoke(IMFAsyncCallba case MEMediaSample: hr = source_reader_media_sample_handler(reader, stream, event); break; + case MEStreamSeeked: + case MEStreamStarted: + case MEEndOfStream: + hr = source_reader_media_stream_state_handler(reader, stream, event_type); + break; default: ; } @@ -735,6 +780,7 @@ static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index, DWORD *stream_flags, LONGLONG *timestamp, IMFSample **sample) { struct source_reader *reader = impl_from_IMFSourceReader(iface); + DWORD stream_index; HRESULT hr; TRACE("%p, %#x, %#x, %p, %p, %p, %p\n", iface, index, flags, actual_index, stream_flags, timestamp, sample); @@ -742,16 +788,16 @@ static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index, switch (index) { case MF_SOURCE_READER_FIRST_VIDEO_STREAM: - index = reader->first_video_stream_index; + stream_index = reader->first_video_stream_index; break; case MF_SOURCE_READER_FIRST_AUDIO_STREAM: - index = reader->first_audio_stream_index; + stream_index = reader->first_audio_stream_index; break; case MF_SOURCE_READER_ANY_STREAM: FIXME("Non-specific requests are not supported.\n"); return E_NOTIMPL; default: - ; + stream_index = index; } /* FIXME: probably should happen once */ @@ -769,18 +815,20 @@ static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index, if (!stream_flags || !sample) return E_POINTER; - if (actual_index) - *actual_index = index; - *sample = NULL; - if (index >= reader->stream_count) + if (stream_index >= reader->stream_count) { *stream_flags = MF_SOURCE_READERF_ERROR; + if (actual_index) + *actual_index = index; return MF_E_INVALIDSTREAMNUMBER; } - stream = &reader->streams[index]; + if (actual_index) + *actual_index = stream_index; + + stream = &reader->streams[stream_index]; EnterCriticalSection(&stream->cs);
1
0
0
0
Nikolay Sivov : mfreadwrite: Wake also on new streams.
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: 279f6dbd0cb1e4f2c48340ce6fd3e43e6fa681eb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=279f6dbd0cb1e4f2c48340ce…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 22 10:52:29 2019 +0300 mfreadwrite: Wake also on new streams. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfreadwrite/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c index e27fe82..490f238 100644 --- a/dlls/mfreadwrite/main.c +++ b/dlls/mfreadwrite/main.c @@ -253,6 +253,9 @@ static HRESULT source_reader_new_stream_handler(struct source_reader *reader, IM { WARN("Failed to subscribe to stream events, hr %#x.\n", hr); } + + /* Wake so any waiting ReadSample() calls have a chance to make requests. */ + WakeAllConditionVariable(&reader->streams[i].sample_event); } break; }
1
0
0
0
Nikolay Sivov : mfreadwrite: Handle failure path in GetNativeMediaType().
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: 56bb5967118584012ae0d97c156c52e65586671c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=56bb5967118584012ae0d97c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 22 10:52:28 2019 +0300 mfreadwrite: Handle failure path in GetNativeMediaType(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfreadwrite/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c index 8145e5b..e27fe82 100644 --- a/dlls/mfreadwrite/main.c +++ b/dlls/mfreadwrite/main.c @@ -613,10 +613,12 @@ static HRESULT WINAPI src_reader_GetNativeMediaType(IMFSourceReader *iface, DWOR hr = IMFMediaTypeHandler_GetMediaTypeByIndex(handler, type_index, &src_type); IMFMediaTypeHandler_Release(handler); - if (SUCCEEDED(hr = MFCreateMediaType(type))) - hr = IMFMediaType_CopyAllItems(src_type, (IMFAttributes *)*type); - - IMFMediaType_Release(src_type); + if (SUCCEEDED(hr)) + { + if (SUCCEEDED(hr = MFCreateMediaType(type))) + hr = IMFMediaType_CopyAllItems(src_type, (IMFAttributes *)*type); + IMFMediaType_Release(src_type); + } return hr; }
1
0
0
0
Nikolay Sivov : mfreadwrite: Add partial implementation of ReadSample().
by Alexandre Julliard
22 Apr '19
22 Apr '19
Module: wine Branch: master Commit: 020d2202ea06d395a37b9840b00dd50d26be6d2c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=020d2202ea06d395a37b9840…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Apr 22 10:52:27 2019 +0300 mfreadwrite: Add partial implementation of ReadSample(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfreadwrite/main.c | 109 +++++++++++++++++++++++++++++++++++++--- dlls/mfreadwrite/tests/mfplat.c | 7 +++ 2 files changed, 109 insertions(+), 7 deletions(-) diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c index 43dfd4e..8145e5b 100644 --- a/dlls/mfreadwrite/main.c +++ b/dlls/mfreadwrite/main.c @@ -79,13 +79,21 @@ struct sample IMFSample *sample; }; +enum media_stream_state +{ + STREAM_STATE_READY = 0, + STREAM_STATE_EOS, +}; + struct media_stream { IMFMediaStream *stream; IMFMediaType *current; DWORD id; CRITICAL_SECTION cs; + CONDITION_VARIABLE sample_event; struct list samples; + enum media_stream_state state; }; typedef struct source_reader @@ -359,6 +367,8 @@ static HRESULT source_reader_media_sample_handler(struct source_reader *reader, list_add_tail(&reader->streams[i].samples, &pending_sample->entry); LeaveCriticalSection(&reader->streams[i].cs); + WakeAllConditionVariable(&reader->streams[i].sample_event); + break; } } @@ -698,14 +708,98 @@ static HRESULT WINAPI src_reader_SetCurrentPosition(IMFSourceReader *iface, REFG return IMFMediaSource_Start(reader->source, reader->descriptor, format, position); } -static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index, - DWORD flags, DWORD *actualindex, DWORD *sampleflags, LONGLONG *timestamp, - IMFSample **sample) +static IMFSample *media_stream_pop_sample(struct media_stream *stream, DWORD *stream_flags) { - srcreader *This = impl_from_IMFSourceReader(iface); - FIXME("%p, 0x%08x, 0x%08x, %p, %p, %p, %p\n", This, index, flags, actualindex, - sampleflags, timestamp, sample); - return E_NOTIMPL; + IMFSample *ret = NULL; + struct list *head; + + if ((head = list_head(&stream->samples))) + { + struct sample *pending_sample = LIST_ENTRY(head, struct sample, entry); + ret = pending_sample->sample; + list_remove(&pending_sample->entry); + heap_free(pending_sample); + } + + *stream_flags = stream->state == STREAM_STATE_EOS ? MF_SOURCE_READERF_ENDOFSTREAM : 0; + + return ret; +} + +static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index, DWORD flags, DWORD *actual_index, + DWORD *stream_flags, LONGLONG *timestamp, IMFSample **sample) +{ + struct source_reader *reader = impl_from_IMFSourceReader(iface); + HRESULT hr; + + TRACE("%p, %#x, %#x, %p, %p, %p, %p\n", iface, index, flags, actual_index, stream_flags, timestamp, sample); + + switch (index) + { + case MF_SOURCE_READER_FIRST_VIDEO_STREAM: + index = reader->first_video_stream_index; + break; + case MF_SOURCE_READER_FIRST_AUDIO_STREAM: + index = reader->first_audio_stream_index; + break; + case MF_SOURCE_READER_ANY_STREAM: + FIXME("Non-specific requests are not supported.\n"); + return E_NOTIMPL; + default: + ; + } + + /* FIXME: probably should happen once */ + IMFMediaSource_Start(reader->source, reader->descriptor, NULL, NULL); + + if (reader->async_callback) + { + FIXME("Async mode is not implemented.\n"); + return E_NOTIMPL; + } + else + { + struct media_stream *stream; + + if (!stream_flags || !sample) + return E_POINTER; + + if (actual_index) + *actual_index = index; + + *sample = NULL; + + if (index >= reader->stream_count) + { + *stream_flags = MF_SOURCE_READERF_ERROR; + return MF_E_INVALIDSTREAMNUMBER; + } + + stream = &reader->streams[index]; + + EnterCriticalSection(&stream->cs); + + if (!(flags & MF_SOURCE_READER_CONTROLF_DRAIN)) + { + while (list_empty(&stream->samples) && stream->state != STREAM_STATE_EOS) + { + if (stream->stream) + { + if (FAILED(hr = IMFMediaStream_RequestSample(stream->stream, NULL))) + WARN("Sample request failed, hr %#x.\n", hr); + } + SleepConditionVariableCS(&stream->sample_event, &stream->cs, INFINITE); + } + } + + *sample = media_stream_pop_sample(stream, stream_flags); + + LeaveCriticalSection(&stream->cs); + + TRACE("Got sample %p.\n", *sample); + } + + return S_OK; } static HRESULT WINAPI src_reader_Flush(IMFSourceReader *iface, DWORD index) @@ -922,6 +1016,7 @@ static HRESULT create_source_reader_from_source(IMFMediaSource *source, IMFAttri break; InitializeCriticalSection(&object->streams[i].cs); + InitializeConditionVariable(&object->streams[i].sample_event); list_init(&object->streams[i].samples); } diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 29e8e08..b86fb06 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -315,6 +315,13 @@ todo_wine ok(actual_index == MF_SOURCE_READER_FIRST_VIDEO_STREAM, "Unexpected stream index %u\n", actual_index); ok(stream_flags == MF_SOURCE_READERF_ERROR, "Unexpected stream flags %#x.\n", stream_flags); + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, &stream_flags, ×tamp, + &sample); + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr); + + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, NULL, ×tamp, &sample); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, ×tamp, &sample); ok(hr == S_OK, "Failed to get a sample, hr %#x.\n", hr);
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
81
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Results per page:
10
25
50
100
200