ReactOS 0.4.16-dev-197-g92996da
handle.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TDI interface
4 * FILE: handle.c
5 * PURPOSE: TDI transport handle management
6 */
7
8#include "precomp.h"
9
10const PWCHAR TcpFileName = L"\\Device\\Tcp";
11
13{
14 UNICODE_STRING fileName;
15 OBJECT_ATTRIBUTES objectAttributes;
16 IO_STATUS_BLOCK ioStatusBlock;
18
20
21 InitializeObjectAttributes( &objectAttributes,
22 &fileName,
24 NULL,
25 NULL );
26
27 status = NtOpenFile( tcpFile,
29 &objectAttributes,
30 &ioStatusBlock,
33
34 /* String does not need to be freed: it points to the constant
35 * string we provided */
36
37 if (!NT_SUCCESS(status))
38 *tcpFile = INVALID_HANDLE_VALUE;
39
40 return status;
41}
42
44{
46
47 NtClose( h );
48}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FILE_SHARE_READ
Definition: compat.h:136
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define ASSERT(a)
Definition: mode.c:44
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
ULONG ACCESS_MASK
Definition: nt_native.h:40
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define L(x)
Definition: ntvdm.h:50
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
const PWCHAR TcpFileName
Definition: handle.c:10
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
Definition: ps.c:97
uint16_t * PWCHAR
Definition: typedefs.h:56
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658