ReactOS 0.4.15-dev-7931-gfd331f1
queue.c File Reference
#include "setupapi_private.h"
#include <aclapi.h>
Include dependency graph for queue.c:

Go to the source code of this file.

Classes

struct  default_callback_context
 
struct  file_op
 
struct  file_op_queue
 
struct  file_queue
 
struct  extract_cab_ctx
 

Functions

static WCHARstrdupW (const WCHAR *str)
 
static charstrdupWtoA (const WCHAR *str)
 
static void queue_file_op (struct file_op_queue *queue, struct file_op *op)
 
static void free_file_op_queue (struct file_op_queue *queue)
 
static void concat_W (WCHAR *buffer, const WCHAR *src1, const WCHAR *src2, const WCHAR *src3)
 
static BOOL build_filepathsW (const struct file_op *op, FILEPATHS_W *paths)
 
UINT CALLBACK QUEUE_callback_WtoA (void *context, UINT notification, UINT_PTR param1, UINT_PTR param2)
 
static void get_src_file_info (HINF hinf, struct file_op *op)
 
static WCHARget_destination_dir (HINF hinf, const WCHAR *section)
 
static UINT WINAPI extract_cab_cb (void *arg, UINT message, UINT_PTR param1, UINT_PTR param2)
 
static BOOL extract_cabinet_file (const WCHAR *cabinet, const WCHAR *root, const WCHAR *src, const WCHAR *dst)
 
HSPFILEQ WINAPI SetupOpenFileQueue (void)
 
BOOL WINAPI SetupCloseFileQueue (HSPFILEQ handle)
 
BOOL WINAPI SetupQueueCopyIndirectA (PSP_FILE_COPY_PARAMS_A params)
 
BOOL WINAPI SetupQueueCopyIndirectW (PSP_FILE_COPY_PARAMS_W params)
 
BOOL WINAPI SetupQueueCopyA (HSPFILEQ queue, PCSTR src_root, PCSTR src_path, PCSTR src_file, PCSTR src_descr, PCSTR src_tag, PCSTR dst_dir, PCSTR dst_file, DWORD style)
 
BOOL WINAPI SetupQueueCopyW (HSPFILEQ queue, PCWSTR src_root, PCWSTR src_path, PCWSTR src_file, PCWSTR src_descr, PCWSTR src_tag, PCWSTR dst_dir, PCWSTR dst_file, DWORD style)
 
BOOL WINAPI SetupQueueDefaultCopyA (HSPFILEQ queue, HINF hinf, PCSTR src_root, PCSTR src_file, PCSTR dst_file, DWORD style)
 
BOOL WINAPI SetupQueueDefaultCopyW (HSPFILEQ queue, HINF hinf, PCWSTR src_root, PCWSTR src_file, PCWSTR dst_file, DWORD style)
 
BOOL WINAPI SetupQueueDeleteA (HSPFILEQ handle, PCSTR part1, PCSTR part2)
 
BOOL WINAPI SetupQueueDeleteW (HSPFILEQ handle, PCWSTR part1, PCWSTR part2)
 
BOOL WINAPI SetupQueueRenameA (HSPFILEQ handle, PCSTR SourcePath, PCSTR SourceFilename, PCSTR TargetPath, PCSTR TargetFilename)
 
BOOL WINAPI SetupQueueRenameW (HSPFILEQ handle, PCWSTR SourcePath, PCWSTR SourceFilename, PCWSTR TargetPath, PCWSTR TargetFilename)
 
BOOL WINAPI SetupQueueCopySectionA (HSPFILEQ queue, PCSTR src_root, HINF hinf, HINF hlist, PCSTR section, DWORD style)
 
BOOL WINAPI SetupQueueCopySectionW (HSPFILEQ queue, PCWSTR src_root, HINF hinf, HINF hlist, PCWSTR section, DWORD style)
 
BOOL WINAPI SetupQueueDeleteSectionA (HSPFILEQ queue, HINF hinf, HINF hlist, PCSTR section)
 
BOOL WINAPI SetupQueueDeleteSectionW (HSPFILEQ queue, HINF hinf, HINF hlist, PCWSTR section)
 
BOOL WINAPI SetupQueueRenameSectionA (HSPFILEQ queue, HINF hinf, HINF hlist, PCSTR section)
 
BOOL WINAPI SetupQueueRenameSectionW (HSPFILEQ queue, HINF hinf, HINF hlist, PCWSTR section)
 
BOOL WINAPI SetupCommitFileQueueA (HWND owner, HSPFILEQ queue, PSP_FILE_CALLBACK_A handler, PVOID context)
 
static BOOL create_full_pathW (const WCHAR *path)
 
static BOOL do_file_copyW (LPCWSTR source, LPCWSTR target, DWORD style, PSP_FILE_CALLBACK_W handler, PVOID context)
 
BOOL WINAPI SetupInstallFileA (HINF hinf, PINFCONTEXT inf_context, PCSTR source, PCSTR root, PCSTR dest, DWORD style, PSP_FILE_CALLBACK_A handler, PVOID context)
 
BOOL WINAPI SetupInstallFileW (HINF hinf, PINFCONTEXT inf_context, PCWSTR source, PCWSTR root, PCWSTR dest, DWORD style, PSP_FILE_CALLBACK_W handler, PVOID context)
 
BOOL WINAPI SetupCommitFileQueueW (HWND owner, HSPFILEQ handle, PSP_FILE_CALLBACK_W handler, PVOID context)
 
BOOL WINAPI SetupScanFileQueueA (HSPFILEQ handle, DWORD flags, HWND window, PSP_FILE_CALLBACK_A handler, PVOID context, PDWORD result)
 
BOOL WINAPI SetupScanFileQueueW (HSPFILEQ handle, DWORD flags, HWND window, PSP_FILE_CALLBACK_W handler, PVOID context, PDWORD result)
 
BOOL WINAPI SetupGetFileQueueCount (HSPFILEQ handle, UINT op, PUINT result)
 
BOOL WINAPI SetupGetFileQueueFlags (HSPFILEQ handle, PDWORD flags)
 
BOOL WINAPI SetupSetFileQueueFlags (HSPFILEQ handle, DWORD mask, DWORD flags)
 
BOOL WINAPI SetupSetFileQueueAlternatePlatformA (HSPFILEQ handle, PSP_ALTPLATFORM_INFO platform, PCSTR catalogfile)
 
BOOL WINAPI SetupSetFileQueueAlternatePlatformW (HSPFILEQ handle, PSP_ALTPLATFORM_INFO platform, PCWSTR catalogfile)
 
PVOID WINAPI SetupInitDefaultQueueCallback (HWND owner)
 
PVOID WINAPI SetupInitDefaultQueueCallbackEx (HWND owner, HWND progress, UINT msg, DWORD reserved1, PVOID reserved2)
 
void WINAPI SetupTermDefaultQueueCallback (PVOID context)
 
UINT WINAPI SetupDefaultQueueCallbackA (PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
 
UINT WINAPI SetupDefaultQueueCallbackW (PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
 
UINT WINAPI SetupDeleteErrorA (HWND parent, PCSTR dialogTitle, PCSTR file, UINT w32error, DWORD style)
 
UINT WINAPI SetupDeleteErrorW (HWND parent, PCWSTR dialogTitle, PCWSTR file, UINT w32error, DWORD style)
 
UINT WINAPI SetupRenameErrorA (HWND parent, PCSTR dialogTitle, PCSTR source, PCSTR target, UINT w32error, DWORD style)
 
UINT WINAPI SetupRenameErrorW (HWND parent, PCWSTR dialogTitle, PCWSTR source, PCWSTR target, UINT w32error, DWORD style)
 
UINT WINAPI SetupCopyErrorA (HWND parent, PCSTR dialogTitle, PCSTR diskname, PCSTR sourcepath, PCSTR sourcefile, PCSTR targetpath, UINT w32error, DWORD style, PSTR pathbuffer, DWORD buffersize, PDWORD requiredsize)
 
UINT WINAPI SetupCopyErrorW (HWND parent, PCWSTR dialogTitle, PCWSTR diskname, PCWSTR sourcepath, PCWSTR sourcefile, PCWSTR targetpath, UINT w32error, DWORD style, PWSTR pathbuffer, DWORD buffersize, PDWORD requiredsize)
 
DWORD WINAPI pSetupGetQueueFlags (HSPFILEQ handle)
 
BOOL WINAPI pSetupSetQueueFlags (HSPFILEQ handle, DWORD flags)
 

Variables

static const WCHAR DotSecurity [] = {'.','S','e','c','u','r','i','t','y',0}
 

Function Documentation

◆ build_filepathsW()

static BOOL build_filepathsW ( const struct file_op op,
FILEPATHS_W paths 
)
static

Definition at line 150 of file queue.c.

151{
152 unsigned int src_len = 1, dst_len = 1;
153 WCHAR *source = (PWSTR)paths->Source, *target = (PWSTR)paths->Target;
154
155 if (op->src_root) src_len += strlenW(op->src_root) + 1;
156 if (op->src_path) src_len += strlenW(op->src_path) + 1;
157 if (op->src_file) src_len += strlenW(op->src_file) + 1;
158 if (op->dst_path) dst_len += strlenW(op->dst_path) + 1;
159 if (op->dst_file) dst_len += strlenW(op->dst_file) + 1;
160 src_len *= sizeof(WCHAR);
161 dst_len *= sizeof(WCHAR);
162
163 if (!source || HeapSize( GetProcessHeap(), 0, source ) < src_len )
164 {
166 paths->Source = source = HeapAlloc( GetProcessHeap(), 0, src_len );
167 }
168 if (!target || HeapSize( GetProcessHeap(), 0, target ) < dst_len )
169 {
171 paths->Target = target = HeapAlloc( GetProcessHeap(), 0, dst_len );
172 }
173 if (!source || !target) return FALSE;
174 concat_W( source, op->src_root, op->src_path, op->src_file );
175 concat_W( target, NULL, op->dst_path, op->dst_file );
176 paths->Win32Error = 0;
177 paths->Flags = 0;
178 return TRUE;
179}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT op
Definition: effect.c:236
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static void concat_W(WCHAR *buffer, const WCHAR *src1, const WCHAR *src2, const WCHAR *src3)
Definition: queue.c:121
GLenum target
Definition: glext.h:7315
GLsizei const GLuint * paths
Definition: glext.h:11717
#define strlenW(s)
Definition: unicode.h:28
uint16_t * PWSTR
Definition: typedefs.h:56
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SetupCommitFileQueueW(), and SetupScanFileQueueW().

◆ concat_W()

static void concat_W ( WCHAR buffer,
const WCHAR src1,
const WCHAR src2,
const WCHAR src3 
)
static

Definition at line 121 of file queue.c.

122{
123 *buffer = 0;
124 if (src1 && *src1)
125 {
126 strcpyW( buffer, src1 );
127 buffer += strlenW(buffer );
128 if (buffer[-1] != '\\') *buffer++ = '\\';
129 if (src2) while (*src2 == '\\') src2++;
130 }
131
132 if (src2)
133 {
134 strcpyW( buffer, src2 );
135 buffer += strlenW(buffer );
136 if (buffer[-1] != '\\') *buffer++ = '\\';
137 if (src3) while (*src3 == '\\') src3++;
138 }
139
140 if (src3)
141 strcpyW( buffer, src3 );
142}
GLuint buffer
Definition: glext.h:5915
#define strcpyW(d, s)
Definition: unicode.h:29

Referenced by build_filepathsW().

◆ create_full_pathW()

static BOOL create_full_pathW ( const WCHAR path)
static

Definition at line 966 of file queue.c.

967{
968 BOOL ret = TRUE;
969 int len;
970 WCHAR *new_path;
971
972 new_path = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 1) * sizeof(WCHAR));
973 strcpyW(new_path, path);
974
975 while((len = strlenW(new_path)) && new_path[len - 1] == '\\')
976 new_path[len - 1] = 0;
977
978 while(!CreateDirectoryW(new_path, NULL))
979 {
980 WCHAR *slash;
982
984 break;
985
987 {
988 ret = FALSE;
989 break;
990 }
991
992 if(!(slash = strrchrW(new_path, '\\')))
993 {
994 ret = FALSE;
995 break;
996 }
997
998 len = slash - new_path;
999 new_path[len] = 0;
1000 if(!create_full_pathW(new_path))
1001 {
1002 ret = FALSE;
1003 break;
1004 }
1005 new_path[len] = '\\';
1006 }
1007
1008 HeapFree(GetProcessHeap(), 0, new_path);
1009 return ret;
1010}
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
static BOOL create_full_pathW(const WCHAR *path)
Definition: queue.c:966
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define strrchrW(s, c)
Definition: unicode.h:35
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106

Referenced by create_full_pathW(), and SetupCommitFileQueueW().

◆ do_file_copyW()

static BOOL do_file_copyW ( LPCWSTR  source,
LPCWSTR  target,
DWORD  style,
PSP_FILE_CALLBACK_W  handler,
PVOID  context 
)
static

Definition at line 1012 of file queue.c.

1014{
1015 BOOL rc = FALSE;
1016 BOOL docopy = TRUE;
1017#ifdef __REACTOS__
1018 INT hSource, hTemp;
1019 OFSTRUCT OfStruct;
1020 WCHAR TempPath[MAX_PATH];
1021 WCHAR TempFile[MAX_PATH];
1022 LONG lRes;
1023 DWORD dwLastError;
1024#endif
1025
1026 TRACE("copy %s to %s style 0x%x\n",debugstr_w(source),debugstr_w(target),style);
1027
1028#ifdef __REACTOS__
1029 /* Get a temp file name */
1030 if (!GetTempPathW(ARRAYSIZE(TempPath), TempPath))
1031 {
1032 ERR("GetTempPathW error\n");
1033 return FALSE;
1034 }
1035
1036 /* Try to open the source file */
1037 hSource = LZOpenFileW((LPWSTR)source, &OfStruct, OF_READ);
1038 if (hSource < 0)
1039 {
1040 TRACE("LZOpenFileW(1) error %d %s\n", (int)hSource, debugstr_w(source));
1041 return FALSE;
1042 }
1043
1044 if (!GetTempFileNameW(TempPath, L"", 0, TempFile))
1045 {
1046 dwLastError = GetLastError();
1047
1048 ERR("GetTempFileNameW(%s) error\n", debugstr_w(TempPath));
1049
1050 /* Close the source handle */
1051 LZClose(hSource);
1052
1053 /* Restore error condition triggered by GetTempFileNameW */
1054 SetLastError(dwLastError);
1055
1056 return FALSE;
1057 }
1058
1059 /* Extract the compressed file to a temp location */
1060 hTemp = LZOpenFileW(TempFile, &OfStruct, OF_CREATE);
1061 if (hTemp < 0)
1062 {
1063 dwLastError = GetLastError();
1064
1065 ERR("LZOpenFileW(2) error %d %s\n", (int)hTemp, debugstr_w(TempFile));
1066
1067 /* Close the source handle */
1068 LZClose(hSource);
1069
1070 /* Delete temp file if an error is signaled */
1071 DeleteFileW(TempFile);
1072
1073 /* Restore error condition triggered by LZOpenFileW */
1074 SetLastError(dwLastError);
1075
1076 return FALSE;
1077 }
1078
1079 lRes = LZCopy(hSource, hTemp);
1080
1081 dwLastError = GetLastError();
1082
1083 LZClose(hSource);
1084 LZClose(hTemp);
1085
1086 if (lRes < 0)
1087 {
1088 ERR("LZCopy error %d (%s, %s)\n", (int)lRes, debugstr_w(source), debugstr_w(TempFile));
1089
1090 /* Delete temp file if copy was not successful */
1091 DeleteFileW(TempFile);
1092
1093 /* Restore error condition triggered by LZCopy */
1094 SetLastError(dwLastError);
1095
1096 return FALSE;
1097 }
1098#endif
1099
1100 /* before copy processing */
1102 {
1104 docopy = FALSE;
1105 }
1107 {
1108 DWORD VersionSizeSource=0;
1109 DWORD VersionSizeTarget=0;
1110 DWORD zero=0;
1111
1112 /*
1113 * This is sort of an interesting workaround. You see, calling
1114 * GetVersionInfoSize on a builtin dll loads that dll into memory
1115 * and we do not properly unload builtin dlls.. so we effectively
1116 * lock into memory all the targets we are replacing. This leads
1117 * to problems when we try to register the replaced dlls.
1118 *
1119 * So I will test for the existence of the files first so that
1120 * we just basically unconditionally replace the builtin versions.
1121 */
1124 {
1125 VersionSizeSource = GetFileVersionInfoSizeW(TempFile,&zero);
1126 VersionSizeTarget = GetFileVersionInfoSizeW((LPWSTR)target,&zero);
1127 }
1128
1129 TRACE("SizeTarget %i ... SizeSource %i\n",VersionSizeTarget,
1130 VersionSizeSource);
1131
1132 if (VersionSizeSource && VersionSizeTarget)
1133 {
1134 LPVOID VersionSource;
1135 LPVOID VersionTarget;
1136 VS_FIXEDFILEINFO *TargetInfo;
1137 VS_FIXEDFILEINFO *SourceInfo;
1138 UINT length;
1139 WCHAR SubBlock[2]={'\\',0};
1140 DWORD ret;
1141
1142 VersionSource = HeapAlloc(GetProcessHeap(),0,VersionSizeSource);
1143 VersionTarget = HeapAlloc(GetProcessHeap(),0,VersionSizeTarget);
1144
1145 ret = GetFileVersionInfoW(TempFile,0,VersionSizeSource,VersionSource);
1146 if (ret)
1147 ret = GetFileVersionInfoW((LPWSTR)target, 0, VersionSizeTarget,
1148 VersionTarget);
1149
1150 if (ret)
1151 {
1152 ret = VerQueryValueW(VersionSource, SubBlock,
1153 (LPVOID*)&SourceInfo, &length);
1154 if (ret)
1155 ret = VerQueryValueW(VersionTarget, SubBlock,
1156 (LPVOID*)&TargetInfo, &length);
1157
1158 if (ret)
1159 {
1160 FILEPATHS_W filepaths;
1161
1162 TRACE("Versions: Source %i.%i target %i.%i\n",
1163 SourceInfo->dwFileVersionMS, SourceInfo->dwFileVersionLS,
1164 TargetInfo->dwFileVersionMS, TargetInfo->dwFileVersionLS);
1165
1166 /* used in case of notification */
1167 filepaths.Target = target;
1168 filepaths.Source = source;
1169 filepaths.Win32Error = 0;
1170 filepaths.Flags = 0;
1171
1172 if (TargetInfo->dwFileVersionMS > SourceInfo->dwFileVersionMS)
1173 {
1174 if (handler)
1175 docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
1176 else
1177 docopy = FALSE;
1178 }
1179 else if ((TargetInfo->dwFileVersionMS == SourceInfo->dwFileVersionMS)
1180 && (TargetInfo->dwFileVersionLS > SourceInfo->dwFileVersionLS))
1181 {
1182 if (handler)
1183 docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
1184 else
1185 docopy = FALSE;
1186 }
1187 else if ((style & SP_COPY_NEWER_ONLY) &&
1188 (TargetInfo->dwFileVersionMS ==
1189 SourceInfo->dwFileVersionMS)
1190 &&(TargetInfo->dwFileVersionLS ==
1191 SourceInfo->dwFileVersionLS))
1192 {
1193 if (handler)
1194 docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
1195 else
1196 docopy = FALSE;
1197 }
1198 }
1199 }
1200 HeapFree(GetProcessHeap(),0,VersionSource);
1201 HeapFree(GetProcessHeap(),0,VersionTarget);
1202 }
1203 }
1205 {
1207 {
1208 FIXME("Notify user target file exists\n");
1209 docopy = FALSE;
1210 }
1211 }
1214 {
1215 ERR("Unsupported style(s) 0x%x\n",style);
1216 }
1217
1218 if (docopy)
1219 {
1221 TRACE("Did copy... rc was %i\n",rc);
1222 }
1223
1224 /* after copy processing */
1226 {
1227 if (rc)
1229 }
1230
1231 return rc;
1232}
Arabic default style
Definition: afstyles.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERR(fmt,...)
Definition: debug.h:110
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1120
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:611
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define debugstr_w
Definition: kernel32.h:32
HFILE WINAPI LZOpenFileW(LPWSTR fn, LPOFSTRUCT ofs, WORD mode)
Definition: lzexpand.c:580
LONG WINAPI LZCopy(HFILE src, HFILE dest)
Definition: lzexpand.c:467
void WINAPI LZClose(HFILE fd)
Definition: lzexpand.c:595
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
int zero
Definition: sehframes.cpp:29
#define SP_COPY_FORCE_NOOVERWRITE
Definition: setupapi.h:488
#define SP_COPY_NEWER_ONLY
Definition: setupapi.h:492
#define SP_COPY_NOOVERWRITE
Definition: setupapi.h:480
#define SP_COPY_DELETESOURCE
Definition: setupapi.h:476
#define SP_COPY_NODECOMP
Definition: setupapi.h:481
#define SP_COPY_REPLACEONLY
Definition: setupapi.h:477
#define SP_COPY_WARNIFSKIP
Definition: setupapi.h:490
#define SP_COPY_NEWER_OR_SAME
Definition: setupapi.h:479
#define SP_COPY_NOSKIP
Definition: setupapi.h:487
#define SP_COPY_FORCE_NEWER
Definition: setupapi.h:489
#define SP_COPY_IN_USE_NEEDS_REBOOT
Definition: setupapi.h:485
#define SP_COPY_FORCE_IN_USE
Definition: setupapi.h:486
#define SPFILENOTIFY_TARGETNEWER
Definition: setupapi.h:574
#define SP_COPY_LANGUAGEAWARE
Definition: setupapi.h:482
#define TRACE(s)
Definition: solgame.cpp:4
ULONG Flags
Definition: fileqsup.h:63
UINT Win32Error
Definition: fileqsup.h:62
PCWSTR Source
Definition: fileqsup.h:61
PCWSTR Target
Definition: fileqsup.h:60
Definition: http.c:7252
DWORD dwFileVersionLS
Definition: compat.h:903
DWORD dwFileVersionMS
Definition: compat.h:902
int32_t INT
Definition: typedefs.h:58
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define OF_READ
Definition: winbase.h:116
#define OF_CREATE
Definition: winbase.h:125
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SetupCommitFileQueueW(), and SetupInstallFileW().

◆ extract_cab_cb()

static UINT WINAPI extract_cab_cb ( void arg,
UINT  message,
UINT_PTR  param1,
UINT_PTR  param2 
)
static

Definition at line 370 of file queue.c.

371{
372 struct extract_cab_ctx *ctx = arg;
373
374 switch (message)
375 {
377 {
379 const WCHAR *filename;
380
381 if ((filename = strrchrW( info->NameInCabinet, '\\' )))
382 filename++;
383 else
384 filename = info->NameInCabinet;
385
386 if (lstrcmpiW( filename, ctx->src ))
387 return FILEOP_SKIP;
388
389 strcpyW( info->FullTargetName, ctx->dst );
390 return FILEOP_DOIT;
391 }
393 {
394 const FILEPATHS_W *paths = (const FILEPATHS_W *)param1;
395 return paths->Win32Error;
396 }
398 {
399 const CABINET_INFO_W *info = (const CABINET_INFO_W *)param1;
400 strcpyW( (WCHAR *)param2, info->CabinetPath );
401 return ERROR_SUCCESS;
402 }
404 return 0;
405 default:
406 FIXME("Unexpected message %#x.\n", message);
407 return 0;
408 }
409}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FILEOP_SKIP
Definition: fileqsup.h:49
#define FILEOP_DOIT
Definition: fileqsup.h:48
const char * filename
Definition: ioapi.h:137
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define SPFILENOTIFY_CABINETINFO
Definition: setupapi.h:561
#define SPFILENOTIFY_NEEDNEWCABINET
Definition: setupapi.h:563
#define SPFILENOTIFY_FILEEXTRACTED
Definition: setupapi.h:564
#define SPFILENOTIFY_FILEINCABINET
Definition: setupapi.h:562
Definition: tftpd.h:60
void * arg
Definition: msvc.h:10

Referenced by extract_cabinet_file().

◆ extract_cabinet_file()

static BOOL extract_cabinet_file ( const WCHAR cabinet,
const WCHAR root,
const WCHAR src,
const WCHAR dst 
)
static

Definition at line 416 of file queue.c.

418{
419#ifndef __REACTOS__
420 static const WCHAR extW[] = {'.','c','a','b',0};
421#endif
422 static const WCHAR backslashW[] = {'\\',0};
424 struct extract_cab_ctx ctx = {src, dst};
425
426#ifdef __REACTOS__
427 TRACE("extract_cabinet_file(cab = '%s' ; root = '%s' ; src = '%s' ; dst = '%s')\n",
429#else
430 int len = strlenW( cabinet );
431 /* make sure the cabinet file has a .cab extension */
432 if (len <= 4 || strcmpiW( cabinet + len - 4, extW )) return FALSE;
433#endif
434 strcpyW(path, root);
437
439}
static const WCHAR backslashW[]
static UINT WINAPI extract_cab_cb(void *arg, UINT message, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:370
BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context)
Definition: setupcab.c:575
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define strcatW(d, s)
Definition: unicode.h:30

Referenced by SetupCommitFileQueueW().

◆ free_file_op_queue()

static void free_file_op_queue ( struct file_op_queue queue)
static

Definition at line 100 of file queue.c.

101{
102 struct file_op *t, *op = queue->head;
103
104 while( op )
105 {
106 HeapFree( GetProcessHeap(), 0, op->src_root );
107 HeapFree( GetProcessHeap(), 0, op->src_path );
108 HeapFree( GetProcessHeap(), 0, op->src_file );
109 HeapFree( GetProcessHeap(), 0, op->src_descr );
110 HeapFree( GetProcessHeap(), 0, op->src_tag );
111 HeapFree( GetProcessHeap(), 0, op->dst_path );
112 if (op->dst_sd) LocalFree( op->dst_sd);
113 if (op->dst_file != op->src_file) HeapFree( GetProcessHeap(), 0, op->dst_file );
114 t = op;
115 op = op->next;
116 HeapFree( GetProcessHeap(), 0, t );
117 }
118}
Definition: _queue.h:67
GLdouble GLdouble t
Definition: gl.h:2047
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
Definition: queue.c:37

Referenced by SetupCloseFileQueue().

◆ get_destination_dir()

static WCHAR * get_destination_dir ( HINF  hinf,
const WCHAR section 
)
static

Definition at line 353 of file queue.c.

354{
355 static const WCHAR Dest[] = {'D','e','s','t','i','n','a','t','i','o','n','D','i','r','s',0};
356 static const WCHAR Def[] = {'D','e','f','a','u','l','t','D','e','s','t','D','i','r',0};
358
359 if (!SetupFindFirstLineW( hinf, Dest, section, &context ) &&
360 !SetupFindFirstLineW( hinf, Dest, Def, &context )) return NULL;
361 return PARSER_get_dest_dir( &context );
362}
WCHAR * PARSER_get_dest_dir(INFCONTEXT *context)
Definition: parser.c:1116
Definition: parser.c:56
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:56

Referenced by SetupQueueCopyIndirectA(), SetupQueueCopyIndirectW(), SetupQueueCopySectionW(), SetupQueueDeleteSectionW(), and SetupQueueRenameSectionW().

◆ get_src_file_info()

static void get_src_file_info ( HINF  hinf,
struct file_op op 
)
static

Definition at line 272 of file queue.c.

273{
274 static const WCHAR SourceDisksNames[] =
275 {'S','o','u','r','c','e','D','i','s','k','s','N','a','m','e','s',0};
276 static const WCHAR SourceDisksFiles[] =
277 {'S','o','u','r','c','e','D','i','s','k','s','F','i','l','e','s',0};
278
279 INFCONTEXT file_ctx, disk_ctx;
280 INT id, diskid;
281 DWORD len, len2;
282 WCHAR SectionName[MAX_PATH];
283
284 /* find the SourceDisksFiles entry */
285 if(!SetupDiGetActualSectionToInstallW(hinf, SourceDisksFiles, SectionName, MAX_PATH, NULL, NULL))
286 return;
287 if (!SetupFindFirstLineW( hinf, SectionName, op->src_file, &file_ctx ))
288 {
290 /* no specific info, use .inf file source directory */
291 if (!op->src_root) op->src_root = PARSER_get_src_root( hinf );
292 return;
293 }
294 if (!SetupGetIntField( &file_ctx, 1, &diskid )) return;
295
296 /* now find the diskid in the SourceDisksNames section */
297 if(!SetupDiGetActualSectionToInstallW(hinf, SourceDisksNames, SectionName, MAX_PATH, NULL, NULL))
298 return;
299 if (!SetupFindFirstLineW( hinf, SectionName, NULL, &disk_ctx )) return;
300 for (;;)
301 {
302 if (SetupGetIntField( &disk_ctx, 0, &id ) && (id == diskid)) break;
303 if (!SetupFindNextLine( &disk_ctx, &disk_ctx )) return;
304 }
305
306 /* and fill in the missing info */
307
308 if (!op->src_descr)
309 {
310 if (SetupGetStringFieldW( &disk_ctx, 1, NULL, 0, &len ) &&
311 (op->src_descr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) )))
312 SetupGetStringFieldW( &disk_ctx, 1, op->src_descr, len, NULL );
313 }
314 if (!op->src_tag)
315 {
316 if (SetupGetStringFieldW( &disk_ctx, 2, NULL, 0, &len ) &&
317 (op->src_tag = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) )))
318 SetupGetStringFieldW( &disk_ctx, 2, op->src_tag, len, NULL );
319 }
320 if (!op->src_path && !(op->style & SP_COPY_SOURCE_ABSOLUTE))
321 {
322 len = len2 = 0;
323 if (!(op->style & SP_COPY_SOURCEPATH_ABSOLUTE))
324 {
325 /* retrieve relative path for this disk */
326 if (!SetupGetStringFieldW( &disk_ctx, 4, NULL, 0, &len )) len = 0;
327 }
328 /* retrieve relative path for this file */
329 if (!SetupGetStringFieldW( &file_ctx, 2, NULL, 0, &len2 )) len2 = 0;
330
331 if ((len || len2) &&
332 (op->src_path = HeapAlloc( GetProcessHeap(), 0, (len+len2)*sizeof(WCHAR) )))
333 {
334 WCHAR *ptr = op->src_path;
335 if (len)
336 {
337 SetupGetStringFieldW( &disk_ctx, 4, op->src_path, len, NULL );
338 ptr = op->src_path + strlenW(op->src_path);
339 if (len2 && ptr > op->src_path && ptr[-1] != '\\') *ptr++ = '\\';
340 }
341 if (!SetupGetStringFieldW( &file_ctx, 2, ptr, len2, NULL )) *ptr = 0;
342 }
343 }
344 if (!op->src_root) op->src_root = PARSER_get_src_root(hinf);
345}
BOOL WINAPI SetupDiGetActualSectionToInstallW(HINF InfHandle, PCWSTR InfSectionName, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR *Extension)
Definition: devinst.c:1980
WCHAR * PARSER_get_src_root(HINF hinf)
Definition: parser.c:1096
GLuint id
Definition: glext.h:5910
static PVOID ptr
Definition: dispmode.c:27
#define SP_COPY_SOURCE_ABSOLUTE
Definition: setupapi.h:483
#define SP_COPY_SOURCEPATH_ABSOLUTE
Definition: setupapi.h:484
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:186
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:148
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:82

Referenced by SetupQueueCopyIndirectA(), and SetupQueueCopyIndirectW().

◆ pSetupGetQueueFlags()

DWORD WINAPI pSetupGetQueueFlags ( HSPFILEQ  handle)

Definition at line 1870 of file queue.c.

1871{
1872 struct file_queue *queue = handle;
1873 return queue->flags;
1874}

◆ pSetupSetQueueFlags()

BOOL WINAPI pSetupSetQueueFlags ( HSPFILEQ  handle,
DWORD  flags 
)

Definition at line 1879 of file queue.c.

1880{
1881 struct file_queue *queue = handle;
1882 queue->flags = flags;
1883 return TRUE;
1884}
GLbitfield flags
Definition: glext.h:7161

◆ QUEUE_callback_WtoA()

UINT CALLBACK QUEUE_callback_WtoA ( void context,
UINT  notification,
UINT_PTR  param1,
UINT_PTR  param2 
)

Definition at line 187 of file queue.c.

189{
190 struct callback_WtoA_context *callback_ctx = context;
191 char buffer[MAX_PATH];
192 UINT ret;
193 UINT_PTR old_param2 = param2;
194
195 switch(notification)
196 {
198 param2 = (UINT_PTR)&buffer;
199 /* fall through */
209 {
210 FILEPATHS_W *pathsW = (FILEPATHS_W *)param1;
211 FILEPATHS_A pathsA;
212
213 pathsA.Source = strdupWtoA( pathsW->Source );
214 pathsA.Target = strdupWtoA( pathsW->Target );
215 pathsA.Win32Error = pathsW->Win32Error;
216 pathsA.Flags = pathsW->Flags;
217 ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification,
218 (UINT_PTR)&pathsA, param2 );
219 HeapFree( GetProcessHeap(), 0, (void *)pathsA.Source );
220 HeapFree( GetProcessHeap(), 0, (void *)pathsA.Target );
221 }
223 MultiByteToWideChar( CP_ACP, 0, buffer, -1, (WCHAR *)old_param2, MAX_PATH );
224 break;
225
228 {
231
232 statusA.cbSize = sizeof(statusA);
233 statusA.FileName = strdupWtoA( statusW->FileName );
234 statusA.Win32Error = statusW->Win32Error;
235 statusA.FailureCode = statusW->FailureCode;
236 ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification,
237 (UINT_PTR)&statusA, param2 );
238 HeapFree( GetProcessHeap(), 0, (LPSTR)statusA.FileName );
239 }
240 break;
241
243 {
244 LPWSTR targetW = (LPWSTR)param1;
245 LPSTR target = strdupWtoA( targetW );
246
247 ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification,
248 (UINT_PTR)target, param2 );
250 }
251 break;
252
254 FIXME("mapping for %d not implemented\n",notification);
259 default:
260 ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification, param1, param2 );
261 break;
262 }
263 return ret;
264}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
static char * strdupWtoA(const WCHAR *str)
Definition: queue.c:77
#define SPFILENOTIFY_ENDDELETE
Definition: fileqsup.h:28
#define SPFILENOTIFY_RENAMEERROR
Definition: fileqsup.h:33
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define SPFILENOTIFY_QUEUESCAN
Definition: fileqsup.h:40
#define SPFILENOTIFY_ENDQUEUE
Definition: fileqsup.h:23
#define SPFILENOTIFY_ENDCOPY
Definition: fileqsup.h:36
#define SPFILENOTIFY_DELETEERROR
Definition: fileqsup.h:29
#define SPFILENOTIFY_STARTCOPY
Definition: fileqsup.h:35
#define SPFILENOTIFY_COPYERROR
Definition: fileqsup.h:37
#define SPFILENOTIFY_NEEDMEDIA
Definition: fileqsup.h:39
#define SPFILENOTIFY_ENDSUBQUEUE
Definition: fileqsup.h:25
#define SPFILENOTIFY_STARTRENAME
Definition: fileqsup.h:31
#define SPFILENOTIFY_ENDRENAME
Definition: fileqsup.h:32
#define SPFILENOTIFY_STARTQUEUE
Definition: fileqsup.h:22
#define SPFILENOTIFY_STARTREGISTRATION
Definition: setupapi.h:570
#define SPFILENOTIFY_QUEUESCAN_EX
Definition: setupapi.h:569
#define SPFILENOTIFY_ENDREGISTRATION
Definition: setupapi.h:571
PCSTR Source
Definition: setupapi.h:748
DWORD Flags
Definition: setupapi.h:750
PCSTR Target
Definition: setupapi.h:747
UINT Win32Error
Definition: setupapi.h:749
PSP_FILE_CALLBACK_A orig_handler
char * LPSTR
Definition: xmlstorage.h:182

Referenced by SetupCommitFileQueueA(), SetupInstallFileA(), SetupInstallFromInfSectionA(), and SetupScanFileQueueA().

◆ queue_file_op()

static void queue_file_op ( struct file_op_queue queue,
struct file_op op 
)
inlinestatic

Definition at line 90 of file queue.c.

91{
92 op->next = NULL;
93 if (queue->tail) queue->tail->next = op;
94 else queue->head = op;
95 queue->tail = op;
96 queue->count++;
97}

Referenced by SetupQueueCopyIndirectA(), SetupQueueCopyIndirectW(), SetupQueueDeleteA(), SetupQueueDeleteW(), SetupQueueRenameA(), and SetupQueueRenameW().

◆ SetupCloseFileQueue()

BOOL WINAPI SetupCloseFileQueue ( HSPFILEQ  handle)

Definition at line 458 of file queue.c.

459{
460 struct file_queue *queue = handle;
461
462 free_file_op_queue( &queue->copy_queue );
463 free_file_op_queue( &queue->rename_queue );
464 free_file_op_queue( &queue->delete_queue );
466 return TRUE;
467}
static void free_file_op_queue(struct file_op_queue *queue)
Definition: queue.c:100

◆ SetupCommitFileQueueA()

BOOL WINAPI SetupCommitFileQueueA ( HWND  owner,
HSPFILEQ  queue,
PSP_FILE_CALLBACK_A  handler,
PVOID  context 
)

Definition at line 950 of file queue.c.

952{
954
955 ctx.orig_context = context;
956 ctx.orig_handler = handler;
958}
UINT CALLBACK QUEUE_callback_WtoA(void *context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:187
#define SetupCommitFileQueueW
Definition: fileqsup.c:33

◆ SetupCommitFileQueueW()

BOOL WINAPI SetupCommitFileQueueW ( HWND  owner,
HSPFILEQ  handle,
PSP_FILE_CALLBACK_W  handler,
PVOID  context 
)

Definition at line 1348 of file queue.c.

1350{
1351 struct file_queue *queue = handle;
1352 struct file_op *op;
1353 BOOL result = FALSE;
1355 UINT op_result;
1356
1357 paths.Source = paths.Target = NULL;
1358
1359 if (!queue->copy_queue.count && !queue->delete_queue.count && !queue->rename_queue.count)
1360 return TRUE; /* nothing to do */
1361
1362 if (!handler( context, SPFILENOTIFY_STARTQUEUE, (UINT_PTR)owner, 0 )) return FALSE;
1363
1364 /* perform deletes */
1365
1366 if (queue->delete_queue.count)
1367 {
1369 queue->delete_queue.count ))) goto done;
1370 for (op = queue->delete_queue.head; op; op = op->next)
1371 {
1374 if (op_result == FILEOP_ABORT) goto done;
1375 while (op_result == FILEOP_DOIT)
1376 {
1377 TRACE( "deleting file %s\n", debugstr_w(paths.Target) );
1378 if (DeleteFileW( paths.Target )) break; /* success */
1379 paths.Win32Error = GetLastError();
1381 if (op_result == FILEOP_ABORT) goto done;
1382 }
1384 }
1386 }
1387
1388 /* perform renames */
1389
1390 if (queue->rename_queue.count)
1391 {
1393 queue->rename_queue.count ))) goto done;
1394 for (op = queue->rename_queue.head; op; op = op->next)
1395 {
1398 if (op_result == FILEOP_ABORT) goto done;
1399 while (op_result == FILEOP_DOIT)
1400 {
1401 TRACE( "renaming file %s -> %s\n",
1402 debugstr_w(paths.Source), debugstr_w(paths.Target) );
1403 if (MoveFileW( paths.Source, paths.Target )) break; /* success */
1404 paths.Win32Error = GetLastError();
1406 if (op_result == FILEOP_ABORT) goto done;
1407 }
1409 }
1411 }
1412
1413 /* perform copies */
1414
1415 if (queue->copy_queue.count)
1416 {
1418 queue->copy_queue.count ))) goto done;
1419 for (op = queue->copy_queue.head; op; op = op->next)
1420 {
1421 WCHAR newpath[MAX_PATH];
1422
1425 if (op_result == FILEOP_ABORT) goto done;
1426 if (op_result == FILEOP_NEWPATH) op_result = FILEOP_DOIT;
1427 while (op_result == FILEOP_DOIT || op_result == FILEOP_NEWPATH)
1428 {
1429 TRACE( "copying file %s -> %s\n",
1430 debugstr_w( op_result == FILEOP_NEWPATH ? newpath : paths.Source ),
1431 debugstr_w(paths.Target) );
1432 if (op->dst_path)
1433 {
1434 if (!create_full_pathW( op->dst_path ))
1435 {
1436 paths.Win32Error = GetLastError();
1438 (UINT_PTR)&paths, (UINT_PTR)newpath );
1439 if (op_result == FILEOP_ABORT) goto done;
1440 }
1441 }
1442 if (do_file_copyW( op_result == FILEOP_NEWPATH ? newpath : paths.Source,
1443 paths.Target, op->style, handler, context )) break; /* success */
1444 /* try to extract it from the cabinet file */
1445 if (op->src_tag)
1446 {
1447 if (extract_cabinet_file( op->src_tag, op->src_root,
1448 op->src_file, paths.Target )) break;
1449 }
1450 paths.Win32Error = GetLastError();
1452 (UINT_PTR)&paths, (UINT_PTR)newpath );
1453 if (op_result == FILEOP_ABORT) goto done;
1454 }
1455 if (op->dst_sd)
1456 {
1457 PSID psidOwner = NULL, psidGroup = NULL;
1458 PACL pDacl = NULL, pSacl = NULL;
1459 SECURITY_INFORMATION security_info = 0;
1460 BOOL present, dummy;
1461
1462 if (GetSecurityDescriptorOwner( op->dst_sd, &psidOwner, &dummy ) && psidOwner)
1463 security_info |= OWNER_SECURITY_INFORMATION;
1464 if (GetSecurityDescriptorGroup( op->dst_sd, &psidGroup, &dummy ) && psidGroup)
1465 security_info |= GROUP_SECURITY_INFORMATION;
1466 if (GetSecurityDescriptorDacl( op->dst_sd, &present, &pDacl, &dummy ))
1467 security_info |= DACL_SECURITY_INFORMATION;
1468 if (GetSecurityDescriptorSacl( op->dst_sd, &present, &pSacl, &dummy ))
1469 security_info |= DACL_SECURITY_INFORMATION;
1470 SetNamedSecurityInfoW( (LPWSTR)paths.Target, SE_FILE_OBJECT, security_info,
1471 psidOwner, psidGroup, pDacl, pSacl );
1472 /* Yes, ignore the return code... */
1473 }
1475 }
1477 }
1478
1479
1480 result = TRUE;
1481
1482 done:
1484 HeapFree( GetProcessHeap(), 0, (void *)paths.Source );
1485 HeapFree( GetProcessHeap(), 0, (void *)paths.Target );
1486 return result;
1487}
@ SE_FILE_OBJECT
Definition: accctrl.h:160
DWORD WINAPI SetNamedSecurityInfoW(LPWSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID psidOwner, PSID psidGroup, PACL pDacl, PACL pSacl)
Definition: misc.c:1197
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1104
static BOOL build_filepathsW(const struct file_op *op, FILEPATHS_W *paths)
Definition: queue.c:150
static BOOL do_file_copyW(LPCWSTR source, LPCWSTR target, DWORD style, PSP_FILE_CALLBACK_W handler, PVOID context)
Definition: queue.c:1012
static BOOL extract_cabinet_file(const WCHAR *cabinet, const WCHAR *root, const WCHAR *src, const WCHAR *dst)
Definition: queue.c:416
#define FILEOP_COPY
Definition: fileqsup.h:42
#define FILEOP_NEWPATH
Definition: fileqsup.h:51
#define FILEOP_RENAME
Definition: fileqsup.h:43
#define FILEOP_DELETE
Definition: fileqsup.h:44
#define FILEOP_ABORT
Definition: fileqsup.h:47
GLuint64EXT * result
Definition: glext.h:11304
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
BOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pGroup, LPBOOL lpbGroupDefaulted)
Definition: sec.c:76
BOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL *pSacl, LPBOOL lpbSaclDefaulted)
Definition: sec.c:146
BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL *pDacl, LPBOOL lpbDaclDefaulted)
Definition: sec.c:45
BOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pOwner, LPBOOL lpbOwnerDefaulted)
Definition: sec.c:103
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define OWNER_SECURITY_INFORMATION
Definition: setypes.h:123
#define GROUP_SECURITY_INFORMATION
Definition: setypes.h:124

◆ SetupCopyErrorA()

UINT WINAPI SetupCopyErrorA ( HWND  parent,
PCSTR  dialogTitle,
PCSTR  diskname,
PCSTR  sourcepath,
PCSTR  sourcefile,
PCSTR  targetpath,
UINT  w32error,
DWORD  style,
PSTR  pathbuffer,
DWORD  buffersize,
PDWORD  requiredsize 
)

Definition at line 1843 of file queue.c.

1847{
1848 FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
1849 w32error, debugstr_a(sourcefile), debugstr_a(sourcepath) ,debugstr_a(targetpath));
1850 return DPROMPT_SKIPFILE;
1851}
#define debugstr_a
Definition: kernel32.h:31
#define DPROMPT_SKIPFILE
Definition: setupapi.h:271

◆ SetupCopyErrorW()

UINT WINAPI SetupCopyErrorW ( HWND  parent,
PCWSTR  dialogTitle,
PCWSTR  diskname,
PCWSTR  sourcepath,
PCWSTR  sourcefile,
PCWSTR  targetpath,
UINT  w32error,
DWORD  style,
PWSTR  pathbuffer,
DWORD  buffersize,
PDWORD  requiredsize 
)

Definition at line 1857 of file queue.c.

1861{
1862 FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
1863 w32error, debugstr_w(sourcefile), debugstr_w(sourcepath) ,debugstr_w(targetpath));
1864 return DPROMPT_SKIPFILE;
1865}

◆ SetupDefaultQueueCallbackA()

UINT WINAPI SetupDefaultQueueCallbackA ( PVOID  context,
UINT  notification,
UINT_PTR  param1,
UINT_PTR  param2 
)

Definition at line 1665 of file queue.c.

1667{
1668 FILEPATHS_A *paths = (FILEPATHS_A *)param1;
1670
1671 switch(notification)
1672 {
1674 TRACE( "start queue\n" );
1675 return TRUE;
1677 TRACE( "end queue\n" );
1678 return 0;
1680 TRACE( "start subqueue %ld count %ld\n", param1, param2 );
1681 return TRUE;
1683 TRACE( "end subqueue %ld\n", param1 );
1684 return 0;
1686 TRACE( "start delete %s\n", debugstr_a(paths->Target) );
1687 return FILEOP_DOIT;
1689 TRACE( "end delete %s\n", debugstr_a(paths->Target) );
1690 return 0;
1692 /*Windows Ignores attempts to delete files / folders which do not exist*/
1693 if ((paths->Win32Error != ERROR_FILE_NOT_FOUND) && (paths->Win32Error != ERROR_PATH_NOT_FOUND))
1694 SetupDeleteErrorA(ctx->owner, NULL, paths->Target, paths->Win32Error, 0);
1695 return FILEOP_SKIP;
1697 TRACE( "start rename %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
1698 return FILEOP_DOIT;
1700 TRACE( "end rename %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
1701 return 0;
1703 SetupRenameErrorA(ctx->owner, NULL, paths->Source, paths->Target, paths->Win32Error, 0);
1704 return FILEOP_SKIP;
1706 TRACE( "start copy %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
1707 return FILEOP_DOIT;
1709 TRACE( "end copy %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
1710 return 0;
1712 ERR( "copy error %d %s -> %s\n", paths->Win32Error,
1713 debugstr_a(paths->Source), debugstr_a(paths->Target) );
1714 return FILEOP_SKIP;
1716 TRACE( "need media\n" );
1717 return FILEOP_SKIP;
1718 default:
1719 FIXME( "notification %d params %lx,%lx\n", notification, param1, param2 );
1720 break;
1721 }
1722 return 0;
1723}
UINT WINAPI SetupDeleteErrorA(HWND parent, PCSTR dialogTitle, PCSTR file, UINT w32error, DWORD style)
Definition: queue.c:1794
UINT WINAPI SetupRenameErrorA(HWND parent, PCSTR dialogTitle, PCSTR source, PCSTR target, UINT w32error, DWORD style)
Definition: queue.c:1818
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79

◆ SetupDefaultQueueCallbackW()

UINT WINAPI SetupDefaultQueueCallbackW ( PVOID  context,
UINT  notification,
UINT_PTR  param1,
UINT_PTR  param2 
)

Definition at line 1729 of file queue.c.

1731{
1732 FILEPATHS_W *paths = (FILEPATHS_W *)param1;
1734
1735 switch(notification)
1736 {
1738 TRACE( "start queue\n" );
1739 return TRUE;
1741 TRACE( "end queue\n" );
1742 return 0;
1744 TRACE( "start subqueue %ld count %ld\n", param1, param2 );
1745 return TRUE;
1747 TRACE( "end subqueue %ld\n", param1 );
1748 return 0;
1750 TRACE( "start delete %s\n", debugstr_w(paths->Target) );
1751 return FILEOP_DOIT;
1753 TRACE( "end delete %s\n", debugstr_w(paths->Target) );
1754 return 0;
1756 /*Windows Ignores attempts to delete files / folders which do not exist*/
1757 if ((paths->Win32Error != ERROR_FILE_NOT_FOUND) && (paths->Win32Error != ERROR_PATH_NOT_FOUND))
1758 SetupDeleteErrorW(ctx->owner, NULL, paths->Target, paths->Win32Error, 0);
1759 return FILEOP_SKIP;
1761 SetupRenameErrorW(ctx->owner, NULL, paths->Source, paths->Target, paths->Win32Error, 0);
1762 return FILEOP_DOIT;
1764 TRACE( "end rename %s -> %s\n", debugstr_w(paths->Source), debugstr_w(paths->Target) );
1765 return 0;
1767 ERR( "rename error %d %s -> %s\n", paths->Win32Error,
1768 debugstr_w(paths->Source), debugstr_w(paths->Target) );
1769 return FILEOP_SKIP;
1771 TRACE( "start copy %s -> %s\n", debugstr_w(paths->Source), debugstr_w(paths->Target) );
1772 return FILEOP_DOIT;
1774 TRACE( "end copy %s -> %s\n", debugstr_w(paths->Source), debugstr_w(paths->Target) );
1775 return 0;
1777 TRACE( "copy error %d %s -> %s\n", paths->Win32Error,
1778 debugstr_w(paths->Source), debugstr_w(paths->Target) );
1779 return FILEOP_SKIP;
1781 TRACE( "need media\n" );
1782 return FILEOP_SKIP;
1783 default:
1784 FIXME( "notification %d params %lx,%lx\n", notification, param1, param2 );
1785 break;
1786 }
1787 return 0;
1788}
UINT WINAPI SetupRenameErrorW(HWND parent, PCWSTR dialogTitle, PCWSTR source, PCWSTR target, UINT w32error, DWORD style)
Definition: queue.c:1830
UINT WINAPI SetupDeleteErrorW(HWND parent, PCWSTR dialogTitle, PCWSTR file, UINT w32error, DWORD style)
Definition: queue.c:1806

Referenced by InstallHinfSectionW(), InstallInfSections(), InstallSysSetupInfComponents(), MMSYS_InstallDevice(), pQueueCallback(), SetupDiInstallClassExW(), SetupDiInstallDevice(), SetupDiInstallDriverFiles(), SetupDiRegisterCoDeviceInstallers(), and spapi_install().

◆ SetupDeleteErrorA()

UINT WINAPI SetupDeleteErrorA ( HWND  parent,
PCSTR  dialogTitle,
PCSTR  file,
UINT  w32error,
DWORD  style 
)

Definition at line 1794 of file queue.c.

1796{
1797 FIXME( "stub: (Error Number %d when attempting to delete %s)\n",
1798 w32error, debugstr_a(file) );
1799 return DPROMPT_SKIPFILE;
1800}
Definition: fci.c:127

Referenced by SetupDefaultQueueCallbackA().

◆ SetupDeleteErrorW()

UINT WINAPI SetupDeleteErrorW ( HWND  parent,
PCWSTR  dialogTitle,
PCWSTR  file,
UINT  w32error,
DWORD  style 
)

Definition at line 1806 of file queue.c.

1808{
1809 FIXME( "stub: (Error Number %d when attempting to delete %s)\n",
1810 w32error, debugstr_w(file) );
1811 return DPROMPT_SKIPFILE;
1812}

Referenced by SetupDefaultQueueCallbackW().

◆ SetupGetFileQueueCount()

BOOL WINAPI SetupGetFileQueueCount ( HSPFILEQ  handle,
UINT  op,
PUINT  result 
)

Definition at line 1564 of file queue.c.

1565{
1566 struct file_queue *queue = handle;
1567
1568 switch(op)
1569 {
1570 case FILEOP_COPY:
1571 *result = queue->copy_queue.count;
1572 return TRUE;
1573 case FILEOP_RENAME:
1574 *result = queue->rename_queue.count;
1575 return TRUE;
1576 case FILEOP_DELETE:
1577 *result = queue->delete_queue.count;
1578 return TRUE;
1579 }
1580 return FALSE;
1581}

◆ SetupGetFileQueueFlags()

BOOL WINAPI SetupGetFileQueueFlags ( HSPFILEQ  handle,
PDWORD  flags 
)

Definition at line 1587 of file queue.c.

1588{
1589 struct file_queue *queue = handle;
1590 *flags = queue->flags;
1591 return TRUE;
1592}

◆ SetupInitDefaultQueueCallback()

PVOID WINAPI SetupInitDefaultQueueCallback ( HWND  owner)

Definition at line 1629 of file queue.c.

1630{
1631 return SetupInitDefaultQueueCallbackEx( owner, 0, 0, 0, NULL );
1632}
PVOID WINAPI SetupInitDefaultQueueCallbackEx(HWND owner, HWND progress, UINT msg, DWORD reserved1, PVOID reserved2)
Definition: queue.c:1638

Referenced by InstallHinfSectionW(), InstallInfSections(), MMSYS_InstallDevice(), RegisterDlls(), SetupDiInstallClassExW(), SetupDiInstallDevice(), SetupDiInstallDriverFiles(), SetupDiRegisterCoDeviceInstallers(), and test_defaultcallback().

◆ SetupInitDefaultQueueCallbackEx()

PVOID WINAPI SetupInitDefaultQueueCallbackEx ( HWND  owner,
HWND  progress,
UINT  msg,
DWORD  reserved1,
PVOID  reserved2 
)

Definition at line 1638 of file queue.c.

1640{
1642
1643 if ((context = HeapAlloc( GetProcessHeap(), 0, sizeof(*context) )))
1644 {
1645 context->owner = owner;
1646 context->progress = progress;
1647 context->message = msg;
1648 }
1649 return context;
1650}
#define msg(x)
Definition: auth_time.c:54
cd_progress_ptr progress
Definition: cdjpeg.h:152

Referenced by AdvInstallFileW(), SetupInitDefaultQueueCallback(), spapi_install(), and test_defaultcallback().

◆ SetupInstallFileA()

BOOL WINAPI SetupInstallFileA ( HINF  hinf,
PINFCONTEXT  inf_context,
PCSTR  source,
PCSTR  root,
PCSTR  dest,
DWORD  style,
PSP_FILE_CALLBACK_A  handler,
PVOID  context 
)

Definition at line 1237 of file queue.c.

1239{
1240 BOOL ret = FALSE;
1243
1244 TRACE("%p %p %s %s %s %x %p %p\n", hinf, inf_context, debugstr_a(source), debugstr_a(root),
1246
1247 sourceW.Buffer = rootW.Buffer = destW.Buffer = NULL;
1249 {
1251 return FALSE;
1252 }
1254 {
1256 goto exit;
1257 }
1258 if (dest && !RtlCreateUnicodeStringFromAsciiz( &destW, dest ))
1259 {
1261 goto exit;
1262 }
1263
1264 ctx.orig_context = context;
1265 ctx.orig_handler = handler;
1266
1267 ret = SetupInstallFileW( hinf, inf_context, sourceW.Buffer, rootW.Buffer, destW.Buffer, style, QUEUE_callback_WtoA, &ctx );
1268
1269exit:
1272 RtlFreeUnicodeString( &destW );
1273 return ret;
1274}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
static const WCHAR rootW[]
Definition: chain.c:69
BOOL WINAPI SetupInstallFileW(HINF hinf, PINFCONTEXT inf_context, PCWSTR source, PCWSTR root, PCWSTR dest, DWORD style, PSP_FILE_CALLBACK_W handler, PVOID context)
Definition: queue.c:1279
static const WCHAR sourceW[]
Definition: jsregexp.c:37
static char * dest
Definition: rtl.c:135
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define exit(n)
Definition: config.h:202

◆ SetupInstallFileW()

BOOL WINAPI SetupInstallFileW ( HINF  hinf,
PINFCONTEXT  inf_context,
PCWSTR  source,
PCWSTR  root,
PCWSTR  dest,
DWORD  style,
PSP_FILE_CALLBACK_W  handler,
PVOID  context 
)

Definition at line 1279 of file queue.c.

1281{
1282 static const WCHAR CopyFiles[] = {'C','o','p','y','F','i','l','e','s',0};
1283
1284 BOOL ret, absolute = (root && *root && !(style & SP_COPY_SOURCE_ABSOLUTE));
1285 WCHAR *buffer, *p, *inf_source = NULL;
1286 unsigned int len;
1287
1288 TRACE("%p %p %s %s %s %x %p %p\n", hinf, inf_context, debugstr_w(source), debugstr_w(root),
1290
1291 if (hinf)
1292 {
1294
1295 if (!inf_context)
1296 {
1297 inf_context = &ctx;
1298 if (!SetupFindFirstLineW( hinf, CopyFiles, NULL, inf_context )) return FALSE;
1299 }
1300 if (!SetupGetStringFieldW( inf_context, 1, NULL, 0, (PDWORD) &len )) return FALSE;
1301 if (!(inf_source = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
1302 {
1304 return FALSE;
1305 }
1306 if (!SetupGetStringFieldW( inf_context, 1, inf_source, len, NULL ))
1307 {
1308 HeapFree( GetProcessHeap(), 0, inf_source );
1309 return FALSE;
1310 }
1311 source = inf_source;
1312 }
1313 else if (!source)
1314 {
1316 return FALSE;
1317 }
1318
1319 len = strlenW( source ) + 1;
1320 if (absolute) len += strlenW( root ) + 1;
1321
1322 if (!(p = buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
1323 {
1324 HeapFree( GetProcessHeap(), 0, inf_source );
1326 return FALSE;
1327 }
1328
1329 if (absolute)
1330 {
1331 strcpyW( buffer, root );
1332 p += strlenW( buffer );
1333 if (p[-1] != '\\') *p++ = '\\';
1334 }
1335 while (*source == '\\') source++;
1336 strcpyW( p, source );
1337
1339
1340 HeapFree( GetProcessHeap(), 0, inf_source );
1342 return ret;
1343}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static const WCHAR CopyFiles[]
Definition: install.c:107
GLfloat GLfloat p
Definition: glext.h:8902
DWORD * PDWORD
Definition: pedump.c:68

Referenced by SetupInstallFileA().

◆ SetupOpenFileQueue()

HSPFILEQ WINAPI SetupOpenFileQueue ( void  )

Definition at line 445 of file queue.c.

446{
447 struct file_queue *queue;
448
449 if (!(queue = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*queue))))
451 return queue;
452}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

◆ SetupQueueCopyA()

BOOL WINAPI SetupQueueCopyA ( HSPFILEQ  queue,
PCSTR  src_root,
PCSTR  src_path,
PCSTR  src_file,
PCSTR  src_descr,
PCSTR  src_tag,
PCSTR  dst_dir,
PCSTR  dst_file,
DWORD  style 
)

Definition at line 549 of file queue.c.

552{
554
555 params.cbSize = sizeof(params);
556 params.QueueHandle = queue;
557 params.SourceRootPath = src_root;
558 params.SourcePath = src_path;
559 params.SourceFilename = src_file;
560 params.SourceDescription = src_descr;
561 params.SourceTagfile = src_tag;
562 params.TargetDirectory = dst_dir;
563 params.TargetFilename = dst_file;
564 params.CopyStyle = style;
565 params.LayoutInf = 0;
566 params.SecurityDescriptor = NULL;
568}
BOOL WINAPI SetupQueueCopyIndirectA(PSP_FILE_COPY_PARAMS_A params)
Definition: queue.c:473
GLenum const GLfloat * params
Definition: glext.h:5645

◆ SetupQueueCopyIndirectA()

BOOL WINAPI SetupQueueCopyIndirectA ( PSP_FILE_COPY_PARAMS_A  params)

Definition at line 473 of file queue.c.

474{
475 struct file_queue *queue = params->QueueHandle;
476 struct file_op *op;
477
478 if (!(op = HeapAlloc( GetProcessHeap(), 0, sizeof(*op) ))) return FALSE;
479 op->style = params->CopyStyle;
480 op->src_root = strdupAtoW( params->SourceRootPath );
481 op->src_path = strdupAtoW( params->SourcePath );
482 op->src_file = strdupAtoW( params->SourceFilename );
483 op->src_descr = strdupAtoW( params->SourceDescription );
484 op->src_tag = strdupAtoW( params->SourceTagfile );
485 op->dst_path = strdupAtoW( params->TargetDirectory );
486 op->dst_file = strdupAtoW( params->TargetFilename );
487 op->dst_sd = NULL;
488
489 /* some defaults */
490 if (!op->src_file) op->src_file = op->dst_file;
491 if (params->LayoutInf)
492 {
493 get_src_file_info( params->LayoutInf, op );
494 if (!op->dst_path) op->dst_path = get_destination_dir( params->LayoutInf, op->dst_file );
495 }
496
497 TRACE( "root=%s path=%s file=%s -> dir=%s file=%s descr=%s tag=%s\n",
498 debugstr_w(op->src_root), debugstr_w(op->src_path), debugstr_w(op->src_file),
499 debugstr_w(op->dst_path), debugstr_w(op->dst_file),
500 debugstr_w(op->src_descr), debugstr_w(op->src_tag) );
501
502 queue_file_op( &queue->copy_queue, op );
503 return TRUE;
504}
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
static void get_src_file_info(HINF hinf, struct file_op *op)
Definition: queue.c:272
static void queue_file_op(struct file_op_queue *queue, struct file_op *op)
Definition: queue.c:90
static WCHAR * get_destination_dir(HINF hinf, const WCHAR *section)
Definition: queue.c:353

Referenced by SetupQueueCopyA(), and SetupQueueDefaultCopyA().

◆ SetupQueueCopyIndirectW()

BOOL WINAPI SetupQueueCopyIndirectW ( PSP_FILE_COPY_PARAMS_W  params)

Definition at line 510 of file queue.c.

511{
512 struct file_queue *queue = params->QueueHandle;
513 struct file_op *op;
514
515 if (!(op = HeapAlloc( GetProcessHeap(), 0, sizeof(*op) ))) return FALSE;
516 op->style = params->CopyStyle;
517 op->src_root = strdupW( params->SourceRootPath );
518 op->src_path = strdupW( params->SourcePath );
519 op->src_file = strdupW( params->SourceFilename );
520 op->src_descr = strdupW( params->SourceDescription );
521 op->src_tag = strdupW( params->SourceTagfile );
522 op->dst_path = strdupW( params->TargetDirectory );
523 op->dst_file = strdupW( params->TargetFilename );
524 op->dst_sd = NULL;
525 if (params->SecurityDescriptor)
527
528 /* some defaults */
529 if (!op->src_file) op->src_file = op->dst_file;
530 if (params->LayoutInf)
531 {
532 get_src_file_info( params->LayoutInf, op );
533 if (!op->dst_path) op->dst_path = get_destination_dir( params->LayoutInf, op->dst_file );
534 }
535
536 TRACE( "root=%s path=%s file=%s -> dir=%s file=%s descr=%s tag=%s\n",
537 debugstr_w(op->src_root), debugstr_w(op->src_path), debugstr_w(op->src_file),
538 debugstr_w(op->dst_path), debugstr_w(op->dst_file),
539 debugstr_w(op->src_descr), debugstr_w(op->src_tag) );
540
541 queue_file_op( &queue->copy_queue, op );
542 return TRUE;
543}
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(LPCWSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize)
Definition: security.c:3062
static WCHAR * strdupW(const WCHAR *str)
Definition: queue.c:66
#define SDDL_REVISION_1
Definition: sddl.h:30

Referenced by SetupQueueCopySectionW(), SetupQueueCopyW(), and SetupQueueDefaultCopyW().

◆ SetupQueueCopySectionA()

BOOL WINAPI SetupQueueCopySectionA ( HSPFILEQ  queue,
PCSTR  src_root,
HINF  hinf,
HINF  hlist,
PCSTR  section,
DWORD  style 
)

Definition at line 741 of file queue.c.

743{
744 UNICODE_STRING sectionW;
745 BOOL ret = FALSE;
746
747 if (!RtlCreateUnicodeStringFromAsciiz( &sectionW, section ))
748 {
750 return FALSE;
751 }
752 if (!src_root)
753 ret = SetupQueueCopySectionW( queue, NULL, hinf, hlist, sectionW.Buffer, style );
754 else
755 {
756 UNICODE_STRING srcW;
757 if (RtlCreateUnicodeStringFromAsciiz( &srcW, src_root ))
758 {
759 ret = SetupQueueCopySectionW( queue, srcW.Buffer, hinf, hlist, sectionW.Buffer, style );
760 RtlFreeUnicodeString( &srcW );
761 }
763 }
764 RtlFreeUnicodeString( &sectionW );
765 return ret;
766}
BOOL WINAPI SetupQueueCopySectionW(HSPFILEQ queue, PCWSTR src_root, HINF hinf, HINF hlist, PCWSTR section, DWORD style)
Definition: queue.c:772

◆ SetupQueueCopySectionW()

BOOL WINAPI SetupQueueCopySectionW ( HSPFILEQ  queue,
PCWSTR  src_root,
HINF  hinf,
HINF  hlist,
PCWSTR  section,
DWORD  style 
)

Definition at line 772 of file queue.c.

774{
776 LPWSTR security_key, security_descriptor = NULL;
777 INFCONTEXT context, security_context;
779 INT flags;
780 DWORD required;
781 BOOL ret;
782
783 TRACE( "hinf=%p/%p section=%s root=%s\n",
784 hinf, hlist, debugstr_w(section), debugstr_w(src_root) );
785
786 /* Check for .Security section */
787 security_key = MyMalloc( (strlenW( section ) + strlenW( DotSecurity )) * sizeof(WCHAR) + sizeof(UNICODE_NULL) );
788 if (!security_key)
789 {
791 return FALSE;
792 }
793 strcpyW( security_key, section );
794 strcatW( security_key, DotSecurity );
795 ret = SetupFindFirstLineW( hinf, security_key, NULL, &security_context );
796 MyFree(security_key);
797 if (ret)
798 {
799 if (!SetupGetLineTextW( &security_context, NULL, NULL, NULL, NULL, 0, &required ))
800 return FALSE;
801 security_descriptor = MyMalloc( required * sizeof(WCHAR) );
802 if (!security_descriptor)
803 {
805 return FALSE;
806 }
807 if (!SetupGetLineTextW( &security_context, NULL, NULL, NULL, security_descriptor, required, NULL ))
808 {
809 MyFree( security_descriptor );
810 return FALSE;
811 }
812 }
813
814 params.cbSize = sizeof(params);
815 params.QueueHandle = queue;
816 params.SourceRootPath = src_root;
817 params.SourcePath = NULL;
818 params.SourceDescription = NULL;
819 params.SourceTagfile = NULL;
820 params.TargetFilename = dest;
821 params.CopyStyle = style;
822 params.LayoutInf = hinf;
823 params.SecurityDescriptor = security_descriptor;
824
825 ret = FALSE;
826 if (!hlist) hlist = hinf;
827 if (!hinf) hinf = hlist;
828 if (!SetupFindFirstLineW( hlist, section, NULL, &context )) goto done;
829 if (!(params.TargetDirectory = get_destination_dir( hinf, section ))) goto done;
830 do
831 {
832 if (!SetupGetStringFieldW( &context, 1, dest, sizeof(dest)/sizeof(WCHAR), NULL ))
833 goto done;
834 if (!SetupGetStringFieldW( &context, 2, src, sizeof(src)/sizeof(WCHAR), NULL )) *src = 0;
835 if (!SetupGetIntField( &context, 4, &flags )) flags = 0; /* FIXME */
836
837 params.SourceFilename = *src ? src : NULL;
838 if (!SetupQueueCopyIndirectW( &params )) goto done;
839 } while (SetupFindNextLine( &context, &context ));
840 ret = TRUE;
841
842done:
843 if (security_descriptor)
844 MyFree( security_descriptor );
845 return ret;
846}
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
Definition: parser.c:1756
static const WCHAR DotSecurity[]
Definition: queue.c:26
BOOL WINAPI SetupQueueCopyIndirectW(PSP_FILE_COPY_PARAMS_W params)
Definition: queue.c:510
#define UNICODE_NULL

Referenced by copy_files_callback(), and SetupQueueCopySectionA().

◆ SetupQueueCopyW()

BOOL WINAPI SetupQueueCopyW ( HSPFILEQ  queue,
PCWSTR  src_root,
PCWSTR  src_path,
PCWSTR  src_file,
PCWSTR  src_descr,
PCWSTR  src_tag,
PCWSTR  dst_dir,
PCWSTR  dst_file,
DWORD  style 
)

Definition at line 574 of file queue.c.

577{
579
580 params.cbSize = sizeof(params);
581 params.QueueHandle = queue;
582 params.SourceRootPath = src_root;
583 params.SourcePath = src_path;
584 params.SourceFilename = src_file;
585 params.SourceDescription = src_descr;
586 params.SourceTagfile = src_tag;
587 params.TargetDirectory = dst_dir;
588 params.TargetFilename = dst_file;
589 params.CopyStyle = style;
590 params.LayoutInf = 0;
591 params.SecurityDescriptor = NULL;
593}

Referenced by AdvInstallFileW().

◆ SetupQueueDefaultCopyA()

BOOL WINAPI SetupQueueDefaultCopyA ( HSPFILEQ  queue,
HINF  hinf,
PCSTR  src_root,
PCSTR  src_file,
PCSTR  dst_file,
DWORD  style 
)

Definition at line 599 of file queue.c.

601{
603
604 params.cbSize = sizeof(params);
605 params.QueueHandle = queue;
606 params.SourceRootPath = src_root;
607 params.SourcePath = NULL;
608 params.SourceFilename = src_file;
609 params.SourceDescription = NULL;
610 params.SourceTagfile = NULL;
611 params.TargetDirectory = NULL;
612 params.TargetFilename = dst_file;
613 params.CopyStyle = style;
614 params.LayoutInf = hinf;
615 params.SecurityDescriptor = NULL;
617}

◆ SetupQueueDefaultCopyW()

BOOL WINAPI SetupQueueDefaultCopyW ( HSPFILEQ  queue,
HINF  hinf,
PCWSTR  src_root,
PCWSTR  src_file,
PCWSTR  dst_file,
DWORD  style 
)

Definition at line 623 of file queue.c.

625{
627
628 params.cbSize = sizeof(params);
629 params.QueueHandle = queue;
630 params.SourceRootPath = src_root;
631 params.SourcePath = NULL;
632 params.SourceFilename = src_file;
633 params.SourceDescription = NULL;
634 params.SourceTagfile = NULL;
635 params.TargetDirectory = NULL;
636 params.TargetFilename = dst_file;
637 params.CopyStyle = style;
638 params.LayoutInf = hinf;
639 params.SecurityDescriptor = NULL;
641}

Referenced by copy_files_callback().

◆ SetupQueueDeleteA()

BOOL WINAPI SetupQueueDeleteA ( HSPFILEQ  handle,
PCSTR  part1,
PCSTR  part2 
)

Definition at line 647 of file queue.c.

648{
649 struct file_queue *queue = handle;
650 struct file_op *op;
651
652 if (!(op = HeapAlloc( GetProcessHeap(), 0, sizeof(*op) ))) return FALSE;
653 op->style = 0;
654 op->src_root = NULL;
655 op->src_path = NULL;
656 op->src_file = NULL;
657 op->src_descr = NULL;
658 op->src_tag = NULL;
659 op->dst_path = strdupAtoW( part1 );
660 op->dst_file = strdupAtoW( part2 );
661 op->dst_sd = NULL;
662 queue_file_op( &queue->delete_queue, op );
663 return TRUE;
664}

◆ SetupQueueDeleteSectionA()

BOOL WINAPI SetupQueueDeleteSectionA ( HSPFILEQ  queue,
HINF  hinf,
HINF  hlist,
PCSTR  section 
)

Definition at line 852 of file queue.c.

853{
854 UNICODE_STRING sectionW;
855 BOOL ret = FALSE;
856
858 {
859 ret = SetupQueueDeleteSectionW( queue, hinf, hlist, sectionW.Buffer );
860 RtlFreeUnicodeString( &sectionW );
861 }
863 return ret;
864}
BOOL WINAPI SetupQueueDeleteSectionW(HSPFILEQ queue, HINF hinf, HINF hlist, PCWSTR section)
Definition: queue.c:870

◆ SetupQueueDeleteSectionW()

BOOL WINAPI SetupQueueDeleteSectionW ( HSPFILEQ  queue,
HINF  hinf,
HINF  hlist,
PCWSTR  section 
)

Definition at line 870 of file queue.c.

871{
873 WCHAR *dest_dir;
875 BOOL ret = FALSE;
876 INT flags;
877
878 TRACE( "hinf=%p/%p section=%s\n", hinf, hlist, debugstr_w(section) );
879
880 if (!hlist) hlist = hinf;
881 if (!SetupFindFirstLineW( hlist, section, NULL, &context )) return FALSE;
882 if (!(dest_dir = get_destination_dir( hinf, section ))) return FALSE;
883 do
884 {
885 if (!SetupGetStringFieldW( &context, 1, buffer, sizeof(buffer)/sizeof(WCHAR), NULL ))
886 goto done;
887 if (!SetupGetIntField( &context, 4, &flags )) flags = 0;
888 if (!SetupQueueDeleteW( queue, dest_dir, buffer )) goto done;
889 } while (SetupFindNextLine( &context, &context ));
890
891 ret = TRUE;
892 done:
893 HeapFree( GetProcessHeap(), 0, dest_dir );
894 return ret;
895}
#define SetupQueueDeleteW
Definition: fileqsup.c:31

Referenced by delete_files_callback(), and SetupQueueDeleteSectionA().

◆ SetupQueueDeleteW()

BOOL WINAPI SetupQueueDeleteW ( HSPFILEQ  handle,
PCWSTR  part1,
PCWSTR  part2 
)

Definition at line 670 of file queue.c.

671{
672 struct file_queue *queue = handle;
673 struct file_op *op;
674
675 if (!(op = HeapAlloc( GetProcessHeap(), 0, sizeof(*op) ))) return FALSE;
676 op->style = 0;
677 op->src_root = NULL;
678 op->src_path = NULL;
679 op->src_file = NULL;
680 op->src_descr = NULL;
681 op->src_tag = NULL;
682 op->dst_path = strdupW( part1 );
683 op->dst_file = strdupW( part2 );
684 op->dst_sd = NULL;
685 queue_file_op( &queue->delete_queue, op );
686 return TRUE;
687}

◆ SetupQueueRenameA()

BOOL WINAPI SetupQueueRenameA ( HSPFILEQ  handle,
PCSTR  SourcePath,
PCSTR  SourceFilename,
PCSTR  TargetPath,
PCSTR  TargetFilename 
)

Definition at line 693 of file queue.c.

695{
696 struct file_queue *queue = handle;
697 struct file_op *op;
698
699 if (!(op = HeapAlloc( GetProcessHeap(), 0, sizeof(*op) ))) return FALSE;
700 op->style = 0;
701 op->src_root = NULL;
702 op->src_path = strdupAtoW( SourcePath );
703 op->src_file = strdupAtoW( SourceFilename );
704 op->src_descr = NULL;
705 op->src_tag = NULL;
706 op->dst_path = strdupAtoW( TargetPath );
707 op->dst_file = strdupAtoW( TargetFilename );
708 op->dst_sd = NULL;
709 queue_file_op( &queue->rename_queue, op );
710 return TRUE;
711}

◆ SetupQueueRenameSectionA()

BOOL WINAPI SetupQueueRenameSectionA ( HSPFILEQ  queue,
HINF  hinf,
HINF  hlist,
PCSTR  section 
)

Definition at line 901 of file queue.c.

902{
903 UNICODE_STRING sectionW;
904 BOOL ret = FALSE;
905
907 {
908 ret = SetupQueueRenameSectionW( queue, hinf, hlist, sectionW.Buffer );
909 RtlFreeUnicodeString( &sectionW );
910 }
912 return ret;
913}
BOOL WINAPI SetupQueueRenameSectionW(HSPFILEQ queue, HINF hinf, HINF hlist, PCWSTR section)
Definition: queue.c:919

◆ SetupQueueRenameSectionW()

BOOL WINAPI SetupQueueRenameSectionW ( HSPFILEQ  queue,
HINF  hinf,
HINF  hlist,
PCWSTR  section 
)

Definition at line 919 of file queue.c.

920{
922 WCHAR *dest_dir;
924 BOOL ret = FALSE;
925
926 TRACE( "hinf=%p/%p section=%s\n", hinf, hlist, debugstr_w(section) );
927
928 if (!hlist) hlist = hinf;
929 if (!SetupFindFirstLineW( hlist, section, NULL, &context )) return FALSE;
930 if (!(dest_dir = get_destination_dir( hinf, section ))) return FALSE;
931 do
932 {
933 if (!SetupGetStringFieldW( &context, 1, dst, sizeof(dst)/sizeof(WCHAR), NULL ))
934 goto done;
935 if (!SetupGetStringFieldW( &context, 2, src, sizeof(src)/sizeof(WCHAR), NULL ))
936 goto done;
937 if (!SetupQueueRenameW( queue, dest_dir, src, NULL, dst )) goto done;
938 } while (SetupFindNextLine( &context, &context ));
939
940 ret = TRUE;
941 done:
942 HeapFree( GetProcessHeap(), 0, dest_dir );
943 return ret;
944}
#define SetupQueueRenameW
Definition: fileqsup.c:32

Referenced by rename_files_callback(), and SetupQueueRenameSectionA().

◆ SetupQueueRenameW()

BOOL WINAPI SetupQueueRenameW ( HSPFILEQ  handle,
PCWSTR  SourcePath,
PCWSTR  SourceFilename,
PCWSTR  TargetPath,
PCWSTR  TargetFilename 
)

Definition at line 717 of file queue.c.

719{
720 struct file_queue *queue = handle;
721 struct file_op *op;
722
723 if (!(op = HeapAlloc( GetProcessHeap(), 0, sizeof(*op) ))) return FALSE;
724 op->style = 0;
725 op->src_root = NULL;
726 op->src_path = strdupW( SourcePath );
727 op->src_file = strdupW( SourceFilename );
728 op->src_descr = NULL;
729 op->src_tag = NULL;
730 op->dst_path = strdupW( TargetPath );
731 op->dst_file = strdupW( TargetFilename );
732 op->dst_sd = NULL;
733 queue_file_op( &queue->rename_queue, op );
734 return TRUE;
735}

◆ SetupRenameErrorA()

UINT WINAPI SetupRenameErrorA ( HWND  parent,
PCSTR  dialogTitle,
PCSTR  source,
PCSTR  target,
UINT  w32error,
DWORD  style 
)

Definition at line 1818 of file queue.c.

1820{
1821 FIXME( "stub: (Error Number %d when attempting to rename %s to %s)\n",
1822 w32error, debugstr_a(source), debugstr_a(target));
1823 return DPROMPT_SKIPFILE;
1824}

Referenced by SetupDefaultQueueCallbackA().

◆ SetupRenameErrorW()

UINT WINAPI SetupRenameErrorW ( HWND  parent,
PCWSTR  dialogTitle,
PCWSTR  source,
PCWSTR  target,
UINT  w32error,
DWORD  style 
)

Definition at line 1830 of file queue.c.

1832{
1833 FIXME( "stub: (Error Number %d when attempting to rename %s to %s)\n",
1834 w32error, debugstr_w(source), debugstr_w(target));
1835 return DPROMPT_SKIPFILE;
1836}

Referenced by SetupDefaultQueueCallbackW().

◆ SetupScanFileQueueA()

BOOL WINAPI SetupScanFileQueueA ( HSPFILEQ  handle,
DWORD  flags,
HWND  window,
PSP_FILE_CALLBACK_A  handler,
PVOID  context,
PDWORD  result 
)

Definition at line 1493 of file queue.c.

1495{
1497
1498 TRACE("%p %x %p %p %p %p\n", handle, flags, window, handler, context, result);
1499
1500 ctx.orig_context = context;
1501 ctx.orig_handler = handler;
1502
1504}
BOOL WINAPI SetupScanFileQueueW(HSPFILEQ handle, DWORD flags, HWND window, PSP_FILE_CALLBACK_W handler, PVOID context, PDWORD result)
Definition: queue.c:1510
static IHTMLWindow2 * window
Definition: events.c:77

◆ SetupScanFileQueueW()

BOOL WINAPI SetupScanFileQueueW ( HSPFILEQ  handle,
DWORD  flags,
HWND  window,
PSP_FILE_CALLBACK_W  handler,
PVOID  context,
PDWORD  result 
)

Definition at line 1510 of file queue.c.

1512{
1513 struct file_queue *queue = handle;
1514 struct file_op *op;
1516 UINT notification = 0;
1517 BOOL ret = FALSE;
1518
1519 TRACE("%p %x %p %p %p %p\n", handle, flags, window, handler, context, result);
1520
1521 *result = FALSE;
1522
1523 if (!queue->copy_queue.count) return TRUE;
1524
1527
1529 {
1530 FIXME("flags %x not fully implemented\n", flags);
1531 }
1532
1533 paths.Source = paths.Target = NULL;
1534
1535 for (op = queue->copy_queue.head; op; op = op->next)
1536 {
1538 switch (notification)
1539 {
1541 /* FIXME: handle delay flag */
1542 if (handler( context, notification, (UINT_PTR)paths.Target, 0 )) goto done;
1543 break;
1545 if (handler( context, notification, (UINT_PTR)&paths, 0 )) goto done;
1546 break;
1547 default:
1548 ret = TRUE; goto done;
1549 }
1550 }
1551
1552 *result = TRUE;
1553
1554 done:
1555 HeapFree( GetProcessHeap(), 0, (void *)paths.Source );
1556 HeapFree( GetProcessHeap(), 0, (void *)paths.Target );
1557 return ret;
1558}
#define SPQ_SCAN_USE_CALLBACK
Definition: setupapi.h:619
#define SPQ_SCAN_USE_CALLBACKEX
Definition: setupapi.h:620

Referenced by EnumerateDrivers(), and SetupScanFileQueueA().

◆ SetupSetFileQueueAlternatePlatformA()

BOOL WINAPI SetupSetFileQueueAlternatePlatformA ( HSPFILEQ  handle,
PSP_ALTPLATFORM_INFO  platform,
PCSTR  catalogfile 
)

Definition at line 1609 of file queue.c.

1610{
1611 FIXME("(%p, %p, %s) stub!\n", handle, platform, debugstr_a(catalogfile));
1612 return FALSE;
1613}
platform
Definition: msipriv.h:364

◆ SetupSetFileQueueAlternatePlatformW()

BOOL WINAPI SetupSetFileQueueAlternatePlatformW ( HSPFILEQ  handle,
PSP_ALTPLATFORM_INFO  platform,
PCWSTR  catalogfile 
)

Definition at line 1619 of file queue.c.

1620{
1621 FIXME("(%p, %p, %s) stub!\n", handle, platform, debugstr_w(catalogfile));
1622 return FALSE;
1623}

◆ SetupSetFileQueueFlags()

BOOL WINAPI SetupSetFileQueueFlags ( HSPFILEQ  handle,
DWORD  mask,
DWORD  flags 
)

Definition at line 1598 of file queue.c.

1599{
1600 struct file_queue *queue = handle;
1601 queue->flags = (queue->flags & ~mask) | flags;
1602 return TRUE;
1603}
GLenum GLint GLuint mask
Definition: glext.h:6028

◆ SetupTermDefaultQueueCallback()

◆ strdupW()

static WCHAR * strdupW ( const WCHAR str)
inlinestatic

Definition at line 66 of file queue.c.

67{
68 WCHAR *ret = NULL;
69 if (str)
70 {
71 int len = (strlenW(str) + 1) * sizeof(WCHAR);
72 if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( ret, str, len );
73 }
74 return ret;
75}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const WCHAR * str

Referenced by SetupQueueCopyIndirectW(), SetupQueueDeleteW(), and SetupQueueRenameW().

◆ strdupWtoA()

static char * strdupWtoA ( const WCHAR str)
inlinestatic

Definition at line 77 of file queue.c.

78{
79 char *ret = NULL;
80 if (str)
81 {
83 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
85 }
86 return ret;
87}
#define WideCharToMultiByte
Definition: compat.h:111

Referenced by QUEUE_callback_WtoA().

Variable Documentation

◆ DotSecurity

const WCHAR DotSecurity[] = {'.','S','e','c','u','r','i','t','y',0}
static

Definition at line 26 of file queue.c.

Referenced by SetupQueueCopySectionW().