/*********************************************************************** * ExecuteCabW (ADVPACK.@) * * Installs the INF file extracted from a specified cabinet file. * * PARAMS * hwnd [I] Handle to the window used for the display. * pCab [I] Information about the cabinet file. * pReserved [I] Reserved. Must be NULL. * * RETURNS * Success: S_OK. * Failure: E_FAIL. */ HRESULT WINAPI ExecuteCabW(HWND hwnd, CABINFOW* pCab, LPVOID pReserved) { ADVInfo info; HRESULT hr; TRACE("(%p, %p, %p)\n", hwnd, pCab, pReserved); ZeroMemory(&info, sizeof(ADVInfo)); if (pCab->pszCab && *pCab->pszCab) FIXME("Cab archive not extracted!\n"); hr = install_init(pCab->pszInf, pCab->pszSection, pCab->szSrcPath, pCab->dwFlags, &info); if (hr != S_OK) goto done; hr = spapi_install(&info); if (hr != S_OK) goto done; hr = adv_install(&info); done: install_release(&info); return hr; }
//------------------------------ int main(int argc, char **argv) { const char* hostname; int verbose = 0; while (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { case 'v': verbose = 1; break; default: usage(); } argc--; argv++; } if (argc != 3) { usage(); } win32_specific_startup(); hostname = argv[1]; show_releases(hostname, verbose); gth_switch_to(hostname, "failsafe", 1); install_release(hostname, argv[2], verbose); gth_switch_to(hostname, "system", 1); show_releases(hostname, verbose); return 0; }
/*********************************************************************** * LaunchINFSectionW (ADVPACK.@) * * Installs an INF section without BACKUP/ROLLBACK capabilities. * * PARAMS * hWnd [I] Handle to parent window, NULL for desktop. * hInst [I] Instance of the process. * cmdline [I] Contains parameters in the order INF,section,flags,reboot. * show [I] How the window should be shown. * * RETURNS * Success: ADV_SUCCESS. * Failure: ADV_FAILURE. * * NOTES * INF - Filename of the INF to launch. * section - INF section to install. * flags - see advpub.h. * reboot - smart reboot behavior * 'A' Always reboot. * 'I' Reboot if needed (default). * 'N' No reboot. */ INT WINAPI LaunchINFSectionW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT show) { ADVInfo info; LPWSTR cmdline_copy, cmdline_ptr; LPWSTR inf_filename, install_sec; LPWSTR str_flags; DWORD flags = 0; HRESULT hr = S_OK; TRACE("(%p, %p, %s, %d)\n", hWnd, hInst, debugstr_w(cmdline), show); if (!cmdline) return ADV_FAILURE; cmdline_copy = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(cmdline) + 1) * sizeof(WCHAR)); cmdline_ptr = cmdline_copy; lstrcpyW(cmdline_copy, cmdline); inf_filename = get_parameter(&cmdline_ptr, ',', TRUE); install_sec = get_parameter(&cmdline_ptr, ',', TRUE); str_flags = get_parameter(&cmdline_ptr, ',', TRUE); if (str_flags) flags = atolW(str_flags); ZeroMemory(&info, sizeof(ADVInfo)); hr = install_init(inf_filename, install_sec, NULL, flags, &info); if (hr != S_OK) goto done; hr = spapi_install(&info); if (hr != S_OK) goto done; hr = adv_install(&info); done: install_release(&info); HeapFree(GetProcessHeap(), 0, cmdline_copy); return SUCCEEDED(hr) ? ADV_SUCCESS : ADV_FAILURE; }
/*********************************************************************** * RunSetupCommandW (ADVPACK.@) * * Executes an install section in an INF file or a program. * * PARAMS * hWnd [I] Handle to parent window, NULL for quiet mode * szCmdName [I] Inf or EXE filename to execute * szInfSection [I] Inf section to install, NULL for DefaultInstall * szDir [I] Path to extracted files * szTitle [I] Title of all dialogs * phEXE [O] Handle of EXE to wait for * dwFlags [I] Flags; see include/advpub.h * pvReserved [I] Reserved * * RETURNS * S_OK Everything OK * S_ASYNCHRONOUS OK, required to wait on phEXE * ERROR_SUCCESS_REBOOT_REQUIRED Reboot required * E_INVALIDARG Invalid argument given * HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION) * Not supported on this Windows version * E_UNEXPECTED Unexpected error * HRESULT_FROM_WIN32(GetLastError()) Some other error */ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, LPCWSTR szInfSection, LPCWSTR szDir, LPCWSTR lpszTitle, HANDLE *phEXE, DWORD dwFlags, LPVOID pvReserved) { ADVInfo info; HRESULT hr; TRACE("(%p, %s, %s, %s, %s, %p, %d, %p)\n", hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection), debugstr_w(szDir), debugstr_w(lpszTitle), phEXE, dwFlags, pvReserved); if (dwFlags & RSC_FLAG_UPDHLPDLLS) FIXME("Unhandled flag: RSC_FLAG_UPDHLPDLLS\n"); if (!szCmdName || !szDir) return E_INVALIDARG; if (!(dwFlags & RSC_FLAG_INF)) return launch_exe(szCmdName, szDir, phEXE); ZeroMemory(&info, sizeof(ADVInfo)); hr = install_init(szCmdName, szInfSection, szDir, dwFlags, &info); if (hr != S_OK) goto done; hr = spapi_install(&info); if (hr != S_OK) goto done; hr = adv_install(&info); done: install_release(&info); return hr; }
/* internal: see DoInfInstall */ static HRESULT DoInfInstallW(const SETUPCOMMAND_PARAMSW *setup) { ADVInfo info; HRESULT hr; TRACE("(%p)\n", setup); ZeroMemory(&info, sizeof(ADVInfo)); hr = install_init(setup->inf_name, setup->section_name, setup->dir, 0, &info); if (hr != S_OK) goto done; hr = spapi_install(&info); if (hr != S_OK) goto done; hr = adv_install(&info); done: install_release(&info); return S_OK; }