Anonymous_User Absent Member.
Absent Member.
3622 views

Win32 WnetEnumResources() API call fails to retrieve Netware services provider

Hello everyone,
I have a very strange problem which can be reproduced when using
Netware Novell Client 4.91 (4.91.0.20050216)
This happens on both Win2k server with service Pack 4 and Win2k3 server
with service pack 1.

The Wnet API included on Microsoft SDK provides the function
WNetEnumResources. This function can be used to enumerate network
resources such network providers, domains, computers, shares etc ....

I have written a small piece of code that enumerates all netwrok
resources. Part of it enumerates all network providers (which are in my
case: NetWare Services, Microsoft Terminal services, Microsoft Windows
Network and Web Client Networks).
When I run the executable manually, I retrieve all network providers as
expected, but when the same code is executed by a service (that runs
under local system) the "Netware services" is not enumerated), changing
the service to run under administrative user account does not help
either.

This does not happen on Novell 4.9.0 client (on both Win2k and win2k3),
so it seems the problem is related to Novell client 4.91 rather than
the operating system.

For general information the list of network provides is what you get
when you press "My Network places" icon from desktop and than from left
pane select the "Entire network" menu item.

Ideas anyone ?
Thank you in advance

Labels (1)
0 Likes
8 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

Threw a WNetEnumResource test together and executed via the Windows
Task Scheduler (such that it would be spawned from a service process
running as LocalSystem) and saw that "NetWare Services" was included.

Is that true for you too? (i.e. If you launch your code specifically
via AT.EXE / the Task Scheduler, you actually do see the correct
enumeration output?) Or does that test also show the failure for you?

The first thing that came to mind (since you mentioned "from a
service") was perhaps it had to do with "when" your enumeration
attempt was made? e.g. Making the query before NWFS.SYS has started
or similar might cause the network provider to be omitted from the
list.

(The Task Scheduler example, of course, would be well after the
machine is up & you know NWFS.SYS is running since/if you logged into
NDS in order to get to the desktop. Similar to when you simply run
the application from the user's desktop.)

Also, this machine I'm using here is running 4.91 SP1 beta 726 build
(http://www.novell.com/beta/, "Consolidated Support Pack 13 - Public
Beta"). I can run this test against 4.91 shipping code once I'm near
a workstation running that.

niry@whale-com.com wrote:

> Hello everyone,
> I have a very strange problem which can be reproduced when using
> Netware Novell Client 4.91 (4.91.0.20050216)
> This happens on both Win2k server with service Pack 4 and Win2k3 server
> with service pack 1.
>
> The Wnet API included on Microsoft SDK provides the function
> WNetEnumResources. This function can be used to enumerate network
> resources such network providers, domains, computers, shares etc ....
>
> I have written a small piece of code that enumerates all netwrok
> resources. Part of it enumerates all network providers (which are in my
> case: NetWare Services, Microsoft Terminal services, Microsoft Windows
> Network and Web Client Networks).
> When I run the executable manually, I retrieve all network providers as
> expected, but when the same code is executed by a service (that runs
> under local system) the "Netware services" is not enumerated), changing
> the service to run under administrative user account does not help
> either.
>
> This does not happen on Novell 4.9.0 client (on both Win2k and win2k3),
> so it seems the problem is related to Novell client 4.91 rather than
> the operating system.
>
> For general information the list of network provides is what you get
> when you press "My Network places" icon from desktop and than from left
> pane select the "Entire network" menu item.
>
> Ideas anyone ?
> Thank you in advance


Alan Adams
alancrumbadams@drcrumb.com
(to email, remove the crumbs)
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

Dear Alan,
Thank you very much for your efforts

1. I start the service executing "WNetEnumResource" after login so
NWFS.SYS is up and running, I also verified that "Netware" service
provider is listed prior to starting the service (assuming that
explorer using the same API to enumerate service provider, but this is
a mere guess of mine)
2. When I run the executable using "AT" command I get the correct
enumeration. Just like you said the executable is invoked by "nt
authority\system".

I am still puzzled 🙂

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

Tested 4.91 (shipping) on Server 2003 SP1, using SRVANY.EXE (Windows
resource kit) this time instead of AT / Task Scheduler to start my
simply test application as a service & NOT interactive with the
desktop.

Still successfully enumerating the "NetWare Services" entry at the
provider level. (i.e. same level I see "Microsoft Terminal Services",
"Microsoft Windows Network" and "Web Client Network" being enumerated
at.)

Starting to sound like something that would require working with
Novell Support to determine whether this is a scenario where their
network provider simply isn't getting called for some reason, or
whether they are getting called but abort for some reason. Unless the
application is portable enough that you can just send it to them as a
whole.

Not having been able to duplicate what you're seeing at this end just
brought a couple other questions to mind:

1. Do you know its for sure "NT AUTHORITY\SYSTEM" (logon session
0x3E7) your service is running under, or might it be "NT
AUTHORITY\LOCAL SERVICE" (logon session 0x3E5) or "NT
AUTHORITY\NETWORK SERVICE" (logon session 0x3E4)? Not that this
should have a specific effect to my knowledge; just wondering if its a
difference. Actually, I think these other sessions were introduced on
XP; i.e. would not be there on Windows 2000, where you say the problem
also occurs.

2. Can you move even just a troubleshooting/debugging occurrence of
the enumeration to be the _very_first_ thing your application/service
does. Just wondering if some other activity specific to the
application then "spoils" any future attempt at enumeration later. (To
try and explain why the test applications don't see the same issue.)

niry@whale-com.com wrote:

> Dear Alan,
> Thank you very much for your efforts
>
> 1. I start the service executing "WNetEnumResource" after login so
> NWFS.SYS is up and running, I also verified that "Netware" service
> provider is listed prior to starting the service (assuming that
> explorer using the same API to enumerate service provider, but this is
> a mere guess of mine)
> 2. When I run the executable using "AT" command I get the correct
> enumeration. Just like you said the executable is invoked by "nt
> authority\system".
>
> I am still puzzled 🙂


Alan Adams
alancrumbadams@drcrumb.com
(to email, remove the crumbs)
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

Thank you very much again Alan.

1. The service runs under "NT AUTHORITY\SYSTEM", this can be determined
when using the task manager
2. I have tried to troubleshoot the code using your advice and moved
the code that enumerates the service providers into the place where the
service starts. This does not help either, the "Netware services" is
not enumerated. Strangely enough this makes some sort of sense since
the same code runs smoothly under Novell client 4.9.0

This leads me to think it is probably related to the specific Novell
client version, nevertheless I can not be 100% sure

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

Still seeming like it would take a debug version of Novell's network
provider to confirm what is being attempted and what is being aborted,
if anything. Nothing logical at the moment about the scenario you're
seeing the failures in.

I suppose we can at least make the confirmation that MPR (the WNet*
API router) loaded Novell's network provider. (Though that still
doesn't prove whether it was called or not.) Once the service is
running & is showing a failure to enumerate "NetWare Services", use
something like Process Explorer to show whether the service process
now has NOVNPNT.DLL loaded.

(The default when you highlight a process in Process Explorer is to
show the process' open handles, but from the "View" menu you can
switch "Lower Pane View" to DLLs.)
http://www.sysinternals.com/Utilities/ProcessExplorer.html

NOVNPNT.DLL is what implements Novell's network provider. The other
network providers you mentioned are implemented by NTLANMAN.DLL,
DRPROV.DLL and DAVCLNT.DLL; so you should be seeing them too at the
time you expect to see NOVNPNT.DLL.

Just not making a lot of sense that if its 4.91 specific, why the
symptom doesn't seem to duplicate here. Does the issue duplicate on
other machines where you install your service? Or is this only
happening on the most important machine (your development machine).

niry@whale-com.com wrote:

> Thank you very much again Alan.
>
> 1. The service runs under "NT AUTHORITY\SYSTEM", this can be determined
> when using the task manager
> 2. I have tried to troubleshoot the code using your advice and moved
> the code that enumerates the service providers into the place where the
> service starts. This does not help either, the "Netware services" is
> not enumerated. Strangely enough this makes some sort of sense since
> the same code runs smoothly under Novell client 4.9.0
>
> This leads me to think it is probably related to the specific Novell
> client version, nevertheless I can not be 100% sure


Alan Adams
alancrumbadams@drcrumb.com
(to email, remove the crumbs)
0 Likes
Highlighted
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

1. Using process explorer I have observed that the MPR did not load the
Novell Network providers (the other three are loaded by the service)
2. The problem I have encountered was observed and reproduced on
numerous work stations, (I am actually the one that has the "privilege"
to determine the reason) , so in that aspect my most important computer
is not distinguished.

Your time and efforts are really appreciated, thank you.

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

Ah ha. That could be useful. For my own part, I would actually be
more suspicious that Novell's provider failed to load in this context,
as opposed to MPR having mysteriously "never loaded it". (Though that
is still possible, too.)

Either way, I would say the next step in trying to "debug this without
help" is monitoring the activity occurring when MPR is loading network
provider DLLs. If you're proficient in driving WinDBG, that might be
the easiest way by turning on "loader snaps" that show when a module
is being loaded.

Other methods include Sysinternals' FileMon utility (generically
watching all disk activity, which will include DLLs being located and
read), and also Dependency Walker's (www.dependencywalker.com)
"Profile" mode (though I've never tried to use this in the context of
a Windows service).

In my mind you would be looking for one of three things: Complete
absence of attempting to load Novell-specific DLLs; An attempt to load
Novell-specific DLLs which never culminates in loading NOVNPNT.DLL
itself (i.e. Windows attempts to load NOVNPNT.DLL, but first has to
load all the DLLs NOVNPNT.DLL is dependant on like NETWIN32.DLL,
CALWIN32.DLL, etc., but fails loading one of them and aborts before
intializing NOVNPNT.DLL itself); or NOVNPNT.DLL loads but is then
immediately unloaded.

niry@whale-com.com wrote:

> 1. Using process explorer I have observed that the MPR did not load the
> Novell Network providers (the other three are loaded by the service)
> 2. The problem I have encountered was observed and reproduced on
> numerous work stations, (I am actually the one that has the "privilege"
> to determine the reason) , so in that aspect my most important computer
> is not distinguished.
>
> Your time and efforts are really appreciated, thank you.


Alan Adams
alancrumbadams@drcrumb.com
(to email, remove the crumbs)
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Win32 WnetEnumResources() API call fails to retrieve Netware services provider

1. I have written a service of my own and injected the code that tries
to enumerate network providers. When I run my service, the service
produces correct output. This I think settles that the issue is not
related to that fact the code is ran from a service context. This also
suggests that maybe there is something bad on the service on which I
observe the enumeration failure, this however does not explaing why the
problem is not observed on Novell client 4.9.0

2. Following your ideas, I have conducted additional tests:
Using the File Monitor utility and Process Explorer utilities from sys
internals it is seen that when the service starts, the MPR tries to
access the NOVNPNT.dll file, but after very short while (roughly 3
milliseconds) it stops. so its seems that as if there is a failure to
load the DLL or on the other hand the DLL is loaded and immediately
unloaded for some reason. This where I thought how nice it would have
been if I got a version of NOVNPNT.dll that produces some debug
information

Many thanks.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.