Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.5 KiB

  1. //
  2. // AppList.C
  3. //
  4. // Copyright (C) Microsoft, 1994, 1995, All Rights Reserved.
  5. //
  6. // History:
  7. // ral 5/23/94 - First pass
  8. // ral 9/09/94 - Clean up
  9. // 3/20/95 [stevecat] - NT port & real clean up, unicode, etc.
  10. //
  11. //
  12. #include "priv.h"
  13. #include "appwiz.h"
  14. #include "regstr.h"
  15. //
  16. // Executes the appropriate setup program
  17. //
  18. BOOL ExecSetupProg(LPWIZDATA lpwd, BOOL ForceWx86, BOOL bMinimizeWiz)
  19. {
  20. SHELLEXECUTEINFO ei;
  21. BOOL fWorked= FALSE;
  22. #ifdef WX86
  23. DWORD Len;
  24. WCHAR ProcArchValue[32];
  25. #endif
  26. HWND hDlgPropSheet = GetParent(lpwd->hwnd);
  27. LPTSTR lpszTarget = NULL;
  28. ei.cbSize = sizeof(ei);
  29. ei.hwnd = lpwd->hwnd;
  30. ei.lpVerb = NULL;
  31. ei.fMask = 0;
  32. lpszTarget = (lpwd->dwFlags & WDFLAG_EXPSZ) ? lpwd->szExpExeName : lpwd->szExeName;
  33. if (lpszTarget[0] == TEXT('*'))
  34. {
  35. ei.lpFile = CharNext(lpszTarget);
  36. ei.fMask |= SEE_MASK_CONNECTNETDRV;
  37. }
  38. else
  39. {
  40. ei.lpFile = lpszTarget;
  41. }
  42. if (lpwd->szParams[0] == 0)
  43. {
  44. ei.lpParameters = NULL;
  45. }
  46. else
  47. {
  48. ei.lpParameters = lpwd->szParams;
  49. }
  50. if (lpwd->szWorkingDir[0] == TEXT('\0'))
  51. {
  52. ei.lpDirectory = NULL;
  53. }
  54. else
  55. {
  56. ei.lpDirectory = lpwd->szWorkingDir;
  57. }
  58. ei.lpClass = NULL;
  59. ei.nShow = SW_SHOWDEFAULT;
  60. ei.hInstApp = g_hinst;
  61. if (bMinimizeWiz)
  62. SetWindowPos(hDlgPropSheet, 0, 0, 0, 0, 0, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
  63. #ifdef WX86
  64. if (ForceWx86) {
  65. Len = GetEnvironmentVariableW(ProcArchName,
  66. ProcArchValue,
  67. sizeof(ProcArchValue)
  68. );
  69. if (!Len || Len >= sizeof(ProcArchValue)) {
  70. ProcArchValue[0]=L'\0';
  71. }
  72. SetEnvironmentVariableW(ProcArchName, L"x86");
  73. ei.fMask |= SEE_MASK_FLAG_SEPVDM;
  74. }
  75. #endif
  76. fWorked = ShellExecuteEx(&ei);
  77. #ifdef WX86
  78. if (ForceWx86) {
  79. SetEnvironmentVariableW(ProcArchName, ProcArchValue);
  80. }
  81. #endif
  82. if (!fWorked)
  83. {
  84. //
  85. // Something went wrong. Put the dialog back up.
  86. //
  87. SetWindowPos(hDlgPropSheet, 0, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
  88. ShellMessageBox(g_hinst, lpwd->hwnd, MAKEINTRESOURCE(IDS_BADSETUP),
  89. 0, MB_OK | MB_ICONEXCLAMATION);
  90. }
  91. return(fWorked);
  92. }