├── .gitattributes ├── Debug ├── WebCamCapture.dll ├── WebCamCapture.exp ├── WebCamCapture.ilk ├── WebCamCapture.lib └── WebCamCapture.pdb ├── Release ├── WebCamCapture.dll ├── WebCamCapture.exp ├── WebCamCapture.iobj ├── WebCamCapture.ipdb ├── WebCamCapture.lib └── WebCamCapture.pdb ├── WebCamCapture.VC.db ├── WebCamCapture.sln ├── WebCamCapture ├── Debug │ ├── ReflectiveLoader.obj │ ├── VideoCapture.obj │ ├── WebCamCapture.Build.CppClean.log │ ├── WebCamCapture.log │ ├── WebCamCapture.obj │ ├── WebCamCapture.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── WebCamCapture.lastbuildstate │ │ ├── WebCamCapture.write.1u.tlog │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ ├── dllmain.obj │ ├── stdafx.obj │ ├── vc140.idb │ └── vc140.pdb ├── PipeServer.h ├── ReadMe.txt ├── ReflectiveDLLInjection.h ├── ReflectiveLoader.c ├── ReflectiveLoader.h ├── Release │ ├── ReflectiveLoader.obj │ ├── VideoCapture.obj │ ├── WebCamCapture.Build.CppClean.log │ ├── WebCamCapture.log │ ├── WebCamCapture.obj │ ├── WebCamCapture.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── WebCamCapture.lastbuildstate │ │ ├── WebCamCapture.write.1u.tlog │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ ├── dllmain.obj │ ├── stdafx.obj │ └── vc140.pdb ├── WebCamCapture.cpp ├── WebCamCapture.h ├── WebCamCapture.vcxproj ├── WebCamCapture.vcxproj.filters ├── dllmain.cpp ├── stdafx.cpp ├── stdafx.h ├── targetver.h └── x64 │ └── Release │ ├── ReflectiveLoader.obj │ ├── VideoCapture.obj │ ├── WebCamCapture.log │ ├── WebCamCapture.obj │ ├── WebCamCapture.tlog │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── WebCamCapture.lastbuildstate │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ ├── link.write.1.tlog │ └── unsuccessfulbuild │ ├── dllmain.obj │ ├── stdafx.obj │ └── vc140.pdb └── x64 └── Release ├── WebCamCapture.exp └── WebCamCapture.lib /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /Debug/WebCamCapture.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Debug/WebCamCapture.dll -------------------------------------------------------------------------------- /Debug/WebCamCapture.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Debug/WebCamCapture.exp -------------------------------------------------------------------------------- /Debug/WebCamCapture.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Debug/WebCamCapture.ilk -------------------------------------------------------------------------------- /Debug/WebCamCapture.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Debug/WebCamCapture.lib -------------------------------------------------------------------------------- /Debug/WebCamCapture.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Debug/WebCamCapture.pdb -------------------------------------------------------------------------------- /Release/WebCamCapture.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Release/WebCamCapture.dll -------------------------------------------------------------------------------- /Release/WebCamCapture.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Release/WebCamCapture.exp -------------------------------------------------------------------------------- /Release/WebCamCapture.iobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Release/WebCamCapture.iobj -------------------------------------------------------------------------------- /Release/WebCamCapture.ipdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Release/WebCamCapture.ipdb -------------------------------------------------------------------------------- /Release/WebCamCapture.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Release/WebCamCapture.lib -------------------------------------------------------------------------------- /Release/WebCamCapture.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/Release/WebCamCapture.pdb -------------------------------------------------------------------------------- /WebCamCapture.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture.VC.db -------------------------------------------------------------------------------- /WebCamCapture.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebCamCapture", "WebCamCapture\WebCamCapture.vcxproj", "{67E3B2B4-348D-41DE-A482-EB4F8C56E785}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Debug|x64.ActiveCfg = Debug|x64 17 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Debug|x64.Build.0 = Debug|x64 18 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Debug|x86.ActiveCfg = Debug|Win32 19 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Debug|x86.Build.0 = Debug|Win32 20 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Release|x64.ActiveCfg = Release|x64 21 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Release|x64.Build.0 = Release|x64 22 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Release|x86.ActiveCfg = Release|Win32 23 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /WebCamCapture/Debug/ReflectiveLoader.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/ReflectiveLoader.obj -------------------------------------------------------------------------------- /WebCamCapture/Debug/VideoCapture.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/VideoCapture.obj -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.Build.CppClean.log: -------------------------------------------------------------------------------- 1 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\debug\vc140.pdb 2 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\debug\vc140.idb 3 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\debug\videocapture.obj 4 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\debug\stdafx.obj 5 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\debug\webcamcapture.tlog\cl.command.1.tlog 6 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\debug\webcamcapture.tlog\cl.read.1.tlog 7 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\debug\webcamcapture.tlog\cl.write.1.tlog 8 | -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.log: -------------------------------------------------------------------------------- 1 |  WebCamCapture.cpp 2 | stdafx.cpp 3 | VideoCapture.cpp 4 | To compile qedit.h you must install the DirectX 9 SDK, to obtain the dxtrans.h header. 5 | Generating Code... 6 | dllmain.cpp 7 | ReflectiveLoader.c 8 | Creating library c:\users\tester\documents\visual studio 2015\Projects\WebCamCapture\Debug\WebCamCapture.lib and object c:\users\tester\documents\visual studio 2015\Projects\WebCamCapture\Debug\WebCamCapture.exp 9 | WebCamCapture.vcxproj -> c:\users\tester\documents\visual studio 2015\Projects\WebCamCapture\Debug\WebCamCapture.dll 10 | -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.obj -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/WebCamCapture.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 2 | Debug|Win32|c:\users\tester\documents\visual studio 2015\Projects\WebCamCapture\| 3 | -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/WebCamCapture.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.tlog/WebCamCapture.write.1u.tlog -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Debug/WebCamCapture.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/WebCamCapture.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Debug/dllmain.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/dllmain.obj -------------------------------------------------------------------------------- /WebCamCapture/Debug/stdafx.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/stdafx.obj -------------------------------------------------------------------------------- /WebCamCapture/Debug/vc140.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/vc140.idb -------------------------------------------------------------------------------- /WebCamCapture/Debug/vc140.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Debug/vc140.pdb -------------------------------------------------------------------------------- /WebCamCapture/PipeServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | class PipeServer 6 | { 7 | public: 8 | PipeServer(LPCWSTR pipename); 9 | ~PipeServer(); 10 | 11 | LPWSTR command; 12 | LPWSTR data; 13 | void startServer(); 14 | void stopServer(); 15 | void receiveData(); 16 | void sendData(); 17 | private: 18 | HANDLE pipe; 19 | BOOL result; 20 | 21 | }; 22 | 23 | PipeServer::PipeServer(LPCWSTR pipename) 24 | { 25 | pipe = CreateNamedPipe(pipename, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE, 1, 0, 0, 0, NULL); 26 | if (pipe == NULL || pipe == INVALID_HANDLE_VALUE) 27 | { 28 | //do something 29 | } 30 | 31 | } 32 | 33 | PipeServer::~PipeServer() 34 | { 35 | } 36 | 37 | void PipeServer::startServer() 38 | { 39 | //Wait for connection 40 | result = ConnectNamedPipe(pipe, NULL); 41 | if (!result) 42 | { 43 | //close the pipe and exit 44 | std::cout << "Closing pipe\n"; 45 | CloseHandle(pipe); 46 | } 47 | else 48 | { 49 | std::cout << "Server Started\n"; 50 | } 51 | 52 | } 53 | 54 | void PipeServer::sendData() 55 | { 56 | DWORD numBytesWritten = 0; 57 | result = WriteFile(pipe, (LPCVOID **)data, wcslen(data) * sizeof(LPWSTR), &numBytesWritten, NULL); 58 | if (result) 59 | { 60 | std::cout << "Sent data\n"; 61 | std::cout << "Sent " << numBytesWritten << " bytes\n"; 62 | } 63 | else 64 | { 65 | std::cout << "Failed to send data\n"; 66 | } 67 | } 68 | 69 | void PipeServer::receiveData() 70 | { 71 | DWORD numBytesRead = 0; 72 | result = ReadFile(pipe, data, 127 * sizeof(LPWSTR), &numBytesRead, NULL); 73 | if (result) 74 | { 75 | std::cout << "Received command " << data << "\n" << "Read " << numBytesRead << " bytes\n"; 76 | } 77 | else 78 | { 79 | std::cout << "Unable to read from the pipe\n"; 80 | } 81 | } 82 | 83 | void PipeServer::stopServer() 84 | { 85 | CloseHandle(pipe); 86 | std::cout << "Pipe closed"; 87 | } -------------------------------------------------------------------------------- /WebCamCapture/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | DYNAMIC LINK LIBRARY : WebCamCapture Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this WebCamCapture DLL for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your WebCamCapture application. 9 | 10 | 11 | WebCamCapture.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | WebCamCapture.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | WebCamCapture.cpp 25 | This is the main DLL source file. 26 | 27 | When created, this DLL does not export any symbols. As a result, it 28 | will not produce a .lib file when it is built. If you wish this project 29 | to be a project dependency of some other project, you will either need to 30 | add code to export some symbols from the DLL so that an export library 31 | will be produced, or you can set the Ignore Input Library property to Yes 32 | on the General propert page of the Linker folder in the project's Property 33 | Pages dialog box. 34 | 35 | ///////////////////////////////////////////////////////////////////////////// 36 | Other standard files: 37 | 38 | StdAfx.h, StdAfx.cpp 39 | These files are used to build a precompiled header (PCH) file 40 | named WebCamCapture.pch and a precompiled types file named StdAfx.obj. 41 | 42 | ///////////////////////////////////////////////////////////////////////////// 43 | Other notes: 44 | 45 | AppWizard uses "TODO:" comments to indicate parts of the source code you 46 | should add to or customize. 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | -------------------------------------------------------------------------------- /WebCamCapture/ReflectiveDLLInjection.h: -------------------------------------------------------------------------------- 1 | //===============================================================================================// 2 | // Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com) 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are permitted 6 | // provided that the following conditions are met: 7 | // 8 | // * Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other materials provided 13 | // with the distribution. 14 | // 15 | // * Neither the name of Harmony Security nor the names of its contributors may be used to 16 | // endorse or promote products derived from this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 | // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | //===============================================================================================// 28 | #ifndef _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H 29 | #define _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H 30 | //===============================================================================================// 31 | #define WIN32_LEAN_AND_MEAN 32 | #include 33 | 34 | // we declare some common stuff in here... 35 | 36 | #define DLL_QUERY_HMODULE 6 37 | 38 | #define DEREF( name )*(UINT_PTR *)(name) 39 | #define DEREF_64( name )*(DWORD64 *)(name) 40 | #define DEREF_32( name )*(DWORD *)(name) 41 | #define DEREF_16( name )*(WORD *)(name) 42 | #define DEREF_8( name )*(BYTE *)(name) 43 | 44 | typedef ULONG_PTR (WINAPI * REFLECTIVELOADER)( VOID ); 45 | typedef BOOL (WINAPI * DLLMAIN)( HINSTANCE, DWORD, LPVOID ); 46 | 47 | #define DLLEXPORT __declspec( dllexport ) 48 | 49 | //===============================================================================================// 50 | #endif 51 | //===============================================================================================// 52 | -------------------------------------------------------------------------------- /WebCamCapture/ReflectiveLoader.c: -------------------------------------------------------------------------------- 1 | //===============================================================================================// 2 | // Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com) 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are permitted 6 | // provided that the following conditions are met: 7 | // 8 | // * Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other materials provided 13 | // with the distribution. 14 | // 15 | // * Neither the name of Harmony Security nor the names of its contributors may be used to 16 | // endorse or promote products derived from this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 | // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | //===============================================================================================// 28 | #include "ReflectiveLoader.h" 29 | //===============================================================================================// 30 | // Our loader will set this to a pseudo correct HINSTANCE/HMODULE value 31 | HINSTANCE hAppInstance = NULL; 32 | //===============================================================================================// 33 | #pragma intrinsic( _ReturnAddress ) 34 | // This function can not be inlined by the compiler or we will not get the address we expect. Ideally 35 | // this code will be compiled with the /O2 and /Ob1 switches. Bonus points if we could take advantage of 36 | // RIP relative addressing in this instance but I dont believe we can do so with the compiler intrinsics 37 | // available (and no inline asm available under x64). 38 | __declspec(noinline) ULONG_PTR caller( VOID ) { return (ULONG_PTR)_ReturnAddress(); } 39 | //===============================================================================================// 40 | 41 | // Note 1: If you want to have your own DllMain, define REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN, 42 | // otherwise the DllMain at the end of this file will be used. 43 | 44 | // Note 2: If you are injecting the DLL via LoadRemoteLibraryR, define REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR, 45 | // otherwise it is assumed you are calling the ReflectiveLoader via a stub. 46 | 47 | // This is our position independent reflective DLL loader/injector 48 | #ifdef REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR 49 | DLLEXPORT ULONG_PTR WINAPI ReflectiveLoader( LPVOID lpParameter ) 50 | #else 51 | DLLEXPORT ULONG_PTR WINAPI ReflectiveLoader( VOID ) 52 | #endif 53 | { 54 | // the functions we need 55 | LOADLIBRARYA pLoadLibraryA = NULL; 56 | GETPROCADDRESS pGetProcAddress = NULL; 57 | VIRTUALALLOC pVirtualAlloc = NULL; 58 | NTFLUSHINSTRUCTIONCACHE pNtFlushInstructionCache = NULL; 59 | 60 | USHORT usCounter; 61 | 62 | // the initial location of this image in memory 63 | ULONG_PTR uiLibraryAddress; 64 | // the kernels base address and later this images newly loaded base address 65 | ULONG_PTR uiBaseAddress; 66 | 67 | // variables for processing the kernels export table 68 | ULONG_PTR uiAddressArray; 69 | ULONG_PTR uiNameArray; 70 | ULONG_PTR uiExportDir; 71 | ULONG_PTR uiNameOrdinals; 72 | DWORD dwHashValue; 73 | 74 | // variables for loading this image 75 | ULONG_PTR uiHeaderValue; 76 | ULONG_PTR uiValueA; 77 | ULONG_PTR uiValueB; 78 | ULONG_PTR uiValueC; 79 | ULONG_PTR uiValueD; 80 | ULONG_PTR uiValueE; 81 | 82 | // STEP 0: calculate our images current base address 83 | 84 | // we will start searching backwards from our callers return address. 85 | uiLibraryAddress = caller(); 86 | 87 | // loop through memory backwards searching for our images base address 88 | // we dont need SEH style search as we shouldnt generate any access violations with this 89 | while( TRUE ) 90 | { 91 | if( ((PIMAGE_DOS_HEADER)uiLibraryAddress)->e_magic == IMAGE_DOS_SIGNATURE ) 92 | { 93 | uiHeaderValue = ((PIMAGE_DOS_HEADER)uiLibraryAddress)->e_lfanew; 94 | // some x64 dll's can trigger a bogus signature (IMAGE_DOS_SIGNATURE == 'POP r10'), 95 | // we sanity check the e_lfanew with an upper threshold value of 1024 to avoid problems. 96 | if( uiHeaderValue >= sizeof(IMAGE_DOS_HEADER) && uiHeaderValue < 1024 ) 97 | { 98 | uiHeaderValue += uiLibraryAddress; 99 | // break if we have found a valid MZ/PE header 100 | if( ((PIMAGE_NT_HEADERS)uiHeaderValue)->Signature == IMAGE_NT_SIGNATURE ) 101 | break; 102 | } 103 | } 104 | uiLibraryAddress--; 105 | } 106 | 107 | // STEP 1: process the kernels exports for the functions our loader needs... 108 | 109 | // get the Process Enviroment Block 110 | #ifdef WIN_X64 111 | uiBaseAddress = __readgsqword( 0x60 ); 112 | #else 113 | #ifdef WIN_X86 114 | uiBaseAddress = __readfsdword( 0x30 ); 115 | #else WIN_ARM 116 | uiBaseAddress = *(DWORD *)( (BYTE *)_MoveFromCoprocessor( 15, 0, 13, 0, 2 ) + 0x30 ); 117 | #endif 118 | #endif 119 | 120 | // get the processes loaded modules. ref: http://msdn.microsoft.com/en-us/library/aa813708(VS.85).aspx 121 | uiBaseAddress = (ULONG_PTR)((_PPEB)uiBaseAddress)->pLdr; 122 | 123 | // get the first entry of the InMemoryOrder module list 124 | uiValueA = (ULONG_PTR)((PPEB_LDR_DATA)uiBaseAddress)->InMemoryOrderModuleList.Flink; 125 | while( uiValueA ) 126 | { 127 | // get pointer to current modules name (unicode string) 128 | uiValueB = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.pBuffer; 129 | // set bCounter to the length for the loop 130 | usCounter = ((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.Length; 131 | // clear uiValueC which will store the hash of the module name 132 | uiValueC = 0; 133 | 134 | // compute the hash of the module name... 135 | do 136 | { 137 | uiValueC = ror( (DWORD)uiValueC ); 138 | // normalize to uppercase if the madule name is in lowercase 139 | if( *((BYTE *)uiValueB) >= 'a' ) 140 | uiValueC += *((BYTE *)uiValueB) - 0x20; 141 | else 142 | uiValueC += *((BYTE *)uiValueB); 143 | uiValueB++; 144 | } while( --usCounter ); 145 | 146 | // compare the hash with that of kernel32.dll 147 | if( (DWORD)uiValueC == KERNEL32DLL_HASH ) 148 | { 149 | // get this modules base address 150 | uiBaseAddress = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase; 151 | 152 | // get the VA of the modules NT Header 153 | uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew; 154 | 155 | // uiNameArray = the address of the modules export directory entry 156 | uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ]; 157 | 158 | // get the VA of the export directory 159 | uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress ); 160 | 161 | // get the VA for the array of name pointers 162 | uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames ); 163 | 164 | // get the VA for the array of name ordinals 165 | uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals ); 166 | 167 | usCounter = 3; 168 | 169 | // loop while we still have imports to find 170 | while( usCounter > 0 ) 171 | { 172 | // compute the hash values for this function name 173 | dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) ); 174 | 175 | // if we have found a function we want we get its virtual address 176 | if( dwHashValue == LOADLIBRARYA_HASH || dwHashValue == GETPROCADDRESS_HASH || dwHashValue == VIRTUALALLOC_HASH ) 177 | { 178 | // get the VA for the array of addresses 179 | uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions ); 180 | 181 | // use this functions name ordinal as an index into the array of name pointers 182 | uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) ); 183 | 184 | // store this functions VA 185 | if( dwHashValue == LOADLIBRARYA_HASH ) 186 | pLoadLibraryA = (LOADLIBRARYA)( uiBaseAddress + DEREF_32( uiAddressArray ) ); 187 | else if( dwHashValue == GETPROCADDRESS_HASH ) 188 | pGetProcAddress = (GETPROCADDRESS)( uiBaseAddress + DEREF_32( uiAddressArray ) ); 189 | else if( dwHashValue == VIRTUALALLOC_HASH ) 190 | pVirtualAlloc = (VIRTUALALLOC)( uiBaseAddress + DEREF_32( uiAddressArray ) ); 191 | 192 | // decrement our counter 193 | usCounter--; 194 | } 195 | 196 | // get the next exported function name 197 | uiNameArray += sizeof(DWORD); 198 | 199 | // get the next exported function name ordinal 200 | uiNameOrdinals += sizeof(WORD); 201 | } 202 | } 203 | else if( (DWORD)uiValueC == NTDLLDLL_HASH ) 204 | { 205 | // get this modules base address 206 | uiBaseAddress = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase; 207 | 208 | // get the VA of the modules NT Header 209 | uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew; 210 | 211 | // uiNameArray = the address of the modules export directory entry 212 | uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ]; 213 | 214 | // get the VA of the export directory 215 | uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress ); 216 | 217 | // get the VA for the array of name pointers 218 | uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames ); 219 | 220 | // get the VA for the array of name ordinals 221 | uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals ); 222 | 223 | usCounter = 1; 224 | 225 | // loop while we still have imports to find 226 | while( usCounter > 0 ) 227 | { 228 | // compute the hash values for this function name 229 | dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) ); 230 | 231 | // if we have found a function we want we get its virtual address 232 | if( dwHashValue == NTFLUSHINSTRUCTIONCACHE_HASH ) 233 | { 234 | // get the VA for the array of addresses 235 | uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions ); 236 | 237 | // use this functions name ordinal as an index into the array of name pointers 238 | uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) ); 239 | 240 | // store this functions VA 241 | if( dwHashValue == NTFLUSHINSTRUCTIONCACHE_HASH ) 242 | pNtFlushInstructionCache = (NTFLUSHINSTRUCTIONCACHE)( uiBaseAddress + DEREF_32( uiAddressArray ) ); 243 | 244 | // decrement our counter 245 | usCounter--; 246 | } 247 | 248 | // get the next exported function name 249 | uiNameArray += sizeof(DWORD); 250 | 251 | // get the next exported function name ordinal 252 | uiNameOrdinals += sizeof(WORD); 253 | } 254 | } 255 | 256 | // we stop searching when we have found everything we need. 257 | if( pLoadLibraryA && pGetProcAddress && pVirtualAlloc && pNtFlushInstructionCache ) 258 | break; 259 | 260 | // get the next entry 261 | uiValueA = DEREF( uiValueA ); 262 | } 263 | 264 | // STEP 2: load our image into a new permanent location in memory... 265 | 266 | // get the VA of the NT Header for the PE to be loaded 267 | uiHeaderValue = uiLibraryAddress + ((PIMAGE_DOS_HEADER)uiLibraryAddress)->e_lfanew; 268 | 269 | // allocate all the memory for the DLL to be loaded into. we can load at any address because we will 270 | // relocate the image. Also zeros all memory and marks it as READ, WRITE and EXECUTE to avoid any problems. 271 | uiBaseAddress = (ULONG_PTR)pVirtualAlloc( NULL, ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfImage, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE ); 272 | 273 | // we must now copy over the headers 274 | uiValueA = ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfHeaders; 275 | uiValueB = uiLibraryAddress; 276 | uiValueC = uiBaseAddress; 277 | 278 | while( uiValueA-- ) 279 | *(BYTE *)uiValueC++ = *(BYTE *)uiValueB++; 280 | 281 | // STEP 3: load in all of our sections... 282 | 283 | // uiValueA = the VA of the first section 284 | uiValueA = ( (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader + ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.SizeOfOptionalHeader ); 285 | 286 | // itterate through all sections, loading them into memory. 287 | uiValueE = ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.NumberOfSections; 288 | while( uiValueE-- ) 289 | { 290 | // uiValueB is the VA for this section 291 | uiValueB = ( uiBaseAddress + ((PIMAGE_SECTION_HEADER)uiValueA)->VirtualAddress ); 292 | 293 | // uiValueC if the VA for this sections data 294 | uiValueC = ( uiLibraryAddress + ((PIMAGE_SECTION_HEADER)uiValueA)->PointerToRawData ); 295 | 296 | // copy the section over 297 | uiValueD = ((PIMAGE_SECTION_HEADER)uiValueA)->SizeOfRawData; 298 | 299 | while( uiValueD-- ) 300 | *(BYTE *)uiValueB++ = *(BYTE *)uiValueC++; 301 | 302 | // get the VA of the next section 303 | uiValueA += sizeof( IMAGE_SECTION_HEADER ); 304 | } 305 | 306 | // STEP 4: process our images import table... 307 | 308 | // uiValueB = the address of the import directory 309 | uiValueB = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ]; 310 | 311 | // we assume their is an import table to process 312 | // uiValueC is the first entry in the import table 313 | uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress ); 314 | 315 | // itterate through all imports 316 | while( ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ) 317 | { 318 | // use LoadLibraryA to load the imported module into memory 319 | uiLibraryAddress = (ULONG_PTR)pLoadLibraryA( (LPCSTR)( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ) ); 320 | 321 | // uiValueD = VA of the OriginalFirstThunk 322 | uiValueD = ( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->OriginalFirstThunk ); 323 | 324 | // uiValueA = VA of the IAT (via first thunk not origionalfirstthunk) 325 | uiValueA = ( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->FirstThunk ); 326 | 327 | // itterate through all imported functions, importing by ordinal if no name present 328 | while( DEREF(uiValueA) ) 329 | { 330 | // sanity check uiValueD as some compilers only import by FirstThunk 331 | if( uiValueD && ((PIMAGE_THUNK_DATA)uiValueD)->u1.Ordinal & IMAGE_ORDINAL_FLAG ) 332 | { 333 | // get the VA of the modules NT Header 334 | uiExportDir = uiLibraryAddress + ((PIMAGE_DOS_HEADER)uiLibraryAddress)->e_lfanew; 335 | 336 | // uiNameArray = the address of the modules export directory entry 337 | uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ]; 338 | 339 | // get the VA of the export directory 340 | uiExportDir = ( uiLibraryAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress ); 341 | 342 | // get the VA for the array of addresses 343 | uiAddressArray = ( uiLibraryAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions ); 344 | 345 | // use the import ordinal (- export ordinal base) as an index into the array of addresses 346 | uiAddressArray += ( ( IMAGE_ORDINAL( ((PIMAGE_THUNK_DATA)uiValueD)->u1.Ordinal ) - ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->Base ) * sizeof(DWORD) ); 347 | 348 | // patch in the address for this imported function 349 | DEREF(uiValueA) = ( uiLibraryAddress + DEREF_32(uiAddressArray) ); 350 | } 351 | else 352 | { 353 | // get the VA of this functions import by name struct 354 | uiValueB = ( uiBaseAddress + DEREF(uiValueA) ); 355 | 356 | // use GetProcAddress and patch in the address for this imported function 357 | DEREF(uiValueA) = (ULONG_PTR)pGetProcAddress( (HMODULE)uiLibraryAddress, (LPCSTR)((PIMAGE_IMPORT_BY_NAME)uiValueB)->Name ); 358 | } 359 | // get the next imported function 360 | uiValueA += sizeof( ULONG_PTR ); 361 | if( uiValueD ) 362 | uiValueD += sizeof( ULONG_PTR ); 363 | } 364 | 365 | // get the next import 366 | uiValueC += sizeof( IMAGE_IMPORT_DESCRIPTOR ); 367 | } 368 | 369 | // STEP 5: process all of our images relocations... 370 | 371 | // calculate the base address delta and perform relocations (even if we load at desired image base) 372 | uiLibraryAddress = uiBaseAddress - ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.ImageBase; 373 | 374 | // uiValueB = the address of the relocation directory 375 | uiValueB = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_BASERELOC ]; 376 | 377 | // check if their are any relocations present 378 | if( ((PIMAGE_DATA_DIRECTORY)uiValueB)->Size ) 379 | { 380 | // uiValueC is now the first entry (IMAGE_BASE_RELOCATION) 381 | uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress ); 382 | 383 | // and we itterate through all entries... 384 | while( ((PIMAGE_BASE_RELOCATION)uiValueC)->SizeOfBlock ) 385 | { 386 | // uiValueA = the VA for this relocation block 387 | uiValueA = ( uiBaseAddress + ((PIMAGE_BASE_RELOCATION)uiValueC)->VirtualAddress ); 388 | 389 | // uiValueB = number of entries in this relocation block 390 | uiValueB = ( ((PIMAGE_BASE_RELOCATION)uiValueC)->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION) ) / sizeof( IMAGE_RELOC ); 391 | 392 | // uiValueD is now the first entry in the current relocation block 393 | uiValueD = uiValueC + sizeof(IMAGE_BASE_RELOCATION); 394 | 395 | // we itterate through all the entries in the current block... 396 | while( uiValueB-- ) 397 | { 398 | // perform the relocation, skipping IMAGE_REL_BASED_ABSOLUTE as required. 399 | // we dont use a switch statement to avoid the compiler building a jump table 400 | // which would not be very position independent! 401 | if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_DIR64 ) 402 | *(ULONG_PTR *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += uiLibraryAddress; 403 | else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_HIGHLOW ) 404 | *(DWORD *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += (DWORD)uiLibraryAddress; 405 | #ifdef WIN_ARM 406 | // Note: On ARM, the compiler optimization /O2 seems to introduce an off by one issue, possibly a code gen bug. Using /O1 instead avoids this problem. 407 | else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_ARM_MOV32T ) 408 | { 409 | register DWORD dwInstruction; 410 | register DWORD dwAddress; 411 | register WORD wImm; 412 | // get the MOV.T instructions DWORD value (We add 4 to the offset to go past the first MOV.W which handles the low word) 413 | dwInstruction = *(DWORD *)( uiValueA + ((PIMAGE_RELOC)uiValueD)->offset + sizeof(DWORD) ); 414 | // flip the words to get the instruction as expected 415 | dwInstruction = MAKELONG( HIWORD(dwInstruction), LOWORD(dwInstruction) ); 416 | // sanity chack we are processing a MOV instruction... 417 | if( (dwInstruction & ARM_MOV_MASK) == ARM_MOVT ) 418 | { 419 | // pull out the encoded 16bit value (the high portion of the address-to-relocate) 420 | wImm = (WORD)( dwInstruction & 0x000000FF); 421 | wImm |= (WORD)((dwInstruction & 0x00007000) >> 4); 422 | wImm |= (WORD)((dwInstruction & 0x04000000) >> 15); 423 | wImm |= (WORD)((dwInstruction & 0x000F0000) >> 4); 424 | // apply the relocation to the target address 425 | dwAddress = ( (WORD)HIWORD(uiLibraryAddress) + wImm ) & 0xFFFF; 426 | // now create a new instruction with the same opcode and register param. 427 | dwInstruction = (DWORD)( dwInstruction & ARM_MOV_MASK2 ); 428 | // patch in the relocated address... 429 | dwInstruction |= (DWORD)(dwAddress & 0x00FF); 430 | dwInstruction |= (DWORD)(dwAddress & 0x0700) << 4; 431 | dwInstruction |= (DWORD)(dwAddress & 0x0800) << 15; 432 | dwInstruction |= (DWORD)(dwAddress & 0xF000) << 4; 433 | // now flip the instructions words and patch back into the code... 434 | *(DWORD *)( uiValueA + ((PIMAGE_RELOC)uiValueD)->offset + sizeof(DWORD) ) = MAKELONG( HIWORD(dwInstruction), LOWORD(dwInstruction) ); 435 | } 436 | } 437 | #endif 438 | else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_HIGH ) 439 | *(WORD *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += HIWORD(uiLibraryAddress); 440 | else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_LOW ) 441 | *(WORD *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += LOWORD(uiLibraryAddress); 442 | 443 | // get the next entry in the current relocation block 444 | uiValueD += sizeof( IMAGE_RELOC ); 445 | } 446 | 447 | // get the next entry in the relocation directory 448 | uiValueC = uiValueC + ((PIMAGE_BASE_RELOCATION)uiValueC)->SizeOfBlock; 449 | } 450 | } 451 | 452 | // STEP 6: call our images entry point 453 | 454 | // uiValueA = the VA of our newly loaded DLL/EXE's entry point 455 | uiValueA = ( uiBaseAddress + ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.AddressOfEntryPoint ); 456 | 457 | // We must flush the instruction cache to avoid stale code being used which was updated by our relocation processing. 458 | pNtFlushInstructionCache( (HANDLE)-1, NULL, 0 ); 459 | 460 | // call our respective entry point, fudging our hInstance value 461 | #ifdef REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR 462 | // if we are injecting a DLL via LoadRemoteLibraryR we call DllMain and pass in our parameter (via the DllMain lpReserved parameter) 463 | ((DLLMAIN)uiValueA)( (HINSTANCE)uiBaseAddress, DLL_PROCESS_ATTACH, lpParameter ); 464 | #else 465 | // if we are injecting an DLL via a stub we call DllMain with no parameter 466 | ((DLLMAIN)uiValueA)( (HINSTANCE)uiBaseAddress, DLL_PROCESS_ATTACH, NULL ); 467 | #endif 468 | 469 | // STEP 8: return our new entry point address so whatever called us can call DllMain() if needed. 470 | return uiValueA; 471 | } 472 | //===============================================================================================// 473 | #ifndef REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN 474 | 475 | BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved ) 476 | { 477 | BOOL bReturnValue = TRUE; 478 | switch( dwReason ) 479 | { 480 | case DLL_QUERY_HMODULE: 481 | if( lpReserved != NULL ) 482 | *(HMODULE *)lpReserved = hAppInstance; 483 | break; 484 | case DLL_PROCESS_ATTACH: 485 | hAppInstance = hinstDLL; 486 | break; 487 | case DLL_PROCESS_DETACH: 488 | case DLL_THREAD_ATTACH: 489 | case DLL_THREAD_DETACH: 490 | break; 491 | } 492 | return bReturnValue; 493 | } 494 | 495 | #endif 496 | //===============================================================================================// 497 | -------------------------------------------------------------------------------- /WebCamCapture/ReflectiveLoader.h: -------------------------------------------------------------------------------- 1 | //===============================================================================================// 2 | // Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com) 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are permitted 6 | // provided that the following conditions are met: 7 | // 8 | // * Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other materials provided 13 | // with the distribution. 14 | // 15 | // * Neither the name of Harmony Security nor the names of its contributors may be used to 16 | // endorse or promote products derived from this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 | // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | //===============================================================================================// 28 | #ifndef _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H 29 | #define _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H 30 | #define WIN_X86 31 | #define REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN 32 | //===============================================================================================// 33 | #define WIN32_LEAN_AND_MEAN 34 | #include 35 | #include 36 | #include 37 | 38 | #include "ReflectiveDLLInjection.h" 39 | 40 | typedef HMODULE (WINAPI * LOADLIBRARYA)( LPCSTR ); 41 | typedef FARPROC (WINAPI * GETPROCADDRESS)( HMODULE, LPCSTR ); 42 | typedef LPVOID (WINAPI * VIRTUALALLOC)( LPVOID, SIZE_T, DWORD, DWORD ); 43 | typedef DWORD (NTAPI * NTFLUSHINSTRUCTIONCACHE)( HANDLE, PVOID, ULONG ); 44 | 45 | #define KERNEL32DLL_HASH 0x6A4ABC5B 46 | #define NTDLLDLL_HASH 0x3CFA685D 47 | 48 | #define LOADLIBRARYA_HASH 0xEC0E4E8E 49 | #define GETPROCADDRESS_HASH 0x7C0DFCAA 50 | #define VIRTUALALLOC_HASH 0x91AFCA54 51 | #define NTFLUSHINSTRUCTIONCACHE_HASH 0x534C0AB8 52 | 53 | #define IMAGE_REL_BASED_ARM_MOV32A 5 54 | #define IMAGE_REL_BASED_ARM_MOV32T 7 55 | 56 | #define ARM_MOV_MASK (DWORD)(0xFBF08000) 57 | #define ARM_MOV_MASK2 (DWORD)(0xFBF08F00) 58 | #define ARM_MOVW 0xF2400000 59 | #define ARM_MOVT 0xF2C00000 60 | 61 | #define HASH_KEY 13 62 | //===============================================================================================// 63 | #pragma intrinsic( _rotr ) 64 | 65 | __forceinline DWORD ror( DWORD d ) 66 | { 67 | return _rotr( d, HASH_KEY ); 68 | } 69 | 70 | __forceinline DWORD hash( char * c ) 71 | { 72 | register DWORD h = 0; 73 | do 74 | { 75 | h = ror( h ); 76 | h += *c; 77 | } while( *++c ); 78 | 79 | return h; 80 | } 81 | //===============================================================================================// 82 | typedef struct _UNICODE_STR 83 | { 84 | USHORT Length; 85 | USHORT MaximumLength; 86 | PWSTR pBuffer; 87 | } UNICODE_STR, *PUNICODE_STR; 88 | 89 | // WinDbg> dt -v ntdll!_LDR_DATA_TABLE_ENTRY 90 | //__declspec( align(8) ) 91 | typedef struct _LDR_DATA_TABLE_ENTRY 92 | { 93 | //LIST_ENTRY InLoadOrderLinks; // As we search from PPEB_LDR_DATA->InMemoryOrderModuleList we dont use the first entry. 94 | LIST_ENTRY InMemoryOrderModuleList; 95 | LIST_ENTRY InInitializationOrderModuleList; 96 | PVOID DllBase; 97 | PVOID EntryPoint; 98 | ULONG SizeOfImage; 99 | UNICODE_STR FullDllName; 100 | UNICODE_STR BaseDllName; 101 | ULONG Flags; 102 | SHORT LoadCount; 103 | SHORT TlsIndex; 104 | LIST_ENTRY HashTableEntry; 105 | ULONG TimeDateStamp; 106 | } LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY; 107 | 108 | // WinDbg> dt -v ntdll!_PEB_LDR_DATA 109 | typedef struct _PEB_LDR_DATA //, 7 elements, 0x28 bytes 110 | { 111 | DWORD dwLength; 112 | DWORD dwInitialized; 113 | LPVOID lpSsHandle; 114 | LIST_ENTRY InLoadOrderModuleList; 115 | LIST_ENTRY InMemoryOrderModuleList; 116 | LIST_ENTRY InInitializationOrderModuleList; 117 | LPVOID lpEntryInProgress; 118 | } PEB_LDR_DATA, * PPEB_LDR_DATA; 119 | 120 | // WinDbg> dt -v ntdll!_PEB_FREE_BLOCK 121 | typedef struct _PEB_FREE_BLOCK // 2 elements, 0x8 bytes 122 | { 123 | struct _PEB_FREE_BLOCK * pNext; 124 | DWORD dwSize; 125 | } PEB_FREE_BLOCK, * PPEB_FREE_BLOCK; 126 | 127 | // struct _PEB is defined in Winternl.h but it is incomplete 128 | // WinDbg> dt -v ntdll!_PEB 129 | typedef struct __PEB // 65 elements, 0x210 bytes 130 | { 131 | BYTE bInheritedAddressSpace; 132 | BYTE bReadImageFileExecOptions; 133 | BYTE bBeingDebugged; 134 | BYTE bSpareBool; 135 | LPVOID lpMutant; 136 | LPVOID lpImageBaseAddress; 137 | PPEB_LDR_DATA pLdr; 138 | LPVOID lpProcessParameters; 139 | LPVOID lpSubSystemData; 140 | LPVOID lpProcessHeap; 141 | PRTL_CRITICAL_SECTION pFastPebLock; 142 | LPVOID lpFastPebLockRoutine; 143 | LPVOID lpFastPebUnlockRoutine; 144 | DWORD dwEnvironmentUpdateCount; 145 | LPVOID lpKernelCallbackTable; 146 | DWORD dwSystemReserved; 147 | DWORD dwAtlThunkSListPtr32; 148 | PPEB_FREE_BLOCK pFreeList; 149 | DWORD dwTlsExpansionCounter; 150 | LPVOID lpTlsBitmap; 151 | DWORD dwTlsBitmapBits[2]; 152 | LPVOID lpReadOnlySharedMemoryBase; 153 | LPVOID lpReadOnlySharedMemoryHeap; 154 | LPVOID lpReadOnlyStaticServerData; 155 | LPVOID lpAnsiCodePageData; 156 | LPVOID lpOemCodePageData; 157 | LPVOID lpUnicodeCaseTableData; 158 | DWORD dwNumberOfProcessors; 159 | DWORD dwNtGlobalFlag; 160 | LARGE_INTEGER liCriticalSectionTimeout; 161 | DWORD dwHeapSegmentReserve; 162 | DWORD dwHeapSegmentCommit; 163 | DWORD dwHeapDeCommitTotalFreeThreshold; 164 | DWORD dwHeapDeCommitFreeBlockThreshold; 165 | DWORD dwNumberOfHeaps; 166 | DWORD dwMaximumNumberOfHeaps; 167 | LPVOID lpProcessHeaps; 168 | LPVOID lpGdiSharedHandleTable; 169 | LPVOID lpProcessStarterHelper; 170 | DWORD dwGdiDCAttributeList; 171 | LPVOID lpLoaderLock; 172 | DWORD dwOSMajorVersion; 173 | DWORD dwOSMinorVersion; 174 | WORD wOSBuildNumber; 175 | WORD wOSCSDVersion; 176 | DWORD dwOSPlatformId; 177 | DWORD dwImageSubsystem; 178 | DWORD dwImageSubsystemMajorVersion; 179 | DWORD dwImageSubsystemMinorVersion; 180 | DWORD dwImageProcessAffinityMask; 181 | DWORD dwGdiHandleBuffer[34]; 182 | LPVOID lpPostProcessInitRoutine; 183 | LPVOID lpTlsExpansionBitmap; 184 | DWORD dwTlsExpansionBitmapBits[32]; 185 | DWORD dwSessionId; 186 | ULARGE_INTEGER liAppCompatFlags; 187 | ULARGE_INTEGER liAppCompatFlagsUser; 188 | LPVOID lppShimData; 189 | LPVOID lpAppCompatInfo; 190 | UNICODE_STR usCSDVersion; 191 | LPVOID lpActivationContextData; 192 | LPVOID lpProcessAssemblyStorageMap; 193 | LPVOID lpSystemDefaultActivationContextData; 194 | LPVOID lpSystemAssemblyStorageMap; 195 | DWORD dwMinimumStackCommit; 196 | } _PEB, * _PPEB; 197 | 198 | typedef struct 199 | { 200 | WORD offset:12; 201 | WORD type:4; 202 | } IMAGE_RELOC, *PIMAGE_RELOC; 203 | //===============================================================================================// 204 | #endif 205 | //===============================================================================================// 206 | -------------------------------------------------------------------------------- /WebCamCapture/Release/ReflectiveLoader.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/ReflectiveLoader.obj -------------------------------------------------------------------------------- /WebCamCapture/Release/VideoCapture.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/VideoCapture.obj -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.Build.CppClean.log: -------------------------------------------------------------------------------- 1 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\vc140.pdb 2 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.obj 3 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\stdafx.obj 4 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\videocapture.obj 5 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\dllmain.obj 6 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\reflectiveloader.obj 7 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\release\webcamcapture.dll 8 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\release\webcamcapture.ipdb 9 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\release\webcamcapture.iobj 10 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\release\webcamcapture.pdb 11 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\release\webcamcapture.lib 12 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\release\webcamcapture.exp 13 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.tlog\cl.command.1.tlog 14 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.tlog\cl.read.1.tlog 15 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.tlog\cl.write.1.tlog 16 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.tlog\link.command.1.tlog 17 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.tlog\link.read.1.tlog 18 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.tlog\link.write.1.tlog 19 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\release\webcamcapture.tlog\webcamcapture.write.1u.tlog 20 | -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.log: -------------------------------------------------------------------------------- 1 |  VideoCapture.cpp 2 | To compile qedit.h you must install the DirectX 9 SDK, to obtain the dxtrans.h header. 3 | stdafx.cpp 4 | WebCamCapture.cpp 5 | dllmain.cpp 6 | ReflectiveLoader.c 7 | Creating library C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\Release\WebCamCapture.lib and object C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\Release\WebCamCapture.exp 8 | Generating code 9 | All 20 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. 10 | Finished generating code 11 | WebCamCapture.vcxproj -> C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\Release\WebCamCapture.dll 12 | -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.obj -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/WebCamCapture.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 2 | Release|Win32|C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\| 3 | -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/WebCamCapture.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.tlog/WebCamCapture.write.1u.tlog -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Release/WebCamCapture.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/WebCamCapture.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/Release/dllmain.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/dllmain.obj -------------------------------------------------------------------------------- /WebCamCapture/Release/stdafx.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/stdafx.obj -------------------------------------------------------------------------------- /WebCamCapture/Release/vc140.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/Release/vc140.pdb -------------------------------------------------------------------------------- /WebCamCapture/WebCamCapture.cpp: -------------------------------------------------------------------------------- 1 | // WebCamCapture.cpp : Defines the exported functions for the DLL application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include 6 | #include 7 | #include "PipeServer.h" 8 | #include "WebCamCapture.h" 9 | 10 | 11 | 12 | extern "C" __declspec(dllexport) void VoidFunc() 13 | { 14 | 15 | PipeServer *Server = new PipeServer(L"\\\\.\\pipe\\test_pipe"); 16 | Server->startServer(); 17 | Server->data = L"Hello from pipe\n"; 18 | 19 | while (Server->data != L"exit" || Server->data != L"EXIT") 20 | { 21 | Server->sendData(); 22 | //wait for command to record video 23 | Server->receiveData(); 24 | std::cout << "Received data: " << Server->data << "\n"; 25 | } 26 | Server->stopServer(); 27 | } -------------------------------------------------------------------------------- /WebCamCapture/WebCamCapture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | extern "C" __declspec(dllexport) void VoidFunc(); -------------------------------------------------------------------------------- /WebCamCapture/WebCamCapture.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {67E3B2B4-348D-41DE-A482-EB4F8C56E785} 23 | Win32Proj 24 | WebCamCapture 25 | 8.1 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v140 32 | Unicode 33 | 34 | 35 | DynamicLibrary 36 | false 37 | v140 38 | true 39 | Unicode 40 | 41 | 42 | DynamicLibrary 43 | true 44 | v140 45 | Unicode 46 | 47 | 48 | DynamicLibrary 49 | false 50 | v140 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | 87 | 88 | Level3 89 | Disabled 90 | WIN32;_DEBUG;_WINDOWS;_USRDLL;WEBCAMCAPTURE_EXPORTS;%(PreprocessorDefinitions) 91 | 92 | 93 | Windows 94 | true 95 | 96 | 97 | 98 | 99 | 100 | 101 | Level3 102 | Disabled 103 | _DEBUG;_WINDOWS;_USRDLL;WEBCAMCAPTURE_EXPORTS;%(PreprocessorDefinitions) 104 | 105 | 106 | Windows 107 | true 108 | 109 | 110 | 111 | 112 | Level3 113 | 114 | 115 | MaxSpeed 116 | true 117 | true 118 | WIN32;NDEBUG;_WINDOWS;_USRDLL;WEBCAMCAPTURE_EXPORTS;%(PreprocessorDefinitions) 119 | 120 | 121 | Windows 122 | true 123 | true 124 | true 125 | 126 | 127 | 128 | 129 | Level3 130 | 131 | 132 | MaxSpeed 133 | true 134 | true 135 | NDEBUG;_WINDOWS;_USRDLL;WEBCAMCAPTURE_EXPORTS;%(PreprocessorDefinitions) 136 | 137 | 138 | Windows 139 | true 140 | true 141 | true 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | false 160 | 161 | 162 | false 163 | 164 | 165 | false 166 | 167 | 168 | false 169 | 170 | 171 | 172 | 173 | CompileAsCpp 174 | NotUsing 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /WebCamCapture/WebCamCapture.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | -------------------------------------------------------------------------------- /WebCamCapture/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | #include "ReflectiveLoader.h" 4 | #include "WebCamCapture.h" 5 | 6 | BOOL APIENTRY DllMain( HMODULE hModule, 7 | DWORD ul_reason_for_call, 8 | LPVOID lpReserved 9 | ) 10 | { 11 | switch (ul_reason_for_call) 12 | { 13 | case DLL_PROCESS_ATTACH: 14 | case DLL_THREAD_ATTACH: 15 | VoidFunc(); 16 | case DLL_THREAD_DETACH: 17 | case DLL_PROCESS_DETACH: 18 | break; 19 | } 20 | return TRUE; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /WebCamCapture/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // WebCamCapture.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /WebCamCapture/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /WebCamCapture/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/ReflectiveLoader.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/ReflectiveLoader.obj -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/VideoCapture.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/VideoCapture.obj -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.log: -------------------------------------------------------------------------------- 1 |  VideoCapture.cpp 2 | To compile qedit.h you must install the DirectX 9 SDK, to obtain the dxtrans.h header. 3 | stdafx.cpp 4 | WebCamCapture.cpp 5 | c:\users\tester\documents\visual studio 2015\projects\webcamcapture\webcamcapture\PipeServer.h(54): warning C4267: 'argument': conversion from 'size_t' to 'DWORD', possible loss of data 6 | WebCamCapture.cpp(20): warning C4551: function call missing argument list 7 | dllmain.cpp 8 | ReflectiveLoader.c 9 | ReflectiveLoader.c(114): warning C4013: '__readfsdword' undefined; assuming extern returning int 10 | Creating library C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\x64\Release\WebCamCapture.lib and object C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\x64\Release\WebCamCapture.exp 11 | ReflectiveLoader.obj : error LNK2001: unresolved external symbol __readfsdword 12 | C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\x64\Release\WebCamCapture.dll : fatal error LNK1120: 1 unresolved externals 13 | -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.obj -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/WebCamCapture.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 2 | Release|x64|C:\Users\tester\Documents\Visual Studio 2015\Projects\WebCamCapture\| 3 | -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/WebCamCapture.tlog/unsuccessfulbuild: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/WebCamCapture.tlog/unsuccessfulbuild -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/dllmain.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/dllmain.obj -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/stdafx.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/stdafx.obj -------------------------------------------------------------------------------- /WebCamCapture/x64/Release/vc140.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/WebCamCapture/x64/Release/vc140.pdb -------------------------------------------------------------------------------- /x64/Release/WebCamCapture.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/x64/Release/WebCamCapture.exp -------------------------------------------------------------------------------- /x64/Release/WebCamCapture.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xorrior/WebCam_Dll/a3b79f123b505c755646d8e3de517e80fa0cf25b/x64/Release/WebCamCapture.lib --------------------------------------------------------------------------------