AStyle formatting

This commit is contained in:
Duncan Ogilvie 2021-11-14 14:05:53 +01:00
parent cda4385d6d
commit f0832465c6
6 changed files with 86 additions and 86 deletions

View File

@ -144,7 +144,7 @@ static NTSTATUS CreateThreadSkipAttach(IN HANDLE ProcessHandle, IN PUSER_THREAD_
NTSTATUS Status; NTSTATUS Status;
HANDLE hThread; HANDLE hThread;
typedef NTSTATUS(NTAPI *t_NtCreateThreadEx)( typedef NTSTATUS(NTAPI * t_NtCreateThreadEx)(
PHANDLE /* ThreadHandle */, PHANDLE /* ThreadHandle */,
ACCESS_MASK /* DesiredAccess */, ACCESS_MASK /* DesiredAccess */,
POBJECT_ATTRIBUTES /* ObjectAttributes */, POBJECT_ATTRIBUTES /* ObjectAttributes */,

View File

@ -2037,7 +2037,7 @@ DWORD EngineSetDebugPrivilege(HANDLE hProcess, bool bEnablePrivilege)
NTSTATUS Status = NtOpenProcessToken(hProcess, NTSTATUS Status = NtOpenProcessToken(hProcess,
TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
&TokenHandle); &TokenHandle);
if (!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
return RtlNtStatusToDosError(Status); return RtlNtStatusToDosError(Status);
LUID LuidPrivilege; LUID LuidPrivilege;
@ -2060,7 +2060,7 @@ DWORD EngineSetDebugPrivilege(HANDLE hProcess, bool bEnablePrivilege)
// Map the success code NOT_ALL_ASSIGNED to an appropriate error // Map the success code NOT_ALL_ASSIGNED to an appropriate error
// since we're only trying to adjust one privilege. // since we're only trying to adjust one privilege.
if (Status == STATUS_NOT_ALL_ASSIGNED) if(Status == STATUS_NOT_ALL_ASSIGNED)
Status = STATUS_PRIVILEGE_NOT_HELD; Status = STATUS_PRIVILEGE_NOT_HELD;
return NT_SUCCESS(Status) ? ERROR_SUCCESS : RtlNtStatusToDosError(Status); return NT_SUCCESS(Status) ? ERROR_SUCCESS : RtlNtStatusToDosError(Status);

View File

@ -323,7 +323,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec* p, SizeT limit, const Byte*
unsigned i = 1; unsigned i = 1;
do do
{ {
GET_BIT2(prob + i, i, ; , distance |= mask); GET_BIT2(prob + i, i, ;, distance |= mask);
mask <<= 1; mask <<= 1;
} }
while(--numDirectBits != 0); while(--numDirectBits != 0);
@ -358,10 +358,10 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec* p, SizeT limit, const Byte*
distance <<= kNumAlignBits; distance <<= kNumAlignBits;
{ {
unsigned i = 1; unsigned i = 1;
GET_BIT2(prob + i, i, ; , distance |= 1); GET_BIT2(prob + i, i, ;, distance |= 1);
GET_BIT2(prob + i, i, ; , distance |= 2); GET_BIT2(prob + i, i, ;, distance |= 2);
GET_BIT2(prob + i, i, ; , distance |= 4); GET_BIT2(prob + i, i, ;, distance |= 4);
GET_BIT2(prob + i, i, ; , distance |= 8); GET_BIT2(prob + i, i, ;, distance |= 8);
} }
if(distance == (UInt32)0xFFFFFFFF) if(distance == (UInt32)0xFFFFFFFF)
{ {

View File

@ -469,11 +469,11 @@ __declspec(dllexport) bool TITCALL SetMemoryBPXEx(ULONG_PTR MemoryStart, SIZE_T
VirtualQueryEx(dbgProcessInformation.hProcess, curPage, &MemInfo, sizeof(MEMORY_BASIC_INFORMATION)); VirtualQueryEx(dbgProcessInformation.hProcess, curPage, &MemInfo, sizeof(MEMORY_BASIC_INFORMATION));
if (OldProtect == 0) if(OldProtect == 0)
OldProtect = MemInfo.Protect; OldProtect = MemInfo.Protect;
// Check if the alternative memory breakpoint method should be used // Check if the alternative memory breakpoint method should be used
if (engineMembpAlt) if(engineMembpAlt)
{ {
if(!(MemInfo.Protect & PAGE_NOACCESS)) if(!(MemInfo.Protect & PAGE_NOACCESS))
{ {
@ -544,7 +544,7 @@ __declspec(dllexport) bool TITCALL RemoveMemoryBPX(ULONG_PTR MemoryStart, SIZE_T
VirtualQueryEx(dbgProcessInformation.hProcess, curPage, &MemInfo, sizeof(MEMORY_BASIC_INFORMATION)); VirtualQueryEx(dbgProcessInformation.hProcess, curPage, &MemInfo, sizeof(MEMORY_BASIC_INFORMATION));
// Check if the alternative memory breakpoint method is being used // Check if the alternative memory breakpoint method is being used
if (engineMembpAlt) if(engineMembpAlt)
{ {
if(MemInfo.Protect & PAGE_NOACCESS) if(MemInfo.Protect & PAGE_NOACCESS)
{ {

View File

@ -59,7 +59,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
// Check if DBG_REPLY_LATER is supported based on Windows version (Windows 10, version 1507 or above) // Check if DBG_REPLY_LATER is supported based on Windows version (Windows 10, version 1507 or above)
// https://www.gaijin.at/en/infos/windows-version-numbers // https://www.gaijin.at/en/infos/windows-version-numbers
const uint32_t NtBuildNumber = *(uint32_t*)(0x7FFE0000 + 0x260); const uint32_t NtBuildNumber = *(uint32_t*)(0x7FFE0000 + 0x260);
if (NtBuildNumber != 0 && NtBuildNumber >= 10240) if(NtBuildNumber != 0 && NtBuildNumber >= 10240)
{ {
IsDbgReplyLaterSupported = true; IsDbgReplyLaterSupported = true;
} }
@ -109,12 +109,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
} }
} }
if (IsDbgReplyLaterSupported) if(IsDbgReplyLaterSupported)
{ {
if (DBGEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT) if(DBGEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT)
{ {
// Check if there is a thread processing a single step // Check if there is a thread processing a single step
if (ThreadBeingProcessed != 0 && DBGEvent.dwThreadId != ThreadBeingProcessed) if(ThreadBeingProcessed != 0 && DBGEvent.dwThreadId != ThreadBeingProcessed)
{ {
// Reply to the dbg event later // Reply to the dbg event later
DBGCode = DBG_REPLY_LATER; DBGCode = DBG_REPLY_LATER;
@ -122,12 +122,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
goto continue_dbg_event; goto continue_dbg_event;
} }
} }
else if (DBGEvent.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT) else if(DBGEvent.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT)
{ {
if (ThreadBeingProcessed != 0 && DBGEvent.dwThreadId == ThreadBeingProcessed) if(ThreadBeingProcessed != 0 && DBGEvent.dwThreadId == ThreadBeingProcessed)
{ {
// Resume the other threads since the thread being processed is exiting // Resume the other threads since the thread being processed is exiting
for (auto& Thread : SuspendedThreads) for(auto & Thread : SuspendedThreads)
ResumeThread(Thread.hThread); ResumeThread(Thread.hThread);
SuspendedThreads.clear(); SuspendedThreads.clear();
@ -612,10 +612,10 @@ __declspec(dllexport) void TITCALL DebugLoop()
case STATUS_SINGLE_STEP: case STATUS_SINGLE_STEP:
{ {
if (IsDbgReplyLaterSupported) if(IsDbgReplyLaterSupported)
{ {
// Resume the other threads since we are done processing the single step // Resume the other threads since we are done processing the single step
for (auto& Thread : SuspendedThreads) for(auto & Thread : SuspendedThreads)
ResumeThread(Thread.hThread); ResumeThread(Thread.hThread);
SuspendedThreads.clear(); SuspendedThreads.clear();
@ -691,12 +691,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
ResetMemBPX = false; ResetMemBPX = false;
// Check if the alternative memory breakpoint method should be used // Check if the alternative memory breakpoint method should be used
if (engineMembpAlt) if(engineMembpAlt)
{ {
// Check if the breakpoint is still enabled/present and has not been removed // Check if the breakpoint is still enabled/present and has not been removed
for(int i = 0; i < BreakPointBuffer.size(); i++) for(int i = 0; i < BreakPointBuffer.size(); i++)
{ {
if (BreakPointBuffer.at(i).BreakPointAddress == ResetMemBPXAddress && if(BreakPointBuffer.at(i).BreakPointAddress == ResetMemBPXAddress &&
(BreakPointBuffer.at(i).BreakPointType == UE_MEMORY || (BreakPointBuffer.at(i).BreakPointType == UE_MEMORY ||
BreakPointBuffer.at(i).BreakPointType == UE_MEMORY_READ || BreakPointBuffer.at(i).BreakPointType == UE_MEMORY_READ ||
BreakPointBuffer.at(i).BreakPointType == UE_MEMORY_WRITE || BreakPointBuffer.at(i).BreakPointType == UE_MEMORY_WRITE ||
@ -1198,7 +1198,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
} }
// If the breakpoint has to be restored... // If the breakpoint has to be restored...
if (ResetMemBPX) if(ResetMemBPX)
{ {
// ...temporarily revert the PAGE_NOACCESS permission // ...temporarily revert the PAGE_NOACCESS permission
VirtualProtectEx(dbgProcessInformation.hProcess, (LPVOID)ResetMemBPXAddress, VirtualProtectEx(dbgProcessInformation.hProcess, (LPVOID)ResetMemBPXAddress,
@ -1206,7 +1206,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
} }
// Call the custom memory breakpoint handler // Call the custom memory breakpoint handler
if (bCallCustomHandler) if(bCallCustomHandler)
{ {
myCustomHandler = (fCustomHandler)(MemoryBpxCallBack); myCustomHandler = (fCustomHandler)(MemoryBpxCallBack);
myCustomHandler((void*)bpaddr); myCustomHandler((void*)bpaddr);
@ -1422,7 +1422,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
break; break;
} }
if (IsDbgReplyLaterSupported && DBGEvent.dwDebugEventCode != EXIT_THREAD_DEBUG_EVENT) if(IsDbgReplyLaterSupported && DBGEvent.dwDebugEventCode != EXIT_THREAD_DEBUG_EVENT)
{ {
CONTEXT DbgCtx; CONTEXT DbgCtx;
@ -1430,24 +1430,24 @@ __declspec(dllexport) void TITCALL DebugLoop()
hActiveThread = EngineOpenThread(THREAD_GETSETSUSPEND, false, DBGEvent.dwThreadId); hActiveThread = EngineOpenThread(THREAD_GETSETSUSPEND, false, DBGEvent.dwThreadId);
if (hActiveThread != NULL) if(hActiveThread != NULL)
{ {
// If TF is set (single step), then suspend all the other threads // If TF is set (single step), then suspend all the other threads
if (GetThreadContext(hActiveThread, &DbgCtx) && (DbgCtx.EFlags & UE_TRAP_FLAG)) if(GetThreadContext(hActiveThread, &DbgCtx) && (DbgCtx.EFlags & UE_TRAP_FLAG))
{ {
ThreadBeingProcessed = DBGEvent.dwThreadId; ThreadBeingProcessed = DBGEvent.dwThreadId;
for (auto& Thread : hListThread) for(auto & Thread : hListThread)
{ {
if (ThreadBeingProcessed == Thread.dwThreadId) if(ThreadBeingProcessed == Thread.dwThreadId)
continue; continue;
// Check if the thread is already suspended // Check if the thread is already suspended
for (auto& SuspendedThread : SuspendedThreads) for(auto & SuspendedThread : SuspendedThreads)
if (SuspendedThread.dwThreadId == Thread.dwThreadId) if(SuspendedThread.dwThreadId == Thread.dwThreadId)
continue; continue;
if (SuspendThread(Thread.hThread) != -1) if(SuspendThread(Thread.hThread) != -1)
SuspendedThreads.push_back(Thread); SuspendedThreads.push_back(Thread);
} }
} }