diff --git a/patches/d3d11-Deferred_Context/0003-d3d11-Initial-implementation-for-deferred-contexts.patch b/patches/d3d11-Deferred_Context/0003-d3d11-Initial-implementation-for-deferred-contexts.patch index 7a327cfb..a2bb6e1f 100644 --- a/patches/d3d11-Deferred_Context/0003-d3d11-Initial-implementation-for-deferred-contexts.patch +++ b/patches/d3d11-Deferred_Context/0003-d3d11-Initial-implementation-for-deferred-contexts.patch @@ -1,14 +1,14 @@ -From d5ce074cce2ab4d5e4808898562555ecb92b388a Mon Sep 17 00:00:00 2001 +From 05ef8f7024651411d386a6e60e9353feba472cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 19 Jan 2017 16:56:56 +0100 Subject: d3d11: Initial implementation for deferred contexts. --- - dlls/d3d11/device.c | 1073 +++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 1041 insertions(+), 32 deletions(-) + dlls/d3d11/device.c | 1071 +++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 1040 insertions(+), 31 deletions(-) diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c -index 8fd48eff4c..ab833468a2 100644 +index 59b1bc864b..ec02ce6f20 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -19,12 +19,181 @@ @@ -747,16 +747,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_immediate_context_HSSetShaderResources(ID3D11DeviceContext *iface, -@@ -2408,7 +3112,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSGetConstantBuffers(ID3D1 - - static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceContext *iface) - { -- FIXME("iface %p stub!\n", iface); -+ TRACE("iface %p stub!\n", iface); - } - - static void STDMETHODCALLTYPE d3d11_immediate_context_Flush(ID3D11DeviceContext *iface) -@@ -2620,6 +3324,7 @@ static ULONG STDMETHODCALLTYPE d3d11_deferred_context_Release(ID3D11DeviceContex +@@ -2693,6 +3397,7 @@ static ULONG STDMETHODCALLTYPE d3d11_deferred_context_Release(ID3D11DeviceContex if (!refcount) { @@ -764,7 +755,7 @@ index 8fd48eff4c..ab833468a2 100644 wined3d_private_store_cleanup(&context->private_store); ID3D11Device_Release(context->device); HeapFree(GetProcessHeap(), 0, context); -@@ -2671,43 +3376,86 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_SetPrivateDataInterface( +@@ -2744,43 +3449,86 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_SetPrivateDataInterface( static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetConstantBuffers(ID3D11DeviceContext *iface, UINT start_slot, UINT buffer_count, ID3D11Buffer *const *buffers) { @@ -857,7 +848,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *iface, -@@ -2720,53 +3468,169 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *i +@@ -2793,53 +3541,169 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *i static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext *iface, ID3D11Resource *resource, UINT subresource_idx, D3D11_MAP map_type, UINT map_flags, D3D11_MAPPED_SUBRESOURCE *mapped_subresource) { @@ -1036,7 +1027,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstanced(ID3D11DeviceContext *iface, -@@ -2795,7 +3659,16 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceCon +@@ -2868,7 +3732,16 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceCon static void STDMETHODCALLTYPE d3d11_deferred_context_IASetPrimitiveTopology(ID3D11DeviceContext *iface, D3D11_PRIMITIVE_TOPOLOGY topology) { @@ -1054,7 +1045,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetShaderResources(ID3D11DeviceContext *iface, -@@ -2855,8 +3728,28 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargets(ID3D11De +@@ -2928,8 +3801,28 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargets(ID3D11De UINT render_target_view_count, ID3D11RenderTargetView *const *render_target_views, ID3D11DepthStencilView *depth_stencil_view) { @@ -1084,7 +1075,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorderedAccessViews( -@@ -2876,15 +3769,44 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorde +@@ -2949,15 +3842,44 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorde static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetBlendState(ID3D11DeviceContext *iface, ID3D11BlendState *blend_state, const float blend_factor[4], UINT sample_mask) { @@ -1131,7 +1122,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_SOSetTargets(ID3D11DeviceContext *iface, UINT buffer_count, -@@ -2926,13 +3848,34 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11Devi +@@ -2999,13 +3921,34 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11Devi static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetState(ID3D11DeviceContext *iface, ID3D11RasterizerState *rasterizer_state) { @@ -1168,7 +1159,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetScissorRects(ID3D11DeviceContext *iface, -@@ -3047,8 +3990,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShaderResources(ID3D11 +@@ -3120,8 +4063,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShaderResources(ID3D11 static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShader(ID3D11DeviceContext *iface, ID3D11HullShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count) { @@ -1188,7 +1179,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceContext *iface, -@@ -3061,36 +4014,62 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceC +@@ -3134,36 +4087,62 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceC static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetConstantBuffers(ID3D11DeviceContext *iface, UINT start_slot, UINT buffer_count, ID3D11Buffer *const *buffers) { @@ -1256,7 +1247,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShaderResources(ID3D11DeviceContext *iface, -@@ -3391,7 +4370,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSGetConstantBuffers(ID3D11 +@@ -3464,7 +4443,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSGetConstantBuffers(ID3D11 static void STDMETHODCALLTYPE d3d11_deferred_context_ClearState(ID3D11DeviceContext *iface) { @@ -1273,7 +1264,7 @@ index 8fd48eff4c..ab833468a2 100644 } static void STDMETHODCALLTYPE d3d11_deferred_context_Flush(ID3D11DeviceContext *iface) -@@ -3416,9 +4403,29 @@ static UINT STDMETHODCALLTYPE d3d11_deferred_context_GetContextFlags(ID3D11Devic +@@ -3489,9 +4476,29 @@ static UINT STDMETHODCALLTYPE d3d11_deferred_context_GetContextFlags(ID3D11Devic static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_FinishCommandList(ID3D11DeviceContext *iface, BOOL restore, ID3D11CommandList **command_list) { @@ -1305,7 +1296,7 @@ index 8fd48eff4c..ab833468a2 100644 } static const struct ID3D11DeviceContextVtbl d3d11_deferred_context_vtbl = -@@ -4207,6 +5214,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device +@@ -4280,6 +5287,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device object->device = iface; object->refcount = 1; diff --git a/patches/mfplat-MFTRegister/0001-mfplat-Fix-invalid-memory-access.patch b/patches/mfplat-MFTRegister/0001-mfplat-Fix-invalid-memory-access.patch new file mode 100644 index 00000000..9da94ae1 --- /dev/null +++ b/patches/mfplat-MFTRegister/0001-mfplat-Fix-invalid-memory-access.patch @@ -0,0 +1,25 @@ +From d4d2a048787580327efdeaad7baac703a1993b63 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Wed, 10 May 2017 02:13:01 +0200 +Subject: mfplat: Fix invalid memory access. + +--- + dlls/mfplat/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c +index c1c700368f..56bc2840f0 100644 +--- a/dlls/mfplat/main.c ++++ b/dlls/mfplat/main.c +@@ -262,7 +262,7 @@ static BOOL match_type(const WCHAR *clsid_str, const WCHAR *type_str, MFT_REGIST + if (RegQueryValueExW(hfilter, type_str, NULL, ®_type, (LPBYTE)info, &size) != ERROR_SUCCESS) + goto out; + +- for (i = 0; i < size / sizeof(MFT_REGISTER_TYPE_INFO) + 1; i++) ++ for (i = 0; i < size / sizeof(MFT_REGISTER_TYPE_INFO); i++) + { + if (IsEqualGUID(&info[i].guidMajorType, &type->guidMajorType) && + IsEqualGUID(&info[i].guidSubtype, &type->guidSubtype)) +-- +2.12.2 + diff --git a/patches/mfplat-MFTRegister/0001-mfplat-Implement-MFTRegister.patch b/patches/mfplat-MFTRegister/0001-mfplat-Implement-MFTRegister.patch deleted file mode 100644 index f5c4f0f1..00000000 --- a/patches/mfplat-MFTRegister/0001-mfplat-Implement-MFTRegister.patch +++ /dev/null @@ -1,224 +0,0 @@ -From f2fd954313bf70edc5204b89f5f1b668925eda28 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Fri, 17 Apr 2015 14:39:17 +0200 -Subject: mfplat: Implement MFTRegister. (v2) - ---- - dlls/mfplat/Makefile.in | 1 + - dlls/mfplat/main.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++ - dlls/mfplat/mfplat.spec | 2 +- - loader/wine.inf.in | 4 ++ - 4 files changed, 150 insertions(+), 1 deletion(-) - -diff --git a/dlls/mfplat/Makefile.in b/dlls/mfplat/Makefile.in -index 2b5bd24..9679f53 100644 ---- a/dlls/mfplat/Makefile.in -+++ b/dlls/mfplat/Makefile.in -@@ -1,4 +1,5 @@ - MODULE = mfplat.dll -+IMPORTS = user32 advapi32 - - C_SRCS = \ - main.c -diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c -index 698c681..d8b0c7a 100644 ---- a/dlls/mfplat/main.c -+++ b/dlls/mfplat/main.c -@@ -23,15 +23,44 @@ - - #include "windef.h" - #include "winbase.h" -+#include "winuser.h" -+#include "winreg.h" - - #include "initguid.h" - #include "mfapi.h" - #include "mferror.h" - - #include "wine/debug.h" -+#include "wine/unicode.h" - - WINE_DEFAULT_DEBUG_CHANNEL(mfplat); - -+static WCHAR transform_keyW[] = {'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s', -+ '\\','M','e','d','i','a','F','o','u','n','d','a','t','i','o','n','\\', -+ 'T','r','a','n','s','f','o','r','m','s',0}; -+static WCHAR categories_keyW[] = {'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s', -+ '\\','M','e','d','i','a','F','o','u','n','d','a','t','i','o','n','\\', -+ 'T','r','a','n','s','f','o','r','m','s','\\', -+ 'C','a','t','e','g','o','r','i','e','s',0}; -+static WCHAR inputtypesW[] = {'I','n','p','u','t','T','y','p','e','s',0}; -+static WCHAR outputtypesW[] = {'O','u','t','p','u','t','T','y','p','e','s',0}; -+static const WCHAR szGUIDFmt[] = -+{ -+ '%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0', -+ '2','x','%','0','2','x','-','%','0','2','x','%','0','2','x','%','0','2', -+ 'x','%','0','2','x','%','0','2','x','%','0','2','x',0 -+}; -+ -+static LPWSTR GUIDToString(LPWSTR lpwstr, REFGUID lpcguid) -+{ -+ wsprintfW(lpwstr, szGUIDFmt, lpcguid->Data1, lpcguid->Data2, -+ lpcguid->Data3, lpcguid->Data4[0], lpcguid->Data4[1], -+ lpcguid->Data4[2], lpcguid->Data4[3], lpcguid->Data4[4], -+ lpcguid->Data4[5], lpcguid->Data4[6], lpcguid->Data4[7]); -+ -+ return lpwstr; -+} -+ - BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) - { - switch (reason) -@@ -46,6 +75,121 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) - return TRUE; - } - -+static HRESULT register_transform(CLSID *clsid, WCHAR *name, -+ UINT32 cinput, MFT_REGISTER_TYPE_INFO *input_types, -+ UINT32 coutput, MFT_REGISTER_TYPE_INFO *output_types) -+{ -+ HKEY htransform, hclsid = 0; -+ WCHAR buffer[64]; -+ GUID *types; -+ DWORD size; -+ LONG ret; -+ UINT32 i; -+ -+ if (RegOpenKeyW(HKEY_LOCAL_MACHINE, transform_keyW, &htransform)) -+ return E_FAIL; -+ -+ GUIDToString(buffer, clsid); -+ ret = RegCreateKeyW(htransform, buffer, &hclsid); -+ RegCloseKey(htransform); -+ if (ret) return E_FAIL; -+ -+ size = (strlenW(name) + 1) * sizeof(WCHAR); -+ if (RegSetValueExW(hclsid, NULL, 0, REG_SZ, (BYTE *)name, size)) -+ goto err; -+ -+ if (cinput) -+ { -+ size = 2 * cinput * sizeof(GUID); -+ types = HeapAlloc(GetProcessHeap(), 0, size); -+ if (!types) goto err; -+ -+ for (i = 0; i < cinput; i++) -+ { -+ memcpy(&types[2 * i], &input_types[i].guidMajorType, sizeof(GUID)); -+ memcpy(&types[2 * i + 1], &input_types[i].guidSubtype, sizeof(GUID)); -+ } -+ -+ ret = RegSetValueExW(hclsid, inputtypesW, 0, REG_BINARY, (BYTE *)types, size); -+ HeapFree(GetProcessHeap(), 0, types); -+ if (ret) goto err; -+ } -+ -+ if (coutput) -+ { -+ size = 2 * coutput * sizeof(GUID); -+ types = HeapAlloc(GetProcessHeap(), 0, size); -+ if (!types) goto err; -+ -+ for (i = 0; i < coutput; i++) -+ { -+ memcpy(&types[2 * i], &output_types[i].guidMajorType, sizeof(GUID)); -+ memcpy(&types[2 * i + 1], &output_types[i].guidSubtype, sizeof(GUID)); -+ } -+ -+ ret = RegSetValueExW(hclsid, outputtypesW, 0, REG_BINARY, (BYTE *)types, size); -+ HeapFree(GetProcessHeap(), 0, types); -+ if (ret) goto err; -+ } -+ -+ RegCloseKey(hclsid); -+ return S_OK; -+ -+err: -+ RegCloseKey(hclsid); -+ return E_FAIL; -+} -+ -+static HRESULT register_category(CLSID *clsid, GUID *category) -+{ -+ HKEY hcategory, htmp1, htmp2; -+ WCHAR buffer[64]; -+ DWORD ret; -+ -+ if (RegOpenKeyW(HKEY_LOCAL_MACHINE, categories_keyW, &hcategory)) -+ return E_FAIL; -+ -+ GUIDToString(buffer, category); -+ ret = RegCreateKeyW(hcategory, buffer, &htmp1); -+ RegCloseKey(hcategory); -+ if (ret) return E_FAIL; -+ -+ GUIDToString(buffer, clsid); -+ ret = RegCreateKeyW(htmp1, buffer, &htmp2); -+ RegCloseKey(htmp1); -+ if (ret) return E_FAIL; -+ -+ RegCloseKey(htmp2); -+ return S_OK; -+} -+ -+/*********************************************************************** -+ * MFTRegister (mfplat.@) -+ */ -+HRESULT WINAPI MFTRegister(CLSID clsid, GUID category, LPWSTR name, UINT32 flags, UINT32 cinput, -+ MFT_REGISTER_TYPE_INFO *input_types, UINT32 coutput, -+ MFT_REGISTER_TYPE_INFO *output_types, void *attributes) -+{ -+ HRESULT hr; -+ -+ FIXME("(%s, %s, %s, %x, %u, %p, %u, %p, %p)\n", debugstr_guid(&clsid), debugstr_guid(&category), -+ debugstr_w(name), flags, cinput, input_types, -+ coutput, output_types, attributes); -+ -+ if (attributes) -+ FIXME("attributes not yet supported.\n"); -+ -+ if (flags) -+ FIXME("flags not yet supported.\n"); -+ -+ hr = register_transform(&clsid, name, cinput, input_types, coutput, output_types); -+ -+ if (SUCCEEDED(hr)) -+ hr = register_category(&clsid, &category); -+ -+ return hr; -+} -+ - /*********************************************************************** - * MFStartup (mfplat.@) - */ -diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec -index 0b402b7..acde0a5 100644 ---- a/dlls/mfplat/mfplat.spec -+++ b/dlls/mfplat/mfplat.spec -@@ -137,7 +137,7 @@ - @ stub MFTEnum - @ stub MFTEnumEx - @ stub MFTGetInfo --@ stub MFTRegister -+@ stdcall MFTRegister(int128 int128 wstr long long ptr long ptr ptr) - @ stub MFTRegisterLocal - @ stub MFTRegisterLocalByCLSID - @ stub MFTUnregister -diff --git a/loader/wine.inf.in b/loader/wine.inf.in -index f30942a..3935bae 100644 ---- a/loader/wine.inf.in -+++ b/loader/wine.inf.in -@@ -623,6 +623,10 @@ HKLM,Software\Borland\Database Engine\Settings\SYSTEM\INIT,SHAREDMEMLOCATION,,90 - HKLM,Software\Clients\Mail,,2,"Native Mail Client" - HKLM,Software\Clients\Mail\Native Mail Client,,2,"Native Mail Client" - HKLM,Software\Clients\Mail\Native Mail Client,"DLLPath",2,"%11%\winemapi.dll" -+HKLM,Software\Classes\MediaFoundation,,16 -+HKLM,Software\Classes\MediaFoundation\MediaSources,,16 -+HKLM,Software\Classes\MediaFoundation\Transforms,,16 -+HKLM,Software\Classes\MediaFoundation\Transforms\Categories,,16 - HKLM,Software\Microsoft\Advanced INF Setup,,16 - HKLM,Software\Microsoft\Clients,,16 - HKLM,Software\Microsoft\Cryptography\Calais\Current,,16 --- -2.5.1 - diff --git a/patches/mfplat-MFTRegister/0002-mfplat-Implement-MFTUnregister.patch b/patches/mfplat-MFTRegister/0002-mfplat-Implement-MFTUnregister.patch deleted file mode 100644 index 80971c61..00000000 --- a/patches/mfplat-MFTRegister/0002-mfplat-Implement-MFTUnregister.patch +++ /dev/null @@ -1,75 +0,0 @@ -From a978b107d7717dd6768a987007cfbbc8b3a89014 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Fri, 2 Oct 2015 05:07:24 +0200 -Subject: mfplat: Implement MFTUnregister. - ---- - dlls/mfplat/main.c | 38 ++++++++++++++++++++++++++++++++++++++ - dlls/mfplat/mfplat.spec | 2 +- - 2 files changed, 39 insertions(+), 1 deletion(-) - -diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c -index d8b0c7a..6b47a4e 100644 ---- a/dlls/mfplat/main.c -+++ b/dlls/mfplat/main.c -@@ -191,6 +191,44 @@ HRESULT WINAPI MFTRegister(CLSID clsid, GUID category, LPWSTR name, UINT32 flags - } - - /*********************************************************************** -+ * MFTUnregister (mfplat.@) -+ */ -+HRESULT WINAPI MFTUnregister(CLSID clsid) -+{ -+ WCHAR buffer[64], category[MAX_PATH]; -+ HKEY htransform, hcategory, htmp; -+ DWORD size = MAX_PATH; -+ DWORD index = 0; -+ -+ FIXME("(%s)\n", debugstr_guid(&clsid)); -+ -+ GUIDToString(buffer, &clsid); -+ -+ if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, transform_keyW, &htransform)) -+ { -+ RegDeleteKeyW(htransform, buffer); -+ RegCloseKey(htransform); -+ } -+ -+ if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, categories_keyW, &hcategory)) -+ { -+ while (RegEnumKeyExW(hcategory, index, category, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) -+ { -+ if (!RegOpenKeyW(hcategory, category, &htmp)) -+ { -+ RegDeleteKeyW(htmp, buffer); -+ RegCloseKey(htmp); -+ } -+ size = MAX_PATH; -+ index++; -+ } -+ RegCloseKey(hcategory); -+ } -+ -+ return S_OK; -+} -+ -+/*********************************************************************** - * MFStartup (mfplat.@) - */ - HRESULT WINAPI MFStartup(ULONG version, DWORD flags) -diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec -index acde0a5..4501e27 100644 ---- a/dlls/mfplat/mfplat.spec -+++ b/dlls/mfplat/mfplat.spec -@@ -140,7 +140,7 @@ - @ stdcall MFTRegister(int128 int128 wstr long long ptr long ptr ptr) - @ stub MFTRegisterLocal - @ stub MFTRegisterLocalByCLSID --@ stub MFTUnregister -+@ stdcall MFTUnregister(int128) - @ stub MFTUnregisterLocal - @ stub MFTUnregisterLocalByCLSID - @ stub MFTraceError --- -2.5.1 - diff --git a/patches/mfplat-MFTRegister/0003-mfplat-Implement-MFTEnum.patch b/patches/mfplat-MFTRegister/0003-mfplat-Implement-MFTEnum.patch deleted file mode 100644 index 0e734c90..00000000 --- a/patches/mfplat-MFTRegister/0003-mfplat-Implement-MFTEnum.patch +++ /dev/null @@ -1,253 +0,0 @@ -From afc93aaac4a5e5711e9bfe4757fdeb3bdd53bd26 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Fri, 2 Oct 2015 05:08:10 +0200 -Subject: mfplat: Implement MFTEnum. - ---- - dlls/mfplat/Makefile.in | 2 +- - dlls/mfplat/main.c | 183 ++++++++++++++++++++++++++++++++++++++++++++++++ - dlls/mfplat/mfplat.spec | 2 +- - 3 files changed, 185 insertions(+), 2 deletions(-) - -diff --git a/dlls/mfplat/Makefile.in b/dlls/mfplat/Makefile.in -index 9679f53..de760b5 100644 ---- a/dlls/mfplat/Makefile.in -+++ b/dlls/mfplat/Makefile.in -@@ -1,5 +1,5 @@ - MODULE = mfplat.dll --IMPORTS = user32 advapi32 -+IMPORTS = user32 advapi32 ole32 - - C_SRCS = \ - main.c -diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c -index 6b47a4e..3d029d8 100644 ---- a/dlls/mfplat/main.c -+++ b/dlls/mfplat/main.c -@@ -18,6 +18,7 @@ - */ - - #include -+#include - - #define COBJMACROS - -@@ -51,6 +52,17 @@ static const WCHAR szGUIDFmt[] = - 'x','%','0','2','x','%','0','2','x','%','0','2','x',0 - }; - -+static const BYTE guid_conv_table[256] = -+{ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ -+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, /* 0x30 */ -+ 0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ -+ 0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* 0x60 */ -+}; -+ - static LPWSTR GUIDToString(LPWSTR lpwstr, REFGUID lpcguid) - { - wsprintfW(lpwstr, szGUIDFmt, lpcguid->Data1, lpcguid->Data2, -@@ -61,6 +73,60 @@ static LPWSTR GUIDToString(LPWSTR lpwstr, REFGUID lpcguid) - return lpwstr; - } - -+static inline BOOL is_valid_hex(WCHAR c) -+{ -+ if (!(((c >= '0') && (c <= '9')) || -+ ((c >= 'a') && (c <= 'f')) || -+ ((c >= 'A') && (c <= 'F')))) -+ return FALSE; -+ return TRUE; -+} -+ -+static BOOL GUIDFromString(LPCWSTR s, GUID *id) -+{ -+ int i; -+ -+ /* in form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ -+ -+ id->Data1 = 0; -+ for (i = 0; i < 8; i++) -+ { -+ if (!is_valid_hex(s[i])) return FALSE; -+ id->Data1 = (id->Data1 << 4) | guid_conv_table[s[i]]; -+ } -+ if (s[8]!='-') return FALSE; -+ -+ id->Data2 = 0; -+ for (i = 9; i < 13; i++) -+ { -+ if (!is_valid_hex(s[i])) return FALSE; -+ id->Data2 = (id->Data2 << 4) | guid_conv_table[s[i]]; -+ } -+ if (s[13]!='-') return FALSE; -+ -+ id->Data3 = 0; -+ for (i = 14; i < 18; i++) -+ { -+ if (!is_valid_hex(s[i])) return FALSE; -+ id->Data3 = (id->Data3 << 4) | guid_conv_table[s[i]]; -+ } -+ if (s[18]!='-') return FALSE; -+ -+ for (i = 19; i < 36; i+=2) -+ { -+ if (i == 23) -+ { -+ if (s[i]!='-') return FALSE; -+ i++; -+ } -+ if (!is_valid_hex(s[i]) || !is_valid_hex(s[i+1])) return FALSE; -+ id->Data4[(i-19)/2] = guid_conv_table[s[i]] << 4 | guid_conv_table[s[i+1]]; -+ } -+ -+ if (!s[37]) return TRUE; -+ return FALSE; -+} -+ - BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) - { - switch (reason) -@@ -190,6 +256,123 @@ HRESULT WINAPI MFTRegister(CLSID clsid, GUID category, LPWSTR name, UINT32 flags - return hr; - } - -+static BOOL match_type(WCHAR *clsid_str, WCHAR *type_str, MFT_REGISTER_TYPE_INFO *type) -+{ -+ HKEY htransform, hfilter; -+ DWORD reg_type, size; -+ LONG ret = FALSE; -+ GUID *guids = NULL; -+ int i; -+ -+ if (RegOpenKeyW(HKEY_LOCAL_MACHINE, transform_keyW, &htransform)) -+ return FALSE; -+ -+ if (RegOpenKeyW(htransform, clsid_str, &hfilter)) -+ { -+ RegCloseKey(htransform); -+ return FALSE; -+ } -+ -+ if (RegQueryValueExW(hfilter, type_str, NULL, ®_type, NULL, &size) != ERROR_SUCCESS) -+ goto out; -+ -+ if (reg_type != REG_BINARY) -+ goto out; -+ -+ if (!size || size % (sizeof(GUID) * 2) != 0) -+ goto out; -+ -+ guids = HeapAlloc(GetProcessHeap(), 0, size); -+ if (!guids) -+ goto out; -+ -+ if (RegQueryValueExW(hfilter, type_str, NULL, ®_type, (LPBYTE)guids, &size) != ERROR_SUCCESS) -+ goto out; -+ -+ for (i = 0; i < size / sizeof(GUID); i += 2) -+ { -+ if (!memcmp(&guids[i], &type->guidMajorType, sizeof(GUID)) && -+ !memcmp(&guids[i+1], &type->guidSubtype, sizeof(GUID))) -+ { -+ ret = TRUE; -+ break; -+ } -+ } -+ -+out: -+ HeapFree(GetProcessHeap(), 0, guids); -+ RegCloseKey(hfilter); -+ RegCloseKey(htransform); -+ return ret; -+} -+ -+/*********************************************************************** -+ * MFTEnum (mfplat.@) -+ */ -+HRESULT WINAPI MFTEnum(GUID category, UINT32 flags, MFT_REGISTER_TYPE_INFO *input_type, -+ MFT_REGISTER_TYPE_INFO *output_type, IMFAttributes *attributes, -+ CLSID **pclsids, UINT32 *pcount) -+{ -+ WCHAR buffer[64], clsid_str[MAX_PATH]; -+ HKEY hcategory, hlist; -+ DWORD index = 0; -+ DWORD size = MAX_PATH; -+ CLSID *clsids = NULL; -+ UINT32 count = 0; -+ LONG ret; -+ -+ FIXME("(%s, %x, %p, %p, %p, %p, %p)\n", debugstr_guid(&category), flags, input_type, -+ output_type, attributes, pclsids, pcount); -+ -+ if (!pclsids || !pcount) -+ return E_INVALIDARG; -+ -+ if (RegOpenKeyW(HKEY_LOCAL_MACHINE, categories_keyW, &hcategory)) -+ return E_FAIL; -+ -+ GUIDToString(buffer, &category); -+ -+ ret = RegOpenKeyW(hcategory, buffer, &hlist); -+ RegCloseKey(hcategory); -+ if (ret) return E_FAIL; -+ -+ while (RegEnumKeyExW(hlist, index, clsid_str, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) -+ { -+ GUID clsid; -+ PVOID tmp; -+ -+ if (!GUIDFromString(clsid_str, &clsid)) -+ goto next; -+ -+ if (output_type && !match_type(clsid_str, outputtypesW, output_type)) -+ goto next; -+ -+ if (input_type && !match_type(clsid_str, inputtypesW, input_type)) -+ goto next; -+ -+ tmp = CoTaskMemRealloc(clsids, (count + 1) * sizeof(GUID)); -+ if (!tmp) -+ { -+ CoTaskMemFree(clsids); -+ RegCloseKey(hlist); -+ return E_OUTOFMEMORY; -+ } -+ -+ clsids = tmp; -+ clsids[count++] = clsid; -+ -+ next: -+ size = MAX_PATH; -+ index++; -+ } -+ -+ *pclsids = clsids; -+ *pcount = count; -+ -+ RegCloseKey(hlist); -+ return S_OK; -+} -+ - /*********************************************************************** - * MFTUnregister (mfplat.@) - */ -diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec -index 4501e27..cb16e8c 100644 ---- a/dlls/mfplat/mfplat.spec -+++ b/dlls/mfplat/mfplat.spec -@@ -134,7 +134,7 @@ - @ stdcall MFShutdown() - @ stdcall MFStartup(long long) - @ stub MFStreamDescriptorProtectMediaType --@ stub MFTEnum -+@ stdcall MFTEnum(int128 long ptr ptr ptr ptr ptr) - @ stub MFTEnumEx - @ stub MFTGetInfo - @ stdcall MFTRegister(int128 int128 wstr long long ptr long ptr ptr) --- -2.5.1 - diff --git a/patches/mfplat-MFTRegister/0004-mfplat-tests-Add-tests.patch b/patches/mfplat-MFTRegister/0004-mfplat-tests-Add-tests.patch deleted file mode 100644 index 545f1474..00000000 --- a/patches/mfplat-MFTRegister/0004-mfplat-tests-Add-tests.patch +++ /dev/null @@ -1,196 +0,0 @@ -From f7566e5af2508b89e87644cc079844f5827714ce Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Fri, 2 Oct 2015 05:09:10 +0200 -Subject: mfplat/tests: Add tests. - ---- - configure.ac | 1 + - dlls/mfplat/tests/Makefile.in | 5 ++ - dlls/mfplat/tests/mfplat.c | 151 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 157 insertions(+) - create mode 100644 dlls/mfplat/tests/Makefile.in - create mode 100644 dlls/mfplat/tests/mfplat.c - -diff --git a/configure.ac b/configure.ac -index 26be5e60676..a4c1360b3db 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -3122,6 +3122,7 @@ WINE_CONFIG_DLL(mciwave) - WINE_CONFIG_DLL(mf) - WINE_CONFIG_DLL(mf3216) - WINE_CONFIG_DLL(mfplat) -+WINE_CONFIG_TEST(dlls/mfplat/tests) - WINE_CONFIG_DLL(mfreadwrite) - WINE_CONFIG_DLL(mgmtapi) - WINE_CONFIG_DLL(midimap) -diff --git a/dlls/mfplat/tests/Makefile.in b/dlls/mfplat/tests/Makefile.in -new file mode 100644 -index 00000000000..41a098daafe ---- /dev/null -+++ b/dlls/mfplat/tests/Makefile.in -@@ -0,0 +1,5 @@ -+TESTDLL = mfplat.dll -+IMPORTS = ole32 -+ -+C_SRCS = \ -+ mfplat.c -diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c -new file mode 100644 -index 00000000000..5e3be98b59d ---- /dev/null -+++ b/dlls/mfplat/tests/mfplat.c -@@ -0,0 +1,151 @@ -+/* -+ * Unit test suite for mfplat. -+ * -+ * Copyright 2015 Michael Müller -+ * -+ * 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 -+#include -+ -+#define COBJMACROS -+ -+#include "windef.h" -+#include "winbase.h" -+#include "winuser.h" -+#include "winreg.h" -+ -+#include "initguid.h" -+#include "mfapi.h" -+#include "mferror.h" -+ -+#include "wine/test.h" -+ -+DEFINE_GUID(MFT_CATEGORY_OTHER, 0x90175d57,0xb7ea,0x4901,0xae,0xb3,0x93,0x3a,0x87,0x47,0x75,0x6f); -+ -+DEFINE_GUID(DUMMY_CLSID, 0x12345678,0x1234,0x1234,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19); -+DEFINE_GUID(DUMMY_GUID1, 0x12345678,0x1234,0x1234,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21); -+DEFINE_GUID(DUMMY_GUID2, 0x12345678,0x1234,0x1234,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22); -+DEFINE_GUID(DUMMY_GUID3, 0x12345678,0x1234,0x1234,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33); -+ -+static HRESULT (WINAPI* pMFTEnum)(GUID, UINT32, MFT_REGISTER_TYPE_INFO *, MFT_REGISTER_TYPE_INFO *, -+ IMFAttributes *, CLSID**, UINT32*); -+static HRESULT (WINAPI* pMFTRegister)(CLSID, GUID, LPWSTR, UINT32, UINT32, MFT_REGISTER_TYPE_INFO *, -+ UINT32, MFT_REGISTER_TYPE_INFO *, void *); -+static HRESULT (WINAPI* pMFTUnregister)(CLSID); -+ -+static BOOL check_clsid(CLSID *clsids, UINT32 count) -+{ -+ int i; -+ for (i = 0; i < count; i++) -+ { -+ if (IsEqualGUID(&clsids[i], &DUMMY_CLSID)) -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+static void test_register(void) -+{ -+ static WCHAR name[] = {'W','i','n','e',' ','t','e','s','t',0}; -+ MFT_REGISTER_TYPE_INFO input; -+ MFT_REGISTER_TYPE_INFO output; -+ CLSID *clsids; -+ UINT32 count; -+ HRESULT ret; -+ -+ memcpy(&input.guidMajorType, &DUMMY_GUID1, sizeof(GUID)); -+ memcpy(&input.guidMajorType, &DUMMY_GUID2, sizeof(GUID)); -+ memcpy(&output.guidSubtype, &DUMMY_GUID1, sizeof(GUID)); -+ memcpy(&output.guidSubtype, &DUMMY_GUID3, sizeof(GUID)); -+ -+ ret = pMFTRegister(DUMMY_CLSID, MFT_CATEGORY_OTHER, name, 0, 1, &input, 1, &output, NULL); -+ ok(!ret, "Failed to register dummy filter: %x\n", ret); -+ if (ret) return; -+ -+ count = 0; -+ clsids = NULL; -+ ret = pMFTEnum(MFT_CATEGORY_OTHER, 0, NULL, NULL, NULL, &clsids, &count); -+ ok(!ret, "Failed to enumerate filters: %x\n", ret); -+ ok(count > 0, "Expected count > 0\n"); -+ ok(clsids != NULL, "Expected clsids != NULL\n"); -+ ok(check_clsid(clsids, count), "Filter was not part of enumeration\n"); -+ CoTaskMemFree(clsids); -+ -+ count = 0; -+ clsids = NULL; -+ ret = pMFTEnum(MFT_CATEGORY_OTHER, 0, &input, NULL, NULL, &clsids, &count); -+ ok(!ret, "Failed to enumerate filters: %x\n", ret); -+ ok(count > 0, "Expected count > 0\n"); -+ ok(clsids != NULL, "Expected clsids != NULL\n"); -+ ok(check_clsid(clsids, count), "Filter was not part of enumeration\n"); -+ CoTaskMemFree(clsids); -+ -+ count = 0; -+ clsids = NULL; -+ ret = pMFTEnum(MFT_CATEGORY_OTHER, 0, NULL, &output, NULL, &clsids, &count); -+ ok(!ret, "Failed to enumerate filters: %x\n", ret); -+ ok(count > 0, "Expected count > 0\n"); -+ ok(clsids != NULL, "Expected clsids != NULL\n"); -+ ok(check_clsid(clsids, count), "Filter was not part of enumeration\n"); -+ CoTaskMemFree(clsids); -+ -+ count = 0; -+ clsids = NULL; -+ ret = pMFTEnum(MFT_CATEGORY_OTHER, 0, &input, &output, NULL, &clsids, &count); -+ ok(!ret, "Failed to enumerate filters: %x\n", ret); -+ ok(count > 0, "Expected count > 0\n"); -+ ok(clsids != NULL, "Expected clsids != NULL\n"); -+ ok(check_clsid(clsids, count), "Filter was not part of enumeration\n"); -+ CoTaskMemFree(clsids); -+ -+ /* exchange input and output */ -+ count = 0; -+ clsids = NULL; -+ ret = pMFTEnum(MFT_CATEGORY_OTHER, 0, &output, &input, NULL, &clsids, &count); -+ ok(!ret, "Failed to enumerate filters: %x\n", ret); -+ ok(!count, "Expected count == 0\n"); -+ ok(clsids == NULL, "Expected clsids == NULL\n"); -+ -+ pMFTUnregister(DUMMY_CLSID); -+} -+ -+BOOL init_function_ptrs(void) -+{ -+ HMODULE mfplat = LoadLibraryA("mfplat.dll"); -+ if (!mfplat) -+ { -+ win_skip("Could not load mfplat.dll\n"); -+ return FALSE; -+ } -+ -+ #define LOAD_FUNCPTR(f) p##f = (void*)GetProcAddress(mfplat, #f) -+ LOAD_FUNCPTR(MFTEnum); -+ LOAD_FUNCPTR(MFTRegister); -+ LOAD_FUNCPTR(MFTUnregister); -+ #undef LOAD_FUNCPTR -+ -+ return TRUE; -+} -+ -+START_TEST(mfplat) -+{ -+ if (!init_function_ptrs()) -+ return; -+ -+ CoInitialize(NULL); -+ test_register(); -+} --- -2.11.0 - diff --git a/patches/mfplat-MFTRegister/definition b/patches/mfplat-MFTRegister/definition index ca7f27b8..e7c0fc5c 100644 --- a/patches/mfplat-MFTRegister/definition +++ b/patches/mfplat-MFTRegister/definition @@ -1,4 +1,2 @@ -Fixes: [37811] Add implementation for mfplat.MFTRegister -Fixes: [39309] Add implementation for mfplat.MFTEnum Fixes: [39367] Return stub interface from mf.MFCreateMediaSession diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index b0228ed7..201d6af3 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "b6a4b2f593503a105dde01e7bd11ffdde243117a" + echo "8ef79b023a06f00ca6ab37afb8089d358b277d73" } # Show version information @@ -5002,29 +5002,20 @@ fi # Patchset mfplat-MFTRegister # | # | This patchset fixes the following Wine bugs: -# | * [#37811] Add implementation for mfplat.MFTRegister -# | * [#39309] Add implementation for mfplat.MFTEnum # | * [#39367] Return stub interface from mf.MFCreateMediaSession # | # | Modified files: -# | * configure.ac, dlls/mf/Makefile.in, dlls/mf/main.c, dlls/mf/mf.spec, dlls/mf/mf_private.h, dlls/mf/session.c, -# | dlls/mfplat/Makefile.in, dlls/mfplat/main.c, dlls/mfplat/mfplat.spec, dlls/mfplat/tests/Makefile.in, -# | dlls/mfplat/tests/mfplat.c, include/mfidl.idl, include/rpcndr.h, loader/wine.inf.in +# | * dlls/mf/Makefile.in, dlls/mf/main.c, dlls/mf/mf.spec, dlls/mf/mf_private.h, dlls/mf/session.c, dlls/mfplat/main.c, +# | dlls/mfplat/mfplat.spec, include/mfidl.idl, include/rpcndr.h # | if test "$enable_mfplat_MFTRegister" -eq 1; then - patch_apply mfplat-MFTRegister/0001-mfplat-Implement-MFTRegister.patch - patch_apply mfplat-MFTRegister/0002-mfplat-Implement-MFTUnregister.patch - patch_apply mfplat-MFTRegister/0003-mfplat-Implement-MFTEnum.patch - patch_apply mfplat-MFTRegister/0004-mfplat-tests-Add-tests.patch + patch_apply mfplat-MFTRegister/0001-mfplat-Fix-invalid-memory-access.patch patch_apply mfplat-MFTRegister/0006-mf-Add-stub-for-MFCreateMediaSession.patch patch_apply mfplat-MFTRegister/0007-include-rpcndr.h-Fix-definition-of-EXTERN_GUID.patch patch_apply mfplat-MFTRegister/0008-mf-Implement-IMFMediaSession-stub-interface.patch patch_apply mfplat-MFTRegister/0009-mfplat-Add-stub-for-MFCreateSourceResolver.patch ( - printf '%s\n' '+ { "Michael Müller", "mfplat: Implement MFTRegister.", 2 },'; - printf '%s\n' '+ { "Michael Müller", "mfplat: Implement MFTUnregister.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "mfplat: Implement MFTEnum.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "mfplat/tests: Add tests.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "mfplat: Fix invalid memory access.", 1 },'; printf '%s\n' '+ { "Michael Müller", "mf: Add stub for MFCreateMediaSession.", 1 },'; printf '%s\n' '+ { "Michael Müller", "include/rpcndr.h: Fix definition of EXTERN_GUID.", 1 },'; printf '%s\n' '+ { "Michael Müller", "mf: Implement IMFMediaSession stub interface.", 1 },';