Leaked source code of windows server 2003
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.
 
 
 
 
 
 

80 lines
1.3 KiB

/*++
Copyright (c) 1992 Microsoft Corporation
Module Name:
ndisapi.c
Abstract:
Since we cannot include windows.h and ntos.h in the same C file. Sigh !!!
Author:
JameelH
Environment:
Kernel mode, FSD
Revision History:
Aug 1997 JameelH Initial version
--*/
#include <ntosp.h>
extern
VOID
XSetLastError(
IN ULONG Error
);
VOID
InitUnicodeString(
IN PUNICODE_STRING DestinationString,
IN PCWSTR SourceString
)
{
RtlInitUnicodeString(DestinationString, SourceString);
}
NTSTATUS
AppendUnicodeStringToString(
IN PUNICODE_STRING Destination,
IN PUNICODE_STRING Source
)
{
return (RtlAppendUnicodeStringToString(Destination, Source));
}
HANDLE
OpenDevice(
IN PUNICODE_STRING DeviceName
)
{
OBJECT_ATTRIBUTES ObjAttr;
NTSTATUS Status;
IO_STATUS_BLOCK IoStsBlk;
HANDLE Handle = NULL;
InitializeObjectAttributes(&ObjAttr,
DeviceName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = NtOpenFile(&Handle,
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
&ObjAttr,
&IoStsBlk,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_SYNCHRONOUS_IO_NONALERT);
if (Status != STATUS_SUCCESS)
{
XSetLastError(RtlNtStatusToDosError(Status));
}
return(Handle);
}