Skip to content

Commit

Permalink
general tidying up
Browse files Browse the repository at this point in the history
henlo im new 🐸
  • Loading branch information
KaleidonKep99 committed Jun 3, 2020
1 parent 5950855 commit c4382f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
10 changes: 3 additions & 7 deletions AuroraNative/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,23 @@ CURLcode (*CurlSetopt)(struct Curl_easy*, CURLoption, va_list) = nullptr;

CURLcode CurlSetoptVa(struct Curl_easy* data, CURLoption option, ...) {
va_list arg;

CURLcode result;

va_start(arg, option);

result = CurlSetopt(data, option, arg);

va_end(arg);

return result;
}

CURLcode CurlEasySetopt(struct Curl_easy* data, CURLoption tag, ...) {
va_list arg, copy;

CURLcode result;

if (!data)
if (data == nullptr)
return CURLE_BAD_FUNCTION_ARGUMENT;

va_start(arg, tag);

if (tag == CURLOPT_URL) {
va_copy(copy, arg);

Expand Down Expand Up @@ -83,7 +78,8 @@ CURLcode CurlEasySetopt(struct Curl_easy* data, CURLoption tag, ...) {
printf("Thank you, for complying. I hope we can talk, soon. -Cyuubi\n\n");

result = CurlSetopt(data, tag, arg);
} else {
}
else {
#ifdef VERBOSE
printf("CurlEasySetopt: tag = %i\n", tag);
#endif // VERBOSE
Expand Down
25 changes: 12 additions & 13 deletions AuroraNative/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,22 @@ BOOL VHook::Unhook()

LONG WINAPI VHook::Handler(EXCEPTION_POINTERS* pExceptionInfo)
{
if (pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_GUARD_PAGE_VIOLATION)
{
if (pExceptionInfo->ContextRecord->XIP == (uintptr_t)lpTarget)
pExceptionInfo->ContextRecord->XIP = (uintptr_t)lpDetour;

pExceptionInfo->ContextRecord->EFlags |= 0x100;
DWORD dwOldProtect;

return EXCEPTION_CONTINUE_EXECUTION;
}
switch (pExceptionInfo->ExceptionRecord->ExceptionCode) {
case STATUS_GUARD_PAGE_VIOLATION:
if (pExceptionInfo->ContextRecord->XIP == (uintptr_t)lpTarget)
pExceptionInfo->ContextRecord->XIP = (uintptr_t)lpDetour;

if (pExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_SINGLE_STEP)
{
DWORD dwOldProtect;
pExceptionInfo->ContextRecord->EFlags |= 0x100;
return EXCEPTION_CONTINUE_EXECUTION;

VirtualProtect((LPVOID)lpTarget, 1, PAGE_EXECUTE_READ | PAGE_GUARD, &dwOldProtect);
case STATUS_SINGLE_STEP:
VirtualProtect((LPVOID)lpTarget, 1, PAGE_EXECUTE_READ | PAGE_GUARD, &dwOldProtect);
return EXCEPTION_CONTINUE_EXECUTION;

return EXCEPTION_CONTINUE_EXECUTION;
default:
break;
}

return EXCEPTION_CONTINUE_SEARCH;
Expand Down

0 comments on commit c4382f6

Please sign in to comment.