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 2012
----- 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
718 discussions
Start a n
N
ew thread
Alexandre Julliard : kernel32: Fix buffer overflows in K32GetModuleFileNameExA/W.
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: d08f34cd8ecd883a0f0c6bd9b150d92407f0f7c9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d08f34cd8ecd883a0f0c6bd9b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 30 14:19:57 2012 +0200 kernel32: Fix buffer overflows in K32GetModuleFileNameExA/W. --- dlls/kernel32/module.c | 31 ++++++++++++++++++++++++----- dlls/psapi/tests/psapi_main.c | 42 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c index 6b91a4c..57a24ba 100644 --- a/dlls/kernel32/module.c +++ b/dlls/kernel32/module.c @@ -1247,17 +1247,26 @@ DWORD WINAPI K32GetModuleFileNameExW(HANDLE process, HMODULE module, LPWSTR file_name, DWORD size) { LDR_MODULE ldr_module; + DWORD len; + + if (!size) return 0; if(!get_ldr_module(process, module, &ldr_module)) return 0; - size = min(ldr_module.FullDllName.Length / sizeof(WCHAR), size); + len = ldr_module.FullDllName.Length / sizeof(WCHAR); + if (size <= len) + { + len = size; + size--; + } + if (!ReadProcessMemory(process, ldr_module.FullDllName.Buffer, file_name, size * sizeof(WCHAR), NULL)) return 0; file_name[size] = 0; - return size; + return len; } /*********************************************************************** @@ -1267,32 +1276,42 @@ DWORD WINAPI K32GetModuleFileNameExA(HANDLE process, HMODULE module, LPSTR file_name, DWORD size) { WCHAR *ptr; + DWORD len; TRACE("(hProcess=%p, hModule=%p, %p, %d)\n", process, module, file_name, size); - if (!file_name || !size) return 0; + if (!file_name || !size) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } if ( process == GetCurrentProcess() ) { - DWORD len = GetModuleFileNameA( module, file_name, size ); + len = GetModuleFileNameA( module, file_name, size ); if (size) file_name[size - 1] = '\0'; return len; } if (!(ptr = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)))) return 0; - if (!K32GetModuleFileNameExW(process, module, ptr, size)) + len = K32GetModuleFileNameExW(process, module, ptr, size); + if (!len) { file_name[0] = '\0'; } else { if (!WideCharToMultiByte( CP_ACP, 0, ptr, -1, file_name, size, NULL, NULL )) + { file_name[size - 1] = 0; + len = size; + } + else if (len < size) len = strlen( file_name ); } HeapFree(GetProcessHeap(), 0, ptr); - return strlen(file_name); + return len; } /*********************************************************************** diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c index 1944065..8db695e 100644 --- a/dlls/psapi/tests/psapi_main.c +++ b/dlls/psapi/tests/psapi_main.c @@ -49,6 +49,7 @@ static BOOL (WINAPI *pEnumProcesses)(DWORD*, DWORD, DWORD*); static BOOL (WINAPI *pEnumProcessModules)(HANDLE, HMODULE*, DWORD, LPDWORD); static DWORD (WINAPI *pGetModuleBaseNameA)(HANDLE, HMODULE, LPSTR, DWORD); static DWORD (WINAPI *pGetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, DWORD); +static DWORD (WINAPI *pGetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, DWORD); static BOOL (WINAPI *pGetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD); static DWORD (WINAPI *pGetMappedFileNameA)(HANDLE, LPVOID, LPSTR, DWORD); static DWORD (WINAPI *pGetMappedFileNameW)(HANDLE, LPVOID, LPWSTR, DWORD); @@ -67,6 +68,7 @@ static BOOL InitFunctionPtrs(HMODULE hpsapi) PSAPI_GET_PROC(EnumProcesses); PSAPI_GET_PROC(GetModuleBaseNameA); PSAPI_GET_PROC(GetModuleFileNameExA); + PSAPI_GET_PROC(GetModuleFileNameExW); PSAPI_GET_PROC(GetModuleInformation); PSAPI_GET_PROC(GetMappedFileNameA); PSAPI_GET_PROC(GetMappedFileNameW); @@ -471,18 +473,22 @@ static void test_GetModuleFileNameEx(void) { HMODULE hMod = GetModuleHandle(NULL); char szModExPath[MAX_PATH+1], szModPath[MAX_PATH+1]; + WCHAR buffer[MAX_PATH]; DWORD ret; - + SetLastError(0xdeadbeef); - pGetModuleFileNameExA(NULL, hMod, szModExPath, sizeof(szModExPath)); + ret = pGetModuleFileNameExA(NULL, hMod, szModExPath, sizeof(szModExPath)); + ok( !ret, "GetModuleFileNameExA succeeded\n" ); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetModuleFileNameExA(hpQI, hMod, szModExPath, sizeof(szModExPath)); + ret = pGetModuleFileNameExA(hpQI, hMod, szModExPath, sizeof(szModExPath)); + ok( !ret, "GetModuleFileNameExA succeeded\n" ); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetModuleFileNameExA(hpQV, hBad, szModExPath, sizeof(szModExPath)); + ret = pGetModuleFileNameExA(hpQV, hBad, szModExPath, sizeof(szModExPath)); + ok( !ret, "GetModuleFileNameExA succeeded\n" ); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); ret = pGetModuleFileNameExA(hpQV, NULL, szModExPath, sizeof(szModExPath)); @@ -492,6 +498,34 @@ static void test_GetModuleFileNameEx(void) GetModuleFileNameA(NULL, szModPath, sizeof(szModPath)); ok(!strncmp(szModExPath, szModPath, MAX_PATH), "szModExPath=\"%s\" szModPath=\"%s\"\n", szModExPath, szModPath); + + SetLastError(0xdeadbeef); + memset( szModExPath, 0xcc, sizeof(szModExPath) ); + ret = pGetModuleFileNameExA(hpQV, NULL, szModExPath, 4 ); + ok( ret == 4, "wrong length %u\n", ret ); + ok( broken(szModExPath[3]) /*w2kpro*/ || strlen(szModExPath) == 3, + "szModExPath=\"%s\" ret=%d\n", szModExPath, ret ); + ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = pGetModuleFileNameExA(hpQV, NULL, szModExPath, 0 ); + ok( ret == 0, "wrong length %u\n", ret ); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + memset( buffer, 0xcc, sizeof(buffer) ); + ret = pGetModuleFileNameExW(hpQV, NULL, buffer, 4 ); + ok( ret == 4, "wrong length %u\n", ret ); + ok( broken(buffer[3]) /*w2kpro*/ || lstrlenW(buffer) == 3, + "buffer=%s ret=%d\n", wine_dbgstr_w(buffer), ret ); + ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + buffer[0] = 0xcc; + ret = pGetModuleFileNameExW(hpQV, NULL, buffer, 0 ); + ok( ret == 0, "wrong length %u\n", ret ); + ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError()); + ok( buffer[0] == 0xcc, "buffer modified %s\n", wine_dbgstr_w(buffer) ); } static void test_GetModuleBaseName(void)
1
0
0
0
Hans Leidekker : msi: Add support for uninstalling global assemblies.
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: 605e0b7b4176bf5e5cf5888073103016e56b8a2f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=605e0b7b4176bf5e5cf588807…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon Apr 30 09:35:25 2012 +0200 msi: Add support for uninstalling global assemblies. --- dlls/msi/assembly.c | 39 +++++++++++++++++++++++++++++++++++++++ dlls/msi/files.c | 16 ++++++++++------ dlls/msi/msipriv.h | 1 + 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/dlls/msi/assembly.c b/dlls/msi/assembly.c index af23c4a..712bb23 100644 --- a/dlls/msi/assembly.c +++ b/dlls/msi/assembly.c @@ -425,6 +425,45 @@ UINT msi_install_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) return ERROR_SUCCESS; } +UINT msi_uninstall_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) +{ + HRESULT hr; + IAssemblyCache *cache; + MSIASSEMBLY *assembly = comp->assembly; + MSIFEATURE *feature = NULL; + + if (comp->assembly->feature) + feature = msi_get_loaded_feature( package, comp->assembly->feature ); + + if (assembly->application) + { + if (feature) feature->Action = INSTALLSTATE_ABSENT; + return ERROR_SUCCESS; + } + TRACE("removing %s\n", debugstr_w(assembly->display_name)); + + if (assembly->attributes == msidbAssemblyAttributesWin32) + { + cache = package->cache_sxs; + hr = IAssemblyCache_UninstallAssembly( cache, 0, assembly->display_name, NULL, NULL ); + if (FAILED( hr )) WARN("failed to uninstall assembly 0x%08x\n", hr); + } + else + { + unsigned int i; + for (i = 0; i < CLR_VERSION_MAX; i++) + { + if (!assembly->clr_version[i]) continue; + cache = package->cache_net[i]; + hr = IAssemblyCache_UninstallAssembly( cache, 0, assembly->display_name, NULL, NULL ); + if (FAILED( hr )) WARN("failed to uninstall assembly 0x%08x\n", hr); + } + } + if (feature) feature->Action = INSTALLSTATE_ABSENT; + assembly->installed = FALSE; + return ERROR_SUCCESS; +} + static WCHAR *build_local_assembly_path( const WCHAR *filename ) { UINT i; diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 6edf781..fe72c24 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -1308,22 +1308,26 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package ) msi_ui_actiondata( package, szRemoveFiles, uirow ); msiobj_release( &uirow->hdr ); } + + msi_init_assembly_caches( package ); LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) { - MSIFOLDER *folder; - comp->Action = msi_get_component_action( package, comp ); if (comp->Action != INSTALLSTATE_ABSENT) continue; - if (comp->assembly && !comp->assembly->application) continue; - if (comp->Attributes & msidbComponentAttributesPermanent) { TRACE("permanent component, not removing directory\n"); continue; } - folder = msi_get_loaded_folder( package, comp->Directory ); - remove_folder( folder ); + if (comp->assembly && !comp->assembly->application) + msi_uninstall_assembly( package, comp ); + else + { + MSIFOLDER *folder = msi_get_loaded_folder( package, comp->Directory ); + remove_folder( folder ); + } } + msi_destroy_assembly_caches( package ); return ERROR_SUCCESS; } diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index bdce06b..80f5414 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -1027,6 +1027,7 @@ extern UINT msi_create_empty_local_file(LPWSTR path, LPCWSTR suffix) DECLSPEC_HI extern UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) DECLSPEC_HIDDEN; extern MSIASSEMBLY *msi_load_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN; extern UINT msi_install_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN; +extern UINT msi_uninstall_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN; extern BOOL msi_init_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN; extern void msi_destroy_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN; extern WCHAR *msi_font_version_from_file(const WCHAR *) DECLSPEC_HIDDEN;
1
0
0
0
Hans Leidekker : sxs: Add locking around operations on the assembly cache.
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: 9790edd2192bfdb2009a9e06fe6bede025b77b1a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9790edd2192bfdb2009a9e06f…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon Apr 30 09:35:10 2012 +0200 sxs: Add locking around operations on the assembly cache. --- dlls/sxs/cache.c | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/dlls/sxs/cache.c b/dlls/sxs/cache.c index e0ec0d0..46686e5 100644 --- a/dlls/sxs/cache.c +++ b/dlls/sxs/cache.c @@ -36,6 +36,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(sxs); +static const WCHAR cache_mutex_nameW[] = + {'_','_','W','I','N','E','_','S','X','S','_','C','A','C','H','E','_','M','U','T','E','X','_','_',0}; + static const WCHAR win32W[] = {'w','i','n','3','2',0}; static const WCHAR win32_policyW[] = {'w','i','n','3','2','-','p','o','l','i','c','y',0}; static const WCHAR backslashW[] = {'\\',0}; @@ -44,6 +47,7 @@ struct cache { IAssemblyCache IAssemblyCache_iface; LONG refs; + HANDLE lock; }; static inline struct cache *impl_from_IAssemblyCache(IAssemblyCache *iface) @@ -87,6 +91,7 @@ static ULONG WINAPI cache_Release( IAssemblyCache *iface ) if (!refs) { TRACE("destroying %p\n", cache); + CloseHandle( cache->lock ); HeapFree( GetProcessHeap(), 0, cache ); } return refs; @@ -179,6 +184,16 @@ static WCHAR *build_policy_path( const WCHAR *arch, const WCHAR *name, const WCH return ret; } +static void cache_lock( struct cache *cache ) +{ + WaitForSingleObject( cache->lock, INFINITE ); +} + +static void cache_unlock( struct cache *cache ) +{ + ReleaseMutex( cache->lock ); +} + #define ASSEMBLYINFO_FLAG_INSTALLED 1 static HRESULT WINAPI cache_QueryAssemblyInfo( @@ -187,6 +202,7 @@ static HRESULT WINAPI cache_QueryAssemblyInfo( LPCWSTR assembly_name, ASSEMBLY_INFO *info ) { + struct cache *cache = impl_from_IAssemblyCache( iface ); IAssemblyName *name_obj; const WCHAR *arch, *name, *token, *type, *version; WCHAR *p, *path = NULL; @@ -217,6 +233,8 @@ static HRESULT WINAPI cache_QueryAssemblyInfo( IAssemblyName_Release( name_obj ); return S_OK; } + cache_lock( cache ); + if (!strcmpW( type, win32W )) path = build_manifest_path( arch, name, token, version ); else if (!strcmpW( type, win32_policyW )) path = build_policy_path( arch, name, token, version ); else @@ -250,6 +268,7 @@ static HRESULT WINAPI cache_QueryAssemblyInfo( done: HeapFree( GetProcessHeap(), 0, path ); IAssemblyName_Release( name_obj ); + cache_unlock( cache ); return hr; } @@ -657,12 +676,14 @@ static HRESULT WINAPI cache_InstallAssembly( LPCWSTR path, LPCFUSION_INSTALL_REFERENCE ref ) { + struct cache *cache = impl_from_IAssemblyCache( iface ); HRESULT hr, init; IXMLDOMDocument *doc = NULL; struct assembly *assembly = NULL; TRACE("%p, 0x%08x, %s, %p\n", iface, flags, debugstr_w(path), ref); + cache_lock( cache ); init = CoInitialize( NULL ); hr = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (void **)&doc ); @@ -683,6 +704,7 @@ done: free_assembly( assembly ); if (doc) IXMLDOMDocument_Release( doc ); if (SUCCEEDED(init)) CoUninitialize(); + cache_unlock( cache ); return hr; } @@ -728,6 +750,7 @@ static HRESULT WINAPI cache_UninstallAssembly( LPCFUSION_INSTALL_REFERENCE ref, ULONG *disp ) { + struct cache *cache = impl_from_IAssemblyCache( iface ); HRESULT hr, init; IXMLDOMDocument *doc = NULL; struct assembly *assembly = NULL; @@ -742,6 +765,7 @@ static HRESULT WINAPI cache_UninstallAssembly( FIXME("application reference not supported\n"); return E_NOTIMPL; } + cache_lock( cache ); init = CoInitialize( NULL ); hr = CreateAssemblyNameObject( &name_obj, assembly_name, CANOF_PARSE_DISPLAY_NAME, NULL ); @@ -787,6 +811,7 @@ done: free_assembly( assembly ); if (doc) IXMLDOMDocument_Release( doc ); if (SUCCEEDED(init)) CoUninitialize(); + cache_unlock( cache ); return hr; } @@ -822,7 +847,12 @@ HRESULT WINAPI CreateAssemblyCache( IAssemblyCache **obj, DWORD reserved ) cache->IAssemblyCache_iface.lpVtbl = &cache_vtbl; cache->refs = 1; - + cache->lock = CreateMutexW( NULL, FALSE, cache_mutex_nameW ); + if (!cache->lock) + { + HeapFree( GetProcessHeap(), 0, cache ); + return HRESULT_FROM_WIN32( GetLastError() ); + } *obj = &cache->IAssemblyCache_iface; return S_OK; }
1
0
0
0
Hans Leidekker : sxs: Implement IAssemblyCache::UninstallAssembly.
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: 8e70f73a75c7af2a085e226983616f3b1cf6c7cc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8e70f73a75c7af2a085e22698…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon Apr 30 09:34:52 2012 +0200 sxs: Implement IAssemblyCache::UninstallAssembly. --- dlls/sxs/cache.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 104 insertions(+), 11 deletions(-) diff --git a/dlls/sxs/cache.c b/dlls/sxs/cache.c index f39c2fd..e0ec0d0 100644 --- a/dlls/sxs/cache.c +++ b/dlls/sxs/cache.c @@ -92,17 +92,6 @@ static ULONG WINAPI cache_Release( IAssemblyCache *iface ) return refs; } -static HRESULT WINAPI cache_UninstallAssembly( - IAssemblyCache *iface, - DWORD flags, - LPCWSTR name, - LPCFUSION_INSTALL_REFERENCE ref, - ULONG *disp ) -{ - FIXME("%p, 0x%08x, %s, %p, %p\n", iface, flags, debugstr_w(name), ref, disp); - return E_NOTIMPL; -} - static unsigned int build_sxs_path( WCHAR *path ) { static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s','\\',0}; @@ -697,6 +686,110 @@ done: return hr; } +static HRESULT uninstall_assembly( struct assembly *assembly ) +{ + WCHAR sxsdir[MAX_PATH], *name, *dirname, *filename; + unsigned int len, len_name, len_sxsdir = build_sxs_path( sxsdir ); + HRESULT hr = E_OUTOFMEMORY; + struct file *file; + + name = build_assembly_name( assembly->arch, assembly->name, assembly->token, assembly->version, + &len_name ); + if (!name) return E_OUTOFMEMORY; + if (!(dirname = HeapAlloc( GetProcessHeap(), 0, (len_sxsdir + len_name + 1) * sizeof(WCHAR) ))) + goto done; + strcpyW( dirname, sxsdir ); + strcpyW( dirname + len_sxsdir, name ); + + LIST_FOR_EACH_ENTRY( file, &assembly->files, struct file, entry ) + { + len = len_sxsdir + len_name + 1 + strlenW( file->name ); + if (!(filename = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) goto done; + strcpyW( filename, dirname ); + strcatW( filename, backslashW ); + strcatW( filename, file->name ); + + if (!DeleteFileW( filename )) WARN( "failed to delete file %u\n", GetLastError() ); + HeapFree( GetProcessHeap(), 0, filename ); + } + RemoveDirectoryW( dirname ); + hr = S_OK; + +done: + HeapFree( GetProcessHeap(), 0, dirname ); + HeapFree( GetProcessHeap(), 0, name ); + return hr; +} + +static HRESULT WINAPI cache_UninstallAssembly( + IAssemblyCache *iface, + DWORD flags, + LPCWSTR assembly_name, + LPCFUSION_INSTALL_REFERENCE ref, + ULONG *disp ) +{ + HRESULT hr, init; + IXMLDOMDocument *doc = NULL; + struct assembly *assembly = NULL; + IAssemblyName *name_obj = NULL; + const WCHAR *arch, *name, *token, *type, *version; + WCHAR *p, *path = NULL; + + TRACE("%p, 0x%08x, %s, %p, %p\n", iface, flags, debugstr_w(assembly_name), ref, disp); + + if (ref) + { + FIXME("application reference not supported\n"); + return E_NOTIMPL; + } + init = CoInitialize( NULL ); + + hr = CreateAssemblyNameObject( &name_obj, assembly_name, CANOF_PARSE_DISPLAY_NAME, NULL ); + if (FAILED( hr )) + goto done; + + arch = get_name_attribute( name_obj, NAME_ATTR_ID_ARCH ); + name = get_name_attribute( name_obj, NAME_ATTR_ID_NAME ); + token = get_name_attribute( name_obj, NAME_ATTR_ID_TOKEN ); + type = get_name_attribute( name_obj, NAME_ATTR_ID_TYPE ); + version = get_name_attribute( name_obj, NAME_ATTR_ID_VERSION ); + if (!arch || !name || !token || !type || !version) + { + hr = E_INVALIDARG; + goto done; + } + if (!strcmpW( type, win32W )) path = build_manifest_filename( arch, name, token, version ); + else if (!strcmpW( type, win32_policyW )) path = build_policy_filename( arch, name, token, version ); + else + { + hr = E_INVALIDARG; + goto done; + } + + hr = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (void **)&doc ); + if (hr != S_OK) + goto done; + + if ((hr = load_manifest( doc, path )) != S_OK) goto done; + if ((hr = parse_assembly( doc, &assembly )) != S_OK) goto done; + + if (!DeleteFileW( path )) WARN( "unable to remove manifest file %u\n", GetLastError() ); + else if ((p = strrchrW( path, '\\' ))) + { + *p = 0; + RemoveDirectoryW( path ); + } + if (!strcmpW( assembly->type, win32W )) hr = uninstall_assembly( assembly ); + +done: + if (name_obj) IAssemblyName_Release( name_obj ); + HeapFree( GetProcessHeap(), 0, path ); + free_assembly( assembly ); + if (doc) IXMLDOMDocument_Release( doc ); + if (SUCCEEDED(init)) CoUninitialize(); + return hr; +} + static const IAssemblyCacheVtbl cache_vtbl = { cache_QueryInterface,
1
0
0
0
Hans Leidekker : sxs: Add some helper functions.
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: b74f173e2149a4100087176a67b7767ff802a656 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b74f173e2149a4100087176a6…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon Apr 30 09:34:30 2012 +0200 sxs: Add some helper functions. --- dlls/sxs/cache.c | 308 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 177 insertions(+), 131 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=b74f173e2149a41000871…
1
0
0
0
Hans Leidekker : fusion: Add locking around operations on the assembly cache.
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: 93f292506c4fefa126474ad323362e2bc9bfd3d0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=93f292506c4fefa126474ad32…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon Apr 30 09:34:15 2012 +0200 fusion: Add locking around operations on the assembly cache. --- dlls/fusion/asmcache.c | 56 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 42 insertions(+), 14 deletions(-) diff --git a/dlls/fusion/asmcache.c b/dlls/fusion/asmcache.c index d0b45c7..e6a2a65 100644 --- a/dlls/fusion/asmcache.c +++ b/dlls/fusion/asmcache.c @@ -41,6 +41,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(fusion); +static const WCHAR cache_mutex_nameW[] = + {'_','_','W','I','N','E','_','F','U','S','I','O','N','_','C','A','C','H','E','_','M','U','T','E','X','_','_',0}; + static BOOL create_full_path(LPCWSTR path) { LPWSTR new_path; @@ -126,6 +129,7 @@ typedef struct { IAssemblyCache IAssemblyCache_iface; LONG ref; + HANDLE lock; } IAssemblyCacheImpl; static inline IAssemblyCacheImpl *impl_from_IAssemblyCache(IAssemblyCache *iface) @@ -166,17 +170,29 @@ static ULONG WINAPI IAssemblyCacheImpl_AddRef(IAssemblyCache *iface) static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface) { - IAssemblyCacheImpl *This = impl_from_IAssemblyCache(iface); - ULONG refCount = InterlockedDecrement(&This->ref); + IAssemblyCacheImpl *cache = impl_from_IAssemblyCache(iface); + ULONG refCount = InterlockedDecrement( &cache->ref ); - TRACE("(%p)->(ref before = %u)\n", This, refCount + 1); + TRACE("(%p)->(ref before = %u)\n", cache, refCount + 1); if (!refCount) - HeapFree(GetProcessHeap(), 0, This); - + { + CloseHandle( cache->lock ); + HeapFree( GetProcessHeap(), 0, cache ); + } return refCount; } +static void cache_lock( IAssemblyCacheImpl *cache ) +{ + WaitForSingleObject( cache->lock, INFINITE ); +} + +static void cache_unlock( IAssemblyCacheImpl *cache ) +{ + ReleaseMutex( cache->lock ); +} + static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface, DWORD dwFlags, LPCWSTR pszAssemblyName, @@ -184,6 +200,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface ULONG *pulDisposition) { HRESULT hr; + IAssemblyCacheImpl *cache = impl_from_IAssemblyCache(iface); IAssemblyName *asmname, *next = NULL; IAssemblyEnum *asmenum = NULL; WCHAR *p, *path = NULL; @@ -202,6 +219,8 @@ static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface if (FAILED( hr )) return hr; + cache_lock( cache ); + hr = CreateAssemblyEnum( &asmenum, NULL, asmname, ASM_CACHE_GAC, NULL ); if (FAILED( hr )) goto done; @@ -253,6 +272,7 @@ done: if (next) IAssemblyName_Release( next ); if (asmenum) IAssemblyEnum_Release( asmenum ); HeapFree( GetProcessHeap(), 0, path ); + cache_unlock( cache ); return hr; } @@ -261,6 +281,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_QueryAssemblyInfo(IAssemblyCache *iface LPCWSTR pszAssemblyName, ASSEMBLY_INFO *pAsmInfo) { + IAssemblyCacheImpl *cache = impl_from_IAssemblyCache(iface); IAssemblyName *asmname, *next = NULL; IAssemblyEnum *asmenum = NULL; HRESULT hr; @@ -281,6 +302,8 @@ static HRESULT WINAPI IAssemblyCacheImpl_QueryAssemblyInfo(IAssemblyCache *iface if (FAILED(hr)) return hr; + cache_lock( cache ); + hr = CreateAssemblyEnum(&asmenum, NULL, asmname, ASM_CACHE_GAC, NULL); if (FAILED(hr)) goto done; @@ -303,7 +326,7 @@ done: IAssemblyName_Release(asmname); if (next) IAssemblyName_Release(next); if (asmenum) IAssemblyEnum_Release(asmenum); - + cache_unlock( cache ); return hr; } @@ -331,9 +354,10 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, LPCWSTR pszManifestFilePath, LPCFUSION_INSTALL_REFERENCE pRefData) { - static const WCHAR format[] = - {'%','s','\\','%','s','\\','%','s','_','_','%','s','\\',0}; - + static const WCHAR format[] = {'%','s','\\','%','s','\\','%','s','_','_','%','s','\\',0}; + static const WCHAR ext_exe[] = {'.','e','x','e',0}; + static const WCHAR ext_dll[] = {'.','d','l','l',0}; + IAssemblyCacheImpl *cache = impl_from_IAssemblyCache(iface); ASSEMBLY *assembly; LPWSTR filename; LPWSTR name = NULL; @@ -345,9 +369,6 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, LPWSTR ext; HRESULT hr; - static const WCHAR ext_exe[] = {'.','e','x','e',0}; - static const WCHAR ext_dll[] = {'.','d','l','l',0}; - TRACE("(%p, %d, %s, %p)\n", iface, dwFlags, debugstr_w(pszManifestFilePath), pRefData); @@ -382,6 +403,8 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, if (FAILED(hr)) goto done; + cache_lock( cache ); + get_assembly_directory(asmdir, MAX_PATH, assembly_get_architecture(assembly)); sprintfW(path, format, asmdir, name, version, token); @@ -404,6 +427,7 @@ done: HeapFree(GetProcessHeap(), 0, version); HeapFree(GetProcessHeap(), 0, asmpath); assembly_release(assembly); + cache_unlock( cache ); return hr; } @@ -438,9 +462,13 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved cache->IAssemblyCache_iface.lpVtbl = &AssemblyCacheVtbl; cache->ref = 1; - + cache->lock = CreateMutexW( NULL, FALSE, cache_mutex_nameW ); + if (!cache->lock) + { + HeapFree( GetProcessHeap(), 0, cache ); + return HRESULT_FROM_WIN32( GetLastError() ); + } *ppAsmCache = &cache->IAssemblyCache_iface; - return S_OK; }
1
0
0
0
Hans Leidekker : fusion: CreateAssemblyNameObject is no longer a stub.
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: 6032b47443062ad47af5c7d77ac7c3ff19440da2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6032b47443062ad47af5c7d77…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon Apr 30 09:33:58 2012 +0200 fusion: CreateAssemblyNameObject is no longer a stub. --- dlls/fusion/asmname.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/fusion/asmname.c b/dlls/fusion/asmname.c index c79690f..4957ae8 100644 --- a/dlls/fusion/asmname.c +++ b/dlls/fusion/asmname.c @@ -666,7 +666,7 @@ HRESULT WINAPI CreateAssemblyNameObject(LPASSEMBLYNAME *ppAssemblyNameObj, IAssemblyNameImpl *name; HRESULT hr; - TRACE("(%p, %s, %08x, %p) stub!\n", ppAssemblyNameObj, + TRACE("(%p, %s, %08x, %p)\n", ppAssemblyNameObj, debugstr_w(szAssemblyName), dwFlags, pvReserved); if (!ppAssemblyNameObj)
1
0
0
0
Henri Verbeet : d3dx9: Add a FIXME for unsupported filter types to D3DXLoadSurfaceFromMemory().
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: c8ae37a9a936d9872960f3fa0eff6daccc470e5b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c8ae37a9a936d9872960f3fa0…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Sun Apr 29 20:52:06 2012 +0200 d3dx9: Add a FIXME for unsupported filter types to D3DXLoadSurfaceFromMemory(). --- dlls/d3dx9_36/surface.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index 78a48f8..65b6059 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -1039,6 +1039,9 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, } else /* if ((dwFilter & 0xf) == D3DX_FILTER_POINT) */ { + if ((dwFilter & 0xf) != D3DX_FILTER_POINT) + FIXME("Unhandled filter %#x.\n", dwFilter); + /* Always apply a point filter until D3DX_FILTER_LINEAR, * D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */ point_filter_simple_data(pSrcMemory, SrcPitch, src_size, srcformatdesc,
1
0
0
0
Henri Verbeet : d3dx9: Use proper size types in D3DXLoadSurfaceFromMemory() .
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: 5ebd6652ca62515c15a98e02df608d037798e2f0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5ebd6652ca62515c15a98e02d…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Sun Apr 29 20:52:05 2012 +0200 d3dx9: Use proper size types in D3DXLoadSurfaceFromMemory(). --- dlls/d3dx9_36/surface.c | 80 +++++++++++++++++++++++----------------------- 1 files changed, 40 insertions(+), 40 deletions(-) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index 567282c..78a48f8 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -729,11 +729,8 @@ static void format_from_vec4(const PixelFormatDesc *format, const struct vec4 *s * Pixels outsize the source rect are blacked out. * Works only for ARGB formats with 1 - 4 bytes per pixel. */ -static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, - CONST PixelFormatDesc *srcformat, - BYTE *dest, UINT destpitch, POINT destsize, - CONST PixelFormatDesc *destformat, - D3DCOLOR colorkey) +static void copy_simple_data(const BYTE *src, UINT srcpitch, SIZE src_size, const PixelFormatDesc *srcformat, + BYTE *dest, UINT destpitch, SIZE dst_size, const PixelFormatDesc *destformat, D3DCOLOR colorkey) { struct argb_conversion_info conv_info, ck_conv_info; const PixelFormatDesc *ck_format = NULL; @@ -744,8 +741,8 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, ZeroMemory(channels, sizeof(channels)); init_argb_conversion_info(srcformat, destformat, &conv_info); - minwidth = (srcsize.x < destsize.x) ? srcsize.x : destsize.x; - minheight = (srcsize.y < destsize.y) ? srcsize.y : destsize.y; + minwidth = (src_size.cx < dst_size.cx) ? src_size.cx : dst_size.cx; + minheight = (src_size.cy < dst_size.cy) ? src_size.cy : dst_size.cy; if (colorkey) { @@ -806,11 +803,11 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, destptr += destformat->bytes_per_pixel; } - if(srcsize.x < destsize.x) /* black out remaining pixels */ - ZeroMemory(destptr, destformat->bytes_per_pixel * (destsize.x - srcsize.x)); + if (src_size.cx < dst_size.cx) /* black out remaining pixels */ + memset(destptr, 0, destformat->bytes_per_pixel * (dst_size.cx - src_size.cx)); } - if(srcsize.y < destsize.y) /* black out remaining pixels */ - ZeroMemory(dest + srcsize.y * destpitch, destpitch * (destsize.y - srcsize.y)); + if (src_size.cy < dst_size.cy) /* black out remaining pixels */ + memset(dest + src_size.cy * destpitch, 0, destpitch * (dst_size.cy - src_size.cy)); } /************************************************************ @@ -821,11 +818,8 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, * using a point filter. * Works only for ARGB formats with 1 - 4 bytes per pixel. */ -static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, - CONST PixelFormatDesc *srcformat, - BYTE *dest, UINT destpitch, POINT destsize, - CONST PixelFormatDesc *destformat, - D3DCOLOR colorkey) +static void point_filter_simple_data(const BYTE *src, UINT srcpitch, SIZE src_size, const PixelFormatDesc *srcformat, + BYTE *dest, UINT destpitch, SIZE dst_size, const PixelFormatDesc *destformat, D3DCOLOR colorkey) { struct argb_conversion_info conv_info, ck_conv_info; const PixelFormatDesc *ck_format = NULL; @@ -843,12 +837,14 @@ static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsi init_argb_conversion_info(srcformat, ck_format, &ck_conv_info); } - for(y = 0;y < destsize.y;y++) { + for (y = 0; y < dst_size.cy; ++y) + { BYTE *destptr = dest + y * destpitch; - const BYTE *bufptr = src + srcpitch * (y * srcsize.y / destsize.y); + const BYTE *bufptr = src + srcpitch * (y * src_size.cy / dst_size.cy); - for(x = 0;x < destsize.x;x++) { - const BYTE *srcptr = bufptr + (x * srcsize.x / destsize.x) * srcformat->bytes_per_pixel; + for (x = 0; x < dst_size.cx; ++x) + { + const BYTE *srcptr = bufptr + (x * src_size.cx / dst_size.cx) * srcformat->bytes_per_pixel; DWORD val; /* extract source color components */ @@ -944,7 +940,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, CONST PixelFormatDesc *srcformatdesc, *destformatdesc; D3DSURFACE_DESC surfdesc; D3DLOCKED_RECT lockrect; - POINT srcsize, destsize; + SIZE src_size, dst_size; HRESULT hr; TRACE("(%p, %p, %p, %p, %x, %u, %p, %p %u, %#x)\n", pDestSurface, pDestPalette, pDestRect, pSrcMemory, @@ -957,18 +953,22 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, IDirect3DSurface9_GetDesc(pDestSurface, &surfdesc); - srcsize.x = pSrcRect->right - pSrcRect->left; - srcsize.y = pSrcRect->bottom - pSrcRect->top; - if( !pDestRect ) { - destsize.x = surfdesc.Width; - destsize.y = surfdesc.Height; - } else { + src_size.cx = pSrcRect->right - pSrcRect->left; + src_size.cy = pSrcRect->bottom - pSrcRect->top; + if (!pDestRect) + { + dst_size.cx = surfdesc.Width; + dst_size.cy = surfdesc.Height; + } + else + { if(pDestRect->left > pDestRect->right || pDestRect->right > surfdesc.Width) return D3DERR_INVALIDCALL; if(pDestRect->top > pDestRect->bottom || pDestRect->bottom > surfdesc.Height) return D3DERR_INVALIDCALL; if(pDestRect->left < 0 || pDestRect->top < 0) return D3DERR_INVALIDCALL; - destsize.x = pDestRect->right - pDestRect->left; - destsize.y = pDestRect->bottom - pDestRect->top; - if(destsize.x == 0 || destsize.y == 0) return D3D_OK; + dst_size.cx = pDestRect->right - pDestRect->left; + dst_size.cy = pDestRect->bottom - pDestRect->top; + if (!dst_size.cx || !dst_size.cy) + return D3D_OK; } srcformatdesc = get_format_info(SrcFormat); @@ -980,11 +980,11 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, return E_NOTIMPL; if (SrcFormat == surfdesc.Format - && destsize.x == srcsize.x - && destsize.y == srcsize.y) /* Simple copy. */ + && dst_size.cx == src_size.cx + && dst_size.cy == src_size.cy) /* Simple copy. */ { - UINT row_block_count = ((srcsize.x + srcformatdesc->block_width - 1) / srcformatdesc->block_width); - UINT row_count = (srcsize.y + srcformatdesc->block_height - 1) / srcformatdesc->block_height; + UINT row_block_count = ((src_size.cx + srcformatdesc->block_width - 1) / srcformatdesc->block_width); + UINT row_count = (src_size.cy + srcformatdesc->block_height - 1) / srcformatdesc->block_height; const BYTE *src_addr; BYTE *dst_addr; UINT row; @@ -992,9 +992,9 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, if (pSrcRect->left & (srcformatdesc->block_width - 1) || pSrcRect->top & (srcformatdesc->block_height - 1) || (pSrcRect->right & (srcformatdesc->block_width - 1) - && srcsize.x != surfdesc.Width) + && src_size.cx != surfdesc.Width) || (pSrcRect->bottom & (srcformatdesc->block_height - 1) - && srcsize.y != surfdesc.Height)) + && src_size.cy != surfdesc.Height)) { WARN("Source rect %s is misaligned.\n", wine_dbgstr_rect(pSrcRect)); return D3DXERR_INVALIDDATA; @@ -1033,16 +1033,16 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, if ((dwFilter & 0xf) == D3DX_FILTER_NONE) { - copy_simple_data(pSrcMemory, SrcPitch, srcsize, srcformatdesc, - lockrect.pBits, lockrect.Pitch, destsize, destformatdesc, + copy_simple_data(pSrcMemory, SrcPitch, src_size, srcformatdesc, + lockrect.pBits, lockrect.Pitch, dst_size, destformatdesc, Colorkey); } else /* if ((dwFilter & 0xf) == D3DX_FILTER_POINT) */ { /* Always apply a point filter until D3DX_FILTER_LINEAR, * D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */ - point_filter_simple_data(pSrcMemory, SrcPitch, srcsize, srcformatdesc, - lockrect.pBits, lockrect.Pitch, destsize, destformatdesc, + point_filter_simple_data(pSrcMemory, SrcPitch, src_size, srcformatdesc, + lockrect.pBits, lockrect.Pitch, dst_size, destformatdesc, Colorkey); }
1
0
0
0
Henri Verbeet : d3d9: Properly retrieve an interface pointer in d3d9_texture_2d_GetSurfaceLevel( ).
by Alexandre Julliard
30 Apr '12
30 Apr '12
Module: wine Branch: master Commit: 605e6b743c3dd4fa00a4ab3a33138e04d7670754 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=605e6b743c3dd4fa00a4ab3a3…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Sun Apr 29 20:52:04 2012 +0200 d3d9: Properly retrieve an interface pointer in d3d9_texture_2d_GetSurfaceLevel(). --- dlls/d3d9/texture.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 7891596..6387e2d 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -326,6 +326,7 @@ static HRESULT WINAPI d3d9_texture_2d_GetSurfaceLevel(IDirect3DTexture9 *iface, { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); struct wined3d_resource *sub_resource; + IDirect3DSurface9Impl *surface_impl; TRACE("iface %p, level %u, surface %p.\n", iface, level, surface); @@ -336,7 +337,8 @@ static HRESULT WINAPI d3d9_texture_2d_GetSurfaceLevel(IDirect3DTexture9 *iface, return D3DERR_INVALIDCALL; } - *surface = wined3d_resource_get_parent(sub_resource); + surface_impl = wined3d_resource_get_parent(sub_resource); + *surface = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*surface); wined3d_mutex_unlock();
1
0
0
0
← Newer
1
2
3
4
5
6
...
72
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
Results per page:
10
25
50
100
200