Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. open.c
  5. Abstract:
  6. This module contains the code to implement the NtOpenFile system
  7. service.
  8. Author:
  9. Darryl E. Havens (darrylh) 25-Oct-1989
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. --*/
  14. #include "iomgr.h"
  15. #ifdef ALLOC_PRAGMA
  16. #pragma alloc_text(PAGE, NtOpenFile)
  17. #endif
  18. NTSTATUS
  19. NtOpenFile(
  20. OUT PHANDLE FileHandle,
  21. IN ACCESS_MASK DesiredAccess,
  22. IN POBJECT_ATTRIBUTES ObjectAttributes,
  23. OUT PIO_STATUS_BLOCK IoStatusBlock,
  24. IN ULONG ShareAccess,
  25. IN ULONG OpenOptions
  26. )
  27. /*++
  28. Routine Description:
  29. This service opens a file or a device. It is used to establish a file
  30. handle to the open device/file that can then be used in subsequent
  31. operations to perform I/O operations on.
  32. Arguments:
  33. FileHandle - A pointer to a variable to receive the handle to the open file.
  34. DesiredAccess - Supplies the types of access that the caller would like to
  35. the file.
  36. ObjectAttributes - Supplies the attributes to be used for file object (name,
  37. SECURITY_DESCRIPTOR, etc.)
  38. IoStatusBlock - Specifies the address of the caller's I/O status block.
  39. ShareAccess - Supplies the types of share access that the caller would like
  40. to the file.
  41. OpenOptions - Caller options for how to perform the open.
  42. Return Value:
  43. The function value is the final completion status of the open/create
  44. operation.
  45. --*/
  46. {
  47. //
  48. // Simply invoke the common I/O file creation routine to perform the work.
  49. //
  50. PAGED_CODE();
  51. return IoCreateFile( FileHandle,
  52. DesiredAccess,
  53. ObjectAttributes,
  54. IoStatusBlock,
  55. (PLARGE_INTEGER) NULL,
  56. 0L,
  57. ShareAccess,
  58. FILE_OPEN,
  59. OpenOptions,
  60. (PVOID) NULL,
  61. 0L,
  62. CreateFileTypeNone,
  63. (PVOID) NULL,
  64. 0 );
  65. }