Fix DHCP bug (a ReadFile was being done on a BOOLEAN return value instead of the handle, and a thread was never returning), fix 99% of warnings and use PCH Modified: trunk/reactos/subsys/system/dhcp/adapter.c Modified: trunk/reactos/subsys/system/dhcp/dhclient.c Modified: trunk/reactos/subsys/system/dhcp/dhcp.xml Modified: trunk/reactos/subsys/system/dhcp/dispatch.c Modified: trunk/reactos/subsys/system/dhcp/hash.c Modified: trunk/reactos/subsys/system/dhcp/include/rosdhcp.h Modified: trunk/reactos/subsys/system/dhcp/pipe.c Modified: trunk/reactos/subsys/system/dhcp/tables.c _____
Modified: trunk/reactos/subsys/system/dhcp/adapter.c --- trunk/reactos/subsys/system/dhcp/adapter.c 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/adapter.c 2005-07-01 15:40:52 UTC (rev 16369) @@ -10,7 +10,7 @@
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 @@ 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); }
_____
Modified: trunk/reactos/subsys/system/dhcp/dhclient.c --- trunk/reactos/subsys/system/dhcp/dhclient.c 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/dhclient.c 2005-07-01 15:40:52 UTC (rev 16369) @@ -124,11 +124,7 @@
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 @@ &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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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", _____
Modified: trunk/reactos/subsys/system/dhcp/dhcp.xml --- trunk/reactos/subsys/system/dhcp/dhcp.xml 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/dhcp.xml 2005-07-01 15:40:52 UTC (rev 16369) @@ -8,6 +8,7 @@
<library>kernel32</library> <library>ws2_32</library> <library>iphlpapi</library> + <pch>include/rosdhcp.h</pch> <file>adapter.c</file> <file>alloc.c</file> <file>api.c</file> _____
Modified: trunk/reactos/subsys/system/dhcp/dispatch.c --- trunk/reactos/subsys/system/dhcp/dispatch.c 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/dispatch.c 2005-07-01 15:40:52 UTC (rev 16369) @@ -66,7 +66,6 @@
void discover_interfaces(struct interface_info *iface) { - NTSTATUS Status; PDHCP_ADAPTER Adapter = AdapterFindInfo( iface );
if_register_receive(iface); _____
Modified: trunk/reactos/subsys/system/dhcp/hash.c --- trunk/reactos/subsys/system/dhcp/hash.c 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/hash.c 2005-07-01 15:40:52 UTC (rev 16369) @@ -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"; _____
Modified: trunk/reactos/subsys/system/dhcp/include/rosdhcp.h --- trunk/reactos/subsys/system/dhcp/include/rosdhcp.h 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/include/rosdhcp.h 2005-07-01 15:40:52 UTC (rev 16369) @@ -1,11 +1,9 @@
#ifndef ROSDHCP_H #define ROSDHCP_H
-#include <roscfg.h> #include <windows.h> #define NTOS_MODE_USER #include <ndk/ntndk.h> -#include <winnt.h> #include <iprtrmib.h> #include <iphlpapi.h> #include <winsock2.h> @@ -59,6 +57,8 @@ #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 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*/ _____
Modified: trunk/reactos/subsys/system/dhcp/pipe.c --- trunk/reactos/subsys/system/dhcp/pipe.c 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/pipe.c 2005-07-01 15:40:52 UTC (rev 16369) @@ -31,10 +31,10 @@
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 @@ break; } } - CloseHandle( Connection ); + CloseHandle( CommPipe ); } + + return TRUE; }
HANDLE PipeInit() { _____
Modified: trunk/reactos/subsys/system/dhcp/tables.c --- trunk/reactos/subsys/system/dhcp/tables.c 2005-07-01 15:29:06 UTC (rev 16368) +++ trunk/reactos/subsys/system/dhcp/tables.c 2005-07-01 15:40:52 UTC (rev 16369) @@ -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";