Category : Network Files
Archive   : PREFER.ZIP
Filename : PREFER.C

 
Output of file : PREFER.C contained in archive : PREFER.ZIP
#include
#include
#include
#include

main(argc,argv)
int argc;
char *argv[];
{
char serverName[48];
WORD connectID1,connectID2,DefaultConnectionID;
int netReturn,localDrives;
char fileServerName[48];
BYTE newDirHandle, mask;
char loginPath[]="SYS:LOGIN";
char letter,chr='A';


if(argc<2)exit();
strcpy(serverName,argv[1]);
strupr(serverName);


DefaultConnectionID=GetDefaultConnectionID();
GetFileServerName(DefaultConnectionID,fileServerName);
printf("\nDefault server is %s.\n",fileServerName);

netReturn=AttachToFileServer(&serverName, &connectID1);
if (netReturn==252)
{
printf("Unknown file server requested: %s.\n",serverName);
exit();
}

if( connectID1 != DefaultConnectionID)
{
DetachFromFileServer(DefaultConnectionID);
SetPrimaryConnectionID(connectID1);
SetPreferredConnectionID(connectID1);

localDrives=GetNumberOFLocalDrives();
letter=(char)(chr+localDrives);

netReturn=AllocPermanentDirectoryHandle(0x00,&loginPath,letter,newDirHandle,mask);

printf("\nNew default server is %s.\n",serverName);
}

}


  3 Responses to “Category : Network Files
Archive   : PREFER.ZIP
Filename : PREFER.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/