1. reformatted the code so human beings can read it

2. enabled precompiled headers

svn path=/trunk/; revision=11533
This commit is contained in:
Thomas Bluemel 2004-11-02 23:42:49 +00:00
parent f99b2df6d1
commit a3901ae581
7 changed files with 876 additions and 912 deletions

View file

@ -6,3 +6,4 @@ temp.exp
*.o
*.d
*.map
*.gch

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.10 2004/05/29 21:24:46 hbirr Exp $
# $Id: makefile,v 1.11 2004/11/02 23:42:49 weiden Exp $
PATH_TO_TOP = ../..
@ -17,6 +17,8 @@ TARGET_LFLAGS = -nostartfiles -nostdlib
TARGET_BASE = $(TARGET_BASE_LIB_PSAPI)
TARGET_PCH = precomp.h
TARGET_OBJECTS = \
misc/dllmain.o \
misc/malloc.o \

View file

@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.4 2002/08/31 17:11:24 hyperion Exp $
/* $Id: dllmain.c,v 1.5 2004/11/02 23:42:49 weiden Exp $
*/
/*
* COPYRIGHT: None
@ -11,8 +11,7 @@
* 28/11/2001: Created (Emanuele Aliberti <eal@users.sf.net>)
* 30/08/2002: Minimal tweak (KJK::Hyperion <noog@libero.it>)
*/
#include <windows.h>
#include <ntdll/ldr.h>
#include "precomp.h"
BOOLEAN STDCALL DllMain
(

View file

@ -1,4 +1,4 @@
/* $Id: malloc.c,v 1.4 2003/04/02 22:09:57 hyperion Exp $
/* $Id: malloc.c,v 1.5 2004/11/02 23:42:49 weiden Exp $
*/
/*
* COPYRIGHT: None
@ -13,39 +13,40 @@
* for better reusability
*/
#include <ddk/ntddk.h>
#include <napi/teb.h>
#include <ntos/heap.h>
#include "precomp.h"
PVOID STDCALL MemAlloc
(
IN HANDLE Heap,
IN PVOID Ptr,
IN ULONG Size
)
PVOID
STDCALL
MemAlloc(IN HANDLE Heap,
IN PVOID Ptr,
IN ULONG Size)
{
PVOID pBuf = NULL;
PVOID pBuf = NULL;
if(Size == 0 && Ptr == NULL)
return (NULL);
if(Size == 0 && Ptr == NULL)
{
return NULL;
}
if(Heap == NULL)
Heap = NtCurrentPeb()->ProcessHeap;
if(Heap == NULL)
{
Heap = NtCurrentPeb()->ProcessHeap;
}
if(Size > 0)
{
if(Ptr == NULL)
/* malloc */
pBuf = RtlAllocateHeap(Heap, 0, Size);
if(Size > 0)
{
if(Ptr == NULL)
/* malloc */
pBuf = RtlAllocateHeap(Heap, 0, Size);
else
/* realloc */
pBuf = RtlReAllocateHeap(Heap, 0, Ptr, Size);
}
else
/* realloc */
pBuf = RtlReAllocateHeap(Heap, 0, Ptr, Size);
}
else
/* free */
RtlFreeHeap(Heap, 0, Ptr);
/* free */
RtlFreeHeap(Heap, 0, Ptr);
return pBuf;
return pBuf;
}
void *PsaiMalloc(SIZE_T size)

View file

@ -1,45 +1,59 @@
/* $Id: stubs.c,v 1.5 2004/10/31 01:23:05 weiden Exp $ */
#include <windows.h>
#include <psapi.h>
/* $Id: stubs.c,v 1.6 2004/11/02 23:42:49 weiden Exp $ */
#include "precomp.h"
#if 0
BOOL STDCALL EnumPageFiles(
PENUM_PAGE_CALLBACKW pCallbackRoutine,
LPVOID lpContext
)
/*
* @unimplemented
*/
BOOL
STDCALL
EnumPageFiles(PENUM_PAGE_CALLBACKW pCallbackRoutine,
LPVOID lpContext)
{
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
}
BOOL STDCALL GetPerformanceInfo(
PPERFORMANCE_INFORMATION pPerformanceInformation,
DWORD cb
)
/*
* @unimplemented
*/
BOOL
STDCALL
GetPerformanceInfo(PPERFORMANCE_INFORMATION pPerformanceInformation,
DWORD cb)
{
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
}
#endif
BOOL STDCALL GetProcessMemoryInfo(
HANDLE Process, // handle to process
PPROCESS_MEMORY_COUNTERS ppsmemCounters, // buffer
DWORD cb // size of buffer
)
/*
* @unimplemented
*/
BOOL
STDCALL
GetProcessMemoryInfo(HANDLE Process,
PPROCESS_MEMORY_COUNTERS ppsmemCounters,
DWORD cb)
{
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
}
BOOL STDCALL QueryWorkingSet(
HANDLE hProcess, // handle to process
PVOID pv, // information buffer
DWORD cb // size of buffer
)
/*
* @unimplemented
*/
BOOL
STDCALL
QueryWorkingSet(HANDLE hProcess,
PVOID pv,
DWORD cb)
{
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
SetLastError(ERROR_INVALID_FUNCTION);
return FALSE;
}
/* EOF */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
#include <windows.h>
#include <psapi.h>
#include <epsapi.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <ddk/ntddk.h>
#include <napi/teb.h>
#include <ntos/heap.h>
#include <ntdll/ldr.h>
#define SetLastErrorByStatus(__S__) \
((void)SetLastError(RtlNtStatusToDosError(__S__)))