Skip to content

Commit 574e262

Browse files
committed
Fixes for multi-byte build configurations.
1 parent c7b95a0 commit 574e262

20 files changed

+327
-296
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ DriverPlugin_dbg.rc-plugin64d
6363
/BIN/plugins-lol/TestPlugin.lib
6464
*.rc-plugin
6565
/BIN/plugins/TestPlugin.lib
66+
*.rc-plugin64

ReClass/CClassView.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,9 @@ void CClassView::ReplaceSelectedWithType( NodeType Type )
16091609
{
16101610
std::vector<CNodeBase*> newSelected;
16111611

1612+
#if defined(_DEBUG)
16121613
PrintOut( _T( "Replace Node Type %s" ), NodeTypeToString( Type ) );
1614+
#endif
16131615

16141616
for (size_t i = 0; i < m_Selected.size( ); i++)
16151617
{

ReClass/CMemory.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ class CMemory {
1010

1111
~CMemory( )
1212
{
13-
if (m_pMemory)
14-
{
13+
if (m_pMemory != NULL)
1514
free( m_pMemory );
16-
m_pMemory = NULL;
17-
}
1815
}
1916

2017
inline void SetSize( unsigned long Size )

ReClass/CNodeClass.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CNodeClass::CNodeClass( )
1818

1919
m_RequestPosition = -1;
2020
m_Idx = 0;
21-
m_pChildClassFrame = nullptr;
21+
m_pChildClassFrame = NULL;
2222
}
2323

2424
void CNodeClass::Update( const PHOTSPOT Spot )
@@ -47,6 +47,7 @@ NODESIZE CNodeClass::Draw( const PVIEWINFO View, int x, int y )
4747
{
4848
NODESIZE DrawSize;
4949
NODESIZE ChildDrawSize;
50+
int tx;
5051

5152
DrawSize.x = 0;
5253
DrawSize.y = 0;
@@ -55,7 +56,7 @@ NODESIZE CNodeClass::Draw( const PVIEWINFO View, int x, int y )
5556
x = AddOpenClose( View, x, y );
5657

5758
// Save tx here
58-
int tx = x;
59+
tx = x;
5960

6061
x = AddIcon( View, x, y, ICON_CLASS, -1, -1 );
6162
x = AddText( View, x, y, g_crOffset, 0, _T( "%s" ), m_strOffset ) + g_FontWidth;
@@ -87,21 +88,21 @@ NODESIZE CNodeClass::Draw( const PVIEWINFO View, int x, int y )
8788
CNodeBase* pNode = m_ChildNodes[i];
8889
if (!pNode)
8990
{
90-
PrintOut( _T( "Node %d is NULL in class %s!" ), i, m_strName.GetString( ) );
91+
PrintOutDbg( _T( "Node %d is NULL in class %s!" ), i, m_strName.GetString( ) );
9192
continue;
9293
}
9394

9495
if (pNode->GetType( ) == nt_vtable)
9596
{
9697
CNodeVTable* VTableNode = static_cast<CNodeVTable*>(pNode);
97-
if (!VTableNode->IsInitialized( ) && m_pChildClassFrame != nullptr)
98+
if (!VTableNode->IsInitialized( ) && m_pChildClassFrame != NULL)
9899
VTableNode->Initialize( static_cast<CWnd*>(m_pChildClassFrame->GetChildView( )) );
99100
}
100101

101102
if (pNode->GetType( ) == nt_function)
102103
{
103104
CNodeFunction* FunctionNode = static_cast<CNodeFunction*>(pNode);
104-
if (!FunctionNode->IsInitialized( ) && m_pChildClassFrame != nullptr)
105+
if (!FunctionNode->IsInitialized( ) && m_pChildClassFrame != NULL)
105106
FunctionNode->Initialize( m_pChildClassFrame->GetChildView( ), m_Offset + FunctionNode->GetOffset( ) );
106107
}
107108

ReClass/CNodeFunctionPtr.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ NODESIZE CNodeFunctionPtr::Draw( const PVIEWINFO View, int x, int y )
5959
NODESIZE DrawSize;
6060
int tx, ax;
6161

62-
if (m_bHidden)
62+
if (IsHidden( ))
6363
return DrawHidden( View, x, y );
6464

6565
AddSelection( View, 0, y, g_FontHeight );
@@ -99,7 +99,6 @@ NODESIZE CNodeFunctionPtr::Draw( const PVIEWINFO View, int x, int y )
9999
tx = AddOpenClose( View, tx, y );
100100

101101
tx += g_FontWidth;
102-
103102
tx = AddComment( View, tx, y );
104103

105104
if (m_LevelsOpen[View->Level])
@@ -151,9 +150,7 @@ void CNodeFunctionPtr::Initialize( CWnd* pParentWindow, ULONG_PTR Address )
151150
{
152151
m_pAssemblyWindow->Clear( );
153152
m_pAssemblyWindow->ShowWindow( SW_HIDE );
154-
155153
delete m_pAssemblyWindow;
156-
m_pAssemblyWindow = NULL;
157154
}
158155

159156
m_pAssemblyWindow = new CScintillaEdit;
@@ -304,5 +301,4 @@ void CNodeFunctionPtr::DisassembleBytes( ULONG_PTR Address )
304301

305302
// Force a redraw
306303
m_bRedrawNeeded = TRUE;
307-
308304
}

ReClass/CNodeFunctionPtr.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ class CNodeFunctionPtr : public CNodeBase {
2121

2222
inline void HideAssemblyWindow( )
2323
{
24-
if (m_bRedrawNeeded == FALSE)
24+
if (!m_bRedrawNeeded)
2525
{
2626
if (m_pAssemblyWindow != NULL)
2727
m_pAssemblyWindow->ShowWindow( SW_HIDE );
2828
m_bRedrawNeeded = TRUE;
2929
}
30+
31+
//if (m_pAssemblyWindow != NULL)
32+
//{
33+
// m_pAssemblyWindow->ShowWindow( SW_HIDE );
34+
// m_bRedrawNeeded = TRUE;
35+
//}
3036
}
3137

3238
private:

ReClass/CNodePtr.cpp

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "stdafx.h"
22
#include "CNodePtr.h"
33

4-
CNodePtr::CNodePtr( ) : m_pNode( NULL )
4+
CNodePtr::CNodePtr( )
5+
: m_pClassNode( NULL )
56
{
67
m_nodeType = nt_pointer;
78
}
@@ -15,12 +16,13 @@ NODESIZE CNodePtr::Draw( const PVIEWINFO View, int x, int y )
1516
{
1617
NODESIZE DrawSize;
1718
NODESIZE ChildDrawSize;
18-
uintptr_t* Data;
19+
ULONG_PTR* Data;
20+
int tx;
1921

2022
if (m_bHidden)
2123
return DrawHidden( View, x, y );
2224

23-
Data = (uintptr_t*)(View->Data + m_Offset);
25+
Data = (ULONG_PTR*)(View->Data + m_Offset);
2426

2527
//printf( "read ptr: %p\n", View->Data );
2628
AddSelection( View, 0, y, g_FontHeight );
@@ -30,21 +32,21 @@ NODESIZE CNodePtr::Draw( const PVIEWINFO View, int x, int y )
3032
x = AddOpenClose( View, x, y );
3133
x = AddIcon( View, x, y, ICON_POINTER, -1, -1 );
3234

33-
int tx = x;
34-
tx = AddAddressOffset( View, tx, y );
35+
tx = AddAddressOffset( View, x, y );
3536
tx = AddText( View, tx, y, g_crType, HS_NONE, _T( "Ptr " ) );
3637
tx = AddText( View, tx, y, g_crName, HS_NAME, _T( "%s" ), m_strName );
37-
tx = AddText( View, tx, y, g_crValue, HS_NONE, _T( " <%s>" ), m_pNode->GetName( ) );
38+
tx = AddText( View, tx, y, g_crValue, HS_NONE, _T( " <%s>" ), m_pClassNode->GetName( ) );
3839
tx = AddIcon( View, tx, y, ICON_CHANGE, HS_CLICK, HS_CHANGE_A );
3940

4041
tx += g_FontWidth;
4142
tx = AddComment( View, tx, y );
4243

4344
y += g_FontHeight;
4445
DrawSize.x = tx;
46+
4547
if (m_LevelsOpen[View->Level])
4648
{
47-
DWORD NeededSize = m_pNode->GetMemorySize( );
49+
DWORD NeededSize = m_pClassNode->GetMemorySize( );
4850
m_Memory.SetSize( NeededSize );
4951

5052
VIEWINFO NewView;
@@ -54,12 +56,11 @@ NODESIZE CNodePtr::Draw( const PVIEWINFO View, int x, int y )
5456

5557
ReClassReadMemory( (LPVOID)NewView.Address, (LPVOID)NewView.Data, NeededSize );
5658

57-
ChildDrawSize = m_pNode->Draw( &NewView, x, y );
59+
ChildDrawSize = m_pClassNode->Draw( &NewView, x, y );
60+
5861
y = ChildDrawSize.y;
5962
if (ChildDrawSize.x > DrawSize.x)
60-
{
6163
DrawSize.x = ChildDrawSize.x;
62-
}
6364
}
6465

6566
DrawSize.y = y;

ReClass/CNodePtr.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class CNodePtr : public CNodeBase {
1313

1414
virtual NODESIZE Draw( const PVIEWINFO View, int x, int y );
1515

16-
inline void SetClass( CNodeClass* pNode ) { m_pNode = pNode; }
17-
inline CNodeClass* GetClass( void ) { return m_pNode; }
16+
inline void SetClass( CNodeClass* pClassNode ) { m_pClassNode = pClassNode; }
17+
inline CNodeClass* GetClass( void ) { return m_pClassNode; }
1818

1919
inline CMemory* Memory( ) { return &m_Memory; }
2020

2121
private:
22-
CNodeClass* m_pNode;
22+
CNodeClass* m_pClassNode;
2323
CMemory m_Memory;
2424
};

ReClass/CNodeVTable.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ NODESIZE CNodeVTable::Draw( const PVIEWINFO View, int x, int y )
6464

6565
ReClassReadMemory( (LPVOID)NewView.Address, NewView.Data, NeededSize );
6666

67-
for (UINT i = 0; i < m_ChildNodes.size( ); i++)
67+
for (size_t i = 0; i < m_ChildNodes.size( ); i++)
6868
{
6969
CNodeFunctionPtr* FunctionPtrNode = static_cast<CNodeFunctionPtr*>(m_ChildNodes[i]);
7070

@@ -86,8 +86,10 @@ NODESIZE CNodeVTable::Draw( const PVIEWINFO View, int x, int y )
8686
}
8787
else
8888
{
89-
for (UINT i = 0; i < m_ChildNodes.size( ); i++)
89+
for (size_t i = 0; i < m_ChildNodes.size( ); i++)
90+
{
9091
static_cast<CNodeFunctionPtr*>(m_ChildNodes[i])->HideAssemblyWindow( );
92+
}
9193
}
9294

9395
return DrawSize;

ReClass/CScintillaEdit.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,9 @@ void CScintillaEdit::AddText( CString text, ULONG length )
761761
else
762762
{
763763
#ifdef UNICODE
764-
ULONG textLength = text.GetLength( );
765-
SendEditor( SCI_ADDTEXT, (WPARAM)textLength, (LPARAM)CW2A( text.GetBuffer( ) ).m_psz );
764+
SendEditor( SCI_ADDTEXT, (WPARAM)text.GetLength( ), (LPARAM)CW2A( text.GetBuffer( ) ).m_psz );
766765
#else
767-
SendEditor( SCI_ADDTEXT, (WPARAM)textLength, (LPARAM)text.GetBuffer( ) );
766+
SendEditor( SCI_ADDTEXT, (WPARAM)text.GetLength( ), (LPARAM)text.GetBuffer( ) );
768767
#endif
769768
}
770769
}
@@ -782,10 +781,9 @@ void CScintillaEdit::AppendText( CString text, ULONG length )
782781
else
783782
{
784783
#ifdef UNICODE
785-
ULONG textLength = text.GetLength( );
786-
SendEditor( SCI_APPENDTEXT, (WPARAM)textLength, (LPARAM)CW2A( text.GetBuffer( ) ).m_psz );
784+
SendEditor( SCI_APPENDTEXT, (WPARAM)text.GetLength( ), (LPARAM)CW2A( text.GetBuffer( ) ).m_psz );
787785
#else
788-
SendEditor( SCI_APPENDTEXT, (WPARAM)textLength, (LPARAM)text.GetBuffer( ) );
786+
SendEditor( SCI_APPENDTEXT, (WPARAM)text.GetLength( ), (LPARAM)text.GetBuffer( ) );
789787
#endif
790788
}
791789
}

ReClass/DialogPlugins.cpp

+17-12
Original file line numberDiff line numberDiff line change
@@ -77,47 +77,52 @@ void CDialogPlugins::OnPopupMenuSettings( )
7777
}
7878

7979
void CDialogPlugins::OnPopupMenuAbout( )
80-
{
81-
CStringW Title;
82-
PRECLASS_PLUGIN Plugin = GetSelectedPlugin( );
80+
{
81+
PRECLASS_PLUGIN Plugin = GetSelectedPlugin( );
8382

8483
//TODO: make cool about dialog maybe??
8584

86-
Title.Format( L"%s - About", Plugin->Info.Name );
87-
MessageBoxW( Plugin->Info.About, Title, MB_OK | MB_ICONINFORMATION );
85+
CStringW Title( Plugin->Info.Name );
86+
Title.Append( L" - About" );
87+
::MessageBoxW( GetSafeHwnd( ), Plugin->Info.About, Title, MB_OK | MB_ICONINFORMATION );
8888
}
8989

9090
void CDialogPlugins::OnPopupMenuChangeState( )
9191
{
9292
PRECLASS_PLUGIN Plugin = GetSelectedPlugin( );
9393

94-
Plugin->StateChangeFunction( Plugin->State = !Plugin->State );
94+
Plugin->State = !Plugin->State;
95+
Plugin->StateChangeFunction( Plugin->State );
9596

96-
#ifdef UNICODE
97+
#ifdef _UNICODE
9798
g_ReClassApp.WriteProfileInt( L"PluginState", Plugin->Info.Name, Plugin->State ? 1 : 0 );
9899
#else
99-
g_ReClassApp.WriteProfileInt( "PluginState", CW2A( Plugin.Info.Name ), Plugin.State ? 1 : 0 );
100+
g_ReClassApp.WriteProfileInt( "PluginState", CW2A( Plugin->Info.Name ), Plugin->State ? 1 : 0 );
100101
#endif
102+
101103
RefreshPlugins( );
102104
}
103105

104106
VOID CDialogPlugins::RefreshPlugins( )
105107
{
106-
LVITEM Item;
108+
LVITEMW Item;
107109

108110
m_PluginsList.DeleteAllItems( );
109111

110112
for (PRECLASS_PLUGIN Plugin : g_LoadedPlugins)
111113
{
112-
ZeroMemory( &Item, sizeof( LVITEM ) );
113-
114+
ZeroMemory( &Item, sizeof( LVITEMW ) );
114115
Item.mask = LVIF_TEXT;
115116
Item.pszText = Plugin->Info.Name;
116117
Item.cchTextMax = (int)wcslen( Plugin->Info.Name ) + 1;
117118
Item.iItem = m_PluginsList.GetItemCount( );
118119

119-
int PosIdx = m_PluginsList.InsertItem( &Item );
120+
int PosIdx = m_PluginsList.InsertItem( (LVITEM*)&Item );
121+
#ifdef _UNICODE
120122
m_PluginsList.SetItemText( PosIdx, 1, Plugin->Info.Version );
123+
#else
124+
m_PluginsList.SetItemText( PosIdx, 1, CW2A( Plugin->Info.Version ) );
125+
#endif
121126
m_PluginsList.SetItemText( PosIdx, 2, Plugin->State ? _T( "Enabled" ) : _T( "Disabled" ) );
122127
}
123128
}

ReClass/DialogProcSelect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void CDialogProcSelect::ListRunningProcs( )
121121
#ifdef UNICODE
122122
Info.strProcessName = ProcessInfo->ImageName.Buffer;
123123
#else
124-
Info.strProcessName = CW2A( proc_info->ImageName.Buffer );
124+
Info.strProcessName = CW2A( ProcessInfo->ImageName.Buffer );
125125
#endif
126126

127127
GetModuleFileNameEx( hProcess, NULL, tcsProcessPath, MAX_PATH );

0 commit comments

Comments
 (0)