Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
mem.h
Package: shell.rar [view]
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:
Windows Kernel
Development Platform:
Visual C++
- #ifndef _INC_MEM
- #define _INC_MEM
- // wrappers for private allocations, near in 16 bits
- #define NearAlloc(cb) ((void NEAR*)LocalAlloc(LPTR, (cb)))
- #define NearReAlloc(pb, cb) ((void NEAR*)LocalReAlloc((HLOCAL)(pb), (cb), LMEM_MOVEABLE | LMEM_ZEROINIT))
- #define NearFree(pb) (LocalFree((HLOCAL)(pb)) ? FALSE : TRUE)
- #define NearSize(pb) LocalSize(pb)
- #ifdef WIN32
- //
- // These macros are used in our controls, that in 32 bits we simply call
- // LocalAlloc as to have the memory associated with the process that created
- // it and as such will be cleaned up if the process goes away.
- //
- #ifdef DEBUG
- LPVOID WINAPI ControlAlloc(HANDLE hheap, DWORD cb);
- LPVOID WINAPI ControlReAlloc(HANDLE hheap, LPVOID pb, DWORD cb);
- BOOL WINAPI ControlFree(HANDLE hheap, LPVOID pb);
- DWORD WINAPI ControlSize(HANDLE hheap, LPVOID pb);
- #else // DEBUG
- #define ControlAlloc(hheap, cb) HeapAlloc((hheap), HEAP_ZERO_MEMORY, (cb))
- #define ControlReAlloc(hheap, pb, cb) HeapReAlloc((hheap), HEAP_ZERO_MEMORY, (pb),(cb))
- #define ControlFree(hheap, pb) HeapFree((hheap), 0, (pb))
- #define ControlSize(hheap, pb) HeapSize((hheap), 0, (LPCVOID)(pb))
- #endif // DEBUG
- BOOL Str_Set(LPSTR *ppsz, LPCSTR psz); // in the process heap
- #else // WIN32
- //
- // In 16 bit code we need the Allocs to go from our heap code as we do not
- // want to limit them to 64K of data. If we have some type of notification of
- // 16 bit application termination, We may want to see if we can
- // dedicate different heaps for different processes to cleanup...
- //
- #define ControlAlloc(hheap, cb) Alloc(cb) /* calls to verify heap exists */
- #define ControlReAlloc(hheap, pb, cb) ReAlloc(pb, cb)
- #define ControlFree(hheap, pb) Free(pb)
- #define ControlSize(hheap, pb) GetSize((LPCVOID)pb)
- #define Str_Set(p, s) Str_SetPtr(p, s) // use shared heap for win16
- #endif // WIN32
- extern HANDLE g_hSharedHeap;
- #endif // !_INC_MEM