|WOW, who sold you this job? were you sober?
Taking it in order.
1) Unmounting the drive will flush the caches. Of course the SCSI standard allows surprise removal so, you never can tell.
2) Issuing SCSI commands. You should be able to issue any SCSI custom command through IOCTL passtrhru interface if the drive is not mounted. How this is affected by security and passwords, I'll be honest: I don't know. You may well require elevated priviliges to do this from user mode.
3) Remounting volumes: should be no problem if you have chosen a drive letter or a reparse point previously. If the drive (well the drives's GUID, really) has not been mounted before, you need elevated privileges to put in the HKLM section of the registry. Also take a look at the automount status (which I think you can see in mountvol, or diskpart. (not too sober myself)).
2B) reestablish write protect. Well I suppose there's a custom SCSI for that one too? Of course if your thingy i s already mounted, you may require elevation. Scratch that, if your drive is already mounted R/W, write protecting it afterwards will cause the file system driver (FAT32, NTFS) to have a nervous breakdown. You won't believe how these things can fill your event log with messages of doom.
Ron Aldrich wrote:All of this has to work on Windows XP, Windows NT and Windows 7
Which Windows NT? If you're talking about 3.1 or 3.51, I've worn out the CD's to put my ashtray on. (Actually I seem to remember they still came on floppys). Windows 2000 has left supported status when William Shatner had to hand over the keys of the USS Enterprise. Your best bet is XP service pack 3. It postdates server 2003 (when all the goodies were introduced) and should have all the nice OS interfaces, without having to write your own device drivers.
Without user privileges: actually I think this is feasible, providing that you have an install program that handles the messy bits like doing initial mounts, establishing HKLM keys.
Ron Aldrich wrote:I guess my first task is to determine whether or not this is even possible.
Funny you should say that. Today I gave some advice to a rookie, which was exactly in line with what you're saying now. Of course I'm not implying you're a rookie, but this might amuse you: http://www.codeproject.com/Answers/76089/this-is-a-network-analyzer-how-do-i-Dnslookup.aspx#answer3[^]
If you're really looking at targeting pre-XP SP3 releases then the Open Specification document to which you referred may be be your only chance. But remember that these open specifications are not cast in stone. These docs were only produced by M$ because they were forced do to so by the EU. Support will be patchy, at best.
If you send me a private reply on this message, you'll get my email address by returning mail. (putting addresses on the internet is never a good idea. (Can I interest you in some Cialis or Viagra?)
PS, to clear some confusion: you don't mount a drive. A drive is a physical thing which contains partitions. A drive is either offline or online. When it's online it can be controlled by the device manager. Partitions can be mounted or dismounted on reparse points (drive letters, empty NTFS directories) when the drive is online...