- made IShellFolder a aggregable object

- SHCoCreateInstance can create CSIDL_FSFolder now
- browsing into folders on the desktop implemented
- corrected returnvalue of Ico_ExtractIconEx
- fixed SHGetDataFromIDList to return data of simple pidls
This commit is contained in:
Juergen Schmied 1999-11-23 22:31:18 +00:00 committed by Alexandre Julliard
parent e0a3ba54c6
commit afe53ed99d
10 changed files with 509 additions and 346 deletions

View File

@ -136,7 +136,7 @@ BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len)
LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen); LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen);
ret = TRUE; ret = TRUE;
} }
else if (IsEqualIID(riid, &IID_MyComputer)) else if (IsEqualIID(riid, &CLSID_MyComputer))
{ {
LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen); LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen);
ret = TRUE; ret = TRUE;
@ -152,6 +152,9 @@ BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len)
* HCR_GetFolderAttributes [internal] * HCR_GetFolderAttributes [internal]
* *
* gets the folder attributes of a class * gets the folder attributes of a class
*
* FIXME
* verify the defaultvalue for *szDest
*/ */
BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest) BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest)
{ HKEY hkey; { HKEY hkey;
@ -163,6 +166,9 @@ BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest)
WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]); WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]);
TRACE("%s\n",xriid ); TRACE("%s\n",xriid );
if (!szDest) return FALSE;
*szDest = SFGAO_FOLDER|SFGAO_FILESYSTEM;
strcat (xriid, "\\ShellFolder"); strcat (xriid, "\\ShellFolder");
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey)) if (RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey))

View File

@ -203,18 +203,12 @@ static BYTE * ICO_GetIconDirectory( HFILE hFile, LPicoICONDIR* lplpiID, ULONG *u
} }
/************************************************************************* /*************************************************************************
* InternalExtractIcon [SHELL.39]
*
* This abortion is called directly by Progman
* fixme: the icon section is broken (don't have a handle for
* ICO_GetIconDirectory....)
* *
* returns
* failure:0; success: icon handle or nr of icons (nIconIndex-1)
*/ */
#define ICO_INVALID_FILE 1 HICON WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nIconIndex, UINT n, UINT cxDesired, UINT cyDesired )
#define ICO_NO_ICONS 0 { HGLOBAL hRet = 0;
HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nIconIndex, UINT n, UINT cxDesired, UINT cyDesired )
{ HGLOBAL hRet = ICO_NO_ICONS;
LPBYTE pData; LPBYTE pData;
OFSTRUCT ofs; OFSTRUCT ofs;
DWORD sig; DWORD sig;
@ -227,7 +221,7 @@ HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nI
TRACE("(file %s,start %d,extract %d\n", lpszExeFileName, nIconIndex, n); TRACE("(file %s,start %d,extract %d\n", lpszExeFileName, nIconIndex, n);
if( hFile == HFILE_ERROR || !n ) if( hFile == HFILE_ERROR || !n )
return ICO_INVALID_FILE; return hRet;
sig = SHELL_GetResourceTable(hFile,&pData); sig = SHELL_GetResourceTable(hFile,&pData);
@ -321,13 +315,11 @@ HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nI
if ( !(fmapping = CreateFileMappingA(hFile,NULL,PAGE_READONLY|SEC_COMMIT,0,0,NULL))) if ( !(fmapping = CreateFileMappingA(hFile,NULL,PAGE_READONLY|SEC_COMMIT,0,0,NULL)))
{ WARN("failed to create filemap.\n"); /* FIXME, INVALID_HANDLE_VALUE? */ { WARN("failed to create filemap.\n"); /* FIXME, INVALID_HANDLE_VALUE? */
hRet = ICO_INVALID_FILE;
goto end_2; /* failure */ goto end_2; /* failure */
} }
if ( !(peimage = MapViewOfFile(fmapping,FILE_MAP_READ,0,0,0))) if ( !(peimage = MapViewOfFile(fmapping,FILE_MAP_READ,0,0,0)))
{ WARN("failed to mmap filemap.\n"); { WARN("failed to mmap filemap.\n");
hRet = ICO_INVALID_FILE;
goto end_2; /* failure */ goto end_2; /* failure */
} }
@ -348,12 +340,12 @@ HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nI
if (!rootresdir) if (!rootresdir)
{ WARN("haven't found section for resource directory.\n"); { WARN("haven't found section for resource directory.\n");
goto end_4; /* failure */ goto end_3; /* failure */
} }
/* search the group icon dir*/ /* search the group icon dir*/
if (!(icongroupresdir = GetResDirEntryW(rootresdir,RT_GROUP_ICONW, (DWORD)rootresdir,FALSE))) if (!(icongroupresdir = GetResDirEntryW(rootresdir,RT_GROUP_ICONW, (DWORD)rootresdir,FALSE)))
{ WARN("No Icongroupresourcedirectory!\n"); { WARN("No Icongroupresourcedirectory!\n");
goto end_4; /* failure */ goto end_3; /* failure */
} }
iconDirCount = icongroupresdir->NumberOfNamedEntries+icongroupresdir->NumberOfIdEntries; iconDirCount = icongroupresdir->NumberOfNamedEntries+icongroupresdir->NumberOfIdEntries;
@ -365,7 +357,7 @@ HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nI
if (nIconIndex >= iconDirCount) if (nIconIndex >= iconDirCount)
{ WARN("nIconIndex %d is larger than iconDirCount %d\n",nIconIndex,iconDirCount); { WARN("nIconIndex %d is larger than iconDirCount %d\n",nIconIndex,iconDirCount);
goto end_4; /* failure */ goto end_3; /* failure */
} }
xresent = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(icongroupresdir+1); /* caller just wanted the number of entries */ xresent = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(icongroupresdir+1); /* caller just wanted the number of entries */
@ -399,14 +391,14 @@ HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nI
if (!igdata) if (!igdata)
{ WARN("no matching real address for icongroup!\n"); { WARN("no matching real address for icongroup!\n");
goto end_4; /* failure */ goto end_3; /* failure */
} }
RetPtr[i] = (HICON)pLookupIconIdFromDirectoryEx(igdata, TRUE, cxDesired, cyDesired, LR_DEFAULTCOLOR); RetPtr[i] = (HICON)pLookupIconIdFromDirectoryEx(igdata, TRUE, cxDesired, cyDesired, LR_DEFAULTCOLOR);
} }
if (!(iconresdir=GetResDirEntryW(rootresdir,RT_ICONW,(DWORD)rootresdir,FALSE))) if (!(iconresdir=GetResDirEntryW(rootresdir,RT_ICONW,(DWORD)rootresdir,FALSE)))
{ WARN("No Iconresourcedirectory!\n"); { WARN("No Iconresourcedirectory!\n");
goto end_4; /* failure */ goto end_3; /* failure */
} }
for (i=0;i<n;i++) for (i=0;i<n;i++)
@ -434,11 +426,9 @@ HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nI
hRet = RetPtr[0]; /* return first icon */ hRet = RetPtr[0]; /* return first icon */
goto end_3; /* sucess */ goto end_3; /* sucess */
} }
hRet = ICO_INVALID_FILE;
goto end_1; /* unknown filetype */ goto end_1; /* unknown filetype */
/* cleaning up (try & catch would be nicer:-) ) */ /* cleaning up (try & catch would be nicer:-) ) */
end_4: hRet = 0; /* failure */
end_3: UnmapViewOfFile(peimage); /* success */ end_3: UnmapViewOfFile(peimage); /* success */
end_2: CloseHandle(fmapping); end_2: CloseHandle(fmapping);
end_1: _lclose( hFile); end_1: _lclose( hFile);

View File

@ -12,6 +12,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include "winbase.h"
#include "debugtools.h" #include "debugtools.h"
#include "shell.h" #include "shell.h"
#include "shlguid.h" #include "shlguid.h"
@ -55,8 +56,8 @@ void pdump (LPCITEMIDLIST pidl)
do do
{ {
type = _ILGetDataPointer(pidltemp)->type; type = _ILGetDataPointer(pidltemp)->type;
szData = _ILGetTextPointer(type, _ILGetDataPointer(pidltemp)); szData = _ILGetTextPointer(pidltemp);
szShortName = _ILGetSTextPointer(type, _ILGetDataPointer(pidltemp)); szShortName = _ILGetSTextPointer(pidltemp);
_ILSimpleGetText(pidltemp, szName, MAX_PATH); _ILSimpleGetText(pidltemp, szName, MAX_PATH);
MESSAGE ("-- pidl=%p size=%u type=%lx name=%s (%s,%s)\n", MESSAGE ("-- pidl=%p size=%u type=%lx name=%s (%s,%s)\n",
@ -70,6 +71,7 @@ void pdump (LPCITEMIDLIST pidl)
{ {
MESSAGE ("empty pidl (Desktop)\n"); MESSAGE ("empty pidl (Desktop)\n");
} }
pcheck(pidl);
} }
__SET_DEBUGGING(__DBCL_TRACE, dbch_shell, bIsShellDebug); __SET_DEBUGGING(__DBCL_TRACE, dbch_shell, bIsShellDebug);
@ -848,6 +850,9 @@ HRESULT WINAPI SHGetSpecialFolderLocation(
/************************************************************************* /*************************************************************************
* SHGetDataFromIDListA [SHELL32.247] * SHGetDataFromIDListA [SHELL32.247]
* *
* NOTES
* the pidl can be a simple one. since we cant get the path out of the pidl
* we have to take all data from the pidl
*/ */
HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len) HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len)
{ {
@ -860,18 +865,15 @@ HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int n
case SHGDFIL_FINDDATA: case SHGDFIL_FINDDATA:
{ {
WIN32_FIND_DATAA * pfd = dest; WIN32_FIND_DATAA * pfd = dest;
CHAR pszPath[MAX_PATH];
HANDLE handle;
if ( len < sizeof (WIN32_FIND_DATAA)) { if ( len < sizeof (WIN32_FIND_DATAA)) return E_INVALIDARG;
ERR_(shell)("%d does not find sizeof(finddata)\n",len);
return E_INVALIDARG;
}
SHGetPathFromIDListA(pidl, pszPath); ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA));
_ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime));
if ((handle = FindFirstFileA ( pszPath, pfd))) pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0);
FindClose (handle); pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0);
lstrcpynA(pfd->cFileName,_ILGetTextPointer(pidl), MAX_PATH);
lstrcpynA(pfd->cAlternateFileName,_ILGetSTextPointer(pidl), 14);
} }
return NOERROR; return NOERROR;
@ -899,23 +901,27 @@ HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int n
case SHGDFIL_FINDDATA: case SHGDFIL_FINDDATA:
{ {
WIN32_FIND_DATAW * pfd = dest; WIN32_FIND_DATAW * pfd = dest;
WCHAR pszPath[MAX_PATH];
HANDLE handle;
if ( len < sizeof (WIN32_FIND_DATAW)) { if ( len < sizeof (WIN32_FIND_DATAW)) return E_INVALIDARG;
ERR_(shell)("%d does not find sizeof(finddata)\n",len);
return E_INVALIDARG; ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA));
} _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime));
SHGetPathFromIDListW(pidl, pszPath); pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0);
if ((handle = FindFirstFileW ( pszPath, pfd))) pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0);
FindClose (handle); lstrcpynAtoW(pfd->cFileName,_ILGetTextPointer(pidl), MAX_PATH);
lstrcpynAtoW(pfd->cAlternateFileName,_ILGetSTextPointer(pidl), 14);
} }
return NOERROR; return NOERROR;
default: /* fallthrough */ case SHGDFIL_NETRESOURCE:
case SHGDFIL_DESCRIPTIONID:
FIXME_(shell)("SHGDFIL %i stub\n", nFormat);
break; break;
default:
ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat);
} }
FIXME_(shell)("(sf=%p pidl=%p nFormat=0x%04x %p 0x%04x), unhandled.\n",psf,pidl,nFormat,dest,len);
return SHGetDataFromIDListA( psf, pidl, nFormat, dest, len); return E_INVALIDARG;
} }
/************************************************************************* /*************************************************************************
@ -1018,6 +1024,7 @@ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCI
ILFree (pidlChild); ILFree (pidlChild);
SHFree (pidlParent); SHFree (pidlParent);
if (psf) IShellFolder_Release(psf);
} }
@ -1058,32 +1065,32 @@ LPITEMIDLIST _ILCreateDesktop()
LPITEMIDLIST _ILCreateMyComputer() LPITEMIDLIST _ILCreateMyComputer()
{ TRACE_(pidl)("()\n"); { TRACE_(pidl)("()\n");
return _ILCreate(PT_MYCOMP, &IID_MyComputer, sizeof(GUID)); return _ILCreate(PT_MYCOMP, &CLSID_MyComputer, sizeof(GUID));
} }
LPITEMIDLIST _ILCreateIExplore() LPITEMIDLIST _ILCreateIExplore()
{ TRACE_(pidl)("()\n"); { TRACE_(pidl)("()\n");
return _ILCreate(PT_MYCOMP, &IID_IExplore, sizeof(GUID)); return _ILCreate(PT_MYCOMP, &CLSID_Internet, sizeof(GUID));
} }
LPITEMIDLIST _ILCreateControl() LPITEMIDLIST _ILCreateControl()
{ TRACE_(pidl)("()\n"); { TRACE_(pidl)("()\n");
return _ILCreate(PT_SPECIAL, &IID_Control, sizeof(GUID)); return _ILCreate(PT_SPECIAL, &CLSID_ControlPanel, sizeof(GUID));
} }
LPITEMIDLIST _ILCreatePrinter() LPITEMIDLIST _ILCreatePrinter()
{ TRACE_(pidl)("()\n"); { TRACE_(pidl)("()\n");
return _ILCreate(PT_SPECIAL, &IID_Printer, sizeof(GUID)); return _ILCreate(PT_SPECIAL, &CLSID_Printers, sizeof(GUID));
} }
LPITEMIDLIST _ILCreateNetwork() LPITEMIDLIST _ILCreateNetwork()
{ TRACE_(pidl)("()\n"); { TRACE_(pidl)("()\n");
return _ILCreate(PT_MYCOMP, &IID_Network, sizeof(GUID)); return _ILCreate(PT_MYCOMP, &CLSID_NetworkPlaces, sizeof(GUID));
} }
LPITEMIDLIST _ILCreateBitBucket() LPITEMIDLIST _ILCreateBitBucket()
{ TRACE_(pidl)("()\n"); { TRACE_(pidl)("()\n");
return _ILCreate(PT_MYCOMP, &IID_BitBucket, sizeof(GUID)); return _ILCreate(PT_MYCOMP, &CLSID_RecycleBin, sizeof(GUID));
} }
LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew) LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew)
@ -1224,7 +1231,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT16 uInSize)
pidlOut->mkid.cb = uSize; pidlOut->mkid.cb = uSize;
pData =_ILGetDataPointer(pidlOut); pData =_ILGetDataPointer(pidlOut);
pData->type = type; pData->type = type;
pszDest = _ILGetTextPointer(type, pData); pszDest = _ILGetTextPointer(pidlOut);
memcpy(pszDest, pIn, uInSize); memcpy(pszDest, pIn, uInSize);
TRACE_(pidl)("- create Drive: %s\n",debugstr_a(pszDest)); TRACE_(pidl)("- create Drive: %s\n",debugstr_a(pszDest));
break; break;
@ -1237,7 +1244,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT16 uInSize)
pidlOut->mkid.cb = uSize; pidlOut->mkid.cb = uSize;
pData =_ILGetDataPointer(pidlOut); pData =_ILGetDataPointer(pidlOut);
pData->type = type; pData->type = type;
pszDest = _ILGetTextPointer(type, pData); pszDest = _ILGetTextPointer(pidlOut);
memcpy(pszDest, pIn, uInSize); memcpy(pszDest, pIn, uInSize);
TRACE_(pidl)("- create Value: %s\n",debugstr_a(pszDest)); TRACE_(pidl)("- create Value: %s\n",debugstr_a(pszDest));
break; break;
@ -1296,7 +1303,7 @@ BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
TRACE_(pidl)("(%p)\n",pidl); TRACE_(pidl)("(%p)\n",pidl);
if (iid) if (iid)
return IsEqualIID(iid, &IID_MyComputer); return IsEqualIID(iid, &CLSID_MyComputer);
return FALSE; return FALSE;
} }
@ -1363,7 +1370,6 @@ BOOL _ILIsPidlSimple ( LPCITEMIDLIST pidl)
*/ */
DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
{ {
LPPIDLDATA pData;
DWORD dwReturn=0; DWORD dwReturn=0;
LPSTR szSrc; LPSTR szSrc;
GUID const * riid; GUID const * riid;
@ -1376,9 +1382,7 @@ DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
if (szOut) if (szOut)
*szOut = 0; *szOut = 0;
pData = _ILGetDataPointer(pidl); if (_ILIsDesktop(pidl))
if (!pData)
{ {
/* desktop */ /* desktop */
if (HCR_GetClassName(&CLSID_ShellDesktop, szTemp, MAX_PATH)) if (HCR_GetClassName(&CLSID_ShellDesktop, szTemp, MAX_PATH))
@ -1389,7 +1393,7 @@ DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
dwReturn = strlen (szTemp); dwReturn = strlen (szTemp);
} }
} }
else if (( szSrc = _ILGetTextPointer(pData->type, pData) )) else if (( szSrc = _ILGetTextPointer(pidl) ))
{ {
/* filesystem */ /* filesystem */
if (szOut) if (szOut)
@ -1435,36 +1439,37 @@ LPPIDLDATA _ILGetDataPointer(LPITEMIDLIST pidl)
* _ILGetTextPointer() * _ILGetTextPointer()
* gets a pointer to the long filename string stored in the pidl * gets a pointer to the long filename string stored in the pidl
*/ */
LPSTR _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata) LPSTR _ILGetTextPointer(LPCITEMIDLIST pidl)
{/* TRACE(pidl,"(type=%x data=%p)\n", type, pidldata);*/ {/* TRACE(pidl,"(pidl%p)\n", pidl);*/
if(!pidldata) LPPIDLDATA pdata =_ILGetDataPointer(pidl);
{ return NULL;
}
switch (type) if (pdata)
{ {
case PT_MYCOMP: switch (pdata->type)
case PT_SPECIAL: {
return NULL; case PT_MYCOMP:
case PT_SPECIAL:
return NULL;
case PT_DRIVE: case PT_DRIVE:
case PT_DRIVE1: case PT_DRIVE1:
case PT_DRIVE2: case PT_DRIVE2:
case PT_DRIVE3: case PT_DRIVE3:
return (LPSTR)&(pidldata->u.drive.szDriveName); return (LPSTR)&(pdata->u.drive.szDriveName);
case PT_FOLDER: case PT_FOLDER:
case PT_FOLDER1: case PT_FOLDER1:
case PT_VALUE: case PT_VALUE:
case PT_IESPECIAL: case PT_IESPECIAL:
return (LPSTR)&(pidldata->u.file.szNames); return (LPSTR)&(pdata->u.file.szNames);
case PT_WORKGRP: case PT_WORKGRP:
case PT_COMP: case PT_COMP:
case PT_NETWORK: case PT_NETWORK:
case PT_SHARE: case PT_SHARE:
return (LPSTR)&(pidldata->u.network.szNames); return (LPSTR)&(pdata->u.network.szNames);
}
} }
return NULL; return NULL;
} }
@ -1473,21 +1478,23 @@ LPSTR _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata)
* _ILGetSTextPointer() * _ILGetSTextPointer()
* gets a pointer to the short filename string stored in the pidl * gets a pointer to the short filename string stored in the pidl
*/ */
LPSTR _ILGetSTextPointer(PIDLTYPE type, LPPIDLDATA pidldata) LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl)
{/* TRACE(pidl,"(type=%x data=%p)\n", type, pidldata);*/ {/* TRACE(pidl,"(pidl%p)\n", pidl);*/
if(!pidldata) LPPIDLDATA pdata =_ILGetDataPointer(pidl);
return NULL;
switch (type) if (pdata)
{ {
case PT_FOLDER: switch (pdata->type)
case PT_VALUE: {
case PT_IESPECIAL: case PT_FOLDER:
return (LPSTR)(pidldata->u.file.szNames + strlen (pidldata->u.file.szNames) + 1); case PT_VALUE:
case PT_IESPECIAL:
return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1);
case PT_WORKGRP: case PT_WORKGRP:
return (LPSTR)(pidldata->u.network.szNames + strlen (pidldata->u.network.szNames) + 1); return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1);
}
} }
return NULL; return NULL;
} }
@ -1658,7 +1665,7 @@ void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
} }
/************************************************************************* /*************************************************************************
* _ILGetAttributeStr * _ILGetFileAttributes
* *
* Given the ItemIdList, get the Attrib string format * Given the ItemIdList, get the Attrib string format
* *
@ -1668,55 +1675,52 @@ void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
* uOutsize [I] The size of the Buffer * uOutsize [I] The size of the Buffer
* *
* RETURNS * RETURNS
* True if successful * Attributes
* *
* NOTES * NOTES
* *
*/ */
BOOL _ILGetAttributeStr(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
{ {
LPPIDLDATA pData =_ILGetDataPointer(pidl); LPPIDLDATA pData =_ILGetDataPointer(pidl);
WORD wAttrib; WORD wAttrib = 0;
int i; int i;
/* Need At Least 6 characters to represent the Attrib String */ switch(pData->type)
if(uOutSize < 6) {
{ case PT_FOLDER:
return FALSE; wAttrib = pData->u.folder.uFileAttribs;
} break;
switch(pData->type) case PT_VALUE:
{ wAttrib = pData->u.file.uFileAttribs;
case PT_FOLDER: break;
wAttrib = pData->u.folder.uFileAttribs; }
break;
case PT_VALUE: if(uOutSize >= 6)
wAttrib = pData->u.file.uFileAttribs; {
break; i=0;
default: if(wAttrib & FILE_ATTRIBUTE_READONLY)
return FALSE; {
} pOut[i++] = 'R';
i=0; }
if(wAttrib & FILE_ATTRIBUTE_READONLY) if(wAttrib & FILE_ATTRIBUTE_HIDDEN)
{ {
pOut[i++] = 'R'; pOut[i++] = 'H';
} }
if(wAttrib & FILE_ATTRIBUTE_HIDDEN) if(wAttrib & FILE_ATTRIBUTE_SYSTEM)
{ {
pOut[i++] = 'H'; pOut[i++] = 'S';
} }
if(wAttrib & FILE_ATTRIBUTE_SYSTEM) if(wAttrib & FILE_ATTRIBUTE_ARCHIVE)
{ {
pOut[i++] = 'S'; pOut[i++] = 'A';
} }
if(wAttrib & FILE_ATTRIBUTE_ARCHIVE) if(wAttrib & FILE_ATTRIBUTE_COMPRESSED)
{ {
pOut[i++] = 'A'; pOut[i++] = 'C';
} }
if(wAttrib & FILE_ATTRIBUTE_COMPRESSED) pOut[i] = 0x00;
{ }
pOut[i++] = 'C'; return wAttrib;
}
pOut[i] = 0x00;
return TRUE;
} }

View File

@ -121,7 +121,7 @@ BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
BOOL _ILGetAttributeStr (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); DWORD _ILGetFileAttributes (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft); BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft);
DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT16); DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT16);
@ -158,8 +158,8 @@ LPITEMIDLIST _ILCreateSpecial (LPCSTR szGUID);
* helper functions (getting struct-pointer) * helper functions (getting struct-pointer)
*/ */
LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST); LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST);
LPSTR _ILGetTextPointer (PIDLTYPE type, LPPIDLDATA pidldata); LPSTR _ILGetTextPointer (LPCITEMIDLIST);
LPSTR _ILGetSTextPointer (PIDLTYPE type, LPPIDLDATA pidldata); LPSTR _ILGetSTextPointer (LPCITEMIDLIST);
REFIID _ILGetGUIDPointer (LPCITEMIDLIST pidl); REFIID _ILGetGUIDPointer (LPCITEMIDLIST pidl);
/* /*

View File

@ -28,6 +28,13 @@
DEFAULT_DEBUG_CHANNEL(shell) DEFAULT_DEBUG_CHANNEL(shell)
DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id); DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id);
extern IShellFolder * IShellFolder_Constructor(
IShellFolder * psf,
LPITEMIDLIST pidl);
extern HRESULT IFSFolder_Constructor(
IUnknown * pUnkOuter,
REFIID riid,
LPVOID * ppv);
/************************************************************************* /*************************************************************************
* SHCoCreateInstance [SHELL32.102] * SHCoCreateInstance [SHELL32.102]
@ -62,14 +69,22 @@ LRESULT WINAPI SHCoCreateInstance(
TRACE("(%p,\n\tCLSID:\t%s, unk:%p\n\tIID:\t%s,%p)\n", TRACE("(%p,\n\tCLSID:\t%s, unk:%p\n\tIID:\t%s,%p)\n",
aclsid,xclsid,unknownouter,xiid,ppv); aclsid,xclsid,unknownouter,xiid,ppv);
hres = CoCreateInstance(myclsid, unknownouter, CLSCTX_INPROC_SERVER, refiid, ppv); if IsEqualCLSID(myclsid, &CLSID_ShellFSFolder)
{
hres = IFSFolder_Constructor(unknownouter, refiid, ppv);
}
else
{
hres = CoCreateInstance(myclsid, unknownouter, CLSCTX_INPROC_SERVER, refiid, ppv);
}
if(hres!=S_OK) if(hres!=S_OK)
{ {
ERR("failed (0x%08lx) to create \n\tCLSID:\t%s\n\tIID:\t%s\n", hres, xclsid, xiid); ERR("failed (0x%08lx) to create \n\tCLSID:\t%s\n\tIID:\t%s\n", hres, xclsid, xiid);
ERR("you might need to import the winedefault.reg\n"); ERR("class not found in registry\n");
} }
TRACE("-- instance: %p\n",*ppv);
return hres; return hres;
} }
@ -87,11 +102,6 @@ HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv
*ppv = NULL; *ppv = NULL;
if(IsEqualCLSID(rclsid, &CLSID_PaperBin))
{
ERR("paper bin not implemented\n");
return CLASS_E_CLASSNOTAVAILABLE;
}
if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)|| if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)||
IsEqualCLSID(rclsid, &CLSID_ShellLink)) IsEqualCLSID(rclsid, &CLSID_ShellLink))
{ {

View File

@ -469,10 +469,10 @@ DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) {
* free_ptr() - frees memory using IMalloc * free_ptr() - frees memory using IMalloc
* exported by ordinal * exported by ordinal
*/ */
/*#define MEM_DEBUG 1*/ #define MEM_DEBUG 0
DWORD WINAPI SHFree(LPVOID x) DWORD WINAPI SHFree(LPVOID x)
{ {
#ifdef MEM_DEBUG #if MEM_DEBUG
WORD len = *(LPWORD)(x-2); WORD len = *(LPWORD)(x-2);
if ( *(LPWORD)(x+len) != 0x7384) if ( *(LPWORD)(x+len) != 0x7384)
@ -503,13 +503,13 @@ LPVOID WINAPI SHAlloc(DWORD len)
{ {
LPBYTE ret; LPBYTE ret;
#ifdef MEM_DEBUG #if MEM_DEBUG
ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6); ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
#else #else
ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len); ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
#endif #endif
#ifdef MEM_DEBUG #if MEM_DEBUG
*(LPWORD)(ret) = 0x8271; *(LPWORD)(ret) = 0x8271;
*(LPWORD)(ret+2) = (WORD)len; *(LPWORD)(ret+2) = (WORD)len;
*(LPWORD)(ret+4+len) = 0x7384; *(LPWORD)(ret+4+len) = 0x7384;

View File

@ -777,6 +777,7 @@ HRESULT WINAPI PathProcessCommandA (LPSTR lpCommand, LPSTR v, DWORD w, DWORD x)
{ {
FIXME("%p(%s) %p 0x%04lx 0x%04lx stub\n", FIXME("%p(%s) %p 0x%04lx 0x%04lx stub\n",
lpCommand, lpCommand, v, w,x ); lpCommand, lpCommand, v, w,x );
lstrcpyA(v, lpCommand);
return 0; return 0;
} }

File diff suppressed because it is too large Load Diff

View File

@ -417,8 +417,8 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
/* Sort by Attribute: Folder or Files can be sorted */ /* Sort by Attribute: Folder or Files can be sorted */
else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_ATTRIB) else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_ATTRIB)
{ {
_ILGetAttributeStr(pItemIdList1, strName1, MAX_PATH); _ILGetFileAttributes(pItemIdList1, strName1, MAX_PATH);
_ILGetAttributeStr(pItemIdList2, strName2, MAX_PATH); _ILGetFileAttributes(pItemIdList2, strName2, MAX_PATH);
nDiff = strcasecmp(strName1, strName2); nDiff = strcasecmp(strName1, strName2);
} }
/* Sort by FileName: Folder or Files can be sorted */ /* Sort by FileName: Folder or Files can be sorted */

View File

@ -31,15 +31,17 @@ DEFINE_GUID (IID_IDockingWindow, 0x012dd920L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00,
DEFINE_GUID (IID_IDockingWindowSite, 0x2A342FC2L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); DEFINE_GUID (IID_IDockingWindowSite, 0x2A342FC2L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8);
/**************************************************************************** /****************************************************************************
* undocumented stuff * the next IID's are the namespace elements of the pidls
*/ */
/* the next IID's are the namespace elements of the pidls */ DEFINE_GUID(CLSID_NetworkPlaces, 0x208D2C60, 0x3AEA, 0x1069, 0xA2, 0xD7, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID (IID_MyComputer, 0x20D04FE0L, 0x3AEA, 0x1069, 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_NetworkDomain, 0x46e06680, 0x4bf0, 0x11d1, 0x83, 0xee, 0x00, 0xa0, 0xc9, 0x0d, 0xc8, 0x49);
DEFINE_GUID (IID_IExplore, 0x871C5380L, 0x42A0, 0x1069, 0xA2, 0xEA, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_NetworkServer, 0xc0542a90, 0x4bf0, 0x11d1, 0x83, 0xee, 0x00, 0xa0, 0xc9, 0x0d, 0xc8, 0x49);
DEFINE_GUID (IID_Control, 0x23EC2020L, 0x3AEA, 0x1069, 0xA2, 0xDD, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_NetworkShare, 0x54a754c0, 0x4bf0, 0x11d1, 0x83, 0xee, 0x00, 0xa0, 0xc9, 0x0d, 0xc8, 0x49);
DEFINE_GUID (IID_Printer, 0x2227A280L, 0x3AEA, 0x1069, 0xA2, 0xDE, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_MyComputer, 0x20D04FE0, 0x3AEA, 0x1069, 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID (IID_Network, 0x208D2C60L, 0x3AEA, 0x1069, 0xA2, 0xD7, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_Internet, 0x871C5380, 0x42A0, 0x1069, 0xA2, 0xEA, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID (IID_BitBucket, 0x645FF040L, 0x5081, 0x101B, 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E); DEFINE_GUID(CLSID_ShellFSFolder, 0xF3364BA0, 0x65B9, 0x11CE, 0xA9, 0xBA, 0x00, 0xAA, 0x00, 0x4A, 0xE8, 0x37);
DEFINE_GUID(CLSID_RecycleBin, 0x645FF040, 0x5081, 0x101B, 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E);
DEFINE_GUID (CLSID_PaperBin, 0x645FF040L, 0x5081, 0x101B, 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E); DEFINE_GUID(CLSID_ControlPanel, 0x21EC2020, 0x3AEA, 0x1069, 0xA2, 0xDD, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID(CLSID_Printers, 0x2227A280, 0x3AEA, 0x1069, 0xA2, 0xDE, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
DEFINE_GUID(CLSID_MyDocuments, 0x450d8fba, 0xad25, 0x11d0, 0x98, 0xa8, 0x08, 0x00, 0x36, 0x1b, 0x11, 0x03);
#endif /* __WINE_SHLGUID_H */ #endif /* __WINE_SHLGUID_H */