fix ps/2 mouse init, make Stall more precise, rename CurrentProcess to KeGetCurrentProcess, correct type about maneuvers, add file writing to win32
This commit is contained in:
1 parent
8c7564d5e1
commit
a37f5b1581
14 files changed
+288
-75
No files matched your search
@@ -54,21 +54,13 @@ static const HAL_API* gHal;
|
||||
|
||||
void KeSyscallSetHal(const HAL_API* hal) { gHal = hal; }
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helper: get the current process, or NULL if unavailable.
|
||||
// ---------------------------------------------------------------------------
|
||||
static inline PROCESS* CurrentProcess(void) {
|
||||
THREAD* t = KeGetCurrentThread();
|
||||
return t ? t->Owner : NULL;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helper: look up a handle and type-check it in one call.
|
||||
// Bumps the refcount on success; caller must ObDereferenceObject when done.
|
||||
// Returns NULL if the handle is invalid or the type does not match.
|
||||
// ---------------------------------------------------------------------------
|
||||
static OBJECT* HandleToObject(uint32_t handle, OBJECT_TYPE expected) {
|
||||
PROCESS* proc = CurrentProcess();
|
||||
PROCESS* proc = KeGetCurrentProcess();
|
||||
if (!proc) return NULL;
|
||||
OBJECT* obj = KeLookupHandle(proc, handle); // bumps refcount
|
||||
if (!obj) return NULL;
|
||||
@@ -85,7 +77,7 @@ static OBJECT* HandleToObject(uint32_t handle, OBJECT_TYPE expected) {
|
||||
// On failure, drops the reference it would have stored.
|
||||
// ---------------------------------------------------------------------------
|
||||
static KSTATUS AllocHandleForCurrent(OBJECT* obj, uint32_t* handleOut) {
|
||||
PROCESS* proc = CurrentProcess();
|
||||
PROCESS* proc = KeGetCurrentProcess();
|
||||
if (!proc) return STATUS_FAILURE;
|
||||
KSTATUS s = KeAllocateHandle(proc, obj, handleOut);
|
||||
if (!KSUCCESS(s)) ObDereferenceObject(obj);
|
||||
@@ -126,7 +118,7 @@ static uint64_t SyscallExitThread(uint64_t a0, uint64_t a1, uint64_t a2,
|
||||
static uint64_t SyscallCreateThread(uint64_t a0, uint64_t a1, uint64_t a2,
|
||||
uint64_t a3, uint64_t a4, uint64_t a5) {
|
||||
(void)a4; (void)a5;
|
||||
PROCESS* proc = CurrentProcess();
|
||||
PROCESS* proc = KeGetCurrentProcess();
|
||||
if (!proc) return STATUS_FAILURE;
|
||||
if (a2 >= PriorityCount) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
@@ -154,7 +146,7 @@ static uint64_t SyscallGetCurrentTid(uint64_t a0, uint64_t a1, uint64_t a2,
|
||||
static uint64_t SyscallGetCurrentPid(uint64_t a0, uint64_t a1, uint64_t a2,
|
||||
uint64_t a3, uint64_t a4, uint64_t a5) {
|
||||
(void)a0; (void)a1; (void)a2; (void)a3; (void)a4; (void)a5;
|
||||
PROCESS* p = CurrentProcess();
|
||||
PROCESS* p = KeGetCurrentProcess();
|
||||
return p ? p->ProcessId : 0;
|
||||
}
|
||||
|
||||
@@ -448,7 +440,7 @@ static uint64_t SyscallQueueRecv(uint64_t a0, uint64_t a1, uint64_t a2,
|
||||
static uint64_t SyscallCloseHandle(uint64_t a0, uint64_t a1, uint64_t a2,
|
||||
uint64_t a3, uint64_t a4, uint64_t a5) {
|
||||
(void)a1; (void)a2; (void)a3; (void)a4; (void)a5;
|
||||
PROCESS* proc = CurrentProcess();
|
||||
PROCESS* proc = KeGetCurrentProcess();
|
||||
if (!proc) return STATUS_FAILURE;
|
||||
KeCloseHandle(proc, (uint32_t)a0);
|
||||
return STATUS_SUCCESS;
|
||||
@@ -733,7 +725,7 @@ static uint64_t SyscallCreateProcess(uint64_t a0, uint64_t a1, uint64_t a2,
|
||||
if (!KSUCCESS(s)) { ObDereferenceObject(&proc->Header); return s; }
|
||||
|
||||
// Give the caller a handle to the new process so they can wait on it.
|
||||
PROCESS* caller = CurrentProcess();
|
||||
PROCESS* caller = KeGetCurrentProcess();
|
||||
if (!caller) { ObDereferenceObject(&proc->Header); return STATUS_FAILURE; }
|
||||
|
||||
uint32_t handle;
|
||||
|
||||
Reference in new issue
Block a user