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

commit 2363fee51f835e2087ea2291f57250b062dc1478
Author:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
AuthorDate: Sat Mar 24 23:07:35 2018 +0100
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Sat Apr 7 18:48:12 2018 +0200

    [USERSRV] Hard-error improvements 6/7
    
    Make UserpFormatMessages() return the possible timeout for the hard error; 
use it when displaying the hard error message boxes.
---
 win32ss/user/winsrv/usersrv/harderror.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/win32ss/user/winsrv/usersrv/harderror.c 
b/win32ss/user/winsrv/usersrv/harderror.c
index 9a1d2c7f32..9248d60f92 100644
--- a/win32ss/user/winsrv/usersrv/harderror.c
+++ b/win32ss/user/winsrv/usersrv/harderror.c
@@ -346,6 +346,7 @@ UserpFormatMessages(
     IN OUT PUNICODE_STRING TextStringU,
     IN OUT PUNICODE_STRING CaptionStringU,
     OUT PUINT pdwType,
+    OUT PULONG pdwTimeout,
     IN PHARDERROR_MSG Message)
 {
     NTSTATUS Status;
@@ -418,6 +419,12 @@ UserpFormatMessages(
             CaptionStringU->Length = 0;
         }
 
+        /* Set the timeout */
+        if (Message->NumberOfParameters >= 4)
+            *pdwTimeout = (ULONG)Parameters[3];
+        else
+            *pdwTimeout = INFINITE;
+
         goto Quit;
     }
 
@@ -462,6 +469,9 @@ UserpFormatMessages(
 
     *pdwType |= MB_SYSTEMMODAL | MB_SETFOREGROUND;
 
+    /* Set the timeout */
+    *pdwTimeout = INFINITE;
+
     /* Copy the Parameters array locally */
     RtlCopyMemory(&CopyParameters, Parameters, sizeof(CopyParameters));
 
@@ -991,7 +1001,8 @@ UserServerHardError(
     IN PHARDERROR_MSG Message)
 {
     ULONG ErrorMode;
-    UINT dwType = 0;
+    UINT  dwType = 0;
+    ULONG Timeout = INFINITE;
     UNICODE_STRING TextU, CaptionU;
     WCHAR LocalTextBuffer[256];
     WCHAR LocalCaptionBuffer[256];
@@ -1029,7 +1040,7 @@ UserServerHardError(
     /* Format the message caption and text */
     RtlInitEmptyUnicodeString(&TextU, LocalTextBuffer, 
sizeof(LocalTextBuffer));
     RtlInitEmptyUnicodeString(&CaptionU, LocalCaptionBuffer, 
sizeof(LocalCaptionBuffer));
-    UserpFormatMessages(&TextU, &CaptionU, &dwType, /* &Timeout, */ Message);
+    UserpFormatMessages(&TextU, &CaptionU, &dwType, &Timeout, Message);
 
     /* Log the hard error message */
     UserpLogHardError(&TextU, &CaptionU);
@@ -1065,7 +1076,7 @@ UserServerHardError(
     Message->Response = UserpMessageBox(TextU.Buffer,
                                         CaptionU.Buffer,
                                         dwType,
-                                        (ULONG)-1);
+                                        Timeout);
 
 Quit:
     /* Free the strings if they have been reallocated */

Reply via email to