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.

195 lines
4.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: SCardCmd.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // SCardCmd.h : Declaration of the CSCardCmd
  11. #ifndef __SCARDCMD_H_
  12. #define __SCARDCMD_H_
  13. #include "resource.h" // main symbols
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CSCardCmd
  16. class ATL_NO_VTABLE CSCardCmd :
  17. public CComObjectRootEx<CComMultiThreadModel>,
  18. public CComCoClass<CSCardCmd, &CLSID_CSCardCmd>,
  19. public IDispatchImpl<ISCardCmd, &IID_ISCardCmd, &LIBID_SCARDSSPLib>
  20. {
  21. public:
  22. CSCardCmd()
  23. : m_bfRequestData(),
  24. m_bfResponseApdu()
  25. {
  26. m_pUnkMarshaler = NULL;
  27. m_bCla = 0;
  28. m_bIns = 0;
  29. m_bP1 = 0;
  30. m_bP2 = 0;
  31. m_wLe = 0;
  32. m_dwFlags = 0;
  33. m_bRequestNad = 0;
  34. m_bResponseNad = 0;
  35. m_bAltCla = 0;
  36. }
  37. DECLARE_REGISTRY_RESOURCEID(IDR_SCARDCMD)
  38. DECLARE_GET_CONTROLLING_UNKNOWN()
  39. DECLARE_PROTECT_FINAL_CONSTRUCT()
  40. BEGIN_COM_MAP(CSCardCmd)
  41. COM_INTERFACE_ENTRY(ISCardCmd)
  42. COM_INTERFACE_ENTRY(IDispatch)
  43. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  44. END_COM_MAP()
  45. HRESULT FinalConstruct()
  46. {
  47. return CoCreateFreeThreadedMarshaler(
  48. GetControllingUnknown(), &m_pUnkMarshaler.p);
  49. }
  50. void FinalRelease()
  51. {
  52. m_pUnkMarshaler.Release();
  53. }
  54. CComPtr<IUnknown> m_pUnkMarshaler;
  55. protected:
  56. BYTE m_bCla;
  57. BYTE m_bIns;
  58. BYTE m_bP1;
  59. BYTE m_bP2;
  60. CBuffer m_bfRequestData;
  61. CBuffer m_bfResponseApdu;
  62. WORD m_wLe;
  63. DWORD m_dwFlags;
  64. BYTE m_bRequestNad;
  65. BYTE m_bResponseNad;
  66. BYTE m_bAltCla;
  67. // ISCardCmd
  68. public:
  69. STDMETHOD(get_Apdu)(
  70. /* [retval][out] */ LPBYTEBUFFER __RPC_FAR *ppApdu);
  71. STDMETHOD(put_Apdu)(
  72. /* [in] */ LPBYTEBUFFER pApdu);
  73. STDMETHOD(get_ApduLength)(
  74. /* [retval][out] */ LONG __RPC_FAR *plSize);
  75. STDMETHOD(get_ApduReply)(
  76. /* [retval][out] */ LPBYTEBUFFER __RPC_FAR *ppReplyApdu);
  77. STDMETHOD(put_ApduReply)(
  78. /* [in] */ LPBYTEBUFFER pReplyApdu);
  79. STDMETHOD(get_ApduReplyLength)(
  80. /* [retval][out] */ LONG __RPC_FAR *plSize);
  81. STDMETHOD(put_ApduReplyLength)(
  82. /* [in] */ LONG lSize);
  83. STDMETHOD(get_ClassId)(
  84. /* [retval][out] */ BYTE __RPC_FAR *pbyClass);
  85. STDMETHOD(put_ClassId)(
  86. /* [defaultvalue][in] */ BYTE byClass = 0);
  87. STDMETHOD(get_Data)(
  88. /* [retval][out] */ LPBYTEBUFFER __RPC_FAR *ppData);
  89. STDMETHOD(put_Data)(
  90. /* [in] */ LPBYTEBUFFER pData);
  91. STDMETHOD(get_InstructionId)(
  92. /* [retval][out] */ BYTE __RPC_FAR *pbyIns);
  93. STDMETHOD(put_InstructionId)(
  94. /* [in] */ BYTE byIns);
  95. STDMETHOD(get_LeField)(
  96. /* [retval][out] */ LONG __RPC_FAR *plSize);
  97. STDMETHOD(get_P1)(
  98. /* [retval][out] */ BYTE __RPC_FAR *pbyP1);
  99. STDMETHOD(put_P1)(
  100. /* [in] */ BYTE byP1);
  101. STDMETHOD(get_P2)(
  102. /* [retval][out] */ BYTE __RPC_FAR *pbyP2);
  103. STDMETHOD(put_P2)(
  104. /* [in] */ BYTE byP2);
  105. STDMETHOD(get_P3)(
  106. /* [retval][out] */ BYTE __RPC_FAR *pbyP3);
  107. STDMETHOD(get_ReplyStatus)(
  108. /* [retval][out] */ LPWORD pwStatus);
  109. STDMETHOD(put_ReplyStatus)(
  110. /* [in] */ WORD wStatus);
  111. STDMETHOD(get_ReplyStatusSW1)(
  112. /* [retval][out] */ BYTE __RPC_FAR *pbySW1);
  113. STDMETHOD(get_ReplyStatusSW2)(
  114. /* [retval][out] */ BYTE __RPC_FAR *pbySW2);
  115. STDMETHOD(get_Type)(
  116. /* [retval][out] */ ISO_APDU_TYPE __RPC_FAR *pType);
  117. STDMETHOD(get_Nad)(
  118. /* [retval][out] */ BYTE __RPC_FAR *pbNad);
  119. STDMETHOD(put_Nad)(
  120. /* [in] */ BYTE bNad);
  121. STDMETHOD(get_ReplyNad)(
  122. /* [retval][out] */ BYTE __RPC_FAR *pbNad);
  123. STDMETHOD(put_ReplyNad)(
  124. /* [in] */ BYTE bNad);
  125. STDMETHOD(BuildCmd)(
  126. /* [in] */ BYTE byClassId,
  127. /* [in] */ BYTE byInsId,
  128. /* [defaultvalue][in] */ BYTE byP1 = 0,
  129. /* [defaultvalue][in] */ BYTE byP2 = 0,
  130. /* [defaultvalue][in] */ LPBYTEBUFFER pbyData = 0,
  131. /* [defaultvalue][in] */ LONG __RPC_FAR *plLe = 0);
  132. STDMETHOD(Clear)(
  133. void);
  134. STDMETHOD(Encapsulate)(
  135. /* [in] */ LPBYTEBUFFER pApdu,
  136. /* [in] */ ISO_APDU_TYPE ApduType);
  137. STDMETHOD(get_AlternateClassId)(
  138. /* [retval][out] */ BYTE __RPC_FAR *pbyClass);
  139. STDMETHOD(put_AlternateClassId)(
  140. /* [in] */ BYTE byClass = 0);
  141. };
  142. inline CSCardCmd *
  143. NewSCardCmd(
  144. void)
  145. {
  146. return (CSCardCmd *)NewObject(CLSID_CSCardCmd, IID_ISCardCmd);
  147. }
  148. #endif //__SCARDCMD_H_