commit 70b55deb12c4c6c3f0dfcb368da4c25840b0d510 Author: SubstituteR Date: Fri Dec 18 15:33:06 2020 -0500 Upload diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c90e45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,363 @@ +# ---> VisualStudio +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/DllWrapper.sln b/DllWrapper.sln new file mode 100644 index 0000000..0ba6fa6 --- /dev/null +++ b/DllWrapper.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllWrapper", "DllWrapper\DllWrapper.vcxproj", "{BB30BF15-6016-43AE-9790-BB4B423A79A4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Debug|x64.ActiveCfg = Debug|x64 + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Debug|x64.Build.0 = Debug|x64 + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Debug|x86.ActiveCfg = Debug|Win32 + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Debug|x86.Build.0 = Debug|Win32 + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Release|x64.ActiveCfg = Release|x64 + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Release|x64.Build.0 = Release|x64 + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Release|x86.ActiveCfg = Release|Win32 + {BB30BF15-6016-43AE-9790-BB4B423A79A4}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {90F471B5-6DA8-4A15-A1DD-A689CEDC9577} + EndGlobalSection +EndGlobal diff --git a/DllWrapper/DllWrapper.vcxproj b/DllWrapper/DllWrapper.vcxproj new file mode 100644 index 0000000..33e18bc --- /dev/null +++ b/DllWrapper/DllWrapper.vcxproj @@ -0,0 +1,197 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {BB30BF15-6016-43AE-9790-BB4B423A79A4} + Win32Proj + DllWrapper + 10.0 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + true + version + + + true + version + + + false + version + + + false + version + + + + NotUsing + Level3 + true + WIN32;_DEBUG;DLLWRAPPER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + stdcpp17 + + + Windows + true + false + version\version.def + + + + + NotUsing + Level3 + true + _DEBUG;DLLWRAPPER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + stdcpp17 + + + Windows + true + false + version\version.def + + + + + NotUsing + Level3 + true + true + true + WIN32;NDEBUG;DLLWRAPPER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + stdcpp17 + + + Windows + true + true + true + false + version\version.def + + + + + NotUsing + Level3 + true + true + true + NDEBUG;DLLWRAPPER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + stdcpp17 + + + Windows + true + true + true + false + version\version.def + + + + + + + + + + + CppCode + true + true + false + false + + + CppCode + true + true + false + false + + + + + + + + \ No newline at end of file diff --git a/DllWrapper/DllWrapper.vcxproj.filters b/DllWrapper/DllWrapper.vcxproj.filters new file mode 100644 index 0000000..aec711f --- /dev/null +++ b/DllWrapper/DllWrapper.vcxproj.filters @@ -0,0 +1,49 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {cb33e585-df76-4a67-a5f0-3d6d59052e7e} + + + {e9587809-56ae-40ac-a8f7-c4cdcfe71fe6} + + + {4e844e72-d0ca-456e-b954-0cc2f123f924} + + + + + Source Files\version + + + + + Source Files + + + + + Source Files\version + + + + + Source Files\version\32 + + + Source Files\version\64 + + + \ No newline at end of file diff --git a/DllWrapper/dllmain.cpp b/DllWrapper/dllmain.cpp new file mode 100644 index 0000000..d576014 --- /dev/null +++ b/DllWrapper/dllmain.cpp @@ -0,0 +1,21 @@ +#include "version/version.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved +) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + setupWrappers(); + MessageBox(NULL, TEXT("TEST"), TEXT("TEST"), 0); + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/DllWrapper/version/32/version_32.asm b/DllWrapper/version/32/version_32.asm new file mode 100644 index 0000000..b76900a --- /dev/null +++ b/DllWrapper/version/32/version_32.asm @@ -0,0 +1,55 @@ +.model flat, C +.code +extern mProcs:DWORD +GetFileVersionInfoA_wrapper proc + jmp mProcs[0*4] +GetFileVersionInfoA_wrapper endp +GetFileVersionInfoByHandle_wrapper proc + jmp mProcs[1*4] +GetFileVersionInfoByHandle_wrapper endp +GetFileVersionInfoExA_wrapper proc + jmp mProcs[2*4] +GetFileVersionInfoExA_wrapper endp +GetFileVersionInfoExW_wrapper proc + jmp mProcs[3*4] +GetFileVersionInfoExW_wrapper endp +GetFileVersionInfoSizeA_wrapper proc + jmp mProcs[4*4] +GetFileVersionInfoSizeA_wrapper endp +GetFileVersionInfoSizeExA_wrapper proc + jmp mProcs[5*4] +GetFileVersionInfoSizeExA_wrapper endp +GetFileVersionInfoSizeExW_wrapper proc + jmp mProcs[6*4] +GetFileVersionInfoSizeExW_wrapper endp +GetFileVersionInfoSizeW_wrapper proc + jmp mProcs[7*4] +GetFileVersionInfoSizeW_wrapper endp +GetFileVersionInfoW_wrapper proc + jmp mProcs[8*4] +GetFileVersionInfoW_wrapper endp +VerFindFileA_wrapper proc + jmp mProcs[9*4] +VerFindFileA_wrapper endp +VerFindFileW_wrapper proc + jmp mProcs[10*4] +VerFindFileW_wrapper endp +VerInstallFileA_wrapper proc + jmp mProcs[11*4] +VerInstallFileA_wrapper endp +VerInstallFileW_wrapper proc + jmp mProcs[12*4] +VerInstallFileW_wrapper endp +VerLanguageNameA_wrapper proc + jmp mProcs[13*4] +VerLanguageNameA_wrapper endp +VerLanguageNameW_wrapper proc + jmp mProcs[14*4] +VerLanguageNameW_wrapper endp +VerQueryValueA_wrapper proc + jmp mProcs[15*4] +VerQueryValueA_wrapper endp +VerQueryValueW_wrapper proc + jmp mProcs[16*4] +VerQueryValueW_wrapper endp +end \ No newline at end of file diff --git a/DllWrapper/version/64/version_64.asm b/DllWrapper/version/64/version_64.asm new file mode 100644 index 0000000..e267571 --- /dev/null +++ b/DllWrapper/version/64/version_64.asm @@ -0,0 +1,54 @@ +.code +extern mProcs:QWORD +GetFileVersionInfoA_wrapper proc + jmp mProcs[0*8] +GetFileVersionInfoA_wrapper endp +GetFileVersionInfoByHandle_wrapper proc + jmp mProcs[1*8] +GetFileVersionInfoByHandle_wrapper endp +GetFileVersionInfoExA_wrapper proc + jmp mProcs[2*8] +GetFileVersionInfoExA_wrapper endp +GetFileVersionInfoExW_wrapper proc + jmp mProcs[3*8] +GetFileVersionInfoExW_wrapper endp +GetFileVersionInfoSizeA_wrapper proc + jmp mProcs[4*8] +GetFileVersionInfoSizeA_wrapper endp +GetFileVersionInfoSizeExA_wrapper proc + jmp mProcs[5*8] +GetFileVersionInfoSizeExA_wrapper endp +GetFileVersionInfoSizeExW_wrapper proc + jmp mProcs[6*8] +GetFileVersionInfoSizeExW_wrapper endp +GetFileVersionInfoSizeW_wrapper proc + jmp mProcs[7*8] +GetFileVersionInfoSizeW_wrapper endp +GetFileVersionInfoW_wrapper proc + jmp mProcs[8*8] +GetFileVersionInfoW_wrapper endp +VerFindFileA_wrapper proc + jmp mProcs[9*8] +VerFindFileA_wrapper endp +VerFindFileW_wrapper proc + jmp mProcs[10*8] +VerFindFileW_wrapper endp +VerInstallFileA_wrapper proc + jmp mProcs[11*8] +VerInstallFileA_wrapper endp +VerInstallFileW_wrapper proc + jmp mProcs[12*8] +VerInstallFileW_wrapper endp +VerLanguageNameA_wrapper proc + jmp mProcs[13*8] +VerLanguageNameA_wrapper endp +VerLanguageNameW_wrapper proc + jmp mProcs[14*8] +VerLanguageNameW_wrapper endp +VerQueryValueA_wrapper proc + jmp mProcs[15*8] +VerQueryValueA_wrapper endp +VerQueryValueW_wrapper proc + jmp mProcs[16*8] +VerQueryValueW_wrapper endp +end \ No newline at end of file diff --git a/DllWrapper/version/version.def b/DllWrapper/version/version.def new file mode 100644 index 0000000..bfeeb15 --- /dev/null +++ b/DllWrapper/version/version.def @@ -0,0 +1,19 @@ +LIBRARY version.dll +EXPORTS + GetFileVersionInfoA=GetFileVersionInfoA_wrapper @1 + GetFileVersionInfoByHandle=GetFileVersionInfoByHandle_wrapper @2 + GetFileVersionInfoExA=GetFileVersionInfoExA_wrapper @3 + GetFileVersionInfoExW=GetFileVersionInfoExW_wrapper @4 + GetFileVersionInfoSizeA=GetFileVersionInfoSizeA_wrapper @5 + GetFileVersionInfoSizeExA=GetFileVersionInfoSizeExA_wrapper @6 + GetFileVersionInfoSizeExW=GetFileVersionInfoSizeExW_wrapper @7 + GetFileVersionInfoSizeW=GetFileVersionInfoSizeW_wrapper @8 + GetFileVersionInfoW=GetFileVersionInfoW_wrapper @9 + VerFindFileA=VerFindFileA_wrapper @10 + VerFindFileW=VerFindFileW_wrapper @11 + VerInstallFileA=VerInstallFileA_wrapper @12 + VerInstallFileW=VerInstallFileW_wrapper @13 + VerLanguageNameA=VerLanguageNameA_wrapper @14 + VerLanguageNameW=VerLanguageNameW_wrapper @15 + VerQueryValueA=VerQueryValueA_wrapper @16 + VerQueryValueW=VerQueryValueW_wrapper @17 \ No newline at end of file diff --git a/DllWrapper/version/version.h b/DllWrapper/version/version.h new file mode 100644 index 0000000..df05630 --- /dev/null +++ b/DllWrapper/version/version.h @@ -0,0 +1,57 @@ +#pragma once +#define WIN32_LEAN_AND_MEAN +#include +#include + +HINSTANCE m_hinst_dll = nullptr; +extern "C" UINT_PTR mProcs[17]{ 0 }; + +LPCSTR import_names[] = { + "GetFileVersionInfoA", + "GetFileVersionInfoByHandle", + "GetFileVersionInfoExA", + "GetFileVersionInfoExW", + "GetFileVersionInfoSizeA", + "GetFileVersionInfoSizeExA", + "GetFileVersionInfoSizeExW", + "GetFileVersionInfoSizeW", + "GetFileVersionInfoW", + "VerFindFileA", + "VerFindFileW", + "VerInstallFileA", + "VerInstallFileW", + "VerLanguageNameA", + "VerLanguageNameW", + "VerQueryValueA", + "VerQueryValueW" +}; + +void setupWrappers() +{ + CHAR sys_dir[MAX_PATH]; + GetSystemDirectoryA(sys_dir, MAX_PATH); + char buffer[MAX_PATH]; + sprintf_s(buffer, "%s\\version.dll", sys_dir); + m_hinst_dll = LoadLibraryA(buffer); + for (int i = 0; i < 17; i++) { + mProcs[i] = reinterpret_cast(GetProcAddress(m_hinst_dll, import_names[i])); + } +} + +extern "C" void GetFileVersionInfoA_wrapper(); +extern "C" void GetFileVersionInfoByHandle_wrapper(); +extern "C" void GetFileVersionInfoExA_wrapper(); +extern "C" void GetFileVersionInfoExW_wrapper(); +extern "C" void GetFileVersionInfoSizeA_wrapper(); +extern "C" void GetFileVersionInfoSizeExA_wrapper(); +extern "C" void GetFileVersionInfoSizeExW_wrapper(); +extern "C" void GetFileVersionInfoSizeW_wrapper(); +extern "C" void GetFileVersionInfoW_wrapper(); +extern "C" void VerFindFileA_wrapper(); +extern "C" void VerFindFileW_wrapper(); +extern "C" void VerInstallFileA_wrapper(); +extern "C" void VerInstallFileW_wrapper(); +extern "C" void VerLanguageNameA_wrapper(); +extern "C" void VerLanguageNameW_wrapper(); +extern "C" void VerQueryValueA_wrapper(); +extern "C" void VerQueryValueW_wrapper(); \ No newline at end of file