win32wnet.WNetOpenEnum - passing NULL NETRESOURCE

Paul Moore paul.moore at atosorigin.com
Thu Nov 1 08:48:32 EST 2001


I'm trying to use win32wnet to enumerate net resources (it's actually to
test some issues I'm having with a larger piece of software).

The MSDN documentation says of the "resource" parameter, that it *must*
be NULL if the scope parameter is not RESOURCE_GLOBALNET, and that it
can be NULL if the scope parameter *is* RESOURCE_GLOBALNET. Also of
relevance, it implies that to enumerate the full network, you should
start the enumeration with a NULL resource, and walk the resulting tree
from there.

When I try to pass 0 as the resource parameter, though, I get an error -
specifically,

    >>> w = WNetOpenEnum(2,0,0,0)
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    pywintypes.api_error: (0, 'WNetOpenEnum', 'failed converting
NetResource Object')

(Here, 2 is RESOURCE_GLOBALNET - it seems that this constant isn't
exposed by win32wnet?)

Is there something else I should use to pass a NULL value?

Thanks,
Paul.




More information about the Python-list mailing list