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.

1182 lines
32 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. setupapi.c
  5. Abstract:
  6. This function contains the setupapi debugger extensions
  7. Author:
  8. Mark Lucovsky (markl) 09-Apr-1991
  9. Revision History:
  10. --*/
  11. #include "ntsdextp.h"
  12. #include <setupapi.h>
  13. extern WINDBG_EXTENSION_APIS ExtensionApis;
  14. extern HANDLE ExtensionCurrentProcess;
  15. VOID
  16. DumpXFile(
  17. PXFILE pxf,
  18. DWORD mask
  19. )
  20. {
  21. PVOID pst;
  22. DWORD i, offset;
  23. PVOID stdata,pextradata;
  24. STRING_TABLE st;
  25. PSTRING_NODEW node;//, prev;
  26. if ((mask & 4) == 0 ) {
  27. return;
  28. }
  29. dprintf( "\t\t ***XFILE structure***\n" );
  30. dprintf( "\t\t CurrentSize : 0x%x", pxf->CurrentSize );
  31. if (pxf->CurrentSize == -1) {
  32. dprintf( " (doesn't currently exist)" );
  33. }
  34. dprintf( "\n\t\t NewSize : 0x%x", pxf->NewSize );
  35. if (pxf->NewSize == -1) {
  36. dprintf( " (will be deleted)" );
  37. }
  38. dprintf("\n");
  39. }
  40. VOID
  41. DumpXDirectory(
  42. PXDIRECTORY pxd,
  43. DWORD mask
  44. )
  45. {
  46. PVOID pst;
  47. DWORD i;
  48. DWORD_PTR offset;
  49. PVOID stdata,pextradata;
  50. STRING_TABLE st;
  51. PSTRING_NODEW node;//, prev;
  52. PXFILE pxf;
  53. if ((mask & 2) == 0 ) {
  54. return;
  55. }
  56. dprintf( "\t\t ***XDIRECTORY structure***\n", pxd );
  57. dprintf( "\t\t SpaceRequired : 0x%x\n", pxd->SpaceRequired );
  58. dprintf( "\t\t FilesTable : 08%08x\n", pxd->FilesTable );
  59. move ( st, pxd->FilesTable ) ;
  60. dprintf("\t\t ***FilesTable***\n");
  61. dprintf("\t\t Base Data ptr:\t0x%08x\n", st.Data);
  62. dprintf("\t\t DataSize:\t0x%08x\n", st.DataSize);
  63. dprintf("\t\t BufferSize:\t0x%08x\n", st.BufferSize);
  64. dprintf("\t\t ExtraDataSize:\t0x%08x\n", st.ExtraDataSize);
  65. stdata = GetStringTableData( &st );
  66. if (!stdata) {
  67. dprintf("error retrieving string table data!\n");
  68. return;
  69. }
  70. //
  71. // now, dump each node in the string table
  72. //
  73. for (i = 0; i<HASH_BUCKET_COUNT; i++ ) {
  74. node = GetFirstNode(stdata, ((PULONG_PTR)stdata)[i], &offset );
  75. if (!node) {
  76. // dprintf("No data at hash bucket %d\n", i);
  77. } else {
  78. dprintf("\t\t Data at hash bucket %d\n", i);
  79. while (node) {
  80. dprintf("\t\t Entry Name:\t%ws (0x%08x)\n", node->String, offset);
  81. pxf = (PXFILE) GetStringNodeExtraData( node );
  82. DumpXFile( pxf, mask );
  83. free(pxf);
  84. node = GetNextNode( stdata, node, &offset );
  85. if (CheckInterupted()) {
  86. return;
  87. }
  88. }
  89. }
  90. if (CheckInterupted()) {
  91. return;
  92. }
  93. }
  94. free( stdata );
  95. }
  96. VOID
  97. DumpXDrive(
  98. PXDRIVE pxd,
  99. DWORD mask
  100. )
  101. {
  102. PVOID pst;
  103. DWORD i;
  104. DWORD_PTR offset;
  105. PVOID stdata,pextradata;
  106. STRING_TABLE st;
  107. PSTRING_NODEW node;//, prev;
  108. PXDIRECTORY pxdir;
  109. if ((mask & 1) == 0) {
  110. return;
  111. }
  112. dprintf( "\t\t***XDRIVE structure***\n", pxd );
  113. dprintf( "\t\t SpaceRequired : 0x%x\n", pxd->SpaceRequired );
  114. dprintf( "\t\t BytesPerCluster : 08%08x\n", pxd->BytesPerCluster );
  115. dprintf( "\t\t Slop : 08%x\n", pxd->Slop );
  116. dprintf( "\t\t DirsTable : 08%08x\n", pxd->DirsTable );
  117. move ( st, pxd->DirsTable ) ;
  118. dprintf("\t\t ***DirsTable***\n");
  119. dprintf("\t\t Base Data ptr:\t0x%08x\n", st.Data);
  120. dprintf("\t\t DataSize:\t0x%08x\n", st.DataSize);
  121. dprintf("\t\t BufferSize:\t0x%08x\n", st.BufferSize);
  122. dprintf("\t\t ExtraDataSize:\t0x%08x\n", st.ExtraDataSize);
  123. stdata = GetStringTableData( &st );
  124. if (!stdata) {
  125. dprintf("error retrieving string table data!\n");
  126. return;
  127. }
  128. //
  129. // now, dump each node in the string table
  130. //
  131. for (i = 0; i<HASH_BUCKET_COUNT; i++ ) {
  132. node = GetFirstNode(stdata, ((PULONG_PTR)stdata)[i], &offset );
  133. if (!node) {
  134. // dprintf("No data at hash bucket %d\n", i);
  135. } else {
  136. dprintf("\t\t Data at hash bucket %d\n", i);
  137. while (node) {
  138. dprintf("\t\t Entry Name:\t%ws (0x%08x)\n", node->String, offset);
  139. pxdir = (PXDIRECTORY) GetStringNodeExtraData( node );
  140. DumpXDirectory( pxdir, mask );
  141. free(pxdir);
  142. node = GetNextNode( stdata, node, &offset );
  143. if (CheckInterupted()) {
  144. return;
  145. }
  146. }
  147. }
  148. if (CheckInterupted()) {
  149. return;
  150. }
  151. }
  152. free( stdata );
  153. }
  154. DECLARE_API( space )
  155. /*++
  156. Routine Description:
  157. This debugger extension dumps the data related to a HDSKSPC structure
  158. Arguments:
  159. Return Value:
  160. --*/
  161. {
  162. DWORD ReturnLength;
  163. PVOID pds,pst;
  164. DISK_SPACE_LIST dsl;
  165. DWORD i;
  166. DWORD_PTR offset;
  167. PVOID stdata,pextradata;
  168. STRING_TABLE st;
  169. PSTRING_NODEW node;//, prev;
  170. PXDRIVE pxd;
  171. DWORD Mask = 0;
  172. //BOOL val;
  173. INIT_API();
  174. while (*lpArgumentString == ' ') {
  175. lpArgumentString++;
  176. }
  177. pds = (PVOID)GetExpression( lpArgumentString );
  178. while (*lpArgumentString && (*lpArgumentString != ' ') ) {
  179. lpArgumentString++;
  180. }
  181. while (*lpArgumentString == ' ') {
  182. lpArgumentString++;
  183. }
  184. if (*lpArgumentString) {
  185. Mask = (DWORD)GetExpression( lpArgumentString );
  186. }
  187. move( dsl , pds );
  188. dprintf("DISK_SPACE_LIST at :\t0x%08x\n", (ULONG_PTR) pds);
  189. dprintf("\tLock[0] : 0x%08x\n", dsl.Lock.handles[0]);
  190. dprintf("\tLock[1] : 0x%08x\n", dsl.Lock.handles[1]);
  191. dprintf("\tDrivesTable : 0x%08x\n", dsl.DrivesTable );
  192. dprintf("\tFlags : 0x%08x\n", dsl.Flags);
  193. move ( st, dsl.DrivesTable ) ;
  194. dprintf("\t ***DrivesTable***\n");
  195. DumpStringTableHeader( &st );
  196. stdata = GetStringTableData( &st );
  197. if (!stdata) {
  198. dprintf("error retrieving string table data!\n");
  199. return;
  200. }
  201. //
  202. // now, dump each node in the string table
  203. //
  204. for (i = 0; i<HASH_BUCKET_COUNT; i++ ) {
  205. node = GetFirstNode(stdata, ((PULONG_PTR)stdata)[i], &offset );
  206. if (!node) {
  207. // dprintf("No data at hash bucket %d\n", i);
  208. } else {
  209. dprintf("\t\tData at hash bucket %d\n", i);
  210. while (node) {
  211. dprintf("\t\tEntry Name:\t%ws (0x%08x)\n", node->String, offset);
  212. pxd = (PXDRIVE) GetStringNodeExtraData( node );
  213. DumpXDrive( pxd, Mask );
  214. free(pxd);
  215. node = GetNextNode( stdata, node, &offset );
  216. if (CheckInterupted()) {
  217. return;
  218. }
  219. }
  220. }
  221. if (CheckInterupted()) {
  222. return;
  223. }
  224. }
  225. free( stdata );
  226. }
  227. #define TRACK_ARG_DECLARE
  228. #define TRACK_ARG_COMMA
  229. #include "cntxtlog.h"
  230. #include "backup.h"
  231. #include "fileq.h"
  232. VOID DumpAltPlatformInfo( PSP_ALTPLATFORM_INFO api, DWORD mask );
  233. VOID DumpFileQueueNodeList( PSP_FILE_QUEUE_NODE pfqn, DWORD mask, BOOL recursive ) ;
  234. VOID DumpSourceMediaInfoList( PSOURCE_MEDIA_INFO smi, DWORD mask, BOOL recursive );
  235. VOID DumpCatalogInfoList( PSPQ_CATALOG_INFO ci, DWORD mask, BOOL recursive );
  236. VOID DumpUnwindList( PSP_UNWIND_NODE pun, DWORD mask, BOOL recursive );
  237. VOID DumpDelayMoveList( PSP_DELAYMOVE_NODE pdn, DWORD mask, BOOL recursive );
  238. VOID
  239. DumpAltPlatformInfo(
  240. PSP_ALTPLATFORM_INFO api,
  241. DWORD mask
  242. )
  243. {
  244. //if ((mask & 4) == 0 ) {
  245. // return;
  246. //}
  247. dprintf( "\t\t***SP_ALT_PLATFORM_INFO structure***\n" );
  248. dprintf( "\t\t cbSize : 0x%x\n", api->cbSize );
  249. dprintf( "\t\t Platform : 0x%x\n", api->Platform );
  250. dprintf( "\t\t MajorVersion : 0x%x\n", api->MajorVersion );
  251. dprintf( "\t\t MinorVersion : 0x%x\n", api->MinorVersion );
  252. dprintf( "\t\t ProcessorArchitecture : 0x%x\n", api->ProcessorArchitecture );
  253. dprintf( "\t\t Reserved : 0x%x\n", api->Reserved );
  254. }
  255. VOID
  256. DumpFileQueueNodeList(
  257. PSP_FILE_QUEUE_NODE pfqn,
  258. DWORD mask,
  259. BOOL recursive
  260. )
  261. {
  262. //PVOID pst;
  263. //DWORD i, offset;
  264. //PVOID stdata,pextradata;
  265. //STRING_TABLE st;
  266. //PSTRING_NODEW node;//, prev;
  267. //if ((mask & 4) == 0 ) {
  268. // return;
  269. //}
  270. SP_FILE_QUEUE_NODE next;
  271. SOURCE_MEDIA_INFO smi;
  272. SPQ_CATALOG_INFO ci;
  273. dprintf( "\t\t***SP_FILE_QUEUE_NODE structure***\n" );
  274. dprintf( "\t\t Next : 0x%x\n", pfqn->Next );
  275. dprintf( "\t\t Operation : 0x%x ( %s )\n", pfqn->Operation,
  276. (pfqn->Operation == FILEOP_DELETE) ? "DELETE" :
  277. (pfqn->Operation == FILEOP_RENAME) ? "RENAME" :
  278. "COPY" );
  279. dprintf( "\t\t SourceRootPath : 0x%x\n", pfqn->SourceRootPath );
  280. dprintf( "\t\t SourcePath : 0x%x\n", pfqn->SourcePath );
  281. dprintf( "\t\t SourceFilename : 0x%x\n", pfqn->SourceFilename );
  282. dprintf( "\t\t TargetDirectory : 0x%x\n", pfqn->TargetDirectory );
  283. dprintf( "\t\t SecurityDesc : 0x%x\n", pfqn->SecurityDesc );
  284. dprintf( "\t\t SourceMediaInfo : 0x%x\n", pfqn->SourceMediaInfo );
  285. if (pfqn->SourceMediaInfo && recursive) {
  286. if (CheckInterupted()) {
  287. return;
  288. }
  289. move( smi, pfqn->SourceMediaInfo );
  290. DumpSourceMediaInfoList( &smi, mask, FALSE );
  291. }
  292. dprintf( "\t\t StyleFlags : 0x%x\n", pfqn->StyleFlags );
  293. dprintf( "\t\t InternalFlags : 0x%x\n", pfqn->InternalFlags );
  294. dprintf( "\t\t CatalogInfo : 0x%x\n", pfqn->CatalogInfo );
  295. if (pfqn->CatalogInfo && recursive) {
  296. if (CheckInterupted()) {
  297. return;
  298. }
  299. move( ci, pfqn->CatalogInfo);
  300. DumpCatalogInfoList( &ci, mask, FALSE );
  301. }
  302. if (pfqn->Next && recursive) {
  303. move( next, pfqn->Next );
  304. DumpFileQueueNodeList( &next, mask, TRUE );
  305. }
  306. }
  307. VOID
  308. DumpSourceMediaInfoList(
  309. PSOURCE_MEDIA_INFO smi,
  310. DWORD mask,
  311. BOOL recursive
  312. )
  313. {
  314. //PVOID pst;
  315. //DWORD i, offset;
  316. //PVOID stdata,pextradata;
  317. //STRING_TABLE st;
  318. //PSTRING_NODEW node;//, prev;
  319. //if ((mask & 4) == 0 ) {
  320. // return;
  321. //}
  322. SOURCE_MEDIA_INFO next;
  323. SP_FILE_QUEUE_NODE queue;
  324. dprintf( "\t\t***SOURCE_MEDIA_INFO structure***\n" );
  325. dprintf( "\t\t Next : 0x%x\n", smi->Next );
  326. dprintf( "\t\t Description : 0x%x\n", smi->Description );
  327. dprintf( "\t\t DescriptionDisplayName : 0x%x\n", smi->DescriptionDisplayName );
  328. dprintf( "\t\t Tagfile : 0x%x\n", smi->Tagfile );
  329. dprintf( "\t\t SourceRootPath : 0x%x\n", smi->SourceRootPath );
  330. dprintf( "\t\t CopyQueue : 0x%x\n", smi->CopyQueue );
  331. if (smi->CopyQueue && (mask & 8) && recursive) {
  332. if (CheckInterupted()) {
  333. return;
  334. }
  335. move ( queue, smi->CopyQueue ) ;
  336. DumpFileQueueNodeList( &queue, mask, FALSE );
  337. }
  338. dprintf( "\t\t CopyNodeCount : 0x%x\n", smi->CopyNodeCount );
  339. dprintf( "\t\t Flags : 0x%x\n", smi->Flags );
  340. if (smi->Next && recursive) {
  341. if (CheckInterupted()) {
  342. return;
  343. }
  344. move ( next, smi->Next ) ;
  345. DumpSourceMediaInfoList( &next, mask, TRUE );
  346. }
  347. }
  348. VOID
  349. DumpCatalogInfoList(
  350. PSPQ_CATALOG_INFO ci,
  351. DWORD mask,
  352. BOOL recursive
  353. )
  354. {
  355. //PVOID pst;
  356. //DWORD i, offset;
  357. //PVOID stdata,pextradata;
  358. //STRING_TABLE st;
  359. //PSTRING_NODEW node;//, prev;
  360. //if ((mask & 4) == 0 ) {
  361. // return;
  362. //}
  363. SPQ_CATALOG_INFO next;
  364. dprintf( "\t\t***SPQ_CATALOG_INFO structure***\n" );
  365. dprintf( "\t\t Next : 0x%x\n", ci->Next );
  366. dprintf( "\t\t CatalogFileFromInf : 0x%x\n", ci->CatalogFileFromInf );
  367. dprintf( "\t\t AltCatalogFileFromInf : 0x%x\n", ci->AltCatalogFileFromInf );
  368. dprintf( "\t\t AltCatalogFileFromInfPending : 0x%x\n", ci->AltCatalogFileFromInfPending );
  369. dprintf( "\t\t InfFullPath : 0x%x\n", ci->InfFullPath );
  370. dprintf( "\t\t InfOriginalName : 0x%x\n", ci->InfOriginalName );
  371. dprintf( "\t\t InfFinalPath : 0x%x\n", ci->InfFinalPath );
  372. dprintf( "\t\t VerificationFailureError : 0x%x\n", ci->VerificationFailureError );
  373. dprintf( "\t\t Flags : 0x%x\n", ci->Flags );
  374. dprintf( "\t\t CatalogFilenameOnSystem : %ws\n", ci->CatalogFilenameOnSystem );
  375. if (ci->Next && recursive) {
  376. if (CheckInterupted()) {
  377. return;
  378. }
  379. move(next, ci->Next );
  380. DumpCatalogInfoList( &next, mask, TRUE ) ;
  381. }
  382. }
  383. VOID
  384. DumpUnwindList(
  385. PSP_UNWIND_NODE pun,
  386. DWORD mask,
  387. BOOL recursive
  388. )
  389. {
  390. SP_UNWIND_NODE next;
  391. dprintf( "\t\t***SP_UNWIND_NODE structure***\n" );
  392. dprintf( "\t\t NextNode : 0x%x\n", pun->NextNode );
  393. dprintf( "\t\t TargetID : 0x%x\n", pun->TargetID );
  394. dprintf( "\t\t SecurityDesc : 0x%x\n", pun->SecurityDesc );
  395. dprintf( "\t\t CreateTime : 0x%x 0x%x\n",
  396. pun->CreateTime.dwLowDateTime,
  397. pun->CreateTime.dwHighDateTime );
  398. dprintf( "\t\t AccessTime : 0x%x 0x%x\n",
  399. pun->AccessTime.dwLowDateTime,
  400. pun->AccessTime.dwHighDateTime );
  401. dprintf( "\t\t WriteTime : 0x%x 0x%x\n",
  402. pun->WriteTime.dwLowDateTime,
  403. pun->WriteTime.dwHighDateTime );
  404. if (pun->NextNode && recursive) {
  405. if (CheckInterupted()) {
  406. return;
  407. }
  408. move(next, pun->NextNode);
  409. DumpUnwindList( &next, mask, TRUE );
  410. }
  411. }
  412. VOID
  413. DumpTargetEnt(
  414. PSP_TARGET_ENT pte,
  415. DWORD mask
  416. )
  417. {
  418. dprintf( "\t\t***SP_TARGET_ENT structure***\n" );
  419. dprintf( "\t\t TargetRoot : 0x%x\n", pte->TargetRoot );
  420. dprintf( "\t\t TargetSubDir : 0x%x\n", pte->TargetSubDir );
  421. dprintf( "\t\t TargetFilename : 0x%x\n", pte->TargetFilename );
  422. dprintf( "\t\t BackupRoot : 0x%x\n", pte->BackupRoot );
  423. dprintf( "\t\t BackupSubDir : 0x%x\n", pte->BackupSubDir );
  424. dprintf( "\t\t BackupFilename : 0x%x\n", pte->BackupFilename );
  425. dprintf( "\t\t NewTargetFilename : 0x%x\n", pte->NewTargetFilename );
  426. dprintf( "\t\t InternalFlags : 0x%x\n", pte->InternalFlags );
  427. }
  428. VOID
  429. DumpDelayMoveList(
  430. PSP_DELAYMOVE_NODE pdn,
  431. DWORD mask,
  432. BOOL recursive
  433. )
  434. {
  435. SP_DELAYMOVE_NODE next;
  436. dprintf( "\t\t***SP_DELAYMOVE_NODE structure***\n" );
  437. dprintf( "\t\t NextNode : 0x%x\n", pdn->NextNode );
  438. dprintf( "\t\t SourceFilename : 0x%x\n", pdn->SourceFilename );
  439. dprintf( "\t\t TargetFilename : 0x%x\n", pdn->TargetFilename );
  440. dprintf( "\t\t SecurityDesc (stringtable index) : 0x%x\n", pdn->SecurityDesc );
  441. if (pdn->NextNode && recursive) {
  442. if (CheckInterupted()) {
  443. return;
  444. }
  445. move(next,pdn->NextNode);
  446. DumpDelayMoveList( &next, mask, TRUE );
  447. }
  448. }
  449. DECLARE_API( queue )
  450. /*++
  451. Routine Description:
  452. This debugger extension dumps the data related to a HSPFILEQ
  453. Arguments:
  454. Return Value:
  455. --*/
  456. {
  457. DWORD ReturnLength;
  458. PVOID pfq,pst;
  459. SP_FILE_QUEUE fq;
  460. PSP_TARGET_ENT pte;
  461. DWORD i;
  462. DWORD_PTR offset;
  463. PVOID stdata,pextradata;
  464. STRING_TABLE st;
  465. PSTRING_NODEW node;//, prev;
  466. DWORD Mask = 0;
  467. //BOOL val;
  468. INIT_API();
  469. while (*lpArgumentString == ' ') {
  470. lpArgumentString++;
  471. }
  472. pfq = (PVOID)GetExpression( lpArgumentString );
  473. while (*lpArgumentString && (*lpArgumentString != ' ') ) {
  474. lpArgumentString++;
  475. }
  476. while (*lpArgumentString == ' ') {
  477. lpArgumentString++;
  478. }
  479. if (*lpArgumentString) {
  480. Mask = (DWORD)GetExpression( lpArgumentString );
  481. }
  482. move( fq , pfq );
  483. dprintf("SP_FILE_QUEUE at :\t0x%08x\n", (ULONG_PTR) pfq);
  484. dprintf("\t BackupQueue : 0x%08x\n", fq.BackupQueue);
  485. dprintf("\t DeleteQueue : 0x%08x\n", fq.DeleteQueue);
  486. dprintf("\t RenameQueue : 0x%08x\n", fq.RenameQueue);
  487. dprintf("\t CopyNodeCount : 0x%08x\n", fq.CopyNodeCount);
  488. dprintf("\t DeleteNodeCount : 0x%08x\n", fq.DeleteNodeCount);
  489. dprintf("\t RenameNodeCount : 0x%08x\n", fq.RenameNodeCount);
  490. dprintf("\t BackupNodeCount : 0x%08x\n", fq.BackupNodeCount);
  491. dprintf("\t SourceMediaList : 0x%08x\n", fq.SourceMediaList);
  492. dprintf("\t SourceMediaCount : 0x%08x\n", fq.SourceMediaCount);
  493. dprintf("\t CatalogList : 0x%08x\n", fq.CatalogList);
  494. dprintf("\t DriverSigningPolicy : 0x%08x (%s)\n",
  495. fq.DriverSigningPolicy,
  496. (fq.DriverSigningPolicy == DRIVERSIGN_BLOCKING) ? "DRIVERSIGN_BLOCKING" :
  497. (fq.DriverSigningPolicy == DRIVERSIGN_WARNING) ? "DRIVERSIGN_WARNING" :
  498. "DRIVERSIGN_NONE" );
  499. dprintf("\t hWndDriverSigningUi : 0x%08x\n", fq.hWndDriverSigningUi);
  500. dprintf("\t DeviceDescStringId : 0x%08x\n", fq.DeviceDescStringId);
  501. dprintf("\t AltPlatformInfo : 0x%08x\n", fq.AltPlatformInfo);
  502. DumpAltPlatformInfo( &fq.AltPlatformInfo, Mask );
  503. dprintf("\t AltCatalogFile : 0x%08x\n", fq.AltCatalogFile);
  504. dprintf("\t StringTable : 0x%08x\n", fq.StringTable);
  505. dprintf("\t LockRefCount : 0x%08x\n", fq.LockRefCount);
  506. dprintf("\t Flags : 0x%08x\n", fq.Flags);
  507. dprintf("\t SisSourceHandle : 0x%08x\n", fq.SisSourceHandle);
  508. dprintf("\t SisSourceDirectory : 0x%08x\n", fq.SisSourceDirectory);
  509. dprintf("\t BackupInfID : 0x%08x\n", fq.BackupInfID);
  510. dprintf("\t TargetLookupTable : 0x%08x\n", fq.TargetLookupTable);
  511. dprintf("\t UnwindQueue : 0x%08x\n", fq.UnwindQueue);
  512. dprintf("\t DelayMoveQueue : 0x%08x\n", fq.DelayMoveQueue);
  513. dprintf("\t DelayMoveQueueTail : 0x%08x\n", fq.DelayMoveQueueTail);
  514. dprintf("\t Signature : 0x%08x (%s)\n",
  515. fq.Signature,
  516. (fq.Signature == SP_FILE_QUEUE_SIG) ? "VALID" : "INVALID" );
  517. //
  518. // dump the queue nodes
  519. //
  520. if (Mask & 1) {
  521. SP_FILE_QUEUE_NODE qnode;
  522. SOURCE_MEDIA_INFO smi;
  523. if (fq.BackupQueue) {
  524. move(qnode, fq.BackupQueue);
  525. dprintf("\t ***BackupQueue***\n");
  526. DumpFileQueueNodeList( &qnode, Mask, TRUE );
  527. }
  528. if (fq.DeleteQueue) {
  529. move(qnode, fq.DeleteQueue);
  530. dprintf("\t ***DeleteQueue***\n");
  531. DumpFileQueueNodeList( &qnode, Mask, TRUE );
  532. }
  533. if (fq.RenameQueue) {
  534. move(qnode, fq.RenameQueue);
  535. dprintf("\t ***RenameQueue***\n");
  536. DumpFileQueueNodeList( &qnode, Mask, TRUE );
  537. }
  538. if (fq.SourceMediaList) {
  539. move(smi, fq.SourceMediaList);
  540. dprintf("\t ***source media list***\n");
  541. DumpSourceMediaInfoList( &smi, Mask, TRUE );
  542. }
  543. }
  544. //
  545. // dump the catalog info
  546. //
  547. if (Mask & 2) {
  548. SPQ_CATALOG_INFO ci;
  549. if (fq.CatalogList) {
  550. move(ci, fq.CatalogList);
  551. dprintf("\t ***CatalogList***\n");
  552. DumpCatalogInfoList( &ci, Mask, TRUE );
  553. }
  554. }
  555. //
  556. // dump the string table
  557. //
  558. if (Mask & 4) {
  559. dprintf("\t ***StringTable***\n");
  560. move ( st, fq.StringTable ) ;
  561. DumpStringTableHeader( &st );
  562. stdata = GetStringTableData( &st );
  563. if (!stdata) {
  564. dprintf("error retrieving string table data!\n");
  565. return;
  566. }
  567. //
  568. // now, dump each node in the string table
  569. //
  570. for (i = 0; i<HASH_BUCKET_COUNT; i++ ) {
  571. node = GetFirstNode(stdata, ((PULONG_PTR)stdata)[i], &offset );
  572. if (!node) {
  573. // dprintf("No data at hash bucket %d\n", i);
  574. } else {
  575. dprintf("\t\tData at hash bucket %d\n", i);
  576. while (node) {
  577. dprintf("\t\tEntry Name:\t%ws (0x%08x)\n", node->String, offset);
  578. pextradata = st.Data + offset + (wcslen(node->String) + 1)*sizeof(WCHAR) + sizeof(DWORD);
  579. dprintf("\tExtra Data:\t0x%p\n", pextradata );
  580. node = GetNextNode( stdata, node, &offset );
  581. if (CheckInterupted()) {
  582. return;
  583. }
  584. }
  585. }
  586. if (CheckInterupted()) {
  587. return;
  588. }
  589. }
  590. free( stdata );
  591. dprintf("\t ***TargetLookupTable***\n");
  592. move ( st, fq.TargetLookupTable ) ;
  593. DumpStringTableHeader( &st );
  594. stdata = GetStringTableData( &st );
  595. if (!stdata) {
  596. dprintf("error retrieving string table data!\n");
  597. return;
  598. }
  599. //
  600. // now, dump each node in the string table
  601. //
  602. for (i = 0; i<HASH_BUCKET_COUNT; i++ ) {
  603. node = GetFirstNode(stdata, ((PULONG_PTR)stdata)[i], &offset );
  604. if (!node) {
  605. // dprintf("No data at hash bucket %d\n", i);
  606. } else {
  607. dprintf("\t\tData at hash bucket %d\n", i);
  608. while (node) {
  609. dprintf("\t\tEntry Name:\t%ws (0x%08x)\n", node->String, offset);
  610. pte = GetStringNodeExtraData( node );
  611. DumpTargetEnt( pte, Mask );
  612. free( pte );
  613. node = GetNextNode( stdata, node, &offset );
  614. if (CheckInterupted()) {
  615. return;
  616. }
  617. }
  618. }
  619. if (CheckInterupted()) {
  620. return;
  621. }
  622. }
  623. free( stdata );
  624. }
  625. //
  626. // backup stuff
  627. //
  628. if (Mask & 8) {
  629. SP_UNWIND_NODE un;
  630. SP_DELAYMOVE_NODE dnode;
  631. if (fq.UnwindQueue) {
  632. move(un, fq.UnwindQueue);
  633. dprintf("\t ***UnwindQueue***\n");
  634. DumpUnwindList( &un, Mask, TRUE );
  635. }
  636. if (fq.DelayMoveQueue) {
  637. move(dnode, fq.DelayMoveQueue);
  638. dprintf("\t ***DelayMoveQueue***\n");
  639. DumpDelayMoveList( &dnode, Mask, TRUE );
  640. }
  641. if (fq.DelayMoveQueueTail) {
  642. move(dnode, fq.DelayMoveQueueTail);
  643. dprintf("\t ***DelayMoveQueueTail***\n");
  644. DumpDelayMoveList( &dnode, Mask, TRUE );
  645. }
  646. }
  647. }
  648. DECLARE_API( qcontext )
  649. /*++
  650. Routine Description:
  651. This debugger extension dumps the data related to a queue context structure
  652. Arguments:
  653. Return Value:
  654. --*/
  655. {
  656. DWORD ReturnLength;
  657. PVOID pqc;
  658. QUEUECONTEXT qc;
  659. DWORD i, offset;
  660. PVOID stdata,pextradata;
  661. STRING_TABLE st;
  662. PSTRING_NODEW node;//, prev;
  663. //BOOL val;
  664. INIT_API();
  665. while (*lpArgumentString == ' ') {
  666. lpArgumentString++;
  667. }
  668. pqc = (PVOID)GetExpression( lpArgumentString );
  669. move( qc , pqc );
  670. dprintf("QUEUECONTEXT at :\t0x%08x\n", (ULONG_PTR) pqc);
  671. dprintf("\t OwnerWindow : 0x%08x\n", qc.OwnerWindow);
  672. dprintf("\t MainThreadId : 0x%08x\n", qc.MainThreadId);
  673. dprintf("\t ProgressDialog : 0x%08x\n", qc.ProgressDialog);
  674. dprintf("\t ProgressBar : 0x%08x\n", qc.ProgressBar);
  675. dprintf("\t Cancelled : 0x%08x\n", qc.Cancelled);
  676. dprintf("\t CurrentSourceName : %ws\n", qc.CurrentSourceName);
  677. dprintf("\t ScreenReader : 0x%08x\n", qc.ScreenReader);
  678. dprintf("\t MessageBoxUp : 0x%08x\n", qc.MessageBoxUp);
  679. dprintf("\t PendingUiType : 0x%08x\n", qc.PendingUiType);
  680. dprintf("\t PendingUiParameters : 0x%08x\n", qc.PendingUiParameters);
  681. dprintf("\t CancelReturnCode : 0x%08x\n", qc.CancelReturnCode);
  682. dprintf("\t DialogKilled : 0x%08x\n", qc.DialogKilled);
  683. dprintf("\t AlternateProgressWindow : 0x%08x\n", qc.AlternateProgressWindow);
  684. dprintf("\t ProgressMsg : 0x%08x\n", qc.ProgressMsg);
  685. dprintf("\t NoToAllMask : 0x%08x\n", qc.NoToAllMask);
  686. dprintf("\t UiThreadHandle : 0x%08x\n", qc.UiThreadHandle);
  687. }
  688. //#include "inf.h"
  689. VOID
  690. DumpInfLine(
  691. PINF_LINE line,
  692. PBYTE valuedata
  693. )
  694. {
  695. DWORD i;
  696. PVOID ptr;
  697. ULONG_PTR data;
  698. // dprintf("***INF_LINE***\n");
  699. dprintf("\t ValueCount : 0x%x\n", line->ValueCount);
  700. dprintf("\t Flags : 0x%x\n", line->Flags);
  701. dprintf("\t Values : 0x%x\n", line->Values);
  702. if (line->Flags > 3) {
  703. return;
  704. }
  705. for (i = 0; i< line->ValueCount; i++) {
  706. ptr = valuedata + (ULONG_PTR)(line->Values *sizeof(ULONG_PTR)) + (ULONG_PTR)(i*sizeof(ULONG_PTR));
  707. move ( data, valuedata + (ULONG_PTR)(line->Values *sizeof(ULONG_PTR)) + (ULONG_PTR)(i*sizeof(ULONG_PTR)) );
  708. dprintf("\t data [%d] : 0x%x [0x%x]\n", i, ptr,data );
  709. if (CheckInterupted()) {
  710. return;
  711. }
  712. }
  713. }
  714. VOID
  715. DumpInfSection(
  716. PINF_SECTION section,
  717. PBYTE linedata,
  718. PBYTE valuedata
  719. )
  720. {
  721. DWORD i;
  722. INF_LINE line;
  723. PBYTE data;
  724. dprintf("***INF_SECTION***\n");
  725. dprintf("\t SectionName : 0x%x\n", section->SectionName);
  726. dprintf("\t LineCount : 0x%x\n", section->LineCount);
  727. dprintf("\t Lines : 0x%x\n", section->Lines);
  728. for (i = 0; i< section->LineCount; i++) {
  729. data = linedata + (sizeof(INF_LINE)*section->Lines) + (ULONG_PTR)(sizeof(INF_LINE)*i);
  730. dprintf("***INF_LINE [%i] at 0x%x***\n",i, data);
  731. moveBlock ( line, (PBYTE) linedata + (sizeof(INF_LINE)*section->Lines) + (ULONG_PTR)(sizeof(INF_LINE)*i), sizeof(INF_LINE) );
  732. DumpInfLine(&line, valuedata);
  733. if (CheckInterupted()) {
  734. return;
  735. }
  736. }
  737. }
  738. VOID
  739. DumpInfVersionNode(
  740. PINF_VERSION_NODE ver
  741. )
  742. {
  743. PWSTR Data;
  744. dprintf("***INF_VERSION_NODE***\n");
  745. dprintf("\t FilenameSize : 0x%x\n", ver->FilenameSize);
  746. dprintf("\t DataBlock : 0x%x\n", ver->DataBlock);
  747. dprintf("\t DataSize : 0x%x\n", ver->DataSize);
  748. dprintf("\t DatumCount : 0x%x\n", ver->DatumCount);
  749. dprintf("\t Filename : %ws\n", ver->Filename);
  750. return;
  751. Data = malloc(ver->DataSize);
  752. if (!Data) {
  753. return;
  754. }
  755. moveBlock(Data, ver->DataBlock, ver->DataSize);
  756. dprintf("\t %ws\n", Data );
  757. free( Data );
  758. }
  759. VOID
  760. DumpUserDirId(
  761. PUSERDIRID dirid
  762. )
  763. {
  764. dprintf("***USERDIRID***\n");
  765. dprintf("\t Id : 0x%x\n", dirid->Id);
  766. dprintf("\t Directory : %ws\n", dirid->Directory);
  767. }
  768. VOID
  769. DumpUserDirIdList(
  770. PUSERDIRID_LIST list
  771. )
  772. {
  773. USERDIRID dirid;
  774. UINT i;
  775. dprintf("***USERDIRID_LIST***\n");
  776. dprintf("\t UserDirIds : 0x%x\n", list->UserDirIds);
  777. dprintf("\t UserDirIdCount : 0x%x\n", list->UserDirIdCount);
  778. for (i = 0; i < list->UserDirIdCount; i++) {
  779. moveBlock(dirid, ((LPBYTE)list->UserDirIds) + (ULONG_PTR)(sizeof(ULONG_PTR)*i) , sizeof(USERDIRID));
  780. DumpUserDirId(&dirid);
  781. if (CheckInterupted()) {
  782. return;
  783. }
  784. }
  785. }
  786. VOID
  787. DumpStringSubstNode(
  788. PSTRINGSUBST_NODE node
  789. )
  790. {
  791. dprintf("***STRINGSUBST_NODE***\n");
  792. dprintf("\t ValueOffset : 0x%x\n", node->ValueOffset);
  793. dprintf("\t TemplateStringId : 0x%x\n", node->TemplateStringId);
  794. dprintf("\t CaseSensitive : 0x%x\n", node->CaseSensitive);
  795. }
  796. DECLARE_API( infdump )
  797. /*++
  798. Routine Description:
  799. This debugger extension dumps the data related to an HINF structure
  800. Arguments:
  801. Return Value:
  802. --*/
  803. {
  804. DWORD ReturnLength;
  805. PVOID pinf;
  806. LOADED_INF inf;
  807. INF_SECTION InfSection;
  808. INF_LINE InfLine;
  809. DWORD i;
  810. DWORD_PTR offset;
  811. PVOID stdata,pextradata;
  812. STRING_TABLE st;
  813. PSTRING_NODEW node;//, prev;
  814. //BOOL val;
  815. INIT_API();
  816. while (*lpArgumentString == ' ') {
  817. lpArgumentString++;
  818. }
  819. pinf = (PVOID)GetExpression( lpArgumentString );
  820. move( inf , pinf );
  821. dprintf("LOADED_INF at :\t0x%x\n", (ULONG_PTR) pinf);
  822. dprintf("\t Signature : 0x%08x ( %s )\n", inf.Signature,
  823. inf.Signature == LOADED_INF_SIG ? "Valid" : "Invalid");
  824. if (inf.Signature != LOADED_INF_SIG) {
  825. return;
  826. }
  827. dprintf("\t FileHandle : 0x%x\n", inf.FileHandle);
  828. dprintf("\t MappingHandle : 0x%x\n", inf.MappingHandle);
  829. dprintf("\t ViewAddress : 0x%x\n", inf.ViewAddress);
  830. if (inf.FileHandle == INVALID_HANDLE_VALUE) {
  831. dprintf(" *** In memory INF ***\n" );
  832. } else {
  833. dprintf(" *** PNF ***\n" );
  834. }
  835. dprintf("\t StringTable : 0x%x\n", inf.StringTable);
  836. dprintf("\t SectionCount : 0x%x\n", inf.SectionCount);
  837. dprintf("\tSectionBlock : 0x%x\n", inf.SectionBlock);
  838. for (i = 0; i < inf.SectionCount; i++) {
  839. dprintf("***INF_SECTION [%d] at 0x%x***\n",i, (PBYTE)inf.SectionBlock + (ULONG_PTR)(sizeof(INF_SECTION)*i));
  840. move (InfSection, (PBYTE)inf.SectionBlock + (ULONG_PTR)(sizeof(INF_SECTION)*i) );
  841. DumpInfSection( &InfSection, (PBYTE)inf.LineBlock, (PBYTE)inf.ValueBlock );
  842. if (CheckInterupted()) {
  843. return;
  844. }
  845. }
  846. dprintf("\tLineBlock : 0x%x\n", inf.LineBlock);
  847. // move (InfLine, inf.LineBlock );
  848. // DumpInfLine( &InfLine ) ;
  849. dprintf("\t ValueBlock : 0x%x\n", inf.ValueBlock);
  850. DumpInfVersionNode(&inf.VersionBlock);
  851. dprintf("\t HasStrings : 0x%x\n", inf.HasStrings);
  852. dprintf("\t OsLoaderPath : %ws\n", inf.OsLoaderPath);
  853. dprintf("\t InfSourceMediaType : 0x%x ( ", inf.InfSourceMediaType);
  854. if (inf.InfSourceMediaType) {
  855. if (inf.InfSourceMediaType & SPOST_PATH ) {
  856. dprintf("SPOST_PATH ");
  857. }
  858. if (inf.InfSourceMediaType & SPOST_URL) {
  859. dprintf("SPOST_URL ");
  860. }
  861. } else {
  862. dprintf("SPOST_NONE ");
  863. }
  864. dprintf(")\n");
  865. dprintf("\t InfSourcePath : %ws\n", inf.InfSourcePath);
  866. dprintf("\t OriginalInfName : %ws\n", inf.OriginalInfName);
  867. dprintf("\t SubstValueList : 0x%x\n", inf.SubstValueList);
  868. dprintf("\t SubstValueCount : 0x%x\n", inf.SubstValueCount);
  869. dprintf("\t Style : 0x%x ( ", inf.Style);
  870. if (inf.Style & INF_STYLE_OLDNT) {
  871. dprintf("INF_STYLE_OLDNT ");
  872. }
  873. if (inf.Style & INF_STYLE_WIN4) {
  874. dprintf("INF_STYLE_WIN4 ");
  875. }
  876. dprintf(")\n");
  877. dprintf("\t SectionBlockSizeBytes : 0x%x\n", inf.SectionBlockSizeBytes);
  878. dprintf("\t LineBlockSizeBytes : 0x%x\n", inf.LineBlockSizeBytes);
  879. dprintf("\t ValueBlockSizeBytes : 0x%x\n", inf.ValueBlockSizeBytes);
  880. dprintf("\t LanguageId : 0x%x\n", inf.LanguageId);
  881. dprintf("\t UserDirIdList : 0x%x\n", inf.UserDirIdList);
  882. dprintf("\tLock[0] : 0x%x\n", inf.Lock.handles[0]);
  883. dprintf("\tLock[1] : 0x%x\n", inf.Lock.handles[1]);
  884. dprintf("\tPrev : 0x%x\n", inf.Prev);
  885. dprintf("\tNext : 0x%x\n", inf.Next);
  886. move ( st, inf.StringTable ) ;
  887. DumpStringTableHeader( &st );
  888. dprintf("***STRING_TABLE***\n");
  889. stdata = GetStringTableData( &st );
  890. if (!stdata) {
  891. dprintf("error retrieving string table data!\n");
  892. return;
  893. }
  894. //
  895. // now, dump each node in the string table
  896. //
  897. for (i = 0; i<HASH_BUCKET_COUNT; i++ ) {
  898. node = GetFirstNode(stdata, ((PULONG_PTR)stdata)[i], &offset );
  899. if (!node) {
  900. // dprintf("No data at hash bucket %d\n", i);
  901. } else {
  902. dprintf("\t\tData at hash bucket %d\n", i);
  903. while (node) {
  904. dprintf("\t\tEntry Name:\t%ws (0x%08x)\n", node->String, offset);
  905. pextradata = st.Data + offset + (wcslen(node->String) + 1)*sizeof(WCHAR) + sizeof(DWORD);
  906. dprintf("\tExtra Data:\t0x%08x\n", pextradata );
  907. node = GetNextNode( stdata, node, &offset );
  908. if (CheckInterupted()) {
  909. return;
  910. }
  911. }
  912. }
  913. if (CheckInterupted()) {
  914. return;
  915. }
  916. }
  917. free( stdata );
  918. }