[PATCH 3/4] winmm: Set error when mmioOpen(MMIO_PARSE|MMIO_EXIST) is called with too long path.
Gijs Vermeulen
gijsvrm at gmail.com
Mon Jan 18 14:45:33 CST 2021
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
---
dlls/winmm/mmio.c | 3 +++
dlls/winmm/tests/mmio.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c
index 3ad29a5fe92..7882dc1c2f9 100644
--- a/dlls/winmm/mmio.c
+++ b/dlls/winmm/mmio.c
@@ -648,7 +648,10 @@ static HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags,
if (!szFileName)
return (HMMIO)FALSE;
if (GetFullPathNameA(szFileName, sizeof(buffer), buffer, NULL) >= sizeof(buffer))
+ {
+ refmminfo->wErrorRet = MMIOERR_OUTOFMEMORY;
return (HMMIO)FALSE;
+ }
if ((dwOpenFlags & MMIO_EXIST) && (GetFileAttributesA(buffer) == INVALID_FILE_ATTRIBUTES))
{
refmminfo->wErrorRet = MMIOERR_FILENOTFOUND;
diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c
index 5fe81e58d3d..ae9d4b6aeeb 100644
--- a/dlls/winmm/tests/mmio.c
+++ b/dlls/winmm/tests/mmio.c
@@ -535,7 +535,7 @@ static void test_mmioOpen_create(void)
info.wErrorRet = 0xdead;
hmmio = mmioOpenW(buffer, &info, MMIO_PARSE);
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);
+ ok(info.wErrorRet == MMIOERR_OUTOFMEMORY, "got error %#x\n", info.wErrorRet);
wcscpy(expect, temp_dir);
wcscat(expect, long_filename);
expect[127] = 0;
@@ -545,7 +545,7 @@ static void test_mmioOpen_create(void)
info.wErrorRet = 0xdead;
hmmio = mmioOpenA(bufferA, &info, MMIO_PARSE);
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);
+ ok(info.wErrorRet == MMIOERR_OUTOFMEMORY, "got error %#x\n", info.wErrorRet);
WideCharToMultiByte(CP_ACP, 0, long_filename, -1, expectA, sizeof(expectA), NULL, NULL);
ok(!strcmp(bufferA, expectA), "expected %s, got %s\n", debugstr_a(expectA), debugstr_a(bufferA));
--
2.30.0
More information about the wine-devel
mailing list