mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added patch for implementation of mfplat.MFTEnum.
This commit is contained in:
parent
59e96aed08
commit
6a06b1710e
@ -34,8 +34,9 @@ Wine. All those differences are also documented on the
|
||||
Included bug fixes and improvements
|
||||
-----------------------------------
|
||||
|
||||
**Bug fixes and features included in the next upcoming release [16]:**
|
||||
**Bug fixes and features included in the next upcoming release [17]:**
|
||||
|
||||
* Add implementation for mfplat.MFTEnum ([Wine Bug #39309](https://bugs.winehq.org/show_bug.cgi?id=39309))
|
||||
* Add implementation for msidb commandline tool
|
||||
* BitBlt and StretchDIBits should be marked as hotpatchable
|
||||
* Codepage conversion should fail when destination length is < 0
|
||||
|
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -27,6 +27,7 @@ wine-staging (1.7.52) UNRELEASED; urgency=low
|
||||
* Added patch to mark BitBlt and StretchDIBits as hotpatchable.
|
||||
* Added patch to mark WritePrivateProfileStringA as hotpatchable.
|
||||
* Added patch to make ddraw1 and ddraw_surface1 vtable as writable.
|
||||
* Added patch for implementation of mfplat.MFTEnum.
|
||||
* Removed patch to fix possible memory leak in netprofm init_networks (fixed
|
||||
upstream).
|
||||
* Removed patch for stub of dwmapi.DwmUpdateThumbnailProperties (accepted
|
||||
|
@ -1,4 +1,4 @@
|
||||
From b2283c88d9a2844fd4f20684271a14fe10960f96 Mon Sep 17 00:00:00 2001
|
||||
From f2fd954313bf70edc5204b89f5f1b668925eda28 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 17 Apr 2015 14:39:17 +0200
|
||||
Subject: mfplat: Implement MFTRegister. (v2)
|
||||
@ -21,7 +21,7 @@ index 2b5bd24..9679f53 100644
|
||||
C_SRCS = \
|
||||
main.c
|
||||
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
|
||||
index 698c681..c72d951 100644
|
||||
index 698c681..d8b0c7a 100644
|
||||
--- a/dlls/mfplat/main.c
|
||||
+++ b/dlls/mfplat/main.c
|
||||
@@ -23,15 +23,44 @@
|
||||
@ -74,8 +74,8 @@ index 698c681..c72d951 100644
|
||||
}
|
||||
|
||||
+static HRESULT register_transform(CLSID *clsid, WCHAR *name,
|
||||
+ UINT32 cinput, MFT_REGISTER_TYPE_INFO *inputTypes,
|
||||
+ UINT32 coutput, MFT_REGISTER_TYPE_INFO *outputTypes)
|
||||
+ UINT32 cinput, MFT_REGISTER_TYPE_INFO *input_types,
|
||||
+ UINT32 coutput, MFT_REGISTER_TYPE_INFO *output_types)
|
||||
+{
|
||||
+ HKEY htransform, hclsid = 0;
|
||||
+ WCHAR buffer[64];
|
||||
@ -104,8 +104,8 @@ index 698c681..c72d951 100644
|
||||
+
|
||||
+ for (i = 0; i < cinput; i++)
|
||||
+ {
|
||||
+ memcpy(&types[2 * i], &inputTypes[i].guidMajorType, sizeof(GUID));
|
||||
+ memcpy(&types[2 * i + 1], &inputTypes[i].guidSubtype, sizeof(GUID));
|
||||
+ 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);
|
||||
@ -121,8 +121,8 @@ index 698c681..c72d951 100644
|
||||
+
|
||||
+ for (i = 0; i < coutput; i++)
|
||||
+ {
|
||||
+ memcpy(&types[2 * i], &outputTypes[i].guidMajorType, sizeof(GUID));
|
||||
+ memcpy(&types[2 * i + 1], &outputTypes[i].guidSubtype, sizeof(GUID));
|
||||
+ 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);
|
||||
@ -165,14 +165,14 @@ index 698c681..c72d951 100644
|
||||
+ * MFTRegister (mfplat.@)
|
||||
+ */
|
||||
+HRESULT WINAPI MFTRegister(CLSID clsid, GUID category, LPWSTR name, UINT32 flags, UINT32 cinput,
|
||||
+ MFT_REGISTER_TYPE_INFO *inputTypes, UINT32 coutput,
|
||||
+ MFT_REGISTER_TYPE_INFO *outputTypes, void *attributes)
|
||||
+ 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, inputTypes,
|
||||
+ coutput, outputTypes, attributes);
|
||||
+ debugstr_w(name), flags, cinput, input_types,
|
||||
+ coutput, output_types, attributes);
|
||||
+
|
||||
+ if (attributes)
|
||||
+ FIXME("attributes not yet supported.\n");
|
||||
@ -180,7 +180,7 @@ index 698c681..c72d951 100644
|
||||
+ if (flags)
|
||||
+ FIXME("flags not yet supported.\n");
|
||||
+
|
||||
+ hr = register_transform(&clsid, name, cinput, inputTypes, coutput, outputTypes);
|
||||
+ hr = register_transform(&clsid, name, cinput, input_types, coutput, output_types);
|
||||
+
|
||||
+ if (SUCCEEDED(hr))
|
||||
+ hr = register_category(&clsid, &category);
|
||||
@ -205,7 +205,7 @@ index 0b402b7..acde0a5 100644
|
||||
@ stub MFTRegisterLocalByCLSID
|
||||
@ stub MFTUnregister
|
||||
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
|
||||
index 2025d9e..0f4c400 100644
|
||||
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
|
||||
|
@ -0,0 +1,75 @@
|
||||
From a978b107d7717dd6768a987007cfbbc8b3a89014 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
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
|
||||
|
253
patches/mfplat-MFTRegister/0003-mfplat-Implement-MFTEnum.patch
Normal file
253
patches/mfplat-MFTRegister/0003-mfplat-Implement-MFTEnum.patch
Normal file
@ -0,0 +1,253 @@
|
||||
From afc93aaac4a5e5711e9bfe4757fdeb3bdd53bd26 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
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 <stdarg.h>
|
||||
+#include <string.h>
|
||||
|
||||
#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
|
||||
|
196
patches/mfplat-MFTRegister/0004-mfplat-tests-Add-tests.patch
Normal file
196
patches/mfplat-MFTRegister/0004-mfplat-tests-Add-tests.patch
Normal file
@ -0,0 +1,196 @@
|
||||
From ad8bbfd9104e2d35aba7f37b26c555bb7cbd7e16 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
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 c37c491..54641a6 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -3078,6 +3078,7 @@ WINE_CONFIG_DLL(mciseq)
|
||||
WINE_CONFIG_DLL(mciwave)
|
||||
WINE_CONFIG_DLL(mf)
|
||||
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 0000000..41a098d
|
||||
--- /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 0000000..5e3be98
|
||||
--- /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 <stdarg.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#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.5.1
|
||||
|
@ -1,2 +1,3 @@
|
||||
Fixes: [37811] Add implementation for mfplat.MFTRegister
|
||||
Fixes: [39309] Add implementation for mfplat.MFTEnum
|
||||
Category: stable
|
||||
|
@ -3746,14 +3746,22 @@ fi
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#37811] Add implementation for mfplat.MFTRegister
|
||||
# | * [#39309] Add implementation for mfplat.MFTEnum
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/mfplat/Makefile.in, dlls/mfplat/main.c, dlls/mfplat/mfplat.spec, loader/wine.inf.in
|
||||
# | * configure.ac, dlls/mfplat/Makefile.in, dlls/mfplat/main.c, dlls/mfplat/mfplat.spec, dlls/mfplat/tests/Makefile.in,
|
||||
# | dlls/mfplat/tests/mfplat.c, loader/wine.inf.in
|
||||
# |
|
||||
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
|
||||
(
|
||||
echo '+ { "Michael Müller", "mfplat: Implement MFTRegister.", 2 },';
|
||||
echo '+ { "Michael Müller", "mfplat: Implement MFTUnregister.", 1 },';
|
||||
echo '+ { "Michael Müller", "mfplat: Implement MFTEnum.", 1 },';
|
||||
echo '+ { "Michael Müller", "mfplat/tests: Add tests.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user