Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1d036c04
Commit
1d036c04
authored
Nov 24, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecrt0: Add a helper function and macro to simplify Unix library usage.
parent
ed510dd9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
unix_lib.c
dlls/winecrt0/unix_lib.c
+21
-2
unixlib.h
include/wine/unixlib.h
+9
-1
No files found.
dlls/winecrt0/unix_lib.c
View file @
1d036c04
...
...
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef __WINE_PE_BUILD
#include <stdarg.h>
#include "ntstatus.h"
...
...
@@ -29,6 +27,8 @@
#include "winternl.h"
#include "wine/unixlib.h"
#ifdef __WINE_PE_BUILD
static
NTSTATUS
(
WINAPI
*
p__wine_unix_call
)(
unixlib_handle_t
,
unsigned
int
,
void
*
);
static
void
load_func
(
void
**
func
,
const
char
*
name
,
void
*
def
)
...
...
@@ -54,3 +54,22 @@ NTSTATUS WINAPI __wine_unix_call( unixlib_handle_t handle, unsigned int code, vo
}
#endif
/* __WINE_PE_BUILD */
static
inline
void
*
image_base
(
void
)
{
#ifdef __WINE_PE_BUILD
extern
IMAGE_DOS_HEADER
__ImageBase
;
return
(
void
*
)
&
__ImageBase
;
#else
extern
IMAGE_NT_HEADERS
__wine_spec_nt_header
;
return
(
void
*
)((
__wine_spec_nt_header
.
OptionalHeader
.
ImageBase
+
0xffff
)
&
~
0xffff
);
#endif
}
unixlib_handle_t
__wine_unixlib_handle
=
0
;
NTSTATUS
WINAPI
__wine_init_unix_call
(
void
)
{
return
NtQueryVirtualMemory
(
GetCurrentProcess
(),
image_base
(),
MemoryWineUnixFuncs
,
&
__wine_unixlib_handle
,
sizeof
(
__wine_unixlib_handle
),
NULL
);
}
include/wine/unixlib.h
View file @
1d036c04
...
...
@@ -21,13 +21,14 @@
#ifndef __WINE_WINE_UNIXLIB_H
#define __WINE_WINE_UNIXLIB_H
typedef
NTSTATUS
(
*
unixlib_entry_t
)(
void
*
args
);
typedef
UINT64
unixlib_handle_t
;
extern
NTSTATUS
WINAPI
__wine_unix_call
(
unixlib_handle_t
handle
,
unsigned
int
code
,
void
*
args
);
#ifdef WINE_UNIX_LIB
typedef
NTSTATUS
(
*
unixlib_entry_t
)(
void
*
args
);
/* some useful helpers from ntdll */
extern
const
char
*
ntdll_get_build_dir
(
void
);
extern
const
char
*
ntdll_get_data_dir
(
void
);
...
...
@@ -264,6 +265,13 @@ static inline ULONG ntdll_wcstoul( const WCHAR *s, WCHAR **end, int base )
#define wcstol(str,e,b) ntdll_wcstol(str,e,b)
#define wcstoul(str,e,b) ntdll_wcstoul(str,e,b)
#else
/* WINE_UNIX_LIB */
extern
unixlib_handle_t
__wine_unixlib_handle
DECLSPEC_HIDDEN
;
extern
NTSTATUS
WINAPI
__wine_init_unix_call
(
void
)
DECLSPEC_HIDDEN
;
#define WINE_UNIX_CALL(code,args) __wine_unix_call( __wine_unixlib_handle, (code), (args) )
#endif
/* WINE_UNIX_LIB */
#endif
/* __WINE_WINE_UNIXLIB_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment