kernelbase: Implement internal KernelBaseGetGlobalData.

And call it from kernel32 to get access to kernelbase global data.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-03-31 12:06:40 +02:00 committed by Alexandre Julliard
parent 1ff9e76395
commit 981283a50b
5 changed files with 38 additions and 1 deletions

View File

@ -33,6 +33,9 @@
#include "winerror.h"
#include "winnt.h"
#include "winternl.h"
#include "kernel_private.h"
#include "wine/exception.h"
#include "wine/debug.h"
@ -156,6 +159,8 @@ struct mem_entry
#include "poppack.h"
struct kernelbase_global_data *kernelbase_global_data;
#define MAGIC_LOCAL_USED 0x5342
#define POINTER_TO_HANDLE( p ) (*(((const HGLOBAL *)( p )) - 2))
/* align the storage needed for the HLOCAL on an 8-byte boundary thus

View File

@ -123,6 +123,7 @@ static BOOL process_attach( HMODULE module )
RtlSetUnhandledExceptionFilter( UnhandledExceptionFilter );
NtQuerySystemInformation( SystemBasicInformation, &system_info, sizeof(system_info), NULL );
kernelbase_global_data = KernelBaseGetGlobalData();
copy_startup_info();

View File

@ -21,6 +21,17 @@
#ifndef __WINE_KERNEL_PRIVATE_H
#define __WINE_KERNEL_PRIVATE_H
/* not compatible with windows */
struct kernelbase_global_data
{
struct mem_entry *mem_entries;
struct mem_entry *mem_entries_end;
};
void *WINAPI KernelBaseGetGlobalData(void);
extern struct kernelbase_global_data *kernelbase_global_data;
NTSTATUS WINAPI BaseGetNamedObjectDirectory( HANDLE *dir );
static inline BOOL set_ntstatus( NTSTATUS status )

View File

@ -943,7 +943,7 @@
@ stdcall K32InitializeProcessForWsWatch(long) InitializeProcessForWsWatch
@ stdcall K32QueryWorkingSet(long ptr long) QueryWorkingSet
@ stdcall K32QueryWorkingSetEx(long ptr long) QueryWorkingSetEx
@ stub KernelBaseGetGlobalData
@ stdcall KernelBaseGetGlobalData()
@ stdcall LCIDToLocaleName(long ptr long long)
@ stdcall LCMapStringA(long long str long ptr long)
@ stdcall LCMapStringEx(wstr long wstr long ptr long ptr ptr long)

View File

@ -578,6 +578,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry )
* Global/local heap functions
***********************************************************************/
/* not compatible with windows */
struct kernelbase_global_data
{
struct mem_entry *mem_entries;
struct mem_entry *mem_entries_end;
};
#include "pshpack1.h"
struct mem_entry
@ -590,6 +597,8 @@ struct mem_entry
#include "poppack.h"
static struct kernelbase_global_data kernelbase_global_data = {0};
#define MAGIC_LOCAL_USED 0x5342
/* align the storage needed for the HLOCAL on an 8-byte boundary thus
* LocalAlloc/LocalReAlloc'ing with LMEM_MOVEABLE of memory with
@ -617,6 +626,17 @@ static inline void *unsafe_ptr_from_HLOCAL( HLOCAL handle )
return handle;
}
/***********************************************************************
* KernelBaseGetGlobalData (kernelbase.@)
*/
void *WINAPI KernelBaseGetGlobalData(void)
{
WARN_(globalmem)( "semi-stub!\n" );
return &kernelbase_global_data;
}
/***********************************************************************
* GlobalAlloc (kernelbase.@)
*/