NPGetConnection() questions

Hello All

I have questions about NPGetConnection() function
of Network Provider DLL.

According (XPIFS kit) npapi.h the function has prototype:
DWORD APIENTRY NPGetConnection (LPWSTR lpLocalName,

LPWSTR lpRemoteName,

LPDWORD lpnBufferLen);

According MSDN Library-July 2001 the function has prototype
DWORD NPGetConnection( LPTSTR lpLocalName,
LPTSTR lpRemoteName,
LPDWORD lpBufferSize);
Parameters:
lpLocalName - Pointer to the name of the local device
the caller is interested in.
The network provider can assume
this name is syntactically valid.

lpRemoteName- Pointer to a buffer that will receive
the remote name used to make the connection.
This buffer is allocated by the caller.
This data is stored in a NETCONNECTINFOSTRUCT structure.
Additional, network-specific information can be
appended to the end of the structure.
For more information, see the reference information
on NETCONNECTINFOSTRUCT.

lpBufferSize- Pointer to the size, in characters,
of the lpRemoteName buffer. If the call fails
because the buffer is not big enough,
lpBufferSize is set to the required buffer size.

Remarks:
The NPGetConnection function can return information only about
a network connection that is currently connected.
To retrieve information about a network connection that
is currently disconnected, use NPGetConnection3.

My questions:

  1. Is lpBufferSize the size in bytes or WCHAR?
    Have the followed fragment of XPIFS kit DLL NULMRX sample code the bug?
    ( see NULMRX\DLL\nulmrxnp.c)

Here CopyBytes is the length of RemoteName.

if ( CopyBytes > 0 )
{
len = CopyBytes + 1;
if ( *lpBufferSize > len )
{
*lpRemoteName++ = L’\‘;
CopyMemory( lpRemoteName, RemoteName, CopyBytes );
*lpRemoteName++ = L’\0’;
}
else
{
Status = WN_MORE_DATA;
*lpBufferSize = len;
}
}
else
{
Status = WN_NOT_CONNECTED;
}

  1. What does the next sentence in description of lpRemoteName parameter
    mean ?
    “This data is stored in a NETCONNECTINFOSTRUCT structure.”
    Is it correct?

  2. What does the sentence in remarks mean ?
    “To retrieve information about a network connection that
    is currently disconnected, use NPGetConnection3.”

If this means that DLL Provider must have the NPGetConnection3()
export function, then what index and Flags are needed to use in
NPGetCaps()?

  1. Where are any essential difference in requirements to Network Provider
    DLL
    for Windows 2000 and Windows XP?

Regards,

Nikolay Naumov
E-mail: xxxxx@mikron.ru
Mikron Corporation, http://www.mikron.ru
Moscow, Russia


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

Nikolay,

I have been investigating exactly the same issues. I believe
that NPGetConnection and NPGetConnection3 are both mis-documented.
The NETCONNECTINFOSTRUCT is returned by NPGetConnectionPerformance.
NPGetConnection and NPGetConnection3 return only a string, namely
the remote-name to which the local name has been bound.

Since this result is a pure string I believe the final paragraph
in the Using the Network Provider API \ Handling Buffered Data
discussion applies:

When a buffer is used to pass in and return data that
consists only of strings, the DWORD specifying the size
of the buffer should be set to the total number of
characters that will fit in these strings, not to the
number of bytes.

/john


John Yates
40 Pine Street
Needham, MA 02492
781 444-2899


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

> 1. Is lpBufferSize the size in bytes or WCHAR?

Buffer size for NPGetConnection is in BYTES.

  1. What does the next sentence in description of lpRemoteName parameter
    mean ?
    “This data is stored in a NETCONNECTINFOSTRUCT structure.”
    Is it correct?

This is very strange. In my NT4 NP DLL, I treated lpRemoteName as just a string pointer.

  1. What does the sentence in remarks mean ?
    “To retrieve information about a network connection that
    is currently disconnected, use NPGetConnection3.”

NPGetConnection will fail on currently disconnected connections.

If this means that DLL Provider must have the NPGetConnection3()
export function

No, on NT4, it can work without it.

Max


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

Thanks for reply, John Yates and Maxim Shatskih.

Excuse me my bad English.

The background of my NPGetConnection() questions:
I am traing to port my FS driver of NFS Client from Win2k to Windows XP.
In Win2k the NFS client work OK. In Win XP I cannot Map Network Drive,
but NFS client work OK without mapping (as UNC provider).
For example.
I try to map \Server\Testnfs remote directory to letter Q.
I can to open the remote directories by double click, but if I map
the directory to letter, I receive the message:

“Q:\ refers to a location that is unavailable. It could be on
a hard drive on this computer, or on a network. Check to make sure that
the disk is properly inserted, or that you are connected to the Internet
or your network, and then try again. If it still cannot be located,
the information migth have been moved to a different location.”

On “My Computer” windows I see “Testnfs on ‘Server’(Q)” as the Network
Drive.
If I click on this drive, on Debugger Windows I see only NPGetConnection()
requests
to Network Provider DLL before this Message.

Any ideas.

Regads.
Nikolay Naumov
E-mail: xxxxx@mikron.ru
Mikron Corporation, http://www.mikron.ru
Moscow, Russia

I have been investigating exactly the same issues. I believe
that NPGetConnection and NPGetConnection3 are both mis-documented.
The NETCONNECTINFOSTRUCT is returned by NPGetConnectionPerformance.
NPGetConnection and NPGetConnection3 return only a string, namely
the remote-name to which the local name has been bound.

Since this result is a pure string I believe the final paragraph
in the Using the Network Provider API \ Handling Buffered Data
discussion applies:

When a buffer is used to pass in and return data that
consists only of strings, the DWORD specifying the size
of the buffer should be set to the total number of
characters that will fit in these strings, not to the
number of bytes.

/john


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

Have you registered your kernel-mode FSD in MUP?

Max

----- Original Message -----
From: “Naumov”
To: “File Systems Developers”
Sent: Monday, December 03, 2001 10:10 AM
Subject: [ntfsd] Re: NPGetConnection() questions

> Thanks for reply, John Yates and Maxim Shatskih.
>
> Excuse me my bad English.
>
> The background of my NPGetConnection() questions:
> I am traing to port my FS driver of NFS Client from Win2k to Windows XP.
> In Win2k the NFS client work OK. In Win XP I cannot Map Network Drive,
> but NFS client work OK without mapping (as UNC provider).
> For example.
> I try to map \Server\Testnfs remote directory to letter Q.
> I can to open the remote directories by double click, but if I map
> the directory to letter, I receive the message:
>
> “Q:\ refers to a location that is unavailable. It could be on
> a hard drive on this computer, or on a network. Check to make sure that
> the disk is properly inserted, or that you are connected to the Internet
> or your network, and then try again. If it still cannot be located,
> the information migth have been moved to a different location.”
>
> On “My Computer” windows I see “Testnfs on ‘Server’(Q)” as the Network
> Drive.
> If I click on this drive, on Debugger Windows I see only NPGetConnection()
> requests
> to Network Provider DLL before this Message.
>
> Any ideas.
>
> Regads.
> Nikolay Naumov
> E-mail: xxxxx@mikron.ru
> Mikron Corporation, http://www.mikron.ru
> Moscow, Russia
>
>
> >I have been investigating exactly the same issues. I believe
> >that NPGetConnection and NPGetConnection3 are both mis-documented.
> >The NETCONNECTINFOSTRUCT is returned by NPGetConnectionPerformance.
> >NPGetConnection and NPGetConnection3 return only a string, namely
> >the remote-name to which the local name has been bound.
> >
> >Since this result is a pure string I believe the final paragraph
> >in the Using the Network Provider API \ Handling Buffered Data
> >discussion applies:
> >
> > When a buffer is used to pass in and return data that
> > consists only of strings, the DWORD specifying the size
> > of the buffer should be set to the total number of
> > characters that will fit in these strings, not to the
> > number of bytes.
> >
> >/john
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


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