• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * mcd.h
3  *
4  * Media changer driver interface
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #ifndef __MCD_H
24 #define __MCD_H
25 
26 #include "srb.h"
27 #include "scsi.h"
28 #include "ntddchgr.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #if defined(_MCD_)
35 #define CHANGERAPI
36 #else
37 #define CHANGERAPI DECLSPEC_IMPORT
38 #endif
39 
40 #ifdef DebugPrint
41 #undef DebugPrint
42 #endif
43 
44 #if DBG
45 #define DebugPrint(x) ChangerClassDebugPrint x
46 #else
47 #define DebugPrint(x)
48 #endif
49 
50 #define MAXIMUM_CHANGER_INQUIRY_DATA			252
51 
52 CHANGERAPI
53 PVOID
54 NTAPI
55 ChangerClassAllocatePool(
56   IN POOL_TYPE  PoolType,
57   IN ULONG  NumberOfBytes);
58 
59 VOID
60 ChangerClassDebugPrint(
61   ULONG  DebugPrintLevel,
62   PCCHAR  DebugMessage,
63   ...);
64 
65 CHANGERAPI
66 PVOID
67 NTAPI
68 ChangerClassFreePool(
69   IN PVOID  PoolToFree);
70 
71 CHANGERAPI
72 NTSTATUS
73 NTAPI
74 ChangerClassSendSrbSynchronous(
75   IN PDEVICE_OBJECT  DeviceObject,
76   IN PSCSI_REQUEST_BLOCK  Srb,
77   IN PVOID  Buffer,
78   IN ULONG  BufferSize,
79   IN BOOLEAN  WriteToDevice);
80 
81 
82 typedef NTSTATUS NTAPI
83 (*CHANGER_INITIALIZE)(
84   IN PDEVICE_OBJECT  DeviceObject);
85 
86 typedef ULONG NTAPI
87 (*CHANGER_EXTENSION_SIZE)(
88   VOID);
89 
90 typedef VOID NTAPI
91 (*CHANGER_ERROR_ROUTINE)(
92   PDEVICE_OBJECT  DeviceObject,
93   PSCSI_REQUEST_BLOCK  Srb,
94   NTSTATUS  *Status,
95   BOOLEAN  *Retry);
96 
97 typedef NTSTATUS NTAPI
98 (*CHANGER_COMMAND_ROUTINE)(
99   IN PDEVICE_OBJECT  DeviceObject,
100   IN PIRP  Irp);
101 
102 typedef NTSTATUS NTAPI
103 (*CHANGER_PERFORM_DIAGNOSTICS)(
104   IN PDEVICE_OBJECT  DeviceObject,
105   OUT PWMI_CHANGER_PROBLEM_DEVICE_ERROR  ChangerDeviceError);
106 
107 typedef struct _MCD_INIT_DATA {
108   ULONG  InitDataSize;
109   CHANGER_EXTENSION_SIZE  ChangerAdditionalExtensionSize;
110   CHANGER_INITIALIZE  ChangerInitialize;
111   CHANGER_ERROR_ROUTINE  ChangerError;
112   CHANGER_PERFORM_DIAGNOSTICS  ChangerPerformDiagnostics;
113   CHANGER_COMMAND_ROUTINE  ChangerGetParameters;
114   CHANGER_COMMAND_ROUTINE  ChangerGetStatus;
115   CHANGER_COMMAND_ROUTINE  ChangerGetProductData;
116   CHANGER_COMMAND_ROUTINE  ChangerSetAccess;
117   CHANGER_COMMAND_ROUTINE  ChangerGetElementStatus;
118   CHANGER_COMMAND_ROUTINE  ChangerInitializeElementStatus;
119   CHANGER_COMMAND_ROUTINE  ChangerSetPosition;
120   CHANGER_COMMAND_ROUTINE  ChangerExchangeMedium;
121   CHANGER_COMMAND_ROUTINE  ChangerMoveMedium;
122   CHANGER_COMMAND_ROUTINE  ChangerReinitializeUnit;
123   CHANGER_COMMAND_ROUTINE  ChangerQueryVolumeTags;
124 } MCD_INIT_DATA, *PMCD_INIT_DATA;
125 
126 CHANGERAPI
127 NTSTATUS
128 NTAPI
129 ChangerClassInitialize(
130   IN PDRIVER_OBJECT  DriverObject,
131   IN PUNICODE_STRING  RegistryPath,
132   IN PMCD_INIT_DATA  MCDInitData);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif /* __MCD_H */
139