advpack: Implement DoInfInstall on top of the install framework.
This commit is contained in:
parent
0012f56a61
commit
1a0208ef61
@ -460,6 +460,41 @@ typedef struct
|
|||||||
LPCSTR section_name;
|
LPCSTR section_name;
|
||||||
} SETUPCOMMAND_PARAMS;
|
} SETUPCOMMAND_PARAMS;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
HWND hwnd;
|
||||||
|
LPCWSTR title;
|
||||||
|
LPCWSTR inf_name;
|
||||||
|
LPCWSTR dir;
|
||||||
|
LPCWSTR section_name;
|
||||||
|
} SETUPCOMMAND_PARAMSW;
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DoInfInstall (ADVPACK.@)
|
* DoInfInstall (ADVPACK.@)
|
||||||
*
|
*
|
||||||
@ -474,24 +509,32 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
HRESULT WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup)
|
HRESULT WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
UNICODE_STRING title, inf, section, dir;
|
||||||
HINF hinf;
|
SETUPCOMMAND_PARAMSW params;
|
||||||
void *callback_context;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p)\n", setup);
|
if (!setup)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
hinf = SetupOpenInfFileA(setup->inf_name, NULL, INF_STYLE_WIN4, NULL);
|
RtlCreateUnicodeStringFromAsciiz(&title, setup->title);
|
||||||
if (hinf == INVALID_HANDLE_VALUE) return HRESULT_FROM_WIN32(GetLastError());
|
RtlCreateUnicodeStringFromAsciiz(&inf, setup->inf_name);
|
||||||
|
RtlCreateUnicodeStringFromAsciiz(§ion, setup->section_name);
|
||||||
|
RtlCreateUnicodeStringFromAsciiz(&dir, setup->dir);
|
||||||
|
|
||||||
callback_context = SetupInitDefaultQueueCallback(setup->hwnd);
|
params.title = title.Buffer;
|
||||||
|
params.inf_name = inf.Buffer;
|
||||||
|
params.section_name = section.Buffer;
|
||||||
|
params.dir = dir.Buffer;
|
||||||
|
params.hwnd = setup->hwnd;
|
||||||
|
|
||||||
ret = SetupInstallFromInfSectionA(NULL, hinf, setup->section_name, SPINST_ALL,
|
hr = DoInfInstallW(¶ms);
|
||||||
NULL, NULL, 0, SetupDefaultQueueCallbackA,
|
|
||||||
callback_context, NULL, NULL);
|
|
||||||
SetupTermDefaultQueueCallback(callback_context);
|
|
||||||
SetupCloseInfFile(hinf);
|
|
||||||
|
|
||||||
return ret ? S_OK : HRESULT_FROM_WIN32(GetLastError());
|
RtlFreeUnicodeString(&title);
|
||||||
|
RtlFreeUnicodeString(&inf);
|
||||||
|
RtlFreeUnicodeString(§ion);
|
||||||
|
RtlFreeUnicodeString(&dir);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user