ReBaseImage Function
Changes the load address for the specified image, which reduces the required load time for a DLL.
Alternatively, you can use the Rebase tool. This tool is available in Visual Studio and the Platform SDK.
Note that this function is implemented as a call to the ReBaseImage64 function.
BOOL ReBaseImage( __in PCSTR CurrentImageName, __in PCSTR SymbolPath, __in BOOL fReBase, __in BOOL fRebaseSysfileOk, __in BOOL fGoingDown, __in ULONG CheckImageSize, __out ULONG* OldImageSize, __out ULONG_PTR* OldImageBase, __out ULONG* NewImageSize, __in_out ULONG_PTR* NewImageBase, __in ULONG TimeStamp );
Parameters
- CurrentImageName
-
The name of the file to be rebased.
- SymbolPath
-
The path used to find the corresponding symbol file.
- fReBase
-
If this value is TRUE, the image is rebased. Otherwise, the image is not rebased.
- fRebaseSysfileOk
-
If this value is TRUE, the system image is rebased. Otherwise, the system image is not rebased.
- fGoingDown
-
If this value is TRUE, the image can be rebased below the given base; otherwise, it cannot.
- CheckImageSize
-
The maximum size that the image can grow to, in bytes, or zero if there is no limit.
- OldImageSize
-
A pointer to a variable that receives the original image size, in bytes.
- OldImageBase
-
A pointer to a variable that receives the original image base.
- NewImageSize
-
A pointer to a variable that receives the new image size after the rebase operation, in bytes.
- NewImageBase
-
A pointer to a variable that receives the new image base after the rebase operation.
- TimeStamp
-
The new time date stamp for the image file header. The value must be represented in the number of seconds elapsed since midnight (00:00:00), January 1, 1970, Universal Coordinated Time, according to the system clock.
If this parameter is 0, the current file header time date stamp is incremented by 1 second.
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 ReBaseImage function changes the desired load address for the specified image. This operation involves reading the entire image and updating all fixups, debugging information, checksum, and time stamp values. You can rebase an image to reduce the required load time for its DLLs. If an application can rely on a DLL being loaded at the desired load address, then the system loader does not have to relocate the image. The image is simply loaded into the application's virtual address space and the DllMain function is called, if one is present.
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
Client |
Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95. |
---|---|
Server |
Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server. |
Header |
Declared in Imagehlp.h. |
Library |
Use Imagehlp.lib. |
DLL |
Requires Imagehlp.dll. |
See Also
ImageHlp FunctionsDllMain
Send comments about this topic to Microsoft
Build date: 9/25/2007
© 2007 Microsoft Corporation. All rights reserved.