Functions
MemoryManagement

Functions

DWORD mdlWin32_GetLastError ()
 
The mdlWin32_getLastError function returns the most recent error code set

by a mdlWin32_... More...

 
void mdlWin32_SetLastError (DWORD errno)
 The mdlWin32_setLastError function is used to set the error code returned by a mdlWin32... More...
 
int mdlWin32_readDataFromHandle (HANDLE hMem, void **mdlMemPP, UInt *mdlMemLen)
 
The mdlWin32_readDataFromHandle function extracts data from the specified

memory handle hMem and copies the data into a malloced data buffer. More...

 
HANDLE mdlWin32_createDataHandle (UINT flags, void *mdlMemP, UInt mdlMemLen)
 
The mdlWin32_createDataHandle function allocates the specified number of

bytes from the heap and copies mdlMemLen bytes from mdlMemP into the memory handle. More...

 
HANDLE mdlWin32_destroyDataHandle (HANDLE hMem)
 
The mdlWin32_destroyDataHandle function frees to resources allocated

by mdlWin32_createDataHandle. More...

 
HANDLE mdlWin32_writeDataToHandle (HANDLE hMem, void *mdlMemP, UInt mdlMemLen)
 
The mdlWin32_writeDataToHandle function copies data from the specified

memory buffer pointed to by mdlMemP, for mdlMemLen bytes into the memory handle hMem. More...

 

Detailed Description

Function Documentation

HANDLE mdlWin32_createDataHandle ( UINT  flags,
void *  mdlMemP,
UInt  mdlMemLen 
)

The mdlWin32_createDataHandle function allocates the specified number of

bytes from the heap and copies mdlMemLen bytes from mdlMemP into the memory handle.

Parameters
[in]flagsspecifies how to allocate memory and can be a combination of the following flags:
Flag Description
GMEM_MOVEABLE Allocates moveable memory.
GHND Combines the GMEM_MOVEABLE and GMEM_ZEROINIT flags.
GMEM_DDESHARE Allocates memory to be used in the dynamic data exchange (DDE) functions for a DDE conversation and should be set if the memory is to be used for DDE. Only processes that use DDE or the clipboard for interprocess communication should specify this flag. Most applications will use this value.
GMEM_SHARE Same as GMEM_DDESHARE
GMEM_ZEROINIT Initialize memory contents to zero.
[in]mdlMemPspecifies the source of the data to copy into the memory handle.
[in]mdlMemLenspecifies the number of bytes to allocate for the memory handle and to copy from mdlMemP.
Remarks
It is the responsibility of the programmer to insure that the memory allocated by this function is eventually freed.
Returns
mdlWin32_createDataHandle returns the handle of the newly allocated memory object; otherwise, it return NULL. To get extended error information, use the mdlWin32_getLastError function.
See also
mdlWin32_getLastError
Remarks
Required Library: mdlbltin.lib
HANDLE mdlWin32_destroyDataHandle ( HANDLE  hMem)

The mdlWin32_destroyDataHandle function frees to resources allocated

by mdlWin32_createDataHandle.

Parameters
[in]hMemspecifies the memory handle to return to the system.
Returns
mdlWin32_destroyDataHandle returns 0 for success. To get extended error information, use the mdlWin32_getLastError function.
See also
mdlWin32_getLastError mdlWin32_createDataHandle
Remarks
Required Library: mdlbltin.lib
DWORD mdlWin32_GetLastError ( )

The mdlWin32_getLastError function returns the most recent error code set

by a mdlWin32_...

function call.

Returns
mdlWin32_getLastError returns the most recent error code set by a Win32 interface function.
Remarks
Required Library: mdlbltin.lib
int mdlWin32_readDataFromHandle ( HANDLE  hMem,
void **  mdlMemPP,
UInt mdlMemLen 
)

The mdlWin32_readDataFromHandle function extracts data from the specified

memory handle hMem and copies the data into a malloced data buffer.

The address of this buffer is placed in mdlMemPP. The size, in bytes, of this buffer is placed into mdlMemLenP.

Parameters
[in]hMemspecifies the Windows memory handle on which to operate.
[in,out]mdlMemPPspecifies the address of a buffer pointer. A memory block large enough to hold the contents of the data portion of the memory handle is allocated and that address is placed into this parameter.
[out]mdlMemLenpoints to the integer to receive the size of the allocated memory block.
Returns
mdlWin32_readDataFromHandle returns SUCCESS if the function is successful.
See also
mdlWin32_writeDataToHandle mdlWin32_createDataHandle
Remarks
Required Library: mdlbltin.lib
void mdlWin32_SetLastError ( DWORD  errno)

The mdlWin32_setLastError function is used to set the error code returned by a mdlWin32...

function call. This is generally used to reset the error value to zero.

Parameters
[in]errnoThe new error code.
Remarks
Required Library: mdlbltin.lib
HANDLE mdlWin32_writeDataToHandle ( HANDLE  hMem,
void *  mdlMemP,
UInt  mdlMemLen 
)

The mdlWin32_writeDataToHandle function copies data from the specified

memory buffer pointed to by mdlMemP, for mdlMemLen bytes into the memory handle hMem.

Parameters
[in]hMemspecifies the Windows memory handle on which to operate.
[in]mdlMemPspecifies the address of the source data buffer.
[in]mdlMemLenspecifies the size, in bytes, of the source buffer.
Returns
mdlWin32_writeDataToHandle returns hMem on success or NULL on failure.
See also
mdlWin32_readDataFromHandle mdlWin32_createDataHandle
Remarks
Required Library: mdlbltin.lib

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.