2 * Advpack install functions
4 * Copyright 2006 James Hawkins
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(advpack
);
35 /* this structure very closely resembles parameters of RunSetupCommand() */
43 } SETUPCOMMAND_PARAMS
;
45 /***********************************************************************
46 * DoInfInstall (ADVPACK.@)
48 * Install an INF section.
51 * setup [I] Structure containing install information.
55 * HRESULT_FROM_WIN32(GetLastError()) Some other error
57 HRESULT WINAPI
DoInfInstall(const SETUPCOMMAND_PARAMS
*setup
)
61 void *callback_context
;
63 TRACE("%p %s %s %s %s\n", setup
->hwnd
, debugstr_a(setup
->title
),
64 debugstr_a(setup
->inf_name
), debugstr_a(setup
->dir
),
65 debugstr_a(setup
->section_name
));
67 hinf
= SetupOpenInfFileA(setup
->inf_name
, NULL
, INF_STYLE_WIN4
, NULL
);
68 if (hinf
== INVALID_HANDLE_VALUE
) return HRESULT_FROM_WIN32(GetLastError());
70 callback_context
= SetupInitDefaultQueueCallback(setup
->hwnd
);
72 ret
= SetupInstallFromInfSectionA(NULL
, hinf
, setup
->section_name
, SPINST_ALL
,
73 NULL
, NULL
, 0, SetupDefaultQueueCallbackA
,
74 callback_context
, NULL
, NULL
);
75 SetupTermDefaultQueueCallback(callback_context
);
76 SetupCloseInfFile(hinf
);
78 return ret
? S_OK
: HRESULT_FROM_WIN32(GetLastError());
81 /***********************************************************************
82 * ExecuteCabA (ADVPACK.@)
84 * Installs the INF file extracted from a specified cabinet file.
87 * hwnd [I] Handle to the window used for the display.
88 * pCab [I] Information about the cabinet file.
89 * pReserved [I] Reserved. Must be NULL.
98 HRESULT WINAPI
ExecuteCabA( HWND hwnd
, CABINFOA
* pCab
, LPVOID pReserved
)
100 FIXME("(%p %p %p): stub\n", hwnd
, pCab
, pReserved
);
104 /***********************************************************************
105 * LaunchINFSectionA (ADVPACK.@)
107 * Installs an INF section without BACKUP/ROLLBACK capabilities.
110 * hWnd [I] Handle to parent window, NULL for desktop.
111 * hInst [I] Instance of the process.
112 * cmdline [I] Contains parameters in the order INF,section,flags.
113 * show [I] Reboot behaviour:
115 * 'I' default, reboot if needed
125 INT WINAPI
LaunchINFSectionA( HWND hWnd
, HINSTANCE hInst
, LPSTR cmdline
, INT show
)
127 FIXME("(%p %p %s %d): stub\n", hWnd
, hInst
, debugstr_a(cmdline
), show
);
131 /***********************************************************************
132 * LaunchINFSectionExA (ADVPACK.@)
134 * Installs an INF section with BACKUP/ROLLBACK capabilities.
137 * hWnd [I] Handle to parent window, NULL for desktop.
138 * hInst [I] Instance of the process.
139 * cmdline [I] Contains parameters in the order INF,section,CAB,flags.
140 * show [I] Reboot behaviour:
142 * 'I' default, reboot if needed
152 HRESULT WINAPI
LaunchINFSectionExA( HWND hWnd
, HINSTANCE hInst
, LPSTR cmdline
, INT show
)
154 FIXME("(%p %p %s %d): stub\n", hWnd
, hInst
, debugstr_a(cmdline
), show
);
158 /***********************************************************************
159 * RunSetupCommandA (ADVPACK.@)
161 * Executes an install section in an INF file or a program.
164 * hWnd [I] Handle to parent window, NULL for quiet mode
165 * szCmdName [I] Inf or EXE filename to execute
166 * szInfSection [I] Inf section to install, NULL for DefaultInstall
167 * szDir [I] Path to extracted files
168 * szTitle [I] Title of all dialogs
169 * phEXE [O] Handle of EXE to wait for
170 * dwFlags [I] Flags; see include/advpub.h
171 * pvReserved [I] Reserved
175 * S_ASYNCHRONOUS OK, required to wait on phEXE
176 * ERROR_SUCCESS_REBOOT_REQUIRED Reboot required
177 * E_INVALIDARG Invalid argument given
178 * HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION)
179 * Not supported on this Windows version
180 * E_UNEXPECTED Unexpected error
181 * HRESULT_FROM_WIN32(GetLastError()) Some other error
186 HRESULT WINAPI
RunSetupCommandA(HWND hWnd
, LPCSTR szCmdName
,
187 LPCSTR szInfSection
, LPCSTR szDir
,
188 LPCSTR lpszTitle
, HANDLE
*phEXE
,
189 DWORD dwFlags
, LPVOID pvReserved
)
191 FIXME("(%p, %s, %s, %s, %s, %p, 0x%08lx, %p): stub\n",
192 hWnd
, debugstr_a(szCmdName
), debugstr_a(szInfSection
),
193 debugstr_a(szDir
), debugstr_a(lpszTitle
),
194 phEXE
, dwFlags
, pvReserved
);