Jump to content

Recommended Posts

Posted

@trancexx:

Sorry to dissappoint you, I got lost trying to understand it (...after hours). I think I will go back to my old procedure of building a header .au3 with a hard coded array matching the order of the resources in my .rc file. I did do some research and maybe even got a better understanding of pointers, but this, as I said, goes over my head.

Cheers.

Ivan

  • 4 weeks later...
  • 2 years later...
Posted (edited)

Hi,

I know this is an old topic but I find this script very useful but I have a problem.

I made a Dll file with some image but I would to add also version info, I try RT_Manifest and it works in dll but non in Windows property. So I find RT_Version but it is impossible to add with original script so I modified the script but without success, after insertion I don't see my data like normal dll but oriental character.

Can someone help me?

Edited by Saiph
Posted

Error report:

C:UsersXXXAppDataLocalTempRar$DIa0.992ResourcesViewerAndCompiler.au3 (7432) : ==> Array variable subscript badly formatted.:
ReDim $hTreeViewExp[$iNumberOfExporedFunctions]
ReDim $hTreeViewExp[^ ERROR
  • 7 months later...
Posted

Sorry to resurrect.

trancexx, what an immense project! I appreciate the work you threw on this.

I'm working on one of my projects with the Resources UDF, but I can't figure out how to parse an RT_STRING table. It seems you did something in your code that parses the data, but I can't decipher it. What am I doing wrong?

Regards,

cb

_ArrayConcatenate2D · Aero Flip 3D · EPOCH (destroy timestamps) · File Properties Modifier · _GetFileType · UpdateEngine<new> · In-line Case (_ICase) <new>

[hr]

50% of the time, it works all the time. -PezoFaSho

Posted

I'm working on one of my projects with the Resources UDF, but I can't figure out how to parse an RT_STRING table.

 

You could also take a look at the AutoIt3Wrapper source. I added RT_STRING capability to the resource functions a good while back.

Posted (edited)

Oh! I didn't think of that.  :o

Maybe I wasn't clear... I'm successful in using the wrapper to get the .ini into my project as a RT_STRING table, but I can't figure out how to read it back into a readable structure. It doesn't have to be elegant, but dumping to an array would be nice.  ^_^

cb

Edit: Clarity.

Edited by cyberbit

_ArrayConcatenate2D · Aero Flip 3D · EPOCH (destroy timestamps) · File Properties Modifier · _GetFileType · UpdateEngine<new> · In-line Case (_ICase) <new>

[hr]

50% of the time, it works all the time. -PezoFaSho

Posted

^^ There is nothing spectacular about RT_STRING resource. The only thing to remember is that strings always come packed as 16 of them. Try something like this:

#include <Array.au3>

; Read your resource as raw. You'll get something like this...
$bRT_STRING = "0x0000000000000000000009002800500061007500730065006400290020000C004100750074006F004900740020004500720072006F007200B9014100750074006F004900740020006800610073002000640065007400650063007400650064002000740068006500200073007400610063006B00200068006100730020006200650063006F006D006500200063006F00720072007500700074002E000A000A0053007400610063006B00200063006F007200720075007000740069006F006E0020007400790070006900630061006C006C00790020006F006300630075007200730020007700680065006E00200065006900740068006500720020007400680065002000770072006F006E0067002000630061006C006C0069006E006700200063006F006E00760065006E00740069006F006E002000690073002000750073006500640020006F00720020007700680065006E0020007400680065002000660075006E006300740069006F006E002000690073002000630061006C006C00650064002000770069007400680020007400680065002000770072006F006E00670020006E0075006D0062006500720020006F006600200061007200670075006D0065006E00740073002E000A000A004100750074006F0049007400200073007500700070006F00720074007300200074006800650020005F005F00730074006400630061006C006C0020002800570049004E004100500049002900200061006E00640020005F005F0063006400650063006C002000630061006C006C0069006E006700200063006F006E00760065006E00740069006F006E0073002E002000200054006800650020005F005F00730074006400630061006C006C0020002800570049004E004100500049002900200063006F006E00760065006E00740069006F006E00200069007300200075007300650064002000620079002000640065006600610075006C007400200062007500740020005F005F0063006400650063006C002000630061006E0020006200650020007500730065006400200069006E00730074006500610064002E00200020005300650065002000740068006500200044006C006C00430061006C006C0028002900200064006F00630075006D0065006E0074006100740069006F006E00200066006F0072002000640065007400610069006C00730020006F006E0020006300680061006E00670069006E00670020007400680065002000630061006C006C0069006E006700200063006F006E00760065006E00740069006F006E002E001900220045006E0064005700690074006800220020006D0069007300730069006E00670020002200570069007400680022002E0021004200610064006C007900200066006F0072006D006100740074006500640020002200460075006E00630022002000730074006100740065006D0065006E0074002E00190022005700690074006800220020006D0069007300730069006E0067002000220045006E006400570069007400680022002E0028004D0069007300730069006E006700200072006900670068007400200062007200610063006B00650074002000270029002700200069006E002000650078007000720065007300730069006F006E002E001F004D0069007300730069006E00670020006F00700065007200610074006F007200200069006E002000650078007000720065007300730069006F006E002E00220055006E00620061006C0061006E00630065006400200062007200610063006B00650074007300200069006E002000650078007000720065007300730069006F006E002E0014004500720072006F007200200069006E002000650078007000720065007300730069006F006E002E001C004500720072006F0072002000700061007200730069006E0067002000660075006E006300740069006F006E002000630061006C006C002E00"

; Convert to array
$aArray = RT_STRING_ToArray($bRT_STRING)

; Display it
_ArrayDisplay($aArray)


Func RT_STRING_ToArray($bBinary)
    Local $iOffset = 1
    Local $sData
    Local $iLen
    For $i = 1 To 16 ; There is always 16 strings packed together
        $iLen = 2 * LittleEndianToInt(BinaryMid($bBinary, $iOffset, 2))
        If $iLen = 0 Then
            $iOffset += 2
            ContinueLoop
        EndIf
        ; I'll replace some characters to get one-liners for nicer display
        $sData &= StringReplace(StringReplace(StringReplace(BinaryToString(BinaryMid($bBinary, $iOffset + 2, $iLen), 2), @LF, "\n"), @CR, "\r"), Chr(0), "\0") & @LF
        $iOffset += $iLen + 2
    Next
    Return StringSplit(StringTrimRight($sData, 1), @LF, 3)
EndFunc

; A little helper function
Func LittleEndianToInt($iVal)
    Local $tUINT64 = DllStructCreate("uint64")
    DllStructSetData($tUINT64, 1, $iVal)
    Return DllStructGetData($tUINT64, 1)
EndFunc
Posted

Does he mean FindResource / LoadResource / LockResource? Or does he really mean to read back the binary data, in which case he'll have to parse the PE header?

Posted

Does he mean FindResource / LoadResource / LockResource? Or does he really mean to read back the binary data, in which case he'll have to parse the PE header?

My understanding is that he doesn't have problems locking the string resource, one way or the other. He has issues parsing locked data.

I could be wrong though.

  • 1 year later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...