Leaked source code of windows server 2003
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.

95 lines
2.8 KiB

  1. /******************************************************************************
  2. *
  3. * $Workfile: os.h $
  4. *
  5. * $Author: Psmith $
  6. *
  7. * $Revision: 2 $
  8. *
  9. * $Modtime: 23/09/99 10:07 $
  10. *
  11. * Description: NT specific macros and definitions.
  12. *
  13. ******************************************************************************/
  14. #if !defined(OS_H) // OS.H
  15. #define OS_H
  16. #include <ntddk.h>
  17. typedef unsigned char BYTE; // 8-bits
  18. typedef unsigned short WORD; // 16-bits
  19. typedef unsigned long DWORD; // 32-bits
  20. typedef unsigned char UCHAR; // 8-bits
  21. typedef unsigned short USHORT; // 16-bits
  22. typedef unsigned long ULONG; // 32-bits
  23. typedef BYTE *PBYTE;
  24. typedef WORD *PWORD;
  25. typedef DWORD *PDWORD;
  26. typedef UCHAR *PUCHAR;
  27. typedef USHORT *PUSHORT;
  28. typedef ULONG *PULONG;
  29. extern PVOID SpxAllocateMem(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes);
  30. // Macros
  31. /////////////////////////////////////////////////////////////////////////////////
  32. // DebugPrint macro.
  33. #define SpxDbgPrint(STRING) \
  34. DbgPrint STRING
  35. // Allocate and zero memory.
  36. #define UL_ALLOC_AND_ZERO_MEM(NumBytes) \
  37. (SpxAllocateMem(NonPagedPool, NumBytes))
  38. // Free memory.
  39. #define UL_FREE_MEM(Ptr, NumBytes) \
  40. (ExFreePool(Ptr))
  41. // Copy memory.
  42. #define UL_COPY_MEM(pDest, pSrc, NumBytes) \
  43. (RtlCopyMemory(pDest, pSrc, NumBytes))
  44. #define UL_ZERO_MEM(Ptr, NumBytes) \
  45. RtlZeroMemory(Ptr, NumBytes);
  46. // Read single byte from I/O.
  47. #define UL_READ_BYTE_IO(BaseAddress, OffSet) \
  48. (READ_PORT_UCHAR( ((PUCHAR)BaseAddress) + OffSet) )
  49. // Write single byte to I/O.
  50. #define UL_WRITE_BYTE_IO(BaseAddress, OffSet, Data) \
  51. (WRITE_PORT_UCHAR( ((PUCHAR)BaseAddress) + OffSet, Data) )
  52. // Read single byte from Memory.
  53. #define UL_READ_BYTE_MEM(BaseAddress, OffSet) \
  54. (READ_REGISTER_UCHAR( ((PUCHAR)BaseAddress) + OffSet) )
  55. // Write single byte to Memory.
  56. #define UL_WRITE_BYTE_MEM(BaseAddress, OffSet, Data) \
  57. (WRITE_REGISTER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, Data) )
  58. /*
  59. // Read multiple bytes to I/O.
  60. #define UL_READ_MULTIBYTES_IO(BaseAddress, OffSet, pDest, NumberOfBytes) \
  61. (READ_PORT_BUFFER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, pDest, NumberOfBytes) )
  62. // Write multiple bytes to I/O.
  63. #define UL_WRITE_MULTIBYTES_IO(BaseAddress, OffSet, pData, NumberOfBytes) \
  64. (WRITE_PORT_BUFFER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, pData, NumberOfBytes) )
  65. // Read multiple bytes to Memory.
  66. #define UL_READ_MULTIBYTES_MEM(BaseAddress, OffSet, pDest, NumberOfBytes) \
  67. (READ_REGISTER_BUFFER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, pDest, NumberOfBytes) )
  68. // Write multiple bytes to Memory.
  69. #define UL_WRITE_MULTIBYTES_MEM(BaseAddress, OffSet, pData, NumberOfBytes) \
  70. (WRITE_REGISTER_BUFFER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, pData, NumberOfBytes) )
  71. */
  72. #endif // End of OS.H