Solved

possible to make a ramdrive using c.

Posted on 2004-04-18
7
214 Views
Last Modified: 2010-04-15
is it possible to create a ramdrive using c that can be used in dos or windows.
if so then how?

thanks
ico2
0
Comment
Question by:ico2
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Expert Comment

by:ankuratvb
Comment Utility
>create a ramdrive...

Can you please elaborate.
0
 
LVL 1

Author Comment

by:ico2
Comment Utility
how can i get a program to allocate space in the memory to be treated as a hard disk???
0
 
LVL 9

Expert Comment

by:ankuratvb
Comment Utility
Both a hard disk and your RAM are hardware devices.

If you want persistent storage,you can use files and store them on the hard disk.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 7

Expert Comment

by:aib_42
Comment Utility
ico2,

It is possible indeed. A ramdrive, very briefly, is a disk driver that acts as though it were using a real device, only using system memory for storage.

However, creating a ramdrive for DOS and for Windows are quite different problems. Well, maybe not.
Here's the catch: Microsoft's RAMDRIVE.SYS, which originally came with DOS, as you know is a good example of a ramdrive driver (hmm?), but it does not work with 2000+. Obviously, any driver code you wrote for Windows 2k and beyond would not work in DOS.

If you are looking to write a ramdrive for Windows 2k and beyond, here is a good sample driver with source from MS itself:
http://download.microsoft.com/download/win2000ddk/sample01/1/NT5/EN-US/Ramdisk.exe

A ramdrive for DOS wouldn't probably be too long as in lines of code, or even too hard if you have a good DOS documentation.

For Windows 95/98/ME... well, try and see if MS's drive above works.
0
 
LVL 9

Expert Comment

by:ankuratvb
Comment Utility
Is this something like virtual memory?
If that is the case,would it be persistent?
0
 
LVL 1

Author Comment

by:ico2
Comment Utility
i need this to work in ms-dos mostly but it would be useful to get it to work in win98 as well.
how do i use ramdrive.sys?

ankuratvb: it is the opposite of virtual memory.
0
 
LVL 7

Accepted Solution

by:
aib_42 earned 20 total points
Comment Utility
The RAMDRIVE.SYS is basically a DOS device driver (which works in 98 btw), so you have to put something like the following in your CONFIG.SYS file:

DEVICE=C:\WINDOWS\COMMAND\RAMDRIVE.SYS <size>

The actual syntax is:
DEVICE=[drive:][\path\]RAMDRIVE.SYS [Disk_size [Sector_size [Num_entries]]] [/A | /E]
as can be noted in
http://users.cybercity.dk/~bse26236/batutil/help/RAMDRI_S.HTM
and
http://www.lagmonster.org/docs/DOS7/v-ramdrive-sys.html

I forgot to mention, MS's ramdrive has a 32MB size limitation (32767 is the max for the "size" parameter), but there are plenty of alternatives around (Going on www.simtel.net and typing "ramdisk" in the upper right search box reveals about 10)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now