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.

57 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 1998, Microsoft Corporation
  3. Module Name:
  4. nathlpp.h
  5. Abstract:
  6. This module contains declarations common to the user-mode components
  7. of home-networking.
  8. Author:
  9. Abolade Gbadegesin (aboladeg) 5-Mar-1998
  10. Revision History:
  11. --*/
  12. #ifndef _NATHLP_NATHLPP_H_
  13. #define _NATHLP_NATHLPP_H_
  14. //
  15. // Object synchronization macros
  16. //
  17. #define ACQUIRE_LOCK(x) EnterCriticalSection(&(x)->Lock)
  18. #define RELEASE_LOCK(x) LeaveCriticalSection(&(x)->Lock)
  19. #define REFERENCE_OBJECT(x,deleted) \
  20. (deleted(x) \
  21. ? FALSE \
  22. : (InterlockedIncrement( \
  23. reinterpret_cast<LPLONG>(&(x)->ReferenceCount) \
  24. ), TRUE))
  25. /*
  26. #define DEREFERENCE_OBJECT(x,cleanup) \
  27. (InterlockedDecrement(reinterpret_cast<LPLONG>(&(x)->ReferenceCount)) \
  28. ? TRUE \
  29. : (cleanup(x), FALSE))
  30. */
  31. //
  32. // Memory management macros
  33. //
  34. #define NH_ALLOCATE(s) HeapAlloc(GetProcessHeap(), 0, (s))
  35. #define NH_FREE(p) HeapFree(GetProcessHeap(), 0, (p))
  36. #define NAT_PROTOCOL_UDP 0x11
  37. #define NAT_PROTOCOL_TCP 0x06
  38. #endif // _NATHLP_NATHLPP_H_