Repository navigation
Expand file tree
/
Copy pathProcessMM.dpr
More file actions
196 lines (182 loc) · 8.32 KB
/
Copy pathProcessMM.dpr
File metadata and controls
196 lines (182 loc) · 8.32 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
////////////////////////////////////////////////////////////////////////////////
//
// ****************************************************************************
// * Project : Process Memory Map
// * Unit Name : ProcessMM.dpr
// * Author : Alexander (Rouse_) Bagel
// * Copyright : © Fangorn Wizards Lab 1998 - 2026.
// * Version : 1.7.54
// * Home Page : http://rouse.drkb.ru
// * Home Blog : http://alexander-bagel.blogspot.ru
// ****************************************************************************
// * Stable Release : https://github.com/AlexanderBagel/ProcessMemoryMap/releases
// * Latest Source : https://github.com/AlexanderBagel/ProcessMemoryMap
// ****************************************************************************
// *
// * SPDX-License-Identifier: MPL-2.0
// * This Source Code Form is subject to the terms of the Mozilla Public
// * License, v. 2.0. If a copy of the MPL was not distributed with this
// * file, You can obtain one at http://mozilla.org/MPL/2.0/.
// *
// ****************************************************************************
// *
// * Support the Project:
// *
// * If you found this project useful, you can support its development
// * on the author's main-project page:
// *
// * https://boosty.to/processmemorymap
// *
// ****************************************************************************
//
program ProcessMM;
uses
Winapi.Windows,
Winapi.Messages,
Vcl.Forms,
System.SysUtils,
uProcessMM in 'src\gui\uProcessMM.pas' {dlgProcessMM},
uSelectProcess in 'src\gui\uSelectProcess.pas' {dlgSelectProcess},
uExportList in 'src\gui\uExportList.pas' {dlgExportList},
uSettings.Form in 'src\gui\uSettings.Form.pas' {dlgSettings},
uUtils in 'src\uUtils.pas',
uDisplayUtils in 'src\uDisplayUtils.pas',
uRegionProperties in 'src\gui\uRegionProperties.pas' {dlgRegionProps},
uSelectAddress in 'src\gui\uSelectAddress.pas' {dlgSelectAddress},
uFindData in 'src\gui\uFindData.pas' {dlgFindData},
uComparator in 'src\gui\uComparator.pas' {dlgComparator},
uProgress in 'src\gui\uProgress.pas' {dlgProgress},
uDump in 'src\uDump.pas',
uDumpDisplayUtils in 'src\uDumpDisplayUtils.pas',
uIPC in 'src\uIPC.pas',
MemoryMap.Core in 'MemoryMap\MemoryMap.Core.pas',
MemoryMap.Heaps in 'MemoryMap\MemoryMap.Heaps.pas',
MemoryMap.NtDll in 'MemoryMap\MemoryMap.NtDll.pas',
MemoryMap.PEImage in 'MemoryMap\MemoryMap.PEImage.pas',
MemoryMap.RegionData in 'MemoryMap\MemoryMap.RegionData.pas',
MemoryMap.Symbols in 'MemoryMap\MemoryMap.Symbols.pas',
MemoryMap.Threads in 'MemoryMap\MemoryMap.Threads.pas',
MemoryMap.Utils in 'MemoryMap\MemoryMap.Utils.pas',
MemoryMap.Workset in 'MemoryMap\MemoryMap.Workset.pas',
uAbout in 'src\gui\uAbout.pas' {dlgAbout},
uMemoryMapListInfo in 'src\gui\uMemoryMapListInfo.pas' {dlgMemoryMapListInfo},
uMemoryMapListInfoSettings in 'src\gui\uMemoryMapListInfoSettings.pas' {dlgMemoryMapListInfoSettings},
distorm in 'distorm\distorm.pas',
MemoryMap.DebugMapData in 'MemoryMap\MemoryMap.DebugMapData.pas',
uProcessReconnect in 'src\uProcessReconnect.pas',
MemoryMap.ImageHlp in 'MemoryMap\MemoryMap.ImageHlp.pas',
mnemonics in 'distorm\mnemonics.pas',
uKnownData in 'src\gui\uKnownData.pas' {dlgKnownData},
uPatchDetect in 'src\gui\uPatchDetect.pas' {dlgPatches},
RawScanner.Analyzer in 'RawScanner\RawScanner.Analyzer.pas',
RawScanner.ApiSet in 'RawScanner\RawScanner.ApiSet.pas',
RawScanner.Disassembler in 'RawScanner\RawScanner.Disassembler.pas',
RawScanner.Filter in 'RawScanner\RawScanner.Filter.pas',
RawScanner.LoaderData in 'RawScanner\RawScanner.LoaderData.pas',
RawScanner.Logger in 'RawScanner\RawScanner.Logger.pas',
RawScanner.Image.Pe in 'RawScanner\RawScanner.Image.Pe.pas',
RawScanner.Types in 'RawScanner\RawScanner.Types.pas',
RawScanner.Utils in 'RawScanner\RawScanner.Utils.pas',
RawScanner.Wow64 in 'RawScanner\RawScanner.Wow64.pas',
RawScanner.Core in 'RawScanner\RawScanner.Core.pas',
RawScanner.SymbolStorage in 'RawScanner\RawScanner.SymbolStorage.pas',
RawScanner.ActivationContext in 'RawScanner\RawScanner.ActivationContext.pas',
FWProgressBar in 'Controls\FWProgressBar.pas',
pmm_plugin in 'plugins\include\pmm_plugin.pas',
uPluginManager in 'src\uPluginManager.pas',
uDebugInfoDlg in 'src\gui\uDebugInfoDlg.pas' {dlgDbgInfo},
Shell.TaskBarListProgress in 'Controls\Shell.TaskBarListProgress.pas',
RawScanner.X64Gates in 'RawScanner\RawScanner.X64Gates.pas',
uStringsViewer in 'src\gui\uStringsViewer.pas' {dlgStringsViewer},
ScaledCtrls in 'Controls\ScaledCtrls.pas',
uBaseForm in 'src\gui\uBaseForm.pas' {BaseAppForm},
RawScanner.CoffDwarf in 'RawScanner\RawScanner.CoffDwarf.pas',
uCallStack in 'src\gui\uCallStack.pas' {dlgCallStack},
RawScanner.Elf in 'RawScanner\RawScanner.Elf.pas',
RawScanner.Image.Elf in 'RawScanner\RawScanner.Image.Elf.pas',
RawScanner.MapGenerator in 'RawScanner\RawScanner.MapGenerator.pas',
RawScanner.AbstractImage in 'RawScanner\RawScanner.AbstractImage.pas',
RawScanner.Image.Coff in 'RawScanner\RawScanner.Image.Coff.pas',
uSearchResult in 'src\gui\uSearchResult.pas' {dlgSearchResult},
uResources in 'src\gui\uResources.pas' {dlgResources},
RawScanner.Resources in 'RawScanner\RawScanner.Resources.pas',
uSettings in 'src\uSettings.pas',
uDumpResources in 'src\uDumpResources.pas',
RawScanner.Resources.Helpers in 'RawScanner\RawScanner.Resources.Helpers.pas',
uDisplayStyleInfo in 'src\uDisplayStyleInfo.pas',
uPatchRestore in 'src\gui\uPatchRestore.pas' {dlgPatchRestore},
uWindows in 'src\gui\uWindows.pas' {dlgWindows},
FWAniPaintBox in 'Controls\FWAniPaintBox.pas',
RawScanner.Pdb in 'RawScanner\RawScanner.Pdb.pas',
uPdbManager in 'src\gui\uPdbManager.pas' {dlgPdbManager};
{$R *.res}
{$IFDEF RELEASE}
{$R version.res}
{$ENDIF}
// The SINGLE_INSTANCE directive prevents a 32-bit application from launching its 64-bit counterpart
// For debugging purposes only
// [ru] Директива SINGLE_INSTANCE не дает запускать 32 битному приложению 64 битный аналог
// Сугубо для отладки
{$IFDEF SINGLE_INSTANCE}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TdlgProcessMM, dlgProcessMM);
Application.Run;
{$ELSE}
{$IFDEF WIN32}
{$IFDEF DEBUG}
{$R 'win64debug.res' 'win64debug.rc'}
{$ELSE}
{$R 'win64release.res' 'win64release.rc'}
{$ENDIF}
var
IPC: TIPCServer;
New64AppHandle: THandle;
Msg: TMsg;
Path: string;
{$ENDIF} // {$IFDEF WIN32}
begin
{$IFDEF WIN32}
if Is64OS and not FindCmdLineSwitch('32', ['x'], True) then
begin
// If the OS is 64-bit, we launch the corresponding application,
// while we remain running in the background to pass it data about 32-bit heaps.
// However, if the 64-bit application restarts as an administrator,
// we will no longer have access to it and will have to shut down.
// I’ll rework this mechanism properly at some point.
// [ru] Если OS 64-битная, то запускаем соответствующее приложение,
// а сами остаемся висеть чтобы отдавать ему данные о 32-битных кучах.
// Правда если 64-битное приложение перезапустится из под админа
// то доступа к нему мы уже иметь не будем, придется закрываться.
// Потом этот механизм пересмотрю как нибудь по нормальному.
IPC := TIPCServer.Create;
try
Path := ExtractFilePath(ParamStr(0)) + 'processmm64.exe';
New64AppHandle := Run64App(Path, IPC.MMFName);
if New64AppHandle <> 0 then
try
while WaitForSingleObject(New64AppHandle, 50) = WAIT_TIMEOUT do
begin
while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
finally
CloseHandle(New64AppHandle);
end;
finally
DeleteFile(Path);
IPC.Free;
end;
if New64AppHandle <> 0 then Exit;
end;
{$ENDIF} // {$IFDEF WIN32}
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TdlgProcessMM, dlgProcessMM);
Application.Run;
{$ENDIF} // {$IFDEF SINGLE_INSTANCE} -> {$ELSE}
end.