Split out database functions, remove dependence on wine/unicode.h.

This commit is contained in:
Mike McCormack 2005-03-29 11:28:57 +00:00 committed by Alexandre Julliard
parent e732fc023d
commit 180f04059b
3 changed files with 435 additions and 306 deletions

View File

@ -11,6 +11,7 @@ C_SRCS = \
appsearch.c \
create.c \
custom.c \
database.c \
delete.c \
dialog.c \
distinct.c \

345
dlls/msi/database.c Normal file
View File

@ -0,0 +1,345 @@
/*
* Implementation of the Microsoft Installer (msi.dll)
*
* Copyright 2002,2003,2004,2005 Mike McCormack for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "wine/debug.h"
#include "msi.h"
#include "msiquery.h"
#include "msipriv.h"
#include "objidl.h"
#include "objbase.h"
#include "initguid.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
/*
* The MSVC headers define the MSIDBOPEN_* macros cast to LPCTSTR,
* which is a problem because LPCTSTR isn't defined when compiling wine.
* To work around this problem, we need to define LPCTSTR as LPCWSTR here,
* and make sure to only use it in W functions.
*/
#define LPCTSTR LPCWSTR
DEFINE_GUID( CLSID_MsiDatabase, 0x000c1084, 0x0000, 0x0000,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
/*
* .MSI file format
*
* An .msi file is a structured storage file.
* It contains a number of streams.
* A stream for each table in the database.
* Two streams for the string table in the database.
* Any binary data in a table is a reference to a stream.
*/
VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
{
MSIDATABASE *db = (MSIDATABASE *) arg;
DWORD r;
free_cached_tables( db );
r = IStorage_Release( db->storage );
if( r )
ERR("database reference count was not zero (%ld)\n", r);
}
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
{
IStorage *stg = NULL;
HRESULT r;
MSIDATABASE *db = NULL;
UINT ret = ERROR_FUNCTION_FAILED;
LPWSTR szMode;
STATSTG stat;
TRACE("%s %s\n",debugstr_w(szDBPath),debugstr_w(szPersist) );
if( !pdb )
return ERROR_INVALID_PARAMETER;
szMode = (LPWSTR) szPersist;
if( HIWORD( szPersist ) )
{
/* UINT len = lstrlenW( szPerist ) + 1; */
FIXME("don't support persist files yet\b");
return ERROR_INVALID_PARAMETER;
/* szMode = HeapAlloc( GetProcessHeap(), 0, len * sizeof (DWORD) ); */
}
else if( szPersist == MSIDBOPEN_READONLY )
{
r = StgOpenStorage( szDBPath, NULL,
STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
}
else if( szPersist == MSIDBOPEN_CREATE )
{
r = StgCreateDocfile( szDBPath,
STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg);
if( r == ERROR_SUCCESS )
{
IStorage_SetClass( stg, &CLSID_MsiDatabase );
r = init_string_table( stg );
}
}
else if( szPersist == MSIDBOPEN_TRANSACT )
{
r = StgOpenStorage( szDBPath, NULL,
STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
}
else
{
ERR("unknown flag %p\n",szPersist);
return ERROR_INVALID_PARAMETER;
}
if( FAILED( r ) )
{
FIXME("open failed r = %08lx!\n",r);
return ERROR_FUNCTION_FAILED;
}
r = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
if( FAILED( r ) )
{
FIXME("Failed to stat storage\n");
goto end;
}
if( memcmp( &stat.clsid, &CLSID_MsiDatabase, sizeof (GUID) ) )
{
ERR("storage GUID is not a MSI database GUID %s\n",
debugstr_guid(&stat.clsid) );
goto end;
}
db = alloc_msiobject( MSIHANDLETYPE_DATABASE, sizeof (MSIDATABASE),
MSI_CloseDatabase );
if( !db )
{
FIXME("Failed to allocate a handle\n");
goto end;
}
if( TRACE_ON( msi ) )
enum_stream_names( stg );
db->storage = stg;
db->mode = szMode;
ret = load_string_table( db );
if( ret != ERROR_SUCCESS )
goto end;
msiobj_addref( &db->hdr );
IStorage_AddRef( stg );
*pdb = db;
end:
if( db )
msiobj_release( &db->hdr );
if( stg )
IStorage_Release( stg );
return ret;
}
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
{
MSIDATABASE *db;
UINT ret;
TRACE("%s %s %p\n",debugstr_w(szDBPath),debugstr_w(szPersist), phDB);
ret = MSI_OpenDatabaseW( szDBPath, szPersist, &db );
if( ret == ERROR_SUCCESS )
{
*phDB = alloc_msihandle( &db->hdr );
msiobj_release( &db->hdr );
}
return ret;
}
UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
{
HRESULT r = ERROR_FUNCTION_FAILED;
LPWSTR szwDBPath = NULL, szwPersist = NULL;
TRACE("%s %s %p\n", debugstr_a(szDBPath), debugstr_a(szPersist), phDB);
if( szDBPath )
{
szwDBPath = strdupAtoW( szDBPath );
if( !szwDBPath )
goto end;
}
if( HIWORD(szPersist) )
{
szwPersist = strdupAtoW( szPersist );
if( !szwPersist )
goto end;
}
else
szwPersist = (LPWSTR) szPersist;
r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB );
end:
HeapFree( GetProcessHeap(), 0, szwPersist );
HeapFree( GetProcessHeap(), 0, szwDBPath );
return r;
}
UINT MSI_DatabaseImport( MSIDATABASE *db, LPCWSTR folder, LPCWSTR file )
{
FIXME("%p %s %s\n", db, debugstr_w(folder), debugstr_w(file) );
if( folder == NULL || file == NULL )
return ERROR_INVALID_PARAMETER;
return ERROR_CALL_NOT_IMPLEMENTED;
}
UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolder, LPCWSTR szFilename)
{
MSIDATABASE *db;
UINT r;
TRACE("%lx %s %s\n",handle,debugstr_w(szFolder), debugstr_w(szFilename));
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db )
return ERROR_INVALID_HANDLE;
r = MSI_DatabaseImport( db, szFolder, szFilename );
msiobj_release( &db->hdr );
return r;
}
UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle,
LPCSTR szFolder, LPCSTR szFilename )
{
LPWSTR path = NULL, file = NULL;
UINT r = ERROR_OUTOFMEMORY;
TRACE("%lx %s %s\n", handle, debugstr_a(szFolder), debugstr_a(szFilename));
if( szFolder )
{
path = strdupAtoW( szFolder );
if( !path )
goto end;
}
if( szFilename )
{
file = strdupAtoW( szFilename );
if( !file )
goto end;
}
r = MsiDatabaseImportW( handle, path, file );
end:
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, file );
return r;
}
UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
LPCWSTR folder, LPCWSTR file )
{
FIXME("%p %s %s %s\n", db, debugstr_w(table),
debugstr_w(folder), debugstr_w(file) );
if( folder == NULL || file == NULL )
return ERROR_INVALID_PARAMETER;
return ERROR_CALL_NOT_IMPLEMENTED;
}
UINT WINAPI MsiDatabaseExportW( MSIHANDLE handle, LPCWSTR szTable,
LPCWSTR szFolder, LPCWSTR szFilename )
{
MSIDATABASE *db;
UINT r;
TRACE("%lx %s %s %s\n", handle, debugstr_w(szTable),
debugstr_w(szFolder), debugstr_w(szFilename));
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db )
return ERROR_INVALID_HANDLE;
r = MSI_DatabaseExport( db, szTable, szFolder, szFilename );
msiobj_release( &db->hdr );
return r;
}
UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, LPCSTR szTable,
LPCSTR szFolder, LPCSTR szFilename )
{
LPWSTR path = NULL, file = NULL, table = NULL;
UINT r = ERROR_OUTOFMEMORY;
TRACE("%lx %s %s %s\n", handle, debugstr_a(szTable),
debugstr_a(szFolder), debugstr_a(szFilename));
if( szTable )
{
table = strdupAtoW( szTable );
if( !table )
goto end;
}
if( szFolder )
{
path = strdupAtoW( szFolder );
if( !path )
goto end;
}
if( szFilename )
{
file = strdupAtoW( szFilename );
if( !file )
goto end;
}
r = MsiDatabaseImportW( handle, path, file );
end:
HeapFree( GetProcessHeap(), 0, table );
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, file );
return r;
}

View File

@ -32,15 +32,10 @@
#include "msi.h"
#include "msiquery.h"
#include "msipriv.h"
#include "objidl.h"
#include "wincrypt.h"
#include "wine/unicode.h"
#include "objbase.h"
#include "winver.h"
#include "winuser.h"
#include "initguid.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
/*
@ -51,9 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
*/
#define LPCTSTR LPCWSTR
DEFINE_GUID( CLSID_MsiDatabase, 0x000c1084, 0x0000, 0x0000,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
/* the UI level */
INSTALLUILEVEL gUILevel = INSTALLUILEVEL_BASIC;
HWND gUIhwnd = 0;
@ -64,176 +56,9 @@ LPVOID gUIContext = NULL;
WCHAR gszLogFile[MAX_PATH];
HINSTANCE msi_hInstance;
/*
* .MSI file format
*
* A .msi file is a structured storage file.
* It should contain a number of streams.
*/
VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
{
MSIDATABASE *db = (MSIDATABASE *) arg;
DWORD r;
free_cached_tables( db );
r = IStorage_Release( db->storage );
if( r )
ERR("database reference count was not zero (%ld)\n", r);
}
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
{
IStorage *stg = NULL;
HRESULT r;
MSIDATABASE *db = NULL;
UINT ret = ERROR_FUNCTION_FAILED;
LPWSTR szMode;
STATSTG stat;
TRACE("%s %s\n",debugstr_w(szDBPath),debugstr_w(szPersist) );
if( !pdb )
return ERROR_INVALID_PARAMETER;
szMode = (LPWSTR) szPersist;
if( HIWORD( szPersist ) )
{
/* UINT len = lstrlenW( szPerist ) + 1; */
FIXME("don't support persist files yet\b");
return ERROR_INVALID_PARAMETER;
/* szMode = HeapAlloc( GetProcessHeap(), 0, len * sizeof (DWORD) ); */
}
else if( szPersist == MSIDBOPEN_READONLY )
{
r = StgOpenStorage( szDBPath, NULL,
STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
}
else if( szPersist == MSIDBOPEN_CREATE )
{
r = StgCreateDocfile( szDBPath,
STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg);
if( r == ERROR_SUCCESS )
{
IStorage_SetClass( stg, &CLSID_MsiDatabase );
r = init_string_table( stg );
}
}
else if( szPersist == MSIDBOPEN_TRANSACT )
{
r = StgOpenStorage( szDBPath, NULL,
STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
}
else
{
ERR("unknown flag %p\n",szPersist);
return ERROR_INVALID_PARAMETER;
}
if( FAILED( r ) )
{
FIXME("open failed r = %08lx!\n",r);
return ERROR_FUNCTION_FAILED;
}
r = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
if( FAILED( r ) )
{
FIXME("Failed to stat storage\n");
goto end;
}
if( memcmp( &stat.clsid, &CLSID_MsiDatabase, sizeof (GUID) ) )
{
ERR("storage GUID is not a MSI database GUID %s\n",
debugstr_guid(&stat.clsid) );
goto end;
}
db = alloc_msiobject( MSIHANDLETYPE_DATABASE, sizeof (MSIDATABASE),
MSI_CloseDatabase );
if( !db )
{
FIXME("Failed to allocate a handle\n");
goto end;
}
if( TRACE_ON( msi ) )
enum_stream_names( stg );
db->storage = stg;
db->mode = szMode;
ret = load_string_table( db );
if( ret != ERROR_SUCCESS )
goto end;
msiobj_addref( &db->hdr );
IStorage_AddRef( stg );
*pdb = db;
end:
if( db )
msiobj_release( &db->hdr );
if( stg )
IStorage_Release( stg );
return ret;
}
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
{
MSIDATABASE *db;
UINT ret;
TRACE("%s %s %p\n",debugstr_w(szDBPath),debugstr_w(szPersist), phDB);
ret = MSI_OpenDatabaseW( szDBPath, szPersist, &db );
if( ret == ERROR_SUCCESS )
{
*phDB = alloc_msihandle( &db->hdr );
msiobj_release( &db->hdr );
}
return ret;
}
UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
{
HRESULT r = ERROR_FUNCTION_FAILED;
LPWSTR szwDBPath = NULL, szwPersist = NULL;
TRACE("%s %s %p\n", debugstr_a(szDBPath), debugstr_a(szPersist), phDB);
if( szDBPath )
{
szwDBPath = strdupAtoW( szDBPath );
if( !szwDBPath )
goto end;
}
if( HIWORD(szPersist) )
{
szwPersist = strdupAtoW( szPersist );
if( !szwPersist )
goto end;
}
else
szwPersist = (LPWSTR) szPersist;
r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB );
end:
HeapFree( GetProcessHeap(), 0, szwPersist );
HeapFree( GetProcessHeap(), 0, szwDBPath );
return r;
}
UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
{
UINT ret;
UINT r;
LPWSTR szwProd = NULL;
TRACE("%s %p\n",debugstr_a(szProduct), phProduct);
@ -245,11 +70,11 @@ UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
return ERROR_OUTOFMEMORY;
}
ret = MsiOpenProductW( szwProd, phProduct );
r = MsiOpenProductW( szwProd, phProduct );
HeapFree( GetProcessHeap(), 0, szwProd );
return ret;
return r;
}
UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
@ -341,7 +166,7 @@ UINT WINAPI MsiAdvertiseProductExW( LPCWSTR szPackagePath, LPCWSTR szScriptfileP
UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
{
LPWSTR szwPath = NULL, szwCommand = NULL;
UINT r = ERROR_FUNCTION_FAILED; /* FIXME: check return code */
UINT r = ERROR_OUTOFMEMORY;
TRACE("%s %s\n",debugstr_a(szPackagePath), debugstr_a(szCommandLine));
@ -371,26 +196,26 @@ end:
UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
{
MSIPACKAGE *package = NULL;
UINT rc = ERROR_SUCCESS;
UINT r;
MSIHANDLE handle;
FIXME("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
rc = MsiVerifyPackageW(szPackagePath);
if (rc != ERROR_SUCCESS)
return rc;
r = MsiVerifyPackageW(szPackagePath);
if (r != ERROR_SUCCESS)
return r;
rc = MSI_OpenPackageW(szPackagePath,&package);
if (rc != ERROR_SUCCESS)
return rc;
r = MSI_OpenPackageW(szPackagePath,&package);
if (r != ERROR_SUCCESS)
return r;
handle = alloc_msihandle( &package->hdr );
rc = ACTION_DoTopLevelINSTALL(package, szPackagePath, szCommandLine);
r = ACTION_DoTopLevelINSTALL(package, szPackagePath, szCommandLine);
MsiCloseHandle(handle);
msiobj_release( &package->hdr );
return rc;
return r;
}
UINT WINAPI MsiReinstallProductA(LPCSTR szProduct, DWORD dwReinstallMode)
@ -488,12 +313,12 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
commandline = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR));
if (szCommandLine)
strcpyW(commandline,szCommandLine);
lstrcpyW(commandline,szCommandLine);
else
commandline[0] = 0;
if (MsiQueryProductStateW(szProduct) != INSTALLSTATE_UNKNOWN)
strcatW(commandline,szInstalled);
lstrcatW(commandline,szInstalled);
rc = ACTION_DoTopLevelINSTALL(package, sourcepath, commandline);
@ -511,7 +336,7 @@ UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
{
LPWSTR szwProduct = NULL;
LPWSTR szwCommandLine = NULL;
UINT hr = ERROR_FUNCTION_FAILED;
UINT r = ERROR_OUTOFMEMORY;
if( szProduct )
{
@ -527,36 +352,34 @@ UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
goto end;
}
hr = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
r = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
szwCommandLine );
end:
HeapFree( GetProcessHeap(), 0, szwProduct );
HeapFree( GetProcessHeap(), 0, szwCommandLine);
return hr;
return r;
}
UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
INSTALLSTATE eInstallState)
{
LPWSTR szwProduct = NULL;
UINT hr = ERROR_SUCCESS;
UINT r;
FIXME("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState);
TRACE("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState);
if( szProduct )
{
szwProduct = strdupAtoW( szProduct );
if( !szwProduct )
goto end;
return ERROR_OUTOFMEMORY;
}
hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
end:
r = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
HeapFree( GetProcessHeap(), 0, szwProduct );
return hr;
return r;
}
UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel,
@ -564,41 +387,38 @@ UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel,
{
FIXME("%s %d %d\n", debugstr_w(szProduct), iInstallLevel, eInstallState);
return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState,
NULL);
return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState, NULL);
}
UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
{
LPWSTR szwComponent = NULL;
UINT hr = ERROR_INSTALL_FAILURE;
UINT r;
WCHAR szwBuffer[GUID_SIZE];
FIXME("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer));
TRACE("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer));
if( szComponent )
{
szwComponent = strdupAtoW( szComponent );
if( !szwComponent )
goto end;
return ERROR_OUTOFMEMORY;
}
else
return ERROR_INVALID_PARAMETER;
hr = MsiGetProductCodeW( szwComponent, szwBuffer );
r = MsiGetProductCodeW( szwComponent, szwBuffer );
if( ERROR_SUCCESS == hr )
if( ERROR_SUCCESS == r )
WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL);
end:
HeapFree( GetProcessHeap(), 0, szwComponent );
return hr;
return r;
}
UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
{
FIXME("%s %s\n",debugstr_w(szComponent), debugstr_w(szBuffer));
FIXME("%s %p\n",debugstr_w(szComponent), szBuffer);
if (NULL == szComponent)
return ERROR_INVALID_PARAMETER;
return ERROR_CALL_NOT_IMPLEMENTED;
@ -608,7 +428,7 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
LPSTR szBuffer, DWORD *pcchValueBuf)
{
LPWSTR szwProduct = NULL, szwAttribute = NULL, szwBuffer = NULL;
UINT hr = ERROR_OUTOFMEMORY;
UINT r = ERROR_OUTOFMEMORY;
TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szAttribute),
szBuffer, pcchValueBuf);
@ -634,9 +454,9 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
goto end;
}
hr = MsiGetProductInfoW( szwProduct, szwAttribute, szwBuffer, pcchValueBuf );
r = MsiGetProductInfoW( szwProduct, szwAttribute, szwBuffer, pcchValueBuf );
if( ERROR_SUCCESS == hr )
if( ERROR_SUCCESS == r )
WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, *pcchValueBuf, NULL, NULL);
end:
@ -644,14 +464,14 @@ end:
HeapFree( GetProcessHeap(), 0, szwAttribute );
HeapFree( GetProcessHeap(), 0, szwBuffer );
return hr;
return r;
}
UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
LPWSTR szBuffer, DWORD *pcchValueBuf)
{
MSIHANDLE hProduct;
UINT hr;
UINT r;
FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szAttribute),
szBuffer, pcchValueBuf);
@ -661,49 +481,12 @@ UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
if (NULL == szProduct || NULL == szAttribute)
return ERROR_INVALID_PARAMETER;
hr = MsiOpenProductW(szProduct, &hProduct);
if (ERROR_SUCCESS != hr)
return hr;
r = MsiOpenProductW(szProduct, &hProduct);
if (ERROR_SUCCESS != r)
return r;
hr = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf);
r = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf);
MsiCloseHandle(hProduct);
return hr;
}
UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolderPath, LPCWSTR szFilename)
{
FIXME("%lx %s %s\n",handle,debugstr_w(szFolderPath), debugstr_w(szFilename));
return ERROR_CALL_NOT_IMPLEMENTED;
}
UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle,
LPCSTR szFolderPath, LPCSTR szFilename )
{
LPWSTR path = NULL, file = NULL;
UINT r = ERROR_OUTOFMEMORY;
TRACE("%lx %s %s\n", handle, debugstr_a(szFolderPath), debugstr_a(szFilename));
if( szFolderPath )
{
path = strdupAtoW( szFolderPath );
if( !path )
goto end;
}
if( szFilename )
{
file = strdupAtoW( szFilename );
if( !file )
goto end;
}
r = MsiDatabaseImportW( handle, path, file );
end:
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, file );
return r;
}
@ -1159,7 +942,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
if (path[0]=='0')
{
FIXME("Registry entry.. check entry\n");
rrc = INSTALLSTATE_LOCAL;
rrc = INSTALLSTATE_LOCAL;
}
else
{
@ -1174,7 +957,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
{
sz = sz / sizeof(WCHAR);
if( *pcchBuf >= sz )
strcpyW( lpPathBuf, path );
lstrcpyW( lpPathBuf, path );
*pcchBuf = sz;
}
@ -1312,7 +1095,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS));
lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf);
*pcchVersionBuf = strlenW(lpVersionBuf);
*pcchVersionBuf = lstrlenW(lpVersionBuf);
}
else
{
@ -1328,7 +1111,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
FIXME("Retrieve language from file\n");
wsprintfW(tmp, szLangFormat, lang);
lstrcpynW(lpLangBuf, tmp, *pcchLangBuf);
*pcchLangBuf = strlenW(lpLangBuf);
*pcchLangBuf = lstrlenW(lpLangBuf);
}
end: