Module: wine Branch: refs/heads/master Commit: fadf610065731c4ad95cd9c8fb43cd8dc761cea8 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=fadf610065731c4ad95cd9c8...
Author: James Hawkins truiken@gmail.com Date: Tue Apr 11 01:26:44 2006 -0500
advpack: Implement UserInstStubWrapper.
---
dlls/advpack/advpack.c | 76 ++++++++++++++++++++++++++++++++++++++++++------ dlls/advpack/install.c | 2 + 2 files changed, 67 insertions(+), 11 deletions(-)
diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c index e9c8321..b84717f 100644 --- a/dlls/advpack/advpack.c +++ b/dlls/advpack/advpack.c @@ -40,6 +40,17 @@ typedef HRESULT (WINAPI *DLLREGISTER) (v #define MAX_FIELD_LENGTH 512 #define PREFIX_LEN 5
+HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE); + +/* registry path of the Installed Components key for per-user stubs */ +static const WCHAR setup_key[] = { + 'S','O','F','T','W','A','R','E','\', + 'M','i','c','r','o','s','o','f','t','\', + 'A','c','t','i','v','e',' ','S','e','t','u','p','\', + 'I','n','s','t','a','l','l','e','d',' ', + 'C','o','m','p','o','n','e','n','t','s',0 +}; + /* parses the destination directory parameters from pszSection * the parameters are of the form: root,key,value,unknown,fallback * we first read the reg value root\key\value and if that fails, @@ -474,14 +485,6 @@ HRESULT WINAPI SetPerUserSecValuesW(PERU { HKEY setup, guid;
- static const WCHAR setup_key[] = { - 'S','O','F','T','W','A','R','E','\', - 'M','i','c','r','o','s','o','f','t','\', - 'A','c','t','i','v','e',' ','S','e','t','u','p','\', - 'I','n','s','t','a','l','l','e','d',' ', - 'C','o','m','p','o','n','e','n','t','s',0 - }; - static const WCHAR stub_path[] = {'S','t','u','b','P','a','t','h',0}; static const WCHAR version[] = {'V','e','r','s','i','o','n',0}; static const WCHAR locale[] = {'L','o','c','a','l','e',0}; @@ -805,13 +808,66 @@ HRESULT WINAPI UserInstStubWrapperA(HWND
/*********************************************************************** * UserInstStubWrapperW (ADVPACK.@) + * + * Launches the user stub wrapper specified by the RealStubPath + * registry value under Installed Components\szParms. + * + * PARAMS + * hWnd [I] Handle to the window used for the display. + * hInstance [I] Instance of the process. + * szParms [I] The GUID of the installation. + * show [I] How the window should be shown. + * + * RETURNS + * Success: S_OK. + * Failure: E_FAIL. + * + * TODO + * If the type of the StubRealPath value is REG_EXPAND_SZ, then + * we should call ExpandEnvironmentStrings on the value and + * launch the result. */ HRESULT WINAPI UserInstStubWrapperW(HWND hWnd, HINSTANCE hInstance, LPWSTR pszParms, INT nShow) { - FIXME("(%p, %p, %s, %i): stub\n", hWnd, hInstance, debugstr_w(pszParms), nShow); + HKEY setup, guid; + WCHAR stub[MAX_PATH]; + DWORD size = MAX_PATH; + HRESULT hr = S_OK; + BOOL res;
- return E_FAIL; + static const WCHAR real_stub_path[] = { + 'R','e','a','l','S','t','u','b','P','a','t','h',0 + }; + + TRACE("(%p, %p, %s, %i)\n", hWnd, hInstance, debugstr_w(pszParms), nShow); + + if (!pszParms || !*pszParms) + return E_INVALIDARG; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, setup_key, 0, KEY_READ, &setup)) + { + return E_FAIL; + } + + if (RegOpenKeyExW(setup, pszParms, 0, KEY_READ, &guid)) + { + RegCloseKey(setup); + return E_FAIL; + } + + res = RegQueryValueExW(guid, real_stub_path, NULL, NULL, (LPBYTE)stub, &size); + if (res || !*stub) + goto done; + + /* launch the user stub wrapper */ + hr = launch_exe(stub, NULL, NULL); + +done: + RegCloseKey(setup); + RegCloseKey(guid); + + return hr; }
/*********************************************************************** diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c index 1378e9e..ddb5f30 100644 --- a/dlls/advpack/install.c +++ b/dlls/advpack/install.c @@ -367,7 +367,7 @@ done: return hr; }
-static HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE) +HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE) { STARTUPINFOW si; PROCESS_INFORMATION pi;