ReactOS  0.4.15-dev-3440-g915569a
dhcpcapi.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

DWORD APIENTRY DhcpLeaseIpAddress (DWORD AdapterIndex)
 
DWORD APIENTRY DhcpQueryHWInfo (DWORD AdapterIndex, PDWORD MediaType, PDWORD Mtu, PDWORD Speed)
 
DWORD APIENTRY DhcpReleaseIpAddressLease (DWORD AdapterIndex)
 
DWORD APIENTRY DhcpRenewIpAddressLease (DWORD AdapterIndex)
 
DWORD APIENTRY DhcpStaticRefreshParams (DWORD AdapterIndex, DWORD Address, DWORD Netmask)
 
DWORD APIENTRY DhcpNotifyConfigChange (LPWSTR ServerName, LPWSTR AdapterName, BOOL NewIpAddress, DWORD IpIndex, DWORD IpAddress, DWORD SubnetMask, int DhcpAction)
 
DWORD APIENTRY DhcpRosGetAdapterInfo (DWORD AdapterIndex, PBOOL DhcpEnabled, PDWORD DhcpServer, time_t *LeaseObtained, time_t *LeaseExpires)
 

Function Documentation

◆ DhcpLeaseIpAddress()

DWORD APIENTRY DhcpLeaseIpAddress ( DWORD  AdapterIndex)

Definition at line 113 of file dhcpcsvc.c.

114 {
115  COMM_DHCP_REQ Req;
116  COMM_DHCP_REPLY Reply;
118  BOOL Result;
119 
121 
123  Req.AdapterIndex = AdapterIndex;
124 
126  &Req, sizeof(Req),
127  &Reply, sizeof(Reply),
128  &BytesRead, NULL);
129  if (!Result)
130  {
131  /* Pipe transaction failed */
132  return 0;
133  }
134 
135  return Reply.Reply;
136 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI TransactNamedPipe(IN HANDLE hNamedPipe, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: npipe.c:1315
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
#define NULL
Definition: types.h:112

◆ DhcpNotifyConfigChange()

DWORD APIENTRY DhcpNotifyConfigChange ( LPWSTR  ServerName,
LPWSTR  AdapterName,
BOOL  NewIpAddress,
DWORD  IpIndex,
DWORD  IpAddress,
DWORD  SubnetMask,
int  DhcpAction 
)

◆ DhcpQueryHWInfo()

DWORD APIENTRY DhcpQueryHWInfo ( DWORD  AdapterIndex,
PDWORD  MediaType,
PDWORD  Mtu,
PDWORD  Speed 
)

Definition at line 78 of file dhcpcsvc.c.

82 {
83  COMM_DHCP_REQ Req;
84  COMM_DHCP_REPLY Reply;
86  BOOL Result;
87 
89 
91  Req.AdapterIndex = AdapterIndex;
92 
94  &Req, sizeof(Req),
95  &Reply, sizeof(Reply),
96  &BytesRead, NULL);
97  if (!Result)
98  {
99  /* Pipe transaction failed */
100  return 0;
101  }
102 
103  if (Reply.Reply == 0)
104  return 0;
105 
106  *MediaType = Reply.QueryHWInfo.MediaType;
107  *Mtu = Reply.QueryHWInfo.Mtu;
108  *Speed = Reply.QueryHWInfo.Speed;
109  return 1;
110 }
struct _COMM_DHCP_REPLY::@3367 QueryHWInfo
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI TransactNamedPipe(IN HANDLE hNamedPipe, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: npipe.c:1315
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
#define NULL
Definition: types.h:112

◆ DhcpReleaseIpAddressLease()

DWORD APIENTRY DhcpReleaseIpAddressLease ( DWORD  AdapterIndex)

Definition at line 139 of file dhcpcsvc.c.

140 {
141  COMM_DHCP_REQ Req;
142  COMM_DHCP_REPLY Reply;
144  BOOL Result;
145 
147 
149  Req.AdapterIndex = AdapterIndex;
150 
152  &Req, sizeof(Req),
153  &Reply, sizeof(Reply),
154  &BytesRead, NULL);
155  if (!Result)
156  {
157  /* Pipe transaction failed */
158  return 0;
159  }
160 
161  return Reply.Reply;
162 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI TransactNamedPipe(IN HANDLE hNamedPipe, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: npipe.c:1315
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
#define NULL
Definition: types.h:112

Referenced by IpReleaseAddress().

◆ DhcpRenewIpAddressLease()

DWORD APIENTRY DhcpRenewIpAddressLease ( DWORD  AdapterIndex)

Definition at line 165 of file dhcpcsvc.c.

166 {
167  COMM_DHCP_REQ Req;
168  COMM_DHCP_REPLY Reply;
170  BOOL Result;
171 
173 
175  Req.AdapterIndex = AdapterIndex;
176 
178  &Req, sizeof(Req),
179  &Reply, sizeof(Reply),
180  &BytesRead, NULL);
181  if (!Result)
182  {
183  /* Pipe transaction failed */
184  return 0;
185  }
186 
187  return Reply.Reply;
188 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI TransactNamedPipe(IN HANDLE hNamedPipe, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: npipe.c:1315
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
#define NULL
Definition: types.h:112

Referenced by IpRenewAddress().

◆ DhcpRosGetAdapterInfo()

DWORD APIENTRY DhcpRosGetAdapterInfo ( DWORD  AdapterIndex,
PBOOL  DhcpEnabled,
PDWORD  DhcpServer,
time_t LeaseObtained,
time_t LeaseExpires 
)

Get DHCP info for an adapter

Parameters
[in]AdapterIndexIndex of the adapter (iphlpapi-style) for which info is requested
[out]DhcpEnabledReturns whether DHCP is enabled for the adapter
[out]DhcpServerReturns DHCP server IP address (255.255.255.255 if no server reached yet), in network byte order
[out]LeaseObtainedReturns time at which the lease was obtained
[out]LeaseExpiresReturns time at which the lease will expire
Returns
non-zero on success
Remarks
This is a ReactOS-only routine

Definition at line 300 of file dhcpcsvc.c.

305 {
306  COMM_DHCP_REQ Req;
307  COMM_DHCP_REPLY Reply;
309  BOOL Result;
310 
312 
314  Req.AdapterIndex = AdapterIndex;
315 
317  &Req, sizeof(Req),
318  &Reply, sizeof(Reply),
319  &BytesRead, NULL);
320 
321  if (Result && Reply.Reply != 0)
322  *DhcpEnabled = Reply.GetAdapterInfo.DhcpEnabled;
323  else
324  *DhcpEnabled = FALSE;
325 
326  if (*DhcpEnabled)
327  {
328  *DhcpServer = Reply.GetAdapterInfo.DhcpServer;
329  *LeaseObtained = Reply.GetAdapterInfo.LeaseObtained;
330  *LeaseExpires = Reply.GetAdapterInfo.LeaseExpires;
331  }
332  else
333  {
334  *DhcpServer = INADDR_NONE;
335  *LeaseObtained = 0;
336  *LeaseExpires = 0;
337  }
338 
339  return Reply.Reply;
340 }
#define INADDR_NONE
Definition: tcp.c:42
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI TransactNamedPipe(IN HANDLE hNamedPipe, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: npipe.c:1315
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
#define NULL
Definition: types.h:112
struct _COMM_DHCP_REPLY::@3368 GetAdapterInfo

◆ DhcpStaticRefreshParams()

DWORD APIENTRY DhcpStaticRefreshParams ( DWORD  AdapterIndex,
DWORD  Address,
DWORD  Netmask 
)

Definition at line 191 of file dhcpcsvc.c.

194 {
195  COMM_DHCP_REQ Req;
196  COMM_DHCP_REPLY Reply;
198  BOOL Result;
199 
201 
203  Req.AdapterIndex = AdapterIndex;
204  Req.Body.StaticRefreshParams.IPAddress = Address;
205  Req.Body.StaticRefreshParams.Netmask = Netmask;
206 
208  &Req, sizeof(Req),
209  &Reply, sizeof(Reply),
210  &BytesRead, NULL);
211  if (!Result)
212  {
213  /* Pipe transaction failed */
214  return 0;
215  }
216 
217  return Reply.Reply;
218 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:859
unsigned int BOOL
Definition: ntddk_ex.h:94
static WCHAR Address[46]
Definition: ping.c:68
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ASSERT(a)
Definition: mode.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI TransactNamedPipe(IN HANDLE hNamedPipe, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: npipe.c:1315
struct _COMM_DHCP_REQ::@3362::@3366 StaticRefreshParams
static HANDLE PipeHandle
Definition: dhcpcsvc.c:22
#define NULL
Definition: types.h:112
union _COMM_DHCP_REQ::@3362 Body

Referenced by INetCfgComponentControl_fnApplyRegistryChanges().