Commit in reactos on MAIN
include/csrss/csrss.h-51.45 -> 1.46
include/funcs.h+4-41.61 -> 1.62
include/ntos/ps.h+101.10 -> 1.11
            /zwtypes.h+2-21.37 -> 1.38
lib/kernel32/k32.h-11.9 -> 1.10
lib/kernel32/process/proc.c+108-871.65 -> 1.66
lib/ntdll/csr/thread.c+2-21.4 -> 1.5
+126-101
7 modified files
1. implemented SetProcessWorkingSetSize()
2. fixed Set/GetPriorityClass() not to call csrss and use NtSet/QueryInformationProcess() instead

reactos/include/csrss
csrss.h 1.45 -> 1.46
diff -u -r1.45 -r1.46
--- csrss.h	22 Aug 2004 20:52:28 -0000	1.45
+++ csrss.h	19 Sep 2004 14:36:46 -0000	1.46
@@ -5,11 +5,6 @@
 #include <ddk/ntddblue.h>
 #include <ntos.h>
 
-#define CSR_PRIORITY_CLASS_NORMAL	(0x10)
-#define CSR_PRIORITY_CLASS_IDLE		(0x20)
-#define CSR_PRIORITY_CLASS_HIGH		(0x40)
-#define CSR_PRIORITY_CLASS_REALTIME	(0x80)
-
 #define CSR_CSRSS_SECTION_SIZE          (65536)
 
 typedef __declspec(noreturn) VOID CALLBACK(*PCONTROLDISPATCHER)(DWORD);

reactos/include
funcs.h 1.61 -> 1.62
diff -u -r1.61 -r1.62
--- funcs.h	6 Sep 2004 21:15:44 -0000	1.61
+++ funcs.h	19 Sep 2004 14:36:46 -0000	1.62
@@ -5049,16 +5049,16 @@
 STDCALL
 GetProcessWorkingSetSize(
 			 HANDLE hProcess,
-			 LPDWORD lpMinimumWorkingSetSize,
-			 LPDWORD lpMaximumWorkingSetSize
+			 PSIZE_T lpMinimumWorkingSetSize,
+			 PSIZE_T lpMaximumWorkingSetSize
 			 );
 
 WINBOOL
 STDCALL
 SetProcessWorkingSetSize(
 			 HANDLE hProcess,
-			 DWORD dwMinimumWorkingSetSize,
-			 DWORD dwMaximumWorkingSetSize
+			 SIZE_T dwMinimumWorkingSetSize,
+			 SIZE_T dwMaximumWorkingSetSize
 			 );
 
 HANDLE

reactos/include/ntos
ps.h 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- ps.h	30 Dec 2003 18:34:58 -0000	1.10
+++ ps.h	19 Sep 2004 14:36:47 -0000	1.11
@@ -26,6 +26,14 @@
 #define THREAD_PRIORITY_IDLE	(-15)
 #define THREAD_PRIORITY_LOWEST	(-2)
 
+/* Process priority classes */
+#define PROCESS_PRIORITY_CLASS_HIGH	(4) /* FIXME */
+#define PROCESS_PRIORITY_CLASS_IDLE	(0) /* FIXME */
+#define PROCESS_PRIORITY_CLASS_NORMAL	(2) /* FIXME */
+#define PROCESS_PRIORITY_CLASS_REALTIME	(5) /* FIXME */
+#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL (1) /* FIXME */
+#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL (3) /* FIXME */
+
 #ifndef __USE_W32API
 
 /* Thread access rights */
@@ -77,6 +85,8 @@
 #define IDLE_PRIORITY_CLASS	(64)
 #define NORMAL_PRIORITY_CLASS	(32)
 #define REALTIME_PRIORITY_CLASS	(256)
+#define BELOW_NORMAL_PRIORITY_CLASS (16384)
+#define ABOVE_NORMAL_PRIORITY_CLASS (32768)
 
 /* ResumeThread / SuspendThread */
 #define MAXIMUM_SUSPEND_COUNT	(0x7f)

reactos/include/ntos
zwtypes.h 1.37 -> 1.38
diff -u -r1.37 -r1.38
--- zwtypes.h	17 Jul 2004 03:06:01 -0000	1.37
+++ zwtypes.h	19 Sep 2004 14:36:47 -0000	1.38
@@ -646,8 +646,8 @@
 {
 	ULONG PagedPoolLimit;
 	ULONG NonPagedPoolLimit;
-	ULONG MinimumWorkingSetSize;
-	ULONG MaximumWorkingSetSize;
+	SIZE_T MinimumWorkingSetSize;
+	SIZE_T MaximumWorkingSetSize;
 	ULONG PagefileLimit;
 	TIME TimeLimit;
 } QUOTA_LIMITS, *PQUOTA_LIMITS;

reactos/lib/kernel32
k32.h 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- k32.h	3 Jul 2004 17:40:22 -0000	1.9
+++ k32.h	19 Sep 2004 14:36:47 -0000	1.10
@@ -22,7 +22,6 @@
 #include <napi/teb.h>
 #include <napi/npipe.h>
 #include <napi/types.h>
-#include <ntos/minmax.h>
 #include <csrss/csrss.h>
 #include <reactos/buildno.h>
 #include <rosrtl/thread.h>

reactos/lib/kernel32/process
proc.c 1.65 -> 1.66
diff -u -r1.65 -r1.66
--- proc.c	13 Sep 2004 19:10:45 -0000	1.65
+++ proc.c	19 Sep 2004 14:36:47 -0000	1.66
@@ -1,4 +1,4 @@
-/* $Id: proc.c,v 1.65 2004/09/13 19:10:45 gvg Exp $
+/* $Id: proc.c,v 1.66 2004/09/19 14:36:47 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -13,7 +13,6 @@
 
 #include <k32.h>
 
-
 #define NDEBUG
 #include "../include/debug.h"
 
@@ -52,7 +51,7 @@
 				      &BytesWritten);
   if (!NT_SUCCESS(Status))
     {
-      SetLastError (Status);
+      SetLastErrorByStatus (Status);
       return FALSE;
     }
 
@@ -80,7 +79,7 @@
 				    sizeof(DWORD));
   if (!NT_SUCCESS(Status))
     {
-      SetLastError (Status);
+      SetLastErrorByStatus (Status);
       return FALSE;
     }
 
@@ -106,7 +105,7 @@
 			       sizeof(CSRSS_API_REPLY));
   if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
     {
-      SetLastError(Status);
+      SetLastErrorByStatus (Status);
       return(FALSE);
     }
 
@@ -138,7 +137,7 @@
 			       sizeof(CSRSS_API_REPLY));
   if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
     {
-      SetLastError(Status);
+      SetLastErrorByStatus (Status);
       return(FALSE);
     }
 
@@ -151,8 +150,8 @@
  */
 BOOL STDCALL
 GetProcessWorkingSetSize (HANDLE hProcess,
-			  LPDWORD lpMinimumWorkingSetSize,
-			  LPDWORD lpMaximumWorkingSetSize)
+			  PSIZE_T lpMinimumWorkingSetSize,
+			  PSIZE_T lpMaximumWorkingSetSize)
 {
   QUOTA_LIMITS QuotaLimits;
   NTSTATUS Status;
@@ -168,23 +167,38 @@
       return(FALSE);
     }
 
-  *lpMinimumWorkingSetSize = (DWORD)QuotaLimits.MinimumWorkingSetSize;
-  *lpMaximumWorkingSetSize = (DWORD)QuotaLimits.MaximumWorkingSetSize;
+  *lpMinimumWorkingSetSize = QuotaLimits.MinimumWorkingSetSize;
+  *lpMaximumWorkingSetSize = QuotaLimits.MaximumWorkingSetSize;
 
   return(TRUE);
 }
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL STDCALL
 SetProcessWorkingSetSize(HANDLE hProcess,
-			 DWORD dwMinimumWorkingSetSize,
-			 DWORD dwMaximumWorkingSetSize)
+			 SIZE_T dwMinimumWorkingSetSize,
+			 SIZE_T dwMaximumWorkingSetSize)
 {
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return(FALSE);
+  QUOTA_LIMITS QuotaLimits;
+  NTSTATUS Status;
+  
+  QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize;
+  QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize;
+
+  Status = NtSetInformationProcess(hProcess,
+				   ProcessQuotaLimits,
+				   &QuotaLimits,
+				   sizeof(QUOTA_LIMITS));
+  if (!NT_SUCCESS(Status))
+    {
+      SetLastErrorByStatus(Status);
+      return(FALSE);
+    }
+
+  return(TRUE);
 }
 
 
@@ -718,42 +732,45 @@
  * @implemented
  */
 DWORD STDCALL
-GetPriorityClass (HANDLE	hProcess)
+GetPriorityClass (HANDLE hProcess)
 {
-  HANDLE		hProcessTmp;
-  DWORD		CsrPriorityClass = 0; // This tells CSRSS we want to GET it!
-  NTSTATUS	Status;
-	
-  Status = 
-    NtDuplicateObject (GetCurrentProcess(),
-		       hProcess,
-		       GetCurrentProcess(),
-		       &hProcessTmp,
-		       (PROCESS_SET_INFORMATION | PROCESS_QUERY_INFORMATION),
-		       FALSE,
-		       0);
-  if (!NT_SUCCESS(Status))
-    {
-      SetLastErrorByStatus (Status);
-      return (0); /* ERROR */
-    }
-  /* Ask CSRSS to set it */
-  CsrSetPriorityClass (hProcessTmp, &CsrPriorityClass);
-  NtClose (hProcessTmp);
-  /* Translate CSR->W32 priorities */
-  switch (CsrPriorityClass)
+  NTSTATUS Status;
+  PROCESS_PRIORITY_CLASS PriorityClass;
+  
+  Status = NtQueryInformationProcess(hProcess,
+                                     ProcessPriorityClass,
+                                     &PriorityClass,
+                                     sizeof(PROCESS_PRIORITY_CLASS),
+                                     NULL);
+  if(NT_SUCCESS(Status))
+  {
+    switch(PriorityClass.PriorityClass)
     {
-    case CSR_PRIORITY_CLASS_NORMAL:
-      return (NORMAL_PRIORITY_CLASS);	/* 32 */
-    case CSR_PRIORITY_CLASS_IDLE:
-      return (IDLE_PRIORITY_CLASS);	/* 64 */
-    case CSR_PRIORITY_CLASS_HIGH:
-      return (HIGH_PRIORITY_CLASS);	/* 128 */
-    case CSR_PRIORITY_CLASS_REALTIME:
-      return (REALTIME_PRIORITY_CLASS);	/* 256 */
+      case PROCESS_PRIORITY_CLASS_IDLE:
+        return IDLE_PRIORITY_CLASS;
+
+      case PROCESS_PRIORITY_CLASS_BELOW_NORMAL:
+        return BELOW_NORMAL_PRIORITY_CLASS;
+
+      case PROCESS_PRIORITY_CLASS_NORMAL:
+        return NORMAL_PRIORITY_CLASS;
+
+      case PROCESS_PRIORITY_CLASS_ABOVE_NORMAL:
+        return ABOVE_NORMAL_PRIORITY_CLASS;
+
+      case PROCESS_PRIORITY_CLASS_HIGH:
+        return HIGH_PRIORITY_CLASS;
+
+      case PROCESS_PRIORITY_CLASS_REALTIME:
+        return REALTIME_PRIORITY_CLASS;
+
+      default:
+        return NORMAL_PRIORITY_CLASS;
     }
-  SetLastError (ERROR_ACCESS_DENIED);
-  return (0); /* ERROR */
+  }
+  
+  SetLastErrorByStatus(Status);
+  return FALSE;
 }
 
 
@@ -761,53 +778,57 @@
  * @implemented
  */
 BOOL STDCALL
-SetPriorityClass (HANDLE	hProcess,
+SetPriorityClass (HANDLE hProcess,
 		  DWORD	dwPriorityClass)
 {
-  HANDLE		hProcessTmp;
-  DWORD		CsrPriorityClass;
-  NTSTATUS	Status;
+  NTSTATUS Status;
+  PROCESS_PRIORITY_CLASS PriorityClass;
   
-  switch (dwPriorityClass)
-    {
-    case NORMAL_PRIORITY_CLASS:	/* 32 */
-      CsrPriorityClass = CSR_PRIORITY_CLASS_NORMAL;
+  switch(dwPriorityClass)
+  {
+    case IDLE_PRIORITY_CLASS:
+      PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_IDLE;
       break;
-    case IDLE_PRIORITY_CLASS:	/* 64 */
-      CsrPriorityClass = CSR_PRIORITY_CLASS_IDLE;
+
+    case BELOW_NORMAL_PRIORITY_CLASS:
+      PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_BELOW_NORMAL;
       break;
-    case HIGH_PRIORITY_CLASS:	/* 128 */
-      CsrPriorityClass = CSR_PRIORITY_CLASS_HIGH;
+
+    case NORMAL_PRIORITY_CLASS:
+      PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
       break;
-    case REALTIME_PRIORITY_CLASS:	/* 256 */
-      CsrPriorityClass = CSR_PRIORITY_CLASS_REALTIME;
+
+    case ABOVE_NORMAL_PRIORITY_CLASS:
+      PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_ABOVE_NORMAL;
       break;
+
+    case HIGH_PRIORITY_CLASS:
+      PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_HIGH;
+      break;
+
+    case REALTIME_PRIORITY_CLASS:
+      PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_REALTIME;
+      break;
+
     default:
-      SetLastError (ERROR_INVALID_PARAMETER);
-      return (FALSE);
-    }
-  Status = 
-    NtDuplicateObject (GetCurrentProcess(),
-		       hProcess,
-		       GetCurrentProcess(),
-		       &hProcessTmp,
-		       (PROCESS_SET_INFORMATION | PROCESS_QUERY_INFORMATION),
-		       FALSE,
-		       0);
-  if (!NT_SUCCESS(Status))
-    {
-      SetLastErrorByStatus (Status);
-      return (FALSE); /* ERROR */
-    }
-  /* Ask CSRSS to set it */
-  Status = CsrSetPriorityClass (hProcessTmp, &CsrPriorityClass);
-  NtClose (hProcessTmp);
-  if (!NT_SUCCESS(Status))
-    {
-      SetLastErrorByStatus (Status);
-      return (FALSE);
-    }
-  return (TRUE);
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return FALSE;
+  }
+  
+  PriorityClass.Foreground = FALSE;
+
+  Status = NtSetInformationProcess(hProcess,
+                                   ProcessPriorityClass,
+                                   &PriorityClass,
+                                   sizeof(PROCESS_PRIORITY_CLASS));
+
+  if(!NT_SUCCESS(Status))
+  {
+    SetLastErrorByStatus(Status);
+    return FALSE;
+  }
+  
+  return TRUE;
 }
 
 

reactos/lib/ntdll/csr
thread.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- thread.c	11 Jul 2003 13:50:22 -0000	1.4
+++ thread.c	19 Sep 2004 14:36:47 -0000	1.5
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.4 2003/07/11 13:50:22 royce Exp $
+/* $Id: thread.c,v 1.5 2004/09/19 14:36:47 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -33,7 +33,7 @@
 		    PULONG PriorityClass)
 {
    /* FIXME: call csrss to get hProcess' priority */
-   *PriorityClass = CSR_PRIORITY_CLASS_NORMAL;
+   *PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
 
    return (STATUS_NOT_IMPLEMENTED);
 }
CVSspam 0.2.8