Module: wine Branch: master Commit: 2df4112661216c0a5a9b7c828f538aee95e4e212 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2df4112661216c0a5a9b7c828...
Author: Zebediah Figura z.figura12@gmail.com Date: Thu Dec 17 16:40:50 2020 -0600
winmm/tests: Add some tests for MMIO_PARSE with long file names.
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Andrew Eikum aeikum@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winmm/tests/mmio.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c index 0236855f246..c9ceda24f3f 100644 --- a/dlls/winmm/tests/mmio.c +++ b/dlls/winmm/tests/mmio.c @@ -483,7 +483,7 @@ static void test_mmioOpen_create(void) L"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" L"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; WCHAR buffer[MAX_PATH], expect[MAX_PATH]; - char exedir_filename[MAX_PATH]; + char exedir_filename[MAX_PATH], bufferA[MAX_PATH], expectA[MAX_PATH]; MMIOINFO info = {0}; BOOL ret; FILE *f; @@ -531,6 +531,24 @@ static void test_mmioOpen_create(void)
DeleteFileW(long_filename);
+ 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); + todo_wine ok(info.wErrorRet == MMIOERR_OUTOFMEMORY, "got error %#x\n", info.wErrorRet); + wcscpy(expect, temp_dir); + wcscat(expect, long_filename); + expect[127] = 0; + todo_wine ok(!wcscmp(buffer, expect), "expected %s, got %s\n", debugstr_w(expect), debugstr_w(buffer)); + + 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); + 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)); + wcscpy(buffer, L"test_mmio_path"); hmmio = mmioOpenW(buffer, &info, MMIO_WRITE); todo_wine ok(!!hmmio, "failed to open file, error %#x\n", info.wErrorRet);