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
4f58d814
Commit
4f58d814
authored
Dec 09, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Remove __wine_init_unix_lib() and the old Unix library interface.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2aa9c521
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
9 additions
and
197 deletions
+9
-197
loader.c
dlls/ntdll/loader.c
+0
-24
ntdll.spec
dlls/ntdll/ntdll.spec
+0
-1
loader.c
dlls/ntdll/unix/loader.c
+1
-97
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-3
virtual.c
dlls/ntdll/unix/virtual.c
+5
-57
unixlib.h
dlls/ntdll/unixlib.h
+1
-2
unix_lib.c
dlls/winecrt0/unix_lib.c
+0
-12
winternl.h
include/winternl.h
+1
-1
No files found.
dlls/ntdll/loader.c
View file @
4f58d814
...
...
@@ -3042,24 +3042,6 @@ done:
/***********************************************************************
* __wine_init_unix_lib
*/
NTSTATUS
__cdecl
__wine_init_unix_lib
(
HMODULE
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
)
{
WINE_MODREF
*
wm
;
NTSTATUS
ret
;
RtlEnterCriticalSection
(
&
loader_section
);
if
((
wm
=
get_modref
(
module
)))
ret
=
unix_funcs
->
init_unix_lib
(
module
,
reason
,
ptr_in
,
ptr_out
);
else
ret
=
STATUS_INVALID_HANDLE
;
RtlLeaveCriticalSection
(
&
loader_section
);
return
ret
;
}
/***********************************************************************
* __wine_ctrl_routine
*/
NTSTATUS
WINAPI
__wine_ctrl_routine
(
void
*
arg
)
...
...
@@ -4450,11 +4432,6 @@ static void CDECL init_builtin_dll_fallback( void *module )
{
}
static
NTSTATUS
CDECL
init_unix_lib_fallback
(
void
*
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
)
{
return
STATUS_DLL_NOT_FOUND
;
}
static
NTSTATUS
CDECL
unwind_builtin_dll_fallback
(
ULONG
type
,
struct
_DISPATCHER_CONTEXT
*
dispatch
,
CONTEXT
*
context
)
{
...
...
@@ -4472,7 +4449,6 @@ static const struct unix_funcs unix_fallbacks =
{
load_so_dll_fallback
,
init_builtin_dll_fallback
,
init_unix_lib_fallback
,
unwind_builtin_dll_fallback
,
RtlGetSystemTimePrecise_fallback
,
};
...
...
dlls/ntdll/ntdll.spec
View file @
4f58d814
...
...
@@ -1633,7 +1633,6 @@
@ stdcall -syscall __wine_unix_call(int64 long ptr)
@ stdcall -syscall __wine_unix_spawnvp(long ptr)
@ cdecl __wine_set_unix_funcs(long ptr)
@ cdecl __wine_init_unix_lib(long long ptr ptr)
@ stdcall __wine_ctrl_routine(ptr)
@ extern __wine_syscall_dispatcher
@ extern -arch=i386 __wine_ldt_copy
...
...
dlls/ntdll/unix/loader.c
View file @
4f58d814
...
...
@@ -1019,21 +1019,6 @@ static ULONG_PTR find_named_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY
return
0
;
}
static
ULONG_PTR
find_pe_export
(
HMODULE
module
,
const
IMAGE_EXPORT_DIRECTORY
*
exports
,
const
IMAGE_IMPORT_BY_NAME
*
name
)
{
const
WORD
*
ordinals
=
(
const
WORD
*
)((
BYTE
*
)
module
+
exports
->
AddressOfNameOrdinals
);
const
DWORD
*
names
=
(
const
DWORD
*
)((
BYTE
*
)
module
+
exports
->
AddressOfNames
);
if
(
name
->
Hint
<
exports
->
NumberOfNames
)
{
char
*
ename
=
(
char
*
)
module
+
names
[
name
->
Hint
];
if
(
!
strcmp
(
ename
,
(
char
*
)
name
->
Name
))
return
find_ordinal_export
(
module
,
exports
,
ordinals
[
name
->
Hint
]
);
}
return
find_named_export
(
module
,
exports
,
(
char
*
)
name
->
Name
);
}
static
inline
void
*
get_rva
(
void
*
module
,
ULONG_PTR
addr
)
{
return
(
BYTE
*
)
module
+
addr
;
...
...
@@ -1055,49 +1040,6 @@ static const void *get_module_data_dir( HMODULE module, ULONG dir, ULONG *size )
return
get_rva
(
module
,
data
->
VirtualAddress
);
}
static
NTSTATUS
fixup_ntdll_imports
(
const
char
*
name
,
HMODULE
module
)
{
const
IMAGE_IMPORT_DESCRIPTOR
*
descr
;
const
IMAGE_THUNK_DATA
*
import_list
;
IMAGE_THUNK_DATA
*
thunk_list
;
if
(
!
(
descr
=
get_module_data_dir
(
module
,
IMAGE_FILE_IMPORT_DIRECTORY
,
NULL
)))
return
STATUS_SUCCESS
;
for
(;
descr
->
Name
&&
descr
->
FirstThunk
;
descr
++
)
{
thunk_list
=
get_rva
(
module
,
descr
->
FirstThunk
);
/* ntdll must be the only import */
if
(
strcmp
(
get_rva
(
module
,
descr
->
Name
),
"ntdll.dll"
))
{
ERR
(
"module %s is importing %s
\n
"
,
debugstr_a
(
name
),
(
char
*
)
get_rva
(
module
,
descr
->
Name
));
return
STATUS_PROCEDURE_NOT_FOUND
;
}
if
(
descr
->
u
.
OriginalFirstThunk
)
import_list
=
get_rva
(
module
,
descr
->
u
.
OriginalFirstThunk
);
else
import_list
=
thunk_list
;
while
(
import_list
->
u1
.
Ordinal
)
{
if
(
IMAGE_SNAP_BY_ORDINAL
(
import_list
->
u1
.
Ordinal
))
{
int
ordinal
=
IMAGE_ORDINAL
(
import_list
->
u1
.
Ordinal
)
-
ntdll_exports
->
Base
;
thunk_list
->
u1
.
Function
=
find_ordinal_export
(
ntdll_module
,
ntdll_exports
,
ordinal
);
if
(
!
thunk_list
->
u1
.
Function
)
ERR
(
"%s: ntdll.%u not found
\n
"
,
debugstr_a
(
name
),
ordinal
);
}
else
/* import by name */
{
IMAGE_IMPORT_BY_NAME
*
pe_name
=
get_rva
(
module
,
import_list
->
u1
.
AddressOfData
);
thunk_list
->
u1
.
Function
=
find_pe_export
(
ntdll_module
,
ntdll_exports
,
pe_name
);
if
(
!
thunk_list
->
u1
.
Function
)
ERR
(
"%s: ntdll.%s not found
\n
"
,
debugstr_a
(
name
),
pe_name
->
Name
);
}
import_list
++
;
thunk_list
++
;
}
}
return
STATUS_SUCCESS
;
}
static
void
load_ntdll_functions
(
HMODULE
module
)
{
ntdll_exports
=
get_module_data_dir
(
module
,
IMAGE_FILE_EXPORT_DIRECTORY
,
NULL
);
...
...
@@ -1385,38 +1327,6 @@ already_loaded:
/***********************************************************************
* init_unix_lib
*/
static
NTSTATUS
CDECL
init_unix_lib
(
void
*
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
)
{
NTSTATUS
(
CDECL
*
init_func
)(
HMODULE
,
DWORD
,
const
void
*
,
void
*
);
const
IMAGE_NT_HEADERS
*
nt
;
const
char
*
name
;
void
*
handle
,
*
entry
,
*
unix_module
;
NTSTATUS
status
;
if
((
status
=
get_builtin_unix_info
(
module
,
&
name
,
&
handle
,
&
entry
)))
return
status
;
if
(
!
entry
)
{
if
(
!
name
||
!
handle
)
return
STATUS_DLL_NOT_FOUND
;
if
(
!
(
nt
=
dlsym
(
handle
,
"__wine_spec_nt_header"
))
||
!
(
entry
=
dlsym
(
handle
,
"__wine_init_unix_lib"
)))
return
STATUS_INVALID_IMAGE_FORMAT
;
TRACE
(
"loaded %s for %p
\n
"
,
debugstr_a
(
name
),
module
);
unix_module
=
(
void
*
)((
nt
->
OptionalHeader
.
ImageBase
+
0xffff
)
&
~
0xffff
);
map_so_dll
(
nt
,
unix_module
);
fixup_ntdll_imports
(
name
,
unix_module
);
set_builtin_unix_entry
(
module
,
entry
);
}
init_func
=
entry
;
return
init_func
(
module
,
reason
,
ptr_in
,
ptr_out
);
}
/***********************************************************************
* ntdll_init_syscalls
*/
NTSTATUS
ntdll_init_syscalls
(
ULONG
id
,
SYSTEM_SERVICE_TABLE
*
table
,
void
**
dispatcher
)
...
...
@@ -1716,13 +1626,8 @@ static NTSTATUS find_builtin_dll( UNICODE_STRING *nt_name, void **module, SIZE_T
done:
if
(
status
>=
0
&&
ext
)
{
void
*
handle
;
strcpy
(
ext
,
".so"
);
if
((
handle
=
dlopen
(
ptr
,
RTLD_NOW
)))
{
if
(
set_builtin_unix_handle
(
*
module
,
ptr
,
handle
))
dlclose
(
handle
);
}
load_builtin_unixlib
(
*
module
,
ptr
);
}
free
(
file
);
return
status
;
...
...
@@ -2158,7 +2063,6 @@ static struct unix_funcs unix_funcs =
{
load_so_dll
,
init_builtin_dll
,
init_unix_lib
,
unwind_builtin_dll
,
RtlGetSystemTimePrecise
,
#ifdef __aarch64__
...
...
dlls/ntdll/unix/unix_private.h
View file @
4f58d814
...
...
@@ -220,9 +220,7 @@ extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
SECTION_IMAGE_INFORMATION
*
info
)
DECLSPEC_HIDDEN
;
extern
void
release_builtin_module
(
void
*
module
)
DECLSPEC_HIDDEN
;
extern
void
*
get_builtin_so_handle
(
void
*
module
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
get_builtin_unix_info
(
void
*
module
,
const
char
**
name
,
void
**
handle
,
void
**
entry
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
set_builtin_unix_handle
(
void
*
module
,
const
char
*
name
,
void
*
handle
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
set_builtin_unix_entry
(
void
*
module
,
void
*
entry
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
load_builtin_unixlib
(
void
*
module
,
const
char
*
name
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
get_thread_ldt_entry
(
HANDLE
handle
,
void
*
data
,
ULONG
len
,
ULONG
*
ret_len
)
DECLSPEC_HIDDEN
;
extern
void
*
get_native_context
(
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unix/virtual.c
View file @
4f58d814
...
...
@@ -102,9 +102,7 @@ struct builtin_module
unsigned
int
refcount
;
void
*
handle
;
void
*
module
;
char
*
unix_name
;
void
*
unix_handle
;
void
*
unix_entry
;
};
static
struct
list
builtin_modules
=
LIST_INIT
(
builtin_modules
);
...
...
@@ -589,9 +587,7 @@ static void add_builtin_module( void *module, void *handle )
builtin
->
handle
=
handle
;
builtin
->
module
=
module
;
builtin
->
refcount
=
1
;
builtin
->
unix_name
=
NULL
;
builtin
->
unix_handle
=
NULL
;
builtin
->
unix_entry
=
NULL
;
list_add_tail
(
&
builtin_modules
,
&
builtin
->
entry
);
}
...
...
@@ -611,7 +607,6 @@ void release_builtin_module( void *module )
list_remove
(
&
builtin
->
entry
);
if
(
builtin
->
handle
)
dlclose
(
builtin
->
handle
);
if
(
builtin
->
unix_handle
)
dlclose
(
builtin
->
unix_handle
);
free
(
builtin
->
unix_name
);
free
(
builtin
);
}
break
;
...
...
@@ -668,45 +663,22 @@ static NTSTATUS get_builtin_unix_funcs( void *module, BOOL wow, void **funcs )
/***********************************************************************
*
get_builtin_unix_info
*
load_builtin_unixlib
*/
NTSTATUS
get_builtin_unix_info
(
void
*
module
,
const
char
**
name
,
void
**
handle
,
void
**
entry
)
{
sigset_t
sigset
;
NTSTATUS
status
=
STATUS_DLL_NOT_FOUND
;
struct
builtin_module
*
builtin
;
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
LIST_FOR_EACH_ENTRY
(
builtin
,
&
builtin_modules
,
struct
builtin_module
,
entry
)
{
if
(
builtin
->
module
!=
module
)
continue
;
*
name
=
builtin
->
unix_name
;
*
handle
=
builtin
->
unix_handle
;
*
entry
=
builtin
->
unix_entry
;
status
=
STATUS_SUCCESS
;
break
;
}
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
return
status
;
}
/***********************************************************************
* set_builtin_unix_handle
*/
NTSTATUS
set_builtin_unix_handle
(
void
*
module
,
const
char
*
name
,
void
*
handle
)
NTSTATUS
load_builtin_unixlib
(
void
*
module
,
const
char
*
name
)
{
void
*
handle
;
sigset_t
sigset
;
NTSTATUS
status
=
STATUS_DLL_NOT_FOUND
;
struct
builtin_module
*
builtin
;
if
(
!
(
handle
=
dlopen
(
name
,
RTLD_NOW
)))
return
status
;
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
LIST_FOR_EACH_ENTRY
(
builtin
,
&
builtin_modules
,
struct
builtin_module
,
entry
)
{
if
(
builtin
->
module
!=
module
)
continue
;
if
(
!
builtin
->
unix_handle
)
{
builtin
->
unix_name
=
strdup
(
name
);
builtin
->
unix_handle
=
handle
;
status
=
STATUS_SUCCESS
;
}
...
...
@@ -714,31 +686,7 @@ NTSTATUS set_builtin_unix_handle( void *module, const char *name, void *handle )
break
;
}
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
return
status
;
}
/***********************************************************************
* set_builtin_unix_entry
*/
NTSTATUS
set_builtin_unix_entry
(
void
*
module
,
void
*
entry
)
{
sigset_t
sigset
;
NTSTATUS
status
=
STATUS_DLL_NOT_FOUND
;
struct
builtin_module
*
builtin
;
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
LIST_FOR_EACH_ENTRY
(
builtin
,
&
builtin_modules
,
struct
builtin_module
,
entry
)
{
if
(
builtin
->
module
!=
module
)
continue
;
if
(
builtin
->
unix_handle
)
{
builtin
->
unix_entry
=
entry
;
status
=
STATUS_SUCCESS
;
}
break
;
}
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
if
(
status
)
dlclose
(
handle
);
return
status
;
}
...
...
dlls/ntdll/unixlib.h
View file @
4f58d814
...
...
@@ -26,14 +26,13 @@
struct
_DISPATCHER_CONTEXT
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 13
3
#define NTDLL_UNIXLIB_VERSION 13
4
struct
unix_funcs
{
/* loader functions */
NTSTATUS
(
CDECL
*
load_so_dll
)(
UNICODE_STRING
*
nt_name
,
void
**
module
);
void
(
CDECL
*
init_builtin_dll
)(
void
*
module
);
NTSTATUS
(
CDECL
*
init_unix_lib
)(
void
*
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
);
NTSTATUS
(
CDECL
*
unwind_builtin_dll
)(
ULONG
type
,
struct
_DISPATCHER_CONTEXT
*
dispatch
,
CONTEXT
*
context
);
/* other Win32 API functions */
...
...
dlls/winecrt0/unix_lib.c
View file @
4f58d814
...
...
@@ -29,7 +29,6 @@
#include "winternl.h"
#include "wine/unixlib.h"
static
NTSTATUS
(
__cdecl
*
p__wine_init_unix_lib
)(
HMODULE
,
DWORD
,
const
void
*
,
void
*
);
static
NTSTATUS
(
WINAPI
*
p__wine_unix_call
)(
unixlib_handle_t
,
unsigned
int
,
void
*
);
static
void
load_func
(
void
**
func
,
const
char
*
name
,
void
*
def
)
...
...
@@ -43,22 +42,11 @@ static void load_func( void **func, const char *name, void *def )
}
#define LOAD_FUNC(name) load_func( (void **)&p ## name, #name, fallback ## name )
static
NTSTATUS
__cdecl
fallback__wine_init_unix_lib
(
HMODULE
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
)
{
return
STATUS_DLL_NOT_FOUND
;
}
static
NTSTATUS
__cdecl
fallback__wine_unix_call
(
unixlib_handle_t
handle
,
unsigned
int
code
,
void
*
args
)
{
return
STATUS_DLL_NOT_FOUND
;
}
NTSTATUS
__cdecl
__wine_init_unix_lib
(
HMODULE
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
)
{
LOAD_FUNC
(
__wine_init_unix_lib
);
return
p__wine_init_unix_lib
(
module
,
reason
,
ptr_in
,
ptr_out
);
}
NTSTATUS
WINAPI
__wine_unix_call
(
unixlib_handle_t
handle
,
unsigned
int
code
,
void
*
args
)
{
LOAD_FUNC
(
__wine_unix_call
);
...
...
include/winternl.h
View file @
4f58d814
...
...
@@ -4680,7 +4680,7 @@ static inline PLIST_ENTRY RemoveTailList(PLIST_ENTRY le)
#ifdef __WINESRC__
/* Wine internal functions */
extern
NTSTATUS
CDECL
__wine_init_unix_lib
(
HMODULE
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
);
extern
NTSTATUS
WINAPI
__wine_unix_spawnvp
(
char
*
const
argv
[],
int
wait
);
/* The thread information for 16-bit threads */
...
...
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