SCardEstablishContext

The SCardEstablishContext function establishes the resource manager context (the scope) within which database operations are performed.

LONG SCardEstablishContext(
  IN  DWORD dwScope,        
  IN  LPCVOID pvReserved1,  
  IN  LPCVOID pvReserved2,  
  OUT LPSCARDCONTEXT phContext  
);
 

Parameters

dwScope
Supplies the scope of the resource manager context. Possible values are:
Value Meaning
SCARD_SCOPE_USER Database operations are performed within the domain of the user.
SCARD_SCOPE_SYSTEM Database operations are performed within the domain of the system. (The calling application must have appropriate access permissions for any database actions.)

pvReserved1
Reserved for future use, and must be NULL. Reserved to allow a suitably privileged management application to act on behalf of another user.
pvReserved2
Reserved for future use, and must be NULL. Reserved to allow a suitably privileged management application to act on behalf of another terminal.
phContext
Receives a handle to the established resource manager context. This handle can now be supplied to other functions attempting to do work within this context.

Return Values

If the function… The return value is…
Succeeds SCARD_S_SUCCESS.
Fails An error code (see Error Codes for a list of all error codes).

Remarks

The context handle returned by SCardEstablishContext can be used by database query and management functions. For a description of these functions see, Smart Card Database Query Functions and Smart Card Database Management Functions.

To release an established resource manager context, see SCardReleaseContext.

QuickInfo

  Windows NT: Use version 4.0 SP3 and later.
  Windows: Use Windows 95 OSR2.1.
  Windows CE: Unsupported.
  Header: Declared in winscard.h.
  Import Library: Link with winscard.lib.

See Also

SCardReleaseContext