mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:23:01 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
48
sdk/lib/tdilib/handle.c
Normal file
48
sdk/lib/tdilib/handle.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS TDI interface
|
||||
* FILE: handle.c
|
||||
* PURPOSE: TDI transport handle management
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
const PWCHAR TcpFileName = L"\\Device\\Tcp";
|
||||
|
||||
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
|
||||
{
|
||||
UNICODE_STRING fileName;
|
||||
OBJECT_ATTRIBUTES objectAttributes;
|
||||
IO_STATUS_BLOCK ioStatusBlock;
|
||||
NTSTATUS status;
|
||||
|
||||
RtlInitUnicodeString( &fileName, TcpFileName );
|
||||
|
||||
InitializeObjectAttributes( &objectAttributes,
|
||||
&fileName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL );
|
||||
|
||||
status = NtOpenFile( tcpFile,
|
||||
DesiredAccess | SYNCHRONIZE,
|
||||
&objectAttributes,
|
||||
&ioStatusBlock,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT);
|
||||
|
||||
/* String does not need to be freed: it points to the constant
|
||||
* string we provided */
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
*tcpFile = INVALID_HANDLE_VALUE;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
VOID closeTcpFile( HANDLE h )
|
||||
{
|
||||
ASSERT(h != INVALID_HANDLE_VALUE);
|
||||
|
||||
NtClose( h );
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue