advpack: Prepare the unicodification of advpack.dll.
[wine.git] / dlls / advpack / install.c
blobf67c63c5a3d32b1d070b441de4eacd3ebf7bb6af
1 /*
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
21 #include <stdarg.h>
22 #include <stdlib.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "winreg.h"
28 #include "winver.h"
29 #include "setupapi.h"
30 #include "advpub.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(advpack);
35 /* this structure very closely resembles parameters of RunSetupCommand() */
36 typedef struct
38 HWND hwnd;
39 LPCSTR title;
40 LPCSTR inf_name;
41 LPCSTR dir;
42 LPCSTR section_name;
43 } SETUPCOMMAND_PARAMS;
45 /***********************************************************************
46 * DoInfInstall (ADVPACK.@)
48 * Install an INF section.
50 * PARAMS
51 * setup [I] Structure containing install information.
53 * RETURNS
54 * S_OK Everything OK
55 * HRESULT_FROM_WIN32(GetLastError()) Some other error
57 HRESULT WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup)
59 BOOL ret;
60 HINF hinf;
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.
86 * PARAMS
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.
91 * RETURNS
92 * Success: S_OK.
93 * Failure: E_FAIL.
95 * BUGS
96 * Unimplemented
98 HRESULT WINAPI ExecuteCabA( HWND hwnd, CABINFOA* pCab, LPVOID pReserved )
100 FIXME("(%p %p %p): stub\n", hwnd, pCab, pReserved);
101 return E_FAIL;
104 /***********************************************************************
105 * LaunchINFSectionA (ADVPACK.@)
107 * Installs an INF section without BACKUP/ROLLBACK capabilities.
109 * PARAMS
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:
114 * 'A' reboot always
115 * 'I' default, reboot if needed
116 * 'N' no reboot
118 * RETURNS
119 * Success: S_OK.
120 * Failure: S_FALSE
122 * BUGS
123 * Unimplemented.
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 );
128 return 0;
131 /***********************************************************************
132 * LaunchINFSectionExA (ADVPACK.@)
134 * Installs an INF section with BACKUP/ROLLBACK capabilities.
136 * PARAMS
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:
141 * 'A' reboot always
142 * 'I' default, reboot if needed
143 * 'N' no reboot
145 * RETURNS
146 * Success: S_OK.
147 * Failure: E_FAIL.
149 * BUGS
150 * Unimplemented.
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 );
155 return E_FAIL;
158 /***********************************************************************
159 * RunSetupCommandA (ADVPACK.@)
161 * Executes an install section in an INF file or a program.
163 * PARAMS
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
173 * RETURNS
174 * S_OK Everything OK
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
183 * BUGS
184 * Unimplemented
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);
195 return E_UNEXPECTED;