James Hawkins : advpack:
Perform a setupapi-level install of the INF file in RunSetupCommand.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Apr 11 05:05:10 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 698ee36c852ba6922f78a8d6a499e4dbe0faaa48
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=698ee36c852ba6922f78a8d6a499e4dbe0faaa48
Author: James Hawkins <truiken at gmail.com>
Date: Tue Apr 11 00:18:49 2006 -0500
advpack: Perform a setupapi-level install of the INF file in RunSetupCommand.
---
dlls/advpack/install.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
index 1cc7d32..1378e9e 100644
--- a/dlls/advpack/install.c
+++ b/dlls/advpack/install.c
@@ -74,6 +74,40 @@ static BOOL is_full_path(LPWSTR path)
return FALSE;
}
+/* performs a setupapi-level install of the INF file */
+static HRESULT spapi_install(HINF hinf, LPCWSTR install_sec, LPCWSTR source_path)
+{
+ BOOL ret;
+ HRESULT res;
+ PVOID context;
+
+ context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, NULL);
+ if (!context)
+ return ADV_HRESULT(GetLastError());
+
+ ret = SetupInstallFromInfSectionW(NULL, hinf, install_sec, SPINST_FILES,
+ NULL, source_path, SP_COPY_NEWER,
+ NULL, context, NULL, NULL);
+ if (!ret)
+ {
+ res = ADV_HRESULT(GetLastError());
+ SetupTermDefaultQueueCallback(context);
+
+ return res;
+ }
+
+ SetupTermDefaultQueueCallback(context);
+
+ ret = SetupInstallFromInfSectionW(NULL, hinf, install_sec,
+ SPINST_INIFILES | SPINST_REGISTRY,
+ HKEY_LOCAL_MACHINE, NULL, 0,
+ NULL, NULL, NULL, NULL);
+ if (!ret)
+ return ADV_HRESULT(GetLastError());
+
+ return S_OK;
+}
+
/* this structure very closely resembles parameters of RunSetupCommand() */
typedef struct
{
@@ -438,6 +472,7 @@ HRESULT WINAPI RunSetupCommandW(HWND hWn
DWORD dwFlags, LPVOID pvReserved)
{
HINF hinf;
+ HRESULT hr;
TRACE("(%p, %s, %s, %s, %s, %p, %ld, %p)\n",
hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection),
@@ -457,6 +492,8 @@ HRESULT WINAPI RunSetupCommandW(HWND hWn
if (hinf == INVALID_HANDLE_VALUE)
return ADV_HRESULT(GetLastError());
+ hr = spapi_install(hinf, szInfSection, szDir);
+
SetupCloseInfFile(hinf);
- return E_UNEXPECTED;
+ return hr;
}
More information about the wine-cvs
mailing list