Author: ion
Date: Wed Aug 28 21:09:16 2013
New Revision: 59859
URL:
http://svn.reactos.org/svn/reactos?rev=59859&view=rev
Log:
[NDK]: Fix Vista vs Server 2003 definition of SECTION_IMAGE_INFORMATION.
[NTOSKRNL]: Gut out almost all the fields in the ReactOS-specific MM_IMAGE_SECTION, and
replace them with the NT SECTION_IMAGE_INFORMATION structure instead. Make NtQuerySection
simply return a copy of these fields (as on Windows).
[NTOSKRNL]: Update the PE loader code to now store information in
SECTION_IMAGE_INFORMATION. Also store LoaderFlags and DllCharacteristics, which were not
stored/returned to users before (in NtQuerySection).
[NTOSKRNL]: An entrypoint of NULL should also set ImageContainsCode to FALSE.
[NTOSKRNL]: Implement MmGetImageInformation, which is used by
NtQueryInformationProcess(ProcessImageInformation). Also implement this latter info
class.
[NTOSKRNL]: Delete ps_i.h, nobody uses this anymore.
Modified:
trunk/reactos/include/ndk/mmtypes.h
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/include/internal/ps_i.h
trunk/reactos/ntoskrnl/mm/ARM3/section.c
trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
trunk/reactos/ntoskrnl/mm/section.c
trunk/reactos/ntoskrnl/ps/query.c
Modified: trunk/reactos/include/ndk/mmtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/mmtypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/mmtypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/mmtypes.h [iso-8859-1] Wed Aug 28 21:09:16 2013
@@ -343,11 +343,30 @@
USHORT ImageCharacteristics;
USHORT DllCharacteristics;
USHORT Machine;
- UCHAR ImageContainsCode;
- UCHAR Spare1;
+ BOOLEAN ImageContainsCode;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ union
+ {
+ struct
+ {
+ UCHAR ComPlusNativeReady:1;
+ UCHAR ComPlusILOnly:1;
+ UCHAR ImageDynamicallyRelocated:1;
+ UCHAR ImageMappedFlat:1;
+ UCHAR Reserved:4;
+ };
+ UCHAR ImageFlags;
+ };
+#else
+ BOOLEAN Spare1;
+#endif
ULONG LoaderFlags;
ULONG ImageFileSize;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG CheckSum;
+#else
ULONG Reserved[1];
+#endif
} SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
#ifndef NTOS_MODE_USER
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Wed Aug 28 21:09:16 2013
@@ -216,18 +216,9 @@
typedef struct _MM_IMAGE_SECTION_OBJECT
{
- ULONG_PTR ImageBase;
- ULONG_PTR StackReserve;
- ULONG_PTR StackCommit;
- ULONG_PTR EntryPoint;
- USHORT Subsystem;
- USHORT ImageCharacteristics;
- USHORT MinorSubsystemVersion;
- USHORT MajorSubsystemVersion;
- USHORT Machine;
- BOOLEAN Executable;
+ SECTION_IMAGE_INFORMATION ImageInformation;
+ PVOID BasedAddress;
ULONG NrSegments;
- ULONG ImageSize;
PMM_SECTION_SEGMENT Segments;
} MM_IMAGE_SECTION_OBJECT, *PMM_IMAGE_SECTION_OBJECT;
@@ -1548,6 +1539,12 @@
/* section.c *****************************************************************/
+VOID
+NTAPI
+MmGetImageInformation(
+ OUT PSECTION_IMAGE_INFORMATION ImageInformation
+);
+
PFILE_OBJECT
NTAPI
MmGetFileObjectForSection(
Modified: trunk/reactos/ntoskrnl/include/internal/ps_i.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ps_i.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ps_i.h [iso-8859-1] Wed Aug 28 21:09:16 2013
@@ -6,602 +6,3 @@
* PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
* Thomas Weidenmueller (w3seek(a)reactos.org)
*/
-
-//
-// Process Information Classes
-//
-static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
-{
- /* ProcessBasicInformation */
- IQS_SAME
- (
- PROCESS_BASIC_INFORMATION,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessQuotaLimits */
- IQS_SAME
- (
- QUOTA_LIMITS,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessIoCounters */
- IQS_SAME
- (
- IO_COUNTERS,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessVmCounters */
- IQS_SAME
- (
- VM_COUNTERS,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessTimes */
- IQS_SAME
- (
- KERNEL_USER_TIMES,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessBasePriority */
- IQS_SAME
- (
- KPRIORITY,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessRaisePriority */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessDebugPort */
- IQS_SAME
- (
- HANDLE,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessExceptionPort */
- IQS_SAME
- (
- HANDLE,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessAccessToken */
- IQS_SAME
- (
- PROCESS_ACCESS_TOKEN,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessLdtInformation */
- IQS_SAME
- (
- UCHAR,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessLdtSize */
- IQS_SAME
- (
- UCHAR,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessDefaultHardErrorMode */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessIoPortHandlers */
- IQS_SAME
- (
- UCHAR,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessPooledUsageAndLimits */
- IQS_SAME
- (
- POOLED_USAGE_AND_LIMITS,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessWorkingSetWatch */
- IQS_SAME
- (
- PROCESS_WS_WATCH_INFORMATION,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessUserModeIOPL */
- IQS_SAME
- (
- UCHAR,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessEnableAlignmentFaultFixup */
- IQS_SAME
- (
- BOOLEAN,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessPriorityClass */
- IQS_SAME
- (
- PROCESS_PRIORITY_CLASS,
- USHORT,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessWx86Information */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessHandleCount */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessAffinityMask */
- IQS_SAME
- (
- KAFFINITY,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessPriorityBoost */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessDeviceMap */
- IQS
- (
- ((PROCESS_DEVICEMAP_INFORMATION*)0)->Query,
- ((PROCESS_DEVICEMAP_INFORMATION*)0)->Set,
- ULONG,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessSessionInformation */
- IQS_SAME
- (
- PROCESS_SESSION_INFORMATION,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessForegroundInformation */
- IQS_SAME
- (
- BOOLEAN,
- ULONG,
- ICIF_SET
- ),
-
- /* ProcessWow64Information */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ProcessImageFileName */
- IQS_SAME
- (
- UNICODE_STRING,
- ULONG,
- ICIF_QUERY | ICIF_SIZE_VARIABLE
- ),
-
- /* ProcessLUIDDeviceMapsEnabled */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessBreakOnTermination */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ProcessDebugObjectHandle */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessDebugFlags */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessHandleTracing */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessIoPriority */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessExecuteFlags */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessTlsInformation */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessCookie */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessImageInformation */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessCycleTime */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessPagePriority */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-
- /* ProcessInstrumentationCallback */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- 0
- ),
-};
-
-//
-// Thread Information Classes
-//
-static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
-{
- /* ThreadBasicInformation */
- IQS_SAME
- (
- THREAD_BASIC_INFORMATION,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadTimes */
- IQS_SAME
- (
- KERNEL_USER_TIMES,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadPriority */
- IQS_SAME
- (
- KPRIORITY,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadBasePriority */
- IQS_SAME
- (
- LONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadAffinityMask */
- IQS_SAME
- (
- KAFFINITY,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadImpersonationToken */
- IQS_SAME
- (
- HANDLE,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ThreadDescriptorTableEntry */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadEnableAlignmentFaultFixup */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadEventPair_Reusable */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadQuerySetWin32StartAddress */
- IQS_SAME
- (
- PVOID,
- ULONG,
- ICIF_QUERY | ICIF_SET
- ),
-
- /* ThreadZeroTlsCell */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadPerformanceCount */
- IQS_SAME
- (
- LARGE_INTEGER,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadAmILastThread */
- IQS_SAME
- (
- BOOLEAN,
- BOOLEAN,
- ICIF_QUERY
- ),
-
- /* ThreadIdealProcessor */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadPriorityBoost */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadSetTlsArrayAddress */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadIsIoPending */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadHideFromDebugger */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
-
- /* ThreadPriorityBoost */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadSetTlsArrayAddress */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadIsIoPending */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadHideFromDebugger */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadBreakOnTermination */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadSwitchLegacyState */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadIsTerminated */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadLastSystemCall */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadIoPriority */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadCycleTime */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadPagePriority */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadActualBasePriority */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-
- /* ThreadTebInformation */
- IQS_SAME
- (
- ULONG,
- ULONG,
- ICIF_QUERY
- ),
-
- /* ThreadCSwitchMon */
- IQS_SAME
- (
- UCHAR,
- UCHAR,
- ICIF_QUERY
- ),
-};
Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Wed Aug 28 21:09:16 2013
@@ -1495,6 +1495,22 @@
return ((PROS_SECTION_OBJECT)SectionObject)->FileObject;
}
+VOID
+NTAPI
+MmGetImageInformation (OUT PSECTION_IMAGE_INFORMATION ImageInformation)
+{
+ PSECTION_OBJECT SectionObject;
+
+ /* Get the section object of this process*/
+ SectionObject = PsGetCurrentProcess()->SectionObject;
+ ASSERT(SectionObject != NULL);
+ ASSERT(MiIsRosSectionObject(SectionObject) == TRUE);
+
+ /* Return the image information */
+ DPRINT1("HERE!\n");
+ *ImageInformation =
((PROS_SECTION_OBJECT)SectionObject)->ImageSection->ImageInformation;
+}
+
NTSTATUS
NTAPI
MmGetFileNameForFileObject(IN PFILE_OBJECT FileObject,
Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Wed Aug 28 21:09:16 2013
@@ -156,7 +156,7 @@
}
/* Reserve system PTEs needed */
- PteCount = ROUND_TO_PAGES(Section->ImageSection->ImageSize) >>
PAGE_SHIFT;
+ PteCount =
ROUND_TO_PAGES(Section->ImageSection->ImageInformation.ImageFileSize) >>
PAGE_SHIFT;
PointerPte = MiReserveSystemPtes(PteCount, SystemPteSpace);
if (!PointerPte)
{
@@ -3040,7 +3040,7 @@
ASSERT(Status != STATUS_ALREADY_COMMITTED);
/* Get the size of the driver */
- DriverSize = ((PROS_SECTION_OBJECT)Section)->ImageSection->ImageSize;
+ DriverSize =
((PROS_SECTION_OBJECT)Section)->ImageSection->ImageInformation.ImageFileSize;
/* Make sure we're not being loaded into session space */
if (!Flags)
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Wed Aug 28 21:09:16 2013
@@ -199,6 +199,7 @@
ULONG cbHeadersSize = 0;
ULONG nSectionAlignment;
ULONG nFileAlignment;
+ ULONG ImageBase;
const IMAGE_DOS_HEADER * pidhDosHeader;
const IMAGE_NT_HEADERS32 * pinhNtHeader;
const IMAGE_OPTIONAL_HEADER32 * piohOptHeader;
@@ -389,17 +390,54 @@
/* PE32 */
case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
{
- if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, ImageBase))
- ImageSectionObject->ImageBase = piohOptHeader->ImageBase;
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, ImageBase))
+ ImageBase = piohOptHeader->ImageBase;
if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfImage))
- ImageSectionObject->ImageSize = piohOptHeader->SizeOfImage;
+ ImageSectionObject->ImageInformation.ImageFileSize =
piohOptHeader->SizeOfImage;
if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfStackReserve))
- ImageSectionObject->StackReserve =
piohOptHeader->SizeOfStackReserve;
+ ImageSectionObject->ImageInformation.MaximumStackSize =
piohOptHeader->SizeOfStackReserve;
if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfStackCommit))
- ImageSectionObject->StackCommit =
piohOptHeader->SizeOfStackCommit;
+ ImageSectionObject->ImageInformation.CommittedStackSize =
piohOptHeader->SizeOfStackCommit;
+
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, Subsystem))
+ {
+ ImageSectionObject->ImageInformation.SubSystemType =
piohOptHeader->Subsystem;
+
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize,
MinorSubsystemVersion) &&
+ RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize,
MajorSubsystemVersion))
+ {
+ ImageSectionObject->ImageInformation.SubSystemMinorVersion =
piohOptHeader->MinorSubsystemVersion;
+ ImageSectionObject->ImageInformation.SubSystemMajorVersion =
piohOptHeader->MajorSubsystemVersion;
+ }
+ }
+
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, AddressOfEntryPoint))
+ {
+ ImageSectionObject->ImageInformation.TransferAddress = (PVOID)
(ImageBase +
+ piohOptHeader->AddressOfEntryPoint);
+ }
+
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfCode))
+ ImageSectionObject->ImageInformation.ImageContainsCode =
piohOptHeader->SizeOfCode != 0;
+ else
+ ImageSectionObject->ImageInformation.ImageContainsCode = TRUE;
+
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, AddressOfEntryPoint))
+ {
+ if (piohOptHeader->AddressOfEntryPoint == 0)
+ {
+ ImageSectionObject->ImageInformation.ImageContainsCode = FALSE;
+ }
+ }
+
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, LoaderFlags))
+ ImageSectionObject->ImageInformation.LoaderFlags =
piohOptHeader->LoaderFlags;
+
+ if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, DllCharacteristics))
+ ImageSectionObject->ImageInformation.DllCharacteristics =
piohOptHeader->DllCharacteristics;
break;
}
@@ -413,10 +451,9 @@
if(RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, ImageBase))
{
+ ImageBase = pioh64OptHeader->ImageBase;
if(pioh64OptHeader->ImageBase > MAXULONG_PTR)
DIE(("ImageBase exceeds the address space\n"));
-
- ImageSectionObject->ImageBase =
(ULONG_PTR)pioh64OptHeader->ImageBase;
}
if(RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, SizeOfImage))
@@ -424,7 +461,7 @@
if(pioh64OptHeader->SizeOfImage > MAXULONG_PTR)
DIE(("SizeOfImage exceeds the address space\n"));
- ImageSectionObject->ImageSize = pioh64OptHeader->SizeOfImage;
+ ImageSectionObject->ImageInformation.ImageFileSize =
pioh64OptHeader->SizeOfImage;
}
if(RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, SizeOfStackReserve))
@@ -432,7 +469,7 @@
if(pioh64OptHeader->SizeOfStackReserve > MAXULONG_PTR)
DIE(("SizeOfStackReserve exceeds the address space\n"));
- ImageSectionObject->StackReserve =
(ULONG_PTR)pioh64OptHeader->SizeOfStackReserve;
+ ImageSectionObject->ImageInformation.MaximumStackSize = (ULONG_PTR)
pioh64OptHeader->SizeOfStackReserve;
}
if(RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, SizeOfStackCommit))
@@ -440,42 +477,59 @@
if(pioh64OptHeader->SizeOfStackCommit > MAXULONG_PTR)
DIE(("SizeOfStackCommit exceeds the address space\n"));
- ImageSectionObject->StackCommit =
(ULONG_PTR)pioh64OptHeader->SizeOfStackCommit;
+ ImageSectionObject->ImageInformation.CommittedStackSize = (ULONG_PTR)
pioh64OptHeader->SizeOfStackCommit;
}
+
+ if (RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, Subsystem))
+ {
+ ImageSectionObject->ImageInformation.SubSystemType =
pioh64OptHeader->Subsystem;
+
+ if (RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize,
MinorSubsystemVersion) &&
+ RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize,
MajorSubsystemVersion))
+ {
+ ImageSectionObject->ImageInformation.SubSystemMinorVersion =
pioh64OptHeader->MinorSubsystemVersion;
+ ImageSectionObject->ImageInformation.SubSystemMajorVersion =
pioh64OptHeader->MajorSubsystemVersion;
+ }
+ }
+
+ if (RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize,
AddressOfEntryPoint))
+ {
+ ImageSectionObject->ImageInformation.TransferAddress = (PVOID)
(ImageBase +
+ pioh64OptHeader->AddressOfEntryPoint);
+ }
+
+ if (RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, SizeOfCode))
+ ImageSectionObject->ImageInformation.ImageContainsCode =
pioh64OptHeader->SizeOfCode != 0;
+ else
+ ImageSectionObject->ImageInformation.ImageContainsCode = TRUE;
+
+ if (RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize,
AddressOfEntryPoint))
+ {
+ if (pioh64OptHeader->AddressOfEntryPoint == 0)
+ {
+ ImageSectionObject->ImageInformation.ImageContainsCode = FALSE;
+ }
+ }
+
+ if (RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, LoaderFlags))
+ ImageSectionObject->ImageInformation.LoaderFlags =
pioh64OptHeader->LoaderFlags;
+
+ if (RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize,
DllCharacteristics))
+ ImageSectionObject->ImageInformation.DllCharacteristics =
pioh64OptHeader->DllCharacteristics;
break;
}
}
/* [1], section 3.4.2 */
- if((ULONG_PTR)ImageSectionObject->ImageBase % 0x10000)
+ if((ULONG_PTR)ImageBase % 0x10000)
DIE(("ImageBase is not aligned on a 64KB boundary"));
- if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, Subsystem))
- {
- ImageSectionObject->Subsystem = piohOptHeader->Subsystem;
-
- if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, MinorSubsystemVersion)
&&
- RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, MajorSubsystemVersion))
- {
- ImageSectionObject->MinorSubsystemVersion =
piohOptHeader->MinorSubsystemVersion;
- ImageSectionObject->MajorSubsystemVersion =
piohOptHeader->MajorSubsystemVersion;
- }
- }
-
- if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, AddressOfEntryPoint))
- {
- ImageSectionObject->EntryPoint = ImageSectionObject->ImageBase +
- piohOptHeader->AddressOfEntryPoint;
- }
-
- if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfCode))
- ImageSectionObject->Executable = piohOptHeader->SizeOfCode != 0;
- else
- ImageSectionObject->Executable = TRUE;
-
- ImageSectionObject->ImageCharacteristics =
pinhNtHeader->FileHeader.Characteristics;
- ImageSectionObject->Machine = pinhNtHeader->FileHeader.Machine;
+ ImageSectionObject->ImageInformation.ImageCharacteristics =
pinhNtHeader->FileHeader.Characteristics;
+ ImageSectionObject->ImageInformation.Machine =
pinhNtHeader->FileHeader.Machine;
+ ImageSectionObject->ImageInformation.GpValue = 0;
+ ImageSectionObject->ImageInformation.ZeroBits = 0;
+ ImageSectionObject->BasedAddress = (PVOID)ImageBase;
/* SECTION HEADERS */
nStatus = STATUS_INVALID_IMAGE_FORMAT;
@@ -3597,18 +3651,18 @@
* Some defaults
*/
/* FIXME? are these values platform-dependent? */
- if(ImageSectionObject->StackReserve == 0)
- ImageSectionObject->StackReserve = 0x40000;
-
- if(ImageSectionObject->StackCommit == 0)
- ImageSectionObject->StackCommit = 0x1000;
-
- if(ImageSectionObject->ImageBase == 0)
- {
- if(ImageSectionObject->ImageCharacteristics & IMAGE_FILE_DLL)
- ImageSectionObject->ImageBase = 0x10000000;
+ if (ImageSectionObject->ImageInformation.MaximumStackSize == 0)
+ ImageSectionObject->ImageInformation.MaximumStackSize = 0x40000;
+
+ if(ImageSectionObject->ImageInformation.CommittedStackSize == 0)
+ ImageSectionObject->ImageInformation.CommittedStackSize = 0x1000;
+
+ if(ImageSectionObject->BasedAddress == NULL)
+ {
+ if(ImageSectionObject->ImageInformation.ImageCharacteristics &
IMAGE_FILE_DLL)
+ ImageSectionObject->BasedAddress = (PVOID)0x10000000;
else
- ImageSectionObject->ImageBase = 0x00400000;
+ ImageSectionObject->BasedAddress = (PVOID)0x00400000;
}
/*
@@ -4237,21 +4291,12 @@
_SEH2_TRY
{
- memset(Sii, 0, sizeof(SECTION_IMAGE_INFORMATION));
if (Section->AllocationAttributes & SEC_IMAGE)
{
PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
ImageSectionObject = Section->ImageSection;
- Sii->TransferAddress = (PVOID)ImageSectionObject->EntryPoint;
- Sii->MaximumStackSize = ImageSectionObject->StackReserve;
- Sii->CommittedStackSize = ImageSectionObject->StackCommit;
- Sii->SubSystemType = ImageSectionObject->Subsystem;
- Sii->SubSystemMinorVersion =
ImageSectionObject->MinorSubsystemVersion;
- Sii->SubSystemMajorVersion =
ImageSectionObject->MajorSubsystemVersion;
- Sii->ImageCharacteristics =
ImageSectionObject->ImageCharacteristics;
- Sii->Machine = ImageSectionObject->Machine;
- Sii->ImageContainsCode = ImageSectionObject->Executable;
+ *Sii = ImageSectionObject->ImageInformation;
}
if (ResultLength != NULL)
@@ -4386,11 +4431,10 @@
SectionSegments = ImageSectionObject->Segments;
NrSegments = ImageSectionObject->NrSegments;
-
ImageBase = (ULONG_PTR)*BaseAddress;
if (ImageBase == 0)
{
- ImageBase = ImageSectionObject->ImageBase;
+ ImageBase = (ULONG_PTR)ImageSectionObject->BasedAddress;
}
ImageSize = 0;
@@ -4405,7 +4449,7 @@
}
}
- ImageSectionObject->ImageSize = (ULONG)ImageSize;
+ ImageSectionObject->ImageInformation.ImageFileSize = (ULONG)ImageSize;
/* Check for an illegal base address */
if ((ImageBase + ImageSize) > (ULONG_PTR)MmHighestUserAddress)
Modified: trunk/reactos/ntoskrnl/ps/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=59…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Wed Aug 28 21:09:16 2013
@@ -16,9 +16,6 @@
/* FIXME: From winbase.h... what to do? */
#define SEM_NOALIGNMENTFAULTEXCEPT 0x04
-
-/* Include Information Class Tables */
-#include "internal/ps_i.h"
/* Debugging Level */
ULONG PspTraceLevel = 0;
@@ -108,7 +105,8 @@
_SEH2_END;
}
- if((ProcessInformationClass == ProcessCookie) &&
+ if (((ProcessInformationClass == ProcessCookie) ||
+ (ProcessInformationClass == ProcessImageInformation)) &&
(ProcessHandle != NtCurrentProcess()))
{
/*
@@ -823,8 +821,30 @@
break;
case ProcessImageInformation:
- DPRINT1("Image Information Query Not implemented: %lx\n",
ProcessInformationClass);
- Status = STATUS_NOT_IMPLEMENTED;
+
+ /* Set the length required and validate it */
+ Length = sizeof(SECTION_IMAGE_INFORMATION);
+ if (ProcessInformationLength != Length)
+ {
+ /* Break out */
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ break;
+ }
+
+ /* Enter SEH to protect write */
+ _SEH2_TRY
+ {
+ MmGetImageInformation((PSECTION_IMAGE_INFORMATION)ProcessInformation);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ /* Get the exception code */
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+
+ /* Indicate success */
+ Status = STATUS_SUCCESS;
break;
case ProcessDebugObjectHandle: