Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F554691
ImportRebuilder.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
ImportRebuilder.h
View Options
#pragma once
#include
<map>
#include
"PeParser.h"
#include
"Thunks.h"
class
ImportRebuilder
:
public
PeParser
{
public
:
ImportRebuilder
(
const
WCHAR
*
file
)
:
PeParser
(
file
,
true
)
{
pImportDescriptor
=
0
;
pThunkData
=
0
;
pImportByName
=
0
;
numberOfImportDescriptors
=
0
;
sizeOfImportSection
=
0
;
sizeOfApiAndModuleNames
=
0
;
importSectionIndex
=
0
;
useOFT
=
false
;
sizeOfOFTArray
=
0
;
}
bool
rebuildImportTable
(
const
WCHAR
*
newFilePath
,
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
void
enableOFTSupport
();
private
:
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
;
//OriginalFirstThunk Array in Import Section
size_t
sizeOfOFTArray
;
bool
useOFT
;
DWORD
fillImportSection
(
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
BYTE
*
getMemoryPointerFromRVA
(
DWORD_PTR
dwRVA
);
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
,
DWORD
sectionOffsetOFTArray
);
void
calculateImportSizes
(
std
::
map
<
DWORD_PTR
,
ImportModuleThunk
>
&
moduleList
);
void
addSpecialImportDescriptor
(
DWORD_PTR
rvaFirstThunk
,
DWORD
sectionOffsetOFTArray
);
};
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Tue, Feb 10, 8:47 PM (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
20/15/d96aa5f9501318121afd8da30d83
Attached To
rSCY Scylla
Event Timeline
Log In to Comment