GoravG Posted May 2, 2015 Share Posted May 2, 2015 (edited) I am create script with get Func to resource section but erroranyone help me.my script..expandcollapse popup#AutoIt3Wrapper_Res_File_Add=Code.txt, rt_rcdata, Func_Code Global Const $mb_systemmodal = 4096 Global Const $hgdi_error = Ptr(-1) Global Const $invalid_handle_value = Ptr(-1) Global Const $kf_extended = 256 Global Const $kf_altdown = 8192 Global Const $kf_up = 32768 Global Const $llkhf_extended = BitShift($kf_extended, 8) Global Const $llkhf_altdown = BitShift($kf_altdown, 8) Global Const $llkhf_up = BitShift($kf_up, 8) Global Const $load_library_as_datafile = 2 Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct" Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs" Global Const $tagrebarbandinfo = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagrect & ";uint uChevronState") Func _winapi_freelibrary($hmodule) Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_getmodulehandle($smodulename) Local $smodulenametype = "wstr" If $smodulename = "" Then $smodulename = 0 $smodulenametype = "ptr" EndIf Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload) Local $aresult, $simagetype = "int" If IsString($simage) Then $simagetype = "wstr" $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_loadlibraryex($sfilename, $iflags = 0) Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Global Const $tagosversioninfo = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct" Global Const $__winver = __winver() Func __winver() Local $tosvi = DllStructCreate($tagosversioninfo) DllStructSetData($tosvi, 1, DllStructGetSize($tosvi)) Local $ret = DllCall("kernel32.dll", "bool", "GetVersionExW", "struct*", $tosvi) If @error OR NOT $ret[0] Then Return SetError(@error, @extended, 0) Return BitOR(BitShift(DllStructGetData($tosvi, 2), -8), DllStructGetData($tosvi, 3)) EndFunc Global $ghgdipdll = 0 Global $gigdipref = 0 Global $gigdiptoken = 0 Global $gbgdip_v1_0 = True Func _gdiplus_startup($sgdipdll = Default) $gigdipref += 1 If $gigdipref > 1 Then Return True If $sgdipdll = Default Then If @OSBuild > 4999 AND @OSBuild < 7600 Then $sgdipdll = @WindowsDir & "\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6000.16386_none_8df21b8362744ace\gdiplus.dll" Else $sgdipdll = "gdiplus.dll" EndIf EndIf $ghgdipdll = DllOpen($sgdipdll) If $ghgdipdll = -1 Then $gigdipref = 0 Return SetError(1, 2, False) EndIf Local $sver = FileGetVersion($sgdipdll) $sver = StringSplit($sver, ".") If $sver[1] > 5 Then $gbgdip_v1_0 = False Local $tinput = DllStructCreate($taggdipstartupinput) Local $ttoken = DllStructCreate("ulong_ptr Data") DllStructSetData($tinput, "Version", 1) Local $aresult = DllCall($ghgdipdll, "int", "GdiplusStartup", "struct*", $ttoken, "struct*", $tinput, "ptr", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) $gigdiptoken = DllStructGetData($ttoken, "Data") Return True EndFunc _gdiplus_startup() Global Const $rt_bitmap = 2 Func _resourceget($resname, $restype = 10, $reslang = 0, $dll = -1) Local Const $image_bitmap = 0 Local $hinstance, $hbitmap, $infoblock, $globalmemoryblock, $memorypointer, $ressize If $dll = -1 Then $hinstance = _winapi_getmodulehandle("") Else $hinstance = _winapi_loadlibraryex($dll, $load_library_as_datafile) EndIf If $hinstance = 0 Then Return SetError(1, 0, 0) If $restype = $rt_bitmap Then $hbitmap = _winapi_loadimage($hinstance, $resname, $image_bitmap, 0, 0, 0) If @error Then Return SetError(2, 0, 0) Return $hbitmap EndIf If $reslang <> 0 Then $infoblock = DllCall("kernel32.dll", "ptr", "FindResourceExW", "ptr", $hinstance, "long", $restype, "wstr", $resname, "short", $reslang) Else $infoblock = DllCall("kernel32.dll", "ptr", "FindResourceW", "ptr", $hinstance, "wstr", $resname, "long", $restype) EndIf If @error Then Return SetError(3, 0, 0) $infoblock = $infoblock[0] If $infoblock = 0 Then Return SetError(4, 0, 0) $ressize = DllCall("kernel32.dll", "dword", "SizeofResource", "ptr", $hinstance, "ptr", $infoblock) If @error Then Return SetError(5, 0, 0) $ressize = $ressize[0] If $ressize = 0 Then Return SetError(6, 0, 0) $globalmemoryblock = DllCall("kernel32.dll", "ptr", "LoadResource", "ptr", $hinstance, "ptr", $infoblock) If @error Then Return SetError(7, 0, 0) $globalmemoryblock = $globalmemoryblock[0] If $globalmemoryblock = 0 Then Return SetError(8, 0, 0) $memorypointer = DllCall("kernel32.dll", "ptr", "LockResource", "ptr", $globalmemoryblock) If @error Then Return SetError(9, 0, 0) $memorypointer = $memorypointer[0] If $memorypointer = 0 Then Return SetError(10, 0, 0) If $dll <> -1 Then _winapi_freelibrary($hinstance) If @error Then Return SetError(11, 0, 0) SetExtended($ressize) Return $memorypointer EndFunc Func _resourcegetasstring($resname, $restype = 10, $reslang = 0, $dll = -1) Local $respointer, $ressize, $struct $respointer = _resourceget($resname, $restype, $reslang, $dll) If @error Then SetError(1, 0, 0) Return "" EndIf $ressize = @extended $struct = DllStructCreate("char[" & $ressize & "]", $respointer) Return DllStructGetData($struct, 1) EndFunc $FR = _resourcegetasstring("Func_Code") MsgBox($mb_systemmodal, "", $FR("476F6F6420427965")) Code.txt Edited May 2, 2015 by GoravG I am new, i am not programmer..... Sorry my bad English...... Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2015 Developers Share Posted May 2, 2015 You have 2 closing brackets in this statement:$FR = _resourcegetasstring("Func_Code"))Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
GoravG Posted May 2, 2015 Author Share Posted May 2, 2015 josreplace$FR = _resourcegetasstring("Func_Code"))$FR = _resourcegetasstring("Func_Code")but show Error: Variable cannot be accessed in this manner. I am new, i am not programmer..... Sorry my bad English...... Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2015 Developers Share Posted May 2, 2015 What is this portion of code supposed to do?$FR = _resourcegetasstring("Func_Code") MsgBox($mb_systemmodal, "", $FR("476F6F6420427965"))Shouldn't that be something like:$FR = _resourcegetasstring("476F6F6420427965") MsgBox($mb_systemmodal, "", $FR)Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
GoravG Posted May 2, 2015 Author Share Posted May 2, 2015 Code.txt textFunc _hextostring($shex) If NOT (StringLeft($shex, 2) == "0x") Then $shex = "0x" & $shex Return BinaryToString($shex) EndFuncmy script$FR = _resourcegetasstring("Func_Code") ;Get Resource data Func_Code Section MsgBox($mb_systemmodal, "", $FR("476F6F6420427965")) ;this is hex codestring code:MsgBox($mb_systemmodal, "", $FR("Good Bye"))no get func_Codei m very confused I am new, i am not programmer..... Sorry my bad English...... Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2015 Developers Share Posted May 2, 2015 Not sure I understand what you are trying to tell me.Do you need to convert the returned information in $FR from Hex to String like this? :MsgBox($mb_systemmodal, "", _hextostring($FR))Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
GoravG Posted May 2, 2015 Author Share Posted May 2, 2015 this is not right !MsgBox($mb_systemmodal, "", _hextostring($FR))I m trying to read compile exe with add code.txt to resource data (func_Code section)without add au3 script file _hextostring I am new, i am not programmer..... Sorry my bad English...... Link to comment Share on other sites More sharing options...
guinness Posted May 2, 2015 Share Posted May 2, 2015 Have you checked out ResourcesEx in my signature? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2015 Developers Share Posted May 2, 2015 this is not right !without add au3 script file _hextostringI am still lost what it is you want to do so will stop the guessing game.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Mobius Posted May 2, 2015 Share Posted May 2, 2015 (edited) The OP is attempting to use the variable $FR (which contains the _hextostring function source retrieved from the resources) as some kind of prototype of _hextostring, and is attempting to pass it a parameter here: MsgBox($mb_systemmodal, "", $FR("476F6F6420427965")) ;this is hex codeSo thinking that at runtime $FR("476F6F6420427965")will be replaced withGood Byeas returned by the function In $FR.Apart from the obvious attempting to declare and use a function within the parameter of a function. Edited May 2, 2015 by Mobius Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now