Does any one know how to "lock" the CD-ROM drive. Or is there a way to disable Autoplay feature and re-enable it later?
Posted on 2001-04-20 16:39:00 by brewmanchu
If you have Win98, Go to the Device Manager, Select the CD Drive and look at its Properties. Uncheck Auto insert notification.
Posted on 2001-04-20 18:30:00 by anon
Just for 411: There is a file on the CD appropriately called tells Windows what to do when the CD is inserted. An excellent way to break a restricted shell, I might add too ;-) *unknown*
Posted on 2001-04-20 18:44:00 by *unknown*
What I was really asking is if you can do it programmatically.Is there some API or message to use that will disallow the drive from opening? Or intercept a message like "drive is opening" and to tell it to clode before it actually opens?
Posted on 2001-04-20 20:29:00 by brewmanchu
brewmanchu, Yes there is a way to do that, I don't know how yet, I have seen it done many times. I have been in programs that install from CD's and I have removed and reinserted the disk and it did not auto run while there program was running, win95/98/ME is a good example while intalling drivers windows sometimes will ask for the windows CD, you insert it and it does not autorun. so keep searching as well as I am. don't let anyone tell you it can't be done. I just figure if someone says it can't be done, when I have seen it done, it just means they don't know eather. good luck and if I find it I will post it here... sorry I did not help any.. I was just looking for the same I have gotten "NO-CAN-DO" from most people.
Posted on 2001-04-20 20:51:00 by Zcoder
im not sure how this is done either but one approach is to somehow progammically disable the eject button. it definetly can be done though. ill keep an eye out for something. smurf
Posted on 2001-04-20 21:09:00 by smurf
Sorry about the tease. Here is some info from the SDK that should get you started.
Suppressing AutoRun Programmatically There are a variety of situations where AutoRun may need to be suppressed programmatically. Two examples are: Your application has a setup program that requires the user to insert another disc that may contain an Autorun.inf file. During the operation of your application, the user may need to insert another disc that may contain an Autorun.inf file. In either case, you will normally not want to launch another application while the original is in progress. Users can manually suppress AutoRun by holding down the SHIFT key when they insert the CD-ROM. However, it is usually preferable to handle this operation programmatically rather than depending on the user. With systems that have shell version 4.70 and later, Microsoft® Windows® sends a "QueryCancelAutoPlay" message to the foreground window. Your application can respond to this message to suppress AutoRun. This approach is used by system utilities such as the Open common dialog box to disable AutoRun. You will not get a "QueryCancelAutoPlay" message with versions of Windows 95 that do not have the Internet Explorer 4.0 integrated shell installed. The following code fragments illustrate how to set up and handle this message. Your application must be running in the foreground window. First, register "QueryCancelAutoPlay" as a Windows message: uMessage = RegisterWindowMessage(TEXT("QueryCancelAutoPlay")); Your application's window must be in the foreground to receive this message. The message handler should return TRUE to cancel AutoRun and FALSE to enable it. The following code fragment illustrates how to use this message to disable AutoRun. UINT g_uQueryCancelAutoPlay = 0; LRESULT WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { ... default: if (!g_uQueryCancelAutoPlay) { g_uQueryCancelAutoPlay = RegisterWindowMessage(TEXT("QueryCancelAutoPlay")); } if (uMsg && uMsg == g_uQueryCancelAutoPlay) { return TRUE; // cancel auto-play } } } If your application is using a dialog box and needs to respond to a "QueryCancelAutoPlay" message, it cannot simply return TRUE or FALSE. Instead, call SetWindowLong with nIndex set to DWL_MSGRESULT. Set the dwNewLong parameter to TRUE to cancel AutoRun, and FALSE to enable it. For example, the following sample dialog procedure cancels AutoRun when it receives a "QueryCancelAutoPlay" message. UINT g_uQueryCancelAutoPlay = 0; BOOL DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { ... default: if (!g_uQueryCancelAutoPlay) { g_uQueryCancelAutoPlay = RegisterWindowMessage(TEXT("QueryCancelAutoPlay")); } if (uMsg == g_uQueryCancelAutoPlay) { SetWindowLong(hDlg, DWL_MSGRESULT, TRUE); return 1; } } } Using the Registry to Disable AutoRun There are two registry values that can be used to persistently disable AutoRun: NoDriveAutoRun and NoDriveTypeAutoRun. The first value disables AutoRun for specified drive letters and the second disables AutoRun for a class of drives. If either of these values is set to disable AutoRun for a particular device, it will be disabled. Note: The NoDriveAutoRun and NoDriveTypeAutoRun values should only be modified by system administrators to change the value for the entire system for testing or administrative purposes. Applications should not modify these values, as there is no way to reliably restore them to their original values. The NoDriveAutoRun value disables AutoRun for specified drive letters. It is a REG_DWORD data value, found under the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer key. The first bit of the value corresponds to A:, the second to B:, and so on. To disable AutoRun f
Posted on 2001-04-20 22:16:00 by anon
Thanks muchly! I have been looking and looking.. just not in the right places. This will work just fine for my prog. This message was edited by brewmanchu, on 4/22/2001 9:34:36 AM
Posted on 2001-04-22 09:33:00 by brewmanchu