advpack: Use get_parameter to read the three parameters of RegisterOCX.
Use get_parameter to read the three parameters to RegisterOCX. Remove the ERRs and TRACEs now that we return the HRESULT.
This commit is contained in:
parent
39c0682bff
commit
1bc69125af
|
@ -416,44 +416,46 @@ HRESULT WINAPI RebootCheckOnInstallW(HWND hWnd, LPCWSTR pszINF,
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI RegisterOCX(HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show)
|
HRESULT WINAPI RegisterOCX(HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show)
|
||||||
{
|
{
|
||||||
WCHAR wszBuff[MAX_PATH];
|
LPWSTR ocx_filename, str_flags, param;
|
||||||
WCHAR* pwcComma;
|
LPWSTR cmdline_copy, cmdline_ptr;
|
||||||
HMODULE hm;
|
UNICODE_STRING cmdlineW;
|
||||||
DLLREGISTER pfnRegister;
|
DLLREGISTER pfnRegister;
|
||||||
HRESULT hr;
|
HRESULT hr = E_FAIL;
|
||||||
|
HMODULE hm = NULL;
|
||||||
|
DWORD size;
|
||||||
|
|
||||||
TRACE("(%s)\n", debugstr_a(cmdline));
|
TRACE("(%s)\n", debugstr_a(cmdline));
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, cmdline, strlen(cmdline), wszBuff, MAX_PATH);
|
RtlCreateUnicodeStringFromAsciiz(&cmdlineW, cmdline);
|
||||||
if ((pwcComma = strchrW( wszBuff, ',' ))) *pwcComma = 0;
|
|
||||||
|
|
||||||
TRACE("Parsed DLL name (%s)\n", debugstr_w(wszBuff));
|
size = (lstrlenW(cmdlineW.Buffer) + 1) * sizeof(WCHAR);
|
||||||
|
cmdline_copy = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
cmdline_ptr = cmdline_copy;
|
||||||
|
lstrcpyW(cmdline_copy, cmdlineW.Buffer);
|
||||||
|
|
||||||
hm = LoadLibraryExW(wszBuff, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
|
ocx_filename = get_parameter(&cmdline_ptr, ',');
|
||||||
|
if (!ocx_filename || !*ocx_filename)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
str_flags = get_parameter(&cmdline_ptr, ',');
|
||||||
|
param = get_parameter(&cmdline_ptr, ',');
|
||||||
|
|
||||||
|
hm = LoadLibraryExW(ocx_filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||||
if (!hm)
|
if (!hm)
|
||||||
{
|
goto done;
|
||||||
ERR("Couldn't load DLL: %s\n", debugstr_w(wszBuff));
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pfnRegister = (DLLREGISTER)GetProcAddress(hm, "DllRegisterServer");
|
pfnRegister = (DLLREGISTER)GetProcAddress(hm, "DllRegisterServer");
|
||||||
if (pfnRegister == NULL)
|
if (!pfnRegister)
|
||||||
{
|
goto done;
|
||||||
ERR("DllRegisterServer entry point not found\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hr = pfnRegister();
|
hr = pfnRegister();
|
||||||
if (hr != S_OK)
|
|
||||||
{
|
|
||||||
ERR("DllRegisterServer entry point returned %08lx\n", hr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("Successfully registered OCX\n");
|
|
||||||
|
|
||||||
|
done:
|
||||||
FreeLibrary(hm);
|
FreeLibrary(hm);
|
||||||
return S_OK;
|
HeapFree(GetProcessHeap(), 0, cmdline_copy);
|
||||||
|
RtlFreeUnicodeString(&cmdlineW);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
Loading…
Reference in New Issue