FNFCIOPEN macro (fci.h)
The FNFCIOPEN macro provides the declaration for the application-defined callback function to open a file in an FCI context.
Syntax
void FNFCIOPEN(
[in] fn
);
Parameters
[in] fn
The name of the file.
Return value
None
Remarks
The function accepts parameters similar to _open.
Examples
FNFCIOPEN(fnFileOpen)
{
HANDLE hFile = NULL;
DWORD dwDesiredAccess = 0;
DWORD dwCreationDisposition = 0;
UNREFERENCED_PARAMETER(pv);
UNREFERENCED_PARAMETER(pmode);
if ( oflag & _O_RDWR )
{
dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
}
else if ( oflag & _O_WRONLY )
{
dwDesiredAccess = GENERIC_WRITE;
}
else
{
dwDesiredAccess = GENERIC_READ;
}
if ( oflag & _O_CREAT )
{
dwCreationDisposition = CREATE_ALWAYS;
}
else
{
dwCreationDisposition = OPEN_EXISTING;
}
hFile = CreateFileA(pszFile,
dwDesiredAccess,
FILE_SHARE_READ,
NULL,
dwCreationDisposition,
FILE_ATTRIBUTE_NORMAL,
NULL);
if ( hFile == INVALID_HANDLE_VALUE )
{
*err = GetLastError();
}
return (INT_PTR)hFile;
}
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | fci.h |