Author: hbelusca
Date: Thu Jun 30 14:00:34 2016
New Revision: 71703
URL:
http://svn.reactos.org/svn/reactos?rev=71703&view=rev
Log:
[KERNEL32]
- Whitespace fixes (dosdev.c, except.c, loader.c)
- except.c: Remove some unneeded casts; NtQueryInformationProcess for
'ProcessDebugPort' is implemented and therefore it will never return
STATUS_NOT_IMPLEMENTED.
Modified:
trunk/reactos/dll/win32/kernel32/client/dosdev.c
trunk/reactos/dll/win32/kernel32/client/except.c
trunk/reactos/dll/win32/kernel32/client/loader.c
Modified: trunk/reactos/dll/win32/kernel32/client/dosdev.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/dosdev.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/dosdev.c [iso-8859-1] Thu Jun 30 14:00:34
2016
@@ -442,7 +442,7 @@
if (Length + NameLength + 1 >= ucchMax)
{
Length = 0;
- BaseSetLastNTError (STATUS_BUFFER_TOO_SMALL);
+ BaseSetLastNTError(STATUS_BUFFER_TOO_SMALL);
break;
}
Modified: trunk/reactos/dll/win32/kernel32/client/except.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] Thu Jun 30 14:00:34
2016
@@ -85,7 +85,7 @@
DbgPrint("Unhandled exception\n");
DbgPrint("ExceptionCode: %8x\n", ExceptionRecord->ExceptionCode);
- if ((NTSTATUS)ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION
&&
+ if (ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
ExceptionRecord->NumberParameters == 2)
{
DbgPrint("Faulting Address: %8x\n",
ExceptionRecord->ExceptionInformation[1]);
@@ -209,7 +209,7 @@
/* Query the current setting */
Status = NtQueryInformationProcess(NtCurrentProcess(),
ProcessDefaultHardErrorMode,
- (PVOID)&ErrMode,
+ &ErrMode,
sizeof(ErrMode),
NULL);
if (!NT_SUCCESS(Status))
@@ -238,97 +238,106 @@
/*
* @implemented
*/
-LONG WINAPI
-UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
-{
- LONG RetValue;
- HANDLE DebugPort = NULL;
- NTSTATUS ErrCode;
- ULONG_PTR ErrorParameters[4];
- ULONG ErrorResponse;
- PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord;
- LPTOP_LEVEL_EXCEPTION_FILTER RealFilter;
-
- if ((NTSTATUS)ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
- ExceptionRecord->NumberParameters >= 2)
- {
- switch(ExceptionRecord->ExceptionInformation[0])
- {
- case EXCEPTION_WRITE_FAULT:
- /* Change the protection on some write attempts, some InstallShield setups
- have this bug */
- RetValue = BasepCheckForReadOnlyResource(
- (PVOID)ExceptionRecord->ExceptionInformation[1]);
- if (RetValue == EXCEPTION_CONTINUE_EXECUTION)
- return EXCEPTION_CONTINUE_EXECUTION;
- break;
- case EXCEPTION_EXECUTE_FAULT:
- /* FIXME */
- break;
- }
- }
-
- /* Is there a debugger running ? */
- ErrCode = NtQueryInformationProcess(NtCurrentProcess(), ProcessDebugPort,
- &DebugPort, sizeof(HANDLE), NULL);
- if (!NT_SUCCESS(ErrCode) && ErrCode != STATUS_NOT_IMPLEMENTED)
- {
- BaseSetLastNTError(ErrCode);
- return EXCEPTION_EXECUTE_HANDLER;
- }
-
- if (DebugPort)
- {
- /* Pass the exception to debugger. */
- DPRINT("Passing exception to debugger\n");
- return EXCEPTION_CONTINUE_SEARCH;
- }
-
- RealFilter = RtlDecodePointer(GlobalTopLevelExceptionFilter);
- if (RealFilter)
- {
- LONG ret = RealFilter(ExceptionInfo);
- if (ret != EXCEPTION_CONTINUE_SEARCH)
- return ret;
- }
-
- PrintStackTrace(ExceptionInfo);
-
- /* Save exception code and address */
- ErrorParameters[0] = (ULONG)ExceptionRecord->ExceptionCode;
- ErrorParameters[1] = (ULONG_PTR)ExceptionRecord->ExceptionAddress;
-
- if ((NTSTATUS)ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION)
- {
- /* get the type of operation that caused the access violation */
- ErrorParameters[2] = ExceptionRecord->ExceptionInformation[0];
- }
- else
- {
- ErrorParameters[2] = ExceptionRecord->ExceptionInformation[2];
- }
-
- /* Save faulting address */
- ErrorParameters[3] = ExceptionRecord->ExceptionInformation[1];
-
- /* Raise the harderror */
- ErrCode = NtRaiseHardError(STATUS_UNHANDLED_EXCEPTION,
- 4, 0, ErrorParameters, OptionOkCancel, &ErrorResponse);
-
- if (NT_SUCCESS(ErrCode) && (ErrorResponse == ResponseCancel))
- {
- /* FIXME: Check the result, if the "Cancel" button was
- clicked run a debugger */
- DPRINT1("Debugging is not implemented yet\n");
- }
-
- /*
- * Returning EXCEPTION_EXECUTE_HANDLER means that the code in
- * the __except block will be executed. Normally this will end up in a
- * Terminate process.
- */
-
- return EXCEPTION_EXECUTE_HANDLER;
+LONG
+WINAPI
+UnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
+{
+ NTSTATUS Status;
+ LONG RetValue;
+ HANDLE DebugPort = NULL;
+ ULONG_PTR ErrorParameters[4];
+ ULONG ErrorResponse;
+ PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord;
+ LPTOP_LEVEL_EXCEPTION_FILTER RealFilter;
+
+ if (ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
+ ExceptionRecord->NumberParameters >= 2)
+ {
+ switch(ExceptionRecord->ExceptionInformation[0])
+ {
+ case EXCEPTION_WRITE_FAULT:
+ /* Change the protection on some write attempts, some InstallShield
setups
+ have this bug */
+ RetValue = BasepCheckForReadOnlyResource(
+ (PVOID)ExceptionRecord->ExceptionInformation[1]);
+ if (RetValue == EXCEPTION_CONTINUE_EXECUTION)
+ return EXCEPTION_CONTINUE_EXECUTION;
+ break;
+
+ case EXCEPTION_EXECUTE_FAULT:
+ /* FIXME */
+ break;
+ }
+ }
+
+ /* Is there a debugger running? */
+ Status = NtQueryInformationProcess(NtCurrentProcess(),
+ ProcessDebugPort,
+ &DebugPort,
+ sizeof(DebugPort),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ BaseSetLastNTError(Status);
+ return EXCEPTION_EXECUTE_HANDLER;
+ }
+
+ if (DebugPort)
+ {
+ /* Pass the exception to debugger. */
+ DPRINT("Passing exception to debugger\n");
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
+ RealFilter = RtlDecodePointer(GlobalTopLevelExceptionFilter);
+ if (RealFilter)
+ {
+ LONG ret = RealFilter(ExceptionInfo);
+ if (ret != EXCEPTION_CONTINUE_SEARCH)
+ return ret;
+ }
+
+ PrintStackTrace(ExceptionInfo);
+
+ /* Save exception code and address */
+ ErrorParameters[0] = (ULONG)ExceptionRecord->ExceptionCode;
+ ErrorParameters[1] = (ULONG_PTR)ExceptionRecord->ExceptionAddress;
+
+ if (ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION)
+ {
+ /* get the type of operation that caused the access violation */
+ ErrorParameters[2] = ExceptionRecord->ExceptionInformation[0];
+ }
+ else
+ {
+ ErrorParameters[2] = ExceptionRecord->ExceptionInformation[2];
+ }
+
+ /* Save faulting address */
+ ErrorParameters[3] = ExceptionRecord->ExceptionInformation[1];
+
+ /* Raise the harderror */
+ Status = NtRaiseHardError(STATUS_UNHANDLED_EXCEPTION,
+ 4,
+ 0,
+ ErrorParameters,
+ OptionOkCancel,
+ &ErrorResponse);
+
+ if (NT_SUCCESS(Status) && (ErrorResponse == ResponseCancel))
+ {
+ /* FIXME: Check the result, if the "Cancel" button was
+ clicked run a debugger */
+ DPRINT1("Debugging is not implemented yet\n");
+ }
+
+ /*
+ * Returning EXCEPTION_EXECUTE_HANDLER means that the code in
+ * the __except block will be executed. Normally this will end up in a
+ * Terminate process.
+ */
+
+ return EXCEPTION_EXECUTE_HANDLER;
}
/*
Modified: trunk/reactos/dll/win32/kernel32/client/loader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] Thu Jun 30 14:00:34
2016
@@ -177,7 +177,7 @@
LoadLibraryW(LPCWSTR lpLibFileName)
{
/* Call Ex version of the API */
- return LoadLibraryExW (lpLibFileName, 0, 0);
+ return LoadLibraryExW(lpLibFileName, 0, 0);
}