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.

736 lines
18 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 2000
  6. //
  7. // File: symbolverification.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // SymbolVerification.cpp: implementation of the CSymbolVerification class.
  11. //
  12. //////////////////////////////////////////////////////////////////////
  13. #ifndef NO_STRICT
  14. #ifndef STRICT
  15. #define STRICT 1
  16. #endif
  17. #endif /* NO_STRICT */
  18. #include <WINDOWS.H>
  19. #include <TCHAR.H>
  20. #include <STDIO.H>
  21. #include "globals.h"
  22. #include "SymbolVerification.h"
  23. #include "ModuleInfo.h"
  24. #include "UtilityFunctions.h"
  25. #pragma warning (push)
  26. #pragma warning ( disable : 4710)
  27. //////////////////////////////////////////////////////////////////////
  28. // Construction/Destruction
  29. //////////////////////////////////////////////////////////////////////
  30. CSymbolVerification::CSymbolVerification()
  31. {
  32. m_fComInitialized = false;
  33. m_fSQLServerConnectionAttempted = false;
  34. m_fSQLServerConnectionInitialized = false;
  35. // SQL2 - mjl 12/14/99
  36. m_fSQLServerConnectionAttempted2 = false;
  37. m_fSQLServerConnectionInitialized2 = false;
  38. // Initialize ADO Connection Object to NULL
  39. m_lpConnectionPointer = NULL;
  40. m_lpConnectionPointer2 = NULL; // SQL2 - mjl 12/14/99
  41. }
  42. CSymbolVerification::~CSymbolVerification()
  43. {
  44. if (SQLServerConnectionInitialized())
  45. {
  46. TerminateSQLServerConnection();
  47. }
  48. if (SQLServerConnectionInitialized2())
  49. {
  50. TerminateSQLServerConnection2();
  51. }
  52. if (m_fComInitialized)
  53. ::CoUninitialize();
  54. }
  55. bool CSymbolVerification::Initialize()
  56. {
  57. HRESULT hr = S_OK;
  58. // Initialize COM
  59. hr = ::CoInitialize(NULL);
  60. if (FAILED(hr))
  61. {
  62. _tprintf(TEXT("Failed Initializing COM!\n"));
  63. return false;
  64. }
  65. // Com is initialized!
  66. m_fComInitialized = true;
  67. return true;
  68. }
  69. bool CSymbolVerification::InitializeSQLServerConnection(LPTSTR tszSQLServerName)
  70. {
  71. HRESULT hr = S_OK;
  72. TCHAR tszConnectionString[256];
  73. m_fSQLServerConnectionAttempted = true;
  74. _tprintf(TEXT("\nAttempting connection to SQL Server [%s]..."), tszSQLServerName);
  75. // Compose the Connection String
  76. // ie. "driver={SQL Server};server=<servername>;database=Symbols"
  77. _tcscpy(tszConnectionString, TEXT("driver={SQL Server};server="));
  78. _tcscat(tszConnectionString, tszSQLServerName);
  79. _tcscat(tszConnectionString, TEXT(";uid=GUEST;pwd=guest;database=Symbols"));
  80. try
  81. {
  82. // Okay, we need a BSTR
  83. _bstr_t bstrConnectionString( tszConnectionString );
  84. // Okay, let's try and actually create this Connection Pointer...
  85. hr = m_lpConnectionPointer.CreateInstance( __uuidof( Connection ) );
  86. if (FAILED(hr))
  87. goto error;
  88. // Now, let's use the Connection Pointer object to actually get connected...
  89. hr = m_lpConnectionPointer->Open( bstrConnectionString, "", "", -1);
  90. if (FAILED(hr))
  91. goto error;
  92. // Now, let's create a RecordSet for use later...
  93. hr = m_lpRecordSetPointer.CreateInstance( __uuidof( Recordset ) );
  94. if (FAILED(hr))
  95. goto error;
  96. m_fSQLServerConnectionInitialized = true;
  97. _tprintf(TEXT("SUCCESS!\n\n"));
  98. }
  99. catch (_com_error &e )
  100. {
  101. _tprintf( TEXT("FAILURE!\n\n") );
  102. DumpCOMException(e);
  103. goto error;
  104. }
  105. catch (...)
  106. {
  107. _tprintf( TEXT("FAILURE!\n\n") );
  108. _tprintf( TEXT("Caught an exception of unknown type\n" ) );
  109. goto error;
  110. }
  111. goto cleanup;
  112. error:
  113. if (m_lpConnectionPointer)
  114. m_lpConnectionPointer = NULL;
  115. _tprintf(TEXT("\nFAILURE Attempting SQL Server Connection! Error = 0x%x\n"), hr);
  116. switch (hr)
  117. {
  118. case E_NOINTERFACE:
  119. case REGDB_E_CLASSNOTREG:
  120. _tprintf(TEXT("\nThe most likely reason for this is that your system does not have\n"));
  121. _tprintf(TEXT("the necessary ADO components installed. You should install the\n"));
  122. _tprintf(TEXT("latest Microsoft Data Access Component (MDAC) release available on\n"));
  123. _tprintf(TEXT("http://www.microsoft.com/data/download.htm\n"));
  124. break;
  125. }
  126. cleanup:
  127. return m_fSQLServerConnectionInitialized;
  128. }
  129. void CSymbolVerification::DumpCOMException(_com_error &e)
  130. {
  131. _tprintf( TEXT("\tCode = %08lx\n"), e.Error());
  132. _tprintf( TEXT("\tCode meaning = %s\n"), e.ErrorMessage());
  133. _bstr_t bstrSource(e.Source());
  134. _bstr_t bstrDescription(e.Description());
  135. _tprintf( TEXT("\tSource = %s\n"), (LPCSTR) bstrSource);
  136. _tprintf( TEXT("\tDescription = %s\n"), (LPCSTR) bstrDescription);
  137. }
  138. bool CSymbolVerification::TerminateSQLServerConnection()
  139. {
  140. // Free the Connection
  141. if (m_lpConnectionPointer)
  142. m_lpConnectionPointer = NULL;
  143. if (m_lpRecordSetPointer)
  144. m_lpRecordSetPointer = NULL;
  145. m_fSQLServerConnectionInitialized = false;
  146. return true;
  147. }
  148. bool CSymbolVerification::SearchForDBGFileUsingSQLServer(LPTSTR tszPEImageModuleName, DWORD dwPEImageTimeDateStamp, CModuleInfo *lpModuleInfo)
  149. {
  150. HRESULT hr = S_OK;
  151. FieldPtr lpFieldSymbolPath = NULL;
  152. _variant_t vSymbolPath;
  153. wchar_t wszSymbolPath[_MAX_PATH+1];
  154. wchar_t wszReturnedDBGFile[_MAX_FNAME];
  155. wchar_t wszReturnedDBGFileExtension[_MAX_EXT];
  156. TCHAR tszCommandText[256];
  157. TCHAR tszLinkerDate[64]; // Plenty big...
  158. TCHAR tszDBGFileName[_MAX_FNAME];
  159. HANDLE hFileHandle;
  160. _tsplitpath(tszPEImageModuleName, NULL, NULL, tszDBGFileName, NULL);
  161. #ifdef _UNICODE
  162. LPTSTR wszDBGFileName = tszDBGFileName;
  163. #else
  164. wchar_t wszDBGFileName[_MAX_FNAME];
  165. MultiByteToWideChar( CP_ACP,
  166. MB_PRECOMPOSED,
  167. tszDBGFileName,
  168. -1,
  169. wszDBGFileName,
  170. _MAX_FNAME);
  171. #endif
  172. // Compose the Connection String
  173. // ie. "driver={SQL Server};server=<servername>;database=Symbols"
  174. _tcscpy(tszCommandText, TEXT("SELECT FILENAME FROM Symbols WHERE TIMESTAMP = '"));
  175. _stprintf(tszLinkerDate, TEXT("%x"), dwPEImageTimeDateStamp);
  176. _tcscat(tszCommandText, tszLinkerDate);
  177. _tcscat(tszCommandText, TEXT("'"));
  178. try {
  179. _bstr_t bstrCommandText( tszCommandText );
  180. m_lpRecordSetPointer = m_lpConnectionPointer->Execute(bstrCommandText, NULL, adCmdText);
  181. lpFieldSymbolPath = m_lpRecordSetPointer->Fields->GetItem(_variant_t( "FILENAME" ));
  182. #ifdef _DEBUG
  183. _tprintf(TEXT("Searching SQL Server for matching symbol for [%s]\n"), tszPEImageModuleName);
  184. #endif
  185. while (VARIANT_FALSE == m_lpRecordSetPointer->EndOfFile)
  186. {
  187. vSymbolPath.Clear();
  188. vSymbolPath = lpFieldSymbolPath->Value;
  189. wcscpy(wszSymbolPath, vSymbolPath.bstrVal);
  190. _wsplitpath(wszSymbolPath, NULL, NULL, wszReturnedDBGFile, wszReturnedDBGFileExtension);
  191. //
  192. if ( (_wcsicmp(wszReturnedDBGFile, wszDBGFileName) == 0 ) &&
  193. (_wcsicmp(wszReturnedDBGFileExtension, L".DBG") == 0 )
  194. )
  195. {
  196. #ifdef _DEBUG
  197. wprintf(L"Module path = %s\n", wszSymbolPath);
  198. #endif
  199. #ifdef _UNICODE
  200. wchar_t * tszSymbolPath = wszSymbolPath;
  201. #else
  202. char tszSymbolPath[_MAX_PATH+1];
  203. WideCharToMultiByte(CP_ACP,
  204. 0,
  205. wszSymbolPath,
  206. -1,
  207. tszSymbolPath,
  208. _MAX_PATH+1,
  209. NULL,
  210. NULL);
  211. #endif
  212. // Okay, let's validate the DBG file we are pointing to...
  213. hFileHandle = CreateFile( tszSymbolPath,
  214. GENERIC_READ,
  215. (FILE_SHARE_READ | FILE_SHARE_WRITE),
  216. NULL,
  217. OPEN_EXISTING,
  218. 0,
  219. NULL);
  220. // Does the returned handle look good?
  221. if (hFileHandle != INVALID_HANDLE_VALUE)
  222. {
  223. lpModuleInfo->VerifyDBGFile(hFileHandle, tszSymbolPath, lpModuleInfo);
  224. } else
  225. {
  226. _tprintf(TEXT("\nERROR: Searching for [%s]!\n"), tszSymbolPath);
  227. CUtilityFunctions::PrintMessageString(GetLastError());
  228. }
  229. CloseHandle(hFileHandle);
  230. if (lpModuleInfo->GetDBGSymbolModuleStatus() == CModuleInfo::SymbolModuleStatus::SYMBOL_MATCH)
  231. {
  232. // Cool... it really does match...
  233. hr = m_lpRecordSetPointer->Close();
  234. goto cleanup;
  235. }
  236. }
  237. m_lpRecordSetPointer->MoveNext();
  238. }
  239. hr = m_lpRecordSetPointer->Close();
  240. if (FAILED(hr))
  241. goto error;
  242. }
  243. catch (_com_error &e )
  244. {
  245. _tprintf( TEXT("FAILURE Attempting SQL Server Connection!\n") );
  246. DumpCOMException(e);
  247. goto cleanup;
  248. }
  249. catch (...)
  250. {
  251. _tprintf( TEXT("FAILURE Attempting SQL Server Connection!\n") );
  252. _tprintf( TEXT("Caught an exception of unknown type\n" ) );
  253. goto cleanup;
  254. }
  255. goto cleanup;
  256. error:
  257. TerminateSQLServerConnection();
  258. _tprintf(TEXT("FAILURE Attempting to query the SQL Server!\n"));
  259. cleanup:
  260. return true;
  261. }
  262. /////////////////////////// mjl //////////////////////////////////////////
  263. bool CSymbolVerification::InitializeSQLServerConnection2(LPTSTR tszSQLServerName)
  264. {
  265. HRESULT hr = S_OK;
  266. TCHAR tszConnectionString[256];
  267. m_fSQLServerConnectionAttempted2 = true;
  268. _tprintf(TEXT("\nAttempting connection to SQL Server [%s]..."), tszSQLServerName);
  269. // Compose the Connection String
  270. // ie. "driver={SQL Server};server=<servername>;database=Symbols"
  271. _tcscpy(tszConnectionString, TEXT("driver={SQL Server};server="));
  272. _tcscat(tszConnectionString, tszSQLServerName);
  273. _tcscat(tszConnectionString, TEXT(";uid=GUEST;pwd=guest;database=Symbols2"));
  274. try
  275. {
  276. // Okay, we need a BSTR
  277. _bstr_t bstrConnectionString( tszConnectionString );
  278. // Okay, let's try and actually create this Connection Pointer...
  279. hr = m_lpConnectionPointer2.CreateInstance( __uuidof( Connection ) );
  280. if (FAILED(hr))
  281. goto error;
  282. // Now, let's use the Connection Pointer object to actually get connected...
  283. hr = m_lpConnectionPointer2->Open( bstrConnectionString, "", "", -1);
  284. if (FAILED(hr))
  285. goto error;
  286. // Now, let's create a RecordSet for use later...
  287. hr = m_lpRecordSetPointer2.CreateInstance( __uuidof( Recordset ) );
  288. if (FAILED(hr))
  289. goto error;
  290. _tprintf(TEXT("Complete\n"));
  291. m_fSQLServerConnectionInitialized2 = true;
  292. }
  293. catch (_com_error &e )
  294. {
  295. _tprintf( TEXT("FAILURE Attempting SQL Server Connection!\n") );
  296. DumpCOMException(e);
  297. goto error;
  298. }
  299. catch (...)
  300. {
  301. _tprintf( TEXT("FAILURE Attempting SQL Server Connection!\n") );
  302. _tprintf( TEXT("Caught an exception of unknown type\n" ) );
  303. goto error;
  304. }
  305. goto cleanup;
  306. error:
  307. if (m_lpConnectionPointer2)
  308. m_lpConnectionPointer2 = NULL;
  309. _tprintf(TEXT("\nFAILURE Attempting SQL Server Connection! Error = 0x%x\n"), hr);
  310. switch (hr)
  311. {
  312. case E_NOINTERFACE:
  313. case REGDB_E_CLASSNOTREG:
  314. _tprintf(TEXT("\nThe most likely reason for this is that your system does not have\n"));
  315. _tprintf(TEXT("the necessary ADO components installed. You should install the\n"));
  316. _tprintf(TEXT("latest Microsoft Data Access Component (MDAC) release available on\n"));
  317. _tprintf(TEXT("http://www.microsoft.com/data/download.htm\n"));
  318. break;
  319. }
  320. cleanup:
  321. return m_fSQLServerConnectionInitialized2;
  322. }
  323. bool CSymbolVerification::TerminateSQLServerConnection2()
  324. {
  325. // Free the Connection
  326. if (m_lpConnectionPointer2)
  327. m_lpConnectionPointer2 = NULL;
  328. if (m_lpRecordSetPointer2)
  329. m_lpRecordSetPointer2 = NULL;
  330. m_fSQLServerConnectionInitialized2 = false;
  331. return true;
  332. }
  333. bool CSymbolVerification::SearchForDBGFileUsingSQLServer2(LPTSTR tszPEImageModuleName, DWORD dwPEImageTimeDateStamp, CModuleInfo *lpModuleInfo)
  334. {
  335. HRESULT hr = S_OK;
  336. FieldPtr lpFieldSymbolPath = NULL;
  337. _variant_t vSymbolPath;
  338. _bstr_t sFieldSymbolPath;
  339. wchar_t wszSymbolPath[_MAX_PATH+1];
  340. wchar_t wszReturnedDBGFile[_MAX_FNAME];
  341. wchar_t wszReturnedDBGFileExtension[_MAX_EXT];
  342. TCHAR tszCommandText[512];
  343. TCHAR tszDBGFileName[_MAX_FNAME];
  344. HANDLE hFileHandle;
  345. _tsplitpath(tszPEImageModuleName, NULL, NULL, tszDBGFileName, NULL);
  346. #ifdef _UNICODE
  347. LPTSTR wszDBGFileName = tszDBGFileName;
  348. #else
  349. wchar_t wszDBGFileName[_MAX_FNAME];
  350. MultiByteToWideChar( CP_ACP,
  351. MB_PRECOMPOSED,
  352. tszDBGFileName,
  353. -1,
  354. wszDBGFileName,
  355. _MAX_FNAME);
  356. #endif
  357. // Compose the Query String
  358. _stprintf(tszCommandText, TEXT("SELECT tblDBGModulePaths.DBGModulePath FROM tblDBGModules,tblDBGModulePaths WHERE tblDBGModules.DBGFilename='%s.DBG' AND tblDBGModules.TimeDateStamp='%d' AND tblDBGModules.DBGModuleID = tblDBGModulePaths.DBGModuleID"),tszDBGFileName,dwPEImageTimeDateStamp);
  359. try {
  360. _bstr_t bstrCommandText( tszCommandText );
  361. m_lpRecordSetPointer2 = m_lpConnectionPointer2->Execute(bstrCommandText, NULL, adCmdText);
  362. while ( !m_lpRecordSetPointer2->EndOfFile )
  363. {
  364. vSymbolPath = m_lpRecordSetPointer2->Fields->GetItem("DBGModulePath")->Value;
  365. lpFieldSymbolPath = m_lpRecordSetPointer2->Fields->GetItem(_variant_t( "DBGModulePath" ));
  366. #ifdef _DEBUG
  367. _tprintf(TEXT("Searching SQL Server for matching symbol for [%s]\n"), tszPEImageModuleName);
  368. #endif
  369. vSymbolPath.Clear();
  370. vSymbolPath = lpFieldSymbolPath->Value;
  371. wcscpy(wszSymbolPath, vSymbolPath.bstrVal);
  372. _wsplitpath(wszSymbolPath, NULL, NULL, wszReturnedDBGFile, wszReturnedDBGFileExtension);
  373. //
  374. if ( (_wcsicmp(wszReturnedDBGFile, wszDBGFileName) == 0 ) &&
  375. (_wcsicmp(wszReturnedDBGFileExtension, L".DBG") == 0 )
  376. )
  377. {
  378. #ifdef _DEBUG
  379. wprintf(L"Module path = %s\n", wszSymbolPath);
  380. #endif
  381. #ifdef _UNICODE
  382. wchar_t * tszSymbolPath = wszSymbolPath;
  383. #else
  384. char tszSymbolPath[_MAX_PATH+1];
  385. WideCharToMultiByte(CP_ACP,
  386. 0,
  387. wszSymbolPath,
  388. -1,
  389. tszSymbolPath,
  390. _MAX_PATH+1,
  391. NULL,
  392. NULL);
  393. #endif
  394. // Okay, let's validate the DBG file we are pointing to...
  395. hFileHandle = CreateFile( tszSymbolPath,
  396. GENERIC_READ,
  397. (FILE_SHARE_READ | FILE_SHARE_WRITE),
  398. NULL,
  399. OPEN_EXISTING,
  400. 0,
  401. NULL);
  402. // Does the returned handle look good?
  403. if (hFileHandle != INVALID_HANDLE_VALUE)
  404. {
  405. lpModuleInfo->VerifyDBGFile(hFileHandle, tszSymbolPath, lpModuleInfo);
  406. } else
  407. {
  408. _tprintf(TEXT("\nERROR: Searching for [%s]!\n"), tszSymbolPath);
  409. CUtilityFunctions::PrintMessageString(GetLastError());
  410. }
  411. CloseHandle(hFileHandle);
  412. if (lpModuleInfo->GetDBGSymbolModuleStatus() == CModuleInfo::SymbolModuleStatus::SYMBOL_MATCH)
  413. {
  414. // Cool... it really does match...
  415. hr = m_lpRecordSetPointer2->Close();
  416. goto cleanup;
  417. }
  418. }
  419. m_lpRecordSetPointer2->MoveNext();
  420. }
  421. hr = m_lpRecordSetPointer2->Close();
  422. if (FAILED(hr))
  423. goto error;
  424. }
  425. catch (_com_error &e )
  426. {
  427. _tprintf( TEXT("FAILURE Attempting SQL Server Connection!\n") );
  428. DumpCOMException(e);
  429. goto cleanup;
  430. }
  431. catch (...)
  432. {
  433. _tprintf( TEXT("FAILURE Attempting SQL Server Connection!\n") );
  434. _tprintf( TEXT("Caught an exception of unknown type\n" ) );
  435. goto cleanup;
  436. }
  437. goto cleanup;
  438. error:
  439. TerminateSQLServerConnection();
  440. _tprintf(TEXT("FAILURE Attempting to query the SQL Server!\n"));
  441. cleanup:
  442. return true;
  443. }
  444. bool CSymbolVerification::SearchForPDBFileUsingSQLServer2(LPTSTR tszPEImageModuleName, DWORD dwPDBSignature, CModuleInfo *lpModuleInfo)
  445. {
  446. HRESULT hr = S_OK;
  447. FieldPtr lpFieldSymbolPath = NULL;
  448. _variant_t vSymbolPath;
  449. _bstr_t sFieldSymbolPath;
  450. wchar_t wszSymbolPath[_MAX_PATH+1];
  451. wchar_t wszReturnedPDBFile[_MAX_FNAME];
  452. wchar_t wszReturnedPDBFileExtension[_MAX_EXT];
  453. TCHAR tszCommandText[512];
  454. TCHAR tszPDBFileName[_MAX_FNAME];
  455. HANDLE hFileHandle;
  456. _tsplitpath(tszPEImageModuleName, NULL, NULL, tszPDBFileName, NULL);
  457. #ifdef _UNICODE
  458. LPTSTR wszPDBFileName = tszPDBFileName;
  459. #else
  460. wchar_t wszPDBFileName[_MAX_FNAME];
  461. MultiByteToWideChar( CP_ACP,
  462. MB_PRECOMPOSED,
  463. tszPDBFileName,
  464. -1,
  465. wszPDBFileName,
  466. _MAX_FNAME);
  467. #endif
  468. // Compose the Query String
  469. _stprintf(tszCommandText, TEXT("SELECT tblPDBModulePaths.PDBModulePath FROM tblPDBModules,tblPDBModulePaths WHERE tblPDBModules.PDBFilename='%s.PDB' AND tblPDBModules.PDBSignature='%d' AND tblPDBModules.PDBModuleID = tblPDBModulePaths.PDBModuleID"),tszPDBFileName,dwPDBSignature);
  470. try {
  471. _bstr_t bstrCommandText( tszCommandText );
  472. m_lpRecordSetPointer2 = m_lpConnectionPointer2->Execute(bstrCommandText, NULL, adCmdText);
  473. while ( !m_lpRecordSetPointer2->EndOfFile )
  474. {
  475. vSymbolPath = m_lpRecordSetPointer2->Fields->GetItem("PDBModulePath")->Value;
  476. lpFieldSymbolPath = m_lpRecordSetPointer2->Fields->GetItem(_variant_t( "PDBModulePath" ));
  477. #ifdef _DEBUG
  478. _tprintf(TEXT("Searching SQL Server for matching symbol for [%s]\n"), tszPEImageModuleName);
  479. #endif
  480. vSymbolPath.Clear();
  481. vSymbolPath = lpFieldSymbolPath->Value;
  482. wcscpy(wszSymbolPath, vSymbolPath.bstrVal);
  483. _wsplitpath(wszSymbolPath, NULL, NULL, wszReturnedPDBFile, wszReturnedPDBFileExtension);
  484. if ( (_wcsicmp(wszReturnedPDBFile, wszPDBFileName) == 0 ) &&
  485. (_wcsicmp(wszReturnedPDBFileExtension, L".PDB") == 0 )
  486. )
  487. {
  488. #ifdef _DEBUG
  489. wprintf(L"Module path = %s\n", wszSymbolPath);
  490. #endif
  491. #ifdef _UNICODE
  492. wchar_t * tszSymbolPath = wszSymbolPath;
  493. #else
  494. char tszSymbolPath[_MAX_PATH+1];
  495. WideCharToMultiByte(CP_ACP,
  496. 0,
  497. wszSymbolPath,
  498. -1,
  499. tszSymbolPath,
  500. _MAX_PATH+1,
  501. NULL,
  502. NULL);
  503. #endif
  504. // Okay, let's validate the DBG file we are pointing to...
  505. hFileHandle = CreateFile( tszSymbolPath,
  506. GENERIC_READ,
  507. (FILE_SHARE_READ | FILE_SHARE_WRITE),
  508. NULL,
  509. OPEN_EXISTING,
  510. 0,
  511. NULL);
  512. // Does the returned handle look good?
  513. if (hFileHandle != INVALID_HANDLE_VALUE)
  514. {
  515. lpModuleInfo->VerifyPDBFile(hFileHandle, tszSymbolPath, lpModuleInfo);
  516. } else
  517. {
  518. _tprintf(TEXT("\nERROR: Searching for [%s]!\n"), tszSymbolPath);
  519. CUtilityFunctions::PrintMessageString(GetLastError());
  520. }
  521. CloseHandle(hFileHandle);
  522. if (lpModuleInfo->GetPDBSymbolModuleStatus() == CModuleInfo::SymbolModuleStatus::SYMBOL_MATCH)
  523. {
  524. // Cool... it really does match...
  525. hr = m_lpRecordSetPointer2->Close();
  526. goto cleanup;
  527. }
  528. }
  529. m_lpRecordSetPointer2->MoveNext();
  530. }
  531. hr = m_lpRecordSetPointer2->Close();
  532. if (FAILED(hr))
  533. goto error;
  534. }
  535. catch (_com_error &e )
  536. {
  537. _tprintf( TEXT("\nFAILURE Attempting SQL2 Server Connection!\n") );
  538. DumpCOMException(e);
  539. goto cleanup;
  540. }
  541. catch (...)
  542. {
  543. _tprintf( TEXT("FAILURE Attempting SQL2 Server Connection!\n") );
  544. _tprintf( TEXT("Caught an exception of unknown type\n" ) );
  545. goto cleanup;
  546. }
  547. goto cleanup;
  548. error:
  549. TerminateSQLServerConnection2();
  550. _tprintf(TEXT("FAILURE Attempting to query the SQL Server!\n"));
  551. cleanup:
  552. return true;
  553. }
  554. #pragma warning (pop)