Re: NET ERROR MSG

Thanks Tim.

I tried it & it gave the message box

“CreateFile failed Errorcode 87”.

I am trying to find out error code 87 with NET HELPMSG 87, but got the error, parameter not correct.

I referred to the following page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdk40/html/cerefneterrors-numericalorder.asp

It specifies the error code values as 4 digits. There are system error codes, from which 87 = Parameter is incorrect, ERROR_INVALID_PARAMETER.

But it is not a NET ERROR.

Please advise.

Thanks,
Harsha

Tim Roberts wrote:
Harsha Inamdar wrote:

> I am trying to create a device handle using CreateFile function. This
> handle is given as a input to DeviceIoControl function.
>
> Device_Handle =CreateFile(
> pDeviceInterfaceDetailData->DevicePath,
> GENERIC_READ,
> FILE_SHARE_READ,
> NULL,
> OPEN_EXISTING,
> 0,
> NULL
> )
>
> But it returns INVALID_HANDLE_VALUE. The driver is loaded into the system.

Follow this with a call to GetLastError to find out what the problem was.
if( Device_Handle == INVALID_HANDLE_VALUE )
{
char sz[80];
sprintf( sz, “CreateFile failed, error %d”, GetLastError() );
MessageBox( 0, sz, “CreateFile”, MB_OK );
return;
}

> Also if there is more than one device, is it possible to have an array
> of device handles?
>
> HANDLE Device_Handle[3] is it possible?

Sure, but it requires three separate calls to CreateFile, and you would
have to have some way to distinguish between the instances in the file
name. You can’t magically open all 3 at once.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

“net helpmsg” is a generic way you can query the Win32 message catalog. NET
HELPMSG just uses FormatMessage with FORMAT_MESSAGE_FROM_SYSTEM. It does
not have a hard-coded list of network error codes. Therefore, it can
translate most of the error codes in <winerror.h> for you. There is no
separate namespace of “net errors” that is separate from “Win32 errors”.
You are not getting an error from “NET HELPMSG” – NET HELPMSG is telling
you that the description for error code 87 is “Invalid parameter”.

Another way to print out error messages is the !error debugger extensino.
And you are using a debugger, right? If you’re using Visual Studio, there’s
a debugger hint that the current value is an error code, and VS will
automatically look up and display the error text for you. Enter the
variable in the watch window as “error,hr” (assuming the variable is named
“error”). The “,hr” is a hint to the debugger that it’s an HRESULT. Since
you’re dealing with Win32 error codes, which are not HRESULTs, you’ll have
to convert them to HRESULTs first, by using the HRESULT_FROM_WIN32 macro,
like so:

foo()
{
HRESULT result;
HANDLE handle;

handle = CreateFile(…);
if (handle == INVALID_HANDLE_RESULT) {
result = HRESULT_FROM_WIN32(GetLastError());
// set breakpoint here
}
}

When the breakpoint fires, examine the ‘result’ variable. You shouldn’t
need to add the “,hr” suffix, but if VS doesn’t automatically display it,
use the suffix and add it to the watch window. The HRESULT_FROM_WIN32 macro
just encodes a Win32 error code (which is a small positive integer) as an
HRESULT (which has an “error” bit, a “facility code” which is set to
FACILITY_WIN32, and the Win32 error code in the bottom 16 bits).

FormatMessage will handle both Win32 error codes and HRESULTs.

– arlie

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Harsha Inamdar
Sent: Thursday, April 06, 2006 10:42 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] NET ERROR MSG

Thanks Tim.

I tried it & it gave the message box

“CreateFile failed Errorcode 87”.

I am trying to find out error code 87 with NET HELPMSG 87, but got the
error, parameter not correct.

I referred to the following page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdk40/ht
ml/cerefneterrors-numericalorder.asp

It specifies the error code values as 4 digits. There are system error
codes, from which 87 = Parameter is incorrect, ERROR_INVALID_PARAMETER.

But it is not a NET ERROR.

Please advise.

Thanks,
Harsha</winerror.h>

Although this isn’t going to help the OP, I would like to point out that
the Vista WDK finally includes winerror.exe in the tools directory. So
if you have the beta (or once it ships) you can do

C:\Documents and Settings\peter>winerror 87
87 ERROR_INVALID_PARAMETER <–> 0x40000002
STATUS_WORKING_SET_LIMIT_RANGE
87 ERROR_INVALID_PARAMETER <–> 0x80090308 No Symbolic Name
87 ERROR_INVALID_PARAMETER <–> 0x80090309 No Symbolic Name
87 ERROR_INVALID_PARAMETER <–> 0x8009030d No Symbolic Name
87 ERROR_INVALID_PARAMETER <–> 0x80090320 No Symbolic Name
87 ERROR_INVALID_PARAMETER <–> 0x80090326 No Symbolic Name
87 ERROR_INVALID_PARAMETER <–> 0x80090327 No Symbolic Name
87 ERROR_INVALID_PARAMETER <–> 0xc0000003 STATUS_INVALID_INFO_CLASS
87 ERROR_INVALID_PARAMETER <–> 0xc000000b STATUS_INVALID_CID
87 ERROR_INVALID_PARAMETER <–> 0xc000000d STATUS_INVALID_PARAMETER
87 ERROR_INVALID_PARAMETER <–> 0xc000001a STATUS_UNABLE_TO_FREE_VM
87 ERROR_INVALID_PARAMETER <–> 0xc000001b
STATUS_UNABLE_TO_DELETE_SECTION
87 ERROR_INVALID_PARAMETER <–> 0xc0000030
STATUS_INVALID_PARAMETER_MIX
87 ERROR_INVALID_PARAMETER <–> 0xc0000045
STATUS_INVALID_PAGE_PROTECTION
87 ERROR_INVALID_PARAMETER <–> 0xc0000048 STATUS_PORT_ALREADY_SET
87 ERROR_INVALID_PARAMETER <–> 0xc0000049 STATUS_SECTION_NOT_IMAGE
87 ERROR_INVALID_PARAMETER <–> 0xc000004c
STATUS_BAD_WORKING_SET_LIMIT
87 ERROR_INVALID_PARAMETER <–> 0xc000004d
STATUS_INCOMPATIBLE_FILE_MAP
87 ERROR_INVALID_PARAMETER <–> 0xc000004e STATUS_SECTION_PROTECTION
87 ERROR_INVALID_PARAMETER <–> 0xc00000a9
STATUS_BAD_MASTER_BOOT_RECORD
87 ERROR_INVALID_PARAMETER <–> 0xc00000ef
STATUS_INVALID_PARAMETER_1
87 ERROR_INVALID_PARAMETER <–> 0xc00000f0
STATUS_INVALID_PARAMETER_2
87 ERROR_INVALID_PARAMETER <–> 0xc00000f1
STATUS_INVALID_PARAMETER_3
87 ERROR_INVALID_PARAMETER <–> 0xc00000f2
STATUS_INVALID_PARAMETER_4
87 ERROR_INVALID_PARAMETER <–> 0xc00000f3
STATUS_INVALID_PARAMETER_5
87 ERROR_INVALID_PARAMETER <–> 0xc00000f4
STATUS_INVALID_PARAMETER_6
87 ERROR_INVALID_PARAMETER <–> 0xc00000f5
STATUS_INVALID_PARAMETER_7
87 ERROR_INVALID_PARAMETER <–> 0xc00000f6
STATUS_INVALID_PARAMETER_8
87 ERROR_INVALID_PARAMETER <–> 0xc00000f7
STATUS_INVALID_PARAMETER_9
87 ERROR_INVALID_PARAMETER <–> 0xc00000f8
STATUS_INVALID_PARAMETER_10
87 ERROR_INVALID_PARAMETER <–> 0xc00000f9
STATUS_INVALID_PARAMETER_11
87 ERROR_INVALID_PARAMETER <–> 0xc00000fa
STATUS_INVALID_PARAMETER_12
87 ERROR_INVALID_PARAMETER <–> 0xc0000182
STATUS_DEVICE_CONFIGURATION_ERROR
87 ERROR_INVALID_PARAMETER <–> 0xc0000229 STATUS_FAIL_CHECK

(winerror 0x57 would show the same thing).

If you want to decode an NT status, you’d do:

C:\Documents and Settings\peter>winerror -s 0xc000000d
87 ERROR_INVALID_PARAMETER <–> c000000d STATUS_INVALID_PARAMETER

The error numbers are based on the Vista error mappings, so it may be a
little off for previous OS’s, but we don’t tend to change the error
mappings, just add some new ones.

Sorry - just wanted to plug it.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Arlie Davis
Sent: Thursday, April 06, 2006 8:04 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] NET ERROR MSG

“net helpmsg” is a generic way you can query the Win32 message catalog.
NET HELPMSG just uses FormatMessage with FORMAT_MESSAGE_FROM_SYSTEM. It
does not have a hard-coded list of network error codes. Therefore, it
can translate most of the error codes in <winerror.h> for you. There is
no separate namespace of “net errors” that is separate from “Win32
errors”.
You are not getting an error from “NET HELPMSG” – NET HELPMSG is
telling you that the description for error code 87 is “Invalid
parameter”.

Another way to print out error messages is the !error debugger
extensino.
And you are using a debugger, right? If you’re using Visual Studio,
there’s a debugger hint that the current value is an error code, and VS
will automatically look up and display the error text for you. Enter
the variable in the watch window as “error,hr” (assuming the variable is
named “error”). The “,hr” is a hint to the debugger that it’s an
HRESULT. Since you’re dealing with Win32 error codes, which are not
HRESULTs, you’ll have to convert them to HRESULTs first, by using the
HRESULT_FROM_WIN32 macro, like so:

foo()
{
HRESULT result;
HANDLE handle;

handle = CreateFile(…);
if (handle == INVALID_HANDLE_RESULT) {
result = HRESULT_FROM_WIN32(GetLastError());
// set breakpoint here
}
}

When the breakpoint fires, examine the ‘result’ variable. You shouldn’t
need to add the “,hr” suffix, but if VS doesn’t automatically display
it, use the suffix and add it to the watch window. The
HRESULT_FROM_WIN32 macro just encodes a Win32 error code (which is a
small positive integer) as an HRESULT (which has an “error” bit, a
“facility code” which is set to FACILITY_WIN32, and the Win32 error code
in the bottom 16 bits).

FormatMessage will handle both Win32 error codes and HRESULTs.

– arlie

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Harsha Inamdar
Sent: Thursday, April 06, 2006 10:42 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] NET ERROR MSG

Thanks Tim.

I tried it & it gave the message box

“CreateFile failed Errorcode 87”.

I am trying to find out error code 87 with NET HELPMSG 87, but got the
error, parameter not correct.

I referred to the following page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdk4
0/ht
ml/cerefneterrors-numericalorder.asp

It specifies the error code values as 4 digits. There are system error
codes, from which 87 = Parameter is incorrect, ERROR_INVALID_PARAMETER.

But it is not a NET ERROR.

Please advise.

Thanks,
Harsha


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</winerror.h>

Thanks Arlie. It was very helpful.

I got the error message E_InvalidArg from result = HRESULT_FROM_WIN32(GetLastError()).

I will now examin each function parameter.

Thanks again,
Harsha

Arlie Davis wrote:
“net helpmsg” is a generic way you can query the Win32 message catalog. NET
HELPMSG just uses FormatMessage with FORMAT_MESSAGE_FROM_SYSTEM. It does
not have a hard-coded list of network error codes. Therefore, it can
translate most of the error codes in for you. There is no
separate namespace of “net errors” that is separate from “Win32 errors”.
You are not getting an error from “NET HELPMSG” – NET HELPMSG is telling
you that the description for error code 87 is “Invalid parameter”.

Another way to print out error messages is the !error debugger extensino.
And you are using a debugger, right? If you’re using Visual Studio, there’s
a debugger hint that the current value is an error code, and VS will
automatically look up and display the error text for you. Enter the
variable in the watch window as “error,hr” (assuming the variable is named
“error”). The “,hr” is a hint to the debugger that it’s an HRESULT. Since
you’re dealing with Win32 error codes, which are not HRESULTs, you’ll have
to convert them to HRESULTs first, by using the HRESULT_FROM_WIN32 macro,
like so:

foo()
{
HRESULT result;
HANDLE handle;

handle = CreateFile(…);
if (handle == INVALID_HANDLE_RESULT) {
result = HRESULT_FROM_WIN32(GetLastError());
// set breakpoint here
}
}

When the breakpoint fires, examine the ‘result’ variable. You shouldn’t
need to add the “,hr” suffix, but if VS doesn’t automatically display it,
use the suffix and add it to the watch window. The HRESULT_FROM_WIN32 macro
just encodes a Win32 error code (which is a small positive integer) as an
HRESULT (which has an “error” bit, a “facility code” which is set to
FACILITY_WIN32, and the Win32 error code in the bottom 16 bits).

FormatMessage will handle both Win32 error codes and HRESULTs.

– arlie

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Harsha Inamdar
Sent: Thursday, April 06, 2006 10:42 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] NET ERROR MSG

Thanks Tim.

I tried it & it gave the message box

“CreateFile failed Errorcode 87”.

I am trying to find out error code 87 with NET HELPMSG 87, but got the
error, parameter not correct.

I referred to the following page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdk40/ht
ml/cerefneterrors-numericalorder.asp

It specifies the error code values as 4 digits. There are system error
codes, from which 87 = Parameter is incorrect, ERROR_INVALID_PARAMETER.

But it is not a NET ERROR.

Please advise.

Thanks,
Harsha


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

> Enter the

variable in the watch window as “error,hr” (assuming the variable is named
“error”). The “,hr” is a hint to the debugger that it’s an HRESULT.
There is even a simpler way: even if you DO NOT have “error” declared,
“err,hr” in a “watch” window shows the current state, that is, what
GetLastError() would have returned at this point.

One of those tricks that should be mentioned in the docs …

----- Original Message -----
From: “Arlie Davis”
To: “Windows System Software Devs Interest List”
Sent: Thursday, April 06, 2006 11:03 AM
Subject: RE: [ntdev] NET ERROR MSG

> “net helpmsg” is a generic way you can query the Win32 message catalog.
> NET
> HELPMSG just uses FormatMessage with FORMAT_MESSAGE_FROM_SYSTEM. It does
> not have a hard-coded list of network error codes. Therefore, it can
> translate most of the error codes in <winerror.h> for you. There is no
> separate namespace of “net errors” that is separate from “Win32 errors”.
> You are not getting an error from “NET HELPMSG” – NET HELPMSG is telling
> you that the description for error code 87 is “Invalid parameter”.
>
> Another way to print out error messages is the !error debugger extensino.
> And you are using a debugger, right? If you’re using Visual Studio,
> there’s
> a debugger hint that the current value is an error code, and VS will
> automatically look up and display the error text for you. Enter the
> variable in the watch window as “error,hr” (assuming the variable is named
> “error”). The “,hr” is a hint to the debugger that it’s an HRESULT.
> Since
> you’re dealing with Win32 error codes, which are not HRESULTs, you’ll have
> to convert them to HRESULTs first, by using the HRESULT_FROM_WIN32 macro,
> like so:
>
> foo()
> {
> HRESULT result;
> HANDLE handle;
>
> handle = CreateFile(…);
> if (handle == INVALID_HANDLE_RESULT) {
> result = HRESULT_FROM_WIN32(GetLastError());
> // set breakpoint here
> }
> }
>
> When the breakpoint fires, examine the ‘result’ variable. You shouldn’t
> need to add the “,hr” suffix, but if VS doesn’t automatically display it,
> use the suffix and add it to the watch window. The HRESULT_FROM_WIN32
> macro
> just encodes a Win32 error code (which is a small positive integer) as an
> HRESULT (which has an “error” bit, a “facility code” which is set to
> FACILITY_WIN32, and the Win32 error code in the bottom 16 bits).
>
> FormatMessage will handle both Win32 error codes and HRESULTs.
>
> – arlie
>
>
> ________________________________
>
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Harsha Inamdar
> Sent: Thursday, April 06, 2006 10:42 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] NET ERROR MSG
>
>
> Thanks Tim.
>
> I tried it & it gave the message box
>
> “CreateFile failed Errorcode 87”.
>
> I am trying to find out error code 87 with NET HELPMSG 87, but got the
> error, parameter not correct.
>
> I referred to the following page:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdk40/ht
> ml/cerefneterrors-numericalorder.asp
>
> It specifies the error code values as 4 digits. There are system error
> codes, from which 87 = Parameter is incorrect, ERROR_INVALID_PARAMETER.
>
> But it is not a NET ERROR.
>
> Please advise.
>
> Thanks,
> Harsha
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></winerror.h>

Harsha Inamdar wrote:

I tried it & it gave the message box

“CreateFile failed Errorcode 87”.

I am trying to find out error code 87 with NET HELPMSG 87, but got the
error, parameter not correct.

I know it looks like you are getting an error from that command, but
what it is telling you is that the full explanation of error code 87 is
“The parameter is incorrect.” ERROR_INVALID_PARAMETER, as you note below.

So, that means that one of the parameters to your CreateFile call is not
correct. What kind of driver are you opening? Some drivers cannot be
opened, or can only be opened by one specific opener. For example, the
display miniport cannot be opened from a user-mode app.

Where did you get the driver handle? Is this sample code from somewhere?

I referred to the following page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdk40/html/cerefneterrors-numericalorder.asp

It specifies the error code values as 4 digits. There are system error
codes, from which 87 = Parameter is incorrect, ERROR_INVALID_PARAMETER.

But it is not a NET ERROR.

Doesn’t matter. Net helpmsg can be used to look up any of the standard
error codes. The real source for this is in the “winerror.h” include
file in your Visual C++ or PlatformSDK directory. Look for “87”, and
you’ll find the same thing.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks Tim.

It is a modem driver. I am just doing some practice with it to see if I can send a IOCTL call to it.

How to identify whether a driver can be opened or not or with which opener?
Does it depend on some security bit?

Thanks again,
Harsha

Tim Roberts wrote:
Harsha Inamdar wrote:

>
> I tried it & it gave the message box
>
> “CreateFile failed Errorcode 87”.
>
> I am trying to find out error code 87 with NET HELPMSG 87, but got the
> error, parameter not correct.

I know it looks like you are getting an error from that command, but
what it is telling you is that the full explanation of error code 87 is
“The parameter is incorrect.” ERROR_INVALID_PARAMETER, as you note below.

So, that means that one of the parameters to your CreateFile call is not
correct. What kind of driver are you opening? Some drivers cannot be
opened, or can only be opened by one specific opener. For example, the
display miniport cannot be opened from a user-mode app.

Where did you get the driver handle? Is this sample code from somewhere?

> I referred to the following page:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdk40/html/cerefneterrors-numericalorder.asp
>
> It specifies the error code values as 4 digits. There are system error
> codes, from which 87 = Parameter is incorrect, ERROR_INVALID_PARAMETER.
>
> But it is not a NET ERROR.

Doesn’t matter. Net helpmsg can be used to look up any of the standard
error codes. The real source for this is in the “winerror.h” include
file in your Visual C++ or PlatformSDK directory. Look for “87”, and
you’ll find the same thing.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

---------------------------------
Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

Harsha Inamdar wrote:

It is a modem driver. I am just doing some practice with it to see if
I can send a IOCTL call to it.

Where did you get the file name that you passed to CreateFile? Have you
printed it out to make sure it is sensible?

How to identify whether a driver can be opened or not or with which
opener?

It varies by device class. The source code for fake but compliant modem
driver is included with the DDK. Since many (most?) drivers start life
as a copy of some sample, it’s likely that your real-life modem driver
is based on the same beginnings.

Does it depend on some security bit?

Yes. The sample modem driver will only allow itself to be opened once,
but that should have caused a different error code. (Because of that,
you can eliminate your FILE_SHARE_READ option; it cannot be shared.) Is
your modem in use when you try to open it?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.