[PATCH v2] winmm: Use _lopen instead of OpenFile.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Mon Mar 30 15:51:55 CDT 2020


Hi Andrew,

On 30/3/20 11:28 pm, Andrew Eikum wrote:
> On Mon, Mar 30, 2020 at 08:54:30AM +1100, Alistair Leslie-Hughes wrote:
>> diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c
>> index 6f14301975..800a86894f 100644
>> --- a/dlls/winmm/mmio.c
>> +++ b/dlls/winmm/mmio.c
>> @@ -76,8 +76,10 @@ 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);
>> +                if (lpmmioinfo->dwFlags & OF_CREATE)
>> +                    lpmmioinfo->adwInfo[0] = _lcreat(szFileName, lpmmioinfo->dwFlags);
>> +                else
>> +                    lpmmioinfo->adwInfo[0] = _lopen(szFileName, lpmmioinfo->dwFlags);
>>               }
>>   	    if (lpmmioinfo->adwInfo[0] == HFILE_ERROR)
>>   		ret = MMIOERR_FILENOTFOUND;
> 
> I think _lcreat doesn't take OF_ flags.
I've double checked and the parameter should be 0.

> 
> I'm not sure what the best fix here is. Copying create_file_OF from
> kernel32 and using CreateFile in all cases is the best solution I can
> come up with, but it's not great.
I started out doing this, then a found _lopen and this would stop 
duplicating the code from kernel32.

> 
> Also, is this something we can add a test for?
We should be able to, its just a large path.


Alistair.



More information about the wine-devel mailing list