ReactOS 0.4.15-dev-7942-gd23573b
library.h File Reference
#include <stdarg.h>
#include <sys/types.h>
#include <stdint.h>
#include <windef.h>
#include <winbase.h>
Include dependency graph for library.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  __wine_ldt_copy
 

Macros

#define WINE_LDT_EXTERN   extern
 
#define WINE_LDT_FLAGS_DATA   0x13 /* Data segment */
 
#define WINE_LDT_FLAGS_STACK   0x17 /* Stack segment */
 
#define WINE_LDT_FLAGS_CODE   0x1b /* Code segment */
 
#define WINE_LDT_FLAGS_TYPE_MASK   0x1f /* Mask for segment type */
 
#define WINE_LDT_FLAGS_32BIT   0x40 /* Segment is 32-bit (code or stack) */
 
#define WINE_LDT_FLAGS_ALLOCATED   0x80 /* Segment is allocated (no longer free) */
 
#define __DEFINE_GET_SEG(seg)   inline static unsigned short wine_get_##seg(void) { return 0; }
 
#define __DEFINE_SET_SEG(seg)   inline static void wine_set_##seg(int val) { /* nothing */ }
 

Typedefs

typedef void(* load_dll_callback_t) (void *, const char *)
 

Functions

const charwine_get_build_dir (void)
 
const charwine_get_config_dir (void)
 
const charwine_get_data_dir (void)
 
const charwine_get_server_dir (void)
 
const charwine_get_user_name (void)
 
void wine_init_argv0_path (const char *argv0)
 
void wine_exec_wine_binary (const char *name, char **argv, char **envp, int use_preloader)
 
voidwine_dlopen (const char *filename, int flag, char *error, size_t errorsize)
 
voidwine_dlsym (void *handle, const char *symbol, char *error, size_t errorsize)
 
int wine_dlclose (void *handle, char *error, size_t errorsize)
 
void wine_dll_set_callback (load_dll_callback_t load)
 
voidwine_dll_load (const char *filename, char *error, int errorsize, int *file_exists)
 
voidwine_dll_load_main_exe (const char *name, char *error, int errorsize, int test_only, int *file_exists)
 
void wine_dll_unload (void *handle)
 
int wine_dll_get_owner (const char *name, char *buffer, int size, int *file_exists)
 
void wine_init (int argc, char *argv[], char *error, int error_size)
 
void wine_dbg_add_option (const char *name, unsigned char set, unsigned char clear)
 
int wine_dbg_parse_options (const char *str)
 
void DECLSPEC_NORETURN wine_switch_to_stack (void(*func)(void *), void *arg, void *stack)
 
void wine_set_pe_load_area (void *base, size_t size)
 
void wine_free_pe_load_area (void)
 
voidwine_anon_mmap (void *start, size_t size, int prot, int flags)
 
void wine_mmap_add_reserved_area (void *addr, size_t size)
 
void wine_mmap_remove_reserved_area (void *addr, size_t size, int unmap)
 
int wine_mmap_is_in_reserved_area (void *addr, size_t size)
 
void wine_ldt_init_locking (void(*lock_func)(void), void(*unlock_func)(void))
 
void wine_ldt_get_entry (unsigned short sel, LDT_ENTRY *entry)
 
int wine_ldt_set_entry (unsigned short sel, const LDT_ENTRY *entry)
 
int wine_ldt_is_system (unsigned short sel)
 
voidwine_ldt_get_ptr (unsigned short sel, unsigned int offset)
 
unsigned short wine_ldt_alloc_entries (int count)
 
unsigned short wine_ldt_realloc_entries (unsigned short sel, int oldcount, int newcount)
 
void wine_ldt_free_entries (unsigned short sel, int count)
 
static unsigned short wine_ldt_alloc_fs (void)
 
static void wine_ldt_init_fs (unsigned short sel, const LDT_ENTRY *entry)
 
static void wine_ldt_free_fs (unsigned short sel)
 
static void wine_ldt_set_base (LDT_ENTRY *ent, const void *base)
 
static void wine_ldt_set_limit (LDT_ENTRY *ent, unsigned int limit)
 
static voidwine_ldt_get_base (const LDT_ENTRY *ent)
 
static unsigned int wine_ldt_get_limit (const LDT_ENTRY *ent)
 
static void wine_ldt_set_flags (LDT_ENTRY *ent, unsigned char flags)
 
static unsigned char wine_ldt_get_flags (const LDT_ENTRY *ent)
 
static int wine_ldt_is_empty (const LDT_ENTRY *ent)
 

Variables

int __wine_main_argc
 
char ** __wine_main_argv
 
WCHAR ** __wine_main_wargv
 
char ** __wine_main_environ
 
const char *(* __wine_dbgstr_an )(const char *s, int n)
 
const char *(* __wine_dbgstr_wn )(const WCHAR *s, int n)
 
const char *(* __wine_dbg_vsprintf )(const char *format, va_list args)
 
int(* __wine_dbg_vprintf )(const char *format, va_list args)
 
int(* __wine_dbg_vlog )(unsigned int cls, const char *channel, const char *function, const char *format, va_list args)
 
WINE_LDT_EXTERN struct __wine_ldt_copy wine_ldt_copy
 

Macro Definition Documentation

◆ __DEFINE_GET_SEG

#define __DEFINE_GET_SEG (   seg)    inline static unsigned short wine_get_##seg(void) { return 0; }

Definition at line 198 of file library.h.

◆ __DEFINE_SET_SEG

#define __DEFINE_SET_SEG (   seg)    inline static void wine_set_##seg(int val) { /* nothing */ }

Definition at line 199 of file library.h.

◆ WINE_LDT_EXTERN

#define WINE_LDT_EXTERN   extern

Definition at line 115 of file library.h.

◆ WINE_LDT_FLAGS_32BIT

#define WINE_LDT_FLAGS_32BIT   0x40 /* Segment is 32-bit (code or stack) */

Definition at line 129 of file library.h.

◆ WINE_LDT_FLAGS_ALLOCATED

#define WINE_LDT_FLAGS_ALLOCATED   0x80 /* Segment is allocated (no longer free) */

Definition at line 130 of file library.h.

◆ WINE_LDT_FLAGS_CODE

#define WINE_LDT_FLAGS_CODE   0x1b /* Code segment */

Definition at line 127 of file library.h.

◆ WINE_LDT_FLAGS_DATA

#define WINE_LDT_FLAGS_DATA   0x13 /* Data segment */

Definition at line 125 of file library.h.

◆ WINE_LDT_FLAGS_STACK

#define WINE_LDT_FLAGS_STACK   0x17 /* Stack segment */

Definition at line 126 of file library.h.

◆ WINE_LDT_FLAGS_TYPE_MASK

#define WINE_LDT_FLAGS_TYPE_MASK   0x1f /* Mask for segment type */

Definition at line 128 of file library.h.

Typedef Documentation

◆ load_dll_callback_t

typedef void(* load_dll_callback_t) (void *, const char *)

Definition at line 43 of file library.h.

Function Documentation

◆ wine_anon_mmap()

void * wine_anon_mmap ( void start,
size_t  size,
int  prot,
int  flags 
)

◆ wine_dbg_add_option()

void wine_dbg_add_option ( const char name,
unsigned char  set,
unsigned char  clear 
)

◆ wine_dbg_parse_options()

int wine_dbg_parse_options ( const char str)

◆ wine_dlclose()

int wine_dlclose ( void handle,
char error,
size_t  errorsize 
)

Definition at line 58 of file loader.c.

59{
60 return FreeLibrary(handle);
61}
#define FreeLibrary(x)
Definition: compat.h:748

Referenced by DllMain(), wined3d_dxtn_free(), and wined3d_dxtn_init().

◆ wine_dll_get_owner()

int wine_dll_get_owner ( const char name,
char buffer,
int  size,
int file_exists 
)

◆ wine_dll_load()

void * wine_dll_load ( const char filename,
char error,
int  errorsize,
int file_exists 
)

◆ wine_dll_load_main_exe()

void * wine_dll_load_main_exe ( const char name,
char error,
int  errorsize,
int  test_only,
int file_exists 
)

◆ wine_dll_set_callback()

void wine_dll_set_callback ( load_dll_callback_t  load)

◆ wine_dll_unload()

void wine_dll_unload ( void handle)

◆ wine_dlopen()

void * wine_dlopen ( const char filename,
int  flag,
char error,
size_t  errorsize 
)

Definition at line 53 of file loader.c.

54{
55 return LoadLibraryA(filename);
56}
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
const char * filename
Definition: ioapi.h:137

Referenced by ODBC_LoadDriverManager(), and wined3d_dxtn_init().

◆ wine_dlsym()

void * wine_dlsym ( void handle,
const char symbol,
char error,
size_t  errorsize 
)

Definition at line 48 of file loader.c.

49{
50 return GetProcAddress(handle, symbol);
51}
#define GetProcAddress(x, y)
Definition: compat.h:753

◆ wine_exec_wine_binary()

void wine_exec_wine_binary ( const char name,
char **  argv,
char **  envp,
int  use_preloader 
)

◆ wine_free_pe_load_area()

void wine_free_pe_load_area ( void  )

◆ wine_get_build_dir()

const char * wine_get_build_dir ( void  )

Definition at line 30 of file config.c.

31{
32 return NULL;
33}
#define NULL
Definition: types.h:112

Referenced by get_mono_path().

◆ wine_get_config_dir()

const char * wine_get_config_dir ( void  )

◆ wine_get_data_dir()

const char * wine_get_data_dir ( void  )

Definition at line 24 of file config.c.

25{
26 return NULL;
27}

Referenced by get_mono_path().

◆ wine_get_server_dir()

const char * wine_get_server_dir ( void  )

◆ wine_get_user_name()

const char * wine_get_user_name ( void  )

◆ wine_init()

void wine_init ( int  argc,
char argv[],
char error,
int  error_size 
)

◆ wine_init_argv0_path()

void wine_init_argv0_path ( const char argv0)

◆ wine_ldt_alloc_entries()

unsigned short wine_ldt_alloc_entries ( int  count)

◆ wine_ldt_alloc_fs()

static unsigned short wine_ldt_alloc_fs ( void  )
inlinestatic

Definition at line 101 of file library.h.

101{ return 0x0b; /* pseudo GDT selector */ }

◆ wine_ldt_free_entries()

void wine_ldt_free_entries ( unsigned short  sel,
int  count 
)

◆ wine_ldt_free_fs()

static void wine_ldt_free_fs ( unsigned short  sel)
inlinestatic

Definition at line 103 of file library.h.

103{ }

◆ wine_ldt_get_base()

static void * wine_ldt_get_base ( const LDT_ENTRY ent)
inlinestatic

Definition at line 145 of file library.h.

146{
147 return (void *)(ent->BaseLow |
148 (intptr_t)ent->HighWord.Bits.BaseMid << 16 |
149 (intptr_t)ent->HighWord.Bits.BaseHi << 24);
150}
int intptr_t
Definition: crtdefs.h:304
union _LDT_ENTRY::@358 HighWord
struct _LDT_ENTRY::@358::@360 Bits
WORD BaseLow
Definition: compat.h:779

◆ wine_ldt_get_entry()

void wine_ldt_get_entry ( unsigned short  sel,
LDT_ENTRY entry 
)

◆ wine_ldt_get_flags()

static unsigned char wine_ldt_get_flags ( const LDT_ENTRY ent)
inlinestatic

Definition at line 166 of file library.h.

167{
168 unsigned char ret = ent->HighWord.Bits.Type;
169 if (ent->HighWord.Bits.Default_Big) ret |= WINE_LDT_FLAGS_32BIT;
170 return ret;
171}
#define WINE_LDT_FLAGS_32BIT
Definition: library.h:129
int ret

◆ wine_ldt_get_limit()

static unsigned int wine_ldt_get_limit ( const LDT_ENTRY ent)
inlinestatic

Definition at line 151 of file library.h.

152{
153 unsigned int limit = ent->LimitLow | (ent->HighWord.Bits.LimitHi << 16);
154 if (ent->HighWord.Bits.Granularity) limit = (limit << 12) | 0xfff;
155 return limit;
156}
GLint limit
Definition: glext.h:10326
WORD LimitLow
Definition: compat.h:778

◆ wine_ldt_get_ptr()

void * wine_ldt_get_ptr ( unsigned short  sel,
unsigned int  offset 
)

◆ wine_ldt_init_fs()

static void wine_ldt_init_fs ( unsigned short  sel,
const LDT_ENTRY entry 
)
inlinestatic

Definition at line 102 of file library.h.

102{ }

◆ wine_ldt_init_locking()

void wine_ldt_init_locking ( void(*)(void lock_func,
void(*)(void unlock_func 
)

◆ wine_ldt_is_empty()

static int wine_ldt_is_empty ( const LDT_ENTRY ent)
inlinestatic

Definition at line 172 of file library.h.

173{
174 const DWORD *dw = (const DWORD *)ent;
175 return (dw[0] | dw[1]) == 0;
176}
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40

◆ wine_ldt_is_system()

int wine_ldt_is_system ( unsigned short  sel)

◆ wine_ldt_realloc_entries()

unsigned short wine_ldt_realloc_entries ( unsigned short  sel,
int  oldcount,
int  newcount 
)

◆ wine_ldt_set_base()

static void wine_ldt_set_base ( LDT_ENTRY ent,
const void base 
)
inlinestatic

Definition at line 133 of file library.h.

134{
135 ent->BaseLow = (WORD)(intptr_t)base;
136 ent->HighWord.Bits.BaseMid = (BYTE)((intptr_t)base >> 16);
137 ent->HighWord.Bits.BaseHi = (BYTE)((intptr_t)base >> 24);
138}
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned char BYTE
Definition: xxhash.c:193

◆ wine_ldt_set_entry()

int wine_ldt_set_entry ( unsigned short  sel,
const LDT_ENTRY entry 
)

◆ wine_ldt_set_flags()

static void wine_ldt_set_flags ( LDT_ENTRY ent,
unsigned char  flags 
)
inlinestatic

Definition at line 157 of file library.h.

158{
159 ent->HighWord.Bits.Dpl = 3;
160 ent->HighWord.Bits.Pres = 1;
161 ent->HighWord.Bits.Type = flags;
162 ent->HighWord.Bits.Sys = 0;
163 ent->HighWord.Bits.Reserved_0 = 0;
164 ent->HighWord.Bits.Default_Big = (flags & WINE_LDT_FLAGS_32BIT) != 0;
165}
GLbitfield flags
Definition: glext.h:7161

◆ wine_ldt_set_limit()

static void wine_ldt_set_limit ( LDT_ENTRY ent,
unsigned int  limit 
)
inlinestatic

Definition at line 139 of file library.h.

140{
141 if ((ent->HighWord.Bits.Granularity = (limit >= 0x100000))) limit >>= 12;
142 ent->LimitLow = (WORD)limit;
143 ent->HighWord.Bits.LimitHi = (limit >> 16);
144}

◆ wine_mmap_add_reserved_area()

void wine_mmap_add_reserved_area ( void addr,
size_t  size 
)

◆ wine_mmap_is_in_reserved_area()

int wine_mmap_is_in_reserved_area ( void addr,
size_t  size 
)

◆ wine_mmap_remove_reserved_area()

void wine_mmap_remove_reserved_area ( void addr,
size_t  size,
int  unmap 
)

◆ wine_set_pe_load_area()

void wine_set_pe_load_area ( void base,
size_t  size 
)

◆ wine_switch_to_stack()

void DECLSPEC_NORETURN wine_switch_to_stack ( void(*)(void *)  func,
void arg,
void stack 
)

Variable Documentation

◆ __wine_dbg_vlog

int(* __wine_dbg_vlog) (unsigned int cls, const char *channel, const char *function, const char *format, va_list args) ( unsigned int  cls,
const char channel,
const char function,
const char format,
va_list  args 
)
extern

◆ __wine_dbg_vprintf

int(* __wine_dbg_vprintf) (const char *format, va_list args) ( const char format,
va_list  args 
)
extern

◆ __wine_dbg_vsprintf

const char *(* __wine_dbg_vsprintf) (const char *format, va_list args) ( const char format,
va_list  args 
)
extern

◆ __wine_dbgstr_an

const char *(* __wine_dbgstr_an) (const char *s, int n) ( const char s,
int  n 
)
extern

◆ __wine_dbgstr_wn

const char *(* __wine_dbgstr_wn) (const WCHAR *s, int n) ( const WCHAR s,
int  n 
)
extern

◆ __wine_main_argc

int __wine_main_argc
extern

◆ __wine_main_argv

char** __wine_main_argv
extern

◆ __wine_main_environ

char** __wine_main_environ
extern

◆ __wine_main_wargv

WCHAR** __wine_main_wargv
extern

◆ wine_ldt_copy

Referenced by MapSL().