2 * Setupapi file queue routines
4 * Copyright 2002 Alexandre Julliard for CodeWeavers
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "setupapi_private.h"
34 #include "wine/debug.h"
35 #include "wine/heap.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(setupapi
);
39 /* context structure for the default queue callback */
40 struct default_callback_context
67 struct source_media
*media
;
80 struct file_op_queue copy_queue
;
81 struct file_op_queue delete_queue
;
82 struct file_op_queue rename_queue
;
84 struct source_media
**sources
;
85 unsigned int source_count
;
88 #define FILE_QUEUE_MAGIC 0x21514653
90 /* append a file operation to a queue */
91 static inline void queue_file_op( struct file_op_queue
*queue
, struct file_op
*op
)
94 if (queue
->tail
) queue
->tail
->next
= op
;
95 else queue
->head
= op
;
100 /* free all the file operations on a given queue */
101 static void free_file_op_queue( struct file_op_queue
*queue
)
103 struct file_op
*t
, *op
= queue
->head
;
107 HeapFree( GetProcessHeap(), 0, op
->src_path
);
108 HeapFree( GetProcessHeap(), 0, op
->src_file
);
109 HeapFree( GetProcessHeap(), 0, op
->dst_path
);
110 if (op
->dst_file
!= op
->src_file
) HeapFree( GetProcessHeap(), 0, op
->dst_file
);
113 HeapFree( GetProcessHeap(), 0, t
);
117 /* concat 3 strings to make a path, handling separators correctly */
118 static void concat_W( WCHAR
*buffer
, const WCHAR
*src1
, const WCHAR
*src2
, const WCHAR
*src3
)
123 lstrcpyW( buffer
, src1
);
124 buffer
+= lstrlenW(buffer
);
125 if (buffer
[-1] != '\\') *buffer
++ = '\\';
127 if (src2
) while (*src2
== '\\') src2
++;
132 lstrcpyW( buffer
, src2
);
133 buffer
+= lstrlenW(buffer
);
134 if (buffer
[-1] != '\\') *buffer
++ = '\\';
136 if (src3
) while (*src3
== '\\') src3
++;
140 lstrcpyW( buffer
, src3
);
144 /***********************************************************************
147 * Build a FILEPATHS_W structure for a given file operation.
149 static BOOL
build_filepathsW( const struct file_op
*op
, FILEPATHS_W
*paths
)
151 unsigned int src_len
= 1, dst_len
= 1;
152 WCHAR
*source
= (PWSTR
)paths
->Source
, *target
= (PWSTR
)paths
->Target
;
154 if (op
->media
) src_len
+= lstrlenW(op
->media
->root
) + 1;
155 if (op
->src_path
) src_len
+= lstrlenW(op
->src_path
) + 1;
156 if (op
->src_file
) src_len
+= lstrlenW(op
->src_file
) + 1;
157 if (op
->dst_path
) dst_len
+= lstrlenW(op
->dst_path
) + 1;
158 if (op
->dst_file
) dst_len
+= lstrlenW(op
->dst_file
) + 1;
159 src_len
*= sizeof(WCHAR
);
160 dst_len
*= sizeof(WCHAR
);
162 if (!source
|| HeapSize( GetProcessHeap(), 0, source
) < src_len
)
164 HeapFree( GetProcessHeap(), 0, source
);
165 paths
->Source
= source
= HeapAlloc( GetProcessHeap(), 0, src_len
);
167 if (!target
|| HeapSize( GetProcessHeap(), 0, target
) < dst_len
)
169 HeapFree( GetProcessHeap(), 0, target
);
170 paths
->Target
= target
= HeapAlloc( GetProcessHeap(), 0, dst_len
);
172 if (!source
|| !target
) return FALSE
;
173 concat_W( source
, op
->media
? op
->media
->root
: NULL
, op
->src_path
, op
->src_file
);
174 concat_W( target
, NULL
, op
->dst_path
, op
->dst_file
);
175 paths
->Win32Error
= 0;
181 /***********************************************************************
182 * QUEUE_callback_WtoA
184 * Map a file callback parameters from W to A and call the A callback.
186 UINT CALLBACK
QUEUE_callback_WtoA( void *context
, UINT notification
,
187 UINT_PTR param1
, UINT_PTR param2
)
189 struct callback_WtoA_context
*callback_ctx
= context
;
190 char buffer
[MAX_PATH
];
192 UINT_PTR old_param2
= param2
;
196 case SPFILENOTIFY_COPYERROR
:
198 param2
= (UINT_PTR
)buffer
;
200 case SPFILENOTIFY_STARTDELETE
:
201 case SPFILENOTIFY_ENDDELETE
:
202 case SPFILENOTIFY_DELETEERROR
:
203 case SPFILENOTIFY_STARTRENAME
:
204 case SPFILENOTIFY_ENDRENAME
:
205 case SPFILENOTIFY_RENAMEERROR
:
206 case SPFILENOTIFY_STARTCOPY
:
207 case SPFILENOTIFY_ENDCOPY
:
208 case SPFILENOTIFY_QUEUESCAN_EX
:
210 FILEPATHS_W
*pathsW
= (FILEPATHS_W
*)param1
;
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
);
222 if (notification
== SPFILENOTIFY_COPYERROR
)
223 MultiByteToWideChar( CP_ACP
, 0, buffer
, -1, (WCHAR
*)old_param2
, MAX_PATH
);
226 case SPFILENOTIFY_STARTREGISTRATION
:
227 case SPFILENOTIFY_ENDREGISTRATION
:
229 SP_REGISTER_CONTROL_STATUSW
*statusW
= (SP_REGISTER_CONTROL_STATUSW
*)param1
;
230 SP_REGISTER_CONTROL_STATUSA statusA
;
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
);
242 case SPFILENOTIFY_QUEUESCAN
:
244 LPWSTR targetW
= (LPWSTR
)param1
;
245 LPSTR target
= strdupWtoA( targetW
);
247 ret
= callback_ctx
->orig_handler( callback_ctx
->orig_context
, notification
,
248 (UINT_PTR
)target
, param2
);
249 HeapFree( GetProcessHeap(), 0, target
);
253 case SPFILENOTIFY_NEEDMEDIA
:
255 const SOURCE_MEDIA_W
*mediaW
= (const SOURCE_MEDIA_W
*)param1
;
257 SOURCE_MEDIA_A mediaA
;
259 mediaA
.Tagfile
= strdupWtoA(mediaW
->Tagfile
);
260 mediaA
.Description
= strdupWtoA(mediaW
->Description
);
261 mediaA
.SourcePath
= strdupWtoA(mediaW
->SourcePath
);
262 mediaA
.SourceFile
= strdupWtoA(mediaW
->SourceFile
);
263 mediaA
.Flags
= mediaW
->Flags
;
266 ret
= callback_ctx
->orig_handler(callback_ctx
->orig_context
, notification
,
267 (UINT_PTR
)&mediaA
, (UINT_PTR
)&path
);
268 MultiByteToWideChar(CP_ACP
, 0, path
, -1, (WCHAR
*)param2
, MAX_PATH
);
270 heap_free((char *)mediaA
.Tagfile
);
271 heap_free((char *)mediaA
.Description
);
272 heap_free((char *)mediaA
.SourcePath
);
273 heap_free((char *)mediaA
.SourceFile
);
276 case SPFILENOTIFY_STARTQUEUE
:
277 case SPFILENOTIFY_ENDQUEUE
:
278 case SPFILENOTIFY_STARTSUBQUEUE
:
279 case SPFILENOTIFY_ENDSUBQUEUE
:
281 ret
= callback_ctx
->orig_handler( callback_ctx
->orig_context
, notification
, param1
, param2
);
287 static void get_source_info( HINF hinf
, const WCHAR
*src_file
, SP_FILE_COPY_PARAMS_W
*params
,
288 WCHAR
*src_root
, WCHAR
*src_path
)
290 INFCONTEXT file_ctx
, disk_ctx
;
294 /* find the SourceDisksFiles entry */
295 if (!SetupFindFirstLineW( hinf
, L
"SourceDisksFiles", src_file
, &file_ctx
)) return;
296 if (!SetupGetIntField( &file_ctx
, 1, &diskid
)) return;
298 /* now find the diskid in the SourceDisksNames section */
299 if (!SetupFindFirstLineW( hinf
, L
"SourceDisksNames", NULL
, &disk_ctx
)) return;
302 if (SetupGetIntField( &disk_ctx
, 0, &id
) && (id
== diskid
)) break;
303 if (!SetupFindNextLine( &disk_ctx
, &disk_ctx
)) return;
306 if (SetupGetStringFieldW( &disk_ctx
, 1, NULL
, 0, &len
) && len
> sizeof(WCHAR
)
307 && (params
->SourceDescription
= heap_alloc( len
* sizeof(WCHAR
) )))
308 SetupGetStringFieldW( &disk_ctx
, 1, (WCHAR
*)params
->SourceDescription
, len
, NULL
);
310 if (SetupGetStringFieldW( &disk_ctx
, 2, NULL
, 0, &len
) && len
> sizeof(WCHAR
)
311 && (params
->SourceTagfile
= heap_alloc( len
* sizeof(WCHAR
) )))
312 SetupGetStringFieldW( &disk_ctx
, 2, (WCHAR
*)params
->SourceTagfile
, len
, NULL
);
314 if (SetupGetStringFieldW( &disk_ctx
, 4, NULL
, 0, &len
) && len
> sizeof(WCHAR
)
315 && len
< MAX_PATH
- lstrlenW( src_root
) - 1)
317 lstrcatW( src_root
, L
"\\" );
318 SetupGetStringFieldW( &disk_ctx
, 4, src_root
+ lstrlenW( src_root
),
319 MAX_PATH
- lstrlenW( src_root
), NULL
);
322 if (SetupGetStringFieldW( &file_ctx
, 2, NULL
, 0, &len
) && len
> sizeof(WCHAR
) && len
< MAX_PATH
)
324 SetupGetStringFieldW( &file_ctx
, 2, src_path
, MAX_PATH
, NULL
);
325 params
->SourcePath
= src_path
;
329 /***********************************************************************
330 * get_destination_dir
332 * Retrieve the destination dir for a given section.
334 static WCHAR
*get_destination_dir( HINF hinf
, const WCHAR
*section
)
337 WCHAR systemdir
[MAX_PATH
], *dir
;
340 if (!section
|| !(ret
= SetupFindFirstLineW( hinf
, L
"DestinationDirs", section
, &context
)))
341 ret
= SetupFindFirstLineW( hinf
, L
"DestinationDirs", L
"DefaultDestDir", &context
);
343 if (ret
&& (dir
= PARSER_get_dest_dir( &context
)))
346 GetSystemDirectoryW( systemdir
, MAX_PATH
);
347 return strdupW( systemdir
);
350 struct extract_cab_ctx
356 static UINT WINAPI
extract_cab_cb( void *arg
, UINT message
, UINT_PTR param1
, UINT_PTR param2
)
358 struct extract_cab_ctx
*ctx
= arg
;
362 case SPFILENOTIFY_FILEINCABINET
:
364 FILE_IN_CABINET_INFO_W
*info
= (FILE_IN_CABINET_INFO_W
*)param1
;
365 const WCHAR
*filename
;
367 if ((filename
= wcsrchr( info
->NameInCabinet
, '\\' )))
370 filename
= info
->NameInCabinet
;
372 if (lstrcmpiW( filename
, ctx
->src
))
375 lstrcpyW( info
->FullTargetName
, ctx
->dst
);
378 case SPFILENOTIFY_FILEEXTRACTED
:
380 const FILEPATHS_W
*paths
= (const FILEPATHS_W
*)param1
;
381 return paths
->Win32Error
;
383 case SPFILENOTIFY_NEEDNEWCABINET
:
385 const CABINET_INFO_W
*info
= (const CABINET_INFO_W
*)param1
;
386 lstrcpyW( (WCHAR
*)param2
, info
->CabinetPath
);
387 return ERROR_SUCCESS
;
389 case SPFILENOTIFY_CABINETINFO
:
392 FIXME("Unexpected message %#x.\n", message
);
397 /***********************************************************************
398 * extract_cabinet_file
400 * Extract a file from a .cab file.
402 static BOOL
extract_cabinet_file( const WCHAR
*cabinet
, const WCHAR
*root
,
403 const WCHAR
*src
, const WCHAR
*dst
)
405 struct extract_cab_ctx ctx
= {src
, dst
};
406 int len
= lstrlenW( cabinet
);
407 WCHAR path
[MAX_PATH
];
409 /* make sure the cabinet file has a .cab extension */
410 if (len
<= 4 || wcsicmp( cabinet
+ len
- 4, L
".cab" )) return FALSE
;
412 lstrcpyW(path
, root
);
413 lstrcatW(path
, L
"\\" );
414 lstrcatW(path
, cabinet
);
416 return SetupIterateCabinetW( path
, 0, extract_cab_cb
, &ctx
);
419 /***********************************************************************
420 * SetupOpenFileQueue (SETUPAPI.@)
422 HSPFILEQ WINAPI
SetupOpenFileQueue(void)
424 struct file_queue
*queue
;
426 if (!(queue
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*queue
))))
427 return INVALID_HANDLE_VALUE
;
428 queue
->magic
= FILE_QUEUE_MAGIC
;
433 /***********************************************************************
434 * SetupCloseFileQueue (SETUPAPI.@)
436 BOOL WINAPI
SetupCloseFileQueue( HSPFILEQ handle
)
438 struct file_queue
*queue
= handle
;
441 /* Windows XP DDK installer passes the handle returned from
442 * SetupInitDefaultQueueCallback() to this function. */
443 if (queue
->magic
!= FILE_QUEUE_MAGIC
)
445 SetLastError(ERROR_INVALID_HANDLE
);
449 free_file_op_queue( &queue
->copy_queue
);
450 free_file_op_queue( &queue
->rename_queue
);
451 free_file_op_queue( &queue
->delete_queue
);
452 for (i
= 0; i
< queue
->source_count
; ++i
)
454 heap_free( queue
->sources
[i
]->desc
);
455 heap_free( queue
->sources
[i
]->tag
);
456 heap_free( queue
->sources
[i
] );
458 heap_free( queue
->sources
);
459 HeapFree( GetProcessHeap(), 0, queue
);
464 /***********************************************************************
465 * SetupQueueCopyIndirectA (SETUPAPI.@)
467 BOOL WINAPI
SetupQueueCopyIndirectA( SP_FILE_COPY_PARAMS_A
*paramsA
)
469 SP_FILE_COPY_PARAMS_W paramsW
;
472 paramsW
.cbSize
= sizeof(paramsW
);
473 paramsW
.QueueHandle
= paramsA
->QueueHandle
;
474 paramsW
.SourceRootPath
= strdupAtoW( paramsA
->SourceRootPath
);
475 paramsW
.SourcePath
= strdupAtoW( paramsA
->SourcePath
);
476 paramsW
.SourceFilename
= strdupAtoW( paramsA
->SourceFilename
);
477 paramsW
.SourceDescription
= strdupAtoW( paramsA
->SourceDescription
);
478 paramsW
.SourceTagfile
= strdupAtoW( paramsA
->SourceTagfile
);
479 paramsW
.TargetDirectory
= strdupAtoW( paramsA
->TargetDirectory
);
480 paramsW
.TargetFilename
= strdupAtoW( paramsA
->TargetFilename
);
481 paramsW
.CopyStyle
= paramsA
->CopyStyle
;
482 paramsW
.LayoutInf
= paramsA
->LayoutInf
;
483 paramsW
.SecurityDescriptor
= strdupAtoW( paramsA
->SecurityDescriptor
);
485 ret
= SetupQueueCopyIndirectW( ¶msW
);
487 heap_free( (WCHAR
*)paramsW
.SourceRootPath
);
488 heap_free( (WCHAR
*)paramsW
.SourcePath
);
489 heap_free( (WCHAR
*)paramsW
.SourceFilename
);
490 heap_free( (WCHAR
*)paramsW
.SourceDescription
);
491 heap_free( (WCHAR
*)paramsW
.SourceTagfile
);
492 heap_free( (WCHAR
*)paramsW
.TargetDirectory
);
493 heap_free( (WCHAR
*)paramsW
.TargetFilename
);
494 heap_free( (WCHAR
*)paramsW
.SecurityDescriptor
);
498 static BOOL
equal_str(const WCHAR
*a
, const WCHAR
*b
)
500 return (!a
&& !b
) || (a
&& b
&& !wcscmp(a
, b
));
503 static struct source_media
*get_source_media(struct file_queue
*queue
,
504 const WCHAR
*root
, const WCHAR
*desc
, const WCHAR
*tag
)
508 for (i
= 0; i
< queue
->source_count
; ++i
)
510 if (!wcscmp(root
, queue
->sources
[i
]->root
)
511 && equal_str(desc
, queue
->sources
[i
]->desc
)
512 && equal_str(tag
, queue
->sources
[i
]->tag
))
514 return queue
->sources
[i
];
518 queue
->sources
= heap_realloc( queue
->sources
, ++queue
->source_count
* sizeof(*queue
->sources
) );
519 queue
->sources
[i
] = heap_alloc( sizeof(*queue
->sources
[i
]) );
520 lstrcpyW(queue
->sources
[i
]->root
, root
);
521 queue
->sources
[i
]->desc
= strdupW(desc
);
522 queue
->sources
[i
]->tag
= strdupW(tag
);
523 queue
->sources
[i
]->resolved
= FALSE
;
524 queue
->sources
[i
]->cabinet
= FALSE
;
526 return queue
->sources
[i
];
529 /***********************************************************************
530 * SetupQueueCopyIndirectW (SETUPAPI.@)
532 BOOL WINAPI
SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W params
)
534 struct file_queue
*queue
= params
->QueueHandle
;
537 if (!(op
= HeapAlloc( GetProcessHeap(), 0, sizeof(*op
) ))) return FALSE
;
538 op
->style
= params
->CopyStyle
;
539 op
->src_path
= strdupW( params
->SourcePath
);
540 op
->src_file
= strdupW( params
->SourceFilename
);
541 op
->dst_path
= strdupW( params
->TargetDirectory
);
542 op
->dst_file
= strdupW( params
->TargetFilename
);
545 if (!op
->dst_file
) op
->dst_file
= op
->src_file
;
546 if (params
->LayoutInf
)
547 FIXME("Unhandled LayoutInf %p.\n", params
->LayoutInf
);
549 op
->media
= get_source_media( queue
, params
->SourceRootPath
? params
->SourceRootPath
: L
"",
550 params
->SourceDescription
, params
->SourceTagfile
);
552 TRACE( "root=%s path=%s file=%s -> dir=%s file=%s descr=%s tag=%s\n",
553 debugstr_w(op
->media
->root
), debugstr_w(op
->src_path
), debugstr_w(op
->src_file
),
554 debugstr_w(op
->dst_path
), debugstr_w(op
->dst_file
),
555 debugstr_w(op
->media
->desc
), debugstr_w(op
->media
->tag
) );
557 queue_file_op( &queue
->copy_queue
, op
);
562 /***********************************************************************
563 * SetupQueueCopyA (SETUPAPI.@)
565 BOOL WINAPI
SetupQueueCopyA( HSPFILEQ queue
, PCSTR src_root
, PCSTR src_path
, PCSTR src_file
,
566 PCSTR src_descr
, PCSTR src_tag
, PCSTR dst_dir
, PCSTR dst_file
,
569 SP_FILE_COPY_PARAMS_A params
;
571 params
.cbSize
= sizeof(params
);
572 params
.QueueHandle
= queue
;
573 params
.SourceRootPath
= src_root
;
574 params
.SourcePath
= src_path
;
575 params
.SourceFilename
= src_file
;
576 params
.SourceDescription
= src_descr
;
577 params
.SourceTagfile
= src_tag
;
578 params
.TargetDirectory
= dst_dir
;
579 params
.TargetFilename
= dst_file
;
580 params
.CopyStyle
= style
;
581 params
.LayoutInf
= 0;
582 params
.SecurityDescriptor
= NULL
;
583 return SetupQueueCopyIndirectA( ¶ms
);
587 /***********************************************************************
588 * SetupQueueCopyW (SETUPAPI.@)
590 BOOL WINAPI
SetupQueueCopyW( HSPFILEQ queue
, PCWSTR src_root
, PCWSTR src_path
, PCWSTR src_file
,
591 PCWSTR src_descr
, PCWSTR src_tag
, PCWSTR dst_dir
, PCWSTR dst_file
,
594 SP_FILE_COPY_PARAMS_W params
;
596 params
.cbSize
= sizeof(params
);
597 params
.QueueHandle
= queue
;
598 params
.SourceRootPath
= src_root
;
599 params
.SourcePath
= src_path
;
600 params
.SourceFilename
= src_file
;
601 params
.SourceDescription
= src_descr
;
602 params
.SourceTagfile
= src_tag
;
603 params
.TargetDirectory
= dst_dir
;
604 params
.TargetFilename
= dst_file
;
605 params
.CopyStyle
= style
;
606 params
.LayoutInf
= 0;
607 params
.SecurityDescriptor
= NULL
;
608 return SetupQueueCopyIndirectW( ¶ms
);
612 /***********************************************************************
613 * SetupQueueDefaultCopyA (SETUPAPI.@)
615 BOOL WINAPI
SetupQueueDefaultCopyA( HSPFILEQ queue
, HINF hinf
, const char *src_rootA
,
616 const char *src_fileA
, const char *dst_fileA
, DWORD style
)
618 WCHAR src_rootW
[MAX_PATH
], src_fileW
[MAX_PATH
], dst_fileW
[MAX_PATH
];
620 if (!src_rootA
|| !src_fileA
|| !dst_fileA
)
622 SetLastError(ERROR_INVALID_PARAMETER
);
626 MultiByteToWideChar( CP_ACP
, 0, src_rootA
, -1, src_rootW
, ARRAY_SIZE(src_rootW
) );
627 MultiByteToWideChar( CP_ACP
, 0, src_fileA
, -1, src_fileW
, ARRAY_SIZE(src_fileW
) );
628 MultiByteToWideChar( CP_ACP
, 0, dst_fileA
, -1, dst_fileW
, ARRAY_SIZE(dst_fileW
) );
629 return SetupQueueDefaultCopyW( queue
, hinf
, src_rootW
, src_fileW
, dst_fileW
, style
);
633 /***********************************************************************
634 * SetupQueueDefaultCopyW (SETUPAPI.@)
636 BOOL WINAPI
SetupQueueDefaultCopyW( HSPFILEQ queue
, HINF hinf
, PCWSTR src_root
, PCWSTR src_file
,
637 PCWSTR dst_file
, DWORD style
)
639 WCHAR src_root_buffer
[MAX_PATH
], src_path
[MAX_PATH
];
640 SP_FILE_COPY_PARAMS_W params
;
643 if (!src_root
|| !src_file
|| !dst_file
)
645 SetLastError(ERROR_INVALID_PARAMETER
);
649 params
.cbSize
= sizeof(params
);
650 params
.QueueHandle
= queue
;
651 params
.SourceRootPath
= src_root_buffer
;
652 params
.SourcePath
= NULL
;
653 params
.SourceFilename
= src_file
;
654 params
.SourceDescription
= NULL
;
655 params
.SourceTagfile
= NULL
;
656 params
.TargetFilename
= dst_file
;
657 params
.CopyStyle
= style
;
658 params
.LayoutInf
= NULL
;
659 params
.SecurityDescriptor
= NULL
;
661 lstrcpyW( src_root_buffer
, src_root
);
663 if (!(params
.TargetDirectory
= get_destination_dir( hinf
, NULL
))) return FALSE
;
664 get_source_info( hinf
, src_file
, ¶ms
, src_root_buffer
, src_path
);
666 ret
= SetupQueueCopyIndirectW( ¶ms
);
668 heap_free( (WCHAR
*)params
.TargetDirectory
);
669 heap_free( (WCHAR
*)params
.SourceDescription
);
670 heap_free( (WCHAR
*)params
.SourceTagfile
);
675 /***********************************************************************
676 * SetupQueueDeleteA (SETUPAPI.@)
678 BOOL WINAPI
SetupQueueDeleteA( HSPFILEQ handle
, PCSTR part1
, PCSTR part2
)
680 struct file_queue
*queue
= handle
;
683 if (!(op
= heap_alloc_zero( sizeof(*op
) ))) return FALSE
;
684 op
->dst_path
= strdupAtoW( part1
);
685 op
->dst_file
= strdupAtoW( part2
);
686 queue_file_op( &queue
->delete_queue
, op
);
691 /***********************************************************************
692 * SetupQueueDeleteW (SETUPAPI.@)
694 BOOL WINAPI
SetupQueueDeleteW( HSPFILEQ handle
, PCWSTR part1
, PCWSTR part2
)
696 struct file_queue
*queue
= handle
;
699 if (!(op
= heap_alloc_zero( sizeof(*op
) ))) return FALSE
;
700 op
->dst_path
= strdupW( part1
);
701 op
->dst_file
= strdupW( part2
);
702 queue_file_op( &queue
->delete_queue
, op
);
707 /***********************************************************************
708 * SetupQueueRenameA (SETUPAPI.@)
710 BOOL WINAPI
SetupQueueRenameA( HSPFILEQ handle
, PCSTR SourcePath
, PCSTR SourceFilename
,
711 PCSTR TargetPath
, PCSTR TargetFilename
)
713 struct file_queue
*queue
= handle
;
716 if (!(op
= heap_alloc_zero( sizeof(*op
) ))) return FALSE
;
717 op
->src_path
= strdupAtoW( SourcePath
);
718 op
->src_file
= strdupAtoW( SourceFilename
);
719 op
->dst_path
= strdupAtoW( TargetPath
);
720 op
->dst_file
= strdupAtoW( TargetFilename
);
721 queue_file_op( &queue
->rename_queue
, op
);
726 /***********************************************************************
727 * SetupQueueRenameW (SETUPAPI.@)
729 BOOL WINAPI
SetupQueueRenameW( HSPFILEQ handle
, PCWSTR SourcePath
, PCWSTR SourceFilename
,
730 PCWSTR TargetPath
, PCWSTR TargetFilename
)
732 struct file_queue
*queue
= handle
;
735 if (!(op
= heap_alloc_zero( sizeof(*op
) ))) return FALSE
;
736 op
->src_path
= strdupW( SourcePath
);
737 op
->src_file
= strdupW( SourceFilename
);
738 op
->dst_path
= strdupW( TargetPath
);
739 op
->dst_file
= strdupW( TargetFilename
);
740 queue_file_op( &queue
->rename_queue
, op
);
745 /***********************************************************************
746 * SetupQueueCopySectionA (SETUPAPI.@)
748 BOOL WINAPI
SetupQueueCopySectionA( HSPFILEQ queue
, PCSTR src_root
, HINF hinf
, HINF hlist
,
749 PCSTR section
, DWORD style
)
751 UNICODE_STRING sectionW
;
754 if (!RtlCreateUnicodeStringFromAsciiz( §ionW
, section
))
756 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
760 ret
= SetupQueueCopySectionW( queue
, NULL
, hinf
, hlist
, sectionW
.Buffer
, style
);
764 if (RtlCreateUnicodeStringFromAsciiz( &srcW
, src_root
))
766 ret
= SetupQueueCopySectionW( queue
, srcW
.Buffer
, hinf
, hlist
, sectionW
.Buffer
, style
);
767 RtlFreeUnicodeString( &srcW
);
769 else SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
771 RtlFreeUnicodeString( §ionW
);
775 /***********************************************************************
776 * SetupQueueCopySectionW (SETUPAPI.@)
778 BOOL WINAPI
SetupQueueCopySectionW( HSPFILEQ queue
, PCWSTR src_root
, HINF hinf
, HINF hlist
,
779 PCWSTR section
, DWORD style
)
781 WCHAR src_root_buffer
[MAX_PATH
], src_path
[MAX_PATH
], src_file
[MAX_PATH
], dst_file
[MAX_PATH
], *dest_dir
;
783 SP_FILE_COPY_PARAMS_W params
;
788 TRACE("queue %p, src_root %s, hinf %p, hlist %p, section %s, style %#x.\n",
789 queue
, debugstr_w(src_root
), hinf
, hlist
, debugstr_w(section
), style
);
793 SetLastError(ERROR_INVALID_PARAMETER
);
797 params
.cbSize
= sizeof(params
);
798 params
.QueueHandle
= queue
;
799 params
.SourceRootPath
= src_root_buffer
;
800 params
.SourceFilename
= src_file
;
801 params
.TargetFilename
= dst_file
;
802 params
.CopyStyle
= style
;
803 params
.LayoutInf
= NULL
;
804 params
.SecurityDescriptor
= NULL
;
806 lstrcpyW( src_root_buffer
, src_root
);
808 if (!hlist
) hlist
= hinf
;
809 if (!hinf
) hinf
= hlist
;
810 if (!SetupFindFirstLineW( hlist
, section
, NULL
, &context
)) return FALSE
;
811 if (!(params
.TargetDirectory
= dest_dir
= get_destination_dir( hinf
, section
))) return FALSE
;
814 params
.SourcePath
= NULL
;
815 params
.SourceDescription
= NULL
;
816 params
.SourceTagfile
= NULL
;
817 lstrcpyW( src_root_buffer
, src_root
);
820 if (!SetupGetStringFieldW( &context
, 1, dst_file
, ARRAY_SIZE( dst_file
), NULL
))
822 if (!SetupGetStringFieldW( &context
, 2, src_file
, ARRAY_SIZE( src_file
), &len
) || len
<= sizeof(WCHAR
))
823 lstrcpyW( src_file
, dst_file
);
825 if (!SetupGetIntField( &context
, 4, &flags
)) flags
= 0; /* FIXME */
827 get_source_info( hinf
, src_file
, ¶ms
, src_root_buffer
, src_path
);
829 if (!SetupQueueCopyIndirectW( ¶ms
)) goto end
;
831 heap_free( (WCHAR
*)params
.SourceDescription
);
832 heap_free( (WCHAR
*)params
.SourceTagfile
);
833 } while (SetupFindNextLine( &context
, &context
));
837 HeapFree(GetProcessHeap(), 0, dest_dir
);
842 /***********************************************************************
843 * SetupQueueDeleteSectionA (SETUPAPI.@)
845 BOOL WINAPI
SetupQueueDeleteSectionA( HSPFILEQ queue
, HINF hinf
, HINF hlist
, PCSTR section
)
847 UNICODE_STRING sectionW
;
850 if (RtlCreateUnicodeStringFromAsciiz( §ionW
, section
))
852 ret
= SetupQueueDeleteSectionW( queue
, hinf
, hlist
, sectionW
.Buffer
);
853 RtlFreeUnicodeString( §ionW
);
855 else SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
860 /***********************************************************************
861 * SetupQueueDeleteSectionW (SETUPAPI.@)
863 BOOL WINAPI
SetupQueueDeleteSectionW( HSPFILEQ queue
, HINF hinf
, HINF hlist
, PCWSTR section
)
867 WCHAR buffer
[MAX_PATH
];
871 TRACE( "hinf=%p/%p section=%s\n", hinf
, hlist
, debugstr_w(section
) );
873 if (!hlist
) hlist
= hinf
;
874 if (!SetupFindFirstLineW( hlist
, section
, NULL
, &context
)) return FALSE
;
875 if (!(dest_dir
= get_destination_dir( hinf
, section
))) return FALSE
;
878 if (!SetupGetStringFieldW( &context
, 1, buffer
, ARRAY_SIZE( buffer
), NULL
))
880 if (!SetupGetIntField( &context
, 4, &flags
)) flags
= 0;
881 if (!SetupQueueDeleteW( queue
, dest_dir
, buffer
)) goto done
;
882 } while (SetupFindNextLine( &context
, &context
));
886 HeapFree( GetProcessHeap(), 0, dest_dir
);
891 /***********************************************************************
892 * SetupQueueRenameSectionA (SETUPAPI.@)
894 BOOL WINAPI
SetupQueueRenameSectionA( HSPFILEQ queue
, HINF hinf
, HINF hlist
, PCSTR section
)
896 UNICODE_STRING sectionW
;
899 if (RtlCreateUnicodeStringFromAsciiz( §ionW
, section
))
901 ret
= SetupQueueRenameSectionW( queue
, hinf
, hlist
, sectionW
.Buffer
);
902 RtlFreeUnicodeString( §ionW
);
904 else SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
909 /***********************************************************************
910 * SetupQueueRenameSectionW (SETUPAPI.@)
912 BOOL WINAPI
SetupQueueRenameSectionW( HSPFILEQ queue
, HINF hinf
, HINF hlist
, PCWSTR section
)
916 WCHAR src
[MAX_PATH
], dst
[MAX_PATH
];
919 TRACE( "hinf=%p/%p section=%s\n", hinf
, hlist
, debugstr_w(section
) );
921 if (!hlist
) hlist
= hinf
;
922 if (!SetupFindFirstLineW( hlist
, section
, NULL
, &context
)) return FALSE
;
923 if (!(dest_dir
= get_destination_dir( hinf
, section
))) return FALSE
;
926 if (!SetupGetStringFieldW( &context
, 1, dst
, ARRAY_SIZE( dst
), NULL
))
928 if (!SetupGetStringFieldW( &context
, 2, src
, ARRAY_SIZE( src
), NULL
))
930 if (!SetupQueueRenameW( queue
, dest_dir
, src
, NULL
, dst
)) goto done
;
931 } while (SetupFindNextLine( &context
, &context
));
935 HeapFree( GetProcessHeap(), 0, dest_dir
);
940 /***********************************************************************
941 * SetupCommitFileQueueA (SETUPAPI.@)
943 BOOL WINAPI
SetupCommitFileQueueA( HWND owner
, HSPFILEQ queue
, PSP_FILE_CALLBACK_A handler
,
946 struct callback_WtoA_context ctx
;
948 ctx
.orig_context
= context
;
949 ctx
.orig_handler
= handler
;
950 return SetupCommitFileQueueW( owner
, queue
, QUEUE_callback_WtoA
, &ctx
);
954 /***********************************************************************
957 * Recursively create all directories in the path.
959 static BOOL
create_full_pathW(const WCHAR
*path
)
965 new_path
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path
) + 1) * sizeof(WCHAR
));
966 lstrcpyW(new_path
, path
);
968 while((len
= lstrlenW(new_path
)) && new_path
[len
- 1] == '\\')
969 new_path
[len
- 1] = 0;
971 while(!CreateDirectoryW(new_path
, NULL
))
974 DWORD last_error
= GetLastError();
976 if(last_error
== ERROR_ALREADY_EXISTS
)
979 if(last_error
!= ERROR_PATH_NOT_FOUND
)
985 if(!(slash
= wcsrchr(new_path
, '\\')))
991 len
= slash
- new_path
;
993 if(!create_full_pathW(new_path
))
998 new_path
[len
] = '\\';
1001 HeapFree(GetProcessHeap(), 0, new_path
);
1005 static BOOL
do_file_copyW( LPCWSTR source
, LPCWSTR target
, DWORD style
,
1006 PSP_FILE_CALLBACK_W handler
, PVOID context
)
1011 TRACE("copy %s to %s style 0x%x\n",debugstr_w(source
),debugstr_w(target
),style
);
1013 /* before copy processing */
1014 if (style
& SP_COPY_REPLACEONLY
)
1016 if (GetFileAttributesW(target
) == INVALID_FILE_ATTRIBUTES
)
1019 if (style
& (SP_COPY_NEWER_OR_SAME
| SP_COPY_NEWER_ONLY
| SP_COPY_FORCE_NEWER
))
1021 DWORD VersionSizeSource
=0;
1022 DWORD VersionSizeTarget
=0;
1026 * This is sort of an interesting workaround. You see, calling
1027 * GetVersionInfoSize on a builtin dll loads that dll into memory
1028 * and we do not properly unload builtin dlls.. so we effectively
1029 * lock into memory all the targets we are replacing. This leads
1030 * to problems when we try to register the replaced dlls.
1032 * So I will test for the existence of the files first so that
1033 * we just basically unconditionally replace the builtin versions.
1035 if ((GetFileAttributesW(target
) != INVALID_FILE_ATTRIBUTES
) &&
1036 (GetFileAttributesW(source
) != INVALID_FILE_ATTRIBUTES
))
1038 VersionSizeSource
= GetFileVersionInfoSizeW(source
,&zero
);
1039 VersionSizeTarget
= GetFileVersionInfoSizeW(target
,&zero
);
1042 if (VersionSizeSource
&& VersionSizeTarget
)
1044 LPVOID VersionSource
;
1045 LPVOID VersionTarget
;
1046 VS_FIXEDFILEINFO
*TargetInfo
;
1047 VS_FIXEDFILEINFO
*SourceInfo
;
1051 VersionSource
= HeapAlloc(GetProcessHeap(),0,VersionSizeSource
);
1052 VersionTarget
= HeapAlloc(GetProcessHeap(),0,VersionSizeTarget
);
1054 ret
= GetFileVersionInfoW(source
,0,VersionSizeSource
,VersionSource
);
1056 ret
= GetFileVersionInfoW(target
, 0, VersionSizeTarget
,
1061 ret
= VerQueryValueW(VersionSource
, L
"\\", (LPVOID
*)&SourceInfo
, &length
);
1063 ret
= VerQueryValueW(VersionTarget
, L
"\\", (LPVOID
*)&TargetInfo
, &length
);
1067 FILEPATHS_W filepaths
;
1069 TRACE("Versions: Source %i.%i target %i.%i\n",
1070 SourceInfo
->dwFileVersionMS
, SourceInfo
->dwFileVersionLS
,
1071 TargetInfo
->dwFileVersionMS
, TargetInfo
->dwFileVersionLS
);
1073 /* used in case of notification */
1074 filepaths
.Target
= target
;
1075 filepaths
.Source
= source
;
1076 filepaths
.Win32Error
= 0;
1077 filepaths
.Flags
= 0;
1079 if (TargetInfo
->dwFileVersionMS
> SourceInfo
->dwFileVersionMS
)
1082 docopy
= handler (context
, SPFILENOTIFY_TARGETNEWER
, (UINT_PTR
)&filepaths
, 0);
1086 else if ((TargetInfo
->dwFileVersionMS
== SourceInfo
->dwFileVersionMS
)
1087 && (TargetInfo
->dwFileVersionLS
> SourceInfo
->dwFileVersionLS
))
1090 docopy
= handler (context
, SPFILENOTIFY_TARGETNEWER
, (UINT_PTR
)&filepaths
, 0);
1094 else if ((style
& SP_COPY_NEWER_ONLY
) &&
1095 (TargetInfo
->dwFileVersionMS
==
1096 SourceInfo
->dwFileVersionMS
)
1097 &&(TargetInfo
->dwFileVersionLS
==
1098 SourceInfo
->dwFileVersionLS
))
1101 docopy
= handler (context
, SPFILENOTIFY_TARGETNEWER
, (UINT_PTR
)&filepaths
, 0);
1107 HeapFree(GetProcessHeap(),0,VersionSource
);
1108 HeapFree(GetProcessHeap(),0,VersionTarget
);
1111 if (style
& (SP_COPY_NOOVERWRITE
| SP_COPY_FORCE_NOOVERWRITE
))
1113 if (GetFileAttributesW(target
) != INVALID_FILE_ATTRIBUTES
)
1115 FIXME("Notify user target file exists\n");
1119 if (style
& (SP_COPY_NODECOMP
| SP_COPY_LANGUAGEAWARE
| SP_COPY_FORCE_IN_USE
|
1120 SP_COPY_NOSKIP
| SP_COPY_WARNIFSKIP
))
1122 ERR("Unsupported style(s) 0x%x\n",style
);
1127 rc
= CopyFileW(source
,target
,FALSE
);
1128 if (!rc
&& GetLastError() == ERROR_SHARING_VIOLATION
&&
1129 (style
& SP_COPY_IN_USE_NEEDS_REBOOT
))
1131 WCHAR temp_file
[MAX_PATH
];
1132 WCHAR temp
[MAX_PATH
];
1134 if (GetTempPathW(MAX_PATH
, temp
) &&
1135 GetTempFileNameW(temp
, L
"SET", 0, temp_file
))
1137 rc
= CopyFileW(source
, temp_file
, FALSE
);
1139 rc
= MoveFileExW(temp_file
, target
, MOVEFILE_DELAY_UNTIL_REBOOT
);
1141 DeleteFileW(temp_file
);
1144 if (!rc
) WARN( "failed to copy, err %u\n", GetLastError() );
1147 SetLastError(ERROR_SUCCESS
);
1149 /* after copy processing */
1150 if (style
& SP_COPY_DELETESOURCE
)
1153 DeleteFileW(source
);
1159 /***********************************************************************
1160 * SetupInstallFileExA (SETUPAPI.@)
1162 BOOL WINAPI
SetupInstallFileExA( HINF hinf
, PINFCONTEXT inf_context
, PCSTR source
, PCSTR root
,
1163 PCSTR dest
, DWORD style
, PSP_FILE_CALLBACK_A handler
, PVOID context
, PBOOL in_use
)
1166 struct callback_WtoA_context ctx
;
1167 UNICODE_STRING sourceW
, rootW
, destW
;
1169 TRACE("%p %p %s %s %s %x %p %p %p\n", hinf
, inf_context
, debugstr_a(source
), debugstr_a(root
),
1170 debugstr_a(dest
), style
, handler
, context
, in_use
);
1172 sourceW
.Buffer
= rootW
.Buffer
= destW
.Buffer
= NULL
;
1173 if (source
&& !RtlCreateUnicodeStringFromAsciiz( &sourceW
, source
))
1175 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
1178 if (root
&& !RtlCreateUnicodeStringFromAsciiz( &rootW
, root
))
1180 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
1183 if (dest
&& !RtlCreateUnicodeStringFromAsciiz( &destW
, dest
))
1185 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
1189 ctx
.orig_context
= context
;
1190 ctx
.orig_handler
= handler
;
1192 ret
= SetupInstallFileExW( hinf
, inf_context
, sourceW
.Buffer
, rootW
.Buffer
, destW
.Buffer
, style
, QUEUE_callback_WtoA
, &ctx
, in_use
);
1195 RtlFreeUnicodeString( &sourceW
);
1196 RtlFreeUnicodeString( &rootW
);
1197 RtlFreeUnicodeString( &destW
);
1201 /***********************************************************************
1202 * SetupInstallFileA (SETUPAPI.@)
1204 BOOL WINAPI
SetupInstallFileA( HINF hinf
, PINFCONTEXT inf_context
, PCSTR source
, PCSTR root
,
1205 PCSTR dest
, DWORD style
, PSP_FILE_CALLBACK_A handler
, PVOID context
)
1207 return SetupInstallFileExA( hinf
, inf_context
, source
, root
, dest
, style
, handler
, context
, NULL
);
1210 /***********************************************************************
1211 * SetupInstallFileExW (SETUPAPI.@)
1213 BOOL WINAPI
SetupInstallFileExW( HINF hinf
, PINFCONTEXT inf_context
, PCWSTR source
, PCWSTR root
,
1214 PCWSTR dest
, DWORD style
, PSP_FILE_CALLBACK_W handler
, PVOID context
, PBOOL in_use
)
1216 BOOL ret
, absolute
= (root
&& *root
&& !(style
& SP_COPY_SOURCE_ABSOLUTE
));
1217 WCHAR
*buffer
, *p
, *inf_source
= NULL
, dest_path
[MAX_PATH
];
1220 TRACE("%p %p %s %s %s %x %p %p %p\n", hinf
, inf_context
, debugstr_w(source
), debugstr_w(root
),
1221 debugstr_w(dest
), style
, handler
, context
, in_use
);
1223 if (in_use
) FIXME("no file in use support\n");
1235 if (!SetupFindFirstLineW( hinf
, L
"CopyFiles", NULL
, inf_context
)) return FALSE
;
1237 if (!SetupGetStringFieldW( inf_context
, 1, NULL
, 0, &len
)) return FALSE
;
1238 if (!(inf_source
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) )))
1240 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
1243 if (!SetupGetStringFieldW( inf_context
, 1, inf_source
, len
, NULL
))
1245 HeapFree( GetProcessHeap(), 0, inf_source
);
1248 source
= inf_source
;
1250 if ((dest_dir
= get_destination_dir( hinf
, NULL
)))
1252 lstrcpyW( dest_path
, dest_dir
);
1253 lstrcatW( dest_path
, L
"\\" );
1254 heap_free( dest_dir
);
1259 SetLastError( ERROR_INVALID_PARAMETER
);
1263 len
= lstrlenW( source
) + 1;
1264 if (absolute
) len
+= lstrlenW( root
) + 1;
1266 if (!(p
= buffer
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) )))
1268 HeapFree( GetProcessHeap(), 0, inf_source
);
1269 SetLastError( ERROR_NOT_ENOUGH_MEMORY
);
1275 lstrcpyW( buffer
, root
);
1276 p
+= lstrlenW( buffer
);
1277 if (p
[-1] != '\\') *p
++ = '\\';
1279 while (*source
== '\\') source
++;
1280 lstrcpyW( p
, source
);
1282 lstrcatW( dest_path
, dest
);
1284 ret
= do_file_copyW( buffer
, dest_path
, style
, handler
, context
);
1286 HeapFree( GetProcessHeap(), 0, inf_source
);
1287 HeapFree( GetProcessHeap(), 0, buffer
);
1291 /***********************************************************************
1292 * SetupInstallFileW (SETUPAPI.@)
1294 BOOL WINAPI
SetupInstallFileW( HINF hinf
, PINFCONTEXT inf_context
, PCWSTR source
, PCWSTR root
,
1295 PCWSTR dest
, DWORD style
, PSP_FILE_CALLBACK_W handler
, PVOID context
)
1297 return SetupInstallFileExW( hinf
, inf_context
, source
, root
, dest
, style
, handler
, context
, NULL
);
1300 static BOOL
queue_copy_file( const WCHAR
*source
, const WCHAR
*dest
,
1301 const struct file_op
*op
, PSP_FILE_CALLBACK_W handler
, void *context
)
1303 TRACE("copying file %s -> %s\n", debugstr_w(source
), debugstr_w(dest
));
1305 if (op
->dst_path
&& !create_full_pathW(op
->dst_path
))
1308 if (do_file_copyW(source
, dest
, op
->style
, handler
, context
) || GetLastError() == ERROR_SUCCESS
)
1311 /* try to extract it from the cabinet file */
1312 if (op
->media
->tag
&& extract_cabinet_file(op
->media
->tag
, op
->media
->root
, op
->src_file
, dest
))
1314 op
->media
->cabinet
= TRUE
;
1321 /***********************************************************************
1322 * SetupCommitFileQueueW (SETUPAPI.@)
1324 BOOL WINAPI
SetupCommitFileQueueW( HWND owner
, HSPFILEQ handle
, PSP_FILE_CALLBACK_W handler
,
1327 struct file_queue
*queue
= handle
;
1329 BOOL result
= FALSE
;
1333 paths
.Source
= paths
.Target
= NULL
;
1335 if (!queue
->copy_queue
.count
&& !queue
->delete_queue
.count
&& !queue
->rename_queue
.count
)
1336 return TRUE
; /* nothing to do */
1338 if (!handler( context
, SPFILENOTIFY_STARTQUEUE
, (UINT_PTR
)owner
, 0 )) return FALSE
;
1340 /* perform deletes */
1342 if (queue
->delete_queue
.count
)
1344 if (!(handler( context
, SPFILENOTIFY_STARTSUBQUEUE
, FILEOP_DELETE
,
1345 queue
->delete_queue
.count
))) goto done
;
1346 for (op
= queue
->delete_queue
.head
; op
; op
= op
->next
)
1348 build_filepathsW( op
, &paths
);
1349 op_result
= handler( context
, SPFILENOTIFY_STARTDELETE
, (UINT_PTR
)&paths
, FILEOP_DELETE
);
1350 if (op_result
== FILEOP_ABORT
) goto done
;
1351 while (op_result
== FILEOP_DOIT
)
1353 TRACE( "deleting file %s\n", debugstr_w(paths
.Target
) );
1354 if (DeleteFileW( paths
.Target
)) break; /* success */
1355 paths
.Win32Error
= GetLastError();
1356 op_result
= handler( context
, SPFILENOTIFY_DELETEERROR
, (UINT_PTR
)&paths
, 0 );
1357 if (op_result
== FILEOP_ABORT
) goto done
;
1359 handler( context
, SPFILENOTIFY_ENDDELETE
, (UINT_PTR
)&paths
, 0 );
1361 handler( context
, SPFILENOTIFY_ENDSUBQUEUE
, FILEOP_DELETE
, 0 );
1364 /* perform renames */
1366 if (queue
->rename_queue
.count
)
1368 if (!(handler( context
, SPFILENOTIFY_STARTSUBQUEUE
, FILEOP_RENAME
,
1369 queue
->rename_queue
.count
))) goto done
;
1370 for (op
= queue
->rename_queue
.head
; op
; op
= op
->next
)
1372 build_filepathsW( op
, &paths
);
1373 op_result
= handler( context
, SPFILENOTIFY_STARTRENAME
, (UINT_PTR
)&paths
, FILEOP_RENAME
);
1374 if (op_result
== FILEOP_ABORT
) goto done
;
1375 while (op_result
== FILEOP_DOIT
)
1377 TRACE( "renaming file %s -> %s\n",
1378 debugstr_w(paths
.Source
), debugstr_w(paths
.Target
) );
1379 if (MoveFileW( paths
.Source
, paths
.Target
)) break; /* success */
1380 paths
.Win32Error
= GetLastError();
1381 op_result
= handler( context
, SPFILENOTIFY_RENAMEERROR
, (UINT_PTR
)&paths
, 0 );
1382 if (op_result
== FILEOP_ABORT
) goto done
;
1384 handler( context
, SPFILENOTIFY_ENDRENAME
, (UINT_PTR
)&paths
, 0 );
1386 handler( context
, SPFILENOTIFY_ENDSUBQUEUE
, FILEOP_RENAME
, 0 );
1389 /* perform copies */
1391 if (queue
->copy_queue
.count
)
1393 if (!(handler( context
, SPFILENOTIFY_STARTSUBQUEUE
, FILEOP_COPY
,
1394 queue
->copy_queue
.count
))) goto done
;
1395 for (op
= queue
->copy_queue
.head
; op
; op
= op
->next
)
1397 WCHAR newpath
[MAX_PATH
];
1399 if (!op
->media
->resolved
)
1401 /* The NEEDMEDIA callback asks for the folder containing the
1402 * first file, but that might be in a subdir of the source
1403 * disk's root directory. We have to do some contortions to
1404 * correct for this. Pretend that the file we're using
1405 * actually isn't in a subdirectory, but keep track of what it
1406 * was, and then later strip it from the root path that we
1407 * ultimately resolve the source disk to. */
1408 WCHAR src_path
[MAX_PATH
];
1409 size_t path_len
= 0;
1414 lstrcpyW(src_path
, op
->src_path
);
1415 path_len
= lstrlenW(src_path
);
1417 lstrcatW(op
->media
->root
, L
"\\");
1418 lstrcatW(op
->media
->root
, op
->src_path
);
1420 heap_free(op
->src_path
);
1421 op
->src_path
= NULL
;
1426 SOURCE_MEDIA_W media
;
1427 media
.Reserved
= NULL
;
1428 media
.Tagfile
= op
->media
->tag
;
1429 media
.Description
= op
->media
->desc
;
1430 media
.SourcePath
= op
->media
->root
;
1431 media
.SourceFile
= op
->src_file
;
1432 media
.Flags
= op
->style
& (SP_COPY_WARNIFSKIP
| SP_COPY_NOSKIP
| SP_FLAG_CABINETCONTINUATION
| SP_COPY_NOBROWSE
);
1435 op_result
= handler( context
, SPFILENOTIFY_NEEDMEDIA
, (UINT_PTR
)&media
, (UINT_PTR
)newpath
);
1437 if (op_result
== FILEOP_ABORT
)
1439 else if (op_result
== FILEOP_SKIP
)
1441 else if (op_result
== FILEOP_NEWPATH
)
1442 lstrcpyW(op
->media
->root
, newpath
);
1443 else if (op_result
!= FILEOP_DOIT
)
1444 FIXME("Unhandled return value %#x.\n", op_result
);
1446 build_filepathsW( op
, &paths
);
1447 op_result
= handler( context
, SPFILENOTIFY_STARTCOPY
, (UINT_PTR
)&paths
, FILEOP_COPY
);
1448 if (op_result
== FILEOP_ABORT
)
1450 else if (op_result
== FILEOP_SKIP
)
1452 else if (op_result
!= FILEOP_DOIT
)
1453 FIXME("Unhandled return value %#x.\n", op_result
);
1455 if (queue_copy_file( paths
.Source
, paths
.Target
, op
, handler
, context
))
1457 if (path_len
> 0 && !op
->media
->cabinet
)
1459 size_t root_len
= lstrlenW(op
->media
->root
);
1460 if (path_len
<= root_len
&& !wcsnicmp(op
->media
->root
+ root_len
- path_len
, src_path
, path_len
))
1461 op
->media
->root
[root_len
- path_len
- 1] = 0;
1463 op
->media
->resolved
= TRUE
;
1464 handler( context
, SPFILENOTIFY_ENDCOPY
, (UINT_PTR
)&paths
, 0 );
1467 paths
.Win32Error
= GetLastError();
1468 if (paths
.Win32Error
== ERROR_PATH_NOT_FOUND
||
1469 paths
.Win32Error
== ERROR_FILE_NOT_FOUND
)
1473 op_result
= handler( context
, SPFILENOTIFY_COPYERROR
, (UINT_PTR
)&paths
, (UINT_PTR
)newpath
);
1474 if (op_result
== FILEOP_ABORT
)
1476 else if (op_result
== FILEOP_SKIP
)
1478 else if (op_result
== FILEOP_NEWPATH
)
1480 lstrcpyW(op
->media
->root
, newpath
);
1481 build_filepathsW(op
, &paths
);
1483 else if (op_result
!= FILEOP_DOIT
)
1484 FIXME("Unhandled return value %#x.\n", op_result
);
1489 build_filepathsW( op
, &paths
);
1490 op_result
= handler( context
, SPFILENOTIFY_STARTCOPY
, (UINT_PTR
)&paths
, FILEOP_COPY
);
1491 if (op_result
== FILEOP_ABORT
)
1493 else if (op_result
== FILEOP_SKIP
)
1495 else if (op_result
!= FILEOP_DOIT
)
1496 FIXME("Unhandled return value %#x.\n", op_result
);
1498 while (op_result
== FILEOP_DOIT
|| op_result
== FILEOP_NEWPATH
)
1500 if (queue_copy_file( paths
.Source
, paths
.Target
, op
, handler
, context
))
1503 paths
.Win32Error
= GetLastError();
1505 op_result
= handler( context
, SPFILENOTIFY_COPYERROR
, (UINT_PTR
)&paths
, (UINT_PTR
)newpath
);
1506 if (op_result
== FILEOP_ABORT
)
1508 else if (op_result
== FILEOP_NEWPATH
)
1510 lstrcpyW(op
->media
->root
, newpath
);
1511 build_filepathsW(op
, &paths
);
1513 else if (op_result
!= FILEOP_SKIP
&& op_result
!= FILEOP_DOIT
)
1514 FIXME("Unhandled return value %#x.\n", op_result
);
1516 handler( context
, SPFILENOTIFY_ENDCOPY
, (UINT_PTR
)&paths
, 0 );
1519 handler( context
, SPFILENOTIFY_ENDSUBQUEUE
, FILEOP_COPY
, 0 );
1526 handler( context
, SPFILENOTIFY_ENDQUEUE
, result
, 0 );
1527 HeapFree( GetProcessHeap(), 0, (void *)paths
.Source
);
1528 HeapFree( GetProcessHeap(), 0, (void *)paths
.Target
);
1533 /***********************************************************************
1534 * SetupScanFileQueueA (SETUPAPI.@)
1536 BOOL WINAPI
SetupScanFileQueueA( HSPFILEQ handle
, DWORD flags
, HWND window
,
1537 PSP_FILE_CALLBACK_A handler
, PVOID context
, PDWORD result
)
1539 struct callback_WtoA_context ctx
;
1541 TRACE("%p %x %p %p %p %p\n", handle
, flags
, window
, handler
, context
, result
);
1543 ctx
.orig_context
= context
;
1544 ctx
.orig_handler
= handler
;
1546 return SetupScanFileQueueW( handle
, flags
, window
, QUEUE_callback_WtoA
, &ctx
, result
);
1550 /***********************************************************************
1551 * SetupScanFileQueueW (SETUPAPI.@)
1553 BOOL WINAPI
SetupScanFileQueueW( HSPFILEQ handle
, DWORD flags
, HWND window
,
1554 PSP_FILE_CALLBACK_W handler
, PVOID context
, PDWORD result
)
1556 struct file_queue
*queue
= handle
;
1559 UINT notification
= 0;
1562 TRACE("%p %x %p %p %p %p\n", handle
, flags
, window
, handler
, context
, result
);
1564 if (!queue
->copy_queue
.count
) return TRUE
;
1566 if (flags
& SPQ_SCAN_USE_CALLBACK
) notification
= SPFILENOTIFY_QUEUESCAN
;
1567 else if (flags
& SPQ_SCAN_USE_CALLBACKEX
) notification
= SPFILENOTIFY_QUEUESCAN_EX
;
1569 if (flags
& ~(SPQ_SCAN_USE_CALLBACK
| SPQ_SCAN_USE_CALLBACKEX
))
1571 FIXME("flags %x not fully implemented\n", flags
);
1574 paths
.Source
= paths
.Target
= NULL
;
1576 for (op
= queue
->copy_queue
.head
; op
; op
= op
->next
)
1578 build_filepathsW( op
, &paths
);
1579 switch (notification
)
1581 case SPFILENOTIFY_QUEUESCAN
:
1582 /* FIXME: handle delay flag */
1583 if (handler( context
, notification
, (UINT_PTR
)paths
.Target
, 0 )) goto done
;
1585 case SPFILENOTIFY_QUEUESCAN_EX
:
1586 if (handler( context
, notification
, (UINT_PTR
)&paths
, 0 )) goto done
;
1589 ret
= TRUE
; goto done
;
1596 if (result
) *result
= 0;
1597 HeapFree( GetProcessHeap(), 0, (void *)paths
.Source
);
1598 HeapFree( GetProcessHeap(), 0, (void *)paths
.Target
);
1603 /***********************************************************************
1604 * SetupGetFileQueueCount (SETUPAPI.@)
1606 BOOL WINAPI
SetupGetFileQueueCount( HSPFILEQ handle
, UINT op
, PUINT result
)
1608 struct file_queue
*queue
= handle
;
1613 *result
= queue
->copy_queue
.count
;
1616 *result
= queue
->rename_queue
.count
;
1619 *result
= queue
->delete_queue
.count
;
1626 /***********************************************************************
1627 * SetupGetFileQueueFlags (SETUPAPI.@)
1629 BOOL WINAPI
SetupGetFileQueueFlags( HSPFILEQ handle
, PDWORD flags
)
1631 struct file_queue
*queue
= handle
;
1632 *flags
= queue
->flags
;
1637 /***********************************************************************
1638 * SetupSetFileQueueFlags (SETUPAPI.@)
1640 BOOL WINAPI
SetupSetFileQueueFlags( HSPFILEQ handle
, DWORD mask
, DWORD flags
)
1642 struct file_queue
*queue
= handle
;
1643 queue
->flags
= (queue
->flags
& ~mask
) | flags
;
1648 /***********************************************************************
1649 * SetupSetFileQueueAlternatePlatformA (SETUPAPI.@)
1651 BOOL WINAPI
SetupSetFileQueueAlternatePlatformA(HSPFILEQ handle
, PSP_ALTPLATFORM_INFO platform
, PCSTR catalogfile
)
1653 FIXME("(%p, %p, %s) stub!\n", handle
, platform
, debugstr_a(catalogfile
));
1658 /***********************************************************************
1659 * SetupSetFileQueueAlternatePlatformW (SETUPAPI.@)
1661 BOOL WINAPI
SetupSetFileQueueAlternatePlatformW(HSPFILEQ handle
, PSP_ALTPLATFORM_INFO platform
, PCWSTR catalogfile
)
1663 FIXME("(%p, %p, %s) stub!\n", handle
, platform
, debugstr_w(catalogfile
));
1668 /***********************************************************************
1669 * SetupInitDefaultQueueCallback (SETUPAPI.@)
1671 PVOID WINAPI
SetupInitDefaultQueueCallback( HWND owner
)
1673 return SetupInitDefaultQueueCallbackEx( owner
, 0, 0, 0, NULL
);
1677 /***********************************************************************
1678 * SetupInitDefaultQueueCallbackEx (SETUPAPI.@)
1680 PVOID WINAPI
SetupInitDefaultQueueCallbackEx( HWND owner
, HWND progress
, UINT msg
,
1681 DWORD reserved1
, PVOID reserved2
)
1683 struct default_callback_context
*context
;
1685 if ((context
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*context
) )))
1687 context
->magic
= 0x43515053; /* "SPQC" */
1688 context
->owner
= owner
;
1689 context
->progress
= progress
;
1690 context
->message
= msg
;
1696 /***********************************************************************
1697 * SetupTermDefaultQueueCallback (SETUPAPI.@)
1699 void WINAPI
SetupTermDefaultQueueCallback( PVOID context
)
1701 HeapFree( GetProcessHeap(), 0, context
);
1705 /***********************************************************************
1706 * SetupDefaultQueueCallbackA (SETUPAPI.@)
1708 UINT WINAPI
SetupDefaultQueueCallbackA( PVOID context
, UINT notification
,
1709 UINT_PTR param1
, UINT_PTR param2
)
1711 FILEPATHS_A
*paths
= (FILEPATHS_A
*)param1
;
1712 struct default_callback_context
*ctx
= context
;
1714 switch(notification
)
1716 case SPFILENOTIFY_STARTQUEUE
:
1717 TRACE( "start queue\n" );
1719 case SPFILENOTIFY_ENDQUEUE
:
1720 TRACE( "end queue\n" );
1722 case SPFILENOTIFY_STARTSUBQUEUE
:
1723 TRACE( "start subqueue %ld count %ld\n", param1
, param2
);
1725 case SPFILENOTIFY_ENDSUBQUEUE
:
1726 TRACE( "end subqueue %ld\n", param1
);
1728 case SPFILENOTIFY_STARTDELETE
:
1729 TRACE( "start delete %s\n", debugstr_a(paths
->Target
) );
1731 case SPFILENOTIFY_ENDDELETE
:
1732 TRACE( "end delete %s\n", debugstr_a(paths
->Target
) );
1734 case SPFILENOTIFY_DELETEERROR
:
1735 /*Windows Ignores attempts to delete files / folders which do not exist*/
1736 if ((paths
->Win32Error
!= ERROR_FILE_NOT_FOUND
) && (paths
->Win32Error
!= ERROR_PATH_NOT_FOUND
))
1737 SetupDeleteErrorA(ctx
->owner
, NULL
, paths
->Target
, paths
->Win32Error
, 0);
1739 case SPFILENOTIFY_STARTRENAME
:
1740 TRACE( "start rename %s -> %s\n", debugstr_a(paths
->Source
), debugstr_a(paths
->Target
) );
1742 case SPFILENOTIFY_ENDRENAME
:
1743 TRACE( "end rename %s -> %s\n", debugstr_a(paths
->Source
), debugstr_a(paths
->Target
) );
1745 case SPFILENOTIFY_RENAMEERROR
:
1746 SetupRenameErrorA(ctx
->owner
, NULL
, paths
->Source
, paths
->Target
, paths
->Win32Error
, 0);
1748 case SPFILENOTIFY_STARTCOPY
:
1749 TRACE( "start copy %s -> %s\n", debugstr_a(paths
->Source
), debugstr_a(paths
->Target
) );
1751 case SPFILENOTIFY_ENDCOPY
:
1752 TRACE( "end copy %s -> %s\n", debugstr_a(paths
->Source
), debugstr_a(paths
->Target
) );
1754 case SPFILENOTIFY_COPYERROR
:
1755 ERR( "copy error %d %s -> %s\n", paths
->Win32Error
,
1756 debugstr_a(paths
->Source
), debugstr_a(paths
->Target
) );
1758 case SPFILENOTIFY_NEEDMEDIA
:
1760 const SOURCE_MEDIA_A
*media
= (const SOURCE_MEDIA_A
*)param1
;
1761 TRACE( "need media %s %s\n", debugstr_a(media
->SourcePath
), debugstr_a(media
->SourceFile
) );
1762 strcpy( (char *)param2
, media
->SourcePath
);
1766 FIXME( "notification %d params %lx,%lx\n", notification
, param1
, param2
);
1773 /***********************************************************************
1774 * SetupDefaultQueueCallbackW (SETUPAPI.@)
1776 UINT WINAPI
SetupDefaultQueueCallbackW( PVOID context
, UINT notification
,
1777 UINT_PTR param1
, UINT_PTR param2
)
1779 FILEPATHS_W
*paths
= (FILEPATHS_W
*)param1
;
1780 struct default_callback_context
*ctx
= context
;
1782 switch(notification
)
1784 case SPFILENOTIFY_STARTQUEUE
:
1785 TRACE( "start queue\n" );
1787 case SPFILENOTIFY_ENDQUEUE
:
1788 TRACE( "end queue\n" );
1790 case SPFILENOTIFY_STARTSUBQUEUE
:
1791 TRACE( "start subqueue %ld count %ld\n", param1
, param2
);
1793 case SPFILENOTIFY_ENDSUBQUEUE
:
1794 TRACE( "end subqueue %ld\n", param1
);
1796 case SPFILENOTIFY_STARTDELETE
:
1797 TRACE( "start delete %s\n", debugstr_w(paths
->Target
) );
1799 case SPFILENOTIFY_ENDDELETE
:
1800 TRACE( "end delete %s\n", debugstr_w(paths
->Target
) );
1802 case SPFILENOTIFY_DELETEERROR
:
1803 /*Windows Ignores attempts to delete files / folders which do not exist*/
1804 if ((paths
->Win32Error
!= ERROR_FILE_NOT_FOUND
) && (paths
->Win32Error
!= ERROR_PATH_NOT_FOUND
))
1805 SetupDeleteErrorW(ctx
->owner
, NULL
, paths
->Target
, paths
->Win32Error
, 0);
1807 case SPFILENOTIFY_STARTRENAME
:
1808 SetupRenameErrorW(ctx
->owner
, NULL
, paths
->Source
, paths
->Target
, paths
->Win32Error
, 0);
1810 case SPFILENOTIFY_ENDRENAME
:
1811 TRACE( "end rename %s -> %s\n", debugstr_w(paths
->Source
), debugstr_w(paths
->Target
) );
1813 case SPFILENOTIFY_RENAMEERROR
:
1814 ERR( "rename error %d %s -> %s\n", paths
->Win32Error
,
1815 debugstr_w(paths
->Source
), debugstr_w(paths
->Target
) );
1817 case SPFILENOTIFY_STARTCOPY
:
1818 TRACE( "start copy %s -> %s\n", debugstr_w(paths
->Source
), debugstr_w(paths
->Target
) );
1820 case SPFILENOTIFY_ENDCOPY
:
1821 TRACE( "end copy %s -> %s\n", debugstr_w(paths
->Source
), debugstr_w(paths
->Target
) );
1823 case SPFILENOTIFY_COPYERROR
:
1824 ERR( "copy error %d %s -> %s\n", paths
->Win32Error
,
1825 debugstr_w(paths
->Source
), debugstr_w(paths
->Target
) );
1827 case SPFILENOTIFY_NEEDMEDIA
:
1829 const SOURCE_MEDIA_W
*media
= (const SOURCE_MEDIA_W
*)param1
;
1830 TRACE( "need media %s %s\n", debugstr_w(media
->SourcePath
), debugstr_w(media
->SourceFile
) );
1831 lstrcpyW( (WCHAR
*)param2
, media
->SourcePath
);
1835 FIXME( "notification %d params %lx,%lx\n", notification
, param1
, param2
);
1841 /***********************************************************************
1842 * SetupDeleteErrorA (SETUPAPI.@)
1845 UINT WINAPI
SetupDeleteErrorA( HWND parent
, PCSTR dialogTitle
, PCSTR file
,
1846 UINT w32error
, DWORD style
)
1848 FIXME( "stub: (Error Number %d when attempting to delete %s)\n",
1849 w32error
, debugstr_a(file
) );
1850 return DPROMPT_SKIPFILE
;
1853 /***********************************************************************
1854 * SetupDeleteErrorW (SETUPAPI.@)
1857 UINT WINAPI
SetupDeleteErrorW( HWND parent
, PCWSTR dialogTitle
, PCWSTR file
,
1858 UINT w32error
, DWORD style
)
1860 FIXME( "stub: (Error Number %d when attempting to delete %s)\n",
1861 w32error
, debugstr_w(file
) );
1862 return DPROMPT_SKIPFILE
;
1865 /***********************************************************************
1866 * SetupRenameErrorA (SETUPAPI.@)
1869 UINT WINAPI
SetupRenameErrorA( HWND parent
, PCSTR dialogTitle
, PCSTR source
,
1870 PCSTR target
, UINT w32error
, DWORD style
)
1872 FIXME( "stub: (Error Number %d when attempting to rename %s to %s)\n",
1873 w32error
, debugstr_a(source
), debugstr_a(target
));
1874 return DPROMPT_SKIPFILE
;
1877 /***********************************************************************
1878 * SetupRenameErrorW (SETUPAPI.@)
1881 UINT WINAPI
SetupRenameErrorW( HWND parent
, PCWSTR dialogTitle
, PCWSTR source
,
1882 PCWSTR target
, UINT w32error
, DWORD style
)
1884 FIXME( "stub: (Error Number %d when attempting to rename %s to %s)\n",
1885 w32error
, debugstr_w(source
), debugstr_w(target
));
1886 return DPROMPT_SKIPFILE
;
1890 /***********************************************************************
1891 * SetupCopyErrorA (SETUPAPI.@)
1894 UINT WINAPI
SetupCopyErrorA( HWND parent
, PCSTR dialogTitle
, PCSTR diskname
,
1895 PCSTR sourcepath
, PCSTR sourcefile
, PCSTR targetpath
,
1896 UINT w32error
, DWORD style
, PSTR pathbuffer
,
1897 DWORD buffersize
, PDWORD requiredsize
)
1899 FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
1900 w32error
, debugstr_a(sourcefile
), debugstr_a(sourcepath
) ,debugstr_a(targetpath
));
1901 return DPROMPT_SKIPFILE
;
1904 /***********************************************************************
1905 * SetupCopyErrorW (SETUPAPI.@)
1908 UINT WINAPI
SetupCopyErrorW( HWND parent
, PCWSTR dialogTitle
, PCWSTR diskname
,
1909 PCWSTR sourcepath
, PCWSTR sourcefile
, PCWSTR targetpath
,
1910 UINT w32error
, DWORD style
, PWSTR pathbuffer
,
1911 DWORD buffersize
, PDWORD requiredsize
)
1913 FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
1914 w32error
, debugstr_w(sourcefile
), debugstr_w(sourcepath
) ,debugstr_w(targetpath
));
1915 return DPROMPT_SKIPFILE
;
1918 /***********************************************************************
1919 * pSetupGetQueueFlags (SETUPAPI.@)
1921 DWORD WINAPI
pSetupGetQueueFlags( HSPFILEQ handle
)
1923 struct file_queue
*queue
= handle
;
1924 return queue
->flags
;
1927 /***********************************************************************
1928 * pSetupSetQueueFlags (SETUPAPI.@)
1930 BOOL WINAPI
pSetupSetQueueFlags( HSPFILEQ handle
, DWORD flags
)
1932 struct file_queue
*queue
= handle
;
1933 queue
->flags
= flags
;