you use way too many datablocs where theyre not needed, and then dont use one where it is needed (lRet)
working code:
code:
var INTERNET_FLAG_RELOAD = 2147483648;
var INTERNET_OPEN_TYPE_DIRECT = 1;
var INTERNET_OPEN_TYPE_PROXY = 3;
var Version = 1;
function OnEvent_Initialize(MessengerStart){
CheckUpdate('http://mattyg.ca/test/', 'AutoUpdateTest');
}
function CheckUpdate(sUrl, sFile){
var sBuffer = Interop.Allocate((255+1) * 2);
var lRet = Interop.Allocate(4);
hOpen = Interop.Call('wininet', 'InternetOpenW', 'ScreenshotSender4Updater', INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0);
hFile = Interop.Call('wininet', 'InternetOpenUrlW', hOpen, sUrl+sFile+'.version', '', 0, INTERNET_FLAG_RELOAD, 0);
test = Interop.Call('wininet', 'InternetReadFile', hFile, sBuffer, 255, lRet);
Interop.Call('wininet', 'InternetCloseHandle', hFile);
Interop.Call('wininet', 'InternetCloseHandle', hOpen);
Debug.Trace(sBuffer.ReadString(0));
}