Modified: trunk/reactos/services/tcpsvcs/chargen.c
Modified: trunk/reactos/services/tcpsvcs/daytime.c
Modified: trunk/reactos/services/tcpsvcs/discard.c
Modified: trunk/reactos/services/tcpsvcs/echo.c
Modified: trunk/reactos/services/tcpsvcs/qotd.c
Modified: trunk/reactos/services/tcpsvcs/skelserver.c
Modified: trunk/reactos/services/tcpsvcs/tcpsvcs.c
Modified: trunk/reactos/services/tcpsvcs/tcpsvcs.h
--- trunk/reactos/services/tcpsvcs/chargen.c 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/chargen.c 2005-12-27 18:05:53 UTC (rev 20374)
@@ -21,13 +21,13 @@
DWORD WINAPI ChargenHandler(VOID* Sock_)
{
- DWORD RetVal = 0;
+ INT RetVal = 0;
SOCKET Sock = (SOCKET)Sock_;
if (!GenerateChars(Sock))
{
LogEvent(_T("Chargen: Char generation failed\n"), 0, FALSE);
- RetVal = -1;
+ RetVal = 1;
}
LogEvent(_T("Chargen: Shutting connection down...\n"), 0, FALSE);
@@ -36,7 +36,7 @@
else
{
LogEvent(_T("Chargen: Connection shutdown failed\n"), 0, FALSE);
- RetVal = -1;
+ RetVal = 1;
}
LogEvent(_T("Chargen: Terminating thread\n"), 0, FALSE);
@@ -56,7 +56,7 @@
/* fill ring with printable characters */
for (charIndex=0, i=START; i<=END; charIndex++, i++)
- ring[charIndex] = i;
+ ring[charIndex] = (char)i;
/* save the address of the end character in the ring */
endring = &ring[charIndex];
--- trunk/reactos/services/tcpsvcs/daytime.c 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/daytime.c 2005-12-27 18:05:53 UTC (rev 20374)
@@ -38,7 +38,7 @@
else
{
LogEvent(_T("DayTime: Connection shutdown failed\n"), 0, FALSE);
- RetVal = -1;
+ RetVal = 1;
}
LogEvent(_T("DayTime: Terminating thread\n"), 0, FALSE);
@@ -48,7 +48,7 @@
BOOL SendTime(SOCKET Sock, TCHAR *time)
{
- INT StringSize = strlen(time);
+ INT StringSize = (INT)_tcsclen(time);
INT RetVal = send(Sock, time, sizeof(TCHAR) * StringSize, 0);
if (RetVal == SOCKET_ERROR)
--- trunk/reactos/services/tcpsvcs/discard.c 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/discard.c 2005-12-27 18:05:53 UTC (rev 20374)
@@ -24,7 +24,7 @@
if (!RecieveIncomingPackets(Sock))
{
LogEvent(_T("Discard: RecieveIncomingPackets failed\n"), 0, FALSE);
- RetVal = -1;
+ RetVal = 1;
}
LogEvent(_T("Discard: Shutting connection down...\n"), 0, FALSE);
@@ -33,7 +33,7 @@
else
{
LogEvent(_T("Discard: Connection shutdown failed\n"), 0, FALSE);
- RetVal = -1;
+ RetVal = 1;
}
LogEvent(_T("Discard: Terminating thread\n"), 0, FALSE);
--- trunk/reactos/services/tcpsvcs/echo.c 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/echo.c 2005-12-27 18:05:53 UTC (rev 20374)
@@ -23,7 +23,7 @@
if (!EchoIncomingPackets(Sock)) {
LogEvent(_T("Echo: EchoIncomingPackets failed\n"), 0, FALSE);
- RetVal = -1;
+ RetVal = 1;
}
LogEvent(_T("Echo: Shutting connection down...\n"), 0, FALSE);
@@ -33,7 +33,7 @@
else
{
LogEvent(_T("Echo: Connection shutdown failed\n"), 0, FALSE);
- RetVal = -1;
+ RetVal = 1;
}
LogEvent(_T("Echo: Terminating thread\n"), 0, FALSE);
--- trunk/reactos/services/tcpsvcs/qotd.c 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/qotd.c 2005-12-27 18:05:53 UTC (rev 20374)
@@ -36,7 +36,7 @@
if(! GetSystemDirectory(Sys, MAX_PATH))
{
LogEvent(_T("QOTD: Getting system path failed.\n"), 0, TRUE);
- ExitThread(-1);
+ ExitThread(1);
}
_tcscat(Sys, FilePath);
@@ -49,7 +49,7 @@
_stprintf(buf, _T("QOTD: Error opening quote file : %s\n"), Sys);
LogEvent(buf, 0, TRUE);
LogEvent(_T("QOTD: Terminating thread\n"), 0, FALSE);
- ExitThread(-1);
+ ExitThread(1);
}
/* read all quotes in the file into an array */
@@ -75,7 +75,7 @@
{
LogEvent(_T("QOTD: Connection shutdown failed\n"), 0, FALSE);
LogEvent(_T("QOTD: Terminating thread\n"), 0, FALSE);
- ExitThread(-1);
+ ExitThread(1);
}
LogEvent(_T("QOTD: Terminating thread\n"), 0, FALSE);
@@ -90,7 +90,7 @@
INT StringSize;
INT RetVal;
- StringSize = strlen(Quote);
+ StringSize = (INT)_tcsclen(Quote);
RetVal = send(Sock, Quote, sizeof(TCHAR) * StringSize, 0);
if (RetVal == SOCKET_ERROR)
--- trunk/reactos/services/tcpsvcs/skelserver.c 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/skelserver.c 2005-12-27 18:05:53 UTC (rev 20374)
@@ -21,13 +21,12 @@
{
SOCKET ListeningSocket;
PSERVICES pServices;
- const TCHAR* HostIP = "127.0.0.1";
TCHAR buf[256];
pServices = (PSERVICES)lpParam;
//DebugBreak();
- ListeningSocket = SetUpListener(HostIP, htons(pServices->Port));
+ ListeningSocket = SetUpListener(htons(pServices->Port));
if (ListeningSocket == INVALID_SOCKET)
{
LogEvent("Socket error when setting up listener\n", 0, TRUE);
@@ -45,7 +44,7 @@
}
-SOCKET SetUpListener(const char* ServAddr, int Port)
+SOCKET SetUpListener(USHORT Port)
{
SOCKET Sock;
SOCKADDR_IN Server;
--- trunk/reactos/services/tcpsvcs/tcpsvcs.c 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/tcpsvcs.c 2005-12-27 18:05:53 UTC (rev 20374)
@@ -52,7 +52,7 @@
int
-main(int argc, char *argv[])
+main(void)
{
SERVICE_TABLE_ENTRY ServiceTable[] =
{
@@ -245,12 +245,10 @@
}
-/* LogEvent is similar to the ReportError function used elsewhere
- For a service, however, we ReportEvent rather than write to standard
- error. Eventually, this function should go into the utility
- library. */
+/* This is a temperary log system until our eventlog is in place */
+
VOID
-LogEvent (LPCTSTR UserMessage, DWORD ExitCode, BOOL PrintErrorMsg)
+LogEvent (LPCTSTR UserMessage, INT ExitCode, BOOL PrintErrorMsg)
{
DWORD eMsgLen, ErrNum = GetLastError ();
LPTSTR lpvSysMsg;
@@ -265,7 +263,7 @@
ErrNum, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpvSysMsg, 0, NULL);
- _stprintf(MessageBuffer, _T("%s %s ErrNum = %lu. ExitCode = %lu."),
+ _stprintf(MessageBuffer, _T("%s %s ErrNum = %lu. ExitCode = %d."),
UserMessage, lpvSysMsg, ErrNum, ExitCode);
HeapFree(GetProcessHeap (), 0, lpvSysMsg);
}
--- trunk/reactos/services/tcpsvcs/tcpsvcs.h 2005-12-27 17:15:51 UTC (rev 20373)
+++ trunk/reactos/services/tcpsvcs/tcpsvcs.h 2005-12-27 18:05:53 UTC (rev 20374)
@@ -44,7 +44,7 @@
/* data structure to pass to threads */
typedef struct _Services {
- INT Port;
+ USHORT Port;
TCHAR *Name;
LPTHREAD_START_ROUTINE Service;
} SERVICES, *PSERVICES;
@@ -53,13 +53,13 @@
//static VOID WINAPI ServiceMain(DWORD argc, LPTSTR argv[]);
VOID WINAPI ServerCtrlHandler(DWORD control);
INT CreateServers(VOID);
-VOID LogEvent (LPCTSTR UserMessage, DWORD ExitCode, BOOL PrintErrorMsg);
+VOID LogEvent (LPCTSTR UserMessage, INT ExitCode, BOOL PrintErrorMsg);
void UpdateStatus (int NewStatus, int Check);
/* skelserver functions */
DWORD WINAPI StartServer(LPVOID lpParam);
-SOCKET SetUpListener(const char* ServAddr, int Port);
+SOCKET SetUpListener(USHORT Port);
VOID AcceptConnections(SOCKET ListeningSocket,
LPTHREAD_START_ROUTINE Service, TCHAR *Name);
BOOL EchoIncomingPackets(SOCKET sd);