https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fbdff437fd072429a9738eddc27f21242cdca0c8

commit fbdff437fd072429a9738eddc27f21242cdca0c8
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Tue May 28 11:06:56 2019 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Oct 31 14:23:16 2020 +0100

    [NTOS:KE:X64] Implement flushing the GDI batch
---
 ntoskrnl/ke/amd64/stubs.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/ntoskrnl/ke/amd64/stubs.c b/ntoskrnl/ke/amd64/stubs.c
index c23c02b0849..fee659737b9 100644
--- a/ntoskrnl/ke/amd64/stubs.c
+++ b/ntoskrnl/ke/amd64/stubs.c
@@ -432,6 +432,28 @@ KiSystemCallHandler(
     Offset = (ServiceNumber >> SERVICE_TABLE_SHIFT) & SERVICE_TABLE_MASK;
     ServiceNumber &= SERVICE_NUMBER_MASK;
 
+    /* Check for win32k system calls */
+    if (Offset & SERVICE_TABLE_TEST)
+    {
+        ULONG GdiBatchCount;
+
+        /* Read the GDI batch count from the TEB */
+        _SEH2_TRY
+        {
+            GdiBatchCount = NtCurrentTeb()->GdiBatchCount;
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            GdiBatchCount = 0;
+        }
+
+        /* Flush batch, if there are entries */
+        if (GdiBatchCount != 0)
+        {
+            KeGdiFlushUserBatch();
+        }
+    }
+
     /* Get descriptor table */
     DescriptorTable = (PVOID)((ULONG_PTR)Thread->ServiceTable + Offset);
 

Reply via email to