[MSDMO] Sync with Wine Staging 3.9. CORE-14656

This commit is contained in:
Amine Khaldi 2018-05-27 03:59:47 +01:00
parent e467e5ff1b
commit 20e02be701
2 changed files with 37 additions and 23 deletions

View file

@ -29,7 +29,6 @@
#include "objbase.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "initguid.h"
#include "dmo.h"
WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
@ -118,6 +117,16 @@ static LPWSTR GUIDToString(LPWSTR lpwstr, REFGUID lpcguid)
return lpwstr;
}
static HRESULT string_to_guid(const WCHAR *string, GUID *guid)
{
WCHAR buffer[39];
buffer[0] = '{';
strcpyW(buffer + 1, string);
buffer[37] = '}';
buffer[38] = 0;
return CLSIDFromString(buffer, guid);
}
static BOOL IsMediaTypeEqual(const DMO_PARTIAL_MEDIATYPE* mt1, const DMO_PARTIAL_MEDIATYPE* mt2)
{
@ -391,7 +400,6 @@ static HRESULT IEnumDMO_Constructor(
{
IEnumDMOImpl* lpedmo;
HRESULT hr;
LONG ret;
*obj = NULL;
@ -406,6 +414,7 @@ static HRESULT IEnumDMO_Constructor(
lpedmo->dwFlags = dwFlags;
lpedmo->cInTypes = cInTypes;
lpedmo->cOutTypes = cOutTypes;
lpedmo->hkey = NULL;
hr = dup_partial_mediatype(pInTypes, cInTypes, &lpedmo->pInTypes);
if (FAILED(hr))
@ -418,8 +427,7 @@ static HRESULT IEnumDMO_Constructor(
/* If not filtering by category enum from media objects root */
if (IsEqualGUID(guidCategory, &GUID_NULL))
{
if ((ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_READ, &lpedmo->hkey)))
hr = HRESULT_FROM_WIN32(ret);
RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_READ, &lpedmo->hkey);
}
else
{
@ -427,8 +435,7 @@ static HRESULT IEnumDMO_Constructor(
WCHAR szKey[MAX_PATH];
wsprintfW(szKey, szCat3Fmt, szDMORootKey, szDMOCategories, GUIDToString(szguid, guidCategory));
if ((ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &lpedmo->hkey)))
hr = HRESULT_FROM_WIN32(ret);
RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &lpedmo->hkey);
}
lerr:
@ -517,14 +524,18 @@ static HRESULT WINAPI IEnumDMO_fnNext(
UINT count = 0;
HRESULT hres = S_OK;
LONG ret;
GUID guid;
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
TRACE("(%p)->(%d %p %p %p)\n", This, cItemsToFetch, pCLSID, Names, pcItemsFetched);
if (!pCLSID || !Names || !pcItemsFetched)
if (!pCLSID || !Names)
return E_POINTER;
if (!pcItemsFetched && cItemsToFetch > 1)
return E_INVALIDARG;
while (count < cItemsToFetch)
{
This->index++;
@ -537,6 +548,9 @@ static HRESULT WINAPI IEnumDMO_fnNext(
break;
}
if (string_to_guid(szNextKey, &guid) != S_OK)
continue;
TRACE("found %s\n", debugstr_w(szNextKey));
if (!(This->dwFlags & DMO_ENUMF_INCLUDE_KEYED))
@ -571,7 +585,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
continue;
}
pInTypes = (DMO_PARTIAL_MEDIATYPE*) szValue;
pInTypes = (DMO_PARTIAL_MEDIATYPE *)szValue;
TRACE("read %d intypes for %s:\n", cInTypes, debugstr_w(szKey));
for (i = 0; i < cInTypes; i++) {
@ -584,10 +598,10 @@ static HRESULT WINAPI IEnumDMO_fnNext(
for (j = 0; j < cInTypes; j++)
{
if (IsMediaTypeEqual(&pInTypes[j], &This->pInTypes[i]))
break;
break;
}
if (j >= cInTypes)
if (j >= cInTypes)
break;
}
@ -608,13 +622,13 @@ static HRESULT WINAPI IEnumDMO_fnNext(
sizeof(szValue)/sizeof(DMO_PARTIAL_MEDIATYPE),
(DMO_PARTIAL_MEDIATYPE*)szValue);
if (FAILED(hres))
if (FAILED(hres))
{
RegCloseKey(hkey);
continue;
}
pOutTypes = (DMO_PARTIAL_MEDIATYPE*) szValue;
pOutTypes = (DMO_PARTIAL_MEDIATYPE *)szValue;
TRACE("read %d outtypes for %s:\n", cOutTypes, debugstr_w(szKey));
for (i = 0; i < cOutTypes; i++) {
@ -627,10 +641,10 @@ static HRESULT WINAPI IEnumDMO_fnNext(
for (j = 0; j < cOutTypes; j++)
{
if (IsMediaTypeEqual(&pOutTypes[j], &This->pOutTypes[i]))
break;
break;
}
if (j >= cOutTypes)
if (j >= cOutTypes)
break;
}
@ -641,26 +655,26 @@ static HRESULT WINAPI IEnumDMO_fnNext(
}
}
/* Media object wasn't filtered so add it to return list */
/* Media object wasn't filtered so add it to return list */
Names[count] = NULL;
len = MAX_PATH * sizeof(WCHAR);
len = MAX_PATH * sizeof(WCHAR);
ret = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE)szValue, &len);
if (ERROR_SUCCESS == ret)
{
{
Names[count] = CoTaskMemAlloc((strlenW(szValue) + 1) * sizeof(WCHAR));
if (Names[count])
if (Names[count])
strcpyW(Names[count], szValue);
}
}
wsprintfW(szGuidKey,szToGuidFmt,szNextKey);
CLSIDFromString(szGuidKey, &pCLSID[count]);
TRACE("found match %s %s\n", debugstr_w(szValue), debugstr_w(szNextKey));
RegCloseKey(hkey);
count++;
count++;
}
*pcItemsFetched = count;
if (*pcItemsFetched < cItemsToFetch)
if (pcItemsFetched) *pcItemsFetched = count;
if (count < cItemsToFetch)
hres = S_FALSE;
TRACE("<-- %i found\n",count);

View file

@ -37,7 +37,7 @@ reactos/dll/directx/wine/dplay # Synced to WineStaging-3.3
reactos/dll/directx/wine/dplayx # Synced to WineStaging-3.3
reactos/dll/directx/wine/dsound # Synced to Wine-1.3.29
reactos/dll/directx/wine/dxdiagn # Synced to WineStaging-3.3
reactos/dll/directx/wine/msdmo # Synced to WineStaging-3.3
reactos/dll/directx/wine/msdmo # Synced to WineStaging-3.9
reactos/dll/directx/wine/qedit # Synced to WineStaging-3.3
reactos/dll/directx/wine/quartz # Synced to WineStaging-3.3
reactos/dll/directx/wine/wined3d # Synced to WineStaging-3.9