Author: ion
Date: Mon Jan 30 01:14:33 2012
New Revision: 55310
URL:
http://svn.reactos.org/svn/reactos?rev=55310&view=rev
Log:
[RTL]: Document, define, implement, and export RtlSetThreadIsCritical.
Modified:
trunk/reactos/dll/ntdll/def/ntdll.pspec
trunk/reactos/dll/ntdll/def/ntdll.spec
trunk/reactos/include/ndk/rtlfuncs.h
trunk/reactos/include/reactos/subsys/sm/smmsg.h
trunk/reactos/lib/rtl/process.c
trunk/reactos/lib/rtl/thread.c
Modified: trunk/reactos/dll/ntdll/def/ntdll.pspec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.pspec?…
==============================================================================
--- trunk/reactos/dll/ntdll/def/ntdll.pspec [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/def/ntdll.pspec [iso-8859-1] Mon Jan 30 01:14:33 2012
@@ -895,7 +895,7 @@
@ stdcall RtlSetSecurityObject(long ptr ptr ptr ptr)
//@ stdcall RtlSetSecurityObjectEx
//@ stdcall RtlSetThreadErrorMode
-//@ stdcall RtlSetThreadIsCritical
+@ stdcall RtlSetThreadIsCritical(long ptr long)
//@ stdcall RtlSetThreadPoolStartFunc
@ stdcall RtlSetTimeZoneInformation(ptr)
//@ stdcall RtlSetTimer
Modified: trunk/reactos/dll/ntdll/def/ntdll.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
==============================================================================
--- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Mon Jan 30 01:14:33 2012
@@ -895,7 +895,7 @@
@ stdcall RtlSetSecurityObject(long ptr ptr ptr ptr)
;@ stdcall RtlSetSecurityObjectEx
;@ stdcall RtlSetThreadErrorMode
-;@ stdcall RtlSetThreadIsCritical
+@ stdcall RtlSetThreadIsCritical(long ptr long)
;@ stdcall RtlSetThreadPoolStartFunc
@ stdcall RtlSetTimeZoneInformation(ptr)
;@ stdcall RtlSetTimer
Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Mon Jan 30 01:14:33 2012
@@ -2401,6 +2401,15 @@
NTSTATUS
NTAPI
RtlSetProcessIsCritical(
+ IN BOOLEAN NewValue,
+ OUT PBOOLEAN OldValue OPTIONAL,
+ IN BOOLEAN NeedBreaks
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSetThreadIsCritical(
IN BOOLEAN NewValue,
OUT PBOOLEAN OldValue OPTIONAL,
IN BOOLEAN NeedBreaks
Modified: trunk/reactos/include/reactos/subsys/sm/smmsg.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/sm/…
==============================================================================
--- trunk/reactos/include/reactos/subsys/sm/smmsg.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/sm/smmsg.h [iso-8859-1] Mon Jan 30 01:14:33 2012
@@ -53,6 +53,7 @@
RTL_USER_PROCESS_INFORMATION ProcessInformation;
BOOLEAN DebugFlag;
} SM_EXEC_PGM_MSG, *PM_EXEC_PGM_MSG;
+C_ASSERT(sizeof(SM_EXEC_PGM_MSG) == 0x48);
typedef struct _SM_LOAD_DEFERED_SUBSYSTEM_MSG
{
Modified: trunk/reactos/lib/rtl/process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/process.c?rev=5531…
==============================================================================
--- trunk/reactos/lib/rtl/process.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/process.c [iso-8859-1] Mon Jan 30 01:14:33 2012
@@ -362,16 +362,19 @@
OUT PBOOLEAN OldValue OPTIONAL,
IN BOOLEAN NeedBreaks)
{
- ULONG BreakOnTermination = FALSE;
-
- if (OldValue)
- *OldValue = FALSE;
+ ULONG BreakOnTermination;
+
+ /* Initialize to FALSE */
+ if (OldValue) *OldValue = FALSE;
/* Fail, if the critical breaks flag is required but is not set */
- if (NeedBreaks == TRUE &&
+ if ((NeedBreaks) &&
!(NtCurrentPeb()->NtGlobalFlag & FLG_ENABLE_SYSTEM_CRIT_BREAKS))
+ {
return STATUS_UNSUCCESSFUL;
-
+ }
+
+ /* Check if the caller wants the old value */
if (OldValue)
{
/* Query and return the old break on termination flag for the process */
Modified: trunk/reactos/lib/rtl/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/thread.c?rev=55310…
==============================================================================
--- trunk/reactos/lib/rtl/thread.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/thread.c [iso-8859-1] Mon Jan 30 01:14:33 2012
@@ -149,6 +149,48 @@
}
/* FUNCTIONS ***************************************************************/
+
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+RtlSetThreadIsCritical(IN BOOLEAN NewValue,
+ OUT PBOOLEAN OldValue OPTIONAL,
+ IN BOOLEAN NeedBreaks)
+{
+ ULONG BreakOnTermination;
+
+ /* Initialize to FALSE */
+ if (OldValue) *OldValue = FALSE;
+
+ /* Fail, if the critical breaks flag is required but is not set */
+ if ((NeedBreaks) &&
+ !(NtCurrentPeb()->NtGlobalFlag & FLG_ENABLE_SYSTEM_CRIT_BREAKS))
+ {
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* Check if the caller wants the old value */
+ if (OldValue)
+ {
+ /* Query and return the old break on termination flag for the process */
+ ZwQueryInformationThread(NtCurrentThread(),
+ ThreadBreakOnTermination,
+ &BreakOnTermination,
+ sizeof(ULONG),
+ NULL);
+ *OldValue = (BOOLEAN)BreakOnTermination;
+ }
+
+ /* Set the break on termination flag for the process */
+ BreakOnTermination = NewValue;
+ return ZwSetInformationThread(NtCurrentThread(),
+ ThreadBreakOnTermination,
+ &BreakOnTermination,
+ sizeof(ULONG));
+}
/*
@implemented