[PATCH 2/4] winmm: Change path cutoff from MAX_PATH to 128 chars in mmioOpen(MMIO_PARSE|MMIO_EXIST).

Gijs Vermeulen gijsvrm at gmail.com
Mon Jan 18 14:45:32 CST 2021


Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
---
 dlls/winmm/mmio.c       | 4 ++--
 dlls/winmm/tests/mmio.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c
index 1d755ea82b8..3ad29a5fe92 100644
--- a/dlls/winmm/mmio.c
+++ b/dlls/winmm/mmio.c
@@ -643,7 +643,7 @@ static HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags,
     }
 
     if (dwOpenFlags & (MMIO_PARSE|MMIO_EXIST)) {
-	char	buffer[MAX_PATH];
+	char	buffer[128];
 
 	if (!szFileName)
 	    return (HMMIO)FALSE;
@@ -744,7 +744,7 @@ HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO* lpmmioinfo,
     if (szFileName)
     {
         INT     len = WideCharToMultiByte( CP_ACP, 0, szFileName, -1, NULL, 0, NULL, NULL );
-        if (len < MAX_PATH) len = MAX_PATH;
+        if (len < 128) len = 128;
         szFn = HeapAlloc( GetProcessHeap(), 0, len );
         if (!szFn) return NULL;
         WideCharToMultiByte( CP_ACP, 0, szFileName, -1, szFn, len, NULL, NULL );
diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c
index cfe917e8b38..5fe81e58d3d 100644
--- a/dlls/winmm/tests/mmio.c
+++ b/dlls/winmm/tests/mmio.c
@@ -534,7 +534,7 @@ static void test_mmioOpen_create(void)
     wcscpy(buffer, long_filename);
     info.wErrorRet = 0xdead;
     hmmio = mmioOpenW(buffer, &info, MMIO_PARSE);
-    todo_wine ok(hmmio == (HMMIO)FALSE, "failed to parse file name, error %#x\n", info.wErrorRet);
+    ok(hmmio == (HMMIO)FALSE, "failed to parse file name, error %#x\n", info.wErrorRet);
     todo_wine ok(info.wErrorRet == MMIOERR_OUTOFMEMORY, "got error %#x\n", info.wErrorRet);
     wcscpy(expect, temp_dir);
     wcscat(expect, long_filename);
@@ -544,10 +544,10 @@ static void test_mmioOpen_create(void)
     WideCharToMultiByte(CP_ACP, 0, long_filename, -1, bufferA, sizeof(bufferA), NULL, NULL);
     info.wErrorRet = 0xdead;
     hmmio = mmioOpenA(bufferA, &info, MMIO_PARSE);
-    todo_wine ok(hmmio == (HMMIO)FALSE, "failed to parse file name, error %#x\n", info.wErrorRet);
+    ok(hmmio == (HMMIO)FALSE, "failed to parse file name, error %#x\n", info.wErrorRet);
     todo_wine ok(info.wErrorRet == MMIOERR_OUTOFMEMORY, "got error %#x\n", info.wErrorRet);
     WideCharToMultiByte(CP_ACP, 0, long_filename, -1, expectA, sizeof(expectA), NULL, NULL);
-    todo_wine ok(!strcmp(bufferA, expectA), "expected %s, got %s\n", debugstr_a(expectA), debugstr_a(bufferA));
+    ok(!strcmp(bufferA, expectA), "expected %s, got %s\n", debugstr_a(expectA), debugstr_a(bufferA));
 
     wcscpy(buffer, L"test_mmio_path");
     hmmio = mmioOpenW(buffer, &info, MMIO_WRITE);
-- 
2.30.0




More information about the wine-devel mailing list