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
9276d53e
Commit
9276d53e
authored
Jun 06, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Use nameless unions/structs for loader data.
parent
59b175d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
26 deletions
+22
-26
loader.c
dlls/kernelbase/loader.c
+14
-16
version.c
dlls/kernelbase/version.c
+8
-10
No files found.
dlls/kernelbase/loader.c
View file @
9276d53e
...
...
@@ -22,8 +22,6 @@
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -683,7 +681,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceLanguagesExA( HMODULE module, LPCSTR t
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
ret
=
func
(
module
,
type
,
name
,
et
[
i
].
u
.
Id
,
param
);
ret
=
func
(
module
,
type
,
name
,
et
[
i
].
Id
,
param
);
if
(
!
ret
)
break
;
}
}
...
...
@@ -743,7 +741,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceLanguagesExW( HMODULE module, LPCWSTR
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
ret
=
func
(
module
,
type
,
name
,
et
[
i
].
u
.
Id
,
param
);
ret
=
func
(
module
,
type
,
name
,
et
[
i
].
Id
,
param
);
if
(
!
ret
)
break
;
}
}
...
...
@@ -801,9 +799,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceNamesExA( HMODULE module, LPCSTR type,
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
if
(
et
[
i
].
u
.
s
.
NameIsString
)
if
(
et
[
i
].
NameIsString
)
{
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
basedir
+
et
[
i
].
u
.
s
.
NameOffset
);
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
basedir
+
et
[
i
].
NameOffset
);
newlen
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
->
NameString
,
str
->
Length
,
NULL
,
0
,
NULL
,
NULL
);
if
(
newlen
+
1
>
len
)
{
...
...
@@ -821,7 +819,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceNamesExA( HMODULE module, LPCSTR type,
}
else
{
ret
=
func
(
module
,
type
,
UIntToPtr
(
et
[
i
].
u
.
Id
),
param
);
ret
=
func
(
module
,
type
,
UIntToPtr
(
et
[
i
].
Id
),
param
);
}
if
(
!
ret
)
break
;
}
...
...
@@ -880,9 +878,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceNamesExW( HMODULE module, LPCWSTR type
{
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
if
(
et
[
i
].
u
.
s
.
NameIsString
)
if
(
et
[
i
].
NameIsString
)
{
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
basedir
+
et
[
i
].
u
.
s
.
NameOffset
);
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
basedir
+
et
[
i
].
NameOffset
);
if
(
str
->
Length
+
1
>
len
)
{
len
=
str
->
Length
+
1
;
...
...
@@ -899,7 +897,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceNamesExW( HMODULE module, LPCWSTR type
}
else
{
ret
=
func
(
module
,
type
,
UIntToPtr
(
et
[
i
].
u
.
Id
),
param
);
ret
=
func
(
module
,
type
,
UIntToPtr
(
et
[
i
].
Id
),
param
);
}
if
(
!
ret
)
break
;
}
...
...
@@ -957,9 +955,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceTypesExA( HMODULE module, ENUMRESTYPEP
et
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
resdir
+
1
);
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
if
(
et
[
i
].
u
.
s
.
NameIsString
)
if
(
et
[
i
].
NameIsString
)
{
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
resdir
+
et
[
i
].
u
.
s
.
NameOffset
);
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
resdir
+
et
[
i
].
NameOffset
);
newlen
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
->
NameString
,
str
->
Length
,
NULL
,
0
,
NULL
,
NULL
);
if
(
newlen
+
1
>
len
)
{
...
...
@@ -973,7 +971,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceTypesExA( HMODULE module, ENUMRESTYPEP
}
else
{
ret
=
func
(
module
,
UIntToPtr
(
et
[
i
].
u
.
Id
),
param
);
ret
=
func
(
module
,
UIntToPtr
(
et
[
i
].
Id
),
param
);
}
if
(
!
ret
)
break
;
}
...
...
@@ -1007,9 +1005,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceTypesExW( HMODULE module, ENUMRESTYPEP
et
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
resdir
+
1
);
for
(
i
=
0
;
i
<
resdir
->
NumberOfNamedEntries
+
resdir
->
NumberOfIdEntries
;
i
++
)
{
if
(
et
[
i
].
u
.
s
.
NameIsString
)
if
(
et
[
i
].
NameIsString
)
{
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
resdir
+
et
[
i
].
u
.
s
.
NameOffset
);
str
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)((
const
BYTE
*
)
resdir
+
et
[
i
].
NameOffset
);
if
(
str
->
Length
+
1
>
len
)
{
len
=
str
->
Length
+
1
;
...
...
@@ -1022,7 +1020,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumResourceTypesExW( HMODULE module, ENUMRESTYPEP
}
else
{
ret
=
func
(
module
,
UIntToPtr
(
et
[
i
].
u
.
Id
),
param
);
ret
=
func
(
module
,
UIntToPtr
(
et
[
i
].
Id
),
param
);
}
if
(
!
ret
)
break
;
}
...
...
dlls/kernelbase/version.c
View file @
9276d53e
...
...
@@ -30,8 +30,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winver.h"
...
...
@@ -286,13 +284,13 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
while
(
min
<=
max
)
{
pos
=
(
min
+
max
)
/
2
;
if
(
entry
[
pos
].
u
.
Id
==
id
)
if
(
entry
[
pos
].
Id
==
id
)
{
DWORD
offset
=
entry
[
pos
].
u2
.
s2
.
OffsetToDirectory
;
DWORD
offset
=
entry
[
pos
].
OffsetToDirectory
;
if
(
offset
>
root_size
-
sizeof
(
*
dir
))
return
NULL
;
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
offset
);
}
if
(
entry
[
pos
].
u
.
Id
>
id
)
max
=
pos
-
1
;
if
(
entry
[
pos
].
Id
>
id
)
max
=
pos
-
1
;
else
min
=
pos
+
1
;
}
return
NULL
;
...
...
@@ -311,7 +309,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
entry
;
entry
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
dir
+
1
);
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
->
u2
.
s2
.
OffsetToDirectory
);
return
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
entry
->
OffsetToDirectory
);
}
...
...
@@ -1698,19 +1696,19 @@ LONG WINAPI PackageIdFromFullName(const WCHAR *full_name, UINT32 flags, UINT32 *
}
buffer
+=
sizeof
(
*
id
);
id
->
version
.
u
.
s
.
Major
=
wcstol
(
version_str
,
NULL
,
10
);
id
->
version
.
Major
=
wcstol
(
version_str
,
NULL
,
10
);
if
(
!
(
s
=
wcschr
(
version_str
,
L'.'
)))
return
ERROR_INVALID_PARAMETER
;
++
s
;
id
->
version
.
u
.
s
.
Minor
=
wcstol
(
s
,
NULL
,
10
);
id
->
version
.
Minor
=
wcstol
(
s
,
NULL
,
10
);
if
(
!
(
s
=
wcschr
(
s
,
L'.'
)))
return
ERROR_INVALID_PARAMETER
;
++
s
;
id
->
version
.
u
.
s
.
Build
=
wcstol
(
s
,
NULL
,
10
);
id
->
version
.
Build
=
wcstol
(
s
,
NULL
,
10
);
if
(
!
(
s
=
wcschr
(
s
,
L'.'
)))
return
ERROR_INVALID_PARAMETER
;
++
s
;
id
->
version
.
u
.
s
.
Revision
=
wcstol
(
s
,
NULL
,
10
);
id
->
version
.
Revision
=
wcstol
(
s
,
NULL
,
10
);
id
->
name
=
(
WCHAR
*
)
buffer
;
len
=
version_str
-
name
-
1
;
...
...
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