Commit 981283a5 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

kernelbase: Implement internal KernelBaseGetGlobalData.

And call it from kernel32 to get access to kernelbase global data. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 1ff9e763
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#include "winerror.h" #include "winerror.h"
#include "winnt.h" #include "winnt.h"
#include "winternl.h" #include "winternl.h"
#include "kernel_private.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -156,6 +159,8 @@ struct mem_entry ...@@ -156,6 +159,8 @@ struct mem_entry
#include "poppack.h" #include "poppack.h"
struct kernelbase_global_data *kernelbase_global_data;
#define MAGIC_LOCAL_USED 0x5342 #define MAGIC_LOCAL_USED 0x5342
#define POINTER_TO_HANDLE( p ) (*(((const HGLOBAL *)( p )) - 2)) #define POINTER_TO_HANDLE( p ) (*(((const HGLOBAL *)( p )) - 2))
/* align the storage needed for the HLOCAL on an 8-byte boundary thus /* align the storage needed for the HLOCAL on an 8-byte boundary thus
......
...@@ -123,6 +123,7 @@ static BOOL process_attach( HMODULE module ) ...@@ -123,6 +123,7 @@ static BOOL process_attach( HMODULE module )
RtlSetUnhandledExceptionFilter( UnhandledExceptionFilter ); RtlSetUnhandledExceptionFilter( UnhandledExceptionFilter );
NtQuerySystemInformation( SystemBasicInformation, &system_info, sizeof(system_info), NULL ); NtQuerySystemInformation( SystemBasicInformation, &system_info, sizeof(system_info), NULL );
kernelbase_global_data = KernelBaseGetGlobalData();
copy_startup_info(); copy_startup_info();
......
...@@ -21,6 +21,17 @@ ...@@ -21,6 +21,17 @@
#ifndef __WINE_KERNEL_PRIVATE_H #ifndef __WINE_KERNEL_PRIVATE_H
#define __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 ); NTSTATUS WINAPI BaseGetNamedObjectDirectory( HANDLE *dir );
static inline BOOL set_ntstatus( NTSTATUS status ) static inline BOOL set_ntstatus( NTSTATUS status )
......
...@@ -943,7 +943,7 @@ ...@@ -943,7 +943,7 @@
@ stdcall K32InitializeProcessForWsWatch(long) InitializeProcessForWsWatch @ stdcall K32InitializeProcessForWsWatch(long) InitializeProcessForWsWatch
@ stdcall K32QueryWorkingSet(long ptr long) QueryWorkingSet @ stdcall K32QueryWorkingSet(long ptr long) QueryWorkingSet
@ stdcall K32QueryWorkingSetEx(long ptr long) QueryWorkingSetEx @ stdcall K32QueryWorkingSetEx(long ptr long) QueryWorkingSetEx
@ stub KernelBaseGetGlobalData @ stdcall KernelBaseGetGlobalData()
@ stdcall LCIDToLocaleName(long ptr long long) @ stdcall LCIDToLocaleName(long ptr long long)
@ stdcall LCMapStringA(long long str long ptr long) @ stdcall LCMapStringA(long long str long ptr long)
@ stdcall LCMapStringEx(wstr long wstr long ptr long ptr ptr long) @ stdcall LCMapStringEx(wstr long wstr long ptr long ptr ptr long)
......
...@@ -578,6 +578,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry ) ...@@ -578,6 +578,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry )
* Global/local heap functions * 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" #include "pshpack1.h"
struct mem_entry struct mem_entry
...@@ -590,6 +597,8 @@ struct mem_entry ...@@ -590,6 +597,8 @@ struct mem_entry
#include "poppack.h" #include "poppack.h"
static struct kernelbase_global_data kernelbase_global_data = {0};
#define MAGIC_LOCAL_USED 0x5342 #define MAGIC_LOCAL_USED 0x5342
/* align the storage needed for the HLOCAL on an 8-byte boundary thus /* align the storage needed for the HLOCAL on an 8-byte boundary thus
* LocalAlloc/LocalReAlloc'ing with LMEM_MOVEABLE of memory with * LocalAlloc/LocalReAlloc'ing with LMEM_MOVEABLE of memory with
...@@ -617,6 +626,17 @@ static inline void *unsafe_ptr_from_HLOCAL( HLOCAL handle ) ...@@ -617,6 +626,17 @@ static inline void *unsafe_ptr_from_HLOCAL( HLOCAL handle )
return handle; return handle;
} }
/***********************************************************************
* KernelBaseGetGlobalData (kernelbase.@)
*/
void *WINAPI KernelBaseGetGlobalData(void)
{
WARN_(globalmem)( "semi-stub!\n" );
return &kernelbase_global_data;
}
/*********************************************************************** /***********************************************************************
* GlobalAlloc (kernelbase.@) * GlobalAlloc (kernelbase.@)
*/ */
......
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