perhaps people might like to examine the smbvfs layer in the cliffs project. inspired by the vfs layer, it is an abstraction of all smb functions [i did not get round to doing SMBsesssetupX and SMBtconX, but all other critical functions are abstracted].