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
0d4f20ca
Commit
0d4f20ca
authored
Jun 06, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Use nameless unions/structs.
parent
0d2046cc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
32 deletions
+23
-32
console.c
dlls/kernel32/console.c
+0
-1
file.c
dlls/kernel32/file.c
+0
-2
resource.c
dlls/kernel32/resource.c
+19
-21
sync.c
dlls/kernel32/sync.c
+4
-5
loader.c
dlls/kernel32/tests/loader.c
+0
-2
virtual.c
dlls/kernel32/virtual.c
+0
-1
No files found.
dlls/kernel32/console.c
View file @
0d4f20ca
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#include <string.h>
#include <string.h>
#include <limits.h>
#include <limits.h>
#define NONAMELESSUNION
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#include "windef.h"
#include "windef.h"
...
...
dlls/kernel32/file.c
View file @
0d4f20ca
...
@@ -24,8 +24,6 @@
...
@@ -24,8 +24,6 @@
#include <stdio.h>
#include <stdio.h>
#include <errno.h>
#include <errno.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "winerror.h"
#include "winerror.h"
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
...
...
dlls/kernel32/resource.c
View file @
0d4f20ca
...
@@ -22,8 +22,6 @@
...
@@ -22,8 +22,6 @@
#include <stdarg.h>
#include <stdarg.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"
...
@@ -541,10 +539,10 @@ static LPWSTR resource_dup_string( const IMAGE_RESOURCE_DIRECTORY *root, const I
...
@@ -541,10 +539,10 @@ static LPWSTR resource_dup_string( const IMAGE_RESOURCE_DIRECTORY *root, const I
const
IMAGE_RESOURCE_DIR_STRING_U
*
string
;
const
IMAGE_RESOURCE_DIR_STRING_U
*
string
;
LPWSTR
s
;
LPWSTR
s
;
if
(
!
entry
->
u
.
s
.
NameIsString
)
if
(
!
entry
->
NameIsString
)
return
UIntToPtr
(
entry
->
u
.
Id
);
return
UIntToPtr
(
entry
->
Id
);
string
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)
(((
const
char
*
)
root
)
+
entry
->
u
.
s
.
NameOffset
);
string
=
(
const
IMAGE_RESOURCE_DIR_STRING_U
*
)
(((
const
char
*
)
root
)
+
entry
->
NameOffset
);
s
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
string
->
Length
+
1
)
*
sizeof
(
WCHAR
)
);
s
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
string
->
Length
+
1
)
*
sizeof
(
WCHAR
)
);
memcpy
(
s
,
string
->
NameString
,
(
string
->
Length
+
1
)
*
sizeof
(
WCHAR
)
);
memcpy
(
s
,
string
->
NameString
,
(
string
->
Length
+
1
)
*
sizeof
(
WCHAR
)
);
s
[
string
->
Length
]
=
0
;
s
[
string
->
Length
]
=
0
;
...
@@ -573,7 +571,7 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates,
...
@@ -573,7 +571,7 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates,
Type
=
resource_dup_string
(
root
,
e1
);
Type
=
resource_dup_string
(
root
,
e1
);
namedir
=
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
e1
->
u2
.
s2
.
OffsetToDirectory
);
namedir
=
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
e1
->
OffsetToDirectory
);
for
(
j
=
0
;
j
<
namedir
->
NumberOfNamedEntries
+
namedir
->
NumberOfIdEntries
;
j
++
)
for
(
j
=
0
;
j
<
namedir
->
NumberOfNamedEntries
+
namedir
->
NumberOfIdEntries
;
j
++
)
{
{
LPWSTR
Name
;
LPWSTR
Name
;
...
@@ -582,7 +580,7 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates,
...
@@ -582,7 +580,7 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates,
Name
=
resource_dup_string
(
root
,
e2
);
Name
=
resource_dup_string
(
root
,
e2
);
langdir
=
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
e2
->
u2
.
s2
.
OffsetToDirectory
);
langdir
=
(
const
IMAGE_RESOURCE_DIRECTORY
*
)((
const
char
*
)
root
+
e2
->
OffsetToDirectory
);
for
(
k
=
0
;
k
<
langdir
->
NumberOfNamedEntries
+
langdir
->
NumberOfIdEntries
;
k
++
)
for
(
k
=
0
;
k
<
langdir
->
NumberOfNamedEntries
+
langdir
->
NumberOfIdEntries
;
k
++
)
{
{
LANGID
Lang
;
LANGID
Lang
;
...
@@ -591,9 +589,9 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates,
...
@@ -591,9 +589,9 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates,
e3
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
langdir
+
1
)
+
k
;
e3
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
langdir
+
1
)
+
k
;
Lang
=
e3
->
u
.
Id
;
Lang
=
e3
->
Id
;
data
=
(
const
IMAGE_RESOURCE_DATA_ENTRY
*
)((
const
char
*
)
root
+
e3
->
u2
.
OffsetToData
);
data
=
(
const
IMAGE_RESOURCE_DATA_ENTRY
*
)((
const
char
*
)
root
+
e3
->
OffsetToData
);
p
=
address_from_rva
(
base
,
mapping_size
,
data
->
OffsetToData
,
data
->
Size
);
p
=
address_from_rva
(
base
,
mapping_size
,
data
->
OffsetToData
,
data
->
Size
);
...
@@ -828,8 +826,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
...
@@ -828,8 +826,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
DWORD
len
;
DWORD
len
;
root
->
NumberOfNamedEntries
++
;
root
->
NumberOfNamedEntries
++
;
e1
->
u
.
s
.
NameIsString
=
1
;
e1
->
NameIsString
=
1
;
e1
->
u
.
s
.
NameOffset
=
si
->
strings_ofs
;
e1
->
NameOffset
=
si
->
strings_ofs
;
strings
=
(
WCHAR
*
)
&
base
[
si
->
strings_ofs
];
strings
=
(
WCHAR
*
)
&
base
[
si
->
strings_ofs
];
len
=
lstrlenW
(
types
->
id
);
len
=
lstrlenW
(
types
->
id
);
...
@@ -840,10 +838,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
...
@@ -840,10 +838,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
else
else
{
{
root
->
NumberOfIdEntries
++
;
root
->
NumberOfIdEntries
++
;
e1
->
u
.
Id
=
LOWORD
(
types
->
id
);
e1
->
Id
=
LOWORD
(
types
->
id
);
}
}
e1
->
u2
.
s2
.
OffsetToDirectory
=
si
->
names_ofs
;
e1
->
OffsetToDirectory
=
si
->
names_ofs
;
e1
->
u2
.
s2
.
DataIsDirectory
=
TRUE
;
e1
->
DataIsDirectory
=
TRUE
;
si
->
types_ofs
+=
sizeof
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
);
si
->
types_ofs
+=
sizeof
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
);
namedir
=
(
IMAGE_RESOURCE_DIRECTORY
*
)
&
base
[
si
->
names_ofs
];
namedir
=
(
IMAGE_RESOURCE_DIRECTORY
*
)
&
base
[
si
->
names_ofs
];
...
@@ -864,8 +862,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
...
@@ -864,8 +862,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
DWORD
len
;
DWORD
len
;
namedir
->
NumberOfNamedEntries
++
;
namedir
->
NumberOfNamedEntries
++
;
e2
->
u
.
s
.
NameIsString
=
1
;
e2
->
NameIsString
=
1
;
e2
->
u
.
s
.
NameOffset
=
si
->
strings_ofs
;
e2
->
NameOffset
=
si
->
strings_ofs
;
strings
=
(
WCHAR
*
)
&
base
[
si
->
strings_ofs
];
strings
=
(
WCHAR
*
)
&
base
[
si
->
strings_ofs
];
len
=
lstrlenW
(
names
->
id
);
len
=
lstrlenW
(
names
->
id
);
...
@@ -876,10 +874,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
...
@@ -876,10 +874,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
else
else
{
{
namedir
->
NumberOfIdEntries
++
;
namedir
->
NumberOfIdEntries
++
;
e2
->
u
.
Id
=
LOWORD
(
names
->
id
);
e2
->
Id
=
LOWORD
(
names
->
id
);
}
}
e2
->
u2
.
s2
.
OffsetToDirectory
=
si
->
langs_ofs
;
e2
->
OffsetToDirectory
=
si
->
langs_ofs
;
e2
->
u2
.
s2
.
DataIsDirectory
=
TRUE
;
e2
->
DataIsDirectory
=
TRUE
;
si
->
names_ofs
+=
sizeof
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
);
si
->
names_ofs
+=
sizeof
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
);
langdir
=
(
IMAGE_RESOURCE_DIRECTORY
*
)
&
base
[
si
->
langs_ofs
];
langdir
=
(
IMAGE_RESOURCE_DIRECTORY
*
)
&
base
[
si
->
langs_ofs
];
...
@@ -896,8 +894,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
...
@@ -896,8 +894,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
e3
=
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)
&
base
[
si
->
langs_ofs
];
e3
=
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)
&
base
[
si
->
langs_ofs
];
memset
(
e3
,
0
,
sizeof
*
e3
);
memset
(
e3
,
0
,
sizeof
*
e3
);
langdir
->
NumberOfIdEntries
++
;
langdir
->
NumberOfIdEntries
++
;
e3
->
u
.
Id
=
LOWORD
(
data
->
lang
);
e3
->
Id
=
LOWORD
(
data
->
lang
);
e3
->
u2
.
OffsetToData
=
si
->
data_entry_ofs
;
e3
->
OffsetToData
=
si
->
data_entry_ofs
;
si
->
langs_ofs
+=
sizeof
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
);
si
->
langs_ofs
+=
sizeof
(
IMAGE_RESOURCE_DIRECTORY_ENTRY
);
...
...
dlls/kernel32/sync.c
View file @
0d4f20ca
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "windef.h"
#include "winbase.h"
#include "winbase.h"
#include "wincon.h"
#include "wincon.h"
...
@@ -87,10 +86,10 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
...
@@ -87,10 +86,10 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
do
do
{
{
high
=
user_shared_data
->
u
.
TickCount
.
High1Time
;
high
=
user_shared_data
->
TickCount
.
High1Time
;
low
=
user_shared_data
->
u
.
TickCount
.
LowPart
;
low
=
user_shared_data
->
TickCount
.
LowPart
;
}
}
while
(
high
!=
user_shared_data
->
u
.
TickCount
.
High2Time
);
while
(
high
!=
user_shared_data
->
TickCount
.
High2Time
);
/* note: we ignore TickCountMultiplier */
/* note: we ignore TickCountMultiplier */
return
(
ULONGLONG
)
high
<<
32
|
low
;
return
(
ULONGLONG
)
high
<<
32
|
low
;
}
}
...
@@ -101,7 +100,7 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
...
@@ -101,7 +100,7 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
DWORD
WINAPI
DECLSPEC_HOTPATCH
GetTickCount
(
void
)
DWORD
WINAPI
DECLSPEC_HOTPATCH
GetTickCount
(
void
)
{
{
/* note: we ignore TickCountMultiplier */
/* note: we ignore TickCountMultiplier */
return
user_shared_data
->
u
.
TickCount
.
LowPart
;
return
user_shared_data
->
TickCount
.
LowPart
;
}
}
/***********************************************************************
/***********************************************************************
...
...
dlls/kernel32/tests/loader.c
View file @
0d4f20ca
...
@@ -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
#define NONAMELESSSTRUCT
#include <stdarg.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdio.h>
#include <assert.h>
#include <assert.h>
...
...
dlls/kernel32/virtual.c
View file @
0d4f20ca
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#define WINE_NO_INLINE_STRING
#define WINE_NO_INLINE_STRING
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "windef.h"
#include "winbase.h"
#include "winbase.h"
#include "winnls.h"
#include "winnls.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