ReactOS 0.4.15-dev-7705-g2320c37
dcatitem.c File Reference
#include <ws2_32.h>
Include dependency graph for dcatitem.c:

Go to the source code of this file.

Functions

PTCATALOG_ENTRY WSAAPI WsTcEntryAllocate (VOID)
 
VOID WSAAPI WsTcEntryDelete (IN PTCATALOG_ENTRY CatalogEntry)
 
VOID WSAAPI WsTcEntryDereference (IN PTCATALOG_ENTRY CatalogEntry)
 
DWORD WSAAPI WsTcEntryInitializeFromRegistry (IN PTCATALOG_ENTRY CatalogEntry, IN HKEY ParentKey, IN DWORD UniqueId)
 
VOID WSAAPI WsTcEntrySetProvider (IN PTCATALOG_ENTRY Entry, IN PTPROVIDER Provider)
 

Function Documentation

◆ WsTcEntryAllocate()

PTCATALOG_ENTRY WSAAPI WsTcEntryAllocate ( VOID  )

Definition at line 17 of file dcatitem.c.

18{
19 PTCATALOG_ENTRY CatalogEntry;
20
21 /* Allocate the catalog entry */
22 CatalogEntry = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*CatalogEntry));
23 if (CatalogEntry)
24 {
25 /* Set the default non-null members */
26 CatalogEntry->RefCount = 1;
27 }
28
29 /* Return it */
30 return CatalogEntry;
31}
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
Definition: ws2_32p.h:86
LONG RefCount
Definition: ws2_32p.h:88
HANDLE WsSockHeap
Definition: dllmain.c:21

Referenced by WsTcRefreshFromRegistry().

◆ WsTcEntryDelete()

VOID WSAAPI WsTcEntryDelete ( IN PTCATALOG_ENTRY  CatalogEntry)

Definition at line 35 of file dcatitem.c.

36{
37 /* Check if a provider is loaded */
38 if (CatalogEntry->Provider)
39 {
40 /* Dereference it too */
41 WsTpDereference(CatalogEntry->Provider);
42 CatalogEntry->Provider = NULL;
43 }
44
45 /* Delete us */
46 HeapFree(WsSockHeap, 0, CatalogEntry);
47}
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:735
VOID WSAAPI WsTpDereference(IN PTPROVIDER Provider)
Definition: dprovide.c:143

Referenced by WsTcEntryDereference().

◆ WsTcEntryDereference()

VOID WSAAPI WsTcEntryDereference ( IN PTCATALOG_ENTRY  CatalogEntry)

Definition at line 51 of file dcatitem.c.

52{
53 /* Dereference and check if it's now 0 */
54 if (!(InterlockedDecrement(&CatalogEntry->RefCount)))
55 {
56 /* We can delete the Provider now */
57 WsTcEntryDelete(CatalogEntry);
58 }
59}
#define InterlockedDecrement
Definition: armddk.h:52
VOID WSAAPI WsTcEntryDelete(IN PTCATALOG_ENTRY CatalogEntry)
Definition: dcatitem.c:35

Referenced by WPUModifyIFSHandle(), WPUQueryBlockingCallback(), WSAAddressToStringA(), WSAAddressToStringW(), WSASocketW(), WSAStringToAddressA(), WSAStringToAddressW(), WsSockDelete(), WsTcDelete(), WsTcFindIfsProviderForSocket(), WsTcRefreshFromRegistry(), and WsTcUpdateProtocolList().

◆ WsTcEntryInitializeFromRegistry()

DWORD WSAAPI WsTcEntryInitializeFromRegistry ( IN PTCATALOG_ENTRY  CatalogEntry,
IN HKEY  ParentKey,
IN DWORD  UniqueId 
)

Definition at line 63 of file dcatitem.c.

66{
67 CHAR CatalogEntryName[13];
68 DWORD RegSize;
69 DWORD RegType = REG_BINARY;
70 HKEY EntryKey;
71 DWORD Return;
72 LPBYTE Buf;
74
75 /* Convert to a 00000xxx string */
76 sprintf(CatalogEntryName, "%0""12""lu", UniqueId);
77
78 /* Open the Entry */
79 Return = RegOpenKeyEx(ParentKey,
80 CatalogEntryName,
81 0,
83 &EntryKey);
84
85 /* Get Size of Catalog Entry Structure */
86 Return = RegQueryValueEx(EntryKey,
87 "PackedCatalogItem",
88 0,
89 NULL,
90 NULL,
91 &RegSize);
92
93 if (!(Buf = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, RegSize)))
95
96 /* Read the Whole Catalog Entry Structure */
97 Return = RegQueryValueEx(EntryKey,
98 "PackedCatalogItem",
99 0,
100 &RegType,
101 Buf,
102 &RegSize);
103
104
105 memcpy(CatalogEntry->DllPath, Buf, sizeof(CatalogEntry->DllPath));
106 index = sizeof(CatalogEntry->DllPath);
107 if (index < RegSize)
108 {
109 memcpy(&CatalogEntry->ProtocolInfo, &Buf[index], sizeof(WSAPROTOCOL_INFOW));
110 index += sizeof(WSAPROTOCOL_INFOW);
111 }
112 HeapFree(WsSockHeap, 0, Buf);
113
114 /* Done */
115 RegCloseKey(EntryKey);
116 return Return;
117}
#define index(s, c)
Definition: various.h:29
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint index
Definition: glext.h:6031
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
unsigned char * LPBYTE
Definition: typedefs.h:53
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
Definition: wdfregistry.h:69
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524
struct _WSAPROTOCOL_INFOW WSAPROTOCOL_INFOW
char CHAR
Definition: xmlstorage.h:175

◆ WsTcEntrySetProvider()

VOID WSAAPI WsTcEntrySetProvider ( IN PTCATALOG_ENTRY  Entry,
IN PTPROVIDER  Provider 
)

Definition at line 121 of file dcatitem.c.

123{
124 /* Reference the provider */
125 InterlockedIncrement(&Provider->RefCount);
126
127 /* Set it */
128 Entry->Provider = Provider;
129}
#define InterlockedIncrement
Definition: armddk.h:53
base of all file and directory entries
Definition: entries.h:83

Referenced by WsTcLoadProvider().