-
Notifications
You must be signed in to change notification settings - Fork 436
DynamicDependencies: Only Detour functions in not-packaged processes #620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e6af2ed
6593c88
9540264
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,22 @@ | |
|
|
||
| #include <../Detours/detours.h> | ||
|
|
||
| static bool IsPackagedProcess() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this like the 4th or 5th copy of this we've made?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lol 2nd or maybe 3rd. I'm planning to centralize this (and a few other things) but waiting on a couple of naming decisions first. There's a laundry list of refactoring I've got my eye on. Planning to put some time in after I finish some critical path work. |
||
| { | ||
| UINT32 n{}; | ||
| const auto rc = ::GetCurrentPackageFullName(&n, nullptr); | ||
| (void) LOG_HR_IF_MSG(HRESULT_FROM_WIN32(rc), (rc != APPMODEL_ERROR_NO_PACKAGE) && (rc != ERROR_INSUFFICIENT_BUFFER), "GetCurrentPackageFullName rc=%d", rc); | ||
| return rc == ERROR_INSUFFICIENT_BUFFER; | ||
| } | ||
|
|
||
| static HRESULT DetoursInitialize() | ||
| { | ||
| // Only detour APIs for not-packaged processes | ||
| if (IsPackagedProcess()) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| // Do we need to detour APIs? | ||
| if (DetourIsHelperProcess()) | ||
| { | ||
|
|
@@ -29,6 +43,12 @@ static HRESULT DetoursInitialize() | |
|
|
||
| static HRESULT DetoursShutdown() | ||
| { | ||
| // Only detour APIs for not-packaged processes | ||
| if (IsPackagedProcess()) | ||
| { | ||
| return S_OK; | ||
| } | ||
|
|
||
| // Did we detour APIs? | ||
| if (DetourIsHelperProcess()) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.