Click to Rate and Give Feedback
MSDN
MSDN Library
Diagnostics
Debug Help Library
DbgHelp Reference
Image Help Library
ImageHlp Reference
ImageHlp Functions
 GetImageConfigInformation Function
GetImageConfigInformation Function

Locates and returns the load configuration data of an image.

Syntax

C++
BOOL GetImageConfigInformation(
  __in   PLOADED_IMAGE LoadedImage,
  __out  PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigInformation
);

Parameters

LoadedImage [in]

A pointer to a LOADED_IMAGE structure that is returned from a call to MapAndLoad or ImageLoad.

ImageConfigInformation [out]

A pointer to an IMAGE_LOAD_CONFIG_DIRECTORY64 structure that receives the configuration information.

Return Value

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 SetImageConfigInformation function locates and changes the load configuration data of an image.

All ImageHlp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderImagehlp.h
LibraryImagehlp.lib
DLLImagehlp.dll

See Also

ImageHlp Functions
IMAGE_LOAD_CONFIG_DIRECTORY64
LOADED_IMAGE
SetImageConfigInformation

Send comments about this topic to Microsoft

Build date: 11/12/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Inaccurate Return Condition Information      Drew Benton   |   Edit   |   Show History
On failure, the function returns 0. However, the last error is never set! I cannot get this function to work correctly. Tracing through the call in OllyDbg, there seems to be a problem on this line:

76C97692     E8 1ACBFFFF             CALL imagehlp.ImageDirectoryEntryToData
76C97697     85C0                        TEST EAX, EAX
76C97699     74 19                        JE SHORT imagehlp.76C976B4
76C9769B     837D 08 48               CMP DWORD PTR SS:[EBP+8], 48  ; This line causes the function to fail!
76C9769F     75 13                        JNZ SHORT imagehlp.76C976B4
On the marked line above, the value in memory is 0x40. After that comparison fails, EAX is set to 0 and the function returns. No SetLastError is ever called in the function, so I have no idea what the error is. I'm guessing there's an error with the size of the structure being passed in and the internal structure expected? I'll try to reverse the function more to figure that error out, but I still wanted to point out the last error never being set as per docs.

Edit: Microsoft Windows XP w/ Service Pack 2 [Version 5.1.2600]
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker