shell32/shlwapi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dlls/shell32/Makefile.in
new file debughlp.c

moving the pidl-debug-functions to a separate file and made them self 
contained. This prevents useless trace-messages generated from the 
debugfunctions itself.

dlls/shlwapi/reg.c
reimplemented SHRegGetPathA/W, SHGetValueA/W, 
SHRegGetPathA/W


---
juergen.schmied@debitel.net



Index: wine/dlls/shell32/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/shell32/Makefile.in,v
retrieving revision 1.44
diff -d -u -r1.44 Makefile.in
--- wine/dlls/shell32/Makefile.in	20 Mar 2002 22:19:09 -0000	1.44
+++ wine/dlls/shell32/Makefile.in	7 May 2002 18:58:22 -0000
@@ -17,6 +17,7 @@
 	clipboard.c \
 	control.c \
 	dataobject.c \
+	debughlp.c \
 	dialogs.c \
 	enumidlist.c \
 	folders.c \
@@ -47,4 +48,5 @@
 @MAKE_DLL_RULES@
 
 ### Dependencies:
+
 
Index: wine/dlls/shell32/pidl.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.c,v
retrieving revision 1.69
diff -d -u -r1.69 pidl.c
--- wine/dlls/shell32/pidl.c	3 Apr 2002 22:52:52 -0000	1.69
+++ wine/dlls/shell32/pidl.c	7 May 2002 18:58:24 -0000
@@ -36,108 +36,12 @@
 #include "shlwapi.h"
 
 #include "pidl.h"
+#include "debughlp.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(pidl);
 WINE_DECLARE_DEBUG_CHANNEL(shell);
 
-void pdump (LPCITEMIDLIST pidl)
-{
-	LPITEMIDLIST pidltemp = pidl;
-	if (!TRACE_ON(pidl))
-	  return;
-
-	if (! pidltemp)
-	{
-	  MESSAGE ("-------- pidl=NULL (Desktop)\n");
-	}
-	else
-	{
-	  MESSAGE ("-------- pidl=%p\n", pidl);
-	  if (pidltemp->mkid.cb)
-	  { 
-	    do
-	    {
-	      DWORD dwAttrib = 0;
-	      LPPIDLDATA pData   = _ILGetDataPointer(pidltemp);
-	      DWORD type         = pData->type;
-	      LPSTR szLongName   = _ILGetTextPointer(pidltemp);
-	      LPSTR szShortName  = _ILGetSTextPointer(pidltemp);
-	      char szName[MAX_PATH];
-
-	      _ILSimpleGetText(pidltemp, szName, MAX_PATH);
-	      if( PT_FOLDER == type)
-	        dwAttrib = pData->u.folder.uFileAttribs;
-	      else if( PT_VALUE == type)
-	        dwAttrib = pData->u.file.uFileAttribs;
-
-	      MESSAGE ("-- pidl=%p size=%u type=%lx attr=0x%08lx name=%s (%s,%s)\n",
-	               pidltemp, pidltemp->mkid.cb,type,dwAttrib,szName,debugstr_a(szLongName), debugstr_a(szShortName));
-
-	      pidltemp = ILGetNext(pidltemp);
-
-	    } while (pidltemp->mkid.cb);
-	  }
-	  else
-	  {
-	    MESSAGE ("empty pidl (Desktop)\n");
-	  }
-	  pcheck(pidl);
-	}
-}
-#define BYTES_PRINTED 32
-BOOL pcheck (LPCITEMIDLIST pidl)
-{
-        DWORD type, ret=TRUE;
-        LPITEMIDLIST pidltemp = pidl;
-
-        if (pidltemp && pidltemp->mkid.cb)
-        { do
-          { type   = _ILGetDataPointer(pidltemp)->type;
-            switch (type)
-	    { case PT_DESKTOP:
-	      case PT_MYCOMP:
-	      case PT_SPECIAL:
-	      case PT_DRIVE:
-	      case PT_DRIVE1:
-	      case PT_DRIVE2:
-	      case PT_DRIVE3:
-	      case PT_FOLDER:
-	      case PT_VALUE:
-	      case PT_FOLDER1:
-	      case PT_WORKGRP:
-	      case PT_COMP:
-	      case PT_NETWORK:
-	      case PT_IESPECIAL1:
-	      case PT_IESPECIAL2:
-	      case PT_SHARE:
-		break;
-	      default:
-	      {
-		char szTemp[BYTES_PRINTED*4 + 1];
-		int i;
-		unsigned char c;
-
-		memset(szTemp, ' ', BYTES_PRINTED*4 + 1);
-		for ( i = 0; (i<pidltemp->mkid.cb) && (i<BYTES_PRINTED); i++)
-		{
-		  c = ((unsigned char *)pidltemp)[i];
-
-		  szTemp[i*3+0] = ((c>>4)>9)? (c>>4)+55 : (c>>4)+48;
-		  szTemp[i*3+1] = ((0x0F&c)>9)? (0x0F&c)+55 : (0x0F&c)+48;
-		  szTemp[i*3+2] = ' ';
-		  szTemp[i+BYTES_PRINTED*3]  =  (c>=0x20 && c <=0x80) ? c : '.';
-		}
-		szTemp[BYTES_PRINTED*4] = 0x00;
-		ERR("unknown IDLIST type size=%u type=%lx\n%s\n",pidltemp->mkid.cb,type, szTemp);
-		ret = FALSE;
-	      }
-	    }
-	    pidltemp = ILGetNext(pidltemp);
-	  } while (pidltemp->mkid.cb);
-	}
-	return ret;
-}
 
 /*************************************************************************
  * ILGetDisplayName			[SHELL32.15]
@@ -1880,3 +1784,5 @@
 
 	return dst;
 }
+
+
Index: wine/dlls/shlwapi/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/Makefile.in,v
retrieving revision 1.12
diff -d -u -r1.12 Makefile.in
--- wine/dlls/shlwapi/Makefile.in	20 Mar 2002 22:19:09 -0000	1.12
+++ wine/dlls/shlwapi/Makefile.in	7 May 2002 18:58:25 -0000
@@ -18,7 +18,14 @@
 	string.c \
 	url.c
 
+EXTRASUBDIRS = \
+        tests
+
+CTESTS = \
+        tests/shreg.c
+
 @MAKE_DLL_RULES@
 
 ### Dependencies:
+
 
Index: wine/dlls/shlwapi/ordinal.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/ordinal.c,v
retrieving revision 1.38
diff -d -u -r1.38 ordinal.c
--- wine/dlls/shlwapi/ordinal.c	3 Apr 2002 02:43:03 -0000	1.38
+++ wine/dlls/shlwapi/ordinal.c	7 May 2002 18:58:29 -0000
@@ -2,7 +2,7 @@
  * SHLWAPI ordinal functions
  *
  * Copyright 1997 Marcus Meissner
- *           1998 Jrgen Schmied
+ *           1998 Jrgen Schmied
  *           2001 Jon Griffiths
  *
  * This library is free software; you can redistribute it and/or
@@ -1213,6 +1213,17 @@
 }
 
 /*************************************************************************
+ *      @	[SHLWAPI.175]
+ *
+ *	NOTE:
+ *	  Param1 can be an IShellFolder Object
+ */
+HRESULT WINAPI SHLWAPI_175 (LPVOID x, LPVOID y)
+{
+	FIXME("(%p %p) stub\n", x,y);
+	return E_FAIL;
+}
+/*************************************************************************
  *      @	[SHLWAPI.176]
  *
  * Function appears to be interface to IServiceProvider::QueryService
@@ -2463,3 +2474,4 @@
     TlsSetValue(SHLWAPI_ThreadRef_index, (LPVOID) punk);
     return S_OK;
 }
+
Index: wine/dlls/shlwapi/reg.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/reg.c,v
retrieving revision 1.24
diff -d -u -r1.24 reg.c
--- wine/dlls/shlwapi/reg.c	9 Mar 2002 23:44:30 -0000	1.24
+++ wine/dlls/shlwapi/reg.c	7 May 2002 18:58:32 -0000
@@ -34,8 +34,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
-typedef DWORD (WINAPI *RegQueryFn)(HKEY,LPCVOID,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
-
 static const char *lpszContentTypeA = "Content Type";
 static const WCHAR lpszContentTypeW[] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0'};
 
@@ -727,24 +725,12 @@
 DWORD WINAPI SHRegGetPathA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
                            LPSTR lpszPath, DWORD dwFlags)
 {
-  HKEY hSubKey;
-  DWORD dwType = REG_SZ, dwSize = MAX_PATH, dwRet = ERROR_SUCCESS;
+  DWORD dwSize = MAX_PATH;
 
   TRACE("(hkey=0x%08x,%s,%s,%p,%ld)\n", hKey, debugstr_a(lpszSubKey),
         debugstr_a(lpszValue), lpszPath, dwFlags);
 
-  if (lpszSubKey && *lpszSubKey)
-    dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
-  else
-    hSubKey = hKey;
-
-  if (!dwRet)
-    dwRet = SHQueryValueExA(hSubKey, lpszValue, NULL, &dwType, lpszPath, &dwSize);
-
-  if (hSubKey != hKey)
-    RegCloseKey(hSubKey);
-
-  return dwRet;
+  return SHGetValueA(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
 }
 
 /*************************************************************************
@@ -755,24 +741,12 @@
 DWORD WINAPI SHRegGetPathW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
                            LPWSTR lpszPath, DWORD dwFlags)
 {
-  HKEY hSubKey;
-  DWORD dwType = REG_SZ, dwSize = MAX_PATH, dwRet = ERROR_SUCCESS;
+  DWORD dwSize = MAX_PATH;
 
   TRACE("(hkey=0x%08x,%s,%s,%p,%ld)\n", hKey, debugstr_w(lpszSubKey),
         debugstr_w(lpszValue), lpszPath, dwFlags);
 
-  if (lpszSubKey && *lpszSubKey)
-    dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
-  else
-    hSubKey = hKey;
-
-  if (!dwRet)
-    dwRet = SHQueryValueExW(hSubKey, lpszValue, NULL, &dwType, lpszPath, &dwSize);
-
-  if (hSubKey != hKey)
-    RegCloseKey(hSubKey);
-
-  return dwRet;
+  return SHGetValueW(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
 }
 
 
@@ -844,22 +818,28 @@
  *
  * RETURNS
  *   Success: ERROR_SUCCESS. Output parameters contain the details read.
- *   Failure: An error code from RegOpenKeyExA or RegQueryValueExA.
+ *   Failure: An error code from RegOpenKeyExA or SHQueryValueExA.
  */
 DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
                          LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 {
-  DWORD dwRet;
-  HKEY hSubKey;
+  DWORD dwRet = 0;
+  HKEY hSubKey = 0;
 
   TRACE("(hkey=0x%08x,%s,%s,%p,%p,%p)\n", hKey, debugstr_a(lpszSubKey),
         debugstr_a(lpszValue), pwType, pvData, pcbData);
 
-  dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
-  if (!dwRet)
+  /*   lpszSubKey can be 0. In this case the value is taken from the
+   *   current key.
+   */
+  if(lpszSubKey) 
+    dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
+
+  if (! dwRet)
   {
-    dwRet = RegQueryValueExA(hSubKey, lpszValue, 0, pwType, pvData, pcbData);
-    RegCloseKey(hSubKey);
+    /* SHQueryValueEx expands Environment strings */
+    dwRet = SHQueryValueExA(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
+    if (hSubKey) RegCloseKey(hSubKey);
   }
   return dwRet;
 }
@@ -872,17 +852,19 @@
 DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
                          LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 {
-  DWORD dwRet;
-  HKEY hSubKey;
+  DWORD dwRet = 0;
+  HKEY hSubKey = 0;
 
   TRACE("(hkey=0x%08x,%s,%s,%p,%p,%p)\n", hKey, debugstr_w(lpszSubKey),
         debugstr_w(lpszValue), pwType, pvData, pcbData);
 
-  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
-  if (!dwRet)
+  if(lpszSubKey) 
+    dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
+
+  if (! dwRet)
   {
-    dwRet = RegQueryValueExW(hSubKey, lpszValue, 0, pwType, pvData, pcbData);
-    RegCloseKey(hSubKey);
+    dwRet = SHQueryValueExW(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
+    if (hSubKey) RegCloseKey(hSubKey);
   }
   return dwRet;
 }
@@ -990,86 +972,67 @@
                           NULL, pwValues, pwValueMax, NULL, NULL, NULL);
 }
 
-/*************************************************************************
- * SHQueryValueExAW
- *
- * Internal implementation of SHQueryValueExA/SHQueryValueExW.
- */
-static DWORD WINAPI SHQueryValueExAW(RegQueryFn pfn,
-                                     HKEY hKey, LPCVOID lpszValue,
-                                     LPDWORD lpReserved, LPDWORD pwType,
-                                     LPBYTE pvData, LPDWORD pcbData)
-{
+/*
   DWORD dwRet, dwType, dwDataLen;
 
-  if (pcbData)
-    dwDataLen = *pcbData;
+  FIXME("(hkey=0x%08x,%s,%p,%p,%p,%p=%ld)\n", hKey, debugstr_a(lpszValue),
+        lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
 
-  dwRet = pfn(hKey, lpszValue, lpReserved, &dwType, pvData, &dwDataLen);
+  if (pcbData) dwDataLen = *pcbData;
+
+  dwRet = RegQueryValueExA(hKey, lpszValue, lpReserved, &dwType, pvData, &dwDataLen);
   if (!dwRet)
   {
     if (dwType == REG_EXPAND_SZ)
     {
-      /* Expand type REG_EXPAND_SZ into REG_SZ */
       LPSTR szExpand;
       LPBYTE pData = pvData;
 
       if (!pData)
       {
-        /* Create a buffer to hold the data, to get the size */
-        if (!pcbData ||
-            !(pData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *pcbData)))
+        if (!pcbData || !(pData = (LPBYTE) LocalAlloc(GMEM_ZEROINIT, *pcbData)))
           return ERROR_OUTOFMEMORY;
-        /* Read the data in to the buffer */
-        if ((dwRet = pfn(hKey, lpszValue, lpReserved, &dwType,
-                         pData, &dwDataLen)))
+
+        if ((dwRet = RegQueryValueExA (hKey, lpszValue, lpReserved, &dwType, pData, &dwDataLen)))
           return dwRet;
       }
 
       if (!pcbData && pData != pvData)
       {
-        /* Note: In this case the caller will crash under Win32 */
         WARN("Invalid pcbData would crash under Win32!");
         return ERROR_OUTOFMEMORY;
       }
 
-      szExpand = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *pcbData);
+      szExpand = (LPBYTE) LocalAlloc(GMEM_ZEROINIT, *pcbData);
       if (!szExpand)
       {
-        if (pData != pvData)
-          HeapFree(GetProcessHeap(), 0, pData);
+        if ( pData != pvData ) LocalFree((HLOCAL)pData);
         return ERROR_OUTOFMEMORY;
       }
-      if ((ExpandEnvironmentStringsA(pvData, szExpand, *pcbData) <= 0))
+      if ((ExpandEnvironmentStringsA(pvData, szExpand, *pcbData) > 0))
       {
         dwDataLen = strlen(szExpand) + 1;
         strncpy(pvData, szExpand, *pcbData);
       }
       else
       {
-        if (pData != pvData)
-          HeapFree(GetProcessHeap(), 0, pData);
-        HeapFree(GetProcessHeap(), 0, szExpand);
+        if ( pData != pvData ) LocalFree((HLOCAL)pData);
+        LocalFree((HLOCAL)szExpand);
         return GetLastError();
       }
-      if (pData != pvData)
-        HeapFree(GetProcessHeap(), 0, pData);
-      HeapFree(GetProcessHeap(), 0, szExpand);
+      if (pData != pvData) LocalFree((HLOCAL)pData);
+      LocalFree((HLOCAL)szExpand);
       dwType = REG_SZ;
     }
     if (dwType == REG_SZ && pvData && pcbData && dwDataLen >= *pcbData)
     {
-      /* String type too long: truncate it */
-      pvData[*pcbData] = '\0';
+      ((LPBYTE) pvData)[*pcbData] = '\0';
     }
   }
-  /* Update the type and data size if the caller wanted them */
-  if (pwType)
-    *pwType = dwType;
-  if (pcbData)
-    *pcbData  = dwDataLen;
+  if ( pwType ) *pwType = dwType;
+  if ( pcbData ) *pcbData = dwDataLen;
   return dwRet;
-}
+*/
 
 /*************************************************************************
  * SHQueryValueExA   [SHLWAPI.@]
@@ -1078,7 +1041,7 @@
  *
  * PARAMS
  *   hKey       [I] Handle to registry key
- *   lpszValue  [I] Name of value to delete
+ *   lpszValue  [I] Name of value to query
  *   lpReserved [O] Reserved for future use; must be NULL
  *   pwType     [O] Optional pointer updated with the values type
  *   pvData     [O] Optional pointer updated with the values data
@@ -1098,18 +1061,75 @@
  *   If the type of the data is REG_EXPAND_SZ, it is expanded to REG_SZ. The
  *   value returned will be truncated if it is of type REG_SZ and bigger than
  *   the buffer given to store it.
  */
-DWORD WINAPI SHQueryValueExA(HKEY hKey, LPCSTR lpszValue,
-                             LPDWORD lpReserved, LPDWORD pwType,
-                             LPVOID pvData, LPDWORD pcbData)
+DWORD WINAPI SHQueryValueExA( HKEY hKey, LPCSTR lpszValue,
+                              LPDWORD lpReserved, LPDWORD pwType,
+                              LPVOID pvData, LPDWORD pcbData)
 {
+  DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
+
   TRACE("(hkey=0x%08x,%s,%p,%p,%p,%p=%ld)\n", hKey, debugstr_a(lpszValue),
         lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
 
-  return SHQueryValueExAW((RegQueryFn)RegQueryValueExA, hKey, lpszValue,
-                          lpReserved, pwType, pvData, pcbData);
+  if (pcbData) dwUnExpDataLen = *pcbData;
+
+  dwRet = RegQueryValueExA(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
+
+  if (pcbData && (dwType == REG_EXPAND_SZ))
+  {
+    DWORD nBytesToAlloc;
+
+    /* Expand type REG_EXPAND_SZ into REG_SZ */
+    LPSTR szData;
+
+    /* If the caller didn't supply a buffer or the buffer is to small we have
+     * to allocate our own
+     */
+    if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
+    { 
+      char cNull = '\0';
+      nBytesToAlloc = (!pvData || (dwRet == ERROR_MORE_DATA)) ? dwUnExpDataLen : *pcbData;
+
+      szData = (LPSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc);
+      RegQueryValueExA (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
+      dwExpDataLen = ExpandEnvironmentStringsA(szData, &cNull, 1);
+      dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
+      LocalFree((HLOCAL) szData);
+    }
+    else
+    {
+      nBytesToAlloc = lstrlenA(pvData) * sizeof (CHAR);
+      szData = (LPSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc + 1);
+      lstrcpyA(szData, pvData);
+      dwExpDataLen = ExpandEnvironmentStringsA(szData, pvData, *pcbData / sizeof(CHAR));
+      if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA; 
+      dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
+      LocalFree((HLOCAL) szData);
+    }
+  }
+
+  /* Update the type and data size if the caller wanted them */
+  if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
+  if ( pwType ) *pwType = dwType;
+  if ( pcbData ) *pcbData = dwUnExpDataLen;
+  return dwRet;
 }
 
+
 /*************************************************************************
  * SHQueryValueExW   [SHLWAPI.@]
  *
@@ -1119,11 +1139,53 @@
                              LPDWORD lpReserved, LPDWORD pwType,
                              LPVOID pvData, LPDWORD pcbData)
 {
+  DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
+
   TRACE("(hkey=0x%08x,%s,%p,%p,%p,%p=%ld)\n", hKey, debugstr_w(lpszValue),
         lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
 
-  return SHQueryValueExAW((RegQueryFn)RegQueryValueExW, hKey, lpszValue,
-                          lpReserved, pwType, pvData, pcbData);
+  if (pcbData) dwUnExpDataLen = *pcbData;
+
+  dwRet = RegQueryValueExW(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
+
+  if (pcbData && (dwType == REG_EXPAND_SZ))
+  {
+    DWORD nBytesToAlloc;
+
+    /* Expand type REG_EXPAND_SZ into REG_SZ */
+    LPWSTR szData;
+
+    /* If the caller didn't supply a buffer or the buffer is to small we have
+     * to allocate our own
+     */
+    if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
+    { 
+      WCHAR cNull = '\0';
+      nBytesToAlloc = (!pvData || (dwRet == ERROR_MORE_DATA)) ? dwUnExpDataLen : *pcbData;
+
+      szData = (LPWSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc);
+      RegQueryValueExW (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
+      dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
+      dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
+      LocalFree((HLOCAL) szData);
+    }
+    else
+    {
+      nBytesToAlloc = lstrlenW(pvData) * sizeof(WCHAR);
+      szData = (LPWSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc + 1);
+      lstrcpyW(szData, pvData);
+      dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, *pcbData/sizeof(WCHAR) );
+      if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA; 
+      dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
+      LocalFree((HLOCAL) szData);
+    }
+  }
+
+  /* Update the type and data size if the caller wanted them */
+  if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
+  if ( pwType ) *pwType = dwType;
+  if ( pcbData ) *pcbData = dwUnExpDataLen;
+  return dwRet;
 }
 
 /*************************************************************************
@@ -1618,3 +1680,12 @@
     TRACE("new key is %08x\n", newKey);
     return newKey;
 }
+
+
+
+
+
+
+
+
+
Index: wine/dlls/shlwapi/shlwapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/shlwapi.spec,v
retrieving revision 1.33
diff -d -u -r1.33 shlwapi.spec
--- wine/dlls/shlwapi/shlwapi.spec	23 Mar 2002 21:39:05 -0000	1.33
+++ wine/dlls/shlwapi/shlwapi.spec	7 May 2002 18:58:33 -0000
@@ -184,7 +184,7 @@
 172 stdcall @(ptr ptr) SHLWAPI_172
 173 stub @
 174 stdcall @(ptr ptr) SHLWAPI_174
-175 stub @
+175 stdcall @(ptr ptr) SHLWAPI_175
 176 stdcall @(ptr ptr ptr ptr) SHLWAPI_176
 177 stub @
 178 stub @
@@ -734,3 +734,4 @@
 @ stub    StrFormatByteSize64A
 @ stub    StrFormatKBSizeA
 @ stub    StrFormatKBSizeW
+
===================================================================
--- /dev/null	Mon Mar  4 08:42:02 2002
+++ wine/dlls/shell32/debughlp.c	Fri Mar 29 20:45:43 2002
@@ -0,0 +1,267 @@
+/*
+ *
+ * Helper functions for debugging
+ *
+ * Copyright 1998, 2002 Juergen Schmied
+ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "pidl.h"
+#include "shlguid.h"
+#include "wine/debug.h"
+#include "debughlp.h"
+
+
+WINE_DEFAULT_DEBUG_CHANNEL(pidl);
+
+LPITEMIDLIST  _dbg_ILGetNext(LPITEMIDLIST pidl)
+{
+	WORD len;
+
+	if(pidl)
+	{
+	  len =  pidl->mkid.cb;
+	  if (len)
+	  {
+	    pidl = (LPITEMIDLIST) (((LPBYTE)pidl)+len);
+	    return pidl;
+	  }
+	}
+	return NULL;
+}
+
+BOOL _dbg_ILIsDesktop(LPCITEMIDLIST pidl)
+{
+	return ( !pidl || (pidl && pidl->mkid.cb == 0x00) );
+}
+
+LPPIDLDATA _dbg_ILGetDataPointer(LPITEMIDLIST pidl)
+{
+	if(pidl && pidl->mkid.cb != 0x00)
+	  return (LPPIDLDATA) &(pidl->mkid.abID);
+	return NULL;
+}
+
+LPSTR _dbg_ILGetTextPointer(LPCITEMIDLIST pidl)
+{
+	LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
+
+	if (pdata)
+	{
+	  switch (pdata->type)
+	  {
+	    case PT_MYCOMP:
+	    case PT_SPECIAL:
+	      return NULL;
+
+	    case PT_DRIVE:
+	    case PT_DRIVE1:
+	    case PT_DRIVE2:
+	    case PT_DRIVE3:
+	      return (LPSTR)&(pdata->u.drive.szDriveName);
+
+	    case PT_FOLDER:
+	    case PT_FOLDER1:
+	    case PT_VALUE:
+	    case PT_IESPECIAL1:
+	    case PT_IESPECIAL2:
+	      return (LPSTR)&(pdata->u.file.szNames);
+
+	    case PT_WORKGRP:
+	    case PT_COMP:
+	    case PT_NETWORK:
+	    case PT_SHARE:
+	      return (LPSTR)&(pdata->u.network.szNames);
+	  }
+	}
+	return NULL;
+}
+
+LPSTR _dbg_ILGetSTextPointer(LPCITEMIDLIST pidl)
+{
+	LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
+
+	if (pdata)
+	{
+	  switch (pdata->type)
+	  {
+	    case PT_FOLDER:
+	    case PT_VALUE:
+	    case PT_IESPECIAL1:
+	    case PT_IESPECIAL2:
+	      return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1);
+
+	    case PT_WORKGRP:
+	      return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1);
+	  }
+	}
+	return NULL;
+}
+
+REFIID _dbg_ILGetGUIDPointer(LPCITEMIDLIST pidl)
+{
+	LPPIDLDATA pdata =_ILGetDataPointer(pidl);
+
+	if (pdata)
+	{
+	  switch (pdata->type)
+	  {
+	    case PT_SPECIAL:
+	    case PT_MYCOMP:
+	      return (REFIID) &(pdata->u.mycomp.guid);
+
+	    default:
+		TRACE("Unknown pidl type 0x%04x\n", pdata->type);
+		break;
+	  }
+	}
+	return NULL;
+}
+
+DWORD _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
+{
+	DWORD		dwReturn=0; 
+	LPSTR		szSrc;
+	GUID const * 	riid;
+	char szTemp[MAX_PATH];
+	
+	if (!pidl) return 0;
+
+	if (szOut)
+	  *szOut = 0;
+
+	if (_dbg_ILIsDesktop(pidl))					
+	{
+	 /* desktop */
+	  if (szOut) strncpy(szOut, "Desktop", uOutSize);
+	  dwReturn = strlen ("Desktop");
+	}
+	else if (( szSrc = _dbg_ILGetTextPointer(pidl) ))
+	{
+	  /* filesystem */
+	  if (szOut) strncpy(szOut, szSrc, uOutSize);
+	  dwReturn = strlen(szSrc);
+	}
+	else if (( riid = _dbg_ILGetGUIDPointer(pidl) ))
+	{
+	  if (szOut)
+            sprintf( szOut, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                 riid->Data1, riid->Data2, riid->Data3,
+                 riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
+                 riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
+	  dwReturn = strlen (szTemp);
+	}
+	else
+	{
+	  ERR("-- no text\n");
+	}
+	return dwReturn;
+}
+
+
+
+
+void pdump (LPCITEMIDLIST pidl)
+{
+	LPITEMIDLIST pidltemp = pidl;
+
+	if (!TRACE_ON(pidl)) return;
+
+	if (! pidltemp)
+	{
+	  MESSAGE ("-------- pidl=NULL (Desktop)\n");
+	}
+	else
+	{
+	  MESSAGE ("-------- pidl=%p\n", pidl);
+	  if (pidltemp->mkid.cb)
+	  { 
+	    do
+	    {
+	      DWORD dwAttrib = 0;
+	      LPPIDLDATA pData   = _dbg_ILGetDataPointer(pidltemp);
+	      DWORD type         = pData->type;
+	      LPSTR szLongName   = _dbg_ILGetTextPointer(pidltemp);
+	      LPSTR szShortName  = _dbg_ILGetSTextPointer(pidltemp);
+	      char szName[MAX_PATH];
+
+	      _dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
+	      if( PT_FOLDER == type)
+	        dwAttrib = pData->u.folder.uFileAttribs;
+	      else if( PT_VALUE == type)
+	        dwAttrib = pData->u.file.uFileAttribs;
+
+	      MESSAGE ("-- pidl=%p size=%u type=%lx attr=0x%08lx name=%s (%s,%s)\n",
+	               pidltemp, pidltemp->mkid.cb,type,dwAttrib,szName,debugstr_a(szLongName), debugstr_a(szShortName));
+
+	      pidltemp = _dbg_ILGetNext(pidltemp);
+
+	    } while (pidltemp->mkid.cb);
+	  }
+	  else
+	  {
+	    MESSAGE ("empty pidl (Desktop)\n");
+	  }
+	  pcheck(pidl);
+	}
+}
+#define BYTES_PRINTED 32
+BOOL pcheck (LPCITEMIDLIST pidl)
+{
+        DWORD type, ret=TRUE;
+        LPITEMIDLIST pidltemp = pidl;
+
+        if (pidltemp && pidltemp->mkid.cb)
+        { do
+          { type   = _dbg_ILGetDataPointer(pidltemp)->type;
+            switch (type)
+	    { case PT_DESKTOP:
+	      case PT_MYCOMP:
+	      case PT_SPECIAL:
+	      case PT_DRIVE:
+	      case PT_DRIVE1:
+	      case PT_DRIVE2:
+	      case PT_DRIVE3:
+	      case PT_FOLDER:
+	      case PT_VALUE:
+	      case PT_FOLDER1:
+	      case PT_WORKGRP:
+	      case PT_COMP:
+	      case PT_NETWORK:
+	      case PT_IESPECIAL1:
+	      case PT_IESPECIAL2:
+	      case PT_SHARE:
+		break;
+	      default:
+	      {
+		char szTemp[BYTES_PRINTED*4 + 1];
+		int i;
+		unsigned char c;
+
+		memset(szTemp, ' ', BYTES_PRINTED*4 + 1);
+		for ( i = 0; (i<pidltemp->mkid.cb) && (i<BYTES_PRINTED); i++)
+		{
+		  c = ((unsigned char *)pidltemp)[i];
+
+		  szTemp[i*3+0] = ((c>>4)>9)? (c>>4)+55 : (c>>4)+48;
+		  szTemp[i*3+1] = ((0x0F&c)>9)? (0x0F&c)+55 : (0x0F&c)+48;
+		  szTemp[i*3+2] = ' ';
+		  szTemp[i+BYTES_PRINTED*3]  =  (c>=0x20 && c <=0x80) ? c : '.';
+		}
+		szTemp[BYTES_PRINTED*4] = 0x00;
+		ERR("unknown IDLIST type size=%u type=%lx\n%s\n",pidltemp->mkid.cb,type, szTemp);
+		ret = FALSE;
+	      }
+	    }
+	    pidltemp = _dbg_ILGetNext(pidltemp);
+	  } while (pidltemp->mkid.cb);
+	}
+	return ret;
+}
+
+
+
+
===================================================================
--- /dev/null	Mon Mar  4 08:42:02 2002
+++ wine/dlls/shell32/debughlp.h	Fri Mar 22 18:33:37 2002
@@ -0,0 +1,6 @@
+#include "winbase.h"
+#include "shlobj.h"
+
+void pdump (LPCITEMIDLIST pidl);
+BOOL pcheck (LPCITEMIDLIST pidl);
+


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux