#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ntddk.h>
#include <pshpack1.h>
#include <poppack.h>
Go to the source code of this file.
◆ CM_PNP_BIOS_DEVICE_NODE
◆ CM_PNP_BIOS_INSTALLATION_CHECK
◆ PCM_PNP_BIOS_DEVICE_NODE
◆ PCM_PNP_BIOS_INSTALLATION_CHECK
◆ PNP_ID_NAME
◆ PPNP_ID_NAME
◆ GetDeviceName()
static char * GetDeviceName |
( |
char * |
PnpId | ) |
|
|
static |
Definition at line 240 of file pnpdump.c.
241{
243
246 {
249
250 IdName++;
251 }
252
253 return "Unknown Device";
254}
int strcmp(const char *String1, const char *String2)
static PNP_ID_NAME PnpName[]
Referenced by PrintDeviceData().
◆ GetPnpKey()
Definition at line 258 of file pnpdump.c.
259{
261 char szBuffer[80];
267
268 *PnpKey = 0;
269
271 "HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter",
272 &hAdapterKey);
274 return 0;
275
276
277 for (dwBus = 0; ; dwBus++)
278 {
279 sprintf(szBuffer,
"%lu", dwBus);
280
282 szBuffer,
283 &hBusKey);
285 {
287 return lError;
288 }
289
292 "Identifier",
294 &dwType,
298 {
301 return lError;
302 }
303
305 {
306 *PnpKey = hBusKey;
309 }
310
312 }
313
314 return 1;
315}
#define RegCloseKey(hKey)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define sprintf(buf, format,...)
#define HKEY_LOCAL_MACHINE
Referenced by main().
◆ main()
Definition at line 670 of file pnpdump.c.
671{
681 DWORD dwResourceSize;
682
683 hPnpKey = 0;
684
687 {
689 }
690
692 {
693 printf(
"This utility prints the PnP-nodes from the registry\n");
694 printf(
"\"/s\" prevents the \"Press any key\"\n\n");
695 return 0;
696 }
697
700 {
701 printf(
"Failed to get PnP-BIOS key\n");
702 return 0;
703 }
704
705 if (hPnpKey != 0)
706 {
707 printf(
"Found PnP-BIOS key\n");
708 }
709
710
714 {
715 printf(
"Error: malloc() failed\n");
717 return 0;
718 }
719
720 do
721 {
723 "Configuration Data",
725 &dwType,
729 {
732 {
733 printf(
"Error: realloc() of %u bytes failed\n", (
unsigned)
dwSize);
735 return 0;
736 }
737 }
738 }
741 {
742 printf(
"Failed to read 'Configuration Data' value\n");
745 return 0;
746 }
747
748
749
751
752
753
754 if (
lpBuffer->PartialResourceList.Count == 0)
755 {
756 printf(
"Invalid resource count!\n");
758 return 0;
759 }
760
761
762
763 dwResourceSize =
lpBuffer->PartialResourceList.PartialDescriptors[0].u.DeviceSpecificData.DataSize;
764
765
769
770
771
774 {
775 printf(
"Error: Invalid PnP signature\n");
777 return 0;
778 }
779
780
781
784
785 if (lpDevNode->
Size == 0)
786 {
787 printf(
"Error: Device node size is zero!\n");
788 return 0;
789 }
790
791#if 0
792 printf(
"Node: %x Size %hu (0x%hx)\n",
796
798return 0;
799#endif
800
801
802 while (dwDataSize < dwResourceSize)
803 {
804 if (lpDevNode->
Size == 0)
805 break;
806
807 printf(
"Node: %x Size %hu (0x%hx)\n",
811
812 dwDataSize += lpDevNode->
Size;
814 }
815
816 if (Ask)
817 {
818 printf(
"\n Press any key...\n");
820 }
821 else
822 {
824 }
825
828
829 while (dwDataSize < dwResourceSize)
830 {
831 if (lpDevNode->
Size == 0)
832 break;
833
835
836 if (Ask)
837 {
838 printf(
"\n Press any key...\n");
840 }
841 else
842 {
844 }
845
846 dwDataSize += lpDevNode->
Size;
848 }
849
851
852 return 0;
853}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
struct _CM_PNP_BIOS_INSTALLATION_CHECK * PCM_PNP_BIOS_INSTALLATION_CHECK
struct _CM_PNP_BIOS_INSTALLATION_CHECK CM_PNP_BIOS_INSTALLATION_CHECK
LONG GetPnpKey(PHKEY PnpKey)
void PrintDeviceData(PCM_PNP_BIOS_DEVICE_NODE DeviceNode)
struct _CM_PNP_BIOS_DEVICE_NODE * PCM_PNP_BIOS_DEVICE_NODE
_Check_return_ _CRTIMP int __cdecl getch(void)
◆ PnpDecodeDma()
Definition at line 343 of file pnpdump.c.
344{
345 unsigned char DmaChannel;
346 unsigned char DmaStatus;
348
352
354
355 for (
i = 0;
i < 8;
i++)
356 {
357 if (DmaChannel & (1 <<
i))
358 {
360 }
361 }
362
364}
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Referenced by PrintDeviceData().
◆ PnpDecodeFixedIoPort()
Definition at line 396 of file pnpdump.c.
397{
400
403 IoPort += (*
Ptr << 8);
406
407 printf(
" Fixed I/O Port descriptor\n");
408 printf(
" PortBase 0x%hx Length 0x%x\n",
410
411#if 0
413 {
414 printf(
" Fixed location I/O Port descriptor: 0x%x\n",
415 IoPort);
416 }
417 else
418 {
419 printf(
" Fixed location I/O Port descriptor: 0x%x - 0x%x\n",
420 IoPort,
422 }
423#endif
424}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Referenced by PrintDeviceData().
◆ PnpDecodeFixedMemory()
Definition at line 518 of file pnpdump.c.
519{
523
526
535
543
544 printf(
" 32-Bit fixed location memory range descriptor\n");
545 printf(
" Base 0x%lx Length 0x%lx Flags 0x%02x\n",
547}
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Referenced by PrintDeviceData().
◆ PnpDecodeIoPort()
Definition at line 368 of file pnpdump.c.
369{
374
375
379 MinBase += (*
Ptr << 8);
383 MaxBase += (*
Ptr << 8);
388
389 printf(
" I/O Port descriptor\n");
390 printf(
" MinBase 0x%x MaxBase 0x%x Align %u Length %u\n",
392}
Referenced by PrintDeviceData().
◆ PnpDecodeIrq()
Definition at line 319 of file pnpdump.c.
320{
323
326 IrqMask |= (*
Ptr << 8);
327
329
330 for (
i = 0;
i < 16;
i++)
331 {
332 if (IrqMask & (1 <<
i))
333 {
335 }
336 }
337
339}
Referenced by PrintDeviceData().
◆ PnpDecodeMemory16()
Definition at line 428 of file pnpdump.c.
429{
435
438
441 MinBase += (*
Ptr << 8);
443
446 MaxBase += (*
Ptr << 8);
448
453
457
458 printf(
" 16-Bit memory range descriptor\n");
459 printf(
" MinBase 0x%hx MaxBase 0x%hx Align 0x%hx Length 0x%hx Flags 0x%02x\n",
461}
Referenced by PrintDeviceData().
◆ PnpDecodeMemory32()
Definition at line 465 of file pnpdump.c.
466{
472
475
478 MinBase += (*
Ptr << 8);
480 MinBase += (*
Ptr << 16);
482 MinBase += (*
Ptr << 24);
484
487 MaxBase += (*
Ptr << 8);
489 MaxBase += (*
Ptr << 16);
491 MaxBase += (*
Ptr << 24);
493
502
510
511 printf(
" 32-Bit memory range descriptor\n");
512 printf(
" MinBase 0x%lx MaxBase 0x%lx Align 0x%lx Length 0x%lx Flags 0x%02x\n",
514}
Referenced by PrintDeviceData().
◆ PrintDeviceData()
Definition at line 550 of file pnpdump.c.
551{
552 char PnpId[8];
554 unsigned int TagSize;
555 unsigned int TagType;
556
558
559 printf (
"Node: %x Size %hu (0x%hx)\n",
563
565
566 PnpId[0] = ((
Id[0] >> 2) & 0x1F) + 0x40;
567 PnpId[1] = ((
Id[0] << 3) & 0x18) +
568 ((
Id[1] >> 5) & 0x07) + 0x40;
569 PnpId[2] = (
Id[1] & 0x1F) + 0x40;
570
571 PnpId[3] =
Hex[(
Id[2] >> 4) & 0xF];
572 PnpId[4] =
Hex[
Id[2] & 0x0F];
573
574 PnpId[5] =
Hex[(
Id[3] >> 4) & 0x0F];
575 PnpId[6] =
Hex[
Id[3] & 0x0F];
576 PnpId[7] = 0;
577
580
582 {
585 {
587 {
588 TagType = *
Ptr & 0x7F;
592 TagSize += (*
Ptr << 16);
594
595
596 switch (TagType)
597 {
598 case 1:
600 break;
601
602 case 5:
604 break;
605
606 case 6:
608 break;
609
610 default:
611 printf(
" Large tag: type %u size %u\n",
612 TagType,
613 TagSize);
614 break;
615 }
616 }
617 else
618 {
619 TagType = (*
Ptr >> 3) & 0x0F;
620 TagSize = *
Ptr & 0x07;
622
623 switch (TagType)
624 {
625 case 2:
626 printf(
" Logical device ID\n");
627 break;
628
629 case 3:
630 printf(
" Compatible device ID\n");
631 break;
632
633 case 4:
635 break;
636
637 case 5:
639 break;
640
641 case 8:
643 break;
644
645 case 9:
647 break;
648
649 case 0x0F:
650 break;
651
652 default:
653 printf(
" Small tag: type %u size %u\n",
654 TagType,
655 TagSize);
656 break;
657 }
658
659
660 if (TagType == 0x0F)
661 break;
662 }
663
665 }
666 }
667}
#define memcpy(s1, s2, n)
static VOID PnpDecodeFixedIoPort(unsigned char *Ptr)
static VOID PnpDecodeMemory16(unsigned char *Ptr)
static VOID PnpDecodeIrq(unsigned char *Ptr)
static VOID PnpDecodeFixedMemory(unsigned char *Ptr)
static char * GetDeviceName(char *PnpId)
static VOID PnpDecodeIoPort(unsigned char *Ptr)
static VOID PnpDecodeMemory32(unsigned char *Ptr)
static VOID PnpDecodeDma(unsigned char *Ptr)
Referenced by main().
◆ Hex
char Hex[] = "0123456789ABCDEF" |
|
static |
◆ PnpName