[ros-diffs] [hpoussin] 30326: Merge some changes from Wine

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Sat Nov 10 15:35:22 CET 2007


Author: hpoussin
Date: Sat Nov 10 17:35:21 2007
New Revision: 30326

URL: http://svn.reactos.org/svn/reactos?rev=30326&view=rev
Log:
Merge some changes from Wine

Modified:
    trunk/reactos/dll/win32/setupapi/dirid.c
    trunk/reactos/dll/win32/setupapi/diskspace.c
    trunk/reactos/dll/win32/setupapi/install.c
    trunk/reactos/dll/win32/setupapi/misc.c
    trunk/reactos/dll/win32/setupapi/parser.c
    trunk/reactos/dll/win32/setupapi/query.c
    trunk/reactos/dll/win32/setupapi/queue.c
    trunk/reactos/dll/win32/setupapi/setupapi.spec
    trunk/reactos/dll/win32/setupapi/setupapi_private.h
    trunk/reactos/dll/win32/setupapi/setupcab.c
    trunk/reactos/dll/win32/setupapi/stringtable.c

Modified: trunk/reactos/dll/win32/setupapi/dirid.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/dirid.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/dirid.c (original)
+++ trunk/reactos/dll/win32/setupapi/dirid.c Sat Nov 10 17:35:21 2007
@@ -142,7 +142,7 @@
 
     if (!SHGetSpecialFolderPathW( NULL, buffer, csidl, TRUE ))
     {
-        FIXME( "CSIDL %lx not found\n", csidl );
+        FIXME( "CSIDL %x not found\n", csidl );
         return get_unknown_dirid();
     }
     len = (strlenW(buffer) + 1) * sizeof(WCHAR);
@@ -199,7 +199,7 @@
                 new = HeapReAlloc( GetProcessHeap(), 0, user_dirids,
                                                   new_size * sizeof(*new) );
 	    else
-                new = HeapAlloc( GetProcessHeap(), 0,
+                new = HeapAlloc( GetProcessHeap(), 0, 
                                                   new_size * sizeof(*new) );
 
             if (!new) return FALSE;

Modified: trunk/reactos/dll/win32/setupapi/diskspace.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/diskspace.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/diskspace.c (original)
+++ trunk/reactos/dll/win32/setupapi/diskspace.c Sat Nov 10 17:35:21 2007
@@ -52,9 +52,9 @@
     list = HeapAlloc(GetProcessHeap(),0,sizeof(DISKSPACELIST));
 
     list->dwDriveCount = 0;
-
+    
     ptr = drives;
-
+    
     while (*ptr)
     {
         DWORD type = GetDriveTypeW(ptr);
@@ -89,8 +89,8 @@
 /***********************************************************************
  *		SetupAddInstallSectionToDiskSpaceListA  (SETUPAPI.@)
  */
-BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace,
-                        HINF InfHandle, HINF LayoutInfHandle,
+BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace, 
+                        HINF InfHandle, HINF LayoutInfHandle, 
                         LPCSTR SectionName, PVOID Reserved1, UINT Reserved2)
 {
     FIXME ("Stub\n");
@@ -100,8 +100,8 @@
 /***********************************************************************
 *		SetupQuerySpaceRequiredOnDriveA  (SETUPAPI.@)
 */
-BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
-                        LPCSTR DriveSpec, LONGLONG* SpaceRequired,
+BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace, 
+                        LPCSTR DriveSpec, LONGLONG* SpaceRequired, 
                         PVOID Reserved1, UINT Reserved2)
 {
     WCHAR driveW[20];
@@ -115,7 +115,7 @@
     lstrcatW(driveW,bkslsh);
 
     TRACE("Looking for drive %s\n",debugstr_w(driveW));
-
+ 
     for (i = 0; i < list->dwDriveCount; i++)
     {
         TRACE("checking drive %s\n",debugstr_w(list->Drives[i].lpzName));
@@ -137,5 +137,5 @@
 {
     LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace;
     HeapFree(GetProcessHeap(),0,list);
-    return TRUE;
+    return TRUE; 
 }

Modified: trunk/reactos/dll/win32/setupapi/install.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/install.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/install.c (original)
+++ trunk/reactos/dll/win32/setupapi/install.c Sat Nov 10 17:35:21 2007
@@ -156,9 +156,9 @@
     struct files_callback_info *info = arg;
 
     if (field[0] == '@')  /* special case: copy single file */
-        SetupQueueDefaultCopyW( info->queue, info->layout, info->src_root, NULL, &field[1], info->copy_flags );
+        SetupQueueDefaultCopyW( info->queue, info->layout ? info->layout : hinf, info->src_root, NULL, field+1, info->copy_flags );
     else
-        SetupQueueCopySectionW( info->queue, info->src_root, info->layout, hinf, field, info->copy_flags );
+        SetupQueueCopySectionW( info->queue, info->src_root, info->layout ? info->layout : hinf, hinf, field, info->copy_flags );
     return TRUE;
 }
 
@@ -319,7 +319,7 @@
             }
             else RegDeleteValueW( hkey, value );
         }
-        else RegDeleteKeyW( hkey, NULL );
+        else NtDeleteKey( hkey );
         return TRUE;
     }
 
@@ -379,7 +379,7 @@
         if (type == REG_DWORD)
         {
             DWORD dw = str ? strtoulW( str, NULL, 0 ) : 0;
-            TRACE( "setting dword %s to %lx\n", debugstr_w(value), dw );
+            TRACE( "setting dword %s to %x\n", debugstr_w(value), dw );
             RegSetValueExW( hkey, value, 0, type, (BYTE *)&dw, sizeof(dw) );
         }
         else
@@ -399,7 +399,7 @@
         if (size)
         {
             if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
-            TRACE( "setting binary data %s len %ld\n", debugstr_w(value), size );
+            TRACE( "setting binary data %s len %d\n", debugstr_w(value), size );
             SetupGetBinaryField( context, 5, data, size, NULL );
         }
         RegSetValueExW( hkey, value, 0, type, data, size );
@@ -618,7 +618,7 @@
 
         if (FAILED(res))
         {
-            WARN( "calling %s in %s returned error %lx\n", entry_point, debugstr_w(path), res );
+            WARN( "calling %s in %s returned error %x\n", entry_point, debugstr_w(path), res );
             status.FailureCode = SPREG_REGSVR;
             status.Win32Error = res;
             goto done;
@@ -642,7 +642,7 @@
 
         if (FAILED(res))
         {
-            WARN( "calling DllInstall in %s returned error %lx\n", debugstr_w(path), res );
+            WARN( "calling DllInstall in %s returned error %x\n", debugstr_w(path), res );
             status.FailureCode = SPREG_REGSVR;
             status.Win32Error = res;
             goto done;
@@ -1163,7 +1163,7 @@
                 goto done;
             if (!callback( hinf, buffer, arg ))
             {
-                WARN("callback failed for %s %s err %ld\n",
+                WARN("callback failed for %s %s err %d\n",
                      debugstr_w(section), debugstr_w(buffer), GetLastError() );
                 goto done;
             }
@@ -1440,23 +1440,24 @@
  */
 void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show )
 {
-    WCHAR *p, *path, section[MAX_PATH];
+    WCHAR *s, *path, section[MAX_PATH];
     void *callback_context;
     UINT mode;
     HINF hinf;
 
     TRACE("hwnd %p, handle %p, cmdline %s\n", hwnd, handle, debugstr_w(cmdline));
 
-    lstrcpynW( section, cmdline, sizeof(section)/sizeof(WCHAR) );
-
-    if (!(p = strchrW( section, ' ' ))) return;
-    *p++ = 0;
-    while (*p == ' ') p++;
-    mode = atoiW( p );
-
-    if (!(p = strchrW( p, ' ' ))) return;
-    path = p + 1;
-    while (*path == ' ') path++;
+    lstrcpynW( section, cmdline, MAX_PATH );
+
+    if (!(s = strchrW( section, ' ' ))) return;
+    *s++ = 0;
+    while (*s == ' ') s++;
+    mode = atoiW( s );
+
+    /* quoted paths are not allowed on native, the rest of the command line is taken as the path */
+    if (!(s = strchrW( s, ' ' ))) return;
+    while (*s == ' ') s++;
+    path = s;
 
     hinf = SetupOpenInfFileW( path, NULL, INF_STYLE_WIN4, NULL );
     if (hinf == INVALID_HANDLE_VALUE) return;
@@ -1492,26 +1493,23 @@
     }
 }
 
-
-/***********************************************************************
- *		SetupInstallServicesFromInfSectionA  (SETUPAPI.@)
- */
-BOOL WINAPI SetupInstallServicesFromInfSectionA( HINF hinf, PCSTR sectionname, DWORD flags )
-{
-    return SetupInstallServicesFromInfSectionExA( hinf, sectionname, flags,
+/***********************************************************************
+ *              SetupInstallServicesFromInfSectionW  (SETUPAPI.@)
+ */
+BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF Inf, PCWSTR SectionName, DWORD Flags)
+{
+    return SetupInstallServicesFromInfSectionExW( Inf, SectionName, Flags,
                                                   NULL, NULL, NULL, NULL );
 }
 
-
-/***********************************************************************
- *		SetupInstallServicesFromInfSectionW  (SETUPAPI.@)
- */
-BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF hinf, PCWSTR sectionname, DWORD flags )
-{
-    return SetupInstallServicesFromInfSectionExW( hinf, sectionname, flags,
+/***********************************************************************
+ *              SetupInstallServicesFromInfSectionA  (SETUPAPI.@)
+ */
+BOOL WINAPI SetupInstallServicesFromInfSectionA( HINF Inf, PCSTR SectionName, DWORD Flags)
+{
+    return SetupInstallServicesFromInfSectionExA( Inf, SectionName, Flags,
                                                   NULL, NULL, NULL, NULL );
 }
-
 
 /***********************************************************************
  *		SetupInstallServicesFromInfSectionExA  (SETUPAPI.@)

Modified: trunk/reactos/dll/win32/setupapi/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/misc.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/misc.c (original)
+++ trunk/reactos/dll/win32/setupapi/misc.c Sat Nov 10 17:35:21 2007
@@ -757,8 +757,7 @@
 fail:;
     dwError = GetLastError();
 
-    if (pOwner != NULL)
-        MyFree(pOwner);
+    MyFree(pOwner);
 
     if (hToken != NULL)
         CloseHandle(hToken);
@@ -826,18 +825,36 @@
 }
 
 
-/**************************************************************************
- * AssertFail [SETUPAPI.@]
- *
- * Display an assertion message.
- *
- * PARAMS
- *     lpFile    [I] File name
- *     uLine     [I] Line number
- *     lpMessage [I] Assertion message
- *
- * RETURNS
- *     Nothing
+static DWORD global_flags = 0;  /* FIXME: what should be in here? */
+
+/***********************************************************************
+ *		pSetupGetGlobalFlags  (SETUPAPI.@)
+ */
+DWORD WINAPI pSetupGetGlobalFlags(void)
+{
+    FIXME( "stub\n" );
+    return global_flags;
+}
+
+
+/***********************************************************************
+ *		pSetupSetGlobalFlags  (SETUPAPI.@)
+ */
+void WINAPI pSetupSetGlobalFlags( DWORD flags )
+{
+    global_flags = flags;
+}
+
+/***********************************************************************
+ *              AssertFail  (SETUPAPI.@)
+ *
+ * Shows an assert fail error messagebox
+ *
+ * PARAMS
+ *   lpFile [I]         file where assert failed
+ *   uLine [I]          line number in file
+ *   lpMessage [I]      assert message
+ *
  */
 VOID WINAPI AssertFail(LPSTR lpFile, UINT uLine, LPSTR lpMessage)
 {
@@ -1280,7 +1297,7 @@
     DWORD nb_chars = 0;
     LPSTR nameA;
 
-    TRACE("%s, %p, %lu, %p, %p, %p, %p\n", debugstr_a(source), name, len, required,
+    TRACE("%s, %p, %d, %p, %p, %p, %p\n", debugstr_a(source), name, len, required,
           source_size, target_size, type);
 
     if (!source || !(sourceW = MultiByteToUnicode( source, CP_ACP ))) return FALSE;
@@ -1340,7 +1357,7 @@
     BOOL ret = FALSE;
     DWORD source_len;
 
-    TRACE("%s, %p, %lu, %p, %p, %p, %p\n", debugstr_w(source), name, len, required,
+    TRACE("%s, %p, %d, %p, %p, %p, %p\n", debugstr_w(source), name, len, required,
           source_size, target_size, type);
 
     if (!source) return FALSE;
@@ -1464,7 +1481,7 @@
     if ((error = LZCopy( src, dst )) >= 0) ret = ERROR_SUCCESS;
     else
     {
-        WARN("failed to decompress file %ld\n", error);
+        WARN("failed to decompress file %d\n", error);
         ret = ERROR_INVALID_DATA;
     }
 

Modified: trunk/reactos/dll/win32/setupapi/parser.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/parser.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/parser.c (original)
+++ trunk/reactos/dll/win32/setupapi/parser.c Sat Nov 10 17:35:21 2007
@@ -162,7 +162,7 @@
 
 
 /* get the directory of the inf file (as counted string, not null-terminated) */
-static const WCHAR *get_inf_dir( struct inf_file *file, unsigned int *len )
+static const WCHAR *get_inf_dir( const struct inf_file *file, unsigned int *len )
 {
     const WCHAR *p = strrchrW( file->filename, '\\' );
     *len = p ? (p + 1 - file->filename) : 0;
@@ -171,7 +171,7 @@
 
 
 /* find a section by name */
-static int find_section( struct inf_file *file, const WCHAR *name )
+static int find_section( const struct inf_file *file, const WCHAR *name )
 {
     unsigned int i;
 
@@ -290,7 +290,7 @@
 
 
 /* retrieve the string substitution for a directory id */
-static const WCHAR *get_dirid_subst( struct inf_file *file, int dirid, unsigned int *len )
+static const WCHAR *get_dirid_subst( const struct inf_file *file, int dirid, unsigned int *len )
 {
     const WCHAR *ret;
 
@@ -303,7 +303,8 @@
 
 /* retrieve the string substitution for a given string, or NULL if not found */
 /* if found, len is set to the substitution length */
-static const WCHAR *get_string_subst( struct inf_file *file, const WCHAR *str, unsigned int *len )
+static const WCHAR *get_string_subst( const struct inf_file *file, const WCHAR *str, unsigned int *len,
+                                      BOOL no_trailing_slash )
 {
     static const WCHAR percent = '%';
 
@@ -340,6 +341,7 @@
         dirid_str[*len] = 0;
         dirid = strtolW( dirid_str, &end, 10 );
         if (!*end) ret = get_dirid_subst( file, dirid, len );
+        if (no_trailing_slash && ret && *len && ret[*len - 1] == '\\') *len -= 1;
         HeapFree( GetProcessHeap(), 0, dirid_str );
         return ret;
     }
@@ -350,7 +352,7 @@
 /* do string substitutions on the specified text */
 /* the buffer is assumed to be large enough */
 /* returns necessary length not including terminating null */
-unsigned int PARSER_string_substW( struct inf_file *file, const WCHAR *text, WCHAR *buffer,
+unsigned int PARSER_string_substW( const struct inf_file *file, const WCHAR *text, WCHAR *buffer,
                                    unsigned int size )
 {
     const WCHAR *start, *subst, *p;
@@ -374,7 +376,7 @@
         else /* end of the %xx% string, find substitution */
         {
             len = p - start - 1;
-            subst = get_string_subst( file, start + 1, &len );
+            subst = get_string_subst( file, start + 1, &len, p[1] == '\\' );
             if (!subst)
             {
                 subst = start;
@@ -403,7 +405,7 @@
 /* do string substitutions on the specified text */
 /* the buffer is assumed to be large enough */
 /* returns necessary length not including terminating null */
-unsigned int PARSER_string_substA( struct inf_file *file, const WCHAR *text, char *buffer,
+unsigned int PARSER_string_substA( const struct inf_file *file, const WCHAR *text, char *buffer,
                                    unsigned int size )
 {
     WCHAR buffW[MAX_STRING_LEN+1];
@@ -456,14 +458,14 @@
 
 
 /* check if the pointer points to an end of file */
-inline static int is_eof( struct parser *parser, const WCHAR *ptr )
+inline static int is_eof( const struct parser *parser, const WCHAR *ptr )
 {
     return (ptr >= parser->end || *ptr == CONTROL_Z);
 }
 
 
 /* check if the pointer points to an end of line */
-inline static int is_eol( struct parser *parser, const WCHAR *ptr )
+inline static int is_eol( const struct parser *parser, const WCHAR *ptr )
 {
     return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == '\n');
 }
@@ -1044,7 +1046,7 @@
     const WCHAR *dir;
     WCHAR *ptr, *ret;
     INT dirid;
-    unsigned int len1 = 0;
+    unsigned int len1;
     DWORD len2;
 
     if (!SetupGetIntField( context, 1, &dirid )) return NULL;
@@ -1321,16 +1323,14 @@
     struct inf_file *file = hinf;
     unsigned int i;
 
-    if (file != NULL && file != INVALID_HANDLE_VALUE)
-    {
-        for (i = 0; i < file->nb_sections; i++)
-            HeapFree( GetProcessHeap(), 0, file->sections[i] );
-        HeapFree( GetProcessHeap(), 0, file->filename );
-        HeapFree( GetProcessHeap(), 0, file->sections );
-        HeapFree( GetProcessHeap(), 0, file->fields );
-        HeapFree( GetProcessHeap(), 0, file->strings );
-        HeapFree( GetProcessHeap(), 0, file );
-    }
+    if (!hinf || (hinf == INVALID_HANDLE_VALUE)) return;
+
+    for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] );
+    HeapFree( GetProcessHeap(), 0, file->filename );
+    HeapFree( GetProcessHeap(), 0, file->sections );
+    HeapFree( GetProcessHeap(), 0, file->fields );
+    HeapFree( GetProcessHeap(), 0, file->strings );
+    HeapFree( GetProcessHeap(), 0, file );
 }
 
 
@@ -1362,16 +1362,13 @@
     int section_index;
     LONG ret = -1;
 
-    if (hinf == NULL || hinf == INVALID_HANDLE_VALUE)
-        return ERROR_INVALID_PARAMETER;
-
     for (file = hinf; file; file = file->next)
     {
         if ((section_index = find_section( file, section )) == -1) continue;
         if (ret == -1) ret = 0;
         ret += file->sections[section_index]->nb_lines;
     }
-    TRACE( "(%p,%s) returning %ld\n", hinf, debugstr_w(section), ret );
+    TRACE( "(%p,%s) returning %d\n", hinf, debugstr_w(section), ret );
     SetLastError( (ret == -1) ? ERROR_SECTION_NOT_FOUND : 0 );
     return ret;
 }
@@ -1403,12 +1400,6 @@
 {
     struct inf_file *file = hinf;
     int section_index;
-
-    if (hinf == NULL || hinf == INVALID_HANDLE_VALUE)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
 
     SetLastError( ERROR_SECTION_NOT_FOUND );
     for (file = hinf; file; file = file->next)
@@ -1422,7 +1413,7 @@
             context->Section    = section_index;
             context->Line       = index;
             SetLastError( 0 );
-            TRACE( "(%p,%s): returning %d/%ld\n",
+            TRACE( "(%p,%s): returning %d/%d\n",
                    hinf, debugstr_w(section), section_index, index );
             return TRUE;
         }
@@ -1469,12 +1460,6 @@
 {
     struct inf_file *file;
     int section_index;
-
-    if (hinf == NULL || hinf == INVALID_HANDLE_VALUE)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
 
     SetLastError( ERROR_SECTION_NOT_FOUND );
     for (file = hinf; file; file = file->next)
@@ -1770,7 +1755,7 @@
         }
         PARSER_string_substA( file, field->text, buffer, size );
 
-        TRACE( "context %p/%p/%d/%d index %ld returning %s\n",
+        TRACE( "context %p/%p/%d/%d index %d returning %s\n",
                context->Inf, context->CurrentInf, context->Section, context->Line,
                index, debugstr_a(buffer) );
     }
@@ -1801,7 +1786,7 @@
         }
         PARSER_string_substW( file, field->text, buffer, size );
 
-        TRACE( "context %p/%p/%d/%d index %ld returning %s\n",
+        TRACE( "context %p/%p/%d/%d index %d returning %s\n",
                context->Inf, context->CurrentInf, context->Section, context->Line,
                index, debugstr_w(buffer) );
     }
@@ -1888,7 +1873,7 @@
     }
     if (TRACE_ON(setupapi))
     {
-        TRACE( "%p/%p/%d/%d index %ld returning",
+        TRACE( "%p/%p/%d/%d index %d returning",
                context->Inf, context->CurrentInf, context->Section, context->Line, index );
         for (i = index; i < line->nb_fields; i++) TRACE( " %02x", buffer[i - index] );
         TRACE( "\n" );

Modified: trunk/reactos/dll/win32/setupapi/query.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/query.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/query.c (original)
+++ trunk/reactos/dll/win32/setupapi/query.c Sat Nov 10 17:35:21 2007
@@ -114,7 +114,7 @@
 
 /***********************************************************************
  *      SetupGetInfInformationW    (SETUPAPI.@)
- *
+ * 
  * BUGS
  *   Only handles the case when InfSpec is an INF handle.
  */
@@ -126,7 +126,7 @@
     BOOL ret;
     DWORD infSize;
 
-    TRACE("(%p, %ld, %p, %ld, %p)\n", InfSpec, SearchControl, ReturnBuffer,
+    TRACE("(%p, %d, %p, %d, %p)\n", InfSpec, SearchControl, ReturnBuffer,
            ReturnBufferSize, RequiredSize);
 
     if (!InfSpec)
@@ -153,7 +153,7 @@
             inf = search_for_inf(InfSpec, SearchControl);
             break;
         case INFINFO_INF_PATH_LIST_SEARCH:
-            FIXME("Unhandled search control: %ld\n", SearchControl);
+            FIXME("Unhandled search control: %d\n", SearchControl);
 
             if (RequiredSize)
                 *RequiredSize = 0;
@@ -214,6 +214,7 @@
 
     if (!ReturnBuffer)
     {
+        HeapFree(GetProcessHeap(), 0, filenameW);
         if (ReturnBufferSize)
         {
             SetLastError(ERROR_INVALID_PARAMETER);
@@ -225,6 +226,7 @@
 
     if (size > ReturnBufferSize)
     {
+        HeapFree(GetProcessHeap(), 0, filenameW);
         SetLastError(ERROR_INSUFFICIENT_BUFFER);
         return FALSE;
     }
@@ -240,12 +242,12 @@
  */
 BOOL WINAPI SetupQueryInfFileInformationW(PSP_INF_INFORMATION InfInformation,
                                           UINT InfIndex, PWSTR ReturnBuffer,
-                                          DWORD ReturnBufferSize, PDWORD RequiredSize)
+                                          DWORD ReturnBufferSize, PDWORD RequiredSize) 
 {
     DWORD len;
     LPWSTR ptr;
 
-    TRACE("(%p, %u, %p, %ld, %p) Stub!\n", InfInformation, InfIndex,
+    TRACE("(%p, %u, %p, %d, %p) Stub!\n", InfInformation, InfIndex,
           ReturnBuffer, ReturnBufferSize, RequiredSize);
 
     if (!InfInformation)
@@ -289,7 +291,7 @@
     DWORD required;
     INT size;
 
-    TRACE("%p, %p, %s, %p, %p, 0x%08lx, %p\n", hinf, context, debugstr_a(filename), source_id,
+    TRACE("%p, %p, %s, %p, %p, 0x%08x, %p\n", hinf, context, debugstr_a(filename), source_id,
           buffer, buffer_size, required_size);
 
     if (filename && *filename && !(filenameW = strdupAtoW( filename )))
@@ -330,10 +332,8 @@
     WCHAR Section[MAX_PATH];
     DWORD size;
     LPWSTR source_id;
-    BOOL ret;
-
-    ret = SetupDiGetActualSectionToInstallW(hinf, source_disks_files, Section, MAX_PATH, NULL, NULL);
-    if (!ret)
+
+    if (!SetupDiGetActualSectionToInstallW(hinf, source_disks_files, Section, MAX_PATH, NULL, NULL))
         return NULL;
 
     if (!SetupFindFirstLineW( hinf, Section, filename, context ) &&
@@ -352,8 +352,7 @@
         return NULL;
     }
 
-    ret = SetupDiGetActualSectionToInstallW(hinf, source_disks_names, Section, MAX_PATH, NULL, NULL);
-    if (!ret)
+    if (!SetupDiGetActualSectionToInstallW(hinf, source_disks_names, Section, MAX_PATH, NULL, NULL))
         return NULL;
 
     if (!SetupFindFirstLineW( hinf, Section, source_id, context ) &&
@@ -376,7 +375,7 @@
     INFCONTEXT ctx;
     WCHAR *end, *source_id_str;
 
-    TRACE("%p, %p, %s, %p, %p, 0x%08lx, %p\n", hinf, context, debugstr_w(filename), source_id,
+    TRACE("%p, %p, %s, %p, %p, 0x%08x, %p\n", hinf, context, debugstr_w(filename), source_id,
           buffer, buffer_size, required_size);
 
     if (!context) context = &ctx;
@@ -420,7 +419,7 @@
     DWORD required;
     INT size;
 
-    TRACE("%p, %d, %d, %p, %lu, %p\n", hinf, source_id, info, buffer, buffer_size,
+    TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
           required_size);
 
     if (!SetupGetSourceInfoW( hinf, source_id, info, NULL, 0, &required ))
@@ -464,15 +463,13 @@
     WCHAR source_id_str[11];
     static const WCHAR fmt[] = {'%','d',0};
     DWORD index;
-    BOOL ret;
-
-    TRACE("%p, %d, %d, %p, %lu, %p\n", hinf, source_id, info, buffer, buffer_size,
+
+    TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
           required_size);
 
     sprintfW( source_id_str, fmt, source_id );
 
-    ret = SetupDiGetActualSectionToInstallW(hinf, source_disks_names, Section, MAX_PATH, NULL, NULL);
-    if (!ret)
+    if (!SetupDiGetActualSectionToInstallW(hinf, source_disks_names, Section, MAX_PATH, NULL, NULL))
         return FALSE;
 
     if (!SetupFindFirstLineW( hinf, Section, source_id_str, &ctx ) &&
@@ -517,7 +514,7 @@
     DWORD required;
     INT size;
 
-    TRACE("%p, %p, %s, %p, 0x%08lx, %p\n", hinf, context, debugstr_a(section), buffer,
+    TRACE("%p, %p, %s, %p, 0x%08x, %p\n", hinf, context, debugstr_a(section), buffer,
           buffer_size, required_size);
 
     if (section && !(sectionW = strdupAtoW( section )))
@@ -569,7 +566,7 @@
     WCHAR *dir;
     INT size;
 
-    TRACE("%p, %p, %s, %p, 0x%08lx, %p\n", hinf, context, debugstr_w(section), buffer,
+    TRACE("%p, %p, %s, %p, 0x%08x, %p\n", hinf, context, debugstr_w(section), buffer,
           buffer_size, required_size);
 
     if (context && !SetupFindFirstLineW( hinf, destination_dirs, NULL, context )) return FALSE;
@@ -612,7 +609,7 @@
 
     if (OriginalFileInfo->cbSize != sizeof(*OriginalFileInfo))
     {
-        ERR("incorrect OriginalFileInfo->cbSize of %lu\n", OriginalFileInfo->cbSize);
+        WARN("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize);
         SetLastError( ERROR_INVALID_USER_BUFFER );
         return FALSE;
     }
@@ -622,9 +619,9 @@
         AlternativePlatformInfo, &OriginalFileInfoW);
     if (ret)
     {
-        WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalInfName, MAX_PATH,
+        WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalInfName, -1,
             OriginalFileInfo->OriginalInfName, MAX_PATH, NULL, NULL);
-        WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalCatalogName, MAX_PATH,
+        WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalCatalogName, -1,
             OriginalFileInfo->OriginalCatalogName, MAX_PATH, NULL, NULL);
     }
 
@@ -645,16 +642,14 @@
     static const WCHAR wszVersion[] = { 'V','e','r','s','i','o','n',0 };
     static const WCHAR wszCatalogFile[] = { 'C','a','t','a','l','o','g','F','i','l','e',0 };
 
-    //SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    //return FALSE;
-
     FIXME("(%p, %d, %p, %p): semi-stub\n", InfInformation, InfIndex,
         AlternativePlatformInfo, OriginalFileInfo);
 
     if (OriginalFileInfo->cbSize != sizeof(*OriginalFileInfo))
     {
-        ERR("incorrect OriginalFileInfo->cbSize of %lu\n", OriginalFileInfo->cbSize);
-        return ERROR_INVALID_USER_BUFFER;
+        WARN("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize);
+        SetLastError(ERROR_INVALID_USER_BUFFER);
+        return FALSE;
     }
 
     inf_path = (LPWSTR)&InfInformation->VersionData[0];

Modified: trunk/reactos/dll/win32/setupapi/queue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/queue.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/queue.c (original)
+++ trunk/reactos/dll/win32/setupapi/queue.c Sat Nov 10 17:35:21 2007
@@ -35,15 +35,15 @@
 
 struct file_op
 {
-    struct file_op       *next;
-    UINT                  style;
-    WCHAR                *src_root;
-    WCHAR                *src_path;
-    WCHAR                *src_file;
-    WCHAR                *src_descr;
-    WCHAR                *src_tag;
-    WCHAR                *dst_path;
-    WCHAR                *dst_file;
+    struct file_op *next;
+    UINT            style;
+    WCHAR          *src_root;
+    WCHAR          *src_path;
+    WCHAR          *src_file;
+    WCHAR          *src_descr;
+    WCHAR          *src_tag;
+    WCHAR          *dst_path;
+    WCHAR          *dst_file;
     PSECURITY_DESCRIPTOR  dst_sd;
 };
 
@@ -207,6 +207,7 @@
     case SPFILENOTIFY_RENAMEERROR:
     case SPFILENOTIFY_STARTCOPY:
     case SPFILENOTIFY_ENDCOPY:
+    case SPFILENOTIFY_QUEUESCAN_EX:
         {
             FILEPATHS_W *pathsW = (FILEPATHS_W *)param1;
             FILEPATHS_A pathsA;
@@ -240,8 +241,18 @@
         }
         break;
 
+    case SPFILENOTIFY_QUEUESCAN:
+        {
+            LPWSTR targetW = (LPWSTR)param1;
+            LPSTR target = strdupWtoA( targetW );
+
+            ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification,
+                                              (UINT_PTR)target, param2 );
+            HeapFree( GetProcessHeap(), 0, target );
+        }
+        break;
+
     case SPFILENOTIFY_NEEDMEDIA:
-    case SPFILENOTIFY_QUEUESCAN:
         FIXME("mapping for %d not implemented\n",notification);
     case SPFILENOTIFY_STARTQUEUE:
     case SPFILENOTIFY_ENDQUEUE:
@@ -963,12 +974,13 @@
     return ret;
 }
 
-static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style)
+static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style, 
+                           PSP_FILE_CALLBACK_W handler, PVOID context )
 {
     BOOL rc = FALSE;
     BOOL docopy = TRUE;
 
-    TRACE("copy %s to %s style 0x%lx\n",debugstr_w(source),debugstr_w(target),style);
+    TRACE("copy %s to %s style 0x%x\n",debugstr_w(source),debugstr_w(target),style);
 
     /* before copy processing */
     if (style & SP_COPY_REPLACEONLY)
@@ -999,7 +1011,7 @@
             VersionSizeTarget = GetFileVersionInfoSizeW((LPWSTR)target,&zero);
         }
 
-        TRACE("SizeTarget %li ... SizeSource %li\n",VersionSizeTarget,
+        TRACE("SizeTarget %i ... SizeSource %i\n",VersionSizeTarget,
                 VersionSizeSource);
 
         if (VersionSizeSource && VersionSizeTarget)
@@ -1030,20 +1042,32 @@
 
                 if (ret)
                 {
-                    TRACE("Versions: Source %li.%li target %li.%li\n",
+                    FILEPATHS_W filepaths;
+
+                    TRACE("Versions: Source %i.%i target %i.%i\n",
                       SourceInfo->dwFileVersionMS, SourceInfo->dwFileVersionLS,
                       TargetInfo->dwFileVersionMS, TargetInfo->dwFileVersionLS);
 
+                    /* used in case of notification */
+                    filepaths.Target = target;
+                    filepaths.Source = source;
+                    filepaths.Win32Error = 0;
+                    filepaths.Flags = 0;
+
                     if (TargetInfo->dwFileVersionMS > SourceInfo->dwFileVersionMS)
                     {
-                        FIXME("Notify that target version is greater..\n");
-                        docopy = FALSE;
+                        if (handler)
+                            docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
+                        else
+                            docopy = FALSE;
                     }
                     else if ((TargetInfo->dwFileVersionMS == SourceInfo->dwFileVersionMS)
                              && (TargetInfo->dwFileVersionLS > SourceInfo->dwFileVersionLS))
                     {
-                        FIXME("Notify that target version is greater..\n");
-                        docopy = FALSE;
+                        if (handler)
+                            docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
+                        else
+                            docopy = FALSE;
                     }
                     else if ((style & SP_COPY_NEWER_ONLY) &&
                         (TargetInfo->dwFileVersionMS ==
@@ -1051,8 +1075,10 @@
                         &&(TargetInfo->dwFileVersionLS ==
                         SourceInfo->dwFileVersionLS))
                     {
-                        FIXME("Notify that target version is greater..\n");
-                        docopy = FALSE;
+                        if (handler)
+                            docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
+                        else
+                            docopy = FALSE;
                     }
                 }
             }
@@ -1071,7 +1097,7 @@
     if (style & (SP_COPY_NODECOMP | SP_COPY_LANGUAGEAWARE | SP_COPY_FORCE_IN_USE |
                  SP_COPY_IN_USE_NEEDS_REBOOT | SP_COPY_NOSKIP | SP_COPY_WARNIFSKIP))
     {
-        ERR("Unsupported style(s) 0x%lx\n",style);
+        ERR("Unsupported style(s) 0x%x\n",style);
     }
 
     if (docopy)
@@ -1107,7 +1133,7 @@
     if (!queue->copy_queue.count && !queue->delete_queue.count && !queue->rename_queue.count)
         return TRUE;  /* nothing to do */
 
-    if (!handler( context, SPFILENOTIFY_STARTQUEUE, (UINT)owner, 0 )) return FALSE;
+    if (!handler( context, SPFILENOTIFY_STARTQUEUE, (UINT_PTR)owner, 0 )) return FALSE;
 
     /* perform deletes */
 
@@ -1188,7 +1214,7 @@
 		    }
 		}
                 if (do_file_copyW( op_result == FILEOP_NEWPATH ? newpath : paths.Source,
-                               paths.Target, op->style )) break;  /* success */
+                               paths.Target, op->style, handler, context )) break;  /* success */
                 /* try to extract it from the cabinet file */
                 if (op->src_tag)
                 {
@@ -1238,11 +1264,17 @@
 /***********************************************************************
  *            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;
+BOOL WINAPI SetupScanFileQueueA( HSPFILEQ handle, DWORD flags, HWND window,
+                                 PSP_FILE_CALLBACK_A handler, PVOID context, PDWORD result )
+{
+    struct callback_WtoA_context ctx;
+
+    TRACE("%p %x %p %p %p %p\n", handle, flags, window, handler, context, result);
+
+    ctx.orig_context = context;
+    ctx.orig_handler = handler;
+
+    return SetupScanFileQueueW( handle, flags, window, QUEUE_callback_WtoA, &ctx, result );
 }
 
 
@@ -1250,42 +1282,53 @@
  *            SetupScanFileQueueW   (SETUPAPI.@)
  */
 BOOL WINAPI SetupScanFileQueueW( HSPFILEQ handle, DWORD flags, HWND window,
-                                 PSP_FILE_CALLBACK_W callback, PVOID context, PDWORD result )
+                                 PSP_FILE_CALLBACK_W handler, PVOID context, PDWORD result )
 {
     struct file_queue *queue = handle;
     struct file_op *op;
-    BOOL allnodesprocessed = FALSE;
     FILEPATHS_W paths;
+    UINT notification = 0;
+    BOOL ret = FALSE;
+
+    TRACE("%p %x %p %p %p %p\n", handle, flags, window, handler, context, result);
+
+    *result = FALSE;
+
+    if (!queue->copy_queue.count) return TRUE;
+
+    if (flags & SPQ_SCAN_USE_CALLBACK)        notification = SPFILENOTIFY_QUEUESCAN;
+    else if (flags & SPQ_SCAN_USE_CALLBACKEX) notification = SPFILENOTIFY_QUEUESCAN_EX;
+
+    if (flags & ~(SPQ_SCAN_USE_CALLBACK | SPQ_SCAN_USE_CALLBACKEX))
+    {
+        FIXME("flags %x not fully implemented\n", flags);
+    }
 
     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)
+
+    for (op = queue->copy_queue.head; op; op = op->next)
+    {
+        build_filepathsW( op, &paths );
+        switch (notification)
         {
-            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;
-            }
+        case SPFILENOTIFY_QUEUESCAN:
+            /* FIXME: handle delay flag */
+            if (handler( context,  notification, (UINT_PTR)paths.Target, 0 )) goto done;
+            break;
+        case SPFILENOTIFY_QUEUESCAN_EX:
+            if (handler( context, notification, (UINT_PTR)&paths, 0 )) goto done;
+            break;
+        default:
+            ret = TRUE; goto done;
         }
     }
 
     *result = TRUE;
-    allnodesprocessed = TRUE;
 
  done:
     HeapFree( GetProcessHeap(), 0, (void *)paths.Source );
     HeapFree( GetProcessHeap(), 0, (void *)paths.Target );
-    return allnodesprocessed;
+    return ret;
 }
 
 
@@ -1408,10 +1451,10 @@
         TRACE( "end queue\n" );
         return 0;
     case SPFILENOTIFY_STARTSUBQUEUE:
-        TRACE( "start subqueue %d count %d\n", param1, param2 );
+        TRACE( "start subqueue %ld count %ld\n", param1, param2 );
         return TRUE;
     case SPFILENOTIFY_ENDSUBQUEUE:
-        TRACE( "end subqueue %d\n", param1 );
+        TRACE( "end subqueue %ld\n", param1 );
         return 0;
     case SPFILENOTIFY_STARTDELETE:
         TRACE( "start delete %s\n", debugstr_a(paths->Target) );
@@ -1447,7 +1490,7 @@
         TRACE( "need media\n" );
         return FILEOP_SKIP;
     default:
-        FIXME( "notification %d params %x,%x\n", notification, param1, param2 );
+        FIXME( "notification %d params %lx,%lx\n", notification, param1, param2 );
         break;
     }
     return 0;
@@ -1472,10 +1515,10 @@
         TRACE( "end queue\n" );
         return 0;
     case SPFILENOTIFY_STARTSUBQUEUE:
-        TRACE( "start subqueue %d count %d\n", param1, param2 );
+        TRACE( "start subqueue %ld count %ld\n", param1, param2 );
         return TRUE;
     case SPFILENOTIFY_ENDSUBQUEUE:
-        TRACE( "end subqueue %d\n", param1 );
+        TRACE( "end subqueue %ld\n", param1 );
         return 0;
     case SPFILENOTIFY_STARTDELETE:
         TRACE( "start delete %s\n", debugstr_w(paths->Target) );
@@ -1512,7 +1555,7 @@
         TRACE( "need media\n" );
         return FILEOP_SKIP;
     default:
-        FIXME( "notification %d params %x,%x\n", notification, param1, param2 );
+        FIXME( "notification %d params %lx,%lx\n", notification, param1, param2 );
         break;
     }
     return 0;
@@ -1571,9 +1614,9 @@
  *            SetupCopyErrorA   (SETUPAPI.@)
  */
 
-UINT WINAPI SetupCopyErrorA( HWND parent, PCSTR dialogTitle, PCSTR diskname,
+UINT WINAPI SetupCopyErrorA( HWND parent, PCSTR dialogTitle, PCSTR diskname, 
                              PCSTR sourcepath, PCSTR sourcefile, PCSTR targetpath,
-                             UINT w32error, DWORD style, PSTR pathbuffer,
+                             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",
@@ -1585,12 +1628,31 @@
  *            SetupCopyErrorW   (SETUPAPI.@)
  */
 
-UINT WINAPI SetupCopyErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR diskname,
+UINT WINAPI SetupCopyErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR diskname, 
                              PCWSTR sourcepath, PCWSTR sourcefile, PCWSTR targetpath,
-                             UINT w32error, DWORD style, PWSTR pathbuffer,
+                             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;
 }
+
+/***********************************************************************
+ *            pSetupGetQueueFlags   (SETUPAPI.@)
+ */
+DWORD WINAPI pSetupGetQueueFlags( HSPFILEQ handle )
+{
+    struct file_queue *queue = handle;
+    return queue->flags;
+}
+
+/***********************************************************************
+ *            pSetupSetQueueFlags   (SETUPAPI.@)
+ */
+BOOL WINAPI pSetupSetQueueFlags( HSPFILEQ handle, DWORD flags )
+{
+    struct file_queue *queue = handle;
+    queue->flags = flags;
+    return TRUE;
+}

Modified: trunk/reactos/dll/win32/setupapi/setupapi.spec
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupapi.spec?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi.spec (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi.spec Sat Nov 10 17:35:21 2007
@@ -285,10 +285,14 @@
 @ stdcall SetupDiCreateDevRegKeyA(ptr ptr long long long ptr str)
 @ stdcall SetupDiCreateDevRegKeyW(ptr ptr long long long ptr wstr)
 @ stdcall SetupDiCreateDeviceInfoA(ptr str ptr str ptr long ptr)
-@ stdcall SetupDiCreateDeviceInfoW(ptr wstr ptr wstr ptr long ptr)
 @ stdcall SetupDiCreateDeviceInfoList(ptr ptr)
 @ stdcall SetupDiCreateDeviceInfoListExA(ptr long str ptr)
 @ stdcall SetupDiCreateDeviceInfoListExW(ptr long wstr ptr)
+@ stdcall SetupDiCreateDeviceInfoW(ptr wstr ptr wstr ptr long ptr)
+@ stub SetupDiCreateDeviceInterfaceA
+@ stub SetupDiCreateDeviceInterfaceW
+@ stub SetupDiCreateDeviceInterfaceRegKeyA
+@ stub SetupDiCreateDeviceInterfaceRegKeyW
 @ stdcall SetupDiDeleteDevRegKey(ptr ptr long long long)
 @ stdcall SetupDiDeleteDeviceInfo(long ptr)
 @ stub SetupDiDeleteDeviceInterfaceData
@@ -328,15 +332,15 @@
 @ stdcall SetupDiGetDeviceInstallParamsW(ptr ptr ptr)
 @ stdcall SetupDiGetDeviceInstanceIdA(ptr ptr str long ptr)
 @ stdcall SetupDiGetDeviceInstanceIdW(ptr ptr wstr long ptr)
+@ stub SetupDiGetDeviceInterfaceAlias
+@ stdcall SetupDiGetDeviceInterfaceDetailA(long ptr ptr long ptr ptr)
+@ stdcall SetupDiGetDeviceInterfaceDetailW(long ptr ptr long ptr ptr)
 @ stdcall SetupDiGetDeviceRegistryPropertyA(long ptr long ptr ptr long ptr)
 @ stdcall SetupDiGetDeviceRegistryPropertyW(long ptr long ptr ptr long ptr)
 @ stdcall SetupDiGetDriverInfoDetailA(ptr ptr ptr ptr long ptr)
 @ stdcall SetupDiGetDriverInfoDetailW(ptr ptr ptr ptr long ptr)
 @ stub SetupDiGetDriverInstallParamsA
 @ stdcall SetupDiGetDriverInstallParamsW(ptr ptr ptr ptr)
-@ stub SetupDiGetDeviceInterfaceAlias
-@ stdcall SetupDiGetDeviceInterfaceDetailA(long ptr ptr long ptr ptr)
-@ stdcall SetupDiGetDeviceInterfaceDetailW(long ptr ptr long ptr ptr)
 @ stub SetupDiGetHwProfileFriendlyNameA
 @ stub SetupDiGetHwProfileFriendlyNameExA
 @ stub SetupDiGetHwProfileFriendlyNameExW
@@ -548,15 +552,15 @@
 @ stub pSetupDestroyRunOnceNodeList
 @ stub pSetupDirectoryIdToPath
 @ stdcall pSetupGetField(ptr long)
-@ stub pSetupGetGlobalFlags
+@ stdcall pSetupGetGlobalFlags()
 @ stub pSetupGetOsLoaderDriveAndPath
-@ stub pSetupGetQueueFlags
+@ stdcall pSetupGetQueueFlags(ptr)
 @ stub pSetupGetVersionDatum
 @ stub pSetupGuidFromString
 @ stub pSetupIsGuidNull
 @ stub pSetupMakeSurePathExists
-@ stub pSetupSetGlobalFlags
-@ stub pSetupSetQueueFlags
+@ stdcall pSetupSetGlobalFlags(long)
+@ stdcall pSetupSetQueueFlags(ptr long)
 @ stub pSetupSetSystemSourceFlags
 @ stub pSetupStringFromGuid
 @ stub pSetupVerifyQueuedCatalogs

Modified: trunk/reactos/dll/win32/setupapi/setupapi_private.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupapi_private.h?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi_private.h (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi_private.h Sat Nov 10 17:35:21 2007
@@ -242,10 +242,10 @@
 struct inf_file;
 extern const WCHAR *DIRID_get_string( int dirid );
 extern const WCHAR *PARSER_get_inf_filename( HINF hinf );
-extern unsigned int PARSER_string_substA( struct inf_file *file, const WCHAR *text,
-                                          char *buffer, unsigned int size );
-extern unsigned int PARSER_string_substW( struct inf_file *file, const WCHAR *text,
-                                          WCHAR *buffer, unsigned int size );
+extern unsigned int PARSER_string_substA( const struct inf_file *file, const WCHAR *text, char *buffer,
+                                          unsigned int size );
+extern unsigned int PARSER_string_substW( const struct inf_file *file, const WCHAR *text, WCHAR *buffer,
+                                          unsigned int size );
 extern WCHAR *PARSER_get_src_root( HINF hinf );
 extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context );
 

Modified: trunk/reactos/dll/win32/setupapi/setupcab.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupcab.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupcab.c (original)
+++ trunk/reactos/dll/win32/setupapi/setupcab.c Sat Nov 10 17:35:21 2007
@@ -1,4 +1,4 @@
-/*
+/* 
  * Setupapi cabinet routines
  *
  * Copyright 2003 Gregory M. Turner
@@ -20,7 +20,7 @@
  *
  * Many useful traces are commented in code, uncomment them if you have
  * trouble and run with WINEDEBUG=+setupapi
- *
+ * 
  */
 
 #include "setupapi_private.h"
@@ -87,12 +87,12 @@
 
 static void *sc_cb_alloc(ULONG cb)
 {
-  return malloc(cb);
+  return HeapAlloc(GetProcessHeap(), 0, cb);
 }
 
 static void sc_cb_free(void *pv)
 {
-  free(pv);
+  HeapFree(GetProcessHeap(), 0, pv);
 }
 
 static INT_PTR sc_cb_open(char *pszFile, int oflag, int pmode)
@@ -523,10 +523,10 @@
   BOOL ret;
 
 
-  TRACE("(CabinetFile == %s, Reserved == %lu, MsgHandler == ^%p, Context == ^%p)\n",
+  TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n",
         debugstr_a(CabinetFile), Reserved, MsgHandler, Context);
 
-  if (! LoadCABINETDll())
+  if (! LoadCABINETDll()) 
     return FALSE;
 
   memset(&my_hsc, 0, sizeof(SC_HSC_A));
@@ -588,7 +588,7 @@
   DWORD fpnsize;
   BOOL ret;
 
-  TRACE("(CabinetFile == %s, Reserved == %lu, MsgHandler == ^%p, Context == ^%p)\n",
+  TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n",
         debugstr_w(CabinetFile), Reserved, MsgHandler, Context);
 
   if (!LoadCABINETDll())

Modified: trunk/reactos/dll/win32/setupapi/stringtable.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/stringtable.c?rev=30326&r1=30325&r2=30326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/stringtable.c (original)
+++ trunk/reactos/dll/win32/setupapi/stringtable.c Sat Nov 10 17:35:21 2007
@@ -39,8 +39,6 @@
     DWORD dwMaxDataSize;
 } STRING_TABLE, *PSTRING_TABLE;
 
-WCHAR empty[] = {0};
-
 
 /**************************************************************************
  * StringTableInitialize [SETUPAPI.@]
@@ -111,11 +109,7 @@
     TRACE("\n");
 
     pStringTable = MyMalloc(sizeof(STRING_TABLE));
-    if (pStringTable == NULL)
-    {
-        ERR("Invalid hStringTable!\n");
-        return NULL;
-    }
+    if (pStringTable == NULL) return NULL;
 
     memset(pStringTable, 0, sizeof(STRING_TABLE));
 
@@ -155,7 +149,7 @@
     PSTRING_TABLE pStringTable;
     DWORD i;
 
-    TRACE("%p\n", (PVOID)hStringTable);
+    TRACE("%p\n", hStringTable);
 
     pStringTable = (PSTRING_TABLE)hStringTable;
     if (pStringTable == NULL)
@@ -165,18 +159,12 @@
     {
         for (i = 0; i < pStringTable->dwMaxSlots; i++)
         {
-            if (pStringTable->pSlots[i].pString != NULL)
-            {
-                MyFree(pStringTable->pSlots[i].pString);
-                pStringTable->pSlots[i].pString = NULL;
-            }
-
-            if (pStringTable->pSlots[i].pData != NULL)
-            {
-                MyFree(pStringTable->pSlots[i].pData);
-                pStringTable->pSlots[i].pData = NULL;
-                pStringTable->pSlots[i].dwSize = 0;
-            }
+            MyFree(pStringTable->pSlots[i].pString);
+            pStringTable->pSlots[i].pString = NULL;
+
+            MyFree(pStringTable->pSlots[i].pData);
+            pStringTable->pSlots[i].pData = NULL;
+            pStringTable->pSlots[i].dwSize = 0;
         }
 
         MyFree(pStringTable->pSlots);
@@ -214,7 +202,7 @@
     PSTRING_TABLE pStringTable;
     DWORD i;
 
-    TRACE("%p %s %lx\n", (PVOID)hStringTable, debugstr_w(lpString), dwFlags);
+    TRACE("%p %s %x\n", hStringTable, debugstr_w(lpString), dwFlags);
 
     pStringTable = (PSTRING_TABLE)hStringTable;
     if (pStringTable == NULL)
@@ -422,7 +410,7 @@
     DWORD i;
     DWORD length;
 
-    TRACE("%p\n", (PVOID)hStringTable);
+    TRACE("%p\n", hStringTable);
 
     pSourceTable = (PSTRING_TABLE)hStringTable;
     if (pSourceTable == NULL)
@@ -508,8 +496,8 @@
 {
     PSTRING_TABLE pStringTable;
 
-    TRACE("%p %lx %p %lu\n",
-          (PVOID)hStringTable, dwId, lpExtraData, dwExtraDataSize);
+    TRACE("%p %x %p %u\n",
+          hStringTable, dwId, lpExtraData, dwExtraDataSize);
 
     pStringTable = (PSTRING_TABLE)hStringTable;
     if (pStringTable == NULL)
@@ -561,7 +549,7 @@
     PSTRING_TABLE pStringTable;
     DWORD i;
 
-    TRACE("%p %s %lx\n", (PVOID)hStringTable, debugstr_w(lpString), dwFlags);
+    TRACE("%p %s %x\n", hStringTable, debugstr_w(lpString), dwFlags);
 
     pStringTable = (PSTRING_TABLE)hStringTable;
     if (pStringTable == NULL)
@@ -685,8 +673,8 @@
 {
     PSTRING_TABLE pStringTable;
 
-    TRACE("%p %lx %p %lu\n",
-          (PVOID)hStringTable, dwId, lpExtraData, dwExtraDataSize);
+    TRACE("%p %x %p %u\n",
+          hStringTable, dwId, lpExtraData, dwExtraDataSize);
 
     pStringTable = (PSTRING_TABLE)hStringTable;
     if (pStringTable == NULL)
@@ -741,8 +729,9 @@
                         DWORD dwId)
 {
     PSTRING_TABLE pStringTable;
-
-    TRACE("%p %lx\n", (PVOID)hStringTable, dwId);
+    static WCHAR empty[] = {0};
+
+    TRACE("%p %x\n", hStringTable, dwId);
 
     pStringTable = (PSTRING_TABLE)hStringTable;
     if (pStringTable == NULL)
@@ -783,8 +772,7 @@
     DWORD dwLength;
     BOOL bResult = FALSE;
 
-    TRACE("%p %lx %p %p\n",
-          (PVOID)hStringTable, dwId, lpBuffer, lpBufferLength);
+    TRACE("%p %x %p %p\n", hStringTable, dwId, lpBuffer, lpBufferLength);
 
     pStringTable = (PSTRING_TABLE)hStringTable;
     if (pStringTable == NULL)
@@ -829,5 +817,5 @@
 VOID WINAPI
 StringTableTrim(HSTRING_TABLE hStringTable)
 {
-    FIXME("%p\n", (PVOID)hStringTable);
-}
+    FIXME("%p\n", hStringTable);
+}




More information about the Ros-diffs mailing list