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

  1. /*++
  2.  
  3. Copyright (c) 1996  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     SCardSrv
  8.  
  9. Abstract:
  10.  
  11.     IDL source for SCardSrv.DLL. This in-process server (DLL)
  12.     encapsulates the services oriented COM interfaces for the
  13.     Smart Card Service Provider (SSP) ISO 7816 Services.
  14.     
  15. Author:
  16.  
  17.     Michael Gallagher (a-mgalla) 10/21/1996
  18.  
  19. Environment:
  20.  
  21.     Win32
  22.  
  23. Revision History:
  24.  
  25.     Mike Gallagher (a-mgalla) 2/4/1997
  26.     Chris Dudley (cdudley) 4/11/1997
  27.     Chris Dudley (cdudley) 7/7/1997
  28.  
  29. Notes:
  30.  
  31.     1. This file will be processed by the MIDL tool to produce
  32.         the type library (SCardSrv.tlb) and marshalling code. A
  33.         header file named SCardSrv.h will be generated by the
  34.         MIDL compiler for the ATL CPP code to use.
  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 Cards Support")
  56. cpp_quote("//  Copyright (C) Microsoft Corporation, 1996.")
  57. cpp_quote("//")
  58. cpp_quote("//")
  59. cpp_quote("// File: SCardSrv.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 "SspsIdl.idl";
  72. #endif
  73.  
  74. interface ISCardISO7816;
  75.  
  76.  
  77. cpp_quote("")
  78. cpp_quote("//////////////////////////////////////////////////////////////////")
  79. cpp_quote("//")
  80. cpp_quote("// Constants and Types")
  81. cpp_quote("//")
  82.  
  83. cpp_quote("#ifndef _NULL_DEFINED")
  84.     cpp_quote("#define _NULL_DEFINED")
  85.     #define NULL    0
  86. cpp_quote("#endif // !_NULL_DEFINED")
  87.  
  88. cpp_quote("#ifndef _NULL_BYTE_DEFINED")
  89.     cpp_quote("#define _NULL_BYTE_DEFINED")
  90.     cpp_quote("#define NULL_BYTE    (0x00)")
  91.     #define NULL_BYTE               (0x00)
  92. cpp_quote("#endif  // !_NULL_BYTE_DEFINED")
  93.  
  94. //
  95. // The following values are merely defined as default states for use
  96. // here in this IDL file. They will NOT be bound into the type library
  97. // for use.
  98. //
  99. // These codes are defined in \\nt\private\ispu\calais\ssps\inc\IsoCodes.h
  100. // for use and redefinition, if wanted, in the sources of the SCardSrv.DLL.
  101. //
  102. //
  103. #define ISO_OPEN_LOGICAL_CHANNEL    (0x00)
  104. #define ISO_CLOSE_LOGICAL_CHANNEL   (0x80)
  105.  
  106. #define ISO_LOGICAL_CHANNEL_0       (0x00)
  107. #define ISO_LOGICAL_CHANNEL_1       (0x01)
  108. #define ISO_LOGICAL_CHANNEL_2       (0x02)
  109. #define ISO_LOGICAL_CHANNEL_3       (0x03)
  110. //
  111. //
  112.  
  113.  
  114. cpp_quote("")
  115. cpp_quote("//////////////////////////////////////////////////////////////////")
  116. cpp_quote("//")
  117. cpp_quote("// ISCardISO7816 Interface Definition")
  118. cpp_quote("//")
  119.  
  120. cpp_quote("#ifndef _LPSCARDISO7816_DEFINED")
  121. cpp_quote("#define _LPSCARDISO7816_DEFINED")
  122.     [
  123.         object,
  124.         uuid(53B6AA68-3F56-11D0-916B-00AA00C18068),
  125.         dual,
  126.         helpstring("ISCardISO7816 Interface"),
  127.         //hidden,
  128.         //restricted,       // prevent macro programming?
  129.         //version(1.0),
  130.         pointer_default(unique)
  131.     ]
  132.     interface ISCardISO7816 : IDispatch
  133.     {
  134.         // Include(s) -
  135.  
  136.         import "oaidl.idl";
  137.                 
  138.         // Pointer(s) -
  139.  
  140.         typedef [unique] ISCardISO7816 *LPSCARDISO;
  141.         typedef [unique] LPSCARDISO LPSCARDISO7816;
  142.         
  143.         // Methods -
  144.  
  145.         [id(0),
  146.          helpstring("Write a record to the end of an EF of linear structure of location one of a cyclic structure")]
  147.         HRESULT AppendRecord([in, defaultvalue(NULL_BYTE)] BYTE byRefCtrl, // currently selected EF
  148.                              [in] LPBYTEBUFFER pData,
  149.                              [in, out] LPSCARDCMD *ppCmd);
  150.  
  151.         [id(1),
  152.          helpstring("Set part of an EF file content to its erased state sequentially")]
  153.         HRESULT EraseBinary([in] BYTE byP1,
  154.                             [in] BYTE byP2,
  155.                             [in, defaultvalue(NULL)]LPBYTEBUFFER pData,
  156.                             [in, out] LPSCARDCMD *ppCmd);
  157.  
  158.         [id(2),
  159.          helpstring("Update the card after a GET CHALLENGE command serviced")]
  160.         HRESULT ExternalAuthenticate([in,defaultvalue(NULL_BYTE)]BYTE byAlgorithmRef,
  161.                                      [in, defaultvalue(NULL_BYTE)] BYTE bySecretRef,
  162.                                      [in, defaultvalue(NULL)] LPBYTEBUFFER pChallenge,
  163.                                      [in, out] LPSCARDCMD *ppCmd);
  164.  
  165.         [id(3),
  166.          helpstring("Issue a challenge for use in a security related procedure")]
  167.         HRESULT GetChallenge([in, defaultvalue(0)] LONG lBytesExpected,
  168.                              [in, out] LPSCARDCMD *ppCmd);
  169.  
  170.         [id(4),
  171.          helpstring("Retrieve a primitive data object")]
  172.         HRESULT GetData([in] BYTE byP1,
  173.                         [in] BYTE byP2,
  174.                         [in, defaultvalue(0)] LONG lBytesToGet,
  175.                         [in, out] LPSCARDCMD *ppCmd);
  176.  
  177.         [id(5),
  178.          helpstring("Retrieve further data")]
  179.         HRESULT GetResponse([in, defaultvalue(0)] BYTE byP1, //=0
  180.                             [in, defaultvalue(0)] BYTE byP2, //=0
  181.                             [in, defaultvalue(0)] LONG lDataLength, // =0
  182.                             [in, out] LPSCARDCMD *ppCmd);
  183.  
  184.         [id(6),
  185.          helpstring("Compute authentication data on card using challenge data sent to card")]
  186.         HRESULT InternalAuthenticate([in, defaultvalue(NULL_BYTE)] BYTE byAlgorithmRef,
  187.                                      [in, defaultvalue(NULL_BYTE)] BYTE bySecretRef,
  188.                                      [in] LPBYTEBUFFER pChallenge,
  189.                                      [in, defaultvalue(0)] LONG lReplyBytes,
  190.                                      [in, out] LPSCARDCMD *ppCmd);
  191.  
  192.         [id(7),
  193.          helpstring("Open or close a logical channel")]
  194.         HRESULT ManageChannel([in, defaultvalue(ISO_CLOSE_LOGICAL_CHANNEL)] BYTE byChannelState,
  195.                               [in, defaultvalue(ISO_LOGICAL_CHANNEL_0)] BYTE byChannel,
  196.                               [in, out] LPSCARDCMD *ppCmd);
  197.  
  198.         [id(8),
  199.          helpstring("Write a primitive data object")]
  200.         HRESULT PutData([in] BYTE byP1,
  201.                         [in] BYTE byP2,
  202.                         [in] LPBYTEBUFFER pData,
  203.                         [in, out] LPSCARDCMD *ppCmd);
  204.  
  205.         [id(9),
  206.          helpstring("Read part of the content of an EF with transparent structure")]
  207.         HRESULT ReadBinary([in] BYTE byP1,
  208.                            [in] BYTE byP2,
  209.                            [in, defaultvalue(0)] LONG lBytesToRead,
  210.                            [in, out] LPSCARDCMD *ppCmd);
  211.  
  212.         [id(10),
  213.          helpstring("Read contents of a specified record from an EF")]
  214.         HRESULT ReadRecord([in, defaultvalue(NULL_BYTE)] BYTE byRecordId, // current record
  215.                            [in] BYTE byRefCtrl,
  216.                            [in, defaultvalue(0)] LONG lBytesToRead,
  217.                            [in, out] LPSCARDCMD *ppCmd);
  218.  
  219.         [id(11),
  220.          helpstring("Set a current file within a logical channel")]
  221.         HRESULT SelectFile([in] BYTE byP1,
  222.                            [in] BYTE byP2,
  223.                            [in, defaultvalue(NULL)] LPBYTEBUFFER pData,
  224.                            [in, defaultvalue(0)] LONG lBytesToRead,
  225.                            [in, out] LPSCARDCMD *ppCmd);
  226.  
  227.         [id(12),
  228.          helpstring("Change the default class ID used in command construction")]
  229.         HRESULT SetDefaultClassId([in] BYTE byClass);
  230.  
  231.         [id(13),
  232.          helpstring("Update bits already present in an EF with command APDU bits")]
  233.         HRESULT UpdateBinary([in] BYTE byP1,
  234.                              [in] BYTE byP2,
  235.                              [in] LPBYTEBUFFER pData,
  236.                              [in, out] LPSCARDCMD *ppCmd);
  237.  
  238.         [id(14),
  239.          helpstring("Update a specific record with the APDU bits")]
  240.         HRESULT UpdateRecord([in, defaultvalue(NULL_BYTE)] BYTE byRecordId, // current record
  241.                              [in, defaultvalue(NULL_BYTE)] BYTE byRefCtrl, // first record in currently selected EF
  242.                              [in] LPBYTEBUFFER pData,
  243.                              [in, out] LPSCARDCMD *ppCmd);
  244.  
  245.         [id(15),
  246.          helpstring("Compare the verification data sent to the card with its stored reference data")]
  247.         HRESULT Verify([in, defaultvalue(NULL_BYTE)] BYTE byRefCtrl, // no info is given
  248.                        [in, defaultvalue(NULL)] LPBYTEBUFFER pData,
  249.                        [in, out] LPSCARDCMD *ppCmd);
  250.  
  251.         [id(16),
  252.          helpstring("Write binary values into an EF")]
  253.         HRESULT WriteBinary([in] BYTE byP1,
  254.                             [in] BYTE byP2,
  255.                             [in] LPBYTEBUFFER pData,
  256.                             [in, out] LPSCARDCMD *ppCmd);
  257.  
  258.         [id(17),
  259.          helpstring("Write to the specified record in an EF")]
  260.         HRESULT WriteRecord([in, defaultvalue(NULL_BYTE)] BYTE byRecordId, // current record
  261.                             [in, defaultvalue(NULL_BYTE)] BYTE byRefCtrl, // first record in currently selected EF
  262.                             [in] LPBYTEBUFFER pData,
  263.                             [in, out] LPSCARDCMD *ppCmd);
  264.     };
  265. cpp_quote("#endif //!_LPSCARDISO7816_DEFINED")
  266.  
  267.  
  268. cpp_quote("")
  269. cpp_quote("//////////////////////////////////////////////////////////////////")
  270. cpp_quote("//")
  271. cpp_quote("// SCardSrv Type Library")
  272. cpp_quote("//")
  273.  
  274. [
  275.     uuid(53B6AA61-3F56-11D0-916B-00AA00C18068),
  276.     version(1.0),
  277.     //hidden,
  278.     //lcid(0x0409),     // general language
  279.     helpstring("SCardSrv 1.0 Type Library")
  280. ]
  281. library SCardSrvLib
  282. {
  283.     // NOTE: must include stdole2.tlb due to problems with the Alpha stdole32.tlb.
  284.     // This will generate warnings during build, but compile is successful.
  285.     #ifdef _ALPHA_
  286.     importlib("stdole2.tlb");
  287.     #else
  288.     importlib("stdole32.tlb");
  289.     #endif
  290.  
  291.     [
  292.         uuid(53B6AA6C-3F56-11D0-916B-00AA00C18068),
  293.         helpstring("SCardISO7816 Class"),
  294.         //hidden,
  295.         //licensed,
  296.         aggregatable
  297.     ]
  298.     coclass CSCardISO7816
  299.     {
  300.         [default] interface ISCardISO7816;
  301.     };
  302.     
  303. };
  304.