http://www.ousob.com --- Legacy Redefined #include <stdio.h> #include <stdlib.h> #include <string.h> #include <io.h> #include <nit.h> #include <extend50.h> BYTE getDrive(char aLetter); char *ltrim(char *input); CLIPPER b_owname() { char objectName[48]; int ccode, completionCode, sequenceNumber, isSame; char filePath[256], fileName[15], creationDate[2]; char lastAccessDate[2], lastUpdateDateAndTime[4]; char lastArchiveDateAndTime[4]; BYTE directoryHandle, searchAttributes; BYTE fileAttributes, extendedFileAttributes; WORD objectType; long fileOwnerID, fileSize; char buffer[256]; WORD objUserType; int ccodeUser; char objUserName[48]; long objUserID; BYTE loginTime[7]; BYTE driveNumber; char day[10], time[9], ttime[3], AmPm[3]; WORD year; int PM; char month[9]; WORD ConnectionNumber; if( !PCOUNT || !ISCHAR(1) ) { _retc(""); return; } ConnectionNumber = GetConnectionNumber(); if( ConnectionNumber == 0 ) { _retc(""); return; } if( access(_parc(1),0) != 0 ){ _retc(""); return; } driveNumber = getDrive(toupper(_parc(1)[0])); _parc(1)[0] = ' '; _parc(1)[1] = ' '; _parc(1)[2] = ' '; directoryHandle = GetDirectoryHandle( driveNumber ); sequenceNumber = -1; sprintf(buffer,"SYS:\\%s\0",ltrim(_parc(1))); searchAttributes = 0x06, completionCode = ScanFileInformation(directoryHandle, buffer, (BYTE)searchAttributes, &sequenceNumber, fileName, &fileAttributes, &extendedFileAttributes, &fileSize, creationDate, lastAccessDate, lastUpdateDateAndTime, lastArchiveDateAndTime, &fileOwnerID); if ( completionCode != 0 ) { _retc(""); } GetBinderyObjectName(fileOwnerID, objectName, &objectType); /* printf("\ncurrent user id = *%s*\n", objUserName); printf("\nfile owner id = *%s*\n", objectName); printf("\nfileID = %ld\n", fileOwnerID); */ _retc(objectName); } BYTE getDrive(char aLetter) { BYTE retVal = 0; switch(aLetter) { case 'O': retVal = 14; break; case 'P': retVal = 15; break; case 'Q': retVal = 16; break; case 'R': retVal = 17; break; case 'S': retVal = 18; break; case 'T': retVal = 19; break; case 'U': retVal = 20; break; case 'V': retVal = 21; break; case 'W': retVal = 22; break; case 'X': retVal = 23; break; case 'Y': retVal = 24; break; case 'Z': retVal = 25; break; } return(retVal); } char *ltrim(char *input) { int i; for( i=0; input[i] == ' '; i++ ) { ; /* NULL */ } return(strcpy( input,(input+i) ) ); }