matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
O.P. InternetOpenUrlW - what am I doing wrong?
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 hOpen = Interop.Allocate(4);
var hFile = Interop.Allocate(4);
var sBuffer = Interop.Allocate(2*(1000)+2);
var lBuffer = Interop.Allocate(4);
lBuffer.WriteDWORD(0, 1000);
var lRet;
hOpen.WriteDWORD(0, Interop.Call('wininet', 'InternetOpenW', 'ScreenshotSender4Updater', INTERNET_OPEN_TYPE_DIRECT, '', '', 0));
hFile.WriteDWORD(0, Interop.Call('wininet', 'InternetOpenUrlW', hOpen.ReadDWORD(0), sUrl+sFile+'.version', '', 0, INTERNET_FLAG_RELOAD, 0));
Interop.Call('wininet', 'InternetReadFile', hFile.ReadDWORD(0), sBuffer.DataPtr, lBuffer.ReadDWORD(0), lRet);
Interop.Call('wininet', 'InternetCloseHandle', hFile.ReadDWORD(0));
Interop.Call('wininet', 'InternetCloseHandle', hOpen.ReadDWORD(0));
Debug.Trace(sBuffer.ReadString(0));
}
Ya so what am I doing wrong? I tried passing lBuffer as a normal var (didn't work), tried passing 1000 didn't work. sBuffer.ReadString(0) is null so I am not sure what is wrong.
|
|