ntdll-NtQuerySection: Fix all field names in SECTION_IMAGE_INFORMATION structure.

This commit is contained in:
Sebastian Lackner 2015-03-03 00:42:30 +01:00
parent 6038eeee95
commit cb7f47b637
3 changed files with 46 additions and 37 deletions

View File

@ -1,18 +1,18 @@
From aa9949cef21f63e2f5ba93515c4e1e17b66b1abf Mon Sep 17 00:00:00 2001
From ec38765fa45f37f6fa4f347506746cabb3cf8a91 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 16 Oct 2014 22:36:58 +0200
Subject: include: Fix definition of SECTION_BASIC_INFORMATION and
SECTION_IMAGE_INFORMATION.
---
include/winternl.h | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
include/winternl.h | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/include/winternl.h b/include/winternl.h
index 5a27f94..bb27a21 100644
index 1a694da..3992309 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1792,7 +1792,7 @@ typedef enum _SECTION_INFORMATION_CLASS
@@ -1792,23 +1792,28 @@ typedef enum _SECTION_INFORMATION_CLASS
} SECTION_INFORMATION_CLASS;
typedef struct _SECTION_BASIC_INFORMATION {
@ -21,27 +21,36 @@ index 5a27f94..bb27a21 100644
ULONG Attributes;
LARGE_INTEGER Size;
} SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
@@ -1800,14 +1800,16 @@ typedef struct _SECTION_BASIC_INFORMATION {
typedef struct _SECTION_IMAGE_INFORMATION {
PVOID EntryPoint;
ULONG StackZeroBits;
- PVOID EntryPoint;
- ULONG StackZeroBits;
- ULONG StackReserved;
- ULONG StackCommit;
+ SIZE_T StackReserved;
+ SIZE_T StackCommit;
ULONG ImageSubsystem;
- ULONG ImageSubsystem;
+ PVOID TransferAddress;
+ ULONG ZeroBits;
+ SIZE_T MaximumStackSize;
+ SIZE_T CommittedStackSize;
+ ULONG SubSystemType;
WORD SubsystemVersionLow;
WORD SubsystemVersionHigh;
ULONG Unknown1;
- ULONG Unknown1;
- ULONG ImageCharacteristics;
- ULONG ImageMachineType;
- ULONG Unknown2[3];
+ ULONG GpValue;
+ USHORT ImageCharacteristics;
+ USHORT DllCharacteristics;
+ USHORT ImageMachineType;
+ USHORT Machine;
+ BOOLEAN ImageContainsCode;
ULONG Unknown2[3];
+ UCHAR ImageFlags;
+ ULONG LoaderFlags;
+ ULONG ImageFileSize;
+ ULONG CheckSum;
} SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
typedef struct _LPC_SECTION_WRITE {
--
2.1.2
2.3.0

View File

@ -1,4 +1,4 @@
From 7f27b62ee7bc1a498490e8a97717d0fb18d6b716 Mon Sep 17 00:00:00 2001
From d63e7cedab22d7b1b7f5f51e993f813f4bfb8737 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 16 Oct 2014 23:24:37 +0200
Subject: ntdll: Implement NtQuerySection. (try 2)
@ -43,7 +43,7 @@ index 73d9383..f0433db 100644
*/
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 5bac269..32b023b 100644
index 9355d04..f175465 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -262,7 +262,7 @@
@ -55,7 +55,7 @@ index 5bac269..32b023b 100644
@ stdcall NtQuerySecurityObject (long long long long long)
@ stdcall NtQuerySemaphore (long long ptr long ptr)
@ stdcall NtQuerySymbolicLinkObject(long ptr ptr)
@@ -1139,7 +1139,7 @@
@@ -1141,7 +1141,7 @@
@ stdcall ZwQueryPerformanceCounter (long long) NtQueryPerformanceCounter
# @ stub ZwQueryPortInformationProcess
# @ stub ZwQueryQuotaInformationFile
@ -65,7 +65,7 @@ index 5bac269..32b023b 100644
@ stdcall ZwQuerySemaphore (long long long long long) NtQuerySemaphore
@ stdcall ZwQuerySymbolicLinkObject(long ptr ptr) NtQuerySymbolicLinkObject
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 4c4c05d..7e75f30 100644
index dc5db00..1dbe964 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2553,6 +2553,101 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *handle, ACCESS_MASK access, const OBJECT_
@ -148,16 +148,16 @@ index 4c4c05d..7e75f30 100644
+ return STATUS_SECTION_NOT_IMAGE;
+
+ memset( info, 0, sizeof(*info) );
+ info->EntryPoint = entry;
+ info->StackZeroBits = 0; /* FIXME */
+ info->StackReserved = 0; /* FIXME */
+ info->StackCommit = 0; /* FIXME */
+ info->ImageSubsystem = subsystem;
+ info->TransferAddress = entry;
+ info->ZeroBits = 0; /* FIXME */
+ info->MaximumStackSize = 0; /* FIXME */
+ info->CommittedStackSize = 0; /* FIXME */
+ info->SubSystemType = subsystem;
+ info->SubsystemVersionHigh = major_subsystem;
+ info->SubsystemVersionLow = minor_subsystem;
+ info->ImageCharacteristics = characteristics;
+ info->DllCharacteristics = dll_characteristics;
+ info->ImageMachineType = machine;
+ info->Machine = machine;
+ info->ImageContainsCode = TRUE; /* FIXME */
+ if (ret_len) *ret_len = sizeof(*info);
+ }
@ -256,7 +256,7 @@ index 64b3003..a701944 100644
if ((fd = get_obj_fd( &mapping->obj )))
{
diff --git a/server/protocol.def b/server/protocol.def
index 4854e3d..d5ca1f1 100644
index fc6bec5..8837ca4 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1619,6 +1619,13 @@ enum char_info_mode
@ -274,5 +274,5 @@ index 4854e3d..d5ca1f1 100644
obj_handle_t shared_file; /* shared mapping file handle */
@END
--
2.1.2
2.3.0

View File

@ -1,4 +1,4 @@
From e82054fc037cd8817bccb0864685e02d92bff3f3 Mon Sep 17 00:00:00 2001
From 26fabea3f9d17e404f802c130f6cb8c74b1d265d Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 16 Oct 2014 23:26:35 +0200
Subject: kernel32/tests: Add tests for NtQuerySection. (try 2)
@ -8,7 +8,7 @@ Subject: kernel32/tests: Add tests for NtQuerySection. (try 2)
1 file changed, 258 insertions(+)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 75e91d5..2607fdc 100644
index 75e91d5..8abe554 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -47,9 +47,27 @@ static struct _TEB * (WINAPI *pNtCurrentTeb)(void);
@ -172,19 +172,19 @@ index 75e91d5..2607fdc 100644
+ status = pNtQuerySection(mapping, SectionImageInformation, &info, sizeof(info), &ret);
+ ok(status == STATUS_SUCCESS, "NtQuerySection error %#x\n", status);
+ ok(ret == sizeof(info.image), "wrong returned size %u\n", ret);
+ ok((ULONG_PTR)info.image.EntryPoint == nt->OptionalHeader.ImageBase + nt->OptionalHeader.AddressOfEntryPoint,
+ "expected %#lx, got %p\n", (SIZE_T)(nt->OptionalHeader.ImageBase + nt->OptionalHeader.AddressOfEntryPoint), info.image.EntryPoint);
+ ok(info.image.StackZeroBits == 0, "expected 0, got %#x\n", info.image.StackZeroBits);
+ ok((ULONG_PTR)info.image.TransferAddress == nt->OptionalHeader.ImageBase + nt->OptionalHeader.AddressOfEntryPoint,
+ "expected %#lx, got %p\n", (SIZE_T)(nt->OptionalHeader.ImageBase + nt->OptionalHeader.AddressOfEntryPoint), info.image.TransferAddress);
+ ok(info.image.ZeroBits == 0, "expected 0, got %#x\n", info.image.ZeroBits);
+todo_wine
+ ok(info.image.StackReserved == nt->OptionalHeader.SizeOfStackReserve, "expected %#lx, got %#lx\n", (SIZE_T)nt->OptionalHeader.SizeOfStackReserve, info.image.StackReserved);
+ ok(info.image.MaximumStackSize == nt->OptionalHeader.SizeOfStackReserve, "expected %#lx, got %#lx\n", (SIZE_T)nt->OptionalHeader.SizeOfStackReserve, info.image.MaximumStackSize);
+todo_wine
+ ok(info.image.StackCommit == nt->OptionalHeader.SizeOfStackCommit, "expected %#lx, got %#lx\n", (SIZE_T)nt->OptionalHeader.SizeOfStackCommit, info.image.StackCommit);
+ ok(info.image.ImageSubsystem == nt->OptionalHeader.Subsystem, "expected %#x, got %#x\n", nt->OptionalHeader.Subsystem, info.image.ImageSubsystem);
+ ok(info.image.CommittedStackSize == nt->OptionalHeader.SizeOfStackCommit, "expected %#lx, got %#lx\n", (SIZE_T)nt->OptionalHeader.SizeOfStackCommit, info.image.CommittedStackSize);
+ ok(info.image.SubSystemType == nt->OptionalHeader.Subsystem, "expected %#x, got %#x\n", nt->OptionalHeader.Subsystem, info.image.SubSystemType);
+ ok(info.image.SubsystemVersionLow == nt->OptionalHeader.MinorSubsystemVersion, "expected %#x, got %#x\n", nt->OptionalHeader.MinorSubsystemVersion, info.image.SubsystemVersionLow);
+ ok(info.image.SubsystemVersionHigh == nt->OptionalHeader.MajorSubsystemVersion, "expected %#x, got %#x\n", nt->OptionalHeader.MajorSubsystemVersion, info.image.SubsystemVersionHigh);
+ ok(info.image.ImageCharacteristics == nt->FileHeader.Characteristics, "expected %#x, got %#x\n", nt->FileHeader.Characteristics, info.image.ImageCharacteristics);
+ ok(info.image.DllCharacteristics == nt->OptionalHeader.DllCharacteristics, "expected %#x, got %#x\n", nt->OptionalHeader.DllCharacteristics, info.image.DllCharacteristics);
+ ok(info.image.ImageMachineType == nt->FileHeader.Machine, "expected %#x, got %#x\n", nt->FileHeader.Machine, info.image.ImageMachineType);
+ ok(info.image.Machine == nt->FileHeader.Machine, "expected %#x, got %#x\n", nt->FileHeader.Machine, info.image.Machine);
+ ok(info.image.ImageContainsCode == TRUE, "expected 1, got %#x\n", info.image.ImageContainsCode);
+
+ memset(&info, 0x55, sizeof(info));
@ -300,5 +300,5 @@ index 75e91d5..2607fdc 100644
test_VirtualAlloc_protection();
test_VirtualProtect();
--
2.2.1
2.3.0