RE: [NtDev] Re: User defined Error codes!

To set the Customer bit add -c to your MC compile line.

MC -c your messages.mc

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@Broadstor.com
xxxxx@inland.net

-----Original Message-----
From: Jeseem S [mailto:xxxxx@hotmail.com]
Sent: Wednesday, June 06, 2001 12:02 AM
To: NT Developers Interest List
Subject: [ntdev] Re: User defined Error codes!

The returned bit is as follows (taken from ntstatus.h)

// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// ±–±±±----------------------±------------------------------+
// |Sev|C|R| Facility | Code |
// ±–±±±----------------------±------------------------------+
// where
// Sev - is the severity code
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error

// C - is the Customer code flag
// R - is a reserved bit
// Facility - is the facility code
// Code - is the facility’s status code

If the Customer bit is set the OS will not try to map it to standard Win32
Error code.
So you will get the same error code (that you returned from KMD) by
GetLastError.

Regards
Jeseem
mailto:xxxxx@hotmail.com mailto:xxxxx

----- Original Message -----
From: “Varadan Venkatesh” < mailto:xxxxx
xxxxx@tataelxsi.co.in>
To: “NT Developers Interest List” < mailto:xxxxx
xxxxx@lists.osr.com>
Sent: Wednesday, June 06, 2001 11:17 AM
Subject: [ntdev] User defined Error codes!

> Hello
>
> I have some clarifications on defining user defined error codes.
> I am writing a WDM based kernel mode driver (KMD). I have a user mode
> application talking to this driver through Win 32 API’s (predominantly
> DeviceIoControl).
>
> When the user mode app invokes DeviceIoControl, it translates to a
> IRP_MJ_DEVICE_CONTROL to the KMD. Now based on the input parameters(in the
> input buffer in Irp.AssociatedIRP.SystemBuffer), some validations are
done.
> And if any of these are invalid, i need to return an error to the user
app.
> I define a error code STATUS_INVALID_PARAM using the .mc resource file.
when
> the parameters are invalid, this error is set in the Irp.IoStatus.Status.
> and the DEVICE_CONTROL irp is completed. Now when the contol returns to
the
> user mode app, DeviceIoControl returns FALSE and GetLastError returns
> ERROR_MR_MID_NOT_FOUND (The system cannot find message text for message
> number 0x%1 in the message file for %2).
>
> This means that the system is not able to map our user defined STATUS_XXX
> messages to ERROR_XXX messages (win 32 error codes).
>
> How do i overcome this? Basically my requirement is I need to define my
own
> error codes in KMD and need it to get reflected in the user mode.
>
> Any pointers in this direction would be greatly appreciated,
>
> Thanks
> Venky
>
>
> —
> You are currently subscribed to ntdev as: mailto:xxxxx
xxxxx@hotmail.com
> To unsubscribe send a blank email to
mailto:leave-ntdev- leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> —
You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</mailto:leave-ntdev-></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>