[KERNEL32]: Formatting fixes (whitespace...) only.

svn path=/trunk/; revision=71768
This commit is contained in:
Hermès Bélusca-Maïto 2016-07-02 20:52:25 +00:00
parent 12df37e35b
commit 1feab2643f
2 changed files with 239 additions and 241 deletions

View file

@ -71,13 +71,13 @@ K32CreateDBMonMutex(void)
TRUE, TRUE,
L"DBWinMutex"); L"DBWinMutex");
if(hMutex != NULL) if (hMutex != NULL)
{ {
/* success */ /* success */
return hMutex; return hMutex;
} }
/* error other than the mutex not being found */ /* error other than the mutex not being found */
else if(GetLastError() != ERROR_FILE_NOT_FOUND) else if (GetLastError() != ERROR_FILE_NOT_FOUND)
{ {
/* failure */ /* failure */
return NULL; return NULL;
@ -100,7 +100,7 @@ K32CreateDBMonMutex(void)
&psidSystem); &psidSystem);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* allocate the BUILTIN\Administrators SID */ /* allocate the BUILTIN\Administrators SID */
nErrCode = RtlAllocateAndInitializeSid(&siaNTAuth, nErrCode = RtlAllocateAndInitializeSid(&siaNTAuth,
@ -116,7 +116,7 @@ K32CreateDBMonMutex(void)
&psidAdministrators); &psidAdministrators);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* allocate the Everyone SID */ /* allocate the Everyone SID */
nErrCode = RtlAllocateAndInitializeSid(&siaWorldAuth, nErrCode = RtlAllocateAndInitializeSid(&siaWorldAuth,
@ -132,7 +132,7 @@ K32CreateDBMonMutex(void)
&psidEveryone); &psidEveryone);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* allocate space for the SIDs too */ /* allocate space for the SIDs too */
nDaclBufSize += RtlLengthSid(psidSystem); nDaclBufSize += RtlLengthSid(psidSystem);
@ -143,13 +143,13 @@ K32CreateDBMonMutex(void)
pDaclBuf = GlobalAlloc(GMEM_FIXED, nDaclBufSize); pDaclBuf = GlobalAlloc(GMEM_FIXED, nDaclBufSize);
/* failure */ /* failure */
if(pDaclBuf == NULL) goto l_Cleanup; if (pDaclBuf == NULL) goto l_Cleanup;
/* create the DACL */ /* create the DACL */
nErrCode = RtlCreateAcl(pDaclBuf, nDaclBufSize, ACL_REVISION); nErrCode = RtlCreateAcl(pDaclBuf, nDaclBufSize, ACL_REVISION);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* grant the minimum required access to Everyone */ /* grant the minimum required access to Everyone */
nErrCode = RtlAddAccessAllowedAce(pDaclBuf, nErrCode = RtlAddAccessAllowedAce(pDaclBuf,
@ -160,7 +160,7 @@ K32CreateDBMonMutex(void)
psidEveryone); psidEveryone);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* grant full access to BUILTIN\Administrators */ /* grant full access to BUILTIN\Administrators */
nErrCode = RtlAddAccessAllowedAce(pDaclBuf, nErrCode = RtlAddAccessAllowedAce(pDaclBuf,
@ -169,7 +169,7 @@ K32CreateDBMonMutex(void)
psidAdministrators); psidAdministrators);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* grant full access to NT AUTHORITY\SYSTEM */ /* grant full access to NT AUTHORITY\SYSTEM */
nErrCode = RtlAddAccessAllowedAce(pDaclBuf, nErrCode = RtlAddAccessAllowedAce(pDaclBuf,
@ -178,14 +178,14 @@ K32CreateDBMonMutex(void)
psidSystem); psidSystem);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* create the security descriptor */ /* create the security descriptor */
nErrCode = RtlCreateSecurityDescriptor(&sdMutexSecurity, nErrCode = RtlCreateSecurityDescriptor(&sdMutexSecurity,
SECURITY_DESCRIPTOR_REVISION); SECURITY_DESCRIPTOR_REVISION);
/* failure */ /* 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 */ /* set the descriptor's DACL to the ACL we created */
nErrCode = RtlSetDaclSecurityDescriptor(&sdMutexSecurity, nErrCode = RtlSetDaclSecurityDescriptor(&sdMutexSecurity,
@ -194,17 +194,17 @@ K32CreateDBMonMutex(void)
FALSE); FALSE);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; if (!NT_SUCCESS(nErrCode)) goto l_Cleanup;
/* create the mutex */ /* create the mutex */
hMutex = CreateMutexW(&saMutexAttribs, FALSE, L"DBWinMutex"); hMutex = CreateMutexW(&saMutexAttribs, FALSE, L"DBWinMutex");
l_Cleanup: l_Cleanup:
/* free the buffers */ /* free the buffers */
if(pDaclBuf) GlobalFree(pDaclBuf); if (pDaclBuf) GlobalFree(pDaclBuf);
if(psidEveryone) RtlFreeSid(psidEveryone); if (psidEveryone) RtlFreeSid(psidEveryone);
if(psidAdministrators) RtlFreeSid(psidAdministrators); if (psidAdministrators) RtlFreeSid(psidAdministrators);
if(psidSystem) RtlFreeSid(psidSystem); if (psidSystem) RtlFreeSid(psidSystem);
return hMutex; return hMutex;
} }
@ -425,8 +425,8 @@ CheckRemoteDebuggerPresent(IN HANDLE hProcess,
/* Check if the process has a debug object/port */ /* Check if the process has a debug object/port */
Status = NtQueryInformationProcess(hProcess, Status = NtQueryInformationProcess(hProcess,
ProcessDebugPort, ProcessDebugPort,
(PVOID)&DebugPort, &DebugPort,
sizeof(HANDLE), sizeof(DebugPort),
NULL); NULL);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
@ -558,7 +558,7 @@ DebugBreakProcess(IN HANDLE Process)
/* Send the breakin request */ /* Send the breakin request */
Status = DbgUiIssueRemoteBreakin(Process); Status = DbgUiIssueRemoteBreakin(Process);
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Failure */ /* Failure */
BaseSetLastNTError(Status); BaseSetLastNTError(Status);
@ -765,7 +765,7 @@ OutputDebugStringA(IN LPCSTR _OutputString)
volatile HANDLE hDBMonDataReady = NULL; volatile HANDLE hDBMonDataReady = NULL;
/* mutex not opened, and no previous attempts to open/create it */ /* mutex not opened, and no previous attempts to open/create it */
if(hDBMonMutex == NULL && !s_bDBMonMutexTriedOpen) if (hDBMonMutex == NULL && !s_bDBMonMutexTriedOpen)
{ {
/* open/create the mutex */ /* open/create the mutex */
hDBMonMutex = K32CreateDBMonMutex(); hDBMonMutex = K32CreateDBMonMutex();
@ -778,7 +778,7 @@ OutputDebugStringA(IN LPCSTR _OutputString)
volatile PCHAR a_cBuffer = NULL; volatile PCHAR a_cBuffer = NULL;
/* opening the mutex failed */ /* opening the mutex failed */
if(hDBMonMutex == NULL) if (hDBMonMutex == NULL)
{ {
/* remember next time */ /* remember next time */
s_bDBMonMutexTriedOpen = TRUE; s_bDBMonMutexTriedOpen = TRUE;
@ -795,7 +795,7 @@ OutputDebugStringA(IN LPCSTR _OutputString)
hDBMonBuffer = OpenFileMappingW(SECTION_MAP_WRITE, FALSE, L"DBWIN_BUFFER"); hDBMonBuffer = OpenFileMappingW(SECTION_MAP_WRITE, FALSE, L"DBWIN_BUFFER");
/* couldn't open the buffer: send the string to the kernel debugger */ /* couldn't open the buffer: send the string to the kernel debugger */
if(hDBMonBuffer == NULL) break; if (hDBMonBuffer == NULL) break;
/* map the buffer */ /* map the buffer */
pDBMonBuffer = MapViewOfFile(hDBMonBuffer, pDBMonBuffer = MapViewOfFile(hDBMonBuffer,
@ -805,13 +805,13 @@ OutputDebugStringA(IN LPCSTR _OutputString)
0); 0);
/* couldn't map the buffer: send the string to the kernel debugger */ /* couldn't map the buffer: send the string to the kernel debugger */
if(pDBMonBuffer == NULL) break; if (pDBMonBuffer == NULL) break;
/* open the event signaling that the buffer can be accessed */ /* open the event signaling that the buffer can be accessed */
hDBMonBufferReady = OpenEventW(SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY"); hDBMonBufferReady = OpenEventW(SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY");
/* couldn't open the event: send the string to the kernel debugger */ /* couldn't open the event: send the string to the kernel debugger */
if(hDBMonBufferReady == NULL) break; if (hDBMonBufferReady == NULL) break;
/* open the event to be signaled when the buffer has been filled */ /* open the event to be signaled when the buffer has been filled */
hDBMonDataReady = OpenEventW(EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY"); hDBMonDataReady = OpenEventW(EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY");
@ -820,7 +820,7 @@ OutputDebugStringA(IN LPCSTR _OutputString)
/* we couldn't connect to the system-wide debug message monitor: send the /* we couldn't connect to the system-wide debug message monitor: send the
string to the kernel debugger */ string to the kernel debugger */
if(hDBMonDataReady == NULL) ReleaseMutex(hDBMonMutex); if (hDBMonDataReady == NULL) ReleaseMutex(hDBMonMutex);
} }
_SEH2_TRY _SEH2_TRY
@ -838,11 +838,11 @@ OutputDebugStringA(IN LPCSTR _OutputString)
{ {
/* we're connected to the debug monitor: /* we're connected to the debug monitor:
write the current block to the shared buffer */ write the current block to the shared buffer */
if(hDBMonDataReady) if (hDBMonDataReady)
{ {
/* wait a maximum of 10 seconds for the debug monitor /* wait a maximum of 10 seconds for the debug monitor
to finish processing the shared buffer */ to finish processing the shared buffer */
if(WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0) if (WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0)
{ {
/* timeout or failure: give up */ /* timeout or failure: give up */
break; break;
@ -852,7 +852,7 @@ OutputDebugStringA(IN LPCSTR _OutputString)
pDBMonBuffer->ProcessId = GetCurrentProcessId(); pDBMonBuffer->ProcessId = GetCurrentProcessId();
/* write only as many bytes as they fit in the buffer */ /* write only as many bytes as they fit in the buffer */
if(nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1)) if (nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1))
nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1; nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1;
else else
nRoundLen = nOutputStringLen; nRoundLen = nOutputStringLen;
@ -879,7 +879,7 @@ OutputDebugStringA(IN LPCSTR _OutputString)
} }
/* write a maximum of 511 bytes */ /* write a maximum of 511 bytes */
if(nOutputStringLen > 510) if (nOutputStringLen > 510)
nRoundLen = 510; nRoundLen = 510;
else else
nRoundLen = nOutputStringLen; nRoundLen = nOutputStringLen;
@ -921,13 +921,13 @@ OutputDebugStringA(IN LPCSTR _OutputString)
_SEH2_FINALLY _SEH2_FINALLY
{ {
/* close all the still open resources */ /* close all the still open resources */
if(hDBMonBufferReady) CloseHandle(hDBMonBufferReady); if (hDBMonBufferReady) CloseHandle(hDBMonBufferReady);
if(pDBMonBuffer) UnmapViewOfFile(pDBMonBuffer); if (pDBMonBuffer) UnmapViewOfFile(pDBMonBuffer);
if(hDBMonBuffer) CloseHandle(hDBMonBuffer); if (hDBMonBuffer) CloseHandle(hDBMonBuffer);
if(hDBMonDataReady) CloseHandle(hDBMonDataReady); if (hDBMonDataReady) CloseHandle(hDBMonDataReady);
/* leave the critical section */ /* leave the critical section */
if(hDBMonDataReady != NULL) if (hDBMonDataReady != NULL)
ReleaseMutex(hDBMonMutex); ReleaseMutex(hDBMonMutex);
} }
_SEH2_END; _SEH2_END;

View file

@ -3,8 +3,8 @@
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
* FILE: dll/win32/kernel32/client/except.c * FILE: dll/win32/kernel32/client/except.c
* PURPOSE: Exception functions * PURPOSE: Exception functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl) * PROGRAMMER: Ariadne (ariadne@xs4all.nl)
* modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ] * Modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ]
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 01/11/98 * Created 01/11/98
*/ */
@ -69,19 +69,19 @@ _dump_context(PCONTEXT pc)
DbgPrint("R8: %08lx R9: %08lx R10: %08lx R11: %08lx\n", pc->R8, pc->R9, pc->R10, pc->R11); 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("R12: %08lx CPSR: %08lx FPSCR: %08lx\n", pc->R12, pc->Cpsr, pc->R1, pc->Fpscr, pc->R3);
#else #else
#error "Unknown architecture" #error "Unknown architecture"
#endif #endif
} }
static VOID static VOID
PrintStackTrace(struct _EXCEPTION_POINTERS *ExceptionInfo) PrintStackTrace(IN PEXCEPTION_POINTERS ExceptionInfo)
{ {
PVOID StartAddr; PVOID StartAddr;
CHAR szMod[128] = ""; CHAR szMod[128] = "";
PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord; PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord;
PCONTEXT ContextRecord = ExceptionInfo->ContextRecord; PCONTEXT ContextRecord = ExceptionInfo->ContextRecord;
/* Print a stack trace. */ /* Print a stack trace */
DbgPrint("Unhandled exception\n"); DbgPrint("Unhandled exception\n");
DbgPrint("ExceptionCode: %8x\n", ExceptionRecord->ExceptionCode); DbgPrint("ExceptionCode: %8x\n", ExceptionRecord->ExceptionCode);
@ -91,7 +91,7 @@ PrintStackTrace(struct _EXCEPTION_POINTERS *ExceptionInfo)
DbgPrint("Faulting Address: %8x\n", ExceptionRecord->ExceptionInformation[1]); DbgPrint("Faulting Address: %8x\n", ExceptionRecord->ExceptionInformation[1]);
} }
_dump_context (ContextRecord); _dump_context(ContextRecord);
_module_name_from_addr(ExceptionRecord->ExceptionAddress, &StartAddr, szMod, sizeof(szMod)); _module_name_from_addr(ExceptionRecord->ExceptionAddress, &StartAddr, szMod, sizeof(szMod));
DbgPrint("Address:\n %8x+%-8x %s\n", DbgPrint("Address:\n %8x+%-8x %s\n",
(PVOID)StartAddr, (PVOID)StartAddr,
@ -368,9 +368,7 @@ RaiseException(IN DWORD dwExceptionCode,
{ {
/* We do, normalize the count */ /* We do, normalize the count */
if (nNumberOfArguments > EXCEPTION_MAXIMUM_PARAMETERS) if (nNumberOfArguments > EXCEPTION_MAXIMUM_PARAMETERS)
{
nNumberOfArguments = EXCEPTION_MAXIMUM_PARAMETERS; nNumberOfArguments = EXCEPTION_MAXIMUM_PARAMETERS;
}
/* Set the count of parameters and copy them */ /* Set the count of parameters and copy them */
ExceptionRecord.NumberParameters = nNumberOfArguments; ExceptionRecord.NumberParameters = nNumberOfArguments;
@ -388,7 +386,7 @@ RaiseException(IN DWORD dwExceptionCode,
} }
/* Trace the wine special error and show the modulename and functionname */ /* 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 */ /* Numbers of parameter must be equal to two */
if (ExceptionRecord.NumberParameters == 2) if (ExceptionRecord.NumberParameters == 2)