use GetSystemDirectory
authorGed Murphy <gedmurphy@reactos.org>
Sun, 23 Oct 2005 11:01:11 +0000 (11:01 +0000)
committerGed Murphy <gedmurphy@reactos.org>
Sun, 23 Oct 2005 11:01:11 +0000 (11:01 +0000)
svn path=/trunk/; revision=18698

reactos/services/tcpsvcs/qotd.c

index 7c20df5..93ead1e 100644 (file)
 #define QBUFSIZ 160
 #define NUMQUOTES 60
 
-LPCTSTR FilePath = "C:\\ReactOS\\system32\\drivers\\etc\\quotes";
+LPCTSTR FilePath = _T("\\drivers\\etc\\quotes");
 
 DWORD WINAPI QotdHandler(VOID* Sock_)
 {
     FILE *fp;
     SOCKET Sock;
-    INT QuoteToPrint;
+    TCHAR Sys[MAX_PATH];
     TCHAR Quote[NUMQUOTES][BUFSIZ]; // need to set this dynamically
+    INT QuoteToPrint;
     INT i = 0;
 
     Sock = (SOCKET)Sock_;
 
+    if(! GetSystemDirectory(Sys, MAX_PATH))
+       _tprintf(_T("Getting system path failed. Error: %lu\n"), GetLastError());
+    
+    _tcscat(Sys, FilePath);
+
     _tprintf(_T("Opening quotes file\n"));
-    if ((fp = _tfopen(FilePath, "r")) == NULL)
+    if ((fp = _tfopen(Sys, "r")) == NULL)
     {
         _tprintf(_T("Error opening file: %lu\n"), GetLastError());
         _tprintf(_T("Terminating qotd thread\n"));