Added support for self-injection via winhttp.dll

This commit is contained in:
acidicoala
2025-09-22 22:47:53 +05:00
parent 8decbafb53
commit f5b8c0c89f
2 changed files with 31 additions and 22 deletions

View File

@@ -109,26 +109,35 @@ if(WIN32)
INPUT_SOURCES_DIR "" INPUT_SOURCES_DIR ""
DLL_FILES_GLOB "${CMAKE_CURRENT_SOURCE_DIR}/res/steamworks/*/binaries/${STEAM_API_MODULE}.dll" DLL_FILES_GLOB "${CMAKE_CURRENT_SOURCE_DIR}/res/steamworks/*/binaries/${STEAM_API_MODULE}.dll"
) )
configure_linker_exports(
TARGET SmokeAPI set(HEADER_CONTENT "#pragma once\n\n")
HEADER_NAME "linker_exports_for_version.h"
FORWARDED_DLL "C:/Windows/System32/version.dll" foreach(WIN_DLL version winhttp winmm)
INPUT_SOURCES_DIR "" set(HEADER_NAME "linker_exports_for_${WIN_DLL}.h")
DLL_FILES_GLOB "C:/Windows/System32/version.dll" configure_linker_exports(
) TARGET SmokeAPI
configure_linker_exports( HEADER_NAME "${HEADER_NAME}"
TARGET SmokeAPI FORWARDED_DLL "C:/Windows/System32/${WIN_DLL}.dll"
HEADER_NAME "linker_exports_for_winmm.h" INPUT_SOURCES_DIR ""
FORWARDED_DLL "C:/Windows/System32/winmm.dll" DLL_FILES_GLOB "C:/Windows/System32/${WIN_DLL}.dll"
INPUT_SOURCES_DIR "" )
DLL_FILES_GLOB "C:/Windows/System32/winmm.dll"
set(HEADER_CONTENT "${HEADER_CONTENT}#include <${HEADER_NAME}>\n")
endforeach()
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/linker_exports_for_windows_dlls.h"
CONTENT "${HEADER_CONTENT}"
) )
# Ignore linker warnings regarding COM-related private exports
set_target_properties(SmokeAPI PROPERTIES LINK_FLAGS "/ignore:4104")
else() else()
# configure_linker_exports( # configure_linker_exports(
# TARGET SmokeAPI # TARGET SmokeAPI
# HEADER_NAME "libsteam_api_exports.cpp" # HEADER_NAME "libsteam_api_exports.cpp"
# FORWARDED_DLL "${STEAM_API_MODULE}_o.so" # FORWARDED_DLL "${STEAM_API_MODULE}_o.so"
# DLL_FILES_GLOB "${CMAKE_CURRENT_SOURCE_DIR}/res/steamworks/*/binaries/${LINUX_DIR}/${STEAM_API_MODULE}.so" # DLL_FILES_GLOB "${CMAKE_CURRENT_SOURCE_DIR}/res/steamworks/*/binaries/${LINUX_DIR}/${STEAM_API_MODULE}.so"
# INPUT_SOURCES_DIR "" # INPUT_SOURCES_DIR ""
# ) # )
endif() endif()

View File

@@ -1,11 +1,11 @@
// ReSharper disable CppUnusedIncludeDirective
#include <koalabox/win.hpp> #include <koalabox/win.hpp>
#include "smoke_api/smoke_api.hpp" #include "smoke_api/smoke_api.hpp"
// These headers will be populated at build time // These headers will be populated at build time
#include "linker_exports_for_steam_api.h" #include "linker_exports_for_steam_api.h"
#include "linker_exports_for_version.h" #include "linker_exports_for_windows_dlls.h"
#include "linker_exports_for_winmm.h"
DLL_MAIN(void* handle, const uint32_t reason, void*) { DLL_MAIN(void* handle, const uint32_t reason, void*) {
if(reason == DLL_PROCESS_ATTACH) { if(reason == DLL_PROCESS_ATTACH) {