PC Review


Reply
Thread Tools Rate Thread

Could someone help with this one?

 
 
JLW
Guest
Posts: n/a
 
      20th May 2004
I cannot get this to work correctly:

File.Create("\\.\PHYSICALDRIVE0")
or
File.Create("\\.\Tape0")


I've been searching for the better part of a week for this one.

Thanks,
JLW


 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      20th May 2004
are you getting an error message when you try to create the file on the
drive>?
"JLW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I cannot get this to work correctly:
>
> File.Create("\\.\PHYSICALDRIVE0")
> or
> File.Create("\\.\Tape0")
>
>
> I've been searching for the better part of a week for this one.
>
> Thanks,
> JLW
>
>



 
Reply With Quote
 
JLW
Guest
Posts: n/a
 
      20th May 2004
Actually, I'm trying to open the drive itself. I know it sounds crazy, but
I'm concentrating on the \\.\TAPE0 one first, so I can make a backup program
that won't cost me a few thousand bucks. The first one will return me a
handle, but for the TAPE0, I get no handle. I switched to using File.Open
and that seems to help a bit. I want to be able top open the harddrive at a
low level so that I can also make myself a low-level formatter (Zero-Fill
drive).

Thanks,
JLW
"Mike" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> are you getting an error message when you try to create the file on the
> drive>?
> "JLW" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I cannot get this to work correctly:
> >
> > File.Create("\\.\PHYSICALDRIVE0")
> > or
> > File.Create("\\.\Tape0")
> >
> >
> > I've been searching for the better part of a week for this one.
> >
> > Thanks,
> > JLW
> >
> >

>
>



 
Reply With Quote
 
AlexS
Guest
Posts: n/a
 
      20th May 2004
Hi, JLW

you might need to use Win32 API CreateFile - see full description in
Platform SDK help or on MSDN.
I think .Net has some limitations, which files could be opened through
standard framework methods.

HTH
Alex

"JLW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Actually, I'm trying to open the drive itself. I know it sounds crazy,

but
> I'm concentrating on the \\.\TAPE0 one first, so I can make a backup

program
> that won't cost me a few thousand bucks. The first one will return me a
> handle, but for the TAPE0, I get no handle. I switched to using File.Open
> and that seems to help a bit. I want to be able top open the harddrive at

a
> low level so that I can also make myself a low-level formatter (Zero-Fill
> drive).
>
> Thanks,
> JLW
> "Mike" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > are you getting an error message when you try to create the file on the
> > drive>?
> > "JLW" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I cannot get this to work correctly:
> > >
> > > File.Create("\\.\PHYSICALDRIVE0")
> > > or
> > > File.Create("\\.\Tape0")
> > >
> > >
> > > I've been searching for the better part of a week for this one.
> > >
> > > Thanks,
> > > JLW
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
JLW
Guest
Posts: n/a
 
      20th May 2004
With that, the handle comes back as -1 every time, regardless of what I
specify as the "file". I have seen this work under VB6, which is why it's
soo damned frustraiting that it can't be done under the framework.

Thanks,
JLW
"AlexS" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi, JLW
>
> you might need to use Win32 API CreateFile - see full description in
> Platform SDK help or on MSDN.
> I think .Net has some limitations, which files could be opened through
> standard framework methods.
>
> HTH
> Alex
>
> "JLW" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Actually, I'm trying to open the drive itself. I know it sounds crazy,

> but
> > I'm concentrating on the \\.\TAPE0 one first, so I can make a backup

> program
> > that won't cost me a few thousand bucks. The first one will return me a
> > handle, but for the TAPE0, I get no handle. I switched to using

File.Open
> > and that seems to help a bit. I want to be able top open the harddrive

at
> a
> > low level so that I can also make myself a low-level formatter

(Zero-Fill
> > drive).
> >
> > Thanks,
> > JLW
> > "Mike" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > are you getting an error message when you try to create the file on

the
> > > drive>?
> > > "JLW" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > I cannot get this to work correctly:
> > > >
> > > > File.Create("\\.\PHYSICALDRIVE0")
> > > > or
> > > > File.Create("\\.\Tape0")
> > > >
> > > >
> > > > I've been searching for the better part of a week for this one.
> > > >
> > > > Thanks,
> > > > JLW
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
AlexS
Guest
Posts: n/a
 
      20th May 2004
JLW,

how do you declare CreateFile?

Here is working sample - I tried it calling TF (@"\\.\PHYSICALDRIVE0") -
note @ before string and see function defnition below. I don't have tape -
ughhh!
Sample uses some prototypes from www.pinvoke.net - thank you guys!

public static int CREATE_NEW = 1;

public static int CREATE_ALWAYS = 2;

public static int OPEN_EXISTING = 3;

public static int OPEN_ALWAYS = 4;

public static int TRUNCATE_EXISTING = 5;


[DllImport("kernel32.dll", SetLastError=true)]

static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess,

uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition,

uint dwFlagsAndAttributes, IntPtr hTemplateFile);

[DllImport("kernel32.dll", SetLastError=true)]

static extern bool CloseHandle(IntPtr hObject);

private static void TF(string filename) {

IntPtr ptr = CreateFile(filename,0, 0,IntPtr.Zero, (uint)OPEN_EXISTING,0,
IntPtr.Zero);

/* Is bad handle? INVALID_HANDLE_VALUE */

if (ptr.ToInt32() == -1)

{

/* ask the framework to marshall the win32 error code to an exception */

Console.WriteLine(String.Format("{0}",Marshal.GetLastWin32Error()));

}

else

{

Console.WriteLine("Opened");

CloseHandle(ptr);

}

}

HTH
Alex

"JLW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> With that, the handle comes back as -1 every time, regardless of what I
> specify as the "file". I have seen this work under VB6, which is why it's
> soo damned frustraiting that it can't be done under the framework.
>
> Thanks,
> JLW
> "AlexS" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi, JLW
> >
> > you might need to use Win32 API CreateFile - see full description in
> > Platform SDK help or on MSDN.
> > I think .Net has some limitations, which files could be opened through
> > standard framework methods.
> >
> > HTH
> > Alex
> >
> > "JLW" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Actually, I'm trying to open the drive itself. I know it sounds

crazy,
> > but
> > > I'm concentrating on the \\.\TAPE0 one first, so I can make a backup

> > program
> > > that won't cost me a few thousand bucks. The first one will return me

a
> > > handle, but for the TAPE0, I get no handle. I switched to using

> File.Open
> > > and that seems to help a bit. I want to be able top open the

harddrive
> at
> > a
> > > low level so that I can also make myself a low-level formatter

> (Zero-Fill
> > > drive).
> > >
> > > Thanks,
> > > JLW
> > > "Mike" <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > > > are you getting an error message when you try to create the file on

> the
> > > > drive>?
> > > > "JLW" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > I cannot get this to work correctly:
> > > > >
> > > > > File.Create("\\.\PHYSICALDRIVE0")
> > > > > or
> > > > > File.Create("\\.\Tape0")
> > > > >
> > > > >
> > > > > I've been searching for the better part of a week for this one.
> > > > >
> > > > > Thanks,
> > > > > JLW
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
CJ Taylor
Guest
Posts: n/a
 
      21st May 2004
Though I'll probably never use this, did want to ask a question about the
tape drive and how it works with windows.

By using the UNC path to the tape drive does windows automatically take care
of all the IO functions(i.e. rewinding the tape, forwarding the tape to the
proper position). My knowledge on how tape drives actually work with the
system is rather limited, just wanted to know if that functionality was
already built into windows or not

Thanks,
CJ

"JLW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Actually, I'm trying to open the drive itself. I know it sounds crazy,

but
> I'm concentrating on the \\.\TAPE0 one first, so I can make a backup

program
> that won't cost me a few thousand bucks. The first one will return me a
> handle, but for the TAPE0, I get no handle. I switched to using File.Open
> and that seems to help a bit. I want to be able top open the harddrive at

a
> low level so that I can also make myself a low-level formatter (Zero-Fill
> drive).
>
> Thanks,
> JLW
> "Mike" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > are you getting an error message when you try to create the file on the
> > drive>?
> > "JLW" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I cannot get this to work correctly:
> > >
> > > File.Create("\\.\PHYSICALDRIVE0")
> > > or
> > > File.Create("\\.\Tape0")
> > >
> > >
> > > I've been searching for the better part of a week for this one.
> > >
> > > Thanks,
> > > JLW
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
JLW
Guest
Posts: n/a
 
      24th May 2004
Supposidly it is, but there's very little documentation on it, and the
Platform SDK really sucks on the subject.
I'm going to give another shot at it later today and will post back what
I've been able to figure out to date.

JLW
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:%(E-Mail Removed)...
> Though I'll probably never use this, did want to ask a question about the
> tape drive and how it works with windows.
>
> By using the UNC path to the tape drive does windows automatically take

care
> of all the IO functions(i.e. rewinding the tape, forwarding the tape to

the
> proper position). My knowledge on how tape drives actually work with the
> system is rather limited, just wanted to know if that functionality was
> already built into windows or not
>
> Thanks,
> CJ
>
> "JLW" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Actually, I'm trying to open the drive itself. I know it sounds crazy,

> but
> > I'm concentrating on the \\.\TAPE0 one first, so I can make a backup

> program
> > that won't cost me a few thousand bucks. The first one will return me a
> > handle, but for the TAPE0, I get no handle. I switched to using

File.Open
> > and that seems to help a bit. I want to be able top open the harddrive

at
> a
> > low level so that I can also make myself a low-level formatter

(Zero-Fill
> > drive).
> >
> > Thanks,
> > JLW
> > "Mike" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > are you getting an error message when you try to create the file on

the
> > > drive>?
> > > "JLW" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > I cannot get this to work correctly:
> > > >
> > > > File.Create("\\.\PHYSICALDRIVE0")
> > > > or
> > > > File.Create("\\.\Tape0")
> > > >
> > > >
> > > > I've been searching for the better part of a week for this one.
> > > >
> > > > Thanks,
> > > > JLW
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
CJ Taylor
Guest
Posts: n/a
 
      24th May 2004
Hey JLW,

Thanks for responding. Look forward to reading your findings.

-CJ

"JLW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Supposidly it is, but there's very little documentation on it, and the
> Platform SDK really sucks on the subject.
> I'm going to give another shot at it later today and will post back what
> I've been able to figure out to date.
>
> JLW
> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
> news:%(E-Mail Removed)...
> > Though I'll probably never use this, did want to ask a question about

the
> > tape drive and how it works with windows.
> >
> > By using the UNC path to the tape drive does windows automatically take

> care
> > of all the IO functions(i.e. rewinding the tape, forwarding the tape to

> the
> > proper position). My knowledge on how tape drives actually work with

the
> > system is rather limited, just wanted to know if that functionality was
> > already built into windows or not
> >
> > Thanks,
> > CJ
> >
> > "JLW" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Actually, I'm trying to open the drive itself. I know it sounds

crazy,
> > but
> > > I'm concentrating on the \\.\TAPE0 one first, so I can make a backup

> > program
> > > that won't cost me a few thousand bucks. The first one will return me

a
> > > handle, but for the TAPE0, I get no handle. I switched to using

> File.Open
> > > and that seems to help a bit. I want to be able top open the

harddrive
> at
> > a
> > > low level so that I can also make myself a low-level formatter

> (Zero-Fill
> > > drive).
> > >
> > > Thanks,
> > > JLW
> > > "Mike" <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > > > are you getting an error message when you try to create the file on

> the
> > > > drive>?
> > > > "JLW" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > I cannot get this to work correctly:
> > > > >
> > > > > File.Create("\\.\PHYSICALDRIVE0")
> > > > > or
> > > > > File.Create("\\.\Tape0")
> > > > >
> > > > >
> > > > > I've been searching for the better part of a week for this one.
> > > > >
> > > > > Thanks,
> > > > > JLW
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:04 AM.