about summary refs log tree commit diff stats
path: root/WitnessRandomizer
diff options
context:
space:
mode:
Diffstat (limited to 'WitnessRandomizer')
-rw-r--r--WitnessRandomizer/Memory.cppbin0 -> 4288 bytes
-rw-r--r--WitnessRandomizer/Memory.h39
-rw-r--r--WitnessRandomizer/WitnessRandomizer.cppbin0 -> 2468 bytes
-rw-r--r--WitnessRandomizer/WitnessRandomizer.vcxproj170
-rw-r--r--WitnessRandomizer/WitnessRandomizer.vcxproj.filters36
-rw-r--r--WitnessRandomizer/pch.cppbin0 -> 430 bytes
-rw-r--r--WitnessRandomizer/pch.hbin0 -> 1262 bytes
7 files changed, 245 insertions, 0 deletions
diff --git a/WitnessRandomizer/Memory.cpp b/WitnessRandomizer/Memory.cpp new file mode 100644 index 0000000..b15685b --- /dev/null +++ b/WitnessRandomizer/Memory.cpp
Binary files differ
diff --git a/WitnessRandomizer/Memory.h b/WitnessRandomizer/Memory.h new file mode 100644 index 0000000..2453cf0 --- /dev/null +++ b/WitnessRandomizer/Memory.h
@@ -0,0 +1,39 @@
1#pragma once
2#include <vector>
3#include <map>
4#include <windows.h>
5
6// https://github.com/erayarslan/WriteProcessMemory-Example
7// http://stackoverflow.com/q/32798185
8// http://stackoverflow.com/q/36018838
9// http://stackoverflow.com/q/1387064
10class Memory
11{
12public:
13 Memory(const std::string& processName);
14 ~Memory();
15
16 template<class T>
17 std::vector<T> ReadData(const std::vector<int>& offsets, int numItems) {
18 std::vector<T> data;
19 data.resize(numItems);
20 if (!ReadProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * numItems, NULL)) {
21 ThrowError();
22 }
23 return data;
24 }
25
26 template <class T>
27 void WriteData(const std::vector<int>& offsets, const std::vector<T>& data) {
28 if (!WriteProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * data.size(), NULL)) {
29 ThrowError();
30 }
31 }
32
33private:
34 void ThrowError();
35
36 uintptr_t ComputeOffset(std::vector<int> offsets);
37 uintptr_t _baseAddress;
38 HANDLE _handle;
39}; \ No newline at end of file
diff --git a/WitnessRandomizer/WitnessRandomizer.cpp b/WitnessRandomizer/WitnessRandomizer.cpp new file mode 100644 index 0000000..6d00a26 --- /dev/null +++ b/WitnessRandomizer/WitnessRandomizer.cpp
Binary files differ
diff --git a/WitnessRandomizer/WitnessRandomizer.vcxproj b/WitnessRandomizer/WitnessRandomizer.vcxproj new file mode 100644 index 0000000..efcd38c --- /dev/null +++ b/WitnessRandomizer/WitnessRandomizer.vcxproj
@@ -0,0 +1,170 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup Label="ProjectConfigurations">
4 <ProjectConfiguration Include="Debug|Win32">
5 <Configuration>Debug</Configuration>
6 <Platform>Win32</Platform>
7 </ProjectConfiguration>
8 <ProjectConfiguration Include="Release|Win32">
9 <Configuration>Release</Configuration>
10 <Platform>Win32</Platform>
11 </ProjectConfiguration>
12 <ProjectConfiguration Include="Debug|x64">
13 <Configuration>Debug</Configuration>
14 <Platform>x64</Platform>
15 </ProjectConfiguration>
16 <ProjectConfiguration Include="Release|x64">
17 <Configuration>Release</Configuration>
18 <Platform>x64</Platform>
19 </ProjectConfiguration>
20 </ItemGroup>
21 <PropertyGroup Label="Globals">
22 <VCProjectVersion>15.0</VCProjectVersion>
23 <ProjectGuid>{1563D1E2-0A18-4AFC-8D6F-9F8D9A433F31}</ProjectGuid>
24 <Keyword>Win32Proj</Keyword>
25 <RootNamespace>WitnessRandomizer</RootNamespace>
26 <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
27 </PropertyGroup>
28 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30 <ConfigurationType>Application</ConfigurationType>
31 <UseDebugLibraries>true</UseDebugLibraries>
32 <PlatformToolset>v141</PlatformToolset>
33 <CharacterSet>Unicode</CharacterSet>
34 </PropertyGroup>
35 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36 <ConfigurationType>Application</ConfigurationType>
37 <UseDebugLibraries>false</UseDebugLibraries>
38 <PlatformToolset>v141</PlatformToolset>
39 <WholeProgramOptimization>true</WholeProgramOptimization>
40 <CharacterSet>Unicode</CharacterSet>
41 </PropertyGroup>
42 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43 <ConfigurationType>Application</ConfigurationType>
44 <UseDebugLibraries>true</UseDebugLibraries>
45 <PlatformToolset>v141</PlatformToolset>
46 <CharacterSet>Unicode</CharacterSet>
47 </PropertyGroup>
48 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49 <ConfigurationType>Application</ConfigurationType>
50 <UseDebugLibraries>false</UseDebugLibraries>
51 <PlatformToolset>v141</PlatformToolset>
52 <WholeProgramOptimization>true</WholeProgramOptimization>
53 <CharacterSet>Unicode</CharacterSet>
54 </PropertyGroup>
55 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56 <ImportGroup Label="ExtensionSettings">
57 </ImportGroup>
58 <ImportGroup Label="Shared">
59 </ImportGroup>
60 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62 </ImportGroup>
63 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65 </ImportGroup>
66 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68 </ImportGroup>
69 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71 </ImportGroup>
72 <PropertyGroup Label="UserMacros" />
73 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74 <LinkIncremental>true</LinkIncremental>
75 </PropertyGroup>
76 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
77 <LinkIncremental>true</LinkIncremental>
78 </PropertyGroup>
79 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
80 <LinkIncremental>false</LinkIncremental>
81 </PropertyGroup>
82 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
83 <LinkIncremental>false</LinkIncremental>
84 </PropertyGroup>
85 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86 <ClCompile>
87 <PrecompiledHeader>Use</PrecompiledHeader>
88 <WarningLevel>Level3</WarningLevel>
89 <Optimization>Disabled</Optimization>
90 <SDLCheck>true</SDLCheck>
91 <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92 <ConformanceMode>true</ConformanceMode>
93 <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
94 </ClCompile>
95 <Link>
96 <SubSystem>Console</SubSystem>
97 <GenerateDebugInformation>true</GenerateDebugInformation>
98 </Link>
99 </ItemDefinitionGroup>
100 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
101 <ClCompile>
102 <PrecompiledHeader>Use</PrecompiledHeader>
103 <WarningLevel>Level3</WarningLevel>
104 <Optimization>Disabled</Optimization>
105 <SDLCheck>true</SDLCheck>
106 <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107 <ConformanceMode>true</ConformanceMode>
108 <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
109 </ClCompile>
110 <Link>
111 <SubSystem>Console</SubSystem>
112 <GenerateDebugInformation>true</GenerateDebugInformation>
113 </Link>
114 </ItemDefinitionGroup>
115 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
116 <ClCompile>
117 <PrecompiledHeader>Use</PrecompiledHeader>
118 <WarningLevel>Level3</WarningLevel>
119 <Optimization>MaxSpeed</Optimization>
120 <FunctionLevelLinking>true</FunctionLevelLinking>
121 <IntrinsicFunctions>true</IntrinsicFunctions>
122 <SDLCheck>true</SDLCheck>
123 <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
124 <ConformanceMode>true</ConformanceMode>
125 <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
126 </ClCompile>
127 <Link>
128 <SubSystem>Console</SubSystem>
129 <EnableCOMDATFolding>true</EnableCOMDATFolding>
130 <OptimizeReferences>true</OptimizeReferences>
131 <GenerateDebugInformation>true</GenerateDebugInformation>
132 </Link>
133 </ItemDefinitionGroup>
134 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
135 <ClCompile>
136 <PrecompiledHeader>Use</PrecompiledHeader>
137 <WarningLevel>Level3</WarningLevel>
138 <Optimization>MaxSpeed</Optimization>
139 <FunctionLevelLinking>true</FunctionLevelLinking>
140 <IntrinsicFunctions>true</IntrinsicFunctions>
141 <SDLCheck>true</SDLCheck>
142 <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
143 <ConformanceMode>true</ConformanceMode>
144 <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
145 </ClCompile>
146 <Link>
147 <SubSystem>Console</SubSystem>
148 <EnableCOMDATFolding>true</EnableCOMDATFolding>
149 <OptimizeReferences>true</OptimizeReferences>
150 <GenerateDebugInformation>true</GenerateDebugInformation>
151 </Link>
152 </ItemDefinitionGroup>
153 <ItemGroup>
154 <ClInclude Include="Memory.h" />
155 <ClInclude Include="pch.h" />
156 </ItemGroup>
157 <ItemGroup>
158 <ClCompile Include="Memory.cpp" />
159 <ClCompile Include="pch.cpp">
160 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
161 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
162 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
163 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
164 </ClCompile>
165 <ClCompile Include="WitnessRandomizer.cpp" />
166 </ItemGroup>
167 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
168 <ImportGroup Label="ExtensionTargets">
169 </ImportGroup>
170</Project> \ No newline at end of file
diff --git a/WitnessRandomizer/WitnessRandomizer.vcxproj.filters b/WitnessRandomizer/WitnessRandomizer.vcxproj.filters new file mode 100644 index 0000000..dc08442 --- /dev/null +++ b/WitnessRandomizer/WitnessRandomizer.vcxproj.filters
@@ -0,0 +1,36 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup>
4 <Filter Include="Source Files">
5 <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 </Filter>
8 <Filter Include="Header Files">
9 <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
11 </Filter>
12 <Filter Include="Resource Files">
13 <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15 </Filter>
16 </ItemGroup>
17 <ItemGroup>
18 <ClInclude Include="pch.h">
19 <Filter>Header Files</Filter>
20 </ClInclude>
21 <ClInclude Include="Memory.h">
22 <Filter>Header Files</Filter>
23 </ClInclude>
24 </ItemGroup>
25 <ItemGroup>
26 <ClCompile Include="pch.cpp">
27 <Filter>Source Files</Filter>
28 </ClCompile>
29 <ClCompile Include="WitnessRandomizer.cpp">
30 <Filter>Source Files</Filter>
31 </ClCompile>
32 <ClCompile Include="Memory.cpp">
33 <Filter>Source Files</Filter>
34 </ClCompile>
35 </ItemGroup>
36</Project> \ No newline at end of file
diff --git a/WitnessRandomizer/pch.cpp b/WitnessRandomizer/pch.cpp new file mode 100644 index 0000000..a38f8a3 --- /dev/null +++ b/WitnessRandomizer/pch.cpp
Binary files differ
diff --git a/WitnessRandomizer/pch.h b/WitnessRandomizer/pch.h new file mode 100644 index 0000000..d87432d --- /dev/null +++ b/WitnessRandomizer/pch.h
Binary files differ