[PATCH 3/6] ws2_32: Read protocols from the etc/protocol file.
Zebediah Figura (she/her)
zfigura at codeweavers.com
Sat Aug 7 17:15:27 CDT 2021
On 8/5/21 3:49 AM, Alexandre Julliard wrote:
> Zebediah Figura <zfigura at codeweavers.com> writes:
>
>> + file = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
>> + if (file == INVALID_HANDLE_VALUE)
>> + {
>> + ERR( "failed to open %s, error %u\n", debugstr_w( path ), GetLastError() );
>> + return NULL;
>> + }
>> +
>> + size = GetFileSize( file, NULL );
>> +
>> + mapping = CreateFileMappingW( file, NULL, PAGE_READONLY, 0, size, NULL );
>> + CloseHandle( file );
>> + if (!mapping)
>> + {
>> + ERR( "failed to create mapping, error %u\n", GetLastError() );
>> + return NULL;
>> + }
>> +
>> + view = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, size );
>> + CloseHandle( mapping );
>> + if (!view)
>> + ERR( "failed to map file, error %u\n", GetLastError() );
>
> I'd suggest malloc+read instead of a file mapping, so that we don't
> waste 64K of address space to load a 400-byte file.
>
Sure; thanks for fixing that up :-)
More information about the wine-devel
mailing list