ReactOS  0.4.15-dev-1638-gc0caa5c
roshttpd.cpp
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS HTTP Daemon
4  * FILE: roshttpd.cpp
5  * PURPOSE: Main program
6  * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7  * REVISIONS:
8  * CSH 01/09/2000 Created
9  */
10 #include <debug.h>
11 #include <new>
12 #include <winsock2.h>
13 #include <stdio.h>
14 #include <config.h>
15 #include <error.h>
16 #include <httpd.h>
17 
18 using namespace std;
19 
20 
22 {
23  InitWinsock();
24 
27 
28  try {
29  // Create configuration object
30  pConfiguration = new CConfig;
32 
33  // Create daemon object
35 
36  MSG Msg;
37  BOOL bQuit = FALSE;
38  while ((!bQuit) && (!pDaemonThread->Terminated())) {
39  bQuit = PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE);
40  if (!bQuit)
42  }
43 
44  delete pDaemonThread;
45 
46  if (pConfiguration != NULL)
47  delete pConfiguration;
48  } catch (bad_alloc&) {
49  if (pConfiguration != NULL)
50  delete pConfiguration;
51  ReportErrorStr(TS("Insufficient resources."));
52  }
53 
54  DeinitWinsock();
55 }
56 
57 /* Program entry point */
58 int main(int argc, char* argv[])
59 {
60  printf("ReactOS HTTP Daemon\n");
61  printf("Type Control-C to stop.\n");
62 
63  Run();
64 
65  printf("Daemon stopped.\n");
66 }
int main(int argc, char *argv[])
Definition: roshttpd.cpp:58
static int argc
Definition: ServiceArgs.c:12
#define DispatchMessage
Definition: winuser.h:5740
#define PeekMessage
Definition: winuser.h:5805
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define TS(x)
Definition: error.h:11
struct @1627 Msg[]
Definition: features.h:417
#define argv
Definition: mplay32.c:18
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID Default()
Definition: config.cpp:42
VOID Run()
Definition: roshttpd.cpp:21
BOOL Terminated()
Definition: thread.cpp:77
void ReportErrorStr(LPTSTR lpsText)
Definition: error.cpp:13
LPCHttpDaemonThread pDaemonThread
Definition: config.cpp:19
#define NULL
Definition: types.h:112
LPCConfig pConfiguration
Definition: config.cpp:18
#define PM_REMOVE
Definition: winuser.h:1182
VOID DeinitWinsock()
Definition: socket.cpp:340
Definition: config.h:22
VOID InitWinsock()
Definition: socket.cpp:319
#define printf
Definition: config.h:203