Previous Next

MapNtStatusToWinError (VxD)

The MapNtStatusToWinError function maps an NTSTATUS code to a Microsoft® Win32® error code.

ULONG 
  MapNtStatusToWinError(
    NTSTATUS  Status
    );

Parameters

Status
The NTSTATUS value that is to be translated into a Win32® error code.

Return Value

MapNtStatusToWinError returns the translated Win32 error code.

Headers

Declared in smclib.h. Include smclib.h.

Comments

Internally, your driver should work with NTSTATUS values and not with Win32 error codes. The smart card resource manager, however, needs Win32 error codes. You can use this function in your device I/O control routine to map the NTSTATUS value to a Win32 error code. Following is an example.

DWORD
  DriverName_DeviceIoControl(
    DWORD  dwService,
    DWORD  dwDDB,
    DWORD  hDevice,
    LPDIOC lpDiocParms)
  )
{
    NTSTATUS status;

    // Let the library do parameter checking 
    // If the library requires the help of the driver it’ll call
    // the driver using a call back mechanism
    status = SmartcardDeviceControl(
        &SmartcardExtension,
        lpDiocParams
        );

    return MapNtStatusToWinError(status);
}

This function is not available when developing WDM drivers. For a list of the functions that can be used, see WDM Smart Card Driver Functions.