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

Alexander Morozov amorozov на etersoft.ru
Пт Окт 23 17:33:17 MSD 2009


----------- следующая часть -----------
From f4e7e18d59d0b3a1b6911b541e01166bfca4879f 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 |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index aec5258..60943a5 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,19 +993,19 @@ 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 );
     }
+    __TRY { *commio->events = events; } __EXCEPT_PAGE_FAULT {} __ENDTRY
     if (commio->iosb) commio->iosb->u.Status = *commio->events ? STATUS_SUCCESS : STATUS_CANCELLED;
     if (commio->hEvent) NtSetEvent(commio->hEvent, NULL);
     RtlFreeHeap(GetProcessHeap(), 0, commio);
-- 
1.6.4.4



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