Spider001 Posted January 29, 2015 Share Posted January 29, 2015 (edited) Hey What is the max length from a string that i can use at IniWrite and iniRead? IniWrite ( "filename", "section", "key", "max length ?" ) Because that maybe the problem from here? I encrypt and write this to a ini file Thank you Will do more test to morrow Edited January 29, 2015 by Spider001 Link to comment Share on other sites More sharing options...
TheSaint Posted January 29, 2015 Share Posted January 29, 2015 (edited) If you are referring to this string 'OLse2YGrw0XUj6Jct9Kv4Ida7MPom5Ru1 ' Then that is well inside the acceptable length. In fact, that is quite short ... unless you are using an old version of Windows (i.e. 3.1 or 95). However, if you have both a leading and trailing quote, you will get errors, as they get stripped off ... a Windows' thing. One or the other is acceptable. There are other characters too, that screw up ini entries (i.e. square brackets, carriage return, etc) Edited January 29, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Spider001 Posted January 29, 2015 Author Share Posted January 29, 2015 That text is acceptebel but i write the encrypte string to the ini and read it to uncrypt Link to comment Share on other sites More sharing options...
kylomas Posted January 30, 2015 Share Posted January 30, 2015 Spider001, From Help file... MAX_STRINGLEN 2,147,483,647 Maximum string length. Post runnable reproducer for better help... kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 30, 2015 Moderators Share Posted January 30, 2015 Make sure what you're writing is in hex for you ini and not raw binary, any null char and it ends the string. Then convert the hex back to binary before decrypting. Are you running a 64 or 32 bit exe? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Spider001 Posted January 30, 2015 Author Share Posted January 30, 2015 (edited) on a 32bit xp no problem on 64 bit 8.1 problem and that's the problem password to encrypt 'OLse2YGrw0XUj6Jct9Kv4Ida7MPom5Ru1 ' key that's be saved at the ini 0x01000000D08C9DDF0115D1118C7A00C04FC297EB010000001886711E8F5CDD49A6C4DE2DCDB482500000000028000000300031002F00320037002F0032003000310035002000320031003A00310033003A00300038000000106600000001000020000000C0CF70165F353813BA14B9BF88FB4714EDB170E39202C848B5414473B237AAAB000000000E800000000200002000000016E5F2CACF72BABE1B385B2A49185C3BAC1B62099B2D542B4C40C63EC035CED6200000005D5E62316A90AFDF772FAC4F5010BEF9F65C884C264C20F10D41BF5D77C206DD40000000A7167816D2B655D8EA953D8A225FD97EC4DCB65DAB11D538A674DF97206091378E8B9FF7252B9136B2809101CCF770EBAFF67428623A5E291ABE70D4E6069A1C password after decrypt OLse2YGrw0XUj6Jct9Kv expandcollapse popup#include <CryptProtect.au3> #include <Date.au3> Func _unprotect($data) If $data <> '' Then Local $sDesc='',$iError2,$iExtended2 $data = _CryptUnprotectData($data, $sDesc) $iError2 = @error $iExtended2 = @extended If $iError2 > 0 Or $iExtended2 > 0 Then MsgBox(0,'error',"Error protecting: " & $iError2 & @LF & "Windows error protecting: " & $iExtended2) Exit EndIf Return $data Else Return '' EndIf EndFunc Func _protect($data) Local $iError1,$iExtended1 Local $tCur = _Date_Time_GetLocalTime() $tCur = _Date_Time_SystemTimeToDateTimeStr($tCur) $data = _CryptProtectData($data, $tCur) $iError1 = @error $iExtended1 = @extended If $iError1 > 0 Or $iExtended1 > 0 Then MsgBox(0,'error',"Error protecting: " & $iError1 & @LF & "Windows error protecting: " & $iExtended1) Exit EndIf Return $data EndFunc ConsoleWrite(@AutoItVersion & @CRLF) ConsoleWrite('OLse2YGrw0XUj6Jct9Kv4Ida7MPom5Ru1 ' & @CRLF) $data = _protect('OLse2YGrw0XUj6Jct9Kv4Ida7MPom5Ru1 ') IniWrite(@TempDir & "\Example.ini", "General", "Title", $data) ConsoleWrite($data & @CRLF) $data = _unprotect(IniRead(@TempDir & "\Example.ini", "General", "Title", "")) ConsoleWrite($data & @CRLF) Edited January 30, 2015 by Spider001 Link to comment Share on other sites More sharing options...
Moderators Solution SmOke_N Posted January 30, 2015 Moderators Solution Share Posted January 30, 2015 I wasn't asking what operating system. I was asking what you were compiling it at. I'm curious if the tags for the udf you're using were properly set for both. So... 1. On your 64bit machine, put this at the top of it (your script): #AutoIt3Wrapper_UseX64=N 2. As I said, you may need to convert back to binary... eg: _unprotect(Binary(IniRead(@TempDir & "\Example.ini", "General", "Title", ""))) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Spider001 Posted January 30, 2015 Author Share Posted January 30, 2015 (edited) i compile it to 64 bit exe for 64 bit os and 32bit exe for xp develop on 32bit i have always tryed on 64bit with 64 bit exe SmOke_N will try your solutions thanks for the help Edited January 30, 2015 by Spider001 Link to comment Share on other sites More sharing options...
Spider001 Posted January 30, 2015 Author Share Posted January 30, 2015 Binary() did it thank you 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