Author: ion Date: Sat Jul 23 18:48:32 2011 New Revision: 52816
URL: http://svn.reactos.org/svn/reactos?rev=52816&view=rev Log: [KERNEL32]: Get rid of RestoreLastError, it's a forward. [KERNEL32]: SetLastError should only set the error code if it's different from the one already set. This is not about optimization: it's compatibility with hardware data breakpoint behavior.
Modified: trunk/reactos/dll/win32/kernel32/client/except.c
Modified: trunk/reactos/dll/win32/kernel32/client/except.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/e... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] Sat Jul 23 18:48:32 2011 @@ -660,20 +660,13 @@ */ VOID WINAPI -SetLastError( - IN DWORD dwErrCode) -{ - if (g_dwLastErrorToBreakOn) - { - /* If we have error to break on and if current matches, break */ - if (g_dwLastErrorToBreakOn == dwErrCode) - { - DbgBreakPoint(); - } - } - - /* Set last error */ - NtCurrentTeb()->LastErrorValue = dwErrCode; +SetLastError(IN DWORD dwErrCode) +{ + /* Break if a debugger requested checking for this error code */ + if ((g_dwLastErrorToBreakOn) && (g_dwLastErrorToBreakOn == dwErrCode)) DbgBreakPoint(); + + /* Set last error if it's a new error */ + if (NtCurrentTeb()->LastErrorValue != dwErrCode) NtCurrentTeb()->LastErrorValue = dwErrCode; }
/* @@ -681,9 +674,9 @@ */ VOID WINAPI -BaseSetLastNTError( - IN NTSTATUS Status) -{ +BaseSetLastNTError(IN NTSTATUS Status) +{ + /* Convert from NT to Win32, then set */ SetLastError(RtlNtStatusToDosError(Status)); }
@@ -692,22 +685,10 @@ */ DWORD WINAPI -GetLastError() -{ +GetLastError(VOID) +{ + /* Return the current value */ return NtCurrentTeb()->LastErrorValue; }
-/* - * @unimplemented - */ -VOID -WINAPI -RestoreLastError( - DWORD dwErrCode - ) -{ - STUB; -} - - /* EOF */