3 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
5 typedef struct tagGUIDStruct
7 BYTE dummy
; /* offset 01 is unknown */
8 GUID guid
; /* offset 02 */
13 typedef struct tagPIDLDATA
18 struct tagGUIDStruct guid
;
19 struct tagVALUEStruct value
;
21 } PIDLDATA
, *LPPIDLDATA
;
23 typedef struct tagENUMLIST
25 struct tagENUMLIST
*pNext
;
28 }ENUMLIST
, *LPENUMLIST
;
32 const IEnumIDListVtbl
*lpVtbl
;
40 /**************************************************************************
49 IEnumIDListImpl
*This
= (IEnumIDListImpl
*)iface
;
55 pNew
= (LPENUMLIST
)SHAlloc(sizeof(ENUMLIST
));
64 This
->mpCurrent
= pNew
;
69 /*add the new item to the end of the list */
70 This
->mpLast
->pNext
= pNew
;
73 /*update the last item pointer */
83 IEnumIDList_fnQueryInterface(
88 IEnumIDListImpl
*This
= (IEnumIDListImpl
*)iface
;
92 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IEnumIDList
))
95 IEnumIDList_AddRef((IEnumIDList
*)*ppvObj
);
105 IEnumIDList_fnAddRef(
108 IEnumIDListImpl
*This
= (IEnumIDListImpl
*)iface
;
109 ULONG refCount
= InterlockedIncrement(&This
->ref
);
116 WINAPI
IEnumIDList_fnRelease(
120 IEnumIDListImpl
*This
= (IEnumIDListImpl
*)iface
;
121 ULONG refCount
= InterlockedDecrement(&This
->ref
);
127 pDelete
= This
->mpFirst
;
128 This
->mpFirst
= pDelete
->pNext
;
129 SHFree(pDelete
->pidl
);
143 LPITEMIDLIST
* rgelt
,
146 IEnumIDListImpl
*This
= (IEnumIDListImpl
*)iface
;
157 if(celt
> 1 && !pceltFetched
)
162 if(celt
> 0 && !This
->mpCurrent
)
167 for(i
= 0; i
< celt
; i
++)
169 if(!(This
->mpCurrent
))
172 temp
= ILClone(This
->mpCurrent
->pidl
);
174 This
->mpCurrent
= This
->mpCurrent
->pNext
;
189 IEnumIDList
* iface
,ULONG celt
)
191 IEnumIDListImpl
*This
= (IEnumIDListImpl
*)iface
;
196 for(dwIndex
= 0; dwIndex
< celt
; dwIndex
++)
203 This
->mpCurrent
= This
->mpCurrent
->pNext
;
214 IEnumIDListImpl
*This
= (IEnumIDListImpl
*)iface
;
216 This
->mpCurrent
= This
->mpFirst
;
225 LPENUMIDLIST
* ppenum
)
227 //IEnumIDListImpl *This = (IEnumIDListImpl *)iface;
232 static const IEnumIDListVtbl eidlvt
=
234 IEnumIDList_fnQueryInterface
,
235 IEnumIDList_fnAddRef
,
236 IEnumIDList_fnRelease
,
243 IEnumIDList
* IEnumIDList_Constructor(void)
245 IEnumIDListImpl
*lpeidl
= CoTaskMemAlloc(sizeof(IEnumIDListImpl
));
250 lpeidl
->lpVtbl
= &eidlvt
;
251 lpeidl
->mpCurrent
= NULL
;
252 lpeidl
->mpLast
= NULL
;
253 lpeidl
->mpFirst
= NULL
;
256 return (IEnumIDList
*)lpeidl
;
259 LPPIDLDATA
_ILGetDataPointer(LPCITEMIDLIST pidl
)
261 if(pidl
&& pidl
->mkid
.cb
!= 0x00)
262 return (LPPIDLDATA
) &(pidl
->mkid
.abID
);
266 LPITEMIDLIST
_ILAlloc(BYTE type
, unsigned int size
)
268 LPITEMIDLIST pidlOut
= NULL
;
270 pidlOut
= SHAlloc(size
+ 5);
275 ZeroMemory(pidlOut
, size
+ 5);
276 pidlOut
->mkid
.cb
= size
+ 3;
277 pData
= _ILGetDataPointer(pidlOut
);
286 LPITEMIDLIST
_ILCreateNetConnect()
288 LPITEMIDLIST pidlOut
;
290 pidlOut
= _ILAlloc(PT_GUID
, sizeof(PIDLDATA
));
293 LPPIDLDATA pData
= _ILGetDataPointer(pidlOut
);
295 memcpy(&(pData
->u
.guid
.guid
), &CLSID_NetworkConnections
, sizeof(GUID
));
300 IID
* _ILGetGUIDPointer(LPCITEMIDLIST pidl
)
302 LPPIDLDATA pdata
=_ILGetDataPointer(pidl
);
307 if (pdata
->type
!= PT_GUID
)
310 return &(pdata
->u
.guid
.guid
);
314 BOOL
_ILIsNetConnect(LPCITEMIDLIST pidl
)
316 REFIID iid
= _ILGetGUIDPointer(pidl
);
319 return IsEqualIID(iid
, &CLSID_NetworkConnections
);
323 LPITEMIDLIST
ILCreateNetConnectItem(INetConnection
* pItem
)
328 pidl
= _ILAlloc(0x99, sizeof(PIDLDATA
));
329 pdata
= _ILGetDataPointer(pidl
);
330 pdata
->u
.value
.pItem
= (PVOID
)pItem
;
335 VALUEStruct
* _ILGetValueStruct(LPCITEMIDLIST pidl
)
337 LPPIDLDATA pdata
= _ILGetDataPointer(pidl
);
339 if (pdata
&& pdata
->type
==0x99)
340 return (VALUEStruct
*)&(pdata
->u
.value
);