Jump to content











Photo
- - - - -

Is there a way to use ImDisk as Portable software


  • Please log in to reply
13 replies to this topic

#1 Cattleya

Cattleya
  • Members
  • 3 posts
  •  
    Vietnam

Posted 02 August 2013 - 02:04 PM

Hi all, I need help :)

 

I don't know if there is a way to use ImDisk without install.

 

It is better if I can just extract imdiskinst.exe and use ImDisk without installl ? Can I manual install ImDisk driver and manual uninstall without ImDisk Uninstaller ? I think if I can do that, it is possible to use ImDisk as Portable software.

 

But I don't know if after install ImDisk still left some registry key or not ? I want to know that because if this happen, I will manual clean it.

 

Some good information that I found:

 

Command line to install/uninstal ImDisk: lhttp://reboot.pro/to...nstall-revised/

ImDisk commandline: http://diddy.boot-la...iles/imdisk.htm

 

Hope I will have a choice, because no other RAMDisk software as portable as ImDisk, other RAMDisk software write a bunch of registry key to my system, still need restart to use, but ImDisk no need restart my system, very cool.

And I can use ImDisk without control panel, only command line is enough.

 

Thank!


Edited by Cattleya, 02 August 2013 - 02:14 PM.


#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 August 2013 - 02:29 PM

 

 

But I don't know if after install ImDisk still left some registry key or not ? I want to know that because if this happen, I will manual clean it.

Just take a snapshot of the Registry (on a machine/install where you NEVER installed imdisk before), install IMDISK manually (as per the info you found), take another snapshot, compare results, Regshot:

http://reboot.pro/to...rt-on-w7-64bit/

is a suitable tool for this.

 

 

:cheers:

Wonko



#3 Cattleya

Cattleya
  • Members
  • 3 posts
  •  
    Vietnam

Posted 02 August 2013 - 02:33 PM

Just take a snapshot of the Registry (on a machine/install where you NEVER installed imdisk before), install IMDISK manually (as per the info you found), take another snapshot, compare results, Regshot:

http://reboot.pro/to...rt-on-w7-64bit/

is a suitable tool for this.

 

 

:cheers:

Wonko

Thank you, I found all registry entry that can write to system in imdisk.inf file:

HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ImDisk", "DisplayName", 0, "ImDisk Virtual Disk Driver"
HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ImDisk", "UninstallString", 0, "rundll32.exe setupapi.dll,InstallHinfSection DefaultUninstall 132 %17%\imdisk.inf"
HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ImDisk", "DisplayIcon", 0, "%11%\imdisk.cpl"
HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ImDisk", "EstimatedSize", 65537, 320
HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ImDisk", "Size", 0, ""

HKCR, "*\shell\ImDiskMountFile", , 0, "Mount as ImDisk Virtual Disk"
HKCR, "*\shell\ImDiskMountFile\command", , 0, "rundll32.exe imdisk.cpl,RunDLL_MountFile %%L"

HKCR, "Drive\shell\ImDiskUnmount", , 0, "Unmount ImDisk Virtual Disk"
HKCR, "Drive\shell\ImDiskUnmount\command", , 0, "rundll32.exe imdisk.cpl,RunDLL_RemoveDevice %%L"

HKCR, "Drive\shell\ImDiskSaveImage", , 0, "Save disk contents as image file"
HKCR, "Drive\shell\ImDiskSaveImage\command", , 0, "rundll32.exe imdisk.cpl,RunDLL_SaveImageFile %%L"

No problem, I can play with it. Very easy with a few line of Autohotkey script. :)



#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 August 2013 - 03:45 PM

Thank you, I found all registry entry that can write to system in imdisk.inf file: 

No problem, I can play with it. Very easy with a few line of Autohotkey script. :)

Yes, but all of those can be (in your particular usage) be removed from the .inf file allright, as they are related to things that you don't *need*:

  • uninstall settings (unneeded if you manually uninstall with SC or similar and delete files)
  • shell settings (unneeded if you use just command line)

Those are "static" keys, written at install time (and useful for uninstalling) contained in the .inf.

 

A .exe may well - when running - write or delete/modify Registry keys.

 

The point was whether which keys are written:

  1. when you install it (manually, rest assured that keys are written to the Registry when a service is installed)
  2. when running it (if any)
  3. when mounting an image from command line (if any)

and which are deleted when you manually uninstall it (manually, rest assured that keys are deleted from the Registry when a service is ininstalled).

 

As said you *need* to compare two registry snapshot to be sure that noting is written in #2 and #3 and that everything that is written in #1 is deleted when uninstalling.

 

:cheers:

Wonko



#5 Cattleya

Cattleya
  • Members
  • 3 posts
  •  
    Vietnam

Posted 02 August 2013 - 04:58 PM

Yes, but all of those can be (in your particular usage) be removed from the .inf file allright, as they are related to things that you don't *need*:

  • uninstall settings (unneeded if you manually uninstall with SC or similar and delete files)
  • shell settings (unneeded if you use just command line)

Those are "static" keys, written at install time (and useful for uninstalling) contained in the .inf.

 

A .exe may well - when running - write or delete/modify Registry keys.

 

The point was whether which keys are written:

  1. when you install it (manually, rest assured that keys are written to the Registry when a service is installed)
  2. when running it (if any)
  3. when mounting an image from command line (if any)

and which are deleted when you manually uninstall it (manually, rest assured that keys are deleted from the Registry when a service is ininstalled).

 

As said you *need* to compare two registry snapshot to be sure that noting is written in #2 and #3 and that everything that is written in #1 is deleted when uninstalling.

 

:cheers:

Wonko

Thank you, I think registry is not my problem now, all registry key seem easy to remove after exit.

 

But now, I need to clear my idea, I think I can create RAMDisk without install ImDisk to my system just by extract imdiskinst.exe and then create RAM drive with command line "imdisk -a -s 400M -m R: -p "/fs:ntfs /q /y"" or something, is that right ?

Do I need to install driver like indisk.sys, awelloc.sys to make ImDisk work ? I how can I prepare that without using ImDisk installer ?

 

Many thank! :)



#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 August 2013 - 05:14 PM

But now, I need to clear my idea, I think I can create RAMDisk without install ImDisk to my system just by extract imdiskinst.exe and then create RAM drive with command line "imdisk -a -s 400M -m R: -p "/fs:ntfs /q /y"" or something, is that right ?

NO.
  
 
 

Do I need to install driver like indisk.sys, awelloc.sys to make ImDisk work ? I how can I prepare that without using ImDisk installer ?

Sure you need to install the IMDISK.SYS driver (the awealloc.sys will only be needed if you want to use awealloc ;)).
And you can install it like any other driver (with SC or similar tool):
http://ss64.com/nt/sc.html

I thought you were already familiar with manual driver/service installing, however:

http://reboot.pro/to...ly-using-scexe/
http://reboot.pro/to...sing-imdiskcpl/


:cheers:
Wonko
  • Cattleya likes this

#7 ITGabs

ITGabs
  • Members
  • 3 posts
  •  
    United States

Posted 07 March 2014 - 05:31 AM

Hi Cattleya and anyone,

 

I am testing the portable mode and this is what I have

 

I am using the version of 333,312 bytes imdiskinst 4.57.0.0??

 

in the same place of the imdiskinst.exe I have this newdisk.bat a small compressed one in y:

imdiskinst -y
imdisk -a -s 256M -m Y: -p "/fs:ntfs /q /y /c"

and this deletedisk.bat to delete the disk, delete the service and then uninstall

imdisk -D -m y:

sc stop ImDskSvc
sc query ImDskSvc
sc delete ImDskSvc

rundll32.exe setupapi.dll,InstallHinfSection DefaultUninstall 132 imdisk.inf

this works great but can be improved, this is just a small test part of a script to install portable apps and move temp and caches folders and etc.

 

First what I want to avoid is that message that the driver is ready.

Second to clean a bit about left overs I can get the snapshots of the disk and in regedit but I am interested more in that pop up



 

 



#8 cdob

cdob

    Gold Member

  • Expert
  • 1469 posts

Posted 08 March 2014 - 03:22 PM

First what I want to avoid is that message that the driver is ready.


Compare install.cmd inside imdiskinst.exe.

if not "%IMDISK_SILENT_SETUP%" == "1" msgbox

 
set IMDISK_SILENT_SETUP=1
imdiskinst.exe -y
imdisk.exe -a -s 256M -m Y: -p "/fs:ntfs /q /y /c"


#9 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 10 March 2014 - 05:40 PM

Hi Cattleya and anyone,

 

I am testing the portable mode and this is what I have

 

I am using the version of 333,312 bytes imdiskinst 4.57.0.0??

 

in the same place of the imdiskinst.exe I have this newdisk.bat a small compressed one in y:

imdiskinst -y
imdisk -a -s 256M -m Y: -p "/fs:ntfs /q /y /c"

and this deletedisk.bat to delete the disk, delete the service and then uninstall

imdisk -D -m y:

sc stop ImDskSvc
sc query ImDskSvc
sc delete ImDskSvc

rundll32.exe setupapi.dll,InstallHinfSection DefaultUninstall 132 imdisk.inf

this works great but can be improved, this is just a small test part of a script to install portable apps and move temp and caches folders and etc.

 

First what I want to avoid is that message that the driver is ready.

Second to clean a bit about left overs I can get the snapshots of the disk and in regedit but I am interested more in that pop up

 

 

The dialog box can be avoided by setting an environment variable prior to running imdiskinst.exe, as mentioned in the FAQ.

 

Also, regarding version numbers, I think you might be looking at the version number in imdiskinst.exe. That does not refer to the version of ImDisk but the version of the 7-zip self extracting installer.

 

In your case I would say that it would be reasonably easy to even skip the install script. You could make a simple check for existing ImDisk installations, for example checking for imdisk.sys in system32\drivers directory. Then, if needed, you could manually extract contents of imdiskinst.exe somewhere, run the .inf with rundll32.exe and use net start to load the driver.

 

Current versions of ImDisk also install an uninstall script uninstall_imdisk.cmd in system32 directory. That script could be used in non-interactive mode by setting the same environment variable as for the install.

 

However, you should also really do some kind of checking before uninstall. If you run your script on a machine where ImDisk is already installed, there is an obvious risk that you remove something that is in use, which could have all sorts of consequences including data loss. Run for example imdisk.exe -l to check for existing ImDisk drives before uninstall!



#10 ITGabs

ITGabs
  • Members
  • 3 posts
  •  
    United States

Posted 11 March 2014 - 08:10 AM

The dialog box can be avoided by setting an environment variable prior to running imdiskinst.exe, as mentioned in the FAQ.

 

Also, regarding version numbers, I think you might be looking at the version number in imdiskinst.exe. That does not refer to the version of ImDisk but the version of the 7-zip self extracting installer.

 

In your case I would say that it would be reasonably easy to even skip the install script. You could make a simple check for existing ImDisk installations, for example checking for imdisk.sys in system32\drivers directory. Then, if needed, you could manually extract contents of imdiskinst.exe somewhere, run the .inf with rundll32.exe and use net start to load the driver.

 

Current versions of ImDisk also install an uninstall script uninstall_imdisk.cmd in system32 directory. That script could be used in non-interactive mode by setting the same environment variable as for the install.

 

However, you should also really do some kind of checking before uninstall. If you run your script on a machine where ImDisk is already installed, there is an obvious risk that you remove something that is in use, which could have all sorts of consequences including data loss. Run for example imdisk.exe -l to check for existing ImDisk drives before uninstall!

 

Thanks Cdob and Olaf,

 

I was reading another posts and the source code too.

 

There is a problem about using the environment variable in XP SP3 for what I read in stackoverflow the problem is about the environment variables are loaded from the beginning of the script execution and is trespassed to all the child process and only will be available in a new process, using the SET in batch doesn't work neither I guess the set value is lost in some part probably when you implemented the wrapper wait*.exe.

 

After reboot in XP the new value is present in the system and in that way the installation goes without the message box, but If I delete that var and I start from zero like in a new computer is not possible in XP using the environment variables.

 

Any tip about the environment variables issue should be great because now I have a blocker bug and is quite complex, I am trying to move the TMP and TEMP folders to the new ramdisk.

Install imdisk portable -> create a imdisk -> setting TMP and TEMP into the new imdisk, moving (robocopy) portable apps into the imdisk and running some apps.

This is my "production laptop" a win 7 and sometimes the TMP and TEMP variables not change in the test, what I need to do is unblock and delete all the contents of the temp folders in C: (with unlocker) and later run the programs, in that way everything start to use the imdsik unit as temp, in this way I have a minimal amount of errors, sometimes skype got freeze but I am thinking is some crash related to the cache folders of the browsers that should be different than using the tmp or temp foder.

I have a SSD too so what I am doing is backup my ramdisk into the SSD using robocopy /MIR excluding any temp cache folder and later a backup of all my working stuff into a 32 GB SD card of 10mb/s ...quite slow but since there are not so many changes robocopy /mir do the job very fast every hour.

 

Still what is on the ramdisk is not so important and sometimes I am not writing back the changes into my SSD because I already have all my settings correctly loaded and saving outside the ram

 

That is principally what I am doing, I saw the possibility of share my full set of tools with some workmates changing ftp ssh and firefox credentials so they can connect directly into their accounts...

In parallel I am working in other scripts to integrate git and dropbox to sync and move things around, for my friends sound complex but for my is perfect to deploy fast and different work sets in wherever computer around the world, I have being traveling the last 5 years while working in security projects, I already lost many HDD, and some laptops and I only lost few personal things more about to be lazy to catalog my pictures or videos and where to backup.

The portable feature is more about follow a standard and left a minimal footprint in the systems that I use.

BTW thanks Olof for your development, I'll send you a small donation soon



#11 ITGabs

ITGabs
  • Members
  • 3 posts
  •  
    United States

Posted 11 March 2014 - 08:17 AM

I commented part of my script with some old code
I am not sure if there is any difference to SET IMDISK_SILENT_SETUP="1" or IMDISK_SILENT_SETUP=1

::start /B loadram.cmd
::this was a workaround installing the imdisk as default imdiskinst -y
::what I am doing is send the control to a new task in parallel or
::asynchronous so while in the next line imdiskinst -y will be installed
::loadram do a hide ping with (like a wait) so after finish the ping create
::the virtual ram, so the pop up box keep waiting while all the rest of my
::script keep running

::SET IMDISK_SILENT_SETUP="1"
::reg add HKCU\Environment /v IMDISK_SILENT_SETUP /d "1" /f

::I tried those commands and the behaviors are different in xp and 7
::In XP and 7 the set parameters go away in some part of the install
::In XP the new Environment setting will be loaded in the next reboot
::In 7 there is not need to reboot but I think I need to close all
::the open cmd bat that are running (inclusive others in the system)
::and after that the new environment setting will work
 
::imdiskinst -y

::at the end I uncompress the imdiskinst.exe in folder imdiskinst
::and this work in all the situations (no need of multitask)
cd imdiskinst
runwait.exe /64 /hide .\install.cmd
cd ../
loadram.cmd


#12 v77

v77

    Silver Member

  • Team Reboot
  • 602 posts
  •  
    France

Posted 11 March 2014 - 09:42 AM

I commented part of my script with some old code
I am not sure if there is any difference to SET IMDISK_SILENT_SETUP="1" or IMDISK_SILENT_SETUP=1

::start /B loadram.cmd
::this was a workaround installing the imdisk as default imdiskinst -y
::what I am doing is send the control to a new task in parallel or
::asynchronous so while in the next line imdiskinst -y will be installed
::loadram do a hide ping with (like a wait) so after finish the ping create
::the virtual ram, so the pop up box keep waiting while all the rest of my
::script keep running

::SET IMDISK_SILENT_SETUP="1"
::reg add HKCU\Environment /v IMDISK_SILENT_SETUP /d "1" /f

::I tried those commands and the behaviors are different in xp and 7
::In XP and 7 the set parameters go away in some part of the install
::In XP the new Environment setting will be loaded in the next reboot
::In 7 there is not need to reboot but I think I need to close all
::the open cmd bat that are running (inclusive others in the system)
::and after that the new environment setting will work
 
::imdiskinst -y

::at the end I uncompress the imdiskinst.exe in folder imdiskinst
::and this work in all the situations (no need of multitask)
cd imdiskinst
runwait.exe /64 /hide .\install.cmd
cd ../
loadram.cmd

 

There is some errors in your commented code:

- SET IMDISK_SILENT_SETUP="1" is incorrect, you have to remove the quotes because in every case, an environment variable contains only a string, so you are storing here a string with quotes. You can see that by typing set in a command prompt after to have defined the variable.

- reg add HKCU\Environment /v IMDISK_SILENT_SETUP /d "1" /f
This store permanently the variable in the system. This should be not necessary...

 

- imdiskinst -y
The -y switch is useless because it is not transmitted through the SFX module of 7-Zip.

That said, you are right about the fact that IMDISK_SILENT_SETUP is not transmitted to the script of imdiskinst.exe. So, the content of imdiskinst.exe must be first extracted. Perhaps Olof could find a way to fix that...

A minimalist way to get a "portable" ImDisk would be to extract imdisk.sys, imdisk.cpl and imdisk.exe from the i386 folders (for a 32-bit system), and then run the following commands from the current directory:
sc create ImDisk binPath= "%CD%\imdisk.sys" type= kernel
sc start ImDisk

Then, you should be able to use imdisk.exe to create a simple static ramdisk.
But with that (and with using imdiskinst.exe), the driver is registered in the system (in the registry). So, after unmounting your ImDisk volumes, if you also want to remove the driver, you have to use the command
sc delete ImDisk
Note that the sc command is available starting from Windows XP. I am not sure to understand all you want to do, but it seems that you really should take a closer look at the help of the sc command.

You can also replace sc start ImDisk by net start ImDisk. The main difference is that the net command works synchronously. This means that net waits that the service is fully started, while sc just sends a command to start the service without waiting anything.



#13 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 11 March 2014 - 10:50 AM

There is some errors in your commented code:

- SET IMDISK_SILENT_SETUP="1" is incorrect, you have to remove the quotes because in every case, an environment variable contains only a string, so you are storing here a string with quotes. You can see that by typing set in a command prompt after to have defined the variable.

- reg add HKCU\Environment /v IMDISK_SILENT_SETUP /d "1" /f
This store permanently the variable in the system. This should be not necessary...
 
- imdiskinst -y
The -y switch is useless because it is not transmitted through the SFX module of 7-Zip.


The -y switch is needed to omit the initial confirmation dialog shown by 7-Zip SFX module.
 

That said, you are right about the fact that IMDISK_SILENT_SETUP is not transmitted to the script of imdiskinst.exe. So, the content of imdiskinst.exe must be first extracted. Perhaps Olof could find a way to fix that...


I had never heard about that before and probably I did not test it on that particular Windows version where it does not work. There is usually the /i switch to start command, to have cmd.exe copy the original environment block to the child process, instead of the block used within the currently running cmd.exe. Question is, what environment block gets copied into child processes of cmd.exe in the case where this variable value is not transferred to ImDisk install script? The original block to cmd.exe, just like when using start /i on other versions? Is this why "ITGabs" tried "reg add" and similar tricks?
 
I wonder if there is some way to write a small program that takes a parameter, sets that parameter as an environment variable and then launches another program. That would work, but it would need to be distributed outside imdiskinst.exe because otherwise the problem has happened when cmd.exe launches imdiskinst.exe...
 
But anyway, all inventive attempts to solve this feel largely overkill. Especially considered that, like I wrote in earlier posts, all that needs to be done is extracting contents of imdiskinst.exe and lunching .inf file using rundll32.exe. Or, like you mentioned, register the driver using sc.exe. But that requires some logic to pick files for the right machine architecture, which is done automatically in the case of the .inf file.
 

A minimalist way to get a "portable" ImDisk would be to extract imdisk.sys, imdisk.cpl and imdisk.exe from the i386 folders (for a 32-bit system), and then run the following commands from the current directory:
sc create ImDisk binPath= "%CD%\imdisk.sys" type= kernel
sc start ImDisk

Then, you should be able to use imdisk.exe to create a simple static ramdisk.
But with that (and with using imdiskinst.exe), the driver is registered in the system (in the registry). So, after unmounting your ImDisk volumes, if you also want to remove the driver, you have to use the command
sc delete ImDisk
Note that the sc command is available starting from Windows XP. I am not sure to understand all you want to do, but it seems that you really should take a closer look at the help of the sc command.
You can also replace sc start ImDisk by net start ImDisk. The main difference is that the net command works synchronously. This means that net waits that the service is fully started, while sc just sends a command to start the service without waiting anything.


The difference between synchronous and asynchronous loading only applies to services. Drivers cannot be loaded asynchronously. So in this case, there is no difference.

#14 v77

v77

    Silver Member

  • Team Reboot
  • 602 posts
  •  
    France

Posted 11 March 2014 - 11:32 AM

The -y switch is needed to omit the initial confirmation dialog shown by 7-Zip SFX module.

 

Ah yes, you're right. :)

And IMDISK_SILENT_SETUP indeed works with that switch.
It seems I was confused because I am using another SFX module... Thanks for your rectifications.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users