Skip to content

Commit 9ae278d

Browse files
committed
Add x86 WoW Support
1 parent a31993e commit 9ae278d

32 files changed

Lines changed: 189 additions & 26 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

MonikaDLL/.vs/MonikaDLL/v17/.suo

9 KB
Binary file not shown.
0 Bytes
Binary file not shown.

MonikaDLL/.vs/MonikaDLL/v17/DocumentLayout.backup.json

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22
"Version": 1,
33
"WorkspaceRootPath": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\",
44
"Documents": [
5+
{
6+
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX86Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
7+
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:InjectX86Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
8+
},
59
{
610
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX64Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
711
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:InjectX64Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
812
},
13+
{
14+
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\dllmain.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
15+
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:dllmain.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
16+
},
917
{
1018
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\ProcessGadgit.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
1119
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:ProcessGadgit.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
1220
},
1321
{
1422
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\KernelWrapper.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
1523
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:KernelWrapper.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
16-
},
17-
{
18-
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\dllmain.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
19-
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:dllmain.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
2024
}
2125
],
2226
"DocumentGroupContainers": [
@@ -31,19 +35,32 @@
3135
{
3236
"$type": "Document",
3337
"DocumentIndex": 0,
38+
"Title": "InjectX86Galgame.cpp",
39+
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX86Galgame.cpp",
40+
"RelativeDocumentMoniker": "InjectX86Galgame.cpp",
41+
"ToolTip": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX86Galgame.cpp",
42+
"RelativeToolTip": "InjectX86Galgame.cpp",
43+
"ViewState": "AgIAABUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
44+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
45+
"WhenOpened": "2024-11-07T08:42:54.762Z",
46+
"EditorCaption": ""
47+
},
48+
{
49+
"$type": "Document",
50+
"DocumentIndex": 1,
3451
"Title": "InjectX64Galgame.cpp",
3552
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX64Galgame.cpp",
3653
"RelativeDocumentMoniker": "InjectX64Galgame.cpp",
3754
"ToolTip": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX64Galgame.cpp",
3855
"RelativeToolTip": "InjectX64Galgame.cpp",
39-
"ViewState": "AgIAANIAAAAAAAAAAAAvwKQAAAABAAAAAAAAAA==",
56+
"ViewState": "AgIAAKIAAAAAAAAAAAAvwLIAAAAFAAAAAAAAAA==",
4057
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
4158
"WhenOpened": "2024-11-04T10:35:02.895Z",
4259
"EditorCaption": ""
4360
},
4461
{
4562
"$type": "Document",
46-
"DocumentIndex": 1,
63+
"DocumentIndex": 3,
4764
"Title": "ProcessGadgit.cpp",
4865
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\ProcessGadgit.cpp",
4966
"RelativeDocumentMoniker": "ProcessGadgit.cpp",
@@ -55,7 +72,7 @@
5572
},
5673
{
5774
"$type": "Document",
58-
"DocumentIndex": 2,
75+
"DocumentIndex": 4,
5976
"Title": "KernelWrapper.cpp",
6077
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\KernelWrapper.cpp",
6178
"RelativeDocumentMoniker": "KernelWrapper.cpp",
@@ -67,13 +84,13 @@
6784
},
6885
{
6986
"$type": "Document",
70-
"DocumentIndex": 3,
87+
"DocumentIndex": 2,
7188
"Title": "dllmain.cpp",
7289
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\dllmain.cpp",
7390
"RelativeDocumentMoniker": "dllmain.cpp",
7491
"ToolTip": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\dllmain.cpp",
7592
"RelativeToolTip": "dllmain.cpp",
76-
"ViewState": "AgIAABIAAAAAAAAAAAAAABcAAAABAAAAAAAAAA==",
93+
"ViewState": "AgIAAB4AAAAAAAAAAAAAABcAAAABAAAAAAAAAA==",
7794
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
7895
"WhenOpened": "2024-08-26T04:16:01.456Z"
7996
}

MonikaDLL/.vs/MonikaDLL/v17/DocumentLayout.json

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
"Version": 1,
33
"WorkspaceRootPath": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\",
44
"Documents": [
5+
{
6+
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectGalgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
7+
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:InjectGalgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
8+
},
9+
{
10+
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX86Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
11+
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:InjectX86Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
12+
},
513
{
614
"AbsoluteMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX64Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
715
"RelativeMoniker": "D:0:0:{AE2845F2-E06C-49D4-85C0-36A962F50764}|MonikaDLL.vcxproj|solutionrelative:InjectX64Galgame.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@@ -31,19 +39,45 @@
3139
{
3240
"$type": "Document",
3341
"DocumentIndex": 0,
42+
"Title": "InjectGalgame.cpp",
43+
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectGalgame.cpp",
44+
"RelativeDocumentMoniker": "InjectGalgame.cpp",
45+
"ToolTip": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectGalgame.cpp",
46+
"RelativeToolTip": "InjectGalgame.cpp",
47+
"ViewState": "AgIAABsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
48+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
49+
"WhenOpened": "2024-11-07T08:54:12.487Z",
50+
"EditorCaption": ""
51+
},
52+
{
53+
"$type": "Document",
54+
"DocumentIndex": 1,
55+
"Title": "InjectX86Galgame.cpp",
56+
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX86Galgame.cpp",
57+
"RelativeDocumentMoniker": "InjectX86Galgame.cpp",
58+
"ToolTip": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX86Galgame.cpp",
59+
"RelativeToolTip": "InjectX86Galgame.cpp",
60+
"ViewState": "AgIAABUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
61+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
62+
"WhenOpened": "2024-11-07T08:42:54.762Z",
63+
"EditorCaption": ""
64+
},
65+
{
66+
"$type": "Document",
67+
"DocumentIndex": 2,
3468
"Title": "InjectX64Galgame.cpp",
3569
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX64Galgame.cpp",
3670
"RelativeDocumentMoniker": "InjectX64Galgame.cpp",
3771
"ToolTip": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\InjectX64Galgame.cpp",
3872
"RelativeToolTip": "InjectX64Galgame.cpp",
39-
"ViewState": "AgIAAKUAAAAAAAAAAAAvwKQAAAABAAAAAAAAAA==",
73+
"ViewState": "AgIAAKIAAAAAAAAAAAAvwLIAAAAFAAAAAAAAAA==",
4074
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
4175
"WhenOpened": "2024-11-04T10:35:02.895Z",
4276
"EditorCaption": ""
4377
},
4478
{
4579
"$type": "Document",
46-
"DocumentIndex": 2,
80+
"DocumentIndex": 4,
4781
"Title": "ProcessGadgit.cpp",
4882
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\ProcessGadgit.cpp",
4983
"RelativeDocumentMoniker": "ProcessGadgit.cpp",
@@ -55,7 +89,7 @@
5589
},
5690
{
5791
"$type": "Document",
58-
"DocumentIndex": 3,
92+
"DocumentIndex": 5,
5993
"Title": "KernelWrapper.cpp",
6094
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\KernelWrapper.cpp",
6195
"RelativeDocumentMoniker": "KernelWrapper.cpp",
@@ -67,16 +101,15 @@
67101
},
68102
{
69103
"$type": "Document",
70-
"DocumentIndex": 1,
104+
"DocumentIndex": 3,
71105
"Title": "dllmain.cpp",
72106
"DocumentMoniker": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\dllmain.cpp",
73107
"RelativeDocumentMoniker": "dllmain.cpp",
74108
"ToolTip": "C:\\Users\\Administrator\\DDLC-MonikaInKernel\\MonikaDLL\\dllmain.cpp",
75109
"RelativeToolTip": "dllmain.cpp",
76110
"ViewState": "AgIAAB4AAAAAAAAAAAAAABcAAAABAAAAAAAAAA==",
77111
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
78-
"WhenOpened": "2024-08-26T04:16:01.456Z",
79-
"EditorCaption": ""
112+
"WhenOpened": "2024-08-26T04:16:01.456Z"
80113
}
81114
]
82115
}

MonikaDLL/InjectGalgame.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#include "pch.h"
2+
3+
extern "C"
4+
{
5+
#include <stdio.h>
6+
#include <stdlib.h>
7+
#include <stdint.h>
8+
#include <Windows.h>
9+
#include <tlhelp32.h>
10+
11+
DWORD GetProcessIdByName(const char* processName);
12+
UINT8 injectX64Gal(char *targetEXE, const char *bmp_path);
13+
UINT8 injectX86Gal(char *targetEXE, const char *bmp_path);
14+
15+
__declspec(dllexport) UINT8 injectGal(char *targetEXE, const char *bmp_path)
16+
{
17+
// get pid
18+
DWORD processId = GetProcessIdByName(targetEXE);
19+
if (!processId)
20+
{
21+
printf("Target process \"%s\" not found. Exiting.\n", targetEXE);
22+
return -1;
23+
}
24+
25+
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
26+
if (!hProcess)
27+
{
28+
printf("Failed to open process with PID %lu\n", processId);
29+
return -1;
30+
}
31+
32+
// check target is x64 or wow64
33+
BOOL isWow64 = FALSE;
34+
IsWow64Process(hProcess, &isWow64);
35+
36+
// Close Handle
37+
CloseHandle(hProcess);
38+
39+
if (isWow64)
40+
{
41+
printf("Target process is x86 (WOW64)\n");
42+
// Inject x86 payload
43+
return injectX86Gal(targetEXE, bmp_path);
44+
}
45+
else
46+
{
47+
printf("Target process is x64\n");
48+
// Inject x64 payload
49+
return injectX64Gal(targetEXE, bmp_path);
50+
}
51+
}
52+
}

MonikaDLL/InjectX86Galgame.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include "pch.h"
2+
3+
extern "C"
4+
{
5+
#include <stdio.h>
6+
#include <stdlib.h>
7+
#include <stdint.h>
8+
#include <Windows.h>
9+
#include <tlhelp32.h>
10+
11+
// x86 (Win32 on Win64) version of the Monika payload is not finished yet...
12+
13+
DWORD GetProcessIdByName(const char* processName);
14+
DWORD GetMainThreadId(DWORD processId);
15+
LPVOID InjectShellcode(HANDLE hProcess, UINT8 *buf, UINT64 bufsize);
16+
HWND GetTargetWindowHandleByPID(DWORD processId);
17+
void DrawImageOnWindow(HWND hwnd, const char* imageFile);
18+
19+
__declspec(dllexport) UINT8 injectX86Gal(char *targetEXE, const char *bmp_path)
20+
{
21+
// First Get the PID of the target process
22+
DWORD processId = GetProcessIdByName(targetEXE);
23+
if (!processId)
24+
{
25+
printf("Target process \"%s\" not found. Exiting.\n", targetEXE);
26+
return -1;
27+
}
28+
printf("Target process \"%s\" found with PID %lu\n", targetEXE, processId);
29+
30+
// Get Hwnd of the target process
31+
HWND targetHwnd = GetTargetWindowHandleByPID(processId);
32+
if (!targetHwnd)
33+
{
34+
printf("Failed to get target window handle\n");
35+
return -1;
36+
}
37+
38+
// Draw the image on the target window
39+
DrawImageOnWindow(targetHwnd, bmp_path);
40+
41+
// Display MessageBoxA in the target process
42+
MessageBoxA(targetHwnd, "JUST Monika", "JUST Monika", MB_OK | MB_ICONWARNING);
43+
}
44+
45+
}

0 commit comments

Comments
 (0)