ReactOS  0.4.14-dev-599-g2d4d3f5
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 111 of file dhcpcsvc.c.

112 {
113  COMM_DHCP_REQ Req;
114  COMM_DHCP_REPLY Reply;
116  BOOL Result;
117 
119 
121  Req.AdapterIndex = AdapterIndex;
122 
124  &Req, sizeof(Req),
125  &Reply, sizeof(Reply),
126  &BytesRead, NULL);
127  if (!Result)
128  {
129  /* Pipe transaction failed */
130  return 0;
131  }
132 
133  return Reply.Reply;
134 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_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
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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:21
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

◆ 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 76 of file dhcpcsvc.c.

80 {
81  COMM_DHCP_REQ Req;
82  COMM_DHCP_REPLY Reply;
84  BOOL Result;
85 
87 
89  Req.AdapterIndex = AdapterIndex;
90 
92  &Req, sizeof(Req),
93  &Reply, sizeof(Reply),
94  &BytesRead, NULL);
95  if (!Result)
96  {
97  /* Pipe transaction failed */
98  return 0;
99  }
100 
101  if (Reply.Reply == 0)
102  return 0;
103 
104  *MediaType = Reply.QueryHWInfo.MediaType;
105  *Mtu = Reply.QueryHWInfo.Mtu;
106  *Speed = Reply.QueryHWInfo.Speed;
107  return 1;
108 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
struct _COMM_DHCP_REPLY::@3319 QueryHWInfo
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_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
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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:21
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

◆ DhcpReleaseIpAddressLease()

DWORD APIENTRY DhcpReleaseIpAddressLease ( DWORD  AdapterIndex)

Definition at line 137 of file dhcpcsvc.c.

138 {
139  COMM_DHCP_REQ Req;
140  COMM_DHCP_REPLY Reply;
142  BOOL Result;
143 
145 
147  Req.AdapterIndex = AdapterIndex;
148 
150  &Req, sizeof(Req),
151  &Reply, sizeof(Reply),
152  &BytesRead, NULL);
153  if (!Result)
154  {
155  /* Pipe transaction failed */
156  return 0;
157  }
158 
159  return Reply.Reply;
160 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_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
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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:21
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

Referenced by IpReleaseAddress().

◆ DhcpRenewIpAddressLease()

DWORD APIENTRY DhcpRenewIpAddressLease ( DWORD  AdapterIndex)

Definition at line 163 of file dhcpcsvc.c.

164 {
165  COMM_DHCP_REQ Req;
166  COMM_DHCP_REPLY Reply;
168  BOOL Result;
169 
171 
173  Req.AdapterIndex = AdapterIndex;
174 
176  &Req, sizeof(Req),
177  &Reply, sizeof(Reply),
178  &BytesRead, NULL);
179  if (!Result)
180  {
181  /* Pipe transaction failed */
182  return 0;
183  }
184 
185  return Reply.Reply;
186 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_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
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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:21
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

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 298 of file dhcpcsvc.c.

303 {
304  COMM_DHCP_REQ Req;
305  COMM_DHCP_REPLY Reply;
307  BOOL Result;
308 
310 
312  Req.AdapterIndex = AdapterIndex;
313 
315  &Req, sizeof(Req),
316  &Reply, sizeof(Reply),
317  &BytesRead, NULL);
318 
319  if (Result && Reply.Reply != 0)
320  *DhcpEnabled = Reply.GetAdapterInfo.DhcpEnabled;
321  else
322  *DhcpEnabled = FALSE;
323 
324  if (*DhcpEnabled)
325  {
326  *DhcpServer = Reply.GetAdapterInfo.DhcpServer;
327  *LeaseObtained = Reply.GetAdapterInfo.LeaseObtained;
328  *LeaseExpires = Reply.GetAdapterInfo.LeaseExpires;
329  }
330  else
331  {
332  *DhcpServer = INADDR_NONE;
333  *LeaseObtained = 0;
334  *LeaseExpires = 0;
335  }
336 
337  return Reply.Reply;
338 }
#define INADDR_NONE
Definition: tcp.c:42
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
struct _COMM_DHCP_REPLY::@3320 GetAdapterInfo
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_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
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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:21
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

◆ DhcpStaticRefreshParams()

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

Definition at line 189 of file dhcpcsvc.c.

192 {
193  COMM_DHCP_REQ Req;
194  COMM_DHCP_REPLY Reply;
196  BOOL Result;
197 
199 
201  Req.AdapterIndex = AdapterIndex;
202  Req.Body.StaticRefreshParams.IPAddress = Address;
203  Req.Body.StaticRefreshParams.Netmask = Netmask;
204 
206  &Req, sizeof(Req),
207  &Reply, sizeof(Reply),
208  &BytesRead, NULL);
209  if (!Result)
210  {
211  /* Pipe transaction failed */
212  return 0;
213  }
214 
215  return Reply.Reply;
216 }
union _COMM_DHCP_REQ::@3314 Body
struct _COMM_DHCP_REQ::@3314::@3318 StaticRefreshParams
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
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
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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:21
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

Referenced by INetCfgComponentControl_fnApplyRegistryChanges().