About EjectDiskFromSADrive function
Posted on 2004-10-28
i'd like a word or two about how to use this function EjectDiskFromSADrive.
I am trying to eject my cdrom drive simply using the following code, ALTHOUGH i am not really confident that i am doing it right.I'd like to know if this is the function to use to eject the cdrom and how to use it right.
DWORD ret = 0;
ret = EjectDiskFromSADrive( NULL, NULL, "\\.\\Cdrom0", NULL, NULL, NULL, NTMS_EJECT_FORCE );
case ERROR_ACCESS_DENIED: printf("NTMS_CONTROL_ACCESS to the library is denied. Other security errors are also possible, but they would indicate a security subsystem error."); break;
case ERROR_DATABASE_FAILURE: printf("The database is inaccessible or damaged."); break;
case ERROR_DATABASE_FULL: printf("The database is full."); break;
case ERROR_DEVICE_NOT_AVAILABLE: printf("The library is disabled."); break;
case ERROR_INVALID_HANDLE: printf("The session ID is invalid or missing."); break;
case ERROR_INVALID_OPERATION: printf("A stop was performed on an invalid operation ID."); break;
case ERROR_INVALID_PARAMETER: printf("A library ID or operation ID pointer is missing."); break;
case ERROR_LIBRARY_OFFLINE: printf("The library ID refers to an offline library that cannot eject media."); break;
case ERROR_MEDIA_NOT_AVAILABLE: printf("The media is disabled."); break;
case ERROR_NOT_ENOUGH_MEMORY: printf("There was an allocation failure during processing."); break;
case ERROR_SUCCESS: printf("The eject operation was successful."); break;
I always get the ERROR_INVALID_PARAMETER error.
I'd like some help. the msnd is not very helpful.