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.

91 lines
2.2 KiB

  1. /*++ BUILD Version: 0001
  2. *
  3. * MVDM v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * MVDM.H
  8. * Constants, macros, and types common to all of MVDM
  9. *
  10. * History:
  11. * Created 14-May-1991 by Jeff Parsons (jeffpar)
  12. --*/
  13. /* Common constants, not defined in NT/WIN32
  14. */
  15. #define K 1024L
  16. /* Common types, not defined in NT/WIN32
  17. */
  18. #ifdef H2INC
  19. typedef unsigned char BYTE;
  20. typedef unsigned short WORD;
  21. typedef unsigned long DWORD;
  22. typedef long LONG;
  23. typedef char CHAR;
  24. typedef short SHORT;
  25. typedef unsigned short USHORT;
  26. typedef unsigned long ULONG;
  27. typedef char *PSZ;
  28. typedef void *PVOID;
  29. typedef ULONG *PULONG;
  30. typedef WORD ATOM;
  31. #endif
  32. // typedef int INT;
  33. // typedef DWORD UINT;
  34. typedef short FAR *LPSHORT;
  35. typedef char SZ[];
  36. typedef char FAR *LPSZ;
  37. typedef PBYTE *PPBYTE;
  38. typedef PWORD *PPWORD;
  39. typedef PDWORD *PPDWORD;
  40. // typedef UINT *PUINT;
  41. // unaligned typedefs
  42. typedef WORD UNALIGNED *PWORD16;
  43. typedef SHORT UNALIGNED *PSHORT16;
  44. typedef DWORD UNALIGNED *PDWORD16;
  45. #define WORDOF16(i,n) (((PWORD16)&(i))[n])
  46. #define LOW16(l) WORDOF16(l,0)
  47. #define HIW16(l) WORDOF16(l,1)
  48. /* Common macros, not defined in NT/WIN32
  49. */
  50. #define BYTEOF(i,n) (((PBYTE)&(i))[n])
  51. #define LOB(i) BYTEOF(i,0)
  52. #define HIB(i) BYTEOF(i,1)
  53. #define WORDOF(i,n) (((PWORD)&(i))[n])
  54. #define LOW(l) WORDOF(l,0)
  55. #define HIW(l) WORDOF(l,1)
  56. #define INTOF(i,n) (((PINT)&(i))[n])
  57. #define UINTOF(i,n) (((PUINT)&(i))[n])
  58. #ifndef MAKEWORD
  59. #define MAKEWORD(l,h) ((WORD)((BYTE)(l)|((BYTE)(h)<<8)))
  60. #endif
  61. #define MAKEDWORD(l0,h0,l1,h1) ((DWORD)MAKEWORD(l0,h0)|((DWORD)MAKEWORD(l1,h1)<<16))
  62. #define GETBYTE(p) *((PBYTE)p)++
  63. #ifdef i386
  64. #define FETCHWORD(s) ((WORD)(s))
  65. #define FETCHDWORD(s) ((DWORD)(s))
  66. #define STOREWORD(d,s) (WORD)d=(WORD)s
  67. #define STOREDWORD(d,s) (DWORD)d=(DWORD)s
  68. #else
  69. #define FETCHWORD(s) (*(UNALIGNED WORD *)&(s))
  70. #define FETCHDWORD(s) (*(UNALIGNED DWORD *)&(s))
  71. #define STOREWORD(d,s) *(UNALIGNED WORD *)&(d)=(WORD)s
  72. #define STOREDWORD(d,s) *(UNALIGNED DWORD *)&(d)=(DWORD)s
  73. #endif
  74. #define FETCHSHORT(s) ((SHORT)(FETCHWORD(s)))
  75. #define FETCHLONG(s) ((LONG)(FETCHDWORD(s)))
  76. #define STORESHORT(d,s) STOREWORD(d,s)
  77. #define STORELONG(d,s) STOREDWORD(d,s)
  78. #define NUMEL(a) ((sizeof a)/(sizeof a[0]))
  79. #define OFFSETOF(t,f) ((INT)&(((t *)0)->f))
  80.