Zebediah Figura : setupapi: Remove implementation for LayoutInf parameter of SP_FILE_COPY_PARAMS.

Alexandre Julliard julliard at winehq.org
Thu May 2 16:45:08 CDT 2019


Module: wine
Branch: master
Commit: ee36f923c59d9ba51b429247df90e0ed30592e62
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ee36f923c59d9ba51b429247df90e0ed30592e62

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed May  1 18:24:06 2019 -0500

setupapi: Remove implementation for LayoutInf parameter of SP_FILE_COPY_PARAMS.

Tests demonstrate that the existing implementation is not correct, and I was
unable to find an arrangement of parameters such that it was respected on
Windows. Most likely it has to do with the undocumented parameters used in
the "master" C:\windows\inf\layout.inf.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/parser.c           | 20 ----------
 dlls/setupapi/queue.c            | 81 +---------------------------------------
 dlls/setupapi/setupapi_private.h |  1 -
 3 files changed, 1 insertion(+), 101 deletions(-)

diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c
index 5cde5eb..c108689 100644
--- a/dlls/setupapi/parser.c
+++ b/dlls/setupapi/parser.c
@@ -1055,26 +1055,6 @@ const WCHAR *PARSER_get_inf_filename( HINF hinf )
     return file->filename;
 }
 
-
-/***********************************************************************
- *            PARSER_get_src_root
- *
- * Retrieve the source directory of an inf file.
- */
-WCHAR *PARSER_get_src_root( HINF hinf )
-{
-    unsigned int len;
-    const WCHAR *dir = get_inf_dir( hinf, &len );
-    WCHAR *ret = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
-    if (ret)
-    {
-        memcpy( ret, dir, len * sizeof(WCHAR) );
-        ret[len] = 0;
-    }
-    return ret;
-}
-
-
 /***********************************************************************
  *            PARSER_get_dest_dir
  *
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c
index bc774f3..d18ce9a 100644
--- a/dlls/setupapi/queue.c
+++ b/dlls/setupapi/queue.c
@@ -256,82 +256,6 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification,
     return ret;
 }
 
-
-/***********************************************************************
- *            get_src_file_info
- *
- * Retrieve the source file information for a given file.
- */
-static void get_src_file_info( HINF hinf, struct file_op *op )
-{
-    static const WCHAR SourceDisksNames[] =
-        {'S','o','u','r','c','e','D','i','s','k','s','N','a','m','e','s',0};
-    static const WCHAR SourceDisksFiles[] =
-        {'S','o','u','r','c','e','D','i','s','k','s','F','i','l','e','s',0};
-
-    INFCONTEXT file_ctx, disk_ctx;
-    INT id, diskid;
-    DWORD len, len2;
-
-    /* find the SourceDisksFiles entry */
-    if (!SetupFindFirstLineW( hinf, SourceDisksFiles, op->src_file, &file_ctx ))
-    {
-        if ((op->style & (SP_COPY_SOURCE_ABSOLUTE|SP_COPY_SOURCEPATH_ABSOLUTE))) return;
-        /* no specific info, use .inf file source directory */
-        if (!op->src_root) op->src_root = PARSER_get_src_root( hinf );
-        return;
-    }
-    if (!SetupGetIntField( &file_ctx, 1, &diskid )) return;
-
-    /* now find the diskid in the SourceDisksNames section */
-    if (!SetupFindFirstLineW( hinf, SourceDisksNames, NULL, &disk_ctx )) return;
-    for (;;)
-    {
-        if (SetupGetIntField( &disk_ctx, 0, &id ) && (id == diskid)) break;
-        if (!SetupFindNextLine( &disk_ctx, &disk_ctx )) return;
-    }
-
-    /* and fill in the missing info */
-
-    if (!op->src_descr)
-    {
-        if (SetupGetStringFieldW( &disk_ctx, 1, NULL, 0, &len ) &&
-            (op->src_descr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) )))
-            SetupGetStringFieldW( &disk_ctx, 1, op->src_descr, len, NULL );
-    }
-    if (!op->src_tag)
-    {
-        if (SetupGetStringFieldW( &disk_ctx, 2, NULL, 0, &len ) &&
-            (op->src_tag = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) )))
-            SetupGetStringFieldW( &disk_ctx, 2, op->src_tag, len, NULL );
-    }
-    if (!op->src_path && !(op->style & SP_COPY_SOURCE_ABSOLUTE))
-    {
-        len = len2 = 0;
-        if (!(op->style & SP_COPY_SOURCEPATH_ABSOLUTE))
-        {
-            /* retrieve relative path for this disk */
-            if (!SetupGetStringFieldW( &disk_ctx, 4, NULL, 0, &len )) len = 0;
-        }
-        /* retrieve relative path for this file */
-        if (!SetupGetStringFieldW( &file_ctx, 2, NULL, 0, &len2 )) len2 = 0;
-
-        if ((len || len2) &&
-            (op->src_path = HeapAlloc( GetProcessHeap(), 0, (len+len2)*sizeof(WCHAR) )))
-        {
-            WCHAR *ptr = op->src_path;
-            if (len)
-            {
-                SetupGetStringFieldW( &disk_ctx, 4, op->src_path, len, NULL );
-                ptr = op->src_path + strlenW(op->src_path);
-                if (len2 && ptr > op->src_path && ptr[-1] != '\\') *ptr++ = '\\';
-            }
-            if (!SetupGetStringFieldW( &file_ctx, 2, ptr, len2, NULL )) *ptr = 0;
-        }
-    }
-    if (!op->src_root) op->src_root = PARSER_get_src_root(hinf);
-}
-
 static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARAMS_W *params,
                              WCHAR *src_root, WCHAR *src_path)
 {
@@ -557,10 +481,7 @@ BOOL WINAPI SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W params )
     /* some defaults */
     if (!op->src_file) op->src_file = op->dst_file;
     if (params->LayoutInf)
-    {
-        get_src_file_info( params->LayoutInf, op );
-        if (!op->dst_path) op->dst_path = get_destination_dir( params->LayoutInf, op->dst_file );
-    }
+        FIXME("Unhandled LayoutInf %p.\n", params->LayoutInf);
 
     TRACE( "root=%s path=%s file=%s -> dir=%s file=%s  descr=%s tag=%s\n",
            debugstr_w(op->src_root), debugstr_w(op->src_path), debugstr_w(op->src_file),
diff --git a/dlls/setupapi/setupapi_private.h b/dlls/setupapi/setupapi_private.h
index 1df96b1..f4685ab 100644
--- a/dlls/setupapi/setupapi_private.h
+++ b/dlls/setupapi/setupapi_private.h
@@ -90,7 +90,6 @@ static inline WCHAR *strdupAtoW( const char *str )
 struct inf_file;
 extern const WCHAR *DIRID_get_string( int dirid ) DECLSPEC_HIDDEN;
 extern const WCHAR *PARSER_get_inf_filename( HINF hinf ) DECLSPEC_HIDDEN;
-extern WCHAR *PARSER_get_src_root( HINF hinf ) DECLSPEC_HIDDEN;
 extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context ) DECLSPEC_HIDDEN;
 
 /* support for Ascii queue callback functions */




More information about the wine-cvs mailing list