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
February 2021
----- 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
2 participants
915 discussions
Start a n
N
ew thread
Alexandre Julliard : server: Store a filename for memory views of .so dlls.
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: 9ce326eea026f99ecc7c1e45084e8fd53105e8a8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9ce326eea026f99ecc7c1e45…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Feb 15 12:24:15 2021 +0100 server: Store a filename for memory views of .so dlls. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loader.c | 9 +++++---- dlls/ntdll/unix/unix_private.h | 3 ++- dlls/ntdll/unix/virtual.c | 5 +++-- include/wine/server_protocol.h | 3 ++- server/mapping.c | 25 +++++++++++++++++++------ server/protocol.def | 1 + server/trace.c | 3 ++- 7 files changed, 34 insertions(+), 15 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index e8853415205..b82bc10485b 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -981,7 +981,8 @@ static void fill_builtin_image_info( void *module, pe_image_info_t *info ) /*********************************************************************** * dlopen_dll */ -static NTSTATUS dlopen_dll( const char *so_name, void **ret_module, pe_image_info_t *image_info ) +static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name, + void **ret_module, pe_image_info_t *image_info ) { struct builtin_module *builtin; void *module, *handle; @@ -1028,7 +1029,7 @@ static NTSTATUS dlopen_dll( const char *so_name, void **ret_module, pe_image_inf dlclose( handle ); return STATUS_NO_MEMORY; } - virtual_create_builtin_view( module, image_info ); + virtual_create_builtin_view( module, nt_name, image_info ); *ret_module = module; return STATUS_SUCCESS; @@ -1107,7 +1108,7 @@ static NTSTATUS CDECL load_so_dll( UNICODE_STRING *nt_name, void **module ) len = nt_name->Length / sizeof(WCHAR); if (len > 3 && !wcsicmp( nt_name->Buffer + len - 3, soW )) nt_name->Length -= 3 * sizeof(WCHAR); - status = dlopen_dll( unix_name, module, &info ); + status = dlopen_dll( unix_name, nt_name, module, &info ); free( unix_name ); return status; } @@ -1261,7 +1262,7 @@ static NTSTATUS open_builtin_file( char *name, OBJECT_ATTRIBUTES *attr, HANDLE * { pe_image_info_t info; - if (!dlopen_dll( name, module, &info )) + if (!dlopen_dll( name, attr->ObjectName, module, &info )) { virtual_fill_image_information( &info, image_info ); status = STATUS_SUCCESS; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 292a38043dd..af8a14a8c65 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -179,7 +179,8 @@ extern void *anon_mmap_alloc( size_t size, int prot ) DECLSPEC_HIDDEN; extern void virtual_init(void) DECLSPEC_HIDDEN; extern ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN; extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN; -extern NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info ) DECLSPEC_HIDDEN; +extern NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_name, + pe_image_info_t *info ) DECLSPEC_HIDDEN; extern TEB *virtual_alloc_first_teb(void) DECLSPEC_HIDDEN; extern NTSTATUS virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN; extern void virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index e0346a28ea3..c35f9c2fc07 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2483,7 +2483,7 @@ void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) /*********************************************************************** * virtual_create_builtin_view */ -NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info ) +NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_name, pe_image_info_t *info ) { NTSTATUS status; sigset_t sigset; @@ -2500,7 +2500,7 @@ NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info ) VPROT_COMMITTED | VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC ); if (!status) { - TRACE( "created %p-%p\n", base, (char *)base + size ); + TRACE( "created %p-%p for %s\n", base, (char *)base + size, debugstr_us(nt_name) ); /* The PE header is always read-only, no write, no execute. */ set_page_vprot( base, page_size, VPROT_COMMITTED | VPROT_READ ); @@ -2521,6 +2521,7 @@ NTSTATUS virtual_create_builtin_view( void *module, pe_image_info_t *info ) req->base = wine_server_client_ptr( view->base ); req->size = size; wine_server_add_data( req, info, sizeof(*info) ); + wine_server_add_data( req, nt_name->Buffer, nt_name->Length ); status = wine_server_call( req ); } SERVER_END_REQ; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 9b9626c1c84..d2a361df26d 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1923,6 +1923,7 @@ struct map_view_request mem_size_t size; file_pos_t start; /* VARARG(image,pe_image_info); */ + /* VARARG(name,unicode_str); */ }; struct map_view_reply { @@ -6265,7 +6266,7 @@ union generic_reply /* ### protocol_version begin ### */ -#define SERVER_PROTOCOL_VERSION 674 +#define SERVER_PROTOCOL_VERSION 675 /* ### protocol_version end ### */ diff --git a/server/mapping.c b/server/mapping.c index 0e97391f74b..17c7ca26b3a 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -134,6 +134,8 @@ struct memory_view client_ptr_t base; /* view base address (in process addr space) */ mem_size_t size; /* view size */ file_pos_t start; /* start offset in mapping */ + data_size_t namelen; + WCHAR name[1]; /* filename for .so dll image views */ }; @@ -1000,6 +1002,12 @@ const pe_image_info_t *get_view_image_info( const struct memory_view *view, clie /* get the file name for a mapped view */ int get_view_nt_name( const struct memory_view *view, struct unicode_str *name ) { + if (view->namelen) /* .so builtin */ + { + name->str = view->name; + name->len = view->namelen; + return 1; + } if (!view->fd) return 0; get_nt_name( view->fd, name ); return 1; @@ -1157,6 +1165,7 @@ DECL_HANDLER(map_view) { struct mapping *mapping = NULL; struct memory_view *view; + data_size_t namelen = 0; if (!req->size || (req->base & page_mask) || req->base + req->size < req->base) /* overflow */ { @@ -1175,13 +1184,16 @@ DECL_HANDLER(map_view) if (!req->mapping) /* image mapping for a .so dll */ { - if (!(view = mem_alloc( sizeof(*view) ))) return; + if (get_req_data_size() > sizeof(view->image)) namelen = get_req_data_size() - sizeof(view->image); + if (!(view = mem_alloc( offsetof( struct memory_view, name[namelen] )))) return; memset( view, 0, sizeof(*view) ); - view->base = req->base; - view->size = req->size; - view->start = req->start; - view->flags = SEC_IMAGE; + view->base = req->base; + view->size = req->size; + view->start = req->start; + view->flags = SEC_IMAGE; + view->namelen = namelen; memcpy( &view->image, get_req_data(), min( sizeof(view->image), get_req_data_size() )); + memcpy( view->name, (pe_image_info_t *)get_req_data() + 1, namelen ); add_process_view( current, view ); return; } @@ -1204,12 +1216,13 @@ DECL_HANDLER(map_view) goto done; } - if ((view = mem_alloc( sizeof(*view) ))) + if ((view = mem_alloc( offsetof( struct memory_view, name[namelen] )))) { view->base = req->base; view->size = req->size; view->start = req->start; view->flags = mapping->flags; + view->namelen = namelen; view->fd = !is_fd_removable( mapping->fd ) ? (struct fd *)grab_object( mapping->fd ) : NULL; view->committed = mapping->committed ? (struct ranges *)grab_object( mapping->committed ) : NULL; view->shared = mapping->shared ? (struct shared_map *)grab_object( mapping->shared ) : NULL; diff --git a/server/protocol.def b/server/protocol.def index caed5c37352..f85826cc277 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1540,6 +1540,7 @@ enum server_fd_type mem_size_t size; /* view size */ file_pos_t start; /* start offset in mapping */ VARARG(image,pe_image_info);/* image info for .so builtins */ + VARARG(name,unicode_str); /* image filename for .so builtins */ @END diff --git a/server/trace.c b/server/trace.c index 8984b75590d..5265cc69a15 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1308,7 +1308,7 @@ static void dump_varargs_pe_image_info( const char *prefix, data_size_t size ) info.header_size, info.file_size, info.checksum ); dump_client_cpu( ",cpu=", &info.cpu ); fputc( '}', stderr ); - remove_data( size ); + remove_data( min( size, sizeof(info) )); } static void dump_varargs_rawinput_devices(const char *prefix, data_size_t size ) @@ -2158,6 +2158,7 @@ static void dump_map_view_request( const struct map_view_request *req ) dump_uint64( ", size=", &req->size ); dump_uint64( ", start=", &req->start ); dump_varargs_pe_image_info( ", image=", cur_size ); + dump_varargs_unicode_str( ", name=", cur_size ); } static void dump_unmap_view_request( const struct unmap_view_request *req )
1
0
0
0
Bernhard Reiter : imagehlp: Partially implement BindImageEx().
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: d129a89d228190baeb8983ecfc18e093255148b9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d129a89d228190baeb8983ec…
Author: Bernhard Reiter <ockham(a)raz.or.at> Date: Sat Feb 13 11:30:11 2021 -0600 imagehlp: Partially implement BindImageEx(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=3591
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/imagehlp/modify.c | 91 +++++++++++++++++++++++++++++++++++++++++---- dlls/imagehlp/tests/image.c | 10 ++--- 2 files changed, 88 insertions(+), 13 deletions(-) diff --git a/dlls/imagehlp/modify.c b/dlls/imagehlp/modify.c index 434a666ae94..d740d221bfc 100644 --- a/dlls/imagehlp/modify.c +++ b/dlls/imagehlp/modify.c @@ -44,15 +44,90 @@ BOOL WINAPI BindImage( /*********************************************************************** * BindImageEx (IMAGEHLP.@) */ -BOOL WINAPI BindImageEx( - DWORD Flags, PCSTR ImageName, PCSTR DllPath, PCSTR SymbolPath, - PIMAGEHLP_STATUS_ROUTINE StatusRoutine) +BOOL WINAPI BindImageEx(DWORD flags, const char *module, const char *dll_path, + const char *symbol_path, PIMAGEHLP_STATUS_ROUTINE cb) { - FIXME("(%d, %s, %s, %s, %p): stub\n", - Flags, debugstr_a(ImageName), debugstr_a(DllPath), - debugstr_a(SymbolPath), StatusRoutine - ); - return TRUE; + const IMAGE_IMPORT_DESCRIPTOR *import; + LOADED_IMAGE image; + ULONG size; + + TRACE("flags %#x, module %s, dll_path %s, symbol_path %s, cb %p.\n", + flags, debugstr_a(module), debugstr_a(dll_path), debugstr_a(symbol_path), cb); + + if (!(flags & BIND_NO_UPDATE)) + FIXME("Image modification is not implemented.\n"); + if (flags & ~BIND_NO_UPDATE) + FIXME("Ignoring flags %#x.\n", flags); + + if (!MapAndLoad(module, dll_path, &image, TRUE, TRUE)) + return FALSE; + + if (!(import = ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &size))) + { + UnMapAndLoad(&image); + return TRUE; /* no imports */ + } + + if (image.FileHeader->OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC) + { + FIXME("Unhandled architecture %#x.\n", image.FileHeader->OptionalHeader.Magic); + UnMapAndLoad(&image); + return TRUE; + } + + for (; import->Name && import->FirstThunk; ++import) + { + char full_path[MAX_PATH]; + IMAGE_THUNK_DATA *thunk; + const char *dll_name; + DWORD thunk_rva; + + if (!(dll_name = ImageRvaToVa(image.FileHeader, image.MappedAddress, import->Name, 0))) + { + ERR("Failed to get VA for import name RVA %#x.\n", import->Name); + continue; + } + + if (cb) cb(BindImportModule, module, dll_name, 0, 0); + + if (!SearchPathA(dll_path, dll_name, 0, sizeof(full_path), full_path, 0)) + { + ERR("Import %s was not found.\n", debugstr_a(dll_path)); + continue; + } + + thunk_rva = import->OriginalFirstThunk ? import->OriginalFirstThunk : import->FirstThunk; + if (!(thunk = ImageRvaToVa(image.FileHeader, image.MappedAddress, thunk_rva, 0))) + { + ERR("Failed to get VA for import thunk RVA %#x.\n", thunk_rva); + continue; + } + + for (; thunk->u1.Ordinal; ++thunk) + { + if (IMAGE_SNAP_BY_ORDINAL(thunk->u1.Ordinal)) + { + /* FIXME: We apparently need to subtract the actual module's + * ordinal base. */ + FIXME("Ordinal imports are not implemented.\n"); + } + else + { + IMAGE_IMPORT_BY_NAME *name; + + if (!(name = ImageRvaToVa(image.FileHeader, image.MappedAddress, thunk->u1.AddressOfData, 0))) + { + ERR("Failed to get VA for name RVA %#x.\n", thunk->u1.AddressOfData); + continue; + } + + if (cb) cb(BindImportProcedure, module, full_path, 0, (ULONG_PTR)name->Name); + } + } + } + + UnMapAndLoad(&image); + return TRUE; } diff --git a/dlls/imagehlp/tests/image.c b/dlls/imagehlp/tests/image.c index 888744ac203..e2aa9485510 100644 --- a/dlls/imagehlp/tests/image.c +++ b/dlls/imagehlp/tests/image.c @@ -372,7 +372,7 @@ static BOOL WINAPI bind_image_cb(IMAGEHLP_STATUS_REASON reason, const char *file char full_path[MAX_PATH]; BOOL ret; - ok(!!va, "expected nonzero VA\n"); + todo_wine ok(!!va, "expected nonzero VA\n"); ret = SearchPathA(NULL, last_module, ".dll", sizeof(full_path), full_path, NULL); ok(ret, "got error %u\n", GetLastError()); ok(!strcmp(module, full_path), "expected %s, got %s\n", debugstr_a(full_path), debugstr_a(module)); @@ -408,15 +408,15 @@ static void test_bind_image_ex(void) SetLastError(0xdeadbeef); ret = BindImageEx(BIND_ALL_IMAGES | BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE, "nonexistent.dll", 0, 0, bind_image_cb); - todo_wine ok(!ret, "expected failure\n"); - todo_wine ok(GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_INVALID_PARAMETER, + ok(!ret, "expected failure\n"); + ok(GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_INVALID_PARAMETER, "got error %u\n", GetLastError()); ret = BindImageEx(BIND_ALL_IMAGES | BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE, filename, NULL, NULL, bind_image_cb); ok(ret, "got error %u\n", GetLastError()); - todo_wine ok(got_SysAllocString == 1, "got %u imports of SysAllocString\n", got_SysAllocString); - todo_wine ok(got_GetOpenFileNameA == 1, "got %u imports of GetOpenFileNameA\n", got_GetOpenFileNameA); + ok(got_SysAllocString == 1, "got %u imports of SysAllocString\n", got_SysAllocString); + ok(got_GetOpenFileNameA == 1, "got %u imports of GetOpenFileNameA\n", got_GetOpenFileNameA); todo_wine ok(got_SHRegGetIntW == 1, "got %u imports of SHRegGetIntW\n", got_SHRegGetIntW); ret = DeleteFileA(filename);
1
0
0
0
Zebediah Figura : imagehlp/tests: Rewrite test_bind_image_ex() using a DLL resource.
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: 4782b08f31d967243014cff14dd41611edabcea6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4782b08f31d967243014cff1…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 13 11:30:10 2021 -0600 imagehlp/tests: Rewrite test_bind_image_ex() using a DLL resource. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/imagehlp/tests/Makefile.in | 8 +- dlls/imagehlp/tests/image.c | 163 +++++++++++++++++++++------------------ dlls/imagehlp/tests/testdll.c | 30 +++++++ dlls/imagehlp/tests/testdll.spec | 2 + 4 files changed, 127 insertions(+), 76 deletions(-) diff --git a/dlls/imagehlp/tests/Makefile.in b/dlls/imagehlp/tests/Makefile.in index 43b434f690a..1a5c393add5 100644 --- a/dlls/imagehlp/tests/Makefile.in +++ b/dlls/imagehlp/tests/Makefile.in @@ -1,6 +1,10 @@ TESTDLL = imagehlp.dll IMPORTS = imagehlp psapi -C_SRCS = \ +testdll_IMPORTS = oleaut32 comdlg32 shlwapi + +SOURCES = \ image.c \ - integrity.c + integrity.c \ + testdll.c \ + testdll.spec diff --git a/dlls/imagehlp/tests/image.c b/dlls/imagehlp/tests/image.c index c8d1a520c96..888744ac203 100644 --- a/dlls/imagehlp/tests/image.c +++ b/dlls/imagehlp/tests/image.c @@ -24,10 +24,36 @@ #include <winbase.h> #include <winver.h> #include <winnt.h> +#include <winuser.h> #include <imagehlp.h> #include "wine/test.h" +static char *load_resource(const char *name) +{ + static char path[MAX_PATH]; + DWORD written; + HANDLE file; + HRSRC res; + void *ptr; + + GetTempPathA(ARRAY_SIZE(path), path); + strcat(path, name); + + file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n", + debugstr_a(path), GetLastError()); + + res = FindResourceA(NULL, name, "TESTDLL"); + ok(!!res, "Failed to load resource, error %u.\n", GetLastError()); + ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res)); + WriteFile(file, ptr, SizeofResource( GetModuleHandleA(NULL), res), &written, NULL); + ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n"); + CloseHandle(file); + + return path; +} + /* minimal PE file image */ #define VA_START 0x400000 #define FILE_PE_START 0x50 @@ -145,9 +171,6 @@ struct expected_update_accum BOOL todo; }; -static int status_routine_called[BindSymbolsNotUpdated+1]; - - static BOOL WINAPI accumulating_stream_output(DIGEST_HANDLE handle, BYTE *pb, DWORD cb) { @@ -270,40 +293,6 @@ static void update_checksum(void) bin.nt_headers.OptionalHeader.CheckSum = sum; } -static BOOL CALLBACK testing_status_routine(IMAGEHLP_STATUS_REASON reason, const char *ImageName, - const char *DllName, ULONG_PTR Va, ULONG_PTR Parameter) -{ - char kernel32_path[MAX_PATH]; - - if (0 <= (int)reason && reason <= BindSymbolsNotUpdated) - status_routine_called[reason]++; - else - ok(0, "expected reason between 0 and %d, got %d\n", BindSymbolsNotUpdated+1, reason); - - switch(reason) - { - case BindImportModule: - ok(!strcmp(DllName, "KERNEL32.DLL"), "expected DllName to be KERNEL32.DLL, got %s\n", - DllName); - break; - - case BindImportProcedure: - case BindForwarderNOT: - GetSystemDirectoryA(kernel32_path, MAX_PATH); - strcat(kernel32_path, "\\KERNEL32.DLL"); - ok(!lstrcmpiA(DllName, kernel32_path), "expected DllName to be %s, got %s\n", - kernel32_path, DllName); - ok(!strcmp((char *)Parameter, "ExitProcess"), - "expected Parameter to be ExitProcess, got %s\n", (char *)Parameter); - break; - - default: - ok(0, "got unexpected reason %d\n", reason); - break; - } - return TRUE; -} - static void test_get_digest_stream(void) { BOOL ret; @@ -360,52 +349,78 @@ static void test_get_digest_stream(void) DeleteFileA(temp_file); } -static void test_bind_image_ex(void) +static unsigned int got_SysAllocString, got_GetOpenFileNameA, got_SHRegGetIntW; + +static BOOL WINAPI bind_image_cb(IMAGEHLP_STATUS_REASON reason, const char *file, + const char *module, ULONG_PTR va, ULONG_PTR param) { - BOOL ret; - HANDLE file; - char temp_file[MAX_PATH]; - DWORD count; + static char last_module[MAX_PATH]; - /* call with a non-existent file */ - SetLastError(0xdeadbeef); - ret = BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES, "nonexistent.dll", 0, 0, - testing_status_routine); - todo_wine ok(!ret && ((GetLastError() == ERROR_FILE_NOT_FOUND) || - (GetLastError() == ERROR_INVALID_PARAMETER)), - "expected ERROR_FILE_NOT_FOUND or ERROR_INVALID_PARAMETER, got %d\n", - GetLastError()); + if (winetest_debug > 1) + trace("reason %u, file %s, module %s, va %#Ix, param %#Ix\n", + reason, debugstr_a(file), debugstr_a(module), va, param); - file = create_temp_file(temp_file); - if (file == INVALID_HANDLE_VALUE) + if (reason == BindImportModule) { - skip("couldn't create temp file\n"); - return; + ok(!strchr(module, '\\'), "got module name %s\n", debugstr_a(module)); + strcpy(last_module, module); + ok(!va, "got VA %#Ix\n", va); + ok(!param, "got param %#Ix\n", param); } + else if (reason == BindImportProcedure) + { + char full_path[MAX_PATH]; + BOOL ret; - WriteFile(file, &bin, sizeof(bin), &count, NULL); - CloseHandle(file); - - /* call with a proper PE file, but with StatusRoutine set to NULL */ - ret = BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES, temp_file, 0, 0, - NULL); - ok(ret, "BindImageEx failed: %d\n", GetLastError()); - - /* call with a proper PE file and StatusRoutine */ - ret = BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES, temp_file, 0, 0, - testing_status_routine); - ok(ret, "BindImageEx failed: %d\n", GetLastError()); + ok(!!va, "expected nonzero VA\n"); + ret = SearchPathA(NULL, last_module, ".dll", sizeof(full_path), full_path, NULL); + ok(ret, "got error %u\n", GetLastError()); + ok(!strcmp(module, full_path), "expected %s, got %s\n", debugstr_a(full_path), debugstr_a(module)); - todo_wine ok(status_routine_called[BindImportModule] == 1, - "StatusRoutine was called %d times\n", status_routine_called[BindImportModule]); + if (!strcmp((const char *)param, "SysAllocString")) + { + ok(!strcmp(last_module, "oleaut32.dll"), "got wrong module %s\n", debugstr_a(module)); + ++got_SysAllocString; + } + else if (!strcmp((const char *)param, "GetOpenFileNameA")) + { + ok(!strcmp(last_module, "comdlg32.dll"), "got wrong module %s\n", debugstr_a(module)); + ++got_GetOpenFileNameA; + } + else if (!strcmp((const char *)param, "Ordinal117")) + { + ok(!strcmp(last_module, "shlwapi.dll"), "got wrong module %s\n", debugstr_a(module)); + ++got_SHRegGetIntW; + } + } + else + { + ok(0, "got unexpected reason %#x\n", reason); + } + return TRUE; +} - todo_wine ok((status_routine_called[BindImportProcedure] == 1) -#if defined(_WIN64) - || broken(status_routine_called[BindImportProcedure] == 0) /* < Win8 */ -#endif - , "StatusRoutine was called %d times\n", status_routine_called[BindImportProcedure]); +static void test_bind_image_ex(void) +{ + const char *filename = load_resource("testdll.dll"); + BOOL ret; - DeleteFileA(temp_file); + SetLastError(0xdeadbeef); + ret = BindImageEx(BIND_ALL_IMAGES | BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE, + "nonexistent.dll", 0, 0, bind_image_cb); + todo_wine ok(!ret, "expected failure\n"); + todo_wine ok(GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_INVALID_PARAMETER, + "got error %u\n", GetLastError()); + + ret = BindImageEx(BIND_ALL_IMAGES | BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE, + filename, NULL, NULL, bind_image_cb); + ok(ret, "got error %u\n", GetLastError()); + todo_wine ok(got_SysAllocString == 1, "got %u imports of SysAllocString\n", got_SysAllocString); + todo_wine ok(got_GetOpenFileNameA == 1, "got %u imports of GetOpenFileNameA\n", got_GetOpenFileNameA); + todo_wine ok(got_SHRegGetIntW == 1, "got %u imports of SHRegGetIntW\n", got_SHRegGetIntW); + + ret = DeleteFileA(filename); + ok(ret, "got error %u\n", GetLastError()); } static void test_image_load(void) diff --git a/dlls/imagehlp/tests/testdll.c b/dlls/imagehlp/tests/testdll.c new file mode 100644 index 00000000000..3c079bfffd3 --- /dev/null +++ b/dlls/imagehlp/tests/testdll.c @@ -0,0 +1,30 @@ +/* + * Copyright 2021 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <oaidl.h> +#include <commdlg.h> +#include <shlwapi.h> + +extern DWORD WINAPI StrCmpCA(const char *, const char *); + +void export(void) +{ + SysAllocString(NULL); + GetOpenFileNameA(NULL); + SHRegGetIntW(NULL, NULL, 0); +} diff --git a/dlls/imagehlp/tests/testdll.spec b/dlls/imagehlp/tests/testdll.spec new file mode 100644 index 00000000000..7d5774e346b --- /dev/null +++ b/dlls/imagehlp/tests/testdll.spec @@ -0,0 +1,2 @@ +@ cdecl export() +@ stdcall VariantInit(ptr) oleaut32.VariantInit
1
0
0
0
Zebediah Figura : imagehlp/tests: Use ImageNtHeader instead of RtlImageNtHeader.
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: 803730ca872be5521b51422c9bd790b0979a49c0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=803730ca872be5521b51422c…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 13 11:30:09 2021 -0600 imagehlp/tests: Use ImageNtHeader instead of RtlImageNtHeader. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/imagehlp/tests/integrity.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/dlls/imagehlp/tests/integrity.c b/dlls/imagehlp/tests/integrity.c index 6d820fa0b1d..fbe40995f2f 100644 --- a/dlls/imagehlp/tests/integrity.c +++ b/dlls/imagehlp/tests/integrity.c @@ -29,11 +29,8 @@ #define PSAPI_VERSION 1 #include "psapi.h" -static HMODULE hNtdll; static char test_dll_path[MAX_PATH]; -static PIMAGE_NT_HEADERS (WINAPI *pRtlImageNtHeader)(PVOID); - static const char test_cert_data[] = {0x30,0x82,0x02,0xE1,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x02 ,0xA0,0x82,0x02,0xD2,0x30,0x82,0x02,0xCE,0x02,0x01,0x01,0x31,0x00,0x30,0x0B @@ -337,7 +334,7 @@ static void test_pe_checksum(void) todo_wine ok(checksum_orig == 0, "Expected 0, got %x\n", checksum_orig); todo_wine ok(checksum_new != 0 && checksum_new != 0xdeadbeef, "Got unexpected value %x\n", checksum_new); - nt_header = pRtlImageNtHeader( modinfo.lpBaseOfDll ); + nt_header = ImageNtHeader( modinfo.lpBaseOfDll ); checksum_correct = nt_header->OptionalHeader.CheckSum; checksum_orig = checksum_new = 0xdeadbeef; @@ -377,10 +374,6 @@ START_TEST(integrity) file_size_orig = get_file_size(); - hNtdll = LoadLibraryA("ntdll.dll"); - if (hNtdll) - pRtlImageNtHeader = (void *) GetProcAddress(hNtdll, "RtlImageNtHeader"); - first = test_add_certificate(test_cert_data, sizeof(test_cert_data)); test_get_certificate(test_cert_data, first); test_remove_certificate(first); @@ -408,6 +401,5 @@ START_TEST(integrity) test_pe_checksum(); - if (hNtdll) FreeLibrary(hNtdll); DeleteFileA(test_dll_path); }
1
0
0
0
Zebediah Figura : imagehlp/tests: Link directly to imagehlp and psapi.
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: 670913af218ce8229eea646534261a33a9ff1b1a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=670913af218ce8229eea6465…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 13 11:30:08 2021 -0600 imagehlp/tests: Link directly to imagehlp and psapi. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/imagehlp/tests/Makefile.in | 1 + dlls/imagehlp/tests/image.c | 67 ++++++------------------------- dlls/imagehlp/tests/integrity.c | 88 +++++++++++------------------------------ 3 files changed, 35 insertions(+), 121 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=670913af218ce8229eea…
1
0
0
0
Zebediah Figura : winegstreamer: Do not compare FPS in wg_format_compare().
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: 408c178d1122d8d37015a144bfc8e06b6a465c85 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=408c178d1122d8d37015a144…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sun Feb 14 15:26:29 2021 -0600 winegstreamer: Do not compare FPS in wg_format_compare(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50667
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/wg_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 8468bde4894..1cbe123ca2f 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -307,10 +307,10 @@ static bool wg_format_compare(const struct wg_format *a, const struct wg_format && a->u.audio.rate == b->u.audio.rate; case WG_MAJOR_TYPE_VIDEO: + /* Do not compare FPS. */ return a->u.video.format == b->u.video.format && a->u.video.width == b->u.video.width - && a->u.video.height == b->u.video.height - && a->u.video.fps_d * b->u.video.fps_n == a->u.video.fps_n * b->u.video.fps_d; + && a->u.video.height == b->u.video.height; } assert(0);
1
0
0
0
Zebediah Figura : winegstreamer: Retrieve wg_parser streams through Unix library functions.
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: f98722fe3b1dfca702a9f40788bffb77c450998e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f98722fe3b1dfca702a9f407…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 13 11:33:06 2021 -0600 winegstreamer: Retrieve wg_parser streams through Unix library functions. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/gst_private.h | 3 +++ dlls/winegstreamer/gstdemux.c | 18 ++++++++++-------- dlls/winegstreamer/wg_parser.c | 13 +++++++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 0ddd9ea1da8..0a37e10c840 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -214,6 +214,9 @@ struct unix_funcs HRESULT (CDECL *wg_parser_connect)(struct wg_parser *parser, uint64_t file_size); void (CDECL *wg_parser_disconnect)(struct wg_parser *parser); + + uint32_t (CDECL *wg_parser_get_stream_count)(struct wg_parser *parser); + struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index); }; extern const struct unix_funcs *unix_funcs; diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 2093608c443..be1c59453d5 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1039,13 +1039,14 @@ static BOOL decodebin_parser_filter_init_gst(struct parser *filter) { static const WCHAR formatW[] = {'S','t','r','e','a','m',' ','%','0','2','u',0}; struct wg_parser *parser = filter->wg_parser; + unsigned int i, stream_count; WCHAR source_name[20]; - unsigned int i; - for (i = 0; i < parser->stream_count; ++i) + stream_count = unix_funcs->wg_parser_get_stream_count(parser); + for (i = 0; i < stream_count; ++i) { sprintfW(source_name, formatW, i); - if (!create_pin(filter, parser->streams[i], source_name)) + if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, i), source_name)) return FALSE; } @@ -1664,7 +1665,7 @@ static BOOL wave_parser_filter_init_gst(struct parser *filter) static const WCHAR source_name[] = {'o','u','t','p','u','t',0}; struct wg_parser *parser = filter->wg_parser; - if (!create_pin(filter, parser->streams[0], source_name)) + if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, 0), source_name)) return FALSE; return TRUE; @@ -1744,13 +1745,14 @@ static BOOL avi_splitter_filter_init_gst(struct parser *filter) { static const WCHAR formatW[] = {'S','t','r','e','a','m',' ','%','0','2','u',0}; struct wg_parser *parser = filter->wg_parser; + uint32_t i, stream_count; WCHAR source_name[20]; - unsigned int i; - for (i = 0; i < parser->stream_count; ++i) + stream_count = unix_funcs->wg_parser_get_stream_count(parser); + for (i = 0; i < stream_count; ++i) { sprintfW(source_name, formatW, i); - if (!create_pin(filter, parser->streams[i], source_name)) + if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, i), source_name)) return FALSE; } @@ -1837,7 +1839,7 @@ static BOOL mpeg_splitter_filter_init_gst(struct parser *filter) static const WCHAR source_name[] = {'A','u','d','i','o',0}; struct wg_parser *parser = filter->wg_parser; - if (!create_pin(filter, parser->streams[0], source_name)) + if (!create_pin(filter, unix_funcs->wg_parser_get_stream(parser, 0), source_name)) return FALSE; return TRUE; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 31b5a67032a..8468bde4894 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -317,6 +317,16 @@ static bool wg_format_compare(const struct wg_format *a, const struct wg_format return false; } +static uint32_t CDECL wg_parser_get_stream_count(struct wg_parser *parser) +{ + return parser->stream_count; +} + +static struct wg_parser_stream * CDECL wg_parser_get_stream(struct wg_parser *parser, uint32_t index) +{ + return parser->streams[index]; +} + static GstAutoplugSelectResult autoplug_blacklist(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) { const char *name = gst_element_factory_get_longname(fact); @@ -1467,6 +1477,9 @@ static const struct unix_funcs funcs = wg_parser_connect, wg_parser_disconnect, + + wg_parser_get_stream_count, + wg_parser_get_stream, }; NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)
1
0
0
0
Zebediah Figura : winegstreamer: Move wg_parser sink disconnection code to the Unix library.
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: 507ba18d08dd22e6dc02e6cd84e09f270fff7b86 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=507ba18d08dd22e6dc02e6cd…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 13 11:33:05 2021 -0600 winegstreamer: Move wg_parser sink disconnection code to the Unix library. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/gstdemux.c | 55 ++---------------------------------- dlls/winegstreamer/wg_parser.c | 61 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 52 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index ce500a92356..0ddd9ea1da8 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -213,6 +213,7 @@ struct unix_funcs void (CDECL *wg_parser_destroy)(struct wg_parser *parser); HRESULT (CDECL *wg_parser_connect)(struct wg_parser *parser, uint64_t file_size); + void (CDECL *wg_parser_disconnect)(struct wg_parser *parser); }; extern const struct unix_funcs *unix_funcs; diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 9a74e09f5dd..2093608c443 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1546,30 +1546,6 @@ static void source_disconnect(struct strmbase_source *iface) stream->enabled = false; } -static void free_stream(struct wg_parser_stream *stream) -{ - if (stream->their_src) - { - if (stream->post_sink) - { - gst_pad_unlink(stream->their_src, stream->post_sink); - gst_pad_unlink(stream->post_src, stream->my_sink); - gst_object_unref(stream->post_src); - gst_object_unref(stream->post_sink); - stream->post_src = stream->post_sink = NULL; - } - else - gst_pad_unlink(stream->their_src, stream->my_sink); - gst_object_unref(stream->their_src); - } - gst_object_unref(stream->my_sink); - - pthread_cond_destroy(&stream->event_cond); - pthread_cond_destroy(&stream->event_empty_cond); - - free(stream); -} - static void free_source_pin(struct parser_source *pin) { if (pin->pin.pin.peer) @@ -1579,8 +1555,6 @@ static void free_source_pin(struct parser_source *pin) IPin_Disconnect(&pin->pin.pin.IPin_iface); } - free_stream(pin->wg_stream); - pin->flushing_cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&pin->flushing_cs); @@ -1628,37 +1602,19 @@ static struct parser_source *create_pin(struct parser *filter, static HRESULT GST_RemoveOutputPins(struct parser *This) { - struct wg_parser *parser = This->wg_parser; unsigned int i; TRACE("(%p)\n", This); mark_wine_thread(); - if (!parser->container) + if (!This->sink_connected) return S_OK; - /* Unblock all of our streams. */ - pthread_mutex_lock(&parser->mutex); - for (i = 0; i < parser->stream_count; ++i) - { - parser->streams[i]->flushing = true; - pthread_cond_signal(&parser->streams[i]->event_empty_cond); - } - pthread_mutex_unlock(&parser->mutex); - - gst_element_set_state(parser->container, GST_STATE_NULL); - gst_pad_unlink(parser->my_src, parser->their_sink); - gst_object_unref(parser->my_src); - gst_object_unref(parser->their_sink); - parser->my_src = parser->their_sink = NULL; + unix_funcs->wg_parser_disconnect(This->wg_parser); /* read_thread() needs to stay alive to service any read requests GStreamer * sends, so we can only shut it down after GStreamer stops. */ This->sink_connected = false; - pthread_mutex_lock(&parser->mutex); - parser->sink_connected = false; - pthread_mutex_unlock(&parser->mutex); - pthread_cond_signal(&parser->read_cond); WaitForSingleObject(This->read_thread, INFINITE); CloseHandle(This->read_thread); @@ -1671,12 +1627,7 @@ static HRESULT GST_RemoveOutputPins(struct parser *This) This->source_count = 0; heap_free(This->sources); This->sources = NULL; - parser->stream_count = 0; - free(parser->streams); - parser->streams = NULL; - gst_element_set_bus(parser->container, NULL); - gst_object_unref(parser->container); - parser->container = NULL; + BaseFilterImpl_IncrementPinVersion(&This->filter); return S_OK; } diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 3e7c41d644d..31b5a67032a 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -1127,6 +1127,66 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s return S_OK; } +static void free_stream(struct wg_parser_stream *stream) +{ + if (stream->their_src) + { + if (stream->post_sink) + { + gst_pad_unlink(stream->their_src, stream->post_sink); + gst_pad_unlink(stream->post_src, stream->my_sink); + gst_object_unref(stream->post_src); + gst_object_unref(stream->post_sink); + stream->post_src = stream->post_sink = NULL; + } + else + gst_pad_unlink(stream->their_src, stream->my_sink); + gst_object_unref(stream->their_src); + } + gst_object_unref(stream->my_sink); + + pthread_cond_destroy(&stream->event_cond); + pthread_cond_destroy(&stream->event_empty_cond); + + free(stream); +} + +static void CDECL wg_parser_disconnect(struct wg_parser *parser) +{ + unsigned int i; + + /* Unblock all of our streams. */ + pthread_mutex_lock(&parser->mutex); + for (i = 0; i < parser->stream_count; ++i) + { + parser->streams[i]->flushing = true; + pthread_cond_signal(&parser->streams[i]->event_empty_cond); + } + pthread_mutex_unlock(&parser->mutex); + + gst_element_set_state(parser->container, GST_STATE_NULL); + gst_pad_unlink(parser->my_src, parser->their_sink); + gst_object_unref(parser->my_src); + gst_object_unref(parser->their_sink); + parser->my_src = parser->their_sink = NULL; + + pthread_mutex_lock(&parser->mutex); + parser->sink_connected = false; + pthread_mutex_unlock(&parser->mutex); + pthread_cond_signal(&parser->read_cond); + + for (i = 0; i < parser->stream_count; ++i) + free_stream(parser->streams[i]); + + parser->stream_count = 0; + free(parser->streams); + parser->streams = NULL; + + gst_element_set_bus(parser->container, NULL); + gst_object_unref(parser->container); + parser->container = NULL; +} + static BOOL decodebin_parser_init_gst(struct wg_parser *parser) { GstElement *element = gst_element_factory_make("decodebin", NULL); @@ -1406,6 +1466,7 @@ static const struct unix_funcs funcs = wg_parser_destroy, wg_parser_connect, + wg_parser_disconnect, }; NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)
1
0
0
0
Zebediah Figura : winegstreamer: Move GST_Connect() to the Unix library.
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: 6c67a0a6be3c331a3dff346fc4956cbd6e1a15d1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6c67a0a6be3c331a3dff346f…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 13 11:33:04 2021 -0600 winegstreamer: Move GST_Connect() to the Unix library. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/gst_private.h | 2 + dlls/winegstreamer/gstdemux.c | 372 +-------------------------------------- dlls/winegstreamer/wg_parser.c | 372 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 375 insertions(+), 371 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=6c67a0a6be3c331a3dff…
1
0
0
0
Zebediah Figura : winegstreamer: Move filter initialization out of GST_Connect().
by Alexandre Julliard
15 Feb '21
15 Feb '21
Module: wine Branch: master Commit: c5c40f22608fedfb523672f20a7cf4b9d16ca4bc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c5c40f22608fedfb523672f2…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sat Feb 13 11:33:03 2021 -0600 winegstreamer: Move filter initialization out of GST_Connect(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winegstreamer/gstdemux.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 40c5e7ae017..8b63aa57702 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1134,25 +1134,18 @@ static LONGLONG query_duration(GstPad *pad) return 0; } -static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin) +static HRESULT GST_Connect(struct wg_parser *parser, LONGLONG file_size) { - struct wg_parser *parser = This->wg_parser; unsigned int i; - LONGLONG avail; GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( "quartz_src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); - IAsyncReader_Length(This->reader, &This->file_size, &avail); - parser->file_size = This->file_size; - - This->sink_connected = true; + parser->file_size = file_size; parser->sink_connected = true; - This->read_thread = CreateThread(NULL, 0, read_thread, This, 0, NULL); - if (!parser->bus) { parser->bus = gst_bus_new(); @@ -1170,7 +1163,6 @@ static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin) gst_pad_set_element_private(parser->my_src, parser); parser->start_offset = parser->next_offset = parser->stop_offset = 0; - This->next_pull_offset = 0; if (!parser->init_gst(parser)) return E_FAIL; @@ -1194,7 +1186,6 @@ static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin) pthread_mutex_unlock(&parser->mutex); parser->next_offset = 0; - This->next_pull_offset = 0; return S_OK; } @@ -1357,6 +1348,7 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons { struct parser *filter = impl_from_strmbase_sink(iface); HRESULT hr = S_OK; + LONGLONG unused; unsigned int i; mark_wine_thread(); @@ -1365,7 +1357,13 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons if (FAILED(hr = IPin_QueryInterface(peer, &IID_IAsyncReader, (void **)&filter->reader))) return hr; - if (FAILED(hr = GST_Connect(filter, peer))) + IAsyncReader_Length(filter->reader, &filter->file_size, &unused); + + filter->sink_connected = true; + filter->read_thread = CreateThread(NULL, 0, read_thread, filter, 0, NULL); + filter->next_pull_offset = 0; + + if (FAILED(hr = GST_Connect(filter->wg_parser, filter->file_size))) goto err; if (!filter->init_gst(filter))
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
92
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
82
83
84
85
86
87
88
89
90
91
92
Results per page:
10
25
50
100
200