The MapNtStatusToWinError function maps a Microsoft® Windows NT® status code to a Win32® error code.
ULONG
MapNtStatusToWinError(
NTSTATUS Status
);
MapNtStatusToWinError returns the translated Win32 error code.
Internally, your driver should work with Windows NT status 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 Windows NT status 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 Driver Functions.