Skip to content

Commit

Permalink
Actually fixed the EOS QueryOwnership function
Browse files Browse the repository at this point in the history
  • Loading branch information
acidicoala committed Mar 15, 2021
1 parent 9e2a04b commit 5e41525
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Unlocker/src/ProcessHooker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ void injectIfNecessary(wstring cmdLine, LPPROCESS_INFORMATION lpProcessInformati
std::wregex pattern(LR"(\w+\.exe)");

// Ignore system processes
std::wregex fullPattern(LR"(^"[A-Za-z]:\\[Ww]indows\\.*\.exe)");
if(regex_search(cmdLine.cbegin(), cmdLine.cend(), match, pattern))
std::wregex windowsPattern(LR"(^"[A-Za-z]:\\[Ww]indows\\.*\.exe)");
if(regex_search(cmdLine.cbegin(), cmdLine.cend(), match, windowsPattern))
{
logger->debug("Skipping injection into a Windows process");
return;
Expand Down
21 changes: 15 additions & 6 deletions Unlocker/src/platforms/epic/eos_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@ void EOS_CALL QueryOwnershipCallback(const EOS_Ecom_QueryOwnershipCallbackInfo*
{
auto data = const_cast<EOS_Ecom_QueryOwnershipCallbackInfo*>(Data);

logger->debug("QueryOwnershipCallback -> ResultCode: {}", Data->ResultCode);
logger->info("Responding with {} items", data->ItemOwnershipCount);

for(unsigned i = 0; i < data->ItemOwnershipCount; i++)
{
auto isBlacklisted = vectorContains(getEpicConfig().blacklist, string(data->ItemOwnership[i].Id));

auto ownership = data->ItemOwnership[i];
ownership.OwnershipStatus = isBlacklisted ? EOS_EOwnershipStatus::EOS_OS_NotOwned : EOS_EOwnershipStatus::EOS_OS_Owned;
logger->info("\t{} [{}]", ownership.Id, ownership.OwnershipStatus == EOS_EOwnershipStatus::EOS_OS_Owned ? "Owned" : "Not Owned");
auto item = const_cast <EOS_Ecom_ItemOwnership*>(data->ItemOwnership + i);
item->OwnershipStatus = isBlacklisted ? EOS_EOwnershipStatus::EOS_OS_NotOwned : EOS_EOwnershipStatus::EOS_OS_Owned;
logger->info("\t{} [{}]", item->Id, item->OwnershipStatus == EOS_EOwnershipStatus::EOS_OS_Owned ? "Owned" : "Not Owned");
}

auto container = (CallbackContainer*) Data->ClientData;
auto container = (CallbackContainer*) data->ClientData;
data->ClientData = container->clientData;
container->originalCallback(Data);
logger->debug("QueryOwnershipCallback -> ClientData: {}, CompletionDelegate: {}", data->ClientData, (void*) container->originalCallback);

container->originalCallback(data);
logger->debug("Original QueryOwnership callback called");

delete container;
Expand All @@ -49,8 +52,14 @@ void EOS_CALL EOS_Ecom_QueryOwnership(
)
{
logger->info("Game requested ownership of {} items", Options->CatalogItemIdCount);
if(Options->CatalogNamespace != NULL)
logger->debug("Catalog namespace: {}", Options->CatalogNamespace);

logger->debug("EOS_Ecom_QueryOwnership -> ClientData: {}, CompletionDelegate: {}", ClientData, (void*) CompletionDelegate);

auto container = new CallbackContainer{ ClientData, CompletionDelegate };
auto container = new CallbackContainer{ NULL };
container->clientData = ClientData;
container->originalCallback = CompletionDelegate;

GET_PROXY_FUNC(EOS_Ecom_QueryOwnership);
proxyFunc(Handle, Options, container, QueryOwnershipCallback);
Expand Down

0 comments on commit 5e41525

Please sign in to comment.