[NTDLL]
[reactos.git] / dll / ntdll / csr / capture.c
index 70a2b18..0a779ec 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
- * FILE:            lib/ntdll/csr/capture.c
+ * FILE:            dll/ntdll/csr/capture.c
  * PURPOSE:         Routines for probing and capturing CSR API Messages
  * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
  */
@@ -9,6 +9,7 @@
 /* INCLUDES *******************************************************************/
 
 #include <ntdll.h>
+
 #define NDEBUG
 #include <debug.h>
 
@@ -93,12 +94,16 @@ CsrAllocateCaptureBuffer(IN ULONG ArgumentCount,
     /* Validate size */
     if (BufferSize >= MAXLONG) return NULL;
 
-    /* Add the size of the header and for each pointer to the pointers */
-    BufferSize += FIELD_OFFSET(CSR_CAPTURE_BUFFER, PointerOffsetsArray) + (ArgumentCount * sizeof(ULONG_PTR));
+    /* Add the size of the header and for each offset to the pointers */
+    BufferSize += FIELD_OFFSET(CSR_CAPTURE_BUFFER, PointerOffsetsArray) +
+                    (ArgumentCount * sizeof(ULONG_PTR));
 
     /* Align it to a 4-byte boundary */
     BufferSize = (BufferSize + 3) & ~3;
 
+    /* Add the size of the alignment padding for each argument */
+    BufferSize += ArgumentCount * 3;
+
     /* Allocate memory from the port heap */
     CaptureBuffer = RtlAllocateHeap(CsrPortHeap, HEAP_ZERO_MEMORY, BufferSize);
     if (CaptureBuffer == NULL) return NULL;
@@ -107,7 +112,7 @@ CsrAllocateCaptureBuffer(IN ULONG ArgumentCount,
     CaptureBuffer->Size = BufferSize;
     CaptureBuffer->PointerCount = 0;
 
-    /* Initialize all the pointers */
+    /* Initialize all the offsets */
     RtlZeroMemory(CaptureBuffer->PointerOffsetsArray,
                   ArgumentCount * sizeof(ULONG_PTR));
 
@@ -263,7 +268,7 @@ CsrCaptureTimeout(IN ULONG Milliseconds,
     if (Milliseconds == -1) return NULL;
 
     /* Convert to relative ticks */
-    Timeout->QuadPart = Int32x32To64(Milliseconds, -100000);
+    Timeout->QuadPart = Int32x32To64(Milliseconds, -10000);
     return Timeout;
 }