ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2005
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
23 participants
669 discussions
Start a n
N
ew thread
[turner] 17469: Fix a CD bug spotted by ravelo_. This is simlair to bug 690. cd foo\"bar", cd "foo"\"bar"" and other of the sorts are all valid.
by turner@svn.reactos.com
Fix a CD bug spotted by ravelo_. This is simlair to bug 690. cd foo\"bar", cd "foo"\"bar"" and other of the sorts are all valid. Modified: trunk/reactos/subsys/system/cmd/internal.c _____ Modified: trunk/reactos/subsys/system/cmd/internal.c --- trunk/reactos/subsys/system/cmd/internal.c 2005-08-21 19:35:19 UTC (rev 17468) +++ trunk/reactos/subsys/system/cmd/internal.c 2005-08-21 20:44:47 UTC (rev 17469) @@ -315,19 +315,16 @@ /* Get Current Directory */ GetRootPath(_T("."),szCurrent,MAX_PATH); - /* Remove " */ - if(szPath[0] == _T('\"')) + /* Remove " */ + i = 0; + while(i < _tcslen(szPath)) { - tmpPath = _tcsstr(szPath,_T("\"")); - tmpPath++; - _tcscpy(szPath,tmpPath); + if(szPath[i] == _T('\"')) + memmove(&szPath[i],&szPath[i + 1], _tcslen(&szPath[i]) * sizeof(TCHAR)); + else + i++; } - if(szPath[_tcslen(szPath) - 1] == _T('\"')) - { - szPath[_tcslen(szPath) - 1] = _T('\0'); - } - tmpPath = szPath; while (_istspace (*tmpPath)) tmpPath++; @@ -339,7 +336,7 @@ return 0; } - + /* change to full path if relative path was given */ GetFullPathName(szPath,MAX_PATH,szFinalPath,NULL);
19 years, 4 months
1
0
0
0
[sedwards] 17468: prompt to configure for Mingw after building project files
by sedwards@svn.reactos.com
prompt to configure for Mingw after building project files Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp _____ Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp --- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp 2005-08-21 19:04:23 UTC (rev 17467) +++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp 2005-08-21 19:35:19 UTC (rev 17468) @@ -26,9 +26,12 @@ #include <string> #include "msvc.h" +#include "../mingw/mingw.h" using namespace std; +char get_key(char *valid,char *prompt); //FIXME +bool spawn_new(const string& cmd); //FIXME void gen_guid(); static class MSVCFactory : public Backend::Factory @@ -53,6 +56,9 @@ void MSVCBackend::Process() { + bool exec = false; + const char rbuild_mingw[] = "output-i386\\tools\\rbuild\\rbuild.exe mingw"; + string filename = ProjectNode.name + ".sln"; cout << "Creating MSVC project: " << filename << endl; @@ -84,21 +90,25 @@ m_devFile << " EndGlobalSection" << endl; m_devFile << "EndGlobal" << endl; - OutputFolders(); - m_devFile << endl << endl; - OutputFileUnits(); + m_devFile.close(); - m_devFile.close(); - + gen_guid(); + // The MSVC build still needs the mingw backend. - + ProcessModules(); + cout << "Done." << endl << endl; cout << "Don't expect the MSVC backend to work yet. "<< endl << endl; - gen_guid(); + if(get_key("yn","Would you like to configure for a Mingw build as well? (y/n)") == 'y') + { + exec = spawn_new(rbuild_mingw); + if (!exec) + printf("\nError invoking rbuild\n"); + } } void MSVCBackend::ProcessModules() @@ -206,20 +216,31 @@ } } -void MSVCBackend::OutputFileUnits() + +char get_key(char *valid,char *prompt) { - for(size_t i = 0; i < m_fileUnits.size(); i++) - { - m_devFile << "[Unit" << i + 1 << "]" << endl; - + int ch,okay; - m_devFile << "FileName=" << m_fileUnits[i].filename << endl; - m_devFile << "CompileCpp=1" << endl; - m_devFile << "Folder=" << m_fileUnits[i].folder << endl; - m_devFile << "Compile=1" << endl; - m_devFile << "Link=1" << endl; - m_devFile << "Priority=1000" << endl; - m_devFile << "OverrideBuildCmd=0" << endl; - m_devFile << "BuildCmd=" << endl << endl;; - } + while (1) { + if (prompt) printf("%s ",prompt); + fflush(stdout); + while (ch = getchar(), ch == ' ' || ch == '\t'); + if (ch == EOF) exit(1); + if (!strchr(valid,okay = ch)) okay = 0; + while (ch = getchar(), ch != '\n' && ch != EOF); + if (ch == EOF) exit(1); + if (okay) return okay; + printf("Invalid input.\n"); + } } + +bool spawn_new( const string& cmd ) +{ + string command = ssprintf ( + "%s", + cmd.c_str (), + NUL, + NUL ); + int exitcode = system ( command.c_str () ); + return (exitcode == 0); +}
19 years, 4 months
1
0
0
0
[weiden] 17467: - use inlined probing macros for basic types
by weiden@svn.reactos.com
- use inlined probing macros for basic types - minor optimizations by comparing the processor mode against KernelMode (==0) instead of UserMode (==1) Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c Modified: trunk/reactos/ntoskrnl/ex/event.c Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c Modified: trunk/reactos/ntoskrnl/include/internal/ob.h Modified: trunk/reactos/ntoskrnl/io/file.c Modified: trunk/reactos/ntoskrnl/io/iocomp.c Modified: trunk/reactos/ntoskrnl/io/plugplay.c Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c Modified: trunk/reactos/ntoskrnl/ke/apc.c Modified: trunk/reactos/ntoskrnl/ke/catch.c Modified: trunk/reactos/ntoskrnl/ke/i386/fpu.c Modified: trunk/reactos/ntoskrnl/ke/kthread.c Modified: trunk/reactos/ntoskrnl/ke/queue.c Modified: trunk/reactos/ntoskrnl/ke/wait.c Modified: trunk/reactos/ntoskrnl/lpc/connect.c Modified: trunk/reactos/ntoskrnl/mm/mdl.c Modified: trunk/reactos/ntoskrnl/mm/pagefile.c Modified: trunk/reactos/ntoskrnl/mm/section.c Modified: trunk/reactos/ntoskrnl/mm/virtual.c Modified: trunk/reactos/ntoskrnl/ob/dirobj.c Modified: trunk/reactos/ntoskrnl/ob/handle.c Modified: trunk/reactos/ntoskrnl/ob/symlink.c Modified: trunk/reactos/ntoskrnl/ob/wait.c Modified: trunk/reactos/ntoskrnl/ps/job.c Modified: trunk/reactos/ntoskrnl/ps/security.c Modified: trunk/reactos/ntoskrnl/ps/suspend.c Modified: trunk/reactos/ntoskrnl/rtl/capture.c Modified: trunk/reactos/ntoskrnl/se/acl.c Modified: trunk/reactos/ntoskrnl/se/sd.c Modified: trunk/reactos/ntoskrnl/se/sid.c Modified: trunk/reactos/ntoskrnl/se/token.c _____ Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c --- trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -1145,9 +1145,7 @@ { _SEH_TRY { - ProbeForWrite(KeyHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(KeyHandle); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/ex/event.c --- trunk/reactos/ntoskrnl/ex/event.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ex/event.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -242,7 +242,7 @@ EventHandle, PreviousState); /* Check buffer validity */ - if(PreviousState && PreviousMode == UserMode) { + if(PreviousState && PreviousMode != KernelMode) { _SEH_TRY { @@ -376,7 +376,7 @@ EventHandle, PreviousState); /* Check buffer validity */ - if(PreviousState && PreviousMode == UserMode) { + if(PreviousState && PreviousMode != KernelMode) { _SEH_TRY { @@ -441,7 +441,7 @@ EventHandle, PreviousState); /* Check buffer validity */ - if(PreviousState != NULL && PreviousMode == UserMode) { + if(PreviousState != NULL && PreviousMode != KernelMode) { _SEH_TRY { _____ Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c --- trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -1541,7 +1541,7 @@ _SEH_TRY { - if (PreviousMode == UserMode) + if (PreviousMode != KernelMode) { /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */ ProbeForWrite(SystemInformation, Length, 1); _____ Modified: trunk/reactos/ntoskrnl/include/internal/ob.h --- trunk/reactos/ntoskrnl/include/internal/ob.h 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/include/internal/ob.h 2005-08-21 19:04:23 UTC (rev 17467) @@ -261,7 +261,7 @@ #define ProbeQueryInfoBuffer(Buffer, BufferLen, Alignment, RetLen, PrevMode, StatusVar) \ do { \ - if(PrevMode == UserMode) \ + if(PrevMode != KernelMode) \ { \ _SEH_TRY \ { \ @@ -291,7 +291,7 @@ #define ProbeSetInfoBuffer(Buffer, BufferLen, Alignment, PrevMode, StatusVar) \ do { \ - if(PrevMode == UserMode) \ + if(PrevMode != KernelMode) \ { \ _SEH_TRY \ { \ _____ Modified: trunk/reactos/ntoskrnl/io/file.c --- trunk/reactos/ntoskrnl/io/file.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/io/file.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -781,18 +781,13 @@ { _SEH_TRY { - ProbeForWrite(FileHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(FileHandle); ProbeForWrite(IoStatusBlock, sizeof(IO_STATUS_BLOCK), sizeof(ULONG)); if(AllocationSize != NULL) { - ProbeForRead(AllocationSize, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - SafeAllocationSize = *AllocationSize; + SafeAllocationSize = ProbeForReadLargeInteger(AllocationSize); } else SafeAllocationSize.QuadPart = 0; @@ -1395,7 +1390,7 @@ LARGE_INTEGER Interval; if ((ULONG_PTR)IoStatusBlock >= (ULONG_PTR)MmUserProbeAddress && - KeGetPreviousMode() == UserMode) + KeGetPreviousMode() != KernelMode) return STATUS_ACCESS_VIOLATION; Status = ObReferenceObjectByHandle(FileHandle, 0, IoFileObjectType, _____ Modified: trunk/reactos/ntoskrnl/io/iocomp.c --- trunk/reactos/ntoskrnl/io/iocomp.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/io/iocomp.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -237,9 +237,7 @@ _SEH_TRY { - ProbeForWrite(IoCompletionHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(IoCompletionHandle); } _SEH_HANDLE { Status = _SEH_GetExceptionCode(); @@ -309,9 +307,7 @@ _SEH_TRY { - ProbeForWrite(IoCompletionHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(IoCompletionHandle); } _SEH_HANDLE { Status = _SEH_GetExceptionCode(); @@ -432,21 +428,14 @@ _SEH_TRY { - ProbeForWrite(CompletionKey, - sizeof(PVOID), - sizeof(ULONG)); - ProbeForWrite(CompletionContext, - sizeof(PVOID), - sizeof(ULONG)); + ProbeForWritePointer(CompletionKey); + ProbeForWritePointer(CompletionContext); ProbeForWrite(IoStatusBlock, sizeof(IO_STATUS_BLOCK), sizeof(ULONG)); if (Timeout != NULL) { - ProbeForRead(Timeout, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - SafeTimeout = *Timeout; + SafeTimeout = ProbeForReadLargeInteger(Timeout); Timeout = &SafeTimeout; } } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/io/plugplay.c --- trunk/reactos/ntoskrnl/io/plugplay.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/io/plugplay.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -173,7 +173,7 @@ DPRINT("NtGetPlugPlayEvent() called\n"); /* Function can only be called from user-mode */ - if (KeGetPreviousMode() != UserMode) + if (KeGetPreviousMode() == KernelMode) { DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n"); return STATUS_ACCESS_DENIED; @@ -636,7 +636,7 @@ PlugPlayControlClass, Buffer, BufferLength); /* Function can only be called from user-mode */ - if (KeGetPreviousMode() != UserMode) + if (KeGetPreviousMode() == KernelMode) { DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n"); return STATUS_ACCESS_DENIED; _____ Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c --- trunk/reactos/ntoskrnl/kdbg/kdb.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/kdbg/kdb.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -1206,7 +1206,7 @@ ul = min(ExpNr, RTL_NUMBER_OF(KdbEnterConditions) - 1); EnterCondition = KdbEnterConditions[ul][FirstChance ? 0 : 1]; if (EnterCondition == KdbDoNotEnter || - (EnterCondition == KdbEnterFromUmode && PreviousMode != UserMode) || + (EnterCondition == KdbEnterFromUmode && PreviousMode == KernelMode) || (EnterCondition == KdbEnterFromKmode && PreviousMode != KernelMode)) { EnterConditionMet = FALSE; _____ Modified: trunk/reactos/ntoskrnl/ke/apc.c --- trunk/reactos/ntoskrnl/ke/apc.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ke/apc.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -360,7 +360,7 @@ } } else if ((Thread->State == Waiting) && - (Thread->WaitMode == UserMode) && + (Thread->WaitMode != KernelMode) && (Thread->Alertable)) { DPRINT("Waking up Thread for User-Mode APC Delivery \n"); @@ -703,7 +703,7 @@ /* Now we do the User APCs */ if ((!IsListEmpty(&Thread->ApcState.ApcListHead[UserMode])) && - (DeliveryMode == UserMode) && (Thread->ApcState.UserApcPending == TRUE)) { + (DeliveryMode != KernelMode) && (Thread->ApcState.UserApcPending == TRUE)) { /* It's not pending anymore */ Thread->ApcState.UserApcPending = FALSE; _____ Modified: trunk/reactos/ntoskrnl/ke/catch.c --- trunk/reactos/ntoskrnl/ke/catch.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ke/catch.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -63,7 +63,7 @@ TContext.ContextFlags = CONTEXT_FULL; /* Check the mode */ - if (PreviousMode == UserMode) + if (PreviousMode != KernelMode) { /* Add Debugger Registers if this is User Mode */ TContext.ContextFlags = TContext.ContextFlags | CONTEXT_DEBUGGER; @@ -91,7 +91,7 @@ if (Action != kdDoNotHandleException) { /* See what kind of Exception this is */ - if (PreviousMode == UserMode) + if (PreviousMode != KernelMode) { /* User mode exception, search the frames if we have to */ if (SearchFrames) _____ Modified: trunk/reactos/ntoskrnl/ke/i386/fpu.c --- trunk/reactos/ntoskrnl/ke/i386/fpu.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ke/i386/fpu.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -498,7 +498,7 @@ PreviousMode = ((Tf->Cs & 0xffff) == USER_CS) ? (UserMode) : (KernelMode); DPRINT("Math/Xmm fault happened! (PreviousMode = %s)\n", - (PreviousMode == UserMode) ? ("UserMode") : ("KernelMode")); + (PreviousMode != KernelMode) ? ("UserMode") : ("KernelMode")); ASSERT(NpxThread == CurrentThread); /* FIXME: Is not always true I think */ _____ Modified: trunk/reactos/ntoskrnl/ke/kthread.c --- trunk/reactos/ntoskrnl/ke/kthread.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ke/kthread.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -1435,7 +1435,7 @@ Thread->Alerted[AlertMode] = FALSE; - } else if ((AlertMode == UserMode) && (!IsListEmpty(&Thread->ApcState.ApcListHead[UserMode]))) { + } else if ((AlertMode != KernelMode) && (!IsListEmpty(&Thread->ApcState.ApcListHead[UserMode]))) { /* If the mode is User and the Queue isn't empty, set Pending */ Thread->ApcState.UserApcPending = TRUE; @@ -1480,9 +1480,7 @@ _SEH_TRY { - ProbeForWrite(SuspendCount, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteUlong(SuspendCount); } _SEH_HANDLE { @@ -1578,26 +1576,30 @@ /* Check if parameters are valid */ if(PreviousMode != KernelMode) { + Status = STATUS_SUCCESS; + _SEH_TRY { - ProbeForRead(DelayInterval, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - /* make a copy on the kernel stack and let DelayInterval point to it so we don't need to wrap KeDelayExecutionThread in SEH! */ - SafeInterval = *DelayInterval; + SafeInterval = ProbeForReadLargeInteger(DelayInterval); + DelayInterval = &SafeInterval; } _SEH_HANDLE { Status = _SEH_GetExceptionCode(); } _SEH_END; + + if (!NT_SUCCESS(Status)) + { + return Status; + } } /* Call the Kernel Function */ Status = KeDelayExecutionThread(PreviousMode, Alertable, - &SafeInterval); + DelayInterval); /* Return Status */ return Status; _____ Modified: trunk/reactos/ntoskrnl/ke/queue.c --- trunk/reactos/ntoskrnl/ke/queue.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ke/queue.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -223,7 +223,7 @@ Thread->WaitBlockList = &Thread->WaitBlock[0]; /* Fail if there's an APC Pending */ - if (WaitMode == UserMode && Thread->ApcState.UserApcPending) { + if (WaitMode != KernelMode && Thread->ApcState.UserApcPending) { /* Return the status and increase the pending threads */ ListEntry = (PLIST_ENTRY)STATUS_USER_APC; _____ Modified: trunk/reactos/ntoskrnl/ke/wait.c --- trunk/reactos/ntoskrnl/ke/wait.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ke/wait.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -47,7 +47,7 @@ /* If there are User APCs Pending, then we can't really be alertable */ } else if ((!IsListEmpty(&CurrentThread->ApcState.ApcListHead[UserMode])) && - (WaitMode == UserMode)) { + (WaitMode != KernelMode)) { DPRINT("APCs are Pending\n"); CurrentThread->ApcState.UserApcPending = TRUE; @@ -55,7 +55,7 @@ } /* If there are User APCs Pending and we are waiting in usermode, then we must notify the caller */ - } else if ((CurrentThread->ApcState.UserApcPending) && (WaitMode == UserMode)) { + } else if ((CurrentThread->ApcState.UserApcPending) && (WaitMode != KernelMode)) { DPRINT("APCs are Pending\n"); *Status = STATUS_USER_APC; } _____ Modified: trunk/reactos/ntoskrnl/lpc/connect.c --- trunk/reactos/ntoskrnl/lpc/connect.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/lpc/connect.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -265,14 +265,10 @@ { _SEH_TRY { - ProbeForWrite(UnsafeConnectedPortHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(UnsafeConnectedPortHandle); if (UnsafeMaximumMessageSize != NULL) { - ProbeForWrite(UnsafeMaximumMessageSize, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(UnsafeMaximumMessageSize); } } _SEH_HANDLE @@ -341,10 +337,7 @@ { _SEH_TRY { - ProbeForRead(UnsafeConnectDataLength, - sizeof(ULONG), - 1); - ConnectDataLength = *UnsafeConnectDataLength; + ConnectDataLength = ProbeForReadUlong(UnsafeConnectDataLength); } _SEH_HANDLE { @@ -374,9 +367,7 @@ { _SEH_TRY { - ProbeForWrite(UnsafeConnectData, - ConnectDataLength, - 1); + ProbeForWriteUlong(UnsafeConnectData); RtlCopyMemory(ConnectData, UnsafeConnectData, ConnectDataLength); _____ Modified: trunk/reactos/ntoskrnl/mm/mdl.c --- trunk/reactos/ntoskrnl/mm/mdl.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/mm/mdl.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -778,7 +778,7 @@ /* Calculate the number of pages required. */ PageCount = PAGE_ROUND_UP(Mdl->ByteCount + Mdl->ByteOffset) / PAGE_SIZE; - if (AccessMode == UserMode) + if (AccessMode != KernelMode) { MEMORY_AREA *Result; LARGE_INTEGER BoundaryAddressMultiple; @@ -885,7 +885,7 @@ { return NULL; } - if (AccessMode == UserMode) + if (AccessMode != KernelMode) { /* Throw exception */ ExRaiseStatus(STATUS_ACCESS_VIOLATION); _____ Modified: trunk/reactos/ntoskrnl/mm/pagefile.c --- trunk/reactos/ntoskrnl/mm/pagefile.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/mm/pagefile.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -801,18 +801,12 @@ { return(Status); } - if (PreviousMode == UserMode) + if (PreviousMode != KernelMode) { _SEH_TRY { - ProbeForRead(InitialSize, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - SafeInitialSize = *InitialSize; - ProbeForRead(MaximumSize, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - SafeMaximumSize = *MaximumSize; + SafeInitialSize = ProbeForReadLargeInteger(InitialSize); + SafeMaximumSize = ProbeForReadLargeInteger(MaximumSize); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/mm/section.c --- trunk/reactos/ntoskrnl/mm/section.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/mm/section.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -3317,11 +3317,8 @@ { _SEH_TRY { - ProbeForRead(MaximumSize, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); /* make a copy on the stack */ - SafeMaximumSize = *MaximumSize; + SafeMaximumSize = ProbeForReadLargeInteger(MaximumSize); MaximumSize = &SafeMaximumSize; } _SEH_HANDLE @@ -3401,9 +3398,7 @@ { _SEH_TRY { - ProbeForWrite(SectionHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(SectionHandle); } _SEH_HANDLE { @@ -3573,21 +3568,15 @@ { if(BaseAddress != NULL) { - ProbeForWrite(BaseAddress, - sizeof(PVOID), - sizeof(ULONG)); + ProbeForWritePointer(BaseAddress); SafeBaseAddress = *BaseAddress; } if(SectionOffset != NULL) { - ProbeForWrite(SectionOffset, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); + ProbeForWriteLargeInteger(SectionOffset); SafeSectionOffset = *SectionOffset; } - ProbeForWrite(ViewSize, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(ViewSize); SafeViewSize = *ViewSize; } _SEH_HANDLE @@ -4133,11 +4122,8 @@ { _SEH_TRY { - ProbeForRead(NewMaximumSize, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); /* make a copy on the stack */ - SafeNewMaximumSize = *NewMaximumSize; + SafeNewMaximumSize = ProbeForReadLargeInteger(NewMaximumSize); NewMaximumSize = &SafeNewMaximumSize; } _SEH_HANDLE _____ Modified: trunk/reactos/ntoskrnl/mm/virtual.c --- trunk/reactos/ntoskrnl/mm/virtual.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/mm/virtual.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -303,9 +303,7 @@ { _SEH_TRY { - ProbeForWrite(UnsafeResultLength, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(UnsafeResultLength); } _SEH_HANDLE { @@ -458,15 +456,9 @@ { _SEH_TRY { - ProbeForWrite(UnsafeBaseAddress, - sizeof(PVOID), - sizeof(ULONG)); - ProbeForWrite(UnsafeBaseAddress, - sizeof(ULONG), - sizeof(ULONG)); - ProbeForWrite(UnsafeOldAccessProtection, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWritePointer(UnsafeBaseAddress); + ProbeForWriteUlong(UnsafeNumberOfBytesToProtect); + ProbeForWriteUlong(UnsafeOldAccessProtection); BaseAddress = *UnsafeBaseAddress; NumberOfBytesToProtect = *UnsafeNumberOfBytesToProtect; @@ -573,9 +565,7 @@ 1); if(NumberOfBytesRead != NULL) { - ProbeForWrite(NumberOfBytesRead, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(NumberOfBytesRead); } } _SEH_HANDLE @@ -776,9 +766,7 @@ { _SEH_TRY { - ProbeForWrite(NumberOfBytesWritten, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(NumberOfBytesWritten); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/ob/dirobj.c --- trunk/reactos/ntoskrnl/ob/dirobj.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ob/dirobj.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -58,9 +58,7 @@ { _SEH_TRY { - ProbeForWrite(DirectoryHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(DirectoryHandle); } _SEH_HANDLE { @@ -186,18 +184,14 @@ ProbeForWrite(Buffer, BufferLength, sizeof(WCHAR)); - ProbeForWrite(Context, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(Context); if(!RestartScan) { SkipEntries = *Context; } if(ReturnLength != NULL) { - ProbeForWrite(ReturnLength, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(ReturnLength); } } _SEH_HANDLE @@ -449,9 +443,7 @@ { _SEH_TRY { - ProbeForWrite(DirectoryHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(DirectoryHandle); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/ob/handle.c --- trunk/reactos/ntoskrnl/ob/handle.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ob/handle.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -388,9 +388,7 @@ { _SEH_TRY { - ProbeForWrite(TargetHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(TargetHandle); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/ob/symlink.c --- trunk/reactos/ntoskrnl/ob/symlink.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ob/symlink.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -186,9 +186,7 @@ { _SEH_TRY { - ProbeForWrite(LinkHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(LinkHandle); } _SEH_HANDLE { @@ -303,9 +301,7 @@ { _SEH_TRY { - ProbeForWrite(LinkHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(LinkHandle); } _SEH_HANDLE { @@ -388,9 +384,7 @@ if(ResultLength != NULL) { - ProbeForWrite(ResultLength, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(ResultLength); } } _SEH_HANDLE _____ Modified: trunk/reactos/ntoskrnl/ob/wait.c --- trunk/reactos/ntoskrnl/ob/wait.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ob/wait.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -75,12 +75,8 @@ if(TimeOut) { - ProbeForRead(TimeOut, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - /* Make a local copy of the timeout on the stack */ - SafeTimeOut = *TimeOut; + SafeTimeOut = ProbeForReadLargeInteger(TimeOut); TimeOut = &SafeTimeOut; } } @@ -273,11 +269,8 @@ { _SEH_TRY { - ProbeForRead(TimeOut, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); /* Make a copy on the stack */ - SafeTimeOut = *TimeOut; + SafeTimeOut = ProbeForReadLargeInteger(TimeOut); TimeOut = &SafeTimeOut; } _SEH_HANDLE @@ -354,11 +347,8 @@ { _SEH_TRY { - ProbeForRead(TimeOut, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); /* Make a copy on the stack */ - SafeTimeOut = *TimeOut; + SafeTimeOut = ProbeForReadLargeInteger(TimeOut); TimeOut = &SafeTimeOut; } _SEH_HANDLE _____ Modified: trunk/reactos/ntoskrnl/ps/job.c --- trunk/reactos/ntoskrnl/ps/job.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ps/job.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -212,7 +212,7 @@ CurrentProcess = PsGetCurrentProcess(); /* check for valid buffers */ - if(PreviousMode == UserMode) + if(PreviousMode != KernelMode) { _SEH_TRY { @@ -382,7 +382,7 @@ PreviousMode = ExGetPreviousMode(); /* check for valid buffers */ - if(PreviousMode == UserMode) + if(PreviousMode != KernelMode) { _SEH_TRY { _____ Modified: trunk/reactos/ntoskrnl/ps/security.c --- trunk/reactos/ntoskrnl/ps/security.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ps/security.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -75,7 +75,7 @@ PreviousMode = ExGetPreviousMode(); - if(PreviousMode == UserMode) + if(PreviousMode != KernelMode) { _SEH_TRY { _____ Modified: trunk/reactos/ntoskrnl/ps/suspend.c --- trunk/reactos/ntoskrnl/ps/suspend.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/ps/suspend.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -45,7 +45,7 @@ ThreadHandle, SuspendCount); /* Check buffer validity */ - if(SuspendCount && PreviousMode == UserMode) { + if(SuspendCount && PreviousMode != KernelMode) { _SEH_TRY { _____ Modified: trunk/reactos/ntoskrnl/rtl/capture.c --- trunk/reactos/ntoskrnl/rtl/capture.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/rtl/capture.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -32,7 +32,7 @@ * Copy the source string structure to kernel space. */ - if(CurrentMode == UserMode) + if(CurrentMode != KernelMode) { RtlZeroMemory(&Src, sizeof(Src)); _____ Modified: trunk/reactos/ntoskrnl/se/acl.c --- trunk/reactos/ntoskrnl/se/acl.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/se/acl.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -354,7 +354,7 @@ PAGED_CODE(); if(CapturedAcl != NULL && - (AccessMode == UserMode || + (AccessMode != KernelMode || (AccessMode == KernelMode && CaptureIfKernel))) { ExFreePool(CapturedAcl); _____ Modified: trunk/reactos/ntoskrnl/se/sd.c --- trunk/reactos/ntoskrnl/se/sd.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/se/sd.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -338,7 +338,7 @@ PAGED_CODE(); if(CapturedSecurityQualityOfService != NULL && - (AccessMode == UserMode || + (AccessMode != KernelMode || (AccessMode == KernelMode && CaptureIfKernel))) { ExFreePool(CapturedSecurityQualityOfService); @@ -819,7 +819,7 @@ and CaptureIfKernelMode that you previously passed to SeCaptureSecurityDescriptor() in order to avoid memory leaks! */ if(CapturedSecurityDescriptor != NULL && - (CurrentMode == UserMode || + (CurrentMode != KernelMode || (CurrentMode == KernelMode && CaptureIfKernelMode))) { /* only delete the descriptor when SeCaptureSecurityDescriptor() allocated one! */ _____ Modified: trunk/reactos/ntoskrnl/se/sid.c --- trunk/reactos/ntoskrnl/se/sid.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/se/sid.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -316,7 +316,7 @@ PAGED_CODE(); if(CapturedSid != NULL && - (AccessMode == UserMode || + (AccessMode != KernelMode || (AccessMode == KernelMode && CaptureIfKernel))) { ExFreePool(CapturedSid); _____ Modified: trunk/reactos/ntoskrnl/se/token.c --- trunk/reactos/ntoskrnl/se/token.c 2005-08-21 17:38:07 UTC (rev 17466) +++ trunk/reactos/ntoskrnl/se/token.c 2005-08-21 19:04:23 UTC (rev 17467) @@ -1440,9 +1440,7 @@ { _SEH_TRY { - ProbeForWrite(NewTokenHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(NewTokenHandle); } _SEH_HANDLE { @@ -2053,6 +2051,7 @@ ULONG uLength; ULONG i; ULONG nTokenPrivileges = 0; + LARGE_INTEGER LocalExpirationTime = {}; KPROCESSOR_MODE PreviousMode; NTSTATUS Status = STATUS_SUCCESS; @@ -2064,15 +2063,11 @@ { _SEH_TRY { - ProbeForWrite(TokenHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(TokenHandle); ProbeForRead(AuthenticationId, sizeof(LUID), sizeof(ULONG)); - ProbeForRead(ExpirationTime, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); + LocalExpirationTime = ProbeForReadLargeInteger(ExpirationTime); ProbeForRead(TokenUser, sizeof(TOKEN_USER), sizeof(ULONG)); @@ -2110,6 +2105,7 @@ else { nTokenPrivileges = TokenPrivileges->PrivilegeCount; + LocalExpirationTime = *ExpirationTime; } Status = ZwAllocateLocallyUniqueId(&TokenId); @@ -2383,9 +2379,7 @@ { _SEH_TRY { - ProbeForWrite(TokenHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(TokenHandle); } _SEH_HANDLE {
19 years, 4 months
1
0
0
0
[weiden] 17466: use inlined probing macros for basic types
by weiden@svn.reactos.com
use inlined probing macros for basic types Modified: trunk/reactos/ntoskrnl/ex/event.c Modified: trunk/reactos/ntoskrnl/ex/evtpair.c Modified: trunk/reactos/ntoskrnl/ex/mutant.c Modified: trunk/reactos/ntoskrnl/ex/profile.c Modified: trunk/reactos/ntoskrnl/ex/sem.c Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c Modified: trunk/reactos/ntoskrnl/ex/time.c Modified: trunk/reactos/ntoskrnl/ex/timer.c Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h _____ Modified: trunk/reactos/ntoskrnl/ex/event.c --- trunk/reactos/ntoskrnl/ex/event.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/event.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -110,9 +110,7 @@ _SEH_TRY { - ProbeForWrite(EventHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(EventHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -190,9 +188,7 @@ _SEH_TRY { - ProbeForWrite(EventHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(EventHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -250,9 +246,7 @@ _SEH_TRY { - ProbeForWrite(PreviousState, - sizeof(LONG), - sizeof(ULONG)); + ProbeForWriteLong(PreviousState); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -386,9 +380,7 @@ _SEH_TRY { - ProbeForWrite(PreviousState, - sizeof(LONG), - sizeof(ULONG)); + ProbeForWriteLong(PreviousState); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -453,9 +445,7 @@ _SEH_TRY { - ProbeForWrite(PreviousState, - sizeof(LONG), - sizeof(ULONG)); + ProbeForWriteLong(PreviousState); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); _____ Modified: trunk/reactos/ntoskrnl/ex/evtpair.c --- trunk/reactos/ntoskrnl/ex/evtpair.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/evtpair.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -66,13 +66,11 @@ DPRINT("NtCreateEventPair: 0x%p\n", EventPairHandle); /* Check Output Safety */ - if(PreviousMode == UserMode) { + if(PreviousMode != KernelMode) { _SEH_TRY { - ProbeForWrite(EventPairHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(EventPairHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -142,13 +140,11 @@ PAGED_CODE(); /* Check Output Safety */ - if(PreviousMode == UserMode) { + if(PreviousMode != KernelMode) { _SEH_TRY { - ProbeForWrite(EventPairHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(EventPairHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); _____ Modified: trunk/reactos/ntoskrnl/ex/mutant.c --- trunk/reactos/ntoskrnl/ex/mutant.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/mutant.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -90,13 +90,11 @@ DPRINT("NtCreateMutant(0x%p, 0x%x, 0x%p)\n", MutantHandle, DesiredAccess, ObjectAttributes); /* Check Output Safety */ - if(PreviousMode == UserMode) { + if(PreviousMode != KernelMode) { _SEH_TRY { - ProbeForWrite(MutantHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(MutantHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -169,13 +167,11 @@ DPRINT("NtOpenMutant(0x%p, 0x%x, 0x%p)\n", MutantHandle, DesiredAccess, ObjectAttributes); /* Check Output Safety */ - if(PreviousMode == UserMode) { + if(PreviousMode != KernelMode) { _SEH_TRY { - ProbeForWrite(MutantHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(MutantHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -305,9 +301,7 @@ _SEH_TRY { - ProbeForWrite(PreviousCount, - sizeof(LONG), - sizeof(ULONG)); + ProbeForWriteLong(PreviousCount); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); _____ Modified: trunk/reactos/ntoskrnl/ex/profile.c --- trunk/reactos/ntoskrnl/ex/profile.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/profile.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -126,9 +126,7 @@ _SEH_TRY { - ProbeForWrite(ProfileHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(ProfileHandle); ProbeForWrite(Buffer, BufferSize, @@ -238,13 +236,9 @@ _SEH_TRY { - ProbeForWrite(PerformanceCounter, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); + ProbeForWriteLargeInteger(PerformanceCounter); - ProbeForWrite(PerformanceFrequency, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); + ProbeForWriteLargeInteger(PerformanceFrequency); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { Status = _SEH_GetExceptionCode(); @@ -412,9 +406,7 @@ _SEH_TRY { - ProbeForWrite(Interval, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(Interval); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { _____ Modified: trunk/reactos/ntoskrnl/ex/sem.c --- trunk/reactos/ntoskrnl/ex/sem.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/sem.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -76,9 +76,7 @@ { _SEH_TRY { - ProbeForWrite(SemaphoreHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(SemaphoreHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { @@ -162,9 +160,7 @@ { _SEH_TRY { - ProbeForWrite(SemaphoreHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(SemaphoreHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { @@ -289,9 +285,7 @@ { _SEH_TRY { - ProbeForWrite(PreviousCount, - sizeof(LONG), - sizeof(ULONG)); + ProbeForWriteLong(PreviousCount); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { _____ Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c --- trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -137,9 +137,7 @@ sizeof(WCHAR)); if(ReturnLength != NULL) { - ProbeForWrite(ReturnLength, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(ReturnLength); } } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) @@ -1548,7 +1546,7 @@ /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */ ProbeForWrite(SystemInformation, Length, 1); if (UnsafeResultLength != NULL) - ProbeForWrite(UnsafeResultLength, sizeof(ULONG), sizeof(ULONG)); + ProbeForWriteUlong(UnsafeResultLength); } /* Clear user buffer. */ _____ Modified: trunk/reactos/ntoskrnl/ex/time.c --- trunk/reactos/ntoskrnl/ex/time.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/time.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -161,15 +161,10 @@ { _SEH_TRY { - ProbeForRead(SystemTime, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - NewSystemTime = *SystemTime; + NewSystemTime = ProbeForReadLargeInteger(SystemTime); if(PreviousTime != NULL) { - ProbeForWrite(PreviousTime, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); + ProbeForWriteLargeInteger(PreviousTime); } } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) @@ -246,9 +241,7 @@ { _SEH_TRY { - ProbeForRead(SystemTime, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); + ProbeForWriteLargeInteger(SystemTime); /* it's safe to pass the pointer directly to KeQuerySystemTime as it's just a basic copy to these pointer, if it raises an exception nothing dangerous _____ Modified: trunk/reactos/ntoskrnl/ex/timer.c --- trunk/reactos/ntoskrnl/ex/timer.c 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/ex/timer.c 2005-08-21 17:38:07 UTC (rev 17466) @@ -271,9 +271,7 @@ { _SEH_TRY { - ProbeForWrite(CurrentState, - sizeof(BOOLEAN), - sizeof(BOOLEAN)); + ProbeForWriteBoolean(CurrentState); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { @@ -403,9 +401,7 @@ { _SEH_TRY { - ProbeForWrite(TimerHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(TimerHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { @@ -493,9 +489,7 @@ { _SEH_TRY { - ProbeForWrite(TimerHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(TimerHandle); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { @@ -633,16 +627,11 @@ { _SEH_TRY { - ProbeForRead(DueTime, - sizeof(LARGE_INTEGER), - sizeof(ULONG)); - TimerDueTime = *DueTime; + TimerDueTime = ProbeForReadLargeInteger(DueTime); if(PreviousState) { - ProbeForWrite(PreviousState, - sizeof(BOOLEAN), - sizeof(BOOLEAN)); + ProbeForWriteBoolean(PreviousState); } } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) _____ Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-08-21 15:54:48 UTC (rev 17465) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-08-21 17:38:07 UTC (rev 17466) @@ -106,6 +106,7 @@ *(volatile Type *)(Ptr) = *(volatile Type *)(Ptr); \ } while (0) +#define ProbeForWriteBoolean(Ptr) ProbeForWriteGenericType(Ptr, BOOLEAN) #define ProbeForWriteUchar(Ptr) ProbeForWriteGenericType(Ptr, UCHAR) #define ProbeForWriteChar(Ptr) ProbeForWriteGenericType(Ptr, Char) #define ProbeForWriteUshort(Ptr) ProbeForWriteGenericType(Ptr, USHORT) @@ -120,13 +121,16 @@ #define ProbeForWritePointer(Ptr) ProbeForWriteGenericType(Ptr, PVOID) #define ProbeForWriteHandle(Ptr) ProbeForWriteGenericType(Ptr, HANDLE) #define ProbeForWriteLangid(Ptr) ProbeForWriteGenericType(Ptr, LANGID) +#define ProbeForWriteLargeInteger(Ptr) ProbeForWriteGenericType(&(Ptr)->QuadPart, LONGLONG) +#define ProbeForWriteUlargeInteger(Ptr) ProbeForWriteGenericType(&(Ptr)->QuadPart, ULONGLONG) #define ProbeForReadGenericType(Ptr, Type, Default) \ (((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) || \ (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) ? \ ExRaiseStatus (STATUS_ACCESS_VIOLATION), Default : \ - *(volatile Type *)(Ptr)) + *(Type *)(Ptr)) +#define ProbeForReadBoolean(Ptr) ProbeForReadGenericType(Ptr, BOOLEAN, FALSE) #define ProbeForReadUchar(Ptr) ProbeForReadGenericType(Ptr, UCHAR, 0) #define ProbeForReadChar(Ptr) ProbeForReadGenericType(Ptr, CHAR, 0) #define ProbeForReadUshort(Ptr) ProbeForReadGenericType(Ptr, USHORT, 0) @@ -140,6 +144,8 @@ #define ProbeForReadPointer(Ptr) ProbeForReadGenericType(Ptr, PVOID, NULL) #define ProbeForReadHandle(Ptr) ProbeForReadGenericType(Ptr, HANDLE, NULL) #define ProbeForReadLangid(Ptr) ProbeForReadGenericType(Ptr, LANGID, 0) +#define ProbeForReadLargeInteger(Ptr) ((LARGE_INTEGER)ProbeForReadGenericType(&(Ptr)->QuadPart, LONGLONG, 0)) +#define ProbeForReadUlargeInteger(Ptr) ((ULARGE_INTEGER)ProbeForReadGenericType(&(Ptr)->QuadPart, ULONGLONG, 0)) #endif
19 years, 4 months
1
0
0
0
[navaraf] 17465: Replace wcsncpy with lstrcpynW / memcpy as appropriate.
by navaraf@svn.reactos.com
Replace wcsncpy with lstrcpynW / memcpy as appropriate. Modified: trunk/reactos/lib/kernel32/misc/profile.c _____ Modified: trunk/reactos/lib/kernel32/misc/profile.c --- trunk/reactos/lib/kernel32/misc/profile.c 2005-08-21 15:51:57 UTC (rev 17464) +++ trunk/reactos/lib/kernel32/misc/profile.c 2005-08-21 15:54:48 UTC (rev 17465) @@ -24,7 +24,6 @@ #define NDEBUG #include "../include/debug.h" - static const char bom_utf8[] = {0xEF,0xBB,0xBF}; typedef enum @@ -122,9 +121,7 @@ quote = *value++; } - wcsncpy( buffer, value, len ); - if (quote && ((size_t)len >= wcslen(value))) - buffer[wcslen(buffer) - 1] = '\0'; + lstrcpynW( buffer, value, len ); } @@ -963,7 +960,7 @@ { if (f > 0) { - wcsncpy(buf, section->name, f - 1); + memcpy(buf, section->name, (f - 1) * sizeof(WCHAR)); buf += f - 1; *buf++ = '\0'; } @@ -1158,13 +1155,13 @@ break; } - if (*p == ' ') /* ouch, contained trailing ' ' */ - { + if (*p == ' ') /* ouch, contained trailing ' ' */ + { int len = (int)(p - def_val); LPWSTR p; p = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); - wcsncpy(p, def_val, len); + memcpy(p, def_val, len * sizeof(WCHAR)); p[len] = '\0'; pDefVal = p; } @@ -1185,7 +1182,7 @@ } else { - wcsncpy( buffer, pDefVal, len ); + lstrcpynW( buffer, pDefVal, len ); ret = wcslen( buffer ); }
19 years, 4 months
1
0
0
0
[navaraf] 17464: Fix implementation of wcsnlen and strnlen.
by navaraf@svn.reactos.com
Fix implementation of wcsnlen and strnlen. Modified: trunk/reactos/lib/kernel32/mem/isbad.c _____ Modified: trunk/reactos/lib/kernel32/mem/isbad.c --- trunk/reactos/lib/kernel32/mem/isbad.c 2005-08-21 15:51:23 UTC (rev 17463) +++ trunk/reactos/lib/kernel32/mem/isbad.c 2005-08-21 15:51:57 UTC (rev 17464) @@ -21,7 +21,7 @@ ) { UINT i = 0; - while( lpsz[i] && i < ucchMax ) i++; + while( i < ucchMax && lpsz[i] ) i++; return i; } @@ -37,7 +37,7 @@ ) { UINT i = 0; - while( lpsz[i] && i < uiMax ) i++; + while( i < uiMax && lpsz[i] ) i++; return i; }
19 years, 4 months
1
0
0
0
[navaraf] 17463: Fix buffer overflow in lstrcpynW and lstrcpynA.
by navaraf@svn.reactos.com
Fix buffer overflow in lstrcpynW and lstrcpynA. Modified: trunk/reactos/lib/kernel32/string/lstring.c _____ Modified: trunk/reactos/lib/kernel32/string/lstring.c --- trunk/reactos/lib/kernel32/string/lstring.c 2005-08-21 15:38:47 UTC (rev 17462) +++ trunk/reactos/lib/kernel32/string/lstring.c 2005-08-21 15:51:23 UTC (rev 17463) @@ -91,10 +91,9 @@ do { - if ('\0' == (*d++ = *s++)) - { - break; - } + if ('\0' == *s) + break; + *d++ = *s++; } while(1 != --iMaxLength); *d = '\0'; @@ -239,10 +238,9 @@ do { - if (L'\0' == (*d++ = *s++)) - { - break; - } + if (L'\0' == *s) + break; + *d++ = *s++; } while(1 != --iMaxLength); *d = L'\0';
19 years, 4 months
1
0
0
0
[weiden] 17462: - use inlined probing macros for basic types
by weiden@svn.reactos.com
- use inlined probing macros for basic types - documented dozens of vulnerabilities in NtOpenThread, NtCreateThread and NtOpenProcess (owner may fix them) Modified: trunk/reactos/ntoskrnl/ps/job.c Modified: trunk/reactos/ntoskrnl/ps/locale.c Modified: trunk/reactos/ntoskrnl/ps/process.c Modified: trunk/reactos/ntoskrnl/ps/query.c Modified: trunk/reactos/ntoskrnl/ps/security.c Modified: trunk/reactos/ntoskrnl/ps/suspend.c Modified: trunk/reactos/ntoskrnl/ps/thread.c _____ Modified: trunk/reactos/ntoskrnl/ps/job.c --- trunk/reactos/ntoskrnl/ps/job.c 2005-08-21 15:14:36 UTC (rev 17461) +++ trunk/reactos/ntoskrnl/ps/job.c 2005-08-21 15:38:47 UTC (rev 17462) @@ -216,10 +216,7 @@ { _SEH_TRY { - /* probe with 32bit alignment */ - ProbeForWrite(JobHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(JobHandle); } _SEH_HANDLE { @@ -389,10 +386,7 @@ { _SEH_TRY { - /* probe with 32bit alignment */ - ProbeForWrite(JobHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(JobHandle); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/ps/locale.c --- trunk/reactos/ntoskrnl/ps/locale.c 2005-08-21 15:14:36 UTC (rev 17461) +++ trunk/reactos/ntoskrnl/ps/locale.c 2005-08-21 15:38:47 UTC (rev 17462) @@ -199,28 +199,40 @@ NtQueryDefaultLocale(IN BOOLEAN UserProfile, OUT PLCID DefaultLocaleId) { - PAGED_CODE(); + NTSTATUS Status = STATUS_SUCCESS; - if (DefaultLocaleId == NULL) - return STATUS_UNSUCCESSFUL; + PAGED_CODE(); - if (UserProfile) + _SEH_TRY { - if (!PsDefaultThreadLocaleInitialized) - { - PiInitThreadLocale(); - } + if (KeGetPreviousMode() != KernelMode) + { + ProbeForWriteLangid(DefaultLocaleId); + } + + if (UserProfile) + { + if (!PsDefaultThreadLocaleInitialized) + { + PiInitThreadLocale(); + } - /* set thread locale */ - *DefaultLocaleId = PsDefaultThreadLocaleId; + /* set thread locale */ + *DefaultLocaleId = PsDefaultThreadLocaleId; + } + else + { + /* set system locale */ + *DefaultLocaleId = PsDefaultSystemLocaleId; + } } - else + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - /* set system locale */ - *DefaultLocaleId = PsDefaultSystemLocaleId; + Status = _SEH_GetExceptionCode(); } + _SEH_END; - return STATUS_SUCCESS; + return Status; } @@ -353,16 +365,36 @@ ULONG Value; HANDLE UserKey; HANDLE KeyHandle; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); + + _SEH_TRY + { + if (KeGetPreviousMode() != KernelMode) + { + ProbeForWriteLangid(LanguageId); + } + *LanguageId = PsInstallUILanguageId; + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if (!NT_SUCCESS(Status)) + { + return Status; + } + Status = RtlOpenCurrentUser(KEY_READ, &UserKey); if (!NT_SUCCESS(Status)) { - *LanguageId = PsInstallUILanguageId; - return STATUS_SUCCESS; + Value = PsInstallUILanguageId; + goto ReturnSuccess; } InitializeObjectAttributes(&ObjectAttributes, @@ -375,8 +407,8 @@ &ObjectAttributes); if (!NT_SUCCESS(Status)) { - *LanguageId = PsInstallUILanguageId; - return STATUS_SUCCESS; + Value = PsInstallUILanguageId; + goto ReturnSuccess; } ValueInfo = (PKEY_VALUE_PARTIAL_INFORMATION)ValueBuffer; @@ -393,8 +425,8 @@ if (!NT_SUCCESS(Status) || ValueInfo->Type != REG_SZ) { - *LanguageId = PsInstallUILanguageId; - return STATUS_SUCCESS; + Value = PsInstallUILanguageId; + goto ReturnSuccess; } ValueString.Length = ValueInfo->DataLength; @@ -406,15 +438,25 @@ &Value); if (!NT_SUCCESS(Status)) { - *LanguageId = PsInstallUILanguageId; - return STATUS_SUCCESS; + Value = PsInstallUILanguageId; + goto ReturnSuccess; } DPRINT("Default language id: %04lx\n", Value); - *LanguageId = Value; +ReturnSuccess: + _SEH_TRY + { + *LanguageId = Value; + Status = STATUS_SUCCESS; + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; - return STATUS_SUCCESS; + return Status; } @@ -424,11 +466,26 @@ NTSTATUS STDCALL NtQueryInstallUILanguage(OUT PLANGID LanguageId) { - PAGED_CODE(); + NTSTATUS Status = STATUS_SUCCESS; + + PAGED_CODE(); - *LanguageId = PsInstallUILanguageId; + _SEH_TRY + { + if (KeGetPreviousMode() != KernelMode) + { + ProbeForWriteLangid(LanguageId); + } - return STATUS_SUCCESS; + *LanguageId = PsInstallUILanguageId; + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + return Status; } _____ Modified: trunk/reactos/ntoskrnl/ps/process.c --- trunk/reactos/ntoskrnl/ps/process.c 2005-08-21 15:14:36 UTC (rev 17461) +++ trunk/reactos/ntoskrnl/ps/process.c 2005-08-21 15:38:47 UTC (rev 17462) @@ -870,6 +870,7 @@ IN HANDLE DebugPort OPTIONAL, IN HANDLE ExceptionPort OPTIONAL) { + HANDLE hProcess; KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); NTSTATUS Status = STATUS_SUCCESS; @@ -880,9 +881,7 @@ { _SEH_TRY { - ProbeForWrite(ProcessHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(ProcessHandle); } _SEH_HANDLE { @@ -901,8 +900,9 @@ } else { - /* Create a user Process */ - Status = PspCreateProcess(ProcessHandle, + /* Create a user Process, do NOT pass the pointer to the handle supplied + by the caller directly!!! */ + Status = PspCreateProcess(&hProcess, DesiredAccess, ObjectAttributes, ParentProcess, @@ -910,6 +910,18 @@ SectionHandle, DebugPort, ExceptionPort); + if (NT_SUCCESS(Status)) + { + _SEH_TRY + { + *ProcessHandle = hProcess; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } } /* Return Status */ @@ -940,7 +952,7 @@ /* Open by name if one was given */ DPRINT("Checking type\n"); - if (ObjectAttributes->ObjectName) + if (ObjectAttributes->ObjectName) /* FIXME - neither probed nor protected! */ { /* Open it */ DPRINT("Opening by name\n"); @@ -964,11 +976,11 @@ else if (ClientId) { /* Open by Thread ID */ - if (ClientId->UniqueThread) + if (ClientId->UniqueThread) /* FIXME - neither probed nor protected! */ { /* Get the Process */ - DPRINT("Opening by Thread ID: %x\n", ClientId->UniqueThread); - Status = PsLookupProcessThreadByCid(ClientId, + DPRINT("Opening by Thread ID: %x\n", ClientId->UniqueThread); /* FIXME - neither probed nor protected! */ + Status = PsLookupProcessThreadByCid(ClientId, /* FIXME - neither probed nor protected! */ &Process, &Thread); DPRINT("Found: %x\n", Process); @@ -976,8 +988,8 @@ else { /* Get the Process */ - DPRINT("Opening by Process ID: %x\n", ClientId->UniqueProcess); - Status = PsLookupProcessByProcessId(ClientId->UniqueProcess, + DPRINT("Opening by Process ID: %x\n", ClientId->UniqueProcess); /* FIXME - neither probed nor protected! */ + Status = PsLookupProcessByProcessId(ClientId->UniqueProcess, /* FIXME - neither probed nor protected! */ &Process); DPRINT("Found: %x\n", Process); } @@ -990,12 +1002,12 @@ /* Open the Process Object */ Status = ObOpenObjectByPointer(Process, - ObjectAttributes->Attributes, + ObjectAttributes->Attributes, /* FIXME - neither probed nor protected! */ NULL, DesiredAccess, PsProcessType, PreviousMode, - ProcessHandle); + ProcessHandle); /* FIXME - neither probed nor protected! */ if(!NT_SUCCESS(Status)) { DPRINT1("Failure to open process\n"); _____ Modified: trunk/reactos/ntoskrnl/ps/query.c --- trunk/reactos/ntoskrnl/ps/query.c 2005-08-21 15:14:36 UTC (rev 17461) +++ trunk/reactos/ntoskrnl/ps/query.c 2005-08-21 15:38:47 UTC (rev 17462) @@ -1303,9 +1303,7 @@ 1); if (ReturnLength != NULL) { - ProbeForWrite(ReturnLength, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(ReturnLength); } } _SEH_HANDLE _____ Modified: trunk/reactos/ntoskrnl/ps/security.c --- trunk/reactos/ntoskrnl/ps/security.c 2005-08-21 15:14:36 UTC (rev 17461) +++ trunk/reactos/ntoskrnl/ps/security.c 2005-08-21 15:38:47 UTC (rev 17462) @@ -79,9 +79,7 @@ { _SEH_TRY { - ProbeForWrite(TokenHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(TokenHandle); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/ps/suspend.c --- trunk/reactos/ntoskrnl/ps/suspend.c 2005-08-21 15:14:36 UTC (rev 17461) +++ trunk/reactos/ntoskrnl/ps/suspend.c 2005-08-21 15:38:47 UTC (rev 17462) @@ -49,9 +49,7 @@ _SEH_TRY { - ProbeForWrite(SuspendCount, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(SuspendCount); } _SEH_HANDLE { Status = _SEH_GetExceptionCode(); @@ -124,9 +122,7 @@ { _SEH_TRY { - ProbeForWrite(PreviousSuspendCount, - sizeof(ULONG), - sizeof(ULONG)); + ProbeForWriteUlong(PreviousSuspendCount); } _SEH_HANDLE { _____ Modified: trunk/reactos/ntoskrnl/ps/thread.c --- trunk/reactos/ntoskrnl/ps/thread.c 2005-08-21 15:14:36 UTC (rev 17461) +++ trunk/reactos/ntoskrnl/ps/thread.c 2005-08-21 15:38:47 UTC (rev 17462) @@ -597,9 +597,7 @@ _SEH_TRY { - ProbeForWrite(ThreadHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(ThreadHandle); if(ClientId != NULL) { @@ -632,18 +630,18 @@ } /* Use probed data for the Initial TEB */ - SafeInitialTeb = *InitialTeb; + SafeInitialTeb = *InitialTeb; /* FIXME - not protected! */ InitialTeb = &SafeInitialTeb; /* Call the shared function */ - return PspCreateThread(ThreadHandle, + return PspCreateThread(ThreadHandle, /* FIXME - not protected! */ DesiredAccess, ObjectAttributes, ProcessHandle, NULL, - ClientId, - ThreadContext, - InitialTeb, + ClientId, /* FIXME - not protected! */ + ThreadContext, /* FIXME - not protected! */ + InitialTeb, /* FIXME - not protected! */ CreateSuspended, NULL, NULL); @@ -672,9 +670,7 @@ { _SEH_TRY { - ProbeForWrite(ThreadHandle, - sizeof(HANDLE), - sizeof(ULONG)); + ProbeForWriteHandle(ThreadHandle); if(ClientId != NULL) { @@ -696,7 +692,7 @@ } /* Open by name if one was given */ - if (ObjectAttributes->ObjectName) + if (ObjectAttributes->ObjectName) /* FIXME - neither probed nor protected! */ { /* Open it */ Status = ObOpenObjectByName(ObjectAttributes, @@ -711,18 +707,18 @@ { DPRINT1("Could not open object by name\n"); } - + /* FIXME - would be a good idea to return the handle in case of success! */ /* Return Status */ return(Status); } else if (ClientId) { /* Open by Thread ID */ - if (ClientId->UniqueProcess) + if (ClientId->UniqueProcess) /* FIXME - neither probed nor protected! */ { /* Get the Process */ - DPRINT("Opening by Process ID: %x\n", ClientId->UniqueProcess); - Status = PsLookupProcessThreadByCid(ClientId, + DPRINT("Opening by Process ID: %x\n", ClientId->UniqueProcess); /* FIXME - neither probed nor protected! */ + Status = PsLookupProcessThreadByCid(ClientId, /* FIXME - neither probed nor protected! */ NULL, &Thread); } @@ -742,7 +738,7 @@ /* Open the Thread Object */ Status = ObOpenObjectByPointer(Thread, - ObjectAttributes->Attributes, + ObjectAttributes->Attributes, /* FIXME - neither probed nor protected! */ NULL, DesiredAccess, PsThreadType,
19 years, 4 months
1
0
0
0
[weiden] 17461: add macros to probe basic type pointers
by weiden@svn.reactos.com
add macros to probe basic type pointers Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h _____ Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-08-21 15:00:29 UTC (rev 17460) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-08-21 15:14:36 UTC (rev 17461) @@ -92,8 +92,57 @@ IN BOOLEAN CaptureIfKernel ); +/* + * Inlined Probing Macros + * + * NOTE: Alignment of the pointers is not verified! + */ +#define ProbeForWriteGenericType(Ptr, Type) \ + do { \ + if ((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) || \ + (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) { \ + ExRaiseStatus (STATUS_ACCESS_VIOLATION); \ + } \ + *(volatile Type *)(Ptr) = *(volatile Type *)(Ptr); \ + } while (0) + +#define ProbeForWriteUchar(Ptr) ProbeForWriteGenericType(Ptr, UCHAR) +#define ProbeForWriteChar(Ptr) ProbeForWriteGenericType(Ptr, Char) +#define ProbeForWriteUshort(Ptr) ProbeForWriteGenericType(Ptr, USHORT) +#define ProbeForWriteShort(Ptr) ProbeForWriteGenericType(Ptr, SHORT) +#define ProbeForWriteUlong(Ptr) ProbeForWriteGenericType(Ptr, ULONG) +#define ProbeForWriteLong(Ptr) ProbeForWriteGenericType(Ptr, LONG) +#define ProbeForWriteUint(Ptr) ProbeForWriteGenericType(Ptr, UINT) +#define ProbeForWriteInt(Ptr) ProbeForWriteGenericType(Ptr, INT) +#define ProbeForWriteUlonglong(Ptr) ProbeForWriteGenericType(Ptr, ULONGLONG) +#define ProbeForWriteLonglong(Ptr) ProbeForWriteGenericType(Ptr, LONGLONG) +#define ProbeForWriteLonglong(Ptr) ProbeForWriteGenericType(Ptr, LONGLONG) +#define ProbeForWritePointer(Ptr) ProbeForWriteGenericType(Ptr, PVOID) +#define ProbeForWriteHandle(Ptr) ProbeForWriteGenericType(Ptr, HANDLE) +#define ProbeForWriteLangid(Ptr) ProbeForWriteGenericType(Ptr, LANGID) + +#define ProbeForReadGenericType(Ptr, Type, Default) \ + (((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) || \ + (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) ? \ + ExRaiseStatus (STATUS_ACCESS_VIOLATION), Default : \ + *(volatile Type *)(Ptr)) + +#define ProbeForReadUchar(Ptr) ProbeForReadGenericType(Ptr, UCHAR, 0) +#define ProbeForReadChar(Ptr) ProbeForReadGenericType(Ptr, CHAR, 0) +#define ProbeForReadUshort(Ptr) ProbeForReadGenericType(Ptr, USHORT, 0) +#define ProbeForReadShort(Ptr) ProbeForReadGenericType(Ptr, SHORT, 0) +#define ProbeForReadUlong(Ptr) ProbeForReadGenericType(Ptr, ULONG, 0) +#define ProbeForReadLong(Ptr) ProbeForReadGenericType(Ptr, LONG, 0) +#define ProbeForReadUint(Ptr) ProbeForReadGenericType(Ptr, UINT, 0) +#define ProbeForReadInt(Ptr) ProbeForReadGenericType(Ptr, INT, 0) +#define ProbeForReadUlonglong(Ptr) ProbeForReadGenericType(Ptr, ULONGLONG, 0) +#define ProbeForReadLonglong(Ptr) ProbeForReadGenericType(Ptr, LONGLONG, 0) +#define ProbeForReadPointer(Ptr) ProbeForReadGenericType(Ptr, PVOID, NULL) +#define ProbeForReadHandle(Ptr) ProbeForReadGenericType(Ptr, HANDLE, NULL) +#define ProbeForReadLangid(Ptr) ProbeForReadGenericType(Ptr, LANGID, 0) + + #endif - /* * */
19 years, 4 months
1
0
0
0
[weiden] 17460: fixed uninitialized variable warning
by weiden@svn.reactos.com
fixed uninitialized variable warning Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c _____ Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c --- trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c 2005-08-21 14:58:47 UTC (rev 17459) +++ trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c 2005-08-21 15:00:29 UTC (rev 17460) @@ -1081,7 +1081,7 @@ BOOLEAN Stepping; LONG Address; LONG Length; - LONG SigVal; + LONG SigVal = 0; LONG NewPC; PCHAR ptr;
19 years, 4 months
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
67
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Results per page:
10
25
50
100
200