Path: news.mitre.org!blanket.mitre.org!philabs!newsjunkie.ans.net!newsfeeds.ans.net!news-was.dfn.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-peer.sprintlink.net!news.sprintlink.net!Sprint!newsfeed.internetmci.com!192.220.251.22!netnews.nwnet.net!news.microsoft.com!news
From: "Paul Sanders" <paulsan@microsoft.com>
Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode
Subject: Re: TWO QUESTIONS, PLEASE ASSIST
Date: Mon, 1 Dec 1997 10:29:05 -0800
Organization: Microsoft
Lines: 212
Message-ID: <65uvs9$3n1@news.microsoft.com>
References: <65s715$is6$1@news.NetVision.net.il>
NNTP-Posting-Host: 157.54.178.80
X-Newsreader: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3

for #1

> Here are comments from David Goebel about preventing that popup.
>
> -Paul
>
> of course, "\\.\a:" is when using CreateFile() and "\??\a:" is when
> using ZwCreateFile().
> >-----Original Message-----
> >From: David Goebel (Balder Technology Group, Inc.)
> >Sent: Wednesday, June 18, 1997 3:43 PM
> >To: 'Tim Twaits'; 'ntfsd@atria.com'
> >Subject: RE: IoSetThreadHardErrorMode
> >
> >HardError/Exception handling is one of the trickiest parts of NT file
> >system design.  I encourage anyone thinking about tinkering with it to
> >carefully study FatProcessException() in fatdata.c in Microsoft's IFS
> >kit.
> >
> >If all you want to do is check if a floppy is present without getting a
> >pop-up, simplest/safest, is just to do a direct device open
> >(ZwCreateFile of "\\.\a:" with a desired access of only "SYNCHRONIZE |
> >FILE_READ_ATTRIBUTES") and then send down an IOCTL_DISK_CHECK_VERIFY
> (or
> >anything else that will cause it to spin up).  You will just get the
> >status directly from the device with no file system interpretation
> since
> >your handle is to the device.  Note that you can do this from user mode
> >as well.  Just specify 0 desired access to CreateFile().
> >
> >David
> >
> >PS: I will be in San Jose (California, not Costa Rica) next Tuesday if
> >anybody there is interested in some short consulting.  Check out
> >www.balder.com for details.
> >>-----Original Message-----
> >>From: Tim Twaits [SMTP:TJT@sophos.com]
> >>Sent: Wednesday, June 18, 1997 3:35 AM
> >>To: ntfsd@atria.com
> >>Subject: IoSetThreadHardErrorMode
> >>
> >>
> >>This call does not exist for NT 3.51.
> >>Does anyone know how to achieve an equivalent effect on an  NT3.51
> system?
> >>
> >>I am trying to stop the system displaying pop-up error message when I
> >>use the Zw file access routines in a driver created system thread. The
> most
> >>obvious one is the "please insert disk" message which is generated
> when
> >>the floppy drive is empty!
> >>
> >>The IoSetTheadHardErrorMode routine nicely solves the problem under NT
> 4,
> >>but what about NT 3.51?
> >>
> >>Any clues appreciated,
> >>
> >>Tim Twaits
> >>
> >>
> >>
> >>
>
>
> > ----------
> > From:  Wayne Vucenic[SMTP:wvucenic@netgate.net]
> > Sent:  Wednesday, September 10, 1997 3:15 PM
> > To:  Rajeev Nagar
> > Cc:  ntfsd@atria.com
> > Subject:  Re: How can device driver tell if removable drive has
> > media?
> >
> > Hi Rajeev,
> >
> > >Use the FileMon approach.
> > >
> > >However, be careful about the type of access to the device that
> > >you request. If you specify FILE_READ_ATTRIBUTES (for e.g.) ONLY
> > >then the I/O Manager will NOT try to perform a mount which will work
> > >well for you.
> > >
> > >Asking for read/write access will result in a mount being requested
> > >which will cause the problem you described.
> >
> > I tried the FileMon approach, specifying only FILE_READ_ATTRIBUTES in
> > the
> > call to ZwCreateFile().  See the attached sample code.  If I call this
> > code
> > from my device driver, and if there's no floppy in the A: drive, I get
> > that
> > same "Please insert a floppy" dialog box.
> >
> > Should I change some of the other parameters I pass to
> > ZwCreateFile()???
> >
> > I tried this on NT 4.0 SP3, but to make sure I'm not seeing some
> > interaction with a 3rd party driver on my system, I also tried it on
> > an
> > installation of NT 4.0 SP1, with little 3rd party stuff.  Both
> > produced the
> > same dialog box.
> >
> > (I notice from your email address that you work at HP/Cupertino.  I
> > work in
> > Cupertino, too.  Small world...)
> >
> > Thanks for any advice,
> >
> > Wayne
> >
> >
> > // Following code adapted from Filemon.c
> > // Copyright (C) 1996-1997 Mark Russinovich and Bryce Cogswell
> >
> > void test()
> > {
> >    IO_STATUS_BLOCK     ioStatus;
> >    HANDLE              ntFileHandle;
> >    OBJECT_ATTRIBUTES   objectAttributes;
> >    UNICODE_STRING      fileNameUnicodeString;
> >    WCHAR               filename[] = L"\\DosDevices\\A:\\";
> >    NTSTATUS            ntStatus;
> >
> >    RtlInitUnicodeString( &fileNameUnicodeString, filename );
> >    InitializeObjectAttributes( &objectAttributes,
> > &fileNameUnicodeString,
> >       OBJ_CASE_INSENSITIVE, NULL, NULL );
> >    ntStatus = ZwCreateFile( &ntFileHandle, FILE_READ_ATTRIBUTES,
> >       &objectAttributes, &ioStatus, NULL, FILE_ATTRIBUTE_NORMAL,
> > FILE_SHARE_READ|FILE_SHARE_WRITE,
> >       FILE_OPEN, FILE_DIRECTORY_FILE, NULL, 0 );
> >    if ( NT_SUCCESS( ntStatus ))
> >       ZwClose( ntFileHandle );
> > }
> >
>
>
> ----------
> From:  Mor Naveh[SMTP:Mor.Naveh@kla-tencor.com]
> Sent:  Wednesday, October 29, 1997 9:21 PM
> To:  'ntfsd@atria.com'; 'Yaniv Azriel'
> Subject:  RE: [ntfsd] Unformatted Floppy
>
> Thanks for your reply
> But - this method is not good enough for me, since if I cannot attach to
> the floppy device I keep retrying every ~1 secs, if I'm calling
> ZwCreateFile() with the floppy name , and there's no floppy in  the
> drive I get a system message box popping up saying "No disk... Abort /
> Retry / Ignore", and you just cannot work on the computer like that..
>
> Mor.
>
> >----------
> >From:  Yaniv Azriel[SMTP:zong@memco.co.il]
> >Sent:  Wednesday, October 29, 1997 8:38 AM
> >To:  Mor Naveh; ntfsd@atria.com
> >Subject:  Re: [ntfsd] Unformatted Floppy
> >
> >Are you attaching to the physical drive or the filesysetm ?
> >Try to see which filesystem is mounted on the current floppy
> >(if you have a vpb then this is the realdevice=floppy device=fs or null).
> >
> > Basically,
> > ZwCreateFile(\device\floppy);
> >       dev=GetObjectPointer(handle);
> > dev->vpb->device!=NULL <==> fs is loaded
> > dev->vpb->device->driver is the fs driver object
> >
> >Note that it takes a couple of secs for a fs to mount after a media
> change
> >
> >
> >
> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> >[ To unsubscribe, send email to ntfsd-request@atria.com with body
> >UNSUBSCRIBE (the subject is ignored). ]
> >
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> [ To unsubscribe, send email to ntfsd-request@atria.com with body
> UNSUBSCRIBE (the subject is ignored). ]
>
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ To unsubscribe, send email to ntfsd-request@atria.com with body
UNSUBSCRIBE (the subject is ignored). ]
Tsahi Carmona wrote in message <65s715$is6$1@news.NetVision.net.il>...
>Hello all!
>
>I have two questions regarding NT device driver programing:
>
>1. How can I tell if there is a diskette in drive (without the NT internal
>message: DRIVE IS NOT READY pops on the screen when attempting to open file
>on the drive)?
>
>2. I have some dificults opening file on the net. I'm using ZwCreateFile
>function and it works fine on local drives but not on the net. I think the
>reason is because the symbolic link to the net drive is not valid for
>ZwCreateFile function (The symbolic link is:
>"\DosDevices\F:\JUMBO_SYS.DEVELOPMENT.JUMBO\"), my guess is because there
>are two dots in the symbolic link, it is not valid), am I right or there is
>another reason?
>
>Thanks and happy thanksgiving,
>
>Tsahi.
>EMail: tsahi@iris.co.il
>
>
>