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
65edf192
Commit
65edf192
authored
May 30, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use nameless unions/structs for loader data.
parent
7f088b0b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
36 deletions
+26
-36
actctx.c
dlls/ntdll/actctx.c
+4
-5
loader.c
dlls/ntdll/loader.c
+5
-7
locale.c
dlls/ntdll/locale.c
+0
-2
resource.c
dlls/ntdll/resource.c
+11
-13
thread.c
dlls/ntdll/thread.c
+0
-1
loader.c
dlls/ntdll/unix/loader.c
+6
-8
No files found.
dlls/ntdll/actctx.c
View file @
65edf192
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "winternl.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "ddk/wdm.h"
#include "ntdll_misc.h"
#include "ntdll_misc.h"
...
@@ -2942,7 +2941,7 @@ static NTSTATUS find_first_manifest_resource_in_module( HANDLE hModule, const WC
...
@@ -2942,7 +2941,7 @@ static NTSTATUS find_first_manifest_resource_in_module( HANDLE hModule, const WC
if
(
!
resdir
->
NumberOfIdEntries
)
return
STATUS_RESOURCE_NAME_NOT_FOUND
;
if
(
!
resdir
->
NumberOfIdEntries
)
return
STATUS_RESOURCE_NAME_NOT_FOUND
;
entry_base
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
resdir
+
1
);
entry_base
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
resdir
+
1
);
entry
=
entry_base
+
resdir
->
NumberOfNamedEntries
;
entry
=
entry_base
+
resdir
->
NumberOfNamedEntries
;
*
resname
=
(
const
WCHAR
*
)(
ULONG_PTR
)
entry
->
u
.
Id
;
*
resname
=
(
const
WCHAR
*
)(
ULONG_PTR
)
entry
->
Id
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
...
@@ -3285,14 +3284,14 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
...
@@ -3285,14 +3284,14 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
if
(
!
open_nt_file
(
&
handle
,
&
path_us
))
if
(
!
open_nt_file
(
&
handle
,
&
path_us
))
{
{
io
.
u
.
Status
=
get_manifest_in_manifest_file
(
acl
,
&
sxs_ai
,
path_us
.
Buffer
,
file
,
TRUE
,
handle
);
io
.
Status
=
get_manifest_in_manifest_file
(
acl
,
&
sxs_ai
,
path_us
.
Buffer
,
file
,
TRUE
,
handle
);
NtClose
(
handle
);
NtClose
(
handle
);
}
}
else
io
.
u
.
Status
=
STATUS_NO_SUCH_FILE
;
else
io
.
Status
=
STATUS_NO_SUCH_FILE
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
file
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
file
);
RtlFreeUnicodeString
(
&
path_us
);
RtlFreeUnicodeString
(
&
path_us
);
return
io
.
u
.
Status
;
return
io
.
Status
;
}
}
static
NTSTATUS
lookup_assembly
(
struct
actctx_loader
*
acl
,
static
NTSTATUS
lookup_assembly
(
struct
actctx_loader
*
acl
,
...
...
dlls/ntdll/loader.c
View file @
65edf192
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "windef.h"
#include "winnt.h"
#include "winnt.h"
#include "winioctl.h"
#include "winioctl.h"
...
@@ -1057,8 +1055,8 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
...
@@ -1057,8 +1055,8 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
DWORD
protect_old
;
DWORD
protect_old
;
thunk_list
=
get_rva
(
module
,
(
DWORD
)
descr
->
FirstThunk
);
thunk_list
=
get_rva
(
module
,
(
DWORD
)
descr
->
FirstThunk
);
if
(
descr
->
u
.
OriginalFirstThunk
)
if
(
descr
->
OriginalFirstThunk
)
import_list
=
get_rva
(
module
,
(
DWORD
)
descr
->
u
.
OriginalFirstThunk
);
import_list
=
get_rva
(
module
,
(
DWORD
)
descr
->
OriginalFirstThunk
);
else
else
import_list
=
thunk_list
;
import_list
=
thunk_list
;
...
@@ -2134,7 +2132,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
...
@@ -2134,7 +2132,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
if
(
id
)
wm
->
id
=
*
id
;
if
(
id
)
wm
->
id
=
*
id
;
if
(
image_info
->
LoaderFlags
)
wm
->
ldr
.
Flags
|=
LDR_COR_IMAGE
;
if
(
image_info
->
LoaderFlags
)
wm
->
ldr
.
Flags
|=
LDR_COR_IMAGE
;
if
(
image_info
->
u
.
s
.
ComPlusILOnly
)
wm
->
ldr
.
Flags
|=
LDR_COR_ILONLY
;
if
(
image_info
->
ComPlusILOnly
)
wm
->
ldr
.
Flags
|=
LDR_COR_ILONLY
;
wm
->
system
=
system
;
wm
->
system
=
system
;
set_security_cookie
(
*
module
,
map_size
);
set_security_cookie
(
*
module
,
map_size
);
...
@@ -2352,7 +2350,7 @@ static BOOL is_valid_binary( HANDLE file, const SECTION_IMAGE_INFORMATION *info
...
@@ -2352,7 +2350,7 @@ static BOOL is_valid_binary( HANDLE file, const SECTION_IMAGE_INFORMATION *info
if
(
current_machine
==
IMAGE_FILE_MACHINE_AMD64
&&
has_chpe_metadata
(
file
,
info
))
return
TRUE
;
if
(
current_machine
==
IMAGE_FILE_MACHINE_AMD64
&&
has_chpe_metadata
(
file
,
info
))
return
TRUE
;
/* support 32-bit IL-only images on 64-bit */
/* support 32-bit IL-only images on 64-bit */
if
(
!
info
->
ImageContainsCode
)
return
TRUE
;
if
(
!
info
->
ImageContainsCode
)
return
TRUE
;
if
(
info
->
u
.
s
.
ComPlusNativeReady
)
return
TRUE
;
if
(
info
->
ComPlusNativeReady
)
return
TRUE
;
return
is_com_ilonly
(
file
,
info
);
return
is_com_ilonly
(
file
,
info
);
}
}
...
@@ -4188,7 +4186,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
...
@@ -4188,7 +4186,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
#elif defined(__arm__)
#elif defined(__arm__)
entry
=
(
void
**
)
&
context
->
R0
;
entry
=
(
void
**
)
&
context
->
R0
;
#elif defined(__aarch64__)
#elif defined(__aarch64__)
entry
=
(
void
**
)
&
context
->
u
.
s
.
X0
;
entry
=
(
void
**
)
&
context
->
X0
;
#endif
#endif
if
(
process_detaching
)
NtTerminateThread
(
GetCurrentThread
(),
0
);
if
(
process_detaching
)
NtTerminateThread
(
GetCurrentThread
(),
0
);
...
...
dlls/ntdll/locale.c
View file @
65edf192
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
*/
#define NONAMELESSUNION
#include <stdarg.h>
#include <stdarg.h>
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
...
...
dlls/ntdll/resource.c
View file @
65edf192
...
@@ -29,8 +29,6 @@
...
@@ -29,8 +29,6 @@
#include <stdlib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/types.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#include "windef.h"
#include "windef.h"
...
@@ -84,8 +82,8 @@ static const IMAGE_RESOURCE_DIRECTORY *find_first_entry( const IMAGE_RESOURCE_DI
...
@@ -84,8 +82,8 @@ static const IMAGE_RESOURCE_DIRECTORY *find_first_entry( const IMAGE_RESOURCE_DI
for
(
pos
=
0
;
pos
<
dir
->
NumberOfNamedEntries
+
dir
->
NumberOfIdEntries
;
pos
++
)
for
(
pos
=
0
;
pos
<
dir
->
NumberOfNamedEntries
+
dir
->
NumberOfIdEntries
;
pos
++
)
{
{
if
(
!
entry
[
pos
].
u2
.
s2
.
DataIsDirectory
==
!
want_dir
)
if
(
!
entry
[
pos
].
DataIsDirectory
==
!
want_dir
)
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
[
pos
].
u2
.
s2
.
OffsetToDirectory
);
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
[
pos
].
OffsetToDirectory
);
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -108,17 +106,17 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
...
@@ -108,17 +106,17 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
while
(
min
<=
max
)
while
(
min
<=
max
)
{
{
pos
=
(
min
+
max
)
/
2
;
pos
=
(
min
+
max
)
/
2
;
if
(
entry
[
pos
].
u
.
Id
==
id
)
if
(
entry
[
pos
].
Id
==
id
)
{
{
if
(
!
entry
[
pos
].
u2
.
s2
.
DataIsDirectory
==
!
want_dir
)
if
(
!
entry
[
pos
].
DataIsDirectory
==
!
want_dir
)
{
{
TRACE
(
"root %p dir %p id %04x ret %p
\n
"
,
TRACE
(
"root %p dir %p id %04x ret %p
\n
"
,
root
,
dir
,
id
,
(
const
char
*
)
root
+
entry
[
pos
].
u2
.
s2
.
OffsetToDirectory
);
root
,
dir
,
id
,
(
const
char
*
)
root
+
entry
[
pos
].
OffsetToDirectory
);
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
[
pos
].
u2
.
s2
.
OffsetToDirectory
);
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
[
pos
].
OffsetToDirectory
);
}
}
break
;
break
;
}
}
if
(
entry
[
pos
].
u
.
Id
>
id
)
max
=
pos
-
1
;
if
(
entry
[
pos
].
Id
>
id
)
max
=
pos
-
1
;
else
min
=
pos
+
1
;
else
min
=
pos
+
1
;
}
}
TRACE
(
"root %p dir %p id %04x not found
\n
"
,
root
,
dir
,
id
);
TRACE
(
"root %p dir %p id %04x not found
\n
"
,
root
,
dir
,
id
);
...
@@ -147,15 +145,15 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_
...
@@ -147,15 +145,15 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_
while
(
min
<=
max
)
while
(
min
<=
max
)
{
{
pos
=
(
min
+
max
)
/
2
;
pos
=
(
min
+
max
)
/
2
;
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
char
*
)
root
+
entry
[
pos
].
u
.
s
.
NameOffset
);
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
char
*
)
root
+
entry
[
pos
].
NameOffset
);
res
=
wcsncmp
(
name
,
str
->
NameString
,
str
->
Length
);
res
=
wcsncmp
(
name
,
str
->
NameString
,
str
->
Length
);
if
(
!
res
&&
namelen
==
str
->
Length
)
if
(
!
res
&&
namelen
==
str
->
Length
)
{
{
if
(
!
entry
[
pos
].
u2
.
s2
.
DataIsDirectory
==
!
want_dir
)
if
(
!
entry
[
pos
].
DataIsDirectory
==
!
want_dir
)
{
{
TRACE
(
"root %p dir %p name %s ret %p
\n
"
,
TRACE
(
"root %p dir %p name %s ret %p
\n
"
,
root
,
dir
,
debugstr_w
(
name
),
(
const
char
*
)
root
+
entry
[
pos
].
u2
.
s2
.
OffsetToDirectory
);
root
,
dir
,
debugstr_w
(
name
),
(
const
char
*
)
root
+
entry
[
pos
].
OffsetToDirectory
);
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
[
pos
].
u2
.
s2
.
OffsetToDirectory
);
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
[
pos
].
OffsetToDirectory
);
}
}
break
;
break
;
}
}
...
...
dlls/ntdll/thread.c
View file @
65edf192
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#include <limits.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/types.h>
#define NONAMELESSUNION
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#include "winternl.h"
#include "winternl.h"
...
...
dlls/ntdll/unix/loader.c
View file @
65edf192
...
@@ -80,8 +80,6 @@
...
@@ -80,8 +80,6 @@
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "windef.h"
#include "winnt.h"
#include "winnt.h"
#include "winbase.h"
#include "winbase.h"
...
@@ -423,8 +421,8 @@ static void fixup_so_resources( IMAGE_RESOURCE_DIRECTORY *dir, BYTE *root, int d
...
@@ -423,8 +421,8 @@ static void fixup_so_resources( IMAGE_RESOURCE_DIRECTORY *dir, BYTE *root, int d
for
(
i
=
0
;
i
<
dir
->
NumberOfNamedEntries
+
dir
->
NumberOfIdEntries
;
i
++
,
entry
++
)
for
(
i
=
0
;
i
<
dir
->
NumberOfNamedEntries
+
dir
->
NumberOfIdEntries
;
i
++
,
entry
++
)
{
{
void
*
ptr
=
root
+
entry
->
u2
.
s2
.
OffsetToDirectory
;
void
*
ptr
=
root
+
entry
->
OffsetToDirectory
;
if
(
entry
->
u2
.
s2
.
DataIsDirectory
)
fixup_so_resources
(
ptr
,
root
,
delta
);
if
(
entry
->
DataIsDirectory
)
fixup_so_resources
(
ptr
,
root
,
delta
);
else
fixup_rva_dwords
(
&
((
IMAGE_RESOURCE_DATA_ENTRY
*
)
ptr
)
->
OffsetToData
,
delta
,
1
);
else
fixup_rva_dwords
(
&
((
IMAGE_RESOURCE_DATA_ENTRY
*
)
ptr
)
->
OffsetToData
,
delta
,
1
);
}
}
}
}
...
@@ -931,11 +929,11 @@ static NTSTATUS map_so_dll( const IMAGE_NT_HEADERS *nt_descr, HMODULE module )
...
@@ -931,11 +929,11 @@ static NTSTATUS map_so_dll( const IMAGE_NT_HEADERS *nt_descr, HMODULE module )
while
(
imports
->
Name
)
while
(
imports
->
Name
)
{
{
fixup_rva_dwords
(
&
imports
->
u
.
OriginalFirstThunk
,
delta
,
1
);
fixup_rva_dwords
(
&
imports
->
OriginalFirstThunk
,
delta
,
1
);
fixup_rva_dwords
(
&
imports
->
Name
,
delta
,
1
);
fixup_rva_dwords
(
&
imports
->
Name
,
delta
,
1
);
fixup_rva_dwords
(
&
imports
->
FirstThunk
,
delta
,
1
);
fixup_rva_dwords
(
&
imports
->
FirstThunk
,
delta
,
1
);
if
(
imports
->
u
.
OriginalFirstThunk
)
if
(
imports
->
OriginalFirstThunk
)
fixup_rva_names
(
(
UINT_PTR
*
)(
addr
+
imports
->
u
.
OriginalFirstThunk
),
delta
);
fixup_rva_names
(
(
UINT_PTR
*
)(
addr
+
imports
->
OriginalFirstThunk
),
delta
);
if
(
imports
->
FirstThunk
)
if
(
imports
->
FirstThunk
)
fixup_rva_names
(
(
UINT_PTR
*
)(
addr
+
imports
->
FirstThunk
),
delta
);
fixup_rva_names
(
(
UINT_PTR
*
)(
addr
+
imports
->
FirstThunk
),
delta
);
imports
++
;
imports
++
;
...
@@ -1694,7 +1692,7 @@ static NTSTATUS open_main_image( WCHAR *image, void **module, SECTION_IMAGE_INFO
...
@@ -1694,7 +1692,7 @@ static NTSTATUS open_main_image( WCHAR *image, void **module, SECTION_IMAGE_INFO
if
(
!
status
)
if
(
!
status
)
{
{
status
=
virtual_map_module
(
mapping
,
module
,
&
size
,
info
,
0
,
machine
);
status
=
virtual_map_module
(
mapping
,
module
,
&
size
,
info
,
0
,
machine
);
if
(
status
==
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
&&
info
->
u
.
s
.
ComPlusNativeReady
)
if
(
status
==
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
&&
info
->
ComPlusNativeReady
)
{
{
info
->
Machine
=
native_machine
;
info
->
Machine
=
native_machine
;
status
=
STATUS_SUCCESS
;
status
=
STATUS_SUCCESS
;
...
...
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