msacm32: Use extended structure definition for driver configuration.

1a) fixes a too short memory allocation on 64bit (DRVCONFIGINFO is 20 byte
    large while only 16 bytes were allocated)
1b) incidentally, removes a bunch of GCC11 warnings (generated by 1a)
2)  introduces DRVCONFIGINFOEX (note, in SDK, it's defined in mmiscapi.h;
    since it doesn't exist yet in Wine, I added the structure to
    mmsystem.h, where DRVCONFIGINFO already exists)
3)  initializes the missing field

Note: my testing don't show on Win10's msacm32 that DRV_CONFIGURE uses the
DRVCONFIGINFOEX structure.
So, maybe (wild guess here), the extended structure is only used
when the driver is linked to some hardware.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-02-11 18:49:45 +01:00 committed by Alexandre Julliard
parent 3a0eb8bde9
commit 14f8089dc1
2 changed files with 15 additions and 9 deletions

View File

@ -400,7 +400,7 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
{
PWINE_ACMDRIVERID padid;
LRESULT lResult;
LPDRVCONFIGINFO pConfigInfo = NULL;
LPDRVCONFIGINFOEX pConfigInfo = NULL;
LPWSTR section_name = NULL;
LPWSTR alias_name = NULL;
@ -425,16 +425,15 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
}
if (pAlias != NULL) {
/* DRVCONFIGINFO is only 12 bytes long, but native msacm
* reports a 16-byte structure to codecs, so allocate 16 bytes,
* just to be on the safe side.
*/
const unsigned int iStructSize = 16;
pConfigInfo = HeapAlloc(MSACM_hHeap, 0, iStructSize);
pConfigInfo = HeapAlloc(MSACM_hHeap, 0, sizeof(*pConfigInfo));
if (!pConfigInfo) {
ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n");
ERR("OOM while supplying DRVCONFIGINFOEX for DRV_CONFIGURE, using NULL\n");
} else {
pConfigInfo->dwDCISize = iStructSize;
/* In some cases (seen in the 32bit world), a DRVCONFIGINFOEX struct is passed
* (with extended size) instead of the documented DRVCONFIGINFO.
* So, always pass a DRVCONFIGINFOEX to be one the safe side
*/
pConfigInfo->dwDCISize = sizeof(*pConfigInfo);
section_name = HeapAlloc(MSACM_hHeap, 0, sizeof(L"Drivers32"));
if (section_name) lstrcpyW(section_name, L"Drivers32");
@ -442,6 +441,7 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
alias_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(pAlias) + 1) * sizeof(WCHAR));
if (alias_name) lstrcpyW(alias_name, pAlias);
pConfigInfo->lpszDCIAliasName = alias_name;
pConfigInfo->dnDevNode = 0; /* FIXME */
if (pConfigInfo->lpszDCISectionName == NULL || pConfigInfo->lpszDCIAliasName == NULL) {
HeapFree(MSACM_hHeap, 0, alias_name);

View File

@ -225,6 +225,12 @@ typedef struct tagDRVCONFIGINFO {
LPCWSTR lpszDCIAliasName;
} DRVCONFIGINFO, *LPDRVCONFIGINFO;
typedef struct tagDRVCONFIGINFOEX {
DWORD dwDCISize;
LPCWSTR lpszDCISectionName;
LPCWSTR lpszDCIAliasName;
DWORD dnDevNode;
} DRVCONFIGINFOEX, *LPDRVCONFIGINFOEX;
LRESULT WINAPI DefDriverProc(DWORD_PTR,HDRVR,UINT,LPARAM,LPARAM);
/* this sounds odd, but it's the way it is. OpenDriverA even disappeared