DWORD VCRedistx86Bootstrap(const TempDirectory& prereqs, const std::wstring& elevateDll) { if (IsVCRedist2015x86Installed()) { return 0; } auto vcredistX86 = prereqs.Path() + L"\\vc_redist.x86.exe"s; println(L"Downloading Visual C++ 2015 redistributable (x86)"); DownloadStatus status; downloadFile(L"https://download.microsoft.com/download/C/E/5/CE514EAE-78A8-4381-86E8-29108D78DBD4/VC_redist.x86.exe", vcredistX86.c_str(), &status); println(""); std::wstring cmdline = vcredistX86 + L" /install /quiet /norestart"; println(L"Installing Visual C++ 2015 redistributable (x86)"); LPSTARTUPINFO si; LPPROCESS_INFORMATION pi; BOOL success = CreateProcessElevatedIfNeeded(const_cast<LPWSTR>(cmdline.c_str()), prereqs.PathCStr(), si, pi, elevateDll.c_str()); if (!success) { return GetLastError(); } WaitForSingleObject(pi->hProcess, INFINITE); DWORD result; GetExitCodeProcess(pi->hProcess, &result); CloseHandle(pi->hThread); CloseHandle(pi->hProcess); println(L"Finished"); return result; }
BOOL NetFxBootstrap(const TempDirectory& prereqs, const std::wstring& elevateDll) { if (IsNetfx46Installed()) { return true; } auto netFxInstall = prereqs.Path() + L"\\NDP46-KB3045560-Web.exe"s; println(L"Downloading .NET 4.6"); DownloadStatus status; //downloadFile(L"https://download.microsoft.com/download/1/4/A/14A6C422-0D3C-4811-A31F-5EF91A83C368/NDP46-KB3045560-Web.exe", netFxInstall.c_str(), &status); downloadFile(L"https://download.microsoft.com/download/3/5/9/35980F81-60F4-4DE3-88FC-8F962B97253B/NDP461-KB3102438-Web.exe", netFxInstall.c_str(), &status); println(""); std::wstring args = L"/q /norestart /ChainingPackage Winston"; println(L"Installing .NET 4.6"); auto result = Server().Launch(args, netFxInstall, prereqs.Path(), elevateDll); print(L"result "); println(result); return result; }