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
util.c
Upload User: yuandong
Upload Date: 2022-08-08
Package Size: 954k
Code Size: 1k
Category:
Delphi VCL
Development Platform:
C++ Builder
- /*++
- Copyright (c) 1990-1998 Microsoft Corporation
- All rights reserved
- Module Name:
- util.c
- --*/
- #include "local.h"
- LPVOID
- ReallocSplMem(
- LPVOID pOldMem,
- DWORD cbOld,
- DWORD cbNew
- )
- {
- LPVOID pNewMem;
- pNewMem=AllocSplMem(cbNew);
- if (pOldMem && pNewMem) {
- if (cbOld) {
- CopyMemory( pNewMem, pOldMem, min(cbNew, cbOld));
- }
- FreeSplMem(pOldMem);
- }
- return pNewMem;
- }
- LPWSTR
- AllocSplStr(
- LPWSTR pStr
- )
- /*++
- Routine Description:
- This function will allocate enough local memory to store the specified
- string, and copy that string to the allocated memory
- Arguments:
- pStr - Pointer to the string that needs to be allocated and stored
- Return Value:
- NON-NULL - A pointer to the allocated memory containing the string
- FALSE/NULL - The operation failed. Extended error status is available
- using GetLastError.
- --*/
- {
- LPWSTR pMem;
- DWORD cbStr;
- if (!pStr) {
- return NULL;
- }
- cbStr = wcslen(pStr)*sizeof(WCHAR) + sizeof(WCHAR);
- if (pMem = AllocSplMem( cbStr )) {
- CopyMemory( pMem, pStr, cbStr );
- }
- return pMem;
- }
- LPVOID
- AllocSplMem(
- DWORD cbAlloc
- )
- {
- PVOID pvMemory;
- pvMemory = GlobalAlloc(GMEM_FIXED, cbAlloc);
- if( pvMemory ){
- ZeroMemory( pvMemory, cbAlloc );
- }
- return pvMemory;
- }