Build kernel32 with NDK

svn path=/trunk/; revision=16134
This commit is contained in:
Alex Ionescu 2005-06-20 04:07:49 +00:00
parent d98066b2aa
commit 497256b40e
10 changed files with 67 additions and 54 deletions

View file

@ -578,7 +578,7 @@ GetShortPathNameW (
DWORD shortlen DWORD shortlen
) )
{ {
WCHAR tmpshortpath[PATH_MAX]; WCHAR tmpshortpath[MAX_PATH];
LPCWSTR p; LPCWSTR p;
DWORD sp = 0, lp = 0; DWORD sp = 0, lp = 0;
DWORD tmplen; DWORD tmplen;

View file

@ -12,6 +12,7 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <k32.h> #include <k32.h>
#include <malloc.h>
#define NDEBUG #define NDEBUG
#include "../include/debug.h" #include "../include/debug.h"

View file

@ -177,7 +177,7 @@ CreateNamedPipeW(LPCWSTR lpName,
if (nMaxInstances >= PIPE_UNLIMITED_INSTANCES) if (nMaxInstances >= PIPE_UNLIMITED_INSTANCES)
{ {
nMaxInstances = ULONG_MAX; nMaxInstances = 0xFFFFFFFF;
} }
DefaultTimeOut.QuadPart = nDefaultTimeOut * -10000LL; DefaultTimeOut.QuadPart = nDefaultTimeOut * -10000LL;

View file

@ -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 #define NTOS_MODE_USER
#include <ntos.h> #include <ndk/ntndk.h>
#include <ctype.h>
#include <stdarg.h> /* C Headers */
#include <stdio.h>
#include <malloc.h>
#include <limits.h>
#include <wchar.h> #include <wchar.h>
#include <string.h>
#include <ddk/ntddk.h> /* DDK Driver Headers */
#include <ddk/ntddbeep.h> #include <ddk/ntddbeep.h>
#include <ddk/ntddser.h> #include <ddk/ntddser.h>
#include <windows.h> #include <ddk/ntddtape.h>
#include <tlhelp32.h>
/* FIXME: Clean this sh*t up */
#include <ntdll/base.h> #include <ntdll/base.h>
#include <ntdll/rtl.h> #include <ntdll/rtl.h>
#include <ntdll/dbg.h> #include <ntdll/dbg.h>
#include <ntdll/csr.h> #include <ntdll/csr.h>
#include <ntdll/ldr.h> #include <ntdll/ldr.h>
#include <napi/i386/segment.h>
#include <napi/teb.h>
#include <napi/npipe.h>
#include <napi/types.h>
#include <csrss/csrss.h>
#include <reactos/buildno.h>
#include <rosrtl/thread.h>
#include <rosrtl/string.h>
#include <ntos/ldrtypes.h>
#include <ntos/zwtypes.h>
#include <ddk/ldrfuncs.h>
#include <ddk/ntifs.h>
/* Toolhelp & CSRSS Header */
#include <tlhelp32.h>
#include <csrss/csrss.h>
/* FIXME: KILL ROSRTL */
#include <rosrtl/thread.h>
#include <rosrtl/string.h> #include <rosrtl/string.h>
#include <rosrtl/registry.h> #include <rosrtl/registry.h>
/* Internal Kernel32 Header */
#include "include/kernel32.h" #include "include/kernel32.h"
/* PSEH for SEH Support */
#include <pseh.h> #include <pseh.h>
/* Helper Header */
#include <reactos/helper.h>
#include <reactos/buildno.h>

View file

@ -407,38 +407,38 @@ GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
*/ */
lpBuffer->dwMemoryLoad = (SysBasicInfo.NumberOfPhysicalPages - lpBuffer->dwMemoryLoad = (SysBasicInfo.NumberOfPhysicalPages -
SysPerfInfo.AvailablePages) * 100 / SysPerfInfo.AvailablePages) * 100 /
SysBasicInfo.NumberOfPhysicalPages; SysBasicInfo.PageSize;
DPRINT1("Memory Load: %d\n",lpBuffer->dwMemoryLoad ); DPRINT1("Memory Load: %d\n",lpBuffer->dwMemoryLoad );
lpBuffer->ullTotalPhys = SysBasicInfo.NumberOfPhysicalPages * lpBuffer->ullTotalPhys = SysBasicInfo.NumberOfPhysicalPages *
SysBasicInfo.PhysicalPageSize; SysBasicInfo.PageSize;
lpBuffer->ullAvailPhys = SysPerfInfo.AvailablePages * lpBuffer->ullAvailPhys = SysPerfInfo.AvailablePages *
SysBasicInfo.PhysicalPageSize; SysBasicInfo.PageSize;
DPRINT("%d\n",SysPerfInfo.AvailablePages ); DPRINT("%d\n",SysPerfInfo.AvailablePages );
DPRINT("%d\n",lpBuffer->ullAvailPhys ); DPRINT("%d\n",lpBuffer->ullAvailPhys );
lpBuffer->ullTotalPageFile = SysPerfInfo.TotalCommitLimit * lpBuffer->ullTotalPageFile = SysPerfInfo.CommitLimit *
SysBasicInfo.PhysicalPageSize; SysBasicInfo.PageSize;
DPRINT("%d\n",lpBuffer->ullTotalPageFile ); DPRINT("%d\n",lpBuffer->ullTotalPageFile );
lpBuffer->ullAvailPageFile = ((SysPerfInfo.TotalCommitLimit - lpBuffer->ullAvailPageFile = ((SysPerfInfo.CommitLimit -
SysPerfInfo.TotalCommittedPages) * SysPerfInfo.CommittedPages) *
SysBasicInfo.PhysicalPageSize); SysBasicInfo.PageSize);
/* VM available to the calling processes, User Mem? */ /* VM available to the calling processes, User Mem? */
lpBuffer->ullTotalVirtual = SysBasicInfo.HighestUserAddress - lpBuffer->ullTotalVirtual = SysBasicInfo.MaximumUserModeAddress -
SysBasicInfo.LowestUserAddress; SysBasicInfo.MinimumUserModeAddress;
lpBuffer->ullAvailVirtual = (lpBuffer->ullTotalVirtual - lpBuffer->ullAvailVirtual = (lpBuffer->ullTotalVirtual -
(UserMemory * (UserMemory *
SysBasicInfo.PhysicalPageSize)); SysBasicInfo.PageSize));
DPRINT("%d\n",lpBuffer->ullAvailVirtual ); DPRINT("%d\n",lpBuffer->ullAvailVirtual );
DPRINT("%d\n",UserMemory); DPRINT("%d\n",UserMemory);
DPRINT("%d\n",SysBasicInfo.PhysicalPageSize); DPRINT("%d\n",SysBasicInfo.PageSize);
/* lol! Memory from beyond! */ /* lol! Memory from beyond! */
lpBuffer->ullAvailExtendedVirtual = 0; lpBuffer->ullAvailExtendedVirtual = 0;

View file

@ -28,6 +28,7 @@
#define NDEBUG #define NDEBUG
#include "../include/debug.h" #include "../include/debug.h"
#include "lzexpand.h" #include "lzexpand.h"
#include <ctype.h>
#define HFILE_ERROR ((HFILE)-1) #define HFILE_ERROR ((HFILE)-1)

View file

@ -58,11 +58,11 @@ GetSystemInfo (
Si->wProcessorArchitecture = Spi.ProcessorArchitecture; Si->wProcessorArchitecture = Spi.ProcessorArchitecture;
/* For future use: always zero */ /* For future use: always zero */
Si->wReserved = 0; Si->wReserved = 0;
Si->dwPageSize = Sbi.PhysicalPageSize; Si->dwPageSize = Sbi.PageSize;
Si->lpMinimumApplicationAddress = (PVOID)Sbi.LowestUserAddress; Si->lpMinimumApplicationAddress = (PVOID)Sbi.MinimumUserModeAddress;
Si->lpMaximumApplicationAddress = (PVOID)Sbi.HighestUserAddress; Si->lpMaximumApplicationAddress = (PVOID)Sbi.MaximumUserModeAddress;
Si->dwActiveProcessorMask = Sbi.ActiveProcessors; Si->dwActiveProcessorMask = Sbi.ActiveProcessorsAffinityMask;
Si->dwNumberOfProcessors = Sbi.NumberProcessors; Si->dwNumberOfProcessors = Sbi.NumberOfProcessors;
/* /*
* Compatibility (no longer relevant): * Compatibility (no longer relevant):
* PROCESSOR_INTEL_386 386 * PROCESSOR_INTEL_386 386

View file

@ -366,7 +366,7 @@ SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
DPRINT("SetTimeZoneInformation()\n"); DPRINT("SetTimeZoneInformation()\n");
Status = RtlSetTimeZoneInformation((PTIME_ZONE_INFORMATION)lpTimeZoneInformation); Status = RtlSetTimeZoneInformation((LPTIME_ZONE_INFORMATION)lpTimeZoneInformation);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status); DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status);
@ -442,12 +442,12 @@ GetSystemTimeAdjustment(PDWORD lpTimeAdjustment,
PDWORD lpTimeIncrement, PDWORD lpTimeIncrement,
PBOOL lpTimeAdjustmentDisabled) PBOOL lpTimeAdjustmentDisabled)
{ {
SYSTEM_QUERY_TIME_ADJUSTMENT Buffer; SYSTEM_QUERY_TIME_ADJUST_INFORMATION Buffer;
NTSTATUS Status; NTSTATUS Status;
Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation,
&Buffer, &Buffer,
sizeof(SYSTEM_QUERY_TIME_ADJUSTMENT), sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION),
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -456,8 +456,8 @@ GetSystemTimeAdjustment(PDWORD lpTimeAdjustment,
} }
*lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment; *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment;
*lpTimeIncrement = (DWORD)Buffer.MaximumIncrement; *lpTimeIncrement = (DWORD)Buffer.TimeIncrement;
*lpTimeAdjustmentDisabled = (BOOL)Buffer.TimeSynchronization; *lpTimeAdjustmentDisabled = (BOOL)Buffer.Enable;
return TRUE; return TRUE;
} }
@ -471,14 +471,14 @@ SetSystemTimeAdjustment(DWORD dwTimeAdjustment,
BOOL bTimeAdjustmentDisabled) BOOL bTimeAdjustmentDisabled)
{ {
NTSTATUS Status; NTSTATUS Status;
SYSTEM_SET_TIME_ADJUSTMENT Buffer; SYSTEM_SET_TIME_ADJUST_INFORMATION Buffer;
Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment; Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment;
Buffer.TimeSynchronization = (BOOLEAN)bTimeAdjustmentDisabled; Buffer.Enable = (BOOLEAN)bTimeAdjustmentDisabled;
Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
&Buffer, &Buffer,
sizeof(SYSTEM_SET_TIME_ADJUSTMENT)); sizeof(SYSTEM_SET_TIME_ADJUST_INFORMATION));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastErrorByStatus(Status); SetLastErrorByStatus(Status);

View file

@ -139,11 +139,11 @@ BOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
BOOL bRetVal; BOOL bRetVal;
STARTUPINFOW wsiStartupInfo; STARTUPINFOW wsiStartupInfo;
NTSTATUS STDCALL_FUNC (*pTrue)(UNICODE_STRING *, NTSTATUS (STDCALL *pTrue)(UNICODE_STRING *,
ANSI_STRING *, ANSI_STRING *,
BOOLEAN); BOOLEAN);
ULONG STDCALL_FUNC (*pRtlMbStringToUnicodeSize)(ANSI_STRING *); ULONG (STDCALL *pRtlMbStringToUnicodeSize)(ANSI_STRING *);
DPRINT("dwCreationFlags %x, lpEnvironment %x, lpCurrentDirectory %x, " DPRINT("dwCreationFlags %x, lpEnvironment %x, lpCurrentDirectory %x, "
"lpStartupInfo %x, lpProcessInformation %x\n", "lpStartupInfo %x, lpProcessInformation %x\n",
@ -1156,7 +1156,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
*/ */
CsrRequest.Type = CSRSS_CREATE_PROCESS; CsrRequest.Type = CSRSS_CREATE_PROCESS;
CsrRequest.Data.CreateProcessRequest.NewProcessId = CsrRequest.Data.CreateProcessRequest.NewProcessId =
ProcessBasicInfo.UniqueProcessId; (HANDLE)ProcessBasicInfo.UniqueProcessId;
if (Sii.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) if (Sii.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
{ {
/* Do not create a console for GUI applications */ /* Do not create a console for GUI applications */
@ -1306,7 +1306,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
if (IsConsoleHandle(Ppb->hStdError)) if (IsConsoleHandle(Ppb->hStdError))
{ {
CsrRequest.Type = CSRSS_DUPLICATE_HANDLE; 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; CsrRequest.Data.DuplicateHandleRequest.Handle = CsrReply.Data.CreateProcessReply.OutputHandle;
Status = CsrClientCallServer(&CsrRequest, Status = CsrClientCallServer(&CsrRequest,
&CsrReply, &CsrReply,

View file

@ -62,7 +62,7 @@ GetProcessAffinityMask (HANDLE hProcess,
} }
*lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask; *lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask;
*lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessors; *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessorsAffinityMask;
return TRUE; return TRUE;
} }