PureBasic Windows: Creating a virtual drive.
PureBasic Windows: Creating a virtual drive.
Is it possible to create a virtual drive with PureBasic, so it appears in Windows as a new drive with its own drive letter and I can handle the further stuff to insert in that virtual drive?
Thanks a bunch in advance.
fenyctis
Thanks a bunch in advance.
fenyctis
DefineDosDevice_() should do the trick as well.Effigy wrote:Just a correction the subst command is still available in 2000/XP

Anyway, in order to create real virtual drives you have to delve a little
deeper into driver development.
Microsoft provides a ramdisk sample driver containing sourcecode, don't
know if this helps (DDK needed).
On the other hand... driver development in PureBasic? Hmm...
Good programmers don't comment their code. It was hard to write, should be hard to read.
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
Is this what you are looking for? I have seen this described as a "virtual"
drive.
drive.
Code: Select all
NR.NETRESOURCE
LocalName.s = "Q:" ; Change to your desired device name
RemoteName.s = "\\TERRY\C:\PUREBASIC" ; Change to your desired path, local or remote
NR\dwType = #RESOURCETYPE_DISK
NR\lpLocalName = @LocalName
NR\lpRemoteName = @RemoteName
; Make the connection -------------------------------------
; ------ (ptr to NETRESOURCE structure, password, username, flag = 0 or #CONNECT_UPDATE_PROFILE)
If WNetAddConnection2_(@NR,"","",#Null) = #NO_ERROR
; Have a look... go on...
MessageRequester ("Cool!", "Go verify that the drive is now in My Computer" + Chr(10) + "Then come back and click OK", #MB_ICONINFORMATION)
Else
MessageRequester ("Drat!", "Couldn't connect -- check paths and/or network", #MB_ICONERROR)
EndIf
;
; Do whatever
;
; Remove assigned connection ------------------------------
; ------ (ptr to resource name, flag - 0 or #CONNECT_UPDATE_PROFILE, #TRUE (force disconnect) or #FALSE (fail if open files or jobs)
If WNetCancelConnection2_(@LocalName,0, #True) = #NO_ERROR
MessageRequester ("Cool!", "Disconnected successfully", #MB_ICONINFORMATION)
Else
MessageRequester ("Drat!", "Couldn't disconnect -- remove connection manually", #MB_ICONERROR)
EndIf
End
Hi fenyctis,
I really understand your question. I need the same thing to recognice what file a user try's to find on my drive and then react on my way (give him the file or an own generated error etc.). I will be able to generate the data that is returned by the filesystem.
The MS-example for the "ramdisk sample driver" postet by traumatic should be nearest of what we both want.
Kukulkan
I really understand your question. I need the same thing to recognice what file a user try's to find on my drive and then react on my way (give him the file or an own generated error etc.). I will be able to generate the data that is returned by the filesystem.
The MS-example for the "ramdisk sample driver" postet by traumatic should be nearest of what we both want.
Kukulkan
Theoretically easy, just write a file system driver. :roll:Kukulkan wrote:Hi fenyctis,
I really understand your question. I need the same thing to recognice what file a user try's to find on my drive and then react on my way (give him the file or an own generated error etc.). I will be able to generate the data that is returned by the filesystem.
The MS-example for the "ramdisk sample driver" postet by traumatic should be nearest of what we both want.
Kukulkan
i seem to recall a dll mentioned somewhere, that would provide such a device available from within a programming language... was it mentioned here on the forums?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
... but i am not the only one ... (John Lennon)
I have the same problem and saw the driver a long time ago, but i like to make a quick solution - it should WORK IN MEMORY.
Actual i have some ideas :
1. Make a FTP-Server and mount it in Windows (2000/XP/... in Explorer)
But this is only a Link and not availabel by File-Open.
2. Use my own FTP-Server and work with WebDrive.
But this costs monye for me and all they wont to use my software.
http://www.southrivertech.com/products/ ... index.html
3. Change the OS (or have a second PC) and use a new Linux with Fuse - Filesystem in Userspace
http://fuse.sourceforge.net/
there are some solutions (FTP also) and it is posible (may not for me) to make a own driver (direct connecting to a PB-App.)
It is a hard way.
4. Use http://www.acc.umu.se/~bosse/httpdisk-3.zip also on http://www.acc.umu.se/~bosse/
One minute ago i saw (maybe) the key for this
http://www.purebasic.fr/english/viewtop ... filesystem - 4. Thread
Hope someone can use a part of this (and will share his work).
Actual i have some ideas :
1. Make a FTP-Server and mount it in Windows (2000/XP/... in Explorer)
But this is only a Link and not availabel by File-Open.
2. Use my own FTP-Server and work with WebDrive.
But this costs monye for me and all they wont to use my software.
http://www.southrivertech.com/products/ ... index.html
3. Change the OS (or have a second PC) and use a new Linux with Fuse - Filesystem in Userspace
http://fuse.sourceforge.net/
there are some solutions (FTP also) and it is posible (may not for me) to make a own driver (direct connecting to a PB-App.)
It is a hard way.
4. Use http://www.acc.umu.se/~bosse/httpdisk-3.zip also on http://www.acc.umu.se/~bosse/
One minute ago i saw (maybe) the key for this
http://www.purebasic.fr/english/viewtop ... filesystem - 4. Thread
Hope someone can use a part of this (and will share his work).
Please pardon my English, my native tongue is German.