Category : Network Files
Archive   : TAKEOV.ZIP
Filename : TAKEOVER.C

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

/* Takeover Ver 1.0
Written By Gary Macy
Lockheed Missiles & Space Co. Inc.
Strategic Weapons Facility - Pacific.
Box 6429
NSB Bangor, WA 98315

Language: Microsoft C6.1 - Requires Novell 'C' Interface

Purpose: To reaasign ownership of files to correct problems with
users who are impacted by file storage size limitations
File ownership can be assigned to any valid user Object
or, by default to the supervisor.

** Provided to NetWire As-Is

*/

BYTE creationDate[4],maxRights,prompt_flag;
char searchPath[130],dirName[13];
int seqNumber,ccode;
unsigned long ownerID,target_ID;
char target_name[45];
unsigned char filePath[255],fileName[15],fcreationDate[2],lastAccessDate[2] ;
unsigned char lastUpdate[4], lastArchiveDateAndTime[4];
BYTE dirHandle,searchAttributes,fileAttributes,extendedFileAttributes;
unsigned long fileOwnerID,fileSize,freesize=0,freecount=0;
FILE *datefile;

long UserBID(char *username)
{ long ID;
int rc;
rc=GetBinderyObjectID(username,1,&ID);
if (rc!=0)
{printf("Error - Couldn't get Object ID for %s - rc=%x\n",username,rc);
exit(-4);
}
return(ID);
}

void take_over_file(char *which1 )
{ int rc,doit;
char drive[_MAX_DRIVE],dir[_MAX_DIR],fname[_MAX_FNAME],ext[_MAX_EXT];
char answer,fixpath[_MAX_PATH];
seqNumber=-1;
dirHandle=0;
_splitpath(which1,drive,dir,fname,ext);
searchAttributes=FA_NORMAL | FA_READ_ONLY | FA_HIDDEN | FA_SYSTEM ;
strcpy(filePath,which1);
do
{ if ((ccode=ScanFileInformation(0,&filePath,&searchAttributes,
&seqNumber,&fileName,&fileAttributes,&extendedFileAttributes,
&fileSize,&fcreationDate,
&lastAccessDate,&lastUpdate,
&lastArchiveDateAndTime,&fileOwnerID))==0)
{ fileOwnerID=target_ID;
if(prompt_flag>0)
{ printf("Change %s ? ",fileName);
answer=getche();
if (answer=='y'|answer=='Y') {doit=1;}
else {doit=0;}
}
else {doit=1;}
if (doit==1)
{ _makepath(fixpath,drive,dir,'\0',"");
strcat(fixpath,fileName);
printf("Setting %s to owner %s\n",fixpath,target_name);
if ((rc=SetFileInformation(0,&fixpath,&searchAttributes,
fileAttributes,extendedFileAttributes,
fcreationDate,
lastAccessDate,lastUpdate,
lastArchiveDateAndTime,fileOwnerID))!=0)
{ printf("Error - Couldn't update file Ownership for %s RC=%x\n",fixpath,rc);
}
}
else {printf("Skipping %s\n",filePath); }
}
} while (ccode==0);
}

void make_path(char *oldpath)
{ char drv,work[70],drive[_MAX_DRIVE],dir[_MAX_DIR],fname[_MAX_FNAME],ext[_MAX_EXT];
WORD conID;
BYTE dhandle,sflags;
_splitpath(oldpath,drive,dir,fname,ext);
if (strlen(drive)==0)
{ drive[0]=_getdrive();
drive[0]+='A'-1;
drive[1]='\0';
}
drv=drive[0]-'A';
GetDriveInformation(drv,&conID,&dhandle,&sflags);
GetDirectoryPath(dhandle,&dir);
_makepath(searchPath,"",dir,fname,ext);
}

main(argc,argv)
int argc;
char *argv[];
{ int t1;
BYTE level;
long objectID;
printf("Novell Mass File ReAssignment 1.0\n");
t1=GetBinderyAccessLevel(&level,&objectID);
if (level!=0x33)
{ printf("Error - You are not authorized to use this function!\nAccess=%x\n",level);
exit(-2);
}
if (argc<2)
{ printf( "\nError - Wrong Format for Command Use:\n");
printf( "\nTAKEOVER [PATH:]FILENAME [/P] [/Ixxxxxxxxxx] - switches are optional where:\n");
printf( "/P means ask for each file\n");
printf( "/Ixxxxxxxxx Assigns Files to user Named xxxxxxxx (Default is SUPERVISOR)\n");
printf( " wildcards in the path names are acceptable.\n");
exit (7);
}
prompt_flag=0;
strcpy(target_name,"SUPERVISOR");
for (t1=1;t1 { if (strnicmp(argv[t1],"/P",2)==0) prompt_flag=1;
if (strnicmp(argv[t1],"/I",2)==0) strcpy(target_name,strupr(argv[t1]+2));
}
make_path(strupr(argv[1]));
printf ("Changing %s to owner %s ",searchPath,target_name);
if (prompt_flag==0) {printf( "en Mass.\n\n");}
else { printf("prompted\n\n");}
target_ID=UserBID(target_name);
take_over_file(searchPath);
}


  3 Responses to “Category : Network Files
Archive   : TAKEOV.ZIP
Filename : TAKEOVER.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/