https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dbcbc1cda146e605376657...
commit dbcbc1cda146e605376657467ac858be5bd16ee7 Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Thu Mar 8 13:30:52 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Thu Mar 8 13:30:52 2018 +0100
[DEVENUM] Sync with Wine Staging 3.3. CORE-14434 --- dll/directx/wine/devenum/CMakeLists.txt | 4 +- dll/directx/wine/devenum/createdevenum.c | 83 +++++++++++++++++++++++++++-- dll/directx/wine/devenum/devenum.rc | 11 ++-- dll/directx/wine/devenum/devenum_main.c | 4 +- dll/directx/wine/devenum/devenum_private.h | 41 +++++++------- dll/directx/wine/devenum/factory.c | 4 ++ dll/directx/wine/devenum/mediacatenum.c | 7 ++- dll/directx/wine/devenum/parsedisplayname.c | 5 +- dll/directx/wine/devenum/precomp.h | 16 ++++++ dll/directx/wine/devenum/resource.h | 8 --- media/doc/README.WINE | 2 +- 11 files changed, 141 insertions(+), 44 deletions(-)
diff --git a/dll/directx/wine/devenum/CMakeLists.txt b/dll/directx/wine/devenum/CMakeLists.txt index 3992202e2e..d8af794b86 100644 --- a/dll/directx/wine/devenum/CMakeLists.txt +++ b/dll/directx/wine/devenum/CMakeLists.txt @@ -12,7 +12,7 @@ list(APPEND SOURCE factory.c mediacatenum.c parsedisplayname.c - devenum_private.h) + precomp.h)
add_library(devenum SHARED ${SOURCE} @@ -24,5 +24,5 @@ set_module_type(devenum win32dll UNICODE) target_link_libraries(devenum strmiids uuid wine) add_delay_importlibs(devenum msvfw32) add_importlibs(devenum advapi32 advapi32_vista ole32 oleaut32 winmm user32 avicap32 msacm32 msvcrt kernel32 ntdll) -add_pch(devenum devenum_private.h SOURCE) +add_pch(devenum precomp.h SOURCE) add_cd_file(TARGET devenum DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/wine/devenum/createdevenum.c b/dll/directx/wine/devenum/createdevenum.c index a4d0df5a34..002ffbc876 100644 --- a/dll/directx/wine/devenum/createdevenum.c +++ b/dll/directx/wine/devenum/createdevenum.c @@ -23,13 +23,18 @@ * - Also creates the special registry keys created at run-time */
+#define NONAMELESSSTRUCT +#define NONAMELESSUNION + #include "devenum_private.h" +#include "vfw.h" +#include "aviriff.h"
-#include <vfw.h> -#include <aviriff.h> -#include <shlwapi.h> +#include "wine/debug.h" +#include "wine/unicode.h" +#include "mmddk.h"
-#include "resource.h" +WINE_DEFAULT_DEBUG_CHANNEL(devenum);
extern HINSTANCE DEVENUM_hInstance;
@@ -109,6 +114,7 @@ static BOOL IsSpecialCategory(const CLSID *clsid) IsEqualGUID(clsid, &CLSID_AudioInputDeviceCategory) || IsEqualGUID(clsid, &CLSID_VideoInputDeviceCategory) || IsEqualGUID(clsid, &CLSID_VideoCompressorCategory) || + IsEqualGUID(clsid, &CLSID_AudioCompressorCategory) || IsEqualGUID(clsid, &CLSID_MidiRendererCategory); }
@@ -633,6 +639,72 @@ static void register_vfw_codecs(void) RegCloseKey(basekey); }
+static BOOL WINAPI acm_driver_callback(HACMDRIVERID hadid, DWORD_PTR user, DWORD support) +{ + static const WCHAR CLSIDW[] = {'C','L','S','I','D',0}; + static const WCHAR AcmIdW[] = {'A','c','m','I','d',0}; + static const WCHAR FriendlyNameW[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0}; + static const WCHAR fmtW[] = {'%','u','%','s',0}; + + WCHAR acmwrapper_clsid_str[CHARS_IN_GUID], buffer[MAX_PATH]; + HKEY key, basekey = (HKEY) user; + ACMFORMATTAGDETAILSW format; + ACMDRIVERDETAILSW driver; + HACMDRIVER had; + DWORD i, res; + + StringFromGUID2(&CLSID_ACMWrapper, acmwrapper_clsid_str, sizeof(acmwrapper_clsid_str)/sizeof(WCHAR)); + + driver.cbStruct = sizeof(driver); + if (acmDriverDetailsW(hadid, &driver, 0) != MMSYSERR_NOERROR) + return TRUE; + + if (acmDriverOpen(&had, hadid, 0) != MMSYSERR_NOERROR) + return TRUE; + + for (i = 0; i < driver.cFormatTags; i++) + { + memset(&format, 0, sizeof(format)); + format.cbStruct = sizeof(format); + format.dwFormatTagIndex = i; + + if (acmFormatTagDetailsW(had, &format, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR) + continue; + + snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), fmtW, format.dwFormatTag, format.szFormatTag); + + res = RegCreateKeyW(basekey, buffer, &key); + if (res != ERROR_SUCCESS) continue; + + RegSetValueExW(key, CLSIDW, 0, REG_SZ, (BYTE*)acmwrapper_clsid_str, sizeof(acmwrapper_clsid_str)); + RegSetValueExW(key, AcmIdW, 0, REG_DWORD, (BYTE*)&format.dwFormatTag, sizeof(DWORD)); + RegSetValueExW(key, FriendlyNameW, 0, REG_SZ, (BYTE*)format.szFormatTag, (strlenW(format.szFormatTag)+1)*sizeof(WCHAR)); + /* FIXME: Set FilterData values */ + + RegCloseKey(key); + } + + acmDriverClose(had, 0); + + return TRUE; +} + +static void register_acm_codecs(void) +{ + HKEY basekey; + + basekey = open_special_category_key(&CLSID_AudioCompressorCategory, TRUE); + if (!basekey) + { + ERR("Could not create key\n"); + return; + } + + acmDriverEnum(acm_driver_callback, (DWORD_PTR)basekey, 0); + + RegCloseKey(basekey); +} + static HANDLE DEVENUM_populate_handle; static const WCHAR DEVENUM_populate_handle_nameW[] = {'_','_','W','I','N','E','_', @@ -685,6 +757,8 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) RegDeleteTreeW(basekey, path); if (SUCCEEDED(DEVENUM_GetCategoryKey(&CLSID_VideoCompressorCategory, &basekey, path, MAX_PATH))) RegDeleteTreeW(basekey, path); + if (SUCCEEDED(DEVENUM_GetCategoryKey(&CLSID_AudioCompressorCategory, &basekey, path, MAX_PATH))) + RegDeleteTreeW(basekey, path);
rf2.dwVersion = 2; rf2.dwMerit = MERIT_PREFERRED; @@ -966,6 +1040,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) IFilterMapper2_Release(pMapper);
register_vfw_codecs(); + register_acm_codecs();
SetEvent(DEVENUM_populate_handle); return res; diff --git a/dll/directx/wine/devenum/devenum.rc b/dll/directx/wine/devenum/devenum.rc index fcb0a0217b..294d41ff23 100644 --- a/dll/directx/wine/devenum/devenum.rc +++ b/dll/directx/wine/devenum/devenum.rc @@ -18,11 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <windef.h> +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "devenum_private.h"
-#include "resource.h" - -#pragma code_page(65001) +#pragma makedep po
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
@@ -43,6 +44,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #define WINE_PRODUCTVERSION 6,5,1,902 #define WINE_PRODUCTVERSION_STR "6.5"
-#include <wine/wine_common_ver.rc> +#include "wine/wine_common_ver.rc"
1 WINE_REGISTRY devenum_classes.rgs diff --git a/dll/directx/wine/devenum/devenum_main.c b/dll/directx/wine/devenum/devenum_main.c index 005dc957da..5596358117 100644 --- a/dll/directx/wine/devenum/devenum_main.c +++ b/dll/directx/wine/devenum/devenum_main.c @@ -20,8 +20,10 @@ */
#include "devenum_private.h" +#include "rpcproxy.h" +#include "wine/debug.h"
-#include <rpcproxy.h> +WINE_DEFAULT_DEBUG_CHANNEL(devenum);
DECLSPEC_HIDDEN LONG dll_refs; DECLSPEC_HIDDEN HINSTANCE DEVENUM_hInstance; diff --git a/dll/directx/wine/devenum/devenum_private.h b/dll/directx/wine/devenum/devenum_private.h index 088cc4c909..72c285d422 100644 --- a/dll/directx/wine/devenum/devenum_private.h +++ b/dll/directx/wine/devenum/devenum_private.h @@ -22,35 +22,28 @@ * - Private file where devenum globals are declared */
-#ifndef __WINE_DEVENUM_H -#define __WINE_DEVENUM_H +#pragma once
#ifndef RC_INVOKED #include <stdarg.h> #endif
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "winerror.h"
#define COBJMACROS -#define NONAMELESSSTRUCT -#define NONAMELESSUNION
-#include <windef.h> -#include <winbase.h> -#include <wingdi.h> -#include <winreg.h> -#include <objbase.h> -#include <oleidl.h> -#include <strmif.h> -#include <uuids.h> - -#include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(devenum); +#include "ole2.h" +#include "strmif.h" +#include "olectl.h" +#include "uuids.h"
#ifndef RC_INVOKED -#include <wine/unicode.h> +#include "wine/unicode.h" #endif
/********************************************************************** @@ -95,4 +88,12 @@ extern const WCHAR clsid_keyname[6] DECLSPEC_HIDDEN; extern const WCHAR wszInstanceKeyName[] DECLSPEC_HIDDEN; #define CLSID_STR_LEN (sizeof(clsid_keyname) / sizeof(WCHAR))
-#endif /* __WINE_DEVENUM_H */ +/********************************************************************** + * Resource IDs + */ +#define IDS_DEVENUM_DSDEFAULT 7 +#define IDS_DEVENUM_DS 8 +#define IDS_DEVENUM_WODEFAULT 9 +#define IDS_DEVENUM_MIDEFAULT 10 +#define IDS_DEVENUM_KSDEFAULT 11 +#define IDS_DEVENUM_KS 12 diff --git a/dll/directx/wine/devenum/factory.c b/dll/directx/wine/devenum/factory.c index e31944ad50..c808fa532d 100644 --- a/dll/directx/wine/devenum/factory.c +++ b/dll/directx/wine/devenum/factory.c @@ -21,6 +21,10 @@
#include "devenum_private.h"
+#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(devenum); + /********************************************************************** * DEVENUM_IClassFactory_QueryInterface (also IUnknown) */ diff --git a/dll/directx/wine/devenum/mediacatenum.c b/dll/directx/wine/devenum/mediacatenum.c index fb4e561dc7..4edc4e9622 100644 --- a/dll/directx/wine/devenum/mediacatenum.c +++ b/dll/directx/wine/devenum/mediacatenum.c @@ -23,9 +23,12 @@ */
#include "devenum_private.h" +#include "oleauto.h" +#include "ocidl.h"
-#include <ocidl.h> -#include <oleauto.h> +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(devenum);
typedef struct { diff --git a/dll/directx/wine/devenum/parsedisplayname.c b/dll/directx/wine/devenum/parsedisplayname.c index 5c8b67680f..77ea1ecdcb 100644 --- a/dll/directx/wine/devenum/parsedisplayname.c +++ b/dll/directx/wine/devenum/parsedisplayname.c @@ -21,9 +21,12 @@ * - Implements IParseDisplayName interface which creates a moniker * from a string in a special format */ - #include "devenum_private.h"
+#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(devenum); + static HRESULT WINAPI DEVENUM_IParseDisplayName_QueryInterface(IParseDisplayName *iface, REFIID riid, void **ppv) { diff --git a/dll/directx/wine/devenum/precomp.h b/dll/directx/wine/devenum/precomp.h new file mode 100644 index 0000000000..071deb3f19 --- /dev/null +++ b/dll/directx/wine/devenum/precomp.h @@ -0,0 +1,16 @@ + +#ifndef _WINE_DEVENUM_PRECOMP_H +#define _WINE_DEVENUM_PRECOMP_H + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define NONAMELESSSTRUCT +#define NONAMELESSUNION + +#include "devenum_private.h" + +#include <wine/debug.h> + +#endif /* !_WINE_DEVENUM_PRECOMP_H */ diff --git a/dll/directx/wine/devenum/resource.h b/dll/directx/wine/devenum/resource.h deleted file mode 100644 index 3cc562ba4c..0000000000 --- a/dll/directx/wine/devenum/resource.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#define IDS_DEVENUM_DSDEFAULT 7 -#define IDS_DEVENUM_DS 8 -#define IDS_DEVENUM_WODEFAULT 9 -#define IDS_DEVENUM_MIDEFAULT 10 -#define IDS_DEVENUM_KSDEFAULT 11 -#define IDS_DEVENUM_KS 12 diff --git a/media/doc/README.WINE b/media/doc/README.WINE index fd64d09a2e..f41e4884d8 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -29,7 +29,7 @@ reactos/dll/directx/wine/d3drm # Synced to WineStaging-3.3 reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-3.3 reactos/dll/directx/wine/d3dxof # Synced to WineStaging-3.3 reactos/dll/directx/wine/ddraw # Synced to WineStaging-3.3 -reactos/dll/directx/wine/devenum # Synced to Wine-3.0 +reactos/dll/directx/wine/devenum # Synced to WineStaging-3.3 reactos/dll/directx/wine/dinput # Synced to Wine-3.0 reactos/dll/directx/wine/dinput8 # Synced to WineStaging-2.9 reactos/dll/directx/wine/dmusic # Synced to WineStaging-2.9