Source code of Windows XP (NT5)
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.

81 lines
1.9 KiB

  1. // setup.cpp : Defines the entry point for the console application.
  2. //
  3. #include "Windows.h"
  4. #include "Tchar.h"
  5. //int main(int argc, char* argv[])
  6. #ifdef UNICODE
  7. extern "C" int __cdecl
  8. wmain(
  9. #else
  10. int __cdecl
  11. main(
  12. #endif
  13. int argc,
  14. TCHAR *argv[])
  15. {
  16. STARTUPINFO structStartInfo;
  17. PROCESS_INFORMATION structProcInfo;
  18. BOOL bRet = FALSE;
  19. DWORD dwLastRet = 0L;
  20. TCHAR szMsiexecPath[MAX_PATH+1] = _T("");
  21. LPCTSTR lpszSystem32Path = NULL;
  22. do
  23. {
  24. ZeroMemory( (void*)&structStartInfo, sizeof( STARTUPINFO ) );
  25. ZeroMemory( (void*)&structProcInfo, sizeof( PROCESS_INFORMATION ) );
  26. structStartInfo.cb = sizeof( STARTUPINFO );
  27. structStartInfo.cbReserved2 = 0L;
  28. structStartInfo.dwFillAttribute = 0L; //GUI App.
  29. structStartInfo.dwFlags = STARTF_USESHOWWINDOW;
  30. structStartInfo.dwX = 0L;
  31. structStartInfo.dwXCountChars = 0L;
  32. structStartInfo.dwXSize = 0L;
  33. structStartInfo.dwY = 0L;
  34. structStartInfo.dwYCountChars = 0L;
  35. structStartInfo.dwYSize = 0L;
  36. structStartInfo.hStdError = NULL;
  37. structStartInfo.hStdInput = NULL;
  38. structStartInfo.hStdOutput = NULL;
  39. structStartInfo.lpDesktop = NULL;
  40. structStartInfo.lpReserved = NULL;
  41. structStartInfo.lpReserved2 = NULL;
  42. structStartInfo.lpTitle = NULL;
  43. structStartInfo.wShowWindow = SW_NORMAL;
  44. lpszSystem32Path = _tgetenv( _T("WINDIR") );
  45. _tcscpy( szMsiexecPath, lpszSystem32Path );
  46. _tcscat( szMsiexecPath, _T("\\system32\\msiexec.exe") );
  47. bRet = CreateProcess(
  48. szMsiexecPath,
  49. _T(" /i suptools.msi"),
  50. NULL,
  51. NULL,
  52. FALSE,
  53. DETACHED_PROCESS,
  54. NULL,
  55. NULL,
  56. &structStartInfo,
  57. &structProcInfo
  58. );
  59. if( FALSE == bRet ) {
  60. dwLastRet = GetLastError();
  61. break;
  62. }
  63. dwLastRet = 0L;
  64. }
  65. while( FALSE );
  66. if( dwLastRet != 0L ) { MessageBox( NULL, _T("Error starting the MSI file"), _T("Error"), MB_OK | MB_ICONERROR ); }
  67. return 0;
  68. }