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.

151 lines
4.1 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. #ifdef DBCS
  53. #define STRCHR(string, character) DBCSStrChr(string, character)
  54. #else
  55. #define STRCHR(string, character) _fstrchr(string, character)
  56. #endif
  57. #endif
  58. #ifdef WIN32
  59. #define CHARNEXT(string) CharNext(string)
  60. #else
  61. #define CHARNEXT(string) (string + 1)
  62. #endif
  63. #ifdef WIN32
  64. #define CHARUPPERSTRING(string) CharUpper(string)
  65. #else
  66. #define CHARUPPERSTRING(string) _fstrupr(string)
  67. #endif
  68. #ifdef WIN32
  69. #define FILE_HANDLE HANDLE
  70. #else
  71. #define FILE_HANDLE int
  72. #endif
  73. #ifdef WIN32
  74. #define FILE_NUMBYTES DWORD
  75. #else
  76. #define FILE_NUMBYTES unsigned
  77. #endif
  78. #if 1 //def WIN32
  79. #define OPENREADFILE(pfilename, handle) \
  80. ((handle = (FILE_HANDLE) OpenFile(pfilename, &OFStruct, OF_READ)) != \
  81. (FILE_HANDLE) HFILE_ERROR)
  82. #else
  83. #define OPENREADFILE(pfilename, handle) \
  84. (_dos_open(pfilename, _O_RDONLY, &handle) == 0)
  85. #endif
  86. #ifdef WIN32
  87. #define OPENWRITEFILE(pfilename, handle) \
  88. ((handle = CreateFile(pfilename, GENERIC_WRITE, 0, \
  89. NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) != \
  90. INVALID_HANDLE_VALUE)
  91. #else
  92. #define OPENWRITEFILE(pfilename, handle) \
  93. (HFILE_ERROR!=(handle=_lcreat(pfilename, 0)))
  94. #endif
  95. #ifdef WIN32
  96. #define READFILE(handle, buffer, count, pnumbytes) \
  97. ReadFile(handle, buffer, count, pnumbytes, NULL)
  98. #else
  99. #define READFILE(handle, buffer, count, pnumbytes) \
  100. (count==(*pnumbytes=_hread(handle, buffer, count)))
  101. #endif
  102. #ifdef WIN32
  103. #define WRITEFILE(handle, buffer, count, pnumbytes) \
  104. WriteFile(handle, buffer, count, pnumbytes, NULL)
  105. #else
  106. #define WRITEFILE(handle, buffer, count, pnumbytes) \
  107. (count==(*pnumbytes=_hwrite(handle, buffer, count)))
  108. #endif
  109. #ifdef WIN32
  110. #define SEEKCURRENTFILE(handle, count) \
  111. (SetFilePointer(handle, (LONG) count, NULL, FILE_CURRENT))
  112. #else
  113. #define SEEKCURRENTFILE(handle, count) \
  114. (_llseek(handle, count, SEEK_CUR))
  115. #endif
  116. #ifdef WIN32
  117. #define CLOSEFILE(handle) CloseHandle(handle)
  118. #else
  119. #define CLOSEFILE(handle) _lclose(handle)
  120. #endif
  121. #ifdef WIN32
  122. #define GETFILESIZE(handle) GetFileSize(handle, NULL)
  123. #else
  124. DWORD
  125. NEAR PASCAL
  126. GetFileSize(
  127. FILE_HANDLE hFile
  128. );
  129. #define GETFILESIZE(handle) GetFileSize(handle)
  130. #endif
  131. #endif // _INC_REG1632
  132.