V1H多线程CPU占用测试:

i=
(`%
SetBatchLines -1
MyFunction := MCode("2,x64:VVdWU0iD7CiD+QGJyH4pjWn+MduNef2J6I1x/4Pg/inHifGD7gLo1f///wHDOf518IPlAY1EHQBIg8QoW15fXcM=")
DllCall(MyFunction, "int", 350, "cdecl")

MCode(mcode) {
  static e := {1:4, 2:1}, c := (A_PtrSize=8) ? "x64" : "x86"
  if (!regexmatch(mcode, "^([0-9]+),(" c ":|.*?," c ":)([^,]+)", m))
    return
  if (!DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e[m1], "ptr", 0, "uint*", s, "ptr", 0, "ptr", 0))
    return
  p := DllCall("GlobalAlloc", "uint", 0, "ptr", s, "ptr")
  if (c="x64")
    DllCall("VirtualProtect", "ptr", p, "ptr", s, "uint", 0x40, "uint*", op)
  if (DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e[m1], "ptr", p, "uint*", s, "ptr", 0, "ptr", 0))
    return p
  DllCall("GlobalFree", "ptr", p)
}
)

; 创建多少个线程?
Loop 9 {
  ahk%A_Index% := AhkThread(i)
}

; V1H存在无法清理忙碌线程的问题
Esc::ExitApp

 

V2H多线程CPU占用测试

i:='
(
MyFunction := MCode("2,x64:VVdWU0iD7CiD+QGJyH4pjWn+MduNef2J6I1x/4Pg/inHifGD7gLo1f///wHDOf518IPlAY1EHQBIg8QoW15fXcM=")
MyFunction("int",350,"cdecl")

MCode(hex, argtypes := 0, &code := 0) {
  static reg := "^([12]?).*" (c := A_PtrSize = 8 ? "x64" : "x86") ":([A-Za-z\d+/=]+)"
  if (RegExMatch(hex, reg, &m))
    hex := m[2], flag := m[1] = "1" ? 4 : m[1] = "2" ? 1 : hex ~= "[+/=]" ? 1 : 4
  else
    flag := hex ~= "[+/=]" ? 1 : 4
  if (!DllCall("crypt32\CryptStringToBinary", "str", hex, "uint", 0, "uint", flag, "ptr", 0, "uint*", &s := 0, "ptr", 0, "ptr", 0))
    return
  code := Buffer(s)
  if (DllCall("crypt32\CryptStringToBinary", "str", hex, "uint", 0, "uint", flag, "ptr", code, "uint*", &s, "ptr", 0, "ptr", 0) && DllCall("VirtualProtect", "ptr", code, "uint", s, "uint", 0x40, "uint*", 0)) {
    args := []
    if (Type(argtypes) = "Array" && argtypes.Length) {
      args.Length := argtypes.Length * 2 - 1
      for i, t in argtypes
        args[i * 2 - 1] := t
    }
    return DllCall.Bind(code, args*)
  }
}
)'

ahk1 := Worker(i)
ahk2 := Worker(i)
ahk3 := Worker(i)
ahk4 := Worker(i)
ahk5 := Worker(i)
ahk6 := Worker(i)
ahk7 := Worker(i)
; ahk8 := Worker(i)
Return

Esc::ExitApp

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。