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);
489 rc = ERROR_INVALID_HANDLE;
493 sz = strlenW(szInstalled);
496 sz += strlenW(szCommandLine);
498 commandline = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR));
501 strcpyW(commandline,szCommandLine);
505 if (MsiQueryProductStateW(szProduct) != INSTALLSTATE_UNKNOWN)
506 strcatW(commandline,szInstalled);
508 rc = ACTION_DoTopLevelINSTALL(package, sourcepath, commandline);
510 msiobj_release( &package->hdr );
512 HeapFree(GetProcessHeap(),0,commandline);
519 UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
520 INSTALLSTATE eInstallState, LPCSTR szCommandLine)
522 LPWSTR szwProduct = NULL;
523 LPWSTR szwCommandLine = NULL;
524 UINT hr = ERROR_FUNCTION_FAILED;
528 UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
529 szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
532 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
537 UINT len = MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, NULL, 0 );
538 szwCommandLine= HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
541 MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, szwCommandLine, len );
544 hr = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
547 HeapFree( GetProcessHeap(), 0, szwProduct );
548 HeapFree( GetProcessHeap(), 0, szwCommandLine);
553 UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
554 INSTALLSTATE eInstallState)
556 LPWSTR szwProduct = NULL;
557 UINT hr = ERROR_SUCCESS;
559 FIXME("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState);
563 UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
564 szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
567 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
570 hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
573 HeapFree( GetProcessHeap(), 0, szwProduct );
578 UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel,
579 INSTALLSTATE eInstallState)
581 FIXME("%s %d %d\n", debugstr_w(szProduct), iInstallLevel, eInstallState);
583 return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState,
587 UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
589 LPWSTR szwComponent = NULL;
590 UINT hr = ERROR_INSTALL_FAILURE;
591 WCHAR szwBuffer[GUID_SIZE];
593 FIXME("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer));
597 UINT len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 );
598 szwComponent = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
601 MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len );
604 return ERROR_INVALID_PARAMETER;
606 hr = MsiGetProductCodeW( szwComponent, szwBuffer );
608 if( ERROR_SUCCESS == hr )
609 WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL);
612 HeapFree( GetProcessHeap(), 0, szwComponent );
617 UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
619 FIXME("%s %s\n",debugstr_w(szComponent), debugstr_w(szBuffer));
620 if (NULL == szComponent)
621 return ERROR_INVALID_PARAMETER;
622 return ERROR_CALL_NOT_IMPLEMENTED;
625 UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
626 LPSTR szBuffer, DWORD *pcchValueBuf)
628 LPWSTR szwProduct = NULL, szwAttribute = NULL, szwBuffer = NULL;
629 UINT hr = ERROR_INSTALL_FAILURE;
631 FIXME("%s %s %p %p\n",debugstr_a(szProduct), debugstr_a(szAttribute),
632 szBuffer, pcchValueBuf);
634 if( NULL != szBuffer && NULL == pcchValueBuf )
635 return ERROR_INVALID_PARAMETER;
638 UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
639 szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
642 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
645 return ERROR_INVALID_PARAMETER;
649 UINT len = MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, NULL, 0 );
650 szwAttribute = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
653 MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, szwAttribute, len );
657 hr = ERROR_INVALID_PARAMETER;
663 szwBuffer = HeapAlloc( GetProcessHeap(), 0, (*pcchValueBuf) * sizeof(WCHAR) );
668 hr = MsiGetProductInfoW( szwProduct, szwAttribute, szwBuffer, pcchValueBuf );
670 if( ERROR_SUCCESS == hr )
671 WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, *pcchValueBuf, NULL, NULL);
674 HeapFree( GetProcessHeap(), 0, szwProduct );
675 HeapFree( GetProcessHeap(), 0, szwAttribute );
676 HeapFree( GetProcessHeap(), 0, szwBuffer );
681 UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
682 LPWSTR szBuffer, DWORD *pcchValueBuf)
687 FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szAttribute),
688 szBuffer, pcchValueBuf);
690 if (NULL != szBuffer && NULL == pcchValueBuf)
691 return ERROR_INVALID_PARAMETER;
692 if (NULL == szProduct || NULL == szAttribute)
693 return ERROR_INVALID_PARAMETER;
695 hr = MsiOpenProductW(szProduct, &hProduct);
696 if (ERROR_SUCCESS != hr)
699 hr = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf);
700 MsiCloseHandle(hProduct);
704 UINT WINAPI MsiDatabaseImportA(LPCSTR szFolderPath, LPCSTR szFilename)
706 FIXME("%s %s\n",debugstr_a(szFolderPath), debugstr_a(szFilename));
707 return ERROR_CALL_NOT_IMPLEMENTED;
710 UINT WINAPI MsiDatabaseImportW(LPCWSTR szFolderPath, LPCWSTR szFilename)
712 FIXME("%s %s\n",debugstr_w(szFolderPath), debugstr_w(szFilename));
713 return ERROR_CALL_NOT_IMPLEMENTED;
716 UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
718 LPWSTR szwLogFile = NULL;
719 UINT hr = ERROR_INSTALL_FAILURE;
721 FIXME("%08lx %s %08lx\n", dwLogMode, debugstr_a(szLogFile), attributes);
725 UINT len = MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, NULL, 0 );
726 szwLogFile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
729 MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, szwLogFile, len );
732 return ERROR_INVALID_PARAMETER;
734 hr = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
737 HeapFree( GetProcessHeap(), 0, szwLogFile );
742 UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes)
744 HANDLE file = INVALID_HANDLE_VALUE;
746 TRACE("%08lx %s %08lx\n", dwLogMode, debugstr_w(szLogFile), attributes);
748 strcpyW(gszLogFile,szLogFile);
749 if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
750 DeleteFileW(szLogFile);
751 file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
752 FILE_ATTRIBUTE_NORMAL, NULL);
753 if (file != INVALID_HANDLE_VALUE)
756 ERR("Unable to enable log %s\n",debugstr_w(szLogFile));
758 return ERROR_SUCCESS;
761 INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
767 len = MultiByteToWideChar(CP_ACP,0,szProduct,-1,NULL,0);
768 szwProduct = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
769 MultiByteToWideChar(CP_ACP,0,szProduct,-1,szwProduct,len);
770 rc = MsiQueryProductStateW(szwProduct);
771 HeapFree(GetProcessHeap(),0,szwProduct);
775 INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
778 INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
780 static const WCHAR szWindowsInstaller[] = {
781 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 };
784 TRACE("%s\n", debugstr_w(szProduct));
786 rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
787 if (rc != ERROR_SUCCESS)
792 rc = MSIREG_OpenUninstallKey(szProduct,&hkey,FALSE);
793 if (rc != ERROR_SUCCESS)
797 rc = RegQueryValueExW(hkey,szWindowsInstaller,NULL,NULL,(LPVOID)&rrc, &sz);
798 if (rc != ERROR_SUCCESS)
805 rrc = INSTALLSTATE_DEFAULT;
808 FIXME("Unknown install state read from registry (%i)\n",rrc);
809 rrc = INSTALLSTATE_UNKNOWN;
817 INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
819 INSTALLUILEVEL old = gUILevel;
820 HWND oldwnd = gUIhwnd;
822 TRACE("%08x %p\n", dwUILevel, phWnd);
824 gUILevel = dwUILevel;
833 INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler,
834 DWORD dwMessageFilter, LPVOID pvContext)
836 INSTALLUI_HANDLERA prev = gUIHandlerA;
838 TRACE("%p %lx %p\n",puiHandler, dwMessageFilter,pvContext);
839 gUIHandlerA = puiHandler;
840 gUIFilter = dwMessageFilter;
841 gUIContext = pvContext;
846 INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW(INSTALLUI_HANDLERW puiHandler,
847 DWORD dwMessageFilter, LPVOID pvContext)
849 INSTALLUI_HANDLERW prev = gUIHandlerW;
851 TRACE("%p %lx %p\n",puiHandler,dwMessageFilter,pvContext);
852 gUIHandlerW = puiHandler;
853 gUIFilter = dwMessageFilter;
854 gUIContext = pvContext;
859 /******************************************************************
860 * MsiLoadStringW [MSI.@]
862 * Loads a string from MSI's string resources.
866 * handle [I] only -1 is handled currently
867 * id [I] id of the string to be loaded
868 * lpBuffer [O] buffer for the string to be written to
869 * nBufferMax [I] maximum size of the buffer in characters
870 * lang [I] the preferred language for the string
874 * If successful, this function returns the language id of the string loaded
875 * If the function fails, the function returns zero.
879 * The type of the first parameter is unknown. LoadString's prototype
880 * suggests that it might be a module handle. I have made it an MSI handle
881 * for starters, as -1 is an invalid MSI handle, but not an invalid module
882 * handle. Maybe strings can be stored in an MSI database somehow.
884 LANGID WINAPI MsiLoadStringW( MSIHANDLE handle, UINT id, LPWSTR lpBuffer,
885 int nBufferMax, LANGID lang )
892 TRACE("%ld %u %p %d %d\n", handle, id, lpBuffer, nBufferMax, lang);
895 FIXME("don't know how to deal with handle = %08lx\n", handle);
898 lang = GetUserDefaultLangID();
900 hres = FindResourceExW( msi_hInstance, (LPCWSTR) RT_STRING,
904 hResData = LoadResource( msi_hInstance, hres );
907 p = LockResource( hResData );
911 for (i = 0; i < (id&0xf); i++)
915 if( nBufferMax <= len )
918 memcpy( lpBuffer, p+1, len * sizeof(WCHAR));
921 TRACE("found -> %s\n", debugstr_w(lpBuffer));
926 LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
927 int nBufferMax, LANGID lang )
933 bufW = HeapAlloc(GetProcessHeap(), 0, nBufferMax*sizeof(WCHAR));
934 r = MsiLoadStringW(handle, id, bufW, nBufferMax, lang);
937 len = WideCharToMultiByte(CP_ACP, 0, bufW, -1, NULL, 0, NULL, NULL );
938 if( len <= nBufferMax )
939 WideCharToMultiByte( CP_ACP, 0, bufW, -1,
940 lpBuffer, nBufferMax, NULL, NULL );
944 HeapFree(GetProcessHeap(), 0, bufW);
948 INSTALLSTATE WINAPI MsiLocateComponentA(LPCSTR szComponent, LPSTR lpPathBuf,
951 FIXME("%s %p %08lx\n", debugstr_a(szComponent), lpPathBuf, *pcchBuf);
952 return INSTALLSTATE_UNKNOWN;
955 INSTALLSTATE WINAPI MsiLocateComponentW(LPCWSTR szComponent, LPSTR lpPathBuf,
958 FIXME("%s %p %08lx\n", debugstr_w(szComponent), lpPathBuf, *pcchBuf);
959 return INSTALLSTATE_UNKNOWN;
962 UINT WINAPI MsiMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,
963 WORD wLanguageId, DWORD f)
965 FIXME("%p %s %s %u %08x %08lx\n",hWnd,debugstr_a(lpText),debugstr_a(lpCaption),
966 uType,wLanguageId,f);
967 return ERROR_CALL_NOT_IMPLEMENTED;
970 UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,
971 WORD wLanguageId, DWORD f)
973 FIXME("%p %s %s %u %08x %08lx\n",hWnd,debugstr_w(lpText),debugstr_w(lpCaption),
974 uType,wLanguageId,f);
975 return ERROR_CALL_NOT_IMPLEMENTED;
978 UINT WINAPI MsiProvideAssemblyA( LPCSTR szAssemblyName, LPCSTR szAppContext,
979 DWORD dwInstallMode, DWORD dwAssemblyInfo, LPSTR lpPathBuf,
982 FIXME("%s %s %08lx %08lx %p %p\n", debugstr_a(szAssemblyName),
983 debugstr_a(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
985 return ERROR_CALL_NOT_IMPLEMENTED;
988 UINT WINAPI MsiProvideAssemblyW( LPCWSTR szAssemblyName, LPCWSTR szAppContext,
989 DWORD dwInstallMode, DWORD dwAssemblyInfo, LPWSTR lpPathBuf,
992 FIXME("%s %s %08lx %08lx %p %p\n", debugstr_w(szAssemblyName),
993 debugstr_w(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
995 return ERROR_CALL_NOT_IMPLEMENTED;
998 UINT WINAPI MsiProvideComponentFromDescriptorA( LPCSTR szDescriptor,
999 LPSTR szPath, DWORD *pcchPath, DWORD *pcchArgs )
1001 FIXME("%s %p %p %p\n", debugstr_a(szDescriptor), szPath, pcchPath, pcchArgs );
1002 return ERROR_CALL_NOT_IMPLEMENTED;
1005 UINT WINAPI MsiProvideComponentFromDescriptorW( LPCWSTR szDescriptor,
1006 LPWSTR szPath, DWORD *pcchPath, DWORD *pcchArgs )
1008 FIXME("%s %p %p %p\n", debugstr_w(szDescriptor), szPath, pcchPath, pcchArgs );
1009 return ERROR_CALL_NOT_IMPLEMENTED;
1012 HRESULT WINAPI MsiGetFileSignatureInformationA( LPCSTR szSignedObjectPath,
1013 DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, BYTE* pbHashData,
1016 FIXME("%s %08lx %p %p %p\n", debugstr_a(szSignedObjectPath), dwFlags,
1017 ppcCertContext, pbHashData, pcbHashData);
1018 return ERROR_CALL_NOT_IMPLEMENTED;
1021 HRESULT WINAPI MsiGetFileSignatureInformationW( LPCWSTR szSignedObjectPath,
1022 DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, BYTE* pbHashData,
1025 FIXME("%s %08lx %p %p %p\n", debugstr_w(szSignedObjectPath), dwFlags,
1026 ppcCertContext, pbHashData, pcbHashData);
1027 return ERROR_CALL_NOT_IMPLEMENTED;
1030 UINT WINAPI MsiGetProductPropertyA( MSIHANDLE hProduct, LPCSTR szProperty,
1031 LPSTR szValue, DWORD *pccbValue )
1033 FIXME("%ld %s %p %p\n", hProduct, debugstr_a(szProperty), szValue, pccbValue);
1034 return ERROR_CALL_NOT_IMPLEMENTED;
1037 UINT WINAPI MsiGetProductPropertyW( MSIHANDLE hProduct, LPCWSTR szProperty,
1038 LPWSTR szValue, DWORD *pccbValue )
1040 FIXME("%ld %s %p %p\n", hProduct, debugstr_w(szProperty), szValue, pccbValue);
1041 return ERROR_CALL_NOT_IMPLEMENTED;
1044 UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage )
1047 LPWSTR szPack = NULL;
1049 TRACE("%s\n", debugstr_a(szPackage) );
1053 len = MultiByteToWideChar( CP_ACP, 0, szPackage, -1, NULL, 0 );
1054 szPack = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1056 return ERROR_OUTOFMEMORY;
1057 MultiByteToWideChar( CP_ACP, 0, szPackage, -1, szPack, len );
1060 r = MsiVerifyPackageW( szPack );
1062 HeapFree( GetProcessHeap(), 0, szPack );
1067 UINT WINAPI MsiVerifyPackageW( LPCWSTR szPackage )
1072 TRACE("%s\n", debugstr_w(szPackage) );
1074 r = MsiOpenDatabaseW( szPackage, MSIDBOPEN_READONLY, &handle );
1075 MsiCloseHandle( handle );
1080 INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
1081 LPSTR lpPathBuf, DWORD* pcchBuf)
1083 LPWSTR szwProduct = NULL, szwComponent = NULL, lpwPathBuf= NULL;
1085 UINT len, incoming_len;
1089 len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
1090 szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1092 return ERROR_OUTOFMEMORY;
1093 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
1098 len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 );
1099 szwComponent= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1102 HeapFree( GetProcessHeap(), 0, szwProduct);
1103 return ERROR_OUTOFMEMORY;
1105 MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len );
1108 if( pcchBuf && *pcchBuf > 0 )
1109 lpwPathBuf = HeapAlloc( GetProcessHeap(), 0, *pcchBuf * sizeof(WCHAR));
1113 incoming_len = *pcchBuf;
1114 rc = MsiGetComponentPathW(szwProduct, szwComponent, lpwPathBuf, pcchBuf);
1116 HeapFree( GetProcessHeap(), 0, szwProduct);
1117 HeapFree( GetProcessHeap(), 0, szwComponent);
1120 if (rc != INSTALLSTATE_UNKNOWN)
1121 WideCharToMultiByte(CP_ACP, 0, lpwPathBuf, incoming_len,
1122 lpPathBuf, incoming_len, NULL, NULL);
1123 HeapFree( GetProcessHeap(), 0, lpwPathBuf);
1129 INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
1130 LPWSTR lpPathBuf, DWORD* pcchBuf)
1132 WCHAR squished_pc[GUID_SIZE];
1134 INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
1139 TRACE("%s %s %p %p\n", debugstr_w(szProduct),
1140 debugstr_w(szComponent), lpPathBuf, pcchBuf);
1142 if( lpPathBuf && !pcchBuf )
1143 return INSTALLSTATE_INVALIDARG;
1145 squash_guid(szProduct,squished_pc);
1147 rc = MSIREG_OpenProductsKey( szProduct, &hkey, FALSE);
1148 if( rc != ERROR_SUCCESS )
1153 rc = MSIREG_OpenComponentsKey( szComponent, &hkey, FALSE);
1154 if( rc != ERROR_SUCCESS )
1159 rc = RegQueryValueExW( hkey, squished_pc, NULL, &type, NULL, &sz );
1160 if( rc != ERROR_SUCCESS )
1162 if( type != REG_SZ )
1165 sz += sizeof(WCHAR);
1166 path = HeapAlloc( GetProcessHeap(), 0, sz );
1170 rc = RegQueryValueExW( hkey, squished_pc, NULL, NULL, (LPVOID) path, &sz );
1171 if( rc != ERROR_SUCCESS )
1174 TRACE("found path of (%s:%s)(%s)\n", debugstr_w(szComponent),
1175 debugstr_w(szProduct), debugstr_w(path));
1179 FIXME("Registry entry.. check entry\n");
1180 rrc = INSTALLSTATE_LOCAL;
1184 /* PROBABLY a file */
1185 if ( GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES )
1186 rrc = INSTALLSTATE_LOCAL;
1188 rrc = INSTALLSTATE_ABSENT;
1193 sz = sz / sizeof(WCHAR);
1194 if( *pcchBuf >= sz )
1195 strcpyW( lpPathBuf, path );
1200 HeapFree(GetProcessHeap(), 0, path );
1205 INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
1209 LPWSTR szwProduct= NULL;
1210 LPWSTR szwFeature= NULL;
1214 len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 );
1215 szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1217 return ERROR_OUTOFMEMORY;
1218 MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
1223 len = MultiByteToWideChar( CP_ACP, 0, szFeature, -1, NULL, 0 );
1224 szwFeature= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1227 HeapFree( GetProcessHeap(), 0, szwProduct);
1228 return ERROR_OUTOFMEMORY;
1230 MultiByteToWideChar( CP_ACP, 0, szFeature, -1, szwFeature, len );
1233 rc = MsiQueryFeatureStateW(szwProduct, szwFeature);
1235 HeapFree( GetProcessHeap(), 0, szwProduct);
1236 HeapFree( GetProcessHeap(), 0, szwFeature);
1241 INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
1243 FIXME("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
1245 * Iterates all the features components and the features parents components
1247 return INSTALLSTATE_LOCAL;
1250 UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
1251 DWORD* pcchVersionBuf, LPSTR lpLangBuf, DWORD* pcchLangBuf)
1253 LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL;
1254 UINT len, ret = ERROR_OUTOFMEMORY;
1258 len = MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, NULL, 0 );
1259 szwFilePath = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
1262 MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, szwFilePath, len );
1265 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
1267 lpwVersionBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf*sizeof(WCHAR));
1268 if( !lpwVersionBuff )
1272 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
1274 lpwLangBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf*sizeof(WCHAR));
1279 ret = MsiGetFileVersionW(szwFilePath, lpwVersionBuff, pcchVersionBuf,
1280 lpwLangBuff, pcchLangBuf);
1282 if( lpwVersionBuff )
1283 WideCharToMultiByte(CP_ACP, 0, lpwVersionBuff, -1,
1284 lpVersionBuf, *pcchVersionBuf, NULL, NULL);
1286 WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1,
1287 lpLangBuf, *pcchLangBuf, NULL, NULL);
1290 HeapFree(GetProcessHeap(), 0, szwFilePath);
1291 HeapFree(GetProcessHeap(), 0, lpwVersionBuff);
1292 HeapFree(GetProcessHeap(), 0, lpwLangBuff);
1297 UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
1298 DWORD* pcchVersionBuf, LPWSTR lpLangBuf, DWORD* pcchLangBuf)
1300 static const WCHAR szVersionResource[] = {'\\',0};
1301 static const WCHAR szVersionFormat[] = {
1302 '%','d','.','%','d','.','%','d','.','%','d',0};
1303 static const WCHAR szLangFormat[] = {'%','d',0};
1306 LPVOID lpVer = NULL;
1307 VS_FIXEDFILEINFO *ffi;
1311 TRACE("%s %p %ld %p %ld\n", debugstr_w(szFilePath),
1312 lpVersionBuf, pcchVersionBuf?*pcchVersionBuf:0,
1313 lpLangBuf, pcchLangBuf?*pcchLangBuf:0);
1315 dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL);
1317 return GetLastError();
1319 lpVer = HeapAlloc(GetProcessHeap(), 0, dwVerLen);
1322 ret = ERROR_OUTOFMEMORY;
1326 if( !GetFileVersionInfoW(szFilePath, 0, dwVerLen, lpVer) )
1328 ret = GetLastError();
1331 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
1333 if( VerQueryValueW(lpVer, szVersionResource, (LPVOID*)&ffi, &puLen) &&
1336 wsprintfW(tmp, szVersionFormat,
1337 HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
1338 HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS));
1339 lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf);
1340 *pcchVersionBuf = strlenW(lpVersionBuf);
1345 *pcchVersionBuf = 0;
1349 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
1351 DWORD lang = GetUserDefaultLangID();
1353 FIXME("Retrieve language from file\n");
1354 wsprintfW(tmp, szLangFormat, lang);
1355 lstrcpynW(lpLangBuf, tmp, *pcchLangBuf);
1356 *pcchLangBuf = strlenW(lpLangBuf);
1360 HeapFree(GetProcessHeap(), 0, lpVer);
1365 /******************************************************************
1368 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
1372 case DLL_PROCESS_ATTACH:
1373 msi_hInstance = hinstDLL;
1374 DisableThreadLibraryCalls(hinstDLL);
1375 msi_dialog_register_class();
1377 case DLL_PROCESS_DETACH:
1378 msi_dialog_unregister_class();
1379 /* FIXME: Cleanup */
1385 typedef struct tagIClassFactoryImpl
1387 IClassFactoryVtbl *lpVtbl;
1388 } IClassFactoryImpl;
1390 static HRESULT WINAPI MsiCF_QueryInterface(LPCLASSFACTORY iface,
1391 REFIID riid,LPVOID *ppobj)
1393 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
1394 FIXME("%p %s %p\n",This,debugstr_guid(riid),ppobj);
1395 return E_NOINTERFACE;
1398 static ULONG WINAPI MsiCF_AddRef(LPCLASSFACTORY iface)
1403 static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface)
1408 static HRESULT WINAPI MsiCF_CreateInstance(LPCLASSFACTORY iface,
1409 LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
1411 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
1413 FIXME("%p %p %s %p\n", This, pOuter, debugstr_guid(riid), ppobj);
1417 static HRESULT WINAPI MsiCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
1419 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
1421 FIXME("%p %d\n", This, dolock);
1425 static IClassFactoryVtbl MsiCF_Vtbl =
1427 MsiCF_QueryInterface,
1430 MsiCF_CreateInstance,
1434 static IClassFactoryImpl Msi_CF = { &MsiCF_Vtbl };
1436 /******************************************************************
1437 * DllGetClassObject [MSI.@]
1439 HRESULT WINAPI MSI_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
1441 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1443 if( IsEqualCLSID (rclsid, &CLSID_IMsiServer) ||
1444 IsEqualCLSID (rclsid, &CLSID_IMsiServerMessage) ||
1445 IsEqualCLSID (rclsid, &CLSID_IMsiServerX1) ||
1446 IsEqualCLSID (rclsid, &CLSID_IMsiServerX2) ||
1447 IsEqualCLSID (rclsid, &CLSID_IMsiServerX3) )
1449 *ppv = (LPVOID) &Msi_CF;
1452 return CLASS_E_CLASSNOTAVAILABLE;
1455 /******************************************************************
1456 * DllGetVersion [MSI.@]
1458 HRESULT WINAPI MSI_DllGetVersion(DLLVERSIONINFO *pdvi)
1462 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
1463 return E_INVALIDARG;
1465 pdvi->dwMajorVersion = MSI_MAJORVERSION;
1466 pdvi->dwMinorVersion = MSI_MINORVERSION;
1467 pdvi->dwBuildNumber = MSI_BUILDNUMBER;
1468 pdvi->dwPlatformID = 1;
1473 /******************************************************************
1474 * DllCanUnloadNow [MSI.@]
1476 BOOL WINAPI MSI_DllCanUnloadNow(void)
1481 UINT WINAPI MsiGetFeatureUsageW(LPCWSTR szProduct, LPCWSTR szFeature,
1482 DWORD* pdwUseCount, WORD* pwDateUsed)
1484 FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szFeature),
1485 pdwUseCount, pwDateUsed);
1486 return ERROR_CALL_NOT_IMPLEMENTED;
1489 UINT WINAPI MsiGetFeatureUsageA(LPCSTR szProduct, LPCSTR szFeature,
1490 DWORD* pdwUseCount, WORD* pwDateUsed)
1492 FIXME("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szFeature),
1493 pdwUseCount, pwDateUsed);
1494 return ERROR_CALL_NOT_IMPLEMENTED;
1497 INSTALLSTATE WINAPI MsiUseFeatureExW(LPCWSTR szProduct, LPCWSTR szFeature,
1498 DWORD dwInstallMode, DWORD dwReserved)
1500 FIXME("%s %s %li %li\n", debugstr_w(szProduct), debugstr_w(szFeature),
1501 dwInstallMode, dwReserved);
1504 * Polls all the components of the feature to find install state and then
1506 * Software\\Microsoft\\Windows\\CurrentVersion\\
1507 * Installer\\Products\\<squishguid>\\<feature>
1508 * "Usage"=dword:........
1511 return INSTALLSTATE_LOCAL;
1514 INSTALLSTATE WINAPI MsiUseFeatureExA(LPCSTR szProduct, LPCSTR szFeature,
1515 DWORD dwInstallMode, DWORD dwReserved)
1517 FIXME("%s %s %li %li\n", debugstr_a(szProduct), debugstr_a(szFeature),
1518 dwInstallMode, dwReserved);
1520 return INSTALLSTATE_LOCAL;
1523 INSTALLSTATE WINAPI MsiUseFeatureW(LPCWSTR szProduct, LPCWSTR szFeature)
1525 FIXME("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
1527 return INSTALLSTATE_LOCAL;
1530 INSTALLSTATE WINAPI MsiUseFeatureA(LPCSTR szProduct, LPCSTR szFeature)
1532 FIXME("%s %s\n", debugstr_a(szProduct), debugstr_a(szFeature));
1534 return INSTALLSTATE_LOCAL;
1537 UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
1538 LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR szProduct,
1539 DWORD Unused1, DWORD Unused2, LPWSTR lpPathBuf,
1542 FIXME("%s %s %li %s %li %li %p %p\n", debugstr_w(szComponent),
1543 debugstr_w(szQualifier), dwInstallMode, debugstr_w(szProduct),
1544 Unused1, Unused2, lpPathBuf, pcchPathBuf);
1546 return ERROR_INDEX_ABSENT;
1549 USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct, LPWSTR lpUserNameBuf,
1550 DWORD* pcchUserNameBuf, LPWSTR lpOrgNameBuf,
1551 DWORD* pcchOrgNameBuf, LPWSTR lpSerialBuf, DWORD* pcchSerialBuf)
1553 FIXME("%s %p %p %p %p %p %p\n",debugstr_w(szProduct), lpUserNameBuf,
1554 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
1557 return USERINFOSTATE_UNKNOWN;
1560 USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct, LPSTR lpUserNameBuf,
1561 DWORD* pcchUserNameBuf, LPSTR lpOrgNameBuf,
1562 DWORD* pcchOrgNameBuf, LPSTR lpSerialBuf, DWORD* pcchSerialBuf)
1564 FIXME("%s %p %p %p %p %p %p\n",debugstr_a(szProduct), lpUserNameBuf,
1565 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
1568 return USERINFOSTATE_UNKNOWN;
1571 UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
1573 FIXME("%s\n",debugstr_w(szProduct));
1574 return ERROR_CALL_NOT_IMPLEMENTED;
1577 UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
1579 FIXME("%s\n",debugstr_a(szProduct));
1580 return ERROR_CALL_NOT_IMPLEMENTED;
1583 UINT WINAPI MsiCreateAndVerifyInstallerDirectory(void)
1586 return ERROR_CALL_NOT_IMPLEMENTED;
1589 UINT WINAPI MsiGetShortcutTargetA( LPCSTR szShortcutTarget,
1590 LPSTR szProductCode, LPSTR szFeatureId,
1591 LPSTR szComponentCode )
1594 return ERROR_CALL_NOT_IMPLEMENTED;
1597 UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
1598 LPWSTR szProductCode, LPWSTR szFeatureId,
1599 LPWSTR szComponentCode )
1602 return ERROR_CALL_NOT_IMPLEMENTED;
1605 UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
1606 DWORD dwReinstallMode )
1608 FIXME("%s %s %li\n", debugstr_w(szProduct), debugstr_w(szFeature),
1610 return ERROR_SUCCESS;
1613 UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature,
1614 DWORD dwReinstallMode )
1616 FIXME("%s %s %li\n", debugstr_a(szProduct), debugstr_a(szFeature),
1618 return ERROR_SUCCESS;