Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to enable/disable autorun without reboot?


4 replies to this topic

gronchi

gronchi
  • Members
  • 71 posts

Posted 13 February 2003 - 09:19

Hi to all,
I wish enable/disable CDRom autorun feature inside my setup's script.
And I wish to do that without force the user to reboot the machine.
Microsoft Knowledge Base say:

///
How to Enable or Disable Automatically Running CD-ROMs
(This article was previously published under Q155217)

...

There is no option to enable or disable automatically running CD-ROMs in the user interface. To enable or disable automatically running CD-ROMs, you must edit the registry:

1.
Click Start, click Run, type regedit in the Open box, and then press ENTER.

2.
Locate and click the following registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\CDRom

3.
To disable automatically running CD-ROMs, change the Autorun value to 0 (zero). To enable automatically running CD-ROMs, change the Autorun value to 1.

4.
Restart your computer.

...
///

Is there a no-reboot way to do that?
Maybe turning to some API function or other?


Thanks.
Ciao, Giuseppe

Perotin

Perotin
  • Full Members
  • 407 posts

Posted 13 February 2003 - 14:44

Did you try to manipulate the value with installscript and test, if the behaviour is different?
Do you want to insert a second cd? If yes, why do you add autorun.inf to it?
Do you want to restart while the cd is still in the drive? If yes, why do you look for a way without reboot? ...

Please tell more about the way you want to act and the os to react.

btw: another way to manipulate the autorun settings is to use a different key:

translated from german winfaq:
Quote

HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ Policies\ Explorer
or
HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Windows\ CurrentVersion\ Policies\ Explorer

value "NoDriveTypeAutoRun", data type REG_DWORD
manipulate the first Byte to set autorun for devices

the devices are coded bitwise

bit  value   function
0    1        (1) all unknown devices deactivated  
1    1        (2) unknown
2    1        (4) fdd and other changeable devices deactivated
3    1        (8) hdd deactivated
4    1        (16) network drives deactivated
5    1        (32) cdrom deactivated
6    1        (64) ram disk deactivated
7    1        (128) reserved

default is hex 95 (dec 149:  1+4+16+128 = 149).  

examples
95      Autorun.inf is run automatically with cdrom
B5      Autorun.inf is run on cdrom and hdd
00      autorun.inf is run on all drives (even fdd)
FF      Autorun.inf is run on no devices
FD      autostart is deactivated

hth :)


Gruß / regards
Thomas

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 13 February 2003 - 16:19

I know it can be done without a reboot because I've seen other software packages do it on-the-fly.
user posted image

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 13 February 2003 - 16:49

You'll find some information here:

http://msdn.microsof...rary....tro.asp

The optimal solution would be to handle the message that Windows broadcasts before it starts to autoplay the CD. Unfortunately that's not possible inside your script. I believe you would have to launch an exe for this purpose.

The alternative - if you create the CD - would be to use a autorun program that wuld simply do nothing and exit immediately if your setup is running. (You can find such a program here on InstallSite in section Realted Tools -> CD Autorun)

gronchi

gronchi
  • Members
  • 71 posts

Posted 18 February 2003 - 08:45

>Please tell more about the way you want to act and the os to react.

I built a IS project (just script work, no groups, components or other) install itself onto a machine. Then when I run it it drives the user to copy all CDRom setup he had into a web setup' repository (allow him to perform, in the future, a sort of web installation/update). Don't ask me why I choose InstallShield to do that...
So when user insert our old CDRom setup (with autorun) I need it don't start because that isn't the install-time but it's only the time to copy the CDRom setup under a web server. I also wish the user didn't reboot his machine!
I hope it's quite clear despite my poor english, anyway if you want other information I'm here.

Following is the answer Damien Carbery give me on official InstallShield forum:

http://community.ins...wthr....=111043

What do you think?
Next days I'll study his precious suggestion

Ciao,
Giuseppe