Skip to content

Commit 0192f31

Browse files
committed
Begin normalizing PE templates
1 parent df86d1b commit 0192f31

File tree

8 files changed

+22
-380
lines changed

8 files changed

+22
-380
lines changed

data/templates/src/pe/dll_mixed_mode/build.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
if "%~1"=="" GOTO NO_ARGUMENTS
44
echo Compiling for: %1
55
call "%VCINSTALLDIR%Auxiliary\Build\vcvarsall.bat" %1
6+
:: mscoree.lib requires .NET SDK to be installed, add it as a Visual Studio component
67
cl /CLR /LD /GS- /I ..\dll /DBUILDMODE=2 template.cpp /Fe:template_%1_windows_mixed_mode.dll /link mscoree.lib kernel32.lib /entry:DllMain /subsystem:WINDOWS
78
cl /CLR /LD /GS- /I ..\dll /DBUILDMODE=2 /DSCSIZE=262144 template.cpp /Fe:template_%1_windows_mixed_mode.256kib.dll /link mscoree.lib kernel32.lib /entry:DllMain /subsystem:WINDOWS
89
exit /B
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@echo off
2+
3+
if "%~1"=="" GOTO NO_ARGUMENTS
4+
echo Compiling for: %1
5+
call "%VCINSTALLDIR%Auxiliary\Build\vcvarsall.bat" %1
6+
cl /GS- template.c /Fe:template_%1_windows.exe /link kernel32.lib /entry:main /subsystem:WINDOWS /NODEFAULTLIB
7+
cl /GS- /DSCSIZE=262144 template.c /Fe:template_%1_windows.256kib.exe /link kernel32.lib /entry:main /subsystem:WINDOWS /NODEFAULTLIB
8+
exit /B
9+
10+
:NO_ARGUMENTS
11+
%COMSPEC% /c "%0" x86
12+
%COMSPEC% /c "%0" x64
13+
del *.obj *.res
14+
move *.exe ..\..\..

data/templates/src/pe/exe/template.c

100755100644
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#include <stdio.h>
1+
#include <windows.h>
22

33
#define SCSIZE 4096
4-
char payload[SCSIZE] = "PAYLOAD:";
4+
char bPayload[SCSIZE] = "PAYLOAD:";
55

6-
char comment[512] = "";
7-
8-
int main(int argc, char **argv) {
9-
(*(void (*)()) payload)();
10-
return(0);
6+
void main() {
7+
DWORD dwOldProtect;
8+
VirtualProtect(bPayload, SCSIZE, PAGE_EXECUTE_READWRITE, &dwOldProtect);
9+
(*(void (*)()) bPayload)();
10+
return;
1111
}

data/templates/src/pe/exe/template.s

Lines changed: 0 additions & 341 deletions
This file was deleted.

0 commit comments

Comments
 (0)