diff --git a/tools/VistaUpdaterLauncher/VistaUpdaterLauncher.sln b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher.sln new file mode 100644 index 000000000000..b52fb618c7d4 --- /dev/null +++ b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VistaUpdaterLauncher", "VistaUpdaterLauncher\VistaUpdaterLauncher.vcproj", "{05040CA8-09AC-48F2-89BE-1A271F97FE58}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05040CA8-09AC-48F2-89BE-1A271F97FE58}.Debug|Win32.ActiveCfg = Debug|Win32 + {05040CA8-09AC-48F2-89BE-1A271F97FE58}.Debug|Win32.Build.0 = Debug|Win32 + {05040CA8-09AC-48F2-89BE-1A271F97FE58}.Release|Win32.ActiveCfg = Release|Win32 + {05040CA8-09AC-48F2-89BE-1A271F97FE58}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp new file mode 100644 index 000000000000..bd14d4d4163e --- /dev/null +++ b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp @@ -0,0 +1,63 @@ +// VistaUpdaterLauncher.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include +#include +#include +#include +#include +#include +#include + + +int _tmain(int argc, _TCHAR* argv[]) +{ + STARTUPINFO startupInfo = {0}; + startupInfo.cb = sizeof(startupInfo); + PROCESS_INFORMATION processInformation = {0}; + + startupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + startupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + startupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); + + wchar_t commandLine[32768] = L""; + + for (int i = 1; i < argc; i++) { + wcscat_s(commandLine, L"\""); + wcscat_s(commandLine, argv[i]); + wcscat_s(commandLine, L"\" "); + } + + wprintf(L"Creating new process: %s\n", commandLine); + fflush(stdout); + + if (!CreateProcess( + NULL, /*LPCTSTR lpApplicationName*/ + commandLine,/* LPTSTR lpCommandLine*/ + NULL, /*LPSECURITY_ATTRIBUTES lpProcessAttributes*/ + NULL, /*LPSECURITY_ATTRIBUTES lpThreadAttributes*/ + TRUE, /*BOOL bInheritHandles,*/ + 0, /*DWORD dwCreationFlags*/ + NULL, /*LPVOID lpEnvironment*/ + NULL, /*LPCTSTR lpCurrentDirectory*/ + &startupInfo, /*LPSTARTUPINFO lpStartupInfo*/ + &processInformation /*LPPROCESS_INFORMATION lpProcessInformation*/)) + { + wprintf(L"Cannot create process: %d\n", GetLastError()); + return -1; + } + + WaitForSingleObject(processInformation.hProcess, INFINITE); + + DWORD exitCode = 0; + if (!GetExitCodeProcess(processInformation.hProcess, &exitCode)) + { + wprintf(L"Cannot retrieve process exit code: %d\n", GetLastError()); + exitCode = -1; + } + CloseHandle(processInformation.hProcess); + + return exitCode; +} + diff --git a/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.vcproj b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.vcproj new file mode 100644 index 000000000000..1d927d041101 --- /dev/null +++ b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.vcproj @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/stdafx.cpp b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/stdafx.cpp new file mode 100644 index 000000000000..ef12a279f80d --- /dev/null +++ b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// VistaUpdaterLauncher.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/stdafx.h b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/stdafx.h new file mode 100644 index 000000000000..b005a839def2 --- /dev/null +++ b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: reference additional headers your program requires here diff --git a/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/targetver.h b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/targetver.h new file mode 100644 index 000000000000..6fe8eb79e1a1 --- /dev/null +++ b/tools/VistaUpdaterLauncher/VistaUpdaterLauncher/targetver.h @@ -0,0 +1,13 @@ +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif +