Move static keyword to the right place
[reactos.git] / reactos / lib / setupapi / queue.c
index 87693f0..6a66aa2 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
-#include "winerror.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "winnls.h"
-#include "setupapi.h"
-#include "wine/unicode.h"
 #include "setupapi_private.h"
-#include "winver.h"
-#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
 
@@ -767,6 +753,7 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
     params.SecurityDescriptor = NULL;
 
     if (!hlist) hlist = hinf;
+    if (!hinf) hinf = hlist;
     if (!SetupFindFirstLineW( hlist, section, NULL, &context )) return FALSE;
     if (!(params.TargetDirectory = get_destination_dir( hinf, section ))) return FALSE;
     do
@@ -946,7 +933,7 @@ static BOOL create_full_pathW(const WCHAR *path)
     return ret;
 }
 
-BOOL static do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style)
+static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style)
 {
     BOOL rc = FALSE;
     BOOL docopy = TRUE;
@@ -978,8 +965,8 @@ BOOL static do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style)
         if ((GetFileAttributesW(target) != INVALID_FILE_ATTRIBUTES) &&
             (GetFileAttributesW(source) != INVALID_FILE_ATTRIBUTES))
         {
-            VersionSizeSource = GetFileVersionInfoSizeW(source,&zero);
-            VersionSizeTarget = GetFileVersionInfoSizeW(target,&zero);
+            VersionSizeSource = GetFileVersionInfoSizeW((LPWSTR)source,&zero);
+            VersionSizeTarget = GetFileVersionInfoSizeW((LPWSTR)target,&zero);
         }
 
         TRACE("SizeTarget %li ... SizeSource %li\n",VersionSizeTarget,
@@ -998,9 +985,9 @@ BOOL static do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style)
             VersionSource = HeapAlloc(GetProcessHeap(),0,VersionSizeSource);
             VersionTarget = HeapAlloc(GetProcessHeap(),0,VersionSizeTarget);
 
-            ret = GetFileVersionInfoW(source,0,VersionSizeSource,VersionSource);
+            ret = GetFileVersionInfoW((LPWSTR)source,0,VersionSizeSource,VersionSource);
             if (ret)
-              ret = GetFileVersionInfoW(target, 0, VersionSizeTarget,
+              ret = GetFileVersionInfoW((LPWSTR)target, 0, VersionSizeTarget,
                     VersionTarget);
 
             if (ret)
@@ -1266,6 +1253,26 @@ BOOL WINAPI SetupSetFileQueueFlags( HSPFILEQ handle, DWORD mask, DWORD flags )
 }
 
 
+/***********************************************************************
+ *   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.@)
  */
@@ -1309,6 +1316,7 @@ 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)
     {
@@ -1331,7 +1339,9 @@ UINT WINAPI SetupDefaultQueueCallbackA( PVOID context, UINT notification,
         TRACE( "end delete %s\n", debugstr_a(paths->Target) );
         return 0;
     case SPFILENOTIFY_DELETEERROR:
-        ERR( "delete error %d %s\n", paths->Win32Error, debugstr_a(paths->Target) );
+        /*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) );
@@ -1340,8 +1350,7 @@ UINT WINAPI SetupDefaultQueueCallbackA( PVOID context, UINT notification,
         TRACE( "end rename %s -> %s\n", debugstr_a(paths->Source), debugstr_a(paths->Target) );
         return 0;
     case SPFILENOTIFY_RENAMEERROR:
-        ERR( "rename error %d %s -> %s\n", paths->Win32Error,
-             debugstr_a(paths->Source), debugstr_a(paths->Target) );
+        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) );
@@ -1371,6 +1380,7 @@ 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)
     {
@@ -1393,10 +1403,12 @@ UINT WINAPI SetupDefaultQueueCallbackW( PVOID context, UINT notification,
         TRACE( "end delete %s\n", debugstr_w(paths->Target) );
         return 0;
     case SPFILENOTIFY_DELETEERROR:
-        ERR( "delete error %d %s\n", paths->Win32Error, debugstr_w(paths->Target) );
+        /*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:
-        TRACE( "start rename %s -> %s\n", debugstr_w(paths->Source), debugstr_w(paths->Target) );
+        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) );
@@ -1424,3 +1436,80 @@ UINT WINAPI SetupDefaultQueueCallbackW( PVOID context, UINT notification,
     }
     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;
+}