473,671 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I find out if drive (possibly WITHOUT file system) exists?

Assume I have a partition (under WIn2000/WInXP) which is possibly NOT
formatted with a files system (e.g. NTFS). This could be a partition on an external
USB harddisc.

How do I find out if this partition exist?

Notice that "normal" program code that refers to the root directory or a file system do
not work.

The C++ or C code should use not use .NET functions.

Tony
Aug 4 '05 #1
1 2695
In article <42************ ***********@new sread4.arcor-online.net>,
Tony Bansten <to******@hotma il.com> wrote:
Assume I have a partition (under WIn2000/WInXP) which is possibly NOT
formatted with a files system (e.g. NTFS). This could be a partition on an external
USB harddisc. How do I find out if this partition exist?


The C and C++ languages do not know themselves anything about
partitions. You should ask in a Windows newsgroup.

FYI, there are some traditional approaches to this problem --
approaches which might or might not be applicable to Windows:

a) Wander through the operating system's mount table to figure out
whether the partition is -already- mounted

b) Ask the operating system to mount it for you. If the response
is that it doesn't exist, then you know it doesn't exist.
If the response is that you don't have permission to mount it,
then you need to know the OS-specific checking sequence: on
some OS's, it would be an indication that it has determined that
a filesystem is there, whereas on other OS's, it would be an
indication that you don't have enough privilege to mount -any-
filesystem.

c) Research technical details about each filesystem type you
might want to deal with. Ask the operating system to allow you raw
access to the blocks that make up the partition. Check through
the blocks, looking for the "magic numbers" that signal various
different filesystem types. Note: on Unix systems, you would
normally be disallowed access to the raw partition blocks unless
you were privileged; I don't know whether the same is true for Windows.

--
"I want to make sure [a user] can't get through ... an online
experience without hitting a Microsoft ad"
-- Steve Ballmer [Microsoft Chief Executive]
Aug 4 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
53462
by: Matthias Ludwig | last post by:
I'm trying to create a directory on the web server with a vb.net code: .... Dim dirName As String = "w:\filepath\images" If Not Directory.Exists(dirName) Then Directory.CreateDirectory(dirName) Label1.Text = "Directory created" Else
1
539
by: Tony Bansten | last post by:
Assume I have a partition (under WIn2000/WInXP) which is possibly NOT formatted with a files system (e.g. NTFS). This could be a partition on an external USB harddisc. How do I find out if this partition exist? Notice that "normal" program code that refers to the root directory or a file system do not work. The C++ or C code should use not use .NET functions.
2
9375
by: Zeno Lee | last post by:
I'm using File.Exists to test a file on my C: drive. My program was strongly named and had caspol -af run on it to allow it to run from the network. There are 3 ways I am doing this: 1) Run from my C: drive, File.Exists works properly and says C:\Temp\test.txt exists 2) Run from my H:\ (network) drive, File.Exists says the file doesn't exist. 3) Run from Visual Studio debugger, with project configuration property
2
5676
by: Peter O'Reilly | last post by:
I am experiencing difficulty access a mapped network drive in an ASP.NET application. While using the .Net framework v 1.1 implementation of System.IO.Directory.Exists(), it fails to recognize a mapped network drive. This is true if the path specified uses a mapped drive letter or is expressed as a UNC address. I have also tried the drive letter and UNC paths with and without trailing backslashes, respectively.
5
7217
by: Tom Vogel | last post by:
Creating a subfolder within my ASP.NET application folder fails with the above error, but only at my hosting provider. The command: Directory.CreateDirectory(path) Path is set to 'D:\appfolder\test2'. ASPNET has full control on the application folder. Any ideas why this fails? - Tom
8
10777
by: Michael | last post by:
I am running a web server (IIS) on Windows 2003 SP 1. My ASP.NET C# applications run fine. However, my application is a combination of Classic ASP and C#. For some reason when you attempt to access the Classic ASP components of the application you are presented with this useless error message: "The system cannot find the file specified" The ASP.NET applications are contained within one directory, for instance...
2
4744
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple file sharing. And have specified the "Allow network users to change my files." option as well. Then on my laptop (xp home sp2) I have mapped a network drive using windows explorer. So on my laptop I have a Y: drive that points to the "Visual...
1
9074
by: tanya.wang | last post by:
I want to access files from a remote server so I mapped it in my server under z:\ for \\myserver\web\mysite\images\ I added this UNC path to my IIS virtual directory and name it as "upload" but I still cannot use any FSO to read it. Here is my code: <% Dim fs set fs=Server.CreateObject("Scripting.FileSystemObject")
3
2325
by: Alexander Vasilevsky | last post by:
Here, there is a challenge: to find the files must be on a local computer, have the same names. Get drives and folders to go through without problems. But what and how to store files while a search? http://www.alvas.net - Audio tools for C# and VB.Net developers + Christmas gift
0
8483
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8402
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8927
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6237
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.