diff --git a/reactos/subsys/system/dhcp/adapter.c b/reactos/subsys/system/dhcp/adapter.c index 25e7e1d612f..58c5da30ffe 100644 --- a/reactos/subsys/system/dhcp/adapter.c +++ b/reactos/subsys/system/dhcp/adapter.c @@ -10,7 +10,7 @@ PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { DWORD Error; HKEY MainKey; PCHAR *Out, OutKeyName; - DWORD CharTotal = 0, ThisKey, AppendLen = 1 + strlen(Append); + DWORD CharTotal = 0, AppendLen = 1 + strlen(Append); DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); @@ -194,7 +194,7 @@ BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) { DefGatewayRow.dwForwardNextHop = inet_addr(DefaultGateway); Error = CreateIpForwardEntry( &DefGatewayRow ); if( Error ) - warning("Failed to set default gateway %s: %d\n", + warning("Failed to set default gateway %s: %ld\n", DefaultGateway, Error); } diff --git a/reactos/subsys/system/dhcp/dhclient.c b/reactos/subsys/system/dhcp/dhclient.c index 50f1c1a264d..6417f09f983 100644 --- a/reactos/subsys/system/dhcp/dhclient.c +++ b/reactos/subsys/system/dhcp/dhclient.c @@ -124,11 +124,7 @@ int check_arp( struct interface_info *ip, struct client_lease *lp ) { int main(int argc, char *argv[]) { - extern char *__progname; - int ch, fd, quiet = 0, i = 0; - int pipe_fd[2]; - struct passwd *pw; - + int i = 0; ApiInit(); AdapterInit(); PipeInit(); @@ -503,7 +499,7 @@ void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { &Adapter->NteInstance ); if( !NT_SUCCESS(Status) ) - warning("AddIPAddress: %x\n", Status); + warning("AddIPAddress: %lx\n", Status); } if( new_lease->options[DHO_ROUTERS].len ) { @@ -526,7 +522,7 @@ void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { Status = CreateIpForwardEntry( &RouterMib ); if( !NT_SUCCESS(Status) ) - warning("CreateIpForwardEntry: %x\n", Status); + warning("CreateIpForwardEntry: %lx\n", Status); else old_default_route = RouterMib.dwForwardNextHop; } @@ -551,7 +547,7 @@ bind_lease(struct interface_info *ip) if( ip->client->active->renewal - cur_time ) add_timeout(ip->client->active->renewal, state_bound, ip); - note("bound to %s -- renewal in %d seconds.", + note("bound to %s -- renewal in %ld seconds.", piaddr(ip->client->active->address), ip->client->active->renewal - cur_time); @@ -917,7 +913,7 @@ send_discover(void *ipp) if (!ip->client->offered_leases && ip->client->config->media) { int fail = 0; -again: + if (ip->client->medium) { ip->client->medium = ip->client->medium->next; increase = 0; @@ -976,7 +972,7 @@ again: ip->client->packet.secs = htons(65535); ip->client->secs = ip->client->packet.secs; - note("DHCPDISCOVER on %s to %s port %d interval %d", + note("DHCPDISCOVER on %s to %s port %d interval %ld", ip->name, inet_ntoa(sockaddr_broadcast.sin_addr), ntohs(sockaddr_broadcast.sin_port), ip->client->interval); @@ -1030,7 +1026,7 @@ state_panic(void *ipp) if (cur_time < ip->client->active->renewal) { ip->client->state = S_BOUND; - note("bound: renewal in %d seconds.", + note("bound: renewal in %ld seconds.", ip->client->active->renewal - cur_time); add_timeout( @@ -1106,7 +1102,6 @@ send_request(void *ipp) if ((ip->client->state == S_REBOOTING || ip->client->state == S_REQUESTING) && interval > ip->client->config->reboot_timeout) { -cancel: ip->client->state = S_INIT; cancel_timeout(send_request, ip); state_init(ip); @@ -1632,7 +1627,6 @@ priv_script_write_params(char *prefix, struct client_lease *lease) struct interface_info *ip = ifi; u_int8_t dbuf[1500]; int i, len = 0; - char tbuf[128]; #if 0 script_set_env(ip->client, prefix, "ip_address", diff --git a/reactos/subsys/system/dhcp/dhcp.xml b/reactos/subsys/system/dhcp/dhcp.xml index f587f699a96..98ee751b051 100644 --- a/reactos/subsys/system/dhcp/dhcp.xml +++ b/reactos/subsys/system/dhcp/dhcp.xml @@ -8,6 +8,7 @@ kernel32 ws2_32 iphlpapi + include/rosdhcp.h adapter.c alloc.c api.c diff --git a/reactos/subsys/system/dhcp/dispatch.c b/reactos/subsys/system/dhcp/dispatch.c index 82a6c76284f..5bf9410cee5 100644 --- a/reactos/subsys/system/dhcp/dispatch.c +++ b/reactos/subsys/system/dhcp/dispatch.c @@ -66,7 +66,6 @@ static int interface_status(struct interface_info *ifinfo); void discover_interfaces(struct interface_info *iface) { - NTSTATUS Status; PDHCP_ADAPTER Adapter = AdapterFindInfo( iface ); if_register_receive(iface); diff --git a/reactos/subsys/system/dhcp/hash.c b/reactos/subsys/system/dhcp/hash.c index c47c562879b..bd54ec34eb8 100644 --- a/reactos/subsys/system/dhcp/hash.c +++ b/reactos/subsys/system/dhcp/hash.c @@ -40,6 +40,7 @@ * Enterprises, see ``http://www.vix.com''. */ +#define lint #ifndef lint static char copyright[] = "$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; diff --git a/reactos/subsys/system/dhcp/include/rosdhcp.h b/reactos/subsys/system/dhcp/include/rosdhcp.h index 88001f5584a..566240f171f 100644 --- a/reactos/subsys/system/dhcp/include/rosdhcp.h +++ b/reactos/subsys/system/dhcp/include/rosdhcp.h @@ -1,11 +1,9 @@ #ifndef ROSDHCP_H #define ROSDHCP_H -#include #include #define NTOS_MODE_USER #include -#include #include #include #include @@ -59,6 +57,8 @@ typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply ); #define random rand #define srandom srand +void AdapterInit(VOID); +HANDLE PipeInit(VOID); extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); extern VOID ApiInit(); @@ -68,5 +68,5 @@ extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ); extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); - +int warn( char *format, ... ); #endif/*ROSDHCP_H*/ diff --git a/reactos/subsys/system/dhcp/pipe.c b/reactos/subsys/system/dhcp/pipe.c index b7aa296f14e..1b31f99017b 100644 --- a/reactos/subsys/system/dhcp/pipe.c +++ b/reactos/subsys/system/dhcp/pipe.c @@ -31,10 +31,10 @@ DWORD WINAPI PipeThreadProc( LPVOID Parameter ) { DWORD BytesRead, BytesWritten; COMM_DHCP_REQ Req; BOOL Result; - HANDLE Connection; + BOOLEAN Connection; while( (Connection = ConnectNamedPipe( CommPipe, NULL )) ) { - Result = ReadFile( Connection, &Req, sizeof(Req), &BytesRead, NULL ); + Result = ReadFile( CommPipe, &Req, sizeof(Req), &BytesRead, NULL ); if( Result ) { switch( Req.Type ) { case DhcpReqQueryHWInfo: @@ -54,8 +54,10 @@ DWORD WINAPI PipeThreadProc( LPVOID Parameter ) { break; } } - CloseHandle( Connection ); + CloseHandle( CommPipe ); } + + return TRUE; } HANDLE PipeInit() { diff --git a/reactos/subsys/system/dhcp/tables.c b/reactos/subsys/system/dhcp/tables.c index 7eb9c766b6f..3de26b7cef6 100644 --- a/reactos/subsys/system/dhcp/tables.c +++ b/reactos/subsys/system/dhcp/tables.c @@ -39,7 +39,7 @@ * see ``http://www.vix.com/isc''. To learn more about Vixie * Enterprises, see ``http://www.vix.com''. */ - +#define lint #ifndef lint static char copyright[] = "$Id: tables.c,v 1.13.2.4 1999/04/24 16:46:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";