-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOllyExt.cpp
140 lines (107 loc) · 2.75 KB
/
OllyExt.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "stdafx.h"
#include "OllyExtOS.h"
#include "OllyExtVersion.h"
#include "OllyExtAbout.h"
#include "OllyExtIcon.h"
#include "OllyExtMenu.h"
#include "OllyExtDisasmMenu.h"
#include "OllyExtDumpMenu.h"
#include "OllyExtIntegrity.h"
#include "OllyExtProtect.h"
#include "OllyExtBugfixes.h"
#include "OllyExtGeneral.h"
#include "OllyExt.h"
HINSTANCE g_instance = NULL;
static bool g_protectionApplied = false;
BOOL WINAPI DllMain( HINSTANCE new_instance, DWORD fdwReason, LPVOID lpvReserved )
{
g_instance = new_instance;
return TRUE;
}
extc int __cdecl ODBG2_Pluginquery( int ollydbgversion, ulong* features, wchar_t pluginname[SHORTNAME], wchar_t pluginversion[SHORTNAME] )
{
if( ollydbgversion < 201 )
{
PLUGIN_CHECK_ERROR( false, return 0;, INVALID_OLLY_VERSION, 201, ollydbgversion );
}
g_ollydbgVersion = ollydbgversion;
osInit();
versionInit();
wcscpy_s( pluginname, SHORTNAME, PLUGIN_NAME );
wcscpy_s( pluginversion, SHORTNAME, OLLYEXT_VERSION );
Addtolist( 0, BLACK, g_versionStr );
wchar_t v[TEXTLEN];
mbstowcs( v, BeaEngineVersion(), TEXTLEN );
wchar_t beaVer[TEXTLEN];
wsprintf( beaVer, L"%ws: BeaEngine version: %ws", PLUGIN_NAME, v );
Addtolist( 0, BLACK, beaVer );
wchar_t r[TEXTLEN];
mbstowcs( r, BeaEngineRevision(), TEXTLEN );
wchar_t beaRev[TEXTLEN];
wsprintf( beaRev, L"%ws: BeaEngine revision: %ws", PLUGIN_NAME, r );
Addtolist( 0, BLACK, beaRev );
return PLUGIN_VERSION;
}
extc int __cdecl ODBG2_Plugininit( void )
{
aboutInit();
iconInit();
SendMessage( hwollymain, WM_SETICON, ICON_SMALL, (LPARAM)g_hIconSmall );
SendMessage( hwollymain, WM_SETICON, ICON_BIG, (LPARAM)g_hIconBig );
integrityInit();
integritySnapshot( L"ntdll.dll" );
protectReadOptions();
bugfixesReadOptions();
bugfixesApply();
generalReadOptions();
return 0;
}
extc void ODBG2_Pluginnotify( int code, void* data, ulong parm1, ulong parm2 )
{
switch( code )
{
case PN_STATUS:
switch( parm1 )
{
case STAT_LOADING:
protectPreHook();
break;
case STAT_IDLE:
protectPostHook();
break;
}
break;
}
}
extc void __cdecl ODBG2_Pluginreset( void )
{
g_protectionApplied = false;
protectReset();
}
extc int __cdecl ODBG2_Pluginexception( t_run* prun, const t_disasm* da, t_thread* pthr, t_reg* preg, wchar_t* message )
{
if( !g_protectionApplied &&
!skipsystembp )
{
g_protectionApplied = true;
protectApply();
}
return PE_IGNORED;
}
extc t_menu* __cdecl ODBG2_Pluginmenu( wchar_t* type )
{
if( !wcscmp( type, PWM_MAIN ) )
return g_mainMenu;
else if( !wcscmp( type, PWM_DISASM ) )
return g_disasmMenu;
else if( !wcscmp( type, PWM_DUMP ) )
return g_dumpMenu;
return NULL;
};
extc void __cdecl ODBG2_Plugindestroy( void )
{
integrityDestroy();
iconDestroy();
aboutDestroy();
versionDestroy();
}