Author: cgutman
Date: Sat Mar 28 04:23:50 2009
New Revision: 40263
URL:
http://svn.reactos.org/svn/reactos?rev=40263&view=rev
Log:
- More LockBuffers fixes
- Now attempting to sync the clock with a network time server doesn't cause an access
violation
Modified:
trunk/reactos/drivers/network/afd/afd/lock.c
Modified: trunk/reactos/drivers/network/afd/afd/lock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/lo…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] Sat Mar 28 04:23:50 2009
@@ -69,7 +69,7 @@
BOOLEAN Write, BOOLEAN LockAddress ) {
UINT i;
/* Copy the buffer array so we don't lose it */
- UINT Lock = (LockAddress && AddressLen) ? 2 : 0;
+ UINT Lock = LockAddress ? 2 : 0;
UINT Size = sizeof(AFD_WSABUF) * (Count + Lock);
PAFD_WSABUF NewBuf = ExAllocatePool( PagedPool, Size * 2 );
BOOLEAN LockFailed = FALSE;
@@ -77,17 +77,20 @@
AFD_DbgPrint(MID_TRACE,("Called(%08x)\n", NewBuf));
if( NewBuf ) {
+ RtlZeroMemory(NewBuf, Size * 2);
+
PAFD_MAPBUF MapBuf = (PAFD_MAPBUF)(NewBuf + Count + Lock);
_SEH2_TRY {
RtlCopyMemory( NewBuf, Buf, sizeof(AFD_WSABUF) * Count );
- if( Lock != 0 ) {
- NewBuf[Count].buf = AddressBuf;
- NewBuf[Count].len = *AddressLen;
- Count++;
- NewBuf[Count].buf = (PVOID)AddressLen;
- NewBuf[Count].len = sizeof(*AddressLen);
- Count++;
+ if( LockAddress ) {
+ if (AddressBuf && AddressLen) {
+ NewBuf[Count].buf = AddressBuf;
+ NewBuf[Count].len = *AddressLen;
+ NewBuf[Count + 1].buf = (PVOID)AddressLen;
+ NewBuf[Count + 1].len = sizeof(*AddressLen);
+ }
+ Count += 2;
}
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
AFD_DbgPrint(MIN_TRACE,("Access violation copying buffer info "