📄 queue.c
字号:
}
paths.Win32Error = GetLastError();
op_result = handler( context, SPFILENOTIFY_COPYERROR,
(UINT_PTR)&paths, (UINT_PTR)newpath );
if (op_result == FILEOP_ABORT) goto done;
}
if (op->dst_sd)
{
PSID psidOwner = NULL, psidGroup = NULL;
PACL pDacl = NULL, pSacl = NULL;
SECURITY_INFORMATION security_info = 0;
BOOL present, dummy;
if (GetSecurityDescriptorOwner( op->dst_sd, &psidOwner, &dummy ) && psidOwner)
security_info |= OWNER_SECURITY_INFORMATION;
if (GetSecurityDescriptorGroup( op->dst_sd, &psidGroup, &dummy ) && psidGroup)
security_info |= GROUP_SECURITY_INFORMATION;
if (GetSecurityDescriptorDacl( op->dst_sd, &present, &pDacl, &dummy ))
security_info |= DACL_SECURITY_INFORMATION;
if (GetSecurityDescriptorSacl( op->dst_sd, &present, &pSacl, &dummy ))
security_info |= DACL_SECURITY_INFORMATION;
SetNamedSecurityInfoW( (LPWSTR)paths.Target, SE_FILE_OBJECT, security_info,
psidOwner, psidGroup, pDacl, pSacl );
/* Yes, ignore the return code... */
}
handler( context, SPFILENOTIFY_ENDCOPY, (UINT_PTR)&paths, 0 );
}
handler( context, SPFILENOTIFY_ENDSUBQUEUE, FILEOP_COPY, 0 );
}
result = TRUE;
done:
handler( context, SPFILENOTIFY_ENDQUEUE, result, 0 );
HeapFree( GetProcessHeap(), 0, (void *)paths.Source );
HeapFree( GetProcessHeap(), 0, (void *)paths.Target );
return result;
}
/***********************************************************************
* SetupScanFileQueueA (SETUPAPI.@)
*/
BOOL WINAPI SetupScanFileQueueA( HSPFILEQ queue, DWORD flags, HWND window,
PSP_FILE_CALLBACK_A callback, PVOID context, PDWORD result )
{
FIXME("stub\n");
return FALSE;
}
/***********************************************************************
* SetupScanFileQueueW (SETUPAPI.@)
*/
BOOL WINAPI SetupScanFileQueueW( HSPFILEQ handle, DWORD flags, HWND window,
PSP_FILE_CALLBACK_W callback, PVOID context, PDWORD result )
{
struct file_queue *queue = handle;
struct file_op *op;
BOOL allnodesprocessed = FALSE;
FILEPATHS_W paths;
paths.Source = paths.Target = NULL;
*result = FALSE;
if ( flags & (SPQ_SCAN_FILE_PRESENCE | SPQ_SCAN_FILE_VALIDITY | SPQ_SCAN_USE_CALLBACKEX | SPQ_SCAN_INFORM_USER | SPQ_SCAN_PRUNE_COPY_QUEUE /*| SPQ_SCAN_USE_CALLBACK_SIGNERINFO | SPQ_SCAN_PRUNE_DELREN*/) )
{
FIXME( "flags ignored 0x%lx\n", flags & (SPQ_SCAN_FILE_PRESENCE | SPQ_SCAN_FILE_VALIDITY | SPQ_SCAN_USE_CALLBACKEX | SPQ_SCAN_INFORM_USER | SPQ_SCAN_PRUNE_COPY_QUEUE /*| SPQ_SCAN_USE_CALLBACK_SIGNERINFO | SPQ_SCAN_PRUNE_DELREN*/) );
}
if (queue->copy_queue.count)
{
for (op = queue->copy_queue.head; op; op = op->next)
{
build_filepathsW( op, &paths );
if (flags & SPQ_SCAN_USE_CALLBACK)
{
/* FIXME: sometimes set param 2 to SPQ_DELAYED_COPY */
if (NO_ERROR != callback( context, SPFILENOTIFY_QUEUESCAN, (UINT)paths.Target, 0 ))
goto done;
}
}
}
*result = TRUE;
allnodesprocessed = TRUE;
done:
HeapFree( GetProcessHeap(), 0, (void *)paths.Source );
HeapFree( GetProcessHeap(), 0, (void *)paths.Target );
return allnodesprocessed;
}
/***********************************************************************
* SetupGetFileQueueCount (SETUPAPI.@)
*/
BOOL WINAPI SetupGetFileQueueCount( HSPFILEQ handle, UINT op, PUINT result )
{
struct file_queue *queue = handle;
switch(op)
{
case FILEOP_COPY:
*result = queue->copy_queue.count;
return TRUE;
case FILEOP_RENAME:
*result = queue->rename_queue.count;
return TRUE;
case FILEOP_DELETE:
*result = queue->delete_queue.count;
return TRUE;
}
return FALSE;
}
/***********************************************************************
* SetupGetFileQueueFlags (SETUPAPI.@)
*/
BOOL WINAPI SetupGetFileQueueFlags( HSPFILEQ handle, PDWORD flags )
{
struct file_queue *queue = handle;
*flags = queue->flags;
return TRUE;
}
/***********************************************************************
* SetupSetFileQueueFlags (SETUPAPI.@)
*/
BOOL WINAPI SetupSetFileQueueFlags( HSPFILEQ handle, DWORD mask, DWORD flags )
{
struct file_queue *queue = handle;
queue->flags = (queue->flags & ~mask) | flags;
return TRUE;
}
/***********************************************************************
* SetupSetFileQueueAlternatePlatformA (SETUPAPI.@)
*/
BOOL WINAPI SetupSetFileQueueAlternatePlatformA(HSPFILEQ handle, PSP_ALTPLATFORM_INFO platform, PCSTR catalogfile)
{
FIXME("(%p, %p, %s) stub!\n", handle, platform, debugstr_a(catalogfile));
return FALSE;
}
/***********************************************************************
* SetupSetFileQueueAlternatePlatformW (SETUPAPI.@)
*/
BOOL WINAPI SetupSetFileQueueAlternatePlatformW(HSPFILEQ handle, PSP_ALTPLATFORM_INFO platform, PCWSTR catalogfile)
{
FIXME("(%p, %p, %s) stub!\n", handle, platform, debugstr_w(catalogfile));
return FALSE;
}
/***********************************************************************
* SetupInitDefaultQueueCallback (SETUPAPI.@)
*/
PVOID WINAPI SetupInitDefaultQueueCallback( HWND owner )
{
return SetupInitDefaultQueueCallbackEx( owner, 0, 0, 0, NULL );
}
/***********************************************************************
* SetupInitDefaultQueueCallbackEx (SETUPAPI.@)
*/
PVOID WINAPI SetupInitDefaultQueueCallbackEx( HWND owner, HWND progress, UINT msg,
DWORD reserved1, PVOID reserved2 )
{
struct default_callback_context *context;
if ((context = HeapAlloc( GetProcessHeap(), 0, sizeof(*context) )))
{
context->owner = owner;
context->progress = progress;
context->message = msg;
}
return context;
}
/***********************************************************************
* SetupTermDefaultQueueCallback (SETUPAPI.@)
*/
void WINAPI SetupTermDefaultQueueCallback( PVOID context )
{
HeapFree( GetProcessHeap(), 0, context );
}
/***********************************************************************
* SetupDefaultQueueCallbackA (SETUPAPI.@)
*/
UINT WINAPI SetupDefaultQueueCallbackA( PVOID context, UINT notification,
UINT_PTR param1, UINT_PTR param2 )
{
FILEPATHS_A *paths = (FILEPATHS_A *)param1;
struct default_callback_context *ctx = (struct default_callback_context *)context;
switch(notification)
{
case SPFILENOTIFY_STARTQUEUE:
TRACE( "start queue\n" );
return TRUE;
case SPFILENOTIFY_ENDQUEUE:
TRACE( "end queue\n" );
return 0;
case SPFILENOTIFY_STARTSUBQUEUE:
TRACE( "start subqueue %d count %d\n", param1, param2 );
return TRUE;
case SPFILENOTIFY_ENDSUBQUEUE:
TRACE( "end subqueue %d\n", param1 );
return 0;
case SPFILENOTIFY_STARTDELETE:
TRACE( "start delete %s\n", debugstr_a(paths->Target) );
return FILEOP_DOIT;
case SPFILENOTIFY_ENDDELETE:
TRACE( "end delete %s\n", debugstr_a(paths->Target) );
return 0;
case SPFILENOTIFY_DELETEERROR:
/*Windows Ignores attempts to delete files / folders which do not exist*/
if ((paths->Win32Error != ERROR_FILE_NOT_FOUND) && (paths->Win32Error != ERROR_PATH_NOT_FOUND))
SetupDeleteErrorA(ctx->owner, NULL, paths->Target, paths->Win32Error, 0);
return FILEOP_SKIP;
case SPFILENOTIFY_STARTRENAME:
TRACE( "start rename %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
return FILEOP_DOIT;
case SPFILENOTIFY_ENDRENAME:
TRACE( "end rename %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
return 0;
case SPFILENOTIFY_RENAMEERROR:
SetupRenameErrorA(ctx->owner, NULL, paths->Source, paths->Target, paths->Win32Error, 0);
return FILEOP_SKIP;
case SPFILENOTIFY_STARTCOPY:
TRACE( "start copy %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
return FILEOP_DOIT;
case SPFILENOTIFY_ENDCOPY:
TRACE( "end copy %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
return 0;
case SPFILENOTIFY_COPYERROR:
ERR( "copy error %d %s -> %s\n", paths->Win32Error,
debugstr_a(paths->Source), debugstr_a(paths->Target) );
return FILEOP_SKIP;
case SPFILENOTIFY_NEEDMEDIA:
TRACE( "need media\n" );
return FILEOP_SKIP;
default:
FIXME( "notification %d params %x,%x\n", notification, param1, param2 );
break;
}
return 0;
}
/***********************************************************************
* SetupDefaultQueueCallbackW (SETUPAPI.@)
*/
UINT WINAPI SetupDefaultQueueCallbackW( PVOID context, UINT notification,
UINT_PTR param1, UINT_PTR param2 )
{
FILEPATHS_W *paths = (FILEPATHS_W *)param1;
struct default_callback_context *ctx = (struct default_callback_context *)context;
switch(notification)
{
case SPFILENOTIFY_STARTQUEUE:
TRACE( "start queue\n" );
return TRUE;
case SPFILENOTIFY_ENDQUEUE:
TRACE( "end queue\n" );
return 0;
case SPFILENOTIFY_STARTSUBQUEUE:
TRACE( "start subqueue %d count %d\n", param1, param2 );
return TRUE;
case SPFILENOTIFY_ENDSUBQUEUE:
TRACE( "end subqueue %d\n", param1 );
return 0;
case SPFILENOTIFY_STARTDELETE:
TRACE( "start delete %s\n", debugstr_w(paths->Target) );
return FILEOP_DOIT;
case SPFILENOTIFY_ENDDELETE:
TRACE( "end delete %s\n", debugstr_w(paths->Target) );
return 0;
case SPFILENOTIFY_DELETEERROR:
/*Windows Ignores attempts to delete files / folders which do not exist*/
if ((paths->Win32Error != ERROR_FILE_NOT_FOUND) && (paths->Win32Error != ERROR_PATH_NOT_FOUND))
SetupDeleteErrorW(ctx->owner, NULL, paths->Target, paths->Win32Error, 0);
return FILEOP_SKIP;
case SPFILENOTIFY_STARTRENAME:
SetupRenameErrorW(ctx->owner, NULL, paths->Source, paths->Target, paths->Win32Error, 0);
return FILEOP_DOIT;
case SPFILENOTIFY_ENDRENAME:
TRACE( "end rename %s -> %s\n", debugstr_w(paths->Source), debugstr_w(paths->Target) );
return 0;
case SPFILENOTIFY_RENAMEERROR:
ERR( "rename error %d %s -> %s\n", paths->Win32Error,
debugstr_w(paths->Source), debugstr_w(paths->Target) );
return FILEOP_SKIP;
case SPFILENOTIFY_STARTCOPY:
TRACE( "start copy %s -> %s\n", debugstr_w(paths->Source), debugstr_w(paths->Target) );
return FILEOP_DOIT;
case SPFILENOTIFY_ENDCOPY:
TRACE( "end copy %s -> %s\n", debugstr_w(paths->Source), debugstr_w(paths->Target) );
return 0;
case SPFILENOTIFY_COPYERROR:
ERR( "copy error %d %s -> %s\n", paths->Win32Error,
debugstr_w(paths->Source), debugstr_w(paths->Target) );
return FILEOP_SKIP;
case SPFILENOTIFY_NEEDMEDIA:
TRACE( "need media\n" );
return FILEOP_SKIP;
default:
FIXME( "notification %d params %x,%x\n", notification, param1, param2 );
break;
}
return 0;
}
/***********************************************************************
* SetupDeleteErrorA (SETUPAPI.@)
*/
UINT WINAPI SetupDeleteErrorA( HWND parent, PCSTR dialogTitle, PCSTR file,
UINT w32error, DWORD style)
{
FIXME( "stub: (Error Number %d when attempting to delete %s)\n",
w32error, debugstr_a(file) );
return DPROMPT_SKIPFILE;
}
/***********************************************************************
* SetupDeleteErrorW (SETUPAPI.@)
*/
UINT WINAPI SetupDeleteErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR file,
UINT w32error, DWORD style)
{
FIXME( "stub: (Error Number %d when attempting to delete %s)\n",
w32error, debugstr_w(file) );
return DPROMPT_SKIPFILE;
}
/***********************************************************************
* SetupRenameErrorA (SETUPAPI.@)
*/
UINT WINAPI SetupRenameErrorA( HWND parent, PCSTR dialogTitle, PCSTR source,
PCSTR target, UINT w32error, DWORD style)
{
FIXME( "stub: (Error Number %d when attempting to rename %s to %s)\n",
w32error, debugstr_a(source), debugstr_a(target));
return DPROMPT_SKIPFILE;
}
/***********************************************************************
* SetupRenameErrorW (SETUPAPI.@)
*/
UINT WINAPI SetupRenameErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR source,
PCWSTR target, UINT w32error, DWORD style)
{
FIXME( "stub: (Error Number %d when attempting to rename %s to %s)\n",
w32error, debugstr_w(source), debugstr_w(target));
return DPROMPT_SKIPFILE;
}
/***********************************************************************
* SetupCopyErrorA (SETUPAPI.@)
*/
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)
{
FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
w32error, debugstr_a(sourcefile), debugstr_a(sourcepath) ,debugstr_a(targetpath));
return DPROMPT_SKIPFILE;
}
/***********************************************************************
* SetupCopyErrorW (SETUPAPI.@)
*/
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)
{
FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
w32error, debugstr_w(sourcefile), debugstr_w(sourcepath) ,debugstr_w(targetpath));
return DPROMPT_SKIPFILE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -