MapAndLoad

The MapAndLoad function maps an image and preloads data from the mapped file.

BOOL MapAndLoad(

IN LPSTR ImageName,  
IN LPSTR DllPath,  
OUT PLOADED_IMAGE LoadedImage,  
IN BOOL DotDll,  
IN BOOL ReadOnly  
);  

Parameters

ImageName

The name of the image that is loaded.

DllPath

The path used to locate the image if the name provided cannot be found. If NULL is used, then the search path rules set forth in the SearchPath function will apply.

LoadedImage

A pointer to a LOADED_IMAGE structure. This structure receives information about the image after it is loaded.

DotDll

If the image needs to be located and the image name does not contain a file extension, this parameter controls the default extension used for the search process. If the value is TRUE, a .dll extension is used. If the value is FALSE, then a .exe extension is used.

ReadOnly

If this value is TRUE, the file is mapped for read-access only. If the value is FALSE, the file is mapped for read and write access.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, then the return value is FALSE. To retrieve extended error information, call GetLastError.

Remarks

The MapAndLoad function maps an image and preloads data from the mapped file. The corresponding function, UnMapAndLoad, must be used to deallocate all resources that are allocated by the MapAndLoad function.