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=27324 Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d45e36f5f8
commit
5ee2ef5217
|
@ -48,6 +48,40 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmio);
|
|||
|
||||
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]
|
||||
*/
|
||||
|
@ -76,9 +110,14 @@ static LRESULT CALLBACK mmioDosIOProc(LPMMIOINFO lpmmioinfo, UINT uMessage,
|
|||
|
||||
/* if filename NULL, assume open file handle in adwInfo[0] */
|
||||
if (szFileName) {
|
||||
OFSTRUCT ofs;
|
||||
lpmmioinfo->adwInfo[0] = OpenFile(szFileName, &ofs, lpmmioinfo->dwFlags & 0xFFFF);
|
||||
}
|
||||
HANDLE file;
|
||||
|
||||
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)
|
||||
ret = MMIOERR_FILENOTFOUND;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue