Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
69 user(s) are online (62 user(s) are browsing Forums)

Members: 1
Guests: 68

afxgroup, more...

Support us!

Headlines

 
  Register To Post  

Determine MultiAssign
Just popping in
Just popping in


See User information
How do I determine if an entry is a multi-assign?

LIBS: could be
Workbench:Libs
Workbench:MUI/Libs

bin: could be
Programming:SDK/local/C
Programming:SDK/C

BOOL
GetAssigns
(VOID)
{
    
BOOL                            Success=TRUE;
    
struct Node                        *node;
    
struct List                        *ADOList;

    
struct DevProc                    *dp=NULL;

    if ((
ADOList=IDOS->AllocDosObjectTags(DOS_VOLUMELIST,
        
ADO_Type,                                LDF_ASSIGNS,
        
ADO_AddColon,                            TRUE,
    
TAG_END)))
    {
        for(
node=IExec->GetHead(ADOList); nodenode=IExec->GetSucc(node))
        {
            if ((
dp=IDOS->GetDeviceProcFlags(node->ln_Name,0,LDF_ALL)))
            {
                if (
dp->dvp_Flags DVPB_MULTIASSIGN)
                {
                    
IDOS->Printf("MultiAssign: %s\n",node->ln_Name);
                }

                
IDOS->FreeDeviceProc(dp);
            }


            if (!(
AssignsNode=(struct AssignsNode *)SAK_CreateGenericListNode(sizeof(struct AssignsNode),(STRPTR)"")))
            {
                
SAK_EasyRequest(Objects[OID_WINDOW],MainWindow,RequesterTitle,REQIMAGE_WARNING,0,SAK_LocaleString(MSG_COULD_NOT_CREATE_EXEC_LIST_NODE),SAK_LocaleString(MSG_CONTINUE));
                
Success=FALSE;
                break;
            }
            
SAK_AddGenericListNode(MasterAssignsList,(struct Node *)AssignsNode,GLIST_BOTTOM);

            
IUtility->SNPrintf(AssignsNode->Name,128,"%s",node->ln_Name);
            
IUtility->SNPrintf(AssignsNode->UserData,128,"[Ass]%s",AssignsNode->Name);
        }

        
IDOS->FreeDosObject(DOS_VOLUMELIST,ADOList);
    }

    return(
Success);
}


Once I determine if it is a multi-assign, how do I get the list of paths for it?

The Asl file requester, Volumes, show multi-assigns in bold. When click on it, a new window opens with the items.

Go to top
Re: Determine MultiAssign
Just popping in
Just popping in


See User information
if (dp->dvp_Flags & DVPB_ASSIGNMENT)

gives me the multi-assign entries. Weird.

But now how do I get their items?

Workbench Explorer - A better way to browse drawers
Go to top
Re: Determine MultiAssign
Just popping in
Just popping in


See User information
BOOL
GetAssigns
(VOID)
{
    
BOOL                            Success=TRUE;
    
struct Node                        *node;
    
struct List                        *ADOList;
    
struct DevProc                    *dp=NULL, *dp2=NULL;
    
struct MsgPort                    *filesystemtask;

    if ((
ADOList=IDOS->AllocDosObjectTags(DOS_VOLUMELIST,
        
ADO_Type,                                LDF_ASSIGNS,
        
ADO_AddColon,                            TRUE,
    
TAG_END)))
    {
        for(
node=IExec->GetHead(ADOList); nodenode=IExec->GetSucc(node))
        {
            if (!(
AssignsNode=(struct AssignsNode *)SAK_CreateGenericListNode(sizeof(struct AssignsNode),(STRPTR)"")))
            {
                
SAK_EasyRequest(Objects[OID_WINDOW],MainWindow,RequesterTitle,REQIMAGE_WARNING,0,SAK_LocaleString(MSG_COULD_NOT_CREATE_EXEC_LIST_NODE),SAK_LocaleString(MSG_CONTINUE));
                
Success=FALSE;
                break;
            }
            
SAK_AddGenericListNode(MasterAssignsList,(struct Node *)AssignsNode,GLIST_BOTTOM);

            
IUtility->SNPrintf(AssignsNode->Name,128,"%s",node->ln_Name);
            
IUtility->SNPrintf(AssignsNode->UserData,128,"[Ass]%s",AssignsNode->Name);
//            AssignsNode->IsMultiAssign=FALSE;

            
while ((dp=IDOS->GetDeviceProcFlags(node->ln_Name,dp,LDF_ALL)))
            {
                if (
dp->dvp_Flags DVPB_ASSIGNMENT)
                {
                    
IDOS->Printf("MultiAssign: %s\n",node->ln_Name);
//                    AssignsNode->IsMultiAssign=TRUE;

                    
filesystemtask IDOS->GetFileSysPort();
                    do
                    {
                        if ((
dp2=IDOS->GetDeviceProcFlags(node->ln_Name,dp2,LDF_ALL)))
                        {
                            
IDOS->SetFileSysPort(dp2->dvp_Port);
                            if ((
IDOS->NameFromLock(dp2->dvp_Lock,Misc1Buffer,1024)))
                            {
                                
IDOS->Printf("MultiAssign: %s -> %s\n",node->ln_Name,Misc1Buffer);
                                
error=0;
                            }
                            else
                                
error=IDOS->IoErr();

                            if (
error != 0)
                                break;

                        }
                    } while (
dp2 && (dp2->dvp_Flags DVPF_MULTIASSIGN));

                    
IDOS->SetFileSysPort(filesystemtask);
                    if (
dp2)
                    {
                        
IDOS->FreeDeviceProc(dp2);
                        
dp2=NULL;
                    }
                }
            }
        }

        if (
dp)
            
IDOS->FreeDeviceProc(dp);

        
IDOS->FreeDosObject(DOS_VOLUMELIST,ADOList);
    }

    return(
Success);
}


Are the
filesystemtask = IDOS->GetFileSysPort();
and
IDOS->SetFileSysPort(dp2->dvp_Port);
and
IDOS->SetFileSysPort(filesystemtask);
necessary? It works without them.

Workbench Explorer - A better way to browse drawers
Go to top
Re: Determine MultiAssign
Just can't stay away
Just can't stay away


See User information
@mritter0

Quote:

Are the
filesystemtask = IDOS->GetFileSysPort();
and
IDOS->SetFileSysPort(dp2->dvp_Port);
and
IDOS->SetFileSysPort(filesystemtask);
necessary? It works without them.


They are necessary because dp2->dvp_Lock can be ZERO if the assign is on the filesystem root.

If you didn't have these statements you would always get the SYS: partition from IDOS->NameFromLock() for such assigns.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project