Kann man auch Funktionspointer in MCode in irgendeiner Weise nutzen ?

MCode funktion + onlinegenerator (x86 und x64)
Nee Funktionspointer wie man sie in C benutzt um andere Funktionen dynamisch auszurufen:
int MyFunction(int a) { int (*funcptr)(int); int b; funcptr = MyFunction; a++; if (a==42) return a; b = (*funcptr)(a); return b; }
Ach ja BTW HEX hat bei mir in MCode den geist aufgegeben

Visit the new forum ahkscript.org.
allerdings wollte ich eine andere MCODe funktion aufrufen, und dies geht so :
int MyFunction(unsigned int funcptr) { void(*func)(void); objfunc = reinterpret_cast < void (__cdecl *)(void) > (funcptr); (*func)(); return 0; }

Visit the new forum ahkscript.org.
struct disp { float x; float y; float rot; unsigned int list; }; disp * obj[];
Ich bin mir jetzt selbst nicht ganz sicher:
Ist das ein Pointer zu einem Array mit Structs oder ein Array mit Pointern zu Structs?
EDIT:
Ich hab jetzt doch noch eine gute Internetseite mit Infos gefunden.
Es schein to richtig zu sein.

Visit the new forum ahkscript.org.
Der Generator ist nach ca. einer Woche jetzt wieder online.
Bitte um Entschuldigung, irgend ein Programm, Update oder sonst was hat wohl die Firewall aktiviert, wodurch kein Kontakt zum Server möglich war.

Ist doch kein Problem.
Dafür brauchst du dich nicht zu entschuldigen, es ist ja nicht so als hätten wir dafür etwas bezahlt.

Visit the new forum ahkscript.org.
News:
Im neuen Forum gibt es ein Tutorial von nnnik über MCode:
http://auto-hotkey.c...f=11&t=116#p734
Hab ich auch im 1. Post verlinkt

Kannst du die /QIfist option benutzen?
Wenn du x86 kompilierst?
Siehe Hier:
http://ahkscript.org...83&p=5419#p5419

Visit the new forum ahkscript.org.
Hallo,
Sorry für die vielen Anfragen wegen des generators...
Nein, leider ist der im moment nicht online.
Hab den Internetanbieter gewechselt, und mit nem WebStick kann ich leider keine dyndns einrichten.
Ich tendiere aber ohnehin zu einem root-server (auch wegen anderen projekten).
Bis dahin kann ich nur den Code mit euch teilen den ich für den generator verwendet habe...
/*! Adapted by TheGood http://www.autohotkey.com/forum/viewtopic.php?p=364922 Last updated: August 17th, 2010 Rewrite for AHK 1.1+ Bentschi 2013 */ #SingleInstance, off installdir := "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\" ;HKCU\HKEY_CURRENT_USER\Software\Microsoft\VCExpress\11.0_Config\Setup\VC ;ProductDir if (!fileexist(vcvarsall := installdir "vcvarsall.bat")) exitapp, -1 opt := {opt:"x", lang:1, comp:1, enc:1, warn:1} pcount = %0% if (!fileexist(srcfile := AbsolutePath(%pcount%))) exitapp, -2 fileinfo := SplitPath(srcfile) Loop, % pcount { p := %A_Index% if (p="-minsize") opt.opt := 1 else if (p="-maxspeed") opt.opt := 2 else if (p="-noopt") opt.opt := "d" else if (p="-c") opt.lang := 1 else if (p="-cpp") opt.lang := 2 else if (p="-x86") opt.comp := 1 else if (p="-x64") opt.comp := 2 else if (p="-x86x64") opt.comp := 3 else if (p="-hex") opt.enc := 1 else if (p="-base64") opt.enc := 2 else if (regexmatch(p, "^-warn([1-4])$", m)) opt.warn := m1 } bat := "@echo off`r`n" outfiles := {} for k,v in {1:"x86", 2:"x86_amd64"} { if (opt.comp&k) { outfiles[v] := fileinfo.dir fileinfo.filename "_" v ".cod" FileDelete, % fileinfo.dir fileinfo.filename "_" v ".cod" bat .= "echo COMPILER: " v "`r`n" bat .= "echo OPTIONS: " ((opt.lang=1) ? "/TC" : "/TP") " /c /FAc /Facode.cod /O" opt.opt " /W" opt.warn "`r`n" bat .= "call """ vcvarsall """ " v "`r`n" bat .= "cl " ((opt.lang=1) ? "/TC" : "/TP") " /c /FAc /Facode.cod /O" opt.opt " /W" opt.warn " """ srcfile """`r`n" bat .= "echo ERRORLEVEL: %ERRORLEVEL%`r`n" bat .= "echo STRIP BEGIN MOVE`r`n" bat .= "move /Y """ fileinfo.dir "code.cod"" """ fileinfo.dir fileinfo.filename "_" v ".cod""`r`n" bat .= "echo STRIP END MOVE`r`n" bat .= "echo ---`r`n" } } SetWorkingDir, % fileinfo.dir batfile := fileinfo.dir fileinfo.filename ".bat" logfile := fileinfo.dir fileinfo.filename ".log" FileDelete, % batfile FileAppend, % bat, % batfile FileDelete, % logfile RunWait, % batfile " >> " logfile,, Hide FileDelete, % fileinfo.dir "code.cod" err := 0 Loop, read, % logfile { if (regexmatch(A_LoopReadLine, "ERRORLEVEL: (.*)", m)) err += m1 } if (err) { CleanLog() exitapp, -3 } functions := {} log := "" for k,v in outfiles { Loop, 10 { if (!fileexist(v)) { if (A_Index=10) { CleanLog() exitapp, -4 } sleep, 200 } else break } FileRead, code, % v f := {} while (RegExMatch(code, "ms)_?([^\s]+?)\s+PROC\s*(.*?)\s*[^\s]+\s*ENDP(.*)", m)) { f.name := regexreplace(m1, "\?(.*?)@@.*", "$1") f.code := regexreplace(regexreplace(m2, "m)^[^\t]*\t([^\t\r\n]+)[^\r\n]*", "$1"), "\s+") log .= "Extract function: " f.name " [" k "] [" (strlen(f.code)//2) " bytes]`r`n" if (opt.enc!=1) { binlength := StringToBinary(4, f.code, bin) if (opt.enc=2) f.code := BinaryToString(1, &bin, binlength) } functions[f.name, k] := f.code code := m3 } } out := "" width := 100 for name,info in functions { c := name " := MCode(""" d := opt.enc for comp,code in info { if (comp="x86") d .= ",x86:" else if (comp="x86_amd64") d .= ",x64:" else continue d .= code } if (strlen(c)+strlen(d)+2<width) out .= c d """)`r`n" else { out .= c "`r`n(LTrim Join`r`n" while (strlen(d)>width) { out .= substr(d, 1, width) "`r`n" d := substr(d, width+1) } if (d) out .= d "`r`n" out .= ")"")`r`n" } } outfile := fileinfo.dir fileinfo.filename ".mcode" FileDelete, % outfile FileAppend, % out, % outfile FileAppend, % log, % logfile CleanLog() ExitApp, 0 CleanLog() { global FileRead, xlog, % logfile FileDelete, % logfile xlog := regexreplace(xlog, "im)^" regexreplace(fileinfo.filename ((fileinfo.ext) ? "." fileinfo.ext : ""), "(\\|[.*?+[{|()^$])", "\$1") "\s*") xlog := regexreplace(xlog, "i)" regexreplace(srcfile, "(\\|[.*?+[{|()^$])", "\$1"), "source") xlog := regexreplace(xlog, "s)STRIP BEGIN MOVE.*?STRIP END MOVE[\r\n]+") FileAppend, % xlog, % logfile } SplitPath(filename) { if (regexmatch(filename, "^(.*\\)?([^.\\]*)\.?([^\\]*)$", m)) return {filename:m2, dir:AbsolutePath(m1), ext:m3} } AbsolutePath(filename) { if (!DllCall("shlwapi\PathIsRelativeW", "wstr", filename)) return filename s := DllCall("GetFullPathNameW", "wstr", filename, "uint", 0, "ptr", 0, "ptr", 0) VarSetCapacity(buf, s*2, 0) DllCall("GetFullPathNameW", "wstr", filename, "uint", s, "ptr", &buf, "ptr", 0) return StrGet(&buf, s, "utf-16") } StringToBinary(type, str, byref buf) { if (!DllCall("crypt32\CryptStringToBinary", "str", str, "uint", 0, "uint", type, "ptr", 0, "uint*", sout, "ptr", 0, "ptr", 0)) return "" VarSetCapacity(buf, sout, 0) if (!DllCall("crypt32\CryptStringToBinary", "str", str, "uint", 0, "uint", type, "ptr", &buf, "uint*", sout, "ptr", 0, "ptr", 0)) return "" return sout } BinaryToString(type, ptr, size) { if (!DllCall("crypt32\CryptBinaryToStringW", "ptr", ptr, "uint", size, "uint", type, "ptr", 0, "uint*", sout)) return VarSetCapacity(bout, sout<<1, 0) if (!DllCall("crypt32\CryptBinaryToStringW", "ptr", ptr, "uint", size, "uint", type, "ptr", &bout, "uint*", sout)) return return regexreplace(StrGet(&bout, sout<<1, "utf-16"), "\s+") }
