mirror of https://github.com/tongzx/nt5src
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
71 lines
1.8 KiB
//+-------------------------------------------------------------------------
|
|
//
|
|
// Microsoft Windows
|
|
// Copyright (C) Microsoft Corporation, 1997.
|
|
//
|
|
// File: launch.cxx
|
|
//
|
|
// Contents:
|
|
//
|
|
//--------------------------------------------------------------------------
|
|
|
|
#include "act.hxx"
|
|
|
|
HRESULT
|
|
CClsidData::LaunchActivatorServer(
|
|
OUT HANDLE * phProcess
|
|
)
|
|
{
|
|
WCHAR * pwszCommandLine;
|
|
STARTUPINFO StartupInfo;
|
|
PROCESS_INFORMATION ProcessInfo;
|
|
HRESULT hr;
|
|
BOOL bStatus;
|
|
|
|
hr = GetLaunchCommandLine( &pwszCommandLine );
|
|
|
|
StartupInfo.cb = sizeof(StartupInfo);
|
|
StartupInfo.lpReserved = NULL;
|
|
StartupInfo.lpDesktop = NULL;
|
|
StartupInfo.lpTitle = (SERVERTYPE_SURROGATE == _ServerType) ? NULL : _pwszServer;
|
|
StartupInfo.dwX = 40;
|
|
StartupInfo.dwY = 40;
|
|
StartupInfo.dwXSize = 80;
|
|
StartupInfo.dwYSize = 40;
|
|
StartupInfo.dwFlags = 0;
|
|
StartupInfo.wShowWindow = SW_SHOWNORMAL;
|
|
StartupInfo.cbReserved2 = 0;
|
|
StartupInfo.lpReserved2 = NULL;
|
|
|
|
ProcessInfo.hThread = 0;
|
|
ProcessInfo.hProcess = 0;
|
|
|
|
bStatus = CreateProcess(
|
|
NULL,
|
|
pwszCommandLine,
|
|
NULL,
|
|
NULL,
|
|
FALSE,
|
|
CREATE_NEW_CONSOLE,
|
|
NULL,
|
|
NULL,
|
|
&StartupInfo,
|
|
&ProcessInfo );
|
|
|
|
if ( ProcessInfo.hThread )
|
|
CloseHandle( ProcessInfo.hThread );
|
|
|
|
if ( ProcessInfo.hProcess && ! bStatus )
|
|
{
|
|
CloseHandle( ProcessInfo.hProcess );
|
|
ProcessInfo.hProcess = 0;
|
|
}
|
|
|
|
*phProcess = ProcessInfo.hProcess;
|
|
|
|
PrivMemFree( pwszCommandLine );
|
|
|
|
return bStatus ? S_OK : HRESULT_FROM_WIN32( GetLastError() );
|
|
}
|
|
|
|
|