Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Release/x86/jitm.exe
Binary file not shown.
Binary file modified Release/x86/jitmhook.dll
Binary file not shown.
1 change: 1 addition & 0 deletions jitm/jitm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static void PrepareMethods(Assembly asm)
MethodInfo[] methods = c.GetMethods();
foreach (MethodInfo method in methods)
{
if (method.IsAbstract || method.ContainsGenericParameters) continue;
try
{
RuntimeHelpers.PrepareMethod(method.MethodHandle);
Expand Down
4 changes: 3 additions & 1 deletion jitmhook/CDNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ BOOL _CDNet::LoadTablesInfo(
for (std::vector<PTableInfo>::iterator it = Tables.begin(); it != Tables.end(); ++it)
{
DWORD nNumberOfRows = 0;
DWORD nOffset = nStartOfNumberOfRows + nCount * sizeof(DWORD);
if (!ReadFile(hFile, &nNumberOfRows, sizeof(DWORD), &nBytes, NULL))
return FALSE;
(*it)->nNumberOfRows = nNumberOfRows;
Expand Down Expand Up @@ -309,6 +308,9 @@ BOOL _CDNet::LoadTablesInfo(
Tables.pop_back();
delete ti;
}

std::cout << "[*] Loading tables info done" << std::endl;

return this->Methods.size() > 0;
}

Expand Down
49 changes: 26 additions & 23 deletions jitmhook/CDNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ typedef struct _StreamInfo

typedef struct _DNetTablesHeader
{
DWORD nReserved;
DWORD nUnknown;
DWORD nReserved_1;
BYTE nMajorVersion;
BYTE nMinorVersion;
BYTE nHeapOffsetSizes;
BYTE nReserved_2;
DWORD nMaskValidLow;
DWORD nMaskValidHigh;
DWORD nMaskSortedLow;
Expand Down Expand Up @@ -239,14 +242,14 @@ typedef struct _DNetTableRow_Module : Row
{
typedef struct __DNetTableRow_Module
{
WORD nGeneration;
WORD nNameRVA;
WORD nMVID;
WORD nEncId;
WORD nEncBaseId;
WORD nGeneration;
DWORD nNameRVA;
WORD nMVID;
WORD nEncId;
WORD nEncBaseId;
} __INTERNAL;
WORD nGeneration;
WORD nNameRVA;
DWORD nNameRVA;
WORD nMVID;
WORD nEncId;
WORD nEncBaseId;
Expand All @@ -258,7 +261,7 @@ typedef struct _DNetTableRow_Module : Row
DWORD nBytes;
if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, nOffset, 0, FILE_BEGIN))
return FALSE;
if (!ReadFile(hFile, &data, sizeof(data), &nBytes, NULL))
if (!ReadFile(hFile, &data, sizeof data, &nBytes, NULL))
return FALSE;

this->nGeneration = data.nGeneration;
Expand All @@ -275,12 +278,12 @@ typedef struct _DNetTableRow_TypeRef : Row
typedef struct __DNetTableRow_TypeRef
{
WORD nResolutionScope;
WORD nNameRVA;
WORD nNamespace;
DWORD nNameRVA;
DWORD nNamespace;
} __INTERNAL;
WORD nResolutionScope;
WORD nNameRVA;
WORD nNamespace;
DWORD nNameRVA;
DWORD nNamespace;

DWORD Size() { return sizeof(__INTERNAL); }
BOOL Load(HANDLE hFile, DWORD nOffset)
Expand All @@ -306,16 +309,16 @@ typedef struct _DNetTableRow_TypeDef : Row
{
typedef struct __DNetTableRow_TypeDef
{
DWORD nFlags;
WORD nNameRVA;
WORD nNamespace;
DWORD nFlags;
DWORD nNameRVA;
DWORD nNamespace;
WORD nExtends;
WORD nFieldList;
WORD nMethodList;
} __INTERNAL;
DWORD nFlags;
WORD nNameRVA;
WORD nNamespace;
DWORD nNameRVA;
DWORD nNamespace;
WORD nExtends;
WORD nFieldList;
WORD nMethodList;
Expand Down Expand Up @@ -346,11 +349,11 @@ typedef struct _DNetTableRow_Field : Row
typedef struct __DNetTableRow_Field
{
WORD nFlags;
WORD nNameRVA;
DWORD nNameRVA;
WORD nSignature;
} __INTERNAL;
WORD nFlags;
WORD nNameRVA;
DWORD nNameRVA;
WORD nSignature;
DWORD Size() { return sizeof(__INTERNAL); }
BOOL Load(HANDLE hFile, DWORD nOffset)
Expand All @@ -374,17 +377,17 @@ typedef struct _DNetTableRow_MethodDef : Row
{
typedef struct __DNetTableRow_MethodDef
{
DWORD nRVA;
DWORD nRVA;
WORD nImplFlags;
WORD nFlags;
WORD nNameRVA;
DWORD nNameRVA;
WORD nSignature;
WORD nParamList;
} __INTERNAL;
DWORD nRVA;
WORD nImplFlags;
WORD nFlags;
WORD nNameRVA;
DWORD nNameRVA;
WORD nSignature;
WORD nParamList;
DWORD nMID;
Expand Down