Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- 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 48bbd3ed48..a3e2650f50 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; }
/**************************************************************************
This could use a test, I think.
Andrew
On Fri, Aug 28, 2020 at 06:25:28PM +1000, Alistair Leslie-Hughes wrote:
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
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 48bbd3ed48..a3e2650f50 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.28.0