more syncing of setupapi
Modified: trunk/reactos/lib/setupapi/diskspace.c
Modified: trunk/reactos/lib/setupapi/install.c
Modified: trunk/reactos/lib/setupapi/parser.c
Modified: trunk/reactos/lib/setupapi/setupcab.c
Modified: trunk/reactos/lib/setupapi/setupx16.h
Modified: trunk/reactos/lib/setupapi/setupx_main.c
Modified: trunk/reactos/lib/setupapi/stubs.c
Modified: trunk/reactos/lib/setupapi/virtcopy.c

Modified: trunk/reactos/lib/setupapi/diskspace.c
--- trunk/reactos/lib/setupapi/diskspace.c	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/diskspace.c	2005-01-22 02:38:07 UTC (rev 13205)
@@ -18,9 +18,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "config.h"
-#include "wine/port.h"
-
 #include <stdarg.h>
 
 #include "windef.h"
@@ -120,10 +117,10 @@
                         PVOID Reserved1, UINT Reserved2)
 {
     WCHAR driveW[20];
-    int i;
+    unsigned int i;
     LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace;
     BOOL rc = FALSE;
-    WCHAR bkslsh[]= {'\\',0};
+    static const WCHAR bkslsh[]= {'\\',0};
 
     MultiByteToWideChar(CP_ACP,0,DriveSpec,-1,driveW,20);
 

Modified: trunk/reactos/lib/setupapi/install.c
--- trunk/reactos/lib/setupapi/install.c	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/install.c	2005-01-22 02:38:07 UTC (rev 13205)
@@ -342,7 +342,7 @@
         {
             TRACE( "setting value %s to %s\n", debugstr_w(value), debugstr_w(str) );
             if (str) RegSetValueExW( hkey, value, 0, type, (BYTE *)str, size * sizeof(WCHAR) );
-            else RegSetValueExW( hkey, value, 0, type, (BYTE *)&empty, sizeof(WCHAR) );
+            else RegSetValueExW( hkey, value, 0, type, (const BYTE *)&empty, sizeof(WCHAR) );
         }
         HeapFree( GetProcessHeap(), 0, str );
         return TRUE;

Modified: trunk/reactos/lib/setupapi/parser.c
--- trunk/reactos/lib/setupapi/parser.c	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/parser.c	2005-01-22 02:38:07 UTC (rev 13205)
@@ -162,15 +162,14 @@
     if (new_count < 32) new_count = 32;
 
     if (array)
-	new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem );
+        new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem );
     else
-	new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem );
+        new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem );
 
     if (new_array)
         *count = new_count;
     else
-	if (array)
-    	    HeapFree( GetProcessHeap(), 0, array );
+        HeapFree( GetProcessHeap(), 0, array );
     return new_array;
 }
 
@@ -178,7 +177,7 @@
 /* find a section by name */
 static int find_section( struct inf_file *file, const WCHAR *name )
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < file->nb_sections; i++)
         if (!strcmpiW( name, file->sections[i]->name )) return i;
@@ -313,7 +312,8 @@
     struct section *strings_section;
     struct line *line;
     struct field *field;
-    int i, dirid;
+    unsigned int i;
+    int dirid;
     WCHAR *dirid_str, *end;
     const WCHAR *ret = NULL;
 
@@ -1170,9 +1170,7 @@
     WCHAR Buffer[MAX_PATH];
 
     GetWindowsDirectoryW( Buffer, MAX_PATH );
-
-    wcscat( Buffer, Layout );
-
+    strcatW( Buffer, Layout );
     return SetupOpenInfFileW( Buffer, NULL, INF_STYLE_WIN4, NULL);
 }
 
@@ -1184,7 +1182,7 @@
 void WINAPI SetupCloseInfFile( HINF hinf )
 {
     struct inf_file *file = hinf;
-    int i;
+    unsigned int i;
 
     for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] );
     HeapFree( GetProcessHeap(), 0, file->src_root );

Modified: trunk/reactos/lib/setupapi/setupcab.c
--- trunk/reactos/lib/setupapi/setupcab.c	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/setupcab.c	2005-01-22 02:38:07 UTC (rev 13205)
@@ -19,7 +19,7 @@
  *
  *
  * Many useful traces are commented in code, uncomment them if you have
- * trouble and run with --debugmsg +setupapi
+ * trouble and run with WINEDEBUG=+setupapi
  * 
  */
 
@@ -39,8 +39,8 @@
 #include "fdi.h"
 #include "wine/unicode.h"
 
-#include <fcntl.h>
-#include <share.h>
+#include "fcntl.h"
+#include "share.h"
 
 #include "wine/debug.h"
 
@@ -312,7 +312,7 @@
     if (err == FILEOP_DOIT) {
       TRACE("  Callback specified filename: %s\n", debugstr_a(&(fici.FullTargetName[0])));
       if (!fici.FullTargetName[0]) {
-        WARN("  Empty return string causing abort.");
+        WARN("  Empty return string causing abort.\n");
         SetLastError(ERROR_PATH_NOT_FOUND);
         return -1;
       }
@@ -597,11 +597,11 @@
 BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved,
                                  PSP_FILE_CALLBACK_W MsgHandler, PVOID Context)
 {
-  CHAR CabinetFile_A[MAX_PATH];
-  unsigned int len;
+  CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH];
+  UINT len;
   SC_HSC_W my_hsc;
   ERF erf;
-  CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *p;
+  WCHAR pszCabPathW[MAX_PATH], *p;
   DWORD fpnsize;
   BOOL ret;
 
@@ -612,36 +612,33 @@
     return FALSE;
 
   if (!CabinetFile) return FALSE;
-  if (!WideCharToMultiByte(CP_ACP, 0, CabinetFile, -1, CabinetFile_A, MAX_PATH, 0, 0))
-      return FALSE;
 
   memset(&my_hsc, 0, sizeof(SC_HSC_W));
-  pszCabinet[0] = '\0';
-  pszCabPath[0] = '\0';
 
-  fpnsize = GetFullPathNameA(CabinetFile_A, MAX_PATH, &(pszCabPath[0]), &p);
+  fpnsize = GetFullPathNameW(CabinetFile, MAX_PATH, pszCabPathW, &p);
   if (fpnsize > MAX_PATH) {
     SetLastError(ERROR_BAD_PATHNAME);
     return FALSE;
   }
 
   if (p) {
-    strcpy(pszCabinet, p);
-    *p = '\0';
+    strcpyW(my_hsc.most_recent_cabinet_name, p);
+    *p = 0;
+    len = WideCharToMultiByte(CP_ACP, 0, pszCabPathW, -1, pszCabPath,
+				MAX_PATH, 0, 0);
+    if (!len) return FALSE;
   } else {
-    strcpy(pszCabinet, CabinetFile_A);
+    strcpyW(my_hsc.most_recent_cabinet_name, CabinetFile);
     pszCabPath[0] = '\0';
   }
 
-  TRACE("path: %s, cabfile: %s\n", debugstr_a(pszCabPath), debugstr_a(pszCabinet));
+  len = WideCharToMultiByte(CP_ACP, 0, my_hsc.most_recent_cabinet_name, -1,
+				pszCabinet, MAX_PATH, 0, 0);
+  if (!len) return FALSE;
 
-  /* remember the cabinet name */
-  len = 1 + MultiByteToWideChar(CP_ACP, 0, pszCabinet, -1,
-             &(my_hsc.most_recent_cabinet_name[0]), MAX_PATH);
-  if (len > MAX_PATH)
-    return FALSE;
-  else if (len <= 1)
-    my_hsc.most_recent_cabinet_name[0] = '\0';
+  TRACE("path: %s, cabfile: %s\n",
+	debugstr_a(pszCabPath), debugstr_a(pszCabinet));
+
   my_hsc.magic = SC_HSC_W_MAGIC;
   my_hsc.msghandler = MsgHandler;
   my_hsc.context = Context;

Modified: trunk/reactos/lib/setupapi/setupx16.h
--- trunk/reactos/lib/setupapi/setupx16.h	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/setupx16.h	2005-01-22 02:38:07 UTC (rev 13205)
@@ -21,6 +21,7 @@
 
 #include "wine/windef16.h"
 
+typedef UINT16 DI_FUNCTION16;
 typedef UINT16 HINF16;
 typedef UINT16 LOGDISKID16;
 typedef UINT16 VHSTR;

Modified: trunk/reactos/lib/setupapi/setupx_main.c
--- trunk/reactos/lib/setupapi/setupx_main.c	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/setupx_main.c	2005-01-22 02:38:07 UTC (rev 13205)
@@ -476,9 +476,9 @@
     else
     {
         pCurrLDD = pCurr->pldd;
-	if (pCurrLDD->pszPath)		HeapFree(heap, 0, pCurrLDD->pszPath);
-	if (pCurrLDD->pszVolLabel)	HeapFree(heap, 0, pCurrLDD->pszVolLabel);
-	if (pCurrLDD->pszDiskName)	HeapFree(heap, 0, pCurrLDD->pszDiskName);
+        HeapFree(heap, 0, pCurrLDD->pszPath);
+        HeapFree(heap, 0, pCurrLDD->pszVolLabel);
+        HeapFree(heap, 0, pCurrLDD->pszDiskName);
     }
 
     memcpy(pCurrLDD, pldd, sizeof(LOGDISKDESC_S));

Modified: trunk/reactos/lib/setupapi/stubs.c
--- trunk/reactos/lib/setupapi/stubs.c	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/stubs.c	2005-01-22 02:38:07 UTC (rev 13205)
@@ -113,6 +113,19 @@
 }
 
 /***********************************************************************
+ *             CM_Get_Device_ID_ListA  (SETUPAPI.@)
+ */
+
+DWORD WINAPI CM_Get_Device_ID_ListA(
+    PCSTR pszFilter, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags )
+{
+    FIXME("%p %p %ld %ld\n", pszFilter, Buffer, BufferLen, ulFlags );
+    memset(Buffer,0,2);
+    return CR_SUCCESS;
+}
+
+
+/***********************************************************************
  *		SetupCopyOEMInfA  (SETUPAPI.@)
  */
 BOOL WINAPI SetupCopyOEMInfA(PCSTR sourceinffile, PCSTR sourcemedialoc,

Modified: trunk/reactos/lib/setupapi/virtcopy.c
--- trunk/reactos/lib/setupapi/virtcopy.c	2005-01-22 02:06:56 UTC (rev 13204)
+++ trunk/reactos/lib/setupapi/virtcopy.c	2005-01-22 02:38:07 UTC (rev 13205)
@@ -658,7 +658,7 @@
     registered = TRUE;
     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
-    wndClass.lpfnWndProc   = (WNDPROC)VCP_UI_FileCopyWndProc;
+    wndClass.lpfnWndProc   = VCP_UI_FileCopyWndProc;
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = 0;
     wndClass.hCursor       = LoadCursorA (0, (LPSTR)IDC_ARROW);