-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwin.diff
More file actions
executable file
·475 lines (435 loc) · 11.7 KB
/
win.diff
File metadata and controls
executable file
·475 lines (435 loc) · 11.7 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
diff --git a/CPPHEADER b/CPPHEADER
old mode 100644
new mode 100755
diff --git a/LICENSE b/LICENSE
old mode 100644
new mode 100755
diff --git a/LICENSE.LGPL b/LICENSE.LGPL
old mode 100644
new mode 100755
diff --git a/README b/README
old mode 100644
new mode 100755
index 3b6cbfd..9372280
--- a/README
+++ b/README
@@ -35,3 +35,7 @@ Roll back:
$ git checkout A2 -- .
$ git commit -m 'going back to A2'
+
+http://www.codebreakers-journal.com/downloads/cbj/2006/CBM_1_2_2006_Nigurrath_Loaders_for_DLLs.pdf
+http://msdn.microsoft.com/en-us/library/7k30y2k5.aspx
+http://www.codeproject.com/KB/system/hooksys.aspx
\ No newline at end of file
diff --git a/bin/conf b/bin/conf
old mode 100644
new mode 100755
diff --git a/globinclude.pri b/globinclude.pri
old mode 100644
new mode 100755
diff --git a/images/bad.svg b/images/bad.svg
old mode 100644
new mode 100755
diff --git a/images/globresources.pri b/images/globresources.pri
old mode 100644
new mode 100755
diff --git a/images/lib.qrc b/images/lib.qrc
old mode 100644
new mode 100755
diff --git a/martex/libqtload/filter.cpp b/martex/libqtload/filter.cpp
old mode 100644
new mode 100755
index 37f3c50..1c621af
--- a/martex/libqtload/filter.cpp
+++ b/martex/libqtload/filter.cpp
@@ -20,6 +20,13 @@ int message()
filter::filter()
{
QSpyWidget::instance()->setObject(0);
+// QSpyWidget::instance()->moveToThread(QCoreApplication::instance()->thread());
+ //QSpyWidget::instance()->setParent(this);
+ this->moveToThread(QCoreApplication::instance()->thread());
+
+ connect(this, SIGNAL(objChanged(QObject *)),
+ QSpyWidget::instance(), SLOT(setObject(QObject *)), Qt::QueuedConnection);
+
}
bool filter::eventFilter(QObject *obj, QEvent *event)
@@ -41,8 +48,8 @@ bool filter::eventFilter(QObject *obj, QEvent *event)
{
// QMouseEvent *keyEvent = static_cast<QMouseEvent *>(event);
// qDebug("Mouse pres %d", keyEvent->pos().x());
- QSpyWidget::instance()->setObject(obj);
- //QSpyWidget::instance()->show();
+ //QSpyWidget::instance()->setObject(obj);
+ emit objChanged(obj);
return false;
}
if (event->type() == QEvent::Show)
diff --git a/martex/libqtload/filter.h b/martex/libqtload/filter.h
old mode 100644
new mode 100755
index 1b79a8e..80e25e7
--- a/martex/libqtload/filter.h
+++ b/martex/libqtload/filter.h
@@ -6,6 +6,10 @@
#include <QKeyEvent>
+#include <windows.h>
+__declspec( dllexport ) void Proc();
+LRESULT __declspec(dllexport) CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam);
+
class filter : public QObject
{
Q_OBJECT
@@ -13,6 +17,9 @@ class filter : public QObject
public:
filter();
+signals:
+ void objChanged(QObject * obj);
+
protected:
bool eventFilter(QObject *obj, QEvent *event);
diff --git a/martex/libqtload/lib.cpp b/martex/libqtload/lib.cpp
old mode 100644
new mode 100755
index 3034f6a..625cfd5
--- a/martex/libqtload/lib.cpp
+++ b/martex/libqtload/lib.cpp
@@ -1,10 +1,15 @@
#include <QCoreApplication>
+#include <QThread>
#include <QEvent>
+#include <QPushButton>
#include "filter.h"
static bool installed = false;
+
+
+
/*
int QCoreApplication::exec()
{
@@ -19,22 +24,59 @@ void QCoreApplication::exit(int)
}
*/
-#ifdef Q_OS_WIN
+//#pragma comment(linker, "/export:QCoreApplication::event=_RegistrationDll.QCoreApplication::event")
#include <windows.h>
+//LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
+
+
+ __declspec(dllexport) LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
+{
+
+ printf("helo GetMsgProc !!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+/* if (!installed)
+ {
+ QCoreApplication::instance()->installEventFilter( new filter());
+ installed = true;
+ }
+*/
+
+ return CallNextHookEx (NULL, nCode, wParam, lParam);
+}
+
+#ifdef Q_OS_WIN
+
+ class MyThread : public QThread
+ {
+ public:
+ void run();
+ };
+
+
bool WINAPI DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved)
{
- if(dwReason == DLL_PROCESS_ATTACH)
+ printf("helo!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+ if(dwReason == DLL_PROCESS_ATTACH)
{
- printf("helo!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+ printf("Attaching helo!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
}
else if(dwReason == DLL_PROCESS_DETACH)
{
printf("helo!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
}
+ /* if (!installed)
+ {
+ filter *f = new filter();
+ f->moveToThread(QCoreApplication::instance()->thread());
+ QCoreApplication::instance()->installEventFilter( f );
+ f->moveToThread(QCoreApplication::instance()->thread());
+ installed = true;
+ }*/
return true;
-}
+}
/*BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
@@ -55,6 +97,51 @@ bool WINAPI DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved)
return TRUE;
}
*/
+#ifdef _MANAGED
+#pragma managed(pop)
+#endif
+
+
+
+ void MyThread::run()
+ {
+ if (!installed)
+ {
+ filter *f = new filter();
+// f->moveToThread(QCoreApplication::instance()->thread());
+ QCoreApplication::instance()->installEventFilter( f );
+// f->moveToThread(QCoreApplication::instance()->thread());
+ installed = true;
+ }
+ exec();
+ }
+
+class Hello
+{
+public:
+ Hello() {
+
+ MyThread* t = new MyThread;
+ t->start();
+ //QPushButton w;
+ //w.show();
+ //QEventLoop el;
+ //el.exec();
+ //QCoreApplication::instance()->exec();
+/* for (;;){
+ QCoreApplication::instance()->processEvents();
+ }
+*/
+
+// MessageBoxA(NULL, "Hello", "Hi", MB_OK);
+
+ }
+};
+
+Hello h;
+
+
+
#else
bool QCoreApplication::event(QEvent *e)
diff --git a/martex/libqtload/libqtload.pro b/martex/libqtload/libqtload.pro
old mode 100644
new mode 100755
index b77789f..1e0066a
--- a/martex/libqtload/libqtload.pro
+++ b/martex/libqtload/libqtload.pro
@@ -9,6 +9,8 @@ INCLUDEPATH += .
CONFIG += designer
CONFIG += uitools
+LIBS += User32.lib
+
qtAddLibrary(QtDesigner)
qtAddLibrary(QtDesignerComponents)
diff --git a/martex/libqtload/qspywidget.cpp b/martex/libqtload/qspywidget.cpp
old mode 100644
new mode 100755
index dd685f1..a857c5d
--- a/martex/libqtload/qspywidget.cpp
+++ b/martex/libqtload/qspywidget.cpp
@@ -26,10 +26,13 @@ QSpyWidget::QSpyWidget(QWidget *parent) :
{
selected = 0;
m_top = 0;
+// m_ui->moveToThread(QCoreApplication::instance()->thread());
+// this->moveToThread(QCoreApplication::instance()->thread());
m_ui->setupUi(this);
m_ui->treeWidget->setColumnWidth(0, 220);
m_formeditor = QDesignerComponents::createFormEditor(0);
+// m_formeditor->moveToThread(QCoreApplication::instance()->thread());
// oi = QDesignerComponents::createObjectInspector(m_formeditor, 0);
// oi->setWindowTitle(tr("Object inspector"));
@@ -37,6 +40,7 @@ QSpyWidget::QSpyWidget(QWidget *parent) :
// QDesignerObjectInspector *oi2 = qobject_cast<QDesignerObjectInspector *>(oi);
pe = QDesignerComponents::createPropertyEditor(m_formeditor, 0);
+// pe->moveToThread(QCoreApplication::instance()->thread());
pe->setWindowTitle(tr("Property editor"));
// m_ui->splitter->addWidget(oi);
m_ui->splitter->addWidget(pe);
@@ -70,8 +74,9 @@ void QSpyWidget::setObject(QObject * obj)
if (obj) selected = obj;
else return;
- if (updateObjectTree(obj))
- pe->setObject(obj);
+ updateObjectTree(obj);
+// if (updateObjectTree(obj))
+// pe->setObject(obj);
}
bool QSpyWidget::updateObjectTree(QObject * obj)
@@ -92,6 +97,7 @@ bool QSpyWidget::updateObjectTree(QObject * obj)
addChildrens(objItem, m_top);
m_ui->treeWidget->expandAll();
+
return true;
}
return false;
@@ -118,6 +124,8 @@ void QSpyWidget::addChildrens(QTreeWidgetItem *parent, QObject * obj)
QSpyWidget::~QSpyWidget()
{
+ delete trayIconMenu;
+ delete trayIcon;
delete m_ui;
}
diff --git a/martex/libqtload/qspywidget.h b/martex/libqtload/qspywidget.h
old mode 100644
new mode 100755
index f6d654d..e65bcf5
--- a/martex/libqtload/qspywidget.h
+++ b/martex/libqtload/qspywidget.h
@@ -28,13 +28,15 @@ class QSpyWidget : public QWidget {
public:
static QSpyWidget *instance();
+
+public slots:
void setObject(QObject * obj);
+protected:
void createActions();
void createTrayIcon();
void setVisible(bool visible);
-protected:
virtual void changeEvent(QEvent *e);
bool updateObjectTree(QObject * obj);
void addChildrens(QTreeWidgetItem *parent, QObject * obj);
diff --git a/martex/libqtload/qspywidget.ui b/martex/libqtload/qspywidget.ui
old mode 100644
new mode 100755
diff --git a/martex/main.cpp b/martex/main.cpp
old mode 100644
new mode 100755
index e603b4f..0cb882f
--- a/martex/main.cpp
+++ b/martex/main.cpp
@@ -5,7 +5,16 @@
#ifdef Q_OS_WIN
+
+#include <QProcess>
+#include <QObject>
+#include <QThread>
+#include <QDebug>
+
#include <windows.h>
+#include <QInjector.h>
+
+
#else
@@ -18,60 +27,18 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
if (argc < 1) return -1;
QString str(QObject::tr("translate me"));
- qWarning("TODO check for lib existance: %s:%d", __FILE__, __LINE__);
- qWarning("TODO check for executable existance: %s:%d", __FILE__, __LINE__);
- qWarning("TODO: %s:%d", __FILE__, __LINE__);
+ qWarning("TODO check for lib existance: %s:%d", __FILE__, __LINE__);
+ qWarning("TODO check for executable existance: %s:%d", __FILE__, __LINE__);
+ qWarning("TODO: %s:%d", __FILE__, __LINE__);
#ifdef Q_OS_WIN
-HANDLE hProcess;
-
-HANDLE hThread;
-char szLibPath[_MAX_PATH]; // The name of our "LibSpy.dll" module
-
- // (including full path!);
-
-void* pLibRemote; // The address (in the remote process) where
-
- // szLibPath will be copied to;
-
-DWORD hLibModule; // Base address of loaded module (==HMODULE);
-
-HMODULE hKernel32 = ::GetModuleHandle(L"Kernel32");
-
-// initialize szLibPath
-
-//...
-
-
-// 1. Allocate memory in the remote process for szLibPath
-
-// 2. Write szLibPath to the allocated memory
-
-pLibRemote = ::VirtualAllocEx( hProcess, NULL, sizeof(szLibPath),
- MEM_COMMIT, PAGE_READWRITE );
-::WriteProcessMemory( hProcess, pLibRemote, (void*)szLibPath,
- sizeof(szLibPath), NULL );
-
-
-// Load "LibSpy.dll" into the remote process
-
-// (via CreateRemoteThread & LoadLibrary)
-
-hThread = ::CreateRemoteThread( hProcess, NULL, 0,
- (LPTHREAD_START_ROUTINE) ::GetProcAddress( hKernel32,
- "LoadLibraryA" ),
- pLibRemote, 0, NULL );
-::WaitForSingleObject( hThread, INFINITE );
-
-// Get handle of the loaded module
-
-::GetExitCodeThread( hThread, &hLibModule );
-
-// Clean up
-
-::CloseHandle( hThread );
-::VirtualFreeEx( hProcess, pLibRemote, sizeof(szLibPath), MEM_RELEASE );
+ QInjector inj;
+ QString name(argv[1]/*"loopback.exe"*/);
+ inj.start(name);
+
+//QThread::currentThread()->wait(2000);
+
#else
int ret;
@@ -80,5 +47,10 @@ hThread = ::CreateRemoteThread( hProcess, NULL, 0,
ret = execve (argv[1], nargv, env);
#endif
-
+ return a.exec();
}
+
+
+
+
+
diff --git a/martex/martex.pro b/martex/martex.pro
old mode 100644
new mode 100755
index 10ff29f..741a1bb
--- a/martex/martex.pro
+++ b/martex/martex.pro
@@ -7,7 +7,11 @@ TARGET = martex
DEPENDPATH += .
INCLUDEPATH += .
-SOURCES += main.cpp
+LIBS += Advapi32.lib User32.lib
+
+
+HEADERS += QInjector.h
+SOURCES += main.cpp QInjector.cpp
include (../globinclude.pri)
@@ -16,3 +20,5 @@ RESOURCES += $$GLOBRESOURCES
DESTDIR = $$GLOBTOP/bin
+win32:CONFIG+=console
+
diff --git a/martlet.pro b/martlet.pro
old mode 100644
new mode 100755
diff --git a/translations/en_uk.ts b/translations/en_uk.ts
old mode 100644
new mode 100755
diff --git a/translations/translations.pri b/translations/translations.pri
old mode 100644
new mode 100755
diff --git a/translations/ua.ts b/translations/ua.ts
old mode 100644
new mode 100755