Skip to content

Commit 0f3f85b

Browse files
committed
Added a null check for a case where all processes got filtered out of the attach form and enter/attach key got pressed.
Added an optional parameter to ClassNode constructor allowing to specify a base address. Added using remote process image base on class node creation as base address. Modified output file paths for projects to allow for automated copy on build event for plugins.
1 parent d09d208 commit 0f3f85b

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

Forms/MainForm.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,19 @@ private void attachToProcessToolStripMenuItem_Click(object sender, EventArgs e)
159159
{
160160
if (pb.ShowDialog() == DialogResult.OK)
161161
{
162-
DetachFromCurrentProcess();
163-
164-
remoteProcess.Process = pb.SelectedProcess;
165-
remoteProcess.UpdateProcessInformations();
166-
if (pb.LoadSymbols)
162+
if (pb.SelectedProcess != null)
167163
{
168-
LoadAllSymbolsForCurrentProcess();
169-
}
164+
DetachFromCurrentProcess();
170165

171-
Program.Settings.LastProcess = remoteProcess.Process.Name;
166+
remoteProcess.Process = pb.SelectedProcess;
167+
remoteProcess.UpdateProcessInformations();
168+
if (pb.LoadSymbols)
169+
{
170+
LoadAllSymbolsForCurrentProcess();
171+
}
172+
173+
Program.Settings.LastProcess = remoteProcess.Process.Name;
174+
}
172175
}
173176
}
174177
}
@@ -180,7 +183,8 @@ private void detachToolStripMenuItem_Click(object sender, EventArgs e)
180183

181184
private void newClassToolStripButton_Click(object sender, EventArgs e)
182185
{
183-
var node = ClassNode.Create();
186+
var Address = remoteProcess.IsValid ? remoteProcess.GetModuleByName(remoteProcess.Process.Name).Start : IntPtr.Zero;
187+
var node = ClassNode.Create(Address);
184188
node.AddBytes(64);
185189

186190
classesView.SelectedClass = node;

NativeHelper/NativeHelper.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,25 @@
7272
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
7373
<LinkIncremental>true</LinkIncremental>
7474
<TargetName>$(ProjectName)</TargetName>
75-
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
75+
<OutDir>$(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\</OutDir>
7676
<IncludePath>.\beaengine\include;$(IncludePath)</IncludePath>
7777
</PropertyGroup>
7878
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
7979
<LinkIncremental>true</LinkIncremental>
8080
<TargetName>$(ProjectName)</TargetName>
81-
<OutDir>$(SolutionDir)\bin\$(Configuration)\x64\</OutDir>
81+
<OutDir>$(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\</OutDir>
8282
<IncludePath>.\beaengine\include;$(IncludePath)</IncludePath>
8383
</PropertyGroup>
8484
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
8585
<LinkIncremental>false</LinkIncremental>
8686
<TargetName>$(ProjectName)</TargetName>
87-
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
87+
<OutDir>$(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\</OutDir>
8888
<IncludePath>.\beaengine\include;$(IncludePath)</IncludePath>
8989
</PropertyGroup>
9090
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
9191
<LinkIncremental>false</LinkIncremental>
9292
<TargetName>$(ProjectName)</TargetName>
93-
<OutDir>$(SolutionDir)bin\$(Configuration)\x64\</OutDir>
93+
<OutDir>$(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\</OutDir>
9494
<IncludePath>.\beaengine\include;$(IncludePath)</IncludePath>
9595
</PropertyGroup>
9696
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

Nodes/ClassNode.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,32 @@ public IntPtr Address
4545

4646
public event NodeEventHandler NodesChanged;
4747

48-
internal ClassNode(bool notifyClassCreated)
48+
internal ClassNode(bool notifyClassCreated, IntPtr Address = default(IntPtr))
4949
{
5050
Contract.Ensures(AddressFormula != null);
5151

5252
Uuid = new NodeUuid(true);
53-
53+
if (Address == IntPtr.Zero)
54+
{
5455
#if WIN64
55-
Address = (IntPtr)0x140000000;
56+
this.Address = (IntPtr)0x140000000;
5657
#else
57-
Address = (IntPtr)0x400000;
58+
this.Address = (IntPtr)0x400000;
5859
#endif
59-
60+
}
61+
else
62+
this.Address = Address;
6063
if (notifyClassCreated)
6164
{
6265
ClassCreated?.Invoke(this);
6366
}
6467
}
6568

66-
public static ClassNode Create()
69+
public static ClassNode Create(IntPtr Address = default(IntPtr))
6770
{
6871
Contract.Ensures(Contract.Result<ClassNode>() != null);
6972

70-
return new ClassNode(true);
73+
return new ClassNode(true, Address);
7174
}
7275

7376
public override void Intialize()

ReClass.NET.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<DebugSymbols>true</DebugSymbols>
2222
<DebugType>full</DebugType>
2323
<Optimize>false</Optimize>
24-
<OutputPath>bin\Debug\</OutputPath>
24+
<OutputPath>bin\x86\Debug\</OutputPath>
2525
<DefineConstants>TRACE;DEBUG;WIN32</DefineConstants>
2626
<ErrorReport>prompt</ErrorReport>
2727
<WarningLevel>4</WarningLevel>
@@ -74,7 +74,7 @@
7474
<PlatformTarget>x86</PlatformTarget>
7575
<DebugType>pdbonly</DebugType>
7676
<Optimize>true</Optimize>
77-
<OutputPath>bin\Release\</OutputPath>
77+
<OutputPath>bin\x86\Release\</OutputPath>
7878
<DefineConstants>TRACE;WIN32;RELEASE</DefineConstants>
7979
<ErrorReport>prompt</ErrorReport>
8080
<WarningLevel>4</WarningLevel>
@@ -84,7 +84,7 @@
8484
<DebugSymbols>true</DebugSymbols>
8585
<DebugType>full</DebugType>
8686
<Optimize>false</Optimize>
87-
<OutputPath>bin\Debug\x64\</OutputPath>
87+
<OutputPath>bin\x64\Debug\</OutputPath>
8888
<DefineConstants>TRACE;DEBUG;WIN64</DefineConstants>
8989
<ErrorReport>prompt</ErrorReport>
9090
<WarningLevel>4</WarningLevel>
@@ -94,7 +94,7 @@
9494
<PlatformTarget>x64</PlatformTarget>
9595
<DebugType>pdbonly</DebugType>
9696
<Optimize>true</Optimize>
97-
<OutputPath>bin\Release\x64\</OutputPath>
97+
<OutputPath>bin\x64\Release\</OutputPath>
9898
<DefineConstants>TRACE;WIN64;RELEASE</DefineConstants>
9999
<ErrorReport>prompt</ErrorReport>
100100
<WarningLevel>4</WarningLevel>

0 commit comments

Comments
 (0)