[PATCH 3/6] ws2_32: Read protocols from the etc/protocol file.
Alexandre Julliard
julliard at winehq.org
Thu Aug 5 03:49:42 CDT 2021
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.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list