Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

345 lines
9.1 KiB

  1. //////////////////////////////////////////////////////////////////
  2. // ioReadyMin.h
  3. //
  4. // The include file for minimum IomegaReady 3.0.
  5. //
  6. // Copyright (C) 1998 Iomega Corp.
  7. //
  8. //////////////////////////////////////////////////////////////////
  9. #ifndef __iomegaReady_h__
  10. #define __iomegaReady_h__
  11. #if defined(macintosh) || defined(_MAC)
  12. #define IOREADY_MAC 1
  13. #define IOREADY_WIN 0
  14. #endif
  15. #if defined(_WIN32) || defined(_MSC_VER)
  16. #define IOREADY_MAC 0
  17. #define IOREADY_WIN 1
  18. #endif
  19. #ifdef DllInterface
  20. #undef DllInterface
  21. #endif
  22. #if IOREADY_WIN
  23. #ifndef _WINDOWS_
  24. #pragma message ( __FILE__ ": error: include <windows.h> before including \"ioReadyMin.h\"")
  25. #endif // _WINDOWS_
  26. #ifdef __Building_iomegaReady_Dll__
  27. #define DllInterface __declspec( dllexport )
  28. #define STRICT 1
  29. #elif defined __Building_iomegaReady_Lib__
  30. #define DllInterface
  31. #define STRICT 1
  32. bool InitializeIoReady();
  33. #elif defined __Using_iomegaReady_Lib__
  34. #define DllInterface
  35. bool InitializeIoReady();
  36. #else
  37. #define DllInterface __declspec( dllimport )
  38. #endif
  39. #pragma warning(disable:4786) // disable function name truncation warning
  40. #pragma warning(disable:4251) // disable dll interface warning
  41. #else // IOREADY_MAC
  42. #define DllInterface
  43. #endif // IOREADY_WIN/IOREADY_MAC block
  44. #if IOREADY_MAC
  45. typedef UInt32 CRITICAL_SECTION;
  46. typedef PicHandle HBITMAP;
  47. typedef Handle HICON;
  48. typedef Handle HANDLE;
  49. typedef RGBColor COLORREF;
  50. typedef HFileInfo WIN32_FIND_DATA;
  51. typedef void* LPVOID;
  52. typedef bool BOOL;
  53. typedef UInt8 BYTE;
  54. typedef UInt16 WORD;
  55. typedef UInt32 DWORD;
  56. typedef UInt64 QWord;
  57. #define MAX_PATH 32
  58. extern void InitializeCriticalSection(CRITICAL_SECTION*);
  59. extern void DeleteCriticalSection(CRITICAL_SECTION*);
  60. extern void EnterCriticalSection(CRITICAL_SECTION*);
  61. extern void LeaveCriticalSection(CRITICAL_SECTION*);
  62. #endif // IOREADY_MAC
  63. #pragma pack( push, ioReadyPack, 8 )
  64. //////////////////////////////////////////////////////////////////
  65. // ioReady namespace
  66. //
  67. namespace ioReady {
  68. //////////////////////////////////////////////////////////////////
  69. // forward class declarations
  70. //
  71. class DllInterface Drive;
  72. class DllInterface Disk;
  73. class DllInterface Adapter;
  74. class DriveImp;
  75. class DiskImp;
  76. class CoreOSImp;
  77. class AdapterInfo;
  78. /////////////////////////////////////////////////////////////////
  79. // constants for ioReady
  80. //
  81. const int ct_nMaxFamilyLength = 128; // max for family description strings
  82. const int ct_nSerialNumberLength = 19; // min needed for getMediaSerialNumber, includes space for NULL
  83. const int ct_nExtendedSerialNumberLength = 41;
  84. // min needed for getExtendedMediaSerialNumber, includes space for NULL
  85. const int ct_nMaxAdapterAttributes = 3; // current max number of attributes
  86. const int ct_nAdapterAttributeLength = 64; // min needed for getAttribute strings
  87. //////////////////////////////////////////////////////////////////
  88. // Enumerations
  89. //
  90. // Any drives added must be added as bit flags
  91. // Enumed this way so the DriveArray, etc objects can take as argument
  92. // Future use Iomega value is now 0x00E0
  93. //
  94. enum EDriveFamily
  95. {
  96. eAnyFamily = 0xFFFF,
  97. eIomegaFamily = 0x00FF,
  98. eInvalidFamily = 0x0000,
  99. eZip = 0x0001,
  100. eJaz = 0x0002,
  101. eClik = 0x0004,
  102. ePacifica = 0x0008,
  103. eOtherIomegaFamily = 0x0010,
  104. eFloppyFamily = 0x0100,
  105. eHardDriveFamily = 0x0200,
  106. eCDRomFamily = 0x0400,
  107. eNetworkFamily = 0x0800,
  108. eGenericFamily = 0x1000,
  109. eRemovableFamily = 0x2000,
  110. eRamFamily = 0x4000,
  111. eIomegaCDFamily = 0x8000
  112. };
  113. enum EDriveSubFamily
  114. {
  115. eInvalidSubFamily=0, eZip100=1, eZip250=2, eJaz1=3,
  116. eJaz2=4, eClik40=5, ePacifica2=6, eOtherIomegaSubFamily=7,
  117. eHardDriveSubFamily=8, eRemovableSubFamily=9, eFloppySubFamily=10,
  118. eCDRomSubFamily=11, eNetworkSubFamily=12, eGenericSubFamily=13,
  119. eRamSubFamily=14, eIomegaCDSubFamily=15
  120. };
  121. enum EDriveModel
  122. {
  123. eInvalidModel=0, eZip100Plus=1, eZip100Scsi=2,
  124. eZip100PPort=3, eZip100Atapi=4, eZip100IDE=5, eJaz1Scsi=6,
  125. eJaz2Scsi=7, eClik40Atapi=8, ePacifica2GScsi=9, eOtherIomegaModel=10,
  126. eHardDriveModel=11, eRemovableModel=12, eFloppyModel=13, eCDRomModel=14,
  127. eNetworkModel=15, eGenericModel=16, eZip250PPort=17, eZip250Scsi=18,
  128. eZip250Atapi=19, eRamModel=20, eClik40PPort=21, eZip100Usb=22,
  129. eZipCDModel=23, eClik40PCCard=24, eZip250Usb=25, eZip250PCCard=26,
  130. eClik40USB = 27
  131. };
  132. enum EMediaType
  133. {
  134. eInvalidDisk=0, eNoDiskInserted=1, eZip100Disk=2,
  135. eJaz1Disk=3, eJaz2Disk=4, eHardDisk=5, eNetworkDisk=6, eFloppyDisk=7,
  136. eRemovableDisk=8, eCDRomDisk=9, eGenericDisk=10, eOtherIomegaDisk=11,
  137. eZip250Disk=12, eClik40Disk=13, ePacifica2GDisk=14, eRamDisk=15,
  138. eZipCDDisk=16, ePacifica1GDisk=17
  139. };
  140. enum EAdapter
  141. {
  142. eUnknownAdapter=0, eParallelPort=1, eScsi=2, eAtapi=3, eIDE=4, eUSB=5, e1394=6, ePCCard=7
  143. };
  144. //////////////////////////////////////////////////////////////////
  145. // error enums
  146. //
  147. enum EError
  148. {
  149. eNoError =0, eNotImplemented=1, eNotApplicable=2, eNoDisk=3,
  150. eWrongDiskType=4, eNotFormatted=5, eReadWriteProtectedError=6, eWriteProtectedError=7,
  151. eDiskErrorReading=8, eDiskErrorWriting=9, eOSLockAlreadyOnDisk=10,
  152. eDriveInUse=11, eCritical=12, eQuickVerifyFormatNotAllowed=13,
  153. eSurfaceVerifyFormatNotAllowed=14, eNeedsSurfaceVerifyFormat=15, eStringLengthExceeded=16,
  154. eLowMemory=17, eCannotDelete=18, eCannotMakeRemovable=19,
  155. eUserCancel=20, eInvalidStateChange=21, eIncorrectPassword=22,
  156. eOutOfRange=23, ePasswordRequired=24, eNotRemovable=25,
  157. ePasswordTooLong=26, eProtected=27, eSystemDisk=28, eBootDisk=29,
  158. eUnableCopySystemFiles=30, eUnableLabelVolume=31, eIssueFormatFailed=32,
  159. eFormatInProgress=33, eInvalidParameter=34, eEjectInProgress=35
  160. };
  161. //////////////////////////////////////////////////////////////////
  162. // Drive class
  163. //
  164. class DllInterface Drive
  165. {
  166. public:
  167. Drive( int drvNum );
  168. Drive( char c );
  169. ~Drive();
  170. // identification functions
  171. int getDrvNum();
  172. bool isIomegaDrive();
  173. bool isIomegaCDDrive();
  174. // more identification functions
  175. EDriveFamily getFamily();
  176. EDriveSubFamily getSubFamily();
  177. EDriveModel getModel();
  178. const char *getFamilyText( );
  179. const char *getSubFamilyText( );
  180. const char *getModelText( );
  181. // disk functions
  182. bool hasDisk();
  183. Disk& getDisk();
  184. protected:
  185. DriveImp* m_pImp;
  186. private:
  187. // helper function for constructors
  188. void create( int drvNum );
  189. void createIomegaDrive( CoreOSImp *pCore );
  190. void createIomegaDrive( CoreOSImp *pCore, char *szInquiry );
  191. void createNonIomegaDrive( CoreOSImp *pCore );
  192. Drive &operator=( const Drive &drive); // no assignment operator
  193. Drive( const Drive & ); // no copy constructor
  194. };
  195. //////////////////////////////////////////////////////////////////
  196. // DiskIface class
  197. // Interface only, not exported, pure virtual class
  198. //
  199. class DllInterface DiskIface
  200. {
  201. public:
  202. // disk identification functions
  203. virtual EMediaType getMediaType() = 0;
  204. virtual const char *getMediaSerialNumber() = 0;
  205. };
  206. //////////////////////////////////////////////////////////////////
  207. // Disk class
  208. //
  209. class DllInterface Disk : public DiskIface
  210. {
  211. public:
  212. ~Disk();
  213. // disk identification functions
  214. EMediaType getMediaType();
  215. const char *getMediaSerialNumber( ); // unique serial number
  216. const char *getExtendedMediaSerialNumber(); // longer unique serial number
  217. protected:
  218. // user accesses through getDisk()
  219. Disk( DriveImp *pDriveImp );
  220. private:
  221. // state functions
  222. void updateDiskPresence();
  223. void updateDiskIdentity();
  224. DriveImp *m_pDriveImp;
  225. DiskImp *m_pImp;
  226. Disk &operator=( const Disk &disk); // no assignment operator
  227. Disk( const Disk & ); // no copy constructor
  228. friend class DriveImp;
  229. };
  230. //////////////////////////////////////////////////////////////////
  231. // Adapter class
  232. //
  233. class AttribListImp;
  234. class DllInterface Adapter
  235. {
  236. public:
  237. virtual ~Adapter();
  238. EAdapter getType();
  239. const char *getName( );
  240. const char *getMiniportDriverName( );
  241. virtual bool getAttribute( int index, char *szLabel, char *szValue, int nLength );
  242. virtual int getAttributeCount();
  243. static Adapter *createAdapter( EAdapter eType, AdapterInfo& attrib );
  244. protected:
  245. // user access Adapter through getAdapter call
  246. Adapter( EAdapter eAdapter, const char *szName );
  247. virtual void initializeAttributes();
  248. EAdapter m_eType;
  249. char *m_pszName;
  250. char *m_pszMiniportDriverName;
  251. AttribListImp *m_pAttribList;
  252. bool m_bAttrInitialized;
  253. private:
  254. Adapter& operator=( const Adapter& adapter); // no assignment operator
  255. Adapter( const Adapter& ); // no copy constructor
  256. friend void Drive::createIomegaDrive( CoreOSImp *pCore );
  257. friend class DriveImp;
  258. };
  259. //////////////////////////////////////////////////////////////////
  260. // ScsiAdapter class
  261. //
  262. class DllInterface ScsiAdapter : public Adapter
  263. {
  264. public:
  265. int getScsiId();
  266. protected:
  267. // user access Adapter through getAdapter call
  268. ScsiAdapter( EAdapter eAdapter, const char *szName, int nScsiId );
  269. virtual void initializeAttributes();
  270. private:
  271. int m_nScsiId;
  272. friend class Adapter;
  273. };
  274. } // end of ioReady namespace
  275. #pragma pack( pop, ioReadyPack )
  276. #endif // __iomegaReady_h__