diff --git a/reactos/lib/kernel32/makefile b/reactos/lib/kernel32/makefile index 2b69015e61d..9e3c3270d6b 100644 --- a/reactos/lib/kernel32/makefile +++ b/reactos/lib/kernel32/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.43 2001/02/17 00:02:32 ekohl Exp $ +# $Id: makefile,v 1.44 2001/02/17 17:41:17 ekohl Exp $ # # ReactOS Operating System # @@ -27,8 +27,8 @@ FILE_OBJECTS = file/file.o file/curdir.o file/lfile.o file/dir.o \ file/move.o file/lock.o file/rw.o file/delete.o \ file/npipe.o -MEM_OBJECTS = mem/global.o mem/heap.o mem/utils.o mem/section.o mem/isbad.o \ - mem/procmem.o mem/virtual.o +MEM_OBJECTS = mem/global.o mem/heap.o mem/isbad.o mem/procmem.o \ + mem/section.o mem/virtual.o NLS_OBJECTS = nls/codepage.o nls/cpmisc.o nls/cptable.o\ nls/cp37.o nls/cp437.o nls/cp500.o nls/cp737.o nls/cp775.o nls/cp850.o nls/cp852.o nls/cp855.o nls/cp857.o\ diff --git a/reactos/lib/kernel32/mem/heap.c b/reactos/lib/kernel32/mem/heap.c index 1c6fb061c75..057ec65fffb 100644 --- a/reactos/lib/kernel32/mem/heap.c +++ b/reactos/lib/kernel32/mem/heap.c @@ -1,4 +1,4 @@ -/* $Id: heap.c,v 1.17 2001/02/17 00:01:26 ekohl Exp $ +/* $Id: heap.c,v 1.18 2001/02/17 17:42:46 ekohl Exp $ * * kernel/heap.c * Copyright (C) 1996, Onno Hovers, All rights reserved @@ -62,14 +62,10 @@ HANDLE WINAPI GetProcessHeap(VOID) /******************************************************************** * GetProcessHeaps -- KERNEL32 * -* * -* NOTE in Win95 this function is not implemented and just returns * -* ERROR_CALL_NOT_IMPLEMENTED * ********************************************************************/ DWORD WINAPI GetProcessHeaps(DWORD maxheaps, PHANDLE phandles ) { - UNIMPLEMENTED; - return(ERROR_CALL_NOT_IMPLEMENTED); + return(RtlGetProcessHeaps(maxheaps, phandles)); } /********************************************************************* @@ -94,17 +90,13 @@ BOOL WINAPI HeapUnlock(HANDLE hheap) * NT uses this function to compact moveable blocks and other things * * Here it does not compact, but it finds the largest free region * *********************************************************************/ -UINT STDCALL -HeapCompact(HANDLE hheap, - DWORD flags) +UINT WINAPI HeapCompact(HANDLE hheap, DWORD flags) { return RtlCompactHeap(hheap, flags); } /********************************************************************* * HeapValidate -- KERNEL32 * -* * -* NOTE: only implemented in NT * *********************************************************************/ BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem) { diff --git a/reactos/lib/kernel32/mem/mem.c b/reactos/lib/kernel32/mem/mem.c deleted file mode 100644 index e1869b4cf92..00000000000 --- a/reactos/lib/kernel32/mem/mem.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $Id: mem.c,v 1.2 2000/07/01 17:07:00 ea Exp $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS user mode libraries - * FILE: kernel32/mem/utils.cc - * PURPOSE: Various simple memory initalizations functions - */ - -#include - -VOID ZeroMemory(PVOID Destination, DWORD Length) -{ - #ifdef __i386__ - - #endif /* __i386__ */ -} - -VOID CopyMemory(PVOID Destination, CONST VOID* Source, DWORD Length) -{ - #ifdef __i386__ - #endif /* __i386__ */ -} - - -/* EOF */ diff --git a/reactos/lib/kernel32/mem/section.c b/reactos/lib/kernel32/mem/section.c index 54d69fd6644..35106e75340 100644 --- a/reactos/lib/kernel32/mem/section.c +++ b/reactos/lib/kernel32/mem/section.c @@ -1,4 +1,4 @@ -/* $Id: section.c,v 1.12 2000/07/01 17:07:00 ea Exp $ +/* $Id: section.c,v 1.13 2001/02/17 17:42:46 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -13,16 +13,17 @@ #include #include +#include + /* FUNCTIONS *****************************************************************/ -HANDLE STDCALL CreateFileMappingA ( - HANDLE hFile, - LPSECURITY_ATTRIBUTES lpFileMappingAttributes, - DWORD flProtect, - DWORD dwMaximumSizeHigh, - DWORD dwMaximumSizeLow, - LPCSTR lpName - ) +HANDLE STDCALL +CreateFileMappingA(HANDLE hFile, + LPSECURITY_ATTRIBUTES lpFileMappingAttributes, + DWORD flProtect, + DWORD dwMaximumSizeHigh, + DWORD dwMaximumSizeLow, + LPCSTR lpName) { NTSTATUS Status; HANDLE SectionHandle; @@ -43,12 +44,15 @@ HANDLE STDCALL CreateFileMappingA ( MaximumSize.u.LowPart = dwMaximumSizeLow; MaximumSize.u.HighPart = dwMaximumSizeHigh; - RtlInitAnsiString(&AnsiName, (LPSTR)lpName); - RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); + RtlInitAnsiString(&AnsiName, + (LPSTR)lpName); + RtlAnsiStringToUnicodeString(&UnicodeName, + &AnsiName, + TRUE); InitializeObjectAttributes(&ObjectAttributes, &UnicodeName, 0, - NULL, + hBaseDir, SecurityDescriptor); Status = NtCreateSection(&SectionHandle, SECTION_ALL_ACCESS, @@ -57,27 +61,23 @@ HANDLE STDCALL CreateFileMappingA ( flProtect, 0, hFile); - RtlFreeUnicodeString (&UnicodeName); + RtlFreeUnicodeString(&UnicodeName); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + SetLastErrorByStatus(Status); return NULL; } - return SectionHandle; } -HANDLE -STDCALL -CreateFileMappingW ( - HANDLE hFile, - LPSECURITY_ATTRIBUTES lpFileMappingAttributes, - DWORD flProtect, - DWORD dwMaximumSizeHigh, - DWORD dwMaximumSizeLow, - LPCWSTR lpName - ) +HANDLE STDCALL +CreateFileMappingW(HANDLE hFile, + LPSECURITY_ATTRIBUTES lpFileMappingAttributes, + DWORD flProtect, + DWORD dwMaximumSizeHigh, + DWORD dwMaximumSizeLow, + LPCWSTR lpName) { NTSTATUS Status; HANDLE SectionHandle; @@ -97,11 +97,12 @@ CreateFileMappingW ( MaximumSize.u.LowPart = dwMaximumSizeLow; MaximumSize.u.HighPart = dwMaximumSizeHigh; - RtlInitUnicodeString(&UnicodeName, lpName); + RtlInitUnicodeString(&UnicodeName, + lpName); InitializeObjectAttributes(&ObjectAttributes, &UnicodeName, 0, - NULL, + hBaseDir, SecurityDescriptor); Status = NtCreateSection(&SectionHandle, SECTION_ALL_ACCESS, @@ -112,20 +113,20 @@ CreateFileMappingW ( hFile); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + SetLastErrorByStatus(Status); return NULL; } - return SectionHandle; } -LPVOID STDCALL MapViewOfFileEx(HANDLE hFileMappingObject, - DWORD dwDesiredAccess, - DWORD dwFileOffsetHigh, - DWORD dwFileOffsetLow, - DWORD dwNumberOfBytesToMap, - LPVOID lpBaseAddress) +LPVOID STDCALL +MapViewOfFileEx(HANDLE hFileMappingObject, + DWORD dwDesiredAccess, + DWORD dwFileOffsetHigh, + DWORD dwFileOffsetLow, + DWORD dwNumberOfBytesToMap, + LPVOID lpBaseAddress) { NTSTATUS Status; LARGE_INTEGER SectionOffset; @@ -157,66 +158,60 @@ LPVOID STDCALL MapViewOfFileEx(HANDLE hFileMappingObject, } Status = ZwMapViewOfSection(hFileMappingObject, - NtCurrentProcess(), - &BaseAddress, - 0, - dwNumberOfBytesToMap, - &SectionOffset, - &ViewSize, - ViewShare, - 0, - Protect); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return NULL; - } - - return BaseAddress; + NtCurrentProcess(), + &BaseAddress, + 0, + dwNumberOfBytesToMap, + &SectionOffset, + &ViewSize, + ViewShare, + 0, + Protect); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return NULL; + } + return BaseAddress; } -LPVOID -STDCALL -MapViewOfFile ( - HANDLE hFileMappingObject, - DWORD dwDesiredAccess, - DWORD dwFileOffsetHigh, - DWORD dwFileOffsetLow, - DWORD dwNumberOfBytesToMap - ) + +LPVOID STDCALL +MapViewOfFile(HANDLE hFileMappingObject, + DWORD dwDesiredAccess, + DWORD dwFileOffsetHigh, + DWORD dwFileOffsetLow, + DWORD dwNumberOfBytesToMap) { - return MapViewOfFileEx(hFileMappingObject,dwDesiredAccess, - dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap,NULL); + return MapViewOfFileEx(hFileMappingObject, + dwDesiredAccess, + dwFileOffsetHigh, + dwFileOffsetLow, + dwNumberOfBytesToMap, + NULL); } -WINBOOL -STDCALL -UnmapViewOfFile ( - LPVOID lpBaseAddress - ) +WINBOOL STDCALL +UnmapViewOfFile(LPVOID lpBaseAddress) { - NTSTATUS Status; - Status = NtUnmapViewOfSection(NtCurrentProcess(),lpBaseAddress); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return FALSE; - } + NTSTATUS Status; - return TRUE; + Status = NtUnmapViewOfSection(NtCurrentProcess(), + lpBaseAddress); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + return TRUE; } -HANDLE -STDCALL -OpenFileMappingA ( - DWORD dwDesiredAccess, - WINBOOL bInheritHandle, - LPCSTR lpName - ) +HANDLE STDCALL +OpenFileMappingA(DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + LPCSTR lpName) { NTSTATUS Status; HANDLE SectionHandle; @@ -226,89 +221,87 @@ OpenFileMappingA ( ULONG Attributes = 0; - if ( bInheritHandle ) - Attributes = OBJ_INHERIT; + if (bInheritHandle) + { + Attributes = OBJ_INHERIT; + } - RtlInitAnsiString(&AnsiName, (LPSTR)lpName); - RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); + RtlInitAnsiString(&AnsiName, + (LPSTR)lpName); + RtlAnsiStringToUnicodeString(&UnicodeName, + &AnsiName, + TRUE); InitializeObjectAttributes(&ObjectAttributes, &UnicodeName, Attributes, - NULL, + hBaseDir, NULL); Status = NtOpenSection(&SectionHandle, SECTION_ALL_ACCESS, - &ObjectAttributes - ); - RtlFreeUnicodeString (&UnicodeName); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return NULL; - } - - return SectionHandle; + &ObjectAttributes); + RtlFreeUnicodeString (&UnicodeName); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus (Status); + return NULL; + } + return SectionHandle; } -HANDLE -STDCALL -OpenFileMappingW ( - DWORD dwDesiredAccess, - WINBOOL bInheritHandle, - LPCWSTR lpName - ) +HANDLE STDCALL +OpenFileMappingW(DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + LPCWSTR lpName) { NTSTATUS Status; HANDLE SectionHandle; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING UnicodeName; - ULONG Attributes = 0; - if ( bInheritHandle ) - Attributes = OBJ_INHERIT; + if (bInheritHandle) + { + Attributes = OBJ_INHERIT; + } - RtlInitUnicodeString(&UnicodeName, lpName); + RtlInitUnicodeString(&UnicodeName, + lpName); InitializeObjectAttributes(&ObjectAttributes, &UnicodeName, Attributes, - NULL, + hBaseDir, NULL); Status = ZwOpenSection(&SectionHandle, SECTION_ALL_ACCESS, &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return NULL; - } - - return SectionHandle; + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return NULL; + } + return SectionHandle; } -WINBOOL -STDCALL -FlushViewOfFile ( - LPCVOID lpBaseAddress, - DWORD dwNumberOfBytesToFlush - ) -{ - NTSTATUS Status; - ULONG NumberOfBytesFlushed; - Status = NtFlushVirtualMemory (NtCurrentProcess (), - (LPVOID)lpBaseAddress, - dwNumberOfBytesToFlush, - &NumberOfBytesFlushed); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return FALSE; - } - return TRUE; +WINBOOL STDCALL +FlushViewOfFile(LPCVOID lpBaseAddress, + DWORD dwNumberOfBytesToFlush) +{ + NTSTATUS Status; + ULONG NumberOfBytesFlushed; + + Status = NtFlushVirtualMemory(NtCurrentProcess(), + (LPVOID)lpBaseAddress, + dwNumberOfBytesToFlush, + &NumberOfBytesFlushed); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + return TRUE; } /* EOF */ diff --git a/reactos/lib/kernel32/mem/utils.c b/reactos/lib/kernel32/mem/utils.c deleted file mode 100644 index cff7da3f7bb..00000000000 --- a/reactos/lib/kernel32/mem/utils.c +++ /dev/null @@ -1,19 +0,0 @@ -/* $Id: utils.c,v 1.5 2000/07/01 17:07:00 ea Exp $ - * - * FILE: lib/kernel32/mem/utils.c - */ -#include -#include - -VOID CopyMemory(PVOID Destination, CONST VOID* Source, DWORD Length) -{ - DWORD i; - - for (i=0; i