Build kernel32 with NDK
Modified: trunk/reactos/lib/kernel32/file/dir.c
Modified: trunk/reactos/lib/kernel32/file/move.c
Modified: trunk/reactos/lib/kernel32/file/npipe.c
Modified: trunk/reactos/lib/kernel32/k32.h
Modified: trunk/reactos/lib/kernel32/mem/global.c
Modified: trunk/reactos/lib/kernel32/misc/lzexpand_main.c
Modified: trunk/reactos/lib/kernel32/misc/sysinfo.c
Modified: trunk/reactos/lib/kernel32/misc/time.c
Modified: trunk/reactos/lib/kernel32/process/create.c
Modified: trunk/reactos/lib/kernel32/process/proc.c

Modified: trunk/reactos/lib/kernel32/file/dir.c
--- trunk/reactos/lib/kernel32/file/dir.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/file/dir.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -578,7 +578,7 @@
         DWORD   shortlen
         )
 {
-    WCHAR               tmpshortpath[PATH_MAX];
+    WCHAR               tmpshortpath[MAX_PATH];
     LPCWSTR             p;
     DWORD               sp = 0, lp = 0;
     DWORD               tmplen;

Modified: trunk/reactos/lib/kernel32/file/move.c
--- trunk/reactos/lib/kernel32/file/move.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/file/move.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -12,6 +12,7 @@
 /* INCLUDES *****************************************************************/
 
 #include <k32.h>
+#include <malloc.h>
 
 #define NDEBUG
 #include "../include/debug.h"

Modified: trunk/reactos/lib/kernel32/file/npipe.c
--- trunk/reactos/lib/kernel32/file/npipe.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/file/npipe.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -177,7 +177,7 @@
 
    if (nMaxInstances >= PIPE_UNLIMITED_INSTANCES)
      {
-	nMaxInstances = ULONG_MAX;
+	nMaxInstances = 0xFFFFFFFF;
      }
 
    DefaultTimeOut.QuadPart = nDefaultTimeOut * -10000LL;

Modified: trunk/reactos/lib/kernel32/k32.h
--- trunk/reactos/lib/kernel32/k32.h	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/k32.h	2005-06-20 04:07:49 UTC (rev 16134)
@@ -1,38 +1,49 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS System Libraries
+ * FILE:            lib/ntdll/inc/ntdll.h
+ * PURPOSE:         Native Libary Header
+ * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
+ */
+
+/* INCLUDES ******************************************************************/
+
+/* PSDK/NDK Headers */
+#include <windows.h>
 #define NTOS_MODE_USER
-#include <ntos.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <malloc.h>
-#include <limits.h>
+#include <ndk/ntndk.h>
+
+/* C Headers */
 #include <wchar.h>
-#include <string.h>
-#include <ddk/ntddk.h>
+
+/* DDK Driver Headers */
 #include <ddk/ntddbeep.h>
 #include <ddk/ntddser.h>
-#include <windows.h>
-#include <tlhelp32.h>
+#include <ddk/ntddtape.h>
+
+/* FIXME: Clean this sh*t up */
 #include <ntdll/base.h>
 #include <ntdll/rtl.h>
 #include <ntdll/dbg.h>
 #include <ntdll/csr.h>
 #include <ntdll/ldr.h>
-#include <napi/i386/segment.h>
-#include <napi/teb.h>
-#include <napi/npipe.h>
-#include <napi/types.h>
+
+/* Toolhelp & CSRSS Header */
+#include <tlhelp32.h>
 #include <csrss/csrss.h>
-#include <reactos/buildno.h>
+
+/* FIXME: KILL ROSRTL */
 #include <rosrtl/thread.h>
 #include <rosrtl/string.h>
-#include <ntos/ldrtypes.h>
-#include <ntos/zwtypes.h>
-#include <ddk/ldrfuncs.h>
-#include <ddk/ntifs.h>
-
-#include <rosrtl/string.h>
 #include <rosrtl/registry.h>
 
+/* Internal Kernel32 Header */
 #include "include/kernel32.h"
 
+/* PSEH for SEH Support */
 #include <pseh.h>
+
+/* Helper Header */
+#include <reactos/helper.h>
+#include <reactos/buildno.h>
+

Modified: trunk/reactos/lib/kernel32/mem/global.c
--- trunk/reactos/lib/kernel32/mem/global.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/mem/global.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -407,38 +407,38 @@
  */
    lpBuffer->dwMemoryLoad = (SysBasicInfo.NumberOfPhysicalPages -
   			     SysPerfInfo.AvailablePages) * 100 /
-    			     SysBasicInfo.NumberOfPhysicalPages;
+    			     SysBasicInfo.PageSize;
 
 	DPRINT1("Memory Load: %d\n",lpBuffer->dwMemoryLoad );
 
    lpBuffer->ullTotalPhys = SysBasicInfo.NumberOfPhysicalPages *
-   					SysBasicInfo.PhysicalPageSize;
+   					SysBasicInfo.PageSize;
    lpBuffer->ullAvailPhys = SysPerfInfo.AvailablePages *
-    					SysBasicInfo.PhysicalPageSize;
+    					SysBasicInfo.PageSize;
 
 	DPRINT("%d\n",SysPerfInfo.AvailablePages );
 	DPRINT("%d\n",lpBuffer->ullAvailPhys );
 
-   lpBuffer->ullTotalPageFile = SysPerfInfo.TotalCommitLimit *
-    					SysBasicInfo.PhysicalPageSize;
+   lpBuffer->ullTotalPageFile = SysPerfInfo.CommitLimit *
+    					SysBasicInfo.PageSize;
 
 	DPRINT("%d\n",lpBuffer->ullTotalPageFile );
 
-   lpBuffer->ullAvailPageFile = ((SysPerfInfo.TotalCommitLimit -
-    					SysPerfInfo.TotalCommittedPages) *
-    					SysBasicInfo.PhysicalPageSize);
+   lpBuffer->ullAvailPageFile = ((SysPerfInfo.CommitLimit -
+    					SysPerfInfo.CommittedPages) *
+    					SysBasicInfo.PageSize);
 
 /* VM available to the calling processes, User Mem? */
-   lpBuffer->ullTotalVirtual = SysBasicInfo.HighestUserAddress -
-    					SysBasicInfo.LowestUserAddress;
+   lpBuffer->ullTotalVirtual = SysBasicInfo.MaximumUserModeAddress -
+    					SysBasicInfo.MinimumUserModeAddress;
 
    lpBuffer->ullAvailVirtual = (lpBuffer->ullTotalVirtual -
     					(UserMemory *
-    					 SysBasicInfo.PhysicalPageSize));
+    					 SysBasicInfo.PageSize));
 
 	DPRINT("%d\n",lpBuffer->ullAvailVirtual );
 	DPRINT("%d\n",UserMemory);
-	DPRINT("%d\n",SysBasicInfo.PhysicalPageSize);
+	DPRINT("%d\n",SysBasicInfo.PageSize);
 
 /* lol! Memory from beyond! */
    lpBuffer->ullAvailExtendedVirtual = 0;

Modified: trunk/reactos/lib/kernel32/misc/lzexpand_main.c
--- trunk/reactos/lib/kernel32/misc/lzexpand_main.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/misc/lzexpand_main.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -28,6 +28,7 @@
 #define NDEBUG
 #include "../include/debug.h"
 #include "lzexpand.h"
+#include <ctype.h>
 
 #define HFILE_ERROR ((HFILE)-1)
 

Modified: trunk/reactos/lib/kernel32/misc/sysinfo.c
--- trunk/reactos/lib/kernel32/misc/sysinfo.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/misc/sysinfo.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -58,11 +58,11 @@
 	Si->wProcessorArchitecture	= Spi.ProcessorArchitecture;
 	/* For future use: always zero */
 	Si->wReserved			= 0;
-	Si->dwPageSize			= Sbi.PhysicalPageSize;
-	Si->lpMinimumApplicationAddress	= (PVOID)Sbi.LowestUserAddress;
-	Si->lpMaximumApplicationAddress	= (PVOID)Sbi.HighestUserAddress;
-	Si->dwActiveProcessorMask	= Sbi.ActiveProcessors;
-	Si->dwNumberOfProcessors	= Sbi.NumberProcessors;
+	Si->dwPageSize			= Sbi.PageSize;
+	Si->lpMinimumApplicationAddress	= (PVOID)Sbi.MinimumUserModeAddress;
+	Si->lpMaximumApplicationAddress	= (PVOID)Sbi.MaximumUserModeAddress;
+	Si->dwActiveProcessorMask	= Sbi.ActiveProcessorsAffinityMask;
+	Si->dwNumberOfProcessors	= Sbi.NumberOfProcessors;
 	/*
 	 * Compatibility (no longer relevant):
 	 *	PROCESSOR_INTEL_386	386

Modified: trunk/reactos/lib/kernel32/misc/time.c
--- trunk/reactos/lib/kernel32/misc/time.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/misc/time.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -366,7 +366,7 @@
 
    DPRINT("SetTimeZoneInformation()\n");
 
-   Status = RtlSetTimeZoneInformation((PTIME_ZONE_INFORMATION)lpTimeZoneInformation);
+   Status = RtlSetTimeZoneInformation((LPTIME_ZONE_INFORMATION)lpTimeZoneInformation);
    if (!NT_SUCCESS(Status))
      {
 	DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status);
@@ -442,12 +442,12 @@
 			PDWORD lpTimeIncrement,
 			PBOOL lpTimeAdjustmentDisabled)
 {
-   SYSTEM_QUERY_TIME_ADJUSTMENT Buffer;
+   SYSTEM_QUERY_TIME_ADJUST_INFORMATION Buffer;
    NTSTATUS Status;
 
    Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation,
 				     &Buffer,
-				     sizeof(SYSTEM_QUERY_TIME_ADJUSTMENT),
+				     sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION),
 				     NULL);
    if (!NT_SUCCESS(Status))
      {
@@ -456,8 +456,8 @@
      }
 
    *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment;
-   *lpTimeIncrement = (DWORD)Buffer.MaximumIncrement;
-   *lpTimeAdjustmentDisabled = (BOOL)Buffer.TimeSynchronization;
+   *lpTimeIncrement = (DWORD)Buffer.TimeIncrement;
+   *lpTimeAdjustmentDisabled = (BOOL)Buffer.Enable;
 
    return TRUE;
 }
@@ -471,14 +471,14 @@
 			BOOL bTimeAdjustmentDisabled)
 {
    NTSTATUS Status;
-   SYSTEM_SET_TIME_ADJUSTMENT Buffer;
+   SYSTEM_SET_TIME_ADJUST_INFORMATION Buffer;
 
    Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment;
-   Buffer.TimeSynchronization = (BOOLEAN)bTimeAdjustmentDisabled;
+   Buffer.Enable = (BOOLEAN)bTimeAdjustmentDisabled;
 
    Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
 				   &Buffer,
-				   sizeof(SYSTEM_SET_TIME_ADJUSTMENT));
+				   sizeof(SYSTEM_SET_TIME_ADJUST_INFORMATION));
    if (!NT_SUCCESS(Status))
      {
 	SetLastErrorByStatus(Status);

Modified: trunk/reactos/lib/kernel32/process/create.c
--- trunk/reactos/lib/kernel32/process/create.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/process/create.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -139,11 +139,11 @@
    BOOL bRetVal;
    STARTUPINFOW wsiStartupInfo;
 
-   NTSTATUS STDCALL_FUNC (*pTrue)(UNICODE_STRING *,
+   NTSTATUS (STDCALL *pTrue)(UNICODE_STRING *,
                                   ANSI_STRING *,
 				  BOOLEAN);
 
-   ULONG STDCALL_FUNC (*pRtlMbStringToUnicodeSize)(ANSI_STRING *);
+   ULONG (STDCALL *pRtlMbStringToUnicodeSize)(ANSI_STRING *);
 
    DPRINT("dwCreationFlags %x, lpEnvironment %x, lpCurrentDirectory %x, "
           "lpStartupInfo %x, lpProcessInformation %x\n",
@@ -1156,7 +1156,7 @@
     */
    CsrRequest.Type = CSRSS_CREATE_PROCESS;
    CsrRequest.Data.CreateProcessRequest.NewProcessId =
-      ProcessBasicInfo.UniqueProcessId;
+      (HANDLE)ProcessBasicInfo.UniqueProcessId;
    if (Sii.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
    {
       /* Do not create a console for GUI applications */
@@ -1306,7 +1306,7 @@
       if (IsConsoleHandle(Ppb->hStdError))
       {
          CsrRequest.Type = CSRSS_DUPLICATE_HANDLE;
-         CsrRequest.Data.DuplicateHandleRequest.ProcessId = ProcessBasicInfo.UniqueProcessId;
+         CsrRequest.Data.DuplicateHandleRequest.ProcessId = (HANDLE)ProcessBasicInfo.UniqueProcessId;
          CsrRequest.Data.DuplicateHandleRequest.Handle = CsrReply.Data.CreateProcessReply.OutputHandle;
          Status = CsrClientCallServer(&CsrRequest,
                                       &CsrReply,

Modified: trunk/reactos/lib/kernel32/process/proc.c
--- trunk/reactos/lib/kernel32/process/proc.c	2005-06-20 04:07:34 UTC (rev 16133)
+++ trunk/reactos/lib/kernel32/process/proc.c	2005-06-20 04:07:49 UTC (rev 16134)
@@ -62,7 +62,7 @@
     }
 
   *lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask;
-  *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessors;
+  *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessorsAffinityMask;
 
   return TRUE;
 }