|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* WinPR: Windows Portable Runtime
|
|
Packit |
1fb8d4 |
* Windows Native System Services
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
Packit |
1fb8d4 |
* Copyright 2013 Thincast Technologies GmbH
|
|
Packit |
1fb8d4 |
* Copyright 2013 Norbert Federa <norbert.federa@thincast.com>
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit |
1fb8d4 |
* you may not use this file except in compliance with the License.
|
|
Packit |
1fb8d4 |
* You may obtain a copy of the License at
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
1fb8d4 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
1fb8d4 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
1fb8d4 |
* See the License for the specific language governing permissions and
|
|
Packit |
1fb8d4 |
* limitations under the License.
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
1fb8d4 |
#include "config.h"
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <winpr/crt.h>
|
|
Packit |
1fb8d4 |
#include <winpr/library.h>
|
|
Packit |
1fb8d4 |
#include <winpr/wlog.h>
|
|
Packit |
1fb8d4 |
#include <winpr/nt.h>
|
|
Packit |
1fb8d4 |
#include <winpr/endian.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include "../log.h"
|
|
Packit |
1fb8d4 |
#define TAG WINPR_TAG("nt")
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtXxx Routines:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff557720/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* InitializeObjectAttributes macro
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff547804/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
VOID _InitializeObjectAttributes(POBJECT_ATTRIBUTES InitializedAttributes,
|
|
Packit Service |
5a9772 |
PUNICODE_STRING ObjectName, ULONG Attributes, HANDLE RootDirectory,
|
|
Packit Service |
5a9772 |
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if defined(_WIN32) && !defined(_UWP)
|
|
Packit Service |
5a9772 |
InitializeObjectAttributes(InitializedAttributes, ObjectName, Attributes, RootDirectory,
|
|
Packit Service |
5a9772 |
SecurityDescriptor);
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
InitializedAttributes->Length = sizeof(OBJECT_ATTRIBUTES);
|
|
Packit |
1fb8d4 |
InitializedAttributes->ObjectName = ObjectName;
|
|
Packit |
1fb8d4 |
InitializedAttributes->Attributes = Attributes;
|
|
Packit |
1fb8d4 |
InitializedAttributes->RootDirectory = RootDirectory;
|
|
Packit |
1fb8d4 |
InitializedAttributes->SecurityDescriptor = SecurityDescriptor;
|
|
Packit |
1fb8d4 |
InitializedAttributes->SecurityQualityOfService = NULL;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifndef _WIN32
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <pthread.h>
|
|
Packit |
1fb8d4 |
#include <winpr/crt.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include "../handle/handle.h"
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
struct winpr_nt_file
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
WINPR_HANDLE_DEF();
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
ACCESS_MASK DesiredAccess;
|
|
Packit |
1fb8d4 |
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
Packit |
1fb8d4 |
ULONG FileAttributes;
|
|
Packit |
1fb8d4 |
ULONG ShareAccess;
|
|
Packit |
1fb8d4 |
ULONG CreateDisposition;
|
|
Packit |
1fb8d4 |
ULONG CreateOptions;
|
|
Packit |
1fb8d4 |
};
|
|
Packit |
1fb8d4 |
typedef struct winpr_nt_file WINPR_NT_FILE;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
static pthread_once_t _TebOnceControl = PTHREAD_ONCE_INIT;
|
|
Packit Service |
5a9772 |
static pthread_key_t _TebKey;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
static void _TebDestruct(void* teb)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
free(teb);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
static void _TebInitOnce(void)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
pthread_key_create(&_TebKey, _TebDestruct);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
PTEB NtCurrentTeb(void)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
PTEB teb = NULL;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (pthread_once(&_TebOnceControl, _TebInitOnce) == 0)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
if ((teb = pthread_getspecific(_TebKey)) == NULL)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
teb = calloc(1, sizeof(TEB));
|
|
Packit |
1fb8d4 |
if (teb)
|
|
Packit |
1fb8d4 |
pthread_setspecific(_TebKey, teb);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
return teb;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* RtlInitAnsiString routine:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff561918/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
VOID _RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit Service |
5a9772 |
DestinationString->Buffer = (PCHAR)SourceString;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!SourceString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
DestinationString->Length = 0;
|
|
Packit |
1fb8d4 |
DestinationString->MaximumLength = 0;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
else
|
|
Packit |
1fb8d4 |
{
|
|
Packit Service |
5a9772 |
USHORT length = (USHORT)strlen(SourceString);
|
|
Packit |
1fb8d4 |
DestinationString->Length = length;
|
|
Packit |
1fb8d4 |
DestinationString->MaximumLength = length + 1;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* RtlInitUnicodeString routine:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff561934/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
VOID _RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit Service |
5a9772 |
DestinationString->Buffer = (PWSTR)SourceString;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!SourceString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
DestinationString->Length = 0;
|
|
Packit |
1fb8d4 |
DestinationString->MaximumLength = 0;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
else
|
|
Packit |
1fb8d4 |
{
|
|
Packit Service |
5a9772 |
USHORT length = (USHORT)_wcslen(SourceString);
|
|
Packit |
1fb8d4 |
DestinationString->Length = length * 2;
|
|
Packit |
1fb8d4 |
DestinationString->MaximumLength = (length + 1) * 2;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* RtlAnsiStringToUnicodeString function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/ms648413/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString,
|
|
Packit Service |
5a9772 |
PCANSI_STRING SourceString,
|
|
Packit Service |
5a9772 |
BOOLEAN AllocateDestinationString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
int index;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!SourceString)
|
|
Packit |
1fb8d4 |
return STATUS_INVALID_PARAMETER;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (AllocateDestinationString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
PWSTR wbuf = NULL;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (SourceString->MaximumLength)
|
|
Packit |
1fb8d4 |
{
|
|
Packit Service |
5a9772 |
if (!(wbuf = (PWSTR)calloc(SourceString->MaximumLength, 2)))
|
|
Packit |
1fb8d4 |
return STATUS_NO_MEMORY;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
DestinationString->MaximumLength = SourceString->MaximumLength * 2;
|
|
Packit |
1fb8d4 |
DestinationString->Buffer = wbuf;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
else
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
if (DestinationString->MaximumLength < SourceString->MaximumLength * 2)
|
|
Packit |
1fb8d4 |
return STATUS_BUFFER_OVERFLOW;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
for (index = 0; index < SourceString->MaximumLength; index++)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
Data_Write_UINT16(&DestinationString->Buffer[index], SourceString->Buffer[index]);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
DestinationString->Length = SourceString->Length * 2;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* RtlFreeUnicodeString function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/ms648418/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
VOID _RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
if (UnicodeString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
free(UnicodeString->Buffer);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
UnicodeString->Length = 0;
|
|
Packit |
1fb8d4 |
UnicodeString->MaximumLength = 0;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* RtlNtStatusToDosError function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/windows/desktop/ms680600/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
ULONG _RtlNtStatusToDosError(NTSTATUS status)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return status;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtCreateFile function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/bb432380/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtCreateFile(PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
|
|
Packit Service |
5a9772 |
POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER AllocationSize, ULONG FileAttributes, ULONG ShareAccess,
|
|
Packit Service |
5a9772 |
ULONG CreateDisposition, ULONG CreateOptions, PVOID EaBuffer, ULONG EaLength)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if 1
|
|
Packit |
1fb8d4 |
WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__);
|
|
Packit |
1fb8d4 |
return STATUS_NOT_SUPPORTED;
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
WINPR_NT_FILE* pFileHandle;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
pFileHandle = (WINPR_NT_FILE*)calloc(1, sizeof(WINPR_NT_FILE));
|
|
Packit |
1fb8d4 |
if (!pFileHandle)
|
|
Packit |
1fb8d4 |
return STATUS_NO_MEMORY;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
pFileHandle->DesiredAccess = DesiredAccess;
|
|
Packit |
1fb8d4 |
pFileHandle->FileAttributes = FileAttributes;
|
|
Packit |
1fb8d4 |
pFileHandle->ShareAccess = ShareAccess;
|
|
Packit |
1fb8d4 |
pFileHandle->CreateDisposition = CreateDisposition;
|
|
Packit |
1fb8d4 |
pFileHandle->CreateOptions = CreateOptions;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
*((PULONG_PTR)FileHandle) = (ULONG_PTR)pFileHandle;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
// STATUS_ACCESS_DENIED
|
|
Packit Service |
5a9772 |
// STATUS_OBJECT_NAME_INVALID
|
|
Packit Service |
5a9772 |
// STATUS_OBJECT_PATH_NOT_FOUND
|
|
Packit Service |
5a9772 |
// STATUS_OBJECT_NAME_NOT_FOUND
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtOpenFile function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/bb432381/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtOpenFile(PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
|
|
Packit Service |
5a9772 |
POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
ULONG ShareAccess, ULONG OpenOptions)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if 1
|
|
Packit |
1fb8d4 |
WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__);
|
|
Packit |
1fb8d4 |
return STATUS_NOT_SUPPORTED;
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
WINPR_NT_FILE* pFileHandle;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
pFileHandle = (WINPR_NT_FILE*)calloc(1, sizeof(WINPR_NT_FILE));
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pFileHandle)
|
|
Packit |
1fb8d4 |
return STATUS_NO_MEMORY;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
pFileHandle->DesiredAccess = DesiredAccess;
|
|
Packit |
1fb8d4 |
pFileHandle->ShareAccess = ShareAccess;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
*((PULONG_PTR)FileHandle) = (ULONG_PTR)pFileHandle;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtReadFile function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff567072/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER ByteOffset, PULONG Key)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if 1
|
|
Packit |
1fb8d4 |
WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__);
|
|
Packit |
1fb8d4 |
return STATUS_NOT_SUPPORTED;
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtWriteFile function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff567121/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtWriteFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER ByteOffset, PULONG Key)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if 1
|
|
Packit |
1fb8d4 |
WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__);
|
|
Packit |
1fb8d4 |
return STATUS_NOT_SUPPORTED;
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtDeviceIoControlFile function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/ms648411/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
NTSTATUS _NtDeviceIoControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine,
|
|
Packit Service |
5a9772 |
PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
ULONG IoControlCode, PVOID InputBuffer, ULONG InputBufferLength,
|
|
Packit Service |
5a9772 |
PVOID OutputBuffer, ULONG OutputBufferLength)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if 1
|
|
Packit |
1fb8d4 |
WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__);
|
|
Packit |
1fb8d4 |
return STATUS_NOT_SUPPORTED;
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtClose function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/ms648410/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtClose(HANDLE Handle)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if 1
|
|
Packit |
1fb8d4 |
WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__);
|
|
Packit |
1fb8d4 |
return STATUS_NOT_SUPPORTED;
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
WINPR_NT_FILE* pFileHandle;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!Handle)
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
pFileHandle = (WINPR_NT_FILE*)Handle;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
free(pFileHandle);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* NtWaitForSingleObject function:
|
|
Packit |
1fb8d4 |
* http://msdn.microsoft.com/en-us/library/ms648412/
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtWaitForSingleObject(HANDLE Handle, BOOLEAN Alertable, PLARGE_INTEGER Timeout)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
#if 1
|
|
Packit |
1fb8d4 |
WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__);
|
|
Packit |
1fb8d4 |
return STATUS_NOT_SUPPORTED;
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
return STATUS_SUCCESS;
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#else
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <winpr/synch.h>
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef VOID(WINAPI* RTL_INIT_ANSI_STRING_FN)(PANSI_STRING DestinationString, PCSZ SourceString);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef VOID(WINAPI* RTL_INIT_UNICODE_STRING_FN)(PUNICODE_STRING DestinationString,
|
|
Packit Service |
5a9772 |
PCWSTR SourceString);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* RTL_ANSI_STRING_TO_UNICODE_STRING_FN)(PUNICODE_STRING DestinationString,
|
|
Packit Service |
5a9772 |
PCANSI_STRING SourceString,
|
|
Packit Service |
5a9772 |
BOOLEAN AllocateDestinationString);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef VOID(WINAPI* RTL_FREE_UNICODE_STRING_FN)(PUNICODE_STRING UnicodeString);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef ULONG(WINAPI* RTL_NT_STATUS_TO_DOS_ERROR_FN)(NTSTATUS status);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* NT_CREATE_FILE_FN)(PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
|
|
Packit Service |
5a9772 |
POBJECT_ATTRIBUTES ObjectAttributes,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER AllocationSize, ULONG FileAttributes,
|
|
Packit Service |
5a9772 |
ULONG ShareAccess, ULONG CreateDisposition,
|
|
Packit Service |
5a9772 |
ULONG CreateOptions, PVOID EaBuffer, ULONG EaLength);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* NT_OPEN_FILE_FN)(PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
|
|
Packit Service |
5a9772 |
POBJECT_ATTRIBUTES ObjectAttributes,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock, ULONG ShareAccess,
|
|
Packit Service |
5a9772 |
ULONG OpenOptions);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* NT_READ_FILE_FN)(HANDLE FileHandle, HANDLE Event,
|
|
Packit Service |
5a9772 |
PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer,
|
|
Packit Service |
5a9772 |
ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* NT_WRITE_FILE_FN)(HANDLE FileHandle, HANDLE Event,
|
|
Packit Service |
5a9772 |
PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer,
|
|
Packit Service |
5a9772 |
ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* NT_DEVICE_IO_CONTROL_FILE_FN)(HANDLE FileHandle, HANDLE Event,
|
|
Packit Service |
5a9772 |
PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
ULONG IoControlCode, PVOID InputBuffer,
|
|
Packit Service |
5a9772 |
ULONG InputBufferLength, PVOID OutputBuffer,
|
|
Packit Service |
5a9772 |
ULONG OutputBufferLength);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* NT_CLOSE_FN)(HANDLE Handle);
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef NTSTATUS(WINAPI* NT_WAIT_FOR_SINGLE_OBJECT_FN)(HANDLE Handle, BOOLEAN Alertable,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER Timeout);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
static RTL_INIT_ANSI_STRING_FN pRtlInitAnsiString = NULL;
|
|
Packit |
1fb8d4 |
static RTL_INIT_UNICODE_STRING_FN pRtlInitUnicodeString = NULL;
|
|
Packit |
1fb8d4 |
static RTL_ANSI_STRING_TO_UNICODE_STRING_FN pRtlAnsiStringToUnicodeString = NULL;
|
|
Packit |
1fb8d4 |
static RTL_FREE_UNICODE_STRING_FN pRtlFreeUnicodeString = NULL;
|
|
Packit |
1fb8d4 |
static RTL_NT_STATUS_TO_DOS_ERROR_FN pRtlNtStatusToDosError = NULL;
|
|
Packit |
1fb8d4 |
static NT_CREATE_FILE_FN pNtCreateFile = NULL;
|
|
Packit |
1fb8d4 |
static NT_OPEN_FILE_FN pNtOpenFile = NULL;
|
|
Packit |
1fb8d4 |
static NT_READ_FILE_FN pNtReadFile = NULL;
|
|
Packit |
1fb8d4 |
static NT_WRITE_FILE_FN pNtWriteFile = NULL;
|
|
Packit |
1fb8d4 |
static NT_DEVICE_IO_CONTROL_FILE_FN pNtDeviceIoControlFile = NULL;
|
|
Packit |
1fb8d4 |
static NT_CLOSE_FN pNtClose = NULL;
|
|
Packit |
1fb8d4 |
static NT_WAIT_FOR_SINGLE_OBJECT_FN pNtWaitForSingleObject = NULL;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
static INIT_ONCE ntdllInitOnce = INIT_ONCE_STATIC_INIT;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
static BOOL CALLBACK NtdllModuleInit(PINIT_ONCE once, PVOID param, PVOID* context)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
HMODULE NtdllModule = LoadLibraryA("ntdll.dll");
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (NtdllModule)
|
|
Packit |
1fb8d4 |
{
|
|
Packit Service |
5a9772 |
pRtlInitAnsiString =
|
|
Packit Service |
5a9772 |
(RTL_INIT_ANSI_STRING_FN)GetProcAddress(NtdllModule, "RtlInitAnsiString");
|
|
Packit Service |
5a9772 |
pRtlInitUnicodeString =
|
|
Packit Service |
5a9772 |
(RTL_INIT_UNICODE_STRING_FN)GetProcAddress(NtdllModule, "RtlInitUnicodeString");
|
|
Packit Service |
5a9772 |
pRtlAnsiStringToUnicodeString = (RTL_ANSI_STRING_TO_UNICODE_STRING_FN)GetProcAddress(
|
|
Packit Service |
5a9772 |
NtdllModule, "RtlAnsiStringToUnicodeString");
|
|
Packit Service |
5a9772 |
pRtlFreeUnicodeString =
|
|
Packit Service |
5a9772 |
(RTL_FREE_UNICODE_STRING_FN)GetProcAddress(NtdllModule, "RtlFreeUnicodeString");
|
|
Packit Service |
5a9772 |
pRtlNtStatusToDosError =
|
|
Packit Service |
5a9772 |
(RTL_NT_STATUS_TO_DOS_ERROR_FN)GetProcAddress(NtdllModule, "RtlNtStatusToDosError");
|
|
Packit |
1fb8d4 |
pNtCreateFile = (NT_CREATE_FILE_FN)GetProcAddress(NtdllModule, "NtCreateFile");
|
|
Packit |
1fb8d4 |
pNtOpenFile = (NT_OPEN_FILE_FN)GetProcAddress(NtdllModule, "NtOpenFile");
|
|
Packit |
1fb8d4 |
pNtReadFile = (NT_READ_FILE_FN)GetProcAddress(NtdllModule, "NtReadFile");
|
|
Packit |
1fb8d4 |
pNtWriteFile = (NT_WRITE_FILE_FN)GetProcAddress(NtdllModule, "NtWriteFile");
|
|
Packit Service |
5a9772 |
pNtDeviceIoControlFile =
|
|
Packit Service |
5a9772 |
(NT_DEVICE_IO_CONTROL_FILE_FN)GetProcAddress(NtdllModule, "NtDeviceIoControlFile");
|
|
Packit |
1fb8d4 |
pNtClose = (NT_CLOSE_FN)GetProcAddress(NtdllModule, "NtClose");
|
|
Packit Service |
5a9772 |
pNtWaitForSingleObject =
|
|
Packit Service |
5a9772 |
(NT_WAIT_FOR_SINGLE_OBJECT_FN)GetProcAddress(NtdllModule, "NtWaitForSingleObject");
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
return TRUE;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
VOID _RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pRtlInitAnsiString)
|
|
Packit |
1fb8d4 |
return;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
pRtlInitAnsiString(DestinationString, SourceString);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
VOID _RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pRtlInitUnicodeString)
|
|
Packit |
1fb8d4 |
return;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
pRtlInitUnicodeString(DestinationString, SourceString);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString,
|
|
Packit Service |
5a9772 |
PCANSI_STRING SourceString,
|
|
Packit Service |
5a9772 |
BOOLEAN AllocateDestinationString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pRtlAnsiStringToUnicodeString)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
return pRtlAnsiStringToUnicodeString(DestinationString, SourceString,
|
|
Packit Service |
5a9772 |
AllocateDestinationString);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
VOID _RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pRtlFreeUnicodeString)
|
|
Packit |
1fb8d4 |
return;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
pRtlFreeUnicodeString(UnicodeString);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
ULONG _RtlNtStatusToDosError(NTSTATUS status)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pRtlNtStatusToDosError)
|
|
Packit |
1fb8d4 |
return status;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return pRtlNtStatusToDosError(status);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtCreateFile(PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
|
|
Packit Service |
5a9772 |
POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER AllocationSize, ULONG FileAttributes, ULONG ShareAccess,
|
|
Packit Service |
5a9772 |
ULONG CreateDisposition, ULONG CreateOptions, PVOID EaBuffer, ULONG EaLength)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pNtCreateFile)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
return pNtCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, AllocationSize,
|
|
Packit Service |
5a9772 |
FileAttributes, ShareAccess, CreateDisposition, CreateOptions, EaBuffer,
|
|
Packit Service |
5a9772 |
EaLength);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtOpenFile(PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
|
|
Packit Service |
5a9772 |
POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
ULONG ShareAccess, ULONG OpenOptions)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pNtOpenFile)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
return pNtOpenFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, ShareAccess,
|
|
Packit Service |
5a9772 |
OpenOptions);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER ByteOffset, PULONG Key)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pNtReadFile)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
return pNtReadFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length,
|
|
Packit Service |
5a9772 |
ByteOffset, Key);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtWriteFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
|
Packit Service |
5a9772 |
PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length,
|
|
Packit Service |
5a9772 |
PLARGE_INTEGER ByteOffset, PULONG Key)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pNtWriteFile)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
return pNtWriteFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length,
|
|
Packit Service |
5a9772 |
ByteOffset, Key);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
NTSTATUS _NtDeviceIoControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine,
|
|
Packit Service |
5a9772 |
PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock,
|
|
Packit Service |
5a9772 |
ULONG IoControlCode, PVOID InputBuffer, ULONG InputBufferLength,
|
|
Packit Service |
5a9772 |
PVOID OutputBuffer, ULONG OutputBufferLength)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pNtDeviceIoControlFile)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
return pNtDeviceIoControlFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock,
|
|
Packit Service |
5a9772 |
IoControlCode, InputBuffer, InputBufferLength, OutputBuffer,
|
|
Packit Service |
5a9772 |
OutputBufferLength);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtClose(HANDLE Handle)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pNtClose)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return pNtClose(Handle);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
NTSTATUS _NtWaitForSingleObject(HANDLE Handle, BOOLEAN Alertable, PLARGE_INTEGER Timeout)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (!pNtWaitForSingleObject)
|
|
Packit |
1fb8d4 |
return STATUS_INTERNAL_ERROR;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return pNtWaitForSingleObject(Handle, Alertable, Timeout);
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#endif
|