2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 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
29 #include "wine/debug.h"
30 #include "wine/unicode.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(msi);
34 static void MSI_ClosePreview( MSIOBJECTHDR *arg )
36 MSIPREVIEW *preview = (MSIPREVIEW *) arg;
38 msiobj_release( &preview->package->hdr );
41 MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE *db )
43 MSIPREVIEW *preview = NULL;
46 package = MSI_CreatePackage( db );
49 preview = alloc_msiobject( MSIHANDLETYPE_PREVIEW, sizeof (MSIPREVIEW),
53 preview->package = package;
55 msiobj_addref( &package->hdr );
57 msiobj_release( &package->hdr );
62 UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE* phPreview )
66 UINT r = ERROR_FUNCTION_FAILED;
68 TRACE("%ld %p\n", hdb, phPreview);
70 db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
72 return ERROR_INVALID_HANDLE;
73 preview = MSI_EnableUIPreview( db );
76 *phPreview = alloc_msihandle( &preview->hdr );
77 msiobj_release( &preview->hdr );
84 static VOID preview_event_handler( MSIPACKAGE *package, LPCWSTR event,
85 LPCWSTR argument, msi_dialog *dialog )
87 MESSAGE("Preview dialog event '%s' (arg='%s')\n",
88 debugstr_w( event ), debugstr_w( argument ));
91 UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
93 msi_dialog *dialog = NULL;
94 UINT r = ERROR_SUCCESS;
97 msi_dialog_destroy( preview->dialog );
99 /* an empty name means we should just destroy the current preview dialog */
102 dialog = msi_dialog_create( preview->package, szDialogName,
103 preview_event_handler );
105 msi_dialog_do_preview( dialog );
107 r = ERROR_FUNCTION_FAILED;
109 preview->dialog = dialog;
114 UINT WINAPI MsiPreviewDialogW( MSIHANDLE hPreview, LPCWSTR szDialogName )
119 TRACE("%ld %s\n", hPreview, debugstr_w(szDialogName));
121 preview = msihandle2msiinfo( hPreview, MSIHANDLETYPE_PREVIEW );
123 return ERROR_INVALID_HANDLE;
125 r = MSI_PreviewDialogW( preview, szDialogName );
127 msiobj_release( &preview->hdr );
132 UINT WINAPI MsiPreviewDialogA( MSIHANDLE hPreview, LPCSTR szDialogName )
137 TRACE("%ld %s\n", hPreview, debugstr_a(szDialogName));
141 len = MultiByteToWideChar( CP_ACP, 0, szDialogName, -1, NULL, 0 );
142 strW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
143 MultiByteToWideChar( CP_ACP, 0, szDialogName, -1, strW, len );
145 r = MsiPreviewDialogW( hPreview, strW );
146 HeapFree( GetProcessHeap(), 0, strW );
150 UINT WINAPI MsiPreviewBillboardW( MSIHANDLE hPreview, LPCWSTR szControlName,
153 FIXME("%ld %s %s\n", hPreview, debugstr_w(szControlName),
154 debugstr_w(szBillboard));
155 return ERROR_CALL_NOT_IMPLEMENTED;
158 UINT WINAPI MsiPreviewBillboardA( MSIHANDLE hPreview, LPCSTR szControlName,
161 FIXME("%ld %s %s\n", hPreview, debugstr_a(szControlName),
162 debugstr_a(szBillboard));
163 return ERROR_CALL_NOT_IMPLEMENTED;