Commit 1d043f4d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winmm: Search the default path when opening an existing file in create_file_OF().

Based on a patch by Alistair Leslie-Hughes. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49650Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 2df41126
......@@ -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 );
}
/**************************************************************************
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment