Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
techiew committed Oct 29, 2024
1 parent fd0fa22 commit 5806854
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions UniversalProxyDLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace UPD
WORD numSections = 0;

// Function prototypes
void* RegisterCallback(std::string exportName, void* callback);
void* RegisterCallback(std::string exportName, void* callbackAddress);
void CreateProxy(HMODULE dllToProxy, std::string specificPathToSearch);
std::string GetModuleFileNameFromModuleHandle(HMODULE handle);
std::string FindOriginalDLL(std::string dllFileName, std::string specificPathToSearch);
Expand Down Expand Up @@ -94,14 +94,18 @@ namespace UPD
template<typename... Types> void Log(Types... args);
template<typename T> std::string NumberToHexString(T number);

void* RegisterCallback(std::string exportName, void* callback)
void* RegisterCallback(std::string exportName, void* callbackAddress)
{
if (callback != nullptr)
if (callbackAddress != nullptr)
{
callbacks[exportName].callbackAddress = (uintptr_t)callback;
Log("Registered callback: ", exportName);
callbacks[exportName].callbackAddress = (uintptr_t)callbackAddress;
Log("Registered callback for: ", exportName);
return &callbacks[exportName].returnAddress;
}
else
{
Log("Invalid callback (nullptr): ", exportName);
}
return nullptr;
}

Expand Down

0 comments on commit 5806854

Please sign in to comment.