home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / sspsidl.idl < prev    next >
Text File  |  1998-04-25  |  19KB  |  521 lines

  1. /*++
  2.  
  3. Copyright (c) 1996  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     SspsIdl
  8.  
  9. Abstract:
  10.  
  11.     IDL source for SspsIdl.DLL. This in-process server (DLL)
  12.     encapsulates the services oriented COM interfaces for the
  13.     Smart Card Service Provider (SSP) Data Services.
  14.  
  15. Author:
  16.  
  17.     Michael Gallagher (a-mgalla) 11/21/1996
  18.  
  19. Environment:
  20.  
  21.     Win32
  22.  
  23. Revision History:
  24.  
  25.     Mike Gallagher (a-mgalla) 1/19/1997
  26.     Chris Dudley (cdudley) 2/15/1997
  27.  
  28. Notes:
  29.  
  30.     1. This file will be processed by the MIDL tool to produce
  31.         the type library (SspsIdl.tlb) and marshalling code. A
  32.         header file named SspsIdl.h will be generated by the
  33.         MIDL compiler for the ATL CPP code to use (and any other
  34.         C/C++ code files).
  35.  
  36.     2. Rather than create separate IDL files for the C/C++, VB
  37.         and Java languages, the decision has been made to create
  38.         one IDL file that can be used by any language environment
  39.         using standardized OLE Automation types.
  40.  
  41.     3. The #define'd constants in this MIDL file will NOT be
  42.         registered into the type library! You will need to define
  43.         these constants in your Visual Basic, Delphi, etc. code
  44.         as needed unless the constant is not defined as a const
  45.         variable in this IDL file. The constants will be defined
  46.         for Java users. And, of course, the C/C++ coders can use
  47.         the header file generated by the MIDL compiler as described
  48.         above.
  49.  
  50. --*/
  51.  
  52.  
  53. cpp_quote("//+-------------------------------------------------------------------------")
  54. cpp_quote("//")
  55. cpp_quote("//  Microsoft Smart Card Support")
  56. cpp_quote("//  Copyright (C) Microsoft Corporation, 1996.")
  57. cpp_quote("//")
  58. cpp_quote("//")
  59. cpp_quote("// File: SspsIdl.h")
  60. cpp_quote("//")
  61. cpp_quote("//--------------------------------------------------------------------------")
  62.  
  63.  
  64. cpp_quote("")
  65. cpp_quote("//////////////////////////////////////////////////////////////////")
  66. cpp_quote("//")
  67. cpp_quote("// Imports")
  68. cpp_quote("//")
  69.  
  70. #ifndef DO_NO_IMPORTS
  71.     import "oaidl.idl";
  72. #endif
  73.  
  74. interface IByteBuffer;
  75. interface ISCardTypeConv;
  76. interface ISCardCmd;
  77.  
  78.  
  79. cpp_quote("")
  80. cpp_quote("//////////////////////////////////////////////////////////////////")
  81. cpp_quote("//")
  82. cpp_quote("// Types and Constants")
  83. cpp_quote("//")
  84.  
  85. cpp_quote("#ifndef _NULL_DEFINED")
  86.     cpp_quote("#define _NULL_DEFINED")
  87.     #define NULL    0
  88. cpp_quote("#endif // !_NULL_DEFINED")
  89.  
  90. cpp_quote("#ifndef _LPBYTE_DEFINED")
  91.     cpp_quote("#define _LPBYTE_DEFINED")
  92.     typedef [public] BYTE *LPBYTE;
  93. cpp_quote("#endif // !_LPBYTE_DEFINED")
  94.  
  95. cpp_quote("#ifndef _LPCBYTE_DEFINED")
  96.     cpp_quote("#define _LPCBYTE_DEFINED")
  97.     typedef [public] const BYTE *LPCBYTE;
  98. cpp_quote("#endif // !_LPCBYTE_DEFINED")
  99.  
  100. cpp_quote("#ifndef _BYTEARRAY_DEFINED")
  101.     cpp_quote("#define _BYTEARRAY_DEFINED")
  102.     typedef [helpstring("Helpful byte array."),
  103.              //uuid(),
  104.              //helpcontext(),
  105.              version(1.0)]
  106.     struct tagBYTEARRAY {
  107.         HGLOBAL hMem;
  108.         DWORD dwSize;
  109.         [size_is(dwSize)] LPBYTE pbyData;
  110.      } BYTEARRAY;
  111.  
  112.     cpp_quote("#define _CB_BYTEARRAY_DEFINED")
  113.     cpp_quote("#define CB_BYTEARRAY     (sizeof(BYTEARRAY))")
  114.  
  115.     cpp_quote("#define _PBYTEARRAY_DEFINED")
  116.     typedef [public] BYTEARRAY *PBYTEARRAY;
  117.  
  118.     cpp_quote("#define _PCBYTEARRAY_DEFINED")
  119.     typedef [public] const BYTEARRAY *PCBYTEARRAY;
  120.  
  121.     cpp_quote("#define _LPBYTEARRAY_DEFINED")
  122.     typedef [public] BYTEARRAY *LPBYTEARRAY;
  123.  
  124.     cpp_quote("#define _LPCBYTEARRAY_DEFINED")
  125.     typedef [public] const BYTEARRAY *LPCBYTEARRAY;
  126. cpp_quote("#endif // _BYTEARRAY_DEFINED")
  127.  
  128. cpp_quote("#ifndef _STATSTRUCT")
  129.     cpp_quote("#define _STATSTRUCT")
  130.     typedef [helpstring("Stream status structure."),
  131.              //uuid(),
  132.              //helpcontext(),
  133.              version(1.0)]
  134.     struct tagSTATSTRUCT {
  135.         LONG        type;
  136.         LONG        cbSize;
  137.         LONG        grfMode;
  138.         LONG        grfLocksSupported;
  139.         LONG        grfStateBits;
  140.      } STATSTRUCT;
  141.  
  142.     cpp_quote("#define _CB_STATSTRUCT_DEFINED")
  143.     cpp_quote("#define CB_STATSTRUCT    (sizeof(STATSTRUCT))")
  144.  
  145.     cpp_quote("#define _LPSTATSTRUCT_DEFINED")
  146.     typedef [public] STATSTRUCT* LPSTATSTRUCT;
  147. cpp_quote("#endif // _STATSTRUCT_DEFINED")
  148.  
  149. cpp_quote("#ifndef _ISO_APDU_TYPE")
  150.     cpp_quote("#define _ISO_APDU_TYPE")
  151.     typedef [helpstring("ISO 7816-4 APDU Case types."),
  152.              //uuid(),
  153.              //helpcontext(),
  154.              version(1.0)]
  155.     enum tagISO_APDU_TYPE {
  156.         ISO_CASE_1 = 1,
  157.         ISO_CASE_2 = 2,
  158.         ISO_CASE_3 = 3,
  159.         ISO_CASE_4 = 4
  160.     } ISO_APDU_TYPE;
  161. cpp_quote("#endif // _ISO_APDU_TYPE")
  162.  
  163.  
  164. cpp_quote("")
  165. cpp_quote("//////////////////////////////////////////////////////////////////")
  166. cpp_quote("//")
  167. cpp_quote("// IByteBuffer Interface")
  168. cpp_quote("//")
  169.  
  170. cpp_quote("#ifndef _LPBYTEBUFFER_DEFINED")
  171. cpp_quote("#define _LPBYTEBUFFER_DEFINED")
  172.     [
  173.         object,
  174.         uuid(E126F8FE-A7AF-11D0-B88A-00C04FD424B9),
  175.         dual,
  176.         //hidden,
  177.         //oleautomation,
  178.         helpstring("IByteBuffer Interface"),
  179.         pointer_default(unique)
  180.     ]
  181.     interface IByteBuffer : IDispatch
  182.     {
  183.         // Includes -
  184.  
  185.         // Pointers -
  186.         typedef [unique] IByteBuffer* LPBYTEBUFFER;
  187.         typedef [unique] const IByteBuffer *LPCBYTEBUFFER;
  188.  
  189.         // Properties -
  190.         [   id(0), propget, hidden,
  191.             helpstring("Returns a pointer to the internal IStream object.")]
  192.             HRESULT Stream( [out, retval] LPSTREAM* ppStream );
  193.         [   id(0), propput, hidden,
  194.             helpstring("Sets the internal IStream pointer.")]
  195.             HRESULT Stream( [in] LPSTREAM pStream );
  196.  
  197.         // Methods -
  198.         [   id(1),
  199.             helpstring("Creates a new object with its own seek pointer that references the same bytes as the original.")
  200.         ]
  201.         HRESULT Clone([in, out] LPBYTEBUFFER* ppByteBuffer);
  202.  
  203.         [   id(2),
  204.             helpstring("Ensures that any changes made to an object open in transacted mode are reflected in the parent storage.")
  205.         ]
  206.         HRESULT Commit([in] LONG grfCommitFlags);
  207.  
  208.         [   id(3),
  209.             helpstring("Copies a specified number of bytes from the current seek pointer in the object to the current seek pointer in another object.")
  210.         ]
  211.         HRESULT CopyTo( [in,out] LPBYTEBUFFER* pByteBuffer,
  212.                         [in] LONG cb,
  213.                         [in,out, defaultvalue(NULL)] LONG* pcbRead,
  214.                         [in,out, defaultvalue(NULL)] LONG* pcbWritten);
  215.  
  216.         [   id(4),
  217.             helpstring("Initializes the object. This must be called prior to calling any other methods!")]
  218.         HRESULT Initialize( [in, defaultvalue(1)] LONG lSize,
  219.                             [in, defaultvalue(NULL)] BYTE* pData );
  220.  
  221.         [   id(5),
  222.             helpstring("Restricts access to a specified range of bytes in the buffer object.")
  223.         ]
  224.         HRESULT LockRegion( [in] LONG libOffset,
  225.                             [in] LONG cb,
  226.                             [in] LONG dwLockType);
  227.  
  228.         [   id(6),
  229.             helpstring("Reads a specified number of bytes from the buffer object into memory starting at the current seek pointer.")
  230.         ]
  231.         HRESULT Read(   [in,out] BYTE* pByte,
  232.                         [in] LONG cb,
  233.                         [in, out, defaultvalue(NULL)] LONG* pcbRead);
  234.  
  235.         [   id(7),
  236.             helpstring("Discards all changes that have been made to a transacted stream since the last IByteBuffer::Commit call.")
  237.         ]
  238.         HRESULT Revert ( void );
  239.  
  240.         [   id(8),
  241.             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.")
  242.         ]
  243.         HRESULT Seek(   [in] LONG dLibMove,
  244.                         [in] LONG dwOrigin,
  245.                         [in,out, defaultvalue(NULL)] LONG* pLibnewPosition);
  246.  
  247.         [   id(9),
  248.             helpstring("Changes the size of the stream object.")
  249.         ]
  250.         HRESULT SetSize([in] LONG libNewSize);
  251.  
  252.         [   id(10),
  253.             helpstring("Retrieves the STATSTG structure for this object.")
  254.         ]
  255.         HRESULT Stat(   [in,out] LPSTATSTRUCT pstatstg,
  256.                         [in] LONG grfStatFlag);
  257.         [   id(11),
  258.             helpstring("Removes the access restriction on a range of bytes previously restricted with IByteBuffer::LockRegion.")
  259.         ]
  260.         HRESULT UnlockRegion(   [in] LONG libOffset,
  261.                                 [in] LONG cb,
  262.                                 [in] LONG dwLockType);
  263.  
  264.         [   id(12),
  265.             helpstring("Writes a specified number from bytes into the stream object starting at the current seek pointer.")
  266.         ]
  267.         HRESULT Write(  [in,out] BYTE* pByte,
  268.                         [in] LONG cb,
  269.                         [in,out] LONG* pcbWritten);
  270.     };
  271. cpp_quote("#endif //_LPBYTEBUFFER_DEFINED")
  272.  
  273. cpp_quote("")
  274. cpp_quote("//////////////////////////////////////////////////////////////////")
  275. cpp_quote("//")
  276. cpp_quote("// ISCardTypeConv Interface Definition")
  277. cpp_quote("//")
  278.  
  279. cpp_quote("#ifndef _LPSCARDTYPECONV_DEFINED")
  280. cpp_quote("#define _LPSCARDTYPECONV_DEFINED")
  281.     [
  282.         object,
  283.         uuid(53B6AA63-3F56-11D0-916B-00AA00C18068),
  284.         dual,
  285.         helpstring("ISCardTypeConv Interface"),
  286.         //hidden,
  287.         //restricted,       // prevent macro programming?
  288.         version(1.0),
  289.         pointer_default(unique)
  290.     ]
  291.     interface ISCardTypeConv : IDispatch
  292.     {
  293.         // Includes:
  294.  
  295.         import "oaidl.idl";
  296.  
  297.         // Pointer(s);
  298.  
  299.         typedef [unique] ISCardTypeConv *LPSCARDTYPECONV;
  300.  
  301.         // Methods:
  302.  
  303.         [id(0), helpstring("Convert an array of bytes to an IByteBuffer")]
  304.         HRESULT ConvertByteArrayToByteBuffer(
  305.                     [in] LPBYTE pbyArray,
  306.                     [in] DWORD dwArraySize,
  307.                     [out,retval] LPBYTEBUFFER *ppbyBuffer);
  308.  
  309.         [id(1), helpstring("Convert an IByteBuffer to an array of bytes")]
  310.         HRESULT ConvertByteBufferToByteArray(
  311.                     [in] LPBYTEBUFFER pbyBuffer,
  312.                     [out,retval] LPBYTEARRAY *ppArray);
  313.  
  314.         [id(2), helpstring("Convert an IByteBuffer to a SAFEARRAY(unsigned char)")]
  315.         HRESULT ConvertByteBufferToSafeArray(
  316.                     [in] LPBYTEBUFFER pbyBuffer,
  317.                     [out,retval] LPSAFEARRAY *ppbyArray);
  318.  
  319.         [id(3), helpstring("Convert a SAFEARRAY(unsigned char) to an IByteBuffer")]
  320.         HRESULT ConvertSafeArrayToByteBuffer(
  321.                     [in] LPSAFEARRAY pbyArray,
  322.                     [out,retval] LPBYTEBUFFER *ppbyBuff);
  323.  
  324.         [id(4), helpstring("Create an array of bytes")]
  325.         HRESULT CreateByteArray(
  326.                     [in] DWORD dwAllocSize,
  327.                     [out,retval] LPBYTE *ppbyArray);
  328.  
  329.         [id(5), helpstring("Create an IByteBuffer object")]
  330.         HRESULT CreateByteBuffer(
  331.                     [in] DWORD dwAllocSize,
  332.                     [out,retval] LPBYTEBUFFER *ppbyBuff);
  333.  
  334.         [id(6), helpstring("Create a SAFEARRAY(unsigned char)")]
  335.         HRESULT CreateSafeArray(
  336.                     [in] UINT nAllocSize,
  337.                     [out,retval] LPSAFEARRAY *ppArray);
  338.  
  339.         [id(7), helpstring("Free a pointer to the memory block managed by the IStream")]
  340.         HRESULT FreeIStreamMemoryPtr(
  341.                     [in] LPSTREAM pStrm,
  342.                     [in] LPBYTE pMem);
  343.  
  344.         [id(8), helpstring("Get a pointer to the memory block managed by the IStream")]
  345.         HRESULT GetAtIStreamMemory(
  346.                     [in] LPSTREAM pStrm,
  347.                     [out,retval] LPBYTEARRAY *ppMem);
  348.  
  349.         [id(9), helpstring("How many bytes are in the given IStream")]
  350.         HRESULT SizeOfIStream(
  351.                     [in] LPSTREAM pStrm,
  352.                     [out,retval] ULARGE_INTEGER* puliSize);
  353.     };
  354. cpp_quote("#endif // _LPSCARDTYPECONV_DEFINED")
  355.  
  356.  
  357. cpp_quote("")
  358. cpp_quote("//////////////////////////////////////////////////////////////////")
  359. cpp_quote("//")
  360. cpp_quote("// ISCardCmd Interface Definition")
  361. cpp_quote("//")
  362.  
  363. cpp_quote("#ifndef _LPSCARDCMD_DEFINED")
  364. cpp_quote("#define _LPSCARDCMD_DEFINED")
  365.     [
  366.         object,
  367.         uuid(D5778AE3-43DE-11D0-9171-00AA00C18068),
  368.         dual,
  369.         helpstring("ISCardCmd Interface"),
  370.         //hidden,
  371.         //restricted,       // prevent macro programming?
  372.         version(1.1),
  373.         pointer_default(unique)
  374.     ]
  375.     interface ISCardCmd : IDispatch
  376.     {
  377.         // Includes -
  378.  
  379.         import "oaidl.idl";
  380.  
  381.         // Pointer(s) -
  382.  
  383.         typedef [unique] ISCardCmd *LPSCARDCMD;
  384.  
  385.         // Properties -
  386.  
  387.         [id(0), propget/*, defaultcollelem*/,
  388.          helpstring("Get the raw ISO 7816 APDU string")]
  389.         HRESULT Apdu([out,retval] LPBYTEBUFFER *ppApdu);
  390.  
  391.         [id(0), propput/*, defaultcollelem*/,
  392.          helpstring("Copy a new APDU over the current one")]
  393.         HRESULT Apdu([in] LPBYTEBUFFER pApdu);
  394.  
  395.         [id(1), propget/*, defaultcollelem*/,
  396.          helpstring("Get the byte count (size) of the raw ISO 7816 APDU string")]
  397.         HRESULT ApduLength([out,retval] LONG* plSize);
  398.  
  399.         [id(2), propget/*, defaultcollelem*/,
  400.          helpstring("Get the raw reply ISO 7816 APDU string")]
  401.         HRESULT ApduReply([out,retval] LPBYTEBUFFER *ppReplyApdu);
  402.  
  403.         [id(2), propput/*, defaultcollelem*/,
  404.          helpstring("Set the raw reply ISO 7816 APDU string")]
  405.         HRESULT ApduReply([in] LPBYTEBUFFER pReplyApdu);
  406.  
  407.         [id(3), propget/*, defaultcollelem*/,
  408.          helpstring("Get the byte count (size) of the raw reply ISO 7816 APDU string")]
  409.         HRESULT ApduReplyLength([out,retval] LONG* plSize);
  410.  
  411.         [id(3), propput/*, defaultcollelem*/,
  412.          helpstring("Set the byte count (size) of the raw reply ISO 7816 APDU string")]
  413.         HRESULT ApduReplyLength([in] LONG lSize);
  414.  
  415.         [id(4), propget/*, defaultcollelem*/,
  416.          helpstring("Get the current class ID of the ISO 7816 APDU header")]
  417.         HRESULT ClassId([out,retval] BYTE* pbyClass);
  418.  
  419.         [id(4), propput/*, defaultcollelem*/,
  420.          helpstring("Assign a new class ID in the ISO 7816 APDU header")]
  421.         HRESULT ClassId([in,defaultvalue(0)] BYTE byClass);
  422.  
  423.         [id(5), propget/*, defaultcollelem*/,
  424.          helpstring("Get the current data portion of the ISO 7816 APDU string")]
  425.         HRESULT Data([out,retval] LPBYTEBUFFER *ppData);
  426.  
  427.         [id(5), propput/*, defaultcollelem*/,
  428.          helpstring("Assign a new data portion of the ISO 7816 APDU string")]
  429.         HRESULT Data([in] LPBYTEBUFFER pData);
  430.  
  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.  
  435.         [id(6), propput/*, defaultcollelem*/,
  436.          helpstring("Assign a new instruction ID in the ISO 7816 APDU header")]
  437.         HRESULT InstructionId([in] BYTE byIns);
  438.  
  439.         [id(7), propget/*, defaultcollelem*/,
  440.          helpstring("Get the Le parameter (expected length of reply data) of the ISO 7816 APDU")]
  441.         HRESULT LeField([out,retval] LONG* plSize);
  442.  
  443.         [id(8), propget/*, defaultcollelem*/,
  444.          helpstring("Get the first parameter of the ISO 7816 APDU header")]
  445.         HRESULT P1([out,retval] BYTE* pbyP1);
  446.  
  447.         [id(8), propput/*, defaultcollelem*/,
  448.          helpstring("Assign a new first parameter in the ISO 7816 APDU header")]
  449.         HRESULT P1([in] BYTE byP1);
  450.  
  451.         [id(9), propget/*, defaultcollelem*/,
  452.          helpstring("Get the second parameter of the ISO 7816 APDU header")]
  453.         HRESULT P2([out,retval] BYTE* pbyP2);
  454.  
  455.         [id(9), propput/*, defaultcollelem*/,
  456.          helpstring("Assign a new second parameter in the ISO 7816 APDU header")]
  457.         HRESULT P2([in] BYTE byP2);
  458.  
  459.         [id(10), propget/*, defaultcollelem*/,
  460.          helpstring("Get the third parameter of the ISO 7816 APDU header")]
  461.         HRESULT P3([out,retval] BYTE* pbyP3);
  462.  
  463.         [id(11), propget/*, defaultcollelem*/,
  464.          helpstring("Get the reply status word")]
  465.         HRESULT ReplyStatus([out,retval] LPWORD pwStatus);
  466.  
  467.         [id(11), propput/*, defaultcollelem*/,
  468.          helpstring("Set (save) the reply status word")]
  469.         HRESULT ReplyStatus([in] WORD wStatus);
  470.  
  471.         [id(12), propget/*, defaultcollelem*/,
  472.          helpstring("Get the reply status SW1 byte.")]
  473.         HRESULT ReplyStatusSW1([out,retval] BYTE* pbySW1);
  474.  
  475.         [id(13), propget/*, defaultcollelem*/,
  476.          helpstring("Get the reply status SW2 byte.")]
  477.         HRESULT ReplyStatusSW2([out,retval] BYTE* pbySW2);
  478.  
  479.         [id(14), propget/*, defaultcollelem*/,
  480.          helpstring("Get the current ISO 7816-4 type of the encapsulated APDU.")]
  481.         HRESULT Type([out,retval] ISO_APDU_TYPE* pType);
  482.  
  483.         [id(18), propget/*, defaultcollelem*/,
  484.          helpstring("Get the T=1 Node Address")]
  485.         HRESULT Nad([out,retval] LPBYTE pbNad);
  486.  
  487.         [id(18), propput/*, defaultcollelem*/,
  488.          helpstring("Set (save) the T=1 Node Address")]
  489.         HRESULT Nad([in] BYTE bNad);
  490.  
  491.         [id(19), propget/*, defaultcollelem*/,
  492.          helpstring("Get the T=1 Reply Node Address")]
  493.         HRESULT ReplyNad([out,retval] LPBYTE pbNad);
  494.  
  495.         [id(19), propput/*, defaultcollelem*/,
  496.          helpstring("Set (save) the T=1 Reply Node Address")]
  497.         HRESULT ReplyNad([in] BYTE bNad);
  498.  
  499.         // Methods -
  500.  
  501.         [id(15),
  502.          helpstring("Build a valid ISO 7816 APDU string")]
  503.         HRESULT BuildCmd([in] BYTE byClassId,
  504.                          [in] BYTE byInsId,
  505.                          [in,defaultvalue(0)] BYTE byP1,
  506.                          [in,defaultvalue(0)] BYTE byP2,
  507.                          [in,defaultvalue(NULL)] LPBYTEBUFFER pbyData,
  508.                          [in,defaultvalue(NULL)] LONG* plLe);
  509.  
  510.         [id(16),
  511.          helpstring("Clear the current APDU data")]
  512.         HRESULT Clear(void);
  513.  
  514.         [id(17),
  515.          helpstring("Encapsulate onother APDU into this one as data")]
  516.         HRESULT Encapsulate([in] LPBYTEBUFFER pApdu,
  517.                             [in] ISO_APDU_TYPE ApduType);
  518.     };
  519. cpp_quote("#endif //!_LPSCARDCMD_DEFINED")
  520.  
  521.