Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Failing to call WNetAddConnection3A - error 487: Invalid address

8 views
Skip to first unread message

franco....@gmail.com

unread,
Jul 20, 2020, 11:06:08 AM7/20/20
to
I'm using Gupta 1.5.4.
I'm trying to add a connection with external function WNetAddConnection3A, without mapping a drive.
The structure of NETERESOURCE looks correctly built, but WNetAddConnection3A gives back a 487 error.
I tried to replace the PutLong with a PutInt, but with no avail.

Parameters
String: spvPath
String: spvUser
String: spvPassword
Static Variables
Local variables
Number: nflFar1
Number: nflFar2
Number: nflFarPointer
Number: nflStructSize
!
Number: nflSize
String: sflBuffer
Number: nflRet
String: sflExtract
Number: nflBufferLen
Actions
Set nflBufferLen = 40 + SalStrLength ( spvPath) + 1
Call SalStrSetBufferLength( sflBuffer, nflBufferLen )
Set sflBuffer = SalStrRepeatX ( ' ' , nflBufferLen )
!
Call CStructPutLong( sflBuffer, 4, 1 )
!
Set nflFar1 = CStructPutString2( sflBuffer, 16 , SalStrLength(dfxEmptyString), dfxEmptyString )
!
Set nflFar2 = CStructPutString2( sflBuffer, 20 , SalStrLength(spvPath) + 1 , spvPath )
!
Set nflFarPointer = CStructAllocFarMem( nflBufferLen )
If CStructCopyToFarMem( nflFarPointer, sflBuffer, nflBufferLen )
Set nflRet = WNetAddConnection3A( hWndForm, nflFarPointer, spvPassword, spvUser , 0 )

Call CStructFreeFarMem( nflFar1 )
Call CStructFreeFarMem( nflFar2 )
Call CStructFreeFarMem( nflFarPointer )
! Call uflAStruct.ClearData ()
Return nflRet
0 new messages