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.

220 lines
11 KiB

  1. #ifndef NESYU_INC
  2. #define NESYU_INC
  3. #include "nesy.h"
  4. // This file and the bobbit program are the only documentation on the nesy read only
  5. // database system.
  6. //
  7. // CreateDatabase
  8. //
  9. // Creates a new database
  10. BOOL CreateDatabase(
  11. LPCTSTR szDatabasePath // directory where the database is to be created.
  12. );
  13. // Returns a buffer with the blob ids listed. The caller is responsible for freeing
  14. // this buffer when finished with it.
  15. //
  16. // List
  17. //
  18. // Returns a buffer with the blobs from iBeginID to iEndID listed. The caller is
  19. // responsible for freeing this buffer when finished with it.
  20. BOOL List(
  21. int iLevel, // Level of information desired, 0 lists the blobs only, 1 lists the contents of the blob as well.
  22. LPCTSTR szDatabasePath, // directory path where database is, use ".\\" to specify the current directory.
  23. int iBeginID, // Beginning blob id to list, -1 means begin at beginning of the database.
  24. int iEndID // ending blob id to list, -1 means no end blob so all are listed.
  25. );
  26. //
  27. // SearchDatabase
  28. //
  29. // Returns a buffer with the blob ids listed. The caller is responsible for freeing
  30. // this buffer when finished with it.
  31. BOOL SearchDatabase(
  32. LPCTSTR szSearchString, // search string to be found in database.
  33. int iLevel, // Level of information desired, 0 lists the blobs only, 1 lists the contents of the blob as well.
  34. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  35. );
  36. //
  37. // UpdateBlob
  38. //
  39. // Updates a specific blob in the database with the specified file.
  40. // The return value is the blob id if successfull or -1 if an error occurs.
  41. int UpdateBlob(
  42. int blobID, // blob id to add to the database
  43. LPCTSTR szBlobFile, // blob file to be added to the database
  44. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  45. );
  46. //
  47. // UpdateBlob
  48. //
  49. // Updates a specific blob in the database with the blob in memory.
  50. // The return value is the blob id if successfull or -1 if an error occurs.
  51. int UpdateBlob(
  52. int blobID, // blob id to add to the database
  53. LPVOID pBlob, // memory buffer containing blob to be added to the database.
  54. DWORD dwBlobSize, // size of blob to be added to the database.
  55. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  56. );
  57. //
  58. // WriteBlob
  59. //
  60. // Write a specific blob file to the database. Pass in -1 for the blob id to
  61. // add a new blob to the database. The return value is the blob id
  62. // if successfull or -1 if an error occurs.
  63. int WriteBlob(
  64. int blobID, // blob id to add to the database
  65. LPCTSTR szBlobFile, // blob file to be added to the database
  66. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  67. );
  68. //
  69. // WriteBlob
  70. //
  71. // Write a specific blob in memory to the database. Pass in -1 for the blob id to
  72. // add a new blob to the database. The return value is the blob id
  73. // if successfull or -1 if an error occurs.
  74. int WriteBlob(
  75. int blobID, // blob id to add to the database
  76. LPVOID pBlob, // memory buffer containing blob to be added to the database.
  77. DWORD dwBlobSize, // size of blob to be added to the database.
  78. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  79. );
  80. //
  81. // DeleteBlob
  82. //
  83. // delete the specified blob. returns TRUE if successfull or FALSE if not.
  84. BOOL DeleteBlob(
  85. int blobID, // blob id to add to the database
  86. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  87. );
  88. //
  89. // AddShimDll
  90. //
  91. // Adds a new shim dll to the database's blob 0. This API returns the blob id if successfull or -1 if an
  92. // error occurs. In the case of an error GetLastError() can be checked to get additional information
  93. // as to the specific cause of the error.
  94. int AddShimDll(
  95. PBLOB0 *ppBlob0, // Blob 0 pointer. If the blob is successfully added then this pointer is updated with the new blob0
  96. DWORD *pdwShimID, // If successful, passes back the ID of the shim DLL record created
  97. LPCTSTR szBlobFile, // Shim DLL to be added to the database
  98. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  99. );
  100. //
  101. // AddPatchBlob
  102. //
  103. // Adds a new shim dll to the database's blob 0. This API returns the blob id if successfull or -1 if an
  104. // error occurs. In the case of an error GetLastError() can be checked to get additional information
  105. // as to the specific cause of the error.
  106. int AddPatchBlob(
  107. PBLOB0 *ppBlob0, // Blob 0 pointer. If the blob is successfully added then this pointer is updated with the new blob0
  108. LPCTSTR szBlobFile, // Patch blob to be added to the database
  109. LPCTSTR szDescription, // Description of this patch, this is for information purposes only.
  110. LPCTSTR szDatabasePath // directory path where database is, use ".\\" to specify the current directory.
  111. );
  112. //
  113. // AddExe
  114. //
  115. // This method adds a new exe to blob 0. Then function returns the unique id of the exe that was added. This id can
  116. // be used to later identify the exe. In the case of an error this function returns 0. The function GetLastError()
  117. // can then be checked to determine the cause of the error.
  118. DWORD AddExe(
  119. PBLOB0 *ppBlob0, // Blob 0 pointer. If the exe is successfully added then this pointer is updated with the new blob0
  120. PDWORD pdwBlobPatchID, // array for DWORDs that identify the patch DLL's to be used for this exe
  121. DWORD dwTotalPatchBlobs,// total patch blobs in previous array.
  122. PLARGE_INTEGER pqwFlags,// Flags associated with this exe.
  123. LPCTSTR szFileName // exe that is to be hooked with the shim DLL's identified by the pdwBlobID parameter.
  124. );
  125. //
  126. // AddGlobalInclude
  127. //
  128. // Adds a module to the global include list. This list will largely or completely consist of windows system
  129. // DLLs that shouldn't be patched, so mostly it will be exclusions.
  130. // This list can be overridden by inclusion lists at the DLL or EXE level
  131. // returns TRUE/FALSE for success.
  132. BOOL AddGlobalInclude(
  133. PBLOB0 *ppBlob0, // Blob 0 pointer. If the blob is successfully added then this pointer is updated with the new blob0
  134. INCTYPE eType, // the type: INCLUDE or EXCLUDE
  135. LPCTSTR szModule, // The module to exclude from shimming
  136. LPCTSTR szAPI, // the specific API call that should be excluded, or NULL for all APIs
  137. DWORD dwModuleOffset // used to specify a specific call instance that should be excluded
  138. );
  139. //
  140. // AddShimDllInclude
  141. //
  142. // Adds an include item to the Shim DLL record, which allows a shim dll to shim a DLL which would otherwise
  143. // be excluded by the global exclusion list. Otherwise much like AddGlobalExclude.
  144. BOOL AddShimDllInclude(
  145. PBLOB0 *ppBlob0, // Blob 0 pointer. If the blob is successfully added then this pointer is updated with the new blob0
  146. DWORD dwShimID, // the ID of the shim record, passed back from AddShimDLL
  147. INCTYPE eType, // the type: INCLUDE or EXCLUDE
  148. LPCTSTR szModule, // the module to add to the shim list
  149. LPCTSTR szAPI, // the specific API to include
  150. DWORD dwModuleOffset // used to specify a specific call instance that should be included
  151. );
  152. //
  153. // AddDllRef
  154. //
  155. // Adds to an Exe record a reference to a shim DLL that should be loaded when the executable is loaded
  156. // Inclusions or exclusions of specific modules or calls can be added later by
  157. BOOL AddDllRef(
  158. PBLOB0 *ppBlob0, // Blob 0 pointer. If the blob is successfully added then this pointer is updated with the new blob0
  159. DWORD dwExeID, // the exe ID, passed back from AddExe
  160. DWORD *pdwDllRefID, // passes back the Dll ref ID, used to add include/exclude info later
  161. DWORD dwBlobID // the blob ID of the dll that should be added
  162. );
  163. //
  164. // AddDllRefInclude
  165. //
  166. // Adds an include item to the DLL ref record, which allows adding a DLL for a specific exe which would otherwise
  167. // be excluded by the global exclusion list or the Shim DLL exclusion list. Otherwise much like AddGlobalExclude.
  168. BOOL AddDllRefInclude(
  169. PBLOB0 *ppBlob0, // Blob 0 pointer. If the blob is successfully added then this pointer is updated with the new blob0
  170. DWORD dwDllRefID, // the ID of the Dll ref record, passed back from AddDllRef
  171. INCTYPE eType, // the type: INCLUDE or EXCLUDE
  172. LPCTSTR szModule, // the module to add to the shim list
  173. LPCTSTR szAPI, // the specific API to include
  174. DWORD dwModuleOffset // used to specify a specific call instance that should be included
  175. );
  176. //
  177. // AddMatchingInfo
  178. //
  179. // This method adds a new matching file to an exe in blob 0. The exe is identified by the id returned from the AddExe
  180. // method. This method returns TRUE if the matching info is successfully added or FALSE if an error occurs. In the case
  181. // of an failure the GetLastError() function can be checked to determine the cause of the error.
  182. BOOL AddMatchingInfo(
  183. PBLOB0 *ppBlob0, // Blob 0 pointer. If the exe is successfully added then this pointer is updated with the new blob0
  184. DWORD dwExeID, // Exe id where matching info is to be added. This id is returned from the AddExe function.
  185. LPCTSTR szFileName, // relative path file name of the matching file. This path is relative to the exe file
  186. // that this matching file is being added to.
  187. DWORD dwSize = 0, // Size of the matching file. This parameter can be 0 if size is not to be a criteria.
  188. DWORD dwCrc = 0, // Crc of the matching file. This parameter can be 0 if size is not to be a criteria.
  189. PFILETIME pFt = NULL // file time of the matching file. This parameter can be 0 if size is not to be a criteria.
  190. );
  191. #endif