Commit e2791cdf authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

include: Make IMAGE_RESOURCE_DIRECTORY_ENTRY match PSDK definition.

parent 397c2200
...@@ -219,9 +219,9 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR l ...@@ -219,9 +219,9 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR l
et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1);
for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++)
{ {
if (et[i].u1.s1.NameIsString) if (et[i].u.s.NameIsString)
{ {
str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)resdir + et[i].u1.s1.NameOffset); str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)resdir + et[i].u.s.NameOffset);
newlen = WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL); newlen = WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL);
if (newlen + 1 > len) if (newlen + 1 > len)
{ {
...@@ -235,7 +235,7 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR l ...@@ -235,7 +235,7 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR l
} }
else else
{ {
ret = lpfun( hmod, UIntToPtr(et[i].u1.s2.Id), lparam ); ret = lpfun( hmod, UIntToPtr(et[i].u.Id), lparam );
} }
if (!ret) break; if (!ret) break;
} }
...@@ -269,9 +269,9 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR l ...@@ -269,9 +269,9 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR l
et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1);
for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++)
{ {
if (et[i].u1.s1.NameIsString) if (et[i].u.s.NameIsString)
{ {
str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)resdir + et[i].u1.s1.NameOffset); str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)resdir + et[i].u.s.NameOffset);
if (str->Length + 1 > len) if (str->Length + 1 > len)
{ {
len = str->Length + 1; len = str->Length + 1;
...@@ -284,7 +284,7 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR l ...@@ -284,7 +284,7 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR l
} }
else else
{ {
ret = lpfun( hmod, UIntToPtr(et[i].u1.s2.Id), lparam ); ret = lpfun( hmod, UIntToPtr(et[i].u.Id), lparam );
} }
if (!ret) break; if (!ret) break;
} }
...@@ -326,9 +326,9 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu ...@@ -326,9 +326,9 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu
{ {
for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++)
{ {
if (et[i].u1.s1.NameIsString) if (et[i].u.s.NameIsString)
{ {
str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)basedir + et[i].u1.s1.NameOffset); str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)basedir + et[i].u.s.NameOffset);
newlen = WideCharToMultiByte(CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL); newlen = WideCharToMultiByte(CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL);
if (newlen + 1 > len) if (newlen + 1 > len)
{ {
...@@ -346,7 +346,7 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu ...@@ -346,7 +346,7 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu
} }
else else
{ {
ret = lpfun( hmod, type, UIntToPtr(et[i].u1.s2.Id), lparam ); ret = lpfun( hmod, type, UIntToPtr(et[i].u.Id), lparam );
} }
if (!ret) break; if (!ret) break;
} }
...@@ -398,9 +398,9 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf ...@@ -398,9 +398,9 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf
{ {
for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++)
{ {
if (et[i].u1.s1.NameIsString) if (et[i].u.s.NameIsString)
{ {
str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)basedir + et[i].u1.s1.NameOffset); str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)basedir + et[i].u.s.NameOffset);
if (str->Length + 1 > len) if (str->Length + 1 > len)
{ {
len = str->Length + 1; len = str->Length + 1;
...@@ -417,7 +417,7 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf ...@@ -417,7 +417,7 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf
} }
else else
{ {
ret = lpfun( hmod, type, UIntToPtr(et[i].u1.s2.Id), lparam ); ret = lpfun( hmod, type, UIntToPtr(et[i].u.Id), lparam );
} }
if (!ret) break; if (!ret) break;
} }
...@@ -470,7 +470,7 @@ BOOL WINAPI EnumResourceLanguagesA( HMODULE hmod, LPCSTR type, LPCSTR name, ...@@ -470,7 +470,7 @@ BOOL WINAPI EnumResourceLanguagesA( HMODULE hmod, LPCSTR type, LPCSTR name,
{ {
for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++)
{ {
ret = lpfun( hmod, type, name, et[i].u1.s2.Id, lparam ); ret = lpfun( hmod, type, name, et[i].u.Id, lparam );
if (!ret) break; if (!ret) break;
} }
} }
...@@ -522,7 +522,7 @@ BOOL WINAPI EnumResourceLanguagesW( HMODULE hmod, LPCWSTR type, LPCWSTR name, ...@@ -522,7 +522,7 @@ BOOL WINAPI EnumResourceLanguagesW( HMODULE hmod, LPCWSTR type, LPCWSTR name,
{ {
for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++)
{ {
ret = lpfun( hmod, type, name, et[i].u1.s2.Id, lparam ); ret = lpfun( hmod, type, name, et[i].u.Id, lparam );
if (!ret) break; if (!ret) break;
} }
} }
...@@ -948,10 +948,10 @@ static LPWSTR resource_dup_string( const IMAGE_RESOURCE_DIRECTORY *root, const I ...@@ -948,10 +948,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->u1.s1.NameIsString) if (!entry->u.s.NameIsString)
return UIntToPtr(entry->u1.s2.Id); return UIntToPtr(entry->u.Id);
string = (const IMAGE_RESOURCE_DIR_STRING_U*) (((const char *)root) + entry->u1.s1.NameOffset); string = (const IMAGE_RESOURCE_DIR_STRING_U*) (((const char *)root) + entry->u.s.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;
...@@ -980,7 +980,7 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates, ...@@ -980,7 +980,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.s3.OffsetToDirectory); namedir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e1->u2.s2.OffsetToDirectory);
for (j = 0; j < namedir->NumberOfNamedEntries + namedir->NumberOfIdEntries; j++) for (j = 0; j < namedir->NumberOfNamedEntries + namedir->NumberOfIdEntries; j++)
{ {
LPWSTR Name; LPWSTR Name;
...@@ -989,7 +989,7 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates, ...@@ -989,7 +989,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.s3.OffsetToDirectory); langdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e2->u2.s2.OffsetToDirectory);
for (k = 0; k < langdir->NumberOfNamedEntries + langdir->NumberOfIdEntries; k++) for (k = 0; k < langdir->NumberOfNamedEntries + langdir->NumberOfIdEntries; k++)
{ {
LANGID Lang; LANGID Lang;
...@@ -998,7 +998,7 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates, ...@@ -998,7 +998,7 @@ 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->u1.s2.Id; Lang = e3->u.Id;
data = (const IMAGE_RESOURCE_DATA_ENTRY *)((const char *)root + e3->u2.OffsetToData); data = (const IMAGE_RESOURCE_DATA_ENTRY *)((const char *)root + e3->u2.OffsetToData);
...@@ -1235,8 +1235,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc ...@@ -1235,8 +1235,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
DWORD len; DWORD len;
root->NumberOfNamedEntries++; root->NumberOfNamedEntries++;
e1->u1.s1.NameIsString = 1; e1->u.s.NameIsString = 1;
e1->u1.s1.NameOffset = si->strings_ofs; e1->u.s.NameOffset = si->strings_ofs;
strings = (WCHAR*) &base[si->strings_ofs]; strings = (WCHAR*) &base[si->strings_ofs];
len = lstrlenW( types->id ); len = lstrlenW( types->id );
...@@ -1247,10 +1247,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc ...@@ -1247,10 +1247,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
else else
{ {
root->NumberOfIdEntries++; root->NumberOfIdEntries++;
e1->u1.s2.Id = LOWORD( types->id ); e1->u.Id = LOWORD( types->id );
} }
e1->u2.s3.OffsetToDirectory = si->names_ofs; e1->u2.s2.OffsetToDirectory = si->names_ofs;
e1->u2.s3.DataIsDirectory = TRUE; e1->u2.s2.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];
...@@ -1271,8 +1271,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc ...@@ -1271,8 +1271,8 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
DWORD len; DWORD len;
namedir->NumberOfNamedEntries++; namedir->NumberOfNamedEntries++;
e2->u1.s1.NameIsString = 1; e2->u.s.NameIsString = 1;
e2->u1.s1.NameOffset = si->strings_ofs; e2->u.s.NameOffset = si->strings_ofs;
strings = (WCHAR*) &base[si->strings_ofs]; strings = (WCHAR*) &base[si->strings_ofs];
len = lstrlenW( names->id ); len = lstrlenW( names->id );
...@@ -1283,10 +1283,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc ...@@ -1283,10 +1283,10 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc
else else
{ {
namedir->NumberOfIdEntries++; namedir->NumberOfIdEntries++;
e2->u1.s2.Id = LOWORD( names->id ); e2->u.Id = LOWORD( names->id );
} }
e2->u2.s3.OffsetToDirectory = si->langs_ofs; e2->u2.s2.OffsetToDirectory = si->langs_ofs;
e2->u2.s3.DataIsDirectory = TRUE; e2->u2.s2.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];
...@@ -1303,7 +1303,7 @@ static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resourc ...@@ -1303,7 +1303,7 @@ 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->u1.s2.Id = LOWORD( data->lang ); e3->u.Id = LOWORD( data->lang );
e3->u2.OffsetToData = si->data_entry_ofs; e3->u2.OffsetToData = si->data_entry_ofs;
si->langs_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); si->langs_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY);
......
...@@ -89,8 +89,8 @@ static const IMAGE_RESOURCE_DIRECTORY *find_first_entry( const IMAGE_RESOURCE_DI ...@@ -89,8 +89,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.s3.DataIsDirectory == !want_dir) if (!entry[pos].u2.s2.DataIsDirectory == !want_dir)
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
} }
return NULL; return NULL;
} }
...@@ -113,17 +113,17 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI ...@@ -113,17 +113,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].u1.s2.Id == id) if (entry[pos].u.Id == id)
{ {
if (!entry[pos].u2.s3.DataIsDirectory == !want_dir) if (!entry[pos].u2.s2.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.s3.OffsetToDirectory); root, dir, id, (const char*)root + entry[pos].u2.s2.OffsetToDirectory);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
} }
break; break;
} }
if (entry[pos].u1.s2.Id > id) max = pos - 1; if (entry[pos].u.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 );
...@@ -152,15 +152,15 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_ ...@@ -152,15 +152,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].u1.s1.NameOffset); str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root + entry[pos].u.s.NameOffset);
res = strncmpW( name, str->NameString, str->Length ); res = strncmpW( name, str->NameString, str->Length );
if (!res && namelen == str->Length) if (!res && namelen == str->Length)
{ {
if (!entry[pos].u2.s3.DataIsDirectory == !want_dir) if (!entry[pos].u2.s2.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.s3.OffsetToDirectory); root, dir, debugstr_w(name), (const char*)root + entry[pos].u2.s2.OffsetToDirectory);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
} }
break; break;
} }
......
...@@ -120,9 +120,9 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI ...@@ -120,9 +120,9 @@ 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].u1.s2.Id == id) if (entry[pos].u.Id == id)
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
if (entry[pos].u1.s2.Id > id) max = pos - 1; if (entry[pos].u.Id > id) max = pos - 1;
else min = pos + 1; else min = pos + 1;
} }
return NULL; return NULL;
...@@ -139,7 +139,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_ ...@@ -139,7 +139,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_
{ {
const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry; const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s2.OffsetToDirectory);
} }
/************************************************************************* /*************************************************************************
...@@ -486,7 +486,7 @@ static UINT ICO_ExtractIconExW( ...@@ -486,7 +486,7 @@ static UINT ICO_ExtractIconExW(
while(n<iconDirCount && xprdeTmp) while(n<iconDirCount && xprdeTmp)
{ {
if(xprdeTmp->u1.s2.Id == iId) if(xprdeTmp->u.Id == iId)
{ {
nIconIndex = n; nIconIndex = n;
break; break;
...@@ -522,7 +522,7 @@ static UINT ICO_ExtractIconExW( ...@@ -522,7 +522,7 @@ static UINT ICO_ExtractIconExW(
const IMAGE_RESOURCE_DIRECTORY *resdir; const IMAGE_RESOURCE_DIRECTORY *resdir;
/* go down this resource entry, name */ /* go down this resource entry, name */
resdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)rootresdir + xresent->u2.s3.OffsetToDirectory); resdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)rootresdir + xresent->u2.s2.OffsetToDirectory);
/* default language (0) */ /* default language (0) */
resdir = find_entry_default(resdir,rootresdir); resdir = find_entry_default(resdir,rootresdir);
......
...@@ -60,9 +60,9 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI ...@@ -60,9 +60,9 @@ 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].u1.s2.Id == id) if (entry[pos].u.Id == id)
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
if (entry[pos].u1.s2.Id > id) max = pos - 1; if (entry[pos].u.Id > id) max = pos - 1;
else min = pos + 1; else min = pos + 1;
} }
return NULL; return NULL;
...@@ -81,7 +81,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_ ...@@ -81,7 +81,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_
const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry; const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s2.OffsetToDirectory);
} }
...@@ -119,11 +119,11 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_ ...@@ -119,11 +119,11 @@ 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].u1.s1.NameOffset); str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root + entry[pos].u.s.NameOffset);
res = strncmpiW( nameW, str->NameString, str->Length ); res = strncmpiW( nameW, str->NameString, str->Length );
if (!res && namelen == str->Length) if (!res && namelen == str->Length)
{ {
ret = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); ret = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
break; break;
} }
if (res < 0) max = pos - 1; if (res < 0) max = pos - 1;
......
...@@ -84,9 +84,9 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI ...@@ -84,9 +84,9 @@ 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].u1.s2.Id == id) if (entry[pos].u.Id == id)
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
if (entry[pos].u1.s2.Id > id) max = pos - 1; if (entry[pos].u.Id > id) max = pos - 1;
else min = pos + 1; else min = pos + 1;
} }
return NULL; return NULL;
...@@ -105,7 +105,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_ ...@@ -105,7 +105,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_
const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry; const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s3.OffsetToDirectory); return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s2.OffsetToDirectory);
} }
......
...@@ -3343,18 +3343,16 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { ...@@ -3343,18 +3343,16 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
unsigned NameOffset:31; unsigned NameOffset:31;
unsigned NameIsString:1; unsigned NameIsString:1;
#endif #endif
} DUMMYSTRUCTNAME1; } DUMMYSTRUCTNAME;
DWORD Name; DWORD Name;
struct {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
WORD __pad; WORD __pad;
WORD Id; WORD Id;
#else #else
WORD Id; WORD Id;
WORD __pad; WORD __pad;
#endif #endif
} DUMMYSTRUCTNAME2; } DUMMYUNIONNAME;
} DUMMYUNIONNAME1;
union { union {
DWORD OffsetToData; DWORD OffsetToData;
struct { struct {
...@@ -3365,7 +3363,7 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { ...@@ -3365,7 +3363,7 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
unsigned OffsetToDirectory:31; unsigned OffsetToDirectory:31;
unsigned DataIsDirectory:1; unsigned DataIsDirectory:1;
#endif #endif
} DUMMYSTRUCTNAME3; } DUMMYSTRUCTNAME2;
} DUMMYUNIONNAME2; } DUMMYUNIONNAME2;
} IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY; } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
......
...@@ -359,8 +359,8 @@ static void fixup_resources( IMAGE_RESOURCE_DIRECTORY *dir, BYTE *root, int delt ...@@ -359,8 +359,8 @@ static void fixup_resources( IMAGE_RESOURCE_DIRECTORY *dir, BYTE *root, int delt
entry = (IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); entry = (IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
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.s3.OffsetToDirectory; void *ptr = root + entry->u2.s2.OffsetToDirectory;
if (entry->u2.s3.DataIsDirectory) fixup_resources( ptr, root, delta ); if (entry->u2.s2.DataIsDirectory) fixup_resources( ptr, root, delta );
else else
{ {
IMAGE_RESOURCE_DATA_ENTRY *data = ptr; IMAGE_RESOURCE_DATA_ENTRY *data = ptr;
......
...@@ -1384,52 +1384,51 @@ static void dump_dir_resource(void) ...@@ -1384,52 +1384,51 @@ static void dump_dir_resource(void)
for (i = 0; i< root->NumberOfNamedEntries + root->NumberOfIdEntries; i++) for (i = 0; i< root->NumberOfNamedEntries + root->NumberOfIdEntries; i++)
{ {
e1 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(root + 1) + i; e1 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(root + 1) + i;
namedir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e1->u2.s3.OffsetToDirectory); namedir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e1->u2.s2.OffsetToDirectory);
for (j = 0; j < namedir->NumberOfNamedEntries + namedir->NumberOfIdEntries; j++) for (j = 0; j < namedir->NumberOfNamedEntries + namedir->NumberOfIdEntries; j++)
{ {
e2 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(namedir + 1) + j; e2 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(namedir + 1) + j;
langdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e2->u2.s3.OffsetToDirectory); langdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e2->u2.s2.OffsetToDirectory);
for (k = 0; k < langdir->NumberOfNamedEntries + langdir->NumberOfIdEntries; k++) for (k = 0; k < langdir->NumberOfNamedEntries + langdir->NumberOfIdEntries; k++)
{ {
e3 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(langdir + 1) + k; e3 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(langdir + 1) + k;
printf( "\n " ); printf( "\n " );
if (e1->u1.s1.NameIsString) if (e1->u.s.NameIsString)
{ {
string = (const IMAGE_RESOURCE_DIR_STRING_U*)((const char *)root + e1->u1.s1.NameOffset); string = (const IMAGE_RESOURCE_DIR_STRING_U*)((const char *)root + e1->u.s.NameOffset);
dump_unicode_str( string->NameString, string->Length ); dump_unicode_str( string->NameString, string->Length );
} }
else else
{ {
const char *type = get_resource_type( e1->u1.s2.Id ); const char *type = get_resource_type( e1->u.Id );
if (type) printf( "%s", type ); if (type) printf( "%s", type );
else printf( "%04x", e1->u1.s2.Id ); else printf( "%04x", e1->u.Id );
} }
printf( " Name=" ); printf( " Name=" );
if (e2->u1.s1.NameIsString) if (e2->u.s.NameIsString)
{ {
string = (const IMAGE_RESOURCE_DIR_STRING_U*) ((const char *)root + e2->u1.s1.NameOffset); string = (const IMAGE_RESOURCE_DIR_STRING_U*) ((const char *)root + e2->u.s.NameOffset);
dump_unicode_str( string->NameString, string->Length ); dump_unicode_str( string->NameString, string->Length );
} }
else else
printf( "%04x", e2->u1.s2.Id ); printf( "%04x", e2->u.Id );
printf( " Language=%04x:\n", e3->u1.s2.Id ); printf( " Language=%04x:\n", e3->u.Id );
data = (const IMAGE_RESOURCE_DATA_ENTRY *)((const char *)root + e3->u2.OffsetToData); data = (const IMAGE_RESOURCE_DATA_ENTRY *)((const char *)root + e3->u2.OffsetToData);
if (e1->u1.s1.NameIsString) if (e1->u.s.NameIsString)
{ {
dump_data( RVA( data->OffsetToData, data->Size ), data->Size, " " ); dump_data( RVA( data->OffsetToData, data->Size ), data->Size, " " );
} }
else switch(e1->u1.s2.Id) else switch(e1->u.Id)
{ {
case 6: case 6:
dump_string_data( RVA( data->OffsetToData, data->Size ), data->Size, dump_string_data( RVA( data->OffsetToData, data->Size ), data->Size, e2->u.Id, " " );
e2->u1.s2.Id, " " );
break; break;
case 11: case 11:
dump_msgtable_data( RVA( data->OffsetToData, data->Size ), data->Size, dump_msgtable_data( RVA( data->OffsetToData, data->Size ), data->Size,
e2->u1.s2.Id, " " ); e2->u.Id, " " );
break; break;
default: default:
dump_data( RVA( data->OffsetToData, data->Size ), data->Size, " " ); dump_data( RVA( data->OffsetToData, data->Size ), data->Size, " " );
......
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