Commit 5ee2ef52 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

winmm: Use CreateFileA instead of OpenFile.

OpenFile has a filepath limit of 128. Use CreateFile which doesn't have this limit. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48832 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27324Signed-off-by: 's avatarAlistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d45e36f5
...@@ -48,6 +48,40 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmio); ...@@ -48,6 +48,40 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmio);
static WINE_MMIO *MMIOList; static WINE_MMIO *MMIOList;
/* From kernel32 */
static HANDLE create_file_OF( LPCSTR path, INT mode )
{
DWORD access, sharing, creation;
if (mode & OF_CREATE)
{
creation = CREATE_ALWAYS;
access = GENERIC_READ | GENERIC_WRITE;
}
else
{
creation = OPEN_EXISTING;
switch(mode & 0x03)
{
case OF_READ: access = GENERIC_READ; break;
case OF_WRITE: access = GENERIC_WRITE; break;
case OF_READWRITE: access = GENERIC_READ | GENERIC_WRITE; break;
default: access = 0; break;
}
}
switch(mode & 0x70)
{
case OF_SHARE_EXCLUSIVE: sharing = 0; break;
case OF_SHARE_DENY_WRITE: sharing = FILE_SHARE_READ; break;
case OF_SHARE_DENY_READ: sharing = FILE_SHARE_WRITE; break;
case OF_SHARE_DENY_NONE:
case OF_SHARE_COMPAT:
default: sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; break;
}
return CreateFileA( path, access, sharing, NULL, creation, FILE_ATTRIBUTE_NORMAL, 0 );
}
/************************************************************************** /**************************************************************************
* mmioDosIOProc [internal] * mmioDosIOProc [internal]
*/ */
...@@ -76,9 +110,14 @@ static LRESULT CALLBACK mmioDosIOProc(LPMMIOINFO lpmmioinfo, UINT uMessage, ...@@ -76,9 +110,14 @@ static LRESULT CALLBACK mmioDosIOProc(LPMMIOINFO lpmmioinfo, UINT uMessage,
/* if filename NULL, assume open file handle in adwInfo[0] */ /* if filename NULL, assume open file handle in adwInfo[0] */
if (szFileName) { if (szFileName) {
OFSTRUCT ofs; HANDLE file;
lpmmioinfo->adwInfo[0] = OpenFile(szFileName, &ofs, lpmmioinfo->dwFlags & 0xFFFF);
} file = create_file_OF( szFileName, lpmmioinfo->dwFlags );
if (file != INVALID_HANDLE_VALUE)
lpmmioinfo->adwInfo[0] = HandleToLong(file);
else
lpmmioinfo->adwInfo[0] = HFILE_ERROR;
}
if (lpmmioinfo->adwInfo[0] == HFILE_ERROR) if (lpmmioinfo->adwInfo[0] == HFILE_ERROR)
ret = MMIOERR_FILENOTFOUND; ret = MMIOERR_FILENOTFOUND;
} }
......
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