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.

260 lines
5.4 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // File: upg.h
  6. //
  7. // Contents:
  8. //
  9. // History:
  10. //
  11. //---------------------------------------------------------------------------
  12. #ifndef __TLSUPG4TO5_H__
  13. #define __TLSUPG4TO5_H__
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #include <ntddkbd.h>
  18. #include <ntddmou.h>
  19. #include <windows.h>
  20. #include <winbase.h>
  21. #include <winerror.h>
  22. #include <stdio.h>
  23. #include <tchar.h>
  24. #include <esent.h>
  25. #include "lscommon.h"
  26. #include "secstore.h"
  27. #include "odbcinst.h"
  28. #include "hydra4db.h"
  29. #ifndef LICENOC_SMALL_UPG
  30. #include "JBDef.h"
  31. #include "TLSDb.h"
  32. #endif
  33. #include "backup.h"
  34. #include "KPDesc.h"
  35. #include "Licensed.h"
  36. #include "licpack.h"
  37. #include "version.h"
  38. #include "workitem.h"
  39. #include "upgdef.h"
  40. //
  41. //
  42. //
  43. #define AllocateMemory(size) \
  44. LocalAlloc(LPTR, size)
  45. #define FreeMemory(ptr) \
  46. if(ptr) \
  47. { \
  48. LocalFree(ptr); \
  49. ptr=NULL; \
  50. }
  51. #define SAFESTRCPY(dest, source) \
  52. _tcsncpy(dest, source, min(_tcslen(source), sizeof(dest)/sizeof(TCHAR))); \
  53. dest[min(_tcslen(source), (sizeof(dest)/sizeof(TCHAR) -1))] = _TEXT('\0');
  54. //---------------------------------------------------------------------------
  55. //
  56. // Global variable
  57. //
  58. #ifndef LICENOC_SMALL_UPG
  59. extern JBInstance g_JbInstance;
  60. extern JBSession g_JetSession;
  61. extern JBDatabase g_JetDatabase;
  62. extern PBYTE g_pbSetupId;
  63. extern DWORD g_cbSetupId;
  64. extern PBYTE g_pbDomainSid;
  65. extern DWORD g_cbDomainSid;
  66. #endif
  67. //--------------------------------------------------------------------------
  68. //
  69. // Upgrade Error Code, should move into resource file.
  70. //
  71. #define UPGRADE_SETUP_ERROR_BASE 0xD0000000
  72. //
  73. // File not exist or directory not exist
  74. //
  75. #define ERROR_TARGETFILE_NOT_FOUND (UPGRADE_SETUP_ERROR_BASE)
  76. //
  77. // Destination file already exist
  78. //
  79. #define ERROR_DEST_FILE_EXIST (UPGRADE_SETUP_ERROR_BASE + 1)
  80. //
  81. // Source database file does not exist
  82. //
  83. #define ERROR_SRC_FILE_NOT_EXIST (UPGRADE_SETUP_ERROR_BASE + 2)
  84. //
  85. // Hydra ODBC datasource not exist
  86. //
  87. #define ERROR_ODBC_DATASOURCE_NOTEXIST (UPGRADE_SETUP_ERROR_BASE + 3)
  88. //
  89. // Invalid setup or unsupported version
  90. //
  91. #define ERROR_INVALID_NT4_SETUP (UPGRADE_SETUP_ERROR_BASE + 4)
  92. //
  93. // Internal Error in upgrade
  94. //
  95. #define ERROR_INTERNAL (UPGRADE_SETUP_ERROR_BASE + 5)
  96. //
  97. // Unsupport NT4 database version, for example, beta 2
  98. //
  99. #define ERROR_NOTSUPPORT_DB_VERSION (UPGRADE_SETUP_ERROR_BASE + 6)
  100. //
  101. // JetBlue database file exists
  102. //
  103. #define ERROR_JETBLUE_DBFILE_ALREADY_EXISTS (UPGRADE_SETUP_ERROR_BASE + 1)
  104. //
  105. // JetBlue database file exists and corrupted
  106. //
  107. #define ERROR_CORRUPT_JETBLUE_DBFILE (UPGRADE_SETUP_ERROR_BASE + 2)
  108. //
  109. // Can't delete ODBC datasource
  110. //
  111. #define ERROR_DELETE_ODBC_DSN (UPGRADE_SETUP_ERROR_BASE + 7)
  112. #ifndef LICENOC_SMALL_UPG
  113. //---------------------------------------------------
  114. //
  115. // JetBlue error code.
  116. //
  117. #define UPGRADE_JETBLUE_ERROR_BASE 0xD4000000
  118. #define SET_JB_ERROR(err) (UPGRADE_JETBLUE_ERROR_BASE + abs(err))
  119. #endif
  120. //---------------------------------------------------
  121. //
  122. // ODBC related error code
  123. //
  124. //---------------------------------------------------
  125. #define UPGRADE_ODBC_ERROR_BASE 0xD8000000
  126. //
  127. // General ODBC error
  128. //
  129. #define ERROR_ODBC_GENERAL (UPGRADE_ODBC_ERROR_BASE + 1)
  130. //
  131. // ODBC class internal error
  132. //
  133. #define ERROR_ODBC_INTERNAL (UPGRADE_ODBC_ERROR_BASE + 2)
  134. //
  135. // ODBC Record not found
  136. //
  137. #define ERROR_ODBC_NO_DATA_FOUND (UPGRADE_ODBC_ERROR_BASE + 3)
  138. //
  139. // SQLConnect() failed.
  140. //
  141. #define ERROR_ODBC_CONNECT (UPGRADE_ODBC_ERROR_BASE + 4)
  142. //
  143. // SQLAllocConnect() failed
  144. //
  145. #define ERROR_ODBC_ALLOC_CONNECT (UPGRADE_ODBC_ERROR_BASE + 5)
  146. //
  147. // SQLAllocEnv() failed
  148. //
  149. #define ERROR_ODBC_ALLOC_ENV (UPGRADE_ODBC_ERROR_BASE + 6)
  150. //
  151. // SQLAllocStmt() failed.
  152. //
  153. #define ERROR_ODBC_ALLOC_STMT (UPGRADE_ODBC_ERROR_BASE + 7)
  154. //
  155. // SQTransact() failed on commit
  156. //
  157. #define ERROR_ODBC_COMMIT (UPGRADE_ODBC_ERROR_BASE + 8)
  158. //
  159. // SQTransact() failed on rollback
  160. //
  161. #define ERROR_ODBC_ROLLBACK (UPGRADE_ODBC_ERROR_BASE + 9)
  162. //
  163. // Cant' allocate ODBC handle, all handle are in use.
  164. //
  165. #define ERROR_ODBC_ALLOCATE_HANDLE (UPGRADE_ODBC_ERROR_BASE + 10)
  166. //
  167. // SQLPrepare() failed
  168. //
  169. #define ERROR_ODBC_PREPARE (UPGRADE_ODBC_ERROR_BASE + 11)
  170. //
  171. // Execute() failed
  172. //
  173. #define ERROR_ODBC_EXECUTE (UPGRADE_ODBC_ERROR_BASE + 12)
  174. //
  175. // ExecDirect() failed
  176. //
  177. #define ERROR_ODBC_EXECDIRECT (UPGRADE_ODBC_ERROR_BASE + 13)
  178. //
  179. // BindCol failed.
  180. //
  181. #define ERROR_ODBC_BINDCOL (UPGRADE_ODBC_ERROR_BASE + 14)
  182. //
  183. // BindInputParm() failed.
  184. //
  185. #define ERROR_ODBC_BINDINPUTPARM (UPGRADE_ODBC_ERROR_BASE + 15)
  186. //
  187. // GetData() failed.
  188. //
  189. #define ERROR_ODBC_GETDATA (UPGRADE_ODBC_ERROR_BASE + 16)
  190. //
  191. // ParmData() failed.
  192. //
  193. #define ERROR_ODBC_PARMDATA (UPGRADE_ODBC_ERROR_BASE + 17)
  194. //
  195. // PutData() failed.
  196. //
  197. #define ERROR_ODBC_PUTDATA (UPGRADE_ODBC_ERROR_BASE + 18)
  198. //
  199. // Corrupted database
  200. //
  201. #define ERROR_ODBC_CORRUPTDATABASEFILE (UPGRADE_ODBC_ERROR_BASE + 19)
  202. //
  203. // SQLFtch() failed.
  204. //
  205. #define ERROR_ODBC_FETCH (UPGRADE_ODBC_ERROR_BASE + 20)
  206. #endif