comment ^
Module Name:
    ntdddisk.inc

Abstract:
    This is the include file that defines all common constants and types
    accessing the storage class drivers

Author:
    Four-F (four-f@mail.ru)

Last updated:
	07-July-2004
^

IFNDEF CTL_CODE
CTL_CODE MACRO DeviceType:=<0>, Function:=<0>, Method:=<0>, Access:=<0>
	EXITM %(((DeviceType) SHL 16) OR ((Access) SHL 14) OR ((Function) SHL 2) OR (Method))
ENDM
ENDIF

; begin_winioctl

IFNDEF _NTDDSTOR_H_
_NTDDSTOR_H_ equ 1

; IoControlCode values for storage devices

IOCTL_STORAGE_BASE equ FILE_DEVICE_MASS_STORAGE

; The following device control codes are common for all class drivers.  They
; should be used in place of the older IOCTL_DISK, IOCTL_CDROM and IOCTL_TAPE
; common codes

IOCTL_STORAGE_CHECK_VERIFY     equ CTL_CODE(IOCTL_STORAGE_BASE, 0200h, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_STORAGE_CHECK_VERIFY2    equ CTL_CODE(IOCTL_STORAGE_BASE, 0200h, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_STORAGE_MEDIA_REMOVAL    equ CTL_CODE(IOCTL_STORAGE_BASE, 0201h, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_STORAGE_EJECT_MEDIA      equ CTL_CODE(IOCTL_STORAGE_BASE, 0202h, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_STORAGE_LOAD_MEDIA       equ CTL_CODE(IOCTL_STORAGE_BASE, 0203h, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_STORAGE_LOAD_MEDIA2      equ CTL_CODE(IOCTL_STORAGE_BASE, 0203h, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_STORAGE_RESERVE          equ CTL_CODE(IOCTL_STORAGE_BASE, 0204h, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_STORAGE_RELEASE          equ CTL_CODE(IOCTL_STORAGE_BASE, 0205h, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_STORAGE_FIND_NEW_DEVICES equ CTL_CODE(IOCTL_STORAGE_BASE, 0206h, METHOD_BUFFERED, FILE_READ_ACCESS)

IOCTL_STORAGE_EJECTION_CONTROL equ CTL_CODE(IOCTL_STORAGE_BASE, 0250h, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_STORAGE_MCN_CONTROL      equ CTL_CODE(IOCTL_STORAGE_BASE, 0251h, METHOD_BUFFERED, FILE_ANY_ACCESS)

IOCTL_STORAGE_GET_MEDIA_TYPES  equ CTL_CODE(IOCTL_STORAGE_BASE, 0300h, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_STORAGE_GET_MEDIA_TYPES_EX equ CTL_CODE(IOCTL_STORAGE_BASE, 0301h, METHOD_BUFFERED, FILE_ANY_ACCESS)

IOCTL_STORAGE_RESET_BUS        equ CTL_CODE(IOCTL_STORAGE_BASE, 0400h, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_STORAGE_RESET_DEVICE     equ CTL_CODE(IOCTL_STORAGE_BASE, 0401h, METHOD_BUFFERED, FILE_READ_ACCESS)

IOCTL_STORAGE_GET_DEVICE_NUMBER equ CTL_CODE(IOCTL_STORAGE_BASE, 0420h, METHOD_BUFFERED, FILE_ANY_ACCESS)

IOCTL_STORAGE_PREDICT_FAILURE equ CTL_CODE(IOCTL_STORAGE_BASE, 0440h, METHOD_BUFFERED, FILE_ANY_ACCESS)

; end_winioctl


IOCTL_STORAGE_QUERY_PROPERTY   equ CTL_CODE(IOCTL_STORAGE_BASE, 0500h, METHOD_BUFFERED, FILE_ANY_ACCESS)


; begin_winioctl

; These ioctl codes are obsolete.  They are defined here to avoid resuing them
; and to allow class drivers to respond to them more easily.

OBSOLETE_IOCTL_STORAGE_RESET_BUS        equ CTL_CODE(IOCTL_STORAGE_BASE, 0400h, METHOD_BUFFERED, FILE_READ_ACCESS or FILE_WRITE_ACCESS)
OBSOLETE_IOCTL_STORAGE_RESET_DEVICE     equ CTL_CODE(IOCTL_STORAGE_BASE, 0401h, METHOD_BUFFERED, FILE_READ_ACCESS or FILE_WRITE_ACCESS)


; +
; IOCTL_STORAGE_GET_DEVICE_NUMBER
;
; input - none
;
; output - STORAGE_DEVICE_NUMBER structure
;          The values in the STORAGE_DEVICE_NUMBER structure are guaranteed
;          to remain unchanged until the system is rebooted.  They are not
;          guaranteed to be persistant across boots.
; -

STORAGE_DEVICE_NUMBER STRUCT

	; The FILE_DEVICE_XXX type for this device.

	DeviceType	DWORD	?	; DEVICE_TYPE

	; The number of this device

	DeviceNumber	DWORD	?

	; If the device is partitionable, the partition number of the device.
	; Otherwise -1

	PartitionNumber	DWORD	?
STORAGE_DEVICE_NUMBER ENDS
PSTORAGE_DEVICE_NUMBER typedef ptr STORAGE_DEVICE_NUMBER

ENDIF ; _NTDDSTOR_H_
; end_winioctl
