Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FNFCIOPEN macro

The FNFCIOPEN macro provides the declaration for the application-defined callback function to open a file in an FCI context.

Syntax


INT_PTR FNFCIOPEN(
  [in] LPSTR    pszFile,
       int      oflag,
       int      pmode,
       int FAR  *err,
       void FAR *pv
);

Parameters

pszFile [in]

The name of the file.

oflag

Specifies the type of operations allowed.

pmode

Specifies the permission mode.

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 an application-defined INT_PTR which is used to refer to the opened file. However, a value of -1 indicates an error.

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

Header

Fci.h

See also

FCICreate

 

 

Show: