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.

471 lines
9.1 KiB

  1. /*++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. scejetp.h
  5. Abstract:
  6. Header for scejet.c - Sce-Jet service APIs
  7. Author:
  8. Revision History:
  9. --*/
  10. #ifndef _SCEJETP_
  11. #define _SCEJETP_
  12. #include <esent.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. //
  17. // type used when open a table and a section
  18. //
  19. typedef enum _SCEJET_TABLE_TYPE {
  20. SCEJET_TABLE_SCP,
  21. SCEJET_TABLE_SAP,
  22. SCEJET_TABLE_SMP,
  23. SCEJET_TABLE_VERSION,
  24. SCEJET_TABLE_SECTION,
  25. SCEJET_TABLE_GPO,
  26. SCEJET_TABLE_TATTOO
  27. } SCEJET_TABLE_TYPE;
  28. typedef enum _SCEJET_CREATE_FLAG {
  29. SCEJET_CREATE_IN_BUFFER,
  30. SCEJET_CREATE_NO_TABLEID
  31. } SCEJET_CREATE_FLAG;
  32. //
  33. // type used when open a database file
  34. //
  35. typedef enum _SCEJET_OPEN_TYPE {
  36. SCEJET_OPEN_READ_WRITE=0,
  37. SCEJET_OPEN_EXCLUSIVE,
  38. SCEJET_OPEN_READ_ONLY,
  39. SCEJET_OPEN_NOCHECK_VERSION
  40. } SCEJET_OPEN_TYPE;
  41. //
  42. // type used when create a database file
  43. //
  44. typedef enum _SCEJET_CREATE_TYPE {
  45. SCEJET_RETURN_ON_DUP=0,
  46. SCEJET_OVERWRITE_DUP,
  47. SCEJET_OPEN_DUP,
  48. SCEJET_OPEN_DUP_EXCLUSIVE
  49. } SCEJET_CREATE_TYPE;
  50. //
  51. // type used when delete lines
  52. //
  53. typedef enum _SCEJET_DELETE_TYPE {
  54. SCEJET_DELETE_LINE=0,
  55. SCEJET_DELETE_LINE_NO_CASE,
  56. SCEJET_DELETE_PARTIAL,
  57. SCEJET_DELETE_PARTIAL_NO_CASE,
  58. SCEJET_DELETE_SECTION
  59. } SCEJET_DELETE_TYPE;
  60. //
  61. // type used when find a line
  62. //
  63. typedef enum _SCEJET_FIND_TYPE {
  64. SCEJET_CURRENT=0,
  65. SCEJET_EXACT_MATCH,
  66. SCEJET_PREFIX_MATCH,
  67. SCEJET_NEXT_LINE,
  68. SCEJET_CLOSE_VALUE,
  69. SCEJET_EXACT_MATCH_NO_CASE,
  70. SCEJET_PREFIX_MATCH_NO_CASE
  71. } SCEJET_FIND_TYPE;
  72. typedef enum _SCEJET_SEEK_FLAG {
  73. SCEJET_SEEK_GT=0,
  74. SCEJET_SEEK_EQ,
  75. SCEJET_SEEK_GE,
  76. SCEJET_SEEK_GT_NO_CASE,
  77. SCEJET_SEEK_EQ_NO_CASE,
  78. SCEJET_SEEK_GE_NO_CASE,
  79. SCEJET_SEEK_GE_DONT_CARE
  80. } SCEJET_SEEK_FLAG;
  81. #define SCEJET_PREFIX_MAXLEN 1024
  82. typedef struct _SCE_CONTEXT {
  83. DWORD Type;
  84. JET_SESID JetSessionID;
  85. JET_DBID JetDbID;
  86. SCEJET_OPEN_TYPE OpenFlag;
  87. // scp table
  88. JET_TABLEID JetScpID;
  89. JET_COLUMNID JetScpSectionID;
  90. JET_COLUMNID JetScpNameID;
  91. JET_COLUMNID JetScpValueID;
  92. JET_COLUMNID JetScpGpoID;
  93. // sap table
  94. JET_TABLEID JetSapID;
  95. JET_COLUMNID JetSapSectionID;
  96. JET_COLUMNID JetSapNameID;
  97. JET_COLUMNID JetSapValueID;
  98. // smp table
  99. JET_TABLEID JetSmpID;
  100. JET_COLUMNID JetSmpSectionID;
  101. JET_COLUMNID JetSmpNameID;
  102. JET_COLUMNID JetSmpValueID;
  103. // section table
  104. JET_TABLEID JetTblSecID;
  105. JET_COLUMNID JetSecNameID;
  106. JET_COLUMNID JetSecID;
  107. } SCECONTEXT, *PSCECONTEXT;
  108. typedef struct _SCE_SECTION {
  109. JET_SESID JetSessionID;
  110. JET_DBID JetDbID;
  111. JET_TABLEID JetTableID;
  112. JET_COLUMNID JetColumnSectionID;
  113. JET_COLUMNID JetColumnNameID;
  114. JET_COLUMNID JetColumnValueID;
  115. JET_COLUMNID JetColumnGpoID;
  116. DOUBLE SectionID;
  117. } SCESECTION, *PSCESECTION;
  118. //
  119. // To Open existing profile database.
  120. //
  121. #define SCE_TABLE_OPTION_MERGE_POLICY 0x1
  122. #define SCE_TABLE_OPTION_TATTOO 0x2
  123. #define SCE_TABLE_OPTION_DEMOTE_TATTOO 0x4
  124. SCESTATUS
  125. SceJetOpenFile(
  126. IN LPSTR ProfileFileName,
  127. IN SCEJET_OPEN_TYPE Flags,
  128. IN DWORD dwTableOptions,
  129. OUT PSCECONTEXT *hProfile
  130. );
  131. //
  132. // To create a new profile
  133. //
  134. SCESTATUS
  135. SceJetCreateFile(
  136. IN LPSTR ProfileFileName,
  137. IN SCEJET_CREATE_TYPE Flags,
  138. IN DWORD dwTableOptions,
  139. OUT PSCECONTEXT *hProfile
  140. );
  141. //
  142. // close the profile database.
  143. //
  144. SCESTATUS
  145. SceJetCloseFile(
  146. IN PSCECONTEXT hProfile,
  147. IN BOOL TermSession,
  148. IN BOOL Terminate
  149. );
  150. //
  151. // To Open a section in the profile.
  152. //
  153. SCESTATUS
  154. SceJetOpenSection(
  155. IN PSCECONTEXT hProfile,
  156. IN DOUBLE SectionID,
  157. IN SCEJET_TABLE_TYPE tblType,
  158. OUT PSCESECTION *hSection
  159. );
  160. //
  161. // To get line count in the section.
  162. //
  163. SCESTATUS
  164. SceJetGetLineCount(
  165. IN PSCESECTION hSection,
  166. IN PWSTR LinePrefix OPTIONAL,
  167. IN BOOL bExactCase,
  168. OUT DWORD *Count
  169. );
  170. //
  171. // To delete a section or current line
  172. //
  173. SCESTATUS
  174. SceJetDelete(
  175. IN PSCESECTION hSection,
  176. IN PWSTR LinePrefix,
  177. IN BOOL bObjectFolder,
  178. IN SCEJET_DELETE_TYPE Flags
  179. );
  180. SCESTATUS
  181. SceJetDeleteAll(
  182. IN PSCECONTEXT cxtProfile,
  183. IN LPSTR TblName OPTIONAL,
  184. IN SCEJET_TABLE_TYPE TblType
  185. );
  186. //
  187. // close a section context.
  188. //
  189. SCESTATUS
  190. SceJetCloseSection(
  191. IN PSCESECTION *hSection,
  192. IN BOOL DestroySection
  193. );
  194. //
  195. // To get the line matching the name in the section.
  196. //
  197. SCESTATUS
  198. SceJetGetValue(
  199. IN PSCESECTION hSection,
  200. IN SCEJET_FIND_TYPE Flags,
  201. IN PWSTR LinePrefix OPTIONAL,
  202. IN PWSTR ActualName OPTIONAL,
  203. IN DWORD NameBufLen,
  204. OUT DWORD *RetNameLen OPTIONAL,
  205. IN PWSTR Value OPTIONAL,
  206. IN DWORD ValueBufLen,
  207. OUT DWORD *RetValueLen OPTIONAL
  208. );
  209. //
  210. // To set a line in the section (placed alphabetically by the name)
  211. //
  212. SCESTATUS
  213. SceJetSetLine(
  214. IN PSCESECTION hSection,
  215. IN PWSTR Name,
  216. IN BOOL bReserveCase,
  217. IN PWSTR Value,
  218. IN DWORD ValueLen,
  219. IN LONG GpoID
  220. );
  221. //
  222. // other helper APIs
  223. //
  224. SCESTATUS
  225. SceJetCreateTable(
  226. IN PSCECONTEXT cxtProfile,
  227. IN LPSTR tblName,
  228. IN SCEJET_TABLE_TYPE tblType,
  229. IN SCEJET_CREATE_FLAG nFlags,
  230. IN JET_TABLEID *TableID OPTIONAL,
  231. IN JET_COLUMNID *ColumnID OPTIONAL
  232. );
  233. SCESTATUS
  234. SceJetOpenTable(
  235. IN PSCECONTEXT cxtProfile,
  236. IN LPSTR tblName,
  237. IN SCEJET_TABLE_TYPE tblType,
  238. IN SCEJET_OPEN_TYPE OpenType,
  239. OUT JET_TABLEID *TableID
  240. );
  241. SCESTATUS
  242. SceJetDeleteTable(
  243. IN PSCECONTEXT cxtProfile,
  244. IN LPSTR tblName,
  245. IN SCEJET_TABLE_TYPE tblType
  246. );
  247. SCESTATUS
  248. SceJetCheckVersion(
  249. IN PSCECONTEXT cxtProfile,
  250. OUT FLOAT *pVersion OPTIONAL
  251. );
  252. SCESTATUS
  253. SceJetGetSectionIDByName(
  254. IN PSCECONTEXT cxtProfile,
  255. IN PCWSTR Name,
  256. OUT DOUBLE *SectionID
  257. );
  258. SCESTATUS
  259. SceJetGetSectionNameByID(
  260. IN PSCECONTEXT cxtProfile,
  261. IN DOUBLE SectionID,
  262. OUT PWSTR Name OPTIONAL,
  263. IN OUT LPDWORD pNameLen OPTIONAL
  264. );
  265. SCESTATUS
  266. SceJetAddSection(
  267. IN PSCECONTEXT cxtProfile,
  268. IN PCWSTR Name,
  269. OUT DOUBLE *SectionID
  270. );
  271. SCESTATUS
  272. SceJetDeleteSectionID(
  273. IN PSCECONTEXT cxtProfile,
  274. IN DOUBLE SectionID,
  275. IN PCWSTR Name
  276. );
  277. SCESTATUS
  278. SceJetGetTimeStamp(
  279. IN PSCECONTEXT cxtProfile,
  280. OUT PLARGE_INTEGER ConfigTimeStamp,
  281. OUT PLARGE_INTEGER AnalyzeTimeStamp
  282. );
  283. SCESTATUS
  284. SceJetSetTimeStamp(
  285. IN PSCECONTEXT cxtProfile,
  286. IN BOOL Flag,
  287. IN LARGE_INTEGER NewTimeStamp
  288. );
  289. SCESTATUS
  290. SceJetGetDescription(
  291. IN PSCECONTEXT cxtProfile,
  292. OUT PWSTR *Description
  293. );
  294. SCESTATUS
  295. SceJetStartTransaction(
  296. IN PSCECONTEXT cxtProfile
  297. );
  298. SCESTATUS
  299. SceJetCommitTransaction(
  300. IN PSCECONTEXT cxtProfile,
  301. IN JET_GRBIT grbit
  302. );
  303. SCESTATUS
  304. SceJetRollback(
  305. IN PSCECONTEXT cxtProfile,
  306. IN JET_GRBIT grbit
  307. );
  308. SCESTATUS
  309. SceJetSetValueInVersion(
  310. IN PSCECONTEXT cxtProfile,
  311. IN LPSTR TableName,
  312. IN LPSTR ColumnName,
  313. IN PWSTR Value,
  314. IN DWORD ValueLen, // number of bytes
  315. IN DWORD Prep
  316. );
  317. SCESTATUS
  318. SceJetSeek(
  319. IN PSCESECTION hSection,
  320. IN PWSTR LinePrefix,
  321. IN DWORD PrefixLength,
  322. IN SCEJET_SEEK_FLAG SeekBit
  323. );
  324. SCESTATUS
  325. SceJetMoveNext(
  326. IN PSCESECTION hSection
  327. );
  328. SCESTATUS
  329. SceJetJetErrorToSceStatus(
  330. IN JET_ERR JetErr
  331. );
  332. SCESTATUS
  333. SceJetRenameLine(
  334. IN PSCESECTION hSection,
  335. IN PWSTR Name,
  336. IN PWSTR NewName,
  337. IN BOOL bReserveCase
  338. );
  339. SCESTATUS
  340. SceJetInitialize(OUT JET_ERR *pJetErr OPTIONAL);
  341. SCESTATUS
  342. SceJetTerminate(BOOL bCleanVs);
  343. SCESTATUS
  344. SceJetTerminateNoCritical(BOOL bCleanVs);
  345. VOID
  346. SceJetInitializeData();
  347. BOOL
  348. SceJetDeleteJetFiles(
  349. IN PWSTR DbFileName OPTIONAL
  350. );
  351. SCESTATUS
  352. SceJetSetCurrentLine(
  353. IN PSCESECTION hSection,
  354. IN PWSTR Value,
  355. IN DWORD ValueLen
  356. );
  357. #define SCEJET_MERGE_TABLE_1 0x10L
  358. #define SCEJET_MERGE_TABLE_2 0x20L
  359. #define SCEJET_LOCAL_TABLE 0x30L
  360. BOOL
  361. ScepIsValidContext(
  362. PSCECONTEXT context
  363. );
  364. SCESTATUS
  365. SceJetGetGpoNameByID(
  366. IN PSCECONTEXT cxtProfile,
  367. IN LONG GpoID,
  368. OUT PWSTR Name OPTIONAL,
  369. IN OUT LPDWORD pNameLen,
  370. OUT PWSTR DisplayName OPTIONAL,
  371. IN OUT LPDWORD pDispNameLen
  372. );
  373. LONG
  374. SceJetGetGpoIDByName(
  375. IN PSCECONTEXT cxtProfile,
  376. IN PWSTR szGpoName,
  377. IN BOOL bAdd
  378. );
  379. SCESTATUS
  380. SceJetGetGpoID(
  381. IN PSCESECTION hSection,
  382. IN PWSTR ObjectName,
  383. IN JET_COLUMNID JetColGpoID OPTIONAL,
  384. OUT LONG *pGpoID
  385. );
  386. #ifdef __cplusplus
  387. }
  388. #endif
  389. #endif // _SCEJETP_