diff --git a/kclib/KeDef.h b/kclib/KeDef.h index cb6ad43..6a84bb6 100644 --- a/kclib/KeDef.h +++ b/kclib/KeDef.h @@ -2,8 +2,13 @@ #define _KeDef_h_ // calling conventions #define HYPKERNELAPI _cdecl +#define _OPTIONAL_ +#define _IN_ +#define _OUT_ + +// null pointer #define NULL ((void*)0) -//asdadadadsasdadas + //Struct Naming: //AAXXXXBB //AA: Identifier diff --git a/kclib/KeGraph32.c b/kclib/KeGraph32.c index 8e2cf8f..cae9939 100644 --- a/kclib/KeGraph32.c +++ b/kclib/KeGraph32.c @@ -1,11 +1,11 @@ #include "KeGraph32.h" #include "KeGlobalVariables.h" -ULONG32 KeGetCurrentGraphRow(ULONG32 GraphPosition) +ULONG32 KeGetCurrentGraphRow( _IN_ ULONG32 GraphPosition) { return (GraphPosition/2*DOSGraphColumn); } -ULONG32 KeCheckGraphRowForPrint(ULONG32 GraphPosition) +ULONG32 KeCheckGraphRowForPrint(_IN_ ULONG32 GraphPosition) { if(GraphPosition>=DOSGraphMaxBytes) { @@ -14,7 +14,7 @@ ULONG32 KeCheckGraphRowForPrint(ULONG32 GraphPosition) return GraphPosition; } -ULONG32 KeCheckGraphRowForReturn(ULONG32 GraphPosition) +ULONG32 KeCheckGraphRowForReturn(_IN_ ULONG32 GraphPosition) { ULONG32 GraphRow = GraphPosition/(2*DOSGraphColumn); if(GraphRow >= (DOSGraphRow-1)) diff --git a/kclib/KeGraph32.h b/kclib/KeGraph32.h index 0633d55..7f37e16 100644 --- a/kclib/KeGraph32.h +++ b/kclib/KeGraph32.h @@ -7,13 +7,13 @@ #define DOSGraphMaxBytes 4000 #define DOSGraphBase 0xb8000 -VOID HYPKERNELAPI _asm_KePrintHex32(ULONG32 Hex); -VOID HYPKERNELAPI _asm_KePrintStr32(PCHAR OffsetStr); -ULONG32 HYPKERNELAPI _asm_KeSetGraphPosition32(ULONG32 Row,ULONG32 Column); +VOID HYPKERNELAPI _asm_KePrintHex32(_IN_ ULONG32 Hex); +VOID HYPKERNELAPI _asm_KePrintStr32(_IN_ PCHAR OffsetStr); +ULONG32 HYPKERNELAPI _asm_KeSetGraphPosition32(_IN_ ULONG32 Row, _IN_ ULONG32 Column); VOID HYPKERNELAPI _asm_KeClearGraph32(VOID); -ULONG32 HYPKERNELAPI _asm_KeGraphRowOverflow(ULONG32 GraphPosition); -ULONG32 HYPKERNELAPI KeCheckGraphRowForPrint(ULONG32 GraphPosition); -ULONG32 HYPKERNELAPI KeCheckGraphRowForReturn(ULONG32 GraphPosition); +ULONG32 HYPKERNELAPI _asm_KeGraphRowOverflow(_IN_ ULONG32 GraphPosition); +ULONG32 HYPKERNELAPI KeCheckGraphRowForPrint(_IN_ ULONG32 GraphPosition); +ULONG32 HYPKERNELAPI KeCheckGraphRowForReturn(_IN_ ULONG32 GraphPosition); ULONG32 HYPKERNELAPI _asm_KeGetCurrentGraphPosition32(VOID); -ULONG32 HYPKERNELAPI KeGetCurrentGraphRow(ULONG32 GraphPosition); +ULONG32 HYPKERNELAPI KeGetCurrentGraphRow(_IN_ ULONG32 GraphPosition); #endif diff --git a/kclib/KeIO32.c b/kclib/KeIO32.c index c9ab25a..d28588f 100644 --- a/kclib/KeIO32.c +++ b/kclib/KeIO32.c @@ -1,7 +1,9 @@ #include "KeIO32.h" #include "KeGraph32.h" -VOID KeWriteGDT(ULONG32 Index,PIAGDT32 Dest, PKeGDTDescriptor32 Src) +VOID KeWriteGDT(_IN_ ULONG32 Index, _IN_ PIAGDT32 Dest, _IN_ PKeGDTDescriptor32 Src) { + if (!Dest || !Src) + return; ULONG32 temp = 0; ULONG32 datal = 0; ULONG32 datah = 0; @@ -29,8 +31,10 @@ VOID KeWriteGDT(ULONG32 Index,PIAGDT32 Dest, PKeGDTDescriptor32 Src) } -VOID KeInitializeKeGDTDescriptor32(PKeGDTDescriptor32 Desc, ULONG32 Base, ULONG32 Limit, ULONG32 G, ULONG32 P, ULONG32 S, ULONG32 Type, ULONG32 DPL, ULONG32 DB, ULONG32 AVL) +VOID KeInitializeKeGDTDescriptor32(_OUT_ PKeGDTDescriptor32 Desc, _IN_ ULONG32 Base, _IN_ ULONG32 Limit, _IN_ ULONG32 G, _IN_ ULONG32 P, _IN_ ULONG32 S, _IN_ ULONG32 Type, _IN_ ULONG32 DPL, _IN_ ULONG32 DB, _IN_ ULONG32 AVL) { + if (!Desc) + return; Desc->Base = Base; Desc->Limit = Limit; Desc->G = G; @@ -43,8 +47,10 @@ VOID KeInitializeKeGDTDescriptor32(PKeGDTDescriptor32 Desc, ULONG32 Base, ULONG3 return; } -VOID KeInitializeKeIDTDescriptor32(PKeIDTDescriptor32 Desc,ULONG32 GateType, ULONG32 DPL, ULONG32 D, ULONG32 P, ULONG32 Selector, ULONG32 Offset) +VOID KeInitializeKeIDTDescriptor32(_OUT_ PKeIDTDescriptor32 Desc, _IN_ ULONG32 GateType, _IN_ ULONG32 DPL, _IN_ ULONG32 D, _IN_ ULONG32 P, _IN_ ULONG32 Selector, _IN_ ULONG32 Offset) { + if (!Desc) + return; Desc->GateType = GateType; Desc->DPL = DPL; Desc->D = D; @@ -87,8 +93,10 @@ VOID KeInitInterrupt(VOID) } -VOID KeWriteIDT(ULONG32 Index,PIAGATE32 Dest ,PKeIDTDescriptor32 Src) +VOID KeWriteIDT(_IN_ ULONG32 Index, _IN_ PIAGATE32 Dest, _IN_ PKeIDTDescriptor32 Src) { + if (!Dest || !Src) + return; ULONG32 datah = 0; ULONG32 datal = 0; ULONG32 temp = 0; @@ -124,7 +132,7 @@ VOID KeInit8259A(VOID) _asm_KeWritePort(INT_S_CTLMASK,0xFF); } -VOID KeExceptionHandler(ULONG32 VectorNumber,ULONG32 ErrorCode,ULONG32 eip,ULONG32 cs,ULONG32 eFlags) +VOID KeExceptionHandler(_IN_ ULONG32 VectorNumber, _IN_ ULONG32 ErrorCode, _IN_ ULONG32 eip, _IN_ ULONG32 cs, _IN_ ULONG32 eFlags) { _asm_KeClearGraph32(); _asm_KePrintStr32("Exception Caught:\n"); @@ -245,7 +253,7 @@ VOID KeInitIDT(VOID) _asm_KeLoadIDT(); } -VOID KeIrqIntHandler(ULONG32 IrqNumber) +VOID KeIrqIntHandler(_IN_ ULONG32 IrqNumber) { _asm_KePrintStr32("\nIrq Interrupt Detected. Irq Number:"); _asm_KePrintHex32(IrqNumber); diff --git a/kclib/KeIO32.h b/kclib/KeIO32.h index f16072d..9cd57e1 100644 --- a/kclib/KeIO32.h +++ b/kclib/KeIO32.h @@ -12,16 +12,16 @@ typedef VOID (*PExceptionHandler)(VOID); -VOID HYPKERNELAPI _asm_KeWritePort(ULONG16 Port,ULONG8 Value); -ULONG8 HYPKERNELAPI _asm_KeReadPort(ULONG16 Port); +VOID HYPKERNELAPI _asm_KeWritePort(_IN_ ULONG16 Port, _IN_ ULONG8 Value); +ULONG8 HYPKERNELAPI _asm_KeReadPort(_IN_ ULONG16 Port); VOID HYPKERNELAPI _asm_KeLoadIDT(VOID); VOID HYPKERNELAPI KeInit8259A(VOID); VOID HYPKERNELAPI KeInitInterrupt(VOID); VOID HYPKERNELAPI KeSwitchGDT(VOID); VOID HYPKERNELAPI KeInitIDT(VOID); -VOID HYPKERNELAPI KeWriteGDT(ULONG32 Index,PIAGDT32 Dest, PKeGDTDescriptor32 Src); -VOID HYPKERNELAPI KeWriteIDT(ULONG32 Index,PIAGATE32 Dest ,PKeIDTDescriptor32 Src); -VOID HYPKERNELAPI KeExceptionHandler(ULONG32 VectorNumber,ULONG32 ErrorCode,ULONG32 eip,ULONG32 cs,ULONG32 eFlags); +VOID HYPKERNELAPI KeWriteGDT(_IN_ ULONG32 Index, _IN_ PIAGDT32 Dest, _IN_ PKeGDTDescriptor32 Src); +VOID HYPKERNELAPI KeWriteIDT(_IN_ ULONG32 Index, _IN_ PIAGATE32 Dest, _IN_ PKeIDTDescriptor32 Src); +VOID HYPKERNELAPI KeExceptionHandler(_IN_ ULONG32 VectorNumber, _IN_ ULONG32 ErrorCode, _IN_ ULONG32 eip, _IN_ ULONG32 cs, _IN_ ULONG32 eFlags); VOID HYPKERNELAPI _asm_KeDivideError(VOID); VOID HYPKERNELAPI _asm_KeSingleStepException(VOID); VOID HYPKERNELAPI _asm_KeNMI(VOID); @@ -38,7 +38,7 @@ VOID HYPKERNELAPI _asm_KeStackException(VOID); VOID HYPKERNELAPI _asm_KeGeneralProtection(VOID); VOID HYPKERNELAPI _asm_KePageFault(VOID); VOID HYPKERNELAPI _asm_KeCoprError(VOID); -VOID HYPKERNELAPI KeIrqIntHandler(ULONG32 IrqNumber); +VOID HYPKERNELAPI KeIrqIntHandler(_IN_ ULONG32 IrqNumber); VOID HYPKERNELAPI _asm_KeIrqInt00(VOID); VOID HYPKERNELAPI _asm_KeIrqInt01(VOID); VOID HYPKERNELAPI _asm_KeIrqInt02(VOID); @@ -55,8 +55,8 @@ VOID HYPKERNELAPI _asm_KeIrqInt12(VOID); VOID HYPKERNELAPI _asm_KeIrqInt13(VOID); VOID HYPKERNELAPI _asm_KeIrqInt14(VOID); VOID HYPKERNELAPI _asm_KeIrqInt15(VOID); -VOID HYPKERNELAPI KeInitializeKeGDTDescriptor32(PKeGDTDescriptor32 Desc, ULONG32 Base, ULONG32 Limit, ULONG32 G, ULONG32 P, ULONG32 S, ULONG32 Type, ULONG32 DPL, ULONG32 DB, ULONG32 AVL); -VOID HYPKERNELAPI KeInitializeKeIDTDescriptor32(PKeIDTDescriptor32 Desc,ULONG32 GateType, ULONG32 DPL, ULONG32 D, ULONG32 P, ULONG32 Selector, ULONG32 Offset); +VOID HYPKERNELAPI KeInitializeKeGDTDescriptor32(_OUT_ PKeGDTDescriptor32 Desc, _IN_ ULONG32 Base, _IN_ ULONG32 Limit, _IN_ ULONG32 G, _IN_ ULONG32 P, _IN_ ULONG32 S, _IN_ ULONG32 Type, _IN_ ULONG32 DPL, _IN_ ULONG32 DB, _IN_ ULONG32 AVL); +VOID HYPKERNELAPI KeInitializeKeIDTDescriptor32(_OUT_ PKeIDTDescriptor32 Desc, _IN_ ULONG32 GateType, _IN_ ULONG32 DPL, _IN_ ULONG32 D, _IN_ ULONG32 P, _IN_ ULONG32 Selector, _IN_ ULONG32 Offset); //KeWriteGDT #define KeWriteGDT_AVL_1 0x00100000 diff --git a/kclib/KeMemory32.c b/kclib/KeMemory32.c index b851018..bd5306f 100644 --- a/kclib/KeMemory32.c +++ b/kclib/KeMemory32.c @@ -3,13 +3,7 @@ #include "KeKernelStruct32.h" #include "KeGraph32.h" -ULONG32 HYPKERNELAPI SegmentToPhyscicalAddress(ULONG16 Segment) -{ - PIAGDT32 PDescriptor = &KeGDT[(Segment >> 3)]; - return (PDescriptor->BaseHigh << 24 | PDescriptor->BaseMid << 16 | PDescriptor->BaseLow); -}; - -PVOID HYPKERNELAPI KeMemorySet(PVOID Source, BYTE Value, ULONG32 Length) +PVOID HYPKERNELAPI KeMemorySet(_IN_ PVOID Source, _IN_ BYTE Value, _IN_ ULONG32 Length) { PBYTE src = (PBYTE)Source; while (Length > 0) @@ -23,7 +17,7 @@ PVOID HYPKERNELAPI KeMemorySet(PVOID Source, BYTE Value, ULONG32 Length) return 0; } -PVOID HYPKERNELAPI KeMemoryCopy(PVOID src, PVOID dst, ULONG32 size) +PVOID HYPKERNELAPI KeMemoryCopy(_IN_ PVOID src, _IN_ PVOID dst, _IN_ ULONG32 size) { ULONG32 i = 0; for (i = 0; i < size; i++) @@ -34,8 +28,10 @@ PVOID HYPKERNELAPI KeMemoryCopy(PVOID src, PVOID dst, ULONG32 size) } -VOID HYPKERNELAPI KeInitializeWritePDE4KDescriptor32(PKePDE4KDescriptor32 Desc, ULONG32 P, ULONG32 RW, ULONG32 US, ULONG32 PWT, ULONG32 PCD, ULONG32 A, ULONG32 PS, ULONG32 Address) +VOID HYPKERNELAPI KeInitializeWritePDE4KDescriptor32(_OUT_ PKePDE4KDescriptor32 Desc, _IN_ ULONG32 P, _IN_ ULONG32 RW, _IN_ ULONG32 US, _IN_ ULONG32 PWT, _IN_ ULONG32 PCD, _IN_ ULONG32 A, _IN_ ULONG32 PS, _IN_ ULONG32 Address) { + if (Desc == NULL) + return; Desc->P = P; Desc->Address = Address; Desc->A = A; @@ -47,8 +43,10 @@ VOID HYPKERNELAPI KeInitializeWritePDE4KDescriptor32(PKePDE4KDescriptor32 Desc, return; } -VOID HYPKERNELAPI KeWritePDE4K32(PKePDE4KDescriptor32 Desc, PVOID Dst) +VOID HYPKERNELAPI KeWritePDE4K32(_IN_ PKePDE4KDescriptor32 Desc, _IN_ PVOID Dst) { + if (Desc == NULL || Dst == NULL) + return; ULONG32 temp = 0; temp = Desc->Address; temp = (temp & 0xfffff000); @@ -64,8 +62,10 @@ VOID HYPKERNELAPI KeWritePDE4K32(PKePDE4KDescriptor32 Desc, PVOID Dst) } -VOID HYPKERNELAPI KeInitializeWritePTE4K32Descriptor(PKePTE4KDescriptor32 Desc, ULONG32 P, ULONG32 RW, ULONG32 US, ULONG32 PWT, ULONG32 PCD, ULONG32 A, ULONG32 D, ULONG32 PS, ULONG32 G, ULONG32 Address) +VOID HYPKERNELAPI KeInitializeWritePTE4KDescriptor32(_OUT_ PKePTE4KDescriptor32 Desc, _IN_ ULONG32 P, _IN_ ULONG32 RW, _IN_ ULONG32 US, _IN_ ULONG32 PWT, _IN_ ULONG32 PCD, _IN_ ULONG32 A, _IN_ ULONG32 D, _IN_ ULONG32 PS, _IN_ ULONG32 G, _IN_ ULONG32 Address) { + if (Desc == NULL) + return; Desc->P = P; Desc->Address = Address; Desc->A = A; @@ -79,8 +79,10 @@ VOID HYPKERNELAPI KeInitializeWritePTE4K32Descriptor(PKePTE4KDescriptor32 Desc, return; } -VOID HYPKERNELAPI KeGetPDEInfo(PKePDE4KDescriptor32 pDesc, PVOID PDEPtr) +VOID HYPKERNELAPI KeGetPDEInfo( _OUT_ PKePDE4KDescriptor32 pDesc, _IN_ PVOID PDEPtr) { + if (pDesc == NULL || PDEPtr == NULL) + return; ULONG32 temp = *(PULONG32)PDEPtr; pDesc->Address = (temp >> 12) << 12; pDesc->A = temp & KeWritePDE4K32_A_1; @@ -93,8 +95,10 @@ VOID HYPKERNELAPI KeGetPDEInfo(PKePDE4KDescriptor32 pDesc, PVOID PDEPtr) return; } -VOID HYPKERNELAPI KeGetPTEInfo(PKePTE4KDescriptor32 pDesc, PVOID PTEPtr) +VOID HYPKERNELAPI KeGetPTEInfo( _OUT_ PKePTE4KDescriptor32 pDesc, _IN_ PVOID PTEPtr) { + if (pDesc == NULL || PTEPtr == NULL) + return; ULONG32 temp = *(PULONG32)PTEPtr; pDesc->Address = (temp >> 12) << 12; pDesc->P = temp & KeWritePTE4K32_P_1; @@ -108,8 +112,10 @@ VOID HYPKERNELAPI KeGetPTEInfo(PKePTE4KDescriptor32 pDesc, PVOID PTEPtr) return; } -VOID HYPKERNELAPI KeWritePTE4K32(PKePTE4KDescriptor32 Desc, PVOID Dst) +VOID HYPKERNELAPI KeWritePTE4K32( _IN_ PKePTE4KDescriptor32 Desc, _IN_ PVOID Dst) { + if (Desc == NULL || Dst == NULL) + return; ULONG32 temp = 0; temp = Desc->Address; temp = (temp & 0xfffff000); @@ -125,44 +131,41 @@ VOID HYPKERNELAPI KeWritePTE4K32(PKePTE4KDescriptor32 Desc, PVOID Dst) *(PULONG32)Dst = temp; } -ULONG32 HYPKERNELAPI KeGetPDEIndex4K32(ULONG32 VirtualAddress) +ULONG32 HYPKERNELAPI KeGetPDEIndex4K32( _IN_ ULONG32 VirtualAddress) { return VirtualAddress >> 22; } -ULONG32 HYPKERNELAPI KeGetPTEIndex4K32(ULONG32 VirtualAddress) +ULONG32 HYPKERNELAPI KeGetPTEIndex4K32( _IN_ ULONG32 VirtualAddress) { return (VirtualAddress << 10) >> 22; } -ULONG32 HYPKERNELAPI MmMapVirtualAddress4K32(PVOID PDEPtr, ULONG32 PhysicalAddress, ULONG32 VirtualAddress, PKePTE4KDescriptor32 PTEDesc) +ULONG32 HYPKERNELAPI MmMapVirtualAddress4K32(_IN_ PVOID PDEBase, _IN_ ULONG32 PhysicalAddress, _IN_ ULONG32 VirtualAddress, _IN_ PKePTE4KDescriptor32 PTEDesc, _IN_ _OPTIONAL_ PKePDE4KDescriptor32 PDEDesc) { //Physical Address and Virtual Address will be trimmed to be 4K-aligned + //Please assign proper address for PDEDesc KePDE4KDescriptor32 PDE; - KeGetPDEInfo(&PDE, PDEPtr); - if (PDE.P == KeWritePDE4K32_P_0) - { - //create PDE - } ULONG32 PDEIndex = KeGetPDEIndex4K32(VirtualAddress); ULONG32 PTEIndex = KeGetPTEIndex4K32(VirtualAddress); - ULONG32 PTEBase = (*(PULONG32)((ULONG32)PDEPtr + PDEIndex * 4) >> 12) << 12; + KeGetPDEInfo(&PDE, (PVOID)(PDEIndex*4 + (ULONG32)PDEBase)); + if (PDE.P == KeWritePDE4K32_P_0) + { + KeWritePDE4K32(PDEDesc, (PVOID)(PDEIndex * 4 + (ULONG32)PDEBase)); + } + ULONG32 PTEBase = (*(PULONG32)((ULONG32)PDEBase + PDEIndex * 4) >> 12) << 12; PVOID Target = (PVOID)((*(PULONG32)(PTEBase + PTEIndex * 4) >> 12) << 12); KePTE4KDescriptor32 PTE; KeGetPTEInfo(&PTE, Target); - if (PTE.P == KeWritePTE4K32_P_0) - { - //create PTE - } PTEDesc->Address = VirtualAddress; - KeWritePTE4K32(&PTEDesc, Target); + KeWritePTE4K32(PTEDesc, Target); return 0; } -ULONG32 HYPKERNELAPI KeGetBit(PVOID Source, ULONG32 Position) +ULONG32 HYPKERNELAPI KeGetBit(_IN_ PVOID Source, _IN_ ULONG32 Position) { if (!Source) return 0; @@ -181,7 +184,7 @@ ULONG32 HYPKERNELAPI KeGetBit(PVOID Source, ULONG32 Position) return Value; } -ULONG32 HYPKERNELAPI KeSetBit(PVOID Source, ULONG32 Position, ULONG32 Value) +ULONG32 HYPKERNELAPI KeSetBit(_IN_ PVOID Source, _IN_ ULONG32 Position, _IN_ ULONG32 Value) { if (!Source || Position < 0 || (Value != 0 && Value != 1)) return 1; diff --git a/kclib/KeMemory32.h b/kclib/KeMemory32.h index 8d0e226..4686671 100644 --- a/kclib/KeMemory32.h +++ b/kclib/KeMemory32.h @@ -8,18 +8,21 @@ #include "KeCPUStruct32.h" #define KeVirtualAddressToPhysicalAddress(SegmentBase,VirtualAddress) (ULONG32)((ULONG32)SegmentBase+(ULONG32)(VirtualAddress)) -PVOID HYPKERNELAPI KeMemorySet(PVOID Source,BYTE Value,ULONG32 Length); -PVOID HYPKERNELAPI _asm_KeMemoryCopy(PVOID src,PVOID dst,ULONG32 size); -PVOID HYPKERNELAPI KeMemoryCopy(PVOID src,PVOID dst,ULONG32 size); -VOID HYPKERNELAPI KeInitializeWritePDE4KDescriptor32(PKePDE4KDescriptor32 Desc,ULONG32 P,ULONG32 RW, ULONG32 US,ULONG32 PWT,ULONG32 PCD,ULONG32 A,ULONG32 PS,ULONG32 Address); -VOID HYPKERNELAPI KeWritePDE4K32(PKePDE4KDescriptor32 Desc, PVOID Dst); -VOID HYPKERNELAPI KeInitializeWritePTE4KDescriptor32(PKePTE4KDescriptor32 Desc,ULONG32 P,ULONG32 RW, ULONG32 US,ULONG32 PWT,ULONG32 PCD,ULONG32 A,ULONG32 D,ULONG32 PS,ULONG32 G,ULONG32 Address); -VOID HYPKERNELAPI KeWritePTE4K32(PKePTE4KDescriptor32 Desc,PVOID Dst ); -ULONG32 HYPKERNELAPI KeGetPDEIndex4K32(ULONG32 Virtual_Address); -ULONG32 HYPKERNELAPI KeGetPTEIndex4K32(ULONG32 Virtual_Address); -ULONG32 HYPKERNELAPI MmMapVirtualAddress4K32(PVOID PDEPtr, ULONG32 PhysicalAddress, ULONG32 VirtualAddress, PKePTE4KDescriptor32 PTEDesc); -ULONG32 HYPKERNELAPI KeSetBit(PVOID Source, ULONG32 Position, ULONG32 Value); -ULONG32 HYPKERNELAPI KeGetBit(PVOID Source, ULONG32 Position); + +PVOID HYPKERNELAPI KeMemorySet(_IN_ PVOID Source,_IN_ BYTE Value,_IN_ ULONG32 Length); +PVOID HYPKERNELAPI _asm_KeMemoryCopy(_IN_ PVOID src,_IN_ PVOID dst,_IN_ ULONG32 size); +PVOID HYPKERNELAPI KeMemoryCopy(_IN_ PVOID src,_IN_ PVOID dst,_IN_ ULONG32 size); +VOID HYPKERNELAPI KeInitializeWritePDE4KDescriptor32(_OUT_ PKePDE4KDescriptor32 Desc,_IN_ ULONG32 P,_IN_ ULONG32 RW, _IN_ ULONG32 US,_IN_ ULONG32 PWT,_IN_ ULONG32 PCD,_IN_ ULONG32 A,_IN_ ULONG32 PS,_IN_ ULONG32 Address); +VOID HYPKERNELAPI KeWritePDE4K32(_IN_ PKePDE4KDescriptor32 Desc, _IN_ PVOID Dst); +VOID HYPKERNELAPI KeInitializeWritePTE4KDescriptor32(_OUT_ PKePTE4KDescriptor32 Desc,_IN_ ULONG32 P,_IN_ ULONG32 RW, _IN_ ULONG32 US,_IN_ ULONG32 PWT,_IN_ ULONG32 PCD,_IN_ ULONG32 A,_IN_ ULONG32 D,_IN_ ULONG32 PS,_IN_ ULONG32 G,_IN_ ULONG32 Address); +VOID HYPKERNELAPI KeWritePTE4K32(_IN_ PKePTE4KDescriptor32 Desc,_IN_ PVOID Dst ); +VOID HYPKERNELAPI KeGetPDEInfo(_OUT_ PKePDE4KDescriptor32 pDesc, _IN_ PVOID PDEPtr); +VOID HYPKERNELAPI KeGetPTEInfo(_OUT_ PKePTE4KDescriptor32 pDesc, _IN_ PVOID PTEPtr); +ULONG32 HYPKERNELAPI KeGetPDEIndex4K32(_IN_ ULONG32 Virtual_Address); +ULONG32 HYPKERNELAPI KeGetPTEIndex4K32(_IN_ ULONG32 Virtual_Address); +ULONG32 HYPKERNELAPI MmMapVirtualAddress4K32(_IN_ PVOID PDEPtr, _IN_ ULONG32 PhysicalAddress, _IN_ ULONG32 VirtualAddress, _IN_ PKePTE4KDescriptor32 PTEDesc, _IN_ _OPTIONAL_ PKePDE4KDescriptor32 PDEDesc); +ULONG32 HYPKERNELAPI KeSetBit(_IN_ PVOID Source, _IN_ ULONG32 Position, _IN_ ULONG32 Value); +ULONG32 HYPKERNELAPI KeGetBit(_IN_ PVOID Source, _IN_ ULONG32 Position); #define KeWritePDE4K32_UNDEFINED_BIT 3 diff --git a/kclib/KeProcess32.c b/kclib/KeProcess32.c index 43f1207..93cc90b 100644 --- a/kclib/KeProcess32.c +++ b/kclib/KeProcess32.c @@ -19,7 +19,7 @@ VOID KeInitProcess(VOID) _asm_KeLoadTSS(GDT_SELECTOR_TSS); } -VOID KeCreateProcess(ULONG32 ProcessID,PVOID ProcessAddress,PVOID ProcessStack,PROCESSPRIVILEGE Privilege) +VOID KeCreateProcess(_IN_ ULONG32 ProcessID, _IN_ PVOID ProcessAddress, _IN_ PVOID ProcessStack, _IN_ PROCESSPRIVILEGE Privilege) { PhProcess process; if(Privilege == Process_Priviliege_Kernel) diff --git a/kclib/KeProcess32.h b/kclib/KeProcess32.h index 432ce40..2737486 100644 --- a/kclib/KeProcess32.h +++ b/kclib/KeProcess32.h @@ -45,8 +45,8 @@ typedef struct { -VOID HYPKERNELAPI KeCreateProcess(ULONG32 ProcessID,PVOID ProcessAddress,PVOID ProcessStack,PROCESSPRIVILEGE Privilege); +VOID HYPKERNELAPI KeCreateProcess(_IN_ ULONG32 ProcessID, _IN_ PVOID ProcessAddress, _IN_ PVOID ProcessStack, _IN_ PROCESSPRIVILEGE Privilege); VOID HYPKERNELAPI KeInitProcess(VOID); -VOID HYPKERNELAPI _asm_KeLoadTSS(ULONG32 Selector_TSS); -VOID HYPKERNELAPI _asm_Restart(); +VOID HYPKERNELAPI _asm_KeLoadTSS(_IN_ ULONG32 Selector_TSS); +VOID HYPKERNELAPI _asm_Restart(VOID); #endif \ No newline at end of file diff --git a/kernel.bin b/kernel.bin index 4103d68..e2aae28 100644 Binary files a/kernel.bin and b/kernel.bin differ