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.

71 lines
1.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: launch.cxx
  7. //
  8. // Contents:
  9. //
  10. //--------------------------------------------------------------------------
  11. #include "act.hxx"
  12. HRESULT
  13. CClsidData::LaunchActivatorServer(
  14. OUT HANDLE * phProcess
  15. )
  16. {
  17. WCHAR * pwszCommandLine;
  18. STARTUPINFO StartupInfo;
  19. PROCESS_INFORMATION ProcessInfo;
  20. HRESULT hr;
  21. BOOL bStatus;
  22. hr = GetLaunchCommandLine( &pwszCommandLine );
  23. StartupInfo.cb = sizeof(StartupInfo);
  24. StartupInfo.lpReserved = NULL;
  25. StartupInfo.lpDesktop = NULL;
  26. StartupInfo.lpTitle = (SERVERTYPE_SURROGATE == _ServerType) ? NULL : _pwszServer;
  27. StartupInfo.dwX = 40;
  28. StartupInfo.dwY = 40;
  29. StartupInfo.dwXSize = 80;
  30. StartupInfo.dwYSize = 40;
  31. StartupInfo.dwFlags = 0;
  32. StartupInfo.wShowWindow = SW_SHOWNORMAL;
  33. StartupInfo.cbReserved2 = 0;
  34. StartupInfo.lpReserved2 = NULL;
  35. ProcessInfo.hThread = 0;
  36. ProcessInfo.hProcess = 0;
  37. bStatus = CreateProcess(
  38. NULL,
  39. pwszCommandLine,
  40. NULL,
  41. NULL,
  42. FALSE,
  43. CREATE_NEW_CONSOLE,
  44. NULL,
  45. NULL,
  46. &StartupInfo,
  47. &ProcessInfo );
  48. if ( ProcessInfo.hThread )
  49. CloseHandle( ProcessInfo.hThread );
  50. if ( ProcessInfo.hProcess && ! bStatus )
  51. {
  52. CloseHandle( ProcessInfo.hProcess );
  53. ProcessInfo.hProcess = 0;
  54. }
  55. *phProcess = ProcessInfo.hProcess;
  56. PrivMemFree( pwszCommandLine );
  57. return bStatus ? S_OK : HRESULT_FROM_WIN32( GetLastError() );
  58. }