|  Just popping in 
   
   
                        Joined:2007/6/5 13:51
 Last Login
                                :
 2024/9/4 21:03
 From Brisbane, AUSTRALIA Group:
                                 Registered Users
 | Firstly, you MUST NEVER perform any filesystem operations while you have the doslist locked, as it will most likely end in a deadlock if your
 action causes a handler startup or other action that changes the doslist.
 
 Calling any DOS functions is also unwise for that matter as they may take
 an innordinant amount of time to complete,  and as of V53 the doslist
 lock still implies a Forbid(), which means that multitasking stops.
 
 Better to do it this way;
 Make a struct MinList, call NewMinList() on it.
 Lock the doslist, use the flags;  LDF_DEVICES|LDF_VOLUMES|LDF_READ.
 
 Itterate, for each entry returned, allocate a minnode structure that
 holds the relevant data you want, namely dol_Type, dol_Port and some
 space for the dol_Name string.  Something like this will do;
 
 struct MyNode
 {
 struct MinNode  my_Node;       /* a simple struct Node */
 int32           my_Type;       /* holds the dol_Type  DLT_xxx value */
 struct MsgPort *my_Port;       /* ptr to handler process port */
 TEXT            my_Name[256];  /* A C-String buffer for the BSTR name */
 };
 
 Then allocate one of these each time as sizeof(MyNode), and copy out
 the relevant fields.  Then  IExec->AddTail() the node to your minlist.
 Do this until you fall out, then unlock the doslist ASAP.
 
 Now, if a DLT_VOLUME node has the same port address as a DLT_DEVICE,
 then you have found the matching nodes for a given mounted volume.
 
 Just one caveat, DON'T actually use the port for anything other than
 the comparison, as a volume can "go away" at any moment.
 
 Also, don't forget to IExec->RemHead() all your nodes and free them
 when you're finished..
 
 
                                     |