minor fixes

This commit is contained in:
RadWolfie 2021-03-28 18:13:59 -05:00
parent 6cfad6f212
commit 98805bd0c5
5 changed files with 29 additions and 23 deletions

View File

@ -74,6 +74,7 @@ inline constexpr dword_xt status_pending = 0x00000103L;
inline constexpr dword_xt status_timer_resume_ignored = 0x40000025L;
inline constexpr dword_xt status_buffer_overflow = 0x80000005L;
inline constexpr dword_xt status_unsuccessful = 0xC0000001;
inline constexpr dword_xt status_invalid_handle = 0xC0000008;
inline constexpr dword_xt status_unrecognized_media = 0xC0000014;
inline constexpr dword_xt status_no_memory = 0xC0000017L;
inline constexpr dword_xt status_buffer_too_small = 0xC0000023L;
@ -88,6 +89,7 @@ inline constexpr dword_xt status_insufficient_resources = 0xC000009AL;
inline constexpr dword_xt status_too_many_secrets = 0xC0000156L;
inline constexpr dword_xt status_xbe_region_mismatch = 0xC0050001L;
inline constexpr dword_xt status_xbe_media_mismatch = 0xC0050002L;
inline constexpr dword_xt status_object_name_invalid = 0xC0000033L;
inline constexpr dword_xt status_object_name_not_found = 0xC0000034L;
inline constexpr dword_xt status_object_name_collision = 0xC0000035L;
inline constexpr dword_xt status_invalid_page_protection = 0xC0000045L;

View File

@ -193,12 +193,12 @@ XBSYSAPI EXPORTNUM(64) xbox::OBJECT_TYPE xbox::IoCompletionObjectType =
// ******************************************************************
XBSYSAPI EXPORTNUM(65) xbox::ntstatus_xt NTAPI xbox::IoCreateDevice
(
IN PDRIVER_OBJECT DriverObject,
IN ulong_xt DeviceExtensionSize,
IN PSTRING DeviceName OPTIONAL,
IN ulong_xt DeviceType,
IN boolean_xt Exclusive,
OUT PDEVICE_OBJECT* DeviceObject
IN PDRIVER_OBJECT DriverObject,
IN ulong_xt DeviceExtensionSize,
IN PSTRING DeviceName OPTIONAL,
IN ulong_xt DeviceType,
IN boolean_xt Exclusive,
OUT PDEVICE_OBJECT* DeviceObject
)
{
LOG_FUNC_BEGIN
@ -210,6 +210,9 @@ XBSYSAPI EXPORTNUM(65) xbox::ntstatus_xt NTAPI xbox::IoCreateDevice
LOG_FUNC_ARG_OUT(DeviceObject)
LOG_FUNC_END;
// TODO: IoCreateDevice is critical to enable support for devices interface.
// Which include disk, dvd-rom, memory unit cards, etc.
// Find a way to coexist with host interface from here.
LOG_UNIMPLEMENTED();
RETURN(xbox::status_success);

View File

@ -724,7 +724,7 @@ XBSYSAPI EXPORTNUM(108) xbox::void_xt NTAPI xbox::KeInitializeEvent
LOG_FUNC_END;
// HACK: Since we forward to NtDll::NtCreateEvent, this *might* be a Windows handle instead of our own
// In this case, it is already initialized so no need tod o anything
// In this case, it is already initialized so no need todo anything
// Test Case: Xbox Live Dashboard, Network Test (or any other Xbox Live connection)
DWORD flags = 0;
if (GetHandleInformation((HANDLE)Event, &flags)) {

View File

@ -42,11 +42,11 @@
#pragma warning(default:4005)
#define INITIALIZED_OBJECT_STRING(ObjectString, Value) \
xbox::char_xt ObjectString##Buffer[] = Value; \
xbox::OBJECT_STRING ObjectString = { \
sizeof(Value) - sizeof(CHAR), \
sizeof(Value), \
ObjectString##Buffer \
xbox::char_xt ObjectString##Buffer[] = Value; \
xbox::OBJECT_STRING ObjectString = { \
sizeof(Value) - sizeof(xbox::char_xt), \
sizeof(Value), \
ObjectString##Buffer \
}
INITIALIZED_OBJECT_STRING(ObpDosDevicesString, "\\??");
@ -65,8 +65,8 @@ XBSYSAPI EXPORTNUM(245) xbox::OBJECT_HANDLE_TABLE xbox::ObpObjectHandleTable = {
xbox::PVOID ObpDosDevicesDriveLetterMap['Z' - 'A' + 1];
xbox::boolean_xt xbox::ObpCreatePermanentDirectoryObject(
IN xbox::POBJECT_STRING DirectoryName OPTIONAL,
OUT xbox::POBJECT_DIRECTORY *DirectoryObject
IN POBJECT_STRING DirectoryName OPTIONAL,
OUT POBJECT_DIRECTORY *DirectoryObject
)
{
LOG_FUNC_BEGIN
@ -128,23 +128,25 @@ xbox::ntstatus_xt xbox::ObpReferenceObjectByName(
FoundObject = (POBJECT_DIRECTORY)ObpGetObjectHandleContents(RootDirectoryHandle);
if (FoundObject == NULL) {
status = STATUS_INVALID_HANDLE;
status = xbox::status_invalid_handle;
goto CleanupAndExit;
}
}
if ((RemainingName.Length != 0) &&
(RemainingName.Buffer[0] == OBJ_NAME_PATH_SEPARATOR)) {
status = STATUS_OBJECT_NAME_INVALID;
status = xbox::status_object_name_invalid;
goto CleanupAndExit;
}
goto OpenRootDirectory;
}
FoundObject = ObpRootDirectoryObject;
if ((RemainingName.Length == 0) ||
(RemainingName.Buffer[0] != OBJ_NAME_PATH_SEPARATOR)) {
status = STATUS_OBJECT_NAME_INVALID;
status = xbox::status_object_name_invalid;
goto CleanupAndExit;
}
@ -162,7 +164,7 @@ xbox::ntstatus_xt xbox::ObpReferenceObjectByName(
if (RemainingName.Length != 0) {
if (RemainingName.Buffer[0] == OBJ_NAME_PATH_SEPARATOR) {
status = STATUS_OBJECT_NAME_INVALID;
status = xbox::status_object_name_invalid;
goto CleanupAndExit;
}
} else {
@ -444,7 +446,7 @@ XBSYSAPI EXPORTNUM(239) xbox::ntstatus_xt NTAPI xbox::ObCreateObject
POBJECT_HEADER ObjectHeader = (POBJECT_HEADER)(ObjectNameInfo + 1);
ObjectNameInfo->ChainLink = NULL;
ObjectNameInfo->Directory = NULL;
ObjectNameInfo->Name.Buffer = (PSTR)((PUCHAR)&ObjectHeader->Body + ObjectBodySize);
ObjectNameInfo->Name.Buffer = (PSTR)((PUCHAR)&ObjectHeader->Body + ObjectBodySize);
ObjectNameInfo->Name.Length = ElementName.Length;
ObjectNameInfo->Name.MaximumLength = ElementName.Length;

View File

@ -276,7 +276,7 @@ const std::string DeviceHarddisk0Partition20 = DeviceHarddisk0PartitionPrefix +
const char CxbxDefaultXbeDriveLetter = 'D';
int CxbxDefaultXbeDriveIndex = -1;
EmuNtSymbolicLinkObject* NtSymbolicLinkObjects[26];
EmuNtSymbolicLinkObject* NtSymbolicLinkObjects['Z' - 'A' + 1];
std::vector<XboxDevice> Devices;
EmuHandle::EmuHandle(EmuNtObject* ntObject)
@ -461,13 +461,13 @@ NTSTATUS CxbxConvertFilePath(
// Assume relative to Xbe path
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir);
}
else if (*RootDirectory == (NtDll::HANDLE)-3) {
else if (*RootDirectory == ObDosDevicesDirectory()) {
// This is a special handle that tells the API that this is a DOS device
// We can safely remove it and forward to the Xbe directory.
// Test case GTA3
NtSymbolicLinkObject = FindNtSymbolicLinkObjectByRootHandle(g_hCurDir);
}
else if (*RootDirectory == (NtDll::HANDLE)-4) {
else if (*RootDirectory == ObWin32NamedObjectsDirectory()) {
// NOTE: A handle of -4 on the Xbox signifies the path should be in the BaseNamedObjects namespace.
// This handle doesn't exist on Windows, so we prefix the name instead. (note from LukeUsher)
// Handle special root directory constants
@ -705,7 +705,6 @@ NTSTATUS EmuNtSymbolicLinkObject::Init(std::string aSymbolicLinkName, std::strin
HostSymbolicLinkPath = HostSymbolicLinkPath + ExtraPath;
}
SHCreateDirectoryEx(NULL, HostSymbolicLinkPath.c_str(), NULL);
RootDirectoryHandle = CreateFile(HostSymbolicLinkPath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (RootDirectoryHandle == INVALID_HANDLE_VALUE)
{