From 48be62052066fd376cc5284ef0539f0ff4d6ba76 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 3 Aug 2020 12:02:13 +1000 Subject: [PATCH] winmm: Pass a fullpath to CreateFileA --- dlls/winmm/mmio.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index 48bbd3ed48d..a3e2650f50a 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -52,6 +52,9 @@ static WINE_MMIO *MMIOList; static HANDLE create_file_OF( LPCSTR path, INT mode ) { DWORD access, sharing, creation; + HANDLE ret; + char *fullpath = NULL; + DWORD len; if (mode & OF_CREATE) { @@ -79,7 +82,20 @@ 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 ); + + len = SearchPathA( NULL, path, NULL, 0, fullpath, NULL ); + if (!len) + return CreateFileA( path, access, sharing, NULL, creation, FILE_ATTRIBUTE_NORMAL, 0 ); + + fullpath = HeapAlloc(GetProcessHeap(), 0, len); + if (!fullpath) + return INVALID_HANDLE_VALUE; + + SearchPathA( NULL, path, NULL, len, fullpath, NULL ); + ret = CreateFileA( fullpath, access, sharing, NULL, creation, FILE_ATTRIBUTE_NORMAL, 0 ); + + HeapFree(GetProcessHeap(), 0, fullpath); + return ret; } /************************************************************************** -- 2.27.0