#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "winternl.h"
#include "winnls.h"
#include "setupapi.h"
#include "advpub.h"
#include "ole2.h"
#include "wine/debug.h"
#include "advpack_private.h"
Go to the source code of this file.
|
| | WINE_DEFAULT_DEBUG_CHANNEL (advpack) |
| |
| static HRESULT | del_dirs_callback (HINF hinf, PCWSTR field, const void *arg) |
| |
| static HRESULT | per_user_install_callback (HINF hinf, PCWSTR field, const void *arg) |
| |
| static HRESULT | register_ocxs_callback (HINF hinf, PCWSTR field, const void *arg) |
| |
| static HRESULT | run_setup_commands_callback (HINF hinf, PCWSTR field, const void *arg) |
| |
| LPWSTR | get_parameter (LPWSTR *params, WCHAR separator, BOOL quoted) |
| |
| static BOOL | is_full_path (LPCWSTR path) |
| |
| static WCHAR * | get_field_string (INFCONTEXT *context, DWORD index, WCHAR *buffer, const WCHAR *static_buffer, DWORD *size) |
| |
| static HRESULT | iterate_section_fields (HINF hinf, PCWSTR section, PCWSTR key, iterate_fields_func callback, void *arg) |
| |
| static HRESULT | check_admin_rights (const ADVInfo *info) |
| |
| static HRESULT | spapi_install (const ADVInfo *info) |
| |
| static HRESULT | adv_install (ADVInfo *info) |
| |
| static HRESULT | get_working_dir (ADVInfo *info, LPCWSTR inf_filename, LPCWSTR working_dir) |
| |
| static HRESULT | install_init (LPCWSTR inf_filename, LPCWSTR install_sec, LPCWSTR working_dir, DWORD flags, ADVInfo *info) |
| |
| static void | install_release (const ADVInfo *info) |
| |
| static HRESULT | DoInfInstallW (const SETUPCOMMAND_PARAMSW *setup) |
| |
| HRESULT WINAPI | DoInfInstall (const SETUPCOMMAND_PARAMS *setup) |
| |
| HRESULT WINAPI | ExecuteCabA (HWND hwnd, CABINFOA *pCab, LPVOID pReserved) |
| |
| HRESULT WINAPI | ExecuteCabW (HWND hwnd, CABINFOW *pCab, LPVOID pReserved) |
| |
| INT WINAPI | LaunchINFSectionA (HWND hWnd, HINSTANCE hInst, LPSTR cmdline, INT show) |
| |
| INT WINAPI | LaunchINFSectionW (HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT show) |
| |
| HRESULT WINAPI | LaunchINFSectionExA (HWND hWnd, HINSTANCE hInst, LPSTR cmdline, INT show) |
| |
| HRESULT WINAPI | LaunchINFSectionExW (HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT show) |
| |
| HRESULT | launch_exe (LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE) |
| |
| HRESULT WINAPI | RunSetupCommandA (HWND hWnd, LPCSTR szCmdName, LPCSTR szInfSection, LPCSTR szDir, LPCSTR lpszTitle, HANDLE *phEXE, DWORD dwFlags, LPVOID pvReserved) |
| |
| HRESULT WINAPI | RunSetupCommandW (HWND hWnd, LPCWSTR szCmdName, LPCWSTR szInfSection, LPCWSTR szDir, LPCWSTR lpszTitle, HANDLE *phEXE, DWORD dwFlags, LPVOID pvReserved) |
| |
◆ ADV_FAILURE
◆ ADV_HRESULT
◆ ADV_SUCCESS
◆ HRESULT_FROM_SPAPI
◆ SPAPI_ERROR
| #define SPAPI_ERROR 0xE0000000L |
◆ SPAPI_MASK
◆ SPAPI_PREFIX
| #define SPAPI_PREFIX 0x800F0000L |
◆ ADVInfo
◆ iterate_fields_func
◆ adv_install()
Definition at line 328 of file install.c.
329{
331
335
340
347
352
357
361
363}
static HRESULT per_user_install_callback(HINF hinf, PCWSTR field, const void *arg)
static HRESULT iterate_section_fields(HINF hinf, PCWSTR section, PCWSTR key, iterate_fields_func callback, void *arg)
static HRESULT del_dirs_callback(HINF hinf, PCWSTR field, const void *arg)
static HRESULT run_setup_commands_callback(HINF hinf, PCWSTR field, const void *arg)
static HRESULT register_ocxs_callback(HINF hinf, PCWSTR field, const void *arg)
static HRESULT check_admin_rights(const ADVInfo *info)
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Referenced by DoInfInstallW(), ExecuteCabW(), LaunchINFSectionW(), and RunSetupCommandW().
◆ check_admin_rights()
Definition at line 274 of file install.c.
275{
279
282
285
288
290}
BOOL WINAPI IsNTAdmin(DWORD reserved, LPDWORD pReserved)
#define check(expected, result)
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Referenced by adv_install().
◆ del_dirs_callback()
Definition at line 63 of file install.c.
64{
68
70
72 {
74
77 continue;
78
81 }
82
84}
HRESULT WINAPI DelNodeW(LPCWSTR pszFileOrDirName, DWORD dwFlags)
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
#define MAX_INF_STRING_LENGTH
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Referenced by adv_install().
◆ DoInfInstall()
Definition at line 534 of file install.c.
535{
539
542
547
553
555
560
562}
static HRESULT DoInfInstallW(const SETUPCOMMAND_PARAMSW *setup)
GLenum const GLfloat * params
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
◆ DoInfInstallW()
Definition at line 497 of file install.c.
498{
501
503
505
508 goto done;
509
512 goto done;
513
515
516done:
518
520}
static void install_release(const ADVInfo *info)
static HRESULT spapi_install(const ADVInfo *info)
static HRESULT adv_install(ADVInfo *info)
static HRESULT install_init(LPCWSTR inf_filename, LPCWSTR install_sec, LPCWSTR working_dir, DWORD flags, ADVInfo *info)
Referenced by DoInfInstall().
◆ ExecuteCabA()
Definition at line 569 of file install.c.
570{
574
576
577 if (!pCab)
579
581 {
584 }
585 else
587
590
592
596
598
601
604
606}
HRESULT WINAPI ExecuteCabW(HWND hwnd, CABINFOW *pCab, LPVOID pReserved)
#define MultiByteToWideChar
WCHAR szSrcPath[MAX_PATH]
◆ ExecuteCabW()
Definition at line 622 of file install.c.
623{
626
628
630
632 {
635
638 ERR(
"Failed to extract .inf file!\n");
639 }
640
643 goto done;
644
647 goto done;
648
650
651done:
653
655}
HRESULT WINAPI ExtractFilesW(LPCWSTR CabName, LPCWSTR ExpandDir, DWORD Flags, LPCWSTR FileList, LPVOID LReserved, DWORD Reserved)
Referenced by ExecuteCabA(), LaunchINFSectionExW(), and RegInstallW().
◆ get_field_string()
Definition at line 220 of file install.c.
222{
224
226
228 {
229
234 }
235
238}
#define ERROR_INSUFFICIENT_BUFFER
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
DWORD WINAPI GetLastError(void)
Referenced by iterate_section_fields().
◆ get_parameter()
Definition at line 178 of file install.c.
179{
181
184
185 if (quoted && *
token ==
'"')
186 {
189 {
193 }
194 }
195
198 *(*params)++ = '\0';
199
202
204}
static const WCHAR separator[]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Referenced by DelNodeRunDLL32W(), LaunchINFSectionExW(), LaunchINFSectionW(), RegisterOCX(), and set_ldids().
◆ get_working_dir()
Definition at line 366 of file install.c.
367{
371
373 {
374 len =
ptr - inf_filename + 1;
376 }
377 else if (working_dir && *working_dir)
378 {
381 }
382 else
383 {
387
388
390 {
392 }
393 else
394 {
395
398 }
399
402 }
403
405 if (!
info->working_dir)
407
409
411}
#define GetCurrentDirectoryW(x, y)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define INVALID_FILE_ATTRIBUTES
Referenced by install_init().
◆ install_init()
Definition at line 414 of file install.c.
416{
420
423
425 if (!
info->inf_filename)
427
428
429 info->install_sec =
wcsdup(install_sec && *install_sec ? install_sec :
L"DefaultInstall");
430 if (!
info->install_sec)
432
436
441
445
446
449 else
451
455
457
458
459
462
464}
void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir)
static HRESULT get_working_dir(ADVInfo *info, LPCWSTR inf_filename, LPCWSTR working_dir)
#define INVALID_HANDLE_VALUE
static wchar_t * wcsdup(const wchar_t *str)
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Referenced by DoInfInstallW(), ExecuteCabW(), LaunchINFSectionW(), and RunSetupCommandW().
◆ install_release()
◆ is_full_path()
◆ iterate_section_fields()
Definition at line 241 of file install.c.
243{
244 WCHAR static_buffer[200];
249
252 {
254
256 {
258 goto done;
259
261 goto done;
262 }
263
265 }
266
268
269 done:
272}
static WCHAR * get_field_string(INFCONTEXT *context, DWORD index, WCHAR *buffer, const WCHAR *static_buffer, DWORD *size)
BOOL WINAPI SetupFindNextMatchLineW(PINFCONTEXT context_in, PCWSTR key, PINFCONTEXT context_out)
GLuint GLuint GLsizei count
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static IPrintDialogCallback callback
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Referenced by adv_install(), SetupInstallFilesFromInfSectionW(), SetupInstallFromInfSectionW(), and SetupInstallServicesFromInfSectionExW().
◆ launch_exe()
Definition at line 850 of file install.c.
851{
854
855 if (phEXE) *phEXE =
NULL;
856
860
864 {
866 }
867
869
870 if (phEXE)
871 {
874 }
875
876
879
881}
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
static PROCESS_INFORMATION pi
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
#define CREATE_DEFAULT_ERROR_MODE
#define CREATE_NEW_PROCESS_GROUP
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Referenced by run_setup_commands_callback(), RunSetupCommandW(), and UserInstStubWrapperW().
◆ LaunchINFSectionA()
Definition at line 662 of file install.c.
663{
666
668
671
673
675
677
679}
INT WINAPI LaunchINFSectionW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT show)
◆ LaunchINFSectionExA()
Definition at line 757 of file install.c.
758{
761
763
766
768
770
772
774}
HRESULT WINAPI LaunchINFSectionExW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT show)
◆ LaunchINFSectionExW()
Definition at line 803 of file install.c.
804{
805 LPWSTR cmdline_copy, cmdline_ptr;
809
811
814
816 cmdline_ptr = cmdline_copy;
817
822
826
828 {
831 }
832
833
835 {
838 else
840
843 }
844
848}
static BOOL is_full_path(LPCWSTR path)
LPWSTR get_parameter(LPWSTR *params, WCHAR separator, BOOL quoted)
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Referenced by LaunchINFSectionExA().
◆ LaunchINFSectionW()
Definition at line 705 of file install.c.
706{
708 LPWSTR cmdline_copy, cmdline_ptr;
709 LPWSTR inf_filename, install_sec;
713
715
718
720 cmdline_ptr = cmdline_copy;
721
724
726 if (str_flags)
727 {
731 }
732
734
737 goto done;
738
741 goto done;
742
744
745done:
748
750}
Referenced by LaunchINFSectionA().
◆ per_user_install_callback()
Definition at line 86 of file install.c.
87{
91
94
96
98
100 {
102 }
103
105
107
109
111
113}
HRESULT WINAPI SetPerUserSecValuesW(PERUSERSECTIONW *pPerUser)
WCHAR szStub[MAX_PATH *4]
Referenced by adv_install().
◆ register_ocxs_callback()
Definition at line 115 of file install.c.
116{
120
122
124 {
126
127
129 continue;
130
132 if (hm)
133 {
136
138 }
139 else
141
143 {
144
145 break;
146 }
147 }
148
150}
HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
#define LOAD_WITH_ALTERED_SEARCH_PATH
Referenced by adv_install().
◆ run_setup_commands_callback()
Definition at line 152 of file install.c.
153{
158
160
162 {
164
167 continue;
168
171 }
172
174}
HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE)
Referenced by adv_install().
◆ RunSetupCommandA()
Definition at line 888 of file install.c.
892{
896
897 TRACE(
"(%p, %s, %s, %s, %s, %p, %ld, %p)\n",
901
902 if (!szCmdName || !szDir)
904
909
912
917
919}
HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, LPCWSTR szInfSection, LPCWSTR szDir, LPCWSTR lpszTitle, HANDLE *phEXE, DWORD dwFlags, LPVOID pvReserved)
static LPCWSTR LPVOID pvReserved
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
◆ RunSetupCommandW()
Definition at line 946 of file install.c.
950{
953
954 TRACE(
"(%p, %s, %s, %s, %s, %p, %ld, %p)\n",
958
960 FIXME(
"Unhandled flag: RSC_FLAG_UPDHLPDLLS\n");
961
962 if (!szCmdName || !szDir)
964
967
969
972 goto done;
973
976 goto done;
977
979
980done:
982
984}
#define RSC_FLAG_UPDHLPDLLS
Referenced by install_inf_file(), process_hook_section(), and RunSetupCommandA().
◆ spapi_install()
Definition at line 293 of file install.c.
294{
298
302
308 {
311
313 }
314
316
323
325}
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
PVOID WINAPI SetupInitDefaultQueueCallbackEx(HWND owner, HWND progress, UINT msg, DWORD reserved1, PVOID reserved2)
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
#define HKEY_LOCAL_MACHINE
Referenced by DoInfInstallW(), ExecuteCabW(), LaunchINFSectionW(), and RunSetupCommandW().
◆ WINE_DEFAULT_DEBUG_CHANNEL()
| WINE_DEFAULT_DEBUG_CHANNEL |
( |
advpack |
| ) |
|