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.

147 lines
4.0 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1993-1994
  4. *
  5. * TITLE: REG1632.H
  6. *
  7. * VERSION: 4.01
  8. *
  9. * AUTHOR: Tracy Sharpe
  10. *
  11. * DATE: 06 Apr 1994
  12. *
  13. * Win32 and MS-DOS compatibility macros for the Registry Editor.
  14. *
  15. ********************************************************************************
  16. *
  17. * CHANGE LOG:
  18. *
  19. * DATE REV DESCRIPTION
  20. * ----------- --- -------------------------------------------------------------
  21. * 06 Apr 1994 TCS Original implementation.
  22. *
  23. *******************************************************************************/
  24. #ifndef _INC_REG1632
  25. #define _INC_REG1632
  26. #ifndef LPCHAR
  27. typedef CHAR FAR* LPCHAR;
  28. #endif
  29. #ifdef WIN32
  30. #define WSPRINTF(x) wsprintf ##x
  31. #else
  32. #define WSPRINTF(x) sprintf ##x
  33. #endif
  34. #ifdef WIN32
  35. #define STRCMP(string1, string2) lstrcmp(string1, string2)
  36. #else
  37. #define STRCMP(string1, string2) _fstrcmp(string1, string2)
  38. #endif
  39. #ifdef WIN32
  40. #define STRCPY(string1, string2) lstrcpy(string1, string2)
  41. #else
  42. #define STRCPY(string1, string2) _fstrcpy(string1, string2)
  43. #endif
  44. #ifdef WIN32
  45. #define STRLEN(string) lstrlen(string)
  46. #else
  47. #define STRLEN(string) _fstrlen(string)
  48. #endif
  49. #ifdef WIN32
  50. #define STRCHR(string, character) StrChr(string, character)
  51. #else
  52. #define STRCHR(string, character) _fstrchr(string, character)
  53. #endif
  54. #ifdef WIN32
  55. #define CHARNEXT(string) CharNext(string)
  56. #else
  57. #define CHARNEXT(string) (string + 1)
  58. #endif
  59. #ifdef WIN32
  60. #define CHARUPPERSTRING(string) CharUpper(string)
  61. #else
  62. #define CHARUPPERSTRING(string) _fstrupr(string)
  63. #endif
  64. #ifdef WIN32
  65. #define FILE_HANDLE HANDLE
  66. #else
  67. #define FILE_HANDLE int
  68. #endif
  69. #ifdef WIN32
  70. #define FILE_NUMBYTES DWORD
  71. #else
  72. #define FILE_NUMBYTES unsigned
  73. #endif
  74. #ifdef WIN32
  75. #define OPENREADFILE(pfilename, handle) \
  76. ((handle = CreateFile(pfilename, GENERIC_READ, FILE_SHARE_READ, \
  77. NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != \
  78. INVALID_HANDLE_VALUE)
  79. #else
  80. #define OPENREADFILE(pfilename, handle) \
  81. (_dos_open(pfilename, _O_RDONLY, &handle) == 0)
  82. #endif
  83. #ifdef WIN32
  84. #define OPENWRITEFILE(pfilename, handle) \
  85. ((handle = CreateFile(pfilename, GENERIC_WRITE, 0, \
  86. NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) != \
  87. INVALID_HANDLE_VALUE)
  88. #else
  89. #define OPENWRITEFILE(pfilename, handle) \
  90. (_dos_creat(pfilename, _A_NORMAL, &handle) == 0)
  91. #endif
  92. #ifdef WIN32
  93. #define READFILE(handle, buffer, count, pnumbytes) \
  94. ReadFile(handle, buffer, count, pnumbytes, NULL)
  95. #else
  96. #define READFILE(handle, buffer, count, pnumbytes) \
  97. (_dos_read(handle, buffer, count, pnumbytes) == 0)
  98. #endif
  99. #ifdef WIN32
  100. #define WRITEFILE(handle, buffer, count, pnumbytes) \
  101. WriteFile(handle, buffer, count, pnumbytes, NULL)
  102. #else
  103. #define WRITEFILE(handle, buffer, count, pnumbytes) \
  104. (_dos_write(handle, buffer, count, pnumbytes) == 0)
  105. #endif
  106. #ifdef WIN32
  107. #define SEEKCURRENTFILE(handle, count) \
  108. (SetFilePointer(handle, (LONG) count, NULL, FILE_CURRENT))
  109. #else
  110. #define SEEKCURRENTFILE(handle, count) \
  111. (_dos_seek(handle, (unsigned long) count, SEEK_CUR))
  112. #endif
  113. #ifdef WIN32
  114. #define CLOSEFILE(handle) CloseHandle(handle)
  115. #else
  116. #define CLOSEFILE(handle) _dos_close(handle)
  117. #endif
  118. #ifdef WIN32
  119. #define GETFILESIZE(handle) GetFileSize(handle, NULL)
  120. #else
  121. DWORD
  122. NEAR PASCAL
  123. GetFileSize(
  124. FILE_HANDLE hFile
  125. );
  126. #define GETFILESIZE(handle) GetFileSize(handle)
  127. #endif
  128. #endif // _INC_REG1632