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.

1022 lines
37 KiB

  1. // scardssp.idl : IDL source for scardssp.dll
  2. //
  3. // This file will be processed by the MIDL tool to
  4. // produce the type library (scardssp.tlb) and marshalling code.
  5. cpp_quote("//+-------------------------------------------------------------------------")
  6. cpp_quote("//")
  7. cpp_quote("// Microsoft Smart Card Support")
  8. cpp_quote("// Copyright (C) Microsoft Corporation, 1996 - 1999")
  9. cpp_quote("//")
  10. cpp_quote("//")
  11. cpp_quote("// File: scardssp.h")
  12. cpp_quote("//")
  13. cpp_quote("//--------------------------------------------------------------------------")
  14. cpp_quote("")
  15. cpp_quote("//////////////////////////////////////////////////////////////////")
  16. cpp_quote("//")
  17. cpp_quote("// Imports")
  18. cpp_quote("//")
  19. #ifndef DO_NO_IMPORTS
  20. import "oaidl.idl";
  21. import "ocidl.idl";
  22. #endif
  23. cpp_quote("")
  24. cpp_quote("//////////////////////////////////////////////////////////////////")
  25. cpp_quote("//")
  26. cpp_quote("// Interface declarations")
  27. cpp_quote("//")
  28. interface IByteBuffer;
  29. interface ISCardTypeConv;
  30. interface ISCardCmd;
  31. interface ISCardISO7816;
  32. interface ISCard;
  33. interface ISCardDatabase;
  34. interface ISCardLocate;
  35. cpp_quote("")
  36. cpp_quote("//////////////////////////////////////////////////////////////////")
  37. cpp_quote("//")
  38. cpp_quote("// Types and Constants")
  39. cpp_quote("//")
  40. cpp_quote("#ifndef _NULL_DEFINED")
  41. cpp_quote("#define _NULL_DEFINED")
  42. #define NULL 0
  43. cpp_quote("#endif // !_NULL_DEFINED")
  44. cpp_quote("#ifndef _BYTE_DEFINED")
  45. cpp_quote("#define _BYTE_DEFINED")
  46. typedef [public] unsigned char BYTE;
  47. cpp_quote("#endif // !_BYTE_DEFINED")
  48. cpp_quote("#ifndef _LPBYTE_DEFINED")
  49. cpp_quote("#define _LPBYTE_DEFINED")
  50. typedef [public] BYTE *LPBYTE;
  51. cpp_quote("#endif // !_LPBYTE_DEFINED")
  52. cpp_quote("#ifndef _LPCBYTE_DEFINED")
  53. cpp_quote("#define _LPCBYTE_DEFINED")
  54. typedef [public] const BYTE *LPCBYTE;
  55. cpp_quote("#endif // !_LPCBYTE_DEFINED")
  56. cpp_quote("#ifndef _HSCARD_DEFINED")
  57. cpp_quote("#define _HSCARD_DEFINED")
  58. typedef [public] ULONG_PTR HSCARD;
  59. cpp_quote("#endif // !_HSCARD_DEFINED")
  60. cpp_quote("#ifndef _LPHSCARD_DEFINED")
  61. cpp_quote("#define _LPHSCARD_DEFINED")
  62. typedef [unique] HSCARD *PHSCARD;
  63. typedef [unique] HSCARD *LPHSCARD;
  64. cpp_quote("#endif // !_LPHSCARD_DEFINED")
  65. cpp_quote("#ifndef _HSCARDCONTEXT_DEFINED")
  66. cpp_quote("#define _HSCARDCONTEXT_DEFINED")
  67. typedef [public] ULONG_PTR HSCARDCONTEXT;
  68. cpp_quote("#endif // !_HSCARDCONTEXT_DEFINED")
  69. cpp_quote("#ifndef _LPHSCARDCONTEXT_DEFINED")
  70. cpp_quote("#define _LPHSCARDCONTEXT_DEFINED")
  71. typedef [unique] SHCARDCONTEXT *PHSCARDCONTEXT;
  72. typedef [unique] SHCARDCONTEXT *LPHSCARDCONTEXT;
  73. cpp_quote("#endif // !_LPHSCARDCONTEXT_DEFINED")
  74. cpp_quote("#ifndef _BYTEARRAY_DEFINED")
  75. cpp_quote("#define _BYTEARRAY_DEFINED")
  76. typedef [helpstring("Helpful byte array."),
  77. //uuid(),
  78. //helpcontext(),
  79. version(1.0)]
  80. struct tagBYTEARRAY {
  81. HGLOBAL hMem;
  82. DWORD dwSize;
  83. [size_is(dwSize)] LPBYTE pbyData;
  84. } BYTEARRAY;
  85. cpp_quote("#define _CB_BYTEARRAY_DEFINED")
  86. cpp_quote("#define CB_BYTEARRAY (sizeof(BYTEARRAY))")
  87. cpp_quote("#define _PBYTEARRAY_DEFINED")
  88. typedef [public] BYTEARRAY *PBYTEARRAY;
  89. cpp_quote("#define _PCBYTEARRAY_DEFINED")
  90. typedef [public] const BYTEARRAY *PCBYTEARRAY;
  91. cpp_quote("#define _LPBYTEARRAY_DEFINED")
  92. typedef [public] BYTEARRAY *LPBYTEARRAY;
  93. cpp_quote("#define _LPCBYTEARRAY_DEFINED")
  94. typedef [public] const BYTEARRAY *LPCBYTEARRAY;
  95. cpp_quote("#endif // _BYTEARRAY_DEFINED")
  96. cpp_quote("#ifndef _STATSTRUCT")
  97. cpp_quote("#define _STATSTRUCT")
  98. typedef [helpstring("Stream status structure."),
  99. //uuid(),
  100. //helpcontext(),
  101. version(1.0)]
  102. struct tagSTATSTRUCT {
  103. LONG type;
  104. LONG cbSize;
  105. LONG grfMode;
  106. LONG grfLocksSupported;
  107. LONG grfStateBits;
  108. } STATSTRUCT;
  109. cpp_quote("#define _CB_STATSTRUCT_DEFINED")
  110. cpp_quote("#define CB_STATSTRUCT (sizeof(STATSTRUCT))")
  111. cpp_quote("#define _LPSTATSTRUCT_DEFINED")
  112. typedef [public] STATSTRUCT* LPSTATSTRUCT;
  113. cpp_quote("#endif // _STATSTRUCT_DEFINED")
  114. cpp_quote("#ifndef _ISO_APDU_TYPE")
  115. cpp_quote("#define _ISO_APDU_TYPE")
  116. typedef [helpstring("ISO 7816-4 APDU Case types."),
  117. //uuid(),
  118. //helpcontext(),
  119. version(1.0)]
  120. enum tagISO_APDU_TYPE {
  121. ISO_CASE_1 = 1,
  122. ISO_CASE_2 = 2,
  123. ISO_CASE_3 = 3,
  124. ISO_CASE_4 = 4
  125. } ISO_APDU_TYPE;
  126. cpp_quote("#endif // _ISO_APDU_TYPE")
  127. cpp_quote("#ifndef _SCARD_SHARE_MODES_DEFINED")
  128. cpp_quote("#define _SCARD_SHARE_MODES_DEFINED")
  129. typedef [helpstring("SCard Share Modes"),
  130. //uuid(),
  131. //helpcontext(),
  132. v1_enum, // force 32-bit transmission over RPC, if in use...
  133. version(1.0)]
  134. enum tagSCARD_SHARE_MODES {
  135. EXCLUSIVE = 1,
  136. SHARED = 2
  137. } SCARD_SHARE_MODES;
  138. cpp_quote("#endif // !_SCARD_SHARE_MODES_DEFINED")
  139. cpp_quote("#ifndef _SCARD_DISPOSITIONS_DEFINED")
  140. cpp_quote("#define _SCARD_DISPOSITIONS_DEFINED")
  141. typedef [helpstring("SCard Dispositions"),
  142. //uuid(),
  143. //helpcontext(),
  144. v1_enum, // force 32-bit transmission over RPC, if in use...
  145. version(1.0)]
  146. enum tagSCARD_DISPOSITIONS {
  147. LEAVE = 0,
  148. RESET = 1,
  149. UNPOWER = 2,
  150. EJECT = 3
  151. } SCARD_DISPOSITIONS;
  152. cpp_quote("#endif // !_SCARD_DISPOSITIONS_DEFINED")
  153. cpp_quote("#ifndef _SCARD_STATES_DEFINED")
  154. cpp_quote("#define _SCARD_STATES_DEFINED")
  155. typedef [helpstring("SCard States"),
  156. //uuid(),
  157. //helpcontext(),
  158. v1_enum, // force 32-bit transmission over RPC, if in use...
  159. version(1.0)]
  160. enum tagSCARD_STATES {
  161. ABSENT = 1,
  162. PRESENT = 2,
  163. SWALLOWED = 3,
  164. POWERED = 4,
  165. NEGOTIABLEMODE = 5,
  166. SPECIFICMODE = 6
  167. } SCARD_STATES;
  168. cpp_quote("#endif // !_SCARD_STATES_DEFINED")
  169. cpp_quote("#ifndef _SCARD_PROTOCOLS_DEFINED")
  170. cpp_quote("#define _SCARD_PROTOCOLS_DEFINED")
  171. typedef [helpstring("SCard Protocols"),
  172. //uuid(),
  173. //helpcontext(),
  174. v1_enum, // force 32-bit transmission over RPC, if in use...
  175. version(1.0)]
  176. enum tagSCARD_PROTOCOLS {
  177. T0 = 0x01, // T=0 is the active protocol.
  178. T1 = 0x02, // T=1 is the active protocol.
  179. RAW = 0xff // Raw is the active protocol.
  180. } SCARD_PROTOCOLS;
  181. cpp_quote("#endif // !_SCARD_PROTOCOLS_DEFINED")
  182. cpp_quote("#ifndef _SCARD_INFO")
  183. cpp_quote("#define _SCARD_INFO")
  184. typedef [helpstring("FindCard returned information structure."),
  185. //uuid(),
  186. //helpcontext(),
  187. version(1.0)]
  188. struct tagSCARDINFO {
  189. HSCARD hCard;
  190. HSCARDCONTEXT hContext;
  191. SCARD_PROTOCOLS ActiveProtocol;
  192. SCARD_SHARE_MODES ShareMode;
  193. LONG_PTR hwndOwner;
  194. LONG_PTR lpfnConnectProc;
  195. LONG_PTR lpfnCheckProc;
  196. LONG_PTR lpfnDisconnectProc;
  197. //
  198. // Do we want to include any of the following???
  199. //
  200. // 1. card state (i.e., disposition)
  201. // 2. process ID, thread ID (...a DWORD)
  202. // 3. card GUID
  203. // 4. GUID of class factory
  204. //
  205. } SCARDINFO;
  206. cpp_quote ("#define _LPSCARDINFO")
  207. typedef [unique] SCARDINFO *PSCARDINFO, *LPSCARDINFO;
  208. cpp_quote ("#endif //_SCARD_INFO")
  209. //
  210. // The following values are merely defined as default states for use
  211. // here in this IDL file. They will NOT be bound into the type library
  212. // for use.
  213. //
  214. // These codes are defined in \\nt\private\ispu\calais\ssps\inc\IsoCodes.h
  215. // for use and redefinition, if wanted, in the sources of the SCardSrv.DLL.
  216. //
  217. //
  218. #define ISO_OPEN_LOGICAL_CHANNEL (0x00)
  219. #define ISO_CLOSE_LOGICAL_CHANNEL (0x80)
  220. #define ISO_LOGICAL_CHANNEL_0 (0x00)
  221. #define ISO_LOGICAL_CHANNEL_1 (0x01)
  222. #define ISO_LOGICAL_CHANNEL_2 (0x02)
  223. #define ISO_LOGICAL_CHANNEL_3 (0x03)
  224. //
  225. //
  226. cpp_quote("")
  227. cpp_quote("//////////////////////////////////////////////////////////////////")
  228. cpp_quote("//")
  229. cpp_quote("// IByteBuffer Interface")
  230. cpp_quote("//")
  231. cpp_quote("#ifndef _LPBYTEBUFFER_DEFINED")
  232. cpp_quote("#define _LPBYTEBUFFER_DEFINED")
  233. [
  234. object,
  235. uuid(E126F8FE-A7AF-11D0-B88A-00C04FD424B9),
  236. // dual,
  237. helpstring("IByteBuffer Interface"),
  238. pointer_default(unique)
  239. ]
  240. interface IByteBuffer : IDispatch
  241. {
  242. // Pointers -
  243. typedef [unique] IByteBuffer* LPBYTEBUFFER;
  244. typedef [unique] const IByteBuffer *LPCBYTEBUFFER;
  245. // Properties -
  246. [ id(0), propget, hidden,
  247. helpstring("Returns a pointer to the internal IStream object.")]
  248. HRESULT Stream( [out, retval] LPSTREAM* ppStream );
  249. [ id(0), propput, hidden,
  250. helpstring("Sets the internal IStream pointer.")]
  251. HRESULT Stream( [in] LPSTREAM pStream );
  252. // Methods -
  253. [ id(1),
  254. helpstring("Creates a new object with its own seek pointer that references the same bytes as the original.")
  255. ]
  256. HRESULT Clone([in, out] LPBYTEBUFFER* ppByteBuffer);
  257. [ id(2),
  258. helpstring("Ensures that any changes made to an object open in transacted mode are reflected in the parent storage.")
  259. ]
  260. HRESULT Commit([in] LONG grfCommitFlags);
  261. [ id(3),
  262. helpstring("Copies a specified number of bytes from the current seek pointer in the object to the current seek pointer in another object.")
  263. ]
  264. HRESULT CopyTo( [in,out] LPBYTEBUFFER* ppByteBuffer,
  265. [in] LONG cb,
  266. [in,out, defaultvalue(NULL)] LONG* pcbRead,
  267. [in,out, defaultvalue(NULL)] LONG* pcbWritten);
  268. [ id(4),
  269. helpstring("Initializes the object. This must be called prior to calling any other methods!")]
  270. HRESULT Initialize( [in, defaultvalue(1)] LONG lSize,
  271. [in, defaultvalue(NULL)] BYTE* pData );
  272. [ id(5),
  273. helpstring("Restricts access to a specified range of bytes in the buffer object.")
  274. ]
  275. HRESULT LockRegion( [in] LONG libOffset,
  276. [in] LONG cb,
  277. [in] LONG dwLockType);
  278. [ id(6),
  279. helpstring("Reads a specified number of bytes from the buffer object into memory starting at the current seek pointer.")
  280. ]
  281. HRESULT Read( [in,out] BYTE* pByte,
  282. [in] LONG cb,
  283. [in, out, defaultvalue(NULL)] LONG* pcbRead);
  284. [ id(7),
  285. helpstring("Discards all changes that have been made to a transacted stream since the last IByteBuffer::Commit call.")
  286. ]
  287. HRESULT Revert ( void );
  288. [ id(8),
  289. helpstring("Changes the seek pointer to a new location relative to the beginning of the buffer, to the end of the buffer, or to the current seek pointer.")
  290. ]
  291. HRESULT Seek( [in] LONG dLibMove,
  292. [in] LONG dwOrigin,
  293. [in,out, defaultvalue(NULL)] LONG* pLibnewPosition);
  294. [ id(9),
  295. helpstring("Changes the size of the stream object.")
  296. ]
  297. HRESULT SetSize([in] LONG libNewSize);
  298. [ id(10),
  299. helpstring("Retrieves the STATSTG structure for this object.")
  300. ]
  301. HRESULT Stat( [in,out] LPSTATSTRUCT pstatstg,
  302. [in] LONG grfStatFlag);
  303. [ id(11),
  304. helpstring("Removes the access restriction on a range of bytes previously restricted with IByteBuffer::LockRegion.")
  305. ]
  306. HRESULT UnlockRegion( [in] LONG libOffset,
  307. [in] LONG cb,
  308. [in] LONG dwLockType);
  309. [ id(12),
  310. helpstring("Writes a specified number from bytes into the stream object starting at the current seek pointer.")
  311. ]
  312. HRESULT Write( [in,out] BYTE* pByte,
  313. [in] LONG cb,
  314. [in,out] LONG* pcbWritten);
  315. };
  316. cpp_quote("#endif //_LPBYTEBUFFER_DEFINED")
  317. cpp_quote("")
  318. cpp_quote("//////////////////////////////////////////////////////////////////")
  319. cpp_quote("//")
  320. cpp_quote("// ISCardTypeConv Interface Definition")
  321. cpp_quote("//")
  322. cpp_quote("#ifndef _LPSCARDTYPECONV_DEFINED")
  323. cpp_quote("#define _LPSCARDTYPECONV_DEFINED")
  324. [
  325. object,
  326. uuid(53B6AA63-3F56-11D0-916B-00AA00C18068),
  327. // dual,
  328. helpstring("ISCardTypeConv Interface"),
  329. pointer_default(unique)
  330. ]
  331. interface ISCardTypeConv : IDispatch
  332. {
  333. // Pointer(s);
  334. typedef [unique] ISCardTypeConv *LPSCARDTYPECONV;
  335. // Methods:
  336. [id(0), helpstring("Convert an array of bytes to an IByteBuffer")]
  337. HRESULT ConvertByteArrayToByteBuffer(
  338. [in] LPBYTE pbyArray,
  339. [in] DWORD dwArraySize,
  340. [out,retval] LPBYTEBUFFER *ppbyBuffer);
  341. [id(1), helpstring("Convert an IByteBuffer to an array of bytes")]
  342. HRESULT ConvertByteBufferToByteArray(
  343. [in] LPBYTEBUFFER pbyBuffer,
  344. [out,retval] LPBYTEARRAY *ppArray);
  345. [id(2), helpstring("Convert an IByteBuffer to a SAFEARRAY(unsigned char)")]
  346. HRESULT ConvertByteBufferToSafeArray(
  347. [in] LPBYTEBUFFER pbyBuffer,
  348. [out,retval] LPSAFEARRAY *ppbyArray);
  349. [id(3), helpstring("Convert a SAFEARRAY(unsigned char) to an IByteBuffer")]
  350. HRESULT ConvertSafeArrayToByteBuffer(
  351. [in] LPSAFEARRAY pbyArray,
  352. [out,retval] LPBYTEBUFFER *ppbyBuff);
  353. [id(4), helpstring("Create an array of bytes")]
  354. HRESULT CreateByteArray(
  355. [in] DWORD dwAllocSize,
  356. [out,retval] LPBYTE *ppbyArray);
  357. [id(5), helpstring("Create an IByteBuffer object")]
  358. HRESULT CreateByteBuffer(
  359. [in] DWORD dwAllocSize,
  360. [out,retval] LPBYTEBUFFER *ppbyBuff);
  361. [id(6), helpstring("Create a SAFEARRAY(unsigned char)")]
  362. HRESULT CreateSafeArray(
  363. [in] UINT nAllocSize,
  364. [out,retval] LPSAFEARRAY *ppArray);
  365. [id(7), helpstring("Free a pointer to the memory block managed by the IStream")]
  366. HRESULT FreeIStreamMemoryPtr(
  367. [in] LPSTREAM pStrm,
  368. [in] LPBYTE pMem);
  369. [id(8), helpstring("Get a pointer to the memory block managed by the IStream")]
  370. HRESULT GetAtIStreamMemory(
  371. [in] LPSTREAM pStrm,
  372. [out,retval] LPBYTEARRAY *ppMem);
  373. [id(9), helpstring("How many bytes are in the given IStream")]
  374. HRESULT SizeOfIStream(
  375. [in] LPSTREAM pStrm,
  376. [out,retval] ULARGE_INTEGER* puliSize);
  377. };
  378. cpp_quote("#endif // _LPSCARDTYPECONV_DEFINED")
  379. cpp_quote("")
  380. cpp_quote("//////////////////////////////////////////////////////////////////")
  381. cpp_quote("//")
  382. cpp_quote("// ISCardCmd Interface Definition")
  383. cpp_quote("//")
  384. cpp_quote("#ifndef _LPSCARDCMD_DEFINED")
  385. cpp_quote("#define _LPSCARDCMD_DEFINED")
  386. [
  387. object,
  388. uuid(D5778AE3-43DE-11D0-9171-00AA00C18068),
  389. // dual,
  390. helpstring("ISCardCmd Interface"),
  391. pointer_default(unique)
  392. ]
  393. interface ISCardCmd : IDispatch
  394. {
  395. // Pointer(s) -
  396. typedef [unique] ISCardCmd *LPSCARDCMD;
  397. // Properties -
  398. [id(0), propget/*, defaultcollelem*/,
  399. helpstring("Get the raw ISO 7816 APDU string")]
  400. HRESULT Apdu([out,retval] LPBYTEBUFFER *ppApdu);
  401. [id(0), propput/*, defaultcollelem*/,
  402. helpstring("Copy a new APDU over the current one")]
  403. HRESULT Apdu([in] LPBYTEBUFFER pApdu);
  404. [id(1), propget/*, defaultcollelem*/,
  405. helpstring("Get the byte count (size) of the raw ISO 7816 APDU string")]
  406. HRESULT ApduLength([out,retval] LONG* plSize);
  407. [id(2), propget/*, defaultcollelem*/,
  408. helpstring("Get the raw reply ISO 7816 APDU string")]
  409. HRESULT ApduReply([out,retval] LPBYTEBUFFER *ppReplyApdu);
  410. [id(2), propput/*, defaultcollelem*/,
  411. helpstring("Set the raw reply ISO 7816 APDU string")]
  412. HRESULT ApduReply([in] LPBYTEBUFFER pReplyApdu);
  413. [id(3), propget/*, defaultcollelem*/,
  414. helpstring("Get the byte count (size) of the raw reply ISO 7816 APDU string")]
  415. HRESULT ApduReplyLength([out,retval] LONG* plSize);
  416. [id(3), propput/*, defaultcollelem*/,
  417. helpstring("Set the byte count (size) of the raw reply ISO 7816 APDU string")]
  418. HRESULT ApduReplyLength([in] LONG lSize);
  419. [id(4), propget/*, defaultcollelem*/,
  420. helpstring("Get the current class ID of the ISO 7816 APDU header")]
  421. HRESULT ClassId([out,retval] BYTE* pbyClass);
  422. [id(4), propput/*, defaultcollelem*/,
  423. helpstring("Assign a new class ID in the ISO 7816 APDU header")]
  424. HRESULT ClassId([in,defaultvalue(0)] BYTE byClass);
  425. [id(5), propget/*, defaultcollelem*/,
  426. helpstring("Get the current data portion of the ISO 7816 APDU string")]
  427. HRESULT Data([out,retval] LPBYTEBUFFER *ppData);
  428. [id(5), propput/*, defaultcollelem*/,
  429. helpstring("Assign a new data portion of the ISO 7816 APDU string")]
  430. HRESULT Data([in] LPBYTEBUFFER pData);
  431. [id(6), propget/*, defaultcollelem*/,
  432. helpstring("Get the current instruction ID of the ISO 7816 APDU header")]
  433. HRESULT InstructionId([out,retval] BYTE* pbyIns);
  434. [id(6), propput/*, defaultcollelem*/,
  435. helpstring("Assign a new instruction ID in the ISO 7816 APDU header")]
  436. HRESULT InstructionId([in] BYTE byIns);
  437. [id(7), propget/*, defaultcollelem*/,
  438. helpstring("Get the Le parameter (expected length of reply data) of the ISO 7816 APDU")]
  439. HRESULT LeField([out,retval] LONG* plSize);
  440. [id(8), propget/*, defaultcollelem*/,
  441. helpstring("Get the first parameter of the ISO 7816 APDU header")]
  442. HRESULT P1([out,retval] BYTE* pbyP1);
  443. [id(8), propput/*, defaultcollelem*/,
  444. helpstring("Assign a new first parameter in the ISO 7816 APDU header")]
  445. HRESULT P1([in] BYTE byP1);
  446. [id(9), propget/*, defaultcollelem*/,
  447. helpstring("Get the second parameter of the ISO 7816 APDU header")]
  448. HRESULT P2([out,retval] BYTE* pbyP2);
  449. [id(9), propput/*, defaultcollelem*/,
  450. helpstring("Assign a new second parameter in the ISO 7816 APDU header")]
  451. HRESULT P2([in] BYTE byP2);
  452. [id(10), propget/*, defaultcollelem*/,
  453. helpstring("Get the third parameter of the ISO 7816 APDU header")]
  454. HRESULT P3([out,retval] BYTE* pbyP3);
  455. [id(11), propget/*, defaultcollelem*/,
  456. helpstring("Get the reply status word")]
  457. HRESULT ReplyStatus([out,retval] LPWORD pwStatus);
  458. [id(11), propput/*, defaultcollelem*/,
  459. helpstring("Set (save) the reply status word")]
  460. HRESULT ReplyStatus([in] WORD wStatus);
  461. [id(12), propget/*, defaultcollelem*/,
  462. helpstring("Get the reply status SW1 byte.")]
  463. HRESULT ReplyStatusSW1([out,retval] BYTE* pbySW1);
  464. [id(13), propget/*, defaultcollelem*/,
  465. helpstring("Get the reply status SW2 byte.")]
  466. HRESULT ReplyStatusSW2([out,retval] BYTE* pbySW2);
  467. [id(14), propget/*, defaultcollelem*/,
  468. helpstring("Get the current ISO 7816-4 type of the encapsulated APDU.")]
  469. HRESULT Type([out,retval] ISO_APDU_TYPE* pType);
  470. [id(18), propget/*, defaultcollelem*/,
  471. helpstring("Get the T=1 Node Address")]
  472. HRESULT Nad([out,retval] BYTE* pbNad);
  473. [id(18), propput/*, defaultcollelem*/,
  474. helpstring("Set (save) the T=1 Node Address")]
  475. HRESULT Nad([in] BYTE bNad);
  476. [id(19), propget/*, defaultcollelem*/,
  477. helpstring("Get the T=1 Reply Node Address")]
  478. HRESULT ReplyNad([out,retval] BYTE* pbNad);
  479. [id(19), propput/*, defaultcollelem*/,
  480. helpstring("Set (save) the T=1 Reply Node Address")]
  481. HRESULT ReplyNad([in] BYTE bNad);
  482. // Methods -
  483. [id(15),
  484. helpstring("Build a valid ISO 7816 APDU string")]
  485. HRESULT BuildCmd([in] BYTE byClassId,
  486. [in] BYTE byInsId,
  487. [in,defaultvalue(0)] BYTE byP1,
  488. [in,defaultvalue(0)] BYTE byP2,
  489. [in,defaultvalue(NULL)] LPBYTEBUFFER pbyData,
  490. [in,defaultvalue(NULL)] LONG* plLe);
  491. [id(16),
  492. helpstring("Clear the current APDU data")]
  493. HRESULT Clear(void);
  494. [id(17),
  495. helpstring("Encapsulate onother APDU into this one as data")]
  496. HRESULT Encapsulate([in] LPBYTEBUFFER pApdu,
  497. [in] ISO_APDU_TYPE ApduType);
  498. [id(20), propget/*, defaultcollelem*/,
  499. helpstring("Get the alternate class ID of the ISO 7816 APDU header")]
  500. HRESULT AlternateClassId([out,retval] BYTE* pbyClass);
  501. [id(20), propput/*, defaultcollelem*/,
  502. helpstring("Assign a new alternate class ID in the ISO 7816 APDU header")]
  503. HRESULT AlternateClassId([in] BYTE byClass);
  504. };
  505. cpp_quote("#endif //!_LPSCARDCMD_DEFINED")
  506. cpp_quote("")
  507. cpp_quote("//////////////////////////////////////////////////////////////////")
  508. cpp_quote("//")
  509. cpp_quote("// ISCardISO7816 Interface Definition")
  510. cpp_quote("//")
  511. cpp_quote("#ifndef _LPSCARDISO7816_DEFINED")
  512. cpp_quote("#define _LPSCARDISO7816_DEFINED")
  513. [
  514. object,
  515. uuid(53B6AA68-3F56-11D0-916B-00AA00C18068),
  516. // dual,
  517. helpstring("ISCardISO7816 Interface"),
  518. pointer_default(unique)
  519. ]
  520. interface ISCardISO7816 : IDispatch
  521. {
  522. // Pointer(s) -
  523. typedef [unique] ISCardISO7816 *LPSCARDISO;
  524. typedef [unique] LPSCARDISO LPSCARDISO7816;
  525. // Methods -
  526. [id(0),
  527. helpstring("Write a record to the end of an EF of linear structure of location one of a cyclic structure")]
  528. HRESULT AppendRecord([in] BYTE byRefCtrl, // currently selected EF
  529. [in] LPBYTEBUFFER pData,
  530. [in, out] LPSCARDCMD *ppCmd);
  531. [id(1),
  532. helpstring("Set part of an EF file content to its erased state sequentially")]
  533. HRESULT EraseBinary([in] BYTE byP1,
  534. [in] BYTE byP2,
  535. [in]LPBYTEBUFFER pData,
  536. [in, out] LPSCARDCMD *ppCmd);
  537. [id(2),
  538. helpstring("Update the card after a GET CHALLENGE command serviced")]
  539. HRESULT ExternalAuthenticate([in]BYTE byAlgorithmRef,
  540. [in ] BYTE bySecretRef,
  541. [in] LPBYTEBUFFER pChallenge,
  542. [in, out] LPSCARDCMD *ppCmd);
  543. [id(3),
  544. helpstring("Issue a challenge for use in a security related procedure")]
  545. HRESULT GetChallenge([in ] LONG lBytesExpected,
  546. [in, out] LPSCARDCMD *ppCmd);
  547. [id(4),
  548. helpstring("Retrieve a primitive data object")]
  549. HRESULT GetData([in] BYTE byP1,
  550. [in] BYTE byP2,
  551. [in ] LONG lBytesToGet,
  552. [in, out] LPSCARDCMD *ppCmd);
  553. [id(5),
  554. helpstring("Retrieve further data")]
  555. HRESULT GetResponse([in ] BYTE byP1, //=0
  556. [in] BYTE byP2, //=0
  557. [in] LONG lDataLength, // =0
  558. [in, out] LPSCARDCMD *ppCmd);
  559. [id(6),
  560. helpstring("Compute authentication data on card using challenge data sent to card")]
  561. HRESULT InternalAuthenticate([in ] BYTE byAlgorithmRef,
  562. [in] BYTE bySecretRef,
  563. [in] LPBYTEBUFFER pChallenge,
  564. [in] LONG lReplyBytes,
  565. [in, out] LPSCARDCMD *ppCmd);
  566. [id(7),
  567. helpstring("Open or close a logical channel")]
  568. HRESULT ManageChannel([in ] BYTE byChannelState,
  569. [in] BYTE byChannel,
  570. [in, out] LPSCARDCMD *ppCmd);
  571. [id(8),
  572. helpstring("Write a primitive data object")]
  573. HRESULT PutData([in] BYTE byP1,
  574. [in] BYTE byP2,
  575. [in] LPBYTEBUFFER pData,
  576. [in, out] LPSCARDCMD *ppCmd);
  577. [id(9),
  578. helpstring("Read part of the content of an EF with transparent structure")]
  579. HRESULT ReadBinary([in] BYTE byP1,
  580. [in] BYTE byP2,
  581. [in ] LONG lBytesToRead,
  582. [in, out] LPSCARDCMD *ppCmd);
  583. [id(10),
  584. helpstring("Read contents of a specified record from an EF")]
  585. HRESULT ReadRecord([in] BYTE byRecordId, // current record
  586. [in] BYTE byRefCtrl,
  587. [in] LONG lBytesToRead,
  588. [in, out] LPSCARDCMD *ppCmd);
  589. [id(11),
  590. helpstring("Set a current file within a logical channel")]
  591. HRESULT SelectFile([in] BYTE byP1,
  592. [in] BYTE byP2,
  593. [in ] LPBYTEBUFFER pData,
  594. [in ] LONG lBytesToRead,
  595. [in, out] LPSCARDCMD *ppCmd);
  596. [id(12),
  597. helpstring("Change the default class ID used in command construction")]
  598. HRESULT SetDefaultClassId([in] BYTE byClass);
  599. [id(13),
  600. helpstring("Update bits already present in an EF with command APDU bits")]
  601. HRESULT UpdateBinary([in] BYTE byP1,
  602. [in] BYTE byP2,
  603. [in] LPBYTEBUFFER pData,
  604. [in, out] LPSCARDCMD *ppCmd);
  605. [id(14),
  606. helpstring("Update a specific record with the APDU bits")]
  607. HRESULT UpdateRecord([in ] BYTE byRecordId, // current record
  608. [in] BYTE byRefCtrl, // first record in currently selected EF
  609. [in] LPBYTEBUFFER pData,
  610. [in, out] LPSCARDCMD *ppCmd);
  611. [id(15),
  612. helpstring("Compare the verification data sent to the card with its stored reference data")]
  613. HRESULT Verify([in] BYTE byRefCtrl, // no info is given
  614. [in] LPBYTEBUFFER pData,
  615. [in, out] LPSCARDCMD *ppCmd);
  616. [id(16),
  617. helpstring("Write binary values into an EF")]
  618. HRESULT WriteBinary([in] BYTE byP1,
  619. [in] BYTE byP2,
  620. [in] LPBYTEBUFFER pData,
  621. [in, out] LPSCARDCMD *ppCmd);
  622. [id(17),
  623. helpstring("Write to the specified record in an EF")]
  624. HRESULT WriteRecord([in] BYTE byRecordId, // current record
  625. [in] BYTE byRefCtrl, // first record in currently selected EF
  626. [in] LPBYTEBUFFER pData,
  627. [in, out] LPSCARDCMD *ppCmd);
  628. };
  629. cpp_quote("#endif //!_LPSCARDISO7816_DEFINED")
  630. cpp_quote("")
  631. cpp_quote("//////////////////////////////////////////////////////////////////")
  632. cpp_quote("//")
  633. cpp_quote("// ISCard Interface")
  634. cpp_quote("//")
  635. cpp_quote("#ifndef _LPSCARD_DEFINED")
  636. cpp_quote("#define _LPSCARD_DEFINED")
  637. [
  638. object,
  639. uuid(1461AAC3-6810-11D0-918F-00AA00C18068),
  640. // dual,
  641. helpstring("ISCard Interface"),
  642. pointer_default(unique)
  643. ]
  644. interface ISCard : IDispatch
  645. {
  646. // Pointer(s) -
  647. typedef [unique] ISCard* LPSCARD;
  648. typedef [unique] LPSCARD LPSMARTCARD;
  649. // Properties -
  650. [id(0), propget,
  651. helpstring("Retrieve the ATR string for the Smart Card")]
  652. HRESULT Atr([out,retval] LPBYTEBUFFER *ppAtr);
  653. [id(1), propget,
  654. helpstring("Retrieve the current card handle.")]
  655. HRESULT CardHandle([out,retval] HSCARD *pHandle);
  656. [id(2), propget,
  657. helpstring("Retrieve the current context handle.")]
  658. HRESULT Context([out,retval] HSCARDCONTEXT *pContext);
  659. [id(3), propget,
  660. helpstring("Retrieve the protocol in use on the Smart Card")]
  661. HRESULT Protocol([out,retval] SCARD_PROTOCOLS *pProtocol);
  662. [id(4), propget,
  663. helpstring("Retrieve the current state that the Smart Card is in")]
  664. HRESULT Status([out,retval] SCARD_STATES *pStatus);
  665. // Methods -
  666. [id(5),
  667. helpstring("Attach an open SCard handle to this object")]
  668. HRESULT AttachByHandle([in] HSCARD hCard);
  669. [id(6),
  670. helpstring("Open a connection to a card in the named reader")]
  671. HRESULT AttachByReader([in] BSTR bstrReaderName,
  672. [in,defaultvalue(EXCLUSIVE)]
  673. SCARD_SHARE_MODES ShareMode,
  674. [in,defaultvalue(T0)]
  675. SCARD_PROTOCOLS PrefProtocol);
  676. [id(7),
  677. helpstring("Close a connection to an open card")]
  678. HRESULT Detach([in,defaultvalue(LEAVE)]
  679. SCARD_DISPOSITIONS Disposition);
  680. [id(8),
  681. helpstring("Acquire exclusive access and use of the open Smart Card")]
  682. HRESULT LockSCard(void);
  683. [id(9),
  684. helpstring("Reattach an existing connection to an in use Smart Card ")]
  685. HRESULT ReAttach([in,defaultvalue(EXCLUSIVE)]
  686. SCARD_SHARE_MODES ShareMode,
  687. [in,defaultvalue(LEAVE)]
  688. SCARD_DISPOSITIONS InitState);
  689. [id(10),
  690. helpstring("Execute a card transaction with a card command interface")]
  691. HRESULT Transaction([in,out] LPSCARDCMD *ppCmd);
  692. [id(11),
  693. helpstring("Release the exclusive access lock on the Smart Card")]
  694. HRESULT UnlockSCard([in,defaultvalue(LEAVE)]
  695. SCARD_DISPOSITIONS Disposition);
  696. };
  697. cpp_quote("#endif // !_LPSCARD_DEFINED")
  698. cpp_quote("")
  699. cpp_quote("//////////////////////////////////////////////////////////////////")
  700. cpp_quote("//")
  701. cpp_quote("// ISCardDatabase Interface")
  702. cpp_quote("//")
  703. cpp_quote("#ifndef _LPSCARDDATABASE_DEFINED")
  704. cpp_quote("#define _LPSCARDDATABASE_DEFINED")
  705. [
  706. object,
  707. uuid(1461AAC8-6810-11D0-918F-00AA00C18068),
  708. // dual,
  709. helpstring("ISCardDatabase Interface"),
  710. pointer_default(unique)
  711. ]
  712. interface ISCardDatabase : IDispatch
  713. {
  714. // Pointer(s) -
  715. typedef [unique] ISCardDatabase* LPSCARDDATABASE;
  716. // Methods -
  717. [id(0),
  718. helpstring("Retrieve the provider ID for the named card")]
  719. HRESULT GetProviderCardId([in] BSTR bstrCardName,
  720. [out,retval] LPGUID *ppguidProviderId);
  721. [id(1),
  722. helpstring("Retrieve a list of the interfaces (GUIDs) for the named card")]
  723. HRESULT ListCardInterfaces([in] BSTR bstrCardName,
  724. [out,retval] LPSAFEARRAY *ppInterfaceGuids); // BSTR
  725. [id(2),
  726. helpstring("Retrieve a list of the names of the defined cards")]
  727. HRESULT ListCards([in,defaultvalue(NULL)] LPBYTEBUFFER pAtr,
  728. [in,defaultvalue(NULL)] LPSAFEARRAY pInterfaceGuids, // BSTR
  729. [in,lcid,defaultvalue(0x0409)] long localeId,
  730. [out,retval] LPSAFEARRAY *ppCardNames); // BSTR
  731. [id(3),
  732. helpstring("Retrieve a list of the names of the defined card reader groups")]
  733. HRESULT ListReaderGroups([in,lcid,defaultvalue(0x0409)] long localeId,
  734. [out,retval] LPSAFEARRAY *ppReaderGroups); // BSTR
  735. [id(4),
  736. helpstring("Retrieve a list of the names of the defined card readers")]
  737. HRESULT ListReaders([in,lcid,defaultvalue(0x0409)] long localeId,
  738. [out,retval] LPSAFEARRAY *ppReaders); // BSTR
  739. };
  740. cpp_quote("#endif // !_LPSCARDDATABASE_DEFINED")
  741. cpp_quote("")
  742. cpp_quote("//////////////////////////////////////////////////////////////////")
  743. cpp_quote("//")
  744. cpp_quote("// ISCardLocate Interface")
  745. cpp_quote("//")
  746. cpp_quote("#ifndef _LPSCARDLOCATE_DEFINED")
  747. cpp_quote("#define _LPSCARDLOCATE_DEFINED")
  748. [
  749. object,
  750. uuid(1461AACD-6810-11D0-918F-00AA00C18068),
  751. // dual,
  752. helpstring("ISCardLocate Interface"),
  753. pointer_default(unique)
  754. ]
  755. interface ISCardLocate : IDispatch
  756. {
  757. // Pointer(s) -
  758. typedef [unique] ISCardLocate* LPSCARDLOCATE;
  759. typedef [unique] LPSCARDLOCATE LPSCARDLOC;
  760. // Type(s) -
  761. // Methods -
  762. [id(0),
  763. helpstring("Configure the search based on the card GUIDs")]
  764. HRESULT ConfigureCardGuidSearch(
  765. [in] LPSAFEARRAY pCardGuids, // BSTR
  766. [in,defaultvalue(NULL)] LPSAFEARRAY pGroupNames, // BSTR
  767. [in,defaultvalue("")] BSTR bstrTitle,
  768. [in,defaultvalue(1)] LONG lFlags);
  769. [id(1),
  770. helpstring("Configure the search based on card names")]
  771. HRESULT ConfigureCardNameSearch(
  772. [in] LPSAFEARRAY pCardNames, // BSTR
  773. [in,defaultvalue(NULL)] LPSAFEARRAY pGroupNames, // BSTR
  774. [in,defaultvalue("")] BSTR bstrTitle,
  775. [in,defaultvalue(1)] LONG lFlags);
  776. [id(2),
  777. helpstring("Find and open a connection to the named Smart Card")]
  778. HRESULT FindCard([in,defaultvalue(EXCLUSIVE)]
  779. SCARD_SHARE_MODES ShareMode,
  780. [in,defaultvalue(T0)]
  781. SCARD_PROTOCOLS Protocols,
  782. [in,defaultvalue(1)] LONG lFlags,
  783. [out,retval] LPSCARDINFO *ppCardInfo);
  784. };
  785. cpp_quote("#endif // !_LPSCARDLOCATE_DEFINED")
  786. [
  787. uuid(82C38704-19F1-11D3-A11F-00C04F79F800),
  788. version(1.0),
  789. helpstring("scardssp 1.0 Type Library")
  790. ]
  791. library SCARDSSPLib
  792. {
  793. importlib("stdole32.tlb");
  794. importlib("stdole2.tlb");
  795. [
  796. uuid(E126F8FF-A7AF-11D0-B88A-00C04FD424B9),
  797. helpstring("ByteBuffer Class")
  798. ]
  799. coclass CByteBuffer
  800. {
  801. [default] interface IByteBuffer;
  802. };
  803. [
  804. uuid(53B6AA67-3F56-11D0-916B-00AA00C18068),
  805. helpstring("SCardTypeConv Class")
  806. ]
  807. coclass CSCardTypeConv
  808. {
  809. [default] interface ISCardTypeConv;
  810. };
  811. [
  812. uuid(D5778AE7-43DE-11D0-9171-00AA00C18068),
  813. helpstring("SCardCmd Class")
  814. ]
  815. coclass CSCardCmd
  816. {
  817. [default] interface ISCardCmd;
  818. };
  819. [
  820. uuid(53B6AA6C-3F56-11D0-916B-00AA00C18068),
  821. helpstring("SCardISO7816 Class")
  822. ]
  823. coclass CSCardISO7816
  824. {
  825. [default] interface ISCardISO7816;
  826. };
  827. [
  828. uuid(1461AAC7-6810-11D0-918F-00AA00C18068),
  829. helpstring("SCard Class")
  830. ]
  831. coclass CSCard
  832. {
  833. [default] interface ISCard;
  834. };
  835. [
  836. uuid(1461AACC-6810-11D0-918F-00AA00C18068),
  837. helpstring("SCardDatabase Class")
  838. ]
  839. coclass CSCardDatabase
  840. {
  841. [default] interface ISCardDatabase;
  842. };
  843. [
  844. uuid(1461AAD1-6810-11D0-918F-00AA00C18068),
  845. helpstring("SCardLocate Class")
  846. ]
  847. coclass CSCardLocate
  848. {
  849. [default] interface ISCardLocate;
  850. };
  851. };