WRPHELP.H

/*++ 

Copyright (c) 1996 Microsoft Corporation

Module Name:

WrpHelp

Abstract:

This file contains the class declarations for wrapper helper classes

Author:

Environment:

Win32, C++ w/Exceptions, ATL, COM/OLE

Revision History:

Notes:

--*/

#ifndef __WRPHELP_H__
#define __WRPHELP_H__

/////////////////////////////////////////////////////////////////////////////
//
// Includes
//
#ifndef __LOWLEVEL_SSP_COM__
#define __LOWLEVEL_SSP_COM__
#include <scarddat.h>
#include <scardmgr.h>
#include <scardsrv.h>
#endif

/////////////////////////////////////////////////////////////////////////////
//
// Class Declaration
//
class CCriticalSection
{
// Members
private:

CRITICAL_SECTIONm_CriticalSection;

public:

// Construction/Destruction
public:
CCriticalSection();

~CCriticalSection();

// Methods
BOOL EnterCriticalSection();
BOOL ExitCriticalSection();
};

/////////////////////////////////////////////////////////////////////////////
//
// Class Declaration
//
class CGrabData
{
// members
private:
LPSCARDCMDm_pISCardCmd;
LPSCARDm_pISCard;
LPSCARDISO7816m_pISCardISO7816;
LPSCARDTYPECONV m_pISCardTypeConv;
LONGm_lReplyLength;
WORDm_wReplyStatus;

public:

public:

// Construction/Destruction
CGrabData(LPSCARDCMD pISCardCmd,
LPSCARD pISCard, LPSCARDISO7816 pISCardIso,
LPSCARDTYPECONV pISCardTypeConv) {
if ( (pISCardCmd == NULL) || (pISCard == NULL)
|| (pISCardIso == NULL) || (pISCardTypeConv == NULL) )
delete (this);
m_pISCardCmd = pISCardCmd;
m_pISCard = pISCard;
m_pISCardISO7816 = pISCardIso;
m_pISCardTypeConv = pISCardTypeConv;
}

~CGrabData() {}

// Methods
HRESULT GetExtraData(LPBYTEBUFFER *ppDataOut,
WORD *pwCmdStatus,
LONG *plDataLength);
};

//////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////
//
// Other helpful routines
//
HRESULT
SspCreateByteArray(
IN DWORD dwAllocSize,
OUT LPBYTE *ppbyArray,
OUT OPTIONAL EXCEPINFO* pExceptInfo);

HRESULT
SspConvertDwordToByte(
IN DWORD dwNum,
OUT LPBYTE *ppbyArray,
OUT LPDWORD pdwByteArraySize,
OUT OPTIONAL EXCEPINFO* pExceptInfo);

HRESULT
SspFreeByteArray(
IN LPBYTE pbyArray,
OUT OPTIONAL EXCEPINFO* pExceptInfo);


#endif // __CRITSEC_H__