Class TResourceFile (unit Iconhckr) |
Inherits from
TObject
constructor Create ( szFileName: PANSICHAR );
- Win32 header
destructor Destroy;
Punt to the appropriate routine for the given file
function EnumIcons ( lpfnCallback: TICONENUMERATOR ): BOOLEAN;
* EnumIcons
*
* Enumerates through all icons in the current image file.
function FindIcon ( szResourceID: PANSICHAR ): LONGINT;
* FindIcon
*
* Locates the given Icon ID in the resource file.
function GetIconDIB ( szResourceID: PANSICHAR ): LONGINT;
* GetIconDIB
*
* Returns the physical offset in the TResourceFile where
* the DIB for the specified icon can be found.
function UpdateIcon ( szResourceID: PANSICHAR; szIcon: PANSICHAR ): BOOLEAN;
* UpdateIcon
*
* Locates the specified resource and moves the given icons into
* the exe file.
function UpdateIconFromImage ( szResourceID: PANSICHAR; ResFile: TResourceFile; szSourceID: PANSICHAR ): BOOLEAN;
* UpdateIconFromImage
*
* Updates an icon from another TResourceFile.
function EnumNEIcons ( lpfnCallback: TICONENUMERATOR ): BOOLEAN;
CompareName returns the result of lpfnCallback
function EnumPEIcons ( lpfnCallback: TICONENUMERATOR ): BOOLEAN;
assumes this read works
function FindNEIcon ( szResourceID: PANSICHAR ): LONGINT;
function FindPEIcon ( szResourceID: PANSICHAR ): LONGINT;
this could be a bit smarter to just to check the named or id'd entries
function GetNEIconDIB ( szResourceID: PANSICHAR ): LONGINT;
Punt to the appropriate routine for the given file
function GetPEIconDIB ( szResourceID: PANSICHAR ): LONGINT;
Return the image directory offset
function ImageDirectoryOffset ( dwIMAGE_DIRECTORY : LONGINT; var VirtualAddress: LONGINT ): LONGINT;
PE helper routines
function SectionHeaderOffset: LONGINT;
function UpdateNEIcon ( szResourceID: PANSICHAR; szIcon: PANSICHAR ): BOOLEAN;
assumes this read works
function UpdateNEIconFromImage ( szResourceID: PANSICHAR; ResFile: TResourceFile; szSourceID: PANSICHAR ): BOOLEAN;
the INT typecast here is just in some really wierd case there are 0 icons.
function UpdatePEIcon ( szResourceID: PANSICHAR; szIcon: PANSICHAR ): BOOLEAN;
Punt to the appropriate routine for the given file
function UpdatePEIconFromImage ( szResourceID: PANSICHAR; ResFile: TResourceFile; szSourceID: PANSICHAR ): BOOLEAN;
Punt to the appropriate routine for the given file
m_bPortable : BOOLEAN;
File variable
m_file : FILE;
Name of the file
m_MZHeader : TMZHeader;
True, image is a PE; FALSE, image is an NE
m_NEHeader : TNEHeader;
DOS exe header - common to all images
m_PEHeader : TIMAGE_NT_HEADERS;
Win16 header
m_szFileName : PANSICHAR;
constructor Create ( szFileName: PANSICHAR );
Win32 header
destructor Destroy;
Punt to the appropriate routine for the given file
function EnumIcons ( lpfnCallback: TICONENUMERATOR ): BOOLEAN;
* EnumIcons
*
* Enumerates through all icons in the current image file.
* Calls the method given by lpfnCallback for each icon.
*
* lpfnCallback - the method address to call for each icon.
*
* Returns:
* TRUE - the function was successful, does not guarentee that
* the callback function was called.
*
* FALSE - the function failed.
*
function FindIcon ( szResourceID: PANSICHAR ): LONGINT;
* FindIcon
*
* Locates the given Icon ID in the resource file.
*
* szResourceID - the name of the resouce or the ID in MAKEINTRESOURCE format.
*
* Returns:
* 0 : The requested icon was not found in the file.
* !0 : The handle to the icon (actually file position)
* The two blocks below assume that all PEs and NEs are large
* enough to contain both the PE header and an NE header..
*
* Hopefully, this assumption will never be proven incorrect.
function GetIconDIB ( szResourceID: PANSICHAR ): LONGINT;
* GetIconDIB
*
* Returns the physical offset in the TResourceFile where
* the DIB for the specified icon can be found.
*
* szResourceID - the name of the icon to find (comes from the RT_GROUP_ICON resource)
*
* Returns:
* 0 : failed
* > 0 : the offset of the dib in the image.
the INT typecast here is just in some really wierd case there are 0 icons..
function UpdateIcon ( szResourceID: PANSICHAR; szIcon: PANSICHAR ): BOOLEAN;
* UpdateIcon
*
* Locates the specified resource and moves the given icons into
* the exe file.
*
* szResourceID - the name of the resource or the ID in MAKEINTRESOURCE format.
* szIcon - the name of the .ICO file.
*
* Returns:
* TRUE - successful
* FALSE - failed
this could be a bit smarter to just to check the named or id'd entries
function UpdateIconFromImage ( szResourceID: PANSICHAR; ResFile: TResourceFile; szSourceID: PANSICHAR ): BOOLEAN;
* UpdateIconFromImage
*
* Updates an icon from another TResourceFile.
*
* szResourceID - the name of the resource to be updated (destination)
* ResFile - the TResourceFile class from which the icon is to be retrieved
* szSourceID - the name of the source icon.
*
* Returns:
* TRUE - succesful
* FALSE - failed
Punt to the appropriate routine for the given file
function EnumNEIcons ( lpfnCallback: TICONENUMERATOR ): BOOLEAN;
CompareName returns the result of lpfnCallback
function EnumPEIcons ( lpfnCallback: TICONENUMERATOR ): BOOLEAN;
assumes this read works
function FindNEIcon ( szResourceID: PANSICHAR ): LONGINT;
function FindPEIcon ( szResourceID: PANSICHAR ): LONGINT;
this could be a bit smarter to just to check the named or id'd entries
function GetNEIconDIB ( szResourceID: PANSICHAR ): LONGINT;
Punt to the appropriate routine for the given file
function GetPEIconDIB ( szResourceID: PANSICHAR ): LONGINT;
Return the image directory offset
function ImageDirectoryOffset ( dwIMAGE_DIRECTORY : LONGINT; var VirtualAddress: LONGINT ): LONGINT;
PE helper routines
function SectionHeaderOffset: LONGINT;
function UpdateNEIcon ( szResourceID: PANSICHAR; szIcon: PANSICHAR ): BOOLEAN;
assumes this read works
function UpdateNEIconFromImage ( szResourceID: PANSICHAR; ResFile: TResourceFile; szSourceID: PANSICHAR ): BOOLEAN;
the INT typecast here is just in some really wierd case there are 0 icons..
function UpdatePEIcon ( szResourceID: PANSICHAR; szIcon: PANSICHAR ): BOOLEAN;
Punt to the appropriate routine for the given file
function UpdatePEIconFromImage ( szResourceID: PANSICHAR; ResFile: TResourceFile; szSourceID: PANSICHAR ): BOOLEAN;
Punt to the appropriate routine for the given file
m_bPortable : BOOLEAN;
File variable
m_file : FILE;
Name of the file
m_MZHeader : TMZHeader;
True, image is a PE; FALSE, image is an NE
m_NEHeader : TNEHeader;
DOS exe header - common to all images
m_PEHeader : TIMAGE_NT_HEADERS;
Win16 header
m_szFileName : PANSICHAR;