diff --git a/reactos/dll/win32/kernel32/client/debugger.c b/reactos/dll/win32/kernel32/client/debugger.c index 4191d36f3e5..ab9d3b4e0c3 100644 --- a/reactos/dll/win32/kernel32/client/debugger.c +++ b/reactos/dll/win32/kernel32/client/debugger.c @@ -71,19 +71,19 @@ K32CreateDBMonMutex(void) TRUE, L"DBWinMutex"); - if(hMutex != NULL) + if (hMutex != NULL) { /* success */ return hMutex; } /* error other than the mutex not being found */ - else if(GetLastError() != ERROR_FILE_NOT_FOUND) + else if (GetLastError() != ERROR_FILE_NOT_FOUND) { /* failure */ return NULL; } - /* if the mutex doesn't exist, create it */ + /* if the mutex doesn't exist, create it */ /* first, set up the mutex security */ /* allocate the NT AUTHORITY\SYSTEM SID */ @@ -100,7 +100,7 @@ K32CreateDBMonMutex(void) &psidSystem); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* allocate the BUILTIN\Administrators SID */ nErrCode = RtlAllocateAndInitializeSid(&siaNTAuth, @@ -116,7 +116,7 @@ K32CreateDBMonMutex(void) &psidAdministrators); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* allocate the Everyone SID */ nErrCode = RtlAllocateAndInitializeSid(&siaWorldAuth, @@ -132,7 +132,7 @@ K32CreateDBMonMutex(void) &psidEveryone); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* allocate space for the SIDs too */ nDaclBufSize += RtlLengthSid(psidSystem); @@ -143,13 +143,13 @@ K32CreateDBMonMutex(void) pDaclBuf = GlobalAlloc(GMEM_FIXED, nDaclBufSize); /* failure */ - if(pDaclBuf == NULL) goto l_Cleanup; + if (pDaclBuf == NULL) goto l_Cleanup; /* create the DACL */ nErrCode = RtlCreateAcl(pDaclBuf, nDaclBufSize, ACL_REVISION); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* grant the minimum required access to Everyone */ nErrCode = RtlAddAccessAllowedAce(pDaclBuf, @@ -160,7 +160,7 @@ K32CreateDBMonMutex(void) psidEveryone); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* grant full access to BUILTIN\Administrators */ nErrCode = RtlAddAccessAllowedAce(pDaclBuf, @@ -169,7 +169,7 @@ K32CreateDBMonMutex(void) psidAdministrators); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* grant full access to NT AUTHORITY\SYSTEM */ nErrCode = RtlAddAccessAllowedAce(pDaclBuf, @@ -178,14 +178,14 @@ K32CreateDBMonMutex(void) psidSystem); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* create the security descriptor */ nErrCode = RtlCreateSecurityDescriptor(&sdMutexSecurity, SECURITY_DESCRIPTOR_REVISION); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* set the descriptor's DACL to the ACL we created */ nErrCode = RtlSetDaclSecurityDescriptor(&sdMutexSecurity, @@ -194,19 +194,19 @@ K32CreateDBMonMutex(void) FALSE); /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + if (!NT_SUCCESS(nErrCode)) goto l_Cleanup; /* create the mutex */ hMutex = CreateMutexW(&saMutexAttribs, FALSE, L"DBWinMutex"); l_Cleanup: /* free the buffers */ - if(pDaclBuf) GlobalFree(pDaclBuf); - if(psidEveryone) RtlFreeSid(psidEveryone); - if(psidAdministrators) RtlFreeSid(psidAdministrators); - if(psidSystem) RtlFreeSid(psidSystem); + if (pDaclBuf) GlobalFree(pDaclBuf); + if (psidEveryone) RtlFreeSid(psidEveryone); + if (psidAdministrators) RtlFreeSid(psidAdministrators); + if (psidSystem) RtlFreeSid(psidSystem); - return hMutex; + return hMutex; } VOID @@ -425,8 +425,8 @@ CheckRemoteDebuggerPresent(IN HANDLE hProcess, /* Check if the process has a debug object/port */ Status = NtQueryInformationProcess(hProcess, ProcessDebugPort, - (PVOID)&DebugPort, - sizeof(HANDLE), + &DebugPort, + sizeof(DebugPort), NULL); if (NT_SUCCESS(Status)) { @@ -558,7 +558,7 @@ DebugBreakProcess(IN HANDLE Process) /* Send the breakin request */ Status = DbgUiIssueRemoteBreakin(Process); - if(!NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { /* Failure */ BaseSetLastNTError(Status); @@ -727,212 +727,212 @@ VOID WINAPI OutputDebugStringA(IN LPCSTR _OutputString) { - _SEH2_TRY - { - ULONG_PTR a_nArgs[2]; + _SEH2_TRY + { + ULONG_PTR a_nArgs[2]; - a_nArgs[0] = (ULONG_PTR)(strlen(_OutputString) + 1); - a_nArgs[1] = (ULONG_PTR)_OutputString; + a_nArgs[0] = (ULONG_PTR)(strlen(_OutputString) + 1); + a_nArgs[1] = (ULONG_PTR)_OutputString; - /* send the string to the user-mode debugger */ - RaiseException(DBG_PRINTEXCEPTION_C, 0, 2, a_nArgs); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - /* no user-mode debugger: try the systemwide debug message monitor, or the - kernel debugger as a last resort */ + /* send the string to the user-mode debugger */ + RaiseException(DBG_PRINTEXCEPTION_C, 0, 2, a_nArgs); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* no user-mode debugger: try the systemwide debug message monitor, or the + kernel debugger as a last resort */ - /* mutex used to synchronize invocations of OutputDebugString */ - static HANDLE s_hDBMonMutex = NULL; - /* true if we already attempted to open/create the mutex */ - static BOOL s_bDBMonMutexTriedOpen = FALSE; + /* mutex used to synchronize invocations of OutputDebugString */ + static HANDLE s_hDBMonMutex = NULL; + /* true if we already attempted to open/create the mutex */ + static BOOL s_bDBMonMutexTriedOpen = FALSE; - /* local copy of the mutex handle */ - volatile HANDLE hDBMonMutex = s_hDBMonMutex; - /* handle to the Section of the shared buffer */ - volatile HANDLE hDBMonBuffer = NULL; + /* local copy of the mutex handle */ + volatile HANDLE hDBMonMutex = s_hDBMonMutex; + /* handle to the Section of the shared buffer */ + volatile HANDLE hDBMonBuffer = NULL; - /* pointer to the mapped view of the shared buffer. It consist of the current - process id followed by the message string */ - struct { DWORD ProcessId; CHAR Buffer[1]; } * pDBMonBuffer = NULL; + /* pointer to the mapped view of the shared buffer. It consist of the current + process id followed by the message string */ + struct { DWORD ProcessId; CHAR Buffer[1]; } * pDBMonBuffer = NULL; - /* event: signaled by the debug message monitor when OutputDebugString can write - to the shared buffer */ - volatile HANDLE hDBMonBufferReady = NULL; + /* event: signaled by the debug message monitor when OutputDebugString can write + to the shared buffer */ + volatile HANDLE hDBMonBufferReady = NULL; - /* event: to be signaled by OutputDebugString when it's done writing to the - shared buffer */ - volatile HANDLE hDBMonDataReady = NULL; + /* event: to be signaled by OutputDebugString when it's done writing to the + shared buffer */ + volatile HANDLE hDBMonDataReady = NULL; - /* mutex not opened, and no previous attempts to open/create it */ - if(hDBMonMutex == NULL && !s_bDBMonMutexTriedOpen) - { - /* open/create the mutex */ - hDBMonMutex = K32CreateDBMonMutex(); - /* store the handle */ - s_hDBMonMutex = hDBMonMutex; - } + /* mutex not opened, and no previous attempts to open/create it */ + if (hDBMonMutex == NULL && !s_bDBMonMutexTriedOpen) + { + /* open/create the mutex */ + hDBMonMutex = K32CreateDBMonMutex(); + /* store the handle */ + s_hDBMonMutex = hDBMonMutex; + } - _SEH2_TRY - { - volatile PCHAR a_cBuffer = NULL; + _SEH2_TRY + { + volatile PCHAR a_cBuffer = NULL; - /* opening the mutex failed */ - if(hDBMonMutex == NULL) - { - /* remember next time */ - s_bDBMonMutexTriedOpen = TRUE; - } - /* opening the mutex succeeded */ - else - { - do - { - /* synchronize with other invocations of OutputDebugString */ - WaitForSingleObject(hDBMonMutex, INFINITE); + /* opening the mutex failed */ + if (hDBMonMutex == NULL) + { + /* remember next time */ + s_bDBMonMutexTriedOpen = TRUE; + } + /* opening the mutex succeeded */ + else + { + do + { + /* synchronize with other invocations of OutputDebugString */ + WaitForSingleObject(hDBMonMutex, INFINITE); - /* buffer of the system-wide debug message monitor */ - hDBMonBuffer = OpenFileMappingW(SECTION_MAP_WRITE, FALSE, L"DBWIN_BUFFER"); + /* buffer of the system-wide debug message monitor */ + hDBMonBuffer = OpenFileMappingW(SECTION_MAP_WRITE, FALSE, L"DBWIN_BUFFER"); - /* couldn't open the buffer: send the string to the kernel debugger */ - if(hDBMonBuffer == NULL) break; + /* couldn't open the buffer: send the string to the kernel debugger */ + if (hDBMonBuffer == NULL) break; - /* map the buffer */ - pDBMonBuffer = MapViewOfFile(hDBMonBuffer, - SECTION_MAP_READ | SECTION_MAP_WRITE, - 0, - 0, - 0); + /* map the buffer */ + pDBMonBuffer = MapViewOfFile(hDBMonBuffer, + SECTION_MAP_READ | SECTION_MAP_WRITE, + 0, + 0, + 0); - /* couldn't map the buffer: send the string to the kernel debugger */ - if(pDBMonBuffer == NULL) break; + /* couldn't map the buffer: send the string to the kernel debugger */ + if (pDBMonBuffer == NULL) break; - /* open the event signaling that the buffer can be accessed */ - hDBMonBufferReady = OpenEventW(SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY"); + /* open the event signaling that the buffer can be accessed */ + hDBMonBufferReady = OpenEventW(SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY"); - /* couldn't open the event: send the string to the kernel debugger */ - if(hDBMonBufferReady == NULL) break; + /* couldn't open the event: send the string to the kernel debugger */ + if (hDBMonBufferReady == NULL) break; - /* open the event to be signaled when the buffer has been filled */ - hDBMonDataReady = OpenEventW(EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY"); - } - while(0); + /* open the event to be signaled when the buffer has been filled */ + hDBMonDataReady = OpenEventW(EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY"); + } + while(0); - /* we couldn't connect to the system-wide debug message monitor: send the - string to the kernel debugger */ - if(hDBMonDataReady == NULL) ReleaseMutex(hDBMonMutex); - } + /* we couldn't connect to the system-wide debug message monitor: send the + string to the kernel debugger */ + if (hDBMonDataReady == NULL) ReleaseMutex(hDBMonMutex); + } - _SEH2_TRY - { - /* size of the current output block */ - volatile SIZE_T nRoundLen; + _SEH2_TRY + { + /* size of the current output block */ + volatile SIZE_T nRoundLen; - /* size of the remainder of the string */ - volatile SIZE_T nOutputStringLen; + /* size of the remainder of the string */ + volatile SIZE_T nOutputStringLen; - /* output the whole string */ - nOutputStringLen = strlen(_OutputString); + /* output the whole string */ + nOutputStringLen = strlen(_OutputString); - do - { - /* we're connected to the debug monitor: - write the current block to the shared buffer */ - if(hDBMonDataReady) - { - /* wait a maximum of 10 seconds for the debug monitor - to finish processing the shared buffer */ - if(WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0) - { - /* timeout or failure: give up */ - break; - } + do + { + /* we're connected to the debug monitor: + write the current block to the shared buffer */ + if (hDBMonDataReady) + { + /* wait a maximum of 10 seconds for the debug monitor + to finish processing the shared buffer */ + if (WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0) + { + /* timeout or failure: give up */ + break; + } - /* write the process id into the buffer */ - pDBMonBuffer->ProcessId = GetCurrentProcessId(); + /* write the process id into the buffer */ + pDBMonBuffer->ProcessId = GetCurrentProcessId(); - /* write only as many bytes as they fit in the buffer */ - if(nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1)) - nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1; - else - nRoundLen = nOutputStringLen; + /* write only as many bytes as they fit in the buffer */ + if (nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1)) + nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1; + else + nRoundLen = nOutputStringLen; - /* copy the current block into the buffer */ - memcpy(pDBMonBuffer->Buffer, _OutputString, nRoundLen); + /* copy the current block into the buffer */ + memcpy(pDBMonBuffer->Buffer, _OutputString, nRoundLen); - /* null-terminate the current block */ - pDBMonBuffer->Buffer[nRoundLen] = 0; + /* null-terminate the current block */ + pDBMonBuffer->Buffer[nRoundLen] = 0; - /* signal that the data contains meaningful data and can be read */ - SetEvent(hDBMonDataReady); - } - /* else, send the current block to the kernel debugger */ - else - { - /* output in blocks of 512 characters */ - a_cBuffer = (CHAR*)HeapAlloc(GetProcessHeap(), 0, 512); + /* signal that the data contains meaningful data and can be read */ + SetEvent(hDBMonDataReady); + } + /* else, send the current block to the kernel debugger */ + else + { + /* output in blocks of 512 characters */ + a_cBuffer = (CHAR*)HeapAlloc(GetProcessHeap(), 0, 512); - if (!a_cBuffer) - { - DbgPrint("OutputDebugStringA: Failed\n"); - break; - } + if (!a_cBuffer) + { + DbgPrint("OutputDebugStringA: Failed\n"); + break; + } - /* write a maximum of 511 bytes */ - if(nOutputStringLen > 510) - nRoundLen = 510; - else - nRoundLen = nOutputStringLen; + /* write a maximum of 511 bytes */ + if (nOutputStringLen > 510) + nRoundLen = 510; + else + nRoundLen = nOutputStringLen; - /* copy the current block */ - memcpy(a_cBuffer, _OutputString, nRoundLen); + /* copy the current block */ + memcpy(a_cBuffer, _OutputString, nRoundLen); - /* null-terminate the current block */ - a_cBuffer[nRoundLen] = 0; + /* null-terminate the current block */ + a_cBuffer[nRoundLen] = 0; - /* send the current block to the kernel debugger */ - DbgPrint("%s", a_cBuffer); + /* send the current block to the kernel debugger */ + DbgPrint("%s", a_cBuffer); - if (a_cBuffer) - { - HeapFree(GetProcessHeap(), 0, a_cBuffer); - a_cBuffer = NULL; - } - } + if (a_cBuffer) + { + HeapFree(GetProcessHeap(), 0, a_cBuffer); + a_cBuffer = NULL; + } + } - /* move to the next block */ - _OutputString += nRoundLen; - nOutputStringLen -= nRoundLen; - } - /* repeat until the string has been fully output */ - while (nOutputStringLen > 0); - } - /* ignore access violations and let other exceptions fall through */ - _SEH2_EXCEPT((_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - if (a_cBuffer) - HeapFree(GetProcessHeap(), 0, a_cBuffer); + /* move to the next block */ + _OutputString += nRoundLen; + nOutputStringLen -= nRoundLen; + } + /* repeat until the string has been fully output */ + while (nOutputStringLen > 0); + } + /* ignore access violations and let other exceptions fall through */ + _SEH2_EXCEPT((_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + if (a_cBuffer) + HeapFree(GetProcessHeap(), 0, a_cBuffer); - /* string copied verbatim from Microsoft's kernel32.dll */ - DbgPrint("\nOutputDebugString faulted during output\n"); - } - _SEH2_END; - } - _SEH2_FINALLY - { - /* close all the still open resources */ - if(hDBMonBufferReady) CloseHandle(hDBMonBufferReady); - if(pDBMonBuffer) UnmapViewOfFile(pDBMonBuffer); - if(hDBMonBuffer) CloseHandle(hDBMonBuffer); - if(hDBMonDataReady) CloseHandle(hDBMonDataReady); + /* string copied verbatim from Microsoft's kernel32.dll */ + DbgPrint("\nOutputDebugString faulted during output\n"); + } + _SEH2_END; + } + _SEH2_FINALLY + { + /* close all the still open resources */ + if (hDBMonBufferReady) CloseHandle(hDBMonBufferReady); + if (pDBMonBuffer) UnmapViewOfFile(pDBMonBuffer); + if (hDBMonBuffer) CloseHandle(hDBMonBuffer); + if (hDBMonDataReady) CloseHandle(hDBMonDataReady); - /* leave the critical section */ - if(hDBMonDataReady != NULL) - ReleaseMutex(hDBMonMutex); - } - _SEH2_END; - } - _SEH2_END; + /* leave the critical section */ + if (hDBMonDataReady != NULL) + ReleaseMutex(hDBMonMutex); + } + _SEH2_END; + } + _SEH2_END; } /* diff --git a/reactos/dll/win32/kernel32/client/except.c b/reactos/dll/win32/kernel32/client/except.c index 84b248de6b0..b44ea14e1cb 100644 --- a/reactos/dll/win32/kernel32/client/except.c +++ b/reactos/dll/win32/kernel32/client/except.c @@ -3,8 +3,8 @@ * PROJECT: ReactOS system libraries * FILE: dll/win32/kernel32/client/except.c * PURPOSE: Exception functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) - * modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ] + * PROGRAMMER: Ariadne (ariadne@xs4all.nl) + * Modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ] * UPDATE HISTORY: * Created 01/11/98 */ @@ -24,18 +24,18 @@ static const char* _module_name_from_addr(const void* addr, void **module_start_addr, char* psz, size_t nChars) { - MEMORY_BASIC_INFORMATION mbi; - if (VirtualQuery(addr, &mbi, sizeof(mbi)) != sizeof(mbi) || - !GetModuleFileNameA((HMODULE)mbi.AllocationBase, psz, nChars)) - { - psz[0] = '\0'; - *module_start_addr = 0; - } - else - { - *module_start_addr = (void *)mbi.AllocationBase; - } - return psz; + MEMORY_BASIC_INFORMATION mbi; + if (VirtualQuery(addr, &mbi, sizeof(mbi)) != sizeof(mbi) || + !GetModuleFileNameA((HMODULE)mbi.AllocationBase, psz, nChars)) + { + psz[0] = '\0'; + *module_start_addr = 0; + } + else + { + *module_start_addr = (void *)mbi.AllocationBase; + } + return psz; } @@ -43,45 +43,45 @@ static VOID _dump_context(PCONTEXT pc) { #ifdef _M_IX86 - /* - * Print out the CPU registers - */ - DbgPrint("CS:EIP %x:%x\n", pc->SegCs&0xffff, pc->Eip ); - DbgPrint("DS %x ES %x FS %x GS %x\n", pc->SegDs&0xffff, pc->SegEs&0xffff, - pc->SegFs&0xffff, pc->SegGs&0xfff); - DbgPrint("EAX: %.8x EBX: %.8x ECX: %.8x\n", pc->Eax, pc->Ebx, pc->Ecx); - DbgPrint("EDX: %.8x EBP: %.8x ESI: %.8x ESP: %.8x\n", pc->Edx, - pc->Ebp, pc->Esi, pc->Esp); - DbgPrint("EDI: %.8x EFLAGS: %.8x\n", pc->Edi, pc->EFlags); + /* + * Print out the CPU registers + */ + DbgPrint("CS:EIP %x:%x\n", pc->SegCs&0xffff, pc->Eip ); + DbgPrint("DS %x ES %x FS %x GS %x\n", pc->SegDs&0xffff, pc->SegEs&0xffff, + pc->SegFs&0xffff, pc->SegGs&0xfff); + DbgPrint("EAX: %.8x EBX: %.8x ECX: %.8x\n", pc->Eax, pc->Ebx, pc->Ecx); + DbgPrint("EDX: %.8x EBP: %.8x ESI: %.8x ESP: %.8x\n", pc->Edx, + pc->Ebp, pc->Esi, pc->Esp); + DbgPrint("EDI: %.8x EFLAGS: %.8x\n", pc->Edi, pc->EFlags); #elif defined(_M_AMD64) - DbgPrint("CS:RIP %x:%I64x\n", pc->SegCs&0xffff, pc->Rip ); - DbgPrint("DS %x ES %x FS %x GS %x\n", pc->SegDs&0xffff, pc->SegEs&0xffff, - pc->SegFs&0xffff, pc->SegGs&0xfff); - DbgPrint("RAX: %I64x RBX: %I64x RCX: %I64x RDI: %I64x\n", pc->Rax, pc->Rbx, pc->Rcx, pc->Rdi); - DbgPrint("RDX: %I64x RBP: %I64x RSI: %I64x RSP: %I64x\n", pc->Rdx, pc->Rbp, pc->Rsi, pc->Rsp); - DbgPrint("R8: %I64x R9: %I64x R10: %I64x R11: %I64x\n", pc->R8, pc->R9, pc->R10, pc->R11); - DbgPrint("R12: %I64x R13: %I64x R14: %I64x R15: %I64x\n", pc->R12, pc->R13, pc->R14, pc->R15); - DbgPrint("EFLAGS: %.8x\n", pc->EFlags); + DbgPrint("CS:RIP %x:%I64x\n", pc->SegCs&0xffff, pc->Rip ); + DbgPrint("DS %x ES %x FS %x GS %x\n", pc->SegDs&0xffff, pc->SegEs&0xffff, + pc->SegFs&0xffff, pc->SegGs&0xfff); + DbgPrint("RAX: %I64x RBX: %I64x RCX: %I64x RDI: %I64x\n", pc->Rax, pc->Rbx, pc->Rcx, pc->Rdi); + DbgPrint("RDX: %I64x RBP: %I64x RSI: %I64x RSP: %I64x\n", pc->Rdx, pc->Rbp, pc->Rsi, pc->Rsp); + DbgPrint("R8: %I64x R9: %I64x R10: %I64x R11: %I64x\n", pc->R8, pc->R9, pc->R10, pc->R11); + DbgPrint("R12: %I64x R13: %I64x R14: %I64x R15: %I64x\n", pc->R12, pc->R13, pc->R14, pc->R15); + DbgPrint("EFLAGS: %.8x\n", pc->EFlags); #elif defined(_M_ARM) - DbgPrint("PC: %08lx LR: %08lx SP: %08lx\n", pc->Pc); - DbgPrint("R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n", pc->R0, pc->R1, pc->R2, pc->R3); - DbgPrint("R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n", pc->R4, pc->R5, pc->R6, pc->R7); - DbgPrint("R8: %08lx R9: %08lx R10: %08lx R11: %08lx\n", pc->R8, pc->R9, pc->R10, pc->R11); - DbgPrint("R12: %08lx CPSR: %08lx FPSCR: %08lx\n", pc->R12, pc->Cpsr, pc->R1, pc->Fpscr, pc->R3); + DbgPrint("PC: %08lx LR: %08lx SP: %08lx\n", pc->Pc); + DbgPrint("R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n", pc->R0, pc->R1, pc->R2, pc->R3); + DbgPrint("R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n", pc->R4, pc->R5, pc->R6, pc->R7); + DbgPrint("R8: %08lx R9: %08lx R10: %08lx R11: %08lx\n", pc->R8, pc->R9, pc->R10, pc->R11); + DbgPrint("R12: %08lx CPSR: %08lx FPSCR: %08lx\n", pc->R12, pc->Cpsr, pc->R1, pc->Fpscr, pc->R3); #else -#error "Unknown architecture" + #error "Unknown architecture" #endif } static VOID -PrintStackTrace(struct _EXCEPTION_POINTERS *ExceptionInfo) +PrintStackTrace(IN PEXCEPTION_POINTERS ExceptionInfo) { PVOID StartAddr; CHAR szMod[128] = ""; PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord; PCONTEXT ContextRecord = ExceptionInfo->ContextRecord; - /* Print a stack trace. */ + /* Print a stack trace */ DbgPrint("Unhandled exception\n"); DbgPrint("ExceptionCode: %8x\n", ExceptionRecord->ExceptionCode); @@ -91,7 +91,7 @@ PrintStackTrace(struct _EXCEPTION_POINTERS *ExceptionInfo) DbgPrint("Faulting Address: %8x\n", ExceptionRecord->ExceptionInformation[1]); } - _dump_context (ContextRecord); + _dump_context(ContextRecord); _module_name_from_addr(ExceptionRecord->ExceptionAddress, &StartAddr, szMod, sizeof(szMod)); DbgPrint("Address:\n %8x+%-8x %s\n", (PVOID)StartAddr, @@ -368,9 +368,7 @@ RaiseException(IN DWORD dwExceptionCode, { /* We do, normalize the count */ if (nNumberOfArguments > EXCEPTION_MAXIMUM_PARAMETERS) - { nNumberOfArguments = EXCEPTION_MAXIMUM_PARAMETERS; - } /* Set the count of parameters and copy them */ ExceptionRecord.NumberParameters = nNumberOfArguments; @@ -388,14 +386,14 @@ RaiseException(IN DWORD dwExceptionCode, } /* Trace the wine special error and show the modulename and functionname */ - if (dwExceptionCode == 0x80000100 /*EXCEPTION_WINE_STUB*/) + if (dwExceptionCode == 0x80000100 /* EXCEPTION_WINE_STUB */) { - /* Numbers of parameter must be equal to two */ - if (ExceptionRecord.NumberParameters == 2) - { - DPRINT1("Missing function in : %s\n", ExceptionRecord.ExceptionInformation[0]); - DPRINT1("with the functionname : %s\n", ExceptionRecord.ExceptionInformation[1]); - } + /* Numbers of parameter must be equal to two */ + if (ExceptionRecord.NumberParameters == 2) + { + DPRINT1("Missing function in : %s\n", ExceptionRecord.ExceptionInformation[0]); + DPRINT1("with the functionname : %s\n", ExceptionRecord.ExceptionInformation[1]); + } } /* Raise the exception */