Gerome's FBSL Icon Changer

(Requests for Help with User Code)

Gerome's FBSL Icon Changer

Unread postby GSAC3000 » Mon Oct 26, 2015 9:31 pm

Mike:

In 2007, Gerome posted the code listed below which successfully allowed icons of FBSL generated EXE files to be changed. The program does not run successfully under the current version of FBSL-- it hangs during execution. Can you tell me how to fix the original source to correct the problem so I can use it with the latest FBSL ?

Don

Code: Select all
'  FBSL ICON CHANGER
'  New ICON must be 32x32x16 color (766 bytes)
'
#include <Include\Windows.inc>
#Option Strict
#apptype CONSOLE

'Option Explicit
Begin Const
   szEXEFile  = Fbsl_getfilename( "Pick a compiled FBSL file", "FBSL compiled Files(*.exe)|*.exe", 0 )
   szICONFILE = Fbsl_getfilename( "Pick an ICON file", "ICON Files(*.ico)|*.ico", 0 )
   ICONSTART  = 0x16    ' This is the icon data starts in the icon file.
   ICOMAXSIZE = 0x2FE   ' 766 bytes icon data file
End Const

' // Main
If szICONFILE = "" OrElse szEXEFile = "" Then ExitProgram(-3)
SetNewIcon()
Pause

'// --------------ICON PATCH--------------------- \\
Sub SetNewIcon()
Dim $bufNewIcon, %ICONSIZE, %fpIcon, %fpApp, %ICONLOC = GetIconOffset()

   ICONSIZE = Filelen( szICONFILE )
   If ICONSIZE > ICOMAXSIZE Then
      Msgbox( Null, "This file is not a 32x32 16 colour icon!", "ALERT!", MB_ICONSTOP )
      Exitprogram(-2)
   End If
   If ICONSIZE > ICONSTART Then
      ICONSIZE = ICONSIZE - ICONSTART
   End If

   ' Open icon file
   fpIcon = Fileopen( szICONFILE,  Binary_Input )
   Fileseek ( fpIcon, ICONSTART )
   bufNewIcon = Fileget( fpIcon, ICONSIZE )
   Fileclose( fpIcon )

   ' Patch our _FBSL_.EXE
   fpApp = Fileopen( szEXEFile, Binary )
   Fileseek( fpApp, ICONLOC )
   Fileput( fpApp, bufNewIcon, ICONSIZE )
   Fileclose( fpApp )
   Msgbox( Null, szEXEFile & " was successfully patched!", "SUCCESS!", MB_ICONINFORMATION )

End Sub

Function GetIconOffset()
Dim %sizeofstub2, %i, %iOffset, %FP2, $Bufall
Dim $stringg   = Chr(0x28, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x40, 0x0)
Dim %lenstring = Len(stringg)

   If Not Fileexist(szEXEFile) Then Return 0
   sizeofstub2 = Filelen( szEXEFile )

   FP2    = Fileopen( szEXEFile, Binary_Input )
   Bufall = Fileget( FP2, sizeofstub2 )
   Fileclose( FP2 )

   For i = 0 To sizeofstub2
      If Apicall( "memcmp", "msvcrt", @Bufall+i, stringg, lenstring ) = 0 Then
         iOffset = i
         Exit For
      End If
   Next i
   If iOffset = 0 Then
      Msgbox( Null, "This file is not a 32x32 16 colour icon!", "ALERT!", MB_ICONSTOP )
      Exitprogram(-1)
   End If
Return iOffset
End Function

GSAC3000
FBSL tiny seed
FBSL tiny seed
 
Posts: 15
Joined: Thu Oct 01, 2015 8:15 pm

Re: Gerome's FBSL Icon Changer

Unread postby Mike Lobanovsky » Mon Oct 26, 2015 11:24 pm

Don,

There are four very basic (not BASIC-ish, no pun intended) design decisions that don't now, and never will in the future, allow such scripts to run with FBSL v3.5 and hopefully higher.

1. Such a brute-force approach to dealing with an FBSL executable's resources de-synchronizes the data (checksum) written originally in the executable file header at its compile time, with its newly patched content. Such desync'ing would provoke significantly less smart but yet free and therefore wider used AV software to raise incidental false alarms, which has been and might still be detrimental to FBSL's public image. That's why the FBSL dev team won't encourage such activities any more.

2. The internal structure and layout of an executable precompiled with FBSL v3.5 is substantially different from prior versions so that the old hacks won't work any more. Still you can however use this script in FBSL v3.4.10 as linked to in Gerome's signature to vivisect the executables, both uncompressed and exe-packed with UPX, precompiled in the past with all the now-deprecated FBSL builds.

3. For the purposes of providing access to the scripted content within earlier versions of FBSL executables, FBSL v3.5 still can decompile them provided they are uncompressed and either not password-protected or their author-defined passwords are known to you. FBSL v3.5 will however compile and decompile its own scripts in the new format only.

4. All sorts of manipulations with the FBSL v3.5 executable resources including the choice of appropriate icons, manifests and versioning will be made available to the script author at compile time through the use of a new W.I.P. FBSL executable compiler when I have enough time and insentive to complete this project. Cold::Rocks will replace the existing very limited compiler script that you're currently using via the system popup menu or in the Eclecta code editor.
Mike
"Я старый солдат, мадам, и не знаю слов любви."
"I am an old soldier, ma'am, and I don't know the words of love."
"Je suis un vieux soldat, madame, et je ne connais pas les mots d'amour."
"Ich bin ein alter Soldat, gnädige Frau, und ich weiß nicht die Worte der Liebe."

__________________________________________________________________________________________________________________________________________________
(3.2GHz i5 Core Quad, 8GB RAM / 2 x nVidia GTX 550Ti SLI-bridged, 2GB VRAM)
(x86 Win XP Pro Russian Sp3/x86 Win Vista Ultimate Sp2/x64 Win 7 Ultimate Sp1/Wine in x64 elementaryOS Luna)
User avatar
Mike Lobanovsky
FBSL Administrator
FBSL Administrator
 
Posts: 1823
Joined: Tue Apr 19, 2005 8:22 am
Location: Republic of Belarus

Re: Gerome's FBSL Icon Changer

Unread postby GSAC3000 » Tue Oct 27, 2015 6:18 pm

Mike:

Thanks again for your very useful and informative reply to my query about ICON CHANGER.
I very muck like the structural changes you and the team have made (and are still making) to FBSL.
I am looking forward to your "WIP"

Don
GSAC3000
FBSL tiny seed
FBSL tiny seed
 
Posts: 15
Joined: Thu Oct 01, 2015 8:15 pm


Return to Help!

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron