From 87c5a4c7a06cb5bd37293b5d311264bfe93800b0 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 15 Sep 2023 08:19:50 +1000 Subject: [PATCH] Rebase against f71315c8494575698634062cfad4f5d84fd230a1. --- ...sh-in-Win-9X-mode-when-an-invalid-de.patch | 56 ++++++++++--------- staging/upstream-commit | 2 +- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/patches/winmm-mciSendCommandA/0001-winmm-Do-not-crash-in-Win-9X-mode-when-an-invalid-de.patch b/patches/winmm-mciSendCommandA/0001-winmm-Do-not-crash-in-Win-9X-mode-when-an-invalid-de.patch index c4788b64..85594824 100644 --- a/patches/winmm-mciSendCommandA/0001-winmm-Do-not-crash-in-Win-9X-mode-when-an-invalid-de.patch +++ b/patches/winmm-mciSendCommandA/0001-winmm-Do-not-crash-in-Win-9X-mode-when-an-invalid-de.patch @@ -1,18 +1,18 @@ -From f32d9d5f3b9b4b3e54037211f5d561681ed589fa Mon Sep 17 00:00:00 2001 +From da3cf82252881cb1e4315bd0ecb44bd27ee5520f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 4 Mar 2016 16:15:50 +0100 Subject: [PATCH] winmm: Do not crash in Win 9X mode when an invalid device ptr is passed to MCI_OPEN. --- - dlls/winmm/mci.c | 42 ++++++++++++++++++++---------------------- - 1 file changed, 20 insertions(+), 22 deletions(-) + dlls/winmm/mci.c | 44 +++++++++++++++++++++----------------------- + 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c -index 2aa74fd4127..5b8463286e5 100644 +index 959801aa835..c56a69def11 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c -@@ -209,7 +209,7 @@ static LPWSTR MCI_strdupAtoW( LPCSTR str ) +@@ -204,7 +204,7 @@ static LPWSTR MCI_strdupAtoW( LPCSTR str ) return ret; } @@ -21,7 +21,7 @@ index 2aa74fd4127..5b8463286e5 100644 { if (msg < DRV_RESERVED) return 0; -@@ -252,8 +252,12 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -247,8 +247,12 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) MCI_ANIM_OPEN_PARMSW *mci_openW; DWORD_PTR *ptr; @@ -29,13 +29,13 @@ index 2aa74fd4127..5b8463286e5 100644 + (GetVersion() & 0x80000000) && IsBadStringPtrA(mci_openA->lpstrDeviceType, -1)) + return MCIERR_MISSING_COMMAND_STRING; + - ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD_PTR) + sizeof(*mci_openW)); + ptr = malloc(sizeof(DWORD_PTR) + sizeof(*mci_openW)); - if (!ptr) return -1; + if (!ptr) return MCIERR_OUT_OF_MEMORY; *ptr++ = *dwParam2; /* save the previous pointer */ *dwParam2 = (DWORD_PTR)ptr; -@@ -283,7 +287,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -278,7 +282,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) if (HIWORD(dwParam1)) memcpy(&mci_openW->dwStyle, &mci_openA->dwStyle, sizeof(MCI_ANIM_OPEN_PARMSW) - sizeof(MCI_OPEN_PARMSW)); } @@ -44,16 +44,18 @@ index 2aa74fd4127..5b8463286e5 100644 case MCI_WINDOW: if (dwParam1 & MCI_ANIM_WINDOW_TEXT) -@@ -292,7 +296,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -286,8 +290,8 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) + MCI_ANIM_WINDOW_PARMSA *mci_windowA = (MCI_ANIM_WINDOW_PARMSA *)*dwParam2; MCI_ANIM_WINDOW_PARMSW *mci_windowW; - mci_windowW = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_windowW)); +- mci_windowW = malloc(sizeof(*mci_windowW)); - if (!mci_windowW) return -1; ++ mci_windowW = malloc( sizeof(*mci_windowW)); + if (!mci_windowW) return MCIERR_OUT_OF_MEMORY; *dwParam2 = (DWORD_PTR)mci_windowW; -@@ -304,8 +308,6 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -299,8 +303,6 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) mci_windowW->hWnd = mci_windowA->hWnd; if (dwParam1 & MCI_ANIM_WINDOW_STATE) mci_windowW->nCmdShow = mci_windowA->nCmdShow; @@ -62,34 +64,34 @@ index 2aa74fd4127..5b8463286e5 100644 } return 0; -@@ -317,7 +319,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -312,7 +314,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) DWORD_PTR *ptr; - ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_sysinfoW) + sizeof(DWORD_PTR)); + ptr = malloc(sizeof(*mci_sysinfoW) + sizeof(DWORD_PTR)); - if (!ptr) return -1; + if (!ptr) return MCIERR_OUT_OF_MEMORY; *ptr++ = *dwParam2; /* save the previous pointer */ *dwParam2 = (DWORD_PTR)ptr; -@@ -331,7 +333,6 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) - mci_sysinfoW->lpstrReturn = HeapAlloc(GetProcessHeap(), 0, mci_sysinfoW->dwRetSize * sizeof(WCHAR)); +@@ -326,7 +328,6 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) + mci_sysinfoW->lpstrReturn = malloc(mci_sysinfoW->dwRetSize * sizeof(WCHAR)); mci_sysinfoW->dwNumber = mci_sysinfoA->dwNumber; mci_sysinfoW->wDeviceType = mci_sysinfoA->wDeviceType; - return 1; } return 0; case MCI_INFO: -@@ -341,7 +342,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -336,7 +337,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) DWORD_PTR *ptr; - ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_infoW) + sizeof(DWORD_PTR)); + ptr = malloc(sizeof(*mci_infoW) + sizeof(DWORD_PTR)); - if (!ptr) return -1; + if (!ptr) return MCIERR_OUT_OF_MEMORY; *ptr++ = *dwParam2; /* save the previous pointer */ *dwParam2 = (DWORD_PTR)ptr; -@@ -355,8 +356,8 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) - mci_infoW->lpstrReturn = HeapAlloc(GetProcessHeap(), 0, mci_infoW->dwRetSize * sizeof(WCHAR)); +@@ -350,8 +351,8 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) + mci_infoW->lpstrReturn = malloc(mci_infoW->dwRetSize * sizeof(WCHAR)); if (dwParam1 & MCI_DGV_INFO_ITEM) mci_infoW->dwItem = mci_infoA->dwItem; - return 1; @@ -98,16 +100,16 @@ index 2aa74fd4127..5b8463286e5 100644 case MCI_SAVE: case MCI_LOAD: case MCI_CAPTURE: -@@ -366,7 +367,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -361,7 +362,7 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) MCI_OVLY_LOAD_PARMSW *mci_loadW; - mci_loadW = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_loadW)); + mci_loadW = malloc(sizeof(*mci_loadW)); - if (!mci_loadW) return -1; + if (!mci_loadW) return MCIERR_OUT_OF_MEMORY; *dwParam2 = (DWORD_PTR)mci_loadW; if (dwParam1 & MCI_NOTIFY) -@@ -377,8 +378,8 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -372,8 +373,8 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) (MCI_CAPTURE == msg && dwParam1 & MCI_DGV_CAPTURE_AT) || (MCI_RESTORE == msg && dwParam1 & MCI_DGV_RESTORE_AT)) mci_loadW->rc = mci_loadA->rc; @@ -117,10 +119,10 @@ index 2aa74fd4127..5b8463286e5 100644 case MCI_SOUND: case MCI_ESCAPE: { /* All these commands have the same layout: callback + string */ -@@ -386,14 +387,14 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) +@@ -381,14 +382,14 @@ static int MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2) MCI_VD_ESCAPE_PARMSW *mci_vd_escapeW; - mci_vd_escapeW = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_vd_escapeW)); + mci_vd_escapeW = malloc(sizeof(*mci_vd_escapeW)); - if (!mci_vd_escapeW) return -1; + if (!mci_vd_escapeW) return MCIERR_OUT_OF_MEMORY; @@ -134,7 +136,7 @@ index 2aa74fd4127..5b8463286e5 100644 case MCI_SETAUDIO: case MCI_SETVIDEO: if (!(dwParam1 & (MCI_DGV_SETVIDEO_QUALITY | MCI_DGV_SETVIDEO_ALG -@@ -506,7 +507,6 @@ static void MCI_UnmapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR dwParam2, +@@ -501,7 +502,6 @@ static void MCI_UnmapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR dwParam2, break; default: @@ -142,7 +144,7 @@ index 2aa74fd4127..5b8463286e5 100644 break; } } -@@ -2289,20 +2289,18 @@ DWORD WINAPI mciSendCommandW(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1, +@@ -2282,20 +2282,18 @@ DWORD WINAPI mciSendCommandW(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1, DWORD WINAPI mciSendCommandA(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { DWORD ret; @@ -169,5 +171,5 @@ index 2aa74fd4127..5b8463286e5 100644 } -- -2.34.1 +2.40.1 diff --git a/staging/upstream-commit b/staging/upstream-commit index 55a2b9d7..634d6b6c 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -1b987bfde68b75da3b718ba065826b01b5d6736e +f71315c8494575698634062cfad4f5d84fd230a1