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
Pointer to a null-terminated string that specifies the name of the image that is loaded.
DllPath
Pointer to a null-terminated string that specifies 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 apply.
LoadedImage
Pointer to a LOADED_IMAGE structure that receives information about the image after it is loaded.
DotDll
Specifies the default extension, if the image name does not contain a file extension. If the value is TRUE, a .DLL extension is used. If the value is FALSE, then an .EXE extension is used.
ReadOnly
Specifies the access mode. 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, 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.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in imagehlp.h.
  Import Library: Use imagehlp.lib.

See Also

PE Image Helper (ImageHlp) Overview, Image Access, LOADED_IMAGE, UnMapAndLoad