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.

879 lines
19 KiB

  1. /*++
  2. Copyright (c) 1992-2000 Microsoft Corporation
  3. Module Name:
  4. crdb.h
  5. Abstract:
  6. header for database communication APIS for crash data
  7. Environment:
  8. User Mode.
  9. --*/
  10. #include <stdio.h>
  11. #include <wtypes.h>
  12. #include <objbase.h>
  13. #include <tchar.h>
  14. #define INITGUID
  15. #include <initguid.h> // Newly Required for ADO 1.5.
  16. #include <adoid.h>
  17. #include <adoint.h>
  18. /////////////////////////////////////////////////////////////////////////////
  19. #include <icrsint.h>
  20. #define SOLUTION_TEXT_SIZE 4096
  21. #define OS_VER_SIZE 50
  22. //
  23. // This definition needs to consistent with isapi dll
  24. //
  25. typedef enum _CI_SOURCE {
  26. CiSrcUser, // 0 - User sitting at his desk types in (!dbaddcrash)
  27. CiSrcErClient, // 1 - Live site auto upload (ER CLIENT)
  28. CiSrcCER, // 2 - CER
  29. CiSrcReserved3,// 3 - reserved for later use
  30. CiSrcReserved4,// 4 - reserved for later use
  31. CiSrcManual, // 5 - Live site manual upload (using activex control)
  32. CiSrcStress, // 6 - Stress team (Using special service and isapi.dll)
  33. CiSrcManualFullDump, // 7 - Full dump uploaded to server, for kd its same as 5 - isapi sends it to different message Q
  34. CiSrcManualPssSr, // 8 - Dumps with a SR number associated with them, usually uploaded by Pss
  35. CiSrcMax,
  36. } CI_SOURCE;
  37. //
  38. // This needs to be consistent with SolutionTypes in solutions database
  39. //
  40. typedef enum _CI_SOLUTION_TYPE {
  41. CiSolUnsolved = 0, // 0 - Unsolved
  42. CiSolFixed = 1, // 1 - Fix
  43. CiSolWorkaround = 3, // 3 - Workaround
  44. CiSolTroubleStg = 4, // 4 - Troubleshooting
  45. CiSolReferral = 9, // 9 - Referral
  46. CiMakeItUlong = 0xffffffff,
  47. } CI_SOLUTION_TYPE;
  48. typedef enum _CI_OS_SKU {
  49. CiOsHomeEdition = 0,
  50. CiOsProfessional,
  51. CiOsServer,
  52. CiOsAdvancedServer,
  53. CiOsWebServer,
  54. CiOsDataCenter,
  55. CiOsMaxSKU
  56. } CI_OS_SKU;
  57. typedef struct _CRASH_INSTANCE {
  58. ULONG dwUnused;
  59. PSTR Path;
  60. PSTR OriginalDumpFileName;
  61. ULONG Build;
  62. ULONG iBucket;
  63. PSTR Bucket;
  64. ULONG BucketSize;
  65. ULONG iDefaultBucket;
  66. PSTR DefaultBucket;
  67. ULONG DefaultBucketSize;
  68. PSTR Followup;
  69. PSTR FaultyDriver;
  70. ULONG FailureType;
  71. CI_SOURCE SourceId;
  72. BOOL bSendMail;
  73. BOOL bResetBucket;
  74. BOOL bUpdateCustomer;
  75. ULONG Bug;
  76. ULONG OverClocked;
  77. ULONG UpTime;
  78. ULONG CrashTime;
  79. ULONG StopCode;
  80. union {
  81. struct {
  82. ULONG CpuId;
  83. ULONG CpuType:16;
  84. ULONG NumProc:16;
  85. };
  86. ULONG64 uCpu;
  87. };
  88. PSTR MesgGuid;
  89. PSTR MqConnectStr;
  90. BOOL bSolutionLookedUp;
  91. CI_SOLUTION_TYPE SolutionType;
  92. ULONG SolutionId;
  93. PSTR Solution;
  94. ULONG GenericSolId;
  95. BOOL bExpendableDump;
  96. ULONG DumpClass; // Full / Mini
  97. CI_OS_SKU Sku;
  98. ULONG NtTimeStamp;
  99. ULONG ServicePack;
  100. PSTR PssSr;
  101. ULONG OEMId;
  102. PSTR ArchiveFileName;
  103. } CRASH_INSTANCE, *PCRASH_INSTANCE;
  104. class COutputQueryRecords : public CADORecordBinding
  105. {
  106. public:
  107. void Output()
  108. {
  109. return;
  110. }
  111. };
  112. //This Class extracts crashInstances
  113. class CCrashInstance : public COutputQueryRecords
  114. {
  115. BEGIN_ADO_BINDING(CCrashInstance)
  116. //Column CrashId is the 1stt field in the recordset
  117. ADO_NUMERIC_ENTRY(1, adBigInt, m_CrashId,
  118. 0, 0, m_lCrashIdStatus, TRUE)
  119. // Path, 3rd entry
  120. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_Path,
  121. sizeof(m_sz_Path), m_lPathStatus, TRUE)
  122. // Build, 4th
  123. ADO_NUMERIC_ENTRY(3, adInteger, m_iBuild,
  124. 0, 0, m_lBuildSatus, TRUE)
  125. // Source, 5th
  126. ADO_VARIABLE_LENGTH_ENTRY2(4, adVarChar, m_sz_Source,
  127. sizeof(m_sz_Source), m_lSourceStatus, TRUE)
  128. // CpuId, 6th
  129. ADO_NUMERIC_ENTRY(5, adBigInt, m_iCpuId,
  130. 0, 0, m_lCpuIdStatus, TRUE)
  131. // Date, 6th
  132. // ADO_FIXED_LENGTH_ENTRY(6, adDate, m_Date,
  133. // m_lDateStatus, TRUE)
  134. END_ADO_BINDING()
  135. public:
  136. ULONG64 m_CrashId;
  137. ULONG m_lCrashIdStatus;
  138. CHAR m_sz_Path[256];
  139. ULONG m_lPathStatus;
  140. ULONG m_iBuild;
  141. ULONG m_lBuildSatus;
  142. CHAR m_sz_Source[100];
  143. ULONG m_lSourceStatus;
  144. ULONG64 m_iCpuId;
  145. ULONG m_lCpuIdStatus;
  146. // DATE m_Date;
  147. // ULONG m_lDateStatus;
  148. BOOL InitData( PCRASH_INSTANCE Crash );
  149. void OutPut();
  150. };
  151. class CBucketMap : public CADORecordBinding
  152. {
  153. BEGIN_ADO_BINDING(CBucketMap)
  154. //Column CrashId is the 1stt field in the recordset
  155. ADO_NUMERIC_ENTRY(1, adBigInt, m_CrashId,
  156. 0, 0, m_lCrashIdStatus, TRUE)
  157. //Column BucketId is the 2ndt field in the recordset
  158. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_BucketId,
  159. sizeof(m_sz_BucketId), m_lBucketIdStatus, TRUE)
  160. END_ADO_BINDING()
  161. public:
  162. ULONG64 m_CrashId;
  163. ULONG m_lCrashIdStatus;
  164. CHAR m_sz_BucketId[100];
  165. ULONG m_lBucketIdStatus;
  166. BOOL InitData(ULONG64 CrashId, PCHAR Bucket);
  167. };
  168. //This Class extracts crashInstances
  169. class COverClocked : public COutputQueryRecords
  170. {
  171. BEGIN_ADO_BINDING(COverClocked)
  172. //Column CrashId is the 1stt field in the recordset
  173. ADO_NUMERIC_ENTRY(1, adBigInt, m_CrashId,
  174. 0, 0, m_lCrashIdStatus, TRUE)
  175. END_ADO_BINDING()
  176. public:
  177. ULONG64 m_CrashId;
  178. ULONG m_lCrashIdStatus;
  179. BOOL InitData(ULONG64 CrashId);
  180. };
  181. //This Class extracts buckets
  182. class CBuckets : public COutputQueryRecords
  183. {
  184. BEGIN_ADO_BINDING(CBuckets)
  185. //Column BucketId is the 1st field in the recordset
  186. ADO_VARIABLE_LENGTH_ENTRY2(1, adVarChar, m_sz_BucketId,
  187. sizeof(m_sz_BucketId), m_lBucketIdStatus, TRUE)
  188. // iBucket, 2nd entry
  189. ADO_NUMERIC_ENTRY(2, adInteger, m_iBucket,
  190. 0, 0, m_liBucketStatus, TRUE)
  191. END_ADO_BINDING()
  192. public:
  193. CHAR m_sz_BucketId[100];
  194. ULONG m_lBucketIdStatus;
  195. ULONG m_iBucket;
  196. ULONG m_liBucketStatus;
  197. BOOL InitData(PSTR Bucket);
  198. void Output() { return;};
  199. };
  200. //This Class extracts sp_CheckCrashExists
  201. class CCheckCrashExists : public COutputQueryRecords
  202. {
  203. BEGIN_ADO_BINDING(CCheckCrashExists)
  204. // CrashId 1st entry
  205. ADO_NUMERIC_ENTRY(1, adInteger, m_CrashIdExists,
  206. 0, 0, m_CrashIdStatus, TRUE)
  207. END_ADO_BINDING()
  208. public:
  209. ULONG m_CrashIdExists;
  210. ULONG m_CrashIdStatus;
  211. void Output() { return;};
  212. };
  213. //This Class extracts sp_GetIntBucket
  214. class CGetIntBucket : public COutputQueryRecords
  215. {
  216. BEGIN_ADO_BINDING(CGetIntBucket)
  217. // iBucket, 1st entry
  218. ADO_NUMERIC_ENTRY(1, adInteger, m_iBucket1,
  219. 0, 0, m_liBucketStatus1, TRUE)
  220. // iBucket, 2nd entry
  221. ADO_NUMERIC_ENTRY(2, adInteger, m_iBucket2,
  222. 0, 0, m_liBucketStatus2, TRUE)
  223. END_ADO_BINDING()
  224. public:
  225. ULONG m_iBucket1;
  226. ULONG m_liBucketStatus1;
  227. ULONG m_iBucket2;
  228. ULONG m_liBucketStatus2;
  229. void Output() { return;};
  230. };
  231. //This Class extracts crashbuckets
  232. class CFollowups : public CADORecordBinding
  233. {
  234. BEGIN_ADO_BINDING(CFollowups)
  235. // iBucket, 1st entry
  236. ADO_NUMERIC_ENTRY(1, adInteger, m_iBucket,
  237. 0, 0, m_liBucketStatus, TRUE)
  238. // Followup, 2nd entry
  239. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_Followup,
  240. sizeof(m_sz_Followup), m_lFollowupStatus, TRUE)
  241. END_ADO_BINDING()
  242. public:
  243. ULONG m_iBucket;
  244. ULONG m_liBucketStatus;
  245. CHAR m_sz_Followup[50];
  246. ULONG m_lFollowupStatus;
  247. BOOL InitData(ULONG iBucket, PSTR Followup);
  248. void Output() { return;};
  249. };
  250. //This Class extracts machine info
  251. class CMachineInfo : public CADORecordBinding
  252. {
  253. BEGIN_ADO_BINDING(CMachineInfo)
  254. // CpuId,
  255. ADO_NUMERIC_ENTRY(1, adBigInt, m_iCpuId,
  256. 0, 0, m_lCpuIdStatus, TRUE)
  257. // Followup, 2nd entry
  258. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_Desc,
  259. sizeof(m_sz_Desc), m_lDescStatus, TRUE)
  260. END_ADO_BINDING()
  261. public:
  262. ULONG64 m_iCpuId;
  263. ULONG m_lCpuIdStatus;
  264. CHAR m_sz_Desc[50];
  265. ULONG m_lDescStatus;
  266. BOOL InitData(ULONG64 CpuId, PSTR Desc);
  267. };
  268. //This Class extracts Solution
  269. /*
  270. Expected fields queried:
  271. BucketId - string
  272. SolutionText - large string
  273. OSVersion - string
  274. */
  275. class CBucketSolution : public COutputQueryRecords
  276. {
  277. BEGIN_ADO_BINDING(CBucketSolution)
  278. ADO_VARIABLE_LENGTH_ENTRY2(1, adVarChar, m_sz_BucketId,
  279. sizeof(m_sz_BucketId), m_lBucketIdStatus, TRUE)
  280. // Solution text is the 2nd entry
  281. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_SolText,
  282. sizeof(m_sz_SolText), m_lSolStatus, TRUE)
  283. // OS Version is the 3rd entry
  284. ADO_VARIABLE_LENGTH_ENTRY2(3, adVarChar, m_sz_OSVersion,
  285. sizeof(m_sz_OSVersion), m_lOSVerStatus, TRUE)
  286. END_ADO_BINDING()
  287. public:
  288. CHAR m_sz_BucketId[100];
  289. ULONG m_lBucketIdStatus;
  290. CHAR m_sz_SolText[SOLUTION_TEXT_SIZE];
  291. ULONG m_lSolStatus;
  292. CHAR m_sz_OSVersion[50];
  293. ULONG m_lOSVerStatus;
  294. void Output();
  295. };
  296. //This Class extracts Raid bug
  297. /*
  298. Expected fields queried:
  299. BucketId - string
  300. RaidBug - bug number
  301. */
  302. class CBucketRaid : public COutputQueryRecords
  303. {
  304. BEGIN_ADO_BINDING(CBucketRaid)
  305. //Column BucketId is the 1st field in the recordset
  306. ADO_VARIABLE_LENGTH_ENTRY2(1, adVarChar, m_sz_BucketId,
  307. sizeof(m_sz_BucketId), m_lBucketIdStatus, TRUE)
  308. // RAID bug is the 2nd entry
  309. ADO_NUMERIC_ENTRY(2, adInteger, m_dw_Raid,
  310. 0, 0, m_lRaidStatus, TRUE)
  311. END_ADO_BINDING()
  312. public:
  313. CHAR m_sz_BucketId[100];
  314. ULONG m_lBucketIdStatus;
  315. ULONG m_dw_Raid;
  316. ULONG m_lRaidStatus;
  317. void Output();
  318. };
  319. //This Class extracts CheckSolutionExists
  320. class CCheckSolutionExists : public COutputQueryRecords
  321. {
  322. BEGIN_ADO_BINDING(CCheckSolutionExists)
  323. // CrashId 1st entry
  324. ADO_NUMERIC_ENTRY(1, adInteger, m_SolutionExists,
  325. 0, 0, m_SolutionIdStatus, TRUE)
  326. END_ADO_BINDING()
  327. public:
  328. ULONG m_SolutionExists;
  329. ULONG m_SolutionIdStatus;
  330. void Output() { return;};
  331. };
  332. // This gets sBugcket and gBucket strings from DB
  333. class CRetriveBucket : public COutputQueryRecords
  334. {
  335. BEGIN_ADO_BINDING(CRetriveBucket)
  336. ADO_VARIABLE_LENGTH_ENTRY2(1, adVarChar, m_sz_sBucketId,
  337. sizeof(m_sz_sBucketId), m_lsBucketIdStatus, TRUE)
  338. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_gBucketId,
  339. sizeof(m_sz_gBucketId), m_lgBucketIdStatus, TRUE)
  340. END_ADO_BINDING()
  341. public:
  342. CHAR m_sz_sBucketId[100];
  343. ULONG m_lsBucketIdStatus;
  344. CHAR m_sz_gBucketId[100];
  345. ULONG m_lgBucketIdStatus;
  346. void Output() { return;};
  347. };
  348. // This gets bugid and comment strings from DB
  349. class CBugAndComment : public COutputQueryRecords
  350. {
  351. BEGIN_ADO_BINDING(CBugAndComment)
  352. ADO_NUMERIC_ENTRY(1, adInteger, m_dw_BugId,
  353. 0, 0, m_lBugIdStatus, TRUE)
  354. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_CommentBy,
  355. sizeof(m_sz_CommentBy), m_lCommentByStatus, TRUE)
  356. ADO_VARIABLE_LENGTH_ENTRY2(3, adVarChar, m_sz_Comments,
  357. sizeof(m_sz_Comments), m_lCommentStatus, TRUE)
  358. END_ADO_BINDING()
  359. public:
  360. ULONG m_dw_BugId;
  361. ULONG m_lBugIdStatus;
  362. CHAR m_sz_CommentBy[30];
  363. ULONG m_lCommentByStatus;
  364. CHAR m_sz_Comments[300];
  365. ULONG m_lCommentStatus;
  366. void Output() { return;};
  367. };
  368. // This gets solution type and solution strings from DB
  369. class CSolutionDesc : public COutputQueryRecords
  370. {
  371. BEGIN_ADO_BINDING(CSolutionDesc)
  372. ADO_NUMERIC_ENTRY(1, adInteger, m_dw_SolType,
  373. 0, 0, m_lSolTypeStatus, TRUE)
  374. ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_sz_Solution,
  375. sizeof(m_sz_Solution), m_lSolutionStatus, TRUE)
  376. END_ADO_BINDING()
  377. public:
  378. ULONG m_dw_SolType;
  379. ULONG m_lSolTypeStatus;
  380. CHAR m_sz_Solution[300];
  381. ULONG m_lSolutionStatus;
  382. void Output() { return;};
  383. };
  384. //This Class return value from store proc
  385. class CIntValue : public COutputQueryRecords
  386. {
  387. BEGIN_ADO_BINDING(CIntValue)
  388. // 1st entry is the int value
  389. ADO_NUMERIC_ENTRY(1, adInteger, m_dw_Value1,
  390. 0, 0, m_lValue1Status, TRUE)
  391. // 1st entry is the int value
  392. // ADO_NUMERIC_ENTRY(2, adInteger, m_dw_Value2,
  393. // 0, 0, m_lValue2Status, TRUE)
  394. END_ADO_BINDING()
  395. public:
  396. ULONG m_dw_Value1;
  397. ULONG m_lValue1Status;
  398. // ULONG m_dw_Value2;
  399. // ULONG m_lValue2Status;
  400. void Output() { return;};
  401. };
  402. //This Class return value from store proc
  403. class CIntValue3 : public COutputQueryRecords
  404. {
  405. BEGIN_ADO_BINDING(CIntValue3)
  406. // 1st entry is the int value
  407. ADO_NUMERIC_ENTRY(1, adInteger, m_dw_Value1,
  408. 0, 0, m_lValue1Status, TRUE)
  409. // 2nd entry is the int value
  410. ADO_NUMERIC_ENTRY(2, adInteger, m_dw_Value2,
  411. 0, 0, m_lValue2Status, TRUE)
  412. // 3rd entry is the int value
  413. ADO_NUMERIC_ENTRY(3, adInteger, m_dw_Value3,
  414. 0, 0, m_lValue3Status, TRUE)
  415. END_ADO_BINDING()
  416. public:
  417. ULONG m_dw_Value1;
  418. ULONG m_lValue1Status;
  419. ULONG m_dw_Value2;
  420. ULONG m_lValue2Status;
  421. ULONG m_dw_Value3;
  422. ULONG m_lValue3Status;
  423. void Output() { return;};
  424. };
  425. /////////////////////////////////////////////////////////////////////////////
  426. // Conversion macros/inline functions - Variant
  427. #define VTOLONG(v) ((v).vt==VT_I4 ? (LONG)(v).lVal:0L)
  428. #define VTODATE(v) ((v).vt==VT_DATE ? (CTime)(v).iVal:0L)
  429. #define MAX_QUERY 2000
  430. class CVar : public VARIANT
  431. {
  432. public:
  433. CVar();
  434. CVar(VARTYPE vt, SCODE scode = 0);
  435. CVar(VARIANT var);
  436. ~CVar();
  437. // ASSIGNMENT OPS.
  438. CVar & operator=(PCWSTR pcwstr);
  439. CVar & operator=(VARIANT var);
  440. // CAST OPS.
  441. // doesn't change type. only returns BSTR if variant is of type
  442. // bstr. asserts otherwise.
  443. operator BSTR() const;
  444. HRESULT Clear();
  445. };
  446. typedef struct _CRDB_ADOBSTR {
  447. ULONG dwLength;
  448. WCHAR bstrData[1];
  449. } CRDB_ADOBSTR, *PCRDB_ADOBSTR;
  450. typedef void (WINAPI *OUTPUT_ROUTINE) ( void);
  451. class DatabaseHandler
  452. {
  453. public:
  454. DatabaseHandler();
  455. ~DatabaseHandler();
  456. BOOL ConnectToDataBase(LPSTR szConnectStr);
  457. HRESULT GetRecords(PULONG pCount, BOOL EnumerateAll);
  458. HRESULT EnumerateAllRows();
  459. BOOL IsConnected() { return m_fConnected; };
  460. ADORecordset* m_piCrRecordSet;
  461. ADOCommand* m_piCrCommandObj;
  462. BOOL m_fConnected;
  463. BOOL m_fRecordsetEmpty;
  464. COutputQueryRecords *m_pADOResult;
  465. BOOL m_fPrintIt;
  466. PSTR m_szDbName;
  467. protected:
  468. ADOConnection* m_piConnection;
  469. WCHAR m_wszQueryCommand[MAX_QUERY];
  470. };
  471. class CrashDatabaseHandler : public DatabaseHandler
  472. {
  473. public:
  474. CrashDatabaseHandler();
  475. ~CrashDatabaseHandler();
  476. BOOL ConnectToDataBase()
  477. {
  478. return DatabaseHandler::ConnectToDataBase("crashdb");
  479. }
  480. HRESULT BuildQueryForCrashInstance(PCRASH_INSTANCE Crash);
  481. HRESULT AddCrashToDBByStoreProc(PCRASH_INSTANCE Crash);
  482. HRESULT UpdateBucketCount(PCRASH_INSTANCE Crash);
  483. HRESULT AddCrashBucketMap(ULONG64 CraashId,
  484. PCHAR Bucket,
  485. BOOL OverWrite);
  486. HRESULT AddBucketFollowup(PCRASH_INSTANCE Crash, BOOL bOverWrite);
  487. HRESULT AddMachineIndo(PCRASH_INSTANCE Crash, BOOL bOverWrite);
  488. HRESULT AddOverClockInfo(ULONG64 CrashId);
  489. HRESULT AddCrashInstance(PCRASH_INSTANCE Crash);
  490. HRESULT FindRaidBug(PSTR Bucket, PULONG RaidBug);
  491. HRESULT FindBucketId(PULONG isBucket, PULONG igBucket);
  492. HRESULT LookupCrashBucket(PSTR SBucket, PULONG iSBucket,
  493. PSTR GBucket, PULONG iGBucket);
  494. BOOL CheckCrashExists(PCRASH_INSTANCE Crash);
  495. BOOL CheckSRExists(PSTR szSR, PCRASH_INSTANCE Crash);
  496. HRESULT LinkCrashToSR(PSTR szSR, PCRASH_INSTANCE Crash);
  497. HRESULT FindSRBuckets(PSTR szSR, PSTR szSBucket, ULONG sBucketSize,
  498. PSTR szGBucket, ULONG gBucketSize);
  499. HRESULT GetBucketComments(PSTR szBucket, PSTR szComments,
  500. ULONG SizeofComment, PULONG pBugId);
  501. };
  502. class CustDatabaseHandler : public DatabaseHandler
  503. {
  504. public:
  505. CustDatabaseHandler();
  506. ~CustDatabaseHandler();
  507. BOOL ConnectToDataBase()
  508. {
  509. return DatabaseHandler::ConnectToDataBase("custdb");
  510. }
  511. HRESULT AddCrashToDB(PCRASH_INSTANCE Crash);
  512. };
  513. class SolutionDatabaseHandler : public DatabaseHandler
  514. {
  515. public:
  516. SolutionDatabaseHandler();
  517. ~SolutionDatabaseHandler();
  518. BOOL ConnectToDataBase()
  519. {
  520. return DatabaseHandler::ConnectToDataBase("solndb");
  521. }
  522. HRESULT CheckSolutionExists(
  523. PSTR szSBucket, PSTR szGBucket,
  524. PULONG pSolnId, PULONG pSolutionType, PULONG pgSolutionId,
  525. BOOL bForceGSolLookup);
  526. HRESULT GetSolution(PCRASH_INSTANCE Crash);
  527. HRESULT GetSolutionFromDB(PSTR szBucket, PSTR szGBucket,LPSTR DriverName,
  528. ULONG TimeStamp, ULONG OS, OUT PSTR pszSolution,
  529. ULONG SolutionBufferSize, OUT PULONG pSolutionId,
  530. OUT PULONG pSolutionType, OUT PULONG pGenericSolutionId);
  531. HRESULT PrintBucketInfo(PSTR sBucket, PSTR gBucket);
  532. HRESULT AddKnownFailureToDB(LPSTR Bucket);
  533. HRESULT GetSolutiontext(PSTR szBucket, PSTR szSolText,
  534. ULONG SolTextSize);
  535. };
  536. // Functions from dbconnector.dll
  537. typedef BOOL
  538. (WINAPI* UpdateDbgInfo)(
  539. WCHAR *ConnectionString,
  540. WCHAR *SpString
  541. );
  542. typedef BOOL
  543. (WINAPI* UpdateCustomerDB)(
  544. WCHAR *ConnectionString,
  545. WCHAR *SpString
  546. );
  547. typedef BOOL
  548. (WINAPI* GetBucketIDs)(
  549. WCHAR *ConnectionString,
  550. WCHAR *SpString,
  551. ULONG *SBucket,
  552. ULONG *GBucket);
  553. typedef BOOL
  554. (WINAPI* CheckCrashExists)(
  555. WCHAR *ConnectionString,
  556. WCHAR *SpString,
  557. BOOL *Exists
  558. );
  559. class CConnectDb
  560. {
  561. public:
  562. CConnectDb();
  563. ~CConnectDb() {
  564. };
  565. HRESULT Initialize();
  566. private:
  567. WCHAR m_CrdbConnectString[MAX_PATH];
  568. WCHAR m_CustDbConnectString[MAX_PATH];
  569. WCHAR m_wszQueryBuffer[MAX_QUERY];
  570. // dll functions
  571. UpdateCustomerDB m_ProcUpdateCustomerDB;
  572. UpdateDbgInfo m_ProcUpdateDbgInfo;
  573. GetBucketIDs m_ProcGetBucketIDs;
  574. CheckCrashExists m_ProcCheckCrashExists;
  575. HMODULE m_hDbConnector;
  576. };
  577. extern CrashDatabaseHandler *g_CrDb;
  578. extern CustDatabaseHandler *g_CustDb;
  579. extern SolutionDatabaseHandler *g_SolDb;
  580. HRESULT
  581. InitializeDatabaseHandlers(
  582. PDEBUG_CONTROL3 DebugControl,
  583. ULONG Flags
  584. );
  585. HRESULT
  586. UnInitializeDatabaseHandlers(BOOL bUninitCom);
  587. HRESULT
  588. _EFN_DbAddCrashDirect(
  589. PCRASH_INSTANCE Crash,
  590. PDEBUG_CONTROL3 DebugControl
  591. );
  592. typedef HRESULT (WINAPI * DBADDCRACHDIRECT)(
  593. PCRASH_INSTANCE Crash,
  594. PDEBUG_CONTROL3 DebugControl
  595. );
  596. HRESULT
  597. ExtDllInitDynamicCalls(
  598. PDEBUG_CONTROL3 DebugControl
  599. );
  600. HRESULT
  601. AddCrashToDB(
  602. ULONG Flag,
  603. PCRASH_INSTANCE pCrash
  604. );
  605. #ifndef dprintf
  606. #define dprintf printf
  607. #endif