Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

  1. /*--
  2. Copyright (c) 1995-1998 Microsoft Corporation
  3. Module Name: LISTENER.CPP
  4. Author: Arul Menezes
  5. Abstract: HTTP server initialization & listener thread
  6. --*/
  7. #include "pch.h"
  8. #pragma hdrstop
  9. #include "httpd.h"
  10. typedef void (WINAPI *PFN_EXECUTE)();
  11. #ifdef UNDER_NT
  12. extern "C" int WINAPI HttpInitializeFromExe();
  13. #endif
  14. int
  15. WINAPI
  16. WinMain(HINSTANCE hInstance,
  17. HINSTANCE hPrevInstance,
  18. #ifdef UNDER_NT
  19. LPSTR lpCmdLine,
  20. #else
  21. LPWSTR lpCmdLine,
  22. #endif
  23. int nCmdShow)
  24. {
  25. #ifdef UNDER_NT
  26. // On NT builds, we statically link everything together.
  27. HttpInitializeFromExe();
  28. #else
  29. PFN_EXECUTE pFunc = NULL;
  30. HINSTANCE hLib = LoadLibrary(L"HTTPD.DLL");
  31. if (!hLib)
  32. {
  33. RETAILMSG(1,(L"HTTPDEXE: Httpd.dll not loaded on device, aborting execution\r\n"));
  34. return 1;
  35. }
  36. pFunc = (PFN_EXECUTE) GetProcAddress(hLib,L"HttpInitializeFromExe");
  37. if (!pFunc)
  38. {
  39. RETAILMSG(1,(L"HTTPDEXE: Httpd.dll corrupt or old version, aborting execution\r\n"));
  40. return 1;
  41. }
  42. ((PFN_EXECUTE) pFunc)();
  43. #endif
  44. Sleep(INFINITE); // don't ever stop, must kp to end us.
  45. return 0;
  46. }