Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F554570
ImportRebuild.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
ImportRebuild.h
View Options
#pragma once
#include
"ProcessAccessHelp.h"
#include
"Thunks.h"
class
ImportRebuild
{
public
:
bool
rebuildImportTable
(
const
WCHAR
*
targetFilePath
,
const
WCHAR
*
newFilePath
,
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
DWORD
convertRVAToOffset
(
DWORD
dwRVA
);
DWORD
convertOffsetToRVA
(
DWORD
dwOffset
);
bool
addNewSection
(
char
*
sectionName
,
DWORD
sectionSize
,
BYTE
*
sectionData
);
bool
writeZeroMemoryToFile
(
HANDLE
hFile
,
DWORD
fileOffset
,
DWORD
size
);
private
:
std
::
vector
<
IMAGE_SECTION_HEADER
>
vecSectionHeaders
;
std
::
vector
<
BYTE
*>
vecSectionData
;
BYTE
*
imageData
;
BYTE
*
pDosStub
;
PIMAGE_DOS_HEADER
pDosHeader
;
PIMAGE_NT_HEADERS
pNTHeader
;
PIMAGE_IMPORT_DESCRIPTOR
pImportDescriptor
;
PIMAGE_THUNK_DATA
pThunkData
;
PIMAGE_IMPORT_BY_NAME
pImportByName
;
size_t
numberOfImportDescriptors
;
size_t
sizeOfImportSection
;
size_t
sizeOfApiAndModuleNames
;
size_t
importSectionIndex
;
DWORD
getOffsetLastSection
();
void
clearAllData
();
void
updatePeHeader
();
DWORD
fillImportSection
(
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
bool
splitTargetFile
();
DWORD
convertRVAToOffsetVector
(
DWORD
dwRVA
);
DWORD_PTR
convertOffsetToRVAVector
(
DWORD
dwOffset
);
BYTE
*
getMemoryPointerFromRVA
(
DWORD_PTR
dwRVA
);
DWORD
alignValue
(
DWORD
badValue
,
DWORD
alignTo
);
bool
alignSectionHeaders
();
bool
saveNewFile
(
const
WCHAR
*
filepath
);
bool
loadTargetFile
(
const
WCHAR
*
filepath
);
bool
createNewImportSection
(
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
bool
buildNewImportTable
(
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
void
setFlagToIATSection
(
DWORD_PTR
iatAddress
);
size_t
addImportToImportTable
(
ImportThunk
*
pImport
,
PIMAGE_THUNK_DATA
pThunk
,
PIMAGE_IMPORT_BY_NAME
pImportByName
,
DWORD
sectionOffset
);
size_t
addImportDescriptor
(
ImportModuleThunk
*
pImportModule
,
DWORD
sectionOffset
);
void
calculateImportSizes
(
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
void
addSpecialImportDescriptor
(
DWORD_PTR
rvaFirstThunk
);
};
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Tue, Feb 10, 5:18 PM (1 d, 11 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a0/a3/5c0fc9eddffbddec2b02bdfb2247
Attached To
rSCY Scylla
Event Timeline
Log In to Comment