wine/dlls/setupapi install.c

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 3 13:34:03 CST 2005


ChangeSet ID:	21098
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/03 13:34:03

Modified files:
	dlls/setupapi  : install.c 

Log message:
	Added support for optional section.ntx86 and section.nt in
	InstallHinfSection when current version is set to NT.

Patch: http://cvs.winehq.org/patch.py?id=21098

Old revision  New revision  Changes     Path
 1.13          1.14          +27 -2      wine/dlls/setupapi/install.c

Index: wine/dlls/setupapi/install.c
diff -u -p wine/dlls/setupapi/install.c:1.13 wine/dlls/setupapi/install.c:1.14
--- wine/dlls/setupapi/install.c:1.13	3 Nov 2005 19:34: 3 -0000
+++ wine/dlls/setupapi/install.c	3 Nov 2005 19:34: 3 -0000
@@ -906,14 +906,23 @@ BOOL WINAPI SetupInstallFromInfSectionW(
  */
 void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show )
 {
-    WCHAR *p, *path, section[MAX_PATH];
+#ifdef __i386__
+    static const WCHAR nt_platformW[] = {'.','n','t','x','8','6',0};
+#elif defined(__x86_64)
+    static const WCHAR nt_platformW[] = {'.','n','t','i','a','6','4',0};
+#else  /* FIXME: other platforms */
+    static const WCHAR nt_platformW[] = {'.','n','t',0};
+#endif
+    static const WCHAR nt_genericW[] = {'.','n','t',0};
+
+    WCHAR *p, *path, section[MAX_PATH + sizeof(nt_platformW)/sizeof(WCHAR)];
     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) );
+    lstrcpynW( section, cmdline, MAX_PATH );
 
     if (!(p = strchrW( section, ' ' ))) return;
     *p++ = 0;
@@ -927,6 +936,22 @@ void WINAPI InstallHinfSectionW( HWND hw
     hinf = SetupOpenInfFileW( path, NULL, INF_STYLE_WIN4, NULL );
     if (hinf == INVALID_HANDLE_VALUE) return;
 
+    if (!(GetVersion() & 0x80000000))
+    {
+        INFCONTEXT context;
+
+        /* check for <section>.ntx86 (or corresponding name for the current platform)
+         * and then <section>.nt */
+        p = section + strlenW(section);
+        memcpy( p, nt_platformW, sizeof(nt_platformW) );
+        if (!(SetupFindFirstLineW( hinf, section, NULL, &context )))
+        {
+            memcpy( p, nt_genericW, sizeof(nt_genericW) );
+            if (!(SetupFindFirstLineW( hinf, section, NULL, &context ))) *p = 0;
+        }
+        if (*p) TRACE( "using section %s instead\n", debugstr_w(section) );
+    }
+
     callback_context = SetupInitDefaultQueueCallback( hwnd );
     SetupInstallFromInfSectionW( hwnd, hinf, section, SPINST_ALL, NULL, NULL, SP_COPY_NEWER,
                                  SetupDefaultQueueCallbackW, callback_context,



More information about the wine-cvs mailing list