[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

detecting write protected media

Posted on 2001-08-02
4
Medium Priority
?
234 Views
Last Modified: 2010-04-02
Hi.
I need to detect whether media in floppy or MO disk is write-protected or not.
I've tried to determine it by opening device "\\.\A:" with GENERIC_WRITE access permission, but it succeeds even if the media is write protected.
Any ideas ?
Thank you in advance.
0
Comment
Question by:sisadmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6344878
I suppose you could try creating a file in it and see if it works:

HANDLE hTempFile;

GetTempFileName("A:\\", // dir. for temp. files
  "NEW",                // temp. filename prefix
  0,                    // create unique name
  szTempName);          // buffer for name

hTempFile = CreateFile((LPTSTR) szTempName,  // filename
  GENERIC_READ | GENERIC_WRITE, // open for read-write
  0,                            // do not share
  NULL,                         // no security
  CREATE_ALWAYS,                // overwrite existing file
  FILE_ATTRIBUTE_NORMAL,        // normal file
  NULL);                        // no attr. template

if (hTempFile == INVALID_HANDLE_VALUE) {
  printf("Read-only");
}


0
 
LVL 1

Author Comment

by:sisadmin
ID: 6352760
Hi.
I suppose this will work fine for floppy, but this might be wrong on MO disk, that is NTFS formatted and can have protected folders and so on.
0
 
LVL 11

Expert Comment

by:griessh
ID: 6842561
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to refund the points and delete this question since nobody had a satisfying answer for you.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 6858039
After review, the proposed answer will be accepted by:

ComTech
Community Support Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question