It is currently Sun Oct 20, 2019 2:53 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Mounting a Virtual Disk
PostPosted: Wed Apr 27, 2005 12:19 pm 
Offline
User
User

Joined: Sat Apr 26, 2003 5:49 am
Posts: 51
Well i was looking for some kind of virtual disk when i found Virtul Bin.
Its very nice but i found another thing that i think it can be very usefull.
I was wondering if some one is interested in porting this to Purebasic?

Heres the link's
http://www.acc.umu.se/~bosse/
or if you whant to download
http://www.acc.umu.se/~bosse/filedisk.zip

then just run this to make a small empty file on your hard disk.

Code:
Procedure makeSparse(Filename.s, FileSize.l)
  Protected FileHandle.l
  Protected ReturnValue.l
  FileHandle = CreateFile(#PB_Any, Filename)
  If ( FileHandle <> 0 )
    FileSeek(FileSize - 1)
    WriteByte(0)
    CloseFile(FileHandle)
  Else
    ReturnValue = -1
  EndIf
  ProcedureReturn ReturnValue
EndProcedure

makeSparse("C:\Test.txt", 30*1024*1024) ; 30 Mbytes


After that just install the downloaded software reboot your computer and mount the File Disk.

This will add a new disk (virtual) to your windows expolorer.

The only problem is that i can only test on NTFS, i don't have any FAT Operating System to test it on.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 3:28 pm 
Offline
User
User

Joined: Sat Apr 26, 2003 5:49 am
Posts: 51
Did Anyone saw or tried this???


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 4:15 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 25, 2003 8:39 pm
Posts: 225
Looks very interesting. Gonna check it out the next days.

_________________
Athlon64 3800+ · 1 GB RAM · Radeon X800 XL · Win XP Prof/SP1+IE6.0/Firefox · PB 3.94/4.0
Intel Centrino 1.4 MHz · 1.5 GB RAM · Radeon 9000 Mobility · Win XP Prof/SP2+IE6.0/Firefox · PB 3.94/4.0


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 8:12 pm 
Offline
User
User

Joined: Sat Apr 26, 2003 5:49 am
Posts: 51
Thanks, as i said i would like to port this do purebasic, i think its very usefull.

You can make something like a secure and protected disk using password and encryptation.

Or just use it to store files something like VBin ( Not a Replacement ), its easy to import/export Files.

It has several uses.

But i need help on this, my knoledge of C or C++ is almost none.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 9:39 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:34 pm
Posts: 912
Location: Canada
Hi ShDancer,

I haven't tried the virtual disk thing but I did notice that your little procedure is not the correct way to create a sparce file.

Example, use this command to call your procedure:
Code:
makeSparse("test1.txt", 100*1024*1024)


Then check the properties of the created file...
Size: 100 MB (104,857,600 bytes)
Size on Disk: 100 MB (104,857,600 bytes)


Now try this procedure:
Code:
#FSCTL_SET_SPARSE=$900C4

Procedure MKSparce(FileName.s,FileSize)
  hFile=CreateFile_(FileName,#GENERIC_READ|#GENERIC_WRITE,#FILE_SHARE_READ|#FILE_SHARE_WRITE,0,#CREATE_NEW,#FILE_FLAG_NO_BUFFERING,0)
  If FileHandle<>#INVALID_HANDLE_VALUE
    If DeviceIoControl_(hFile,#FSCTL_SET_SPARSE,0,0,0,0,@Bytes,0)
      If SetFilePointer_(hFile,FileSize,0,#FILE_BEGIN)
        SetEndOfFile_(hFile)
        Result=1
      EndIf
    EndIf
    CloseHandle_(hFile)
  EndIf
  ProcedureReturn Result
EndProcedure


And use this command to call the new procedure:
Code:
MKSparse("test2.txt", 100*1024*1024)


Check the file size of the new file...
Size: 100 MB (104,857,600 bytes)
Size on Disk: 16 KB (16,384 bytes) <--- 16KB !!!


A true sparce file makes the OS think it is 100MB total but actually takes up only 16kb on the hard drive. Much more efficient if there is only a small amount of data stored in it when it's being used as a virtual disk. :)

_________________
Image Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 23, 2005 8:17 pm 
Offline
User
User

Joined: Sat Apr 26, 2003 5:49 am
Posts: 51
Thanks in advance for the reply Paul.

Did anyone try it?
Just 10 min and one reboot. (Well more or less :) )

Until today i was involved in a project in my company
and didn't had time for pb, so now i'm free to continue
this little utility.

Can someone help me porting this to pb?
I don't understand much of C or C++ Language.

I think it could be usefull, for the comunity.

Thanks once more.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 24, 2005 11:39 am 
Offline
User
User
User avatar

Joined: Fri Oct 31, 2003 3:04 pm
Posts: 97
Hi,
I've ported to PB and re-designed filedisk (only C) into this little example:

http://purebasic.myftp.org/?filename=fi ... TCData.zip

Regards,
JOAQUIN


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 24, 2005 4:39 pm 
Offline
User
User

Joined: Wed Apr 14, 2004 2:32 am
Posts: 20
Location: Grand Rapids, MI
The zip file seems to be corrupt. Could you repost?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 24, 2005 4:58 pm 
Offline
User
User
User avatar

Joined: Fri Oct 31, 2003 3:04 pm
Posts: 97
The zip file is correct, but I've changed the case in URL. Sorry.

Try this:

http://purebasic.myftp.org/?filename=fi ... TCdata.zip

JOAQUIN


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 24, 2005 5:49 pm 
Offline
User
User

Joined: Wed Apr 14, 2004 2:32 am
Posts: 20
Location: Grand Rapids, MI
Thanks, seems to work for me now.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 07, 2005 5:19 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 02, 2005 3:55 am
Posts: 501
Location: U.S.A.
Wow, thanks for sharing! I am going to go through and try this out over the next few days.

Have you two (or anyone else for that matter) gotten around to encrypting the data in the virtual drive? How about hiding the virtual drive (or can you do that with this code, I'll have to read through the file)?

Thanks for sharing!

*thumbs up*

_________________
Intrigued - Registered PureBasic, lifetime updates user


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 07, 2005 5:36 pm 
Offline
User
User
User avatar

Joined: Fri Oct 31, 2003 3:04 pm
Posts: 97
Hi,
About encryption, see:

http://www.scherrer.cc/crypt/

I've NOT TESTED it.

JOAQUIN


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 07, 2005 6:39 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 02, 2005 3:55 am
Posts: 501
Location: U.S.A.
jqn wrote:
Hi,
About encryption, see:

http://www.scherrer.cc/crypt/

I've NOT TESTED it.

JOAQUIN


Thanks for the link. I see that Win9x/ME is not supported. Here's what I would need:

Win98SE/ME/2000/XP

and...

I would prefer the use of 448-bit Blowfish. The product I have out now uses 448-bit Blowfish for encryption and thus my marketing compaign can be on the same level, when I tout comments like "448-bit Blowfish encryption used! Stronger than the standard SSL connection!", or something to that effect.

I do appreciate the quick post though and offer!

_________________
Intrigued - Registered PureBasic, lifetime updates user


Top
 Profile  
Reply with quote  
 Post subject: Re: Mounting a Virtual Disk
PostPosted: Mon Aug 05, 2019 5:16 am 
Offline
Addict
Addict
User avatar

Joined: Sun Mar 07, 2004 8:47 am
Posts: 1857
Location: Argentina
Sorry to revive this old thread but I was wondering if someone still had a copy of TCdata.zip since the URL is down. Seemed to be hosted by jqn's home ftp server through a freeddns account which has been down/inactive for a while.

In case nobody has it, are there any alternative solutions for Windows currently?

The original mentioned code in http://www.acc.umu.se/~bosse/ can be found (latest version) here: http://www.acc.umu.se/~bosse/filedisk/filedisk-21.zip

Thanks in advance.

_________________
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye