ReactOS  0.4.12-dev-919-gfc3b8d5
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 
25 extern
27 (WINAPI * QueryObject)(
28  IN HANDLE ObjectHandle,
31  IN ULONG Length,
33  );
34 
35 extern
37 (WINAPI * QueryInformationPort)(
38  IN HANDLE PortHandle,
40  OUT PVOID PortInformation, /* guess */
41  IN ULONG PortInformationLength, /* guess */
42  OUT PULONG ReturnLength /* guess */
43  );
44 
45 
46 /*
47 static
48 VOID
49 DumpBuffer(
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 
69 VOID
71  LPCWSTR Name,
73  LPCWSTR Comment,
74  HANDLE Port
75  )
76 {
79 
80  wprintf(
81  L"Port \"%s\" %s:\n",
82  Name,
83  Comment
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),
97  & ResultLength
98  );
99  if (Status == STATUS_SUCCESS)
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,
130  & ResultLength
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 /*
143 FIXME: 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,
168  & ResultLength
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,
190  & ResultLength
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 */
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
CPPORT Port[4]
Definition: headless.c:34
#define IN
Definition: typedefs.h:38
CONST int CINT
Definition: umtypes.h:124
IN CINT OUT PVOID IN ULONG Length
Definition: dumpinfo.c:29
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LONG NTSTATUS
Definition: precomp.h:26
IN CINT OUT PVOID PortInformation
Definition: dumpinfo.c:39
#define wprintf(...)
Definition: whoami.c:18
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: dumpinfo.c:29
IN CINT OUT PVOID IN ULONG PortInformationLength
Definition: dumpinfo.c:39
IN CINT OUT PVOID ObjectInformation
Definition: dumpinfo.c:29
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
#define BUF_SIZE
Definition: dumpinfo.c:21
NTSTATUS(WINAPI *QueryObject)(IN HANDLE ObjectHandle
VOID DumpInfo(LPCWSTR Name, NTSTATUS Status, LPCWSTR Comment, HANDLE Port)
Definition: dumpinfo.c:70
IN CINT ObjectInformationClass
Definition: dumpinfo.c:29
#define WINAPI
Definition: msvc.h:8
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
unsigned int * PULONG
Definition: retypes.h:1
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
IN CINT PortInformationClass
Definition: dumpinfo.c:39
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define printf
Definition: config.h:203