Free Trial Software Downloads Command-line Resource Editor
Heaventools Home
 

home      products      solutions     news     downloads     order     support     about us

 

 
Resource Tuner Console Sample Scripts
 

 

Edit XML Manifest

Edit Manifest, Add Vista Icon

Among the other tasks, this code shows the way you can edit the embedded manifest entry using VBScript.

This code shows how to:
- Replaces icons in the executable with icons from an ico file which contains more than one image.
- Add a 256x256 PNG-compressed icon (a Vista icon)
- Sort out the added icons in the right order
- Add or replace an XML manifest for Vista User Access Control
- Output the changes in the Resource Tree to a log file.

'------------------------------------------------------------------------------
'
' This code shows how to:
'   - replace icons in the executable with icons from an ico file which 
'     contains more than one image.
'   - add a 256x256 PNG-compressed icon (a Vista icon)
'   - sort out the added icons in the right order
'   - add or replace an XML manifest
'   - output the changes in the Resource Tree to a log file.
'
' To give you an idea of how this all works, we made this sample script and
' test application. When you installed Resorce Tuner Console on your computer,
' the setup program created the "..\Demo" folder under the RTC folder, with 
' the test application "demoapp1.exe" in the "..\Demo\Src" folder. 
'
' The script will add or replace icons in demoapp1.exe with icons from the .ico
' and .png files from the "..\Demo\Src" folder. 
'
' The resulting file will be created in the directory named "..\Demo\Release"
' Check the log file "rtc.log" to see the Resource Tree changed.  
'
' Demonstrates the following:
'
' - PEFileProxy.OpenFileEx
' - PEFileProxy.Terminated
' - PEFileProxy.HasResources
' - PEFileProxy.CreateBackUp
' - PEFileProxy.SaveAsNewImage
' - PEFileProxy.PostDebugString
' - PEFileProxy.UpdateCheckSum
' - ResourcesProxy.ChangeIcon
' - ResourcesProxy.ChangeVistaIcon
' - ResourcesProxy.ChangeManifest
' - ResourcesProxy.SetLanguage
' - ResourcesProxy.SortGroupIcon
' - ResourcesProxy.ResourceTreeToLog
'
'------------------------------------------------------------------------------
Sub Main
  PEFileProxy.PostDebugString "Updating the checksum in the PE file header is enabled."
  PEFileProxy.UpdateCheckSum = True

  PEFileProxy.PostDebugString "The creation of a backup copy is disabled."
  PEFileProxy.CreateBackUp = False

  LangID = 0 ' Default
  CP     = ScriptUnit.CodePageFromLangID(LangID)

  PEFileProxy.PostDebugString "Opening a file and checking resources..."

  'Open file
  'Once the file is opened successfully, check if the file contains resources
  'If not, create resources

  If (PEFileProxy.OpenFileEx ("..\demo\src\demoapp1.exe", True)) Then

    ResourcesProxy.SetLanguage LangID, DELETE_IF_EXISTS

PEFileProxy.PostDebugString "Changing/adding the full XP icon set (9 icons)..."
ResourcesProxy.ChangeIcon "", LangID, CREATE_IF_NOT_EXIST, REPLACE_IF_ITEM_EXISTS, 
"..\demo\src\xp_iconset.ico"

PEFileProxy.PostDebugString "Adding the 256 pix PNG Vista icon ..."
ResourcesProxy.ChangeVistaIcon "", LangID, 32, CREATE_IF_NOT_EXIST, REPLACE_IF_ITEM_EXISTS, 
"..\demo\src\vista_256x256_32bit.png"

 PEFileProxy.PostDebugString "Sorting out the icons..."
 ResourcesProxy.SortGroupIcon "", True

'Edit XML Manifest

    PEFileProxy.PostDebugString "Adding/editing XML Manifest..."
    ResourcesProxy.ChangeManifest EXE_MANIFEST, LangID, CREATE_IF_NOT_EXIST, 
"..\demo\src\exe_manifest.xml"

    PEFileProxy.PostDebugString ""
    PEFileProxy.PostDebugString "Resource Tree built by RTC:"
    ResourcesProxy.ResourceTreeToLog
    PEFileProxy.PostDebugString ""

    PEFileProxy.PostDebugString "Saving file as a new file..."
    PEFileProxy.SaveAsNewImage "..\demo\release\demoapp1.exe"

    PEFileProxy.PostDebugString "Closing this file..."
    PEFileProxy.CloseFile

  Else
    PEFileProxy.PostDebugString "Opening a file produced a fatal error."
  End If

End Sub
'------------------------------------------------------------------------------

To see the changes made to the test EXEs, we recommend using Resource Tuner GUI, a visual resource editor.

Start tuning your applications now

Resource Tuner Console offers exceptional value for money and delivers functionality that reaches far beyond its price tag. Discover how you and your organization can benefit from this exciting program. Start tuning your applications today!

Buy NowBuy Resource Tuner Console now for US$ 199, and make resource editing easier and faster.

Download a 30 day trial version of ResTuner     How to Order

     

Home  •   Site Map  •   Purchase  •   Downloads  •   Support  •   F.A.Q.  •   Forum  •   About