[REFORMATTING]

- Reindent the dbgbuffer.c code to the ReactOS Standard Indentation.

svn path=/trunk/; revision=54662
This commit is contained in:
Aleksey Bragin 2011-12-16 15:45:09 +00:00
parent ce424af08c
commit b8928d9e26

View file

@ -1,8 +1,8 @@
/* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/rtl/dbgbuffer.c
* PROGRAMER: James Tabor
*/
* PROJECT: ReactOS system libraries
* FILE: lib/rtl/dbgbuffer.c
* PROGRAMER: James Tabor
*/
/* INCLUDES *****************************************************************/
@ -14,9 +14,10 @@
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
PRTL_DEBUG_INFORMATION NTAPI
* @unimplemented
*/
PRTL_DEBUG_INFORMATION
NTAPI
RtlCreateQueryDebugBuffer(IN ULONG Size,
IN BOOLEAN EventPair)
{
@ -24,16 +25,13 @@ RtlCreateQueryDebugBuffer(IN ULONG Size,
PRTL_DEBUG_INFORMATION Buf = NULL;
SIZE_T ViewSize = 100 * PAGE_SIZE;
Status = NtAllocateVirtualMemory( NtCurrentProcess(),
Status = NtAllocateVirtualMemory(NtCurrentProcess(),
(PVOID*)&Buf,
0,
&ViewSize,
MEM_COMMIT,
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
return NULL;
}
if (!NT_SUCCESS(Status)) return NULL;
Buf->ViewBaseClient = Buf;
Buf->ViewSize = (ULONG)ViewSize;
@ -44,16 +42,17 @@ RtlCreateQueryDebugBuffer(IN ULONG Size,
}
/*
* @unimplemented
*/
NTSTATUS NTAPI
* @unimplemented
*/
NTSTATUS
NTAPI
RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION Buf)
{
NTSTATUS Status = STATUS_SUCCESS;
if (NULL != Buf)
{
Status = NtFreeVirtualMemory( NtCurrentProcess(),
Status = NtFreeVirtualMemory(NtCurrentProcess(),
(PVOID)Buf,
(PSIZE_T)&Buf->ViewSize, /* FIXME: not portable! */
MEM_RELEASE);
@ -66,10 +65,11 @@ RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION Buf)
}
/*
* Based on lib/epsapi/enum/modules.c by KJK::Hyperion.
*
*/
NTSTATUS NTAPI
* Based on lib/epsapi/enum/modules.c by KJK::Hyperion.
*
*/
NTSTATUS
NTAPI
RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
IN PRTL_PROCESS_MODULES Modules OPTIONAL,
IN ULONG Size OPTIONAL,
@ -90,7 +90,7 @@ RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
DPRINT("RtlpQueryRemoteProcessModules Start\n");
/* query the process basic information (includes the PEB address) */
Status = NtQueryInformationProcess ( ProcessHandle,
Status = NtQueryInformationProcess(ProcessHandle,
ProcessBasicInformation,
&pbiInfo,
sizeof(PROCESS_BASIC_INFORMATION),
@ -115,11 +115,11 @@ RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
}
/* get the address of the PE Loader data */
Status = NtReadVirtualMemory ( ProcessHandle,
Status = NtReadVirtualMemory(ProcessHandle,
&(pbiInfo.PebBaseAddress->Ldr),
&ppldLdrData,
sizeof(ppldLdrData),
NULL );
NULL);
if (!NT_SUCCESS(Status))
{
@ -133,11 +133,11 @@ RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
pleListHead = &ppldLdrData->InLoadOrderModuleList;
/* get the address of the first element in the list */
Status = NtReadVirtualMemory ( ProcessHandle,
Status = NtReadVirtualMemory(ProcessHandle,
&(ppldLdrData->InLoadOrderModuleList.Flink),
&pleCurEntry,
sizeof(pleCurEntry),
NULL );
NULL);
if (!NT_SUCCESS(Status))
{
@ -148,27 +148,26 @@ RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
while(pleCurEntry != pleListHead)
{
UNICODE_STRING Unicode;
WCHAR Buffer[256 * sizeof(WCHAR)];
/* read the current module */
Status = NtReadVirtualMemory ( ProcessHandle,
Status = NtReadVirtualMemory(ProcessHandle,
CONTAINING_RECORD(pleCurEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks),
&lmModule,
sizeof(LDR_DATA_TABLE_ENTRY),
NULL );
NULL);
/* Import module name from remote Process user space. */
Unicode.Length = lmModule.FullDllName.Length;
Unicode.MaximumLength = lmModule.FullDllName.MaximumLength;
Unicode.Buffer = Buffer;
Status = NtReadVirtualMemory ( ProcessHandle,
Status = NtReadVirtualMemory(ProcessHandle,
lmModule.FullDllName.Buffer,
Unicode.Buffer,
Unicode.Length,
NULL );
NULL);
if (!NT_SUCCESS(Status))
{
@ -226,9 +225,10 @@ RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
}
/*
* @unimplemented
*/
NTSTATUS NTAPI
* @unimplemented
*/
NTSTATUS
NTAPI
RtlQueryProcessDebugInformation(IN ULONG ProcessId,
IN ULONG DebugInfoMask,
IN OUT PRTL_DEBUG_INFORMATION Buf)
@ -241,17 +241,17 @@ RtlQueryProcessDebugInformation(IN ULONG ProcessId,
DPRINT("QueryProcessDebugInformation Start\n");
/*
/*
Currently ROS can not read-only from kenrel space, and doesn't
check for boundaries inside kernel space that are page protected
from every one but the kernel. aka page 0 - 2
*/
if (ProcessId <= 1)
if (ProcessId <= 1)
{
Status = STATUS_ACCESS_VIOLATION;
}
else
if (Pid == ProcessId)
else
if (Pid == ProcessId)
{
if (DebugInfoMask & RTL_DEBUG_QUERY_MODULES)
{
@ -262,10 +262,10 @@ if (Pid == ProcessId)
Mp = (PRTL_PROCESS_MODULES)(Buf + Buf->OffsetFree);
/* I like this better than the do & while loop. */
Status = LdrQueryProcessModuleInformation( NULL,
0 ,
Status = LdrQueryProcessModuleInformation(NULL,
0,
&ReturnSize);
Status = LdrQueryProcessModuleInformation( Mp,
Status = LdrQueryProcessModuleInformation(Mp,
ReturnSize ,
&ReturnSize);
if (!NT_SUCCESS(Status))
@ -287,9 +287,11 @@ if (Pid == ProcessId)
HSize = sizeof(RTL_PROCESS_HEAPS);
if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_TAGS)
{
// TODO
}
if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_BLOCKS)
{
// TODO
}
Buf->Heaps = Hp;
Buf->OffsetFree = Buf->OffsetFree + HSize;
@ -309,9 +311,9 @@ if (Pid == ProcessId)
DPRINT("QueryProcessDebugInformation end \n");
DPRINT("QueryDebugInfo : 0x%lx\n", Buf->OffsetFree);
}
else
{
}
else
{
HANDLE hProcess;
CLIENT_ID ClientId;
OBJECT_ATTRIBUTES ObjectAttributes;
@ -326,7 +328,7 @@ else
NULL,
NULL);
Status = NtOpenProcess( &hProcess,
Status = NtOpenProcess(&hProcess,
(PROCESS_ALL_ACCESS),
&ObjectAttributes,
&ClientId );
@ -343,12 +345,12 @@ else
Mp = (PRTL_PROCESS_MODULES)(Buf + Buf->OffsetFree);
Status = RtlpQueryRemoteProcessModules( hProcess,
Status = RtlpQueryRemoteProcessModules(hProcess,
NULL,
0,
&ReturnSize);
Status = RtlpQueryRemoteProcessModules( hProcess,
Status = RtlpQueryRemoteProcessModules(hProcess,
Mp,
ReturnSize ,
&ReturnSize);
@ -371,9 +373,11 @@ else
HSize = sizeof(RTL_PROCESS_HEAPS);
if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_TAGS)
{
// TODO
}
if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_BLOCKS)
{
// TODO
}
Buf->Heaps = Hp;
Buf->OffsetFree = Buf->OffsetFree + HSize;
@ -393,9 +397,9 @@ else
DPRINT("QueryProcessDebugInformation end \n");
DPRINT("QueryDebugInfo : 0x%lx\n", Buf->OffsetFree);
}
return Status;
}
return Status;
}
/* EOL */