Code to ASSIGN (OS1.2)
04-Jun-94 11:10:36
Sb: #41280-Code to ASSIGN (OS1.2)
Fm: John Toebes/SYSOP 70007,3467
To: Murray Dowling 100032,2552
To actually do an assign is a bit of a task under 1.2, but if you want to
you can take the following route:
1. Create a lock on the item that you want to assign using Lock()
2. Create a DosList structure using a DosAllocMem function (the length
in longwords needs to be immediately before the data)
3. Create a Bstr (out of DosAllocMemed memory) with the name of the assign
– IGNORE the colon.
4. Fill in the fields with dol_Lock=your lock, dol_Type = DLT_DIRECTORY,
dol_Task = deviceproc of the lock , dol_Name=namebstr.
5. Add it to the list of devices. To get to this, you DosBase as your
starting point. It will point to dl_Root which is a RootNode. The BPTR
rn_Info points to a struct DosInfo. In there, di_Devices is a BPTR to the
start of the list. Add your node at the head of the list.
Of course, you should check for error conditions (like it is already in
the list, not enough memory, bad locks, …)
Enjoy.
P.S. Allways program with the buddy system. You never know when one of
those bugs will zap you 🙂