-
Notifications
You must be signed in to change notification settings - Fork 0
/
hexApp.cpp
135 lines (132 loc) · 3.19 KB
/
hexApp.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
/***************************************************************
* Name: hexApp.cpp
* Purpose: Code for Application Class
* Author: awsdert ()
* Created: 2012-01-11
* Copyright: awsdert ()
* License:
**************************************************************/
#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
#include "cleanAll.h"
#include "G.h"
IMPLEMENT_APP( hexApp );
s32 MB( xStr text, xStr title, s32 mode )
{
return wxMessageBox( text, title, mode );
}
G* rootWindow;
xStr gTitle = wxT( "HackerEX" );
xStr gVendor = wxT( "Shadow Flare Industries" );
xStr gSlash;
xAStr gSizes;
bool hexApp::OnInit()
{
gSizes.SetCount( SIZE_COUNT );
gSizes[ SIZE_8 ] = wxT( "8bit" );
gSizes[ SIZE_16 ] = wxT( "16bit" );
gSizes[ SIZE_32 ] = wxT( "32bit" );
gSizes[ SIZE_64 ] = wxT( "64bit" );
gSetArea();
gSetQTests();
gSlash = wxGetCwd().Contains( wxT( "\\" ) ) ? wxT( "\\" ) : wxT( "/" );
rootWindow = new G( 0 );
rootWindow->SetIcon( wxICON( NULL ) );
rootWindow->Show();
return true;
}
xStr gGetTitle( void ) { return gTitle; }
xStr gGetVendor( void ) { return gVendor; }
xStr gGetSlash( void ) { return gSlash; }
void gEnable( bool enable, wxWindow* obj )
{
if ( !enable )
{
obj->Disable();
obj->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
}
else
{
obj->Enable();
obj->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
}
}
xAStr gGetSizes( void ) { return gSizes; }
u8 gGetUSize( s8 size )
{
u8 value = 0u;
switch ( size )
{
case SIZE_16: value = 2u; break;
case SIZE_32: value = 4u; break;
case SIZE_64: value = 8u; break;
default: value = 1u;
}
return value;
}
s8 gGetSSize( u8 size )
{
s8 value = -1;
switch ( size )
{
case 2u: value = SIZE_16; break;
case 4u: value = SIZE_32; break;
case 8u: value = SIZE_64; break;
default: value = SIZE_8;
}
return value;
}
void gClose( wxDialog* d )
{
if ( !d->IsModal() ) d->Close();
else d->EndModal( wxID_OK );
}
void ValidateFileName( wxKeyEvent& event )
{
s32 key = event.GetKeyCode();
bool doEvent = false;
wxChar c = key;
xStr text = c;
xStr safe = wxT( "01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ (-)" );
text.UpperCase();
switch ( key )
{
default:
if ( key <= 255 && !safe.Contains( text ) ) break;
case WXK_BACK:
case WXK_DELETE:
case WXK_INSERT:
case WXK_LEFT:
case WXK_RIGHT:
case WXK_UP:
case WXK_DOWN:
doEvent = true;
}
event.Skip(doEvent);
}
#ifdef WIN32
BOOL CALLBACK EnumWindowsMSW( HWND winHandle, LPARAM winLength )
{
if ( IsWindowVisible( winHandle ) )
{
wxString xAppID, xAppExe, xTitle;
// Process ID
DWORD appID;
GetWindowThreadProcessId( winHandle, &appID );
xAppID.Printf( wxT( "%08X" ), appID );
// Executable
xAppExe = GetAppExe( appID );
// Window Caption
TCHAR title[ MAXCHAR ];
SendMessage( winHandle, WM_GETTEXT, MAXBYTE, (LPARAM)(void*)title );
xTitle.Printf( wxT( "%s" ), title );
// Finish up
if ( xTitle != wxT("") )
{
rootWindow->AddApp( xAppID, xAppExe, xTitle );
}
}
return TRUE;
}
#endif