1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-12-21 05:35:54 +01:00

Clean and working builds with CMake

This commit is contained in:
OJ 2020-04-23 13:29:20 +10:00
parent 0e9a231e8a
commit 3dbff1e401
No known key found for this signature in database
GPG Key ID: D5DC61FB93260597
33 changed files with 173 additions and 89 deletions

View File

@ -8,6 +8,7 @@
#include "elevator.h"
#include "namedpipeservice.h"
#include "tokendup.h"
#include "common.h"
// define this as we are going to be injected via LoadRemoteLibraryR
#define REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR

View File

@ -6,31 +6,4 @@
#include <stdio.h>
#include <stdlib.h>
//#define DEBUGTRACE
#ifdef DEBUGTRACE
#define dprintf(...) real_dprintf(__VA_ARGS__)
#else
#define dprintf(...) do{}while(0);
#endif
static _inline void real_dprintf(char *format, ...) {
va_list args;
char buffer[1024];
va_start(args,format);
vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer)-3, format,args);
strcat_s(buffer, sizeof(buffer), "\r\n");
OutputDebugString(buffer);
va_end(args);
}
// Simple macro to close a handle and set the handle to NULL.
#define CLOSE_HANDLE( h ) if( h ) { CloseHandle( h ); h = NULL; }
#define BREAK_ON_ERROR( str ) { dwResult = GetLastError(); dprintf( "%s. error=%d", str, dwResult ); break; }
#define BREAK_WITH_ERROR( str, err ) { dwResult = err; dprintf( "%s. error=%d", str, dwResult ); break; }
typedef BOOL (WINAPI * CHECKTOKENMEMBERSHIP)( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember );
typedef HANDLE (WINAPI * OPENTHREAD)( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId );
#endif

View File

@ -1,5 +1,6 @@
#include "elevator.h"
#include "namedpipeservice.h"
#include "common.h"
LPSTR lpServiceName = NULL;
SERVICE_STATUS_HANDLE hStatus = NULL;

View File

@ -1,5 +1,10 @@
#include "elevator.h"
#include "tokendup.h"
#include "common.h"
typedef BOOL (WINAPI * CHECKTOKENMEMBERSHIP)( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember );
typedef HANDLE (WINAPI * OPENTHREAD)( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId );
/*
* Elevate the given thread with our current token if we are running under the required user.

View File

@ -693,7 +693,7 @@ element_deepcopy(ElementObject* self, PyObject* args)
}
/* add object to memo dictionary (so deepcopy won't visit it again) */
id = PyInt_FromLong((Py_uintptr_t) self);
id = PyInt_FromLong((long)(Py_uintptr_t) self);
if (!id)
goto error;
@ -1273,7 +1273,7 @@ element_setitem(PyObject* self_, Py_ssize_t index, PyObject* item)
self->extra->children[index] = item;
} else {
self->extra->length--;
for (i = index; i < self->extra->length; i++)
for (i = (int)(INT_PTR)index; i < self->extra->length; i++)
self->extra->children[i] = self->extra->children[i+1];
}
@ -1406,7 +1406,7 @@ element_ass_subscr(PyObject* self_, PyObject* item, PyObject* value)
/* Resize before creating the recycle bin, to prevent refleaks. */
if (newlen > slicelen) {
if (element_resize(self, newlen - slicelen) < 0) {
if (element_resize(self, (int)(INT_PTR)(newlen - slicelen)) < 0) {
if (seq) {
Py_DECREF(seq);
}
@ -1448,7 +1448,7 @@ element_ass_subscr(PyObject* self_, PyObject* item, PyObject* value)
self->extra->children[cur] = element;
}
self->extra->length += newlen - slicelen;
self->extra->length += (int)(INT_PTR)(newlen - slicelen);
if (seq) {
Py_DECREF(seq);

View File

@ -132,7 +132,7 @@ int ReadOK(bmp_source_ptr sinfo, char* buffer,int len)
*/
int read_byte (bmp_source_ptr sinfo)
{
return (int)sinfo->pub.input_buf + sinfo->pub.read_offset++;
return (int)(INT_PTR)sinfo->pub.input_buf + sinfo->pub.read_offset++;
}
/*

View File

@ -1,4 +1,4 @@
#include "../../common/common.h"
#include "common.h"
#include <stdint.h>

View File

@ -1,4 +1,3 @@
#define DEBUGTRACE 1
extern "C" {
/*!
* @file WINPMEM.cpp

View File

@ -325,8 +325,6 @@ DWORD server_setup(MetsrvConfig* config)
{
do
{
dprintf("[SERVER] module loaded at 0x%08X", hAppInstance);
// Open a THREAD item for the servers main thread, we use this to manage migration later.
serverThread = thread_open();

View File

@ -1,5 +1,6 @@
#include "screenshot.h"
#include "bmp2jpeg.h"
#include "common.h"
/*
* Please Note: bmp2jpeg.c and bmp2jpeg.h have been coppied over from screen.c
@ -743,6 +744,8 @@ int bmp2jpeg(HBITMAP hBmp, HDC hDC, int quality, BYTE ** buf_jpeg, DWORD * buf_j
else if (cClrBits <= 24)
cClrBits = 24;
else cClrBits = 32;
dprintf("[SCREENSHOT bmptojpeg] Debug 1");
// Allocate memory for the BITMAPINFO structure. (This structure
// contains a BITMAPINFOHEADER structure and an array of RGBQUAD
@ -797,6 +800,7 @@ int bmp2jpeg(HBITMAP hBmp, HDC hDC, int quality, BYTE ** buf_jpeg, DWORD * buf_j
return 0;
}
dprintf("[SCREENSHOT bmptojpeg] Debug 2");
hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
// Compute the size of the entire file.
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) +
@ -833,6 +837,7 @@ int bmp2jpeg(HBITMAP hBmp, HDC hDC, int quality, BYTE ** buf_jpeg, DWORD * buf_j
* We need to provide some value for jpeg_set_defaults() to work.
*/
dprintf("[SCREENSHOT bmptojpeg] Debug 3");
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
cinfo.in_color_space = JCS_RGB; /* arbitrary guess */
@ -845,6 +850,7 @@ int bmp2jpeg(HBITMAP hBmp, HDC hDC, int quality, BYTE ** buf_jpeg, DWORD * buf_j
/* Read the input file header to obtain file size & colorspace. */
start_input_bmp(&cinfo, src_mgr);
dprintf("[SCREENSHOT bmptojpeg] Debug 4");
jpeg_default_colorspace(&cinfo);
@ -852,14 +858,18 @@ int bmp2jpeg(HBITMAP hBmp, HDC hDC, int quality, BYTE ** buf_jpeg, DWORD * buf_j
/* Go GRAYSCALE */
//jpeg_set_colorspace(&cinfo, JCS_GRAYSCALE);
/* Quality */
dprintf("[SCREENSHOT bmptojpeg] Debug 4A");
jpeg_set_quality(&cinfo, quality, FALSE);
// Write the compressed JPEG to memory: bug_jpeg
dprintf("[SCREENSHOT bmptojpeg] Debug 4B");
jpeg_mem_dest(&cinfo, buf_jpeg, buf_jpeg_size);
/* Start compressor */
dprintf("[SCREENSHOT bmptojpeg] Debug 4C");
jpeg_start_compress(&cinfo, TRUE);
dprintf("[SCREENSHOT bmptojpeg] Debug 5");
/* Process data */
while (cinfo.next_scanline < cinfo.image_height) {
num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
@ -867,9 +877,13 @@ int bmp2jpeg(HBITMAP hBmp, HDC hDC, int quality, BYTE ** buf_jpeg, DWORD * buf_j
}
/* Finish compression and release memory */
dprintf("[SCREENSHOT bmptojpeg] Debug 6");
(*src_mgr->finish_input) (&cinfo, src_mgr);
dprintf("[SCREENSHOT bmptojpeg] Debug 7");
jpeg_finish_compress(&cinfo);
dprintf("[SCREENSHOT bmptojpeg] Debug 8");
jpeg_destroy_compress(&cinfo);
dprintf("[SCREENSHOT bmptojpeg] Debug 9");
// Free memory.
GlobalFree((HGLOBAL)lpBits);

View File

@ -1,5 +1,6 @@
#include "screenshot.h"
#include "bmp2jpeg.h"
#include "common.h"
// define this as we are going to be injected via RDI
#define REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
@ -82,12 +83,17 @@ DWORD screenshot(int quality, DWORD dwPipeName)
do
{
dprintf("[SCREENSHOT] Debug 1");
_snprintf_s(cNamedPipe, sizeof(cNamedPipe), MAX_PATH, "\\\\.\\pipe\\%08X", dwPipeName);
dprintf("[SCREENSHOT] Debug 2");
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx(&os))
{
BREAK_ON_ERROR("[SCREENSHOT] screenshot: GetVersionEx failed")
}
dprintf("[SCREENSHOT] Debug 3");
// On NT we cant use SM_CXVIRTUALSCREEN/SM_CYVIRTUALSCREEN.
if (os.dwMajorVersion <= 4)
@ -96,50 +102,65 @@ DWORD screenshot(int quality, DWORD dwPipeName)
ymetric = SM_CYSCREEN;
}
dprintf("[SCREENSHOT] Debug 4");
// open the WinSta0 as some services are attached to a different window station.
hWindowStation = OpenWindowStationA("WinSta0", FALSE, WINSTA_ALL_ACCESS);
dprintf("[SCREENSHOT] Debug 5");
if (!hWindowStation)
{
if (RevertToSelf())
{
dprintf("[SCREENSHOT] Debug 6");
hWindowStation = OpenWindowStationA("WinSta0", FALSE, WINSTA_ALL_ACCESS);
}
}
// if we cant open the defaut input station we wont be able to take a screenshot
if (!hWindowStation)
{
BREAK_WITH_ERROR("[SCREENSHOT] screenshot: Couldnt get the WinSta0 Window Station", ERROR_INVALID_HANDLE);
}
// get the current process's window station so we can restore it later on.
hOrigWindowStation = GetProcessWindowStation();
dprintf("[SCREENSHOT] Debug 7");
// set the host process's window station to this sessions default input station we opened
if (!SetProcessWindowStation(hWindowStation))
BREAK_ON_ERROR("[SCREENSHOT] screenshot: SetProcessWindowStation failed");
// grab a handle to the default input desktop (e.g. Default or WinLogon)
dprintf("[SCREENSHOT] Debug 8");
hInputDesktop = OpenInputDesktop(0, FALSE, MAXIMUM_ALLOWED);
if (!hInputDesktop)
BREAK_ON_ERROR("[SCREENSHOT] screenshot: OpenInputDesktop failed");
// get the threads current desktop so we can restore it later on
dprintf("[SCREENSHOT] Debug 9");
hOrigDesktop = GetThreadDesktop(GetCurrentThreadId());
// set this threads desktop to that of this sessions default input desktop on WinSta0
dprintf("[SCREENSHOT] Debug 10");
SetThreadDesktop(hInputDesktop);
// and now we can grab a handle to this input desktop
dprintf("[SCREENSHOT] Debug 11");
hDesktopWnd = GetDesktopWindow();
// and get a DC from it so we can read its pixels!
dprintf("[SCREENSHOT] Debug 12");
hdc = GetDC(hDesktopWnd);
if (!hdc)
BREAK_ON_ERROR("[SCREENSHOT] screenshot. GetDC failed");
// back up this DC with a memory DC
dprintf("[SCREENSHOT] Debug 13");
hmemdc = CreateCompatibleDC(hdc);
if (!hmemdc)
BREAK_ON_ERROR("[SCREENSHOT] screenshot. CreateCompatibleDC failed");
// calculate the width and height
dprintf("[SCREENSHOT] Debug 14");
sx = GetSystemMetrics(xmetric);
sy = GetSystemMetrics(ymetric);
@ -147,17 +168,20 @@ DWORD screenshot(int quality, DWORD dwPipeName)
// prevent breaking functionality on <= NT 4.0
if (os.dwMajorVersion >= 4)
{
dprintf("[SCREENSHOT] Debug 14");
sxpos = GetSystemMetrics(SM_XVIRTUALSCREEN);
sypos = GetSystemMetrics(SM_YVIRTUALSCREEN);
}
// and create a bitmap
dprintf("[SCREENSHOT] Debug 15");
hbmp = CreateCompatibleBitmap(hdc, sx, sy);
if (!hbmp)
BREAK_ON_ERROR("[SCREENSHOT] screenshot. CreateCompatibleBitmap failed");
// this bitmap is backed by the memory DC
dprintf("[SCREENSHOT] Debug 16");
if (!SelectObject(hmemdc, hbmp))
BREAK_ON_ERROR("[SCREENSHOT] screenshot. SelectObject failed");
@ -165,9 +189,11 @@ DWORD screenshot(int quality, DWORD dwPipeName)
// screenshot all available monitors by default
HMODULE user32 = NULL;
dprintf("[SCREENSHOT] Debug 17");
if ((user32 = LoadLibraryA("user32")))
{
dprintf("[SCREENSHOT] Debug 18");
FARPROC SPDA = GetProcAddress(user32, "SetProcessDPIAware");
if (SPDA)
{
@ -175,13 +201,16 @@ DWORD screenshot(int quality, DWORD dwPipeName)
}
FreeLibrary(user32);
}
dprintf("[SCREENSHOT] Debug 19");
if (!StretchBlt(hmemdc, 0, 0, sx, sy, hdc, sxpos, sypos, GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN), SRCCOPY))
BREAK_ON_ERROR("[SCREENSHOT] screenshot. StretchBlt failed");
// finally convert the BMP we just made into a JPEG...
dprintf("[SCREENSHOT] Debug 20");
if (bmp2jpeg(hbmp, hmemdc, quality, &pJpegBuffer, &dwJpegSize) != 1)
BREAK_WITH_ERROR("[SCREENSHOT] screenshot. bmp2jpeg failed", ERROR_INVALID_HANDLE);
dprintf("[SCREENSHOT] Debug 21");
// we have succeded
dwResult = ERROR_SUCCESS;

View File

@ -6,31 +6,4 @@
#include <stdio.h>
#include <stdlib.h>
//#define DEBUGTRACE
#ifdef DEBUGTRACE
#define dprintf(...) real_dprintf(__VA_ARGS__)
#else
#define dprintf(...) do{}while(0);
#endif
static _inline void real_dprintf(char *format, ...) {
va_list args;
char buffer[1024];
va_start(args,format);
vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer)-3, format,args);
strcat_s(buffer, sizeof(buffer), "\r\n");
OutputDebugStringA(buffer);
va_end(args);
}
// Simple macro to close a handle and set the handle to NULL.
#define CLOSE_HANDLE( h ) if( h ) { CloseHandle( h ); h = NULL; }
#define BREAK_ON_ERROR( str ) { dwResult = GetLastError(); dprintf( "%s. error=%d", str, dwResult ); break; }
#define BREAK_WITH_ERROR( str, err ) { dwResult = err; dprintf( "%s. error=%d", str, dwResult ); break; }
typedef BOOL (WINAPI * CHECKTOKENMEMBERSHIP)( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember );
typedef HANDLE (WINAPI * OPENTHREAD)( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId );
#endif

View File

@ -5,6 +5,8 @@ set(PROJECT_NAME meterpreter)
cmake_policy(SET CMP0091 NEW)
project(${PROJECT_NAME} C CXX)
option(DBGTRACE "Enable debug tracing" OFF)
option(DBGTRACE_VERBOSE "Enable verbose debug tracing" OFF)
option(BUILD_SNIFFER "Build the sniffer extension (requires PSSDK)" OFF)
option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" ON)
if( USE_STATIC_MSVC_RUNTIMES )
@ -29,12 +31,20 @@ endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build Type not speicified, defaulting to 'Release'.")
message(STATUS "Build Type not specified, defaulting to 'Release'.")
endif()
set(IS_RELEASE true)
set(IS_DEBUG false)
if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
if(CMAKE_BUILD_TYPE MATCHES "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX /EHsc")
string(REPLACE "O2" "O1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "Ob2" "Ob1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "O2" "O1" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "Ob2" "Ob1" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
else()
# We only support "Release" or "Debug"
set(CMAKE_BUILD_TYPE "Debug")
set(IS_RELEASE false)
@ -48,6 +58,12 @@ add_definitions(
-DWINVER=0x0501
)
if(DBGTRACE_VERBOSE)
add_definitions(-DDEBUGTRACE=1)
elseif(DBGTRACE)
add_definitions(-DDEBUGTRACE=0)
endif()
if(IS_X64)
add_definitions(
-DWIN64

View File

@ -6,8 +6,11 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
add_definitions(
-D_USRDLL
-D_CRT_SECURE_NO_WARNINGS
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -98,7 +98,7 @@
<CompileAs>CompileAsC</CompileAs>
<ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
@ -135,7 +135,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<CompileAs>CompileAsC</CompileAs>
<ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
@ -174,7 +174,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<CallingConvention>StdCall</CallingConvention>
<CompileAs>CompileAsC</CompileAs>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
@ -210,7 +210,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<CallingConvention>StdCall</CallingConvention>
<CompileAs>CompileAsC</CompileAs>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>

View File

@ -6,10 +6,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
add_definitions(
-D_USRDLL
-DUNICODE
-D_UNICODE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /Gy- /Oy-")
include_directories(../../source/common)
include_directories(../../source/jpeg-8)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -8,6 +8,9 @@ add_definitions(
-D_USRDLL
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -10,6 +10,8 @@ add_definitions(
-D_UNICODE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -11,6 +11,8 @@ add_definitions(
-D_POWERKATZ
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)
include_directories(../../source/extensions/kiwi/mimikatz/inc)

View File

@ -10,6 +10,9 @@ add_definitions(
-D_UNICODE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -10,6 +10,8 @@ add_definitions(
-D_UNICODE
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -10,6 +10,8 @@ add_definitions(
-D_UNICODE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -8,6 +8,8 @@ add_definitions(
-D_USRDLL
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -12,8 +12,11 @@ add_definitions(
-D_USRDLL
-DPy_ENABLE_SHARED
-DPy_BUILD_CORE
-D_CRT_SECURE_NO_WARNINGS
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)
include_directories(../../source/extensions/python/include)

View File

@ -10,6 +10,8 @@ add_definitions(
-D_UNICODE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)
include_directories(${PSSDK_DIR}/_include)

View File

@ -8,8 +8,12 @@ add_definitions(
-D_USRDLL
-DCINTERFACE
-DCOBJMACROS
-D_CRT_SECURE_NO_WARNINGS
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/jpeg-8)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -8,6 +8,8 @@ add_definitions(
-D_USRDLL
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -10,6 +10,8 @@ add_definitions(
-D_UNICODE
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -4,10 +4,11 @@ project(${PROJECT_NAME} C)
add_definitions(
-D_LIB
-DUNICODE
-D_UNICODE
-D_CRT_SECURE_NO_WARNINGS
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /GF /Gy /TP /MP")
set(SRC_DIR ../../source/jpeg-8)
set(
SRC_FILES

View File

@ -7,16 +7,29 @@ SET PTS_VER=v141_xp
SET BUILD_64=Y
SET BUILD_86=Y
SET SNIFFER=OFF
SET DBGTRACE=OFF
SET DBGTRACE_VERBOSE=OFF
set DO_BUILD=Y
IF EXIST "..\..\..\..\pssdk\PSSDK_VC%PSSDK_VER%_LIB\_Libs\pssdk_vc%PSSDK_VER%_mt.lib" SET SNIFFER=ON
IF "%1" == "NOBUILD" SET DO_BUILD=N
IF "%2" == "NOBUILD" SET DO_BUILD=N
IF "%3" == "NOBUILD" SET DO_BUILD=N
IF "%4" == "NOBUILD" SET DO_BUILD=N
IF "%5" == "NOBUILD" SET DO_BUILD=N
IF "%1" == "v120_xp" SET PTS_VER=%1
IF "%2" == "v120_xp" SET PTS_VER=%2
IF "%3" == "v120_xp" SET PTS_VER=%3
IF "%4" == "v120_xp" SET PTS_VER=%4
IF "%5" == "v120_xp" SET PTS_VER=%5
IF "%1" == "VS2013" SET VS_VER=%1
IF "%2" == "VS2013" SET VS_VER=%2
IF "%3" == "VS2013" SET VS_VER=%3
IF "%4" == "VS2013" SET VS_VER=%4
IF "%5" == "VS2013" SET VS_VER=%5
REM If VS2013 is used, we have to stick to v121_xp
IF "%VS_VER%" == "VS2013" (
@ -27,23 +40,49 @@ IF "%VS_VER%" == "VS2013" (
IF "%1" == "x86" SET BUILD_64=N
IF "%2" == "x86" SET BUILD_64=N
IF "%3" == "x86" SET BUILD_64=N
IF "%4" == "x86" SET BUILD_64=N
IF "%5" == "x86" SET BUILD_64=N
IF "%1" == "x64" SET BUILD_86=N
IF "%2" == "x64" SET BUILD_86=N
IF "%3" == "x64" SET BUILD_86=N
IF "%4" == "x64" SET BUILD_86=N
IF "%5" == "x64" SET BUILD_86=N
IF "%1" == "DBGTRACE" SET DBGTRACE=ON
IF "%2" == "DBGTRACE" SET DBGTRACE=ON
IF "%3" == "DBGTRACE" SET DBGTRACE=ON
IF "%4" == "DBGTRACE" SET DBGTRACE=ON
IF "%5" == "DBGTRACE" SET DBGTRACE=ON
IF "%1" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON
IF "%2" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON
IF "%3" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON
IF "%4" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON
IF "%5" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON
IF "%BUILD_64%" == "Y" (
@ECHO ==========================================================================
@ECHO == Building for "%VS_TITLE%" with %PTS_VER% for arch x64
@ECHO ==========================================================================
cmake -G "%VS_TITLE%" -A x64 -T %PTS_VER% -S . -B build\%VS_VER%\x64 -Wno-dev -DBUILD_SNIFFER=%SNIFFER%
cmake --build build\%VS_VER%\x64 --config Release --clean-first -- /p:XPDeprecationWarning=false
@ECHO ====================================================================================
@ECHO == Generating "%VS_TITLE%" w/ %PTS_VER% on x64 - TRACE "%DBGTRACE%-%DBGTRACE_VERBOSE%"
@ECHO ====================================================================================
cmake -G "%VS_TITLE%" -A x64 -T %PTS_VER% -S . -B build\%VS_VER%\x64 -Wno-dev -DBUILD_SNIFFER=%SNIFFER% -DDBGTRACE=%DBGTRACE% -DDBGTRACE_VERBOSE=%DBGTRACE_VERBOSE%
if "%DO_BUILD%" == "Y" (
@ECHO ====================================================================================
@ECHO == Building "%VS_TITLE%" w/ %PTS_VER% on x64 - TRACE "%DBGTRACE%-%DBGTRACE_VERBOSE%"
@ECHO ====================================================================================
cmake --build build\%VS_VER%\x64 --config Release --clean-first -- /p:XPDeprecationWarning=false
)
)
IF "%BUILD_86%" == "Y" (
@ECHO ==========================================================================
@ECHO == Building for "%VS_TITLE%" with %PTS_VER% for arch x86
@ECHO ==========================================================================
cmake -G "%VS_TITLE%" -A Win32 -T %PTS_VER% -S . -B build\%VS_VER%\Win32 -Wno-dev -DBUILD_SNIFFER=%SNIFFER%
cmake --build build\%VS_VER%\Win32 --config Release --clean-first -- /p:XPDeprecationWarning=false
@ECHO ====================================================================================
@ECHO == Generating "%VS_TITLE%" w/ %PTS_VER% on x86 - TRACE "%DBGTRACE%-%DBGTRACE_VERBOSE%"
@ECHO ====================================================================================
cmake -G "%VS_TITLE%" -A Win32 -T %PTS_VER% -S . -B build\%VS_VER%\Win32 -Wno-dev -DBUILD_SNIFFER=%SNIFFER% -DDBGTRACE=%DBGTRACE% -DDBGTRACE_VERBOSE=%DBGTRACE_VERBOSE%
if "%DO_BUILD%" == "Y" (
@ECHO ====================================================================================
@ECHO == Building "%VS_TITLE%" w/ %PTS_VER% on x86 - TRACE "%DBGTRACE%-%DBGTRACE_VERBOSE%"
@ECHO ====================================================================================
cmake --build build\%VS_VER%\Win32 --config Release --clean-first -- /p:XPDeprecationWarning=false
)
)

View File

@ -8,8 +8,11 @@ add_definitions(
-D_USRDLL
-DUNICODE
-D_UNICODE
-D_CRT_SECURE_NO_WARNINGS
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -6,10 +6,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
add_definitions(
-D_USRDLL
-DUNICODE
-D_UNICODE
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
include_directories(../../source/common)
include_directories(../../source/jpeg-8)
include_directories(../../source/ReflectiveDllInjection/common)

View File

@ -87,7 +87,7 @@
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -130,7 +130,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -176,7 +176,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -221,7 +221,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\source\common;..\..\source\ReflectiveDLLInjection\common;..\..\source\jpeg-8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>