From 6a19f586ea1f466d7eb3a4880ed3a7f01992e5d9 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 3 Oct 2014 18:24:10 +0200 Subject: [PATCH] Added patch to implement NtQuerySection. --- README.md | 3 +- debian/changelog | 1 + patches/Makefile | 19 +++ ...NtQuerySection-class-SectionBasicInf.patch | 121 ++++++++++++++++++ patches/ntdll-NtQuerySection/definition | 4 + 5 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 patches/ntdll-NtQuerySection/0001-ntdll-Implement-NtQuerySection-class-SectionBasicInf.patch create mode 100644 patches/ntdll-NtQuerySection/definition diff --git a/README.md b/README.md index 8b91f111..9e6514b4 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Wine. All those differences are also documented on the Included bugfixes and improvements ================================== -**Bugfixes and features included in the next upcoming release [9]:** +**Bugfixes and features included in the next upcoming release [10]:** * Correctly treat '.' when checking for empty directories ([Wine Bug #26272](http://bugs.winehq.org/show_bug.cgi?id=26272)) * Do not fail when a used context is passed to wglShareLists ([Wine Bug #11436](http://bugs.winehq.org/show_bug.cgi?id=11436)) @@ -43,6 +43,7 @@ Included bugfixes and improvements * Limit cross thread access to ImmSet* functions ([Wine Bug #35361](http://bugs.winehq.org/show_bug.cgi?id=35361)) * Send WM_PAINT event during dialog creation ([Wine Bug #35652](http://bugs.winehq.org/show_bug.cgi?id=35652)) * Support for IRichEditOle and ITextDocument support for ITextServices. ([Wine Bug #17042](http://bugs.winehq.org/show_bug.cgi?id=17042)) +* Support for NtQuerySection ([Wine Bug #37338](http://bugs.winehq.org/show_bug.cgi?id=37338)) * Unity3D Editor requires ProductId registry value ([Wine Bug #36964](http://bugs.winehq.org/show_bug.cgi?id=36964)) * Update a XIM candidate position when cursor location changes ([Wine Bug #30938](http://bugs.winehq.org/show_bug.cgi?id=30938)) * Voobly expects correct handling of WRITECOPY memory protection ([Wine Bug #29384](http://bugs.winehq.org/show_bug.cgi?id=29384)) diff --git a/debian/changelog b/debian/changelog index 6116e9bf..b3bc80f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ wine-compholio (1.7.28) UNRELEASED; urgency=low * Added patch for IRichEditOle and ITextDocument support for ITextServices. * Added patch to fix implementation of SH*Shared commands. * Added patch to handle WRITECOPY memory protection properly on i386. + * Added patch to implement NtQuerySection. * Added patches to make clearly visible, that this is a patched wine version. * Removed patch to support FIND_FIRST_EX_CASE_SENSITIVE flag in FindFirstFileExW (accepted upstream). * Removed patch to fix implementation of SH*Shared commands (accepted upstream). diff --git a/patches/Makefile b/patches/Makefile index fc60835b..ccdf70cc 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -47,6 +47,7 @@ PATCHLIST := \ ntdll-Fix_Free.ok \ ntdll-Heap_FreeLists.ok \ ntdll-Junction_Points.ok \ + ntdll-NtQuerySection.ok \ ntdll-Pipe_SpecialCharacters.ok \ ntdll-WRITECOPY.ok \ ntdll-loader_EntryPoint.ok \ @@ -682,6 +683,24 @@ ntdll-Junction_Points.ok: ntdll-Fix_Free.ok echo '+ { "ntdll-Junction_Points", "Erich E. Hoover", "Support for junction points/reparse points." },'; \ ) > ntdll-Junction_Points.ok +# Patchset ntdll-NtQuerySection +# | +# | Included patches: +# | * Implement NtQuerySection class SectionBasicInformation. [by Dmitry Timoshkov] +# | +# | This patchset fixes the following Wine bugs: +# | * [#37338] Support for NtQuerySection +# | +# | Modified files: +# | * dlls/ntdll/nt.c, dlls/ntdll/virtual.c, include/winternl.h +# | +.INTERMEDIATE: ntdll-NtQuerySection.ok +ntdll-NtQuerySection.ok: + $(call APPLY_FILE,ntdll-NtQuerySection/0001-ntdll-Implement-NtQuerySection-class-SectionBasicInf.patch) + @( \ + echo '+ { "ntdll-NtQuerySection", "Dmitry Timoshkov", "Implement NtQuerySection class SectionBasicInformation." },'; \ + ) > ntdll-NtQuerySection.ok + # Patchset ntdll-Pipe_SpecialCharacters # | # | Included patches: diff --git a/patches/ntdll-NtQuerySection/0001-ntdll-Implement-NtQuerySection-class-SectionBasicInf.patch b/patches/ntdll-NtQuerySection/0001-ntdll-Implement-NtQuerySection-class-SectionBasicInf.patch new file mode 100644 index 00000000..a9afba87 --- /dev/null +++ b/patches/ntdll-NtQuerySection/0001-ntdll-Implement-NtQuerySection-class-SectionBasicInf.patch @@ -0,0 +1,121 @@ +From bf3f5ae559f93ec5c0598574aa1838464a2ad701 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Fri, 3 Oct 2014 18:03:58 +0200 +Subject: ntdll: Implement NtQuerySection class SectionBasicInformation. + +--- + dlls/ntdll/nt.c | 19 ------------------- + dlls/ntdll/virtual.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + include/winternl.h | 2 +- + 3 files changed, 54 insertions(+), 20 deletions(-) + +diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c +index 73d9383..f0433db 100644 +--- a/dlls/ntdll/nt.c ++++ b/dlls/ntdll/nt.c +@@ -646,25 +646,6 @@ NTSTATUS WINAPI NtPrivilegeCheck( + } + + /* +- * Section +- */ +- +-/****************************************************************************** +- * NtQuerySection [NTDLL.@] +- */ +-NTSTATUS WINAPI NtQuerySection( +- IN HANDLE SectionHandle, +- IN SECTION_INFORMATION_CLASS SectionInformationClass, +- OUT PVOID SectionInformation, +- IN ULONG Length, +- OUT PULONG ResultLength) +-{ +- FIXME("(%p,%d,%p,0x%08x,%p) stub!\n", +- SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength); +- return 0; +-} +- +-/* + * ports + */ + +diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c +index 4819d2d..94b4827 100644 +--- a/dlls/ntdll/virtual.c ++++ b/dlls/ntdll/virtual.c +@@ -2465,6 +2465,59 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *handle, ACCESS_MASK access, const OBJECT_ + + + /*********************************************************************** ++ * NtQuerySection (NTDLL.@) ++ */ ++NTSTATUS WINAPI NtQuerySection(HANDLE handle, SECTION_INFORMATION_CLASS info_class, ++ PVOID buffer, ULONG len, PULONG ret_len) ++{ ++ SECTION_BASIC_INFORMATION *info; ++ HANDLE dup_mapping, shared_file; ++ unsigned protect; ++ LARGE_INTEGER size; ++ void *base; ++ NTSTATUS res; ++ ++ if (info_class != SectionBasicInformation) ++ { ++ FIXME("%p,info_class=%d,%p,%d,%p) Unknown information class\n", ++ handle, info_class, buffer, len, ret_len); ++ return STATUS_INVALID_INFO_CLASS; ++ } ++ ++ if (len < sizeof(SECTION_BASIC_INFORMATION)) ++ return STATUS_INFO_LENGTH_MISMATCH; ++ ++ SERVER_START_REQ( get_mapping_info ) ++ { ++ req->handle = wine_server_obj_handle( handle ); ++ req->access = SECTION_QUERY; ++ res = wine_server_call( req ); ++ protect = reply->protect; ++ base = wine_server_get_ptr( reply->base ); ++ size.QuadPart = reply->size; ++ dup_mapping = wine_server_ptr_handle( reply->mapping ); ++ shared_file = wine_server_ptr_handle( reply->shared_file ); ++ if ((ULONG_PTR)base != reply->base) base = NULL; ++ } ++ SERVER_END_REQ; ++ if (res) return res; ++ ++ info = buffer; ++ info->BaseAddress = base; ++ info->Size = size; ++ info->Attributes = (protect & VPROT_COMMITTED) ? SEC_COMMIT : SEC_RESERVE; ++ if (protect & VPROT_NOCACHE) info->Attributes |= SEC_NOCACHE; ++ if (protect & VPROT_IMAGE) info->Attributes |= SEC_IMAGE; ++ /* FIXME: SEC_FILE */ ++ if (ret_len) *ret_len = sizeof(*info); ++ ++ if (dup_mapping) NtClose( dup_mapping ); ++ if (shared_file) NtClose( shared_file ); ++ return STATUS_SUCCESS; ++} ++ ++ ++/*********************************************************************** + * NtMapViewOfSection (NTDLL.@) + * ZwMapViewOfSection (NTDLL.@) + */ +diff --git a/include/winternl.h b/include/winternl.h +index 95951e2..ee08187 100644 +--- a/include/winternl.h ++++ b/include/winternl.h +@@ -1791,7 +1791,7 @@ typedef enum _SECTION_INFORMATION_CLASS + } SECTION_INFORMATION_CLASS; + + typedef struct _SECTION_BASIC_INFORMATION { +- ULONG BaseAddress; ++ PVOID BaseAddress; + ULONG Attributes; + LARGE_INTEGER Size; + } SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION; +-- +2.1.1 + diff --git a/patches/ntdll-NtQuerySection/definition b/patches/ntdll-NtQuerySection/definition new file mode 100644 index 00000000..85269603 --- /dev/null +++ b/patches/ntdll-NtQuerySection/definition @@ -0,0 +1,4 @@ +Author: Dmitry Timoshkov +Subject: Implement NtQuerySection class SectionBasicInformation. +Revision: 1 +Fixes: [37338] Support for NtQuerySection