Code: Select all
class mcode{ ;v1.1 by vvhitevvizard
;0x8000=MEM_RELEASE
static __Delete:=(this)=>DllCall("VirtualFree", 'ptr',this.c, 'uint',0, 'uint',0x8000)
__New(_s){
;allocates the virtual addr space of the calling process and changes its protection
;If 1st arg=0, 1=size (1 byte for mcodes <4096) is rounded up to the next page boundary
;Memory allocated is auto-initialized to zero
;0x3000=MEM_COMMIT | MEM_RESERVE, 0x40=PAGE_EXECUTE_READWRITE
c:=this.c:=DllCall("VirtualAlloc", 'ptr',0, 'uint',1, 'uint',0x3000, 'uint',0x40, "PTR")
;0=zero terminated, 1=Base64 w/o hdr, n (out) contains the mcode's binary size
DllCall("crypt32\CryptStringToBinary", 'str',_s, 'uint',0, 'uint',1, 'ptr',c
, 'uintp',n:=4096, 'ptr',0, 'ptr',0)
|| (this.__Delete(),this.c:=0) ;cleanup on decrypt FAIL
this.a:=(c+n+15)&~15 ;addr of binary struct for passed args aligned at 16
}
}
; Test runs
f:=new mcode("SMfA8P///0iLFSIAAABmD+/Ag8AQZg86YwQCCXX00egByMM=")
fc:=f.c, fa:=f.a
j := "
(
{"btc_usd":[{"type":"bid","price":3665,"amount":0.00014128,"tid":202998772,"timestamp":1544493122},{"type":"bid","price":3665,"amount":0.00294042,"tid":202998771,"timestamp":1544493122},{"type":"bid","price":3665,"amount":0.04279948,"tid":202998770,"timestamp":1544493121},{"type":"bid","price":3665,"amount":0.04640327,"tid":202998769,"timestamp":1544493121},{"type":"ask","price":3637.87502918,"amount":1.75254844,"tid":202998768,"timestamp":1544493100},{"type":"ask","price":3637.92,"amount":0.149,"tid":202998767,"timestamp":1544493100},{"type":"ask","price":3642.50714621,"amount":0.00060024,"tid":202998766,"timestamp":1544493100},{"type":"ask","price":3650.93027999,"amount":0.05840623,"tid":202998765,"timestamp":1544493099},{"type":"ask","price":3650.93028006,"amount":0.00273123,"tid":202998764,"timestamp":1544493099},{"type":"ask","price":3657.13568897,"amount":0.00056937,"tid":202998763,"timestamp":1544493098},{"type":"ask","price":3665,"amount":0.02723055,"tid":202998762,"timestamp":1544493098},{"type":"ask","price":3665.00000007,"amount":0.00633775,"tid":202998761,"timestamp":1544493098},{"type":"ask","price":3665.00000013,"amount":0.00257619,"tid":202998760,"timestamp":1544493098},{"type":"ask","price":3665.00000013,"amount":0.00021197,"tid":202998759,"timestamp":1544492992},{"type":"ask","price":3665.00000013,"amount":0.00098846,"tid":202998758,"timestamp":1544492992},{"type":"bid","price":3675.24052302,"amount":0.00132475,"tid":202998757,"timestamp":1544492846},{"type":"bid","price":3675.24052302,"amount":0.00407338,"tid":202998756,"timestamp":1544492846},{"type":"ask","price":3665.00000013,"amount":0.0007,"tid":202998755,"timestamp":1544492686},{"type":"ask","price":3665.00000013,"amount":0.00069381,"tid":202998754,"timestamp":1544492674},{"type":"bid","price":3677.36117543,"amount":0.06463023,"tid":202998753,"timestamp":1544492380},{"type":"bid","price":3673.32533308,"amount":0.00800481,"tid":202998752,"timestamp":1544492009},{"type":"ask","price":3650.93028006,"amount":0.0001,"tid":202998751,"timestamp":1544491811},{"type":"bid","price":3688.79999997,"amount":0.00688347,"tid":202998750,"timestamp":1544491724},{"type":"bid","price":3680.19613712,"amount":0.00000001,"tid":202998749,"timestamp":1544491724},{"type":"bid","price":3680.19613712,"amount":0.0009523,"tid":202998748,"timestamp":1544491690},{"type":"bid","price":3675.68497832,"amount":0.00000001,"tid":202998747,"timestamp":1544491690},{"type":"bid","price":3675.68497832,"amount":0.00010049,"tid":202998746,"timestamp":1544491660},{"type":"bid","price":3665.53400112,"amount":0.00001139,"tid":202998745,"timestamp":1544491660},{"type":"bid","price":3665.53400112,"amount":0.00037376,"tid":202998744,"timestamp":1544491636},{"type":"bid","price":3665.53400112,"amount":0.00043741,"tid":202998743,"timestamp":1544491636},{"type":"bid","price":3665.53400112,"amount":0.0000844,"tid":202998742,"timestamp":1544491636},{"type":"bid","price":3660.1,"amount":0.02539622,"tid":202998741,"timestamp":1544491636},{"type":"ask","price":3650.93028006,"amount":0.00074665,"tid":202998740,"timestamp":1544491368},{"type":"bid","price":3660.1,"amount":0.00082741,"tid":202998739,"timestamp":1544491259},{"type":"bid","price":3660.1,"amount":0.00084668,"tid":202998738,"timestamp":1544491258},{"type":"bid","price":3660.1,"amount":0.07292969,"tid":202998737,"timestamp":1544491257},{"type":"bid","price":3659.87515384,"amount":0.0015812,"tid":202998736,"timestamp":1544491257},{"type":"bid","price":3659.87515384,"amount":0.00022053,"tid":202998735,"timestamp":1544491087},{"type":"bid","price":3650.93028,"amount":0.00022332,"tid":202998734,"timestamp":1544491075},{"type":"bid","price":3650.93027999,"amount":0.00190633,"tid":202998733,"timestamp":1544491011},{"type":"bid","price":3650.93027999,"amount":0.00040973,"tid":202998732,"timestamp":1544490870},{"type":"bid","price":3650.93028,"amount":0.000191,"tid":202998731,"timestamp":1544490525},{"type":"bid","price":3650.93028,"amount":0.00019024,"tid":202998730,"timestamp":1544490408},{"type":"bid","price":3650.93028,"amount":0.00025921,"tid":202998729,"timestamp":1544490408},{"type":"ask","price":3630.96,"amount":0.08270166,"tid":202998728,"timestamp":1544490376},{"type":"ask","price":3634.8039568,"amount":0.00063255,"tid":202998727,"timestamp":1544490376},{"type":"ask","price":3635.72999999,"amount":0.00232072,"tid":202998726,"timestamp":1544490376},{"type":"ask","price":3636.90535714,"amount":0.00074002,"tid":202998725,"timestamp":1544490375},{"type":"ask","price":3640.9999804,"amount":0.00549263,"tid":202998724,"timestamp":1544490375},{"type":"ask","price":3643.13323999,"amount":0.01927689,"tid":202998723,"timestamp":1544490375},{"type":"ask","price":3647.13356601,"amount":0.0259138,"tid":202998722,"timestamp":1544490375},{"type":"ask","price":3649,"amount":0.00301652,"tid":202998721,"timestamp":1544490375},{"type":"ask","price":3649.40156305,"amount":0.00060002,"tid":202998720,"timestamp":1544490375},{"type":"ask","price":3650,"amount":0.0214024,"tid":202998719,"timestamp":1544490375},{"type":"ask","price":3650,"amount":0.03848697,"tid":202998718,"timestamp":1544490375},{"type":"ask","price":3650.00001012,"amount":0.0112916,"tid":202998717,"timestamp":1544490375},{"type":"ask","price":3664.05779423,"amount":0.00056916,"tid":202998716,"timestamp":1544490374},{"type":"ask","price":3664.08824689,"amount":0.00070354,"tid":202998715,"timestamp":1544490374},{"type":"ask","price":3666.0006,"amount":0.02675491,"tid":202998714,"timestamp":1544490374},{"type":"ask","price":3666.0007,"amount":0.00622631,"tid":202998713,"timestamp":1544490373},{"type":"ask","price":3666.00070001,"amount":0.00380937,"tid":202998712,"timestamp":1544490373},{"type":"ask","price":3666.00070001,"amount":0.00086275,"tid":202998711,"timestamp":1544490326},{"type":"bid","price":3670.14887503,"amount":0.00145391,"tid":202998710,"timestamp":1544490312},{"type":"bid","price":3668.69999065,"amount":0.00765963,"tid":202998709,"timestamp":1544490181},{"type":"bid","price":3668.69999066,"amount":0.00026931,"tid":202998708,"timestamp":1544490126},{"type":"bid","price":3673.42848883,"amount":0.00204099,"tid":202998707,"timestamp":1544489766},{"type":"bid","price":3673.42848883,"amount":0.00250871,"tid":202998706,"timestamp":1544489760},{"type":"bid","price":3675.72793857,"amount":0.01406304,"tid":202998705,"timestamp":1544489539},{"type":"bid","price":3675.72793857,"amount":0.00292065,"tid":202998704,"timestamp":1544489539},{"type":"bid","price":3675.72793857,"amount":0.01438334,"tid":202998703,"timestamp":1544489538},{"type":"bid","price":3675.72793857,"amount":0.00216248,"tid":202998702,"timestamp":1544489538},{"type":"bid","price":3675.72793857,"amount":0.01440573,"tid":202998701,"timestamp":1544489538},{"type":"ask","price":3666.00060041,"amount":0.00193785,"tid":202998700,"timestamp":1544489465},{"type":"bid","price":3666.000603,"amount":0.00079303,"tid":202998699,"timestamp":1544489299},{"type":"bid","price":3666.000603,"amount":0.00020697,"tid":202998698,"timestamp":1544489299},{"type":"bid","price":3678.92073284,"amount":0.00325067,"tid":202998697,"timestamp":1544488664},{"type":"bid","price":3678.92073284,"amount":0.00293006,"tid":202998696,"timestamp":1544488663},{"type":"bid","price":3678.92073284,"amount":0.01991601,"tid":202998695,"timestamp":1544488663},{"type":"bid","price":3678.92073284,"amount":0.01992283,"tid":202998694,"timestamp":1544488663},{"type":"bid","price":3684.32156283,"amount":0.00055355,"tid":202998693,"timestamp":1544488575},{"type":"bid","price":3684.32156283,"amount":0.00048689,"tid":202998692,"timestamp":1544488570},{"type":"bid","price":3684.32156283,"amount":0.00057303,"tid":202998691,"timestamp":1544488570},{"type":"ask","price":3666.0006004,"amount":0.00013594,"tid":202998690,"timestamp":1544488525},{"type":"bid","price":3681.8582184,"amount":0.0004652,"tid":202998689,"timestamp":1544487970},{"type":"bid","price":3680.15569063,"amount":0.02130834,"tid":202998688,"timestamp":1544487970},{"type":"ask","price":3681.73876804,"amount":0.00000377,"tid":202998687,"timestamp":1544487932},{"type":"ask","price":3681.73876804,"amount":0.00037315,"tid":202998686,"timestamp":1544487830},{"type":"ask","price":3681.73876804,"amount":0.00222295,"tid":202998685,"timestamp":1544487822},{"type":"ask","price":3681.73876804,"amount":0.00220149,"tid":202998684,"timestamp":1544487822},{"type":"ask","price":3681.73876804,"amount":0.00222295,"tid":202998683,"timestamp":1544487815},{"type":"bid","price":3681.73876804,"amount":0.04920252,"tid":202998682,"timestamp":1544487808},{"type":"bid","price":3677.17079143,"amount":0.00245339,"tid":202998681,"timestamp":1544487730},{"type":"ask","price":3675.10254022,"amount":0.00158296,"tid":202998680,"timestamp":1544487699},{"type":"bid","price":3675.10254022,"amount":0.00070143,"tid":202998679,"timestamp":1544487699},{"type":"bid","price":3672.47696444,"amount":0.00063814,"tid":202998678,"timestamp":1544487657},{"type":"ask","price":3655.00004,"amount":0.00061497,"tid":202998677,"timestamp":1544487628},{"type":"bid","price":3663.42165974,"amount":0.0009249,"tid":202998676,"timestamp":1544487489},{"type":"ask","price":3655.08000503,"amount":0.00757208,"tid":202998675,"timestamp":1544487488},{"type":"ask","price":3659.47676886,"amount":0.00075743,"tid":202998674,"timestamp":1544487488},{"type":"ask","price":3661.47053997,"amount":0.00063814,"tid":202998673,"timestamp":1544487488},{"type":"ask","price":3661.47053998,"amount":0.00576507,"tid":202998672,"timestamp":1544487488},{"type":"bid","price":3663.42165975,"amount":0.00171528,"tid":202998671,"timestamp":1544487477},{"type":"ask","price":3661.47053998,"amount":0.00323435,"tid":202998670,"timestamp":1544487475},{"type":"ask","price":3678,"amount":0.00092491,"tid":202998669,"timestamp":1544487474},{"type":"bid","price":3681.73876804,"amount":0.00292394,"tid":202998668,"timestamp":1544487464},{"type":"bid","price":3678,"amount":0.00211122,"tid":202998667,"timestamp":1544487462},{"type":"bid","price":3678,"amount":0.0029364,"tid":202998666,"timestamp":1544487462},{"type":"ask","price":3661.56000001,"amount":0.00459553,"tid":202998665,"timestamp":1544486871},{"type":"ask","price":3663.15569063,"amount":0.00019748,"tid":202998664,"timestamp":1544486871},{"type":"ask","price":3663.15569063,"amount":0.00170372,"tid":202998663,"timestamp":1544486869},{"type":"ask","price":3663.15569063,"amount":0.00030537,"tid":202998662,"timestamp":1544486868},{"type":"ask","price":3663.15569063,"amount":0.00200911,"tid":202998661,"timestamp":1544486864},{"type":"ask","price":3663.15569063,"amount":0.00672397,"tid":202998660,"timestamp":1544486864},{"type":"ask","price":3663.15569063,"amount":0.00089256,"tid":202998659,"timestamp":1544486797},{"type":"ask","price":3663.15569063,"amount":0.00013752,"tid":202998658,"timestamp":1544486795},{"type":"bid","price":3681.6,"amount":0.00109981,"tid":202998657,"timestamp":1544486793},{"type":"bid","price":3681.6,"amount":0.02658605,"tid":202998656,"timestamp":1544486792},{"type":"bid","price":3681.6,"amount":0.00050437,"tid":202998655,"timestamp":1544486737},{"type":"bid","price":3678.37091372,"amount":0.00080409,"tid":202998654,"timestamp":1544486713},{"type":"ask","price":3663.15569063,"amount":0.00017929,"tid":202998653,"timestamp":1544486712},{"type":"ask","price":3663.15569063,"amount":0.00214199,"tid":202998652,"timestamp":1544486707},{"type":"ask","price":3663.15569063,"amount":0.00239334,"tid":202998651,"timestamp":1544486703},{"type":"ask","price":3663.15569063,"amount":0.00879262,"tid":202998650,"timestamp":1544486703},{"type":"ask","price":3663.15569063,"amount":0.00176729,"tid":202998649,"timestamp":1544486679},{"type":"ask","price":3663.1559,"amount":0.0015119,"tid":202998648,"timestamp":1544486463},{"type":"ask","price":3661.68,"amount":0.00111334,"tid":202998647,"timestamp":1544486351},{"type":"ask","price":3661.68,"amount":0.0207622,"tid":202998646,"timestamp":1544486339},{"type":"ask","price":3661.68000001,"amount":0.00064241,"tid":202998645,"timestamp":1544486338},{"type":"bid","price":3681.35999012,"amount":0.00270048,"tid":202998644,"timestamp":1544486330},{"type":"bid","price":3681.35999012,"amount":0.00234536,"tid":202998643,"timestamp":1544486327},{"type":"bid","price":3681.35999012,"amount":0.00282437,"tid":202998642,"timestamp":1544486327},{"type":"bid","price":3681.36,"amount":0.0020507,"tid":202998641,"timestamp":1544486325},{"type":"bid","price":3681.36,"amount":0.0007798,"tid":202998640,"timestamp":1544486312},{"type":"bid","price":3681.36,"amount":0.00722697,"tid":202998639,"timestamp":1544486311},{"type":"bid","price":3681.36,"amount":0.00536916,"tid":202998638,"timestamp":1544486311},{"type":"bid","price":3681.36,"amount":0.00295395,"tid":202998637,"timestamp":1544486311},{"type":"bid","price":3681.36,"amount":0.00080344,"tid":202998636,"timestamp":1544486310},{"type":"bid","price":3681.36,"amount":0.00079797,"tid":202998635,"timestamp":1544486310},{"type":"ask","price":3661.5607,"amount":0.00682769,"tid":202998634,"timestamp":1544486193},{"type":"bid","price":3681.48,"amount":0.00156752,"tid":202998633,"timestamp":1544486169},{"type":"bid","price":3663.15569063,"amount":0.00034233,"tid":202998632,"timestamp":1544486169},{"type":"ask","price":3661.8,"amount":0.00011226,"tid":202998631,"timestamp":1544485851},{"type":"ask","price":3661.8,"amount":0.00193069,"tid":202998630,"timestamp":1544485850},{"type":"ask","price":3661.8,"amount":0.00104173,"tid":202998629,"timestamp":1544485849},{"type":"ask","price":3661.8,"amount":0.00590797,"tid":202998628,"timestamp":1544485840},{"type":"ask","price":3681.72,"amount":0.0001,"tid":202998627,"timestamp":1544485840},{"type":"bid","price":3681.73876804,"amount":0.00787354,"tid":202998626,"timestamp":1544485716},{"type":"ask","price":3661.92,"amount":0.00055248,"tid":202998625,"timestamp":1544485496},{"type":"ask","price":3661.92,"amount":0.00505648,"tid":202998624,"timestamp":1544485476},{"type":"ask","price":3661.92,"amount":0.00140674,"tid":202998623,"timestamp":1544485475}]}
)"
jlen := StrLen(j)
n:=200*1000
a1 := a2 := 0
loop(n) {
StrPutVar(v := SubStr(j, Random(1,jlen)), _j)
t := A_TickCount, NumPut(&_j,fa), s1:=DllCall(fc), a1 += A_TickCount - t
t := A_TickCount, s2:=StrLen(StrGet(&_j)), a2 += A_TickCount - t
(s1 == s2) || msgbox("error:" s1 " | " s2)
}
msgbox(clipboard:=a1/n "|" a2/n)
StrPutVar(string, ByRef var, encoding := "utf-16") {
VarSetCapacity(var, StrPut(string, encoding) * ((encoding="utf-16"||encoding="cp1200") ? 2 : 1) )
return StrPut(string, &var, encoding)
}