test: open.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# open.c

Go to the documentation of this file.

    00001 /*++
    00002
    00003 Copyright (c) 1989  Microsoft Corporation
    00004
    00005 Module Name:
    00006
    00007     open.c
    00008
    00009 Abstract:
    00010
    00011     This module contains the code to implement the NtOpenFile system
    00012     service.
    00013
    00014 Author:
    00015
    00016     Darryl E. Havens (darrylh) 25-Oct-1989
    00017
    00018 Environment:
    00019
    00020     Kernel mode
    00021
    00022 Revision History:
    00023
    00024
    00025 --*/
    00026
    00027 #include "iop.h"
    00028
    00029 #ifdef ALLOC_PRAGMA
    00030 #pragma alloc_text(PAGE, NtOpenFile)
    00031 #endif
    00032
    00033 NTSTATUS
    00034 NtOpenFile(
    00035     OUT PHANDLE FileHandle,
    00036     IN ACCESS_MASK DesiredAccess,
    00037     IN POBJECT_ATTRIBUTES ObjectAttributes,
    00038     OUT PIO_STATUS_BLOCK IoStatusBlock,
    00039     IN ULONG ShareAccess,
    00040     IN ULONG OpenOptions
    00041     )
    00042
    00043 /*++
    00044
    00045 Routine Description:
    00046
    00047     This service opens a file or a device.  It is used to establish a file
    00048     handle to the open device/file that can then be used in subsequent
    00049     operations to perform I/O operations on.
    00050
    00051 Arguments:
    00052
    00053     FileHandle - A pointer to a variable to receive the handle to the open file.
    00054
    00055     DesiredAccess - Supplies the types of access that the caller would like to
    00056         the file.
    00057
    00058     ObjectAttributes - Supplies the attributes to be used for file object (name,
    00059         SECURITY_DESCRIPTOR, etc.)
    00060
    00061     IoStatusBlock - Specifies the address of the caller's I/O status block.
    00062
    00063     ShareAccess - Supplies the types of share access that the caller would like
    00064         to the file.
    00065
    00066     OpenOptions - Caller options for how to perform the open.
    00067
    00068 Return Value:
    00069
    00070     The function value is the final completion status of the open/create
    00071     operation.
    00072
    00073 --*/
    00074
    00075 {
    00076     //
    00077     // Simply invoke the common I/O file creation routine to perform the work.
    00078     //
    00079
    00080     PAGED_CODE();
    00081
    00082     return IoCreateFile( FileHandle,
    00083                          DesiredAccess,
    00084                          ObjectAttributes,
    00085                          IoStatusBlock,
    00086                          (PLARGE_INTEGER) NULL,
    00087                          0L,
    00088                          ShareAccess,
    00089                          FILE_OPEN,
    00090                          OpenOptions,
    00091                          (PVOID) NULL,
    00092                          0L,
    00093                          CreateFileTypeNone,
    00094                          (PVOID) NULL,
    00095                          0 );
    00096 }