Commit 0d4f20ca authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Use nameless unions/structs.

parent 0d2046cc
...@@ -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"
......
...@@ -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
......
...@@ -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);
......
...@@ -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;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -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>
......
...@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment