[futurebasic] Mounting Appleshare volumes (again)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2001 : Group Archive : Group : All Groups

From: John Wolf <jwolf@...>
Date: Fri, 23 Mar 2001 15:02:53 -0600
Lets try this with Eudora.

Yes, this is PITA code to set up, but once set up, it is quite usable.

Here is the code to log into a server. I am manually filling out the 
volumemount param block based on the values captured from a hex dump 
of the volume info record. (The second program dumps the volume info 
record to a file so you can open it with a hex editor and roll your 
own param block.) The param block is tightly tied to the server you 
are connecting to. You can't just change the values in this example 
and have it work on an ASIP box. This one works on a NT box running 
MacServerIP, but if you recreate the param block correctly, it will 
work with any Apple server. Hopefully someone who understands what I 
am doing here can turn the volume info grabber into something a 
little more friendly, like to save it as a resource that can be 
called back in, plug the username and PW in, and then issue the 
PBVolumeMount call.

Something I noticed when upgrading to FB3 v4: Even though 
PBVolumeMount is recognized by the editor, the code will not compile 
without the TOOLBOX FN def. The same goes for many (all?) of the new 
toolbox defs that were added for FB3 v4.

------------------------------
'Log into a server volume

TOOLBOX FN PBVolumeMount(long) = word `0x205F,0x7041,0xA260,0x3E80
END GLOBALS

REGISTER ON

CLEAR LOCAL
LOCAL FN MountServer
DEFSTR LONG
DIM pbBlk.128
DIM AFPInfo.296
DIM osErr%

AFPInfo.0% =  275 'length
AFPInfo.2& = _"afpm" 'Appleshare mount
AFPInfo.6% = 128 'Something that is supposed to be 0, 128 probably means ASIP.
AFPInfo.10% = 2 'login type. 1=guest 2=unencrypt PW 3=encrypted PW 
4=Random Encrypted PW
AFPInfo.12% = 30 'Offset to Zonename
AFPInfo.14% = 63 'Offset to Servername
AFPInfo.16% = 95 'Offset to VolumeName
AFPInfo.18% = 123 'Offset to Username
AFPInfo.20% = 155 'Offset to user PW
AFPInfo.22% = 164 'Offset to Vol PW
AFPInfo.24% = 1 'No clue what this is
AFPInfo.26% = 173 'Offset to UAM name
AFPInfo.28% = 206 'Offset to UAM info record?
AFPInfo.30$ = "TM Servers" 'Zone name
AFPInfo.63$ = "TMFILE1" 'Server name
AFPInfo.95$ = "MacUpdates" 'Volume name
AFPInfo.123$ = "macupdate" 'User name
AFPInfo.155$ = "notthis" 'Password
AFPInfo.173$ = "Apple Std UAM" 'UAM name
AFPInfo.206% = &h0001 'From here on is just stuff copied from the hex 
dump. No idea what it is.
AFPInfo.208& = &h06033c4f
AFPInfo.212& = &h68ee0601
AFPInfo.216& = &h90d2ca0c 'IP address in this UAM record


pbBlk.ioCompletion&   = 0 'no iocompletion
pbBlk.ioBuffer& = @AFPInfo 'pointer to volume info

osErr% = fn PBVolumeMount(@pbBlk)
END FN = osErr%

FN MountServer

------------------------------
The following program dumps the volume info into a file so you can 
examine it and convert it into PBblock fields. It only looks at the 
second volume on the desktop, so when you run it, make sure you only 
have the Boot volume and the server you want the mount info from on 
the desktop. It might be nifty to modify this program to let you 
select a volume to get the mount info from, it would also be bright 
to write to a resource that the log in routine could recall, plug in 
a username and PW and then issue the PBVolumeMount.
------------------------------

TOOLBOX FN PBGetVolMountInfoSize (LONG) = word `0x205F,0x703F,0xA260,0x3E80
ToolBox FN PBGetVolMountInfo (LONG) = word `0x205F,0x7040,0xA260,0x3E80

END GLOBALS

CLEAR LOCAL
LOCAL FN PBGetVolMountSize
DIM pbBlk.128, @BuffSize%
DIM osErr%

BuffSize%=0
pbBlk.ioCompletion&   = 0 'no iocompletion
pbBlk.ioVRefNum%      = -2'The second volume on desk
pbBlk.ioBuffer& = @BuffSize% 'pointer to volume info size

osErr% = FN PBGetVolMountInfoSize(@pbBlk)

END FN=BuffSize%

CLEAR LOCAL
LOCAL FN myPBGetVolMountInfo(size%)
DIM pbBlk.128, AFPInfo.2048
dim osErr%

pbBlk.ioCompletion&   = 0 'no iocompletion
pbBlk.ioVRefNum%      = -2
pbBlk.ioBuffer& = @AFPInfo 'pointer to volume info size

osErr% = fn PBGetVolMountInfo(@pbBlk)

OPEN "O",1,"VolMountInfo dump"
WRITE FILE #1,@AFPInfo,size%
CLOSE #1

END FN

dim size%
size%=FN PBGetVolMountSize
PRINT "The volume Mount Info is :"size%" bytes long"
IF size%>0 AND size%<2048 THEN FN myPBGetVolMountInfo(size%)

do
until mouse(_down)