Alexandre Julliard : setupapi: Add a few more dirids.

Alexandre Julliard julliard at winehq.org
Wed Nov 11 15:31:42 CST 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 11 11:02:34 2020 +0100

setupapi: Add a few more dirids.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/dirid.c | 50 ++++++++++++++++++++++----------------------------
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/dlls/setupapi/dirid.c b/dlls/setupapi/dirid.c
index d1bffe9d01e..ec263d9f181 100644
--- a/dlls/setupapi/dirid.c
+++ b/dlls/setupapi/dirid.c
@@ -56,14 +56,13 @@ static const WCHAR *csidl_dirids[MAX_CSIDL_DIRID-MIN_CSIDL_DIRID+1];
 static const WCHAR *get_unknown_dirid(void)
 {
     static WCHAR *unknown_dirid;
-    static const WCHAR unknown_str[] = {'\\','u','n','k','n','o','w','n',0};
 
     if (!unknown_dirid)
     {
-        UINT len = GetSystemDirectoryW( NULL, 0 ) + lstrlenW(unknown_str);
+        UINT len = GetSystemDirectoryW( NULL, 0 ) + lstrlenW(L"\\unknown");
         if (!(unknown_dirid = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
         GetSystemDirectoryW( unknown_dirid, len );
-        lstrcatW( unknown_dirid, unknown_str );
+        lstrcatW( unknown_dirid, L"\\unknown" );
     }
     return unknown_dirid;
 }
@@ -73,17 +72,6 @@ static const WCHAR *get_csidl_dir(DWORD csidl);
 /* create the string for a system dirid */
 static const WCHAR *create_system_dirid( int dirid )
 {
-    static const WCHAR Null[]    = {0};
-    static const WCHAR C_Root[]  = {'C',':','\\',0};
-    static const WCHAR Drivers[] = {'\\','d','r','i','v','e','r','s',0};
-    static const WCHAR Inf[]     = {'\\','i','n','f',0};
-    static const WCHAR Help[]    = {'\\','h','e','l','p',0};
-    static const WCHAR Fonts[]   = {'\\','f','o','n','t','s',0};
-    static const WCHAR Viewers[] = {'\\','v','i','e','w','e','r','s',0};
-    static const WCHAR System[]  = {'\\','s','y','s','t','e','m',0};
-    static const WCHAR Spool[]   = {'\\','s','p','o','o','l',0};
-    static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0};
-
     WCHAR buffer[MAX_PATH+32], *str;
     int len;
     DWORD needed;
@@ -91,7 +79,7 @@ static const WCHAR *create_system_dirid( int dirid )
     switch(dirid)
     {
     case DIRID_NULL:
-        return Null;
+        return L"";
     case DIRID_WINDOWS:
         GetWindowsDirectoryW( buffer, MAX_PATH );
         break;
@@ -100,45 +88,52 @@ static const WCHAR *create_system_dirid( int dirid )
         break;
     case DIRID_DRIVERS:
         GetSystemDirectoryW( buffer, MAX_PATH );
-        lstrcatW( buffer, Drivers );
+        lstrcatW( buffer, L"\\drivers" );
         break;
     case DIRID_INF:
         GetWindowsDirectoryW( buffer, MAX_PATH );
-        lstrcatW( buffer, Inf );
+        lstrcatW( buffer, L"\\inf" );
         break;
     case DIRID_HELP:
         GetWindowsDirectoryW( buffer, MAX_PATH );
-        lstrcatW( buffer, Help );
+        lstrcatW( buffer, L"\\help" );
         break;
     case DIRID_FONTS:
         GetWindowsDirectoryW( buffer, MAX_PATH );
-        lstrcatW( buffer, Fonts );
+        lstrcatW( buffer, L"\\fonts" );
         break;
     case DIRID_VIEWERS:
         GetSystemDirectoryW( buffer, MAX_PATH );
-        lstrcatW( buffer, Viewers );
+        lstrcatW( buffer, L"\\viewers" );
+        break;
+    case DIRID_COLOR:
+        GetSystemDirectoryW( buffer, MAX_PATH );
+        lstrcatW( buffer, L"\\spool\\drivers\\color" );
         break;
     case DIRID_APPS:
-        return C_Root;  /* FIXME */
+        return L"C:\\";  /* FIXME */
     case DIRID_SHARED:
         GetWindowsDirectoryW( buffer, MAX_PATH );
         break;
     case DIRID_BOOT:
-        return C_Root;  /* FIXME */
+        return L"C:\\";  /* FIXME */
     case DIRID_SYSTEM16:
         GetWindowsDirectoryW( buffer, MAX_PATH );
-        lstrcatW( buffer, System );
+        lstrcatW( buffer, L"\\system" );
         break;
     case DIRID_SPOOL:
-    case DIRID_SPOOLDRIVERS:  /* FIXME */
         GetWindowsDirectoryW( buffer, MAX_PATH );
-        lstrcatW( buffer, Spool );
+        lstrcatW( buffer, L"\\spool" );
+        break;
+    case DIRID_SPOOLDRIVERS:
+        GetWindowsDirectoryW( buffer, MAX_PATH );
+        lstrcatW( buffer, L"\\spool\\drivers" );
         break;
     case DIRID_USERPROFILE:
-        if (GetEnvironmentVariableW( UserProfile, buffer, MAX_PATH )) break;
+        if (GetEnvironmentVariableW( L"USERPROFILE", buffer, MAX_PATH )) break;
         return get_csidl_dir(CSIDL_PROFILE);
     case DIRID_LOADER:
-        return C_Root;  /* FIXME */
+        return L"C:\\";  /* FIXME */
     case DIRID_PRINTPROCESSOR:
         if (!GetPrintProcessorDirectoryW(NULL, NULL, 1, (LPBYTE)buffer, sizeof(buffer), &needed))
         {
@@ -146,7 +141,6 @@ static const WCHAR *create_system_dirid( int dirid )
             return get_unknown_dirid();
         }
         break;
-    case DIRID_COLOR:  /* FIXME */
     default:
         FIXME( "unknown dirid %d\n", dirid );
         return get_unknown_dirid();




More information about the wine-cvs mailing list