[IPHLPAPI]
[reactos.git] / reactos / dll / win32 / iphlpapi / dhcp_reactos.c
1 /*
2 * PROJECT: ReactOS Networking
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/iphlpapi/dhcp_reactos.c
5 * PURPOSE: DHCP helper functions for ReactOS
6 * COPYRIGHT: Copyright 2006 Ge van Geldorp <gvg@reactos.org>
7 */
8
9 #include "iphlpapi_private.h"
10 #include "dhcp.h"
11 #include "dhcpcsdk.h"
12 #include "dhcpcapi.h"
13 #include <assert.h>
14
15 #define NDEBUG
16 #include "debug.h"
17
18 DWORD APIENTRY DhcpRosGetAdapterInfo(DWORD AdapterIndex,
19 PBOOL DhcpEnabled,
20 PDWORD DhcpServer,
21 time_t *LeaseObtained,
22 time_t *LeaseExpires);
23
24 DWORD getDhcpInfoForAdapter(DWORD AdapterIndex,
25 PBOOL DhcpEnabled,
26 PDWORD DhcpServer,
27 time_t *LeaseObtained,
28 time_t *LeaseExpires)
29 {
30 DWORD Status, Version = 0;
31
32 Status = DhcpCApiInitialize(&Version);
33 if (Status != ERROR_SUCCESS)
34 {
35 /* We assume that the DHCP service isn't running yet */
36 *DhcpEnabled = FALSE;
37 *DhcpServer = htonl(INADDR_NONE);
38 *LeaseObtained = 0;
39 *LeaseExpires = 0;
40 return ERROR_SUCCESS;
41 }
42
43 Status = DhcpRosGetAdapterInfo(AdapterIndex, DhcpEnabled, DhcpServer,
44 LeaseObtained, LeaseExpires);
45
46 DhcpCApiCleanup();
47
48 return Status;
49 }