ReactOS 0.4.16-dev-125-g798ea90
enumlist.cpp File Reference
#include "precomp.h"
Include dependency graph for enumlist.cpp:

Go to the source code of this file.

Classes

struct  tagENUMLIST
 
class  CEnumIDList
 

Typedefs

typedef struct tagENUMLIST ENUMLIST
 
typedef struct tagENUMLISTLPENUMLIST
 

Functions

PNETCONIDSTRUCT ILGetConnData (PCITEMID_CHILD pidl)
 
PWCHAR ILGetConnName (PCITEMID_CHILD pidl)
 
PWCHAR ILGetDeviceName (PCITEMID_CHILD pidl)
 
PITEMID_CHILD ILCreateNetConnectItem (INetConnection *pItem)
 
HRESULT ILGetConnection (PCITEMID_CHILD pidl, INetConnection **pItem)
 
HRESULT CEnumIDList_CreateInstance (HWND hwndOwner, DWORD dwFlags, REFIID riid, LPVOID *ppv)
 

Typedef Documentation

◆ ENUMLIST

◆ LPENUMLIST

Function Documentation

◆ CEnumIDList_CreateInstance()

HRESULT CEnumIDList_CreateInstance ( HWND  hwndOwner,
DWORD  dwFlags,
REFIID  riid,
LPVOID ppv 
)

Definition at line 345 of file enumlist.cpp.

346{
347 return ShellObjectCreatorInit<CEnumIDList>(riid, ppv);
348}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by CNetworkConnections::EnumObjects().

◆ ILCreateNetConnectItem()

PITEMID_CHILD ILCreateNetConnectItem ( INetConnection pItem)

Definition at line 37 of file enumlist.cpp.

38{
39 PITEMID_CHILD pidl;
41 NETCON_PROPERTIES * pProperties;
42 PNETCONIDSTRUCT pnetid;
43 PWCHAR pwchName;
44
45 if (pItem->GetProperties(&pProperties) != S_OK)
46 return NULL;
47
48 size = sizeof(WORD); /* nr of bytes in this item */
49 size += sizeof(NETCONIDSTRUCT);
50 size += (wcslen(pProperties->pszwName) + 1) * sizeof(WCHAR);
51 size += (wcslen(pProperties->pszwDeviceName) + 1) * sizeof(WCHAR);
52
53 /* Allocate enough memory for the trailing id which will indicate that this is a simple id */
54 pidl = static_cast<LPITEMIDLIST>(SHAlloc(size + sizeof(SHITEMID)));
55 if (!pidl)
56 goto end;
57 pidl->mkid.cb = (WORD)size;
59
60 /* Copy the connection properties */
61 pnetid = ILGetConnData(pidl);
62 memset(pnetid->Unknown, 0, sizeof(pnetid->Unknown));
63 pnetid->clsidThisObject = pProperties->clsidThisObject;
64 pnetid->guidId = pProperties->guidId;
65 pnetid->Status = pProperties->Status;
66 pnetid->MediaType = pProperties->MediaType;
67 pnetid->dwCharacter = pProperties->dwCharacter;
68 pnetid->uNameOffset = sizeof(NETCONIDSTRUCT);
69 pnetid->uDeviceNameOffset = ULONG(pnetid->uNameOffset + (wcslen(pProperties->pszwName) + 1) * sizeof(WCHAR));
70
71 pwchName = ILGetConnName(pidl);
72 wcscpy(pwchName, pProperties->pszwName);
73
74 pwchName = ILGetDeviceName(pidl);
75 wcscpy(pwchName, pProperties->pszwDeviceName);
76
77 /* Set the trailing id to null */
78 memset((void*)((ULONG_PTR)pidl + size), 0, sizeof(SHITEMID));
79end:
80 NcFreeNetconProperties(pProperties);
81
82 return pidl;
83}
#define NULL
Definition: types.h:112
#define NETCONIDSTRUCT_SIG
Definition: precomp.h:59
struct tagNETCONIDSTRUCT NETCONIDSTRUCT
struct tagNETCONIDSTRUCT * PNETCONIDSTRUCT
static const WCHAR Signature[]
Definition: parser.c:141
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
PWCHAR ILGetDeviceName(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:29
PNETCONIDSTRUCT ILGetConnData(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:10
PWCHAR ILGetConnName(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:21
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HRESULT GetProperties([out] NETCON_PROPERTIES **ppProps)
#define S_OK
Definition: intsafe.h:52
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
BYTE abID[1]
Definition: shtypes.idl:28
WORD cb
Definition: shtypes.idl:27
SHITEMID mkid
Definition: shtypes.idl:34
DWORD dwCharacter
Definition: precomp.h:66
NETCON_MEDIATYPE MediaType
Definition: precomp.h:67
BYTE Unknown[8]
Definition: precomp.h:63
NETCON_STATUS Status
Definition: precomp.h:68
ULONG uDeviceNameOffset
Definition: precomp.h:70
ULONG uNameOffset
Definition: precomp.h:69
CLSID clsidThisObject
Definition: precomp.h:64
NETCON_STATUS Status
Definition: netcon.h:86
LPWSTR pszwDeviceName
Definition: netcon.h:85
CLSID clsidThisObject
Definition: netcon.h:89
NETCON_MEDIATYPE MediaType
Definition: netcon.h:87
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CEnumIDList::Initialize(), and CNetworkConnections::SetNameOf().

◆ ILGetConnData()

◆ ILGetConnection()

HRESULT ILGetConnection ( PCITEMID_CHILD  pidl,
INetConnection **  pItem 
)

Definition at line 85 of file enumlist.cpp.

86{
87 HRESULT hr;
92 NETCON_PROPERTIES * pProperties;
93
95 if (!pdata)
96 return E_FAIL;
97
98 /* get an instance to of IConnectionManager */
99 hr = CNetConnectionManager_CreateInstance(IID_PPV_ARG(INetConnectionManager, &pNetConMan));
101 return hr;
102
103 hr = pNetConMan->EnumConnections(NCME_DEFAULT, &pEnumCon);
105 return hr;
106
107 while (TRUE)
108 {
109 hr = pEnumCon->Next(1, &INetCon, &Count);
110 if (hr != S_OK)
111 return E_FAIL;
112
113 hr = INetCon->GetProperties(&pProperties);
115 continue;
116
117 BOOL bSame = !memcmp(&pProperties->guidId, &pdata->guidId, sizeof(GUID));
118
119 NcFreeNetconProperties(pProperties);
120
121 if (bSame)
122 {
123 *pItem = INetCon.Detach();
124 return S_OK;
125 }
126 }
127
128 return E_FAIL;
129}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
T * Detach()
Definition: atlcomcli.h:186
HRESULT WINAPI CNetConnectionManager_CreateInstance(REFIID riid, LPVOID *ppv)
#define E_FAIL
Definition: ddrawi.h:102
#define TRUE
Definition: types.h:120
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
unsigned int BOOL
Definition: ntddk_ex.h:94
static PROTOCOLDATA * pdata
Definition: protocol.c:158
@ NCME_DEFAULT
Definition: netcon.h:10
int Count
Definition: noreturn.cpp:7
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)

Referenced by CNetConUiObject::InvokeCommand(), and CNetworkConnections::SetNameOf().

◆ ILGetConnName()

PWCHAR ILGetConnName ( PCITEMID_CHILD  pidl)

Definition at line 21 of file enumlist.cpp.

22{
24 if (!pdata)
25 return NULL;
26 return (PWCHAR)&pidl->mkid.abID[pdata->uNameOffset];
27}

Referenced by CNetworkConnections::GetDetailsOf(), CNetworkConnections::GetDisplayNameOf(), and ILCreateNetConnectItem().

◆ ILGetDeviceName()

PWCHAR ILGetDeviceName ( PCITEMID_CHILD  pidl)

Definition at line 29 of file enumlist.cpp.

30{
32 if (!pdata)
33 return NULL;
34 return (PWCHAR)&pidl->mkid.abID[pdata->uDeviceNameOffset];
35}

Referenced by CNetworkConnections::GetDetailsOf(), and ILCreateNetConnectItem().