ReactOS 0.4.15-dev-7788-g1ad9096
dumpinfo.c
Go to the documentation of this file.
1/*
2 * reactos/apps/lpc/dumpinfo.c
3 *
4 * ReactOS Operating System
5 *
6 * Dump a kernel object's attributes by its handle.
7 *
8 * 19990627 (Emanuele Aliberti)
9 * Initial implementation.
10 * 19990704 (EA)
11 * Added code to find the basic information buffer size
12 * for the LPC port object.
13 * 19990710 (EA)
14 *
15 */
16#include <windows.h>
17#include <stdio.h>
18#include <stdlib.h>
19#include <ddk/ntddk.h>
20
21#define BUF_SIZE 1024
22#define MAX_BASIC_INFO_SIZE 512
23
24
25extern
27(WINAPI * QueryObject)(
28 IN HANDLE ObjectHandle,
33 );
34
35extern
37(WINAPI * QueryInformationPort)(
38 IN HANDLE PortHandle,
43 );
44
45
46/*
47static
48VOID
49DumpBuffer(
50 char *Name,
51 BYTE *buffer,
52 ULONG size
53 )
54{
55 register ULONG i = 0;
56
57 printf("%s [%d] = ",Name,size);
58 for ( i = 0;
59 i != size;
60 ++i
61 )
62 {
63 printf("%02X",buffer[i]);
64 }
65 printf("\n");
66}
67*/
68
69VOID
75 )
76{
79
80 wprintf(
81 L"Port \"%s\" %s:\n",
82 Name,
84 );
85
86 printf("\tStatus = %08X\n",Status);
87 printf("\tPort = %08X\n\n",Port);
88 /*
89 * Query object information.
90 */
91 printf("Basic Information:\n");
92 Status = QueryObject(
93 Port,
96 sizeof (LPC_PORT_BASIC_INFORMATION),
98 );
100 {
101 PLPC_PORT_BASIC_INFORMATION i;
102
103 i = (PLPC_PORT_BASIC_INFORMATION) ObjectInformation;
104
105 printf( "\tUnknown01 = 0x%08X\n", i->Unknown0 );
106 printf( "\tUnknown02 = 0x%08X\n", i->Unknown1 );
107 printf( "\tUnknown03 = 0x%08X\n", i->Unknown2 );
108 printf( "\tUnknown04 = 0x%08X\n", i->Unknown3 );
109 printf( "\tUnknown05 = 0x%08X\n", i->Unknown4 );
110 printf( "\tUnknown06 = 0x%08X\n", i->Unknown5 );
111 printf( "\tUnknown07 = 0x%08X\n", i->Unknown6 );
112 printf( "\tUnknown08 = 0x%08X\n", i->Unknown7 );
113 printf( "\tUnknown09 = 0x%08X\n", i->Unknown8 );
114 printf( "\tUnknown10 = 0x%08X\n", i->Unknown9 );
115 printf( "\tUnknown11 = 0x%08X\n", i->Unknown10 );
116 printf( "\tUnknown12 = 0x%08X\n", i->Unknown11 );
117 printf( "\tUnknown13 = 0x%08X\n", i->Unknown12 );
118 printf( "\tUnknown14 = 0x%08X\n", i->Unknown13 );
119 }
120 else
121 {
122 printf("\tStatus = %08X\n",Status);
123 }
124 printf("Type Information:\n");
125 Status = QueryObject(
126 Port,
129 sizeof ObjectInformation,
131 );
132 if (Status == STATUS_SUCCESS)
133 {
135
137
138 wprintf(
139 L"\tName: \"%s\"\n",
140 (i->Name.Length ? i->Name.Buffer : L"")
141 );
142/*
143FIXME: why this always raise an access violation exception?
144 wprintf(
145 L"\tType: \"%s\"\n",
146 (i->Type.Length ? i->Type.Buffer : L"")
147 );
148/**/
149 printf(
150 "\tTotal Handles: %d\n",
151 i->TotalHandles
152 );
153 printf(
154 "\tReference Count: %d\n",
155 i->ReferenceCount
156 );
157 }
158 else
159 {
160 printf("\tStatus = %08X\n",Status);
161 }
162 printf("Name Information:\n");
163 Status = QueryObject(
164 Port,
167 sizeof ObjectInformation,
169 );
170 if (Status == STATUS_SUCCESS)
171 {
173
175 wprintf(
176 L"\tName: \"%s\"\n",
177 (i->Name.Length ? i->Name.Buffer : L"")
178 );
179 }
180 else
181 {
182 printf("\tStatus = %08X\n",Status);
183 }
184 printf("Data Information:\n");
185 Status = QueryObject(
186 Port,
189 sizeof ObjectInformation,
191 );
192 if (Status == STATUS_SUCCESS)
193 {
195
197 printf(
198 "\tInherit Handle: %s\n",
199 (i->bInheritHandle ? "TRUE" : "FALSE")
200 );
201 printf(
202 "\tProtect from Close: %s\n",
203 (i->bProtectFromClose ? "TRUE" : "FALSE")
204 );
205 }
206 else
207 {
208 printf("\tStatus = %08X\n",Status);
209 }
210//---
211 printf("Port Information:\n");
212/* Status = QueryInformationPort(
213 Port,
214 1, /* info class * /
215 ObjectInformation,
216 sizeof ObjectInformation,
217 & ResultLength
218 );
219 if (Status == STATUS_SUCCESS)
220 {
221 DWORD * i = ObjectInformation;
222 int j = 0;
223
224 while (j < ResultLength / sizeof (DWORD))
225 {
226 printf("\t%08X\n",i[j]);
227 ++j;
228 }
229 }
230 else
231 {
232 printf("\tStatus = %08X\n",Status);
233 }
234*/
235}
236
237
238/* EOF */
@ ObjectTypeInformation
Definition: DriverTester.h:56
@ ObjectBasicInformation
Definition: DriverTester.h:54
@ ObjectNameInformation
Definition: DriverTester.h:55
@ Comment
Definition: asmpp.cpp:34
LONG NTSTATUS
Definition: precomp.h:26
#define NTSTATUS
Definition: precomp.h:21
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
IN CINT ObjectInformationClass
Definition: dumpinfo.c:29
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: dumpinfo.c:33
IN CINT OUT PVOID ObjectInformation
Definition: dumpinfo.c:30
IN CINT OUT PVOID IN ULONG PortInformationLength
Definition: dumpinfo.c:41
#define BUF_SIZE
Definition: dumpinfo.c:21
IN CINT OUT PVOID PortInformation
Definition: dumpinfo.c:40
IN CINT OUT PVOID IN ULONG Length
Definition: dumpinfo.c:31
VOID DumpInfo(LPCWSTR Name, NTSTATUS Status, LPCWSTR Comment, HANDLE Port)
Definition: dumpinfo.c:70
IN CINT PortInformationClass
Definition: dumpinfo.c:39
#define printf
Definition: freeldr.h:93
Status
Definition: gdiplustypes.h:25
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
Definition: glfuncs.h:248
CPPORT Port[4]
Definition: headless.c:35
@ ObjectDataInformation
Definition: winternl.h:852
#define L(x)
Definition: ntvdm.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t * PULONG
Definition: typedefs.h:59
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
CONST int CINT
Definition: umtypes.h:124
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
#define wprintf(...)
Definition: whoami.c:18
#define WINAPI
Definition: msvc.h:6
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193