IOCTL_TAPE_GET_ENCRYPTION_STATE
This IOCTL command queries the drive's encryption method and state.
The IOCTL code for IOCTL_TAPE_GET_ENCRYPTION_STATE is
defined as follows.
#define IOCTL_TAPE_GET_ENCRYPTION_STATE CTL_CODE(IOCTL_TAPE_BASE, 0x0820,
METHOD_BUFFERED, FILE_READ_ACCESS )
The IOCTL gets encryption states for supported devices by using
the following structure.
typedef struct _ENCRYPTION_STATUS
{
UCHAR ucEncryptionCapable; /* (1)Set this field as a boolean based on
the capability of the drive */
UCHAR ucEncryptionMethod; /* (2)Set this field to one of the
defines METHOD_* below */
UCHAR ucEncryptionState; /* (3)Set this field to one of the
#defines STATE_* below */
UCHAR aucReserved[13];
} ENCRYPTION_STATUS, *PENCRYPTION_STATUS;
#defines
for METHOD.#define ENCRYPTION_METHOD_NONE 0 /* Only used in
GET_ENCRYPTION_STATE */
#define ENCRYPTION_METHOD_LIBRARY 1 /* Only used in
GET_ENCRYPTION_STATE */
#define ENCRYPTION_ METHOD_SYSTEM 2 /* Only used in
GET_ENCRYPTION_STATE */
#define ENCRYPTION_ METHOD_APPLICATION 3 /* Only used in
GET_ENCRYPTION_STATE */
#define ENCRYPTION_ METHOD_CUSTOM 4 /* Only used in
GET_ENCRYPTION_STATE */
#define ENCRYPTION_ METHOD_UNKNOWN 5 /* Only used in
GET_ENCRYPTION_STATE */
#defines
for STATE.#define ENCRYPTION_STATE_OFF 0 /* Used in GET/SET_ENCRYPTION_STATE */
#define ENCRYPTION_STATE_ON 1 /* Used in GET/SET_ENCRYPTION_STATE */
#define ENCRYPTION_STATE_NA 2 /* Only used in GET_ENCRYPTION_STATE*/
An example of the IOCTL_TAPE_GET_ENCRYPTION_STATE command
is
ENCRYPTION_STATUS scEncryptStat;
DeviceIoControl(hDevice,
IOCTL_TAPE_GET_ENCRYPTION_STATE,
&scEncryptStat,
sizeof(ENCRYPTION_STATUS),
&scEncryptStat,
sizeof(ENCRYPTION_STATUS),
,&cb
(LPOVERLAPPED) NULL);