Reorganization

This commit is contained in:
Aaron Robinson 2003-07-02 20:40:53 +00:00
parent 2a53541262
commit 0ba5b79d9f
6 changed files with 140 additions and 76 deletions

View File

@ -194,6 +194,10 @@ SOURCE=.\Include\Win32\CxbxKrnl\EmuLDT.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\EmuNtDll.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\EmuShared.h
# End Source File
# Begin Source File
@ -262,10 +266,6 @@ SOURCE=.\Include\Win32\CxbxKrnl\XG.1.0.4627.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\xntdll.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\XOnline.1.0.4361.h
# End Source File
# End Group
@ -342,6 +342,10 @@ SOURCE=.\Source\Win32\CxbxKrnl\EmuLDT.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\CxbxKrnl\EmuNtDll.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\EmuShared.cpp
# End Source File
# Begin Source File

View File

@ -744,6 +744,34 @@ typedef NTSTATUS (NTAPI *FPTR_IoCreateFile)
IN ULONG Options
);
// ******************************************************************
// * Exported API
// ******************************************************************
extern FPTR_RtlInitAnsiString RtlInitAnsiString ;
extern FPTR_RtlInitUnicodeString RtlInitUnicodeString;
extern FPTR_RtlAnsiStringToUnicodeString RtlAnsiStringToUnicodeString;
extern FPTR_RtlUnicodeStringToAnsiString RtlUnicodeStringToAnsiString;
extern FPTR_RtlNtStatusToDosError RtlNtStatusToDosError;
extern FPTR_RtlInitializeCriticalSection RtlInitializeCriticalSection;
extern FPTR_RtlEnterCriticalSection RtlEnterCriticalSection;
extern FPTR_RtlLeaveCriticalSection RtlLeaveCriticalSection;
extern FPTR_RtlCreateHeap RtlCreateHeap;
extern FPTR_RtlAllocateHeap RtlAllocateHeap;
extern FPTR_RtlFreeHeap RtlFreeHeap;
extern FPTR_NtAllocateVirtualMemory NtAllocateVirtualMemory;
extern FPTR_NtClose NtClose;
extern FPTR_NtDelayExecution NtDelayExecution;
extern FPTR_NtDuplicateObject NtDuplicateObject;
extern FPTR_NtQueryInformationFile NtQueryInformationFile;
extern FPTR_NtQueryFullAttributesFile NtQueryFullAttributesFile;
extern FPTR_NtQueryVolumeInformationFile NtQueryVolumeInformationFile;
extern FPTR_NtCreateEvent NtCreateEvent;
extern FPTR_NtCreateFile NtCreateFile;
extern FPTR_NtReadFile NtReadFile;
extern FPTR_NtWriteFile NtWriteFile;
extern FPTR_NtSetInformationFile NtSetInformationFile;
extern FPTR_NtSetLdtEntries NtSetLdtEntries;
#if defined(__cplusplus)
}
#endif

View File

@ -65,33 +65,6 @@ namespace XTL
#include "EmuXTL.h"
};
// ******************************************************************
// * Loaded at run-time to avoid linker conflicts
// ******************************************************************
static HMODULE hNtDll = GetModuleHandle("ntdll");
NtDll::FPTR_RtlInitAnsiString NT_RtlInitAnsiString = (NtDll::FPTR_RtlInitAnsiString)GetProcAddress(hNtDll, "RtlInitAnsiString");
NtDll::FPTR_RtlInitUnicodeString NT_RtlInitUnicodeString = (NtDll::FPTR_RtlInitUnicodeString)GetProcAddress(hNtDll, "RtlInitUnicodeString");
NtDll::FPTR_RtlAnsiStringToUnicodeString NT_RtlAnsiStringToUnicodeString = (NtDll::FPTR_RtlAnsiStringToUnicodeString)GetProcAddress(hNtDll, "RtlAnsiStringToUnicodeString");
NtDll::FPTR_RtlUnicodeStringToAnsiString NT_RtlUnicodeStringToAnsiString = (NtDll::FPTR_RtlUnicodeStringToAnsiString)GetProcAddress(hNtDll, "RtlUnicodeStringToAnsiString");
NtDll::FPTR_RtlNtStatusToDosError NT_RtlNtStatusToDosError = (NtDll::FPTR_RtlNtStatusToDosError)GetProcAddress(hNtDll, "RtlNtStatusToDosError");
NtDll::FPTR_RtlInitializeCriticalSection NT_RtlInitializeCriticalSection = (NtDll::FPTR_RtlInitializeCriticalSection)GetProcAddress(hNtDll, "RtlInitializeCriticalSection");
NtDll::FPTR_RtlEnterCriticalSection NT_RtlEnterCriticalSection = (NtDll::FPTR_RtlEnterCriticalSection)GetProcAddress(hNtDll, "RtlEnterCriticalSection");
NtDll::FPTR_RtlLeaveCriticalSection NT_RtlLeaveCriticalSection = (NtDll::FPTR_RtlLeaveCriticalSection)GetProcAddress(hNtDll, "RtlLeaveCriticalSection");
NtDll::FPTR_NtAllocateVirtualMemory NT_NtAllocateVirtualMemory = (NtDll::FPTR_NtAllocateVirtualMemory)GetProcAddress(hNtDll, "NtAllocateVirtualMemory");
NtDll::FPTR_NtClose NT_NtClose = (NtDll::FPTR_NtClose)GetProcAddress(hNtDll, "NtClose");
NtDll::FPTR_NtDelayExecution NT_NtDelayExecution = (NtDll::FPTR_NtDelayExecution)GetProcAddress(hNtDll, "NtDelayExecution");
NtDll::FPTR_NtDuplicateObject NT_NtDuplicateObject = (NtDll::FPTR_NtDuplicateObject)GetProcAddress(hNtDll, "NtDuplicateObject");
NtDll::FPTR_NtQueryInformationFile NT_NtQueryInformationFile = (NtDll::FPTR_NtQueryInformationFile)GetProcAddress(hNtDll, "NtQueryInformationFile");
NtDll::FPTR_NtQueryFullAttributesFile NT_NtQueryFullAttributesFile = (NtDll::FPTR_NtQueryFullAttributesFile)GetProcAddress(hNtDll, "NtQueryFullAttributesFile");
NtDll::FPTR_NtQueryVolumeInformationFile NT_NtQueryVolumeInformationFile = (NtDll::FPTR_NtQueryVolumeInformationFile)GetProcAddress(hNtDll, "NtQueryVolumeInformationFile");
NtDll::FPTR_NtCreateEvent NT_NtCreateEvent = (NtDll::FPTR_NtCreateEvent)GetProcAddress(hNtDll, "NtCreateEvent");
NtDll::FPTR_NtCreateFile NT_NtCreateFile = (NtDll::FPTR_NtCreateFile)GetProcAddress(hNtDll, "NtCreateFile");
NtDll::FPTR_NtReadFile NT_NtReadFile = (NtDll::FPTR_NtReadFile)GetProcAddress(hNtDll, "NtReadFile");
NtDll::FPTR_NtWriteFile NT_NtWriteFile = (NtDll::FPTR_NtWriteFile)GetProcAddress(hNtDll, "NtWriteFile");
NtDll::FPTR_NtSetInformationFile NT_NtSetInformationFile = (NtDll::FPTR_NtSetInformationFile)GetProcAddress(hNtDll, "NtSetInformationFile");
// ******************************************************************
// * (Helper) PCSTProxyParam
// ******************************************************************
@ -461,7 +434,7 @@ XBSYSAPI EXPORTNUM(99) NTSTATUS NTAPI xboxkrnl::KeDelayExecutionThread
}
#endif
NTSTATUS ret = NT_NtDelayExecution(Alertable, (NtDll::LARGE_INTEGER*)Interval);
NTSTATUS ret = NtDll::NtDelayExecution(Alertable, (NtDll::LARGE_INTEGER*)Interval);
EmuSwapFS(); // Xbox FS
@ -791,7 +764,7 @@ XBSYSAPI EXPORTNUM(184) NTSTATUS NTAPI xboxkrnl::NtAllocateVirtualMemory
}
#endif
NTSTATUS ret = NT_NtAllocateVirtualMemory(GetCurrentProcess(), BaseAddress, ZeroBits, AllocationSize, AllocationType, Protect);
NTSTATUS ret = NtDll::NtAllocateVirtualMemory(GetCurrentProcess(), BaseAddress, ZeroBits, AllocationSize, AllocationType, Protect);
EmuSwapFS(); // Xbox FS
@ -839,7 +812,7 @@ XBSYSAPI EXPORTNUM(187) NTSTATUS NTAPI xboxkrnl::NtClose
// ******************************************************************
else
{
ret = NT_NtClose(Handle);
ret = NtDll::NtClose(Handle);
}
EmuSwapFS(); // Xbox FS
@ -890,7 +863,7 @@ XBSYSAPI EXPORTNUM(189) NTSTATUS NTAPI xboxkrnl::NtCreateEvent
{
mbstowcs(wszObjectName, szBuffer, 160);
NT_RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
NtDll::RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes->Attributes, ObjectAttributes->RootDirectory, NULL);
}
@ -898,7 +871,7 @@ XBSYSAPI EXPORTNUM(189) NTSTATUS NTAPI xboxkrnl::NtCreateEvent
// ******************************************************************
// * Redirect to NtCreateEvent
// ******************************************************************
NTSTATUS ret = NT_NtCreateEvent(EventHandle, EVENT_ALL_ACCESS, &NtObjAttr, (NtDll::EVENT_TYPE)EventType, InitialState);
NTSTATUS ret = NtDll::NtCreateEvent(EventHandle, EVENT_ALL_ACCESS, &NtObjAttr, (NtDll::EVENT_TYPE)EventType, InitialState);
EmuSwapFS(); // Xbox FS
@ -996,7 +969,7 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile
{
mbstowcs(wszObjectName, szBuffer, 160);
NT_RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
NtDll::RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes->Attributes, ObjectAttributes->RootDirectory, NULL);
}
@ -1004,7 +977,7 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile
// ******************************************************************
// * Redirect to NtCreateFile
// ******************************************************************
NTSTATUS ret = NT_NtCreateFile
NTSTATUS ret = NtDll::NtCreateFile
(
FileHandle, DesiredAccess, &NtObjAttr, (NtDll::IO_STATUS_BLOCK*)IoStatusBlock,
(NtDll::LARGE_INTEGER*)AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, NULL, NULL
@ -1048,7 +1021,7 @@ XBSYSAPI EXPORTNUM(197) NTSTATUS NTAPI xboxkrnl::NtDuplicateObject
// ******************************************************************
// * redirect to Win2k/XP
// ******************************************************************
NTSTATUS ret = NT_NtDuplicateObject
NTSTATUS ret = NtDll::NtDuplicateObject
(
GetCurrentProcess(),
SourceHandle,
@ -1140,12 +1113,12 @@ XBSYSAPI EXPORTNUM(210) NTSTATUS NTAPI xboxkrnl::NtQueryFullAttributesFile
{
mbstowcs(wszObjectName, szBuffer, 160);
NT_RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
NtDll::RtlInitUnicodeString(&NtUnicodeString, wszObjectName);
InitializeObjectAttributes(&NtObjAttr, &NtUnicodeString, ObjectAttributes->Attributes, ObjectAttributes->RootDirectory, NULL);
}
NTSTATUS ret = NT_NtQueryFullAttributesFile(&NtObjAttr, Attributes);
NTSTATUS ret = NtDll::NtQueryFullAttributesFile(&NtObjAttr, Attributes);
EmuSwapFS(); // Xbox FS
@ -1184,7 +1157,7 @@ XBSYSAPI EXPORTNUM(211) NTSTATUS NTAPI xboxkrnl::NtQueryInformationFile
}
#endif
NTSTATUS ret = NT_NtQueryInformationFile
NTSTATUS ret = NtDll::NtQueryInformationFile
(
FileHandle,
(NtDll::PIO_STATUS_BLOCK)IoStatusBlock,
@ -1234,7 +1207,7 @@ XBSYSAPI EXPORTNUM(218) NTSTATUS NTAPI xboxkrnl::NtQueryVolumeInformationFile
if(FileInformationClass != FileFsSizeInformation && FileInformationClass != FileDirectoryInformation)
EmuCleanup("NtQueryVolumeInformationFile: Unsupported FileInformationClass");
NTSTATUS ret = NT_NtQueryVolumeInformationFile
NTSTATUS ret = NtDll::NtQueryVolumeInformationFile
(
FileHandle,
(NtDll::PIO_STATUS_BLOCK)IoStatusBlock,
@ -1294,7 +1267,7 @@ XBSYSAPI EXPORTNUM(219) NTSTATUS NTAPI xboxkrnl::NtReadFile
}
#endif
NTSTATUS ret = NT_NtReadFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, (NtDll::LARGE_INTEGER*)ByteOffset, 0);
NTSTATUS ret = NtDll::NtReadFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, (NtDll::LARGE_INTEGER*)ByteOffset, 0);
EmuSwapFS(); // Xbox FS
@ -1333,7 +1306,7 @@ XBSYSAPI EXPORTNUM(226) NTSTATUS NTAPI xboxkrnl::NtSetInformationFile
}
#endif
NTSTATUS ret = NT_NtSetInformationFile(FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass);
NTSTATUS ret = NtDll::NtSetInformationFile(FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass);
EmuSwapFS(); // Xbox FS
@ -1378,7 +1351,7 @@ XBSYSAPI EXPORTNUM(236) NTSTATUS NTAPI xboxkrnl::NtWriteFile
}
#endif
NTSTATUS ret = NT_NtWriteFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, (NtDll::LARGE_INTEGER*)ByteOffset, 0);
NTSTATUS ret = NtDll::NtWriteFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, (NtDll::LARGE_INTEGER*)ByteOffset, 0);
EmuSwapFS(); // Xbox FS
@ -1504,7 +1477,7 @@ XBSYSAPI EXPORTNUM(260) NTSTATUS NTAPI xboxkrnl::RtlAnsiStringToUnicodeString
}
#endif
NTSTATUS ret = NT_RtlAnsiStringToUnicodeString((NtDll::UNICODE_STRING*)DestinationString, (NtDll::STRING*)SourceString, AllocateDestinationString);
NTSTATUS ret = NtDll::RtlAnsiStringToUnicodeString((NtDll::UNICODE_STRING*)DestinationString, (NtDll::STRING*)SourceString, AllocateDestinationString);
EmuSwapFS(); // Xbox FS
@ -1536,9 +1509,9 @@ XBSYSAPI EXPORTNUM(277) VOID NTAPI xboxkrnl::RtlEnterCriticalSection
// This seems redundant, but xbox software doesn't always do it
if(CriticalSection->LockCount == -1)
NT_RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
NT_RtlEnterCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
NtDll::RtlEnterCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
EmuSwapFS(); // Xbox FS
@ -1570,7 +1543,7 @@ XBSYSAPI EXPORTNUM(289) VOID NTAPI xboxkrnl::RtlInitAnsiString
}
#endif
NT_RtlInitAnsiString((NtDll::PANSI_STRING)DestinationString, (NtDll::PCSZ)SourceString);
NtDll::RtlInitAnsiString((NtDll::PANSI_STRING)DestinationString, (NtDll::PCSZ)SourceString);
EmuSwapFS(); // Xbox FS
@ -1600,7 +1573,7 @@ XBSYSAPI EXPORTNUM(291) VOID NTAPI xboxkrnl::RtlInitializeCriticalSection
}
#endif
NT_RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
EmuSwapFS(); // Xbox FS
@ -1618,7 +1591,7 @@ XBSYSAPI EXPORTNUM(294) VOID NTAPI xboxkrnl::RtlLeaveCriticalSection
EmuSwapFS(); // Win2k/XP FS
// Note: We need to execute this before debug output to avoid trouble
NT_RtlLeaveCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
NtDll::RtlLeaveCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
// ******************************************************************
// * debug trace
@ -1661,7 +1634,7 @@ XBSYSAPI EXPORTNUM(301) xboxkrnl::ULONG NTAPI xboxkrnl::RtlNtStatusToDosError
}
#endif
ULONG ret = NT_RtlNtStatusToDosError(Status);
ULONG ret = NtDll::RtlNtStatusToDosError(Status);
EmuSwapFS(); // Xbox FS
@ -1695,7 +1668,7 @@ XBSYSAPI EXPORTNUM(308) xboxkrnl::NTSTATUS NTAPI xboxkrnl::RtlUnicodeStringToAns
}
#endif
NTSTATUS ret = NT_RtlUnicodeStringToAnsiString((NtDll::STRING*)DestinationString, (NtDll::UNICODE_STRING*)SourceString, AllocateDestinationString);
NTSTATUS ret = NtDll::RtlUnicodeStringToAnsiString((NtDll::STRING*)DestinationString, (NtDll::UNICODE_STRING*)SourceString, AllocateDestinationString);
EmuSwapFS(); // Xbox FS

View File

@ -65,13 +65,6 @@ static uint16 FreeLDTEntries[MAXIMUM_XBOX_THREADS];
// ******************************************************************
static CRITICAL_SECTION EmuLDTLock;
// ******************************************************************
// * Loaded at run-time to avoid linker conflicts
// ******************************************************************
static HMODULE hNtDll = GetModuleHandle("ntdll");
static NtDll::FPTR_NtSetLdtEntries NT_NtSetLdtEntries = (NtDll::FPTR_NtSetLdtEntries)GetProcAddress(hNtDll, "NtSetLdtEntries");
// ******************************************************************
// * func: EmuInitLDT
// ******************************************************************
@ -140,7 +133,7 @@ uint16 EmuAllocateLDT(uint32 dwBaseAddr, uint32 dwLimit)
{
using namespace NtDll;
if(!NT_SUCCESS(NT_NtSetLdtEntries((x*8)+7+8, LDTEntry, 0, LDTEntry)))
if(!NT_SUCCESS(NtDll::NtSetLdtEntries((x*8)+7+8, LDTEntry, 0, LDTEntry)))
{
LeaveCriticalSection(&EmuLDTLock);
@ -168,11 +161,11 @@ void EmuDeallocateLDT(uint16 wSelector)
ZeroMemory(&LDTEntry, sizeof(LDTEntry));
NT_NtSetLdtEntries(wSelector, LDTEntry, 0, LDTEntry);
NtDll::NtSetLdtEntries(wSelector, LDTEntry, 0, LDTEntry);
FreeLDTEntries[(wSelector >> 3)-1] = wSelector;
LeaveCriticalSection(&EmuLDTLock);
return;
}
}

View File

@ -0,0 +1,75 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->EmuNtDll.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#define _CXBXKRNL_INTERNAL
#define _XBOXKRNL_LOCAL_
#include <windows.h>
// ******************************************************************
// * prevent name collisions
// ******************************************************************
namespace NtDll
{
#include "EmuNtDll.h"
};
// ******************************************************************
// * Loaded at run-time to avoid linker conflicts
// ******************************************************************
static HMODULE hNtDll = GetModuleHandle("ntdll");
NtDll::FPTR_RtlInitAnsiString NtDll::RtlInitAnsiString = (NtDll::FPTR_RtlInitAnsiString)GetProcAddress(hNtDll, "RtlInitAnsiString");
NtDll::FPTR_RtlInitUnicodeString NtDll::RtlInitUnicodeString = (NtDll::FPTR_RtlInitUnicodeString)GetProcAddress(hNtDll, "RtlInitUnicodeString");
NtDll::FPTR_RtlAnsiStringToUnicodeString NtDll::RtlAnsiStringToUnicodeString = (NtDll::FPTR_RtlAnsiStringToUnicodeString)GetProcAddress(hNtDll, "RtlAnsiStringToUnicodeString");
NtDll::FPTR_RtlUnicodeStringToAnsiString NtDll::RtlUnicodeStringToAnsiString = (NtDll::FPTR_RtlUnicodeStringToAnsiString)GetProcAddress(hNtDll, "RtlUnicodeStringToAnsiString");
NtDll::FPTR_RtlNtStatusToDosError NtDll::RtlNtStatusToDosError = (NtDll::FPTR_RtlNtStatusToDosError)GetProcAddress(hNtDll, "RtlNtStatusToDosError");
NtDll::FPTR_RtlInitializeCriticalSection NtDll::RtlInitializeCriticalSection = (NtDll::FPTR_RtlInitializeCriticalSection)GetProcAddress(hNtDll, "RtlInitializeCriticalSection");
NtDll::FPTR_RtlEnterCriticalSection NtDll::RtlEnterCriticalSection = (NtDll::FPTR_RtlEnterCriticalSection)GetProcAddress(hNtDll, "RtlEnterCriticalSection");
NtDll::FPTR_RtlLeaveCriticalSection NtDll::RtlLeaveCriticalSection = (NtDll::FPTR_RtlLeaveCriticalSection)GetProcAddress(hNtDll, "RtlLeaveCriticalSection");
NtDll::FPTR_RtlCreateHeap NtDll::RtlCreateHeap = (NtDll::FPTR_RtlCreateHeap)GetProcAddress(hNtDll, "RtlCreateHeap");
NtDll::FPTR_RtlAllocateHeap NtDll::RtlAllocateHeap = (NtDll::FPTR_RtlAllocateHeap)GetProcAddress(hNtDll, "RtlAllocateHeap");
NtDll::FPTR_RtlFreeHeap NtDll::RtlFreeHeap = (NtDll::FPTR_RtlFreeHeap)GetProcAddress(hNtDll, "RtlFreeHeap");
NtDll::FPTR_NtAllocateVirtualMemory NtDll::NtAllocateVirtualMemory = (NtDll::FPTR_NtAllocateVirtualMemory)GetProcAddress(hNtDll, "NtAllocateVirtualMemory");
NtDll::FPTR_NtClose NtDll::NtClose = (NtDll::FPTR_NtClose)GetProcAddress(hNtDll, "NtClose");
NtDll::FPTR_NtDelayExecution NtDll::NtDelayExecution = (NtDll::FPTR_NtDelayExecution)GetProcAddress(hNtDll, "NtDelayExecution");
NtDll::FPTR_NtDuplicateObject NtDll::NtDuplicateObject = (NtDll::FPTR_NtDuplicateObject)GetProcAddress(hNtDll, "NtDuplicateObject");
NtDll::FPTR_NtQueryInformationFile NtDll::NtQueryInformationFile = (NtDll::FPTR_NtQueryInformationFile)GetProcAddress(hNtDll, "NtQueryInformationFile");
NtDll::FPTR_NtQueryFullAttributesFile NtDll::NtQueryFullAttributesFile = (NtDll::FPTR_NtQueryFullAttributesFile)GetProcAddress(hNtDll, "NtQueryFullAttributesFile");
NtDll::FPTR_NtQueryVolumeInformationFile NtDll::NtQueryVolumeInformationFile = (NtDll::FPTR_NtQueryVolumeInformationFile)GetProcAddress(hNtDll, "NtQueryVolumeInformationFile");
NtDll::FPTR_NtCreateEvent NtDll::NtCreateEvent = (NtDll::FPTR_NtCreateEvent)GetProcAddress(hNtDll, "NtCreateEvent");
NtDll::FPTR_NtCreateFile NtDll::NtCreateFile = (NtDll::FPTR_NtCreateFile)GetProcAddress(hNtDll, "NtCreateFile");
NtDll::FPTR_NtReadFile NtDll::NtReadFile = (NtDll::FPTR_NtReadFile)GetProcAddress(hNtDll, "NtReadFile");
NtDll::FPTR_NtWriteFile NtDll::NtWriteFile = (NtDll::FPTR_NtWriteFile)GetProcAddress(hNtDll, "NtWriteFile");
NtDll::FPTR_NtSetInformationFile NtDll::NtSetInformationFile = (NtDll::FPTR_NtSetInformationFile)GetProcAddress(hNtDll, "NtSetInformationFile");
NtDll::FPTR_NtSetLdtEntries NtDll::NtSetLdtEntries = (NtDll::FPTR_NtSetLdtEntries)GetProcAddress(hNtDll, "NtSetLdtEntries");

View File

@ -56,15 +56,6 @@ namespace XTL
#include "EmuXTL.h"
};
// ******************************************************************
// * Loaded at run-time to avoid linker conflicts
// ******************************************************************
static HMODULE hNtDll = GetModuleHandle("ntdll");
NtDll::FPTR_RtlCreateHeap NT_RtlCreateHeap = (NtDll::FPTR_RtlCreateHeap)GetProcAddress(hNtDll, "RtlCreateHeap");
NtDll::FPTR_RtlAllocateHeap NT_RtlAllocateHeap = (NtDll::FPTR_RtlAllocateHeap)GetProcAddress(hNtDll, "RtlAllocateHeap");
NtDll::FPTR_RtlFreeHeap NT_RtlFreeHeap = (NtDll::FPTR_RtlFreeHeap)GetProcAddress(hNtDll, "RtlFreeHeap");
// ******************************************************************
// * func: EmuRtlCreateHeap
// ******************************************************************
@ -104,7 +95,7 @@ PVOID WINAPI XTL::EmuRtlCreateHeap
RtlHeapDefinition.Length = sizeof(RtlHeapDefinition);
PVOID pRet = NT_RtlCreateHeap(Flags, Base, Reserve, Commit, Lock, &RtlHeapDefinition);
PVOID pRet = NtDll::RtlCreateHeap(Flags, Base, Reserve, Commit, Lock, &RtlHeapDefinition);
EmuSwapFS(); // XBox FS
@ -138,7 +129,7 @@ PVOID WINAPI XTL::EmuRtlAllocateHeap
}
#endif
PVOID pRet = NT_RtlAllocateHeap(hHeap, dwFlags, dwBytes);
PVOID pRet = NtDll::RtlAllocateHeap(hHeap, dwFlags, dwBytes);
EmuSwapFS(); // XBox FS
@ -172,7 +163,7 @@ BOOL WINAPI XTL::EmuRtlFreeHeap
}
#endif
BOOL bRet = NT_RtlFreeHeap(hHeap, dwFlags, lpMem);
BOOL bRet = NtDll::RtlFreeHeap(hHeap, dwFlags, lpMem);
EmuSwapFS(); // XBox FS