Commit cd4fcf9a authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add a helper function to map a section.

parent 8cdb593f
...@@ -2458,10 +2458,9 @@ NTSTATUS WINAPI NtGetNlsSectionPtr( ULONG type, ULONG id, void *unknown, void ** ...@@ -2458,10 +2458,9 @@ NTSTATUS WINAPI NtGetNlsSectionPtr( ULONG type, ULONG id, void *unknown, void **
} }
if (!status) if (!status)
{ {
*ptr = NULL; status = map_section( handle, ptr, size, PAGE_READONLY );
*size = 0; NtClose( handle );
status = NtMapViewOfSection( handle, GetCurrentProcess(), ptr, 0, 0, NULL, size, }
ViewShare, 0, PAGE_READONLY );
} }
NtClose( handle ); NtClose( handle );
return status; return status;
......
...@@ -2032,11 +2032,7 @@ static void load_apiset_dll(void) ...@@ -2032,11 +2032,7 @@ static void load_apiset_dll(void)
} }
if (!status) if (!status)
{ {
ptr = NULL; status = map_section( mapping, &ptr, &size, PAGE_READONLY );
size = 0;
status = NtMapViewOfSection( mapping, NtCurrentProcess(), &ptr,
is_win64 && wow_peb ? 0x7fffffff : 0, 0, NULL,
&size, ViewShare, 0, PAGE_READONLY );
NtClose( mapping ); NtClose( mapping );
} }
if (!status) if (!status)
......
...@@ -450,4 +450,12 @@ static inline void init_unicode_string( UNICODE_STRING *str, const WCHAR *data ) ...@@ -450,4 +450,12 @@ static inline void init_unicode_string( UNICODE_STRING *str, const WCHAR *data )
str->Buffer = (WCHAR *)data; str->Buffer = (WCHAR *)data;
} }
static inline NTSTATUS map_section( HANDLE mapping, void **ptr, SIZE_T *size, ULONG protect )
{
*ptr = NULL;
*size = 0;
return NtMapViewOfSection( mapping, NtCurrentProcess(), ptr, is_win64 && wow_peb ? 0x7fffffff : 0,
0, NULL, size, ViewShare, 0, protect );
}
#endif /* __NTDLL_UNIX_PRIVATE_H */ #endif /* __NTDLL_UNIX_PRIVATE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment