Import and merge Wine-20041201
Added: trunk/reactos/lib/shlwapi/
Added: trunk/reactos/lib/shlwapi/Makefile.ros-template
Added: trunk/reactos/lib/shlwapi/makefile
Modified: trunk/reactos/lib/shlwapi/ordinal.c
Modified: trunk/reactos/lib/shlwapi/path.c
Modified: trunk/reactos/lib/shlwapi/shlwapi.spec
Modified: trunk/reactos/lib/shlwapi/string.c
Modified: trunk/reactos/lib/shlwapi/url.c

Copied: trunk/reactos/lib/shlwapi (from rev 12609, vendor/wine/dlls/shlwapi/current)

Added: trunk/reactos/lib/shlwapi/Makefile.ros-template
--- vendor/wine/dlls/shlwapi/current/Makefile.ros-template	2004-12-31 16:10:48 UTC (rev 12609)
+++ trunk/reactos/lib/shlwapi/Makefile.ros-template	2004-12-31 16:12:23 UTC (rev 12613)
@@ -0,0 +1,22 @@
+# $Id: Makefile.ros-template 11910 2004-12-03 23:37:44Z blight $
+
+TARGET_NAME = shlwapi
+
+TARGET_OBJECTS = @C_SRCS@
+
+TARGET_CFLAGS = -DWINSHLWAPI= -D__REACTOS__ @EXTRADEFS@
+
+# FIXME: we don't do delayed imports yet so oleaut32.a is listed explicitly
+# NOTE: msvcrt.a must be listed before ntdll.a, because sprintf that is
+#       exported from ntdll doesn't support printing of float types (%f)
+TARGET_SDKLIBS = msvcrt.a @IMPORTS@ oleaut32.a wine.a wine_uuid.a wine_unicode.a msvcrt.a ntdll.a
+
+TARGET_NORC = yes
+
+TARGET_BASE = $(TARGET_BASE_LIB_SHLWAPI)
+
+default: all
+
+DEP_OBJECTS = $(TARGET_OBJECTS)
+
+include $(TOOLS_PATH)/depend.mk

Added: trunk/reactos/lib/shlwapi/makefile
--- vendor/wine/dlls/shlwapi/current/makefile	2004-12-31 16:10:48 UTC (rev 12609)
+++ trunk/reactos/lib/shlwapi/makefile	2004-12-31 16:12:23 UTC (rev 12613)
@@ -0,0 +1,9 @@
+# $Id: makefile 7409 2004-01-02 19:49:47Z gvg $
+
+PATH_TO_TOP = ../..
+
+TARGET_TYPE = winedll
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk

Modified: trunk/reactos/lib/shlwapi/ordinal.c
--- vendor/wine/dlls/shlwapi/current/ordinal.c	2004-12-31 16:10:48 UTC (rev 12609)
+++ trunk/reactos/lib/shlwapi/ordinal.c	2004-12-31 16:12:23 UTC (rev 12613)
@@ -1549,16 +1549,17 @@
         LPVOID *p2)       /* [out]  ptr for call results */
 {
     DWORD ret, aa;
+    IUnknown *iobjectwithsite;
 
     if (!p1) return E_FAIL;
 
     /* see if SetSite interface exists for IObjectWithSite object */
-    ret = IUnknown_QueryInterface((IUnknown *)p1, (REFIID)id1, (LPVOID *)&p1);
-    TRACE("first IU_QI ret=%08lx, p1=%p\n", ret, p1);
+    ret = IUnknown_QueryInterface((IUnknown *)p1, (REFIID)id1, (LPVOID *)&iobjectwithsite);
+    TRACE("first IU_QI ret=%08lx, iobjectwithsite=%p\n", ret, iobjectwithsite);
     if (ret) {
 
 	/* see if GetClassId interface exists for IPersistMoniker object */
-	ret = IUnknown_QueryInterface((IUnknown *)p1, (REFIID)id2, (LPVOID *)&aa);
+	ret = IUnknown_QueryInterface(p1, (REFIID)id2, (LPVOID *)&aa);
 	TRACE("second IU_QI ret=%08lx, aa=%08lx\n", ret, aa);
 	if (ret) return ret;
 
@@ -1570,10 +1571,10 @@
     }
     else {
 	/* fake a SetSite call */
-	ret = IOleWindow_GetWindow((IOleWindow *)p1, (HWND*)p2);
+	ret = IOleWindow_GetWindow((IOleWindow *)iobjectwithsite, (HWND*)p2);
 	TRACE("first IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret,
 	      *(LPDWORD)p2);
-	IUnknown_Release((IUnknown *)p1);
+	IUnknown_Release((IUnknown *)iobjectwithsite);
     }
     return ret;
 }

Modified: trunk/reactos/lib/shlwapi/path.c
--- vendor/wine/dlls/shlwapi/current/path.c	2004-12-31 16:10:48 UTC (rev 12609)
+++ trunk/reactos/lib/shlwapi/path.c	2004-12-31 16:12:23 UTC (rev 12613)
@@ -3989,3 +3989,101 @@
     return S_OK;
   return E_FAIL;
 }
+
+#define PATH_CHAR_CLASS_LETTER      0x0001
+#define PATH_CHAR_CLASS_ASTERIX     0x0002
+#define PATH_CHAR_CLASS_DOT         0x0004
+#define PATH_CHAR_CLASS_BACKSLASH   0x0008
+#define PATH_CHAR_CLASS_COLON       0x0010
+#define PATH_CHAR_CLASS_SEMICOLON   0x0020
+#define PATH_CHAR_CLASS_COMMA       0x0040
+#define PATH_CHAR_CLASS_SPACE       0x0080
+#define PATH_CHAR_CLASS_OTHER_VALID 0x0100
+#define PATH_CHAR_CLASS_DOUBLEQUOTE 0x0200
+
+/*************************************************************************
+ * PathIsValidCharAW     [internal]
+ *
+ * Check if a char is of a certain class
+ */
+static BOOL WINAPI PathIsValidCharAW(unsigned Ch, DWORD Class)
+{
+  static struct
+  {
+    char Ch;
+    DWORD Class;
+  } CharClass[] =
+  {
+    { ' ', PATH_CHAR_CLASS_SPACE },
+    { '!', PATH_CHAR_CLASS_OTHER_VALID },
+    { '"', PATH_CHAR_CLASS_DOUBLEQUOTE },
+    { '#', PATH_CHAR_CLASS_OTHER_VALID },
+    { '$', PATH_CHAR_CLASS_OTHER_VALID },
+    { '%', PATH_CHAR_CLASS_OTHER_VALID },
+    { '&', PATH_CHAR_CLASS_OTHER_VALID },
+    { '\'', PATH_CHAR_CLASS_OTHER_VALID },
+    { '(', PATH_CHAR_CLASS_OTHER_VALID },
+    { ')', PATH_CHAR_CLASS_OTHER_VALID },
+    { '*', PATH_CHAR_CLASS_ASTERIX },
+    { '+', PATH_CHAR_CLASS_OTHER_VALID },
+    { ',', PATH_CHAR_CLASS_COMMA },
+    { '-', PATH_CHAR_CLASS_OTHER_VALID },
+    { '.', PATH_CHAR_CLASS_DOT },
+    { ':', PATH_CHAR_CLASS_COLON },
+    { ';', PATH_CHAR_CLASS_SEMICOLON },
+    { '=', PATH_CHAR_CLASS_OTHER_VALID },
+    { '?', PATH_CHAR_CLASS_LETTER },
+    { '@', PATH_CHAR_CLASS_OTHER_VALID },
+    { '[', PATH_CHAR_CLASS_OTHER_VALID },
+    { '\\', PATH_CHAR_CLASS_BACKSLASH },
+    { ']', PATH_CHAR_CLASS_OTHER_VALID },
+    { '^', PATH_CHAR_CLASS_OTHER_VALID },
+    { '_', PATH_CHAR_CLASS_OTHER_VALID },
+    { '`', PATH_CHAR_CLASS_OTHER_VALID },
+    { '{', PATH_CHAR_CLASS_OTHER_VALID },
+    { '}', PATH_CHAR_CLASS_OTHER_VALID },
+    { '~', PATH_CHAR_CLASS_OTHER_VALID },
+    { 0x7f, PATH_CHAR_CLASS_OTHER_VALID }
+  };
+  unsigned Index;
+
+  if (('A' <= Ch && Ch <= 'Z') || ('a' <= Ch && Ch <= 'z'))
+  {
+    return (Class & PATH_CHAR_CLASS_LETTER);
+  }
+
+  if (('0' <= Ch && Ch <= '9') || 0x80 <= Ch)
+  {
+    return (Class & PATH_CHAR_CLASS_OTHER_VALID);
+  }
+
+  for (Index = 0; Index < sizeof(CharClass) / sizeof(CharClass[0]); Index++)
+  {
+    if (Ch == CharClass[Index].Ch)
+    {
+      return (Class & CharClass[Index].Class);
+    }
+  }
+
+  return FALSE;
+}
+
+/*************************************************************************
+ * @     [SHLWAPI.455]
+ *
+ * Check if an Ascii char is of a certain class
+ */
+BOOL WINAPI PathIsValidCharA(char Ch, DWORD Class)
+{
+  return PathIsValidCharAW((unsigned) Ch, Class);
+}
+
+/*************************************************************************
+ * @     [SHLWAPI.456]
+ *
+ * Check if an Unicode char is of a certain class
+ */
+BOOL WINAPI PathIsValidCharW(WCHAR Ch, DWORD Class)
+{
+  return PathIsValidCharAW((unsigned) Ch, Class);
+}

Modified: trunk/reactos/lib/shlwapi/shlwapi.spec
--- vendor/wine/dlls/shlwapi/current/shlwapi.spec	2004-12-31 16:10:48 UTC (rev 12609)
+++ trunk/reactos/lib/shlwapi/shlwapi.spec	2004-12-31 16:12:23 UTC (rev 12613)
@@ -368,9 +368,9 @@
 368 stdcall @(wstr wstr ptr long wstr) kernel32.GetPrivateProfileStructW
 369 stdcall @(wstr wstr ptr ptr long long ptr wstr ptr ptr) kernel32.CreateProcessW
 370 stdcall -noname ExtractIconWrapW(long wstr long)
-371 stdcall -noname DdeInitializeWrapW(ptr ptr long long) user32.DdeInitializeW
-372 stdcall -noname DdeCreateStringHandleWrapW(long ptr long) user32.DdeCreateStringHandleW
-373 stdcall -noname DdeQueryStringWrapW(long ptr wstr long long) user32.DdeQueryStringW
+371 stdcall DdeInitializeWrapW(ptr ptr long long) user32.DdeInitializeW
+372 stdcall DdeCreateStringHandleWrapW(long ptr long) user32.DdeCreateStringHandleW
+373 stdcall DdeQueryStringWrapW(long ptr wstr long long) user32.DdeQueryStringW
 374 stub -noname SHCheckDiskForMediaA
 375 stub -noname SHCheckDiskForMediaW
 376 stdcall -noname MLGetUILanguage()  # kernel32.GetUserDefaultUILanguage
@@ -389,7 +389,7 @@
 389 stdcall -noname GetSaveFileNameWrapW(ptr)
 390 stdcall -noname WNetRestoreConnectionWrapW(long wstr)
 391 stdcall -noname WNetGetLastErrorWrapW(ptr ptr long ptr long)
-392 stdcall -noname EndDialogWrap(ptr ptr) user32.EndDialog
+392 stdcall EndDialogWrap(ptr ptr) user32.EndDialog
 393 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamW
 394 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamA
 395 stub -noname MLWinHelpA
@@ -452,12 +452,12 @@
 452 stub -noname CharUpperNoDBCSW
 453 stub -noname CharLowerNoDBCSA
 454 stub -noname CharLowerNoDBCSW
-455 stub -noname PathIsValidCharA
-456 stub -noname PathIsValidCharW
+455 stdcall -noname PathIsValidCharA(long long)
+456 stdcall -noname PathIsValidCharW(long long)
 457 stub -noname GetLongPathNameWrapW
 458 stub -noname GetLongPathNameWrapA
-459 stdcall -noname SHExpandEnvironmentStringsA(str ptr long) kernel32.ExpandEnvironmentStringsA
-460 stdcall -noname SHExpandEnvironmentStringsW(wstr ptr long) kernel32.ExpandEnvironmentStringsW
+459 stdcall SHExpandEnvironmentStringsA(str ptr long) kernel32.ExpandEnvironmentStringsA
+460 stdcall SHExpandEnvironmentStringsW(wstr ptr long) kernel32.ExpandEnvironmentStringsW
 461 stdcall -noname SHGetAppCompatFlags(long)
 462 stub -noname UrlFixupW
 463 stub -noname SHExpandEnvironmentStringsForUserA

Modified: trunk/reactos/lib/shlwapi/string.c
--- vendor/wine/dlls/shlwapi/current/string.c	2004-12-31 16:10:48 UTC (rev 12609)
+++ trunk/reactos/lib/shlwapi/string.c	2004-12-31 16:12:23 UTC (rev 12613)
@@ -528,7 +528,7 @@
 {
   TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
 
-  return SHLWAPI_StrStrHelperW(lpszStr, lpszSearch, strncmpW);
+  return SHLWAPI_StrStrHelperW(lpszStr, lpszSearch, (int (*)(LPCWSTR,LPCWSTR,int))wcsncmp);
 }
 
 /*************************************************************************
@@ -637,7 +637,7 @@
 {
   TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
 
-  return SHLWAPI_StrStrHelperW(lpszStr, lpszSearch, strncmpiW);
+  return SHLWAPI_StrStrHelperW(lpszStr, lpszSearch, (int (*)(LPCWSTR,LPCWSTR,int))_wcsnicmp);
 }
 
 /*************************************************************************

Modified: trunk/reactos/lib/shlwapi/url.c
--- vendor/wine/dlls/shlwapi/current/url.c	2004-12-31 16:10:48 UTC (rev 12609)
+++ trunk/reactos/lib/shlwapi/url.c	2004-12-31 16:12:23 UTC (rev 12613)
@@ -1347,8 +1347,8 @@
  *  Success: TRUE. lpDest is filled with the computed hash value.
  *  Failure: FALSE, if any argument is invalid.
  */
-HRESULT WINAPI HashData(const unsigned char *lpSrc, DWORD nSrcLen,
-                     unsigned char *lpDest, DWORD nDestLen)
+HRESULT WINAPI HashData(LPBYTE lpSrc, DWORD nSrcLen,
+                     LPBYTE lpDest, DWORD nDestLen)
 {
   INT srcCount = nSrcLen - 1, destCount = nDestLen - 1;