PRB: WNetEnumResource Returns Different Info on Win95 and NT (152823)
The information in this article applies to:
- Microsoft Win32 Software Development Kit (SDK) for Windows NT
This article was previously published under Q152823 SYMPTOMS
When the WINNET example from the January 96 MSDN is built on Windows 95,
and the sample is executed at the MS-DOS prompt from within Windows 95, the
following error is displayed:
This program has performed an illegal operation and will be shutdown.
If the problem persists, contact the program vendor.
If the WINNET example is executed within the Visual C++ 4.0 debug
environment, the following error is received:
Unhandled exception in winnet.exe: 0xC0000005 : Access Violation.
CAUSE
The WNetEnumResouce API returns different values on Win95 than on
Windows NT.
The problem occurs when an enumeration starts at the root of the network.
The first buffer of NETRESOURCE structures returned from WNetEnumResource
is different. On Windows 95, the lpProvider field is set to the Network
Provider name and the lpRemoteName is set to NULL. On NT, the lpProvider
and lpRemoteName fields point to different strings containing the same
values.
In the WINNET sample, when the EnumResource function tries to execute its
example filter, the _strnicmp C Run-Time function causes an ACCESS
VIOLATION because the lpRemoteName is NULL.
RESOLUTION
Checking the value of the lpRemoteName field and ensuring it is pointing to
a valid address before allowing the filter to execute prevents the ACCESS
VIOLATION error.
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 3/21/2005 |
---|
Keywords: | kbAPI kbnetwork kbprb KB152823 |
---|
|