Fix compilation of shell32/tests/shellpath.c on Windows

Francois Gouget fgouget at free.fr
Fri Oct 22 11:42:01 CDT 2004


Changelog:

  * dlls/shell32/tests/shellpath.c

    Fix the function pointer declarations so MSVC likes them.
    CSIDL_PROFILES is not defined in the Windows SDK.
    snprintf and strcasecmp don't exist on Windows. Replace them with 
wnsprintfA and stricmp respectively.


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                               145 = 1! + 4! + 5!
-------------- next part --------------
Index: dlls/shell32/tests/shellpath.c
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/tests/shellpath.c,v
retrieving revision 1.1
diff -u -r1.1 shellpath.c
--- dlls/shell32/tests/shellpath.c	21 Oct 2004 19:59:46 -0000	1.1
+++ dlls/shell32/tests/shellpath.c	22 Oct 2004 12:18:22 -0000
@@ -69,14 +69,14 @@
 };
 
 static HMODULE hShell32;
-static HRESULT WINAPI (*pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
-static HRESULT WINAPI (*pSHGetFolderLocation)(HWND, int, HANDLE, DWORD,
+static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
+static HRESULT (WINAPI *pSHGetFolderLocation)(HWND, int, HANDLE, DWORD,
  LPITEMIDLIST *);
-static BOOL    WINAPI (*pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
-static HRESULT WINAPI (*pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
-static LPITEMIDLIST WINAPI (*pILFindLastID)(LPCITEMIDLIST);
-static int WINAPI (*pSHFileOperationA)(LPSHFILEOPSTRUCTA);
-static HRESULT WINAPI (*pSHGetMalloc)(LPMALLOC *);
+static BOOL    (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
+static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
+static LPITEMIDLIST (WINAPI *pILFindLastID)(LPCITEMIDLIST);
+static int (WINAPI *pSHFileOperationA)(LPSHFILEOPSTRUCTA);
+static HRESULT (WINAPI *pSHGetMalloc)(LPMALLOC *);
 static DLLVERSIONINFO shellVersion = { 0 };
 static LPMALLOC pMalloc;
 static const struct shellExpectedValues requiredShellValues[] = {
@@ -154,7 +154,7 @@
     hShell32 = LoadLibraryA("shell32");
     if (hShell32)
     {
-        HRESULT WINAPI (*pDllGetVersion)(DLLVERSIONINFO *);
+        HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO *);
 
         pSHGetFolderPathA = (void *)GetProcAddress(hShell32,
          "SHGetFolderPathA");
@@ -192,6 +192,10 @@
     }
 }
 
+#ifndef CSIDL_PROFILES
+#define CSIDL_PROFILES		0x003e
+#endif
+
 /* A couple utility printing functions */
 static const char *getFolderName(int folder)
 {
@@ -260,7 +264,7 @@
     CSIDL_TO_STR(CSIDL_COMPUTERSNEARME);
 #undef CSIDL_TO_STR
     default:
-        snprintf(unknown, sizeof(unknown), "unknown (0x%04x)", folder);
+        wnsprintfA(unknown, sizeof(unknown), "unknown (0x%04x)", folder);
         return unknown;
     }
 }
@@ -271,7 +275,7 @@
 
     if (!guid) return NULL;
 
-    snprintf(guidSTR, sizeof(guidSTR),
+    wnsprintfA(guidSTR, sizeof(guidSTR),
      "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
      guid->Data1, guid->Data2, guid->Data3,
      guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
@@ -522,7 +526,7 @@
     {
         char *envVal = getenv(envVar);
 
-        ok(!envVal || !strcasecmp(envVal, path),
+        ok(!envVal || !stricmp(envVal, path),
          "%%%s%% does not match SHGetSpecialFolderPath:\n"
          "%%%s%% is %s\nSHGetSpecialFolderPath returns %s\n",
          envVar, envVar, envVal, path);
@@ -645,7 +649,7 @@
         PathRemoveBackslashA(windowsShellPath);
         GetWindowsDirectoryA(windowsDir, sizeof(windowsDir));
         PathRemoveBackslashA(windowsDir);
-        ok(!strcasecmp(windowsDir, windowsShellPath),
+        ok(!stricmp(windowsDir, windowsShellPath),
          "GetWindowsDirectory does not match SHGetSpecialFolderPath:\n"
          "GetWindowsDirectory returns %s\nSHGetSpecialFolderPath returns %s\n",
          windowsDir, windowsShellPath);
@@ -667,7 +671,7 @@
     if (pSHGetSpecialFolderPathA(NULL, systemShellPath, CSIDL_SYSTEM, FALSE))
     {
         PathRemoveBackslashA(systemShellPath);
-        ok(!strcasecmp(systemDir, systemShellPath),
+        ok(!stricmp(systemDir, systemShellPath),
          "GetSystemDirectory does not match SHGetSpecialFolderPath:\n"
          "GetSystemDirectory returns %s\nSHGetSpecialFolderPath returns %s\n",
          systemDir, systemShellPath);
@@ -678,7 +682,7 @@
     if (pSHGetSpecialFolderPathA(NULL, systemShellPath, CSIDL_SYSTEMX86, FALSE))
     {
         PathRemoveBackslashA(systemShellPath);
-        ok(!strcasecmp(systemDir, systemShellPath),
+        ok(!stricmp(systemDir, systemShellPath),
          "GetSystemDirectory does not match SHGetSpecialFolderPath:\n"
          "GetSystemDirectory returns %s\nSHGetSpecialFolderPath returns %s\n",
          systemDir, systemShellPath);
@@ -824,7 +828,7 @@
                 PROCESS_INFORMATION info;
                 HRESULT hr;
 
-                snprintf(buffer, sizeof(buffer), "%s tests/shellpath.c 1",
+                wnsprintfA(buffer, sizeof(buffer), "%s tests/shellpath.c 1",
                  selfname);
                 memset(&startup, 0, sizeof(startup));
                 startup.cb = sizeof(startup);
@@ -847,7 +851,7 @@
                  strlen(originalPath) + 1);
                 RegFlushKey(key);
 
-                snprintf(buffer, sizeof(buffer), "%s tests/shellpath.c 2",
+                wnsprintfA(buffer, sizeof(buffer), "%s tests/shellpath.c 2",
                  selfname);
                 memset(&startup, 0, sizeof(startup));
                 startup.cb = sizeof(startup);


More information about the wine-patches mailing list