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.

1907 lines
58 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. regprintres.cpp
  5. Abstract:
  6. This file contains the implementation of the member functions
  7. of PRINT_MANAGER class.
  8. Author:
  9. Jaime Sasson (jaimes) 18-Sep-1991
  10. Environment:
  11. Ulib, Regedit, Windows, User Mode
  12. --*/
  13. #include "regprintres.h"
  14. #include "array.hxx"
  15. #include "regsys.hxx"
  16. #include "iterator.hxx"
  17. #include "regresid.h"
  18. #define STRSAFE_NO_DEPRECATE
  19. #include <strsafe.h>
  20. #ifndef ARRAYSIZE
  21. #define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0]))
  22. #endif
  23. extern "C"
  24. {
  25. // from regprint.c
  26. void PrintBinaryData(PBYTE ValueData, UINT cbcbValueData);
  27. void PrintLiteral(PTSTR lpLiteral);
  28. void PrintNewLine();
  29. }
  30. BOOL PrintString(PWSTRING pwsString)
  31. {
  32. PrintLiteral((PTSTR)pwsString->GetWSTR());
  33. return TRUE;
  34. }
  35. void PrintResourceData(PBYTE pbData, UINT uSize, DWORD dwType)
  36. {
  37. PRINT_RESOURCE::_PrintResources(pbData, uSize, dwType);
  38. }
  39. BOOL PRINT_RESOURCE::s_StringsInitialized = FALSE;
  40. PWSTRING PRINT_RESOURCE::s_IndentString;
  41. PWSTRING PRINT_RESOURCE::s_StringFullDescriptor;
  42. PWSTRING PRINT_RESOURCE::s_StringInterfaceType;
  43. PWSTRING PRINT_RESOURCE::s_StringBusNumber;
  44. PWSTRING PRINT_RESOURCE::s_StringVersion;
  45. PWSTRING PRINT_RESOURCE::s_StringRevision;
  46. PWSTRING PRINT_RESOURCE::s_StringPartialDescriptor;
  47. PWSTRING PRINT_RESOURCE::s_StringResource;
  48. PWSTRING PRINT_RESOURCE::s_StringDisposition;
  49. PWSTRING PRINT_RESOURCE::s_StringVector;
  50. PWSTRING PRINT_RESOURCE::s_StringLevel;
  51. PWSTRING PRINT_RESOURCE::s_StringAffinity;
  52. PWSTRING PRINT_RESOURCE::s_StringType;
  53. PWSTRING PRINT_RESOURCE::s_StringStart;
  54. PWSTRING PRINT_RESOURCE::s_StringLength;
  55. PWSTRING PRINT_RESOURCE::s_StringChannel;
  56. PWSTRING PRINT_RESOURCE::s_StringPort;
  57. PWSTRING PRINT_RESOURCE::s_StringReserved1;
  58. PWSTRING PRINT_RESOURCE::s_StringReserved2;
  59. PWSTRING PRINT_RESOURCE::s_StringDevSpecificData;
  60. PWSTRING PRINT_RESOURCE::s_StringIoInterfaceType;
  61. PWSTRING PRINT_RESOURCE::s_StringIoBusNumber;
  62. PWSTRING PRINT_RESOURCE::s_StringIoSlotNumber;
  63. PWSTRING PRINT_RESOURCE::s_StringIoListNumber;
  64. PWSTRING PRINT_RESOURCE::s_StringIoDescriptorNumber;
  65. PWSTRING PRINT_RESOURCE::s_StringIoOption;
  66. PWSTRING PRINT_RESOURCE::s_StringIoMinimumVector;
  67. PWSTRING PRINT_RESOURCE::s_StringIoMaximumVector;
  68. PWSTRING PRINT_RESOURCE::s_StringIoMinimumAddress;
  69. PWSTRING PRINT_RESOURCE::s_StringIoMaximumAddress;
  70. PWSTRING PRINT_RESOURCE::s_StringIoAlignment;
  71. PWSTRING PRINT_RESOURCE::s_StringIoMinimumChannel;
  72. PWSTRING PRINT_RESOURCE::s_StringIoMaximumChannel;
  73. //------------------------------------------------------------------------------
  74. // PrintResources
  75. //
  76. // DESCRIPTION: Prints a resouce by type
  77. //
  78. //------------------------------------------------------------------------------
  79. void PRINT_RESOURCE::_PrintResources(PBYTE pbData, UINT uSize, DWORD dwType)
  80. {
  81. if(!s_StringsInitialized)
  82. {
  83. s_StringsInitialized = _InitializeStrings();
  84. }
  85. if (s_StringsInitialized)
  86. {
  87. switch (dwType)
  88. {
  89. case REG_RESOURCE_LIST:
  90. _PrintDataRegResourceList(pbData, uSize);
  91. break;
  92. case REG_FULL_RESOURCE_DESCRIPTOR:
  93. {
  94. FULL_DESCRIPTOR FullDescriptor;
  95. if (FullDescriptor.Initialize(pbData, uSize))
  96. {
  97. _PrintFullResourceDescriptor(&FullDescriptor, 0, FALSE);
  98. }
  99. }
  100. break;
  101. case REG_RESOURCE_REQUIREMENTS_LIST:
  102. _PrintDataRegRequirementsList(pbData, uSize);
  103. break;
  104. default:
  105. PrintBinaryData(pbData, uSize);
  106. break;
  107. }
  108. }
  109. }
  110. //------------------------------------------------------------------------------
  111. // PrintDataRegResourceList
  112. //
  113. // DESCRIPTION: Initializes the static strings.
  114. //
  115. //------------------------------------------------------------------------------
  116. BOOL PRINT_RESOURCE::_InitializeStrings()
  117. {
  118. PWSTR Buffer;
  119. ULONG Size;
  120. ULONG Count;
  121. BOOLEAN fSuccess = TRUE;
  122. s_IndentString = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_KEY_NAME_INDENT, "" );
  123. s_StringFullDescriptor = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_FULL_DESCRIPTOR, "" );
  124. s_StringPartialDescriptor = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_PARTIAL_DESCRIPTOR, "" );
  125. s_StringInterfaceType = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_INTERFACE_TYPE, "" );
  126. s_StringBusNumber = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_BUS_NUMBER, "" );
  127. s_StringVersion = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_VERSION, "" );
  128. s_StringRevision = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_REVISION, "" );
  129. s_StringResource = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_RESOURCE, "" );
  130. s_StringDisposition = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_DISPOSITION, "" );
  131. s_StringType = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_TYPE, "" );
  132. s_StringStart = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_START, "" );
  133. s_StringLength = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_LENGTH, "" );
  134. s_StringLevel = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_LEVEL, "" );
  135. s_StringVector = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_VECTOR, "" );
  136. s_StringAffinity = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_AFFINITY, "" );
  137. s_StringChannel = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_CHANNEL, "" );
  138. s_StringPort = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_PORT, "" );
  139. s_StringReserved1 = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_RESERVED1, "" );
  140. s_StringReserved2 = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_RESERVED2, "" );
  141. s_StringDevSpecificData = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_DEV_SPECIFIC_DATA, "" );
  142. s_StringIoInterfaceType = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_INTERFACE_TYPE, "" );
  143. s_StringIoBusNumber = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_BUS_NUMBER, "" );
  144. s_StringIoSlotNumber = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_SLOT_NUMBER, "" );
  145. s_StringIoListNumber = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_LIST_NUMBER, "" );
  146. s_StringIoOption = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_OPTION, "" );
  147. s_StringIoDescriptorNumber = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_DESCRIPTOR_NUMBER, "" );
  148. s_StringIoAlignment = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_ALIGNMENT, "" );
  149. s_StringIoMinimumAddress = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_MINIMUM_ADDRESS, "" );
  150. s_StringIoMaximumAddress = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_MAXIMUM_ADDRESS, "" );
  151. s_StringIoMinimumVector = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_MINIMUM_VECTOR, "" );
  152. s_StringIoMaximumVector = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_MAXIMUM_VECTOR, "" );
  153. s_StringIoMinimumChannel = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_MINIMUM_CHANNEL, "" );
  154. s_StringIoMaximumChannel = REGEDIT_BASE_SYSTEM::QueryString(IDS_PRINT_IO_MAXIMUM_CHANNEL, "" );
  155. if ((s_StringFullDescriptor == NULL) ||
  156. (s_StringPartialDescriptor == NULL) ||
  157. (s_StringInterfaceType == NULL) ||
  158. (s_StringBusNumber == NULL) ||
  159. (s_StringVersion == NULL) ||
  160. (s_StringRevision == NULL) ||
  161. (s_StringResource == NULL) ||
  162. (s_StringDisposition == NULL) ||
  163. (s_StringType == NULL) ||
  164. (s_StringStart == NULL) ||
  165. (s_StringLength == NULL) ||
  166. (s_StringLevel == NULL) ||
  167. (s_StringVector == NULL) ||
  168. (s_StringAffinity == NULL) ||
  169. (s_StringChannel == NULL) ||
  170. (s_StringPort == NULL) ||
  171. (s_StringReserved1 == NULL) ||
  172. (s_StringReserved2 == NULL) ||
  173. (s_StringDevSpecificData == NULL) ||
  174. (s_StringIoInterfaceType == NULL) ||
  175. (s_StringIoBusNumber == NULL) ||
  176. (s_StringIoSlotNumber == NULL) ||
  177. (s_StringIoListNumber == NULL) ||
  178. (s_StringIoOption == NULL) ||
  179. (s_StringIoDescriptorNumber == NULL) ||
  180. (s_StringIoAlignment == NULL) ||
  181. (s_StringIoMinimumAddress == NULL) ||
  182. (s_StringIoMaximumAddress == NULL) ||
  183. (s_StringIoMinimumVector == NULL) ||
  184. (s_StringIoMaximumVector == NULL) ||
  185. (s_StringIoMinimumChannel == NULL) ||
  186. (s_StringIoMaximumChannel == NULL))
  187. {
  188. DELETE(s_StringFullDescriptor);
  189. DELETE(s_StringPartialDescriptor);
  190. DELETE(s_StringInterfaceType);
  191. DELETE(s_StringBusNumber);
  192. DELETE(s_StringVersion);
  193. DELETE(s_StringRevision);
  194. DELETE(s_StringResource);
  195. DELETE(s_StringDisposition);
  196. DELETE(s_StringType);
  197. DELETE(s_StringStart);
  198. DELETE(s_StringLength);
  199. DELETE(s_StringLevel);
  200. DELETE(s_StringVector);
  201. DELETE(s_StringAffinity);
  202. DELETE(s_StringChannel);
  203. DELETE(s_StringPort);
  204. DELETE(s_StringReserved1);
  205. DELETE(s_StringReserved2);
  206. DELETE(s_StringDevSpecificData);
  207. DELETE(s_StringIoInterfaceType);
  208. DELETE(s_StringIoBusNumber);
  209. DELETE(s_StringIoSlotNumber);
  210. DELETE(s_StringIoListNumber);
  211. DELETE(s_StringIoOption);
  212. DELETE(s_StringIoDescriptorNumber);
  213. DELETE(s_StringIoAlignment);
  214. DELETE(s_StringIoMinimumAddress);
  215. DELETE(s_StringIoMaximumAddress);
  216. DELETE(s_StringIoMinimumVector);
  217. DELETE(s_StringIoMaximumVector);
  218. DELETE(s_StringIoMinimumChannel);
  219. DELETE(s_StringIoMaximumChannel);
  220. fSuccess = FALSE;
  221. }
  222. return fSuccess;
  223. }
  224. //------------------------------------------------------------------------------
  225. // PrintDataRegResourceList
  226. //
  227. // DESCRIPTION: Print a REG_RESOURCE_LIST stored in a value entry of a registry
  228. // key.
  229. // PARAMETERS: Data - Pointer to the buffer that contais a REG_RESOURCE_LIST
  230. // data.
  231. // Size - Number of bytes in the buffer.
  232. //------------------------------------------------------------------------------
  233. void PRINT_RESOURCE::_PrintDataRegResourceList(PBYTE Data, UINT Size)
  234. {
  235. RESOURCE_LIST ResourceList;
  236. PARRAY FullResourceDescriptors;
  237. PITERATOR Iterator;
  238. PCFULL_DESCRIPTOR FullDescriptor;
  239. ULONG DescriptorNumber;
  240. PrintNewLine();
  241. if( ( Size == 0 ) ||
  242. ( Data == NULL ) ||
  243. !ResourceList.Initialize( Data, Size ) )
  244. {
  245. return;
  246. }
  247. if( ( ( FullResourceDescriptors = ResourceList.GetFullResourceDescriptors() ) == NULL ) ||
  248. ( ( Iterator = FullResourceDescriptors->QueryIterator() ) == NULL ) )
  249. {
  250. return;
  251. }
  252. DescriptorNumber = 0;
  253. while( ( FullDescriptor = ( PCFULL_DESCRIPTOR )( Iterator->GetNext() ) ) != NULL )
  254. {
  255. if( !_PrintFullResourceDescriptor( FullDescriptor, DescriptorNumber ) )
  256. {
  257. DELETE( Iterator );
  258. return;
  259. }
  260. DescriptorNumber++;
  261. }
  262. DELETE( Iterator );
  263. return;
  264. }
  265. //------------------------------------------------------------------------------
  266. // PrintFullResourceDescriptor
  267. //
  268. // DESCRIPTION: Print the contents of a FULL_DESCRIPTOR object.
  269. //
  270. // PARAMETERS: FullDescriptor - Pointer to object to be printed.
  271. // DescriptorNumber -
  272. // PrintDescriptorNumber - A flag that indicates whether or not the
  273. // descriptor number should be printed.
  274. //------------------------------------------------------------------------------
  275. BOOL PRINT_RESOURCE::_PrintFullResourceDescriptor(PCFULL_DESCRIPTOR FullDescriptor,
  276. UINT DescriptorNumber, BOOL PrintDescriptorNumber)
  277. {
  278. DSTRING FullDescriptorNumberString;
  279. DSTRING AuxString;
  280. DSTRING InterfaceType;
  281. DSTRING BusNumber;
  282. DSTRING Version;
  283. DSTRING Revision;
  284. WCHAR AuxNumber[11];
  285. PWSTRING TypeString;
  286. ULONG InterfaceId;
  287. PARRAY Descriptors;
  288. PITERATOR Iterator;
  289. PCPARTIAL_DESCRIPTOR PartialDescriptor;
  290. ULONG Count;
  291. if( !FullDescriptorNumberString.Initialize( s_IndentString ) ||
  292. !FullDescriptorNumberString.Strcat( s_StringFullDescriptor ) ||
  293. !InterfaceType.Initialize( s_IndentString ) ||
  294. !InterfaceType.Strcat( s_StringInterfaceType ) ||
  295. !BusNumber.Initialize( s_IndentString ) ||
  296. !BusNumber.Strcat( s_StringBusNumber ) ||
  297. !Version.Initialize( s_IndentString ) ||
  298. !Version.Strcat( s_StringVersion ) ||
  299. !Revision.Initialize( s_IndentString ) ||
  300. !Revision.Strcat( s_StringRevision )
  301. )
  302. {
  303. return FALSE;
  304. }
  305. //
  306. // Build a string that contains the full descriptor number
  307. // and print it
  308. //
  309. if( PrintDescriptorNumber )
  310. {
  311. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", DescriptorNumber );
  312. if( !AuxString.Initialize( AuxNumber ) )
  313. {
  314. return FALSE;
  315. }
  316. FullDescriptorNumberString.Strcat( &AuxString );
  317. if( !PrintString( &FullDescriptorNumberString ) )
  318. {
  319. return FALSE;
  320. }
  321. }
  322. PrintNewLine();
  323. //
  324. // Print the interface type
  325. switch( FullDescriptor->GetInterfaceType() )
  326. {
  327. case Internal:
  328. InterfaceId = IDS_BUS_INTERNAL;
  329. break;
  330. case Isa:
  331. InterfaceId = IDS_BUS_ISA;
  332. break;
  333. case Eisa:
  334. InterfaceId = IDS_BUS_EISA;
  335. break;
  336. case MicroChannel:
  337. InterfaceId = IDS_BUS_MICRO_CHANNEL;
  338. break;
  339. case TurboChannel:
  340. InterfaceId = IDS_BUS_TURBO_CHANNEL;
  341. break;
  342. case PCIBus:
  343. InterfaceId = IDS_BUS_PCI_BUS;
  344. break;
  345. case VMEBus:
  346. InterfaceId = IDS_BUS_VME_BUS;
  347. break;
  348. case NuBus:
  349. InterfaceId = IDS_BUS_NU_BUS;
  350. break;
  351. case PCMCIABus:
  352. InterfaceId = IDS_BUS_PCMCIA_BUS;
  353. break;
  354. case CBus:
  355. InterfaceId = IDS_BUS_C_BUS;
  356. break;
  357. case MPIBus:
  358. InterfaceId = IDS_BUS_MPI_BUS;
  359. break;
  360. case MPSABus:
  361. InterfaceId = IDS_BUS_MPSA_BUS;
  362. break;
  363. default:
  364. InterfaceId = IDS_INVALID;
  365. break;
  366. }
  367. TypeString = REGEDIT_BASE_SYSTEM::QueryString( InterfaceId, "" );
  368. if( TypeString == NULL )
  369. {
  370. return FALSE;
  371. }
  372. InterfaceType.Strcat( TypeString );
  373. DELETE( TypeString );
  374. if(!PrintString( &InterfaceType ))
  375. {
  376. return FALSE;
  377. }
  378. PrintNewLine();
  379. //
  380. // Print the bus number
  381. //
  382. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", FullDescriptor->GetBusNumber() );
  383. if( !AuxString.Initialize( AuxNumber ) )
  384. {
  385. return FALSE;
  386. }
  387. BusNumber.Strcat( &AuxString );
  388. if( !PrintString( &BusNumber ) )
  389. {
  390. return FALSE;
  391. }
  392. PrintNewLine();
  393. //
  394. // Print version
  395. //
  396. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", FullDescriptor->GetVersion() );
  397. if( !AuxString.Initialize( AuxNumber ) )
  398. {
  399. return FALSE;
  400. }
  401. Version.Strcat( &AuxString );
  402. if( !PrintString( &Version ) )
  403. {
  404. return FALSE;
  405. }
  406. PrintNewLine();
  407. //
  408. // Print revision
  409. //
  410. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", FullDescriptor->GetRevision() );
  411. if( !AuxString.Initialize( AuxNumber ) )
  412. {
  413. return FALSE;
  414. }
  415. Revision.Strcat( &AuxString );
  416. if( !PrintString( &Revision ) )
  417. {
  418. return FALSE;
  419. }
  420. PrintNewLine();
  421. Descriptors = FullDescriptor->GetResourceDescriptors();
  422. if( ( Descriptors == NULL ) ||
  423. ( ( Iterator = Descriptors->QueryIterator() ) == NULL )
  424. )
  425. {
  426. return FALSE;
  427. }
  428. Count = 0;
  429. while( ( PartialDescriptor = ( PCPARTIAL_DESCRIPTOR )( Iterator->GetNext() ) ) != NULL )
  430. {
  431. if( !_PrintPartialDescriptor( PartialDescriptor, Count ) )
  432. {
  433. DELETE( Iterator );
  434. return FALSE;
  435. }
  436. Count++;
  437. }
  438. DELETE( Iterator );
  439. PrintNewLine();
  440. return TRUE;
  441. }
  442. //------------------------------------------------------------------------------
  443. // PrintPartialDescriptor
  444. //
  445. // DESCRIPTION: Print the contents of a PARTIAL_DESCRIPTOR object.
  446. //
  447. // PARAMETERS: PartialDescriptor - Pointer to object to be printed.
  448. // DescriptorNumber -
  449. //------------------------------------------------------------------------------
  450. BOOL PRINT_RESOURCE::_PrintPartialDescriptor(PCPARTIAL_DESCRIPTOR PartialDescriptor,
  451. ULONG DescriptorNumber)
  452. {
  453. DSTRING PartialDescriptorNumberString;
  454. DSTRING AuxString;
  455. WCHAR AuxNumber[11];
  456. DSTRING ResourceString;
  457. DSTRING DispositionString;
  458. ULONG StringId;
  459. PWSTRING String;
  460. if( !PartialDescriptorNumberString.Initialize( s_IndentString ) ||
  461. !PartialDescriptorNumberString.Strcat( s_StringPartialDescriptor ) ||
  462. !ResourceString.Initialize( s_IndentString ) ||
  463. !ResourceString.Strcat( s_StringResource ) ||
  464. !DispositionString.Initialize( s_IndentString ) ||
  465. !DispositionString.Strcat( s_StringDisposition )
  466. )
  467. {
  468. return FALSE;
  469. }
  470. //
  471. // Build a string that contains the full descriptor number
  472. // and print it
  473. //
  474. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", DescriptorNumber );
  475. if( !AuxString.Initialize( AuxNumber ) )
  476. {
  477. return FALSE;
  478. }
  479. PartialDescriptorNumberString.Strcat( &AuxString );
  480. if( !PrintString( &PartialDescriptorNumberString ) )
  481. {
  482. return FALSE;
  483. }
  484. PrintNewLine();
  485. //
  486. // Print the resource type
  487. //
  488. if( PartialDescriptor->IsDescriptorTypeDma() )
  489. {
  490. StringId = IDS_DEV_DMA;
  491. }
  492. else if( PartialDescriptor->IsDescriptorTypeInterrupt() )
  493. {
  494. StringId = IDS_DEV_INTERRUPT;
  495. }
  496. else if( PartialDescriptor->IsDescriptorTypeMemory() )
  497. {
  498. StringId = IDS_DEV_MEMORY;
  499. }
  500. else if( PartialDescriptor->IsDescriptorTypePort() )
  501. {
  502. StringId = IDS_DEV_PORT;
  503. }
  504. else if( PartialDescriptor->IsDescriptorTypeDeviceSpecific() )
  505. {
  506. StringId = IDS_DEV_DEVICE_SPECIFIC;
  507. }
  508. else
  509. {
  510. StringId = IDS_INVALID;
  511. }
  512. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  513. if( String == NULL )
  514. {
  515. return FALSE;
  516. }
  517. ResourceString.Strcat( String );
  518. DELETE( String );
  519. if( !PrintString( &ResourceString ) )
  520. {
  521. return FALSE;
  522. }
  523. PrintNewLine();
  524. //
  525. // Print the disposition
  526. //
  527. if( PartialDescriptor->IsResourceShareUndetermined() ) {
  528. StringId = IDS_SHARE_UNDETERMINED;
  529. } else if( PartialDescriptor->IsResourceShareDeviceExclusive() ) {
  530. StringId = IDS_SHARE_DEVICE_EXCLUSIVE;
  531. } else if( PartialDescriptor->IsResourceShareDriverExclusive() ) {
  532. StringId = IDS_SHARE_DRIVER_EXCLUSIVE;
  533. } else {
  534. StringId = IDS_SHARE_SHARED;
  535. }
  536. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  537. if( String == NULL )
  538. {
  539. return FALSE;
  540. }
  541. DispositionString.Strcat( String );
  542. DELETE( String );
  543. if( !PrintString( &DispositionString ) )
  544. {
  545. return FALSE;
  546. }
  547. PrintNewLine();
  548. if( PartialDescriptor->IsDescriptorTypeDma() )
  549. {
  550. if( !_PrintDmaDescriptor( ( PCDMA_DESCRIPTOR )PartialDescriptor ) )
  551. {
  552. return FALSE;
  553. }
  554. }
  555. else if( PartialDescriptor->IsDescriptorTypeInterrupt() )
  556. {
  557. if( !_PrintInterruptDescriptor( ( PCINTERRUPT_DESCRIPTOR )PartialDescriptor ) )
  558. {
  559. return FALSE;
  560. }
  561. }
  562. else if( PartialDescriptor->IsDescriptorTypeMemory() )
  563. {
  564. if( !_PrintMemoryDescriptor( ( PCMEMORY_DESCRIPTOR )PartialDescriptor ) )
  565. {
  566. return FALSE;
  567. }
  568. }
  569. else if( PartialDescriptor->IsDescriptorTypePort() )
  570. {
  571. if( !_PrintPortDescriptor( ( PCPORT_DESCRIPTOR )PartialDescriptor ) )
  572. {
  573. return FALSE;
  574. }
  575. }
  576. else if( PartialDescriptor->IsDescriptorTypeDeviceSpecific() )
  577. {
  578. if( !_PrintDeviceSpecificDescriptor( ( PCDEVICE_SPECIFIC_DESCRIPTOR )PartialDescriptor ) )
  579. {
  580. return FALSE;
  581. }
  582. }
  583. PrintNewLine();
  584. return TRUE;
  585. }
  586. //------------------------------------------------------------------------------
  587. // PrintInterruptDescriptor
  588. //
  589. // DESCRIPTION: Print the contents of a INTERRUPT_DESCRIPTOR object.
  590. //
  591. // PARAMETERS: Descriptor - Pointer to object to be printed.
  592. //------------------------------------------------------------------------------
  593. BOOL PRINT_RESOURCE::_PrintInterruptDescriptor(PCINTERRUPT_DESCRIPTOR Descriptor)
  594. {
  595. DSTRING VectorString;
  596. DSTRING LevelString;
  597. DSTRING AffinityString;;
  598. DSTRING TypeString;
  599. DSTRING AuxString;
  600. WCHAR AuxNumber[19];
  601. ULONG StringId;
  602. PWSTRING String;
  603. if( !VectorString.Initialize( s_IndentString ) ||
  604. !VectorString.Strcat( s_StringVector ) ||
  605. !LevelString.Initialize( s_IndentString ) ||
  606. !LevelString.Strcat( s_StringLevel ) ||
  607. !AffinityString.Initialize( s_IndentString ) ||
  608. !AffinityString.Strcat( s_StringAffinity ) ||
  609. !TypeString.Initialize( s_IndentString ) ||
  610. !TypeString.Strcat( s_StringType )
  611. )
  612. {
  613. return FALSE;
  614. }
  615. //
  616. // Print the vector
  617. //
  618. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", Descriptor->GetVector() );
  619. if( !AuxString.Initialize( AuxNumber ) )
  620. {
  621. return FALSE;
  622. }
  623. VectorString.Strcat( &AuxString );
  624. if( !PrintString( &VectorString ) )
  625. {
  626. return FALSE;
  627. }
  628. PrintNewLine();
  629. //
  630. // Print the level
  631. //
  632. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", Descriptor->GetLevel() );
  633. if( !AuxString.Initialize( AuxNumber ) )
  634. {
  635. return FALSE;
  636. }
  637. LevelString.Strcat( &AuxString );
  638. if( !PrintString( &LevelString ) )
  639. {
  640. return FALSE;
  641. }
  642. PrintNewLine();
  643. //
  644. // Print the affinity
  645. //
  646. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"0x%08x", Descriptor->GetAffinity() );
  647. if( !AuxString.Initialize( AuxNumber ) )
  648. {
  649. return FALSE;
  650. }
  651. AffinityString.Strcat( &AuxString );
  652. if( !PrintString( &AffinityString ) )
  653. {
  654. return FALSE;
  655. }
  656. PrintNewLine();
  657. // Print the type
  658. StringId = ( Descriptor->IsInterruptLevelSensitive() )? IDS_INT_LEVEL_SENSITIVE :
  659. IDS_INT_LATCHED;
  660. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  661. if( String == NULL )
  662. {
  663. return FALSE;
  664. }
  665. TypeString.Strcat( String );
  666. DELETE( String );
  667. if( !PrintString( &TypeString ) )
  668. {
  669. return FALSE;
  670. }
  671. PrintNewLine();
  672. return TRUE;
  673. }
  674. //------------------------------------------------------------------------------
  675. // PrintPortDescriptor
  676. //
  677. // DESCRIPTION: Print the contents of a PORT_DESCRIPTOR object.
  678. //
  679. // PARAMETERS: Descriptor - Pointer to object to be printed.
  680. //------------------------------------------------------------------------------
  681. BOOL PRINT_RESOURCE::_PrintPortDescriptor(PCPORT_DESCRIPTOR Descriptor)
  682. {
  683. DSTRING StartAddressString;
  684. DSTRING LengthString;
  685. DSTRING TypeString;
  686. DSTRING AuxString;
  687. WCHAR AuxNumber[19];
  688. ULONG StringId;
  689. PWSTRING String;
  690. if( !StartAddressString.Initialize( s_IndentString ) ||
  691. !StartAddressString.Strcat( s_StringStart ) ||
  692. !LengthString.Initialize( s_IndentString ) ||
  693. !LengthString.Strcat( s_StringLength ) ||
  694. !TypeString.Initialize( s_IndentString ) ||
  695. !TypeString.Strcat( s_StringType )
  696. ) {
  697. DebugPrint( "REGEDT32: Initialization failure" );
  698. return FALSE;
  699. }
  700. //
  701. // Print the start address
  702. //
  703. if( ( ( ( PPORT_DESCRIPTOR )Descriptor )->GetPhysicalAddress() )->HighPart != 0 )
  704. {
  705. StringCchPrintf( AuxNumber,
  706. ARRAYSIZE(AuxNumber),
  707. (LPWSTR)L"0x%08x%08x",
  708. ( ( ( PPORT_DESCRIPTOR )Descriptor )->GetPhysicalAddress() )->HighPart,
  709. ( ( ( PPORT_DESCRIPTOR )Descriptor )->GetPhysicalAddress() )->LowPart );
  710. }
  711. else
  712. {
  713. StringCchPrintf( AuxNumber,
  714. ARRAYSIZE(AuxNumber),
  715. (LPWSTR)L"0x%08x",
  716. ( ( ( PPORT_DESCRIPTOR )Descriptor )->GetPhysicalAddress() )->LowPart );
  717. }
  718. if( !AuxString.Initialize( AuxNumber ) )
  719. {
  720. DebugPrint( "AuxString.Initialize() failed" );
  721. return FALSE;
  722. }
  723. StartAddressString.Strcat( &AuxString );
  724. if( !PrintString( &StartAddressString ) )
  725. {
  726. return FALSE;
  727. }
  728. PrintNewLine();
  729. //
  730. // Print the length
  731. //
  732. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetLength() );
  733. if( !AuxString.Initialize( AuxNumber ) ) {
  734. DebugPrint( "AuxString.Initialize() failed" );
  735. return FALSE;
  736. }
  737. LengthString.Strcat( &AuxString );
  738. if( !PrintString( &LengthString ) ) {
  739. return FALSE;
  740. }
  741. PrintNewLine();
  742. //
  743. // Print the type
  744. //
  745. StringId = ( Descriptor->IsPortMemory() )? IDS_PORT_MEMORY :
  746. IDS_PORT_PORT;
  747. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  748. if( String == NULL ) {
  749. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  750. return FALSE;
  751. }
  752. TypeString.Strcat( String );
  753. DELETE( String );
  754. if( !PrintString( &TypeString ) ) {
  755. return FALSE;
  756. }
  757. PrintNewLine();
  758. return TRUE;
  759. }
  760. //------------------------------------------------------------------------------
  761. // PrintMemoryDescriptor
  762. //
  763. // DESCRIPTION: Print the contents of a MEMORY_DESCRIPTOR object.
  764. //
  765. // PARAMETERS: Descriptor - Pointer to object to be printed.
  766. //------------------------------------------------------------------------------
  767. BOOL PRINT_RESOURCE::_PrintMemoryDescriptor(PCMEMORY_DESCRIPTOR Descriptor)
  768. {
  769. DSTRING StartAddressString;
  770. DSTRING LengthString;
  771. DSTRING TypeString;
  772. DSTRING AuxString;
  773. WCHAR AuxNumber[19];
  774. ULONG StringId;
  775. PWSTRING String;
  776. if( !StartAddressString.Initialize( s_IndentString ) ||
  777. !StartAddressString.Strcat( s_StringStart ) ||
  778. !LengthString.Initialize( s_IndentString ) ||
  779. !LengthString.Strcat( s_StringLength ) ||
  780. !TypeString.Initialize( s_IndentString ) ||
  781. !TypeString.Strcat( s_StringType )
  782. ) {
  783. DebugPrint( "REGEDT32: Initialization failure" );
  784. return FALSE;
  785. }
  786. //
  787. // Print the start address
  788. //
  789. if( ( ( ( PMEMORY_DESCRIPTOR )Descriptor )->GetStartAddress() )->HighPart != 0 )
  790. {
  791. StringCchPrintf( AuxNumber,
  792. ARRAYSIZE(AuxNumber),
  793. (LPWSTR)L"0x%08x%08x",
  794. ( ( ( PMEMORY_DESCRIPTOR )Descriptor )->GetStartAddress() )->HighPart,
  795. ( ( ( PMEMORY_DESCRIPTOR )Descriptor )->GetStartAddress() )->LowPart );
  796. }
  797. else
  798. {
  799. StringCchPrintf( AuxNumber,
  800. ARRAYSIZE(AuxNumber),
  801. (LPWSTR)L"0x%08x",
  802. ( ( ( PMEMORY_DESCRIPTOR )Descriptor )->GetStartAddress() )->LowPart );
  803. }
  804. if( !AuxString.Initialize( AuxNumber ) ) {
  805. DebugPrint( "AuxString.Initialize() failed" );
  806. return FALSE;
  807. }
  808. StartAddressString.Strcat( &AuxString );
  809. if( !PrintString( &StartAddressString ) ) {
  810. return FALSE;
  811. }
  812. PrintNewLine();
  813. //
  814. // Print the length
  815. //
  816. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetLength() );
  817. if( !AuxString.Initialize( AuxNumber ) ) {
  818. DebugPrint( "AuxString.Initialize() failed" );
  819. return FALSE;
  820. }
  821. LengthString.Strcat( &AuxString );
  822. if( !PrintString( &LengthString ) ) {
  823. return FALSE;
  824. }
  825. PrintNewLine();
  826. //
  827. // Print the type
  828. //
  829. StringId = ( Descriptor->IsMemoryReadWrite() )? IDS_MEM_READ_WRITE :
  830. ( ( Descriptor->IsMemoryReadWrite() )? IDS_MEM_READ_ONLY :
  831. IDS_MEM_WRITE_ONLY );
  832. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  833. if( String == NULL ) {
  834. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  835. return FALSE;
  836. }
  837. TypeString.Strcat( String );
  838. DELETE( String );
  839. if( !PrintString( &TypeString ) ) {
  840. return FALSE;
  841. }
  842. PrintNewLine();
  843. return TRUE;
  844. }
  845. //------------------------------------------------------------------------------
  846. // PrintDmaDescriptor
  847. //
  848. // DESCRIPTION: Print the contents of a DMA_DESCRIPTOR object.
  849. //
  850. // PARAMETERS: Descriptor - Pointer to object to be printed.
  851. //------------------------------------------------------------------------------
  852. BOOL PRINT_RESOURCE::_PrintDmaDescriptor(PCDMA_DESCRIPTOR Descriptor)
  853. {
  854. DSTRING ChannelString;
  855. DSTRING PortString;
  856. DSTRING AuxString;
  857. WCHAR AuxNumber[19];
  858. if( !ChannelString.Initialize( s_IndentString ) ||
  859. !ChannelString.Strcat( s_StringChannel ) ||
  860. !PortString.Initialize( s_IndentString ) ||
  861. !PortString.Strcat( s_StringPort )
  862. ) {
  863. DebugPrint( "REGEDT32: Initialization failure" );
  864. return FALSE;
  865. }
  866. //
  867. // Print the channel
  868. //
  869. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", Descriptor->GetChannel() );
  870. if( !AuxString.Initialize( AuxNumber ) ) {
  871. DebugPrint( "AuxString.Initialize() failed" );
  872. return FALSE;
  873. }
  874. ChannelString.Strcat( &AuxString );
  875. if( !PrintString( &ChannelString ) ) {
  876. return FALSE;
  877. }
  878. PrintNewLine();
  879. //
  880. // Print the port
  881. //
  882. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", Descriptor->GetPort() );
  883. if( !AuxString.Initialize( AuxNumber ) ) {
  884. DebugPrint( "AuxString.Initialize() failed" );
  885. return FALSE;
  886. }
  887. PortString.Strcat( &AuxString );
  888. if( !PrintString( &PortString ) ) {
  889. return FALSE;
  890. }
  891. PrintNewLine();
  892. return TRUE;
  893. }
  894. //------------------------------------------------------------------------------
  895. // PrintDeviceSpecificDescriptor
  896. //
  897. // DESCRIPTION: Print the contents of a DEVICE_SPECIFIC_DESCRIPTOR object.
  898. //
  899. // PARAMETERS: Descriptor - Pointer to object to be printed.
  900. //------------------------------------------------------------------------------
  901. BOOL PRINT_RESOURCE::_PrintDeviceSpecificDescriptor(PCDEVICE_SPECIFIC_DESCRIPTOR Descriptor)
  902. {
  903. DSTRING Reserved1String;
  904. DSTRING Reserved2String;
  905. DSTRING DataString;
  906. DSTRING AuxString;
  907. WCHAR AuxNumber[19];
  908. ULONG Size;
  909. PCBYTE Data;
  910. if( !Reserved1String.Initialize( s_IndentString ) ||
  911. !Reserved1String.Strcat( s_StringReserved1 ) ||
  912. !Reserved2String.Initialize( s_IndentString ) ||
  913. !Reserved2String.Strcat( s_StringReserved2 ) ||
  914. !DataString.Initialize( s_IndentString ) ||
  915. !DataString.Strcat( s_StringDevSpecificData )
  916. ) {
  917. DebugPrint( "REGEDT32: Initialization failure" );
  918. return FALSE;
  919. }
  920. //
  921. // Print reserved1
  922. //
  923. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"0x%08x", Descriptor->GetReserved1() );
  924. if( !AuxString.Initialize( AuxNumber ) ) {
  925. DebugPrint( "AuxString.Initialize() failed" );
  926. return FALSE;
  927. }
  928. Reserved1String.Strcat( &AuxString );
  929. if( !PrintString( &Reserved1String ) ) {
  930. return FALSE;
  931. }
  932. PrintNewLine();
  933. //
  934. // Print reserved2
  935. //
  936. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"0x%08x", Descriptor->GetReserved2() );
  937. if( !AuxString.Initialize( AuxNumber ) ) {
  938. DebugPrint( "AuxString.Initialize() failed" );
  939. return FALSE;
  940. }
  941. Reserved2String.Strcat( &AuxString );
  942. if( !PrintString( &Reserved2String ) ) {
  943. return FALSE;
  944. }
  945. PrintNewLine();
  946. Size = Descriptor->GetData( &Data );
  947. if( ( Size != 0 ) &&
  948. ( Data != NULL ) ) {
  949. if( !PrintString( &DataString ) )
  950. {
  951. return FALSE;
  952. }
  953. PrintBinaryData((PBYTE)Data, Size);
  954. PrintNewLine();
  955. }
  956. return TRUE;
  957. }
  958. //------------------------------------------------------------------------------
  959. // PrintDataRegRequirementsList
  960. //
  961. // DESCRIPTION: Print the contents of a DEVICE_SPECIFIC_DESCRIPTOR object.
  962. //
  963. // PARAMETERS:
  964. //------------------------------------------------------------------------------
  965. BOOL PRINT_RESOURCE::_PrintDataRegRequirementsList(PBYTE Data, ULONG Size)
  966. {
  967. IO_REQUIREMENTS_LIST RequirementsList;
  968. PARRAY AlternativeLists;
  969. PITERATOR Iterator;
  970. PCIO_DESCRIPTOR_LIST ResourceList;
  971. ULONG ListNumber;
  972. DSTRING AuxString;
  973. DSTRING InterfaceType;
  974. DSTRING BusNumber;
  975. DSTRING SlotNumber;
  976. WCHAR AuxNumber[11];
  977. PWSTRING TypeString;
  978. ULONG InterfaceId;
  979. PrintNewLine();
  980. if( ( Size == 0 ) ||
  981. ( Data == NULL ) ||
  982. !RequirementsList.Initialize( Data, Size ) ) {
  983. DebugPrintTrace(( "REGEDT32: Unable to initialize RequirementsList \n" ));
  984. return FALSE;
  985. }
  986. if( !InterfaceType.Initialize( s_IndentString ) ||
  987. !InterfaceType.Strcat( s_StringIoInterfaceType ) ||
  988. !BusNumber.Initialize( s_IndentString ) ||
  989. !BusNumber.Strcat( s_StringIoBusNumber ) ||
  990. !SlotNumber.Initialize( s_IndentString ) ||
  991. !SlotNumber.Strcat( s_StringIoSlotNumber )
  992. ) {
  993. DebugPrint( "REGEDT32: Initialization failure" );
  994. return FALSE;
  995. }
  996. //
  997. // Print the interface type
  998. //
  999. switch( RequirementsList.GetInterfaceType() ) {
  1000. case Internal:
  1001. InterfaceId = IDS_BUS_INTERNAL;
  1002. break;
  1003. case Isa:
  1004. InterfaceId = IDS_BUS_ISA;
  1005. break;
  1006. case Eisa:
  1007. InterfaceId = IDS_BUS_EISA;
  1008. break;
  1009. case MicroChannel:
  1010. InterfaceId = IDS_BUS_MICRO_CHANNEL;
  1011. break;
  1012. case TurboChannel:
  1013. InterfaceId = IDS_BUS_TURBO_CHANNEL;
  1014. break;
  1015. case PCIBus:
  1016. InterfaceId = IDS_BUS_PCI_BUS;
  1017. break;
  1018. case VMEBus:
  1019. InterfaceId = IDS_BUS_VME_BUS;
  1020. break;
  1021. case NuBus:
  1022. InterfaceId = IDS_BUS_NU_BUS;
  1023. break;
  1024. case PCMCIABus:
  1025. InterfaceId = IDS_BUS_PCMCIA_BUS;
  1026. break;
  1027. case CBus:
  1028. InterfaceId = IDS_BUS_C_BUS;
  1029. break;
  1030. case MPIBus:
  1031. InterfaceId = IDS_BUS_MPI_BUS;
  1032. break;
  1033. case MPSABus:
  1034. InterfaceId = IDS_BUS_MPSA_BUS;
  1035. break;
  1036. default:
  1037. InterfaceId = IDS_INVALID;
  1038. break;
  1039. }
  1040. TypeString = REGEDIT_BASE_SYSTEM::QueryString( InterfaceId, "" );
  1041. if( TypeString == NULL ) {
  1042. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  1043. return FALSE;
  1044. }
  1045. InterfaceType.Strcat( TypeString );
  1046. DELETE( TypeString );
  1047. if( !PrintString( &InterfaceType ) ) {
  1048. return FALSE;
  1049. }
  1050. PrintNewLine();
  1051. //
  1052. // Print the bus number
  1053. //
  1054. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", RequirementsList.GetBusNumber() );
  1055. if( !AuxString.Initialize( AuxNumber ) ) {
  1056. DebugPrint( "AuxString.Initialize() failed" );
  1057. return FALSE;
  1058. }
  1059. BusNumber.Strcat( &AuxString );
  1060. if( !PrintString( &BusNumber ) ) {
  1061. return FALSE;
  1062. }
  1063. PrintNewLine();
  1064. //
  1065. // Print the slot number
  1066. //
  1067. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", RequirementsList.GetSlotNumber() );
  1068. if( !AuxString.Initialize( AuxNumber ) ) {
  1069. DebugPrint( "AuxString.Initialize() failed" );
  1070. return FALSE;
  1071. }
  1072. SlotNumber.Strcat( &AuxString );
  1073. if( !PrintString( &SlotNumber ) ) {
  1074. return FALSE;
  1075. }
  1076. PrintNewLine();
  1077. //
  1078. // Print the resource lists
  1079. //
  1080. if( ( ( AlternativeLists = RequirementsList.GetAlternativeLists() ) == NULL ) ||
  1081. ( ( Iterator = AlternativeLists->QueryIterator() ) == NULL ) ) {
  1082. DebugPrintTrace(( "REGEDT32: Out of memory! \n" ));
  1083. return FALSE;
  1084. }
  1085. ListNumber = 0;
  1086. while( ( ResourceList = ( PCIO_DESCRIPTOR_LIST )( Iterator->GetNext() ) ) != NULL ) {
  1087. if( !_PrintIoResourceList( ResourceList, ListNumber ) ) {
  1088. DELETE( Iterator );
  1089. return FALSE;
  1090. }
  1091. ListNumber++;
  1092. }
  1093. DELETE( Iterator );
  1094. return TRUE;
  1095. }
  1096. //------------------------------------------------------------------------------
  1097. // PrintIoResourceList
  1098. //
  1099. // DESCRIPTION: Print the contents of an IO_DESCRIPTOR_LIST object.
  1100. //
  1101. // PARAMETERS: Descriptor - Pointer to object to be printed.
  1102. //------------------------------------------------------------------------------
  1103. BOOL PRINT_RESOURCE::_PrintIoResourceList(PCIO_DESCRIPTOR_LIST DescriptorList, UINT ListNumber)
  1104. {
  1105. DSTRING ListNumberString;
  1106. DSTRING AuxString;
  1107. WCHAR AuxNumber[11];
  1108. PARRAY Descriptors;
  1109. PITERATOR Iterator;
  1110. PCIO_DESCRIPTOR IoDescriptor;
  1111. ULONG Count;
  1112. if( !ListNumberString.Initialize( s_IndentString ) ||
  1113. !ListNumberString.Strcat( s_StringIoListNumber )
  1114. ) {
  1115. DebugPrint( "REGEDT32: Initialization failure" );
  1116. return FALSE;
  1117. }
  1118. //
  1119. // Build a string that contains the list number
  1120. // and print it
  1121. //
  1122. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", ListNumber );
  1123. if( !AuxString.Initialize( AuxNumber ) ) {
  1124. DebugPrint( "AuxString.Initialize() failed" );
  1125. return FALSE;
  1126. }
  1127. ListNumberString.Strcat( &AuxString );
  1128. if( !PrintString( &ListNumberString ) ) {
  1129. return FALSE;
  1130. }
  1131. PrintNewLine();
  1132. Descriptors = DescriptorList->GetDescriptorsList();
  1133. if( ( Descriptors == NULL ) ||
  1134. ( ( Iterator = Descriptors->QueryIterator() ) == NULL )
  1135. ) {
  1136. return FALSE;
  1137. }
  1138. Count = 0;
  1139. while( ( IoDescriptor = ( PCIO_DESCRIPTOR )( Iterator->GetNext() ) ) != NULL ) {
  1140. if( !_PrintIoDescriptor( IoDescriptor, Count ) ) {
  1141. DELETE( Iterator );
  1142. return FALSE;
  1143. }
  1144. Count++;
  1145. }
  1146. DELETE( Iterator );
  1147. PrintNewLine();
  1148. return TRUE;
  1149. }
  1150. //------------------------------------------------------------------------------
  1151. // PrintIoDescriptor
  1152. //
  1153. // DESCRIPTION: Print the contents of an IO_DESCRIPTOR object.
  1154. //
  1155. // PARAMETERS: Descriptor - Pointer to object to be printed.
  1156. //------------------------------------------------------------------------------
  1157. BOOL PRINT_RESOURCE::_PrintIoDescriptor(PCIO_DESCRIPTOR IoDescriptor, ULONG DescriptorNumber)
  1158. {
  1159. DSTRING IoDescriptorNumberString;
  1160. DSTRING AuxString;
  1161. WCHAR AuxNumber[11];
  1162. DSTRING ResourceString;
  1163. DSTRING DispositionString;
  1164. DSTRING OptionString;
  1165. ULONG StringId;
  1166. PWSTRING String;
  1167. if( !IoDescriptorNumberString.Initialize( s_IndentString ) ||
  1168. !IoDescriptorNumberString.Strcat( s_StringIoDescriptorNumber ) ||
  1169. !ResourceString.Initialize( s_IndentString ) ||
  1170. !ResourceString.Strcat( s_StringResource ) ||
  1171. !OptionString.Initialize( s_IndentString ) ||
  1172. !OptionString.Strcat( s_StringIoOption ) ||
  1173. !DispositionString.Initialize( s_IndentString ) ||
  1174. !DispositionString.Strcat( s_StringDisposition )
  1175. ) {
  1176. DebugPrint( "REGEDT32: Initialization failure" );
  1177. return FALSE;
  1178. }
  1179. //
  1180. // Build a string that contains the full descriptor number
  1181. // and print it
  1182. //
  1183. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%d", DescriptorNumber );
  1184. if( !AuxString.Initialize( AuxNumber ) ) {
  1185. DebugPrint( "AuxString.Initialize() failed" );
  1186. return FALSE;
  1187. }
  1188. IoDescriptorNumberString.Strcat( &AuxString );
  1189. if( !PrintString( &IoDescriptorNumberString ) ) {
  1190. return FALSE;
  1191. }
  1192. PrintNewLine();
  1193. //
  1194. // Print the resource type
  1195. //
  1196. if( IoDescriptor->IsDescriptorTypeDma() ) {
  1197. StringId = IDS_DEV_DMA;
  1198. } else if( IoDescriptor->IsDescriptorTypeInterrupt() ) {
  1199. StringId = IDS_DEV_INTERRUPT;
  1200. } else if( IoDescriptor->IsDescriptorTypeMemory() ) {
  1201. StringId = IDS_DEV_MEMORY;
  1202. } else if( IoDescriptor->IsDescriptorTypePort() ) {
  1203. StringId = IDS_DEV_PORT;
  1204. } else {
  1205. StringId = IDS_INVALID;
  1206. }
  1207. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  1208. if( String == NULL )
  1209. {
  1210. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  1211. return FALSE;
  1212. }
  1213. ResourceString.Strcat( String );
  1214. DELETE( String );
  1215. if( !PrintString( &ResourceString ) ) {
  1216. return FALSE;
  1217. }
  1218. PrintNewLine();
  1219. //
  1220. // Print the option
  1221. //
  1222. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"0x%08x", IoDescriptor->GetOption() );
  1223. if( !AuxString.Initialize( AuxNumber ) ) {
  1224. DebugPrint( "AuxString.Initialize() failed" );
  1225. return FALSE;
  1226. }
  1227. OptionString.Strcat( &AuxString );
  1228. if( !PrintString( &OptionString ) ) {
  1229. return FALSE;
  1230. }
  1231. PrintNewLine();
  1232. //
  1233. // Print the disposition
  1234. //
  1235. if( IoDescriptor->IsResourceShareUndetermined() ) {
  1236. StringId = IDS_SHARE_UNDETERMINED;
  1237. } else if( IoDescriptor->IsResourceShareDeviceExclusive() ) {
  1238. StringId = IDS_SHARE_DEVICE_EXCLUSIVE;
  1239. } else if( IoDescriptor->IsResourceShareDriverExclusive() ) {
  1240. StringId = IDS_SHARE_DRIVER_EXCLUSIVE;
  1241. } else {
  1242. StringId = IDS_SHARE_SHARED;
  1243. }
  1244. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  1245. if( String == NULL ) {
  1246. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  1247. return FALSE;
  1248. }
  1249. DispositionString.Strcat( String );
  1250. DELETE( String );
  1251. if( !PrintString( &DispositionString ) ) {
  1252. return FALSE;
  1253. }
  1254. PrintNewLine();
  1255. if( IoDescriptor->IsDescriptorTypeDma() ) {
  1256. if( !_PrintIoDmaDescriptor( ( PCIO_DMA_DESCRIPTOR )IoDescriptor ) ) {
  1257. return FALSE;
  1258. }
  1259. } else if( IoDescriptor->IsDescriptorTypeInterrupt() ) {
  1260. if( !_PrintIoInterruptDescriptor( ( PCIO_INTERRUPT_DESCRIPTOR )IoDescriptor ) ) {
  1261. return FALSE;
  1262. }
  1263. } else if( IoDescriptor->IsDescriptorTypeMemory() ) {
  1264. if( !_PrintIoMemoryDescriptor( ( PCIO_MEMORY_DESCRIPTOR )IoDescriptor ) ) {
  1265. return FALSE;
  1266. }
  1267. } else if( IoDescriptor->IsDescriptorTypePort() ) {
  1268. if( !_PrintIoPortDescriptor( ( PCIO_PORT_DESCRIPTOR )IoDescriptor ) ) {
  1269. return FALSE;
  1270. }
  1271. }
  1272. PrintNewLine();
  1273. return TRUE;
  1274. }
  1275. //------------------------------------------------------------------------------
  1276. // PrintIoInterruptDescriptor
  1277. //
  1278. // DESCRIPTION: Print the contents of an IO_INTERRUPT_DESCRIPTOR object.
  1279. //
  1280. // PARAMETERS: Descriptor - Pointer to object to be printed.
  1281. //------------------------------------------------------------------------------
  1282. BOOL PRINT_RESOURCE::_PrintIoInterruptDescriptor(PCIO_INTERRUPT_DESCRIPTOR Descriptor)
  1283. {
  1284. DSTRING MinimumVectorString;
  1285. DSTRING MaximumVectorString;
  1286. DSTRING TypeString;
  1287. DSTRING AuxString;
  1288. WCHAR AuxNumber[19];
  1289. ULONG StringId;
  1290. PWSTRING String;
  1291. if( !MinimumVectorString.Initialize( s_IndentString ) ||
  1292. !MinimumVectorString.Strcat( s_StringIoMinimumVector ) ||
  1293. !MaximumVectorString.Initialize( s_IndentString ) ||
  1294. !MaximumVectorString.Strcat( s_StringIoMaximumVector ) ||
  1295. !TypeString.Initialize( s_IndentString ) ||
  1296. !TypeString.Strcat( s_StringType )
  1297. ) {
  1298. DebugPrint( "REGEDT32: Initialization failure" );
  1299. return FALSE;
  1300. }
  1301. //
  1302. // Print the type
  1303. //
  1304. StringId = ( Descriptor->IsInterruptLevelSensitive() )? IDS_INT_LEVEL_SENSITIVE :
  1305. IDS_INT_LATCHED;
  1306. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  1307. if( String == NULL ) {
  1308. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  1309. return FALSE;
  1310. }
  1311. TypeString.Strcat( String );
  1312. DELETE( String );
  1313. if( !PrintString( &TypeString ) ) {
  1314. return FALSE;
  1315. }
  1316. PrintNewLine();
  1317. //
  1318. // Print the minimum vector
  1319. //
  1320. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetMinimumVector() );
  1321. if( !AuxString.Initialize( AuxNumber ) ) {
  1322. DebugPrint( "AuxString.Initialize() failed" );
  1323. return FALSE;
  1324. }
  1325. MinimumVectorString.Strcat( &AuxString );
  1326. if( !PrintString( &MinimumVectorString ) ) {
  1327. return FALSE;
  1328. }
  1329. PrintNewLine();
  1330. //
  1331. // Print the maximum vector
  1332. //
  1333. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetMaximumVector() );
  1334. if( !AuxString.Initialize( AuxNumber ) ) {
  1335. DebugPrint( "AuxString.Initialize() failed" );
  1336. return FALSE;
  1337. }
  1338. MaximumVectorString.Strcat( &AuxString );
  1339. if( !PrintString( &MaximumVectorString ) ) {
  1340. return FALSE;
  1341. }
  1342. PrintNewLine();
  1343. return TRUE;
  1344. }
  1345. //------------------------------------------------------------------------------
  1346. // PrintIoPortDescriptor
  1347. //
  1348. // DESCRIPTION: Print the contents of an IO_PORT_DESCRIPTOR object.
  1349. //
  1350. // PARAMETERS: Descriptor - Pointer to object to be printed.
  1351. //------------------------------------------------------------------------------
  1352. BOOL PRINT_RESOURCE::_PrintIoPortDescriptor(PCIO_PORT_DESCRIPTOR Descriptor)
  1353. {
  1354. DSTRING MinimumAddressString;
  1355. DSTRING MaximumAddressString;
  1356. DSTRING LengthString;
  1357. DSTRING AlignmentString;
  1358. DSTRING TypeString;
  1359. DSTRING AuxString;
  1360. WCHAR AuxNumber[19];
  1361. ULONG StringId;
  1362. PWSTRING String;
  1363. if( !MinimumAddressString.Initialize( s_IndentString ) ||
  1364. !MinimumAddressString.Strcat( s_StringIoMinimumAddress ) ||
  1365. !MaximumAddressString.Initialize( s_IndentString ) ||
  1366. !MaximumAddressString.Strcat( s_StringIoMaximumAddress ) ||
  1367. !LengthString.Initialize( s_IndentString ) ||
  1368. !LengthString.Strcat( s_StringLength ) ||
  1369. !AlignmentString.Initialize( s_IndentString ) ||
  1370. !AlignmentString.Strcat( s_StringIoAlignment ) ||
  1371. !TypeString.Initialize( s_IndentString ) ||
  1372. !TypeString.Strcat( s_StringType )
  1373. ) {
  1374. DebugPrint( "REGEDT32: Initialization failure" );
  1375. return FALSE;
  1376. }
  1377. //
  1378. // Print the type
  1379. //
  1380. StringId = ( Descriptor->IsPortMemory() )? IDS_PORT_MEMORY :
  1381. IDS_PORT_PORT;
  1382. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  1383. if( String == NULL ) {
  1384. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  1385. return FALSE;
  1386. }
  1387. TypeString.Strcat( String );
  1388. DELETE( String );
  1389. if( !PrintString( &TypeString ) ) {
  1390. return FALSE;
  1391. }
  1392. PrintNewLine();
  1393. //
  1394. // Print the length
  1395. //
  1396. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetLength() );
  1397. if( !AuxString.Initialize( AuxNumber ) ) {
  1398. DebugPrint( "AuxString.Initialize() failed" );
  1399. return FALSE;
  1400. }
  1401. LengthString.Strcat( &AuxString );
  1402. if( !PrintString( &LengthString ) ) {
  1403. return FALSE;
  1404. }
  1405. PrintNewLine();
  1406. //
  1407. // Print the alignment
  1408. //
  1409. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetAlignment() );
  1410. if( !AuxString.Initialize( AuxNumber ) ) {
  1411. DebugPrint( "AuxString.Initialize() failed" );
  1412. return FALSE;
  1413. }
  1414. AlignmentString.Strcat( &AuxString );
  1415. if( !PrintString( &AlignmentString ) ) {
  1416. return FALSE;
  1417. }
  1418. PrintNewLine();
  1419. //
  1420. // Print the minimum address
  1421. //
  1422. if( ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->HighPart != 0 )
  1423. {
  1424. StringCchPrintf( AuxNumber,
  1425. ARRAYSIZE(AuxNumber),
  1426. (LPWSTR)L"0x%08x%08x",
  1427. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->HighPart,
  1428. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->LowPart );
  1429. }
  1430. else
  1431. {
  1432. StringCchPrintf( AuxNumber,
  1433. ARRAYSIZE(AuxNumber),
  1434. (LPWSTR)L"0x%08x",
  1435. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->LowPart );
  1436. }
  1437. if( !AuxString.Initialize( AuxNumber ) ) {
  1438. DebugPrint( "AuxString.Initialize() failed" );
  1439. return FALSE;
  1440. }
  1441. MinimumAddressString.Strcat( &AuxString );
  1442. if( !PrintString( &MinimumAddressString ) ) {
  1443. return FALSE;
  1444. }
  1445. PrintNewLine();
  1446. //
  1447. // Print the maximum address
  1448. //
  1449. if( ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->HighPart != 0 ) {
  1450. StringCchPrintf( AuxNumber,
  1451. ARRAYSIZE(AuxNumber),
  1452. (LPWSTR)L"0x%08x%08x",
  1453. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->HighPart,
  1454. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->LowPart );
  1455. }
  1456. else
  1457. {
  1458. StringCchPrintf( AuxNumber,
  1459. ARRAYSIZE(AuxNumber),
  1460. (LPWSTR)L"0x%08x",
  1461. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->LowPart );
  1462. }
  1463. if( !AuxString.Initialize( AuxNumber ) ) {
  1464. DebugPrint( "AuxString.Initialize() failed" );
  1465. return FALSE;
  1466. }
  1467. MaximumAddressString.Strcat( &AuxString );
  1468. if( !PrintString( &MaximumAddressString ) ) {
  1469. return FALSE;
  1470. }
  1471. PrintNewLine();
  1472. return TRUE;
  1473. }
  1474. //------------------------------------------------------------------------------
  1475. // PrintIoMemoryDescriptor
  1476. //
  1477. // DESCRIPTION: Print the contents of an IO_MEMORY_DESCRIPTOR object.
  1478. //
  1479. // PARAMETERS: Descriptor - Pointer to object to be printed.
  1480. //------------------------------------------------------------------------------
  1481. BOOL PRINT_RESOURCE::_PrintIoMemoryDescriptor(PCIO_MEMORY_DESCRIPTOR Descriptor)
  1482. {
  1483. DSTRING MinimumAddressString;
  1484. DSTRING MaximumAddressString;
  1485. DSTRING LengthString;
  1486. DSTRING AlignmentString;
  1487. DSTRING TypeString;
  1488. DSTRING AuxString;
  1489. WCHAR AuxNumber[19];
  1490. ULONG StringId;
  1491. PWSTRING String;
  1492. if( !MinimumAddressString.Initialize( s_IndentString ) ||
  1493. !MinimumAddressString.Strcat( s_StringIoMinimumAddress ) ||
  1494. !MaximumAddressString.Initialize( s_IndentString ) ||
  1495. !MaximumAddressString.Strcat( s_StringIoMaximumAddress ) ||
  1496. !LengthString.Initialize( s_IndentString ) ||
  1497. !LengthString.Strcat( s_StringLength ) ||
  1498. !AlignmentString.Initialize( s_IndentString ) ||
  1499. !AlignmentString.Strcat( s_StringIoAlignment ) ||
  1500. !TypeString.Initialize( s_IndentString ) ||
  1501. !TypeString.Strcat( s_StringType )
  1502. ) {
  1503. DebugPrint( "REGEDT32: Initialization failure" );
  1504. return FALSE;
  1505. }
  1506. //
  1507. // Print the type
  1508. //
  1509. StringId = ( Descriptor->IsMemoryReadWrite() )? IDS_MEM_READ_WRITE :
  1510. ( ( Descriptor->IsMemoryReadWrite() )? IDS_MEM_READ_ONLY :
  1511. IDS_MEM_WRITE_ONLY );
  1512. String = REGEDIT_BASE_SYSTEM::QueryString( StringId, "" );
  1513. if( String == NULL ) {
  1514. DebugPrintTrace(( "REGEDT32: Unable to retrieve string \n" ));
  1515. return FALSE;
  1516. }
  1517. TypeString.Strcat( String );
  1518. DELETE( String );
  1519. if( !PrintString( &TypeString ) ) {
  1520. return FALSE;
  1521. }
  1522. PrintNewLine();
  1523. //
  1524. // Print the length
  1525. //
  1526. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetLength() );
  1527. if( !AuxString.Initialize( AuxNumber ) ) {
  1528. DebugPrint( "AuxString.Initialize() failed" );
  1529. return FALSE;
  1530. }
  1531. LengthString.Strcat( &AuxString );
  1532. if( !PrintString( &LengthString ) ) {
  1533. return FALSE;
  1534. }
  1535. PrintNewLine();
  1536. //
  1537. // Print the alignment
  1538. //
  1539. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetAlignment() );
  1540. if( !AuxString.Initialize( AuxNumber ) ) {
  1541. DebugPrint( "AuxString.Initialize() failed" );
  1542. return FALSE;
  1543. }
  1544. AlignmentString.Strcat( &AuxString );
  1545. if( !PrintString( &AlignmentString ) ) {
  1546. return FALSE;
  1547. }
  1548. PrintNewLine();
  1549. //
  1550. // Print the minimum address
  1551. //
  1552. if( ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->HighPart != 0 )
  1553. {
  1554. StringCchPrintf( AuxNumber,
  1555. ARRAYSIZE(AuxNumber),
  1556. (LPWSTR)L"0x%08x%08x",
  1557. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->HighPart,
  1558. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->LowPart );
  1559. }
  1560. else
  1561. {
  1562. StringCchPrintf( AuxNumber,
  1563. ARRAYSIZE(AuxNumber),
  1564. (LPWSTR)L"0x%08x",
  1565. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMinimumAddress() )->LowPart );
  1566. }
  1567. if( !AuxString.Initialize( AuxNumber ) ) {
  1568. DebugPrint( "AuxString.Initialize() failed" );
  1569. return FALSE;
  1570. }
  1571. MinimumAddressString.Strcat( &AuxString );
  1572. if( !PrintString( &MinimumAddressString ) ) {
  1573. return FALSE;
  1574. }
  1575. PrintNewLine();
  1576. //
  1577. // Print the maximum address
  1578. //
  1579. if( ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->HighPart != 0 )
  1580. {
  1581. StringCchPrintf( AuxNumber,
  1582. ARRAYSIZE(AuxNumber),
  1583. (LPWSTR)L"0x%08x%08x",
  1584. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->HighPart,
  1585. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->LowPart );
  1586. }
  1587. else
  1588. {
  1589. StringCchPrintf( AuxNumber,
  1590. ARRAYSIZE(AuxNumber),
  1591. (LPWSTR)L"0x%08x",
  1592. ( ( ( PIO_PORT_DESCRIPTOR )Descriptor )->GetMaximumAddress() )->LowPart );
  1593. }
  1594. if( !AuxString.Initialize( AuxNumber ) ) {
  1595. DebugPrint( "AuxString.Initialize() failed" );
  1596. return FALSE;
  1597. }
  1598. MaximumAddressString.Strcat( &AuxString );
  1599. if( !PrintString( &MaximumAddressString ) ) {
  1600. return FALSE;
  1601. }
  1602. PrintNewLine();
  1603. return TRUE;
  1604. }
  1605. //------------------------------------------------------------------------------
  1606. // PrintIoDmaDescriptor
  1607. //
  1608. // DESCRIPTION: Print the contents of an IO_DMA_DESCRIPTOR object.
  1609. //
  1610. // PARAMETERS: Descriptor - Pointer to object to be printed.
  1611. //------------------------------------------------------------------------------
  1612. BOOL PRINT_RESOURCE::_PrintIoDmaDescriptor(PCIO_DMA_DESCRIPTOR Descriptor)
  1613. {
  1614. DSTRING MinimumChannelString;
  1615. DSTRING MaximumChannelString;
  1616. DSTRING AuxString;
  1617. WCHAR AuxNumber[19];
  1618. if( !MinimumChannelString.Initialize( s_IndentString ) ||
  1619. !MinimumChannelString.Strcat( s_StringIoMinimumChannel ) ||
  1620. !MaximumChannelString.Initialize( s_IndentString ) ||
  1621. !MaximumChannelString.Strcat( s_StringIoMaximumChannel )
  1622. ) {
  1623. DebugPrint( "REGEDT32: Initialization failure" );
  1624. return FALSE;
  1625. }
  1626. //
  1627. // Print the minimum channel
  1628. //
  1629. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetMinimumChannel() );
  1630. if( !AuxString.Initialize( AuxNumber ) ) {
  1631. DebugPrint( "AuxString.Initialize() failed" );
  1632. return FALSE;
  1633. }
  1634. MinimumChannelString.Strcat( &AuxString );
  1635. if( !PrintString( &MinimumChannelString ) ) {
  1636. return FALSE;
  1637. }
  1638. PrintNewLine();
  1639. //
  1640. // Print the maximum channel
  1641. //
  1642. StringCchPrintf( AuxNumber, ARRAYSIZE(AuxNumber), (LPWSTR)L"%#x", Descriptor->GetMaximumChannel() );
  1643. if( !AuxString.Initialize( AuxNumber ) ) {
  1644. DebugPrint( "AuxString.Initialize() failed" );
  1645. return FALSE;
  1646. }
  1647. MaximumChannelString.Strcat( &AuxString );
  1648. if( !PrintString( &MaximumChannelString ) ) {
  1649. return FALSE;
  1650. }
  1651. PrintNewLine();
  1652. return TRUE;
  1653. }