A2osX/LIB/LIBCIFS.S.txt
2021-07-24 22:42:23 +02:00

1298 lines
24 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF lib/libcifs
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.e.i
.INB inc/eth.i
.INB inc/libtcpip.i
.INB inc/net.smb.i
*--------------------------------------
.DUMMY
.OR ZPLIB
ZS.START
ZPReqPtr .BS 2
ZPReqLen .BS 2
ZPCtxPtr .BS 2
pFD .BS 2
ZPPtr1 .BS 2
ZPPtr2 .BS 2
BufPtr .BS 2
hBuf .BS 1
hResp .BS 1
pPath .BS 2
flags .BS 1
ftype .BS 1
auxtype .BS 2
ZPRespPtr .BS 2
bFlag .BS 1
ByteCountOfs .BS 1
DWORD .BS 4
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START
.DA 0
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA LIB.LOAD
.DA LIB.UNLOAD
.DA CIFS.Negotiate
.DA CIFS.SessionSetup
.DA CIFS.TreeConnect
.DA CIFS.Mount
.DA CIFS.UMount
*--------------------------------------
L.CALLBACK .DA CIFS.CallBack
*--------------------------------------
J.CIFS .DA CIFS.ChTyp
.DA CIFS.ChMod
.DA CIFS.FStat
.DA CIFS.Stat
.DA CIFS.MKDir
.DA CIFS.BADCALL MKNod
.DA CIFS.BADCALL MKFIFO
.DA CIFS.BADCALL Pipe
.DA CIFS.OpenDir
.DA CIFS.ReadDir
.DA CIFS.CloseDir
.DA CIFS.BADCALL Open
.DA CIFS.BADCALL Close
.DA CIFS.BADCALL Read
.DA CIFS.BADCALL Write
.DA CIFS.ChOwn
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.FOpen
.DA CIFS.FClose
.DA CIFS.FRead
.DA CIFS.FWrite
.DA CIFS.FFlush
.DA CIFS.FSeek
.DA CIFS.FTell
.DA CIFS.FEOF
.DA CIFS.Remove
.DA CIFS.Rename
*--------------------------------------
J.CIFS2 .DA CIFS2.ChTyp
.DA CIFS2.ChMod
.DA CIFS2.FStat
.DA CIFS2.Stat
.DA CIFS2.MKDir
.DA CIFS.BADCALL MKNod
.DA CIFS.BADCALL MKFIFO
.DA CIFS.BADCALL Pipe
.DA CIFS2.OpenDir
.DA CIFS2.ReadDir
.DA CIFS2.CloseDir
.DA CIFS.BADCALL Open
.DA CIFS.BADCALL Close
.DA CIFS.BADCALL Read
.DA CIFS.BADCALL Write
.DA CIFS2.ChOwn
.DA CIFS.BADCALL FPutC...
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL
.DA CIFS.BADCALL ...UngetC
.DA CIFS2.FOpen
.DA CIFS2.FClose
.DA CIFS2.FRead
.DA CIFS2.FWrite
.DA CIFS2.FFlush
.DA CIFS2.FSeek
.DA CIFS2.FTell
.DA CIFS2.FEOF
.DA CIFS2.Remove
.DA CIFS2.Rename
*--------------------------------------
L.LIBTCPIP .DA LIBTCPIP
L.NETBIOS.H .DA NETBIOS.H
.DA 0
*--------------------------------------
LIB.LOAD >LDYA L.LIBTCPIP
>SYSCALL2 LoadLib
bcs .9
sta hLIBTCPIP
>SYSCALL2 GetMemPtr
>STYA pLIBTCPIP
>LDYAI 512
>SYSCALL2 GetMem
bcs .9
stx hReq
* clc
.9 rts
*--------------------------------------
LIB.UNLOAD lda hReq
beq .1
>SYSCALL2 FreeMem
.1 lda hLIBTCPIP
beq .8
>SYSCALL2 UnloadLib
.8 clc
rts
*--------------------------------------
* >PUSHB hSocket
* >PUSHBI 0
* >LIBCALL Negotiate
* A = hSMBContext
*--------------------------------------
CIFS.Negotiate lda (pStack)
bne .1
dec
sta (pStack)
ldy #1 hSocket
lda (pStack),y
>PUSHA
>PUSHW L.NETBIOS.H
>PUSHWI SMB.NegReq.end-NETBIOS.H
ldx #LIBTCPIP.Send
jsr GO.LIBTCPIP
bcs .99
lda #0
sec
rts
*--------------------------------------
.1 dec
sta (pStack)
beq .98
ldy #1 hSocket
lda (pStack),y
jsr ReadSocketA
bcc .3
cmp #E.NODATA
bne .99
inc
rts
.3 jsr GetRespData
ldy #S.NETBIOS+S.SMB.H.STATUS
lda (ZPRespPtr),y
bne .97
ldy #S.NETBIOS.LEN+2
lda (ZPRespPtr),y
clc
adc #S.NETBIOS
sta ZPPtr1
tay
lda #0
>SYSCALL2 GetMem
bcs .99
>STYA ZPCtxPtr
ldy ZPPtr1
.4 dey
lda (ZPRespPtr),y
sta (ZPCtxPtr),y
tya
bne .4
ldy #S.NETBIOS+S.SMB.H.FLAGS
sta (ZPCtxPtr),y
txa hSMBContext
jsr FreeRespData
clc
bra .99
.97 jsr FreeRespData
.98 lda #MLI.E.IO
.99 >RET 2
*--------------------------------------
* >PUSHB hSocket
* >PUSHB hSMBContext
* >PUSHW username
* >PUSHW password
* >PUSHBI 0
* >LIBCALL SessionSetup
* (SMBContext updated with UID)
*--------------------------------------
CIFS.SessionSetup
lda (pStack)
bne .5
dec
sta (pStack)
ldy #5 hSMBContext
jsr GetSMBContext
ldx #S.SMB.H.CMD.SESSION.SETUP.ANDX
jsr RequestSetupX
ldx #0
.2 lda SMB.SessionSetup.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.SessionSetup.H.Len
bne .2
jsr ReqSetupPtr2
ldx #0
.3 lda SMB.SessionSetup.Guest,x
jsr PutBytePtr2
inx
cpx #SMB.SessionSetup.Guest.Len
bne .3
ldx #0
.4 lda SMB.SessionSetup.T,x
jsr PutBytePtr2
inx
cpx #SMB.SessionSetup.T.Len
bne .4
jsr Add2ByteCount
jsr SetReqLen
ldy #6 hSocket
lda (pStack),y
jsr WriteSocketA
bcs .99
lda #0
sec
rts
*--------------------------------------
.5 dec
sta (pStack)
beq .98
ldy #6 hSocket
lda (pStack),y
jsr ReadSocketA
bcc .6
cmp #E.NODATA
bne .99
inc
rts
.6 jsr GetRespData
ldy #S.NETBIOS+S.SMB.H.STATUS
lda (ZPRespPtr),y
bne .97
ldy #5 hSMBContext
jsr GetSMBContext
ldy #S.NETBIOS+S.SMB.H.UID
lda (ZPRespPtr),y
sta (ZPCtxPtr),y
iny
lda (ZPRespPtr),y
sta (ZPCtxPtr),y
.8 jsr FreeRespData
clc
bra .99
.97 jsr FreeRespData
.98 lda #MLI.E.IO
sec
.99 >RET 7
*--------------------------------------
* >PUSHB hSocket
* >PUSHB hSMBContext
* >PUSHW pathname
* >PUSHBI 0
* >LIBCALL TreeConnect
* (SMBContext updated with TID)
*--------------------------------------
CIFS.TreeConnect
lda (pStack)
bne .5
dec
sta (pStack)
ldy #1 pathname
lda (pStack),y
sta pPath
iny
lda (pStack),y
sta pPath+1
iny hSMBContext
jsr GetSMBContext
ldx #S.SMB.H.CMD.TREE.CONNECT.ANDX
jsr RequestSetupX
ldx #0
.1 lda SMB.TreeConnect.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.TreeConnect.H.Len
bne .1
jsr ReqSetupPtr2
lda #0
jsr PutBytePtr2 PASSWORD = "\0"
jsr AppendPathPtr2
jsr AddYReqLenPtr2
ldx #0
.4 lda SMB.TreeConnect.T,x
jsr PutBytePtr2
inx
cpx #SMB.TreeConnect.T.Len
bne .4
jsr SetReqLen
ldy #4 hSocket
lda (pStack),y
jsr WriteSocketA
bcs .99
lda #0
sec
rts
.5 dec
sta (pStack)
beq .98
ldy #4 hSocket
lda (pStack),y
jsr ReadSocketA
bcc .6
cmp #E.NODATA
bne .99
inc
rts
.6 jsr GetRespData
ldy #S.NETBIOS+S.SMB.H.STATUS
lda (ZPRespPtr),y
bne .97
ldy #3 hSMBContext
jsr GetSMBContext
ldy #S.NETBIOS+S.SMB.H.TID
lda (ZPRespPtr),y
sta (ZPCtxPtr),y
iny
lda (ZPRespPtr),y
sta (ZPCtxPtr),y
.8 jsr FreeRespData
clc
bra .99
.97 jsr FreeRespData
.98 lda #MLI.E.IO
sec
.99 >RET 5
*--------------------------------------
* >PUSHB hSocket
* >PUSHB hSMBContext
* >PUSHW MountPoint
* >LIBCALL Mount
*--------------------------------------
CIFS.Mount ldy #1
lda (pStack),y MP HI
>PUSHA
lda (pStack),y MP LO
>PUSHA
>PUSHW L.CALLBACK
>SYSCALL2 Mount
bcs .9
pha hMount
ldx #0
.1 >PULLB MountTable,x
inx
cpx #4
bne .1
pla
clc
rts
.9 >RET 4
*--------------------------------------
CIFS.UMount clc
rts
*--------------------------------------
CIFS.CallBack bit CIFS.Status
bpl .1
phy
pha
ldy #S.PS.PID
lda (pPS),y
cmp CIFS.PID
beq .2
pla
ply
lda #0
sec
rts
.1 jmp (J.CIFS,x)
.2 pla
ply
jmp (J.CIFS2,x)
*--------------------------------------
GetPFD tax
phx
lda hFDs.hName-1,x
>SYSCALL2 GetMemPtr
>STYA pPath
plx
lda hFDs-1,x
>SYSCALL2 GetMemPtr
>STYA pFD
rts
*--------------------------------------
GetCTX lda MountTable+2
>SYSCALL2 GetMemPtr
>STYA ZPCtxPtr
rts
*--------------------------------------
GetSMBContext lda (pStack),y
>SYSCALL2 GetMemPtr
>STYA ZPCtxPtr
rts
*--------------------------------------
RequestT2SetupX ldx #S.SMB.H.CMD.TRANS2
jsr RequestSetupX
ldx #0
.1 lda SMB.Trans2.H,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.Trans2.H.Len
bne .1
rts
*--------------------------------------
RequestSetupX phx
lda hReq
>SYSCALL2 GetMemPtr
>STYA ZPReqPtr
ldy #0
.1 lda (ZPCtxPtr),y
cpy #S.NETBIOS+S.SMB.H.CMD
bne .2
pla
.2 sta (ZPReqPtr),y
iny
cpy #S.NETBIOS+S.SMB.H
bne .1
rts
*--------------------------------------
ReqSetupPtr2 sty ByteCountOfs
lda #0
sta (ZPReqPtr),y Reset ByteCount
iny
sta (ZPReqPtr),y
iny +2 for ByteCount
ReqT2SetupPtr2 sty ZPReqLen
stz ZPReqLen+1
tya
clc
adc ZPReqPtr
sta ZPPtr2
lda ZPReqPtr+1
adc #0
sta ZPPtr2+1
rts
*--------------------------------------
PutBytePtr2 sta (ZPPtr2)
inc ZPPtr2
bne .1
inc ZPPtr2+1
.1 inc ZPReqLen
bne .8
inc ZPReqLen+1
.8 rts
*--------------------------------------
AppendPathPtr2 ldx #0
ldy #$ff
.1 iny
lda (pPath),y
beq .4
.2 cmp #'/'
bne .3
lda #'\'
.3 sta (ZPPtr2),y
tax
bra .1
.4 cpx #'\'
bne .5
dey
.5 sta (ZPPtr2),y A = 0
rts
*--------------------------------------
AppendTypePtr2 ldx #0
.1 cmp PRODOS.FT.HEX,x
beq .4
inx
cpx #PRODOS.FT.TXT-PRODOS.FT.HEX
bne .1
pha
lsr
lsr
lsr
lsr
ora #$30
cmp #'9'+1
bcc .2
adc #6
.2 sta PRODOS.FT.DFLT+1
pla
and #$0F
ora #$30
cmp #'9'+1
bcc .3
adc #6
.3 sta PRODOS.FT.DFLT+2
.4 txa
asl
asl
tax
lda #'.'
sta (ZPPtr2),y
iny
.6 lda PRODOS.FT.TXT,x
sta (ZPPtr2),y
beq .8
inx
iny
bra .6
.8 rts
*--------------------------------------
Add2ByteCount ldy ByteCountOfs
clc
adc (ZPReqPtr),y
sta (ZPReqPtr),y
iny ByteCountOfs+1
lda #0
adc (ZPReqPtr),y
sta (ZPReqPtr),y
rts
*--------------------------------------
AddYReqLenPtr2 tya
sec +1 for \0
adc ZPPtr2
sta ZPPtr2
bcc AddYReqLen
inc ZPPtr2+1
*--------------------------------------
AddYReqLen tya
sec +1 for \0
adc ZPReqLen
sta ZPReqLen
bcc .8
inc ZPReqLen+1
.8 rts
*--------------------------------------
AppendPath ldx #0
.1 lda (pPath)
beq .4
inc pPath
bne .2
inc pPath+1
.2 cmp #'/'
bne .3
lda #'\'
.3 sta (ZPReqPtr),y
tax
iny
bra .1
.4 cpx #'\'
bne .5
dey
.5 rts
*--------------------------------------
SetT2ReqLenYA sty ZPReqLen
stz ZPReqLen+1
SetT2ReqLen lda ZPReqLen
sec
sbc #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+7
ldy #S.NETBIOS+S.SMB.H+1
sta (ZPReqPtr),y
ldy #S.NETBIOS+S.SMB.H+19
sta (ZPReqPtr),y
inc
inc
inc
ldy #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+2
sta (ZPReqPtr),y
*--------------------------------------
SetReqLen lda ZPReqLen
sec
sbc #S.NETBIOS
ldy #S.NETBIOS.LEN+2
sta (ZPReqPtr),y
lda ZPReqLen+1
sec
sbc /S.NETBIOS
dey
sta (ZPReqPtr),y
rts
*--------------------------------------
Sleep ldy #S.PS.PID
lda (pPS),y
sta CIFS.PID
dec CIFS.Status
Sleep2 stz CIFS.Retries
lda #0
sec
rts
*--------------------------------------
Exit.OK jsr FreeRespData
stz CIFS.Status
* clc
rts
*--------------------------------------
Exit.NODATA cmp #E.NODATA
bne .99
dec CIFS.Retries
beq .98
lda #0
sec
rts
.98 lda #MLI.E.OFFLINE
.99 stz CIFS.Status
sec
rts
*--------------------------------------
GetRespData sta hResp
>SYSCALL2 GetMemPtr
pha
tya
* clc
adc #S.TCP
sta ZPRespPtr
pla
adc /S.TCP
sta ZPRespPtr+1
rts
*--------------------------------------
GetRespDataPtr1 ldy #S.NETBIOS+S.SMB.H+15 Data Offset
lda (ZPRespPtr),y
clc
adc ZPRespPtr
tax
iny
lda (ZPRespPtr),y
adc ZPRespPtr+1
pha
txa
clc
adc #S.NETBIOS
sta ZPPtr1
pla
adc /S.NETBIOS
sta ZPPtr1+1
rts
*--------------------------------------
CheckSMBStatus ldy #S.NETBIOS+S.SMB.H.STATUS
lda (ZPRespPtr),y
clc
beq FreeRespData.RTS
stz CIFS.Status
cmp #2 SRV
bcs .9
iny
iny
lda (ZPRespPtr),y ERR CODE
ldx #MLIERR01-SMBERR01
.1 cmp SMBERR01-1,x
beq .2 CS
dex
bne .1
.9 lda #MLI.E.IO
sec
bra FreeRespData
.2 lda MLIERR01-1,x
*--------------------------------------
FreeRespData php
pha
lda hResp
>SYSCALL2 FreeMem
pla
plp
FreeRespData.RTS
rts
*--------------------------------------
FileInfo2StatBuf
ldx #S.STAT-1
.1 stz StatBuf,x
dex
bpl .1
ldy #0 Creation Date/Time
ldx #S.STAT.CTIME
jsr FileInfo2StatBufDT
ldy #4 Last Access Date/Time
ldx #S.STAT.ATIME
jsr FileInfo2StatBufDT
ldy #8 Last Write Date/Time
ldx #S.STAT.MTIME
jsr FileInfo2StatBufDT
ldy #12+3 Data Size
ldx #3
.7 lda (ZPPtr1),y
sta StatBuf+S.STAT.SIZE,x
dey
dex
bpl .7
ldy #20 File Attribute
lda (ZPPtr1),y
and #$10
beq .8
lda /S.STAT.MODE.DIR
sta StatBuf+S.STAT.MODE+1
.8 rts
*--------------------------------------
* YYYYYYYM MMM DDDDD
* HHHHHmmm mmm SSSSS
*--------------------------------------
FileInfo2StatBufDT
iny
lda (ZPPtr1),y
lsr
php
clc
adc #80
sta StatBuf+S.TIME.YEAR,x
lda #19
adc #0
sta StatBuf+S.TIME.CENTURY,x
dey
plp
lda (ZPPtr1),y
ror
lsr
lsr
lsr
lsr
sta StatBuf+S.TIME.MONTH,x
lda (ZPPtr1),y
and #$1F
sta StatBuf+S.TIME.DAY,x
iny
iny
lda (ZPPtr1),y
and #$1F
asl
sta StatBuf+S.TIME.SECOND,x
lda (ZPPtr1),y
and #$E0
sta StatBuf+S.TIME.MINUTE,x
lda (ZPPtr1),y
lsr
ror StatBuf+S.TIME.MINUTE,x
lsr
ror StatBuf+S.TIME.MINUTE,x
lsr
ror StatBuf+S.TIME.MINUTE,x
lsr StatBuf+S.TIME.MINUTE,x
lsr StatBuf+S.TIME.MINUTE,x
sta StatBuf+S.TIME.HOUR,x
rts
* TODO : S.TIME.WDAY
*--------------------------------------
AddA2Ptr1 adc ZPPtr1
sta ZPPtr1
bcc .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
StatBuf2Ptr2 ldy #S.STAT-1
.1 lda StatBuf,y
sta (ZPPtr2),y
dey
bpl .1
rts
*--------------------------------------
AddSTAT2Ptr2 lda #S.STAT
clc
*--------------------------------------
AddA2Ptr2 adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
*ClearSocket jsr ReadSocket
* bcs .8
* >SYSCALL2 FreeMem
* bra ClearSocket
*.8 clc
* rts
*--------------------------------------
WriteSocket lda MountTable+3 hSocket
WriteSocketA >PUSHA
>PUSHW ZPReqPtr
>PUSHW ZPReqLen
ldx #LIBTCPIP.Send
jmp (pLIBTCPIP)
*--------------------------------------
ReadSocket lda MountTable+3 hSocket
ReadSocketA ldx #LIBTCPIP.Recv
GO.LIBTCPIP jmp (pLIBTCPIP)
*--------------------------------------
CIFS.BADCALL lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
.INB usr/src/lib/libcifs.io.s
*--------------------------------------
CS.END
PRODOS.FT.HEX .HS 0406FAFCFDCBCCCFFF
PRODOS.FT.TXT .AZ "txt"
.AZ "bin"
.AZ "asm"
.AZ "bas"
.AZ "var"
.AZ "pix"
.AZ "fon"
.AZ "pak"
.AZ "sys"
PRODOS.FT.END .EQ *-PRODOS.FT.TXT
PRODOS.FT.DFLT .AZ "$ "
*--------------------------------------
SMBERR01 .DA #2,#3,#32
MLIERR01 .DA #MLI.E.FNOTFND,#MLI.E.PNOTFND,#MLI.E.OPEN
*--------------------------------------
NETBIOS.H .DA #0 DIRECT TCP TRANSPORT
.DA #0 24 BITS LENGTH
.DA /SMB.NegReq.end-SMB.H
.DA #SMB.NegReq.end-SMB.H
*--------------------------------------
SMB.H .DA #$FF
.AS "SMB"
.DA #S.SMB.H.CMD.NEGOTIATE
.HS 00000000
.DA #0 S.SMB.H.FLAGS
.DA S.SMB.H.FLAGS2.LONGNAMES
.DA 0 PIDHI
.HS 0000000000000000 SECFEAT
.DA 0 RSVD
.DA $FFFF TID
.DA $FFFE PIDLO
.BS 2 UID
.DA 0 MID
*--------------------------------------
SMB.NegReq .DA #0 WORD COUNT
.DA #SMB.NegReq.end-2-* ByteCount
.DA #0
* .DA #2
* .AZ "PC NETWORK PROGRAM 1.0"
* .DA #2
* .AZ "LANMAN1.0"
* .DA #2
* .AZ "Windows for Workgroups 3.1a"
* .DA #2
* .AZ "LM1.2X002"
* .DA #2
* .AZ "LANMAN2.1"
.DA #2
.AZ "NT LM 0.12"
* .DA #2
* .AZ "SMB 2.002"
* .DA #2
* .AZ "SMB 2.???"
SMB.NegReq.end .EQ *
*--------------------------------------
SMB.SessionSetup.H
.DA #13 WORD COUNT
.HS FF000000 NO MORE CMD
.DA 1280 MAX BUFFER
.DA 2 MAX MPX COUNT
.HS 0000 VC NUMBER
.HS 00000000 SESSION KEY
.DA 0 CI PASS LEN (ANSI)
.DA 0 CS PASS LEN (UNICODE)
.HS 00000000
.HS 00000000 CAPABILITIES
SMB.SessionSetup.H.Len .EQ *-SMB.SessionSetup.H
* .BS 2 ByteCount
SMB.SessionSetup.Guest
* .AZ "" Password
.AZ "Guest" Account Name
.AZ "?" Primary Domain
SMB.SessionSetup.Guest.Len .EQ *-SMB.SessionSetup.Guest
SMB.SessionSetup.T
.AZ "A2osX" Native OS
.AZ "A2osX-CIFSD" Native LANMAN
SMB.SessionSetup.T.Len .EQ *-SMB.SessionSetup.T
*--------------------------------------
SMB.TreeConnect.H
.DA #4 WORD COUNT
.HS FF000000 NO MORE CMD
.DA 0
.DA 1 PASSWORD LEN (1 for "\0")
SMB.TreeConnect.H.Len .EQ *-SMB.TreeConnect.H
* .BS 2 ByteCount
* .AZ "" PASSWORD
* .AZ "_temp" PATH
SMB.TreeConnect.T
.AZ "A:" Disk Share
SMB.TreeConnect.T.Len .EQ *-SMB.TreeConnect.T
*--------------------------------------
SMB.ComCreate.H .DA #24 WORD COUNT
.HS FF000000 NO MORE CMD
.HS 00 Reserved
.BS 2 NameLength
.HS 00000000 Flags
.HS 00000000 RootDirectoryFID
.HS 00000010 DesiredAccess = GENERIC_ALL
.HS 0000000000000000 AllocationSize
.HS 00000000 ExtFileAttributes
.HS 00000000 ShareAccess
.BS 4 CreateDisposition
.HS 00000000 CreateOptions
.HS 00000000 ImpersonationLevel
.HS 00 SecurityFlags
SMB.ComCreate.H.Len .EQ *-SMB.ComCreate.H
* .BS 2 ByteCount
* .AZ "path\file"
*--------------------------------------
SMB.ComClose.H .DA #3 WORD COUNT
.BS 2 FID
.HS 00000000 LastTimeModified
.HS 0000 ByteCount
SMB.ComClose.H.Len .EQ *-SMB.ComClose.H
*--------------------------------------
SMB.ComFlush.H .DA #1 WORD COUNT
.BS 2 FID
.HS 0000 ByteCount
SMB.ComFlush.H.Len .EQ *-SMB.ComFlush.H
*--------------------------------------
SMB.ComDelete.H .DA #1 WORD COUNT
.HS 0000 SearchAttributes
SMB.ComDelete.H.Len .EQ *-SMB.ComDelete.H
* .BS 2 ByteCount
* .HS 04 BufferFormat
* .AZ "path\file"
*--------------------------------------
SMB.ComRename.H .DA #1 WORD COUNT
.HS 0000 SearchAttributes
SMB.ComRename.H.Len .EQ *-SMB.ComRename.H
* .BS 2 ByteCount
* .HS 04 BufferFormat
* .AZ "oldpath"
* .HS 04 BufferFormat
* .AZ "newpath"
*--------------------------------------
SMB.ComRead.H .DA #10 WORD COUNT
.HS FF000000 NO MORE CMD
.BS 2 FID
.BS 4 Offset
.BS 2 MaxCountOfBytesToReturn
.HS 0000 MinCountOfBytesToReturn
.HS 00000000 Timeout
.HS 0000 Remaining
SMB.ComRead.H.Len .EQ *-SMB.ComRead.H
* .BS 2 ByteCount
*--------------------------------------
SMB.ComWrite.H .DA #12 WORD COUNT
.HS FF000000 NO MORE CMD
.BS 2 FID
.BS 4 Offset
.HS 00000000 Timeout
.HS 0000
* .HS 0100 WriteMode=WritethroughMode
.HS 0000 Remaining
.HS 0000 Reserved
.BS 2 DataLength
.DA S.SMB.H+SMB.ComWrite.H.Len+2 DataOffset (+2 skip ByteCount)
SMB.ComWrite.H.Len .EQ *-SMB.ComWrite.H
* .BS 2 ByteCount
* DATA.....
*--------------------------------------
SMB.Trans2.H .DA #15 WORD COUNT
.BS 2 TotalParamCount
.DA 0 TotalDataCount
.DA 10 MaxParameterCount
.DA 450 MaxDataCount
.DA #0 MaxSetupCount
.HS 00 Reserved1
.DA 0 Flags
.HS 00000000 Timeout
.HS 0000 Reserved2
.BS 2 ParameterCount
.DA 68 ParameterOffset
.HS 0000 DataCount
.HS 0000 DataOffset
.DA #1 SetupCount
.HS 00 Reserved3
SMB.Trans2.H.Len .EQ *-SMB.Trans2.H
*--------------------------------------
SMB.FindFirst2 .DA 1 TRANS2_FIND_FIRST2
.BS 2 PrmCnt
.HS 000000 Padding
.DA $0037 SearchAttributes
.DA 1024 SearchCount
.DA 2 Flags
.DA SMB_INFO_STANDARD InformationLevel
.HS 00000000 SearchStorageType
* .AZ "path\*"
SMB.FindFirst2.Len .EQ *-SMB.FindFirst2
*--------------------------------------
SMB.FindNext2 .DA 2 TRANS2_FIND_NEXT2
.BS 2 PrmCnt
.HS 000000 Padding
.BS 2 SID
.DA 1024 SearchCount
.DA SMB_INFO_STANDARD InformationLevel
.HS 00000000 ResumeKey
.DA 2+8 Flags
* .AZ "path\*"
SMB.FindNext2.Len .EQ *-SMB.FindNext2
*--------------------------------------
SMB.QueryPathInfo
.DA 5 TRANS2_QUERY_PATH_INFORMATION
.BS 2 PrmCnt
.HS 000000 Padding
.DA SMB_INFO_STANDARD InformationLevel
.HS 00000000 SearchStorageType
* .AZ "filename"
SMB.QueryPathInfo.Len .EQ *-SMB.QueryPathInfo
*--------------------------------------
SMB.CreateDirectory
.DA 13 TRANS2_CREATE_DIRECTORY
.BS 2 PrmCnt
.HS 000000 Padding
.HS 00000000 Reserved
* .AZ "DirName"
SMB.CreateDirectory.Len .EQ *-SMB.CreateDirectory
*--------------------------------------
LIBTCPIP .AZ "libtcpip"
hLIBTCPIP .BS 1
pLIBTCPIP .BS 2
hSocket .BS 1
hReq .BS 1
*--------------------------------------
CIFS.Status .BS 1
CIFS.PID .BS 1
CIFS.Retries .BS 1
CIFS.Cnt .BS 2
*--------------------------------------
MountTable .BS 2 pMountPoint
.BS 1 hSMBContext
.BS 1 hSocket
*--------------------------------------
hFD .BS 1
hFILE .BS 1
StatBuf .BS S.STAT
*--------------------------------------
MAN
SAVE usr/src/lib/libcifs.s
ASM