map network drive

!global equates
NETRESOURCE GROUP
dwScope       ULONG
dwType        ULONG
dwDisplayType ULONG
dwUsage       ULONG
lpLocalName   ULONG
lpRemoteName  ULONG
lpComment     ULONG
lpProvider    ULONG
            END
CONNECT_UPDATE_PROFILE  EQUATE(01h)
RESOURCETYPE_DISK       EQUATE(01h)
RESOURCETYPE_PRINT      EQUATE(02h)
RESOURCETYPE_ANY        EQUATE(00h)


!global prototypes
MODULE('WNET API')
  WNetAddConnection(*NETRESOURCE,*CSTRING,*CSTRING,ULONG),SIGNED,PASCAL,RAW,NAME('WNetAddConnection2A')
END


!local data
LOC:NetRes           LIKE(NETRESOURCE)
LOC:lpPassword       CSTRING(20)
LOC:lpUserName       CSTRING(20)
LOC:dwFlags          ULONG
LOC:lpLocalName   CSTRING(10)
LOC:lpRemoteName  CSTRING(260)
LOC:lpComment     CSTRING(10)
LOC:lpProvider    CSTRING(10)

!map network drive
CLEAR(LOC:NetRes)
LOC:NetRes.dwType = RESOURCETYPE_DISK
LOC:lpLocalName = 'F:'
LOC:lpRemoteName = '\\III-NTServer\C'
LOC:NetRes.lpLocalName = ADDRESS(LOC:lpLocalName)
LOC:NetRes.lpRemoteName = ADDRESS(LOC:lpRemoteName)
CLEAR(LOC:lpPassword)
CLEAR(LOC:lpUserName)
LOC:dwFlags = CONNECT_UPDATE_PROFILE
Erc# = WNetAddConnection(LOC:NetRes,LOC:lpPassword,LOC:lpUserName,LOC:dwFlags)

Schreibe einen Kommentar