Remove the unused 1st parameter of ACTION_VerifyComponentForAction.
[wine/multimedia.git] / dlls / msi / preview.c
blob4c7c62b60225f63a03d3cf2a6eb2825253944534
1 /*
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
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winnls.h"
26 #include "msi.h"
27 #include "msipriv.h"
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;
44 MSIPACKAGE *package;
46 package = MSI_CreatePackage( db );
47 if( package )
49 preview = alloc_msiobject( MSIHANDLETYPE_PREVIEW, sizeof (MSIPREVIEW),
50 MSI_ClosePreview );
51 if( preview )
53 preview->package = package;
54 preview->dialog = 0;
55 msiobj_addref( &package->hdr );
57 msiobj_release( &package->hdr );
59 return preview;
62 UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE* phPreview )
64 MSIDATABASE *db;
65 MSIPREVIEW *preview;
66 UINT r = ERROR_FUNCTION_FAILED;
68 TRACE("%ld %p\n", hdb, phPreview);
70 db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
71 if( !db )
72 return ERROR_INVALID_HANDLE;
73 preview = MSI_EnableUIPreview( db );
74 if( preview )
76 *phPreview = alloc_msihandle( &preview->hdr );
77 msiobj_release( &preview->hdr );
78 r = ERROR_SUCCESS;
80 msiobj_release( &db->hdr );
82 return r;
85 static UINT preview_event_handler( MSIPACKAGE *package, LPCWSTR event,
86 LPCWSTR argument, msi_dialog *dialog )
88 MESSAGE("Preview dialog event '%s' (arg='%s')\n",
89 debugstr_w( event ), debugstr_w( argument ));
90 return ERROR_SUCCESS;
93 UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
95 msi_dialog *dialog = NULL;
96 UINT r = ERROR_SUCCESS;
98 if( preview->dialog )
99 msi_dialog_destroy( preview->dialog );
101 /* an empty name means we should just destroy the current preview dialog */
102 if( szDialogName )
104 dialog = msi_dialog_create( preview->package, szDialogName,
105 preview_event_handler );
106 if( dialog )
107 msi_dialog_do_preview( dialog );
108 else
109 r = ERROR_FUNCTION_FAILED;
111 preview->dialog = dialog;
113 return r;
116 UINT WINAPI MsiPreviewDialogW( MSIHANDLE hPreview, LPCWSTR szDialogName )
118 MSIPREVIEW *preview;
119 UINT r;
121 TRACE("%ld %s\n", hPreview, debugstr_w(szDialogName));
123 preview = msihandle2msiinfo( hPreview, MSIHANDLETYPE_PREVIEW );
124 if( !preview )
125 return ERROR_INVALID_HANDLE;
127 r = MSI_PreviewDialogW( preview, szDialogName );
129 msiobj_release( &preview->hdr );
131 return r;
134 UINT WINAPI MsiPreviewDialogA( MSIHANDLE hPreview, LPCSTR szDialogName )
136 UINT r;
137 LPWSTR strW = NULL;
139 TRACE("%ld %s\n", hPreview, debugstr_a(szDialogName));
141 if( szDialogName )
143 strW = strdupAtoW( szDialogName );
144 if( !strW )
145 return ERROR_OUTOFMEMORY;
147 r = MsiPreviewDialogW( hPreview, strW );
148 msi_free( strW );
149 return r;
152 UINT WINAPI MsiPreviewBillboardW( MSIHANDLE hPreview, LPCWSTR szControlName,
153 LPCWSTR szBillboard)
155 FIXME("%ld %s %s\n", hPreview, debugstr_w(szControlName),
156 debugstr_w(szBillboard));
157 return ERROR_CALL_NOT_IMPLEMENTED;
160 UINT WINAPI MsiPreviewBillboardA( MSIHANDLE hPreview, LPCSTR szControlName,
161 LPCSTR szBillboard)
163 FIXME("%ld %s %s\n", hPreview, debugstr_a(szControlName),
164 debugstr_a(szBillboard));
165 return ERROR_CALL_NOT_IMPLEMENTED;