New class IDLList "Item ID List List" (internal).
This commit is contained in:
parent
5733ed761d
commit
7a78cfef8b
|
@ -96,10 +96,6 @@ LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
|
||||||
{ DWORD len;
|
{ DWORD len;
|
||||||
LPITEMIDLIST newpidl;
|
LPITEMIDLIST newpidl;
|
||||||
|
|
||||||
TRACE(pidl,"%p\n",pidl);
|
|
||||||
|
|
||||||
pdump(pidl);
|
|
||||||
|
|
||||||
if (!pidl)
|
if (!pidl)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -107,6 +103,10 @@ LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
|
||||||
newpidl = (LPITEMIDLIST)SHAlloc(len);
|
newpidl = (LPITEMIDLIST)SHAlloc(len);
|
||||||
if (newpidl)
|
if (newpidl)
|
||||||
memcpy(newpidl,pidl,len);
|
memcpy(newpidl,pidl,len);
|
||||||
|
|
||||||
|
TRACE(pidl,"pidl=%p newpidl=%p\n",pidl, newpidl);
|
||||||
|
pdump(pidl);
|
||||||
|
|
||||||
return newpidl;
|
return newpidl;
|
||||||
}
|
}
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -118,7 +118,6 @@ LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
|
||||||
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
|
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
|
||||||
{ DWORD len;
|
{ DWORD len;
|
||||||
LPITEMIDLIST newpidl=NULL;
|
LPITEMIDLIST newpidl=NULL;
|
||||||
TRACE(pidl,"pidl=%p\n",pidl);
|
|
||||||
|
|
||||||
if (pidl)
|
if (pidl)
|
||||||
{ len = pidl->mkid.cb;
|
{ len = pidl->mkid.cb;
|
||||||
|
@ -128,6 +127,7 @@ LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
|
||||||
ILGetNext(newpidl)->mkid.cb = 0x00;
|
ILGetNext(newpidl)->mkid.cb = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TRACE(pidl,"pidl=%p newpidl=%p\n",pidl, newpidl);
|
||||||
|
|
||||||
return newpidl;
|
return newpidl;
|
||||||
}
|
}
|
||||||
|
@ -224,8 +224,6 @@ DWORD WINAPI ILGetSize(LPITEMIDLIST pidl)
|
||||||
{ LPSHITEMID si = &(pidl->mkid);
|
{ LPSHITEMID si = &(pidl->mkid);
|
||||||
DWORD len=0;
|
DWORD len=0;
|
||||||
|
|
||||||
/*TRACE(pidl,"pidl=%p\n",pidl);*/
|
|
||||||
|
|
||||||
if (pidl)
|
if (pidl)
|
||||||
{ while (si->cb)
|
{ while (si->cb)
|
||||||
{ len += si->cb;
|
{ len += si->cb;
|
||||||
|
@ -233,7 +231,7 @@ DWORD WINAPI ILGetSize(LPITEMIDLIST pidl)
|
||||||
}
|
}
|
||||||
len += 2;
|
len += 2;
|
||||||
}
|
}
|
||||||
/*TRACE(pidl,"-- size=%lu\n",len);*/
|
TRACE(pidl,"pidl=%p size=%lu\n",pidl, len);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -250,7 +248,7 @@ DWORD WINAPI ILGetSize(LPITEMIDLIST pidl)
|
||||||
LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl)
|
LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl)
|
||||||
{ LPITEMIDLIST nextpidl;
|
{ LPITEMIDLIST nextpidl;
|
||||||
|
|
||||||
/* TRACE(pidl,"(pidl=%p)\n",pidl);*/
|
TRACE(pidl,"(pidl=%p)\n",pidl);
|
||||||
if(pidl)
|
if(pidl)
|
||||||
{ nextpidl = (LPITEMIDLIST)(LPBYTE)(((LPBYTE)pidl) + pidl->mkid.cb);
|
{ nextpidl = (LPITEMIDLIST)(LPBYTE)(((LPBYTE)pidl) + pidl->mkid.cb);
|
||||||
return nextpidl;
|
return nextpidl;
|
||||||
|
@ -467,7 +465,7 @@ DWORD WINAPI _ILGetFolderText(LPCITEMIDLIST pidl,LPSTR lpszPath, DWORD dwSize)
|
||||||
DWORD dwCopied = 0;
|
DWORD dwCopied = 0;
|
||||||
LPSTR pText;
|
LPSTR pText;
|
||||||
|
|
||||||
TRACE(pidl,"(%p)\n",pidl);
|
TRACE(pidl,"(%p path=%p)\n",pidl, lpszPath);
|
||||||
|
|
||||||
if(!pidl)
|
if(!pidl)
|
||||||
{ return 0;
|
{ return 0;
|
||||||
|
@ -679,7 +677,7 @@ LPITEMIDLIST WINAPI _ILCreate(PIDLTYPE type, LPVOID pIn, UINT16 uInSize)
|
||||||
/* the sizes of: cb(2), pidldata-1, szText+1, next cb(2) */
|
/* the sizes of: cb(2), pidldata-1, szText+1, next cb(2) */
|
||||||
switch (type)
|
switch (type)
|
||||||
{ case PT_DRIVE:
|
{ case PT_DRIVE:
|
||||||
uSize = 4 + 10;
|
uSize = 4 + 9;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
uSize = 4 + (sizeof(PIDLDATA)) + uInSize;
|
uSize = 4 + (sizeof(PIDLDATA)) + uInSize;
|
||||||
|
@ -798,3 +796,118 @@ LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata)
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* IDLList "Item ID List List"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static UINT32 IDLList_GetState(LPIDLLIST this);
|
||||||
|
static LPITEMIDLIST IDLList_GetElement(LPIDLLIST this, UINT32 nIndex);
|
||||||
|
static UINT32 IDLList_GetCount(LPIDLLIST this);
|
||||||
|
static BOOL32 IDLList_StoreItem(LPIDLLIST this, LPITEMIDLIST pidl);
|
||||||
|
static BOOL32 IDLList_AddItems(LPIDLLIST this, LPITEMIDLIST *apidl, UINT32 cidl);
|
||||||
|
static BOOL32 IDLList_InitList(LPIDLLIST this);
|
||||||
|
static void IDLList_CleanList(LPIDLLIST this);
|
||||||
|
|
||||||
|
static IDLList_VTable idllvt =
|
||||||
|
{ IDLList_GetState,
|
||||||
|
IDLList_GetElement,
|
||||||
|
IDLList_GetCount,
|
||||||
|
IDLList_StoreItem,
|
||||||
|
IDLList_AddItems,
|
||||||
|
IDLList_InitList,
|
||||||
|
IDLList_CleanList
|
||||||
|
};
|
||||||
|
|
||||||
|
LPIDLLIST IDLList_Constructor (UINT32 uStep)
|
||||||
|
{ LPIDLLIST lpidll;
|
||||||
|
if (!(lpidll = (LPIDLLIST)HeapAlloc(GetProcessHeap(),0,sizeof(IDLList))))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
lpidll->lpvtbl=&idllvt;
|
||||||
|
lpidll->uStep=uStep;
|
||||||
|
lpidll->dpa=NULL;
|
||||||
|
|
||||||
|
TRACE (shell,"(%p)\n",lpidll);
|
||||||
|
return lpidll;
|
||||||
|
}
|
||||||
|
void IDLList_Destructor(LPIDLLIST this)
|
||||||
|
{ TRACE (shell,"(%p)\n",this);
|
||||||
|
IDLList_CleanList(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32 IDLList_GetState(LPIDLLIST this)
|
||||||
|
{ TRACE (shell,"(%p)->(uStep=%u dpa=%p)\n",this, this->uStep, this->dpa);
|
||||||
|
|
||||||
|
if (this->uStep == 0)
|
||||||
|
{ if (this->dpa)
|
||||||
|
return(State_Init);
|
||||||
|
return(State_OutOfMem);
|
||||||
|
}
|
||||||
|
return(State_UnInit);
|
||||||
|
}
|
||||||
|
static LPITEMIDLIST IDLList_GetElement(LPIDLLIST this, UINT32 nIndex)
|
||||||
|
{ TRACE (shell,"(%p)->(index=%u)\n",this, nIndex);
|
||||||
|
return((LPITEMIDLIST)DPA_GetPtr(this->dpa, nIndex));
|
||||||
|
}
|
||||||
|
static UINT32 IDLList_GetCount(LPIDLLIST this)
|
||||||
|
{ TRACE (shell,"(%p)\n",this);
|
||||||
|
return(IDLList_GetState(this)==State_Init ? DPA_GetPtrCount(this->dpa) : 0);
|
||||||
|
}
|
||||||
|
static BOOL32 IDLList_StoreItem(LPIDLLIST this, LPITEMIDLIST pidl)
|
||||||
|
{ TRACE (shell,"(%p)->(pidl=%p)\n",this, pidl);
|
||||||
|
if (pidl)
|
||||||
|
{ if (IDLList_InitList(this) && DPA_InsertPtr(this->dpa, 0x7fff, (LPSTR)pidl)>=0)
|
||||||
|
return(TRUE);
|
||||||
|
ILFree(pidl);
|
||||||
|
}
|
||||||
|
IDLList_CleanList(this);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
static BOOL32 IDLList_AddItems(LPIDLLIST this, LPITEMIDLIST *apidl, UINT32 cidl)
|
||||||
|
{ INT32 i;
|
||||||
|
TRACE (shell,"(%p)->(apidl=%p cidl=%u)\n",this, apidl, cidl);
|
||||||
|
|
||||||
|
for (i=0; i<cidl; ++i)
|
||||||
|
{ if (!IDLList_StoreItem(this, ILClone((LPCITEMIDLIST)apidl[i])))
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
static BOOL32 IDLList_InitList(LPIDLLIST this)
|
||||||
|
{ TRACE (shell,"(%p)\n",this);
|
||||||
|
switch (IDLList_GetState(this))
|
||||||
|
{ case State_Init:
|
||||||
|
return(TRUE);
|
||||||
|
|
||||||
|
case State_OutOfMem:
|
||||||
|
return(FALSE);
|
||||||
|
|
||||||
|
case State_UnInit:
|
||||||
|
default:
|
||||||
|
this->dpa = DPA_Create(this->uStep);
|
||||||
|
this->uStep = 0;
|
||||||
|
return(IDLList_InitList(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void IDLList_CleanList(LPIDLLIST this)
|
||||||
|
{ INT32 i;
|
||||||
|
TRACE (shell,"(%p)\n",this);
|
||||||
|
|
||||||
|
if (this->uStep != 0)
|
||||||
|
{ this->dpa = NULL;
|
||||||
|
this->uStep = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->dpa)
|
||||||
|
{ return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=DPA_GetPtrCount(this->dpa)-1; i>=0; --i)
|
||||||
|
{ ILFree(IDLList_GetElement(this,i));
|
||||||
|
}
|
||||||
|
|
||||||
|
DPA_Destroy(this->dpa);
|
||||||
|
this->dpa=NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#ifndef __WINE_PIDL_H
|
#ifndef __WINE_PIDL_H
|
||||||
#define __WINE_PIDL_H
|
#define __WINE_PIDL_H
|
||||||
|
|
||||||
#include "shlobj.h"
|
#include "shlobj.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -34,16 +35,17 @@
|
||||||
* file: see the PIDLDATA structure
|
* file: see the PIDLDATA structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PT_DESKTOP 0x0000 /*fixme*/
|
#define PT_DESKTOP 0x00 /*fixme*/
|
||||||
#define PT_MYCOMP 0x001F
|
#define PT_MYCOMP 0x1F
|
||||||
#define PT_SPECIAL 0x002E
|
#define PT_SPECIAL 0x2E
|
||||||
#define PT_DRIVE 0x0023
|
#define PT_DRIVE 0x23
|
||||||
#define PT_FOLDER 0x0031
|
#define PT_FOLDER 0x31
|
||||||
#define PT_VALUE 0x0033 /*fixme*/
|
#define PT_VALUE 0x33 /*fixme*/
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
typedef WORD PIDLTYPE;
|
typedef BYTE PIDLTYPE;
|
||||||
typedef struct tagPIDLDATA
|
|
||||||
|
typedef struct tagPIDLDATA
|
||||||
{ PIDLTYPE type;
|
{ PIDLTYPE type;
|
||||||
union
|
union
|
||||||
{ struct
|
{ struct
|
||||||
|
@ -52,7 +54,8 @@ typedef WORD PIDLTYPE;
|
||||||
DWORD dwSFGAO;
|
DWORD dwSFGAO;
|
||||||
} drive;
|
} drive;
|
||||||
struct
|
struct
|
||||||
{ DWORD dwFileSize;
|
{ BYTE dummy;
|
||||||
|
DWORD dwFileSize;
|
||||||
WORD uFileDate;
|
WORD uFileDate;
|
||||||
WORD uFileTime;
|
WORD uFileTime;
|
||||||
WORD uFileAttribs;
|
WORD uFileAttribs;
|
||||||
|
@ -62,39 +65,34 @@ typedef WORD PIDLTYPE;
|
||||||
CHAR szText[1]; /* last entry, variable size */
|
CHAR szText[1]; /* last entry, variable size */
|
||||||
} file, folder, generic;
|
} file, folder, generic;
|
||||||
}u;
|
}u;
|
||||||
}
|
} PIDLDATA, *LPPIDLDATA;
|
||||||
/* here starts my implementation*/
|
|
||||||
PIDLDATA, *LPPIDLDATA;
|
|
||||||
#pragma pack(4)
|
#pragma pack(4)
|
||||||
|
|
||||||
LPITEMIDLIST WINAPI _ILCreateDesktop();
|
LPITEMIDLIST WINAPI _ILCreateDesktop();
|
||||||
LPITEMIDLIST WINAPI _ILCreateMyComputer();
|
LPITEMIDLIST WINAPI _ILCreateMyComputer();
|
||||||
LPITEMIDLIST WINAPI _ILCreateDrive(LPCSTR);
|
LPITEMIDLIST WINAPI _ILCreateDrive(LPCSTR);
|
||||||
LPITEMIDLIST WINAPI _ILCreateFolder(LPCSTR);
|
LPITEMIDLIST WINAPI _ILCreateFolder(LPCSTR);
|
||||||
LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR);
|
LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR);
|
||||||
LPITEMIDLIST WINAPI _ILCreate(PIDLTYPE,LPVOID,UINT16);
|
LPITEMIDLIST WINAPI _ILCreate(PIDLTYPE,LPVOID,UINT16);
|
||||||
|
|
||||||
BOOL32 WINAPI _ILGetDrive(LPCITEMIDLIST,LPSTR,UINT16);
|
BOOL32 WINAPI _ILGetDrive(LPCITEMIDLIST,LPSTR,UINT16);
|
||||||
DWORD WINAPI _ILGetItemText(LPCITEMIDLIST,LPSTR,UINT16);
|
DWORD WINAPI _ILGetItemText(LPCITEMIDLIST,LPSTR,UINT16);
|
||||||
DWORD WINAPI _ILGetFolderText(LPCITEMIDLIST,LPSTR,DWORD);
|
DWORD WINAPI _ILGetFolderText(LPCITEMIDLIST,LPSTR,DWORD);
|
||||||
DWORD WINAPI _ILGetValueText(LPCITEMIDLIST,LPSTR,DWORD);
|
DWORD WINAPI _ILGetValueText(LPCITEMIDLIST,LPSTR,DWORD);
|
||||||
DWORD WINAPI _ILGetDataText(LPCITEMIDLIST,LPCITEMIDLIST,LPSTR,DWORD);
|
DWORD WINAPI _ILGetDataText(LPCITEMIDLIST,LPCITEMIDLIST,LPSTR,DWORD);
|
||||||
DWORD WINAPI _ILGetPidlPath(LPCITEMIDLIST,LPSTR,DWORD);
|
DWORD WINAPI _ILGetPidlPath(LPCITEMIDLIST,LPSTR,DWORD);
|
||||||
DWORD WINAPI _ILGetData(PIDLTYPE,LPCITEMIDLIST,LPVOID,UINT16);
|
DWORD WINAPI _ILGetData(PIDLTYPE,LPCITEMIDLIST,LPVOID,UINT16);
|
||||||
|
|
||||||
BOOL32 WINAPI _ILIsDesktop(LPCITEMIDLIST);
|
BOOL32 WINAPI _ILIsDesktop(LPCITEMIDLIST);
|
||||||
BOOL32 WINAPI _ILIsMyComputer(LPCITEMIDLIST);
|
BOOL32 WINAPI _ILIsMyComputer(LPCITEMIDLIST);
|
||||||
BOOL32 WINAPI _ILIsDrive(LPCITEMIDLIST);
|
BOOL32 WINAPI _ILIsDrive(LPCITEMIDLIST);
|
||||||
BOOL32 WINAPI _ILIsFolder(LPCITEMIDLIST);
|
BOOL32 WINAPI _ILIsFolder(LPCITEMIDLIST);
|
||||||
BOOL32 WINAPI _ILIsValue(LPCITEMIDLIST);
|
BOOL32 WINAPI _ILIsValue(LPCITEMIDLIST);
|
||||||
|
|
||||||
BOOL32 WINAPI _ILHasFolders(LPSTR,LPCITEMIDLIST);
|
BOOL32 WINAPI _ILHasFolders(LPSTR,LPCITEMIDLIST);
|
||||||
|
|
||||||
LPPIDLDATA WINAPI _ILGetDataPointer(LPCITEMIDLIST);
|
LPPIDLDATA WINAPI _ILGetDataPointer(LPCITEMIDLIST);
|
||||||
LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata);
|
LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata);
|
||||||
/*
|
|
||||||
BOOL32 WINAPI _ILGetDesktop(LPCITEMIDLIST,LPSTR);
|
void pdump (LPCITEMIDLIST pidl);
|
||||||
BOOL32 WINAPI _ILSeparatePathAndValue(LPITEMIDLIST,LPITEMIDLIST*,LPITEMIDLIST*);
|
|
||||||
BOOL32 WINAPI _ILGetValueType(LPCITEMIDLIST,LPCITEMIDLIST,LPDWORD);
|
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue