partial sync to wine 1.1.27

svn path=/trunk/; revision=42562
This commit is contained in:
Christoph von Wittich 2009-08-09 13:56:25 +00:00
parent 2127bca655
commit a8fca73ae8
4 changed files with 41 additions and 44 deletions

View file

@ -31,14 +31,17 @@ WINE_DECLARE_DEBUG_CHANNEL(shell);
extern LPVOID WINAPI Alloc(INT); extern LPVOID WINAPI Alloc(INT);
extern BOOL WINAPI Free(LPVOID); extern BOOL WINAPI Free(LPVOID);
static LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl);
static LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl);
/************************************************************************* /*************************************************************************
* ILGetDisplayNameEx [SHELL32.186] * ILGetDisplayNameExA [SHELL32.186]
* *
* Retrieves the display name of an ItemIDList * Retrieves the display name of an ItemIDList
* *
* PARAMS * PARAMS
* psf [I] Shell Folder to start with, if NULL the desktop is used * psf [I] Shell Folder to start with, if NULL the desktop is used
* pidl [I] ItemIDList relativ to the psf to get the display name for * pidl [I] ItemIDList relative to the psf to get the display name for
* path [O] Filled in with the display name, assumed to be at least MAX_PATH long * path [O] Filled in with the display name, assumed to be at least MAX_PATH long
* type [I] Type of display name to retrieve * type [I] Type of display name to retrieve
* 0 = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR uses always the desktop as root * 0 = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR uses always the desktop as root
@ -48,7 +51,7 @@ extern BOOL WINAPI Free(LPVOID);
* RETURNS * RETURNS
* True if the display name could be retrieved successfully, False otherwise * True if the display name could be retrieved successfully, False otherwise
*/ */
BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type) static BOOL ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type)
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
WCHAR wPath[MAX_PATH]; WCHAR wPath[MAX_PATH];
@ -210,7 +213,7 @@ LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
return NULL; return NULL;
len = ILGetSize(pidl); len = ILGetSize(pidl);
newpidl = (LPITEMIDLIST)SHAlloc(len); newpidl = SHAlloc(len);
if (newpidl) if (newpidl)
memcpy(newpidl,pidl,len); memcpy(newpidl,pidl,len);
@ -237,7 +240,7 @@ LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
if (pidl) if (pidl)
{ {
len = pidl->mkid.cb; len = pidl->mkid.cb;
pidlNew = (LPITEMIDLIST) SHAlloc (len+2); pidlNew = SHAlloc(len+2);
if (pidlNew) if (pidlNew)
{ {
memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */ memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */
@ -271,7 +274,7 @@ HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl)
IStream_AddRef (pStream); IStream_AddRef (pStream);
if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead))) if (SUCCEEDED(IStream_Read(pStream, &wLen, 2, &dwBytesRead)))
{ {
TRACE("PIDL length is %d\n", wLen); TRACE("PIDL length is %d\n", wLen);
if (wLen != 0) if (wLen != 0)
@ -326,7 +329,7 @@ HRESULT WINAPI ILSaveToStream (IStream * pStream, LPCITEMIDLIST pPidl)
wLen = ILGetSize(pPidl); wLen = ILGetSize(pPidl);
if (SUCCEEDED(IStream_Write(pStream, (LPVOID)&wLen, 2, NULL))) if (SUCCEEDED(IStream_Write(pStream, &wLen, 2, NULL)))
{ {
if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL))) if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL)))
ret = S_OK; ret = S_OK;
@ -442,7 +445,7 @@ LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl)
return NULL; return NULL;
len = ILGetSize(pidl); len = ILGetSize(pidl);
newpidl = (LPITEMIDLIST)Alloc(len); newpidl = Alloc(len);
if (newpidl) if (newpidl)
memcpy(newpidl,pidl,len); memcpy(newpidl,pidl,len);
@ -703,7 +706,7 @@ HRESULT WINAPI SHGetRealIDL(LPSHELLFOLDER lpsf, LPCITEMIDLIST pidlSimple, LPITEM
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
/*assert(pida->cidl==1);*/ /*assert(pida->cidl==1);*/
LPIDA pida = (LPIDA)GlobalLock(medium.u.hGlobal); LPIDA pida = GlobalLock(medium.u.hGlobal);
LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]); LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]);
@ -805,7 +808,7 @@ LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
} }
/************************************************************************* /*************************************************************************
* ILAppendID [SHELL32.154] * ILAppend [SHELL32.154]
* *
* Adds the single ItemID item to the ItemIDList indicated by pidl. * Adds the single ItemID item to the ItemIDList indicated by pidl.
* If bEnd is FALSE, inserts the item in the front of the list, * If bEnd is FALSE, inserts the item in the front of the list,
@ -963,7 +966,7 @@ LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path)
* is used to avoid having to verify the current path element on disk, so * is used to avoid having to verify the current path element on disk, so
* that creating an ItemIDList from a nonexistent path still can work. * that creating an ItemIDList from a nonexistent path still can work.
*/ */
static HRESULT WINAPI _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile, static HRESULT _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile,
BOOL bBindCtx, LPITEMIDLIST *ppidl, LPDWORD prgfInOut) BOOL bBindCtx, LPITEMIDLIST *ppidl, LPDWORD prgfInOut)
{ {
LPSHELLFOLDER pSF = NULL; LPSHELLFOLDER pSF = NULL;
@ -994,7 +997,7 @@ static HRESULT WINAPI _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile,
IShellFolder_Release(pSF); IShellFolder_Release(pSF);
if (!SUCCEEDED(ret) && ppidl) if (FAILED(ret) && ppidl)
*ppidl = NULL; *ppidl = NULL;
TRACE("%s %p 0x%x\n", debugstr_w(path), ppidl ? *ppidl : NULL, prgfInOut ? *prgfInOut : 0); TRACE("%s %p 0x%x\n", debugstr_w(path), ppidl ? *ppidl : NULL, prgfInOut ? *prgfInOut : 0);
@ -1101,12 +1104,12 @@ HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
shortname = _ILGetSTextPointer(pidl); shortname = _ILGetSTextPointer(pidl);
if (filename) if (filename)
lstrcpynA(pfd->cFileName, filename, MAX_PATH); lstrcpynA(pfd->cFileName, filename, sizeof(pfd->cFileName));
else else
pfd->cFileName[0] = '\0'; pfd->cFileName[0] = '\0';
if (shortname) if (shortname)
lstrcpynA(pfd->cAlternateFileName, shortname, MAX_PATH); lstrcpynA(pfd->cAlternateFileName, shortname, sizeof(pfd->cAlternateFileName));
else else
pfd->cAlternateFileName[0] = '\0'; pfd->cAlternateFileName[0] = '\0';
return NOERROR; return NOERROR;
@ -1300,7 +1303,14 @@ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCI
* *
************************************************************************* *************************************************************************
*/ */
LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size)
/* Basic PIDL constructor. Allocates size + 5 bytes, where:
* - two bytes are SHITEMID.cb
* - one byte is PIDLDATA.type
* - two bytes are the NULL PIDL terminator
* Sets type of the returned PIDL to type.
*/
static LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size)
{ {
LPITEMIDLIST pidlOut = NULL; LPITEMIDLIST pidlOut = NULL;
@ -1412,7 +1422,7 @@ LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid)
{ {
LPPIDLDATA pData = _ILGetDataPointer(pidlOut); LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
memcpy(&(pData->u.guid.guid), guid, sizeof(GUID)); pData->u.guid.guid = *guid;
TRACE("-- create GUID-pidl %s\n", TRACE("-- create GUID-pidl %s\n",
debugstr_guid(&(pData->u.guid.guid))); debugstr_guid(&(pData->u.guid.guid)));
} }
@ -1429,7 +1439,7 @@ LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID)
{ {
IID iid; IID iid;
if (!SUCCEEDED(SHCLSIDFromStringA(szGUID, &iid))) if (FAILED(SHCLSIDFromStringA(szGUID, &iid)))
{ {
ERR("%s is not a GUID\n", szGUID); ERR("%s is not a GUID\n", szGUID);
return NULL; return NULL;
@ -1904,7 +1914,7 @@ DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl) LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
{ {
if(pidl && pidl->mkid.cb != 0x00) if(pidl && pidl->mkid.cb != 0x00)
return (LPPIDLDATA) &(pidl->mkid.abID); return (LPPIDLDATA)pidl->mkid.abID;
return NULL; return NULL;
} }
@ -1912,7 +1922,7 @@ LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
* _ILGetTextPointerW() * _ILGetTextPointerW()
* gets a pointer to the unicode long filename string stored in the pidl * gets a pointer to the unicode long filename string stored in the pidl
*/ */
LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl) static LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl)
{ {
/* TRACE(pidl,"(pidl%p)\n", pidl);*/ /* TRACE(pidl,"(pidl%p)\n", pidl);*/
@ -1952,7 +1962,7 @@ LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl)
return NULL; return NULL;
case PT_VALUEW: case PT_VALUEW:
return (LPWSTR)&(pdata->u.file.szNames); return (LPWSTR)pdata->u.file.szNames;
} }
return NULL; return NULL;
} }
@ -1982,21 +1992,21 @@ LPSTR _ILGetTextPointer(LPCITEMIDLIST pidl)
case PT_DRIVE1: case PT_DRIVE1:
case PT_DRIVE2: case PT_DRIVE2:
case PT_DRIVE3: case PT_DRIVE3:
return (LPSTR)&(pdata->u.drive.szDriveName); return pdata->u.drive.szDriveName;
case PT_FOLDER: case PT_FOLDER:
case PT_FOLDER1: case PT_FOLDER1:
case PT_VALUE: case PT_VALUE:
case PT_IESPECIAL1: case PT_IESPECIAL1:
case PT_IESPECIAL2: case PT_IESPECIAL2:
return (LPSTR)&(pdata->u.file.szNames); return pdata->u.file.szNames;
case PT_WORKGRP: case PT_WORKGRP:
case PT_COMP: case PT_COMP:
case PT_NETWORK: case PT_NETWORK:
case PT_NETPROVIDER: case PT_NETPROVIDER:
case PT_SHARE: case PT_SHARE:
return (LPSTR)&(pdata->u.network.szNames); return pdata->u.network.szNames;
} }
return NULL; return NULL;
} }
@ -2005,7 +2015,7 @@ LPSTR _ILGetTextPointer(LPCITEMIDLIST pidl)
* _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(LPCITEMIDLIST pidl) static LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl)
{ {
/* TRACE(pidl,"(pidl%p)\n", pidl); */ /* TRACE(pidl,"(pidl%p)\n", pidl); */
@ -2020,10 +2030,10 @@ LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl)
case PT_VALUE: case PT_VALUE:
case PT_IESPECIAL1: case PT_IESPECIAL1:
case PT_IESPECIAL2: case PT_IESPECIAL2:
return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); return pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1;
case PT_WORKGRP: case PT_WORKGRP:
return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); return pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1;
} }
return NULL; return NULL;
} }

View file

@ -35,7 +35,6 @@
#ifndef __WINE_PIDL_H #ifndef __WINE_PIDL_H
#define __WINE_PIDL_H #define __WINE_PIDL_H
#include <stdarg.h> #include <stdarg.h>
#include <windef.h> #include <windef.h>
@ -50,7 +49,7 @@
* a pidl of NULL means the desktop * a pidl of NULL means the desktop
* *
* The structure of the pidl seems to be a union. The first byte of the * The structure of the pidl seems to be a union. The first byte of the
* PIDLDATA desribes the type of pidl. * PIDLDATA describes the type of pidl.
* *
* object ! first byte / ! format ! living space * object ! first byte / ! format ! living space
* ! size * ! size
@ -108,7 +107,6 @@
#define PT_IESPECIAL2 0xb1 #define PT_IESPECIAL2 0xb1
#define PT_SHARE 0xc3 #define PT_SHARE 0xc3
#include "pshpack1.h" #include "pshpack1.h"
typedef BYTE PIDLTYPE; typedef BYTE PIDLTYPE;
@ -257,14 +255,6 @@ BOOL __inline _ILIsEmpty (LPCITEMIDLIST pidl) { return _ILIsDeskto
* simple pidls * simple pidls
*/ */
/* Basic PIDL constructor. Allocates size + 5 bytes, where:
* - two bytes are SHITEMID.cb
* - one byte is PIDLDATA.type
* - two bytes are the NULL PIDL terminator
* Sets type of the returned PIDL to type.
*/
LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size);
/* Creates a PIDL with guid format and type type, which must be one of PT_GUID, /* Creates a PIDL with guid format and type type, which must be one of PT_GUID,
* PT_SHELLEXT, or PT_YAGUID. * PT_SHELLEXT, or PT_YAGUID.
*/ */
@ -297,8 +287,6 @@ LPITEMIDLIST _ILCreateDrive (LPCWSTR);
*/ */
LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST); LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST);
LPSTR _ILGetTextPointer (LPCITEMIDLIST); LPSTR _ILGetTextPointer (LPCITEMIDLIST);
LPWSTR _ILGetTextPointerW (LPCITEMIDLIST);
LPSTR _ILGetSTextPointer (LPCITEMIDLIST);
IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl); IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl);
FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl); FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl);
@ -315,7 +303,6 @@ void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl);
LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl); LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl);
LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida); LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida);
BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type);
BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type); BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type);
#endif #endif

View file

@ -94,7 +94,7 @@ HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LP
sf->lpVtblPersistFolder2 = &vt_PersistFolder2; sf->lpVtblPersistFolder2 = &vt_PersistFolder2;
sf->pidlRoot = _ILCreateMyComputer (); /* my qualified pidl */ sf->pidlRoot = _ILCreateMyComputer (); /* my qualified pidl */
if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) if (FAILED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv)))
{ {
IUnknown_Release (_IUnknown_ (sf)); IUnknown_Release (_IUnknown_ (sf));
return E_NOINTERFACE; return E_NOINTERFACE;
@ -180,7 +180,7 @@ static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
{ {
TRACE ("-- destroying IShellFolder(%p)\n", This); TRACE ("-- destroying IShellFolder(%p)\n", This);
SHFree (This->pidlRoot); SHFree (This->pidlRoot);
LocalFree ((HLOCAL) This); LocalFree (This);
} }
return refCount; return refCount;
} }

View file

@ -88,7 +88,7 @@ BOOL SHELL32_GetCustomFolderAttribute(
* *
* PARAMETERS * PARAMETERS
* pszNext [IN] string to get the element from * pszNext [IN] string to get the element from
* pszOut [IN] pointer to buffer whitch receives string * pszOut [IN] pointer to buffer which receives string
* dwOut [IN] length of pszOut * dwOut [IN] length of pszOut
* *
* RETURNS * RETURNS
@ -110,7 +110,7 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut)
while (*pszTail && (*pszTail != (WCHAR) '\\')) while (*pszTail && (*pszTail != (WCHAR) '\\'))
pszTail++; pszTail++;
dwCopy = (const WCHAR *) pszTail - (const WCHAR *) pszNext + 1; dwCopy = pszTail - pszNext + 1;
lstrcpynW (pszOut, pszNext, (dwOut < dwCopy) ? dwOut : dwCopy); lstrcpynW (pszOut, pszNext, (dwOut < dwCopy) ? dwOut : dwCopy);
if (*pszTail) if (*pszTail)