Jump to content











Photo
- - - - -

ImDisk Registry Configuration Help


  • Please log in to reply
6 replies to this topic

#1 wpe

wpe
  • Members
  • 3 posts
  •  
    United States

Posted 02 January 2012 - 09:01 AM

First of all, thank you for created and maintaining such a great software!

I am new to ImDisk, and really had a hard time to get the auto start/mount working. I read some posts, and figured out that modifying registry should be an easy way. However, it seems not true.

I need two ram disks, one starts with a blank ntfs disk (maybe with an existing \temp directory), and the other loads an existing image. I thought these should be pretty common requests; but it's really hard to find a good example.

I later found the faq and how-to page, http://reboot.pro/15593/. However, I don't really know how to deal with the windows scheduler (comparing with regedit, which is more direct to me).

My troubles are:
1. the blank ntfs disk. I can have the disk auto mounted by modifying the registry. However, the disk is not formatted. So far, I haven't figure out how to do it with the registry parameters. I read the imdisk.h file, and I cannot figure out which flag could help.

2. loading an image. I now have it working (with help from a post). However, I still don't understand why "\??\" is needed in front of the image path. It's not mentioned in the post, http://reboot.pro/2072/page__st__22, which explains all parameters.

Besides asking for helps (auto format disk with registry setting), I have following questions and requests:
1. Is there a better documentation or example for the registry configuration (like the faq/how-to page )?

2. Can someone explain the flags defined in the imdisk.h? Some of the flags are straight; but some are not for me. Examples would be the best so users would know when to set a particular flag. For example, when to set IMDISK_PROXY_TYPE_SHM and when to use IMDISK_PROXY_TYPE_DIRECT.

3. For any of the flag, is it true that ImDisk can always select the proper one if no flag is specified? For example, if I did not specify the IMDISK_PROXY_TYPE_xxx flag, does it imply IMDISK_PROXY_TYPE_DIRECT or something implied from the other parameters?

4. In the Control Panel GUI menu, there is an option, "Copy image file to memory". Is there a corresponding configuration in the registry or not? If not, will the feature be added or not?

5. Registry vs. windows scheduler. Which method is preferred? Which one loads the disk first?

6. If windows scheduler is the only way to format the auto-mounted disk, then can someone give a little more helps? (for example, trigger should be "at start up").

Thank you in advance for your time and helps!!! & Happy New Year!!!

#2 Olof Lagerkvist

Olof Lagerkvist

    Silver Member

  • Developer
  • 819 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 02 January 2012 - 11:54 AM

First of all, thank you for created and maintaining such a great software!

I am new to ImDisk, and really had a hard time to get the auto start/mount working. I read some posts, and figured out that modifying registry should be an easy way. However, it seems not true.

I need two ram disks, one starts with a blank ntfs disk (maybe with an existing \temp directory), and the other loads an existing image. I thought these should be pretty common requests; but it's really hard to find a good example.

I later found the faq and how-to page, http://reboot.pro/15593/. However, I don't really know how to deal with the windows scheduler (comparing with regedit, which is more direct to me).

My troubles are:
1. the blank ntfs disk. I can have the disk auto mounted by modifying the registry. However, the disk is not formatted. So far, I haven't figure out how to do it with the registry parameters. I read the imdisk.h file, and I cannot figure out which flag could help.


ImDisk driver cannot format disks so there is no registry setting for that. You need to either use a formatted image file and load that onto the RAM disk using registry settings for that, or use Wndows Scheduler approach instead.

2. loading an image. I now have it working (with help from a post). However, I still don't understand why "\??\" is needed in front of the image path. It's not mentioned in the post, http://reboot.pro/2072/page__st__22, which explains all parameters.


The "\??\" prefix is needed because registry settings are read directly by the driver in kernel mode so it needs Windows kernel compatible paths. There is no translation routine available in kernel mode for example for translating C:\file.img to \??\C:\file.img.

Besides asking for helps (auto format disk with registry setting), I have following questions and requests:
1. Is there a better documentation or example for the registry configuration (like the faq/how-to page )?


No, sorry, registry settings are not used that much. I had some ideas about registry settings in the past, but since it turned out quite hard to implement these things directly in the driver and because also most people find Windows Scheduler and similar approaches a lot easier to deal with and command line tool is frequently needed anyway, priority has been targeting scheduled command lines instead. That is also why there are many more examples of that. It would also be a quite large amount of work to implement everything that the command line tool does into the driver. Many API functions the command line tools uses are simply not available in kernel mode and need completely different approaches, etc.

There are however a few more explanations here: http://reboot.pro/4807/

2. Can someone explain the flags defined in the imdisk.h? Some of the flags are straight; but some are not for me. Examples would be the best so users would know when to set a particular flag. For example, when to set IMDISK_PROXY_TYPE_SHM and when to use IMDISK_PROXY_TYPE_DIRECT.


Flags are better explained in their context, in my opinion. They are used for many different tasks and would just look to complicated if explained all together. You should only use a flag if you know what it is for. In your example here, IMDISK_PROXY_TYPE_SHM indicates proxy communication through a IPC protected shared memory block while IMDISK_PROXY_TYPE_DIRECT indicates proxy communication directly through a named pipe (image file name is then taken as name of named pipe to use).

3. For any of the flag, is it true that ImDisk can always select the proper one if no flag is specified? For example, if I did not specify the IMDISK_PROXY_TYPE_xxx flag, does it imply IMDISK_PROXY_TYPE_DIRECT or something implied from the other parameters?


Yes, pretty much. If you don't use any of the IMDISK_PROXY_TYPE_xxx flags and specify IMDISK_TYPE_PROXY, then IMDISK_PROXY_TYPE_DIRECT is used.

For some flags you will of course need to tell ImDisk what you want by actually specifying the flag. For example when mounting a CD/DVD image through a proxy. Then there is no way for ImDisk to automatically find out that this is a CD/DVD image and that a virtual CD/DVD-ROM drive should be created. Another example is when you want to load an image file onto a RAM disk. If you specify an image file name without flags, then that image file is mounted directly. If you want to create a RAM disk the size of the image file and copy image file contents to that RAM disk, you need to specify IMDISK_TYPE_VM.

4. In the Control Panel GUI menu, there is an option, "Copy image file to memory". Is there a corresponding configuration in the registry or not? If not, will the feature be added or not?


Just specify an image file name and flags for creating a RAM disk at the same time.

5. Registry vs. windows scheduler. Which method is preferred? Which one loads the disk first?


I would say none is "preferred" over the other. Depends on what you want to do. The registry settings are loaded when the driver loads. If driver is set to demand start it will load when you create a virtual disk through Control Panel applet or command line tool or when you type "net start imdisk". If you set driver to auto-load it will load at system startup along with reading registry settings. That will practically happen a little bit earlier in startup process than Windows Scheduler tasks, but the exact order depends on service/driver dependencies etc.

6. If windows scheduler is the only way to format the auto-mounted disk, then can someone give a little more helps? (for example, trigger should be "at start up").


Windows 2000, XP, Server 2003:
Control Panel -> Scheduled Tasks -> Add Scheduled Task. Select Next. Browse for C:\Windows\system32\imdisk.exe and select it and then click next. Select "When my computer starts". Type "system" as user name and leave password fields blank. Tick "Open advanced properties..." and click Finish. Complete command line in "Run" field with parameters you would like to use, for example change to c:\windows\system32\imdisk.exe -a -s 300M -m R: -p "/fs:ntfs /q /y" or something like that. Click ok.

Windows 7 and Server 2008:
Open Administrative Tools -> Task Scheduler. Click "Create basic task" on right pane. Type a name, for example "create RAM disk". Click next. Tick "When computer starts" and click next. Select "Start a program" and click next. Browse for c:\windows\system32\imdisk.exe and select it so that is appears in program/script box. In "add arguments" box you should type command line arguments only (excluding exe file itself). So, for same example as above it should be: -a -s 300M -m R: -p "/fs:ntfs /q /y" (or whatever settings you like). Click next. If you want to run your task as local system account (to make sure it gets permissions to do all tasks) you can tick a box on next page to open properties for your new task and change user settings from there. Click Change user or group and type system and ok. Tick "Run with highest privileges" and ok.

Thank you in advance for your time and helps!!! & Happy New Year!!!


Same! :cheers:

#3 wpe

wpe
  • Members
  • 3 posts
  •  
    United States

Posted 02 January 2012 - 07:41 PM

Thank you, Olof!!! With your comments, I am now very happy with the ImDisk :clap: . I attached my registry below and wish it could be helpful for new comers.

Explanation of the registry:
LoadDevices, number of disk drive to be loaded automatically at start. Here, my setting is 2, Drive A, and Drive B.

Drive A is a 1G cache area, I plan to put all temporary files, and will be cleared after power cycle. In order to do that, I made an image file "C:ToolsdiskA.img" to hold the drive template (with the proper directory structure I need).

DriveLetter0, the drive letter for the first disk, I choose A.
FileName0, the path to the image file. Don't forget the leading "??".
Flags0, as Olof suggested, it sets the disk type to be IMDISK_TYPE_VM.
Size0, size of the disk, 1G. Right now, my image file size is also 1G. According to my understanding of other posts, the image file don't have to be same size. I'll do some tests on this.

Drive B, is a 2.5G disk to hold my frequently used tools, which will involve lots of disk I/O. Changes to this disk will be saved to the image file so that next boot still has the changes.
DriveLetter1, the drive letter for the second disk, I choose B.
FileName1, the path to the image file. Don't forget the leading "??".
Size1, size of the disk, 2.5G. According to the other posts, the size may be lager than the size of the image. I would expect I can increase size later safely.
No Flag1 is needed.

#4 Olof Lagerkvist

Olof Lagerkvist

    Silver Member

  • Developer
  • 819 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 02 January 2012 - 08:00 PM

Thank you, Olof!!! With your comments, I am now very happy with the ImDisk :clap: . I attached my registry below and wish it could be helpful for new comers.

Explanation of the registry:


Thanks for using ImDisk and thanks for putting together this list.

No Flag1 is needed.


I suspect you may have misunderstood something here. If you do not specify any flag at all in Flag1 you will not get a RAM disk. ImDisk will just directly mount the image file you have specified. Did you intend to actually load the image file onto a RAM disk? Use IMDISK_TYPE_VM (value 200 hex) flag in that case. Then use some kind of synchronization method if you want to save RAM disk contents before you dismount the RAM disk.

#5 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1,568 posts
  •  
    American Samoa

Posted 02 January 2012 - 08:42 PM

Olof,

Its amazing, what kind of comprehensive support you consistently provide for ImDisk! :clapping:

#6 wpe

wpe
  • Members
  • 3 posts
  •  
    United States

Posted 02 January 2012 - 09:54 PM

Thanks for using ImDisk and thanks for putting together this list.



I suspect you may have misunderstood something here. If you do not specify any flag at all in Flag1 you will not get a RAM disk. ImDisk will just directly mount the image file you have specified. Did you intend to actually load the image file onto a RAM disk? Use IMDISK_TYPE_VM (value 200 hex) flag in that case. Then use some kind of synchronization method if you want to save RAM disk contents before you dismount the RAM disk.


Yes, you are right. I tested, and without the flags, the image is not loaded to ram. IMDISK_TYPE_VM flag is needed. Then, is there a way or will ImDisk add the feature to do autosave or autosave at exit?


In case the picture is not posted, the exported registry is:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesImDiskParameters]
"LoadDevices"=dword:00000002
"Size0"=hex(B):00,00,00,40,00,00,00,00
"DriveLetter0"="A"
"FileName1"="??C:ToolsdiskB.img"
"DriveLetter1"="B"
"Size1"=hex(B):00,00,00,a0,00,00,00,00
"FileName0"="??C:ToolsdiskA.img"
"Flags0"=dword:00000200
"Flags1"=dword:00000200


#7 Olof Lagerkvist

Olof Lagerkvist

    Silver Member

  • Developer
  • 819 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 02 January 2012 - 11:58 PM

Yes, you are right. I tested, and without the flags, the image is not loaded to ram. IMDISK_TYPE_VM flag is needed. Then, is there a way or will ImDisk add the feature to do autosave or autosave at exit?


There have been some discussions about a save-on-exit service here:
http://reboot.pro/15177/

Could be included some time when finished. There are also many script solutions available in various places using robocopy or other sync tools for synchronizing RAM disk with original image file. I myself prefer in most cases to schedule some kind of script that mounts original image file temporarily and uses robocopy to synchronize RAM disk with this mounted original image file.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users