darn me, forgot to add a note; if you look at the above API you'll
notice that the call takes a TRASMIT_FILE_BUFFERS structure as one of
its parameters, such a struct, which is defined here
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740568%28v=vs.85%29.aspx
contains two buffer; namely head and tail; now, it's a good idea to use
those buffers to add to your file data stream some additional checks;
the idea is to create a structure like (e.g.)
Type tagFileHead
lngStructSize As Long ' LenB of this struct
strFileName As String * 255 ' filename.ext
lngFileSize As Long ' file size (bytes)
dtCreated As Date ' date created
dtModified As Date ' date last modified
lngAttrib As Long ' attributes
strChecksum As String * 50 ' checksum (e.g. MD5)
End Type
and fill the "header" buffer of TRASMIT_FILE_BUFFERS with it while
leaving the tail buffer empty; this way the TransmitFile API will
prepend the header to the file data when transmitting the file to the
remote end; the latter may then temporary save the whole data into a
temporary file, extract the header and use it not only to set back the
correct file name, attribute and dates, but also to check if the file
was correctly transmitted by recalculating the hash value on the file
data; the "lngStructSize" is there just to ease separating the header
from the data since you may just read such a size and know where to
"split" the header from the data