home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-19 | 1.2 KB | 49 lines | [TEXT/CWIE] |
- unit AFPMountVol;
-
- interface
-
- uses
- Types;
-
- function AFPMount (zone, server, vol, user, password: Str32): OSErr;
-
- implementation
-
- uses
- Memory,Files;
-
- function AFPMount (zone, server, vol, user, password: Str32): OSErr;
- var
- info: AFPVolMountInfo;
- cur_offset: integer;
-
- function CopyString (s: Str32): integer;
- begin
- CopyString := cur_offset + 23; (* 23 = header size - 1 (because the AFPData array is 1 based) *)
- BlockMove(@s, @info.AFPData[cur_offset], length(s) + 1);
- cur_offset := cur_offset + length(s) + 1;
- end; (* CopyString *)
-
- var
- pb: ParamBlockRec;
- begin
- info.length := sizeof(info);
- info.media := AppleShareMediaType;
- info.flags := 0;
- info.nbpInterval := 0;
- info.nbpCount := 0;
- info.uamType := kTwoWayEncryptPassword;
- cur_offset := 1;
- info.zoneNameOffset := CopyString(zone);
- info.serverNameOffset := CopyString(server);
- info.volNameOffset := CopyString(vol);
- info.userNameOffset := CopyString(user);
- info.userPasswordOffset := CopyString(password);
- info.volPasswordOffset := CopyString('');
- with pb do begin (* safe *)
- pb.ioBuffer := @info;
- end; (* with *)
- AFPMount := PBVolumeMount(@pb);
- end; (* AFPMount *)
-
- end. (* AFPMountVol *)