extern LPVOID WINAPI Alloc(INT);
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
*
* PARAMS
* 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
* type [I] Type of display name to retrieve
* 0 = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR uses always the desktop as root
* RETURNS
* 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;
WCHAR wPath[MAX_PATH];
return NULL;
len = ILGetSize(pidl);
- newpidl = (LPITEMIDLIST)SHAlloc(len);
+ newpidl = SHAlloc(len);
if (newpidl)
memcpy(newpidl,pidl,len);
if (pidl)
{
len = pidl->mkid.cb;
- pidlNew = (LPITEMIDLIST) SHAlloc (len+2);
+ pidlNew = SHAlloc(len+2);
if (pidlNew)
{
memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */
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);
if (wLen != 0)
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)))
ret = S_OK;
return NULL;
len = ILGetSize(pidl);
- newpidl = (LPITEMIDLIST)Alloc(len);
+ newpidl = Alloc(len);
if (newpidl)
memcpy(newpidl,pidl,len);
if (SUCCEEDED(hr))
{
/*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_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]);
}
/*************************************************************************
- * ILAppendID [SHELL32.154]
+ * ILAppend [SHELL32.154]
*
* Adds the single ItemID item to the ItemIDList indicated by pidl.
* If bEnd is FALSE, inserts the item in the front of the list,
* 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.
*/
-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)
{
LPSHELLFOLDER pSF = NULL;
IShellFolder_Release(pSF);
- if (!SUCCEEDED(ret) && ppidl)
+ if (FAILED(ret) && ppidl)
*ppidl = NULL;
TRACE("%s %p 0x%x\n", debugstr_w(path), ppidl ? *ppidl : NULL, prgfInOut ? *prgfInOut : 0);
shortname = _ILGetSTextPointer(pidl);
if (filename)
- lstrcpynA(pfd->cFileName, filename, MAX_PATH);
+ lstrcpynA(pfd->cFileName, filename, sizeof(pfd->cFileName));
else
pfd->cFileName[0] = '\0';
if (shortname)
- lstrcpynA(pfd->cAlternateFileName, shortname, MAX_PATH);
+ lstrcpynA(pfd->cAlternateFileName, shortname, sizeof(pfd->cAlternateFileName));
else
pfd->cAlternateFileName[0] = '\0';
return NOERROR;
*
*************************************************************************
*/
-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;
{
LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
- memcpy(&(pData->u.guid.guid), guid, sizeof(GUID));
+ pData->u.guid.guid = *guid;
TRACE("-- create GUID-pidl %s\n",
debugstr_guid(&(pData->u.guid.guid)));
}
{
IID iid;
- if (!SUCCEEDED(SHCLSIDFromStringA(szGUID, &iid)))
+ if (FAILED(SHCLSIDFromStringA(szGUID, &iid)))
{
ERR("%s is not a GUID\n", szGUID);
return NULL;
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
{
if(pidl && pidl->mkid.cb != 0x00)
- return (LPPIDLDATA) &(pidl->mkid.abID);
+ return (LPPIDLDATA)pidl->mkid.abID;
return NULL;
}
* _ILGetTextPointerW()
* 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);*/
return NULL;
case PT_VALUEW:
- return (LPWSTR)&(pdata->u.file.szNames);
+ return (LPWSTR)pdata->u.file.szNames;
}
return NULL;
}
case PT_DRIVE1:
case PT_DRIVE2:
case PT_DRIVE3:
- return (LPSTR)&(pdata->u.drive.szDriveName);
+ return 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);
+ return pdata->u.file.szNames;
case PT_WORKGRP:
case PT_COMP:
case PT_NETWORK:
case PT_NETPROVIDER:
case PT_SHARE:
- return (LPSTR)&(pdata->u.network.szNames);
+ return pdata->u.network.szNames;
}
return NULL;
}
* _ILGetSTextPointer()
* 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); */
case PT_VALUE:
case PT_IESPECIAL1:
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:
- 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;
}
#ifndef __WINE_PIDL_H
#define __WINE_PIDL_H
-
#include <stdarg.h>
#include <windef.h>
* a pidl of NULL means the desktop
*
* 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
* ! size
#define PT_IESPECIAL2 0xb1
#define PT_SHARE 0xc3
-
#include "pshpack1.h"
typedef BYTE PIDLTYPE;
* 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,
* PT_SHELLEXT, or PT_YAGUID.
*/
*/
LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST);
LPSTR _ILGetTextPointer (LPCITEMIDLIST);
-LPWSTR _ILGetTextPointerW (LPCITEMIDLIST);
-LPSTR _ILGetSTextPointer (LPCITEMIDLIST);
IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl);
FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl);
LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl);
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);
#endif