Hi All,
I have developed an VB6 application which utilize LogonUser API to
authenticate the user when copying files from current server to another
server.
I have tested copied from XP Pro to NT4 workstation, it is working fine. But
from NT4 workstation copied to XP Pro, failed. I used GetLastError to get the
error codes, but it always return 0.
Below is the function for checking the login
If Len(d) = 0 Then d = vbNullString
' check the username/password pair
' using LOGON32_LOGON_NETWORK delivers the best performance
ret = LogonUser(User, d, Pwd, 2, 3, hToken)
' a non-zero value means success
If ret <> 0 Then
CheckLogin = ImpersonateLoggedOnUser(hToken)
Else
Dim errcode As Integer
errcode = GetLastError()
MsgBox errcode
End If
Any advice is appreciated. Thanks.

Signature
Regards,
Venedict
Bob Butler - 24 May 2007 03:42 GMT
> Hi All,
>
[quoted text clipped - 7 lines]
> the
> error codes, but it always return 0.
It will from VB; check Err.LastDllError instead
Venedict - 24 May 2007 03:52 GMT
Thanks. will try it out.

Signature
Regards,
Venedict
> > Hi All,
> >
[quoted text clipped - 9 lines]
>
> It will from VB; check Err.LastDllError instead
Venedict - 24 May 2007 04:31 GMT
Hi,
Manage to get the error codes and display the text, but the error code is
87, invalid parameter.
But the same code was use in XP environment and it is working fine.
Any advice??
Thanks

Signature
Regards,
Venedict
> Thanks. will try it out.
>
[quoted text clipped - 11 lines]
> >
> > It will from VB; check Err.LastDllError instead
Thorsten Albers - 24 May 2007 11:05 GMT
Venedict <Venedict@discussions.microsoft.com> schrieb im Beitrag
<DE5FB8DC-0701-491C-8D8D-BA2EA65881C9@microsoft.com>...
> If Len(d) = 0 Then d = vbNullString
> ' check the username/password pair
[quoted text clipped - 12 lines]
>
> Any advice is appreciated. Thanks.
As far as I can see at the time of WinNT 4 for dwLogonProvider
0 = LOGON32_PROVIDER_DEFAULT
was the only supported value. Your code has
3 = LOGON32_PROVIDER_WINNT50
which has been introduced with Win2K. I.e. you are passing an "invalid
parameter" (87).
BTW: Using constant names instead of values will help both you and others
very much in finding errors in the code.

Signature
----------------------------------------------------------------------
THORSTEN ALBERS Universität Freiburg
albers@
uni-freiburg.de
----------------------------------------------------------------------
Mark Yudkin - 27 May 2007 09:27 GMT
In addition to Thorsten's resolution, not also that LOGON32_LOGON_NETWORK
isn't a logon, despite its name. It's merely a password verifier. The
resultant token cannot be used for copying files between servers.
> Hi All,
>
[quoted text clipped - 26 lines]
>
> Any advice is appreciated. Thanks.