2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2002,2003,2004,2005 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #define NONAMELESSUNION
31 #include "wine/debug.h"
37 #include "wine/unicode.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(msi);
47 * The MSVC headers define the MSIDBOPEN_* macros cast to LPCTSTR,
48 * which is a problem because LPCTSTR isn't defined when compiling wine.
49 * To work around this problem, we need to define LPCTSTR as LPCWSTR here,
50 * and make sure to only use it in W functions.
52 #define LPCTSTR LPCWSTR
54 DEFINE_GUID( CLSID_MsiDatabase, 0x000c1084, 0x0000, 0x0000,
55 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
58 INSTALLUILEVEL gUILevel = INSTALLUILEVEL_BASIC;
60 INSTALLUI_HANDLERA gUIHandlerA = NULL;
61 INSTALLUI_HANDLERW gUIHandlerW = NULL;
63 LPVOID gUIContext = NULL;
64 WCHAR gszLogFile[MAX_PATH];
65 HINSTANCE msi_hInstance;
70 * A .msi file is a structured storage file.
71 * It should contain a number of streams.
74 VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
76 MSIDATABASE *db = (MSIDATABASE *) arg;
79 free_cached_tables( db );
80 r = IStorage_Release( db->storage );
82 ERR("database reference count was not zero (%ld)\n", r);
85 UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
89 MSIDATABASE *db = NULL;
90 UINT ret = ERROR_FUNCTION_FAILED;
94 TRACE("%s %s\n",debugstr_w(szDBPath),debugstr_w(szPersist) );
97 return ERROR_INVALID_PARAMETER;
99 szMode = (LPWSTR) szPersist;
100 if( HIWORD( szPersist ) )
102 /* UINT len = lstrlenW( szPerist ) + 1; */
103 FIXME("don't support persist files yet\b");
104 return ERROR_INVALID_PARAMETER;
105 /* szMode = HeapAlloc( GetProcessHeap(), 0, len * sizeof (DWORD) ); */
107 else if( szPersist == MSIDBOPEN_READONLY )
109 r = StgOpenStorage( szDBPath, NULL,
110 STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
112 else if( szPersist == MSIDBOPEN_CREATE )
114 r = StgCreateDocfile( szDBPath,
115 STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg);
116 if( r == ERROR_SUCCESS )
118 IStorage_SetClass( stg, &CLSID_MsiDatabase );
119 r = init_string_table( stg );
122 else if( szPersist == MSIDBOPEN_TRANSACT )
124 r = StgOpenStorage( szDBPath, NULL,
125 STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
129 ERR("unknown flag %p\n",szPersist);
130 return ERROR_INVALID_PARAMETER;
135 FIXME("open failed r = %08lx!\n",r);
136 return ERROR_FUNCTION_FAILED;
139 r = IStorage_Stat( stg, &stat, STATFLAG_NONAME );
142 FIXME("Failed to stat storage\n");
146 if( memcmp( &stat.clsid, &CLSID_MsiDatabase, sizeof (GUID) ) )
148 ERR("storage GUID is not a MSI database GUID %s\n",
149 debugstr_guid(&stat.clsid) );
154 db = alloc_msiobject( MSIHANDLETYPE_DATABASE, sizeof (MSIDATABASE),
158 FIXME("Failed to allocate a handle\n");
162 if( TRACE_ON( msi ) )
163 enum_stream_names( stg );
168 ret = load_string_table( db );
169 if( ret != ERROR_SUCCESS )
172 msiobj_addref( &db->hdr );
173 IStorage_AddRef( stg );
178 msiobj_release( &db->hdr );
180 IStorage_Release( stg );
185 UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
190 TRACE("%s %s %p\n",debugstr_w(szDBPath),debugstr_w(szPersist), phDB);
192 ret = MSI_OpenDatabaseW( szDBPath, szPersist, &db );
193 if( ret == ERROR_SUCCESS )
195 *phDB = alloc_msihandle( &db->hdr );
196 msiobj_release( &db->hdr );
202 UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
204 HRESULT r = ERROR_FUNCTION_FAILED;
205 LPWSTR szwDBPath = NULL, szwPersist = NULL;
208 TRACE("%s %s %p\n", debugstr_a(szDBPath), debugstr_a(szPersist), phDB);
212 len = MultiByteToWideChar( CP_ACP, 0, szDBPath, -1, NULL, 0 );
213 szwDBPath = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
216 MultiByteToWideChar( CP_ACP, 0, szDBPath, -1, szwDBPath, len );
219 if( HIWORD(szPersist) )
221 len = MultiByteToWideChar( CP_ACP, 0, szPersist, -1, NULL, 0 );
222 szwPersist = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
225 MultiByteToWideChar( CP_ACP, 0, szPersist, -1, szwPersist, len );
228 szwPersist = (LPWSTR) szPersist;
230 r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB );
233 HeapFree( GetProcessHeap(), 0, szwPersist );
234 HeapFree( GetProcessHeap(), 0, szwDBPath );
239 UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
242 LPWSTR szwProd = NULL;
244 TRACE("%s %p\n",debugstr_a(szProduct), phProduct);
248 len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
249 szwProd = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) );
251 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProd, len );
254 ret = MsiOpenProductW( szwProd, phProduct );
256 HeapFree( GetProcessHeap(), 0, szwProd );
261 UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
263 static const WCHAR szLocalPackage[] = {
264 'L','o','c','a','l','P','a','c','k','a','g','e', 0
268 HKEY hKeyProduct = NULL;
271 TRACE("%s %p\n",debugstr_w(szProduct), phProduct);
273 r = MSIREG_OpenUninstallKey(szProduct,&hKeyProduct,FALSE);
274 if( r != ERROR_SUCCESS )
276 r = ERROR_UNKNOWN_PRODUCT;
280 /* find the size of the path */
282 r = RegQueryValueExW( hKeyProduct, szLocalPackage,
283 NULL, &type, NULL, &count );
284 if( r != ERROR_SUCCESS )
286 r = ERROR_UNKNOWN_PRODUCT;
290 /* now alloc and fetch the path of the database to open */
291 path = HeapAlloc( GetProcessHeap(), 0, count );
295 r = RegQueryValueExW( hKeyProduct, szLocalPackage,
296 NULL, &type, (LPBYTE) path, &count );
297 if( r != ERROR_SUCCESS )
299 r = ERROR_UNKNOWN_PRODUCT;
303 r = MsiOpenPackageW( path, phProduct );
306 HeapFree( GetProcessHeap(), 0, path );
308 RegCloseKey( hKeyProduct );
313 UINT WINAPI MsiAdvertiseProductA(LPCSTR szPackagePath, LPCSTR szScriptfilePath,
314 LPCSTR szTransforms, LANGID lgidLanguage)
316 FIXME("%s %s %s %08x\n",debugstr_a(szPackagePath),
317 debugstr_a(szScriptfilePath), debugstr_a(szTransforms), lgidLanguage);
318 return ERROR_CALL_NOT_IMPLEMENTED;
321 UINT WINAPI MsiAdvertiseProductW(LPCWSTR szPackagePath, LPCWSTR szScriptfilePath,
322 LPCWSTR szTransforms, LANGID lgidLanguage)
324 FIXME("%s %s %s %08x\n",debugstr_w(szPackagePath),
325 debugstr_w(szScriptfilePath), debugstr_w(szTransforms), lgidLanguage);
326 return ERROR_CALL_NOT_IMPLEMENTED;
329 UINT WINAPI MsiAdvertiseProductExA(LPCSTR szPackagePath, LPCSTR szScriptfilePath,
330 LPCSTR szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
332 FIXME("%s %s %s %08x %08lx %08lx\n", debugstr_a(szPackagePath),
333 debugstr_a(szScriptfilePath), debugstr_a(szTransforms),
334 lgidLanguage, dwPlatform, dwOptions);
335 return ERROR_CALL_NOT_IMPLEMENTED;
338 UINT WINAPI MsiAdvertiseProductExW( LPCWSTR szPackagePath, LPCWSTR szScriptfilePath,
339 LPCWSTR szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
341 FIXME("%s %s %s %08x %08lx %08lx\n", debugstr_w(szPackagePath),
342 debugstr_w(szScriptfilePath), debugstr_w(szTransforms),
343 lgidLanguage, dwPlatform, dwOptions);
344 return ERROR_CALL_NOT_IMPLEMENTED;
347 UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
349 LPWSTR szwPath = NULL, szwCommand = NULL;
350 UINT r = ERROR_FUNCTION_FAILED; /* FIXME: check return code */
352 TRACE("%s %s\n",debugstr_a(szPackagePath), debugstr_a(szCommandLine));
356 UINT len = MultiByteToWideChar( CP_ACP, 0, szPackagePath, -1, NULL, 0 );
357 szwPath = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
360 MultiByteToWideChar( CP_ACP, 0, szPackagePath, -1, szwPath, len );
365 UINT len = MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, NULL, 0 );
366 szwCommand = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
369 MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, szwCommand, len );
372 r = MsiInstallProductW( szwPath, szwCommand );
375 HeapFree( GetProcessHeap(), 0, szwPath );
376 HeapFree( GetProcessHeap(), 0, szwCommand );
381 UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
383 MSIPACKAGE *package = NULL;
384 UINT rc = ERROR_SUCCESS;
387 FIXME("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
389 rc = MsiVerifyPackageW(szPackagePath);
390 if (rc != ERROR_SUCCESS)
393 rc = MSI_OpenPackageW(szPackagePath,&package);
394 if (rc != ERROR_SUCCESS)
397 handle = alloc_msihandle( &package->hdr );
399 rc = ACTION_DoTopLevelINSTALL(package, szPackagePath, szCommandLine);
401 MsiCloseHandle(handle);
402 msiobj_release( &package->hdr );
406 UINT WINAPI MsiReinstallProductA(LPCSTR szProduct, DWORD dwReinstallMode)
408 FIXME("%s %08lx\n", debugstr_a(szProduct), dwReinstallMode);
409 return ERROR_CALL_NOT_IMPLEMENTED;
412 UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode)
414 FIXME("%s %08lx\n", debugstr_w(szProduct), dwReinstallMode);
415 return ERROR_CALL_NOT_IMPLEMENTED;
418 UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage,
419 INSTALLTYPE eInstallType, LPCSTR szCommandLine)
421 FIXME("%s %s %d %s\n", debugstr_a(szPatchPackage), debugstr_a(szInstallPackage),
422 eInstallType, debugstr_a(szCommandLine));
423 return ERROR_CALL_NOT_IMPLEMENTED;
426 UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage,
427 INSTALLTYPE eInstallType, LPCWSTR szCommandLine)
429 FIXME("%s %s %d %s\n", debugstr_w(szPatchPackage), debugstr_w(szInstallPackage),
430 eInstallType, debugstr_w(szCommandLine));
431 return ERROR_CALL_NOT_IMPLEMENTED;
434 UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
435 INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
442 static const WCHAR szSouceList[] = {
443 'S','o','u','r','c','e','L','i','s','t',0};
444 static const WCHAR szLUS[] = {
445 'L','a','s','t','U','s','e','d','S','o','u','r','c','e',0};
446 WCHAR sourcepath[0x200];
447 static const WCHAR szInstalled[] = {
448 ' ','I','n','s','t','a','l','l','e','d','=','1',0};
451 FIXME("%s %d %d %s\n",debugstr_w(szProduct), iInstallLevel, eInstallState,
452 debugstr_w(szCommandLine));
454 if (eInstallState != INSTALLSTATE_LOCAL &&
455 eInstallState != INSTALLSTATE_DEFAULT)
457 FIXME("Not implemented for anything other than local installs\n");
458 return ERROR_CALL_NOT_IMPLEMENTED;
461 rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
462 if (rc != ERROR_SUCCESS)
465 rc = RegOpenKeyW(hkey,szSouceList,&hkey1);
466 if (rc != ERROR_SUCCESS)
469 sz = sizeof(sourcepath);
470 rc = RegQueryValueExW(hkey1, szLUS, NULL, NULL,(LPBYTE)sourcepath, &sz);
471 if (rc != ERROR_SUCCESS)
476 * ok 1, we need to find the msi file for this product.
477 * 2, find the source dir for the files
478 * 3, do the configure/install.
479 * 4, cleanupany runonce entry.
482 rc = MsiOpenProductW(szProduct,&handle);
483 if (rc != ERROR_SUCCESS)
486 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
488 sz = strlenW(szInstalled);
491 sz += strlenW(szCommandLine);
493 commandline = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR));
496 strcpyW(commandline,szCommandLine);
500 if (MsiQueryProductStateW(szProduct) != INSTALLSTATE_UNKNOWN)
501 strcatW(commandline,szInstalled);
503 rc = ACTION_DoTopLevelINSTALL(package, sourcepath, commandline);
505 msiobj_release( &package->hdr );
507 HeapFree(GetProcessHeap(),0,commandline);
514 UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
515 INSTALLSTATE eInstallState, LPCSTR szCommandLine)
517 LPWSTR szwProduct = NULL;
518 LPWSTR szwCommandLine = NULL;
519 UINT hr = ERROR_FUNCTION_FAILED;
523 UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
524 szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
527 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
532 UINT len = MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, NULL, 0 );
533 szwCommandLine= HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
536 MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, szwCommandLine, len );
539 hr = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
542 HeapFree( GetProcessHeap(), 0, szwProduct );
543 HeapFree( GetProcessHeap(), 0, szwCommandLine);
548 UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
549 INSTALLSTATE eInstallState)
551 LPWSTR szwProduct = NULL;
552 UINT hr = ERROR_SUCCESS;
554 FIXME("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState);
558 UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
559 szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
562 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
565 hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
568 HeapFree( GetProcessHeap(), 0, szwProduct );
573 UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel,
574 INSTALLSTATE eInstallState)
576 FIXME("%s %d %d\n", debugstr_w(szProduct), iInstallLevel, eInstallState);
578 return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState,
582 UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
584 LPWSTR szwComponent = NULL;
585 UINT hr = ERROR_INSTALL_FAILURE;
586 WCHAR szwBuffer[GUID_SIZE];
588 FIXME("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer));
592 UINT len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 );
593 szwComponent = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
596 MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len );
599 return ERROR_INVALID_PARAMETER;
601 hr = MsiGetProductCodeW( szwComponent, szwBuffer );
603 if( ERROR_SUCCESS == hr )
604 WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL);
607 HeapFree( GetProcessHeap(), 0, szwComponent );
612 UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
614 FIXME("%s %s\n",debugstr_w(szComponent), debugstr_w(szBuffer));
615 if (NULL == szComponent)
616 return ERROR_INVALID_PARAMETER;
617 return ERROR_CALL_NOT_IMPLEMENTED;
620 UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
621 LPSTR szBuffer, DWORD *pcchValueBuf)
623 LPWSTR szwProduct = NULL, szwAttribute = NULL, szwBuffer = NULL;
624 UINT hr = ERROR_INSTALL_FAILURE;
626 FIXME("%s %s %p %p\n",debugstr_a(szProduct), debugstr_a(szAttribute),
627 szBuffer, pcchValueBuf);
629 if( NULL != szBuffer && NULL == pcchValueBuf )
630 return ERROR_INVALID_PARAMETER;
633 UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
634 szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
637 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
640 return ERROR_INVALID_PARAMETER;
644 UINT len = MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, NULL, 0 );
645 szwAttribute = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
648 MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, szwAttribute, len );
652 hr = ERROR_INVALID_PARAMETER;
658 szwBuffer = HeapAlloc( GetProcessHeap(), 0, (*pcchValueBuf) * sizeof(WCHAR) );
663 hr = MsiGetProductInfoW( szwProduct, szwAttribute, szwBuffer, pcchValueBuf );
665 if( ERROR_SUCCESS == hr )
666 WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, *pcchValueBuf, NULL, NULL);
669 HeapFree( GetProcessHeap(), 0, szwProduct );
670 HeapFree( GetProcessHeap(), 0, szwAttribute );
671 HeapFree( GetProcessHeap(), 0, szwBuffer );
676 UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
677 LPWSTR szBuffer, DWORD *pcchValueBuf)
682 FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szAttribute),
683 szBuffer, pcchValueBuf);
685 if (NULL != szBuffer && NULL == pcchValueBuf)
686 return ERROR_INVALID_PARAMETER;
687 if (NULL == szProduct || NULL == szAttribute)
688 return ERROR_INVALID_PARAMETER;
690 hr = MsiOpenProductW(szProduct, &hProduct);
691 if (ERROR_SUCCESS != hr)
694 hr = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf);
695 MsiCloseHandle(hProduct);
699 UINT WINAPI MsiDatabaseImportA(LPCSTR szFolderPath, LPCSTR szFilename)
701 FIXME("%s %s\n",debugstr_a(szFolderPath), debugstr_a(szFilename));
702 return ERROR_CALL_NOT_IMPLEMENTED;
705 UINT WINAPI MsiDatabaseImportW(LPCWSTR szFolderPath, LPCWSTR szFilename)
707 FIXME("%s %s\n",debugstr_w(szFolderPath), debugstr_w(szFilename));
708 return ERROR_CALL_NOT_IMPLEMENTED;
711 UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
713 LPWSTR szwLogFile = NULL;
714 UINT hr = ERROR_INSTALL_FAILURE;
716 FIXME("%08lx %s %08lx\n", dwLogMode, debugstr_a(szLogFile), attributes);
720 UINT len = MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, NULL, 0 );
721 szwLogFile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
724 MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, szwLogFile, len );
727 return ERROR_INVALID_PARAMETER;
729 hr = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
732 HeapFree( GetProcessHeap(), 0, szwLogFile );
737 UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes)
739 HANDLE file = INVALID_HANDLE_VALUE;
741 TRACE("%08lx %s %08lx\n", dwLogMode, debugstr_w(szLogFile), attributes);
743 strcpyW(gszLogFile,szLogFile);
744 if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
745 DeleteFileW(szLogFile);
746 file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
747 FILE_ATTRIBUTE_NORMAL, NULL);
748 if (file != INVALID_HANDLE_VALUE)
751 ERR("Unable to enable log %s\n",debugstr_w(szLogFile));
753 return ERROR_SUCCESS;
756 INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
762 len = MultiByteToWideChar(CP_ACP,0,szProduct,-1,NULL,0);
763 szwProduct = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
764 MultiByteToWideChar(CP_ACP,0,szProduct,-1,szwProduct,len);
765 rc = MsiQueryProductStateW(szwProduct);
766 HeapFree(GetProcessHeap(),0,szwProduct);
770 INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
773 INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
775 static const WCHAR szWindowsInstaller[] = {
776 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 };
779 TRACE("%s\n", debugstr_w(szProduct));
781 rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
782 if (rc != ERROR_SUCCESS)
787 rc = MSIREG_OpenUninstallKey(szProduct,&hkey,FALSE);
788 if (rc != ERROR_SUCCESS)
792 rc = RegQueryValueExW(hkey,szWindowsInstaller,NULL,NULL,(LPVOID)&rrc, &sz);
793 if (rc != ERROR_SUCCESS)
800 rrc = INSTALLSTATE_DEFAULT;
803 FIXME("Unknown install state read from registry (%i)\n",rrc);
804 rrc = INSTALLSTATE_UNKNOWN;
812 INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
814 INSTALLUILEVEL old = gUILevel;
815 HWND oldwnd = gUIhwnd;
817 TRACE("%08x %p\n", dwUILevel, phWnd);
819 gUILevel = dwUILevel;
828 INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler,
829 DWORD dwMessageFilter, LPVOID pvContext)
831 INSTALLUI_HANDLERA prev = gUIHandlerA;
833 TRACE("%p %lx %p\n",puiHandler, dwMessageFilter,pvContext);
834 gUIHandlerA = puiHandler;
835 gUIFilter = dwMessageFilter;
836 gUIContext = pvContext;
841 INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW(INSTALLUI_HANDLERW puiHandler,
842 DWORD dwMessageFilter, LPVOID pvContext)
844 INSTALLUI_HANDLERW prev = gUIHandlerW;
846 TRACE("%p %lx %p\n",puiHandler,dwMessageFilter,pvContext);
847 gUIHandlerW = puiHandler;
848 gUIFilter = dwMessageFilter;
849 gUIContext = pvContext;
854 /******************************************************************
855 * MsiLoadStringW [MSI.@]
857 * Loads a string from MSI's string resources.
861 * handle [I] only -1 is handled currently
862 * id [I] id of the string to be loaded
863 * lpBuffer [O] buffer for the string to be written to
864 * nBufferMax [I] maximum size of the buffer in characters
865 * lang [I] the preferred language for the string
869 * If successful, this function returns the language id of the string loaded
870 * If the function fails, the function returns zero.
874 * The type of the first parameter is unknown. LoadString's prototype
875 * suggests that it might be a module handle. I have made it an MSI handle
876 * for starters, as -1 is an invalid MSI handle, but not an invalid module
877 * handle. Maybe strings can be stored in an MSI database somehow.
879 LANGID WINAPI MsiLoadStringW( MSIHANDLE handle, UINT id, LPWSTR lpBuffer,
880 int nBufferMax, LANGID lang )
887 TRACE("%ld %u %p %d %d\n", handle, id, lpBuffer, nBufferMax, lang);
890 FIXME("don't know how to deal with handle = %08lx\n", handle);
893 lang = GetUserDefaultLangID();
895 hres = FindResourceExW( msi_hInstance, (LPCWSTR) RT_STRING,
899 hResData = LoadResource( msi_hInstance, hres );
902 p = LockResource( hResData );
906 for (i = 0; i < (id&0xf); i++)
910 if( nBufferMax <= len )
913 memcpy( lpBuffer, p+1, len * sizeof(WCHAR));
916 TRACE("found -> %s\n", debugstr_w(lpBuffer));
921 LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
922 int nBufferMax, LANGID lang )
928 bufW = HeapAlloc(GetProcessHeap(), 0, nBufferMax*sizeof(WCHAR));
929 r = MsiLoadStringW(handle, id, bufW, nBufferMax, lang);
932 len = WideCharToMultiByte(CP_ACP, 0, bufW, -1, NULL, 0, NULL, NULL );
933 if( len <= nBufferMax )
934 WideCharToMultiByte( CP_ACP, 0, bufW, -1,
935 lpBuffer, nBufferMax, NULL, NULL );
939 HeapFree(GetProcessHeap(), 0, bufW);
943 INSTALLSTATE WINAPI MsiLocateComponentA(LPCSTR szComponent, LPSTR lpPathBuf,
946 FIXME("%s %p %08lx\n", debugstr_a(szComponent), lpPathBuf, *pcchBuf);
947 return INSTALLSTATE_UNKNOWN;
950 INSTALLSTATE WINAPI MsiLocateComponentW(LPCWSTR szComponent, LPSTR lpPathBuf,
953 FIXME("%s %p %08lx\n", debugstr_w(szComponent), lpPathBuf, *pcchBuf);
954 return INSTALLSTATE_UNKNOWN;
957 UINT WINAPI MsiMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,
958 WORD wLanguageId, DWORD f)
960 FIXME("%p %s %s %u %08x %08lx\n",hWnd,debugstr_a(lpText),debugstr_a(lpCaption),
961 uType,wLanguageId,f);
962 return ERROR_CALL_NOT_IMPLEMENTED;
965 UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,
966 WORD wLanguageId, DWORD f)
968 FIXME("%p %s %s %u %08x %08lx\n",hWnd,debugstr_w(lpText),debugstr_w(lpCaption),
969 uType,wLanguageId,f);
970 return ERROR_CALL_NOT_IMPLEMENTED;
973 UINT WINAPI MsiProvideAssemblyA( LPCSTR szAssemblyName, LPCSTR szAppContext,
974 DWORD dwInstallMode, DWORD dwAssemblyInfo, LPSTR lpPathBuf,
977 FIXME("%s %s %08lx %08lx %p %p\n", debugstr_a(szAssemblyName),
978 debugstr_a(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
980 return ERROR_CALL_NOT_IMPLEMENTED;
983 UINT WINAPI MsiProvideAssemblyW( LPCWSTR szAssemblyName, LPCWSTR szAppContext,
984 DWORD dwInstallMode, DWORD dwAssemblyInfo, LPWSTR lpPathBuf,
987 FIXME("%s %s %08lx %08lx %p %p\n", debugstr_w(szAssemblyName),
988 debugstr_w(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
990 return ERROR_CALL_NOT_IMPLEMENTED;
993 UINT WINAPI MsiProvideComponentFromDescriptorA( LPCSTR szDescriptor,
994 LPSTR szPath, DWORD *pcchPath, DWORD *pcchArgs )
996 FIXME("%s %p %p %p\n", debugstr_a(szDescriptor), szPath, pcchPath, pcchArgs );
997 return ERROR_CALL_NOT_IMPLEMENTED;
1000 UINT WINAPI MsiProvideComponentFromDescriptorW( LPCWSTR szDescriptor,
1001 LPWSTR szPath, DWORD *pcchPath, DWORD *pcchArgs )
1003 FIXME("%s %p %p %p\n", debugstr_w(szDescriptor), szPath, pcchPath, pcchArgs );
1004 return ERROR_CALL_NOT_IMPLEMENTED;
1007 HRESULT WINAPI MsiGetFileSignatureInformationA( LPCSTR szSignedObjectPath,
1008 DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, BYTE* pbHashData,
1011 FIXME("%s %08lx %p %p %p\n", debugstr_a(szSignedObjectPath), dwFlags,
1012 ppcCertContext, pbHashData, pcbHashData);
1013 return ERROR_CALL_NOT_IMPLEMENTED;
1016 HRESULT WINAPI MsiGetFileSignatureInformationW( LPCWSTR szSignedObjectPath,
1017 DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, BYTE* pbHashData,
1020 FIXME("%s %08lx %p %p %p\n", debugstr_w(szSignedObjectPath), dwFlags,
1021 ppcCertContext, pbHashData, pcbHashData);
1022 return ERROR_CALL_NOT_IMPLEMENTED;
1025 UINT WINAPI MsiGetProductPropertyA( MSIHANDLE hProduct, LPCSTR szProperty,
1026 LPSTR szValue, DWORD *pccbValue )
1028 FIXME("%ld %s %p %p\n", hProduct, debugstr_a(szProperty), szValue, pccbValue);
1029 return ERROR_CALL_NOT_IMPLEMENTED;
1032 UINT WINAPI MsiGetProductPropertyW( MSIHANDLE hProduct, LPCWSTR szProperty,
1033 LPWSTR szValue, DWORD *pccbValue )
1035 FIXME("%ld %s %p %p\n", hProduct, debugstr_w(szProperty), szValue, pccbValue);
1036 return ERROR_CALL_NOT_IMPLEMENTED;
1039 UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage )
1042 LPWSTR szPack = NULL;
1044 TRACE("%s\n", debugstr_a(szPackage) );
1048 len = MultiByteToWideChar( CP_ACP, 0, szPackage, -1, NULL, 0 );
1049 szPack = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1051 return ERROR_OUTOFMEMORY;
1052 MultiByteToWideChar( CP_ACP, 0, szPackage, -1, szPack, len );
1055 r = MsiVerifyPackageW( szPack );
1057 HeapFree( GetProcessHeap(), 0, szPack );
1062 UINT WINAPI MsiVerifyPackageW( LPCWSTR szPackage )
1067 TRACE("%s\n", debugstr_w(szPackage) );
1069 r = MsiOpenDatabaseW( szPackage, MSIDBOPEN_READONLY, &handle );
1070 MsiCloseHandle( handle );
1075 INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
1076 LPSTR lpPathBuf, DWORD* pcchBuf)
1078 LPWSTR szwProduct = NULL, szwComponent = NULL, lpwPathBuf= NULL;
1080 UINT len, incoming_len;
1084 len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
1085 szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1087 return ERROR_OUTOFMEMORY;
1088 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
1093 len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 );
1094 szwComponent= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1097 HeapFree( GetProcessHeap(), 0, szwProduct);
1098 return ERROR_OUTOFMEMORY;
1100 MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len );
1103 if( pcchBuf && *pcchBuf > 0 )
1104 lpwPathBuf = HeapAlloc( GetProcessHeap(), 0, *pcchBuf * sizeof(WCHAR));
1108 incoming_len = *pcchBuf;
1109 rc = MsiGetComponentPathW(szwProduct, szwComponent, lpwPathBuf, pcchBuf);
1111 HeapFree( GetProcessHeap(), 0, szwProduct);
1112 HeapFree( GetProcessHeap(), 0, szwComponent);
1115 if (rc != INSTALLSTATE_UNKNOWN)
1116 WideCharToMultiByte(CP_ACP, 0, lpwPathBuf, incoming_len,
1117 lpPathBuf, incoming_len, NULL, NULL);
1118 HeapFree( GetProcessHeap(), 0, lpwPathBuf);
1124 INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
1125 LPWSTR lpPathBuf, DWORD* pcchBuf)
1127 WCHAR squished_pc[GUID_SIZE];
1129 INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
1134 TRACE("%s %s %p %p\n", debugstr_w(szProduct),
1135 debugstr_w(szComponent), lpPathBuf, pcchBuf);
1137 if( lpPathBuf && !pcchBuf )
1138 return INSTALLSTATE_INVALIDARG;
1140 squash_guid(szProduct,squished_pc);
1142 rc = MSIREG_OpenProductsKey( szProduct, &hkey, FALSE);
1143 if( rc != ERROR_SUCCESS )
1148 rc = MSIREG_OpenComponentsKey( szComponent, &hkey, FALSE);
1149 if( rc != ERROR_SUCCESS )
1154 rc = RegQueryValueExW( hkey, squished_pc, NULL, &type, NULL, &sz );
1155 if( rc != ERROR_SUCCESS )
1157 if( type != REG_SZ )
1160 sz += sizeof(WCHAR);
1161 path = HeapAlloc( GetProcessHeap(), 0, sz );
1165 rc = RegQueryValueExW( hkey, squished_pc, NULL, NULL, (LPVOID) path, &sz );
1166 if( rc != ERROR_SUCCESS )
1169 TRACE("found path of (%s:%s)(%s)\n", debugstr_w(szComponent),
1170 debugstr_w(szProduct), debugstr_w(path));
1174 FIXME("Registry entry.. check entry\n");
1175 rrc = INSTALLSTATE_LOCAL;
1179 /* PROBABLY a file */
1180 if ( GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES )
1181 rrc = INSTALLSTATE_LOCAL;
1183 rrc = INSTALLSTATE_ABSENT;
1188 sz = sz / sizeof(WCHAR);
1189 if( *pcchBuf >= sz )
1190 strcpyW( lpPathBuf, path );
1195 HeapFree(GetProcessHeap(), 0, path );
1200 INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
1204 LPWSTR szwProduct= NULL;
1205 LPWSTR szwFeature= NULL;
1209 len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
1210 szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1212 return ERROR_OUTOFMEMORY;
1213 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
1218 len = MultiByteToWideChar( CP_ACP, 0, szFeature, -1, NULL, 0 );
1219 szwFeature= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1222 HeapFree( GetProcessHeap(), 0, szwProduct);
1223 return ERROR_OUTOFMEMORY;
1225 MultiByteToWideChar( CP_ACP, 0, szFeature, -1, szwFeature, len );
1228 rc = MsiQueryFeatureStateW(szwProduct, szwFeature);
1230 HeapFree( GetProcessHeap(), 0, szwProduct);
1231 HeapFree( GetProcessHeap(), 0, szwFeature);
1236 INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
1238 FIXME("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
1240 * Iterates all the features components and the features parents components
1242 return INSTALLSTATE_LOCAL;
1245 UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
1246 DWORD* pcchVersionBuf, LPSTR lpLangBuf, DWORD* pcchLangBuf)
1248 LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL;
1249 UINT len, ret = ERROR_OUTOFMEMORY;
1253 len = MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, NULL, 0 );
1254 szwFilePath = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1257 MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, szwFilePath, len );
1260 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
1262 lpwVersionBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf*sizeof(WCHAR));
1263 if( !lpwVersionBuff )
1267 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
1269 lpwLangBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf*sizeof(WCHAR));
1274 ret = MsiGetFileVersionW(szwFilePath, lpwVersionBuff, pcchVersionBuf,
1275 lpwLangBuff, pcchLangBuf);
1277 if( lpwVersionBuff )
1278 WideCharToMultiByte(CP_ACP, 0, lpwVersionBuff, -1,
1279 lpVersionBuf, *pcchVersionBuf, NULL, NULL);
1281 WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1,
1282 lpLangBuf, *pcchLangBuf, NULL, NULL);
1285 HeapFree(GetProcessHeap(), 0, szwFilePath);
1286 HeapFree(GetProcessHeap(), 0, lpwVersionBuff);
1287 HeapFree(GetProcessHeap(), 0, lpwLangBuff);
1292 UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
1293 DWORD* pcchVersionBuf, LPWSTR lpLangBuf, DWORD* pcchLangBuf)
1295 static const WCHAR szVersionResource[] = {'\\',0};
1296 static const WCHAR szVersionFormat[] = {
1297 '%','d','.','%','d','.','%','d','.','%','d',0};
1298 static const WCHAR szLangFormat[] = {'%','d',0};
1301 LPVOID lpVer = NULL;
1302 VS_FIXEDFILEINFO *ffi;
1306 TRACE("%s %p %ld %p %ld\n", debugstr_w(szFilePath),
1307 lpVersionBuf, pcchVersionBuf?*pcchVersionBuf:0,
1308 lpLangBuf, pcchLangBuf?*pcchLangBuf:0);
1310 dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL);
1312 return GetLastError();
1314 lpVer = HeapAlloc(GetProcessHeap(), 0, dwVerLen);
1317 ret = ERROR_OUTOFMEMORY;
1321 if( !GetFileVersionInfoW(szFilePath, 0, dwVerLen, lpVer) )
1323 ret = GetLastError();
1326 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
1328 if( VerQueryValueW(lpVer, szVersionResource, (LPVOID*)&ffi, &puLen) &&
1331 wsprintfW(tmp, szVersionFormat,
1332 HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
1333 HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS));
1334 lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf);
1335 *pcchVersionBuf = strlenW(lpVersionBuf);
1340 *pcchVersionBuf = 0;
1344 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
1346 DWORD lang = GetUserDefaultLangID();
1348 FIXME("Retrieve language from file\n");
1349 wsprintfW(tmp, szLangFormat, lang);
1350 lstrcpynW(lpLangBuf, tmp, *pcchLangBuf);
1351 *pcchLangBuf = strlenW(lpLangBuf);
1355 HeapFree(GetProcessHeap(), 0, lpVer);
1360 /******************************************************************
1363 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
1367 case DLL_PROCESS_ATTACH:
1368 msi_hInstance = hinstDLL;
1369 DisableThreadLibraryCalls(hinstDLL);
1370 msi_dialog_register_class();
1372 case DLL_PROCESS_DETACH:
1373 msi_dialog_unregister_class();
1374 /* FIXME: Cleanup */
1380 typedef struct tagIClassFactoryImpl
1382 IClassFactoryVtbl *lpVtbl;
1383 } IClassFactoryImpl;
1385 static HRESULT WINAPI MsiCF_QueryInterface(LPCLASSFACTORY iface,
1386 REFIID riid,LPVOID *ppobj)
1388 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
1389 FIXME("%p %s %p\n",This,debugstr_guid(riid),ppobj);
1390 return E_NOINTERFACE;
1393 static ULONG WINAPI MsiCF_AddRef(LPCLASSFACTORY iface)
1398 static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface)
1403 static HRESULT WINAPI MsiCF_CreateInstance(LPCLASSFACTORY iface,
1404 LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
1406 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
1408 FIXME("%p %p %s %p\n", This, pOuter, debugstr_guid(riid), ppobj);
1412 static HRESULT WINAPI MsiCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
1414 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
1416 FIXME("%p %d\n", This, dolock);
1420 static IClassFactoryVtbl MsiCF_Vtbl =
1422 MsiCF_QueryInterface,
1425 MsiCF_CreateInstance,
1429 static IClassFactoryImpl Msi_CF = { &MsiCF_Vtbl };
1431 /******************************************************************
1432 * DllGetClassObject [MSI.@]
1434 HRESULT WINAPI MSI_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
1436 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1438 if( IsEqualCLSID (rclsid, &CLSID_IMsiServer) ||
1439 IsEqualCLSID (rclsid, &CLSID_IMsiServerMessage) ||
1440 IsEqualCLSID (rclsid, &CLSID_IMsiServerX1) ||
1441 IsEqualCLSID (rclsid, &CLSID_IMsiServerX2) ||
1442 IsEqualCLSID (rclsid, &CLSID_IMsiServerX3) )
1444 *ppv = (LPVOID) &Msi_CF;
1447 return CLASS_E_CLASSNOTAVAILABLE;
1450 /******************************************************************
1451 * DllGetVersion [MSI.@]
1453 HRESULT WINAPI MSI_DllGetVersion(DLLVERSIONINFO *pdvi)
1457 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
1458 return E_INVALIDARG;
1460 pdvi->dwMajorVersion = MSI_MAJORVERSION;
1461 pdvi->dwMinorVersion = MSI_MINORVERSION;
1462 pdvi->dwBuildNumber = MSI_BUILDNUMBER;
1463 pdvi->dwPlatformID = 1;
1468 /******************************************************************
1469 * DllCanUnloadNow [MSI.@]
1471 BOOL WINAPI MSI_DllCanUnloadNow(void)
1476 UINT WINAPI MsiGetFeatureUsageW(LPCWSTR szProduct, LPCWSTR szFeature,
1477 DWORD* pdwUseCount, WORD* pwDateUsed)
1479 FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szFeature),
1480 pdwUseCount, pwDateUsed);
1481 return ERROR_CALL_NOT_IMPLEMENTED;
1484 UINT WINAPI MsiGetFeatureUsageA(LPCSTR szProduct, LPCSTR szFeature,
1485 DWORD* pdwUseCount, WORD* pwDateUsed)
1487 FIXME("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szFeature),
1488 pdwUseCount, pwDateUsed);
1489 return ERROR_CALL_NOT_IMPLEMENTED;
1492 INSTALLSTATE WINAPI MsiUseFeatureExW(LPCWSTR szProduct, LPCWSTR szFeature,
1493 DWORD dwInstallMode, DWORD dwReserved)
1495 FIXME("%s %s %li %li\n", debugstr_w(szProduct), debugstr_w(szFeature),
1496 dwInstallMode, dwReserved);
1499 * Polls all the components of the feature to find install state and then
1501 * Software\\Microsoft\\Windows\\CurrentVersion\\
1502 * Installer\\Products\\<squishguid>\\<feature>
1503 * "Usage"=dword:........
1506 return INSTALLSTATE_LOCAL;
1509 INSTALLSTATE WINAPI MsiUseFeatureExA(LPCSTR szProduct, LPCSTR szFeature,
1510 DWORD dwInstallMode, DWORD dwReserved)
1512 FIXME("%s %s %li %li\n", debugstr_a(szProduct), debugstr_a(szFeature),
1513 dwInstallMode, dwReserved);
1515 return INSTALLSTATE_LOCAL;
1518 INSTALLSTATE WINAPI MsiUseFeatureW(LPCWSTR szProduct, LPCWSTR szFeature)
1520 FIXME("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
1522 return INSTALLSTATE_LOCAL;
1525 INSTALLSTATE WINAPI MsiUseFeatureA(LPCSTR szProduct, LPCSTR szFeature)
1527 FIXME("%s %s\n", debugstr_a(szProduct), debugstr_a(szFeature));
1529 return INSTALLSTATE_LOCAL;
1532 UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
1533 LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR szProduct,
1534 DWORD Unused1, DWORD Unused2, LPWSTR lpPathBuf,
1537 FIXME("%s %s %li %s %li %li %p %p\n", debugstr_w(szComponent),
1538 debugstr_w(szQualifier), dwInstallMode, debugstr_w(szProduct),
1539 Unused1, Unused2, lpPathBuf, pcchPathBuf);
1541 return ERROR_INDEX_ABSENT;
1544 USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct, LPWSTR lpUserNameBuf,
1545 DWORD* pcchUserNameBuf, LPWSTR lpOrgNameBuf,
1546 DWORD* pcchOrgNameBuf, LPWSTR lpSerialBuf, DWORD* pcchSerialBuf)
1548 FIXME("%s %p %p %p %p %p %p\n",debugstr_w(szProduct), lpUserNameBuf,
1549 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
1552 return USERINFOSTATE_UNKNOWN;
1555 USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct, LPSTR lpUserNameBuf,
1556 DWORD* pcchUserNameBuf, LPSTR lpOrgNameBuf,
1557 DWORD* pcchOrgNameBuf, LPSTR lpSerialBuf, DWORD* pcchSerialBuf)
1559 FIXME("%s %p %p %p %p %p %p\n",debugstr_a(szProduct), lpUserNameBuf,
1560 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
1563 return USERINFOSTATE_UNKNOWN;
1566 UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
1568 FIXME("%s\n",debugstr_w(szProduct));
1569 return ERROR_CALL_NOT_IMPLEMENTED;
1572 UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
1574 FIXME("%s\n",debugstr_a(szProduct));
1575 return ERROR_CALL_NOT_IMPLEMENTED;
1578 UINT WINAPI MsiCreateAndVerifyInstallerDirectory(void)
1581 return ERROR_CALL_NOT_IMPLEMENTED;
1584 UINT WINAPI MsiGetShortcutTargetA( LPCSTR szShortcutTarget,
1585 LPSTR szProductCode, LPSTR szFeatureId,
1586 LPSTR szComponentCode )
1589 return ERROR_CALL_NOT_IMPLEMENTED;
1592 UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
1593 LPWSTR szProductCode, LPWSTR szFeatureId,
1594 LPWSTR szComponentCode )
1597 return ERROR_CALL_NOT_IMPLEMENTED;
1600 UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
1601 DWORD dwReinstallMode )
1603 FIXME("%s %s %li\n", debugstr_w(szProduct), debugstr_w(szFeature),
1605 return ERROR_SUCCESS;
1608 UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature,
1609 DWORD dwReinstallMode )
1611 FIXME("%s %s %li\n", debugstr_a(szProduct), debugstr_a(szFeature),
1613 return ERROR_SUCCESS;