mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Fixed global and local memory functions
svn path=/trunk/; revision=1776
This commit is contained in:
parent
b7437fe01a
commit
b2a5aa012c
4 changed files with 275 additions and 629 deletions
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.46 2001/03/31 01:17:29 dwelch Exp $
|
||||
# $Id: makefile,v 1.47 2001/04/05 01:53:57 ekohl Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
|
@ -29,8 +29,8 @@ FILE_OBJECTS = file/file.o file/curdir.o file/lfile.o file/dir.o \
|
|||
file/npipe.o file/tape.o file/mailslot.o file/backup.o \
|
||||
file/cnotify.o
|
||||
|
||||
MEM_OBJECTS = mem/global.o mem/heap.o mem/isbad.o mem/procmem.o \
|
||||
mem/section.o mem/virtual.o
|
||||
MEM_OBJECTS = mem/global.o mem/heap.o mem/isbad.o mem/local.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\
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: global.c,v 1.5 2001/01/20 12:18:54 ekohl Exp $
|
||||
/* $Id: global.c,v 1.6 2001/04/05 01:54:16 ekohl Exp $
|
||||
*
|
||||
* Win32 Global/Local heap functions (GlobalXXX, LocalXXX).
|
||||
* These functions included in Win32 for compatibility with 16 bit Windows
|
||||
|
@ -18,7 +18,7 @@
|
|||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
|
||||
#if 0
|
||||
#define MAGIC_GLOBAL_USED 0x5342BEEF
|
||||
#define GLOBAL_LOCK_MAX 0xFF
|
||||
|
||||
|
@ -29,30 +29,33 @@ typedef struct __GLOBAL_LOCAL_HANDLE
|
|||
BYTE Flags;
|
||||
BYTE LockCount;
|
||||
} GLOBAL_HANDLE, LOCAL_HANDLE, *PGLOBAL_HANDLE, *PLOCAL_HANDLE;
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalAlloc(UINT flags, DWORD size)
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
HGLOBAL STDCALL
|
||||
GlobalAlloc(UINT uFlags,
|
||||
DWORD dwBytes)
|
||||
{
|
||||
#if 0
|
||||
PGLOBAL_HANDLE phandle;
|
||||
PVOID palloc;
|
||||
#endif
|
||||
|
||||
DPRINT("GlobalAlloc( 0x%X, 0x%lX )\n", flags, size );
|
||||
DPRINT("GlobalAlloc( 0x%X, 0x%lX )\n", uFlags, dwBytes);
|
||||
|
||||
if((flags & GMEM_MOVEABLE)==0) /* POINTER */
|
||||
{
|
||||
palloc=RtlAllocateHeap(hProcessHeap, 0, size);
|
||||
return (HGLOBAL) palloc;
|
||||
}
|
||||
if ((uFlags & GMEM_MOVEABLE)==0) /* POINTER */
|
||||
{
|
||||
return ((HGLOBAL)RtlAllocateHeap(hProcessHeap, 0, dwBytes));
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
{
|
||||
#if 0
|
||||
HeapLock(__ProcessHeap);
|
||||
|
||||
|
||||
phandle=__HeapAllocFragment(__ProcessHeap, 0, sizeof(GLOBAL_HANDLE));
|
||||
if(size)
|
||||
if(dwBytes)
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE));
|
||||
*(PHANDLE)palloc=(HANDLE) &(phandle->Pointer);
|
||||
|
@ -61,27 +64,133 @@ HGLOBAL WINAPI GlobalAlloc(UINT flags, DWORD size)
|
|||
else
|
||||
phandle->Pointer=NULL;
|
||||
phandle->Magic=MAGIC_GLOBAL_USED;
|
||||
phandle->Flags=flags>>8;
|
||||
phandle->Flags=uFlags>>8;
|
||||
phandle->LockCount=0;
|
||||
HeapUnlock(__ProcessHeap);
|
||||
|
||||
return (HGLOBAL) &(phandle->Pointer);
|
||||
#endif
|
||||
return (HGLOBAL)NULL;
|
||||
}
|
||||
return (HGLOBAL)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
LPVOID WINAPI GlobalLock(HGLOBAL hmem)
|
||||
|
||||
UINT STDCALL
|
||||
GlobalCompact(DWORD dwMinFree)
|
||||
{
|
||||
return RtlCompactHeap(hProcessHeap, 0);
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
GlobalFix(HGLOBAL hMem)
|
||||
{
|
||||
if (hMem != INVALID_HANDLE_VALUE)
|
||||
GlobalLock(hMem);
|
||||
}
|
||||
|
||||
|
||||
UINT STDCALL
|
||||
GlobalFlags(HGLOBAL hMem)
|
||||
{
|
||||
#if 0
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
#endif
|
||||
|
||||
DPRINT("GlobalFlags( 0x%lX )\n", (ULONG)hMem);
|
||||
|
||||
#if 0
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=phandle->LockCount + (phandle->Flags<<8);
|
||||
if(phandle->Pointer==0)
|
||||
retval|= LMEM_DISCARDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HGLOBAL STDCALL
|
||||
GlobalFree(HGLOBAL hMem)
|
||||
{
|
||||
#if 0
|
||||
PGLOBAL_HANDLE phandle;
|
||||
#endif
|
||||
|
||||
DPRINT("GlobalFree( 0x%lX )\n", (ULONG)hMem);
|
||||
|
||||
if (((ULONG)hMem % 4) == 0) /* POINTER */
|
||||
{
|
||||
RtlFreeHeap(hProcessHeap, 0, (PVOID)hMem);
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
#if 0
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hMem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
if(phandle->Pointer)
|
||||
HeapHeapFree(GetProcessHeap(),0,__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
__HeapFreeFragment(__ProcessHeap, 0, phandle);
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
#endif
|
||||
hMem = NULL;
|
||||
}
|
||||
return hMem;
|
||||
}
|
||||
|
||||
|
||||
HGLOBAL STDCALL
|
||||
GlobalHandle(LPCVOID pMem)
|
||||
{
|
||||
DPRINT("GlobalHandle( 0x%lX )\n", (ULONG)pMem);
|
||||
|
||||
#if 0
|
||||
if(((ULONG)pmem%8)==0) /* FIXED */
|
||||
return (HGLOBAL) pmem;
|
||||
else /* MOVEABLE */
|
||||
return (HGLOBAL) *(LPVOID *)(pmem-sizeof(HANDLE));
|
||||
#endif
|
||||
|
||||
return (HGLOBAL)pMem;
|
||||
}
|
||||
|
||||
|
||||
LPVOID STDCALL
|
||||
GlobalLock(HGLOBAL hMem)
|
||||
{
|
||||
#if 0
|
||||
PGLOBAL_HANDLE phandle;
|
||||
LPVOID palloc;
|
||||
#endif
|
||||
|
||||
DPRINT("GlobalLock( 0x%lX )\n", (ULONG) hmem );
|
||||
DPRINT("GlobalLock( 0x%lX )\n", (ULONG)hMem);
|
||||
|
||||
#if 0
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return (LPVOID) hmem;
|
||||
|
||||
|
@ -100,69 +209,33 @@ LPVOID WINAPI GlobalLock(HGLOBAL hmem)
|
|||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return palloc;
|
||||
}
|
||||
#else
|
||||
return (LPVOID)hMem;
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
BOOL WINAPI GlobalUnlock(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
BOOL locked;
|
||||
|
||||
DPRINT("GlobalUnlock( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return FALSE;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if((phandle->LockCount<GLOBAL_LOCK_MAX)&&(phandle->LockCount>0))
|
||||
phandle->LockCount--;
|
||||
|
||||
locked=(phandle->LockCount==0) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("GlobalUnlock: invalid handle\n");
|
||||
locked=FALSE;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return locked;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
HGLOBAL WINAPI GlobalHandle(LPCVOID pmem)
|
||||
|
||||
VOID STDCALL
|
||||
GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
|
||||
{
|
||||
DPRINT("GlobalHandle( 0x%lX )\n", (ULONG) pmem );
|
||||
|
||||
if(((ULONG)pmem%8)==0) /* FIXED */
|
||||
return (HGLOBAL) pmem;
|
||||
else /* MOVEABLE */
|
||||
return (HGLOBAL) *(LPVOID *)(pmem-sizeof(HANDLE));
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hmem, DWORD size, UINT flags)
|
||||
|
||||
HGLOBAL STDCALL
|
||||
GlobalReAlloc(HGLOBAL hMem,
|
||||
DWORD dwBytes,
|
||||
UINT uFlags)
|
||||
{
|
||||
#if 0
|
||||
LPVOID palloc;
|
||||
HGLOBAL hnew;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
#endif
|
||||
|
||||
DPRINT("GlobalReAlloc( 0x%lX, 0x%lX, 0x%X )\n", (ULONG) hmem, size, flags );
|
||||
DPRINT("GlobalReAlloc( 0x%lX, 0x%lX, 0x%X )\n", (ULONG)hMem, dwBytes, uFlags);
|
||||
|
||||
#if 0
|
||||
hnew=NULL;
|
||||
HeapLock(__ProcessHeap);
|
||||
if(flags & GMEM_MODIFY) /* modify flags */
|
||||
|
@ -234,58 +307,25 @@ HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hmem, DWORD size, UINT flags)
|
|||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return hnew;
|
||||
}
|
||||
#else
|
||||
return ((HGLOBAL)RtlReAllocateHeap(hProcessHeap, uFlags, (LPVOID)hMem, dwBytes));
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalFree(HGLOBAL hmem)
|
||||
{
|
||||
#if 0
|
||||
PGLOBAL_HANDLE phandle;
|
||||
#endif
|
||||
|
||||
DPRINT("GlobalFree( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if (((ULONG)hmem % 4) == 0) /* POINTER */
|
||||
{
|
||||
RtlFreeHeap(hProcessHeap, 0, (LPVOID)hmem);
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
#if 0
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
if(phandle->Pointer)
|
||||
HeapHeapFree(GetProcessHeap(),0,__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
__HeapFreeFragment(__ProcessHeap, 0, phandle);
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
#endif
|
||||
hmem = NULL;
|
||||
}
|
||||
return hmem;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
DWORD WINAPI GlobalSize(HGLOBAL hmem)
|
||||
|
||||
DWORD STDCALL
|
||||
GlobalSize(HGLOBAL hMem)
|
||||
{
|
||||
DWORD retval;
|
||||
#if 0
|
||||
PGLOBAL_HANDLE phandle;
|
||||
#endif
|
||||
|
||||
DPRINT("GlobalSize( 0x%lX )\n", (ULONG) hmem );
|
||||
DPRINT("GlobalSize( 0x%lX )\n", (ULONG)hMem);
|
||||
|
||||
if(((ULONG)hmem % 4) == 0)
|
||||
if(((ULONG)hMem % 4) == 0)
|
||||
{
|
||||
retval = RtlSizeHeap(hProcessHeap, 0, hmem);
|
||||
retval = RtlSizeHeap(hProcessHeap, 0, hMem);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -308,54 +348,62 @@ DWORD WINAPI GlobalSize(HGLOBAL hmem)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
LPVOID WINAPI GlobalWire(HGLOBAL hmem)
|
||||
|
||||
VOID STDCALL
|
||||
GlobalUnfix(HGLOBAL hMem)
|
||||
{
|
||||
return GlobalLock( hmem );
|
||||
if (hMem != INVALID_HANDLE_VALUE)
|
||||
GlobalUnlock(hMem);
|
||||
}
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
GlobalUnlock(HGLOBAL hMem)
|
||||
{
|
||||
#if 0
|
||||
PGLOBAL_HANDLE phandle;
|
||||
BOOL locked;
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
DPRINT("GlobalUnlock( 0x%lX )\n", (ULONG)hMem);
|
||||
|
||||
#if 0
|
||||
BOOL WINAPI GlobalUnWire(HGLOBAL hmem)
|
||||
{
|
||||
return GlobalUnlock( hmem);
|
||||
}
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return FALSE;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if((phandle->LockCount<GLOBAL_LOCK_MAX)&&(phandle->LockCount>0))
|
||||
phandle->LockCount--;
|
||||
|
||||
locked=(phandle->LockCount==0) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("GlobalUnlock: invalid handle\n");
|
||||
locked=FALSE;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return locked;
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
VOID WINAPI GlobalFix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalLock( hmem );
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnfix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
VOID WINAPI GlobalUnfix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalUnlock( hmem);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
#if 0
|
||||
UINT WINAPI GlobalFlags(HGLOBAL hmem)
|
||||
BOOL STDCALL
|
||||
GlobalUnWire(HGLOBAL hMem)
|
||||
{
|
||||
return LocalFlags( (HLOCAL) hmem);
|
||||
return GlobalUnlock(hMem);
|
||||
}
|
||||
|
||||
|
||||
LPVOID STDCALL
|
||||
GlobalWire(HGLOBAL hMem)
|
||||
{
|
||||
return GlobalLock(hMem);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* $Id: local.c,v 1.4 2000/07/01 17:07:00 ea Exp $
|
||||
/* $Id: local.c,v 1.5 2001/04/05 01:54:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* Copyright (C) 1996, Onno Hovers, All rights reserved
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/mem/local.cc
|
||||
* FILE: lib/kernel32/mem/local.c
|
||||
* PURPOSE: Manages the local heap
|
||||
* PROGRAMER: Onno Hovers (original wfc version)
|
||||
* David Welch (adapted for ReactOS)
|
||||
|
@ -21,109 +21,86 @@
|
|||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntdll/rtl.h>
|
||||
#include <windows.h>
|
||||
#include <kernel32/heap.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <kernel32/kernel32>
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalFlags(HLOCAL hmem)
|
||||
|
||||
HLOCAL STDCALL
|
||||
LocalAlloc(UINT uFlags,
|
||||
UINT uBytes)
|
||||
{
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=phandle->LockCount + (phandle->Flags<<8);
|
||||
if(phandle->Pointer==0)
|
||||
retval|= LMEM_DISCARDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
return (HLOCAL)GlobalAlloc(uFlags, uBytes);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* LocalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalAlloc(UINT flags, UINT size)
|
||||
UINT STDCALL
|
||||
LocalCompact(UINT uMinFree)
|
||||
{
|
||||
return (HLOCAL) GlobalAlloc( flags, size );
|
||||
return RtlCompactHeap(hProcessHeap, 0);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI LocalLock(HLOCAL hmem)
|
||||
|
||||
UINT STDCALL
|
||||
LocalFlags(HLOCAL hMem)
|
||||
{
|
||||
return GlobalLock( (HGLOBAL) hmem );
|
||||
return GlobalFlags((HGLOBAL)hMem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI LocalUnlock(HLOCAL hmem)
|
||||
|
||||
HLOCAL STDCALL
|
||||
LocalFree(HLOCAL hMem)
|
||||
{
|
||||
return GlobalUnlock( (HGLOBAL) hmem);
|
||||
return (HLOCAL)GlobalFree((HGLOBAL)hMem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalHandle(LPCVOID pmem)
|
||||
|
||||
HLOCAL STDCALL
|
||||
LocalHandle(LPCVOID pMem)
|
||||
{
|
||||
return (HLOCAL) GlobalHandle(pmem);
|
||||
return (HLOCAL)GlobalHandle(pMem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalReAlloc(HLOCAL hmem, UINT size, UINT flags)
|
||||
|
||||
LPVOID STDCALL
|
||||
LocalLock(HLOCAL hMem)
|
||||
{
|
||||
return (HLOCAL) GlobalReAlloc( (HGLOBAL) hmem, size, flags);
|
||||
return GlobalLock((HGLOBAL)hMem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalHeapFree(GetProcessHeap(),0,HLOCAL hmem)
|
||||
|
||||
HLOCAL STDCALL
|
||||
LocalReAlloc(HLOCAL hMem,
|
||||
UINT uBytes,
|
||||
UINT uFlags)
|
||||
{
|
||||
return (HLOCAL) GlobalHeapFree(GetProcessHeap(),0, (HGLOBAL) hmem );
|
||||
return (HLOCAL)GlobalReAlloc((HGLOBAL)hMem, uBytes, uFlags);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalSize(HLOCAL hmem)
|
||||
|
||||
UINT STDCALL
|
||||
LocalShrink(HLOCAL hMem, UINT cbNewSize)
|
||||
{
|
||||
return GlobalSize( (HGLOBAL) hmem );
|
||||
return RtlCompactHeap(hProcessHeap, 0);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalShrink -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalShrink(HLOCAL hmem, UINT newsize)
|
||||
|
||||
UINT STDCALL
|
||||
LocalSize(HLOCAL hMem)
|
||||
{
|
||||
return (__ProcessHeap->End - (LPVOID) __ProcessHeap);
|
||||
return GlobalSize((HGLOBAL)hMem);
|
||||
}
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
LocalUnlock(HLOCAL hMem)
|
||||
{
|
||||
return GlobalUnlock((HGLOBAL)hMem);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.26 2001/03/31 01:17:29 dwelch Exp $
|
||||
/* $Id: stubs.c,v 1.27 2001/04/05 01:54:42 ekohl Exp $
|
||||
*
|
||||
* KERNEL32.DLL stubs (unimplemented functions)
|
||||
* Remove from this file, if you implement them.
|
||||
|
@ -16,18 +16,6 @@ BaseAttachCompleteThunk (VOID)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
CmdBatNotification (
|
||||
|
@ -39,9 +27,6 @@ CmdBatNotification (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
CompareStringA (
|
||||
|
@ -74,7 +59,6 @@ CompareStringW (
|
|||
}
|
||||
|
||||
|
||||
|
||||
LCID
|
||||
STDCALL
|
||||
ConvertDefaultLocale (
|
||||
|
@ -86,11 +70,6 @@ ConvertDefaultLocale (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
CreateVirtualBuffer (
|
||||
|
@ -104,13 +83,6 @@ CreateVirtualBuffer (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
EnumCalendarInfoW (
|
||||
|
@ -519,8 +491,6 @@ GetDateFormatA (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
GetLocaleInfoW (
|
||||
|
@ -549,10 +519,6 @@ GetLocaleInfoA (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
GetNextVDMCommand (
|
||||
|
@ -596,9 +562,6 @@ GetNumberFormatA (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
GetOEMCP (VOID)
|
||||
|
@ -608,11 +571,6 @@ GetOEMCP (VOID)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetStringTypeExW (
|
||||
|
@ -709,8 +667,6 @@ GetSystemPowerStatus (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LCID
|
||||
STDCALL
|
||||
GetThreadLocale (VOID)
|
||||
|
@ -806,160 +762,6 @@ GetVDMCurrentDirectories (
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
HGLOBAL
|
||||
STDCALL
|
||||
GlobalAlloc (
|
||||
UINT uFlags,
|
||||
DWORD dwBytes
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
GlobalCompact (
|
||||
DWORD dwMinFree
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
GlobalFix (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
GlobalFlags (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
HGLOBAL
|
||||
STDCALL
|
||||
GlobalFree (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return hMem;
|
||||
}
|
||||
*/
|
||||
|
||||
HGLOBAL
|
||||
STDCALL
|
||||
GlobalHandle (
|
||||
LPCVOID pMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LPVOID
|
||||
STDCALL
|
||||
GlobalLock (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
/* In Win32 GlobalAlloc returns LPVOID? */
|
||||
return hMem;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
GlobalMemoryStatus (
|
||||
LPMEMORYSTATUS lpBuffer
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
HGLOBAL
|
||||
STDCALL
|
||||
GlobalReAlloc (
|
||||
HGLOBAL hMem,
|
||||
DWORD dwBytes,
|
||||
UINT uFlags
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
DWORD
|
||||
STDCALL
|
||||
GlobalSize (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GlobalUnWire (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
GlobalUnfix (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GlobalUnlock (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
LPVOID
|
||||
STDCALL
|
||||
GlobalWire (
|
||||
HGLOBAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL; /* ? */
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
|
@ -1044,8 +846,6 @@ HeapWalk (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
IsDBCSLeadByte (
|
||||
|
@ -1069,6 +869,25 @@ IsDBCSLeadByteEx (
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME PRIVATE
|
||||
* IsInstalledCP@4
|
||||
*
|
||||
* RETURN VALUE
|
||||
* TRUE if CodePage is installed in the system.
|
||||
*/
|
||||
static
|
||||
BOOL
|
||||
STDCALL
|
||||
IsInstalledCP (
|
||||
UINT CodePage
|
||||
)
|
||||
{
|
||||
/* FIXME */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
IsValidCodePage (
|
||||
|
@ -1136,123 +955,6 @@ LoadModule (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HLOCAL
|
||||
STDCALL
|
||||
LocalAlloc (
|
||||
UINT uFlags,
|
||||
UINT uBytes
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
LocalCompact (
|
||||
UINT uMinFree
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
LocalFlags (
|
||||
HLOCAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HLOCAL
|
||||
STDCALL
|
||||
LocalFree (
|
||||
HLOCAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return hMem;
|
||||
}
|
||||
|
||||
|
||||
HLOCAL
|
||||
STDCALL
|
||||
LocalHandle (
|
||||
LPCVOID pMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LPVOID
|
||||
STDCALL
|
||||
LocalLock (
|
||||
HLOCAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HLOCAL
|
||||
STDCALL
|
||||
LocalReAlloc (
|
||||
HLOCAL hMem,
|
||||
UINT uBytes,
|
||||
UINT uFlags
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
LocalShrink (
|
||||
HLOCAL hMem,
|
||||
UINT cbNewSize
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
LocalSize (
|
||||
HLOCAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
LocalUnlock (
|
||||
HLOCAL hMem
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
MulDiv (
|
||||
|
@ -1266,25 +968,6 @@ MulDiv (
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME PRIVATE
|
||||
* IsInstalledCP@4
|
||||
*
|
||||
* RETURN VALUE
|
||||
* TRUE if CodePage is installed in the system.
|
||||
*/
|
||||
static
|
||||
BOOL
|
||||
STDCALL
|
||||
IsInstalledCP (
|
||||
UINT CodePage
|
||||
)
|
||||
{
|
||||
/* FIXME */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* MultiByteToWideChar@24
|
||||
|
@ -1430,13 +1113,6 @@ MultiByteToWideChar (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
QueryPerformanceCounter (
|
||||
|
@ -1459,11 +1135,6 @@ QueryPerformanceFrequency (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
RegisterConsoleVDM (
|
||||
|
@ -1507,8 +1178,6 @@ RegisterWowExec (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetComputerNameA (
|
||||
|
@ -1531,14 +1200,6 @@ SetComputerNameW (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetLocaleInfoA (
|
||||
|
@ -1565,11 +1226,6 @@ SetLocaleInfoW (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetSystemPowerState (
|
||||
|
@ -1582,8 +1238,6 @@ SetSystemPowerState (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetThreadLocale (
|
||||
|
@ -1607,24 +1261,6 @@ SetVDMCurrentDirectories (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
TrimVirtualBuffer (
|
||||
|
@ -1636,8 +1272,6 @@ TrimVirtualBuffer (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
VDMConsoleOperation (
|
||||
|
@ -1687,9 +1321,6 @@ VerLanguageNameW (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
VirtualBufferExceptionHandler (
|
||||
|
@ -1703,9 +1334,6 @@ VirtualBufferExceptionHandler (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
WideCharToMultiByte (
|
||||
|
@ -1724,11 +1352,4 @@ WideCharToMultiByte (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue