Author: ekohl Date: Sun May 7 16:48:45 2006 New Revision: 21828
URL: http://svn.reactos.ru/svn/reactos?rev=21828&view=rev Log: Fix timeout handling.
Modified: trunk/reactos/dll/win32/kernel32/file/mailslot.c
Modified: trunk/reactos/dll/win32/kernel32/file/mailslot.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/kernel32/file/mail... ============================================================================== --- trunk/reactos/dll/win32/kernel32/file/mailslot.c (original) +++ trunk/reactos/dll/win32/kernel32/file/mailslot.c Sun May 7 16:48:45 2006 @@ -88,7 +88,17 @@ NULL, SecurityDescriptor);
- DefaultTimeOut.QuadPart = lReadTimeout * 10000; + if (lReadTimeout == MAILSLOT_WAIT_FOREVER) + { + /* Set the max */ + DefaultTimeOut.LowPart = 0; + DefaultTimeOut.HighPart = 0x80000000; + } + else + { + /* Convert to NT format */ + DefaultTimeOut.QuadPart = UInt32x32To64(-10000, lReadTimeout); + }
Status = NtCreateMailslotFile(&MailslotHandle, GENERIC_READ | SYNCHRONIZE | WRITE_DAC, @@ -154,7 +164,11 @@ } if (lpReadTimeout != NULL) { - *lpReadTimeout = (DWORD)(Buffer.ReadTimeout.QuadPart / -10000); + if (Buffer.ReadTimeout.LowPart == 0 && + Buffer.ReadTimeout.HighPart == 0x80000000) + *lpReadTimeout = MAILSLOT_WAIT_FOREVER; + else + *lpReadTimeout = (DWORD)(Buffer.ReadTimeout.QuadPart / -10000); }
return(TRUE); @@ -173,7 +187,17 @@ IO_STATUS_BLOCK Iosb; NTSTATUS Status;
- Timeout.QuadPart = lReadTimeout * -10000; + if (lReadTimeout == MAILSLOT_WAIT_FOREVER) + { + /* Set the max */ + Timeout.LowPart = 0; + Timeout.HighPart = 0x80000000; + } + else + { + /* Convert to NT format */ + Timeout.QuadPart = UInt32x32To64(-10000, lReadTimeout); + } Buffer.ReadTimeout = &Timeout;
Status = NtSetInformationFile(hMailslot,