IECreateFile function

Calls the standard CreateFile function from a higher-integrity user context. Creates or opens a file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. The function returns a handle that can be used to access the object.

Syntax

HANDLE IECreateFile(
  _In_ LPCWSTR               lpFileName,
       DWORD                 dwDesiredAccess,
       DWORD                 dwShareMode,
  _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
       DWORD                 dwCreationDisposition,
       DWORD                 dwFlagsAndAttributes,
  _In_ HANDLE                hTemplateFile
);

Parameters

  • lpFileName [in]
    The name of the object to be created or opened.

  • dwDesiredAccess
    The access to the object, which can be read, write, or both.

  • dwShareMode
    The sharing mode of an object, which can be read, write, both, or none.

  • lpSecurityAttributes [in]
    A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes.

  • dwCreationDisposition
    An action to take on files that exist and do not exist.

  • dwFlagsAndAttributes
    The file attributes and flags.

  • hTemplateFile [in]
    A handle to a template file with the GENERIC_READ access right. The template file supplies file attributes and extended attributes for the file that is being created. This parameter can be NULL.

Return value

If the function succeeds, the return value is an open handle to a specified file. If a specified file exists before the function call and dwCreationDisposition is CREATE_ALWAYS or OPEN_ALWAYS, a call to GetLastError returns ERROR_ALREADY_EXISTS, even when the function succeeds. If a file does not exist before the call, GetLastError returns zero (0). If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

Remarks

Requirements

Minimum supported client

Windows XP with SP2

Minimum supported server

Windows Server 2003

Product

Internet Explorer 8

Header

Iepmapi.h

Library

Iepmapi.lib

DLL

Ieframe.dll

See also

CreateFile