News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

OVERLAPPED

Started by ragdog, July 20, 2008, 07:02:48 PM

Previous topic - Next topic

ragdog

Hi


what make this save this the offset from the end of file?

.data
ovrOffset OVERLAPPED <>
.code
mov ovrOffset.loffset,FUNC(filesize,esi)

can anywhere help me in normal syntax without macro?

thanks in forward
ragdog

Tedd

most likely:
invoke filesize,esi
mov ovrOffset.loffset,eax

No snowflake in an avalanche feels responsible.

ragdog

Thanks for you reply

but what exactly makes this function

invoke filesize,esi
mov ovrOffset.loffset,eax

I need this for my  writefile function

Tedd

For overlapped-IO, you provide an OVERLAPPED struct..
within that struct, the 'offset' indicates where the data should be read-from or written-to.

So, in the case of writing, if you set it to the current file-size, the data will be written to the end of the file (appended.)
I'm guessing setting offset to -1 will also cause it to append (so you shouldn't need to get filesize), but you'll have to test to see if it actually does.

But, since you're the one saving the file, I presume you'll already know how much you've written, so you'll already know the offset without getting the filesize each time.
No snowflake in an avalanche feels responsible.

ragdog

ok thanks for this info :U

PBrennick

You can do this...

      invoke  SetFilePointer, SomeiHandle, 86, NULL, FILE_BEGIN

Which would cause the write to be done 86 bytes from the start of the file.

Also, if you intend to append data to the end of a file, you can use :

      invoke  SetFilePointer, SomeHandle, 0, NULL, FILE_END

-- Paul
The GeneSys Project is available from:
The Repository or My crappy website