It's all in the title, i get the feeling it's something to do with my use of a pointer,because even if i bring up the return to before where there's a pointer it returns null,but returns properly if i comment out the pointer & all below it... using https://github.com/joedf/MCode4GCC
Thanks for any insight.
Code: Select all
/*
//works fine here...
#include <stdio.h>
#include <time.h>
int main()
{
printf("%d\n", myLBfunc());
}
*/
/*
#include <time.h>
int myLBfunc()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
int sec = timeinfo->tm_sec; //seconds [0,61]
int min = timeinfo->tm_min; //minutes [0,59]
int hour = timeinfo->tm_hour; //hour [0,23]
int mday = timeinfo->tm_mday; //day of month [1,31]
int month = timeinfo->tm_mon; //month of year [0,11]
int year = timeinfo->tm_year; //years since 1900
int dweek = timeinfo->tm_wday; //day of week [0,6] (Sunday = 0)
int dyear = timeinfo->tm_yday; //day of year [0,365]
if (min % 2 == 0 && sec > 5 && sec < 55){ //if minute is even and second is within specified range... only then return stored value...
return 123456789; //decimal encoded password example....
};
return -1;
}
*/
;should return something....... but does not....
Msgbox % DllCall(MCode("2,x86:U4PsKI1cJByJHCToAAAAAIkcJOgAAAAA9kAEAYsQdRWD6gaD+jEZwCUWzVsHg+gBg8QoW8O4/////+v0kJCQkA=="),"cdecl UInt64")
dt := "Str,AStr,WStr,Int64,Int,Short,Char,Float,Double,Ptr" ; suffix := "*,P", prefix := "U"
For i,type in StrSplit(dt,",") ;'automated' type checking...
If ( thisRet := DllCall(MCode("2,x86:U4PsKI1cJByJHCToAAAAAIkcJOgAAAAA9kAEAYsQdRWD6gaD+jEZwCUWzVsHg+gBg8QoW8O4/////+v0kJCQkA=="),"cdecl " type "") )
Msgbox % thisRet "`n`n" type
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)
}