What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » ReadFile API

ReadFile API
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. ReadFile API
code:
var GENERIC_READ = 0x80000000;
var FILE_BEGIN = 0;
var FILE_SHARE_READ = 1;
var OPEN_EXISTING = 3;

function OnEvent_Initialize(MessengerStart){
    var hOrgFile = Interop.Call('kernel32', 'CreateFileW', 'c:\\test.txt', GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
    var nSize = Interop.Call('kernel32', 'GetFileSize', hOrgFile, 0);
    Debug.Trace('nSize: '+nSize);
    var sText = Interop.Allocate(nSize+1);
    var lRet = Interop.Allocate(4);
    Interop.Call('kernel32', 'ReadFile', hOrgFile, sText, nSize, lRet.DataPtr, 0);
    Debug.Trace(lRet.ReadDWORD(0));
    Debug.Trace(sText.ReadString(0));
    Interop.Call('kernel32', 'CloseHandle', hOrgFile);
}

sText.ReadDWORD(0) is null and lRet.ReadDWORD(0) is 0.

Not sure what I am doing wrong.

ReadFile API msdn

This post was edited on 09-11-2006 at 08:55 PM by matty.
09-11-2006 08:52 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
ReadFile API - by matty on 09-11-2006 at 08:52 PM
RE: ReadFile API - by Mnjul on 09-11-2006 at 09:04 PM
RE: ReadFile API - by -dt- on 09-11-2006 at 11:07 PM
RE: ReadFile API - by RaceProUK on 09-11-2006 at 11:18 PM
RE: ReadFile API - by alexp2_ad on 09-11-2006 at 11:20 PM
RE: ReadFile API - by matty on 09-12-2006 at 01:01 AM
RE: RE: ReadFile API - by alexp2_ad on 09-12-2006 at 09:18 AM
RE: ReadFile API - by Patchou on 09-12-2006 at 05:46 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On