Modified: trunk/reactos/lib/shell32/Makefile.in
Modified: trunk/reactos/lib/shell32/autocomplete.c
Modified: trunk/reactos/lib/shell32/brsfolder.c
Modified: trunk/reactos/lib/shell32/classes.c
Modified: trunk/reactos/lib/shell32/clipboard.c
Modified: trunk/reactos/lib/shell32/cpanelfolder.c
Modified: trunk/reactos/lib/shell32/dataobject.c
Modified: trunk/reactos/lib/shell32/debughlp.c
Modified: trunk/reactos/lib/shell32/dragdrophelper.c
Modified: trunk/reactos/lib/shell32/enumidlist.c
Modified: trunk/reactos/lib/shell32/folders.c
Modified: trunk/reactos/lib/shell32/iconcache.c
Deleted: trunk/reactos/lib/shell32/memorystream.c
Modified: trunk/reactos/lib/shell32/pidl.c
Modified: trunk/reactos/lib/shell32/pidl.h
Modified: trunk/reactos/lib/shell32/regsvr.c
Modified: trunk/reactos/lib/shell32/shell32.spec
Modified: trunk/reactos/lib/shell32/shell32.xml
Modified: trunk/reactos/lib/shell32/shell32_main.h
Modified: trunk/reactos/lib/shell32/shelllink.c
Modified: trunk/reactos/lib/shell32/shellole.c
Modified: trunk/reactos/lib/shell32/shellord.c
Modified: trunk/reactos/lib/shell32/shellpath.c
Modified: trunk/reactos/lib/shell32/shfldr_desktop.c
Modified: trunk/reactos/lib/shell32/shfldr_fs.c
Modified: trunk/reactos/lib/shell32/shfldr_mycomp.c
Modified: trunk/reactos/lib/shell32/shlexec.c
Modified: trunk/reactos/lib/shell32/shlfolder.c
Modified: trunk/reactos/lib/shell32/shlfsbind.c
Modified: trunk/reactos/lib/shell32/shlmenu.c
Modified: trunk/reactos/lib/shell32/shlview.c
Modified: trunk/reactos/lib/shell32/shv_bg_cmenu.c
Modified: trunk/reactos/lib/shell32/shv_item_cmenu.c
Modified: trunk/reactos/lib/shell32/systray.c
--- trunk/reactos/lib/shell32/Makefile.in 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/Makefile.in 2005-08-05 07:48:18 UTC (rev 17060)
@@ -25,7 +25,6 @@
enumidlist.c \
folders.c \
iconcache.c \
- memorystream.c \
pidl.c \
regsvr.c \
shell32_main.c \
--- trunk/reactos/lib/shell32/autocomplete.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/autocomplete.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -62,8 +62,8 @@
typedef struct
{
- IAutoCompleteVtbl *lpVtbl;
- IAutoComplete2Vtbl *lpvtblAutoComplete2;
+ const IAutoCompleteVtbl *lpVtbl;
+ const IAutoComplete2Vtbl *lpvtblAutoComplete2;
DWORD ref;
BOOL enabled;
HWND hwndEdit;
@@ -76,8 +76,8 @@
AUTOCOMPLETEOPTIONS options;
} IAutoCompleteImpl;
-static struct IAutoCompleteVtbl acvt;
-static struct IAutoComplete2Vtbl ac2vt;
+static const IAutoCompleteVtbl acvt;
+static const IAutoComplete2Vtbl ac2vt;
#define _IAutoComplete2_Offset ((int)(&(((IAutoCompleteImpl*)0)->lpvtblAutoComplete2)))
#define _ICOM_THIS_From_IAutoComplete2(class, name) class* This = (class*)(((char*)name)-_IAutoComplete2_Offset);
@@ -312,7 +312,7 @@
/**************************************************************************
* IAutoComplete_fnVTable
*/
-static IAutoCompleteVtbl acvt =
+static const IAutoCompleteVtbl acvt =
{
IAutoComplete_fnQueryInterface,
IAutoComplete_fnAddRef,
@@ -432,7 +432,7 @@
/**************************************************************************
* IAutoComplete2_fnVTable
*/
-static IAutoComplete2Vtbl ac2vt =
+static const IAutoComplete2Vtbl ac2vt =
{
IAutoComplete2_fnQueryInterface,
IAutoComplete2_fnAddRef,
--- trunk/reactos/lib/shell32/brsfolder.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/brsfolder.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -80,7 +80,7 @@
{
if (!lpBrowseInfo->lpfn)
return;
- lpBrowseInfo->lpfn( hWnd, BFFM_INITIALIZED, param, lpBrowseInfo->lParam );
+ lpBrowseInfo->lpfn( hWnd, msg, param, lpBrowseInfo->lParam );
}
/******************************************************************************
@@ -428,8 +428,14 @@
if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
return 0;
- r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
- (REFIID)&IID_IShellFolder, (LPVOID *)&lpsf2 );
+ if (lptvid->lpi && lptvid->lpi->mkid.cb) {
+ r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
+ (REFIID)&IID_IShellFolder, (LPVOID *)&lpsf2 );
+ } else {
+ lpsf2 = lptvid->lpsfParent;
+ r = IShellFolder_AddRef(lpsf2);
+ }
+
if (SUCCEEDED(r))
FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
--- trunk/reactos/lib/shell32/classes.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/classes.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -26,6 +26,9 @@
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
+
+#define COBJMACROS
+
#include "wine/debug.h"
#include "winerror.h"
#include "windef.h"
@@ -39,6 +42,7 @@
#include "shlguid.h"
#include "shresdef.h"
#include "shlwapi.h"
+#include "pidl.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
@@ -178,6 +182,7 @@
else
*dwNr=0; /* sometimes the icon number is missing */
ParseFieldW (szDest, 1, szDest, len);
+ PathUnquoteSpacesW(szDest);
return TRUE;
}
return FALSE;
@@ -201,6 +206,7 @@
else
*dwNr=0; /* sometimes the icon number is missing */
ParseFieldA (szDest, 1, szDest, len);
+ PathUnquoteSpacesA(szDest);
return TRUE;
}
return FALSE;
@@ -339,47 +345,81 @@
return ret;
}
-/***************************************************************************************
-* HCR_GetFolderAttributes [internal]
-*
-* gets the folder attributes of a class
-*
-* FIXME
-* verify the defaultvalue for *szDest
-*/
-BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest)
-{ HKEY hkey;
- char xriid[60];
- DWORD attributes;
- DWORD len = 4;
+/******************************************************************************
+ * HCR_GetFolderAttributes [Internal]
+ *
+ * Query the registry for a shell folders' attributes
+ *
+ * PARAMS
+ * pidlFolder [I] A simple pidl of type PT_GUID.
+ * pdwAttributes [IO] In: Attributes to be queried, OUT: Resulting attributes.
+ *
+ * RETURNS
+ * TRUE: Found information for the attributes in the registry
+ * FALSE: No attribute information found
+ *
+ * NOTES
+ * If queried for an attribute, which is set in the CallForAttributes registry
+ * value, the function binds to the shellfolder objects and queries it.
+ */
+BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes)
+{
+ HKEY hSFKey;
+ LPOLESTR pwszCLSID;
+ LONG lResult;
+ DWORD dwTemp, dwLen;
+ static const WCHAR wszAttributes[] = { 'A','t','t','r','i','b','u','t','e','s',0 };
+ static const WCHAR wszCallForAttributes[] = {
+ 'C','a','l','l','F','o','r','A','t','t','r','i','b','u','t','e','s',0 };
+ WCHAR wszShellFolderKey[] = { 'C','L','S','I','D','\\','{','0','0','0','2','1','4','0','0','-',
+ '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-','0','0','0','0','0','0','0',
+ '0','0','0','4','6','}','\\','S','h','e','l','l','F','o','l','d','e','r',0 };
- sprintf( xriid, "CLSID\\{%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] );
- TRACE("%s\n",xriid );
+ TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes);
+
+ if (!_ILIsPidlSimple(pidlFolder)) {
+ ERR("HCR_GetFolderAttributes should be called for simple PIDL's only!\n");
+ return FALSE;
+ }
+
+ if (!_ILIsDesktop(pidlFolder)) {
+ if (FAILED(StringFromCLSID(_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) return FALSE;
+ memcpy(&wszShellFolderKey[6], pwszCLSID, 38 * sizeof(WCHAR));
+ CoTaskMemFree(pwszCLSID);
+ }
+
+ lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey);
+ if (lResult != ERROR_SUCCESS) return FALSE;
+
+ dwLen = sizeof(DWORD);
+ lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);
+ if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) {
+ LPSHELLFOLDER psfDesktop, psfFolder;
+ HRESULT hr;
- if (!szDest) return FALSE;
- *szDest = SFGAO_FOLDER|SFGAO_FILESYSTEM;
+ RegCloseKey(hSFKey);
+ hr = SHGetDesktopFolder(&psfDesktop);
+ if (SUCCEEDED(hr)) {
+ hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder,
+ (LPVOID*)&psfFolder);
+ if (SUCCEEDED(hr)) {
+ hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes);
+ }
+ }
+ IShellFolder_Release(psfFolder);
+ IShellFolder_Release(psfDesktop);
+ if (FAILED(hr)) return FALSE;
+ } else {
+ lResult = RegQueryValueExW(hSFKey, wszAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);
+ RegCloseKey(hSFKey);
+ if (lResult == ERROR_SUCCESS) {
+ *pdwAttributes &= dwTemp;
+ } else {
+ return FALSE;
+ }
+ }
- strcat (xriid, "\\ShellFolder");
+ TRACE("-- *pdwAttributes == 0x%08lx\n", *pdwAttributes);
- if (RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey))
- {
- return FALSE;
- }
-
- if (RegQueryValueExA(hkey,"Attributes",0,NULL,(LPBYTE)&attributes,&len))
- {
- RegCloseKey(hkey);
- return FALSE;
- }
-
- RegCloseKey(hkey);
-
- TRACE("-- 0x%08lx\n", attributes);
-
- *szDest = attributes;
-
- return TRUE;
+ return TRUE;
}
--- trunk/reactos/lib/shell32/clipboard.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/clipboard.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -176,7 +176,7 @@
char szTemp[MAX_PATH], *szFileName;
LPITEMIDLIST pidl;
HGLOBAL hGlobal;
- HRESULT hr;
+ BOOL bSuccess;
TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
@@ -185,9 +185,9 @@
if (!pidl)
return 0;
- hr = SHELL_GetPathFromIDListA(pidl, szTemp, MAX_PATH);
+ bSuccess = SHGetPathFromIDListA(pidl, szTemp);
SHFree(pidl);
- if (FAILED(hr))
+ if (!bSuccess)
return 0;
size = strlen(szTemp) + 1;
@@ -208,7 +208,7 @@
WCHAR szTemp[MAX_PATH], *szFileName;
LPITEMIDLIST pidl;
HGLOBAL hGlobal;
- HRESULT hr;
+ BOOL bSuccess;
TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
@@ -217,9 +217,9 @@
if (!pidl)
return 0;
- hr = SHELL_GetPathFromIDListW(pidl, szTemp, MAX_PATH);
+ bSuccess = SHGetPathFromIDListW(pidl, szTemp);
SHFree(pidl);
- if (FAILED(hr))
+ if (!bSuccess)
return 0;
size = (strlenW(szTemp)+1) * sizeof(WCHAR);
--- trunk/reactos/lib/shell32/cpanelfolder.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/cpanelfolder.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -58,11 +58,11 @@
*/
typedef struct {
- IShellFolder2Vtbl *lpVtbl;
+ const IShellFolder2Vtbl *lpVtbl;
DWORD ref;
- IPersistFolder2Vtbl *lpVtblPersistFolder2;
- IShellExecuteHookWVtbl *lpVtblShellExecuteHookW;
- IShellExecuteHookAVtbl *lpVtblShellExecuteHookA;
+ const IPersistFolder2Vtbl *lpVtblPersistFolder2;
+ const IShellExecuteHookWVtbl *lpVtblShellExecuteHookW;
+ const IShellExecuteHookAVtbl *lpVtblShellExecuteHookA;
IUnknown *pUnkOuter; /* used for aggregation */
@@ -71,10 +71,10 @@
int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
} ICPanelImpl;
-static IShellFolder2Vtbl vt_ShellFolder2;
-static IPersistFolder2Vtbl vt_PersistFolder2;
-static IShellExecuteHookWVtbl vt_ShellExecuteHookW;
-static IShellExecuteHookAVtbl vt_ShellExecuteHookA;
+static const IShellFolder2Vtbl vt_ShellFolder2;
+static const IPersistFolder2Vtbl vt_PersistFolder2;
+static const IShellExecuteHookWVtbl vt_ShellExecuteHookW;
+static const IShellExecuteHookAVtbl vt_ShellExecuteHookA;
#define _IPersistFolder2_Offset ((int)(&(((ICPanelImpl*)0)->lpVtblPersistFolder2)))
#define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
@@ -792,7 +792,7 @@
return E_NOTIMPL;
}
-static IShellFolder2Vtbl vt_ShellFolder2 =
+static const IShellFolder2Vtbl vt_ShellFolder2 =
{
ISF_ControlPanel_fnQueryInterface,
@@ -898,7 +898,7 @@
return S_OK;
}
-static IPersistFolder2Vtbl vt_PersistFolder2 =
+static const IPersistFolder2Vtbl vt_PersistFolder2 =
{
ICPanel_PersistFolder2_QueryInterface,
@@ -1000,7 +1000,7 @@
return S_FALSE;
}
-static IShellExecuteHookWVtbl vt_ShellExecuteHookW =
+static const IShellExecuteHookWVtbl vt_ShellExecuteHookW =
{
IShellExecuteHookW_fnQueryInterface,
@@ -1079,7 +1079,7 @@
return S_FALSE;
}
-static IShellExecuteHookAVtbl vt_ShellExecuteHookA =
+static const IShellExecuteHookAVtbl vt_ShellExecuteHookA =
{
IShellExecuteHookA_fnQueryInterface,
IShellExecuteHookA_fnAddRef,
--- trunk/reactos/lib/shell32/dataobject.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/dataobject.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -42,7 +42,7 @@
typedef struct
{
/* IUnknown fields */
- IEnumFORMATETCVtbl *lpVtbl;
+ const IEnumFORMATETCVtbl *lpVtbl;
DWORD ref;
/* IEnumFORMATETC fields */
UINT posFmt;
@@ -159,7 +159,7 @@
return S_OK;
}
-static struct IEnumFORMATETCVtbl efvt =
+static const IEnumFORMATETCVtbl efvt =
{
IEnumFORMATETC_fnQueryInterface,
IEnumFORMATETC_fnAddRef,
@@ -204,7 +204,7 @@
typedef struct
{
/* IUnknown fields */
- IDataObjectVtbl *lpVtbl;
+ const IDataObjectVtbl *lpVtbl;
DWORD ref;
/* IDataObject fields */
@@ -408,7 +408,7 @@
return E_NOTIMPL;
}
-static struct IDataObjectVtbl dtovt =
+static const IDataObjectVtbl dtovt =
{
IDataObject_fnQueryInterface,
IDataObject_fnAddRef,
--- trunk/reactos/lib/shell32/debughlp.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/debughlp.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -295,8 +295,8 @@
static char * shdebugstr_buf = shdebugstr_buf1;
static struct {
- REFIID riid;
- char *name;
+ REFIID riid;
+ const char *name;
} InterfaceDesc[] = {
{&IID_IUnknown, "IID_IUnknown"},
{&IID_IClassFactory, "IID_IClassFactory"},
@@ -325,7 +325,7 @@
const char * shdebugstr_guid( const struct _GUID *id )
{
int i;
- char* name = NULL;
+ const char* name = NULL;
char clsidbuf[100];
shdebugstr_buf = (shdebugstr_buf == shdebugstr_buf1) ? shdebugstr_buf2 : shdebugstr_buf1;
--- trunk/reactos/lib/shell32/dragdrophelper.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/dragdrophelper.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -48,11 +48,11 @@
*/
typedef struct {
- IDropTargetHelperVtbl *lpVtbl;
+ const IDropTargetHelperVtbl *lpVtbl;
DWORD ref;
} IDropTargetHelperImpl;
-static struct IDropTargetHelperVtbl vt_IDropTargetHelper;
+static const IDropTargetHelperVtbl vt_IDropTargetHelper;
#define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
#define _IDropTargetHelper_(This) (IDropTargetHelper*)&(This->lpVtbl)
@@ -175,7 +175,7 @@
return E_NOTIMPL;
}
-static IDropTargetHelperVtbl vt_IDropTargetHelper =
+static const IDropTargetHelperVtbl vt_IDropTargetHelper =
{
IDropTargetHelper_fnQueryInterface,
IDropTargetHelper_fnAddRef,
--- trunk/reactos/lib/shell32/enumidlist.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/enumidlist.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -45,7 +45,7 @@
typedef struct
{
- IEnumIDListVtbl *lpVtbl;
+ const IEnumIDListVtbl *lpVtbl;
DWORD ref;
LPENUMLIST mpFirst;
LPENUMLIST mpLast;
@@ -53,7 +53,7 @@
} IEnumIDListImpl;
-static struct IEnumIDListVtbl eidlvt;
+static const IEnumIDListVtbl eidlvt;
/**************************************************************************
* AddToEnumList()
@@ -367,7 +367,7 @@
/**************************************************************************
* IEnumIDList_fnVTable
*/
-static IEnumIDListVtbl eidlvt =
+static const IEnumIDListVtbl eidlvt =
{
IEnumIDList_fnQueryInterface,
IEnumIDList_fnAddRef,
--- trunk/reactos/lib/shell32/folders.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/folders.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -49,16 +49,16 @@
*/
typedef struct
{
- IExtractIconWVtbl *lpVtbl;
+ const IExtractIconWVtbl *lpVtbl;
DWORD ref;
- IPersistFileVtbl *lpvtblPersistFile;
- IExtractIconAVtbl *lpvtblExtractIconA;
+ const IPersistFileVtbl *lpvtblPersistFile;
+ const IExtractIconAVtbl *lpvtblExtractIconA;
LPITEMIDLIST pidl;
} IExtractIconWImpl;
-static struct IExtractIconAVtbl eiavt;
-static struct IExtractIconWVtbl eivt;
-static struct IPersistFileVtbl pfvt;
+static const IExtractIconAVtbl eiavt;
+static const IExtractIconWVtbl eivt;
+static const IPersistFileVtbl pfvt;
#define _IPersistFile_Offset ((int)(&(((IExtractIconWImpl*)0)->lpvtblPersistFile)))
#define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset);
@@ -394,7 +394,7 @@
return S_OK;
}
-static struct IExtractIconWVtbl eivt =
+static const IExtractIconWVtbl eivt =
{
IExtractIconW_fnQueryInterface,
IExtractIconW_fnAddRef,
@@ -486,7 +486,7 @@
return ret;
}
-static struct IExtractIconAVtbl eiavt =
+static const IExtractIconAVtbl eiavt =
{
IExtractIconA_fnQueryInterface,
IExtractIconA_fnAddRef,
@@ -558,7 +558,7 @@
}
-static struct IPersistFileVtbl pfvt =
+static const IPersistFileVtbl pfvt =
{
IEIPersistFile_fnQueryInterface,
IEIPersistFile_fnAddRef,
--- trunk/reactos/lib/shell32/iconcache.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/iconcache.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -670,7 +670,12 @@
{
HICON hIcon = NULL;
INT len = MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, NULL, 0);
- LPWSTR lpIconPathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ /* Note that we need to allocate MAX_PATH, since we are supposed to fill
+ * the correct executable if there is no icon in lpIconPath directly.
+ * lpIconPath itself is supposed to be large enough, so make sure lpIconPathW
+ * is large enough too. Yes, I am puking too.
+ */
+ LPWSTR lpIconPathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
TRACE("%p %s %p\n", hInst, debugstr_a(lpIconPath), lpiIcon);
@@ -678,11 +683,18 @@
{
MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, lpIconPathW, len);
hIcon = ExtractAssociatedIconW(hInst, lpIconPathW, lpiIcon);
+ WideCharToMultiByte(CP_ACP, 0, lpIconPathW, -1, lpIconPath, MAX_PATH , NULL, NULL);
HeapFree(GetProcessHeap(), 0, lpIconPathW);
}
return hIcon;
}
+/*************************************************************************
+ * ExtractAssociatedIconW (SHELL32.@)
+ *
+ * Return icon for given file (either from file itself or from associated
+ * executable) and patch parameters if needed.
+ */
HICON WINAPI ExtractAssociatedIconW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIcon)
{
HICON hIcon = NULL;
--- trunk/reactos/lib/shell32/memorystream.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/memorystream.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -1,309 +0,0 @@
-/*
- * This class implements a pure IStream object
- * and can be used for many purposes.
- *
- * The main reason for implementing this was
- * a cleaner implementation of IShellLink which
- * needs to be able to load lnks from an IStream
- * interface so it was obvious to capsule the file
- * access in an IStream to.
- *
- * Copyright 1999 Juergen Schmied
- * Copyright 2003 Mike McCormack for CodeWeavers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <stdarg.h>
-#include <string.h>
-
-#define COBJMACROS
-
-#include "windef.h"
-#include "winbase.h"
-#include "winerror.h"
-#include "winuser.h"
-#include "wingdi.h"
-#include "shlobj.h"
-#include "wine/debug.h"
-#include "shell32_main.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(shell);
-
-#define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f)
-#define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0)
-#define STGM_CREATE_MODE(stgm) ((stgm)&0x0f000)
-
-typedef struct
-{
- const IStreamVtbl *lpvtst;
- DWORD ref;
- HANDLE handle;
-} ISHFileStream;
-
-/**************************************************************************
-* IStream_fnQueryInterface
-*/
-static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
-
- *ppvObj = NULL;
-
- if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IStream))
- *ppvObj = This;
-
- if(*ppvObj)
- {
- IStream_AddRef((IStream*)*ppvObj);
- TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
- return S_OK;
- }
- TRACE("-- Interface: E_NOINTERFACE\n");
- return E_NOINTERFACE;
-}
-
-/**************************************************************************
-* IStream_fnAddRef
-*/
-static ULONG WINAPI IStream_fnAddRef(IStream *iface)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
- ULONG refCount = InterlockedIncrement(&This->ref);
-
- TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
-
- return refCount;
-}
-
-/**************************************************************************
-* IStream_fnRelease
-*/
-static ULONG WINAPI IStream_fnRelease(IStream *iface)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
- ULONG refCount = InterlockedDecrement(&This->ref);
-
- TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
-
- if (!refCount)
- {
- TRACE(" destroying SHFileStream (%p)\n",This);
- CloseHandle(This->handle);
- HeapFree(GetProcessHeap(),0,This);
- }
- return refCount;
-}
-
-static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead);
-
- if ( !pv )
- return STG_E_INVALIDPOINTER;
-
- if ( ! ReadFile( This->handle, pv, cb, pcbRead, NULL ) )
- return S_FALSE;
-
- return S_OK;
-}
-
-static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten)
-{
- DWORD dummy_count;
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- if( !pv )
- return STG_E_INVALIDPOINTER;
-
- /* WriteFile() doesn't allow to specify NULL as write count pointer */
- if (!pcbWritten)
- pcbWritten = &dummy_count;
-
- if( ! WriteFile( This->handle, pv, cb, pcbWritten, NULL ) )
- return E_FAIL;
-
- return S_OK;
-}
-
-static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)
-{
- DWORD pos, newposlo, newposhi;
-
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- pos = dlibMove.QuadPart; /* FIXME: truncates */
- newposhi = 0;
- newposlo = SetFilePointer( This->handle, pos, &newposhi, dwOrigin );
- if( newposlo == INVALID_SET_FILE_POINTER )
- return E_FAIL;
-
- plibNewPosition->QuadPart = newposlo | ( (LONGLONG)newposhi<<32);
-
- return S_OK;
-}
-
-static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- if( ! SetFilePointer( This->handle, libNewSize.QuadPart, NULL, FILE_BEGIN ) )
- return E_FAIL;
-
- if( ! SetEndOfFile( This->handle ) )
- return E_FAIL;
-
- return S_OK;
-}
-static HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- return E_NOTIMPL;
-}
-static HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- return E_NOTIMPL;
-}
-static HRESULT WINAPI IStream_fnRevert (IStream * iface)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- return E_NOTIMPL;
-}
-static HRESULT WINAPI IStream_fnLockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- return E_NOTIMPL;
-}
-static HRESULT WINAPI IStream_fnUnlockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- return E_NOTIMPL;
-}
-static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- return E_NOTIMPL;
-}
-static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm)
-{
- ISHFileStream *This = (ISHFileStream *)iface;
-
- TRACE("(%p)\n",This);
-
- return E_NOTIMPL;
-}
-
-static const IStreamVtbl stvt =
-{
- IStream_fnQueryInterface,
- IStream_fnAddRef,
- IStream_fnRelease,
- IStream_fnRead,
- IStream_fnWrite,
- IStream_fnSeek,
- IStream_fnSetSize,
- IStream_fnCopyTo,
- IStream_fnCommit,
- IStream_fnRevert,
- IStream_fnLockRegion,
- IStream_fnUnlockRegion,
- IStream_fnStat,
- IStream_fnClone
-};
-
-/**************************************************************************
- * CreateStreamOnFile()
- *
- * similar to CreateStreamOnHGlobal
- */
-HRESULT CreateStreamOnFile (LPCWSTR pszFilename, DWORD grfMode, IStream ** ppstm)
-{
- ISHFileStream* fstr;
- HANDLE handle;
- DWORD access = GENERIC_READ, creat;
-
- if( grfMode & STGM_TRANSACTED )
- return E_INVALIDARG;
-
- switch( STGM_ACCESS_MODE( grfMode ) )
- {
- case STGM_READ:
- access = GENERIC_READ;
- break;
- case STGM_WRITE:
- case STGM_READWRITE:
- access = GENERIC_WRITE | GENERIC_READ;
- break;
- default:
- return STG_E_INVALIDFLAG;
- }
-
- switch( STGM_CREATE_MODE( grfMode ) )
- {
- case STGM_CREATE:
- creat = CREATE_ALWAYS;
- break;
- case STGM_FAILIFTHERE:
- creat = OPEN_EXISTING;
- break;
- default:
- return STG_E_INVALIDFLAG;
- }
-
- handle = CreateFileW( pszFilename, access,
- FILE_SHARE_READ, NULL, creat, 0, NULL );
- if( handle == INVALID_HANDLE_VALUE )
- return HRESULT_FROM_WIN32(GetLastError());
-
- fstr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ISHFileStream));
- if( !fstr )
- return E_OUTOFMEMORY;
- fstr->lpvtst = &stvt;
- fstr->ref = 1;
- fstr->handle = handle;
-
- (*ppstm) = (IStream*)fstr;
-
- return S_OK;
-}
--- trunk/reactos/lib/shell32/pidl.c 2005-08-05 06:56:17 UTC (rev 17059)
+++ trunk/reactos/lib/shell32/pidl.c 2005-08-05 07:48:18 UTC (rev 17060)
@@ -1210,87 +1210,6 @@
}
/*************************************************************************
- * SHELL_GetPathFromIDListA
- */
-HRESULT SHELL_GetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath, UINT uOutSize)
-{
- HRESULT hr = S_OK;
-
- pszPath[0]=0;
-
- /* One case is a PIDL rooted at desktop level */
- if (_ILIsDesktop(pidl) || _ILIsValue(pidl) || _ILIsFolder(pidl))
- {
- hr = SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOP, FALSE);
-
- if (SUCCEEDED(hr))
- PathAddBackslashA(pszPath);
- }
- /* The only other valid case is an item ID list beginning at "My Computer" */
- else if (_ILIsMyComputer(pidl))
- pidl = ILGetNext(pidl);
-
- if (SUCCEEDED(hr))
- {
- LPSTR txt;
-
- while(pidl && pidl->mkid.cb)
- {
- if (_ILIsSpecialFolder(pidl))
- {
- hr = E_INVALIDARG;
- break;
- }
-
- txt = _ILGetTextPointer(pidl);
- if (!txt)
- {
- hr = E_INVALIDARG;
- break;
- }
-
- if (lstrlenA(txt) > pidl->mkid.cb)
- ERR("pidl %p is borked\n",pidl);
-
- /* make sure there's enough space for the next segment */
- if ((lstrlenA(txt) + lstrlenA(pszPath)) > uOutSize)
- {
- hr = E_INVALIDARG;
- break;
- }
- lstrcatA( pszPath, txt );
-
- pidl = ILGetNext(pidl);
- if (!pidl)
- {
- hr = E_INVALIDARG;
- break;
- }
-
- /* Are we at the end and successfully converted the complete PIDL? */
- if (!pidl->mkid.cb)
- break;
-
- if ((lstrlenA(pszPath) + 1) > uOutSize)
- {
- hr = E_INVALIDARG;
- break;
- }
- if (!PathAddBackslashA(pszPath))
- {
- hr = E_INVALIDARG;
- break;
- }
- }
- }
- else
- hr = E_INVALIDARG;
-
- TRACE_(shell)("-- %s, 0x%08lx\n", pszPath, hr);
- return hr;
-}
-
-/*************************************************************************
* SHGetPathFromIDListA [SHELL32.@][NT 4.0: SHELL32.220]
*
* PARAMETERS
@@ -1307,108 +1226,26 @@
*/
BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath)
{
- HRESULT hr;
+ WCHAR wszPath[MAX_PATH];
+ BOOL bSuccess;
- TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath);
- pdump(pidl);
+ bSuccess = SHGetPathFromIDListW(pidl, wszPath);
+ if (bSuccess)
+ WideCharToMultiByte(CP_ACP, 0, wszPath, -1, pszPath, MAX_PATH, NULL, NULL);
- if (!pidl)
- return FALSE;
-
- hr = SHELL_GetPathFromIDListA(pidl, pszPath, MAX_PATH);
-
[truncated at 1000 lines; 2333 more skipped]