🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7956

Re: Missing data from network writes (Win2K client and server)

#7956
From: Ed Mulroy [TeamB]
Date: Thu, 09 Dec 2004 15:34
59 lines
3553 bytes
> > ...I almost never use FILE_SHARE_*  on a file I
> > am creating...
>
> ... We normally do that because engineers like to
> look at what's coming off the disk before imaging has
> finished. ...

A sharing flag suggests that Windows' buffering layer keep
copies around for the sharing users.  If I experienced the
symptoms you describe, my first reaction would be to do
whatever it takes to force the write to be with as little
system-supplied buffering as possible.

If your guys like to see the data that a WriteFile writes
even when they already have access to the program buffer
containing the source data whose address was passed to
WriteFile, consider opening a second, echo file on the local
disk or pipe which has sharing enabled and issuing another
WriteFile to it AFTER the real WriteFile call.

I did not mention this before because I suspected it would be
a burden in your case and I do not know how it would be
handled when the target is on a network, but most of the
time I use FILE_FLAG_WRITE_THROUGH I also use
FILE_FLAG_NO_BUFFERING.  The latter requires the
address of the source be on sector sized boundaries and
the size of the write be an integral multiple of that.

While the help (or at least as I remember it) implies that
you might have to allocate a special buffer for this to force
the alignment, sector sizes are a power of 2 and the
Windows' implementation pretty much requires that any
virtual address in your program which is so aligned (any
address whose numeric value mod that power of 2 is zero),
will map to a physical address which is so aligned.  In my
case I don't bother with the allocation or with determining
the sector size.  I align on a 4K boundary which should
cover any conceivable sector size (I cannot remember a
disk which did not have 512 byte sectors other than floppies
which had power of two sub-multiples of that.)

.  Ed

> Andrue Cope wrote in message
> news:41b8159d$1@newsgroups.borland.com...
>
> > Have you tried specifying FILE_FLAG_WRITE_THROUGH
> > and callingFlushFileBuffers?
>
> We didn't find either of those yesterday - thanks, I'll try them
> today.
>
> > Also, I almost never use FILE_SHARE_*  ...
>
> We normally do that because engineers like to look at
> what's coming off the disk before imaging has finished. In
> this case the tool is primarily for forensic work so the
> disks can be assumed to be good and we can forgoe
> this feature.
Technical Details
Message-ID: <41b87529$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <41b6de1f$1@newsgroups.borland.com> <41b731e9$1@newsgroups.borland.com> <41b76c0b$1@newsgroups.borland.com> <41b8159d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,99122155c7605386
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41b6de1f$1@newsgroups.borland.com> <41b731e9$1@newsgroups.borland.com> <41b76c0b$1@newsgroups.borland.com> <41b8159d$1@newsgroups.borland.com>
Subject: Re: Missing data from network writes (Win2K client and server)
Date: Thu, 9 Dec 2004 10:34:40 -0500
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 24.74.175.102
Message-ID: <41b87529$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1102607657 24.74.175.102 (9 Dec 2004 07:54:17 -0800)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail