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.

76 lines
2.2 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <ndisguid.h>
  6. #include <wmium.h>
  7. #include <winsvc.h>
  8. #include <rtutils.h>
  9. #include <tchar.h>
  10. #include <winsock2.h>
  11. #include <ws2tcpip.h>
  12. #include <stdio.h>
  13. #include <iphlpapi.h>
  14. #include <iptypes.h>
  15. #pragma warning(disable:4057) // 'volatile LONG *' differs in indirection to
  16. // slightly different base types from 'ULONG *'
  17. #pragma warning(disable:4100) // unreferenced formal parameter
  18. #pragma warning(disable:4152) // function/data pointer conversion
  19. #pragma warning(disable:4200) // zero-sized array in struct/union
  20. #pragma warning(disable:4201) // nameless struct/union
  21. #pragma warning(disable:4214) // bit field types other than int
  22. #include <ip6.h>
  23. #include <icmp6.h>
  24. #include <ntddip6.h>
  25. #include <ws2ip6.h>
  26. #include <rasuip.h>
  27. #include <mswsock.h>
  28. #include "trace.h"
  29. #include "6to4.h"
  30. #include "teredo.h"
  31. #define isnot !=
  32. #define is ==
  33. //
  34. // instead of using goto:end to go to the end of the block, use the following
  35. //
  36. #define BEGIN_BREAKOUT_BLOCK1 do
  37. #define GOTO_END_BLOCK1 goto END_BREAKOUT_BLOCK_1
  38. #define END_BREAKOUT_BLOCK1 while(FALSE); END_BREAKOUT_BLOCK_1:
  39. #define BEGIN_BREAKOUT_BLOCK2 do
  40. #define GOTO_END_BLOCK2 goto END_BREAKOUT_BLOCK_2
  41. #define END_BREAKOUT_BLOCK2 while(FALSE); END_BREAKOUT_BLOCK_2:
  42. extern DWORD g_TraceId;
  43. extern HANDLE g_LogHandle;
  44. extern DWORD g_dwLoggingLevel;
  45. extern HANDLE g_Heap;
  46. extern HANDLE g_Lock;
  47. //
  48. // WaitForSingleObject should always succeed, since we should never
  49. // time out, abandon the mutex, or pass an invalid handle.
  50. //
  51. #define ENTER_API() \
  52. if (WaitForSingleObject(g_Lock, INFINITE) != WAIT_OBJECT_0) \
  53. ASSERT(FALSE)
  54. #define LEAVE_API() \
  55. ReleaseMutex(g_Lock)
  56. #define MALLOC(x) HeapAlloc(g_Heap, 0, x)
  57. #define FREE(x) HeapFree(g_Heap, 0, x)
  58. #define REALLOC(x, y) HeapReAlloc(g_Heap, 0, x, y)
  59. #define PROFILE(x) printf("%s\n", x)
  60. #define PRINT_IPADDR(x) \
  61. ((x)&0x000000ff),(((x)&0x0000ff00)>>8),(((x)&0x00ff0000)>>16),(((x)&0xff000000)>>24)
  62. VOID WINAPI
  63. ServiceMain(
  64. IN DWORD argc,
  65. IN LPWSTR *argv);