00560 {
00561 PULONG p;
00562 PWSTR pw, pw1;
00563 ULONG i, j, k, m, cbPrefix;
00564 UNICODE_STRING
ValueName;
00565 PUCHAR pbyte;
00566
00567 cbPrefix = fprintf( fh,
"%.*s",
00568 IndentLevel,
00569
" "
00570 );
00571
ValueName.Buffer = (PWSTR)&(KeyValueInformation->Name[0]);
00572
ValueName.Length = (
USHORT)KeyValueInformation->NameLength;
00573
ValueName.MaximumLength = (
USHORT)KeyValueInformation->NameLength;
00574
00575
if (
ValueName.Length) {
00576 cbPrefix += fprintf( fh,
"%wZ ", &ValueName );
00577 }
00578 cbPrefix += fprintf( fh,
"= " );
00579
00580
if (KeyValueInformation->DataLength == 0) {
00581 fprintf( fh,
" [no data] \n");
00582
return;
00583 }
00584
00585
switch( KeyValueInformation->Type ) {
00586
case REG_SZ:
00587
case REG_EXPAND_SZ:
00588
00589
if (KeyValueInformation->Type == REG_EXPAND_SZ) {
00590 cbPrefix += fprintf( fh,
"REG_EXPAND_SZ " );
00591 }
00592 pw = (PWSTR)((PCHAR)KeyValueInformation + KeyValueInformation->DataOffset);
00593 *(PWSTR)((PCHAR)pw + KeyValueInformation->DataLength) = UNICODE_NULL;
00594 i = 0;
00595
while (*pw) {
00596
if ((cbPrefix + wcslen(pw)) > 80) {
00597 pw1 = pw;
00598
while (*pw1 && *pw1 >
L' ') {
00599 pw1++;
00600 }
00601
00602
if (*pw1) {
00603 *pw1++ = UNICODE_NULL;
00604
while (*pw1 && *pw1 <=
L' ') {
00605 pw1++;
00606 }
00607 }
00608 }
else {
00609 pw1 =
NULL;
00610 }
00611
if (i > 0) {
00612 fprintf( fh,
" \\\n%.*s",
00613 cbPrefix,
00614
" "
00615 );
00616 }
00617
00618 fprintf( fh,
"%ws", pw );
00619
if (!pw1) {
00620
break;
00621 }
00622 i++;
00623 pw = pw1;
00624 }
00625
break;
00626
00627
case REG_BINARY:
00628 fprintf( fh,
"REG_BINARY 0x%08lx", KeyValueInformation->DataLength );
00629 p = (PULONG)((PCHAR)KeyValueInformation + KeyValueInformation->DataOffset);
00630 i = (KeyValueInformation->DataLength + 3) /
sizeof( ULONG );
00631
if (!
SummaryOutput || i <= 8) {
00632
for (j=0; j<i; j++) {
00633
if ((j % 8) == 0) {
00634 fprintf( fh,
"\n%.*s",
00635 IndentLevel+4,
00636
" "
00637 );
00638 }
00639
00640 fprintf( fh,
"0x%08lx ", *p++ );
00641 }
00642 }
00643
else {
00644 fprintf( fh,
" *** value display suppressed ***" );
00645 }
00646 fprintf( fh,
"\n" );
00647
break;
00648
00649
00650
case REG_DWORD:
00651 fprintf( fh,
"REG_DWORD 0x%08lx",
00652 *((PULONG)((PCHAR)KeyValueInformation + KeyValueInformation->DataOffset))
00653 );
00654
break;
00655
00656
case REG_DWORD_BIG_ENDIAN:
00657 fprintf( fh,
"REG_DWORD_BIG_ENDIAN 0x%08lx",
00658 *((PULONG)((PCHAR)KeyValueInformation + KeyValueInformation->DataOffset))
00659 );
00660
break;
00661
00662
case REG_LINK:
00663 fprintf( fh,
"REG_LINK %ws",
00664 ((PWSTR)((PCHAR)KeyValueInformation + KeyValueInformation->DataOffset))
00665 );
00666
break;
00667
00668
case REG_MULTI_SZ:
00669 cbPrefix += fprintf( fh,
"REG_MULTI_SZ " );
00670 pw = (PWSTR)((PCHAR)KeyValueInformation + KeyValueInformation->DataOffset);
00671 i = 0;
00672
if (*pw)
00673
while (i < ((KeyValueInformation->DataLength-1) /
sizeof(WCHAR))) {
00674
if (i > 0) {
00675 fprintf( fh,
" \\\n%.*s",
00676 cbPrefix,
00677
" "
00678 );
00679 }
00680 fprintf(fh,
"\"%ws\" ",pw+i);
00681
do {
00682 ++i;
00683 }
while ( pw[i] != UNICODE_NULL );
00684 ++i;
00685 }
00686
break;
00687
00688
case REG_RESOURCE_LIST:
00689
case REG_FULL_RESOURCE_DESCRIPTOR:
00690 {
00691 PCM_RESOURCE_LIST ResourceList = ((PCM_RESOURCE_LIST)((PCHAR)KeyValueInformation +
00692 KeyValueInformation->DataOffset));
00693 PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
00694 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialResourceDescriptor;
00695 ULONG k, l, count;
00696 PWSTR TypeName;
00697 PWSTR FlagName;
00698 ULONG
Size = KeyValueInformation->DataLength;
00699
00700
if (KeyValueInformation->Type == REG_RESOURCE_LIST) {
00701
00702 fprintf( fh,
" REG_RESOURCE_LIST\n");
00703
00704 fprintf( fh,
"%.*sNumber of Full resource Descriptors = %d",
00705 IndentLevel,
00706
" ",
00707 ResourceList->Count
00708 );
00709
00710 count = ResourceList->Count;
00711 FullDescriptor = &ResourceList->List[0];
00712
00713 }
else {
00714
00715 fprintf( fh,
" REG_FULL_RESOURCE_DESCRIPTOR\n");
00716 count = 1;
00717 FullDescriptor = ((PCM_FULL_RESOURCE_DESCRIPTOR)
00718 ((PCHAR)KeyValueInformation + KeyValueInformation->DataOffset));
00719
00720 }
00721
00722
for (i=0; i< count; i++) {
00723
00724 fprintf( fh,
"\n%.*sPartial List number %d\n",
00725 IndentLevel+4,
00726
" ",
00727 i
00728 );
00729
00730
switch(FullDescriptor->InterfaceType) {
00731
00732
case Internal: TypeName =
L"Internal";
break;
00733
case Isa: TypeName =
L"Isa";
break;
00734
case Eisa: TypeName =
L"Eisa";
break;
00735
case MicroChannel: TypeName =
L"MicroChannel";
break;
00736
case TurboChannel: TypeName =
L"TurboChannel";
break;
00737
case PCIBus: TypeName =
L"PCI";
break;
00738
case VMEBus: TypeName =
L"VME";
break;
00739
case NuBus: TypeName =
L"NuBus";
break;
00740
case PCMCIABus: TypeName =
L"PCMCIA";
break;
00741
case CBus: TypeName =
L"CBUS";
break;
00742
case MPIBus: TypeName =
L"MPI";
break;
00743
00744
default:
00745 TypeName =
L"***invalid bus type***";
00746
break;
00747 }
00748
00749 fprintf( fh,
"%.*sINTERFACE_TYPE %ws\n",
00750 IndentLevel+8,
00751
" ",
00752 TypeName
00753 );
00754
00755 fprintf( fh,
"%.*sBUS_NUMBER %d\n",
00756 IndentLevel+8,
00757
" ",
00758 FullDescriptor->BusNumber
00759 );
00760
00761
00762
00763
00764
00765
00766
if (
Size < FullDescriptor->PartialResourceList.Count *
00767
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) ) {
00768
00769 fprintf( fh,
"\n%.*s *** !!! Invalid ResourceList !!! *** \n",
00770 IndentLevel+8,
00771
" ",
00772 i
00773 );
00774
00775
break;
00776 }
00777
00778
Size -= FullDescriptor->PartialResourceList.Count *
00779
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
00780
00781
00782
00783
for (j=0; j<FullDescriptor->PartialResourceList.Count; j++) {
00784
00785 fprintf( fh,
"%.*sDescriptor number %d\n",
00786 IndentLevel+12,
00787
" ",
00788 j
00789 );
00790
00791 PartialResourceDescriptor =
00792 &(FullDescriptor->PartialResourceList.PartialDescriptors[j]);
00793
00794
switch(PartialResourceDescriptor->ShareDisposition) {
00795
00796
case CmResourceShareUndetermined:
00797 TypeName =
L"CmResourceShareUndetermined";
00798
break;
00799
case CmResourceShareDeviceExclusive:
00800 TypeName =
L"CmResourceDeviceExclusive";
00801
break;
00802
case CmResourceShareDriverExclusive:
00803 TypeName =
L"CmResourceDriverExclusive";
00804
break;
00805
case CmResourceShareShared:
00806 TypeName =
L"CmResourceShared";
00807
break;
00808
default:
00809 TypeName =
L"***invalid share disposition***";
00810
break;
00811 }
00812
00813 fprintf( fh,
"%.*sShare Disposition %ws\n",
00814 IndentLevel+12,
00815
" ",
00816 TypeName
00817 );
00818
00819 FlagName =
L"***invalid Flags";
00820
00821
switch(PartialResourceDescriptor->Type) {
00822
00823
case CmResourceTypeNull:
00824 TypeName =
L"NULL";
00825 FlagName =
L"***Unused";
00826
break;
00827
case CmResourceTypePort:
00828 TypeName =
L"PORT";
00829
if (PartialResourceDescriptor->Flags == CM_RESOURCE_PORT_MEMORY) {
00830 FlagName =
L"CM_RESOURCE_PORT_MEMORY";
00831 }
00832
if (PartialResourceDescriptor->Flags == CM_RESOURCE_PORT_IO) {
00833 FlagName =
L"CM_RESOURCE_PORT_IO";
00834 }
00835
break;
00836
case CmResourceTypeInterrupt:
00837 TypeName =
L"INTERRUPT";
00838
if (PartialResourceDescriptor->Flags == CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE) {
00839 FlagName =
L"CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE";
00840 }
00841
if (PartialResourceDescriptor->Flags == CM_RESOURCE_INTERRUPT_LATCHED) {
00842 FlagName =
L"CM_RESOURCE_INTERRUPT_LATCHED";
00843 }
00844
break;
00845
case CmResourceTypeMemory:
00846 TypeName =
L"MEMORY";
00847
if (PartialResourceDescriptor->Flags == CM_RESOURCE_MEMORY_READ_WRITE) {
00848 FlagName =
L"CM_RESOURCE_MEMORY_READ_WRITE";
00849 }
00850
if (PartialResourceDescriptor->Flags == CM_RESOURCE_MEMORY_READ_ONLY) {
00851 FlagName =
L"CM_RESOURCE_MEMORY_READ_ONLY";
00852 }
00853
if (PartialResourceDescriptor->Flags == CM_RESOURCE_MEMORY_WRITE_ONLY) {
00854 FlagName =
L"CM_RESOURCE_MEMORY_WRITE_ONLY";
00855 }
00856
break;
00857
case CmResourceTypeDma:
00858 TypeName =
L"DMA";
00859 FlagName =
L"***Unused";
00860
break;
00861
case CmResourceTypeDeviceSpecific:
00862 TypeName =
L"DEVICE SPECIFIC";
00863 FlagName =
L"***Unused";
00864
break;
00865
default:
00866 TypeName =
L"***invalid type***";
00867
break;
00868 }
00869
00870 fprintf( fh,
"%.*sTYPE %ws\n",
00871 IndentLevel+12,
00872
" ",
00873 TypeName
00874 );
00875
00876 fprintf( fh,
"%.*sFlags %ws\n",
00877 IndentLevel+12,
00878
" ",
00879 FlagName
00880 );
00881
00882
switch(PartialResourceDescriptor->Type) {
00883
00884
case CmResourceTypePort:
00885 fprintf( fh,
"%.*sSTART 0x%08lx LENGTH 0x%08lx\n",
00886 IndentLevel+12,
00887
" ",
00888 PartialResourceDescriptor->u.Port.Start.LowPart,
00889 PartialResourceDescriptor->u.Port.Length
00890 );
00891
break;
00892
00893
case CmResourceTypeInterrupt:
00894 fprintf( fh,
"%.*sLEVEL %d VECTOR %d AFFINITY %d\n",
00895 IndentLevel+12,
00896
" ",
00897 PartialResourceDescriptor->u.Interrupt.Level,
00898 PartialResourceDescriptor->u.Interrupt.Vector,
00899 PartialResourceDescriptor->u.Interrupt.Affinity
00900 );
00901
break;
00902
00903
case CmResourceTypeMemory:
00904 fprintf( fh,
"%.*sSTART 0x%08lx%08lx LENGTH 0x%08lx\n",
00905 IndentLevel+12,
00906
" ",
00907 PartialResourceDescriptor->u.Memory.Start.HighPart,
00908 PartialResourceDescriptor->u.Memory.Start.LowPart,
00909 PartialResourceDescriptor->u.Memory.Length
00910 );
00911
break;
00912
00913
case CmResourceTypeDma:
00914 fprintf( fh,
"%.*sCHANNEL %d PORT %d\n",
00915 IndentLevel+12,
00916
" ",
00917 PartialResourceDescriptor->u.Dma.Channel,
00918 PartialResourceDescriptor->u.Dma.Port
00919 );
00920
break;
00921
00922
case CmResourceTypeDeviceSpecific:
00923 fprintf( fh,
"%.*sDataSize 0x%08lx\n",
00924 IndentLevel+12,
00925
" ",
00926 PartialResourceDescriptor->u.DeviceSpecificData.DataSize
00927 );
00928
00929 p = (PULONG)(PartialResourceDescriptor + 1);
00930 k = (PartialResourceDescriptor->u.DeviceSpecificData.DataSize + 3) /
sizeof( ULONG );
00931
for (l=0; l<k; l++) {
00932
if ((l % 8) == 0) {
00933 fprintf( fh,
"\n%.*s",
00934 IndentLevel+12,
00935
" "
00936 );
00937 }
00938
00939 fprintf( fh,
"0x%08lx ", *p++ );
00940 }
00941 fprintf( fh,
"\n" );
00942
break;
00943
00944
default:
00945 fprintf( fh,
"%.*s*** Unknown resource list type: %c ****\n",
00946 IndentLevel+12,
00947
" ",
00948 PartialResourceDescriptor->Type
00949 );
00950
break;
00951 }
00952
00953 fprintf( fh,
"\n" );
00954 }
00955
00956 FullDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR) (PartialResourceDescriptor+1);
00957 }
00958
00959
break;
00960 }
00961
00962
case REG_NONE:
00963
default:
00964
if (KeyValueInformation->Type == REG_NONE) {
00965 fprintf( fh,
"REG_NONE\n");
00966 }
00967
else {
00968 fprintf( fh,
"*** Unknown registry type (%08lx)",
00969 KeyValueInformation->Type
00970 );
00971 }
00972 fprintf( fh,
"%.*s",
00973 IndentLevel,
00974
" "
00975 );
00976 fprintf( fh,
" Length: 0x%lx\n", KeyValueInformation->DataLength );
00977 fprintf( fh,
"\n%.*s",
00978 IndentLevel,
00979
" "
00980 );
00981 fprintf( fh,
" Data: ");
00982 pbyte = ((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset);
00983
for ( k=0, m=1; k<KeyValueInformation->DataLength; k++,m++) {
00984 fprintf( fh,
"%02x ", (*pbyte) );
00985 pbyte++;
00986
00987
if (m==8) {
00988 fprintf( fh,
"\n%.*s",
00989 IndentLevel+12,
00990
" "
00991 );
00992 m=0;
00993 }
00994 }
00995
break;
00996 }
00997
00998 fprintf( fh,
"\n" );
00999
return;
01000 }