ReactOS  0.4.15-dev-5109-g2469ce2
package.c
Go to the documentation of this file.
1 /*
2  * Implementation of the Microsoft Installer (msi.dll)
3  *
4  * Copyright 2004 Aric Stewart for CodeWeavers
5  *
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.
10  *
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.
15  *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #define NONAMELESSUNION
22 #define NONAMELESSSTRUCT
23 #define COBJMACROS
24 #ifdef __REACTOS__
25 #define WIN32_NO_STATUS
26 #endif
27 
28 #include <stdarg.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winreg.h"
32 #include "winnls.h"
33 #ifdef __REACTOS__
34 #include <ndk/rtlfuncs.h>
35 #else
36 #include "winternl.h"
37 #endif
38 #include "shlwapi.h"
39 #include "wingdi.h"
40 #include "msi.h"
41 #include "msiquery.h"
42 #include "objidl.h"
43 #include "wincrypt.h"
44 #include "winuser.h"
45 #include "wininet.h"
46 #include "winver.h"
47 #include "urlmon.h"
48 #include "shlobj.h"
49 #include "objbase.h"
50 #include "msidefs.h"
51 #include "sddl.h"
52 
53 #include "wine/debug.h"
54 #include "wine/exception.h"
55 
56 #include "msipriv.h"
57 #include "winemsi_s.h"
58 #include "resource.h"
59 
61 
63 {
64  struct list *item, *cursor;
65 
66  LIST_FOR_EACH_SAFE( item, cursor, &feature->Children )
67  {
69  list_remove( &fl->entry );
70  msi_free( fl );
71  }
72 
73  LIST_FOR_EACH_SAFE( item, cursor, &feature->Components )
74  {
76  list_remove( &cl->entry );
77  msi_free( cl );
78  }
79  msi_free( feature->Feature );
80  msi_free( feature->Feature_Parent );
81  msi_free( feature->Directory );
82  msi_free( feature->Description );
83  msi_free( feature->Title );
84  msi_free( feature );
85 }
86 
87 static void free_folder( MSIFOLDER *folder )
88 {
89  struct list *item, *cursor;
90 
91  LIST_FOR_EACH_SAFE( item, cursor, &folder->children )
92  {
94  list_remove( &fl->entry );
95  msi_free( fl );
96  }
97  msi_free( folder->Parent );
98  msi_free( folder->Directory );
99  msi_free( folder->TargetDefault );
100  msi_free( folder->SourceLongPath );
101  msi_free( folder->SourceShortPath );
102  msi_free( folder->ResolvedTarget );
103  msi_free( folder->ResolvedSource );
104  msi_free( folder );
105 }
106 
108 {
109  struct list *item, *cursor;
110 
111  LIST_FOR_EACH_SAFE( item, cursor, &ext->verbs )
112  {
113  MSIVERB *verb = LIST_ENTRY( item, MSIVERB, entry );
114 
115  list_remove( &verb->entry );
116  msi_free( verb->Verb );
117  msi_free( verb->Command );
118  msi_free( verb->Argument );
119  msi_free( verb );
120  }
121 
122  msi_free( ext->Extension );
123  msi_free( ext->ProgIDText );
124  msi_free( ext );
125 }
126 
128 {
129  msi_free( assembly->feature );
131  msi_free( assembly->application );
132  msi_free( assembly->display_name );
133  if (assembly->tempdir) RemoveDirectoryW( assembly->tempdir );
134  msi_free( assembly->tempdir );
135  msi_free( assembly );
136 }
137 
139 {
140  UINT i;
141  for (i = 0; i < package->script_actions_count[script]; i++)
142  msi_free( package->script_actions[script][i] );
143 
144  msi_free( package->script_actions[script] );
145  package->script_actions[script] = NULL;
146  package->script_actions_count[script] = 0;
147 }
148 
149 static void free_package_structures( MSIPACKAGE *package )
150 {
151  struct list *item, *cursor;
152  int i;
153 
154  LIST_FOR_EACH_SAFE( item, cursor, &package->features )
155  {
157  list_remove( &feature->entry );
159  }
160 
161  LIST_FOR_EACH_SAFE( item, cursor, &package->folders )
162  {
164  list_remove( &folder->entry );
165  free_folder( folder );
166  }
167 
168  LIST_FOR_EACH_SAFE( item, cursor, &package->files )
169  {
171 
172  list_remove( &file->entry );
173  msi_free( file->File );
174  msi_free( file->FileName );
175  msi_free( file->ShortName );
176  msi_free( file->LongName );
177  msi_free( file->Version );
178  msi_free( file->Language );
179  if (msi_is_global_assembly( file->Component )) DeleteFileW( file->TargetPath );
180  msi_free( file->TargetPath );
181  msi_free( file );
182  }
183 
185  {
187 
188  list_remove( &comp->entry );
189  msi_free( comp->Component );
190  msi_free( comp->ComponentId );
191  msi_free( comp->Directory );
192  msi_free( comp->Condition );
193  msi_free( comp->KeyPath );
194  msi_free( comp->FullKeypath );
195  if (comp->assembly) free_assembly( comp->assembly );
196  msi_free( comp );
197  }
198 
200  {
202 
203  list_remove( &patch->entry );
204  msi_free( patch->path );
205  msi_free( patch );
206  }
207 
208  /* clean up extension, progid, class and verb structures */
209  LIST_FOR_EACH_SAFE( item, cursor, &package->classes )
210  {
211  MSICLASS *cls = LIST_ENTRY( item, MSICLASS, entry );
212 
213  list_remove( &cls->entry );
214  msi_free( cls->clsid );
215  msi_free( cls->Context );
216  msi_free( cls->Description );
217  msi_free( cls->FileTypeMask );
218  msi_free( cls->IconPath );
219  msi_free( cls->DefInprocHandler );
221  msi_free( cls->Argument );
222  msi_free( cls->ProgIDText );
223  msi_free( cls );
224  }
225 
227  {
229 
230  list_remove( &ext->entry );
231  free_extension( ext );
232  }
233 
234  LIST_FOR_EACH_SAFE( item, cursor, &package->progids )
235  {
237 
238  list_remove( &progid->entry );
239  msi_free( progid->ProgID );
240  msi_free( progid->Description );
241  msi_free( progid->IconPath );
242  msi_free( progid );
243  }
244 
245  LIST_FOR_EACH_SAFE( item, cursor, &package->mimes )
246  {
247  MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry );
248 
249  list_remove( &mt->entry );
250  msi_free( mt->suffix );
251  msi_free( mt->clsid );
252  msi_free( mt->ContentType );
253  msi_free( mt );
254  }
255 
256  LIST_FOR_EACH_SAFE( item, cursor, &package->appids )
257  {
259 
260  list_remove( &appid->entry );
261  msi_free( appid->AppID );
262  msi_free( appid->RemoteServerName );
263  msi_free( appid->LocalServer );
264  msi_free( appid->ServiceParameters );
265  msi_free( appid->DllSurrogate );
266  msi_free( appid );
267  }
268 
270  {
272 
273  list_remove( &info->entry );
274  msi_free( info->value );
275  msi_free( info );
276  }
277 
279  {
281 
282  list_remove( &info->entry );
283  msi_free( info->volume_label );
284  msi_free( info->disk_prompt );
285  msi_free( info );
286  }
287 
288  for (i = 0; i < SCRIPT_MAX; i++)
289  msi_free_action_script( package, i );
290 
291  for (i = 0; i < package->unique_actions_count; i++)
292  msi_free( package->unique_actions[i] );
293  msi_free( package->unique_actions);
294 
295  LIST_FOR_EACH_SAFE( item, cursor, &package->binaries )
296  {
298 
299  list_remove( &binary->entry );
300  if (!DeleteFileW( binary->tmpfile ))
301  ERR( "failed to delete %s (%lu)\n", debugstr_w(binary->tmpfile), GetLastError() );
302  msi_free( binary->source );
303  msi_free( binary->tmpfile );
304  msi_free( binary );
305  }
306 
308  {
310 
311  list_remove( &cab->entry );
312  IStorage_Release( cab->storage );
313  msi_free( cab->stream );
314  msi_free( cab );
315  }
316 
317  LIST_FOR_EACH_SAFE( item, cursor, &package->patches )
318  {
320 
321  list_remove( &patch->entry );
322  if (patch->delete_on_close && !DeleteFileW( patch->localfile ))
323  {
324  ERR( "failed to delete %s (%lu)\n", debugstr_w(patch->localfile), GetLastError() );
325  }
326  msi_free_patchinfo( patch );
327  }
328 
329  msi_free( package->PackagePath );
330  msi_free( package->ProductCode );
331  msi_free( package->ActionFormat );
332  msi_free( package->LastAction );
333  msi_free( package->LastActionTemplate );
334  msi_free( package->langids );
335 
336  /* cleanup control event subscriptions */
338 }
339 
341 {
342  MSIPACKAGE *package = (MSIPACKAGE *)arg;
343 
344  msi_destroy_assembly_caches( package );
345 
346  if( package->dialog )
347  msi_dialog_destroy( package->dialog );
348 
349  msiobj_release( &package->db->hdr );
350  free_package_structures(package);
351  CloseHandle( package->log_file );
352  if (package->rpc_server_started)
353  RpcServerUnregisterIf(s_IWineMsiRemote_v0_0_s_ifspec, NULL, FALSE);
354  if (rpc_handle)
355  RpcBindingFree(&rpc_handle);
356  if (package->custom_server_32_process)
357  custom_stop_server(package->custom_server_32_process, package->custom_server_32_pipe);
358  if (package->custom_server_64_process)
359  custom_stop_server(package->custom_server_64_process, package->custom_server_64_pipe);
360 
361  if (package->delete_on_close) DeleteFileW( package->localfile );
362  msi_free( package->localfile );
364 }
365 
367 {
368  MSIQUERY *view;
369  UINT rc;
370 
371  rc = MSI_DatabaseOpenViewW(package->db, L"CREATE TABLE `_Property` ( `_Property` CHAR(56) NOT NULL TEMPORARY, "
372  L"`Value` CHAR(98) NOT NULL TEMPORARY PRIMARY KEY `_Property`) HOLD", &view);
373  if (rc != ERROR_SUCCESS)
374  return rc;
375 
376  rc = MSI_ViewExecute(view, 0);
378  msiobj_release(&view->hdr);
379  return rc;
380 }
381 
383 {
384  MSIQUERY *view_select;
385  UINT rc;
386 
387  rc = MSI_DatabaseOpenViewW( db, L"SELECT * FROM `Property`", &view_select );
388  if (rc != ERROR_SUCCESS)
389  return rc;
390 
391  rc = MSI_ViewExecute( view_select, 0 );
392  if (rc != ERROR_SUCCESS)
393  {
394  MSI_ViewClose( view_select );
395  msiobj_release( &view_select->hdr );
396  return rc;
397  }
398 
399  while (1)
400  {
401  MSIQUERY *view_insert, *view_update;
402  MSIRECORD *rec_select;
403 
404  rc = MSI_ViewFetch( view_select, &rec_select );
405  if (rc != ERROR_SUCCESS)
406  break;
407 
408  rc = MSI_DatabaseOpenViewW( db, L"INSERT INTO `_Property` (`_Property`,`Value`) VALUES (?,?)", &view_insert );
409  if (rc != ERROR_SUCCESS)
410  {
411  msiobj_release( &rec_select->hdr );
412  continue;
413  }
414 
415  rc = MSI_ViewExecute( view_insert, rec_select );
416  MSI_ViewClose( view_insert );
417  msiobj_release( &view_insert->hdr );
418  if (rc != ERROR_SUCCESS)
419  {
420  MSIRECORD *rec_update;
421 
422  TRACE("insert failed, trying update\n");
423 
424  rc = MSI_DatabaseOpenViewW( db, L"UPDATE `_Property` SET `Value` = ? WHERE `_Property` = ?", &view_update );
425  if (rc != ERROR_SUCCESS)
426  {
427  WARN("open view failed %u\n", rc);
428  msiobj_release( &rec_select->hdr );
429  continue;
430  }
431 
432  rec_update = MSI_CreateRecord( 2 );
433  MSI_RecordCopyField( rec_select, 1, rec_update, 2 );
434  MSI_RecordCopyField( rec_select, 2, rec_update, 1 );
435  rc = MSI_ViewExecute( view_update, rec_update );
436  if (rc != ERROR_SUCCESS)
437  WARN("update failed %u\n", rc);
438 
439  MSI_ViewClose( view_update );
440  msiobj_release( &view_update->hdr );
441  msiobj_release( &rec_update->hdr );
442  }
443 
444  msiobj_release( &rec_select->hdr );
445  }
446 
447  MSI_ViewClose( view_select );
448  msiobj_release( &view_select->hdr );
449  return rc;
450 }
451 
452 /*
453  * set_installed_prop
454  *
455  * Sets the "Installed" property to indicate that
456  * the product is installed for the current user.
457  */
459 {
460  HKEY hkey;
461  UINT r;
462 
463  if (!package->ProductCode) return ERROR_FUNCTION_FAILED;
464 
465  r = MSIREG_OpenUninstallKey( package->ProductCode, package->platform, &hkey, FALSE );
466  if (r == ERROR_SUCCESS)
467  {
468  RegCloseKey( hkey );
469  msi_set_property( package->db, L"Installed", L"1", -1 );
470  }
471  return r;
472 }
473 
475 {
476  SID_NAME_USE use;
478  LPWSTR sid_str = NULL, dom = NULL;
479  DWORD size, dom_size;
480  PSID psid = NULL;
482 
483  size = 0;
484  GetUserNameW( NULL, &size );
485 
486  user_name = msi_alloc( (size + 1) * sizeof(WCHAR) );
487  if (!user_name)
488  return ERROR_OUTOFMEMORY;
489 
490  if (!GetUserNameW( user_name, &size ))
491  goto done;
492 
493  size = 0;
494  dom_size = 0;
495  LookupAccountNameW( NULL, user_name, NULL, &size, NULL, &dom_size, &use );
496 
497  psid = msi_alloc( size );
498  dom = msi_alloc( dom_size*sizeof (WCHAR) );
499  if (!psid || !dom)
500  {
502  goto done;
503  }
504 
505  if (!LookupAccountNameW( NULL, user_name, psid, &size, dom, &dom_size, &use ))
506  goto done;
507 
508  if (!ConvertSidToStringSidW( psid, &sid_str ))
509  goto done;
510 
511  r = msi_set_property( package->db, L"UserSID", sid_str, -1 );
512 
513 done:
514  LocalFree( sid_str );
515  msi_free( dom );
516  msi_free( psid );
517  msi_free( user_name );
518 
519  return r;
520 }
521 
523 {
524  HKEY netsetup, hkey;
525  LONG res;
526  DWORD size, len, type;
527  WCHAR windir[MAX_PATH], path[MAX_PATH], *filename = NULL;
528 
529  res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\NET Framework Setup\\NDP", 0, KEY_CREATE_SUB_KEY,
530  &netsetup);
531  if (res != ERROR_SUCCESS)
532  return NULL;
533 
534  if (!RegCreateKeyExW(netsetup, L"v4\\Client", 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
535  {
536  size = sizeof(path);
537  if (!RegQueryValueExW(hkey, L"InstallPath", NULL, &type, (BYTE *)path, &size))
538  {
539  len = lstrlenW(path) + lstrlenW(L"fusion.dll") + 2;
540  if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL;
541 
543  lstrcatW(filename, L"\\");
544  lstrcatW(filename, L"fusion.dll");
546  {
547  TRACE( "found %s\n", debugstr_w(filename) );
548  RegCloseKey(hkey);
549  RegCloseKey(netsetup);
550  return filename;
551  }
552  }
553  RegCloseKey(hkey);
554  }
555 
556  if (!RegCreateKeyExW(netsetup, L"v2.0.50727", 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
557  {
558  RegCloseKey(hkey);
560  len = lstrlenW(windir) + lstrlenW(L"Microsoft.NET\\Framework\\") + lstrlenW(L"v2.0.50727") +
561  lstrlenW(L"fusion.dll") + 3;
563  if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL;
564 
565  lstrcpyW(filename, windir);
566  lstrcatW(filename, L"\\");
567  lstrcatW(filename, L"Microsoft.NET\\Framework\\");
568  lstrcatW(filename, L"v2.0.50727");
569  lstrcatW(filename, L"\\");
570  lstrcatW(filename, L"fusion.dll");
572  {
573  TRACE( "found %s\n", debugstr_w(filename) );
574  RegCloseKey(netsetup);
575  return filename;
576  }
577  }
578 
579  RegCloseKey(netsetup);
580  return filename;
581 }
582 
583 typedef struct tagLANGANDCODEPAGE
584 {
585  WORD wLanguage;
586  WORD wCodePage;
588 
589 static void set_msi_assembly_prop(MSIPACKAGE *package)
590 {
591  UINT val_len;
592  DWORD size, handle;
593  LPVOID version = NULL;
594  WCHAR buf[MAX_PATH];
595  LPWSTR fusion, verstr;
597 
598  fusion = get_fusion_filename(package);
599  if (!fusion)
600  return;
601 
602  size = GetFileVersionInfoSizeW(fusion, &handle);
603  if (!size)
604  goto done;
605 
607  if (!version)
608  goto done;
609 
610  if (!GetFileVersionInfoW(fusion, handle, size, version))
611  goto done;
612 
613  if (!VerQueryValueW(version, L"\\VarFileInfo\\Translation", (LPVOID *)&translate, &val_len))
614  goto done;
615 
616  swprintf(buf, ARRAY_SIZE(buf), L"\\StringFileInfo\\%04x%04x\\ProductVersion", translate[0].wLanguage,
617  translate[0].wCodePage);
618 
619  if (!VerQueryValueW(version, buf, (LPVOID *)&verstr, &val_len))
620  goto done;
621 
622  if (!val_len || !verstr)
623  goto done;
624 
625  msi_set_property( package->db, L"MsiNetAssemblySupport", verstr, -1 );
626 
627 done:
628  msi_free(fusion);
629  msi_free(version);
630 }
631 
633 {
634  WCHAR *ptr;
635  RTL_OSVERSIONINFOEXW OSVersion;
636  MEMORYSTATUSEX msex;
637  DWORD verval, len, type;
638  WCHAR pth[MAX_PATH], verstr[11], bufstr[22];
639  HDC dc;
640  HKEY hkey;
641  LPWSTR username, companyname;
642  SYSTEM_INFO sys_info;
643  LANGID langid;
644 
645  /*
646  * Other things that probably should be set:
647  *
648  * VirtualMemory ShellAdvSupport DefaultUIFont PackagecodeChanging
649  * CaptionHeight BorderTop BorderSide TextHeight RedirectedDllSupport
650  */
651 
653  lstrcatW(pth, L"\\");
654  msi_set_property( package->db, L"CommonAppDataFolder", pth, -1 );
655 
657  lstrcatW(pth, L"\\");
658  msi_set_property( package->db, L"FavoritesFolder", pth, -1 );
659 
661  lstrcatW(pth, L"\\");
662  msi_set_property( package->db, L"FontsFolder", pth, -1 );
663 
665  lstrcatW(pth, L"\\");
666  msi_set_property( package->db, L"SendToFolder", pth, -1 );
667 
669  lstrcatW(pth, L"\\");
670  msi_set_property( package->db, L"StartMenuFolder", pth, -1 );
671 
673  lstrcatW(pth, L"\\");
674  msi_set_property( package->db, L"StartupFolder", pth, -1 );
675 
677  lstrcatW(pth, L"\\");
678  msi_set_property( package->db, L"TemplateFolder", pth, -1 );
679 
681  lstrcatW(pth, L"\\");
682  msi_set_property( package->db, L"DesktopFolder", pth, -1 );
683 
684  /* FIXME: set to AllUsers profile path if ALLUSERS is set */
686  lstrcatW(pth, L"\\");
687  msi_set_property( package->db, L"ProgramMenuFolder", pth, -1 );
688 
690  lstrcatW(pth, L"\\");
691  msi_set_property( package->db, L"AdminToolsFolder", pth, -1 );
692 
694  lstrcatW(pth, L"\\");
695  msi_set_property( package->db, L"AppDataFolder", pth, -1 );
696 
698  lstrcatW(pth, L"\\");
699  msi_set_property( package->db, L"SystemFolder", pth, -1 );
700  msi_set_property( package->db, L"System16Folder", pth, -1 );
701 
703  lstrcatW(pth, L"\\");
704  msi_set_property( package->db, L"LocalAppDataFolder", pth, -1 );
705 
707  lstrcatW(pth, L"\\");
708  msi_set_property( package->db, L"MyPicturesFolder", pth, -1 );
709 
711  lstrcatW(pth, L"\\");
712  msi_set_property( package->db, L"PersonalFolder", pth, -1 );
713 
715  lstrcatW(pth, L"\\");
716  msi_set_property( package->db, L"WindowsFolder", pth, -1 );
717 
719  lstrcatW(pth, L"\\");
720  msi_set_property( package->db, L"PrintHoodFolder", pth, -1 );
721 
723  lstrcatW(pth, L"\\");
724  msi_set_property( package->db, L"NetHoodFolder", pth, -1 );
725 
727  lstrcatW(pth, L"\\");
728  msi_set_property( package->db, L"RecentFolder", pth, -1 );
729 
730  /* Physical Memory is specified in MB. Using total amount. */
731  msex.dwLength = sizeof(msex);
732  GlobalMemoryStatusEx( &msex );
733  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", (int)(msex.ullTotalPhys / 1024 / 1024) );
734  msi_set_property( package->db, L"PhysicalMemory", bufstr, len );
735 
737  ptr = wcschr(pth,'\\');
738  if (ptr) *(ptr + 1) = 0;
739  msi_set_property( package->db, L"WindowsVolume", pth, -1 );
740 
741  len = GetTempPathW(MAX_PATH, pth);
742  msi_set_property( package->db, L"TempFolder", pth, len );
743 
744  /* in a wine environment the user is always admin and privileged */
745  msi_set_property( package->db, L"AdminUser", L"1", -1 );
746  msi_set_property( package->db, L"Privileged", L"1", -1 );
747  msi_set_property( package->db, L"MsiRunningElevated", L"1", -1 );
748 
749  /* set the os things */
750  OSVersion.dwOSVersionInfoSize = sizeof(OSVersion);
751  RtlGetVersion((PRTL_OSVERSIONINFOW)&OSVersion);
752  verval = OSVersion.dwMinorVersion + OSVersion.dwMajorVersion * 100;
753  if (verval > 603)
754  {
755  verval = 603;
756  OSVersion.dwBuildNumber = 9600;
757  }
758  len = swprintf( verstr, ARRAY_SIZE(verstr), L"%u", verval );
759  switch (OSVersion.dwPlatformId)
760  {
762  msi_set_property( package->db, L"Version9X", verstr, len );
763  break;
765  msi_set_property( package->db, L"VersionNT", verstr, len );
766  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.wProductType );
767  msi_set_property( package->db, L"MsiNTProductType", bufstr, len );
768  break;
769  }
770  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.dwBuildNumber );
771  msi_set_property( package->db, L"WindowsBuild", bufstr, len );
772  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.wServicePackMajor );
773  msi_set_property( package->db, L"ServicePackLevel", bufstr, len );
774 
775  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u.%u", MSI_MAJORVERSION, MSI_MINORVERSION );
776  msi_set_property( package->db, L"VersionMsi", bufstr, len );
777  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", MSI_MAJORVERSION * 100 );
778  msi_set_property( package->db, L"VersionDatabase", bufstr, len );
779 
780  RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion", 0,
782 
783  GetNativeSystemInfo( &sys_info );
784  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", sys_info.wProcessorLevel );
785  msi_set_property( package->db, L"Intel", bufstr, len );
787  {
789  PathAddBackslashW( pth );
790  msi_set_property( package->db, L"SystemFolder", pth, -1 );
791 
792  len = sizeof(pth);
793  RegQueryValueExW(hkey, L"ProgramFilesDir", 0, &type, (BYTE *)pth, &len);
794  PathAddBackslashW( pth );
795  msi_set_property( package->db, L"ProgramFilesFolder", pth, -1 );
796 
797  len = sizeof(pth);
798  RegQueryValueExW(hkey, L"CommonFilesDir", 0, &type, (BYTE *)pth, &len);
799  PathAddBackslashW( pth );
800  msi_set_property( package->db, L"CommonFilesFolder", pth, -1 );
801  }
802  else if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
803  {
804  msi_set_property( package->db, L"MsiAMD64", bufstr, -1 );
805  msi_set_property( package->db, L"Msix64", bufstr, -1 );
806  msi_set_property( package->db, L"VersionNT64", verstr, -1 );
807 
809  PathAddBackslashW( pth );
810  msi_set_property( package->db, L"System64Folder", pth, -1 );
811 
813  PathAddBackslashW( pth );
814  msi_set_property( package->db, L"SystemFolder", pth, -1 );
815 
816  len = sizeof(pth);
817  RegQueryValueExW(hkey, L"ProgramFilesDir", 0, &type, (BYTE *)pth, &len);
818  PathAddBackslashW( pth );
819  msi_set_property( package->db, L"ProgramFiles64Folder", pth, -1 );
820 
821  len = sizeof(pth);
822  RegQueryValueExW(hkey, L"ProgramFilesDir (x86)", 0, &type, (BYTE *)pth, &len);
823  PathAddBackslashW( pth );
824  msi_set_property( package->db, L"ProgramFilesFolder", pth, -1 );
825 
826  len = sizeof(pth);
827  RegQueryValueExW(hkey, L"CommonFilesDir", 0, &type, (BYTE *)pth, &len);
828  PathAddBackslashW( pth );
829  msi_set_property( package->db, L"CommonFiles64Folder", pth, -1 );
830 
831  len = sizeof(pth);
832  RegQueryValueExW(hkey, L"CommonFilesDir (x86)", 0, &type, (BYTE *)pth, &len);
833  PathAddBackslashW( pth );
834  msi_set_property( package->db, L"CommonFilesFolder", pth, -1 );
835  }
836 
837  RegCloseKey(hkey);
838 
839  /* Screen properties. */
840  dc = GetDC(0);
841  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, HORZRES) );
842  msi_set_property( package->db, L"ScreenX", bufstr, len );
843  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, VERTRES) );
844  msi_set_property( package->db, L"ScreenY", bufstr, len );
845  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, BITSPIXEL) );
846  msi_set_property( package->db, L"ColorBits", bufstr, len );
847  ReleaseDC(0, dc);
848 
849  /* USERNAME and COMPANYNAME */
850  username = msi_dup_property( package->db, L"USERNAME" );
851  companyname = msi_dup_property( package->db, L"COMPANYNAME" );
852 
853  if ((!username || !companyname) &&
854  RegOpenKeyW( HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey ) == ERROR_SUCCESS)
855  {
856  if (!username &&
857  (username = msi_reg_get_val_str( hkey, L"DefName" )))
858  msi_set_property( package->db, L"USERNAME", username, -1 );
859  if (!companyname &&
860  (companyname = msi_reg_get_val_str( hkey, L"DefCompany" )))
861  msi_set_property( package->db, L"COMPANYNAME", companyname, -1 );
862  CloseHandle( hkey );
863  }
864  if ((!username || !companyname) &&
865  RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0,
867  {
868  if (!username &&
869  (username = msi_reg_get_val_str( hkey, L"RegisteredOwner" )))
870  msi_set_property( package->db, L"USERNAME", username, -1 );
871  if (!companyname &&
872  (companyname = msi_reg_get_val_str( hkey, L"RegisteredOrganization" )))
873  msi_set_property( package->db, L"COMPANYNAME", companyname, -1 );
874  CloseHandle( hkey );
875  }
876  msi_free( username );
877  msi_free( companyname );
878 
879  if ( set_user_sid_prop( package ) != ERROR_SUCCESS)
880  ERR("Failed to set the UserSID property\n");
881 
882  set_msi_assembly_prop( package );
883 
885  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", langid );
886  msi_set_property( package->db, L"UserLanguageID", bufstr, len );
887 
889  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", langid );
890  msi_set_property( package->db, L"SystemLanguageID", bufstr, len );
891 
892  len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", MsiQueryProductStateW(package->ProductCode) );
893  msi_set_property( package->db, L"ProductState", bufstr, len );
894 
895  len = 0;
897  {
898  WCHAR *username;
899  if ((username = msi_alloc( len * sizeof(WCHAR) )))
900  {
901  if (GetUserNameW( username, &len ))
902  msi_set_property( package->db, L"LogonUser", username, len - 1 );
903  msi_free( username );
904  }
905  }
906  len = 0;
908  {
909  WCHAR *computername;
910  if ((computername = msi_alloc( len * sizeof(WCHAR) )))
911  {
912  if (GetComputerNameW( computername, &len ))
913  msi_set_property( package->db, L"ComputerName", computername, len );
914  msi_free( computername );
915  }
916  }
917 }
918 
920 {
921  MSIPACKAGE *package;
922 
923  package = alloc_msiobject( MSIHANDLETYPE_PACKAGE, sizeof (MSIPACKAGE),
924  MSI_FreePackage );
925  if( package )
926  {
927  list_init( &package->components );
928  list_init( &package->features );
929  list_init( &package->files );
930  list_init( &package->filepatches );
931  list_init( &package->tempfiles );
932  list_init( &package->folders );
933  list_init( &package->subscriptions );
934  list_init( &package->appids );
935  list_init( &package->classes );
936  list_init( &package->mimes );
937  list_init( &package->extensions );
938  list_init( &package->progids );
939  list_init( &package->RunningActions );
940  list_init( &package->sourcelist_info );
941  list_init( &package->sourcelist_media );
942  list_init( &package->patches );
943  list_init( &package->binaries );
944  list_init( &package->cabinet_streams );
945  }
946 
947  return package;
948 }
949 
951 {
952  BYTE *data;
953  UINT r, sz;
954 
955  r = read_stream_data(package->db->storage, L"AdminProperties", FALSE, &data, &sz);
956  if (r != ERROR_SUCCESS)
957  return r;
958 
959  r = msi_parse_command_line(package, (WCHAR *)data, TRUE);
960 
961  msi_free(data);
962  return r;
963 }
964 
966 {
967  /* FIXME: this should depend on the user's privileges */
968  if (msi_get_property_int( package->db, L"ALLUSERS", 0 ) == 2)
969  {
970  TRACE("resetting ALLUSERS property from 2 to 1\n");
971  msi_set_property( package->db, L"ALLUSERS", L"1", -1 );
972  }
973  msi_set_property( package->db, L"AdminUser", L"1", -1 );
974  msi_set_property( package->db, L"Privileged", L"1", -1 );
975  msi_set_property( package->db, L"MsiRunningElevated", L"1", -1 );
976 }
977 
979 {
980  MSIPACKAGE *package;
981  WCHAR uilevel[11];
982  int len;
983  UINT r;
984 
985  TRACE("%p\n", db);
986 
987  package = msi_alloc_package();
988  if (package)
989  {
990  msiobj_addref( &db->hdr );
991  package->db = db;
992 
993  package->LastAction = NULL;
994  package->LastActionTemplate = NULL;
996  package->WordCount = 0;
997  package->PackagePath = strdupW( db->path );
998 
999  create_temp_property_table( package );
1000  msi_clone_properties( package->db );
1002 
1003  package->ProductCode = msi_dup_property( package->db, L"ProductCode" );
1004 
1005  set_installer_properties( package );
1006 
1007  package->ui_level = gUILevel;
1008  len = swprintf( uilevel, ARRAY_SIZE(uilevel), L"%u", gUILevel & INSTALLUILEVEL_MASK );
1009  msi_set_property( package->db, L"UILevel", uilevel, len );
1010 
1011  r = msi_load_suminfo_properties( package );
1012  if (r != ERROR_SUCCESS)
1013  {
1014  msiobj_release( &package->hdr );
1015  return NULL;
1016  }
1017 
1019  msi_load_admin_properties( package );
1020 
1021  package->log_file = INVALID_HANDLE_VALUE;
1022  package->script = SCRIPT_NONE;
1023  }
1024  return package;
1025 }
1026 
1028 {
1030  DWORD size = 0;
1031  HRESULT hr;
1032 
1033  /* call will always fail, because size is 0,
1034  * but will return ERROR_FILE_NOT_FOUND first
1035  * if the file doesn't exist
1036  */
1037  GetUrlCacheEntryInfoW( szUrl, NULL, &size );
1039  {
1040  cache_entry = msi_alloc( size );
1041  if ( !GetUrlCacheEntryInfoW( szUrl, cache_entry, &size ) )
1042  {
1043  UINT error = GetLastError();
1044  msi_free( cache_entry );
1045  return error;
1046  }
1047 
1048  lstrcpyW( filename, cache_entry->lpszLocalFileName );
1049  msi_free( cache_entry );
1050  return ERROR_SUCCESS;
1051  }
1052 
1054  if ( FAILED(hr) )
1055  {
1056  WARN("failed to download %s to cache file\n", debugstr_w(szUrl));
1057  return ERROR_FUNCTION_FAILED;
1058  }
1059 
1060  return ERROR_SUCCESS;
1061 }
1062 
1064 {
1065  DWORD time, len, i, offset;
1066  HANDLE handle;
1067 
1068  time = GetTickCount();
1070  lstrcatW( path, L"\\Installer\\" );
1072 
1073  len = lstrlenW(path);
1074  for (i = 0; i < 0x10000; i++)
1075  {
1076  offset = swprintf( path + len, MAX_PATH - len, L"%x", (time + i) & 0xffff );
1077  memcpy( path + len + offset, suffix, (lstrlenW( suffix ) + 1) * sizeof(WCHAR) );
1081  {
1083  break;
1084  }
1085  if (GetLastError() != ERROR_FILE_EXISTS &&
1087  return ERROR_FUNCTION_FAILED;
1088  }
1089 
1090  return ERROR_SUCCESS;
1091 }
1092 
1093 static enum platform parse_platform( const WCHAR *str )
1094 {
1095  if (!str[0] || !wcscmp( str, L"Intel" )) return PLATFORM_INTEL;
1096  else if (!wcscmp( str, L"Intel64" )) return PLATFORM_INTEL64;
1097  else if (!wcscmp( str, L"x64" ) || !wcscmp( str, L"AMD64" )) return PLATFORM_X64;
1098  else if (!wcscmp( str, L"Arm" )) return PLATFORM_ARM;
1099  else if (!wcscmp( str, L"Arm64" )) return PLATFORM_ARM64;
1100  return PLATFORM_UNRECOGNIZED;
1101 }
1102 
1104 {
1105  WCHAR *template, *p, *q, *platform;
1106  DWORD i, count;
1107 
1108  package->version = msi_suminfo_get_int32( si, PID_PAGECOUNT );
1109  TRACE("version: %d\n", package->version);
1110 
1111  template = msi_suminfo_dup_string( si, PID_TEMPLATE );
1112  if (!template)
1113  return ERROR_SUCCESS; /* native accepts missing template property */
1114 
1115  TRACE("template: %s\n", debugstr_w(template));
1116 
1117  p = wcschr( template, ';' );
1118  if (!p)
1119  {
1120  WARN("invalid template string %s\n", debugstr_w(template));
1121  msi_free( template );
1123  }
1124  *p = 0;
1125  platform = template;
1126  if ((q = wcschr( platform, ',' ))) *q = 0;
1127  package->platform = parse_platform( platform );
1128  while (package->platform == PLATFORM_UNRECOGNIZED && q)
1129  {
1130  platform = q + 1;
1131  if ((q = wcschr( platform, ',' ))) *q = 0;
1132  package->platform = parse_platform( platform );
1133  }
1134  if (package->platform == PLATFORM_UNRECOGNIZED)
1135  {
1136  WARN("unknown platform %s\n", debugstr_w(template));
1137  msi_free( template );
1139  }
1140  p++;
1141  if (!*p)
1142  {
1143  msi_free( template );
1144  return ERROR_SUCCESS;
1145  }
1146  count = 1;
1147  for (q = p; (q = wcschr( q, ',' )); q++) count++;
1148 
1149  package->langids = msi_alloc( count * sizeof(LANGID) );
1150  if (!package->langids)
1151  {
1152  msi_free( template );
1153  return ERROR_OUTOFMEMORY;
1154  }
1155 
1156  i = 0;
1157  while (*p)
1158  {
1159  q = wcschr( p, ',' );
1160  if (q) *q = 0;
1161  package->langids[i] = wcstol( p, NULL, 10 );
1162  if (!q) break;
1163  p = q + 1;
1164  i++;
1165  }
1166  package->num_langids = i + 1;
1167 
1168  msi_free( template );
1169  return ERROR_SUCCESS;
1170 }
1171 
1173 {
1174  UINT i;
1175 
1176  if (package->platform == PLATFORM_INTEL64)
1178 #ifndef __arm__
1179  if (package->platform == PLATFORM_ARM)
1181 #endif
1182 #ifndef __aarch64__
1183  if (package->platform == PLATFORM_ARM64)
1185 #endif
1186  if (package->platform == PLATFORM_X64)
1187  {
1188  if (!is_64bit && !is_wow64)
1190  if (package->version < 200)
1192  }
1193  if (!package->num_langids)
1194  {
1195  return ERROR_SUCCESS;
1196  }
1197  for (i = 0; i < package->num_langids; i++)
1198  {
1199  LANGID langid = package->langids[i];
1200 
1201  if (PRIMARYLANGID( langid ) == LANG_NEUTRAL)
1202  {
1204  }
1205  if (SUBLANGID( langid ) == SUBLANG_NEUTRAL)
1206  {
1208  }
1210  return ERROR_SUCCESS;
1211  }
1213 }
1214 
1215 static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop )
1216 {
1217  WCHAR query[MAX_PATH];
1218  MSIQUERY *view;
1219  MSIRECORD *rec;
1220  WCHAR *ret = NULL;
1221 
1222  swprintf(query, ARRAY_SIZE(query), L"SELECT `Value` FROM `Property` WHERE `Property`='%s'", prop);
1224  {
1225  return NULL;
1226  }
1227  if (MSI_ViewExecute( view, 0 ) != ERROR_SUCCESS)
1228  {
1229  MSI_ViewClose( view );
1230  msiobj_release( &view->hdr );
1231  return NULL;
1232  }
1233  if (MSI_ViewFetch( view, &rec ) == ERROR_SUCCESS)
1234  {
1235  ret = strdupW( MSI_RecordGetString( rec, 1 ) );
1236  msiobj_release( &rec->hdr );
1237  }
1238  MSI_ViewClose( view );
1239  msiobj_release( &view->hdr );
1240  return ret;
1241 }
1242 
1244 {
1245  return get_property( db, L"ProductCode" );
1246 }
1247 
1249 {
1250  return get_property( db, L"ProductVersion" );
1251 }
1252 
1253 static UINT get_registered_local_package( const WCHAR *product, WCHAR *localfile )
1254 {
1256  WCHAR *filename;
1257  HKEY props_key;
1258  UINT r;
1259 
1260  r = msi_locate_product( product, &context );
1261  if (r != ERROR_SUCCESS)
1262  return r;
1263 
1264  r = MSIREG_OpenInstallProps( product, context, NULL, &props_key, FALSE );
1265  if (r != ERROR_SUCCESS)
1266  return r;
1267 
1269  RegCloseKey( props_key );
1270  if (!filename)
1271  return ERROR_FUNCTION_FAILED;
1272 
1273  lstrcpyW( localfile, filename );
1274  msi_free( filename );
1275  return ERROR_SUCCESS;
1276 }
1277 
1279 {
1280  WCHAR *ret;
1281  MSISUMMARYINFO *si;
1282  UINT r;
1283 
1284  r = msi_get_suminfo( db->storage, 0, &si );
1285  if (r != ERROR_SUCCESS)
1286  {
1287  r = msi_get_db_suminfo( db, 0, &si );
1288  if (r != ERROR_SUCCESS)
1289  {
1290  WARN("failed to load summary info %u\n", r);
1291  return NULL;
1292  }
1293  }
1295  msiobj_release( &si->hdr );
1296  return ret;
1297 }
1298 
1299 static UINT get_local_package( MSIDATABASE *db, WCHAR *localfile )
1300 {
1301  WCHAR *product_code;
1302  UINT r;
1303 
1304  if (!(product_code = get_product_code( db )))
1306  r = get_registered_local_package( product_code, localfile );
1307  msi_free( product_code );
1308  return r;
1309 }
1310 
1312 {
1313  UINT r;
1314 
1315  if (UrlIsW( package, URLIS_URL ))
1316  r = msi_set_property( db, L"OriginalDatabase", package, -1 );
1317  else if (package[0] == '#')
1318  r = msi_set_property( db, L"OriginalDatabase", db->path, -1 );
1319  else
1320  {
1321  DWORD len;
1322  WCHAR *path;
1323 
1324  if (!(len = GetFullPathNameW( package, 0, NULL, NULL ))) return GetLastError();
1325  if (!(path = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
1326  len = GetFullPathNameW( package, len, path, NULL );
1327  r = msi_set_property( db, L"OriginalDatabase", path, len );
1328  msi_free( path );
1329  }
1330  return r;
1331 }
1332 
1333 #ifdef __REACTOS__
1336 BOOL WINAPI SE_DynamicShim(LPCWSTR ProcessImage, PVOID hsdb, PVOID pQueryResult, LPCSTR Module, LPDWORD lpdwDynamicToken);
1339 
1340 #define HID_DOS_PATHS 0x1
1341 #define SDB_DATABASE_MAIN_SHIM 0x80030000
1342 
1343 #define APPHELP_VALID_RESULT 0x10000
1344 #define APPHELP_RESULT_FOUND 0x40000
1345 
1346 static void
1347 AppHelpCheckPackage(LPCWSTR szPackage)
1348 {
1349  USHORT ExeType = 0;
1350  ULONG Reason = 0;
1351 
1352  PVOID QueryResult = NULL;
1353  ULONG QueryResultSize = 0;
1354 
1355  HANDLE Handle = NULL;
1356  BOOL Continue = ApphelpCheckRunAppEx(
1357  Handle, NULL, NULL, szPackage, NULL, ExeType, &Reason, &QueryResult, &QueryResultSize, NULL,
1358  NULL, NULL, NULL, NULL);
1359 
1360  if (Continue)
1361  {
1363  {
1364  DWORD dwToken;
1366  if (hsdb)
1367  {
1368  BOOL bShim = SE_DynamicShim(szPackage, hsdb, QueryResult, "msi.dll", &dwToken);
1369  ERR("ReactOS HACK: Used SE_DynamicShim %d!\n", bShim);
1370 
1371  SdbReleaseDatabase(hsdb);
1372  }
1373  else
1374  {
1375  ERR("Unable to open SDB_DATABASE_MAIN_SHIM\n");
1376  }
1377  }
1378  }
1379 
1380  if (QueryResult)
1381  RtlFreeHeap(RtlGetProcessHeap(), 0, QueryResult);
1382 }
1383 #endif
1384 
1386 {
1387  MSIDATABASE *db;
1388  MSIPACKAGE *package;
1389  MSIHANDLE handle;
1390  MSIRECORD *data_row, *info_row;
1391  UINT r;
1392  WCHAR localfile[MAX_PATH], cachefile[MAX_PATH];
1393  LPCWSTR file = szPackage;
1394  DWORD index = 0;
1395  MSISUMMARYINFO *si;
1396  BOOL delete_on_close = FALSE;
1397  WCHAR *info_template, *productname, *product_code;
1399 
1400  TRACE("%s %p\n", debugstr_w(szPackage), pPackage);
1401 
1403 
1404  localfile[0] = 0;
1405  if( szPackage[0] == '#' )
1406  {
1407  handle = wcstol(&szPackage[1], NULL, 10);
1409  return ERROR_INVALID_HANDLE;
1410  }
1411  else
1412  {
1413  WCHAR *product_version = NULL;
1414 
1415  if ( UrlIsW( szPackage, URLIS_URL ) )
1416  {
1417  r = msi_download_file( szPackage, cachefile );
1418  if (r != ERROR_SUCCESS)
1419  return r;
1420 
1421  file = cachefile;
1422  }
1423 #ifdef __REACTOS__
1424  AppHelpCheckPackage(file);
1425 #endif
1426 
1428  if (r != ERROR_SUCCESS)
1429  {
1431  return ERROR_FILE_NOT_FOUND;
1432  return r;
1433  }
1434  r = get_local_package( db, localfile );
1435  if (r != ERROR_SUCCESS || GetFileAttributesW( localfile ) == INVALID_FILE_ATTRIBUTES)
1436  {
1437  DWORD localfile_attr;
1438 
1439  r = msi_create_empty_local_file( localfile, L".msi" );
1440  if (r != ERROR_SUCCESS)
1441  {
1442  msiobj_release( &db->hdr );
1443  return r;
1444  }
1445 
1446  if (!CopyFileW( file, localfile, FALSE ))
1447  {
1448  r = GetLastError();
1449  WARN("unable to copy package %s to %s (%u)\n", debugstr_w(file), debugstr_w(localfile), r);
1450  DeleteFileW( localfile );
1451  msiobj_release( &db->hdr );
1452  return r;
1453  }
1454  delete_on_close = TRUE;
1455 
1456  /* Remove read-only bit, we are opening it with write access in MSI_OpenDatabaseW below. */
1457  localfile_attr = GetFileAttributesW( localfile );
1458  if (localfile_attr & FILE_ATTRIBUTE_READONLY)
1459  SetFileAttributesW( localfile, localfile_attr & ~FILE_ATTRIBUTE_READONLY);
1460  }
1462  {
1463  if (!CopyFileW( file, localfile, FALSE ))
1464  {
1465  r = GetLastError();
1466  WARN("unable to update cached package (%u)\n", r);
1467  msiobj_release( &db->hdr );
1468  return r;
1469  }
1470  }
1471  else
1472  product_version = get_product_version( db );
1473  msiobj_release( &db->hdr );
1474  TRACE("opening package %s\n", debugstr_w( localfile ));
1475  r = MSI_OpenDatabaseW( localfile, MSIDBOPEN_TRANSACT, &db );
1476  if (r != ERROR_SUCCESS)
1477  return r;
1478 
1479  if (product_version)
1480  {
1481  WCHAR *cache_version = get_product_version( db );
1482  if (!product_version != !cache_version ||
1483  (product_version && wcscmp(product_version, cache_version)))
1484  {
1485  msiobj_release( &db->hdr );
1486  msi_free(product_version);
1487  msi_free(cache_version);
1488  return ERROR_PRODUCT_VERSION;
1489  }
1490  msi_free(product_version);
1491  msi_free(cache_version);
1492  }
1493  }
1494  package = MSI_CreatePackage( db );
1495  msiobj_release( &db->hdr );
1496  if (!package) return ERROR_INSTALL_PACKAGE_INVALID;
1497  package->localfile = strdupW( localfile );
1498  package->delete_on_close = delete_on_close;
1499 
1500  r = msi_get_suminfo( db->storage, 0, &si );
1501  if (r != ERROR_SUCCESS)
1502  {
1503  r = msi_get_db_suminfo( db, 0, &si );
1504  if (r != ERROR_SUCCESS)
1505  {
1506  WARN("failed to load summary info\n");
1507  msiobj_release( &package->hdr );
1509  }
1510  }
1511  r = parse_suminfo( si, package );
1512  msiobj_release( &si->hdr );
1513  if (r != ERROR_SUCCESS)
1514  {
1515  WARN("failed to parse summary info %u\n", r);
1516  msiobj_release( &package->hdr );
1517  return r;
1518  }
1519  r = validate_package( package );
1520  if (r != ERROR_SUCCESS)
1521  {
1522  msiobj_release( &package->hdr );
1523  return r;
1524  }
1525  msi_set_property( package->db, L"DATABASE", db->path, -1 );
1526  set_installed_prop( package );
1527  msi_set_context( package );
1528 
1529  product_code = get_product_code( db );
1530  if (msi_locate_product( product_code, &context ) == ERROR_SUCCESS)
1531  {
1532  TRACE("product already registered\n");
1533  msi_set_property( package->db, L"ProductToBeRegistered", L"1", -1 );
1534  }
1535  msi_free(product_code);
1536 
1537  while (1)
1538  {
1539  WCHAR patch_code[GUID_SIZE];
1540  r = MsiEnumPatchesExW( package->ProductCode, NULL, package->Context,
1541  MSIPATCHSTATE_APPLIED, index, patch_code, NULL, NULL, NULL, NULL );
1542  if (r != ERROR_SUCCESS)
1543  break;
1544 
1545  TRACE("found registered patch %s\n", debugstr_w(patch_code));
1546 
1547  r = msi_apply_registered_patch( package, patch_code );
1548  if (r != ERROR_SUCCESS)
1549  {
1550  ERR("registered patch failed to apply %u\n", r);
1551  msiobj_release( &package->hdr );
1552  return r;
1553  }
1554  index++;
1555  }
1556  if (index) msi_adjust_privilege_properties( package );
1557 
1558  r = msi_set_original_database_property( package->db, szPackage );
1559  if (r != ERROR_SUCCESS)
1560  {
1561  msiobj_release( &package->hdr );
1562  return r;
1563  }
1564  if (gszLogFile)
1567 
1568  if (!msi_init_assembly_caches( package ))
1569  {
1570  ERR("can't initialize assembly caches\n");
1571  msiobj_release( &package->hdr );
1572  return ERROR_FUNCTION_FAILED;
1573  }
1574 
1575  /* FIXME: when should these messages be sent? */
1576  data_row = MSI_CreateRecord(3);
1577  if (!data_row)
1578  return ERROR_OUTOFMEMORY;
1579  MSI_RecordSetStringW(data_row, 0, NULL);
1580  MSI_RecordSetInteger(data_row, 1, 0);
1581  MSI_RecordSetInteger(data_row, 2, package->num_langids ? package->langids[0] : 0);
1584 
1585  info_row = MSI_CreateRecord(0);
1586  if (!info_row)
1587  {
1588  msiobj_release(&data_row->hdr);
1589  return ERROR_OUTOFMEMORY;
1590  }
1591  info_template = msi_get_error_message(package->db, MSIERR_INFO_LOGGINGSTART);
1592  MSI_RecordSetStringW(info_row, 0, info_template);
1593  msi_free(info_template);
1595 
1596  MSI_ProcessMessage(package, INSTALLMESSAGE_COMMONDATA, data_row);
1597 
1598  productname = msi_dup_property(package->db, INSTALLPROPERTY_PRODUCTNAMEW);
1599  MSI_RecordSetInteger(data_row, 1, 1);
1600  MSI_RecordSetStringW(data_row, 2, productname);
1601  MSI_RecordSetStringW(data_row, 3, NULL);
1602  MSI_ProcessMessage(package, INSTALLMESSAGE_COMMONDATA, data_row);
1603 
1604  msi_free(productname);
1605  msiobj_release(&info_row->hdr);
1606  msiobj_release(&data_row->hdr);
1607 
1608  *pPackage = package;
1609  return ERROR_SUCCESS;
1610 }
1611 
1612 UINT WINAPI MsiOpenPackageExW( const WCHAR *szPackage, DWORD dwOptions, MSIHANDLE *phPackage )
1613 {
1614  MSIPACKAGE *package = NULL;
1615  UINT ret;
1616 
1617  TRACE( "%s, %#lx, %p\n", debugstr_w(szPackage), dwOptions, phPackage );
1618 
1619  if( !szPackage || !phPackage )
1620  return ERROR_INVALID_PARAMETER;
1621 
1622  if ( !*szPackage )
1623  {
1624  FIXME("Should create an empty database and package\n");
1625  return ERROR_FUNCTION_FAILED;
1626  }
1627 
1628  if( dwOptions )
1629  FIXME( "dwOptions %#lx not supported\n", dwOptions );
1630 
1631  ret = MSI_OpenPackageW( szPackage, 0, &package );
1632  if( ret == ERROR_SUCCESS )
1633  {
1634  *phPackage = alloc_msihandle( &package->hdr );
1635  if (! *phPackage)
1637  msiobj_release( &package->hdr );
1638  }
1639  else
1641 
1642  return ret;
1643 }
1644 
1646 {
1647  return MsiOpenPackageExW( szPackage, 0, phPackage );
1648 }
1649 
1651 {
1652  LPWSTR szwPack = NULL;
1653  UINT ret;
1654 
1655  if( szPackage )
1656  {
1657  szwPack = strdupAtoW( szPackage );
1658  if( !szwPack )
1659  return ERROR_OUTOFMEMORY;
1660  }
1661 
1662  ret = MsiOpenPackageExW( szwPack, dwOptions, phPackage );
1663 
1664  msi_free( szwPack );
1665 
1666  return ret;
1667 }
1668 
1670 {
1671  return MsiOpenPackageExA( szPackage, 0, phPackage );
1672 }
1673 
1675 {
1676  MSIPACKAGE *package;
1677  MSIHANDLE handle = 0;
1678  MSIHANDLE remote;
1679 
1680  TRACE( "%lu\n", hInstall );
1681 
1682  package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
1683  if( package)
1684  {
1685  handle = alloc_msihandle( &package->db->hdr );
1686  msiobj_release( &package->hdr );
1687  }
1688  else if ((remote = msi_get_remote(hInstall)))
1689  {
1690  __TRY
1691  {
1692  handle = remote_GetActiveDatabase(remote);
1694  }
1696  {
1697  handle = 0;
1698  }
1699  __ENDTRY
1700  }
1701 
1702  return handle;
1703 }
1704 
1706 {
1707  if (!package || (package->ui_level & INSTALLUILEVEL_MASK) == INSTALLUILEVEL_NONE)
1708  return 0;
1709 
1710  /* todo: check if message needs additional styles (topmost/foreground/modality?) */
1711 
1712  switch (eMessageType & 0xff000000)
1713  {
1715  case INSTALLMESSAGE_ERROR:
1717  if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0;
1718  if (!(eMessageType & MB_ICONMASK))
1719  eMessageType |= MB_ICONEXCLAMATION;
1720  return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff);
1722  if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0;
1723  if (!(eMessageType & MB_ICONMASK))
1724  eMessageType |= MB_ICONASTERISK;
1725  return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff);
1726  case INSTALLMESSAGE_USER:
1727  if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0;
1728  if (!(eMessageType & MB_ICONMASK))
1729  eMessageType |= MB_USERICON;
1730  return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff);
1731  case INSTALLMESSAGE_INFO:
1736  return 0;
1738  {
1740  INT rc = ACTION_DialogBox(package, dialog);
1741  msi_free(dialog);
1742  return rc;
1743  }
1745  {
1746  LPWSTR deformatted;
1747  MSIRECORD *uirow = MSI_CreateRecord(1);
1748  if (!uirow) return -1;
1749  deformat_string(package, MSI_RecordGetString(record, 2), &deformatted);
1750  MSI_RecordSetStringW(uirow, 1, deformatted);
1751  msi_event_fire(package, L"ActionText", uirow);
1752 
1753  msi_free(deformatted);
1754  msiobj_release(&uirow->hdr);
1755  return 1;
1756  }
1758  {
1759  MSIRECORD *uirow = MSI_CreateRecord(1);
1760  if (!uirow) return -1;
1761  MSI_RecordSetStringW(uirow, 1, message);
1762  msi_event_fire(package, L"ActionData", uirow);
1763  msiobj_release(&uirow->hdr);
1764 
1765  if (package->action_progress_increment)
1766  {
1767  uirow = MSI_CreateRecord(2);
1768  if (!uirow) return -1;
1769  MSI_RecordSetInteger(uirow, 1, 2);
1770  MSI_RecordSetInteger(uirow, 2, package->action_progress_increment);
1771  msi_event_fire(package, L"SetProgress", uirow);
1772  msiobj_release(&uirow->hdr);
1773  }
1774  return 1;
1775  }
1777  msi_event_fire(package, L"SetProgress", record);
1778  return 1;
1780  switch (MSI_RecordGetInteger(record, 1))
1781  {
1782  case 0:
1783  case 1:
1784  /* do nothing */
1785  return 0;
1786  default:
1787  /* fall through */
1788  ;
1789  }
1790  default:
1791  FIXME("internal UI not implemented for message 0x%08x (UI level = %x)\n", eMessageType, package->ui_level);
1792  return 0;
1793  }
1794 }
1795 
1796 static const struct
1797 {
1798  int id;
1799  const WCHAR *text;
1800 }
1801 internal_errors[] =
1802 {
1803  {2726, L"DEBUG: Error [1]: Action not found: [2]"},
1804  {0}
1805 };
1806 
1808 {
1809  int i = 0;
1810 
1811  while (internal_errors[i].id != 0)
1812  {
1813  if (internal_errors[i].id == error)
1814  return internal_errors[i].text;
1815  i++;
1816  }
1817 
1818  FIXME("missing error message %d\n", error);
1819  return NULL;
1820 }
1821 
1822 /* Returned string must be freed */
1824 {
1825  MSIRECORD *record;
1826  LPWSTR ret = NULL;
1827 
1828  if ((record = MSI_QueryGetRecord(db, L"SELECT `Message` FROM `Error` WHERE `Error` = %d", error)))
1829  {
1831  msiobj_release(&record->hdr);
1832  }
1833  else if (error < 2000)
1834  {
1836  if (len)
1837  {
1838  ret = msi_alloc((len + 1) * sizeof(WCHAR));
1840  }
1841  else
1842  ret = NULL;
1843  }
1844 
1845  return ret;
1846 }
1847 
1849 {
1850  LPWSTR message = {0};
1851  DWORD len;
1852  DWORD log_type = 1 << (eMessageType >> 24);
1853  UINT res;
1854  INT rc = 0;
1855  char *msg;
1856 
1857  TRACE("%x\n", eMessageType);
1858  if (TRACE_ON(msi)) dump_record(record);
1859 
1860  if (!package || !record)
1861  message = NULL;
1862  else {
1863  res = MSI_FormatRecordW(package, record, message, &len);
1864  if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
1865  return res;
1866  len++;
1867  message = msi_alloc(len * sizeof(WCHAR));
1868  if (!message) return ERROR_OUTOFMEMORY;
1869  MSI_FormatRecordW(package, record, message, &len);
1870  }
1871 
1872  /* convert it to ANSI */
1873  len = WideCharToMultiByte( CP_ACP, 0, message, -1, NULL, 0, NULL, NULL );
1874  msg = msi_alloc( len );
1876 
1877  if (gUIHandlerRecord && (gUIFilterRecord & log_type))
1878  {
1879  MSIHANDLE rec = alloc_msihandle(&record->hdr);
1880  TRACE( "calling UI handler %p(pvContext = %p, iMessageType = %#x, hRecord = %lu)\n",
1881  gUIHandlerRecord, gUIContextRecord, eMessageType, rec );
1882  rc = gUIHandlerRecord( gUIContextRecord, eMessageType, rec );
1883  MsiCloseHandle( rec );
1884  }
1885  if (!rc && gUIHandlerW && (gUIFilter & log_type))
1886  {
1887  TRACE( "calling UI handler %p(pvContext = %p, iMessageType = %#x, szMessage = %s)\n",
1888  gUIHandlerW, gUIContext, eMessageType, debugstr_w(message) );
1889  rc = gUIHandlerW( gUIContext, eMessageType, message );
1890  }
1891  else if (!rc && gUIHandlerA && (gUIFilter & log_type))
1892  {
1893  TRACE( "calling UI handler %p(pvContext = %p, iMessageType = %#x, szMessage = %s)\n",
1894  gUIHandlerA, gUIContext, eMessageType, debugstr_a(msg) );
1895  rc = gUIHandlerA( gUIContext, eMessageType, msg );
1896  }
1897 
1898  if (!rc)
1899  rc = internal_ui_handler(package, eMessageType, record, message);
1900 
1901  if (!rc && package && package->log_file != INVALID_HANDLE_VALUE &&
1902  (eMessageType & 0xff000000) != INSTALLMESSAGE_PROGRESS)
1903  {
1904  DWORD written;
1905  WriteFile( package->log_file, msg, len - 1, &written, NULL );
1906  WriteFile( package->log_file, "\n", 1, &written, NULL );
1907  }
1908  msi_free( msg );
1909  msi_free( message );
1910 
1911  return rc;
1912 }
1913 
1915 {
1916  switch (eMessageType & 0xff000000)
1917  {
1919  case INSTALLMESSAGE_ERROR:
1921  case INSTALLMESSAGE_USER:
1922  case INSTALLMESSAGE_INFO:
1925  {
1926  /* error message */
1927 
1928  LPWSTR template;
1929  LPWSTR template_rec = NULL, template_prefix = NULL;
1930  int error = MSI_RecordGetInteger(record, 1);
1931 
1932  if (MSI_RecordIsNull(record, 0))
1933  {
1934  if (error >= 32)
1935  {
1936  template_rec = msi_get_error_message(package->db, error);
1937 
1938  if (!template_rec && error >= 2000)
1939  {
1940  /* internal error, not localized */
1941  if ((template_rec = (LPWSTR) get_internal_error_message(error)))
1942  {
1943  MSI_RecordSetStringW(record, 0, template_rec);
1945  }
1946  template_rec = msi_get_error_message(package->db, MSIERR_INSTALLERROR);
1947  MSI_RecordSetStringW(record, 0, template_rec);
1948  MSI_ProcessMessageVerbatim(package, eMessageType, record);
1949  msi_free(template_rec);
1950  return 0;
1951  }
1952  }
1953  }
1954  else
1955  template_rec = msi_dup_record_field(record, 0);
1956 
1957  template_prefix = msi_get_error_message(package->db, eMessageType >> 24);
1958  if (!template_prefix) template_prefix = strdupW(L"");
1959 
1960  if (!template_rec)
1961  {
1962  /* always returns 0 */
1963  MSI_RecordSetStringW(record, 0, template_prefix);
1964  MSI_ProcessMessageVerbatim(package, eMessageType, record);
1965  msi_free(template_prefix);
1966  return 0;
1967  }
1968 
1969  template = msi_alloc((lstrlenW(template_rec) + lstrlenW(template_prefix) + 1) * sizeof(WCHAR));
1970  if (!template) return ERROR_OUTOFMEMORY;
1971 
1972  lstrcpyW(template, template_prefix);
1973  lstrcatW(template, template_rec);
1974  MSI_RecordSetStringW(record, 0, template);
1975 
1976  msi_free(template_prefix);
1977  msi_free(template_rec);
1978  msi_free(template);
1979  }
1980  break;
1982  {
1983  WCHAR *template = msi_get_error_message(package->db, MSIERR_ACTIONSTART);
1984  MSI_RecordSetStringW(record, 0, template);
1985  msi_free(template);
1986 
1987  msi_free(package->LastAction);
1988  msi_free(package->LastActionTemplate);
1989  package->LastAction = msi_dup_record_field(record, 1);
1990  if (!package->LastAction) package->LastAction = strdupW(L"");
1992  break;
1993  }
1995  if (package->LastAction && package->LastActionTemplate)
1996  {
1997  size_t len = lstrlenW(package->LastAction) + lstrlenW(package->LastActionTemplate) + 7;
1998  WCHAR *template = msi_alloc(len * sizeof(WCHAR));
1999  if (!template) return ERROR_OUTOFMEMORY;
2000  swprintf(template, len, L"{{%s: }}%s", package->LastAction, package->LastActionTemplate);
2001  MSI_RecordSetStringW(record, 0, template);
2002  msi_free(template);
2003  }
2004  break;
2006  {
2007  WCHAR *template = msi_get_error_message(package->db, MSIERR_COMMONDATA);
2008  MSI_RecordSetStringW(record, 0, template);
2009  msi_free(template);
2010  }
2011  break;
2012  }
2013 
2014  return MSI_ProcessMessageVerbatim(package, eMessageType, record);
2015 }
2016 
2018  MSIHANDLE hRecord)
2019 {
2021  MSIPACKAGE *package = NULL;
2022  MSIRECORD *record = NULL;
2023 
2024  if ((eMessageType & 0xff000000) == INSTALLMESSAGE_INITIALIZE ||
2025  (eMessageType & 0xff000000) == INSTALLMESSAGE_TERMINATE)
2026  return -1;
2027 
2028  if ((eMessageType & 0xff000000) == INSTALLMESSAGE_COMMONDATA &&
2029  MsiRecordGetInteger(hRecord, 1) != 2)
2030  return -1;
2031 
2033  if (!record)
2034  return ERROR_INVALID_HANDLE;
2035 
2036  package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
2037  if( !package )
2038  {
2039  MSIHANDLE remote;
2040 
2041  if (!(remote = msi_get_remote(hInstall)))
2042  return ERROR_INVALID_HANDLE;
2043 
2044  __TRY
2045  {
2046  ret = remote_ProcessMessage(remote, eMessageType, (struct wire_record *)&record->count);
2047  }
2049  {
2050  ret = GetExceptionCode();
2051  }
2052  __ENDTRY
2053 
2054  msiobj_release(&record->hdr);
2055  return ret;
2056  }
2057 
2058  ret = MSI_ProcessMessage( package, eMessageType, record );
2059 
2060  msiobj_release( &record->hdr );
2061  msiobj_release( &package->hdr );
2062  return ret;
2063 }
2064 
2065 /* property code */
2066 
2068 {
2069  LPWSTR szwName = NULL, szwValue = NULL;
2071 
2072  szwName = strdupAtoW( szName );
2073  if( szName && !szwName )
2074  goto end;
2075 
2076  szwValue = strdupAtoW( szValue );
2077  if( szValue && !szwValue )
2078  goto end;
2079 
2080  r = MsiSetPropertyW( hInstall, szwName, szwValue);
2081 
2082 end:
2083  msi_free( szwName );
2084  msi_free( szwValue );
2085 
2086  return r;
2087 }
2088 
2090 {
2091  MSIFOLDER *folder;
2092 
2094  {
2095  msi_free( folder->ResolvedSource );
2096  folder->ResolvedSource = NULL;
2097  }
2098 }
2099 
2101 {
2102  MSIQUERY *view;
2103  MSIRECORD *row = NULL;
2104  DWORD sz = 0;
2105  WCHAR query[1024];
2106  UINT rc;
2107 
2108  TRACE("%p %s %s %d\n", db, debugstr_w(name), debugstr_wn(value, len), len);
2109 
2110  if (!name)
2111  return ERROR_INVALID_PARAMETER;
2112 
2113  /* this one is weird... */
2114  if (!name[0])
2116 
2117  if (value && len < 0) len = lstrlenW( value );
2118 
2119  rc = msi_get_property( db, name, 0, &sz );
2120  if (!value || (!*value && !len))
2121  {
2122  swprintf( query, ARRAY_SIZE(query), L"DELETE FROM `_Property` WHERE `_Property` = '%s'", name );
2123  }
2124  else if (rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS)
2125  {
2126  swprintf( query, ARRAY_SIZE(query), L"UPDATE `_Property` SET `Value` = ? WHERE `_Property` = '%s'", name );
2127  row = MSI_CreateRecord(1);
2129  }
2130  else
2131  {
2132  lstrcpyW( query, L"INSERT INTO `_Property` (`_Property`,`Value`) VALUES (?,?)" );
2133  row = MSI_CreateRecord(2);
2134  msi_record_set_string( row, 1, name, -1 );
2136  }
2137 
2138  rc = MSI_DatabaseOpenViewW(db, query, &view);
2139  if (rc == ERROR_SUCCESS)
2140  {
2141  rc = MSI_ViewExecute(view, row);
2143  msiobj_release(&view->hdr);
2144  }
2145  if (row) msiobj_release(&row->hdr);
2146  return rc;
2147 }
2148 
2150 {
2151  MSIPACKAGE *package;
2152  UINT ret;
2153 
2154  package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
2155  if( !package )
2156  {
2157  MSIHANDLE remote;
2158 
2159  if (!(remote = msi_get_remote(hInstall)))
2160  return ERROR_INVALID_HANDLE;
2161 
2162  __TRY
2163  {
2164  ret = remote_SetProperty(remote, szName, szValue);
2165  }
2167  {
2168  ret = GetExceptionCode();
2169  }
2170  __ENDTRY
2171 
2172  return ret;
2173  }
2174 
2175  ret = msi_set_property( package->db, szName, szValue, -1 );
2176  if (ret == ERROR_SUCCESS && !wcscmp( szName, L"SourceDir" ))
2177  msi_reset_source_folders( package );
2178 
2179  msiobj_release( &package->hdr );
2180  return ret;
2181 }
2182 
2184 {
2185  MSIRECORD *rec, *row = NULL;
2186  MSIQUERY *view;
2187  UINT r;
2188  WCHAR *buffer;
2189  int length;
2190 
2191  if (!name || !*name)
2192  return NULL;
2193 
2194  if (!wcscmp(name, L"Date"))
2195  {
2197  if (!length)
2198  return NULL;
2199  buffer = msi_alloc(length * sizeof(WCHAR));
2201 
2202  row = MSI_CreateRecord(1);
2203  if (!row)
2204  {
2205  msi_free(buffer);
2206  return NULL;
2207  }
2209  msi_free(buffer);
2210  return row;
2211  }
2212  else if (!wcscmp(name, L"Time"))
2213  {
2215  if (!length)
2216  return NULL;
2217  buffer = msi_alloc(length * sizeof(WCHAR));
2219 
2220  row = MSI_CreateRecord(1);
2221  if (!row)
2222  {
2223  msi_free(buffer);
2224  return NULL;
2225  }
2227  msi_free(buffer);
2228  return row;
2229  }
2230 
2231  rec = MSI_CreateRecord(1);
2232  if (!rec)
2233  return NULL;
2234 
2235  MSI_RecordSetStringW(rec, 1, name);
2236 
2237  r = MSI_DatabaseOpenViewW(db, L"SELECT `Value` FROM `_Property` WHERE `_Property`=?", &view);
2238  if (r == ERROR_SUCCESS)
2239  {
2240  MSI_ViewExecute(view, rec);
2241  MSI_ViewFetch(view, &row);
2243  msiobj_release(&view->hdr);
2244  }
2245  msiobj_release(&rec->hdr);
2246  return row;
2247 }
2248 
2249 /* internal function, not compatible with MsiGetPropertyW */
2251  LPWSTR szValueBuf, LPDWORD pchValueBuf )
2252 {
2253  MSIRECORD *row;
2255 
2256  TRACE("%p %s %p %p\n", db, debugstr_w(szName), szValueBuf, pchValueBuf);
2257 
2258  row = msi_get_property_row( db, szName );
2259 
2260  if (*pchValueBuf > 0)
2261  szValueBuf[0] = 0;
2262 
2263  if (row)
2264  {
2265  rc = MSI_RecordGetStringW(row, 1, szValueBuf, pchValueBuf);
2266  msiobj_release(&row->hdr);
2267  }
2268 
2269  if (rc == ERROR_SUCCESS)
2270  TRACE("returning %s for property %s\n", debugstr_wn(szValueBuf, *pchValueBuf),
2271  debugstr_w(szName));
2272  else if (rc == ERROR_MORE_DATA)
2273  TRACE( "need %lu sized buffer for %s\n", *pchValueBuf, debugstr_w(szName) );
2274  else
2275  {
2276  *pchValueBuf = 0;
2277  TRACE("property %s not found\n", debugstr_w(szName));
2278  }
2279 
2280  return rc;
2281 }
2282 
2284 {
2285  DWORD sz = 0;
2286  LPWSTR str;
2287  UINT r;
2288 
2289  r = msi_get_property(db, prop, NULL, &sz);
2290  if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
2291  return NULL;
2292 
2293  sz++;
2294  str = msi_alloc(sz * sizeof(WCHAR));
2295  r = msi_get_property(db, prop, str, &sz);
2296  if (r != ERROR_SUCCESS)
2297  {
2298  msi_free(str);
2299  str = NULL;
2300  }
2301 
2302  return str;
2303 }
2304 
2305 int msi_get_property_int( MSIDATABASE *db, LPCWSTR prop, int def )
2306 {
2307  LPWSTR str = msi_dup_property( db, prop );
2308  int val = str ? wcstol(str, NULL, 10) : def;
2309  msi_free(str);
2310  return val;
2311 }
2312 
2314 {
2315  const WCHAR *value = L"";
2316  MSIPACKAGE *package;
2317  MSIRECORD *row;
2318  WCHAR *nameW;
2319  int len = 0;
2320  UINT r;
2321 
2322  if (!name)
2323  return ERROR_INVALID_PARAMETER;
2324 
2325  if (!(nameW = strdupAtoW(name)))
2326  return ERROR_OUTOFMEMORY;
2327 
2328  package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE);
2329  if (!package)
2330  {
2331  WCHAR *value = NULL, *tmp;
2332  MSIHANDLE remote;
2333  DWORD len;
2334 
2335  if (!(remote = msi_get_remote(hinst)))
2336  {
2337  free(nameW);
2338  return ERROR_INVALID_HANDLE;
2339  }
2340 
2341  __TRY
2342  {
2343  r = remote_GetProperty(remote, nameW, &value, &len);
2344  }
2346  {
2347  r = GetExceptionCode();
2348  }
2349  __ENDTRY
2350 
2351  free(nameW);
2352 
2353  if (!r)
2354  {
2355  /* String might contain embedded nulls.
2356  * Native returns the correct size but truncates the string. */
2357  tmp = calloc(1, (len + 1) * sizeof(WCHAR));
2358  if (!tmp)
2359  {
2361  return ERROR_OUTOFMEMORY;
2362  }
2363  lstrcpyW(tmp, value);
2364 
2365  r = msi_strncpyWtoA(tmp, len, buf, sz, TRUE);
2366 
2367  free(tmp);
2368  }
2370  return r;
2371  }
2372 
2373  row = msi_get_property_row(package->db, nameW);
2374  if (row)
2376 
2377  r = msi_strncpyWtoA(value, len, buf, sz, FALSE);
2378 
2379  free(nameW);
2380  if (row) msiobj_release(&row->hdr);
2381  msiobj_release(&package->hdr);
2382  return r;
2383 }
2384 
2386 {
2387  const WCHAR *value = L"";
2388  MSIPACKAGE *package;
2389  MSIRECORD *row;
2390  int len = 0;
2391  UINT r;
2392 
2393  if (!name)
2394  return ERROR_INVALID_PARAMETER;
2395 
2396  package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE);
2397  if (!package)
2398  {
2399  WCHAR *value = NULL, *tmp;
2400  MSIHANDLE remote;
2401  DWORD len;
2402 
2403  if (!(remote = msi_get_remote(hinst)))
2404  return ERROR_INVALID_HANDLE;
2405 
2406  __TRY
2407  {
2408  r = remote_GetProperty(remote, name, &value, &len);
2409  }
2411  {
2412  r = GetExceptionCode();
2413  }
2414  __ENDTRY
2415 
2416  if (!r)
2417  {
2418  /* String might contain embedded nulls.
2419  * Native returns the correct size but truncates the string. */
2420  tmp = calloc(1, (len + 1) * sizeof(WCHAR));
2421  if (!tmp)
2422  {
2424  return ERROR_OUTOFMEMORY;
2425  }
2426  lstrcpyW(tmp, value);
2427 
2428  r = msi_strncpyW(tmp, len, buf, sz);
2429 
2430  free(tmp);
2431  }
2433  return r;
2434  }
2435 
2436  row = msi_get_property_row(package->db, name);
2437  if (row)
2439 
2440  r = msi_strncpyW(value, len, buf, sz);
2441 
2442  if (row) msiobj_release(&row->hdr);
2443  msiobj_release(&package->hdr);
2444  return r;
2445 }
2446 
2448 {
2449  return MsiGetActiveDatabase(hinst);
2450 }
2451 
2453 {
2454  WCHAR empty[1];
2455  UINT r;
2456 
2457  *size = 0;
2459  if (r == ERROR_MORE_DATA)
2460  {
2461  ++*size;
2462  *value = midl_user_allocate(*size * sizeof(WCHAR));
2463  if (!*value)
2464  return ERROR_OUTOFMEMORY;
2466  }
2467  return r;
2468 }
2469 
2471 {
2472  return MsiSetPropertyW(hinst, property, value);
2473 }
2474 
2476 {
2477  MSIHANDLE rec;
2478  int ret;
2479  UINT r;
2480 
2481  if ((r = unmarshal_record(remote_rec, &rec)))
2482  return r;
2483 
2485 
2486  MsiCloseHandle(rec);
2487  return ret;
2488 }
2489 
2491 {
2492  return MsiDoActionW(hinst, action);
2493 }
2494 
2496 {
2497  return MsiSequenceW(hinst, table, sequence);
2498 }
2499 
2501 {
2502  WCHAR empty[1];
2503  DWORD size = 0;
2504  UINT r;
2505 
2507  if (r == ERROR_MORE_DATA)
2508  {
2509  *value = midl_user_allocate(++size * sizeof(WCHAR));
2510  if (!*value)
2511  return ERROR_OUTOFMEMORY;
2513  }
2514  return r;
2515 }
2516 
2518 {
2519  return MsiSetTargetPathW(hinst, folder, value);
2520 }
2521 
2523 {
2524  WCHAR empty[1];
2525  DWORD size = 1;
2526  UINT r;
2527 
2529  if (r == ERROR_MORE_DATA)
2530  {
2531  *value = midl_user_allocate(++size * sizeof(WCHAR));
2532  if (!*value)
2533  return ERROR_OUTOFMEMORY;
2535  }
2536  return r;
2537 }
2538 
2540 {
2541  return MsiGetMode(hinst, mode);
2542 }
2543 
2545 {
2546  return MsiSetMode(hinst, mode, state);
2547 }
2548 
2550  INSTALLSTATE *installed, INSTALLSTATE *action)
2551 {
2552  return MsiGetFeatureStateW(hinst, feature, installed, action);
2553 }
2554 
2556 {
2558 }
2559 
2561  INSTALLSTATE *installed, INSTALLSTATE *action)
2562 {
2563  return MsiGetComponentStateW(hinst, component, installed, action);
2564 }
2565 
2567 {
2568  return MsiSetComponentStateW(hinst, component, state);
2569 }
2570 
2572 {
2573  return MsiGetLanguage(hinst);
2574 }
2575 
2577 {
2578  return MsiSetInstallLevel(hinst, level);
2579 }
2580 
2582 {
2583  WCHAR empty[1];
2584  DWORD size = 0;
2585  MSIHANDLE rec;
2586  UINT r;
2587 
2588  if ((r = unmarshal_record(remote_rec, &rec)))
2589  return r;
2590 
2591  r = MsiFormatRecordW(hinst, rec, empty, &size);
2592  if (r == ERROR_MORE_DATA)
2593  {
2594  *value = midl_user_allocate(++size * sizeof(WCHAR));
2595  if (!*value)
2596  {
2597  MsiCloseHandle(rec);
2598  return ERROR_OUTOFMEMORY;
2599  }
2600  r = MsiFormatRecordW(hinst, rec, *value, &size);
2601  }
2602 
2603  MsiCloseHandle(rec);
2604  return r;
2605 }
2606 
2608 {
2610 }
2611 
2613  MSICOSTTREE cost_tree, INSTALLSTATE state, INT *cost)
2614 {
2615  return MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost);
2616 }
2617 
2620 {
2621  DWORD size = 3;
2622  return MsiEnumComponentCostsW(hinst, component, index, state, drive, &size, cost, temp);
2623 }
2624 
2627 {
2629 
2631  {
2632  if (!wcscmp( info->value, value )) return ERROR_SUCCESS;
2633  }
2634 
2635  info = msi_alloc(sizeof(MSISOURCELISTINFO));
2636  if (!info)
2637  return ERROR_OUTOFMEMORY;
2638 
2639  info->context = context;
2640  info->options = options;
2641  info->property = property;
2642  info->value = strdupW(value);
2643  list_add_head(&package->sourcelist_info, &info->entry);
2644 
2645  return ERROR_SUCCESS;
2646 }
2647 
2649  DWORD disk_id, LPWSTR volume_label, LPWSTR disk_prompt)
2650 {
2651  MSIMEDIADISK *disk;
2652 
2654  {
2655  if (disk->disk_id == disk_id) return ERROR_SUCCESS;
2656  }
2657 
2658  disk = msi_alloc(sizeof(MSIMEDIADISK));
2659  if (!disk)
2660  return ERROR_OUTOFMEMORY;
2661 
2662  disk->context = context;
2663  disk->options = options;
2664  disk->disk_id = disk_id;
2666  disk->disk_prompt = strdupW(disk_prompt);
2667  list_add_head(&package->sourcelist_media, &disk->entry);
2668 
2669  return ERROR_SUCCESS;
2670 }
LPWSTR msi_suminfo_dup_string(MSISUMMARYINFO *si, UINT uiProperty) DECLSPEC_HIDDEN
Definition: suminfo.c:696
void msiobj_addref(MSIOBJECTHDR *info)
Definition: handle.c:217
LPWSTR Argument
Definition: msipriv.h:705
#define MB_ICONMASK
Definition: winuser.h:813
#define __EXCEPT(func)
Definition: exception.h:84
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
LPWSTR ProductCode
Definition: msipriv.h:448
UINT __cdecl s_remote_Sequence(MSIHANDLE hinst, LPCWSTR table, int sequence)
Definition: package.c:2495
#define MB_ICONHAND
Definition: winuser.h:782
UINT msi_get_db_suminfo(MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **si) DECLSPEC_HIDDEN
Definition: suminfo.c:487
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define PID_TEMPLATE
Definition: suminfo.c:49
DWORD disk_id
Definition: msipriv.h:171
UINT msi_package_add_media_disk(MSIPACKAGE *package, DWORD context, DWORD options, DWORD disk_id, LPWSTR volume_label, LPWSTR disk_prompt)
Definition: package.c:2648
DWORD dwOptions
Definition: solitaire.cpp:24
UINT WINAPI MsiEnumComponentCostsW(MSIHANDLE handle, const WCHAR *component, DWORD index, INSTALLSTATE state, WCHAR *drive, DWORD *buflen, int *cost, int *temp)
Definition: msi.c:1964
INTERNETFEATURELIST feature
Definition: misc.c:1719
#define MSIDBOPEN_READONLY
Definition: msiquery.h:66
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:269
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
MSIHANDLE msi_get_remote(MSIHANDLE handle)
Definition: handle.c:183
#define ERROR_INSTALL_LANGUAGE_UNSUPPORTED
Definition: winerror.h:981
UINT WINAPI MsiOpenPackageA(LPCSTR szPackage, MSIHANDLE *phPackage)
Definition: package.c:1669
#define BITSPIXEL
Definition: wingdi.h:720
const uint16_t * PCWSTR
Definition: typedefs.h:57
GLint level
Definition: gl.h:1546
enum platform platform
Definition: msipriv.h:396
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:47
static const WCHAR szName[]
Definition: powrprof.c:45
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define midl_user_free
Definition: rpc.h:45
int INSTALLMESSAGE
Definition: winemsi.idl:28
UINT __cdecl s_remote_GetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value)
Definition: package.c:2500
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:783
#define HORZRES
Definition: wingdi.h:716
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:238
Definition: tftpd.h:59
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
UINT WINAPI MsiSetPropertyW(MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue)
Definition: package.c:2149
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG FusionFlags
Definition: env.c:47
Definition: pdh_main.c:93
UINT MSI_RecordSetStringW(MSIRECORD *, UINT, LPCWSTR) DECLSPEC_HIDDEN
Definition: record.c:597
#define CloseHandle
Definition: compat.h:598
UINT msi_apply_registered_patch(MSIPACKAGE *package, LPCWSTR patch_code) DECLSPEC_HIDDEN
Definition: patch.c:990
Definition: fci.c:115
enum script script
Definition: msipriv.h:432
#define WINE_OPENPACKAGEFLAGS_RECACHE
Definition: msipriv.h:883
UINT WINAPI MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, WCHAR *szResult, DWORD *sz)
Definition: format.c:900
enum _SID_NAME_USE SID_NAME_USE
UINT MSI_RecordCopyField(MSIRECORD *, UINT, MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:166
UINT WINAPI MsiSetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue)
Definition: package.c:2067
WCHAR * msi_get_package_code(MSIDATABASE *db)
Definition: package.c:1278
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:158
#define ERROR_SUCCESS
Definition: deptool.c:10
enum tagMSIINSTALLCONTEXT MSIINSTALLCONTEXT
Definition: action.c:49
#define WideCharToMultiByte
Definition: compat.h:111
LPWSTR msi_reg_get_val_str(HKEY hkey, LPCWSTR name) DECLSPEC_HIDDEN
Definition: registry.c:243
BOOL is_wow64
Definition: msi.c:54
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
LANGID __cdecl s_remote_GetLanguage(MSIHANDLE hinst)
Definition: package.c:2571
#define __cdecl
Definition: accygwin.h:79
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
MSIASSEMBLY * assembly
Definition: msipriv.h:540
static IN LPSTR IN PVOID Unk2
Definition: ldrinit.c:47
Definition: http.c:7251
#define CSIDL_MYPICTURES
Definition: shlobj.h:2050
HDC WINAPI GetDC(_In_opt_ HWND)
UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out) DECLSPEC_HIDDEN
Definition: record.c:1095
MSIOBJECTHDR hdr
Definition: msipriv.h:393
struct list entry
Definition: msipriv.h:524
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
#define midl_user_allocate
Definition: rpc.h:44
VOID WINAPI GetNativeSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:206
UINT LastActionResult
Definition: msipriv.h:412
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
GLsizei const GLchar ** path
Definition: glext.h:7234
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
struct list entry
Definition: msipriv.h:710
static enum platform parse_platform(const WCHAR *str)
Definition: package.c:1093
MSIOBJECTHDR hdr
Definition: msipriv.h:151
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int WINAPI MsiRecordGetInteger(MSIHANDLE handle, UINT iField)
Definition: record.c:237
#define LANG_NEUTRAL
Definition: nls.h:22
struct list RunningActions
Definition: msipriv.h:440
const WCHAR * text
Definition: package.c:1799
#define CP_ACP
Definition: compat.h:109
#define LOCALE_USER_DEFAULT
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LPWSTR * unique_actions
Definition: msipriv.h:435
#define DATE_SHORTDATE
Definition: winnls.h:196
GLuint GLuint GLsizei count
Definition: gl.h:1545
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
Definition: database.c:140
#define free
Definition: debug_ros.c:5
struct file_info manifest
Definition: actctx.c:469
LPWSTR IconPath
Definition: msipriv.h:660
UINT msi_parse_command_line(MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case)
Definition: action.c:214
HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR)
Definition: hsdb.c:369
LPWSTR PackagePath
Definition: msipriv.h:447
#define WARN(fmt,...)
Definition: debug.h:112
HANDLE log_file
Definition: msipriv.h:414
LPWSTR LastAction
Definition: msipriv.h:410
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
UINT MSI_RecordGetStringW(MSIRECORD *, UINT, LPWSTR, LPDWORD) DECLSPEC_HIDDEN
void msi_free_action_script(MSIPACKAGE *package, UINT script)
Definition: package.c:138
MSICONDITION WINAPI MsiEvaluateConditionW(MSIHANDLE, LPCWSTR)
UINT MSI_ViewExecute(MSIQUERY *, MSIRECORD *) DECLSPEC_HIDDEN
Definition: msiquery.c:502
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
BOOL msi_is_global_assembly(MSICOMPONENT *comp)
Definition: action.c:2037
static HDC
Definition: imagelist.c:92
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
MSIPACKAGE * MSI_CreatePackage(MSIDATABASE *db)
Definition: package.c:978
int MSICONDITION
Definition: winemsi.idl:29
UINT __cdecl s_remote_GetComponentState(MSIHANDLE hinst, LPCWSTR component, INSTALLSTATE *installed, INSTALLSTATE *action)
Definition: package.c:2560
INSTALLUI_HANDLERW gUIHandlerW
Definition: msi_main.c:44
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
static UINT get_registered_local_package(const WCHAR *product, WCHAR *localfile)
Definition: package.c:1253
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define IDS_ERROR_BASE
Definition: resource.h:33
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
void msi_dialog_destroy(msi_dialog *dialog)
Definition: dialog.c:4120
GLuint buffer
Definition: glext.h:5915
UINT MSI_FormatRecordW(MSIPACKAGE *package, MSIRECORD *record, LPWSTR buffer, LPDWORD size)
Definition: format.c:838
#define MSI_NULL_INTEGER
Definition: msiquery.h:32
INT ACTION_DialogBox(MSIPACKAGE *package, const WCHAR *dialog)
Definition: dialog.c:4548
INSTALLUILEVEL gUILevel
Definition: msi_main.c:41
static void msi_free(void *mem)
Definition: msipriv.h:1159
struct list folders
Definition: msipriv.h:406
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
UINT msi_set_context(MSIPACKAGE *package)
Definition: action.c:396
WORD LANGID
Definition: typedefs.h:81
UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, const WCHAR *szComponent, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
Definition: install.c:1501
static void free_folder(MSIFOLDER *folder)
Definition: package.c:87
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
__u16 time
Definition: mkdosfs.c:366
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
LPWSTR KeyPath
Definition: msipriv.h:530
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define MSIHANDLETYPE_DATABASE
Definition: msipriv.h:722
static void free_assembly(MSIASSEMBLY *assembly)
Definition: package.c:127
UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options, LPCWSTR property, LPWSTR value)
Definition: package.c:2625
#define PID_REVNUMBER
Definition: suminfo.c:51
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3382
Definition: svc_auth_des.c:77
LPCWSTR LPCWSTR LPCWSTR DWORD PSDBQUERYRESULT_VISTA pQueryResult
Definition: env.c:37
#define SUBLANG_NEUTRAL
Definition: nls.h:167
const char * filename
Definition: ioapi.h:135
#define CSIDL_FONTS
Definition: shlobj.h:2031
LANGID langid
Definition: msctf.idl:605
#define lstrlenW
Definition: compat.h:609
UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD *sz)
Definition: package.c:2313
LPWSTR FileTypeMask
Definition: msipriv.h:659
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
struct list files
Definition: msipriv.h:403
static const BOOL is_64bit
Definition: msipriv.h:44
RPC_STATUS WINAPI RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, UINT WaitForCallsToComplete)
Definition: rpc_server.c:1202
static const WCHAR INSTALLPROPERTY_LOCALPACKAGEW[]
Definition: msi.h:343
__u8 volume_label[11]
Definition: mkdosfs.c:362
#define LCID_INSTALLED
Definition: winnls.h:201
static LPCWSTR get_internal_error_message(int error)
Definition: package.c:1807
#define ERROR_INSTALL_PLATFORM_UNSUPPORTED
Definition: winerror.h:991
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
static void free_package_structures(MSIPACKAGE *package)
Definition: package.c:149
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
UINT msi_strncpyW(const WCHAR *str, int len, WCHAR *buf, DWORD *sz)
Definition: install.c:213
UINT __cdecl s_remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec, LPWSTR *value)
Definition: package.c:2581
UINT WINAPI MsiOpenPackageExA(LPCSTR szPackage, DWORD dwOptions, MSIHANDLE *phPackage)
Definition: package.c:1650
UINT msi_strncpyWtoA(const WCHAR *str, int lenW, char *buf, DWORD *sz, BOOL remote)
Definition: install.c:190
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define SDB_DATABASE_MAIN_SHIM
Definition: apphelp.h:24
struct list tempfiles
Definition: msipriv.h:405
struct list entry
Definition: msipriv.h:553
int msi_get_property_int(MSIDATABASE *db, LPCWSTR prop, int def)
Definition: package.c:2305
void msi_adjust_privilege_properties(MSIPACKAGE *package)
Definition: package.c:965
#define CSIDL_RECENT
Definition: shlobj.h:2020
LPWSTR suffix
Definition: msipriv.h:713
UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:692
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPWSTR clsid
Definition: msipriv.h:714
void msi_reset_source_folders(MSIPACKAGE *package)
Definition: package.c:2089
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWORD *sz)
Definition: package.c:2385
#define L(x)
Definition: ntvdm.h:50
UINT MSI_RecordSetInteger(MSIRECORD *, UINT, int) DECLSPEC_HIDDEN
Definition: record.c:280
static UINT get_local_package(MSIDATABASE *db, WCHAR *localfile)
Definition: package.c:1299
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, LPCWSTR szFolderPath)
Definition: install.c:600
static struct externalui_message * sequence
Definition: package.c:8795
void msi_event_cleanup_all_subscriptions(MSIPACKAGE *package)
Definition: dialog.c:4173
IStorage * storage
Definition: msipriv.h:194
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
Definition: install.c:670
_In_ FLONG fl
Definition: winddi.h:1279
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
Definition: package.c:1674
UINT MSI_ViewFetch(MSIQUERY *, MSIRECORD **) DECLSPEC_HIDDEN
Definition: msiquery.c:377
int id
Definition: package.c:1798
LPWSTR path
Definition: msipriv.h:112
#define FALSE
Definition: types.h:117
UINT __cdecl s_remote_EnumComponentCosts(MSIHANDLE hinst, LPCWSTR component, DWORD index, INSTALLSTATE state, LPWSTR drive, INT *cost, INT *temp)
Definition: package.c:2618
BOOL WINAPI SE_DynamicShim(LPCWSTR ProcessImage, HSDB hsdb, PVOID pQueryResult, LPCSTR Module, LPDWORD lpdwDynamicToken)
Definition: shimeng.c:1485
UINT __cdecl s_remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value, DWORD *size)
Definition: package.c:2452
#define CSIDL_FAVORITES
Definition: shlobj.h:2018
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
struct list entry
Definition: msipriv.h:192
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG PULONG64 SomeFlag1
Definition: env.c:47
unsigned int BOOL
Definition: ntddk_ex.h:94
struct list sourcelist_info
Definition: msipriv.h:463
string_table * strings
Definition: msipriv.h:110
long LONG
Definition: pedump.c:60
BOOL MSI_RecordIsNull(MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:321
UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
Definition: install.c:763
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define MB_USERICON
Definition: winuser.h:777
struct list entry
Definition: msipriv.h:701
UINT __cdecl s_remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state)
Definition: package.c:2544
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define GENERIC_WRITE
Definition: nt_native.h:90
unsigned long MSIHANDLE
Definition: winemsi.idl:24
INT MSI_ProcessMessage(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIRECORD *record)
Definition: package.c:1914
#define debugstr_w
Definition: kernel32.h:32
#define ERROR_PATCH_PACKAGE_INVALID
Definition: winerror.h:994
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static WCHAR * get_product_code(MSIDATABASE *db)
Definition: package.c:1243
void msi_event_fire(MSIPACKAGE *package, const WCHAR *event, MSIRECORD *rec)
Definition: dialog.c:4483
static PVOID ptr
Definition: dispmode.c:27
LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: custom.c:85
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
struct list sourcelist_media
Definition: msipriv.h:464
void msi_destroy_assembly_caches(MSIPACKAGE *package)
Definition: assembly.c:92
GLenum condition
Definition: glext.h:9255
char * appid
Definition: mkisofs.c:161
WCHAR * path
Definition: msipriv.h:632
const WCHAR * str
UINT WINAPI MsiDoActionW(MSIHANDLE hInstall, LPCWSTR szAction)
Definition: install.c:64
MSICONDITION __cdecl s_remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition)
Definition: package.c:2607
INSTALLUI_HANDLER_RECORD gUIHandlerRecord
Definition: msi_main.c:45
#define MSIHANDLETYPE_RECORD
Definition: msipriv.h:725
LPWSTR Command
Definition: msipriv.h:704
static const WCHAR version[]
Definition: asmname.c:66
struct list binaries
Definition: msipriv.h:407
UINT msi_get_suminfo(IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **si) DECLSPEC_HIDDEN
Definition: suminfo.c:457
char ext[3]
Definition: mkdosfs.c:358
static UINT msi_load_admin_properties(MSIPACKAGE *package)
Definition: package.c:950
script
Definition: msipriv.h:382
#define CSIDL_WINDOWS
Definition: shlobj.h:2047
INT WINAPI MsiProcessMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, MSIHANDLE hRecord)
Definition: package.c:2017
static LPWSTR get_fusion_filename(MSIPACKAGE *package)
Definition: package.c:522
UINT WINAPI MsiEnumPatchesExW(const WCHAR *szProductCode, const WCHAR *szUserSid, DWORD dwContext, DWORD dwFilter, DWORD dwIndex, WCHAR *szPatchCode, WCHAR *szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext, WCHAR *szTargetUserSid, DWORD *pcchTargetUserSid)
Definition: registry.c:1963
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:433
GLuint index
Definition: glext.h:6031
void msi_free_patchinfo(MSIPATCHINFO *patch) DECLSPEC_HIDDEN
Definition: patch.c:865
const char * LPCSTR
Definition: xmlstorage.h:183
#define __TRY
Definition: compat.h:80
UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, const WCHAR *szFeature, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
Definition: install.c:1088
struct CFFOLDER folder
Definition: fdi.c:102
int __cdecl s_remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, struct wire_record *remote_rec)
Definition: package.c:2475
UINT WordCount
Definition: msipriv.h:458
struct list mimes
Definition: msipriv.h:429
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
int options
Definition: main.c:106
#define OPEN_EXISTING
Definition: compat.h:634
LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop)
Definition: package.c:2283
GLuint GLfloat * val
Definition: glext.h:7180
UINT MSI_ViewClose(MSIQUERY *) DECLSPEC_HIDDEN
Definition: msiquery.c:454
platform
Definition: msipriv.h:363
BOOL __cdecl s_remote_GetMode(MSIHANDLE hinst, MSIRUNMODE mode)
Definition: package.c:2539
static const WCHAR nameW[]
Definition: main.c:46
static WCHAR username[]
Definition: url.c:32
MSIRECORD *WINAPIV MSI_QueryGetRecord(MSIDATABASE *db, LPCWSTR query,...) DECLSPEC_HIDDEN
Definition: msiquery.c:201
UINT __cdecl s_remote_GetSourcePath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value)
Definition: package.c:2522
DWORD context
Definition: msipriv.h:169
static MSIPACKAGE * msi_alloc_package(void)
Definition: package.c:919
UINT __cdecl s_remote_DoAction(MSIHANDLE hinst, LPCWSTR action)
Definition: package.c:2490
LPWSTR DefInprocHandler
Definition: msipriv.h:661
UINT msi_download_file(LPCWSTR szUrl, LPWSTR filename)
Definition: package.c:1027
UINT __cdecl s_remote_SetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPCWSTR value)
Definition: package.c:2517
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
void dump_record(MSIRECORD *) DECLSPEC_HIDDEN
Definition: record.c:1028
DWORD deformat_string(MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data)
Definition: format.c:1016
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define TRACE(s)
Definition: solgame.cpp:4
static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIRECORD *record, LPCWSTR message)
Definition: package.c:1705
#define ERROR_INSTALL_PACKAGE_INVALID
Definition: winerror.h:978
GLsizeiptr size
Definition: glext.h:5919
LPWSTR Context
Definition: msipriv.h:653
static void translate(POINT *pt, UINT count, const XFORM *xform)
Definition: metafile.c:2586
ULONG dwMajorVersion
Definition: rtltypes.h:247
struct list features
Definition: msipriv.h:402
LPWSTR LastActionTemplate
Definition: msipriv.h:411
LPWSTR Directory
Definition: msipriv.h:527
struct list classes
Definition: msipriv.h:426
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
LPWSTR * script_actions[SCRIPT_MAX]
Definition: msipriv.h:433
#define MSIERR_INFO_LOGGINGSTART
Definition: resource.h:24
LPWSTR ProgIDText
Definition: msipriv.h:656
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
BOOL msi_init_assembly_caches(MSIPACKAGE *package)
Definition: assembly.c:56
#define PID_PAGECOUNT
Definition: suminfo.c:56
#define CSIDL_ADMINTOOLS
Definition: shlobj.h:2059
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD options
Definition: msipriv.h:170
#define debugstr_a
Definition: kernel32.h:31
LPVOID gUIContext
Definition: msi_main.c:48
LONG HRESULT
Definition: typedefs.h:79
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
INSTALLUILEVEL ui_level
Definition: msipriv.h:452
GLintptr offset
Definition: glext.h:5920
#define CSIDL_LOCAL_APPDATA
Definition: shlobj.h:2039
LPWSTR localfile
Definition: msipriv.h:449
struct list appids
Definition: msipriv.h:430
#define CSIDL_SENDTO
Definition: shlobj.h:2021
#define CSIDL_APPDATA
Definition: shlobj.h:2037
LPWSTR Description
Definition: msipriv.h:657
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent, INSTALLSTATE iState)
Definition: install.c:1463
#define WINAPI
Definition: msvc.h:6
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: lang.c:755
UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
Definition: msi.c:56
unsigned short WORD
Definition: ntddk_ex.h:93
UINT msi_create_empty_local_file(LPWSTR path, LPCWSTR suffix)
Definition: package.c:1063
unsigned long DWORD
Definition: ntddk_ex.h:95
struct list progids
Definition: msipriv.h:428
UINT __cdecl s_remote_SetFeatureState(MSIHANDLE hinst, LPCWSTR feature, INSTALLSTATE state)
Definition: package.c:2555
UINT WINAPI MsiGetTargetPathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD *sz)
Definition: install.c:311
HINSTANCE msi_hInstance
Definition: msi_main.c:51
WCHAR * gszLogFile
Definition: msi_main.c:50
#define MSIDBOPEN_TRANSACT
Definition: msiquery.h:67
BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:2012
UINT WINAPI MsiOpenPackageW(LPCWSTR szPackage, MSIHANDLE *phPackage)
Definition: package.c:1645
MSIDATABASE * db
Definition: msipriv.h:394
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
static UINT validate_package(MSIPACKAGE *package)
Definition: package.c:1172
static IN LPSTR Unk1
Definition: ldrinit.c:47
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
int unique_actions_count
Definition: msipriv.h:436
HWND gUIhwnd
Definition: msi_main.c:42
static const struct @489 internal_errors[]
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
UINT msi_clone_properties(MSIDATABASE *db)
Definition: package.c:382
MSIOBJECTHDR hdr
Definition: msipriv.h:129
static void free_extension(MSIEXTENSION *ext)
Definition: package.c:107
LANGID * langids
Definition: msipriv.h:398
#define MB_ICONASTERISK
Definition: winuser.h:778
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
INSTALLUI_HANDLERA gUIHandlerA
Definition: msi_main.c:43
_In_opt_ PVOID _In_ ULONG _In_ PVOID context
Definition: wdfdriver.h:113
struct tagLANGANDCODEPAGE LANGANDCODEPAGE
GLbitfield flags
Definition: glext.h:7161
MSIOBJECTHDR hdr
Definition: msipriv.h:486
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define MSIERR_INSTALLERROR
Definition: resource.h:21
#define HID_DOS_PATHS
Definition: apphelp.h:19
LPWSTR Component
Definition: msipriv.h:525
GLuint GLuint end
Definition: gl.h:1545
struct list components
Definition: msipriv.h:401
ULONG dwBuildNumber
Definition: rtltypes.h:249
static void MSI_FreePackage(MSIOBJECTHDR *arg)
Definition: package.c:340
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: lang.c:1552
LPVOID gUIContextRecord
Definition: msi_main.c:49
#define __ENDTRY
Definition: compat.h:82
int ret
MSIRECORD * MSI_CreateRecord(UINT) DECLSPEC_HIDDEN
Definition: record.c:76
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2421
#define CSIDL_COMMON_APPDATA
Definition: shlobj.h:2046
UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel)
Definition: install.c:1597
static VOID set_installer_properties(MSIPACKAGE *package)
Definition: package.c:632
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:611
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define INSTALLUILEVEL_MASK
Definition: msipriv.h:60
static int state
Definition: maze.c:121
uint32_t entry
Definition: isohybrid.c:63
void WINAPI SdbReleaseDatabase(HSDB)
Definition: hsdb.c:417
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
WORD wProcessorLevel
Definition: winbase.h:1165
Definition: _list.h:228
UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
Definition: package.c:1385
struct list entry
Definition: msipriv.h:200
int INSTALLSTATE
Definition: winemsi.idl:31
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis)
Definition: url.c:1933
MSIHANDLE __cdecl s_remote_GetActiveDatabase(MSIHANDLE hinst)
Definition: package.c:2447
int _cdecl swprintf(const WCHAR *,...)
UINT msi_get_property(MSIDATABASE *db, LPCWSTR szName, LPWSTR szValueBuf, LPDWORD pchValueBuf)
Definition: package.c:2250
GLenum mode
Definition: glext.h:6217
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define debugstr_wn
Definition: kernel32.h:33
unsigned char BYTE
Definition: xxhash.c:193
LPWSTR disk_prompt
Definition: msipriv.h:173
ULONG dwPlatformId
Definition: rtltypes.h:250
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
static const WCHAR INSTALLPROPERTY_PRODUCTNAMEW[]
Definition: msi.h:277
UINT __cdecl s_remote_GetFeatureState(MSIHANDLE hinst, LPCWSTR feature, INSTALLSTATE *installed, INSTALLSTATE *action)
Definition: package.c:2549
#define MSI_MAJORVERSION
Definition: msipriv.h:729
struct list entry
Definition: msipriv.h:625
INT MSI_ProcessMessageVerbatim(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIRECORD *record)
Definition: package.c:1848
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
LPWSTR Condition
Definition: msipriv.h:529
#define CSIDL_STARTUP
Definition: shlobj.h:2019
#define PROCESSOR_ARCHITECTURE_INTEL
Definition: ketypes.h:105
struct list extensions
Definition: msipriv.h:427
struct list cabinet_streams
Definition: msipriv.h:408
void custom_stop_server(HANDLE process, HANDLE pipe)
Definition: custom.c:681
int MSI_RecordGetInteger(MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:213
const WCHAR * msi_record_get_string(const MSIRECORD *, UINT, int *) DECLSPEC_HIDDEN
Definition: record.c:420
#define ERR(fmt,...)
Definition: debug.h:110
LPWSTR ComponentId
Definition: msipriv.h:526
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1230
struct list subscriptions
Definition: msipriv.h:461
UINT num_langids
Definition: msipriv.h:397
LPWSTR clsid
Definition: msipriv.h:652
PVOID PVOID PWCHAR ApplicationName
Definition: env.c:47
LPWSTR ActionFormat
Definition: msipriv.h:409
const WCHAR * action
Definition: action.c:7479
int script_actions_count[SCRIPT_MAX]
Definition: msipriv.h:434
static ATOM item
Definition: dde.c:856
PVOID PVOID PWCHAR PVOID USHORT ExeType
Definition: env.c:47
const char cursor[]
Definition: icontest.c:13
#define lstrcpyW
Definition: compat.h:608
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
UINT msi_set_property(MSIDATABASE *db, const WCHAR *name, const WCHAR *value, int len)
Definition: package.c:2100
int MSIRUNMODE
Definition: winemsi.idl:30
static WCHAR * get_property(MSIDATABASE *db, const WCHAR *prop)
Definition: package.c:1215
#define ERROR_PRODUCT_VERSION
Definition: winerror.h:996
unsigned short USHORT
Definition: pedump.c:61
static UINT set_user_sid_prop(MSIPACKAGE *package)
Definition: package.c:474
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG SxsDataSize
Definition: env.c:47
UINT WINAPI MsiSequenceW(MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode)
Definition: install.c:123
static calc_node_t temp
Definition: rpn_ieee.c:38
UINT WINAPI MsiOpenPackageExW(const WCHAR *szPackage, DWORD dwOptions, MSIHANDLE *phPackage)
Definition: package.c:1612
static UINT parse_suminfo(MSISUMMARYINFO *si, MSIPACKAGE *package)
Definition: package.c:1103
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
WCHAR * msi_dup_record_field(MSIRECORD *row, INT index) DECLSPEC_HIDDEN
Definition: record.c:1002
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define CSIDL_PRINTHOOD
Definition: shlobj.h:2038
UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD *sz)
Definition: install.c:468
DWORD gUIFilterRecord
Definition: msi_main.c:47
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG PULONG64 PULONG SomeFlag2
Definition: env.c:47
UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, const WCHAR *szFeature, MSICOSTTREE iCostTree, INSTALLSTATE iState, INT *piCost)
Definition: install.c:1207
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
MSIHANDLE alloc_msihandle(MSIOBJECTHDR *obj)
Definition: handle.c:111
unsigned int * PULONG
Definition: retypes.h:1
WINE_DEFAULT_DEBUG_CHANNEL(msi)
unsigned int UINT
Definition: ndis.h:50
UINT msi_record_set_string(MSIRECORD *, UINT, const WCHAR *, int) DECLSPEC_HIDDEN
Definition: record.c:573
#define NULL
Definition: types.h:112
#define VERTRES
Definition: wingdi.h:717
BOOL empty
Definition: button.c:170
struct list entry
Definition: fci.c:128
UINT __cdecl s_remote_SetProperty(MSIHANDLE hinst, LPCWSTR property, LPCWSTR value)
Definition: package.c:2470
LPWSTR msi_get_error_message(MSIDATABASE *db, int error)
Definition: package.c:1823
#define MSIERR_ACTIONSTART
Definition: resource.h:22
static HWND dialog
Definition: gui.c:33
LPWSTR localfile
Definition: msipriv.h:205
UINT __cdecl s_remote_SetComponentState(MSIHANDLE hinst, LPCWSTR component, INSTALLSTATE state)
Definition: package.c:2566
WORD wProcessorArchitecture
Definition: winbase.h:1154
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:237
struct list entry
Definition: msipriv.h:168
UINT Context
Definition: msipriv.h:459
#define CreateFileW
Definition: compat.h:600
#define CSIDL_NETHOOD
Definition: shlobj.h:2030
ULONG dwMinorVersion
Definition: rtltypes.h:248
#define msg(x)
Definition: auth_time.c:54
BOOL delete_on_close
Definition: msipriv.h:208
#define CSIDL_PERSONAL
Definition: shlobj.h:2017
LPWSTR FullKeypath
Definition: msipriv.h:538
static void free_feature(MSIFEATURE *feature)
Definition: package.c:62
#define MSI_MINORVERSION
Definition: msipriv.h:730
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2348
Definition: name.c:38
#define CSIDL_STARTMENU
Definition: shlobj.h:2023
#define calloc
Definition: rosglue.h:14
_In_ HANDLE Handle
Definition: extypes.h:390
UINT __cdecl s_remote_SetInstallLevel(MSIHANDLE hinst, int level)
Definition: package.c:2576
LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
Definition: install.c:1541
GLuint res
Definition: glext.h:9613
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
uint32_t * LPDWORD
Definition: typedefs.h:59
int MSICOSTTREE
Definition: winemsi.idl:34
static void set_msi_assembly_prop(MSIPACKAGE *package)
Definition: package.c:589
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define APPHELP_RESULT_FOUND
Definition: apphelp.c:160
UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature, INSTALLSTATE iState)
Definition: install.c:947
INT msi_suminfo_get_int32(MSISUMMARYINFO *si, UINT uiProperty) DECLSPEC_HIDDEN
Definition: suminfo.c:708
#define progid(str)
Definition: exdisp.idl:31
#define MAKELANGID(p, s)
Definition: nls.h:15
static HINSTANCE hinst
Definition: edit.c:551
static IOleDocumentView * view
Definition: activex.c:1749
UINT msi_set_original_database_property(MSIDATABASE *db, const WCHAR *package)
Definition: package.c:1311
static UINT create_temp_property_table(MSIPACKAGE *package)
Definition: package.c:366
static const WCHAR dc[]
unsigned __int64 * PULONG64
Definition: imports.h:198
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:738
LPWSTR DefInprocHandler32
Definition: msipriv.h:662
UINT action_progress_increment
Definition: msipriv.h:413
#define CREATE_NEW
Definition: disk.h:69
BOOL NTAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
Definition: heapmem.c:1272
#define MSIERR_COMMONDATA
Definition: resource.h:23
UINT __cdecl s_remote_GetFeatureCost(MSIHANDLE hinst, LPCWSTR feature, MSICOSTTREE cost_tree, INSTALLSTATE state, INT *cost)
Definition: package.c:2612
static MSIRECORD * msi_get_property_row(MSIDATABASE *db, LPCWSTR name)
Definition: package.c:2183
LPWSTR Verb
Definition: msipriv.h:702
#define CSIDL_SYSTEM
Definition: shlobj.h:2048
IStorage * storage
Definition: msipriv.h:109
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
UINT MSIREG_OpenUninstallKey(const WCHAR *, enum platform, HKEY *, BOOL) DECLSPEC_HIDDEN
#define GetExceptionCode()
Definition: seh.h:27
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LIST_ENTRY(type)
Definition: queue.h:175
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID * SxsData
Definition: env.c:47
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:158
BOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse)
Definition: misc.c:626
#define GUID_SIZE
Definition: msipriv.h:733
#define CSIDL_PROGRAMS
Definition: shlobj.h:2014
#define CSIDL_TEMPLATES
Definition: shlobj.h:2032
struct list filepatches
Definition: msipriv.h:404
BOOL WINAPI ApphelpCheckRunAppEx(_In_ HANDLE FileHandle, _In_opt_ PVOID Unk1, _In_opt_ PVOID Unk2, _In_opt_z_ PCWSTR ApplicationName, _In_opt_ PVOID Environment, _In_opt_ USHORT ExeType, _Inout_opt_ PULONG Reason, _Out_opt_ PVOID *SdbQueryAppCompatData, _Out_opt_ PULONG SdbQueryAppCompatDataSize, _Out_opt_ PVOID *SxsData, _Out_opt_ PULONG SxsDataSize, _Out_opt_ PULONG FusionFlags, _Out_opt_ PULONG64 SomeFlag1, _Out_opt_ PULONG SomeFlag2)
Definition: apphelp.c:184
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1079
BOOL delete_on_close
Definition: msipriv.h:450
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47
LPWSTR Argument
Definition: msipriv.h:663
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define TRACE_ON(x)
Definition: compat.h:75
LPWSTR volume_label
Definition: msipriv.h:172
#define APPHELP_VALID_RESULT
Definition: apphelp.c:158
static UINT set_installed_prop(MSIPACKAGE *package)
Definition: package.c:458
INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
Definition: msi.c:2226
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID * SdbQueryAppCompatData
Definition: env.c:47
static WCHAR * get_product_version(MSIDATABASE *db)
Definition: package.c:1248
MSIOBJECTHDR hdr
Definition: msipriv.h:108
#define RegCloseKey(hKey)
Definition: registry.h:47
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
LPWSTR ContentType
Definition: msipriv.h:711
UINT msi_load_suminfo_properties(MSIPACKAGE *package) DECLSPEC_HIDDEN
Definition: suminfo.c:1262
UINT msi_get_string_table_codepage(const string_table *st) DECLSPEC_HIDDEN
Definition: string.c:671
static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
Definition: navigate.c:960
#define TIME_NOTIMEMARKER
Definition: winnls.h:279
struct list patches
Definition: msipriv.h:400
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote)
Definition: handle.c:135
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
struct list entry
Definition: msipriv.h:651
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG SdbQueryAppCompatDataSize
Definition: env.c:47
Definition: fci.c:126
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
struct list entry
Definition: fci.c:117
UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY **) DECLSPEC_HIDDEN
DWORD gUIFilter
Definition: msi_main.c:46
HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPWSTR szFileName, DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
Definition: umon.c:853
#define SUBLANGID(l)
Definition: nls.h:17
Definition: wininet.h:2127
static WCHAR user_name[UNLEN+1]
Definition: access.c:32