msi: Implement MsiDatabaseImport [try2]

Alexandre Julliard julliard at winehq.org
Thu Sep 28 05:52:18 CDT 2006


"James Hawkins" <truiken at gmail.com> writes:

> +static LPWSTR msi_read_text_archive(LPCWSTR path)
>  {
> -    FIXME("%p %s %s\n", db, debugstr_w(folder), debugstr_w(file) );
> +    HANDLE file;
> +    LPSTR data = NULL;
> +    DWORD read, size = 0;
> +
> +    file = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
> +    if (file == INVALID_HANDLE_VALUE)
> +        return NULL;
> +
> +    size = GetFileSize( file, NULL );
> +    data = msi_alloc( size + 1 );
> +    if (!data)
> +        return NULL;
> +
> +    if (!ReadFile( file, data, size, &read, NULL ))
> +        return NULL;
> +
> +    data[size] = '\0';
> +    return strdupAtoW( data );
> +}

You're leaking both the file and the ascii string.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list