legend

Read resource as a string?

16 posts in this topic

#1 ·  Posted (edited)

I'm trying to read a resource (file.txt), trying to figure it out by viewing this, but haven't found it out yet, any suggestions :)?

 

Edited by legend

Share this post


Link to post
Share on other sites



A resource is embeded in a dll or exe or other files, what are you trying with file.txt?


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

I want to read the content of the txt file (the txt file is added as a resource) but i don't want it to drop it to the disk

Share this post


Link to post
Share on other sites

Hi Legend,

Posting your wrapper directive line you are using to add the resource and the Findresource line you are referencing it with would assist those that try to help you ;)

Vlad

Share this post


Link to post
Share on other sites

I'm not using the wrapper, i'm using reshacker to add my resources :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Look at it from our perspective, without your reference code/line we don't know:

* whether you copied the code from that thread.

* Where in RT_RCDATA your text file resides

* Whether you are using the ansi or Unicode version of FindResource

* whether you decided to use FindResourceEx (ansi or unicode) when FindResource failed you

Y'know that sort of thing, aka help those you wish to help you ;)

Edited by Mobius
Phuggin auto correct

Share this post


Link to post
Share on other sites

Hi Mobius, thank's for your reply, this is what i'm trying to do : 

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\..\..\Program Files (x86)\AutoIt3\Icons\au3.ico
#AutoIt3Wrapper_Res_File_Add=text_1.txt, RT_RCDATA, TXT_1, 0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#Include <WinAPI.au3>
#include <Constants.au3>
Global Const $RT_RCDATA = 10

$Path = @ScriptFullPath
$Hlib = _WinAPI_LoadLibraryEx($Path, $LOAD_LIBRARY_AS_DATAFILE)
$Resource = DllCall('kernel32.dll', 'ptr', 'FindResourceA', 'ptr', $Hlib, 'int', 2, 'long', $RT_RCDATA)
MsgBox(0, '', _WinAPI_GetLastErrorMessage())

 

I'm unsure how i would go on about reading the resource : TXT_1

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Legend.au3

Hiya Legend hope the above is what you are after. :)

Edited by Mobius

Share this post


Link to post
Share on other sites

Hi Mobious, thank's for your help, it's very appreciated :).

But the message it returns is : 

http://prntscr.com/9wu4i1

Share this post


Link to post
Share on other sites

What is wrong with the Resources UDF?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I'm working on a autoit anti deobfuscator, for this purpose I need the shortest possible code for reading a resource as a string.

To make it compatible with any version of autoit.

If it have any interest, I can release it when it's ready

Edited by legend
1 person likes this

Share this post


Link to post
Share on other sites
44 minutes ago, legend said:

Hi didn'tous, thank's for your help, i t's very appreciated :).

But the message it returns is : 

http://prntscr.com/9wu4i1

Aw shucks Legolas too bad it it didn't work for you when you ported it to your code.

Heres what I posted already built and working fine with au3 3.3.14.2

Through AutoCamo obviously ;)

Legless.7z

Share this post


Link to post
Share on other sites

Never mind, my mistake, it works perfect :) Thank's a lot Mobius, I will show you my project when it's finished =)

Share this post


Link to post
Share on other sites
6 minutes ago, legend said:

Never mind, my mistake, it works perfect :) Thank's a lot Mobius, I will show you my project when it's finished =)

I would enjoy that thanks Legend.

Share this post


Link to post
Share on other sites
45 minutes ago, guinness said:

What is wrong with the Resources UDF?

Quite right, Legend here is the link to that should you need it for reference, works with old and new builds of AutoIt

Resources UDF

Share this post


Link to post
Share on other sites
1 hour ago, Mobius said:

Quite right, Legend here is the link to that should you need it for reference, works with old and new builds of AutoIt

Resources UDF

Not quite, it's broken on new versions. My doesn't though.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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