GetProcAddress doesn't take a unicode string
js code:
function Print(s){Debug.Trace(s);}
var GetModuleHandle = function(ModuleName) {
Print("Getting module handle for " + ModuleName);
return Interop.Call("Kernel32.dll","GetModuleHandleW",ModuleName);
}
var GetProcAddress = function(hModule,ProcName) {
Print("Getting procedure address for " + ProcName);
var DataBloc = Interop.Allocate(ProcName.length + 1);
DataBloc.WriteString(0, ProcName, false);
return Interop.Call("Kernel32.dll","GetProcAddress",hModule,DataBloc);
}
var a = GetModuleHandle("kernel32.dll");
Debug.Trace(a);
var b = GetProcAddress(a, "LoadLibraryW");
Debug.Trace(b);