big-endian compatibility

could have been better, but due to lack of time, original code base and the fact that it works, i'm happy with it


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4613 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2006-03-25 17:24:28 +00:00
parent c680fbbc04
commit 0907fb648b
2 changed files with 150 additions and 71 deletions

View file

@ -67,8 +67,13 @@ typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
typedef struct _MY_IMAGE_RESOURCE_DIRECTORY_ENTRY {
union {
struct {
#ifndef __BIG_ENDIAN__
DWORD NameOffset:31;
DWORD NameIsString:1;
#else
DWORD NameIsString:1;
DWORD NameOffset:31;
#endif
} NameString;
DWORD Name;
WORD Id;
@ -76,8 +81,13 @@ typedef struct _MY_IMAGE_RESOURCE_DIRECTORY_ENTRY {
union {
DWORD OffsetToData;
struct {
#ifndef __BIG_ENDIAN__
DWORD OffsetToDirectory:31;
DWORD DataIsDirectory:1;
#else
DWORD DataIsDirectory:1;
DWORD OffsetToDirectory:31;
#endif
} DirectoryOffset;
};
} MY_IMAGE_RESOURCE_DIRECTORY_ENTRY,*PMY_IMAGE_RESOURCE_DIRECTORY_ENTRY;
@ -116,7 +126,6 @@ private:
BYTE* m_pbPE;
int m_iSize;
PIMAGE_DOS_HEADER m_dosHeader;
PIMAGE_NT_HEADERS m_ntHeaders;
DWORD m_dwResourceSectionIndex;
@ -128,6 +137,9 @@ private:
void WriteRsrcSec(BYTE* pbRsrcSec);
void SetOffsets(CResourceDirectory* resDir, DWORD newResDirAt);
DWORD AdjustVA(DWORD dwVirtualAddress, DWORD dwAdjustment);
DWORD AlignVA(DWORD dwVirtualAddress);
};
class CResourceDirectory {