it's valid to pass lpTargetHandle = NULL to DuplicateHandle()
Modified: trunk/reactos/ntoskrnl/ob/handle.c

Modified: trunk/reactos/ntoskrnl/ob/handle.c
--- trunk/reactos/ntoskrnl/ob/handle.c	2005-05-04 20:38:43 UTC (rev 14977)
+++ trunk/reactos/ntoskrnl/ob/handle.c	2005-05-04 21:23:13 UTC (rev 14978)
@@ -347,7 +347,7 @@
 NtDuplicateObject (IN	HANDLE		SourceProcessHandle,
 		   IN	HANDLE		SourceHandle,
 		   IN	HANDLE		TargetProcessHandle,
-		   OUT	PHANDLE		TargetHandle,
+		   OUT	PHANDLE		TargetHandle  OPTIONAL,
 		   IN	ACCESS_MASK	DesiredAccess,
 		   IN	BOOLEAN		InheritHandle,
 		   ULONG		Options)
@@ -386,7 +386,7 @@
    
    PreviousMode = ExGetPreviousMode();
    
-   if(PreviousMode != KernelMode)
+   if(TargetHandle != NULL && PreviousMode != KernelMode)
    {
      _SEH_TRY
      {
@@ -488,7 +488,7 @@
    ObDereferenceObject(TargetProcess);
    ObDereferenceObject(SourceProcess);
 
-   if(NT_SUCCESS(Status))
+   if(NT_SUCCESS(Status) && TargetHandle != NULL)
    {
      _SEH_TRY
      {