ReactOS  0.4.14-dev-77-gd9e7c48
install.c
Go to the documentation of this file.
1 /*
2  * Advpack install functions
3  *
4  * Copyright 2006 James Hawkins
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 #include <stdarg.h>
22 #include <stdlib.h>
23 
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "winreg.h"
28 #include "winternl.h"
29 #include "winnls.h"
30 #include "setupapi.h"
31 #include "advpub.h"
32 #include "ole2.h"
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
35 #include "advpack_private.h"
36 
38 
39 #define SPAPI_ERROR 0xE0000000L
40 #define SPAPI_PREFIX 0x800F0000L
41 #define SPAPI_MASK 0xFFFFL
42 #define HRESULT_FROM_SPAPI(x) ((HRESULT)((x & SPAPI_MASK) | SPAPI_PREFIX))
43 
44 #define ADV_HRESULT(x) ((x & SPAPI_ERROR) ? HRESULT_FROM_SPAPI(x) : HRESULT_FROM_WIN32(x))
45 
46 #define ADV_SUCCESS 0
47 #define ADV_FAILURE 1
48 
49 /* contains information about a specific install instance */
50 typedef struct _ADVInfo
51 {
59 } ADVInfo;
60 
61 typedef HRESULT (*iterate_fields_func)(HINF hinf, PCWSTR field, const void *arg);
62 
63 /* Advanced INF commands */
64 static const WCHAR CheckAdminRights[] = {
65  'C','h','e','c','k','A','d','m','i','n','R','i','g','h','t','s',0
66 };
67 static const WCHAR DelDirs[] = {'D','e','l','D','i','r','s',0};
68 static const WCHAR PerUserInstall[] = {'P','e','r','U','s','e','r','I','n','s','t','a','l','l',0};
69 static const WCHAR RegisterOCXs[] = {'R','e','g','i','s','t','e','r','O','C','X','s',0};
70 static const WCHAR RunPreSetupCommands[] = {
71  'R','u','n','P','r','e','S','e','t','u','p','C','o','m','m','a','n','d','s',0
72 };
73 static const WCHAR RunPostSetupCommands[] = {
74  'R','u','n','P','o','s','t','S','e','t','u','p','C','o','m','m','a','n','d','s',0
75 };
76 
77 /* Advanced INF callbacks */
78 static HRESULT del_dirs_callback(HINF hinf, PCWSTR field, const void *arg)
79 {
81  HRESULT hr = S_OK;
82  DWORD size;
83 
85 
86  for (; ok; ok = SetupFindNextLine(&context, &context))
87  {
89 
92  continue;
93 
95  hr = E_FAIL;
96  }
97 
98  return hr;
99 }
100 
102 {
103  PERUSERSECTIONW per_user;
105  DWORD size;
106 
107  static const WCHAR disp_name[] = {'D','i','s','p','l','a','y','N','a','m','e',0};
108  static const WCHAR version[] = {'V','e','r','s','i','o','n',0};
109  static const WCHAR is_installed[] = {'I','s','I','n','s','t','a','l','l','e','d',0};
110  static const WCHAR comp_id[] = {'C','o','m','p','o','n','e','n','t','I','D',0};
111  static const WCHAR guid[] = {'G','U','I','D',0};
112  static const WCHAR locale[] = {'L','o','c','a','l','e',0};
113  static const WCHAR stub_path[] = {'S','t','u','b','P','a','t','h',0};
114 
115  per_user.bRollback = FALSE;
116  per_user.dwIsInstalled = 0;
117 
118  SetupGetLineTextW(NULL, hinf, field, disp_name, per_user.szDispName, ARRAY_SIZE(per_user.szDispName), &size);
119 
120  SetupGetLineTextW(NULL, hinf, field, version, per_user.szVersion, ARRAY_SIZE(per_user.szVersion), &size);
121 
122  if (SetupFindFirstLineW(hinf, field, is_installed, &context))
123  {
124  SetupGetIntField(&context, 1, (PINT)&per_user.dwIsInstalled);
125  }
126 
127  SetupGetLineTextW(NULL, hinf, field, comp_id, per_user.szCompID, ARRAY_SIZE(per_user.szCompID), &size);
128 
129  SetupGetLineTextW(NULL, hinf, field, guid, per_user.szGUID, ARRAY_SIZE(per_user.szGUID), &size);
130 
131  SetupGetLineTextW(NULL, hinf, field, locale, per_user.szLocale, ARRAY_SIZE(per_user.szLocale), &size);
132 
133  SetupGetLineTextW(NULL, hinf, field, stub_path, per_user.szStub, ARRAY_SIZE(per_user.szStub), &size);
134 
135  return SetPerUserSecValuesW(&per_user);
136 }
137 
138 static HRESULT register_ocxs_callback(HINF hinf, PCWSTR field, const void *arg)
139 {
140  HMODULE hm;
142  HRESULT hr = S_OK;
143 
145 
146  for (; ok; ok = SetupFindNextLine(&context, &context))
147  {
149 
150  /* get OCX filename */
152  continue;
153 
155  if (hm)
156  {
157  if (do_ocx_reg(hm, TRUE, NULL, NULL) != S_OK)
158  hr = E_FAIL;
159 
160  FreeLibrary(hm);
161  }
162  else
163  hr = E_FAIL;
164 
165  if (FAILED(hr))
166  {
167  /* FIXME: display a message box */
168  break;
169  }
170  }
171 
172  return hr;
173 }
174 
176 {
177  const ADVInfo *info = (const ADVInfo *)arg;
179  HRESULT hr = S_OK;
180  DWORD size;
181 
183 
184  for (; ok; ok = SetupFindNextLine(&context, &context))
185  {
187 
190  continue;
191 
192  if (launch_exe(buffer, info->working_dir, NULL) != S_OK)
193  hr = E_FAIL;
194  }
195 
196  return hr;
197 }
198 
199 /* sequentially returns pointers to parameters in a parameter list
200  * returns NULL if the parameter is empty, e.g. one,,three */
202 {
203  LPWSTR token = *params;
204 
205  if (!*params)
206  return NULL;
207 
208  if (quoted && *token == '"')
209  {
210  WCHAR *end = strchrW(token + 1, '"');
211  if (end)
212  {
213  *end = 0;
214  *params = end + 1;
215  token = token + 1;
216  }
217  }
218 
220  if (*params)
221  *(*params)++ = '\0';
222 
223  if (!*token)
224  return NULL;
225 
226  return token;
227 }
228 
230 {
231  const int MIN_PATH_LEN = 3;
232 
233  if (!path || lstrlenW(path) < MIN_PATH_LEN)
234  return FALSE;
235 
236  if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
237  return TRUE;
238 
239  return FALSE;
240 }
241 
242 /* retrieves the contents of a field, dynamically growing the buffer if necessary */
244  const WCHAR *static_buffer, DWORD *size)
245 {
246  DWORD required;
247 
248  if (SetupGetStringFieldW(context, index, buffer, *size, &required)) return buffer;
249 
251  {
252  /* now grow the buffer */
253  if (buffer != static_buffer) HeapFree(GetProcessHeap(), 0, buffer);
254  if (!(buffer = HeapAlloc(GetProcessHeap(), 0, required*sizeof(WCHAR)))) return NULL;
255  *size = required;
256  if (SetupGetStringFieldW(context, index, buffer, *size, &required)) return buffer;
257  }
258 
259  if (buffer != static_buffer) HeapFree(GetProcessHeap(), 0, buffer);
260  return NULL;
261 }
262 
263 /* iterates over all fields of a certain key of a certain section */
266 {
267  WCHAR static_buffer[200];
268  WCHAR *buffer = static_buffer;
269  DWORD size = ARRAY_SIZE(static_buffer);
271  HRESULT hr = E_FAIL;
272 
274  while (ok)
275  {
277 
278  for (i = 1; i <= count; i++)
279  {
280  if (!(buffer = get_field_string(&context, i, buffer, static_buffer, &size)))
281  goto done;
282 
283  if ((hr = callback(hinf, buffer, arg)) != S_OK)
284  goto done;
285  }
286 
288  }
289 
290  hr = S_OK;
291 
292  done:
293  if (buffer != static_buffer) HeapFree(GetProcessHeap(), 0, buffer);
294  return hr;
295 }
296 
298 {
299  INT check;
301  HRESULT hr = S_OK;
302 
303  if (!SetupFindFirstLineW(info->hinf, info->install_sec,
305  return S_OK;
306 
307  if (!SetupGetIntField(&context, 1, &check))
308  return S_OK;
309 
310  if (check == 1)
311  hr = IsNTAdmin(0, NULL) ? S_OK : E_FAIL;
312 
313  return hr;
314 }
315 
316 /* performs a setupapi-level install of the INF file */
318 {
319  BOOL ret;
320  HRESULT res;
321  PVOID context;
322 
324  if (!context)
325  return ADV_HRESULT(GetLastError());
326 
327  ret = SetupInstallFromInfSectionW(NULL, info->hinf, info->install_sec,
328  SPINST_FILES, NULL, info->working_dir,
330  context, NULL, NULL);
331  if (!ret)
332  {
335 
336  return res;
337  }
338 
340 
341  ret = SetupInstallFromInfSectionW(NULL, info->hinf, info->install_sec,
344  NULL, NULL, NULL, NULL);
345  if (!ret)
346  return ADV_HRESULT(GetLastError());
347 
348  return S_OK;
349 }
350 
351 /* processes the Advanced INF commands */
353 {
354  HRESULT hr;
355 
357  if (hr != S_OK)
358  return hr;
359 
360  hr = iterate_section_fields(info->hinf, info->install_sec, RunPreSetupCommands,
362  if (hr != S_OK)
363  return hr;
364 
366  hr = iterate_section_fields(info->hinf, info->install_sec,
368  OleUninitialize();
369  if (hr != S_OK)
370  return hr;
371 
372  hr = iterate_section_fields(info->hinf, info->install_sec,
374  if (hr != S_OK)
375  return hr;
376 
377  hr = iterate_section_fields(info->hinf, info->install_sec, RunPostSetupCommands,
379  if (hr != S_OK)
380  return hr;
381 
382  hr = iterate_section_fields(info->hinf, info->install_sec,
384  if (hr != S_OK)
385  return hr;
386 
387  return hr;
388 }
389 
390 /* determines the proper working directory for the INF file */
391 static HRESULT get_working_dir(ADVInfo *info, LPCWSTR inf_filename, LPCWSTR working_dir)
392 {
394  LPCWSTR ptr;
395  DWORD len;
396 
397  static const WCHAR backslash[] = {'\\',0};
398  static const WCHAR inf_dir[] = {'\\','I','N','F',0};
399 
400  if ((ptr = strrchrW(inf_filename, '\\')))
401  {
402  len = ptr - inf_filename + 1;
403  ptr = inf_filename;
404  }
405  else if (working_dir && *working_dir)
406  {
407  len = lstrlenW(working_dir) + 1;
408  ptr = working_dir;
409  }
410  else
411  {
413  lstrcatW(path, backslash);
414  lstrcatW(path, inf_filename);
415 
416  /* check if the INF file is in the current directory */
418  {
420  }
421  else
422  {
423  /* default to the windows\inf directory if all else fails */
425  lstrcatW(path, inf_dir);
426  }
427 
428  len = lstrlenW(path) + 1;
429  ptr = path;
430  }
431 
432  info->working_dir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
433  if (!info->working_dir)
434  return E_OUTOFMEMORY;
435 
436  lstrcpynW(info->working_dir, ptr, len);
437 
438  return S_OK;
439 }
440 
441 /* loads the INF file and performs checks on it */
442 static HRESULT install_init(LPCWSTR inf_filename, LPCWSTR install_sec,
443  LPCWSTR working_dir, DWORD flags, ADVInfo *info)
444 {
445  DWORD len;
446  HRESULT hr;
447  LPCWSTR ptr, path;
448 
449  static const WCHAR backslash[] = {'\\',0};
450  static const WCHAR default_install[] = {
451  'D','e','f','a','u','l','t','I','n','s','t','a','l','l',0
452  };
453 
454  if (!(ptr = strrchrW(inf_filename, '\\')))
455  ptr = inf_filename;
456 
457  len = lstrlenW(ptr);
458 
459  info->inf_filename = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
460  if (!info->inf_filename)
461  return E_OUTOFMEMORY;
462 
463  lstrcpyW(info->inf_filename, ptr);
464 
465  /* FIXME: determine the proper platform to install (NTx86, etc) */
466  if (!install_sec || !*install_sec)
467  {
468  len = sizeof(default_install) - 1;
469  ptr = default_install;
470  }
471  else
472  {
473  len = lstrlenW(install_sec);
474  ptr = install_sec;
475  }
476 
477  info->install_sec = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
478  if (!info->install_sec)
479  return E_OUTOFMEMORY;
480 
481  lstrcpyW(info->install_sec, ptr);
482 
483  hr = get_working_dir(info, inf_filename, working_dir);
484  if (FAILED(hr))
485  return hr;
486 
487  len = lstrlenW(info->working_dir) + lstrlenW(info->inf_filename) + 2;
488  info->inf_path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
489  if (!info->inf_path)
490  return E_OUTOFMEMORY;
491 
492  lstrcpyW(info->inf_path, info->working_dir);
493  lstrcatW(info->inf_path, backslash);
494  lstrcatW(info->inf_path, info->inf_filename);
495 
496  /* RunSetupCommand opens unmodifed filename parameter */
497  if (flags & RSC_FLAG_INF)
498  path = inf_filename;
499  else
500  path = info->inf_path;
501 
503  if (info->hinf == INVALID_HANDLE_VALUE)
504  return ADV_HRESULT(GetLastError());
505 
506  set_ldids(info->hinf, info->install_sec, info->working_dir);
507 
508  /* FIXME: check that the INF is advanced */
509 
510  info->flags = flags;
511  info->need_reboot = FALSE;
512 
513  return S_OK;
514 }
515 
516 /* release the install instance information */
517 static void install_release(const ADVInfo *info)
518 {
519  SetupCloseInfFile(info->hinf);
520 
521  HeapFree(GetProcessHeap(), 0, info->inf_path);
522  HeapFree(GetProcessHeap(), 0, info->inf_filename);
523  HeapFree(GetProcessHeap(), 0, info->install_sec);
524  HeapFree(GetProcessHeap(), 0, info->working_dir);
525 }
526 
527 /* this structure very closely resembles parameters of RunSetupCommand() */
528 typedef struct
529 {
536 
537 typedef struct
538 {
545 
546 /* internal: see DoInfInstall */
548 {
549  ADVInfo info;
550  HRESULT hr;
551 
552  TRACE("(%p)\n", setup);
553 
554  ZeroMemory(&info, sizeof(ADVInfo));
555 
556  hr = install_init(setup->inf_name, setup->section_name, setup->dir, 0, &info);
557  if (hr != S_OK)
558  goto done;
559 
560  hr = spapi_install(&info);
561  if (hr != S_OK)
562  goto done;
563 
564  hr = adv_install(&info);
565 
566 done:
568 
569  return S_OK;
570 }
571 
572 /***********************************************************************
573  * DoInfInstall (ADVPACK.@)
574  *
575  * Install an INF section.
576  *
577  * PARAMS
578  * setup [I] Structure containing install information.
579  *
580  * RETURNS
581  * S_OK Everything OK
582  * HRESULT_FROM_WIN32(GetLastError()) Some other error
583  */
585 {
588  HRESULT hr;
589 
590  if (!setup)
591  return E_INVALIDARG;
592 
594  RtlCreateUnicodeStringFromAsciiz(&inf, setup->inf_name);
597 
598  params.title = title.Buffer;
599  params.inf_name = inf.Buffer;
600  params.section_name = section.Buffer;
601  params.dir = dir.Buffer;
602  params.hwnd = setup->hwnd;
603 
604  hr = DoInfInstallW(&params);
605 
607  RtlFreeUnicodeString(&inf);
610 
611  return hr;
612 }
613 
614 /***********************************************************************
615  * ExecuteCabA (ADVPACK.@)
616  *
617  * See ExecuteCabW.
618  */
620 {
621  UNICODE_STRING cab, inf, section;
622  CABINFOW cabinfo;
623  HRESULT hr;
624 
625  TRACE("(%p, %p, %p)\n", hwnd, pCab, pReserved);
626 
627  if (!pCab)
628  return E_INVALIDARG;
629 
630  if (pCab->pszCab)
631  {
633  cabinfo.pszCab = cab.Buffer;
634  }
635  else
636  cabinfo.pszCab = NULL;
637 
640 
641  MultiByteToWideChar(CP_ACP, 0, pCab->szSrcPath, -1, cabinfo.szSrcPath, ARRAY_SIZE(cabinfo.szSrcPath));
642 
643  cabinfo.pszInf = inf.Buffer;
644  cabinfo.pszSection = section.Buffer;
645  cabinfo.dwFlags = pCab->dwFlags;
646 
647  hr = ExecuteCabW(hwnd, &cabinfo, pReserved);
648 
649  if (pCab->pszCab)
650  RtlFreeUnicodeString(&cab);
651 
652  RtlFreeUnicodeString(&inf);
654 
655  return hr;
656 }
657 
658 /***********************************************************************
659  * ExecuteCabW (ADVPACK.@)
660  *
661  * Installs the INF file extracted from a specified cabinet file.
662  *
663  * PARAMS
664  * hwnd [I] Handle to the window used for the display.
665  * pCab [I] Information about the cabinet file.
666  * pReserved [I] Reserved. Must be NULL.
667  *
668  * RETURNS
669  * Success: S_OK.
670  * Failure: E_FAIL.
671  */
673 {
674  ADVInfo info;
675  HRESULT hr;
676 
677  TRACE("(%p, %p, %p)\n", hwnd, pCab, pReserved);
678 
679  ZeroMemory(&info, sizeof(ADVInfo));
680 
681  if (pCab->pszCab && *pCab->pszCab)
682  FIXME("Cab archive not extracted!\n");
683 
684  hr = install_init(pCab->pszInf, pCab->pszSection, pCab->szSrcPath, pCab->dwFlags, &info);
685  if (hr != S_OK)
686  goto done;
687 
688  hr = spapi_install(&info);
689  if (hr != S_OK)
690  goto done;
691 
692  hr = adv_install(&info);
693 
694 done:
696 
697  return hr;
698 }
699 
700 /***********************************************************************
701  * LaunchINFSectionA (ADVPACK.@)
702  *
703  * See LaunchINFSectionW.
704  */
706 {
708  HRESULT hr;
709 
710  TRACE("(%p, %p, %s, %i)\n", hWnd, hInst, debugstr_a(cmdline), show);
711 
712  if (!cmdline)
713  return ADV_FAILURE;
714 
716 
717  hr = LaunchINFSectionW(hWnd, hInst, cmd.Buffer, show);
718 
720 
721  return hr;
722 }
723 
724 /***********************************************************************
725  * LaunchINFSectionW (ADVPACK.@)
726  *
727  * Installs an INF section without BACKUP/ROLLBACK capabilities.
728  *
729  * PARAMS
730  * hWnd [I] Handle to parent window, NULL for desktop.
731  * hInst [I] Instance of the process.
732  * cmdline [I] Contains parameters in the order INF,section,flags,reboot.
733  * show [I] How the window should be shown.
734  *
735  * RETURNS
736  * Success: ADV_SUCCESS.
737  * Failure: ADV_FAILURE.
738  *
739  * NOTES
740  * INF - Filename of the INF to launch.
741  * section - INF section to install.
742  * flags - see advpub.h.
743  * reboot - smart reboot behavior
744  * 'A' Always reboot.
745  * 'I' Reboot if needed (default).
746  * 'N' No reboot.
747  */
749 {
750  ADVInfo info;
751  LPWSTR cmdline_copy, cmdline_ptr;
752  LPWSTR inf_filename, install_sec;
753  LPWSTR str_flags;
754  DWORD flags = 0;
755  HRESULT hr = S_OK;
756 
757  TRACE("(%p, %p, %s, %d)\n", hWnd, hInst, debugstr_w(cmdline), show);
758 
759  if (!cmdline)
760  return ADV_FAILURE;
761 
762  cmdline_copy = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(cmdline) + 1) * sizeof(WCHAR));
763  cmdline_ptr = cmdline_copy;
764  lstrcpyW(cmdline_copy, cmdline);
765 
766  inf_filename = get_parameter(&cmdline_ptr, ',', TRUE);
767  install_sec = get_parameter(&cmdline_ptr, ',', TRUE);
768 
769  str_flags = get_parameter(&cmdline_ptr, ',', TRUE);
770  if (str_flags)
771  {
772  DWORD inf_flags = atolW(str_flags);
773  if (inf_flags & LIS_QUIET) flags |= RSC_FLAG_QUIET;
774  if (inf_flags & LIS_NOGRPCONV) flags |= RSC_FLAG_NGCONV;
775  }
776 
777  ZeroMemory(&info, sizeof(ADVInfo));
778 
779  hr = install_init(inf_filename, install_sec, NULL, flags, &info);
780  if (hr != S_OK)
781  goto done;
782 
783  hr = spapi_install(&info);
784  if (hr != S_OK)
785  goto done;
786 
787  hr = adv_install(&info);
788 
789 done:
791  HeapFree(GetProcessHeap(), 0, cmdline_copy);
792 
793  return SUCCEEDED(hr) ? ADV_SUCCESS : ADV_FAILURE;
794 }
795 
796 /***********************************************************************
797  * LaunchINFSectionExA (ADVPACK.@)
798  *
799  * See LaunchINFSectionExW.
800  */
802 {
804  HRESULT hr;
805 
806  TRACE("(%p, %p, %s, %i)\n", hWnd, hInst, debugstr_a(cmdline), show);
807 
808  if (!cmdline)
809  return ADV_FAILURE;
810 
812 
813  hr = LaunchINFSectionExW(hWnd, hInst, cmd.Buffer, show);
814 
816 
817  return hr;
818 }
819 
820 /***********************************************************************
821  * LaunchINFSectionExW (ADVPACK.@)
822  *
823  * Installs an INF section with BACKUP/ROLLBACK capabilities.
824  *
825  * PARAMS
826  * hWnd [I] Handle to parent window, NULL for desktop.
827  * hInst [I] Instance of the process.
828  * cmdline [I] Contains parameters in the order INF,section,CAB,flags,reboot.
829  * show [I] How the window should be shown.
830  *
831  * RETURNS
832  * Success: ADV_SUCCESS.
833  * Failure: ADV_FAILURE.
834  *
835  * NOTES
836  * INF - Filename of the INF to launch.
837  * section - INF section to install.
838  * flags - see advpub.h.
839  * reboot - smart reboot behavior
840  * 'A' Always reboot.
841  * 'I' Reboot if needed (default).
842  * 'N' No reboot.
843  *
844  * BUGS
845  * Doesn't handle the reboot flag.
846  */
848 {
849  LPWSTR cmdline_copy, cmdline_ptr;
850  LPWSTR flags, ptr;
851  CABINFOW cabinfo;
852  HRESULT hr;
853 
854  TRACE("(%p, %p, %s, %d)\n", hWnd, hInst, debugstr_w(cmdline), show);
855 
856  if (!cmdline)
857  return ADV_FAILURE;
858 
859  cmdline_copy = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(cmdline) + 1) * sizeof(WCHAR));
860  cmdline_ptr = cmdline_copy;
861  lstrcpyW(cmdline_copy, cmdline);
862 
863  cabinfo.pszInf = get_parameter(&cmdline_ptr, ',', TRUE);
864  cabinfo.pszSection = get_parameter(&cmdline_ptr, ',', TRUE);
865  cabinfo.pszCab = get_parameter(&cmdline_ptr, ',', TRUE);
866  *cabinfo.szSrcPath = '\0';
867 
868  flags = get_parameter(&cmdline_ptr, ',', TRUE);
869  if (flags)
870  cabinfo.dwFlags = atolW(flags);
871 
872  if (!is_full_path(cabinfo.pszCab) && !is_full_path(cabinfo.pszInf))
873  {
874  HeapFree(GetProcessHeap(), 0, cmdline_copy);
875  return E_INVALIDARG;
876  }
877 
878  /* get the source path from the cab filename */
879  if (cabinfo.pszCab && *cabinfo.pszCab)
880  {
881  if (!is_full_path(cabinfo.pszCab))
882  lstrcpyW(cabinfo.szSrcPath, cabinfo.pszInf);
883  else
884  lstrcpyW(cabinfo.szSrcPath, cabinfo.pszCab);
885 
886  ptr = strrchrW(cabinfo.szSrcPath, '\\');
887  *(++ptr) = '\0';
888  }
889 
890  hr = ExecuteCabW(hWnd, &cabinfo, NULL);
891  HeapFree(GetProcessHeap(), 0, cmdline_copy);
892  return SUCCEEDED(hr) ? ADV_SUCCESS : ADV_FAILURE;
893 }
894 
896 {
897  STARTUPINFOW si;
899 
900  if (phEXE) *phEXE = NULL;
901 
902  ZeroMemory(&pi, sizeof(pi));
903  ZeroMemory(&si, sizeof(si));
904  si.cb = sizeof(si);
905 
908  NULL, dir, &si, &pi))
909  {
911  }
912 
913  CloseHandle(pi.hThread);
914 
915  if (phEXE)
916  {
917  *phEXE = pi.hProcess;
918  return S_ASYNCHRONOUS;
919  }
920 
921  /* wait for the child process to finish */
922  WaitForSingleObject(pi.hProcess, INFINITE);
923  CloseHandle(pi.hProcess);
924 
925  return S_OK;
926 }
927 
928 /***********************************************************************
929  * RunSetupCommandA (ADVPACK.@)
930  *
931  * See RunSetupCommandW.
932  */
934  LPCSTR szInfSection, LPCSTR szDir,
935  LPCSTR lpszTitle, HANDLE *phEXE,
937 {
938  UNICODE_STRING cmdname, infsec;
940  HRESULT hr;
941 
942  TRACE("(%p, %s, %s, %s, %s, %p, %d, %p)\n",
943  hWnd, debugstr_a(szCmdName), debugstr_a(szInfSection),
944  debugstr_a(szDir), debugstr_a(lpszTitle),
945  phEXE, dwFlags, pvReserved);
946 
947  if (!szCmdName || !szDir)
948  return E_INVALIDARG;
949 
950  RtlCreateUnicodeStringFromAsciiz(&cmdname, szCmdName);
951  RtlCreateUnicodeStringFromAsciiz(&infsec, szInfSection);
954 
955  hr = RunSetupCommandW(hWnd, cmdname.Buffer, infsec.Buffer, dir.Buffer,
956  title.Buffer, phEXE, dwFlags, pvReserved);
957 
958  RtlFreeUnicodeString(&cmdname);
959  RtlFreeUnicodeString(&infsec);
962 
963  return hr;
964 }
965 
966 /***********************************************************************
967  * RunSetupCommandW (ADVPACK.@)
968  *
969  * Executes an install section in an INF file or a program.
970  *
971  * PARAMS
972  * hWnd [I] Handle to parent window, NULL for quiet mode
973  * szCmdName [I] Inf or EXE filename to execute
974  * szInfSection [I] Inf section to install, NULL for DefaultInstall
975  * szDir [I] Path to extracted files
976  * szTitle [I] Title of all dialogs
977  * phEXE [O] Handle of EXE to wait for
978  * dwFlags [I] Flags; see include/advpub.h
979  * pvReserved [I] Reserved
980  *
981  * RETURNS
982  * S_OK Everything OK
983  * S_ASYNCHRONOUS OK, required to wait on phEXE
984  * ERROR_SUCCESS_REBOOT_REQUIRED Reboot required
985  * E_INVALIDARG Invalid argument given
986  * HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION)
987  * Not supported on this Windows version
988  * E_UNEXPECTED Unexpected error
989  * HRESULT_FROM_WIN32(GetLastError()) Some other error
990  */
992  LPCWSTR szInfSection, LPCWSTR szDir,
993  LPCWSTR lpszTitle, HANDLE *phEXE,
995 {
996  ADVInfo info;
997  HRESULT hr;
998 
999  TRACE("(%p, %s, %s, %s, %s, %p, %d, %p)\n",
1000  hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection),
1001  debugstr_w(szDir), debugstr_w(lpszTitle),
1002  phEXE, dwFlags, pvReserved);
1003 
1005  FIXME("Unhandled flag: RSC_FLAG_UPDHLPDLLS\n");
1006 
1007  if (!szCmdName || !szDir)
1008  return E_INVALIDARG;
1009 
1010  if (!(dwFlags & RSC_FLAG_INF))
1011  return launch_exe(szCmdName, szDir, phEXE);
1012 
1013  ZeroMemory(&info, sizeof(ADVInfo));
1014 
1015  hr = install_init(szCmdName, szInfSection, szDir, dwFlags, &info);
1016  if (hr != S_OK)
1017  goto done;
1018 
1019  hr = spapi_install(&info);
1020  if (hr != S_OK)
1021  goto done;
1022 
1023  hr = adv_install(&info);
1024 
1025 done:
1027 
1028  return hr;
1029 }
WCHAR szStub[MAX_PATH *4]
Definition: advpub.h:70
DWORD size
Definition: install.c:3631
static HRESULT install_init(LPCWSTR inf_filename, LPCWSTR install_sec, LPCWSTR working_dir, DWORD flags, ADVInfo *info)
Definition: install.c:442
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPSTR pszCab
Definition: advpub.h:34
DWORD flags
Definition: install.c:57
LPWSTR inf_filename
Definition: install.c:54
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define SPINST_INIFILES
Definition: setupapi.h:584
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
static const WCHAR separator[]
Definition: asmname.c:63
HRESULT WINAPI LaunchINFSectionExA(HWND hWnd, HINSTANCE hInst, LPSTR cmdline, INT show)
Definition: install.c:801
#define INF_STYLE_WIN4
Definition: infsupp.h:41
static HRESULT register_ocxs_callback(HINF hinf, PCWSTR field, const void *arg)
Definition: install.c:138
HRESULT hr
Definition: shlfolder.c:183
#define SPINST_REGSVR
Definition: setupapi.h:589
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: http.c:6587
Definition: ftp_var.h:139
BOOL bRollback
Definition: advpub.h:74
GLsizei const GLchar ** path
Definition: glext.h:7234
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define CP_ACP
Definition: compat.h:99
LPCSTR section_name
Definition: install.c:534
LPWSTR pszInf
Definition: advpub.h:44
GLuint GLuint GLsizei count
Definition: gl.h:1545
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
WCHAR szDispName[128]
Definition: advpub.h:68
static const WCHAR RegisterOCXs[]
Definition: install.c:69
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
static HRESULT iterate_section_fields(HINF hinf, PCWSTR section, PCWSTR key, iterate_fields_func callback, void *arg)
Definition: install.c:264
static HRESULT DoInfInstallW(const SETUPCOMMAND_PARAMSW *setup)
Definition: install.c:547
HWND hWnd
Definition: settings.c:17
BOOL WINAPI IsNTAdmin(DWORD reserved, LPDWORD pReserved)
Definition: advpack.c:222
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
GLuint buffer
Definition: glext.h:5915
char * cmd
Definition: vfdcmd.c:85
LPWSTR working_dir
Definition: install.c:56
void * arg
Definition: msvc.h:12
#define CREATE_DEFAULT_ERROR_MODE
Definition: winbase.h:194
DWORD dwIsInstalled
Definition: advpub.h:73
GLuint GLuint end
Definition: gl.h:1545
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define LOAD_WITH_ALTERED_SEARCH_PATH
Definition: winbase.h:339
static HRESULT per_user_install_callback(HINF hinf, PCWSTR field, const void *arg)
Definition: install.c:101
HRESULT WINAPI ExecuteCabW(HWND hwnd, CABINFOW *pCab, LPVOID pReserved)
Definition: install.c:672
Definition: parser.c:55
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
char * LPSTR
Definition: xmlstorage.h:182
static HRESULT(WINAPI *pRunSetupCommand)(HWND
#define lstrlenW
Definition: compat.h:407
#define CREATE_NEW_PROCESS_GROUP
Definition: winbase.h:185
#define E_FAIL
Definition: ddrawi.h:102
#define RSC_FLAG_INF
Definition: advpub.h:130
HRESULT WINAPI SetPerUserSecValuesW(PERUSERSECTIONW *pPerUser)
Definition: advpack.c:558
int32_t INT
Definition: typedefs.h:56
WCHAR szGUID[39+20]
Definition: advpub.h:67
HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE)
Definition: install.c:895
HRESULT WINAPI RunSetupCommandA(HWND hWnd, LPCSTR szCmdName, LPCSTR szInfSection, LPCSTR szDir, LPCSTR lpszTitle, HANDLE *phEXE, DWORD dwFlags, LPVOID pvReserved)
Definition: install.c:933
#define RSC_FLAG_NGCONV
Definition: advpub.h:133
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
static IMAGE_SECTION_HEADER section
Definition: loader.c:152
HRESULT WINAPI ExecuteCabA(HWND hwnd, CABINFOA *pCab, LPVOID pReserved)
Definition: install.c:619
#define lstrcpynW
Definition: compat.h:397
static HRESULT check_admin_rights(const ADVInfo *info)
Definition: install.c:297
HINF hinf
Definition: install.c:52
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
struct _test_info info[]
Definition: SetCursorPos.c:19
static const WCHAR DelDirs[]
Definition: install.c:67
static BOOL is_full_path(LPCWSTR path)
Definition: install.c:229
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HRESULT WINAPI DelNodeW(LPCWSTR pszFileOrDirName, DWORD dwFlags)
Definition: files.c:432
#define LIS_NOGRPCONV
Definition: advpub.h:140
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
const GUID * guid
LPWSTR install_sec
Definition: install.c:55
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum const GLfloat * params
Definition: glext.h:5645
#define SP_COPY_NEWER
Definition: setupapi.h:473
Definition: _locale.h:75
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD dwFlags
Definition: advpub.h:38
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
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 token
Definition: glfuncs.h:210
#define ADV_FAILURE
Definition: install.c:47
INT WINAPI LaunchINFSectionA(HWND hWnd, HINSTANCE hInst, LPSTR cmdline, INT show)
Definition: install.c:705
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define E_INVALIDARG
Definition: ddrawi.h:101
#define SPINST_REGISTRY
Definition: setupapi.h:585
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
DWORD dwFlags
Definition: advpub.h:47
static HRESULT run_setup_commands_callback(HINF hinf, PCWSTR field, const void *arg)
Definition: install.c:175
WINE_UNICODE_INLINE long int atolW(const WCHAR *str)
Definition: unicode.h:310
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
GLuint index
Definition: glext.h:6031
unsigned int dir
Definition: maze.c:112
const char * LPCSTR
Definition: xmlstorage.h:183
#define SPINST_FILES
Definition: setupapi.h:587
WINE_DEFAULT_DEBUG_CHANNEL(advpack)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4593
static HRESULT adv_install(ADVInfo *info)
Definition: install.c:352
static HRESULT del_dirs_callback(HINF hinf, PCWSTR field, const void *arg)
Definition: install.c:78
LPWSTR get_parameter(LPWSTR *params, WCHAR separator, BOOL quoted)
Definition: install.c:201
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
#define TRACE(s)
Definition: solgame.cpp:4
int * PINT
Definition: windef.h:177
#define FreeLibrary(x)
Definition: compat.h:405
GLsizeiptr size
Definition: glext.h:5919
#define MAX_INF_STRING_LENGTH
Definition: infsupp.h:34
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD cb
Definition: winbase.h:817
LPSTR pszSection
Definition: advpub.h:36
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: parser.c:43
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
#define S_ASYNCHRONOUS
Definition: advpub.h:29
#define LIS_QUIET
Definition: advpub.h:139
HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, LPCWSTR szInfSection, LPCWSTR szDir, LPCWSTR lpszTitle, HANDLE *phEXE, DWORD dwFlags, LPVOID pvReserved)
Definition: install.c:991
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
void check(CONTEXT *pContext)
Definition: NtContinue.c:61
GLbitfield flags
Definition: glext.h:7161
#define RSC_FLAG_UPDHLPDLLS
Definition: advpub.h:134
static DWORD pi
Definition: protocol.c:150
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
Definition: install.c:1323
int ret
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Definition: infsupp.c:91
HRESULT WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup)
Definition: install.c:584
static WCHAR * get_field_string(INFCONTEXT *context, DWORD index, WCHAR *buffer, const WCHAR *static_buffer, DWORD *size)
Definition: install.c:243
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1777
HRESULT WINAPI LaunchINFSectionExW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT show)
Definition: install.c:847
GLenum GLsizei len
Definition: glext.h:6722
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
Definition: queue.c:1704
PVOID WINAPI SetupInitDefaultQueueCallbackEx(HWND owner, HWND progress, UINT msg, DWORD reserved1, PVOID reserved2)
Definition: queue.c:1686
static void install_release(const ADVInfo *info)
Definition: install.c:517
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
WCHAR szLocale[10]
Definition: advpub.h:69
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
WCHAR szVersion[32]
Definition: advpub.h:71
#define S_OK
Definition: intsafe.h:59
HINSTANCE hInst
Definition: dxdiag.c:13
#define lstrcpyW
Definition: compat.h:406
WCHAR szCompID[128]
Definition: advpub.h:72
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
LPCWSTR section_name
Definition: install.c:543
Definition: services.c:325
LPWSTR inf_path
Definition: install.c:53
unsigned int UINT
Definition: ndis.h:50
#define ADV_SUCCESS
Definition: install.c:46
void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir)
Definition: advpack.c:109
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
#define MultiByteToWideChar
Definition: compat.h:100
void setup(char *serport, int baud)
Definition: gdblib.c:169
static const WCHAR RunPostSetupCommands[]
Definition: install.c:73
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
GLuint res
Definition: glext.h:9613
#define ADV_HRESULT(x)
Definition: install.c:44
static const WCHAR CheckAdminRights[]
Definition: install.c:64
#define RSC_FLAG_QUIET
Definition: advpub.h:132
static HRESULT spapi_install(const ADVInfo *info)
Definition: install.c:317
INT WINAPI LaunchINFSectionW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT show)
Definition: install.c:748
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
BOOL need_reboot
Definition: install.c:58
HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param)
Definition: advpack.c:442
WCHAR * LPWSTR
Definition: xmlstorage.h:184
WCHAR szSrcPath[MAX_PATH]
Definition: advpub.h:46
LPWSTR pszCab
Definition: advpub.h:43
CHAR szSrcPath[MAX_PATH]
Definition: advpub.h:37
#define INFINITE
Definition: serial.h:102
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233
HRESULT(* iterate_fields_func)(HINF hinf, PCWSTR field, const void *arg)
Definition: install.c:61
struct _ADVInfo ADVInfo
static const WCHAR PerUserInstall[]
Definition: install.c:68
LPWSTR pszSection
Definition: advpub.h:45
static char title[]
Definition: ps.c:92
#define ADN_DEL_IF_EMPTY
Definition: advpub.h:143
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL WINAPI SetupFindNextMatchLineW(PINFCONTEXT context_in, PCWSTR key, PINFCONTEXT context_out)
Definition: parser.c:1694
static const WCHAR RunPreSetupCommands[]
Definition: install.c:70
#define SUCCEEDED(hr)
Definition: intsafe.h:57
LPSTR pszInf
Definition: advpub.h:35
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static HRESULT get_working_dir(ADVInfo *info, LPCWSTR inf_filename, LPCWSTR working_dir)
Definition: install.c:391
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
Definition: parser.c:1756
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184