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.

93 lines
2.6 KiB

  1. /******************************************************************************
  2. *
  3. * $Workfile: os.h $
  4. *
  5. * $Author: Psmith $
  6. *
  7. * $Revision: 3 $
  8. *
  9. * $Modtime: 21/07/99 9:19 $
  10. *
  11. * Description: NT specific macros and definitions.
  12. *
  13. ******************************************************************************/
  14. #if !defined(OSDEFS_H) // OSDEFS.H
  15. #define OSDEFS_H
  16. #include <ntddk.h>
  17. /*
  18. #define TRUE 1
  19. #define FALSE 0
  20. typedef int BOOLEAN;
  21. typedef void VOID;
  22. typedef VOID *PVOID;
  23. */
  24. typedef unsigned char BYTE; // 8-bits
  25. typedef unsigned short WORD; // 16-bits
  26. typedef unsigned long DWORD; // 32-bits
  27. typedef unsigned char UCHAR; // 8-bits
  28. typedef unsigned short USHORT; // 16-bits
  29. typedef unsigned long ULONG; // 32-bits
  30. typedef BYTE *PBYTE;
  31. typedef WORD *PWORD;
  32. typedef DWORD *PDWORD;
  33. typedef UCHAR *PUCHAR;
  34. typedef USHORT *PUSHORT;
  35. typedef ULONG *PULONG;
  36. extern PVOID SpxAllocateMem(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes);
  37. // Macros
  38. #define UL_ALLOC_AND_ZERO_MEM(Size) \
  39. (SpxAllocateMem(NonPagedPool, Size))
  40. #define UL_FREE_MEM(Ptr, Size) \
  41. (ExFreePool(Ptr))
  42. #define UL_COPY_MEM(pDest, pSrc, NumBytes) \
  43. (RtlCopyMemory(pDest, pSrc, NumBytes))
  44. // Read single byte from I/O.
  45. #define UL_READ_BYTE_IO(BaseAddress, OffSet) \
  46. (READ_PORT_UCHAR( ((PUCHAR)BaseAddress) + OffSet) )
  47. // Write single byte to I/O.
  48. #define UL_WRITE_BYTE_IO(BaseAddress, OffSet, Data) \
  49. (WRITE_PORT_UCHAR( ((PUCHAR)BaseAddress) + OffSet, Data) )
  50. /*
  51. // Read multiple bytes to I/O.
  52. #define UL_READ_MULTIBYTES_IO(BaseAddress, OffSet, pDest, NumberOfBytes) \
  53. (READ_PORT_BUFFER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, pDest, NumberOfBytes) )
  54. // Write multiple bytes to I/O.
  55. #define UL_WRITE_MULTIBYTES_IO(BaseAddress, OffSet, pData, NumberOfBytes) \
  56. (WRITE_PORT_BUFFER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, pData, NumberOfBytes) )
  57. */
  58. // Read single byte from Memory.
  59. #define UL_READ_BYTE_MEM(BaseAddress, OffSet) \
  60. (READ_REGISTER_UCHAR( ((PUCHAR)BaseAddress) + OffSet) )
  61. // Write single byte to Memory.
  62. #define UL_WRITE_BYTE_MEM(BaseAddress, OffSet, Data) \
  63. (WRITE_REGISTER_UCHAR( ((PUCHAR)BaseAddress) + OffSet, Data) )
  64. /*
  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 OSDEFS.H