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

@ -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

@ -44,7 +44,7 @@
#define INITIALIZED_OBJECT_STRING(ObjectString, Value) \
xbox::char_xt ObjectString##Buffer[] = Value; \
xbox::OBJECT_STRING ObjectString = { \
sizeof(Value) - sizeof(CHAR), \
sizeof(Value) - sizeof(xbox::char_xt), \
sizeof(Value), \
ObjectString##Buffer \
}
@ -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 {

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)
{