[Wine-patches] [try 2] [eterhack] ntdll: Prevent 1C crash (eterbug #2827).

Alexander Morozov amorozov на etersoft.ru
Пн Окт 26 12:26:50 MSK 2009


----------- следующая часть -----------
From 129a277ed87a9bf8b48308b7a4dfd03efc5a17cf Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Fri, 23 Oct 2009 17:28:23 +0400
Subject: [eterhack] ntdll: Prevent 1C crash (eterbug #2827).

---
 dlls/ntdll/serial.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index aec5258..02416b7 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -72,6 +72,7 @@
 #include "wine/server.h"
 #include "wine/library.h"
 #include "wine/debug.h"
+#include "wine/exception.h"
 
 #ifdef HAVE_LINUX_SERIAL_H
 #ifdef HAVE_ASM_TYPES_H
@@ -967,6 +968,7 @@ static DWORD CALLBACK wait_for_event(LPVOID arg)
 {
     async_commio *commio = arg;
     int fd, needs_close;
+    DWORD events;
 
     if (!server_get_unix_fd( commio->hDevice, FILE_READ_DATA | FILE_WRITE_DATA, &fd, &needs_close, NULL, NULL ))
     {
@@ -991,20 +993,20 @@ static DWORD CALLBACK wait_for_event(LPVOID arg)
             get_irq_info(fd, &new_irq_info);
             if (get_modem_status(fd, &new_mstat))
                 TRACE("get_modem_status failed\n");
-            *commio->events = check_events(fd, commio->evtmask,
-                                           &new_irq_info, &commio->irq_info,
-                                           new_mstat, commio->mstat);
-            if (*commio->events) break;
+            events = check_events(fd, commio->evtmask, &new_irq_info,
+                                  &commio->irq_info, new_mstat, commio->mstat);
+            if (events) break;
             get_wait_mask(commio->hDevice, &new_evtmask);
             if (commio->evtmask != new_evtmask)
             {
-                *commio->events = 0;
+                events = 0;
                 break;
             }
         }
         if (needs_close) close( fd );
     }
-    if (commio->iosb) commio->iosb->u.Status = *commio->events ? STATUS_SUCCESS : STATUS_CANCELLED;
+    __TRY { *commio->events = events; } __EXCEPT_PAGE_FAULT {} __ENDTRY
+    if (commio->iosb) commio->iosb->u.Status = events ? STATUS_SUCCESS : STATUS_CANCELLED;
     if (commio->hEvent) NtSetEvent(commio->hEvent, NULL);
     RtlFreeHeap(GetProcessHeap(), 0, commio);
     return 0;
-- 
1.6.4.4



Подробная информация о списке рассылки Wine-patches