Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F527305
PeRebuild.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
PeRebuild.h
View Options
#include
<Windows.h>
#include
<stdlib.h>
typedef
enum
_ReBaseErr
{
RB_OK
=
0
,
RB_INVALIDPE
,
RB_NORELOCATIONINFO
,
RB_INVALIDRVA
,
RB_INVALIDNEWBASE
,
RB_ACCESSVIOLATION
}
ReBaseErr
;
class
PeRebuild
{
/*****************************************************************************
Improved Realign DLL version 1.5 by yoda
*****************************************************************************/
public
:
bool
truncateFile
(
WCHAR
*
szFilePath
,
DWORD
dwNewFsize
);
DWORD
realignPE
(
LPVOID
AddressOfMapFile
,
DWORD
dwFsize
);
DWORD
wipeReloc
(
void
*
pMap
,
DWORD
dwFsize
);
bool
validatePE
(
void
*
pPEImage
,
DWORD
dwFileSize
);
ReBaseErr
reBasePEImage
(
void
*
pPE
,
DWORD_PTR
dwNewBase
);
bool
updatePeHeaderChecksum
(
LPVOID
AddressOfMapFile
,
DWORD
dwFsize
);
LPVOID
createFileMappingViewFull
(
const
WCHAR
*
filePath
);
void
closeAllMappingHandles
();
private
:
// constants
#define MAX_SEC_NUM 30
const
static
DWORD
ScanStartDS
=
0x40
;
const
static
int
MinSectionTerm
=
5
;
const
static
int
FileAlignmentConstant
=
0x200
;
// variables
DWORD_PTR
dwMapBase
;
LPVOID
pMap
;
DWORD
dwTmpNum
,
dwSectionBase
;
WORD
wTmpNum
;
CHAR
*
pCH
;
WORD
*
pW
;
DWORD
*
pDW
;
LPVOID
pSections
[
MAX_SEC_NUM
];
//my vars
HANDLE
hFileToMap
;
HANDLE
hMappedFile
;
LPVOID
addrMappedDll
;
DWORD
validAlignment
(
DWORD
BadSize
);
DWORD
validAlignmentNew
(
DWORD
badAddress
);
bool
isRoundedTo
(
DWORD_PTR
dwTarNum
,
DWORD_PTR
dwRoundNum
);
void
cleanSectionPointer
();
bool
validatePeHeaders
(
PIMAGE_DOS_HEADER
pDosh
);
};
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Wed, Jan 7, 1:52 PM (8 h, 4 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9a/b1/3cf566a006a18410a02670e66a00
Attached To
rSCY Scylla
Event Timeline
Log In to Comment