Ward
Active Members-
Posts
174 -
Joined
-
Last visited
-
Days Won
4
Ward last won the day on August 19 2020
Ward had the most liked content!
Profile Information
-
Location
Taiwan
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Ward's Achievements
Prodigy (4/7)
126
Reputation
-
fraizor reacted to a post in a topic: A Non-Strict JSON UDF (JSMN)
-
maniootek reacted to a post in a topic: A Non-Strict JSON UDF (JSMN)
-
TheSaint reacted to a post in a topic: A Non-Strict JSON UDF (JSMN)
-
mLipok reacted to a post in a topic: A Non-Strict JSON UDF (JSMN)
-
Zedna reacted to a post in a topic: Curl UDF - AutoIt binary code version of libcurl with SSL support
-
DinFuv reacted to a post in a topic: Web Screenshot
-
IgImAx reacted to a post in a topic: A Non-Strict JSON UDF (JSMN)
-
Leendert-Jan reacted to a post in a topic: A Non-Strict JSON UDF (JSMN)
-
mrdunghr reacted to a post in a topic: Advanced Encryption Standard (AES/Rijndael) UDF
-
Letraindusoir reacted to a post in a topic: A Non-Strict JSON UDF (JSMN)
-
Like Request for node.js or Requests for python, Request UDF is a powerful and easy-to-use HTTP client for AutoIt. It is based on my Curl.au3 and Json.au3 (not included). The Features: Request target can be a string (single url), an array (urls), an object (single url + options or url array + options), an object array (urls + different options), or a json string (decode to array or object automatically), etc.Easy to setup post data, cookies, agent, refer, timeout, proxy, etc.Easy to setup the default options before a series of requests.Use BinaryToString() to decode the returned data according to content type automatically. Use curl multi interface by default. It means all requests will transfer simultaneously and won't block the GUI event.Use callback function to recieve the data and information for every url before main function finished.Supports https and ftp protocols.Example: #Include "Json.au3" #Include "Curl.au3" #Include "Request.au3" RequestDefault('{refer: "http://www.autoitscript.com", agent: "AutoIt/Request", callback: "MyCallback"}') Local $Data = Request("http://httpbin.org/get") ConsoleWrite($Data & @LF) Request('["http://www.google.com", "http://wikipedia.org"]') Request('{url: "http://www.google.com", agent: "AutoIt/Request"}') Request('{url: ["http://www.google.com", "http://wikipedia.org"], agent: "AutoIt/Request"}') Local $Array[] = ["http://www.google.com", "http://wikipedia.org"] Request($Array) Request("http://httpbin.org/post", "key=Post%20can%20be%20the%20raw%20data") Request("http://httpbin.org/post", '{key: "Post can be a json object string"}') Request('{url: "http://httpbin.org/post", post:{key: "Post can be set as second paramemtr or \"post\" option"}}') Local $Obj Json_Put($Obj, ".key", "Post can be an object") Local $Json = Request("http://httpbin.org/post", $Obj) Func MyCallback($Obj) Local $Data = Json_ObjGet($Obj, "Data") Local $EffectiveUrl = Json_ObjGet($Obj, "EffectiveUrl") ConsoleWrite("Callback: " & $EffectiveUrl & " download size: " & StringLen($Data) & @LF) EndFunc More examples are in the archive. Request.zip
-
Curl UDF - AutoIt binary code version of libcurl with SSL support
Ward replied to Ward's topic in AutoIt Example Scripts
The last BinaryCall.au3 UDF can work with MemoryDll.au3. The related function will be called only if MemoryDll.au3 is included. It is checked inside BinaryCall.au3 by following line: Static $HasMemoryDll = IsFunc(Execute('__MemoryModule_RuntimeLoader'))For this Curl UDF. Both old and newer version of BinaryCall.au3 are worked. -
Ward reacted to a post in a topic: Curl UDF - AutoIt binary code version of libcurl with SSL support
-
Curl UDF - AutoIt binary code version of libcurl with SSL support
Ward replied to Ward's topic in AutoIt Example Scripts
You found a bug in one second.... excellent! -
I built my own libcurl for AutoIt based on BinaryCall UDF. libcurl - the multiprotocol file transfer library The Features: Pure AutoIt script, no DLLs needed.Build with SSL/TLS and zlib support (without libidn, libiconv, libssh2).Full easy-interface and partial multi-interface support.Data can read from or write to autoit variables or files.Smaller code size (compare to most libcurl DLL).The version information of this build: Curl Version: libcurl/7.42.1SSL Version: mbedTLS/1.3.10Libz Version: 1.2.8Protocols: ftp,ftps,http,httpsHere are the helper functions (not include in libcurl library). Curl_DataWriteCallback()Curl_DataReadCallback()Curl_FileWriteCallback()Curl_FileReadCallback()Curl_Data_Put()Curl_Data_Get()Curl_Data_Cleanup()See the example script for detail usage. Curl.zip
-
Thanks JohnOne, It seems I pressed some hotkey that swapped these two lines by accident.
-
Oh, this scrip crash on v3.3.12.0, because I still use v3.3.10.2... I fixed it. The problem is in the newer Array.au3 UDF. It did "concatenate" rather than "add" in _ArrayAdd(). (WTF...)
-
#Include "Json.au3" Local $Json = '{ "Headers":[ { "Name":"LOGICAL_NAME","Type":"VARCHAR2"}],"ColumnCount":1,"Rows":[ { "Cells":[ "ThisIsWhatIWant"],"CellCount":1}]}' Local $Obj = Json_Decode($Json) ConsoleWrite(Json_Get($Obj, '["Rows"][0]["Cells"][0]') & @LF) ConsoleWrite(Json_Get($Obj, '.Rows[0].Cells[0]') & @LF) ConsoleWrite(Json_Encode($Obj, $JSON_PRETTY_PRINT) & @LF)
-
I am trying to serialize all the autoit variable by >msgpack, so that I can used it in ZeroRPC (language-agnostic remote procedure call over internet). Int, string, binary are easy, but DllStruct is not. Before variable serialization become build-in function (I hope so), I have to find out my own way. Here is my attempt to guess the setup string. I am not sure did I deal with all the align and struct/endstruct correctly, please let me know if there is any bug. The output may not be the same with the original string, it is not bug. Test() Func Test() Local $Struct $Struct = DllStructCreate("align 2;byte;ptr[2]") ConsoleWrite(DLLStructAnalyze($Struct) & @LF) ; Output: byte;align 2;ptr[2] $Struct = DllStructCreate("int;struct;struct;uint64;uint;byte[5];endstruct;byte;endstruct;byte") ConsoleWrite(DLLStructAnalyze($Struct) & @LF) ; Output: int;struct;struct;uint64;uint;byte[5];endstruct;byte;endstruct;byte $Struct = DllStructCreate("int;uint64;struct;struct;uint;byte[5];endstruct;byte;endstruct;byte") ConsoleWrite(DLLStructAnalyze($Struct) & @LF) ; Output: int;uint64;struct;struct;uint;byte[5];endstruct;byte;endstruct;byte EndFunc
-
I am a perfectionist, too. Here is my suggestion: 1. To deal with string char by char, don't forget use StringToASCIIArray()/StringFromASCIIArray(). String concatenation in script language is slow. (SmOke_N's example did it well.) 2. Conditional statements should be avoid in loop. We can use map instead in this case. My version: Func Rot47($String) Static $Map[127] If Not $Map[33] Then For $i = 33 To 79 $Map[$i] = $i + 47 Next For $i = 80 To 126 $Map[$i] = $i - 47 Next EndIf Local $Array = StringToASCIIArray($String) For $i = 0 To UBound($Array) - 1 If $Array[$i] >= 33 And $Array[$i] <= 126 Then $Array[$i] = $Map[$Array[$i]] EndIf Next Return StringFromASCIIArray($Array) EndFunc
-
Embed DLLs in script and call functions from memory (MemoryDll UDF)
Ward replied to Ward's topic in AutoIt Example Scripts
2015/01/08 Update Note: * Update the machine code version. Both x86 and x64 DLL are supported. * TLS callback are supported. * Remove all MemoryFuncXXX() related functions. Use build-in DllCallAddress instead. * Add MemoryDllLoadString(), MemoryDllLoadResource() * Add _WinAPI_MemoryFindResource(), _WinAPI_MemoryFindResourceEx(), _WinAPI_MemorySizeOfResource(), _WinAPI_MemoryLoadResource(), _WinAPI_MemoryLoadString(), _WinAPI_MemoryLoadStringEx() * Using BinaryCall.au3 to loading the machine code. -
== Update 2015/01/08 == * Rename the library from jsmn.au3 to json.au3. All function names are changed, too. * Add Json_Put() and Json_Get() * Add Null support * Using BinaryCall.au3 to loading the machine code.
-
Introduction "MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller." (by http://msgpack.org/). There are already so many languages support MessagePack format, here comes AutoIt version. The backend coder is Charlie Gunyon's cmp. It supported MessagePack proposal v5. This UDF only have two public functions: MsgPack_Pack() and MsgPack_Unpack(). It just like Json_Enocde() and Json_Decode() in my ?do=embed' frameborder='0' data-embedContent>>JSON UDF. The Map type will be decoded into "Windows Scripting Dictionary Object" retuned from ObjCreate("Scripting.Dictionary"). So I suggest using Json.au3 to deal with the Map/Object data type. The main difference is MessagePack support Binary format, but Json not. For example (?do=embed' frameborder='0' data-embedContent>>Json.au3 is required to run this example): Local $Obj1 Json_Put($Obj1, ".binary", Binary("0x00")) Json_Put($Obj1, ".string", "abc") Json_Put($Obj1, ".int", Random(0, 1000, 1)) Json_Put($Obj1, ".float", Random()) Json_Put($Obj1, ".bool", True) Json_Put($Obj1, ".null", Null) Local $Binary = MsgPack_Pack($Obj1) Local $Obj2 = MsgPack_Unpack($Binary) ConsoleWrite("Test2 $Obj1.binary is " & VarGetType(Json_Get($Obj2, ".binary")) & @LF) ; "Binary" In my opinion, for human readable data storing or exchanging, of course choose Json. Otherwise, especially to exchange data on the internet, MessagePack may be a better choice. MsgPack.zip
- 3 replies
-
- messagepack
- msgpack
-
(and 1 more)
Tagged with:
-
BinaryCall UDF - Write Subroutines In C, Call In AutoIt
Ward replied to Ward's topic in AutoIt Example Scripts
You cannot call it. Your asm code is for DOS, not for Windows. If you want to learn win32 assembly, here are some tutorials. http://win32assembly.programminghorizon.com/tutorials.html.- 33 replies
-
- binary
- machine code
-
(and 1 more)
Tagged with:
-
BinaryCall UDF - Write Subroutines In C, Call In AutoIt
Ward replied to Ward's topic in AutoIt Example Scripts
I modified your script: #include "BinaryCall.au3" ConsoleWrite(test() & @CRLF) Func test() If Not @AutoItX64 Then Local $Code = 'AwAAAAQnAAAAAAAAAAAzmhZYCCq3cDHR36UPpp3jHwcI4LQK5/Vy+rj0A5jEJ0o0wUSVsMAA' Local $Reloc = 'AwAAAAQEAAAAAAAAAAABAAG+jCcAAA==' Local $Symbol[] = ["getString"] Local $CodeBase = _BinaryCall_Create($Code, $Reloc) If @error Then Exit Local $SymbolList = _BinaryCall_SymbolList($CodeBase, $Symbol) If @error Then Exit EndIf Local $Ret = DllCallAddress("str:cdecl", DllStructGetData($SymbolList, "getString")) Return $Ret[0] EndFunc ;==>test- 33 replies
-
- binary
- machine code
-
(and 1 more)
Tagged with:
-
BinaryCall UDF - Write Subroutines In C, Call In AutoIt
Ward replied to Ward's topic in AutoIt Example Scripts
Can you tell me your GCC/MinGW version and your compile options? Ps. On my test, only use 32-bit MinGW/g++ without -O/-O2/-Os will generate .uleb128 pseudo-op. Maybe you can add -Os option to get rid of this problem. Here is my result: MinGW 32-bit gcc (GCC) 4.8.1 gcc -S -Os -masm=intel TCPConnect.c .file "TCPConnect.c" .intel_syntax noprefix .text .globl _TCPConnect .def _TCPConnect; .scl 2; .type 32; .endef _TCPConnect: LFB16: .cfi_startproc push ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 xor eax, eax mov ebp, esp .cfi_def_cfa_register 5 mov ecx, 8 push edi push esi lea edx, [ebp-56] push ebx .cfi_offset 7, -12 .cfi_offset 6, -16 .cfi_offset 3, -20 mov edi, edx sub esp, 76 rep stosd lea eax, [ebp-64] mov DWORD PTR [esp+12], eax mov eax, DWORD PTR [ebp+12] mov DWORD PTR [esp+8], edx mov DWORD PTR [ebp-64], 0 mov DWORD PTR [ebp-52], 2 mov DWORD PTR [esp+4], eax mov eax, DWORD PTR [ebp+8] mov DWORD PTR [ebp-48], 1 mov DWORD PTR [ebp-44], 6 mov DWORD PTR [esp], eax call _getaddrinfo@16 sub esp, 16 test eax, eax mov ebx, eax je L2 L6: xor ebx, ebx jmp L3 L2: mov eax, DWORD PTR [ebp-64] mov edx, DWORD PTR [eax+12] mov DWORD PTR [esp+8], edx mov edx, DWORD PTR [eax+8] mov DWORD PTR [esp+4], edx mov eax, DWORD PTR [eax+4] mov DWORD PTR [esp], eax call _socket@12 sub esp, 12 cmp eax, -1 mov esi, eax mov eax, DWORD PTR [ebp-64] jne L4 mov DWORD PTR [esp], eax jmp L8 L4: mov edx, DWORD PTR [eax+16] mov DWORD PTR [esp+8], edx mov eax, DWORD PTR [eax+24] mov DWORD PTR [esp], esi mov DWORD PTR [esp+4], eax call _connect@12 sub esp, 12 test eax, eax mov eax, DWORD PTR [ebp-64] mov DWORD PTR [esp], eax je L5 L8: call _freeaddrinfo@4 push edx jmp L3 L5: call _freeaddrinfo@4 mov DWORD PTR [ebp-60], 1 push eax lea eax, [ebp-60] mov DWORD PTR [esp+8], eax mov DWORD PTR [esp+4], -2147195266 mov DWORD PTR [esp], esi call _ioctlsocket@12 sub esp, 12 test eax, eax jne L6 mov ebx, esi L3: lea esp, [ebp-12] mov eax, ebx pop ebx .cfi_restore 3 pop esi .cfi_restore 6 pop edi .cfi_restore 7 pop ebp .cfi_restore 5 .cfi_def_cfa 4, 4 ret .cfi_endproc LFE16: .ident "GCC: (GNU) 4.8.1" .def _getaddrinfo@16; .scl 2; .type 32; .endef .def _socket@12; .scl 2; .type 32; .endef .def _connect@12; .scl 2; .type 32; .endef .def _freeaddrinfo@4; .scl 2; .type 32; .endef .def _ioctlsocket@12; .scl 2; .type 32; .endef MinGW-w64 64-bit gcc (GCC) 4.9.1 gcc -S -Os -m32 -masm=intel TCPConnect.c .file "TCPConnect.c" .intel_syntax noprefix .section .text.unlikely,"x" LCOLDB0: .text LHOTB0: .globl _TCPConnect .def _TCPConnect; .scl 2; .type 32; .endef _TCPConnect: push ebp xor eax, eax mov ecx, 8 mov ebp, esp push edi push esi lea edx, [ebp-56] push ebx mov edi, edx sub esp, 76 mov DWORD PTR [ebp-64], 0 rep stosd lea eax, [ebp-64] mov DWORD PTR [ebp-52], 2 mov DWORD PTR [ebp-48], 1 mov DWORD PTR [ebp-44], 6 mov DWORD PTR [esp+8], edx mov DWORD PTR [esp+12], eax mov eax, DWORD PTR [ebp+12] mov DWORD PTR [esp+4], eax mov eax, DWORD PTR [ebp+8] mov DWORD PTR [esp], eax call [DWORD PTR __imp__getaddrinfo@16] sub esp, 16 test eax, eax mov ebx, eax je L2 L6: xor ebx, ebx jmp L3 L2: mov eax, DWORD PTR [ebp-64] mov edx, DWORD PTR [eax+12] mov DWORD PTR [esp+8], edx mov edx, DWORD PTR [eax+8] mov DWORD PTR [esp+4], edx mov eax, DWORD PTR [eax+4] mov DWORD PTR [esp], eax call [DWORD PTR __imp__socket@12] sub esp, 12 cmp eax, -1 mov esi, eax mov edi, DWORD PTR __imp__freeaddrinfo@4 mov eax, DWORD PTR [ebp-64] jne L4 mov DWORD PTR [esp], eax jmp L8 L4: mov edx, DWORD PTR [eax+16] mov DWORD PTR [esp+8], edx mov eax, DWORD PTR [eax+24] mov DWORD PTR [esp], esi mov DWORD PTR [esp+4], eax call [DWORD PTR __imp__connect@12] sub esp, 12 test eax, eax mov eax, DWORD PTR [ebp-64] mov DWORD PTR [esp], eax je L5 L8: call edi push edx jmp L3 L5: call edi push eax lea eax, [ebp-60] mov DWORD PTR [ebp-60], 1 mov DWORD PTR [esp+8], eax mov DWORD PTR [esp+4], -2147195266 mov DWORD PTR [esp], esi call [DWORD PTR __imp__ioctlsocket@12] sub esp, 12 test eax, eax jne L6 mov ebx, esi L3: lea esp, [ebp-12] mov eax, ebx pop ebx pop esi pop edi pop ebp ret .section .text.unlikely,"x" LCOLDE0: .text LHOTE0: .ident "GCC: (GNU) 4.9.1 20140624 (prerelease)"- 33 replies
-
- binary
- machine code
-
(and 1 more)
Tagged with: