diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index cb3175c5cd7..1255cf69da2 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -52,6 +52,7 @@ static WINE_MMIO *MMIOList; static HANDLE create_file_OF( LPCSTR path, INT mode ) { DWORD access, sharing, creation; + char full_path[MAX_PATH]; if (mode & OF_CREATE) { @@ -79,7 +80,13 @@ static HANDLE create_file_OF( LPCSTR path, INT mode ) case OF_SHARE_COMPAT: default: sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; break; } - return CreateFileA( path, access, sharing, NULL, creation, FILE_ATTRIBUTE_NORMAL, 0 ); + + if (mode & OF_CREATE) + return CreateFileA( path, access, sharing, NULL, creation, FILE_ATTRIBUTE_NORMAL, 0 ); + + if (!SearchPathA( NULL, path, NULL, MAX_PATH, full_path, NULL )) + return INVALID_HANDLE_VALUE; + return CreateFileA( full_path, access, sharing, NULL, creation, FILE_ATTRIBUTE_NORMAL, 0 ); } /************************************************************************** diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c index c9ceda24f3f..a232070064c 100644 --- a/dlls/winmm/tests/mmio.c +++ b/dlls/winmm/tests/mmio.c @@ -551,7 +551,7 @@ static void test_mmioOpen_create(void) 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); + ok(!!hmmio, "failed to open file, error %#x\n", info.wErrorRet); mmioClose(hmmio, 0); wcscpy(buffer, L"test_mmio_path");