Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F230099
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
#pragma once
#include
<Windows.h>
#include
<cstdlib>
enum
ReBaseErr
{
RB_OK
=
0
,
RB_INVALIDPE
,
RB_NORELOCATIONINFO
,
RB_INVALIDRVA
,
RB_INVALIDNEWBASE
,
RB_ACCESSVIOLATION
};
/*****************************************************************************
Improved Realign DLL version 1.5 by yoda
*****************************************************************************/
class
PeRebuild
{
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
static
const
size_t
MAX_SEC_NUM
=
30
;
static
const
DWORD
ScanStartDS
=
0x40
;
static
const
int
MinSectionTerm
=
5
;
static
const
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
Tue, Apr 15, 7:31 PM (5 h, 50 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
eb/1b/1d0a549c3f32f0067c1a2e6d24f7
Attached To
rSCY Scylla
Event Timeline
Log In to Comment