The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on July 20, 2008, 07:02:48 PM

Title: OVERLAPPED
Post by: ragdog on July 20, 2008, 07:02:48 PM
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
Title: Re: OVERLAPPED
Post by: Tedd on July 20, 2008, 07:35:47 PM
most likely:
invoke filesize,esi
mov ovrOffset.loffset,eax

Title: Re: OVERLAPPED
Post by: ragdog on July 20, 2008, 08:20:22 PM
Thanks for you reply

but what exactly makes this function

invoke filesize,esi
mov ovrOffset.loffset,eax

I need this for my  writefile function
Title: Re: OVERLAPPED
Post by: Tedd on July 21, 2008, 04:15:27 PM
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.
Title: Re: OVERLAPPED
Post by: ragdog on July 21, 2008, 04:42:22 PM
ok thanks for this info :U
Title: Re: OVERLAPPED
Post by: PBrennick on July 21, 2008, 05:23:42 PM
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