James Hawkins : advpack:
Implement the launching of executables in RunSetupCommand.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 27 05:29:13 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 480b64950b9c9212a10d62dcec5c8a733fef6171
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=480b64950b9c9212a10d62dcec5c8a733fef6171
Author: James Hawkins <truiken at gmail.com>
Date: Sun Mar 26 22:05:58 2006 -0600
advpack: Implement the launching of executables in RunSetupCommand.
---
dlls/advpack/install.c | 42 +++++++++++++++++++++++++++++++++++++++---
dlls/advpack/tests/install.c | 16 +++++-----------
2 files changed, 44 insertions(+), 14 deletions(-)
diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
index ecf8a18..c6bc6c5 100644
--- a/dlls/advpack/install.c
+++ b/dlls/advpack/install.c
@@ -156,6 +156,39 @@ HRESULT WINAPI LaunchINFSectionExA( HWND
return E_FAIL;
}
+static HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE)
+{
+ STARTUPINFOW si;
+ PROCESS_INFORMATION pi;
+
+ if (phEXE) *phEXE = NULL;
+
+ ZeroMemory(&pi, sizeof(pi));
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
+
+ if (!CreateProcessW(NULL, (LPWSTR)cmd, NULL, NULL, FALSE,
+ CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_PROCESS_GROUP,
+ NULL, dir, &si, &pi))
+ {
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ CloseHandle(pi.hThread);
+
+ if (phEXE)
+ {
+ *phEXE = pi.hProcess;
+ return S_ASYNCHRONOUS;
+ }
+
+ /* wait for the child process to finish */
+ WaitForSingleObject(pi.hProcess, INFINITE);
+ CloseHandle(pi.hProcess);
+
+ return S_OK;
+}
+
/***********************************************************************
* RunSetupCommandA (ADVPACK.@)
*
@@ -220,23 +253,26 @@ HRESULT WINAPI RunSetupCommandA(HWND hWn
* HRESULT_FROM_WIN32(GetLastError()) Some other error
*
* BUGS
- * Unimplemented
+ * INF install unimplemented.
*/
HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName,
LPCWSTR szInfSection, LPCWSTR szDir,
LPCWSTR lpszTitle, HANDLE *phEXE,
DWORD dwFlags, LPVOID pvReserved )
{
- FIXME("(%p, %s, %s, %s, %s, %p, 0x%08lx, %p): stub\n",
+ TRACE("(%p, %s, %s, %s, %s, %p, 0x%08lx, %p)\n",
hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection),
debugstr_w(szDir), debugstr_w(lpszTitle),
phEXE, dwFlags, pvReserved);
+ if (dwFlags)
+ FIXME("Unhandled flags: 0x%08lx\n", dwFlags);
+
if (!szCmdName || !szDir)
return E_INVALIDARG;
if (!(dwFlags & RSC_FLAG_INF))
- *phEXE = NULL;
+ return launch_exe(szCmdName, szDir, phEXE);
return E_UNEXPECTED;
}
diff --git a/dlls/advpack/tests/install.c b/dlls/advpack/tests/install.c
index 4810868..26f0fa4 100644
--- a/dlls/advpack/tests/install.c
+++ b/dlls/advpack/tests/install.c
@@ -56,22 +56,16 @@ static void test_RunSetupCommand()
/* try to run a non-existent exe */
hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "idontexist.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL);
- todo_wine
- {
- ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
- "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld\n", hr);
- }
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
+ "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld\n", hr);
ok(hexe == NULL, "Expcted hexe to be NULL\n");
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
/* try a bad directory */
hexe = (HANDLE)0xdeadbeef;
- hr = pRunSetupCommand(NULL, "winve.exe", "Install", "", "Title", &hexe, 0, NULL);
- todo_wine
- {
- ok(hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY),
- "Expected HRESULT_FROM_WIN32(ERROR_DIRECTORY), got %ld\n", hr);
- }
+ hr = pRunSetupCommand(NULL, "winver.exe", "Install", "non\\existent\\directory", "Title", &hexe, 0, NULL);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY),
+ "Expected HRESULT_FROM_WIN32(ERROR_DIRECTORY), got %ld\n", hr);
ok(hexe == NULL, "Expcted hexe to be NULL\n");
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
More information about the wine-cvs
mailing list