Author: hpoussin
Date: Sat Aug 26 12:46:18 2006
New Revision: 23715
URL: http://svn.reactos.org/svn/reactos?rev=23715&view=rev
Log:
Fix a missing referencing in PsImpersonateClient (dereferenced in PsRevertThreadToSelf)
PspWriteTebImpersonationInfo may be used to set or to clear impersonation info => remove an extra assignment
Modified:
trunk/reactos/ntoskrnl/ps/security.c
Modified: trunk/reactos/ntoskrnl/ps/security.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/security.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/security.c (original)
+++ trunk/reactos/ntoskrnl/ps/security.c Sat Aug 26 12:46:18 2006
@@ -149,9 +149,6 @@
Teb->ImpersonationLocale = 0;
Teb->IsImpersonating = 0;
}
-
- /* Set new flag */
- Thread->ActiveImpersonationInfo = TRUE;
/* Check if we're in a different thread */
if (Thread != CurrentThread)
@@ -638,6 +635,7 @@
Impersonation->CopyOnOpen = CopyOnOpen;
Impersonation->EffectiveOnly = EffectiveOnly;
Impersonation->Token = Token;
+ ObReferenceObject(Token);
/* Unlock the thread */
PspUnlockThreadSecurityExclusive(Thread);
Author: ion
Date: Sat Aug 26 10:14:32 2006
New Revision: 23714
URL: http://svn.reactos.org/svn/reactos?rev=23714&view=rev
Log:
- Transform TRAP_PROLOG into a GAS macro.
- Remove code in the page fault handler which was corrupting the trap frame.
- Remove some ROS hacks that dealt with the fact the trap frame was getting corrupted, since now it isn't anymore.
- Enable code that checks for Teb->GdiBatchCount during win32k system calls. The bugs that were mentionned in the #if 0 are fixed.
Modified:
trunk/reactos/include/ndk/asm.h
trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
trunk/reactos/ntoskrnl/ke/i386/trap.s
trunk/reactos/ntoskrnl/mm/i386/pfault.c
Modified: trunk/reactos/include/ndk/asm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/asm.h?rev=2371…
==============================================================================
--- trunk/reactos/include/ndk/asm.h (original)
+++ trunk/reactos/include/ndk/asm.h Sat Aug 26 10:14:32 2006
@@ -327,6 +327,7 @@
#define TEB_EXCEPTION_CODE 0x1A4
#define TEB_ACTIVATION_CONTEXT_STACK_POINTER 0x1A8
#define TEB_DEALLOCATION_STACK 0xE0C
+#define TEB_GDI_BATCH_COUNT 0xF70
#define TEB_GUARANTEED_STACK_BYTES 0xF78
#define TEB_FLS_DATA 0xFB4
Modified: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S Sat Aug 26 10:14:32 2006
@@ -266,63 +266,64 @@
// /* Handle trap */
// <Your Trap Code Here>
//
-#define TRAP_PROLOG(Label) \
- /* Just to be safe, clear out the HIWORD, since it's reserved */ \
- mov word ptr [esp+2], 0; \
-\
- /* Save the non-volatiles */ \
- push ebp; \
- push ebx; \
- push esi; \
- push edi; \
-\
- /* Save FS and set it to PCR */ \
- push fs; \
- mov ebx, KGDT_R0_PCR; \
- mov fs, bx; \
-\
- /* Save exception list and bogus previous mode */ \
- push fs:[KPCR_EXCEPTION_LIST]; \
- push -1; \
-\
- /* Save volatiles and segment registers */ \
- push eax; \
- push ecx; \
- push edx; \
- push ds; \
- push es; \
- push gs; \
-\
- /* Set the R3 data segment */ \
- mov ax, KGDT_R3_DATA + RPL_MASK; \
-\
- /* Skip debug registers and debug stuff */ \
- sub esp, 0x30; \
-\
- /* Load the segment registers */ \
- mov ds, ax; \
- mov es, ax; \
-\
- /* Set up frame */ \
- mov ebp, esp; \
-\
- /* Check if this was from V86 Mode */ \
- /* test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK; */ \
- /* jnz V86_Label; */ \
-\
- /* Get current thread */ \
- mov ecx, [fs:KPCR_CURRENT_THREAD]; \
- cld; \
-\
- /* Flush DR7 */ \
- and dword ptr [ebp+KTRAP_FRAME_DR7], 0; \
-\
- /* Check if the thread was being debugged */ \
- /* test byte ptr [ecx+KTHREAD_DEBUG_ACTIVE], 0xFF; */ \
- /* jnz Dr_Label; */ \
-\
- /* Set the Trap Frame Debug Header */ \
+.macro TRAP_PROLOG Label
+ /* Just to be safe, clear out the HIWORD, since it's reserved */
+ mov word ptr [esp+2], 0
+
+ /* Save the non-volatiles */
+ push ebp
+ push ebx
+ push esi
+ push edi
+
+ /* Save FS and set it to PCR */
+ push fs
+ mov ebx, KGDT_R0_PCR
+ mov fs, bx
+
+ /* Save exception list and bogus previous mode */
+ push fs:[KPCR_EXCEPTION_LIST]
+ push -1
+
+ /* Save volatiles and segment registers */
+ push eax
+ push ecx
+ push edx
+ push ds
+ push es
+ push gs
+
+ /* Set the R3 data segment */
+ mov ax, KGDT_R3_DATA + RPL_MASK
+
+ /* Skip debug registers and debug stuff */
+ sub esp, 0x30
+
+ /* Load the segment registers */
+ mov ds, ax
+ mov es, ax
+
+ /* Set up frame */
+ mov ebp, esp
+
+ /* Check if this was from V86 Mode */
+ /* test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK; */
+ /* jnz V86_Label; */
+
+ /* Get current thread */
+ mov ecx, [fs:KPCR_CURRENT_THREAD]
+ cld
+
+ /* Flush DR7 */
+ and dword ptr [ebp+KTRAP_FRAME_DR7], 0
+
+ /* Check if the thread was being debugged */
+ /* test byte ptr [ecx+KTHREAD_DEBUG_ACTIVE], 0xFF; */
+ /* jnz Dr_Label; */
+
+ /* Set the Trap Frame Debug Header */
SET_TF_DEBUG_HEADER
+.endm
//
// @name INT_PROLOG
@@ -507,23 +508,6 @@
/* Set the trap frame debug header */
SET_TF_DEBUG_HEADER
-#ifdef DBG // FIXME: Is this for GDB? Can it be moved in the stub?
- /*
- * We want to know the address from where the syscall stub was called.
- * If PrevMode is KernelMode, that address is stored in our own (kernel)
- * stack, at location KTRAP_FRAME_ESP.
- * If we're coming from UserMode, we load the usermode stack pointer
- * and go back two frames (first frame is the syscall stub, second call
- * is the caller of the stub).
- */
- mov edi, [ebp+KTRAP_FRAME_ESP]
- test byte ptr [esi+KTHREAD_PREVIOUS_MODE], 0x01
- jz 0f
- mov edi, [edi+4]
-0:
- mov [ebp+KTRAP_FRAME_DEBUGEIP], edi
-#endif
-
/* Enable interrupts */
sti
.endm
@@ -754,20 +738,9 @@
#if DBG
0:
-#if 0
- /* Print a message */
- mov esi, [esp+KTRAP_FRAME_DEBUGARGMARK]
- mov edi, [esp+KTRAP_FRAME_DEBUGARGMARK-4]
- push edi
- push esi
- push offset Broken
- call _DbgPrint
- add esp, 12
-#endif
- jmp 2b // ros hack
-
/* Fix up the mask */
add dword ptr [esp+KTRAP_FRAME_DEBUGARGMARK], 0xBADB0D00
+
6:
int 3
jmp 5b
Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/trap.s (original)
+++ trunk/reactos/ntoskrnl/ke/i386/trap.s Sat Aug 26 10:14:32 2006
@@ -187,23 +187,6 @@
/* Set the trap frame debug header */
SET_TF_DEBUG_HEADER
-#ifdef DBG // FIXME: Is this for GDB? Can it be moved in the stub?
- /*
- * We want to know the address from where the syscall stub was called.
- * If PrevMode is KernelMode, that address is stored in our own (kernel)
- * stack, at location KTRAP_FRAME_ESP.
- * If we're coming from UserMode, we load the usermode stack pointer
- * and go back two frames (first frame is the syscall stub, second call
- * is the caller of the stub).
- */
- mov edi, [ebp+KTRAP_FRAME_ESP]
- test byte ptr [esi+KTHREAD_PREVIOUS_MODE], 0x01
- jz PrevWasKernelMode
- mov edi, [edi+4]
-PrevWasKernelMode:
- mov [ebp+KTRAP_FRAME_DEBUGEIP], edi
-#endif
-
/* Enable interrupts */
sti
@@ -229,9 +212,6 @@
/* Invalid ID, try to load Win32K Table */
jnb KiBBTUnexpectedRange
-#if 0 // <== Disabled for two reasons: We don't save TEB in 0x18, but KPCR.
- // <== We don't have a KeGdiFlushUserBatch callback yet (needs to be
- // sent through the PsInitializeWin32Callouts structure)
/* Check if this was Win32K */
cmp ecx, SERVICE_TABLE_TEST
jnz NotWin32K
@@ -242,15 +222,14 @@
/* Check if we should flush the User Batch */
xor ebx, ebx
or ebx, [ecx+TEB_GDI_BATCH_COUNT]
- jz NoWin32K
+ jz NotWin32K
/* Flush it */
push edx
push eax
- call [_KeGdiFlushUserBatch]
+ //call [_KeGdiFlushUserBatch]
pop eax
pop edx
-#endif
NotWin32K:
/* Increase total syscall count */
Modified: trunk/reactos/ntoskrnl/mm/i386/pfault.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/pfault.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/pfault.c (original)
+++ trunk/reactos/ntoskrnl/mm/i386/pfault.c Sat Aug 26 10:14:32 2006
@@ -36,9 +36,6 @@
ASSERT(ExceptionNr == 14);
- /* Store the exception number in an unused field in the trap frame. */
- Tf->DbgArgMark = 14;
-
/* get the faulting address */
cr2 = Ke386GetCr2();
Tf->DbgArgPointer = cr2;