Implement SetupCopyOEMInfA (not tested)
authorHervé Poussineau <hpoussin@reactos.org>
Wed, 5 Apr 2006 11:13:47 +0000 (11:13 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Wed, 5 Apr 2006 11:13:47 +0000 (11:13 +0000)
svn path=/trunk/; revision=21464

reactos/dll/win32/setupapi/install.c
reactos/dll/win32/setupapi/stubs.c

index 98eb790..5d5525f 100644 (file)
@@ -2,7 +2,7 @@
  * Setupapi install routines
  *
  * Copyright 2002 Alexandre Julliard for CodeWeavers
  * Setupapi install routines
  *
  * Copyright 2002 Alexandre Julliard for CodeWeavers
- *           2005 Hervé Poussineau (hpoussin@reactos.org)
+ *           2005-2006 Hervé Poussineau (hpoussin@reactos.org)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1485,3 +1485,86 @@ nextservice:
     TRACE("Returning %d\n", ret);
     return ret;
 }
     TRACE("Returning %d\n", ret);
     return ret;
 }
+
+
+/***********************************************************************
+ *             SetupCopyOEMInfA  (SETUPAPI.@)
+ */
+BOOL WINAPI SetupCopyOEMInfA(
+        IN PCSTR SourceInfFileName,
+        IN PCSTR OEMSourceMediaLocation,
+        IN DWORD OEMSourceMediaType,
+        IN DWORD CopyStyle,
+        OUT PSTR DestinationInfFileName OPTIONAL,
+        IN DWORD DestinationInfFileNameSize,
+        OUT PDWORD RequiredSize OPTIONAL,
+        OUT PSTR* DestinationInfFileNameComponent OPTIONAL)
+{
+    PWSTR SourceInfFileNameW = NULL;
+    PWSTR OEMSourceMediaLocationW = NULL;
+    PWSTR DestinationInfFileNameW = NULL;
+    PWSTR DestinationInfFileNameComponentW = NULL;
+    BOOL ret = FALSE;
+
+    TRACE("%s %s 0x%lx 0x%lx %p 0%lu %p %p\n",
+        SourceInfFileName, OEMSourceMediaLocation, OEMSourceMediaType,
+        CopyStyle, DestinationInfFileName, DestinationInfFileNameSize,
+        RequiredSize, DestinationInfFileNameComponent);
+
+    if (!DestinationInfFileName && DestinationInfFileNameSize > 0)
+        SetLastError(ERROR_INVALID_PARAMETER);
+    else if (!(SourceInfFileNameW = MultiByteToUnicode(SourceInfFileName, CP_ACP)))
+        SetLastError(ERROR_INVALID_PARAMETER);
+    else if (!(OEMSourceMediaLocationW = MultiByteToUnicode(OEMSourceMediaLocation, CP_ACP)))
+        SetLastError(ERROR_INVALID_PARAMETER);
+    else
+    {
+        if (DestinationInfFileNameSize != 0)
+        {
+            DestinationInfFileNameW = MyMalloc(DestinationInfFileNameSize * sizeof(WCHAR));
+            if (!DestinationInfFileNameW)
+            {
+                SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+                goto cleanup;
+            }
+        }
+
+        ret = SetupCopyOEMInfW(
+            SourceInfFileNameW,
+            OEMSourceMediaLocationW,
+            OEMSourceMediaType,
+            CopyStyle,
+            DestinationInfFileNameW,
+            DestinationInfFileNameSize,
+            RequiredSize,
+            DestinationInfFileNameComponent ? &DestinationInfFileNameComponentW : NULL);
+        if (!ret)
+            goto cleanup;
+
+        if (DestinationInfFileNameSize != 0)
+        {
+            if (WideCharToMultiByte(CP_ACP, 0, DestinationInfFileNameW, -1,
+                DestinationInfFileName, DestinationInfFileNameSize, NULL, NULL) == 0)
+            {
+                DestinationInfFileName[0] = '\0';
+                goto cleanup;
+            }
+        }
+        if (DestinationInfFileNameComponent)
+        {
+            if (DestinationInfFileNameComponentW)
+                *DestinationInfFileNameComponent = &DestinationInfFileName[DestinationInfFileNameComponentW - DestinationInfFileNameW];
+            else
+                *DestinationInfFileNameComponent = NULL;
+        }
+        ret = TRUE;
+    }
+
+cleanup:
+    MyFree(SourceInfFileNameW);
+    MyFree(OEMSourceMediaLocationW);
+    MyFree(DestinationInfFileNameW);
+
+    TRACE("Returning %d\n", ret);
+    return ret;
+}
index 6ea96da..f3dbfa3 100644 (file)
@@ -50,19 +50,6 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailA(HDEVINFO devinfo, PSP_DEVINFO_LIST_D
   return FALSE;
 }
 
   return FALSE;
 }
 
-/***********************************************************************
- *             SetupCopyOEMInfA  (SETUPAPI.@)
- */
-BOOL WINAPI SetupCopyOEMInfA(PCSTR sourceinffile, PCSTR sourcemedialoc,
-                           DWORD mediatype, DWORD copystyle, PSTR destinfname,
-                           DWORD destnamesize, PDWORD required,
-                           PSTR *destinfnamecomponent)
-{
-  FIXME("stub: source %s location %s ...\n", debugstr_a(sourceinffile),
-        debugstr_a(sourcemedialoc));
-  return FALSE;
-}
-
 /***********************************************************************
  *      SetupCopyOEMInfW  (SETUPAPI.@)
  */
 /***********************************************************************
  *      SetupCopyOEMInfW  (SETUPAPI.@)
  */