FNFCIGETOPENINFO macro
The FNFCIGETOPENINFO macro provides the declaration for the application-defined callback function to open a file and retrieve file date, time, and attribute.
Syntax
INT_PTR FNFCIGETOPENINFO( [in] LPSTR pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int FAR *err, void FAR *pv );
Parameters
- pszName [in]
-
The complete filename.
- pdate
-
The MS-DOS date. The date is a packed value with the following format:
Bits Description 0-4 Day of the Month (1-31) 5-8 Month (1 = January, 2 = Feburary, etc.) 9-15 Year Offset from 1980 (add 1980 to value to get current date) - ptime
-
The MS-DOS time. The time is a packed value with the following format:
Bits Description 0-4 Second divided by 2 5-8 Minute (0-59) 9-15 Hour (0-23 on a 24-hour clock) - pattribs
-
The file attributes. For possible values and their descriptions, see File Attributes.
- err
-
Pointer to the error code value. This value will be used to provide extended error information in the ERF structure used to create the FCI context.
- pv
-
Pointer to an application-defined value.
Return value
The return value is application-defined and used to keep track of the opened file. However, a value of -1 indicates an error.
Remarks
The function should open the file using the file open function compatible with those passed into FCICreate.
Examples
FNFCIGETOPENINFO(fnGetOpenInfo)
{
HANDLE hFile;
FILETIME fileTime;
BY_HANDLE_FILE_INFORMATION fileInfo;
hFile = (HANDLE)fnFileOpen(pszName, _O_RDONLY, 0, err, pv);
if ( hFile != (HANDLE)-1 )
{
if( GetFileInformationByHandle(hFile, &fileInfo)
&& FileTimeToLocalFileTime(&fileInfo.ftCreationTime, &fileTime)
&& FileTimeToDosDateTime(&fileTime, pdate, ptime) )
{
*pattribs = (USHORT)fileInfo.dwFileAttributes;
*pattribs &= ( _A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_ARCH );
}
else
{
fnFileClose((INT_PTR)hFile, err, pv);
hFile = (HANDLE)-1;
}
}
return (INT_PTR)hFile;
}
Requirements
|
Header |
|
|---|
See also