Commit in reactos on MAIN
include/funcs.h+7-11.63 -> 1.64
include/ntos/types.h-81.41 -> 1.42
            /zw.h+37-371.31 -> 1.32
            /zwtypes.h+61.39 -> 1.40
lib/kernel32/synch/timer.c+2-21.18 -> 1.19
ntoskrnl/ke/timer.c+4-41.83 -> 1.84
ntoskrnl/nt/mutant.c+33-171.15 -> 1.16
           /ntevent.c+8-61.35 -> 1.36
           /ntsem.c+6-51.22 -> 1.23
           /nttimer.c+17-171.25 -> 1.26
+120-97
10 modified files
fixed prototypes of NtCreateMutant(), NtQueryMutant(), NtQuerySemaphore(), NtQueryTimer(), NtReleaseMutant(), NtReleaseSemaphore(), NtSetTimerResolution() and NtSetTimer()

reactos/include
funcs.h 1.63 -> 1.64
diff -u -r1.63 -r1.64
--- funcs.h	26 Sep 2004 15:55:52 -0000	1.63
+++ funcs.h	24 Oct 2004 16:49:48 -0000	1.64
@@ -8140,7 +8140,13 @@
 	 UINT uElapse,
 	 TIMERPROC lpTimerFunc);
 
-
+typedef
+VOID STDCALL_FUNC
+(*PTIMERAPCROUTINE)(
+	LPVOID lpArgToCompletionRoutine,
+	DWORD dwTimerLowValue,
+	DWORD dwTimerHighValue
+	);
 WINBOOL
 STDCALL
 SetWaitableTimer(HANDLE hTimer,

reactos/include/ntos
types.h 1.41 -> 1.42
diff -u -r1.41 -r1.42
--- types.h	23 Jul 2004 20:03:25 -0000	1.41
+++ types.h	24 Oct 2004 16:49:48 -0000	1.42
@@ -456,14 +456,6 @@
   SHORT Bottom;
 } SMALL_RECT, *PSMALL_RECT;
 
-
-typedef VOID STDCALL_FUNC
-(*PTIMERAPCROUTINE)(
-	LPVOID lpArgToCompletionRoutine,
-	DWORD dwTimerLowValue,
-	DWORD dwTimerHighValue
-	);
-
 #include "except.h"
 
 #else /* __USE_W32API */

reactos/include/ntos
zw.h 1.31 -> 1.32
diff -u -r1.31 -r1.32
--- zw.h	24 Oct 2004 15:26:13 -0000	1.31
+++ zw.h	24 Oct 2004 16:49:48 -0000	1.32
@@ -1,5 +1,5 @@
 
-/* $Id: zw.h,v 1.31 2004/10/24 15:26:13 weiden Exp $
+/* $Id: zw.h,v 1.32 2004/10/24 16:49:48 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -761,7 +761,7 @@
 NtCreateMutant(
 	OUT PHANDLE MutantHandle,
 	IN ACCESS_MASK DesiredAccess,
-	IN POBJECT_ATTRIBUTES ObjectAttributes,
+	IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
 	IN BOOLEAN InitialOwner
 	);
 
@@ -770,7 +770,7 @@
 ZwCreateMutant(
 	OUT PHANDLE MutantHandle,
 	IN ACCESS_MASK DesiredAccess,
-	IN POBJECT_ATTRIBUTES ObjectAttributes,
+	IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
 	IN BOOLEAN InitialOwner
 	);
 
@@ -2996,20 +2996,20 @@
 STDCALL
 NtQueryMutant(
 	IN HANDLE MutantHandle,
-	IN CINT MutantInformationClass,
+	IN MUTANT_INFORMATION_CLASS MutantInformationClass,
 	OUT PVOID MutantInformation,
-	IN ULONG Length,
-	OUT PULONG ResultLength
+	IN ULONG MutantInformationLength,
+	OUT PULONG ResultLength  OPTIONAL
 	);
 
 NTSTATUS
 STDCALL
 ZwQueryMutant(
 	IN HANDLE MutantHandle,
-	IN CINT MutantInformationClass,
+	IN MUTANT_INFORMATION_CLASS MutantInformationClass,
 	OUT PVOID MutantInformation,
-	IN ULONG Length,
-	OUT PULONG ResultLength
+	IN ULONG MutantInformationLength,
+	OUT PULONG ResultLength  OPTIONAL
 	);
 
 /*
@@ -3055,7 +3055,7 @@
 	IN	SEMAPHORE_INFORMATION_CLASS	SemaphoreInformationClass,
 	OUT	PVOID				SemaphoreInformation,
 	IN	ULONG				Length,
-	OUT	PULONG				ReturnLength
+	OUT	PULONG				ReturnLength  OPTIONAL
 	);
 
 NTSTATUS
@@ -3065,7 +3065,7 @@
 	IN	SEMAPHORE_INFORMATION_CLASS	SemaphoreInformationClass,
 	OUT	PVOID				SemaphoreInformation,
 	IN	ULONG				Length,
-	OUT	PULONG				ReturnLength
+	OUT	PULONG				ReturnLength  OPTIONAL
 	);
 
 
@@ -3172,19 +3172,19 @@
 STDCALL
 NtQueryTimer(
 	IN HANDLE TimerHandle,
-	IN CINT TimerInformationClass,
+	IN TIMER_INFORMATION_CLASS TimerInformationClass,
 	OUT PVOID TimerInformation,
-	IN ULONG Length,
-	OUT PULONG ResultLength
+	IN ULONG TimerInformationLength,
+	OUT PULONG ReturnLength  OPTIONAL
 	);
 NTSTATUS
 STDCALL
 ZwQueryTimer(
 	IN HANDLE TimerHandle,
-	IN CINT TimerInformationClass,
+	IN TIMER_INFORMATION_CLASS TimerInformationClass,
 	OUT PVOID TimerInformation,
-	IN ULONG Length,
-	OUT PULONG ResultLength
+	IN ULONG TimerInformationLength,
+	OUT PULONG ReturnLength  OPTIONAL
 	);
 
 /*
@@ -3519,14 +3519,14 @@
 STDCALL	
 NtReleaseMutant(
 	IN HANDLE MutantHandle,
-	IN PULONG ReleaseCount OPTIONAL
+	IN PLONG PreviousCount  OPTIONAL
 	);
 
 NTSTATUS
 STDCALL	
 ZwReleaseMutant(
 	IN HANDLE MutantHandle,
-	IN PULONG ReleaseCount OPTIONAL
+	IN PLONG PreviousCount  OPTIONAL
 	);
 
 /*
@@ -3542,7 +3542,7 @@
 NtReleaseSemaphore(
 	IN	HANDLE	SemaphoreHandle,
 	IN	LONG	ReleaseCount,
-	OUT	PLONG	PreviousCount
+	OUT	PLONG	PreviousCount  OPTIONAL
 	);
 
 NTSTATUS
@@ -3550,7 +3550,7 @@
 ZwReleaseSemaphore(
 	IN	HANDLE	SemaphoreHandle,
 	IN	LONG	ReleaseCount,
-	OUT	PLONG	PreviousCount
+	OUT	PLONG	PreviousCount  OPTIONAL
 	);
 
 /*
@@ -4316,16 +4316,16 @@
 NTSTATUS
 STDCALL
 NtSetTimerResolution(
-	IN ULONG RequestedResolution,
-	IN BOOL SetOrUnset,
-	OUT PULONG ActualResolution
+	IN ULONG DesiredResolution,
+	IN BOOLEAN SetResolution,
+	OUT PULONG CurrentResolution
 	);
 NTSTATUS
 STDCALL
 ZwSetTimerResolution(
-	IN ULONG RequestedResolution,
-	IN BOOL SetOrUnset,
-	OUT PULONG ActualResolution
+	IN ULONG DesiredResolution,
+	IN BOOLEAN SetResolution,
+	OUT PULONG CurrentResolution
 	);
 
 /*
@@ -5561,11 +5561,11 @@
 NtSetTimer(
 	IN HANDLE TimerHandle,
 	IN PLARGE_INTEGER DueTime,
-	IN PTIMERAPCROUTINE TimerApcRoutine,
-	IN PVOID TimerContext,
-	IN BOOL WakeTimer,
-	IN ULONG Period OPTIONAL,
-	OUT PBOOLEAN PreviousState OPTIONAL
+	IN PTIMER_APC_ROUTINE TimerApcRoutine  OPTIONAL,
+	IN PVOID TimerContext  OPTIONAL,
+	IN BOOLEAN ResumeTimer,
+	IN LONG Period  OPTIONAL,
+	OUT PBOOLEAN PreviousState  OPTIONAL
 	);
 
 /*
@@ -6326,11 +6326,11 @@
 ZwSetTimer(
 	IN HANDLE TimerHandle,
 	IN PLARGE_INTEGER DueTime,
-	IN PTIMERAPCROUTINE TimerApcRoutine,
-	IN PVOID TimerContext,
-	IN BOOL WakeTimer,
-	IN ULONG Period OPTIONAL,
-	OUT PBOOLEAN PreviousState OPTIONAL
+	IN PTIMER_APC_ROUTINE TimerApcRoutine  OPTIONAL,
+	IN PVOID TimerContext  OPTIONAL,
+	IN BOOLEAN ResumeTimer,
+	IN LONG Period  OPTIONAL,
+	OUT PBOOLEAN PreviousState  OPTIONAL
 	);
 
 /*

reactos/include/ntos
zwtypes.h 1.39 -> 1.40
diff -u -r1.39 -r1.40
--- zwtypes.h	8 Oct 2004 21:14:21 -0000	1.39
+++ zwtypes.h	24 Oct 2004 16:49:48 -0000	1.40
@@ -1793,6 +1793,12 @@
 
 typedef struct _KINTERRUPT *PKINTERRUPT;
 
+typedef VOID STDCALL_FUNC
+(*PTIMER_APC_ROUTINE)(
+  IN PVOID  TimerContext,
+  IN ULONG  TimerLowValue,
+  IN LONG  TimerHighValue);
+
 #endif /* __USE_W32API */
 
 /* BEGIN REACTOS ONLY */

reactos/lib/kernel32/synch
timer.c 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- timer.c	24 Oct 2004 12:26:27 -0000	1.18
+++ timer.c	24 Oct 2004 16:49:48 -0000	1.19
@@ -1,4 +1,4 @@
-/* $Id: timer.c,v 1.18 2004/10/24 12:26:27 weiden Exp $
+/* $Id: timer.c,v 1.19 2004/10/24 16:49:48 weiden Exp $
  *
  * COPYRIGHT:            See COPYING in the top level directory
  * PROJECT:              ReactOS kernel
@@ -188,7 +188,7 @@
 
    Status = NtSetTimer(hTimer,
 		       (LARGE_INTEGER *)pDueTime,
-		       pfnCompletionRoutine,
+		       (PTIMER_APC_ROUTINE)pfnCompletionRoutine,
 		       lpArgToCompletionRoutine,
 		       fResume,
 		       lPeriod,

reactos/ntoskrnl/ke
timer.c 1.83 -> 1.84
diff -u -r1.83 -r1.84
--- timer.c	23 Oct 2004 14:52:51 -0000	1.83
+++ timer.c	24 Oct 2004 16:49:49 -0000	1.84
@@ -1,4 +1,4 @@
-/* $Id: timer.c,v 1.83 2004/10/23 14:52:51 blight Exp $
+/* $Id: timer.c,v 1.84 2004/10/24 16:49:49 weiden Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -95,9 +95,9 @@
 
 
 NTSTATUS STDCALL
-NtSetTimerResolution(IN ULONG RequestedResolution,
-		     IN BOOL SetOrUnset,
-		     OUT PULONG ActualResolution)
+NtSetTimerResolution(IN ULONG DesiredResolution,
+		     IN BOOLEAN SetResolution,
+		     OUT PULONG CurrentResolution)
 {
   UNIMPLEMENTED;
   return STATUS_NOT_IMPLEMENTED;

reactos/ntoskrnl/nt
mutant.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- mutant.c	15 Aug 2004 16:39:09 -0000	1.15
+++ mutant.c	24 Oct 2004 16:49:49 -0000	1.16
@@ -106,7 +106,7 @@
 NTSTATUS STDCALL
 NtCreateMutant(OUT PHANDLE MutantHandle,
 	       IN ACCESS_MASK DesiredAccess,
-	       IN POBJECT_ATTRIBUTES ObjectAttributes,
+	       IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
 	       IN BOOLEAN InitialOwner)
 {
   PKMUTEX Mutant;
@@ -159,21 +159,19 @@
 
 NTSTATUS STDCALL
 NtQueryMutant(IN HANDLE MutantHandle,
-	      IN CINT MutantInformationClass,
+	      IN MUTANT_INFORMATION_CLASS MutantInformationClass,
 	      OUT PVOID MutantInformation,
-	      IN ULONG Length,
-	      OUT PULONG ResultLength)
+	      IN ULONG MutantInformationLength,
+	      OUT PULONG ResultLength  OPTIONAL)
 {
-  PMUTANT_BASIC_INFORMATION Info;
+  MUTANT_BASIC_INFORMATION SafeMutantInformation;
   PKMUTANT Mutant;
   NTSTATUS Status;
 
-  Info = (PMUTANT_BASIC_INFORMATION)MutantInformation;
-
   if (MutantInformationClass > MutantBasicInformation)
     return(STATUS_INVALID_INFO_CLASS);
 
-  if (Length < sizeof(MUTANT_BASIC_INFORMATION))
+  if (MutantInformationLength < sizeof(MUTANT_BASIC_INFORMATION))
     return(STATUS_INFO_LENGTH_MISMATCH);
 
   Status = ObReferenceObjectByHandle(MutantHandle,
@@ -187,23 +185,37 @@
       return(Status);
     }
 
-  Info->Count = KeReadStateMutant(Mutant);
-  Info->Owned = (Mutant->OwnerThread != NULL);
-  Info->Abandoned = Mutant->Abandoned;
+  SafeMutantInformation.Count = KeReadStateMutant(Mutant);
+  SafeMutantInformation.Owned = (Mutant->OwnerThread != NULL);
+  SafeMutantInformation.Abandoned = Mutant->Abandoned;
 
   ObDereferenceObject(Mutant);
+  
+  Status = MmCopyToCaller(MutantInformation, &SafeMutantInformation, sizeof(MUTANT_BASIC_INFORMATION));
+  if(NT_SUCCESS(Status))
+  {
+    if(ResultLength != NULL)
+    {
+      ULONG RetLen = sizeof(MUTANT_BASIC_INFORMATION);
+      Status = MmCopyToCaller(ResultLength, &RetLen, sizeof(ULONG));
+    }
+    else
+    {
+      Status = STATUS_SUCCESS;
+    }
+  }
 
-  return(STATUS_SUCCESS);
+  return Status;
 }
 
 
 NTSTATUS STDCALL
 NtReleaseMutant(IN HANDLE MutantHandle,
-		IN PULONG ReleaseCount OPTIONAL)
+		IN PLONG PreviousCount  OPTIONAL)
 {
   PKMUTANT Mutant;
   NTSTATUS Status;
-  ULONG Count;
+  LONG Count;
 
   Status = ObReferenceObjectByHandle(MutantHandle,
 				     MUTANT_ALL_ACCESS,
@@ -222,12 +234,16 @@
 			  FALSE);
   ObDereferenceObject(Mutant);
 
-  if (ReleaseCount != NULL)
+  if (PreviousCount != NULL)
+    {
+      Status = MmCopyToCaller(PreviousCount, &Count, sizeof(LONG));
+    }
+  else
     {
-      *ReleaseCount = Count;
+      Status = STATUS_SUCCESS;
     }
 
-  return(STATUS_SUCCESS);
+  return Status;
 }
 
 /* EOF */

reactos/ntoskrnl/nt
ntevent.c 1.35 -> 1.36
diff -u -r1.35 -r1.36
--- ntevent.c	24 Oct 2004 15:26:14 -0000	1.35
+++ ntevent.c	24 Oct 2004 16:49:49 -0000	1.36
@@ -282,16 +282,18 @@
        return(Status);
      }
 
-   RetLen = sizeof(EVENT_BASIC_INFORMATION);
-   Status = MmCopyToCaller(ReturnLength, &RetLen, sizeof(ULONG));
-   if (!NT_SUCCESS(Status))
+   if (ReturnLength != NULL)
      {
-       ObDereferenceObject(Event);
-       return(Status);
+       RetLen = sizeof(EVENT_BASIC_INFORMATION);
+       Status = MmCopyToCaller(ReturnLength, &RetLen, sizeof(ULONG));
+       if (!NT_SUCCESS(Status))
+         {
+           ObDereferenceObject(Event);
+           return(Status);
+         }
      }
 
    ObDereferenceObject(Event);
-
    return(STATUS_SUCCESS);
 }
 

reactos/ntoskrnl/nt
ntsem.c 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- ntsem.c	15 Aug 2004 16:39:09 -0000	1.22
+++ ntsem.c	24 Oct 2004 16:49:49 -0000	1.23
@@ -1,4 +1,4 @@
-/* $Id: ntsem.c,v 1.22 2004/08/15 16:39:09 chorns Exp $
+/* $Id: ntsem.c,v 1.23 2004/10/24 16:49:49 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -76,7 +76,7 @@
 NTSTATUS STDCALL
 NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
 		  IN ACCESS_MASK DesiredAccess,
-		  IN POBJECT_ATTRIBUTES ObjectAttributes,
+		  IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
 		  IN LONG InitialCount,
 		  IN LONG MaximumCount)
 {
@@ -138,7 +138,7 @@
 		 IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
 		 OUT PVOID SemaphoreInformation,
 		 IN ULONG SemaphoreInformationLength,
-		 OUT PULONG ReturnLength)
+		 OUT PULONG ReturnLength  OPTIONAL)
 {
    PSEMAPHORE_BASIC_INFORMATION Info;
    PKSEMAPHORE Semaphore;
@@ -164,7 +164,8 @@
    Info->CurrentCount = KeReadStateSemaphore(Semaphore);
    Info->MaximumCount = Semaphore->Limit;
 
-   *ReturnLength = sizeof(SEMAPHORE_BASIC_INFORMATION);
+   if (ReturnLength != NULL)
+     *ReturnLength = sizeof(SEMAPHORE_BASIC_INFORMATION);
 
    ObDereferenceObject(Semaphore);
 
@@ -174,7 +175,7 @@
 NTSTATUS STDCALL
 NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
 		   IN LONG ReleaseCount,
-		   OUT PLONG PreviousCount)
+		   OUT PLONG PreviousCount  OPTIONAL)
 {
    PKSEMAPHORE Semaphore;
    NTSTATUS Status;

reactos/ntoskrnl/nt
nttimer.c 1.25 -> 1.26
diff -u -r1.25 -r1.26
--- nttimer.c	22 Oct 2004 20:41:10 -0000	1.25
+++ nttimer.c	24 Oct 2004 16:49:49 -0000	1.26
@@ -1,4 +1,4 @@
-/* $Id: nttimer.c,v 1.25 2004/10/22 20:41:10 ekohl Exp $
+/* $Id: nttimer.c,v 1.26 2004/10/24 16:49:49 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -243,13 +243,13 @@
 
 NTSTATUS STDCALL
 NtQueryTimer(IN HANDLE TimerHandle,
-	     IN CINT TimerInformationClass,
-	     OUT PVOID UnsafeTimerInformation,
-	     IN ULONG Length,
-	     OUT PULONG UnsafeResultLength)
+	     IN TIMER_INFORMATION_CLASS TimerInformationClass,
+	     OUT PVOID TimerInformation,
+	     IN ULONG TimerInformationLength,
+	     OUT PULONG ReturnLength  OPTIONAL)
 {
   PNTTIMER Timer;
-  TIMER_BASIC_INFORMATION TimerInformation;
+  TIMER_BASIC_INFORMATION SafeTimerInformation;
   ULONG ResultLength;
   NTSTATUS Status;
 
@@ -269,18 +269,18 @@
       ObDereferenceObject(Timer);
       return(STATUS_INVALID_INFO_CLASS);
     }
-  if (Length < sizeof(TIMER_BASIC_INFORMATION))
+  if (TimerInformationLength < sizeof(TIMER_BASIC_INFORMATION))
     {
       ObDereferenceObject(Timer);
       return(STATUS_INFO_LENGTH_MISMATCH);
     }
 
-  memcpy(&TimerInformation.TimeRemaining, &Timer->Timer.DueTime,
+  memcpy(&SafeTimerInformation.TimeRemaining, &Timer->Timer.DueTime,
 	 sizeof(LARGE_INTEGER));
-  TimerInformation.SignalState = (BOOLEAN)Timer->Timer.Header.SignalState;
+  SafeTimerInformation.SignalState = (BOOLEAN)Timer->Timer.Header.SignalState;
   ResultLength = sizeof(TIMER_BASIC_INFORMATION);
 
-  Status = MmCopyToCaller(UnsafeTimerInformation, &TimerInformation,
+  Status = MmCopyToCaller(TimerInformation, &SafeTimerInformation,
 			  sizeof(TIMER_BASIC_INFORMATION));
   if (!NT_SUCCESS(Status))
     {
@@ -288,9 +288,9 @@
       return(Status);
     }
 
-  if (UnsafeResultLength != NULL)
+  if (ReturnLength != NULL)
     {
-      Status = MmCopyToCaller(UnsafeResultLength, &ResultLength,
+      Status = MmCopyToCaller(ReturnLength, &ResultLength,
 			      sizeof(ULONG));
       if (!NT_SUCCESS(Status))
 	{
@@ -306,11 +306,11 @@
 NTSTATUS STDCALL
 NtSetTimer(IN HANDLE TimerHandle,
 	   IN PLARGE_INTEGER DueTime,
-	   IN PTIMERAPCROUTINE TimerApcRoutine,
-	   IN PVOID TimerContext,
-	   IN BOOL WakeTimer,
-	   IN ULONG Period OPTIONAL,
-	   OUT PBOOLEAN PreviousState OPTIONAL)
+	   IN PTIMER_APC_ROUTINE TimerApcRoutine  OPTIONAL,
+	   IN PVOID TimerContext  OPTIONAL,
+	   IN BOOLEAN ResumeTimer,
+	   IN LONG Period  OPTIONAL,
+	   OUT PBOOLEAN PreviousState  OPTIONAL)
 {
    PNTTIMER Timer;
    NTSTATUS Status;
CVSspam 0.2.8