Einfach CDROM Laufwerk sperren?
Spoiler anzeigen
;Example
#include <WinAPI.au3>
Global $Drive = DriveGetDrive('CDROM')
If IsArray($Drive) Then
_WinAPI_LockDevice($Drive[1], 1)
MsgBox(0, '', 'The drive ' & StringUpper($Drive[1]) & ' is locked.')
_WinAPI_LockDevice($Drive[1], 0)
MsgBox(0, '', 'The drive ' & StringUpper($Drive[1]) & ' is unlocked.')
EndIf
Func _WinAPI_LockDevice($sDrive, $fLock)
;Yashied
Local $hFile = _WinAPI_CreateFileEx('\\.\' & $sDrive, 3, 0xC0000000, 0x03)
If Not $hFile Then
Return SetError(1, 0, 0)
EndIf
Local $tPREVENT_MEDIA_REMOVAL = DllStructCreate('byte')
DllStructSetData($tPREVENT_MEDIA_REMOVAL, 1, $fLock)
Local $Ret = DllCall('kernel32.dll', 'int', 'DeviceIoControl', 'ptr', $hFile, 'dword', 0x002D4804, 'ptr', DllStructGetPtr($tPREVENT_MEDIA_REMOVAL), 'dword', DllStructGetSize($tPREVENT_MEDIA_REMOVAL), 'ptr', 0, 'dword', 0, 'dword*', 0, 'ptr', 0)
If (@error) Or (Not $Ret[0]) Then
$Ret = 0
EndIf
_WinAPI_CloseHandle($hFile)
If Not IsArray($Ret) Then
Return SetError(2, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_LockDevice
Func _WinAPI_CreateFileEx($sFile, $iCreation, $iAccess, $iShare, $iFlagsAndAttributes = 0, $tSecurity = 0, $hTemplate = 0)
;Yashied
Local $Ret = DllCall('kernel32.dll', 'ptr', 'CreateFileW', 'wstr', $sFile, 'dword', $iAccess, 'dword', $iShare, 'ptr', DllStructGetPtr($tSecurity), 'dword', $iCreation, 'dword', $iFlagsAndAttributes, 'ptr', $hTemplate)
If (@error) Or ($Ret[0] = -1) Then
Return SetError(1, 0, 0)
EndIf
Return $Ret[0]
EndFunc ;==>_WinAPI_CreateFileEx
Dann hat sich das mit CD.
Das einzige was bleibt, ist ein USB Stick benutzen und dann halt das mit den Bytes einer .lnk File ändern, dass es ein Programm aufruft, das ginge auch noch (ist die Lücke noch vorhanden?).