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.

269 lines
7.5 KiB

  1. /* *********************************************************************
  2. * RegAPI.h Header file for registry base api function prototypes
  3. * for those who link to Real mode registry Library
  4. * Microsoft Corporation
  5. * Copyright 1993
  6. *
  7. * Author: Nagarajan Subramaniyan
  8. * Created: 11/5/92
  9. *
  10. * Modification history:
  11. * 1/20/94 DONALDM Wrapped LPSTR and others with ifndef
  12. * _INC_WINDOWS, since windows.h typedefs
  13. * these things. WARNING YOU MUST INCLUDE
  14. * WINDOWS.H before REGAPI.H.
  15. * 1/25/94 DONALDM Removed WINDOWS specific stuff since this
  16. * file should ONLY BE USED BY DOS APPS!!!
  17. * **********************************************************************
  18. */
  19. //---------------------------------------------------------------------
  20. #ifdef _INC_WINDOWS
  21. #pragma message( "WARNING RegAPI.H is a DOS ONLY header file" )
  22. #else //ifndef INC_WINDOWS
  23. #ifndef HKEY
  24. #define HKEY DWORD
  25. #define LPHKEY HKEY FAR *
  26. #endif
  27. #ifndef FAR
  28. #define FAR _far
  29. #endif
  30. #ifndef NEAR
  31. #define NEAR _near
  32. #endif
  33. #ifndef PASCAL
  34. #define PASCAL _pascal
  35. #endif
  36. #ifndef CDECL
  37. #define CDECL _cdecl
  38. #endif
  39. #ifndef CONST
  40. #define CONST const
  41. #endif
  42. typedef char FAR* LPSTR;
  43. typedef const char FAR* LPCSTR;
  44. typedef BYTE FAR* LPBYTE;
  45. typedef const BYTE FAR* LPCBYTE;
  46. typedef void FAR* LPVOID;
  47. #ifdef STRICT
  48. typedef signed long LONG;
  49. #else
  50. #define LONG long
  51. #endif
  52. #ifndef WINAPI
  53. #define WINAPI _far _pascal
  54. #endif
  55. #endif // ifndef INC_WINDOWS
  56. //--------------------------------------------------------------------------
  57. /* allowed data types */
  58. #ifndef REG_SZ
  59. #define REG_SZ 0x0001
  60. #endif
  61. #ifndef REG_BINARY
  62. #define REG_BINARY 0x0003
  63. #endif //ifndef REG_SZ
  64. /* Pre-defined KEYS */
  65. #ifndef HKEY_LOCAL_MACHINE
  66. #define HKEY_CLASSES_ROOT ((HKEY) 0x80000000)
  67. #define HKEY_CURRENT_USER ((HKEY) 0x80000001)
  68. #define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002)
  69. #define HKEY_USERS ((HKEY) 0x80000003)
  70. #define HKEY_PERFORMANCE_DATA ((HKEY) 0x80000004)
  71. #define HKEY_CURRENT_CONFIG ((HKEY) 0x80000005)
  72. #define HKEY_DYN_DATA ((HKEY) 0x80000006)
  73. #endif // ifndef HKEY_LOCAL_MACHINE
  74. #ifndef REG_NONE
  75. #define REG_NONE 0 // unknown data type
  76. #endif
  77. /* note that these values are different from win 3.1; these are the same as
  78. the one used by Win 32
  79. */
  80. /* XLATOFF */
  81. /* real mode Registry API entry points, if using direct entry points */
  82. /* MODULE: RBAPI.c */
  83. /* Win 3.1 Compatible APIs */
  84. LONG FAR _cdecl KRegOpenKey(HKEY, LPCSTR, LPHKEY);
  85. LONG FAR _cdecl KRegCreateKey(HKEY, LPCSTR, LPHKEY);
  86. LONG FAR _cdecl KRegCloseKey(HKEY);
  87. LONG FAR _cdecl KRegDeleteKey(HKEY, LPCSTR);
  88. LONG FAR _cdecl KRegSetValue16(HKEY, LPCSTR, DWORD, LPCSTR, DWORD);
  89. LONG FAR _cdecl KRegQueryValue16(HKEY, LPCSTR, LPSTR, LONG FAR*);
  90. LONG FAR _cdecl KRegEnumKey(HKEY, DWORD, LPSTR, DWORD);
  91. /* New APIs from win 32 */
  92. LONG FAR _cdecl KRegDeleteValue(HKEY, LPCSTR);
  93. LONG FAR _cdecl KRegEnumValue(HKEY, DWORD, LPCSTR,
  94. LONG FAR *, DWORD, LONG FAR *, LPBYTE,
  95. LONG FAR *);
  96. LONG FAR _cdecl KRegQueryValueEx(HKEY, LPCSTR, LONG FAR *, LONG FAR *,
  97. LPBYTE, LONG FAR *);
  98. LONG FAR _cdecl KRegSetValueEx(HKEY, LPCSTR, DWORD, DWORD, LPBYTE, DWORD);
  99. LONG FAR _cdecl KRegFlushKey(HKEY);
  100. LONG FAR _cdecl KRegSaveKey(HKEY, LPCSTR,LPVOID);
  101. LONG FAR _cdecl KRegLoadKey(HKEY, LPCSTR,LPCSTR);
  102. LONG FAR _cdecl KRegUnLoadKey(HKEY, LPCSTR);
  103. /* other APIs */
  104. DWORD FAR _cdecl KRegInit(LPSTR lpszSystemFile,LPSTR lpszUserFile,DWORD dwFlags);
  105. // should be called before any other Reg APIs
  106. // If one of the file name ptrs is a NULL ptr, RegInit will ignore init
  107. // for that file and all Predefined keys for that file.
  108. //
  109. // FLAG BITS for dwFlags:
  110. #define REGINIT_CREATENEW 1
  111. /* create new file if give file not found/cannot be opened */
  112. #define REGINIT_RECOVER 2
  113. /* do init and if file is corrupt try to recover before
  114. giving up
  115. */
  116. #define REGINIT_REPLACE_IFBAD 4
  117. /* do init, recover if file is corrupt and if recover is
  118. is impossible, replace with an empty file
  119. */
  120. VOID FAR _cdecl CleanupRegistry();
  121. /* This procedure frees all memory allocated by Registry */
  122. /* if you call this, to use the registry again, you need */
  123. /* to call RegInit again */
  124. DWORD FAR _cdecl KRegFlush(VOID);
  125. // flushes the registry files to disk
  126. // should be done before termination. No harm in calling
  127. // if registry is not dirty.
  128. WORD FAR _cdecl KRegSetErrorCheckingLevel(WORD wErrLevel);
  129. // Set to 0 to disable checksum, 255 to enable checksum
  130. #if 0
  131. DWORD FAR _cdecl KRegFlushKey(HKEY);
  132. #endif
  133. /* Internal APIs - do not use */
  134. /* Modified from Win 3.1 */
  135. DWORD FAR _cdecl KRegQueryValue (HKEY hKey,LPSTR lpszSubKey, LPSTR lpszValueName,DWORD FAR *lpdwType,LPSTR lpValueBuf, DWORD FAR *ldwBufSize);
  136. DWORD FAR _cdecl KRegSetValue(HKEY hKey,LPSTR lpszSubKey,LPSTR lpszValueName,DWORD dwType,LPBYTE lpszValue,DWORD dwValSize);
  137. /* XLATON */
  138. #ifndef SETUPX_INC
  139. /* defines for changing registry API names for direct callers */
  140. #define RegInit KRegInit
  141. #define RegFlush KRegFlush
  142. #define RegOpenKey KRegOpenKey
  143. #define RegCreateKey KRegCreateKey
  144. #define RegCloseKey KRegCloseKey
  145. #define RegDeleteKey KRegDeleteKey
  146. #define RegDeleteValue KRegDeleteValue
  147. #define RegEnumKey KRegEnumKey
  148. #define RegEnumValue KRegEnumValue
  149. #define RegQueryValue KRegQueryValue16
  150. #define RegQueryValueEx KRegQueryValueEx
  151. #define RegSetValue KRegSetValue16
  152. #define RegSetValueEx KRegSetValueEx
  153. #define RegFlushKey KRegFlushKey
  154. #endif /* #ifndef IS_SETUP */
  155. // Equates for registry function for calling the single entry point
  156. // Registry
  157. #define OpenKey 0L
  158. #define CreateKey 1L
  159. #define CloseKey 2L
  160. #define DeleteKey 3L
  161. #define SetValue 4L
  162. #define QueryValue 5L
  163. #define EnumKey 6L
  164. #define DeleteValue 7L
  165. #define EnumValue 8L
  166. #define QueryValueEx 9L
  167. #define SetValueEx 10L
  168. #define FlushKey 11L
  169. #define Init 12L
  170. #define Flush 13L
  171. /* return codes from Chicago Registration functions */
  172. #ifndef ERROR_BADDB
  173. #define ERROR_BADDB 1009L
  174. #endif
  175. #ifndef ERROR_MORE_DATA
  176. #define ERROR_MORE_DATA 234L
  177. #endif
  178. #ifndef ERROR_BADKEY
  179. #define ERROR_BADKEY 1010L
  180. #endif
  181. #ifndef ERROR_CANTOPEN
  182. #define ERROR_CANTOPEN 1011L
  183. #endif
  184. #ifndef ERROR_CANTREAD
  185. #define ERROR_CANTREAD 1012L
  186. #define ERROR_CANTWRITE 1013L
  187. #endif
  188. #ifndef ERROR_REGISTRY_CORRUPT
  189. #define ERROR_REGISTRY_CORRUPT 1015L
  190. #define ERROR_REGISTRY_IO_FAILED 1016L
  191. #endif
  192. #ifndef ERROR_KEY_DELETED
  193. #define ERROR_KEY_DELETED 1018L
  194. #endif
  195. #ifndef ERROR_OUTOFMEMORY
  196. #define ERROR_OUTOFMEMORY 14L
  197. #endif
  198. #ifndef ERROR_INVALID_PARAMETER
  199. #define ERROR_INVALID_PARAMETER 87L
  200. #endif
  201. #ifndef ERROR_NO_MORE_ITEMS
  202. #define ERROR_NO_MORE_ITEMS 259L
  203. #endif
  204. #ifndef ERROR_SUCCESS
  205. #define ERROR_SUCCESS 0L
  206. #endif
  207. #ifndef ERROR_ACCESS_DENIED
  208. #define ERROR_ACCESS_DENIED 8L
  209. #endif