Commit 97591400 authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

Fixed IMAGE_RESOURCE_DIRECTORY_ENTRY on big-endian machines.

parent 9ea31be4
......@@ -744,6 +744,26 @@ dnl **** Check for endianness ****
AC_C_BIGENDIAN
AC_CACHE_CHECK( "whether bitfields are bigendian", wine_cv_bitfields_bigendian,
[AC_TRY_RUN([
union
{
int word;
struct
{
int bit0 : 1;
int rest : sizeof(int)*8 - 1;
} bitfield;
} u;
main() { u.word = 0; u.bitfield.bit0 = 1; exit( u.word == 1 ); } ],
wine_cv_bitfields_bigendian=yes, wine_cv_bitfields_bigendian=no,
wine_cv_bitfields_bigendian=no ) ])
if test "$wine_cv_bitfields_bigendian" = "yes"
then
AC_DEFINE(BITFIELDS_BIGENDIAN)
fi
dnl **** Check for functions ****
AC_FUNC_ALLOCA()
......
......@@ -77,9 +77,9 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
while (min <= max)
{
pos = (min + max) / 2;
if (entry[pos].u1.Id == id)
if (entry[pos].u1.s2.Id == id)
return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s2.OffsetToDirectory);
if (entry[pos].u1.Id > id) max = pos - 1;
if (entry[pos].u1.s2.Id > id) max = pos - 1;
else min = pos + 1;
}
return NULL;
......@@ -411,7 +411,7 @@ static HRESULT ICO_ExtractIconExW(
while(n<iconDirCount && xprdeTmp)
{
if(xprdeTmp->u1.Id == iId)
if(xprdeTmp->u1.s2.Id == iId)
{
nIconIndex = n;
break;
......
......@@ -41,9 +41,9 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
while (min <= max)
{
pos = (min + max) / 2;
if (entry[pos].u1.Id == id)
if (entry[pos].u1.s2.Id == id)
return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s2.OffsetToDirectory);
if (entry[pos].u1.Id > id) max = pos - 1;
if (entry[pos].u1.s2.Id > id) max = pos - 1;
else min = pos + 1;
}
return NULL;
......
......@@ -3,6 +3,9 @@
* defined in the 'configure' script.
*/
/* Define if bitfields are bigendian */
#undef BITFIELDS_BIGENDIAN
/* Define if .type asm directive must be inside a .def directive */
#undef NEED_TYPE_IN_DEF
......
......@@ -47,6 +47,9 @@
/* Define if lex declares yytext as a char * by default, not a char[]. */
#undef YYTEXT_POINTER
/* Define if bitfields are bigendian */
#undef BITFIELDS_BIGENDIAN
/* Define if .type asm directive must be inside a .def directive */
#undef NEED_TYPE_IN_DEF
......
......@@ -2478,17 +2478,35 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY {
typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
union {
struct {
#ifdef BITFIELDS_BIGENDIAN
unsigned NameIsString:1;
unsigned NameOffset:31;
#else
unsigned NameOffset:31;
unsigned NameIsString:1;
#endif
} DUMMYSTRUCTNAME1;
DWORD Name;
struct {
#ifdef WORDS_BIGENDIAN
WORD __pad;
WORD Id;
#else
WORD Id;
WORD __pad;
#endif
} DUMMYSTRUCTNAME2;
} DUMMYUNIONNAME1;
union {
DWORD OffsetToData;
struct {
#ifdef BITFIELDS_BIGENDIAN
unsigned DataIsDirectory:1;
unsigned OffsetToDirectory:31;
#else
unsigned OffsetToDirectory:31;
unsigned DataIsDirectory:1;
#endif
} DUMMYSTRUCTNAME2;
} DUMMYUNIONNAME2;
} IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
......
......@@ -66,9 +66,9 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
while (min <= max)
{
pos = (min + max) / 2;
if (entry[pos].u1.Id == id)
if (entry[pos].u1.s2.Id == id)
return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s2.OffsetToDirectory);
if (entry[pos].u1.Id > id) max = pos - 1;
if (entry[pos].u1.s2.Id > id) max = pos - 1;
else min = pos + 1;
}
return NULL;
......@@ -300,7 +300,7 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG lpara
}
else
{
type = (LPSTR)(int)et[i].u1.Id;
type = (LPSTR)(int)et[i].u1.s2.Id;
ret = lpfun(hmod,type,lparam);
}
if (!ret)
......@@ -339,7 +339,7 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG lpara
}
else
{
type = (LPWSTR)(int)et[i].u1.Id;
type = (LPWSTR)(int)et[i].u1.s2.Id;
ret = lpfun(hmod,type,lparam);
}
if (!ret)
......@@ -384,7 +384,7 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu
}
else
{
name = (LPSTR)(int)et[i].u1.Id;
name = (LPSTR)(int)et[i].u1.s2.Id;
ret = lpfun(hmod,type,name,lparam);
}
if (!ret)
......@@ -426,7 +426,7 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf
}
else
{
name = (LPWSTR)(int)et[i].u1.Id;
name = (LPWSTR)(int)et[i].u1.s2.Id;
ret = lpfun(hmod,type,name,lparam);
}
if (!ret)
......@@ -456,7 +456,7 @@ BOOL WINAPI EnumResourceLanguagesA( HMODULE hmod, LPCSTR type, LPCSTR name,
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
/* languages are just ids... I hope */
ret = lpfun(hmod,type,name,et[i].u1.Id,lparam);
ret = lpfun(hmod,type,name,et[i].u1.s2.Id,lparam);
if (!ret)
break;
}
......@@ -484,7 +484,7 @@ BOOL WINAPI EnumResourceLanguagesW( HMODULE hmod, LPCWSTR type, LPCWSTR name,
et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)(resdir + 1);
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
ret = lpfun(hmod,type,name,et[i].u1.Id,lparam);
ret = lpfun(hmod,type,name,et[i].u1.s2.Id,lparam);
if (!ret)
break;
}
......
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