From 1ab61e6bb20dd39f85fca30c1d0a83db12fea9d6 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 28 Feb 2024 17:48:25 +0100 Subject: HCoreKrnl: Fix IDT, will get the rt_handle_interrupts right, and not corrupt the registers, see below. - New register layout in Stackframe. - Thinking about a way to wrap this handler into a valid win64 call. Signed-off-by: Amlal El Mahrouss --- .vscode/c_cpp_properties.json | 3 +- Private/HALKit/AMD64/HalCoreInterruptHandler.cpp | 30 ++--- .../HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp | 12 +- .../HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp | 8 +- Private/HALKit/AMD64/HalDescriptorLoader.cpp | 29 ++--- Private/HALKit/AMD64/HalHardwareAPIC.cpp | 7 +- Private/HALKit/AMD64/HalInterruptRouting.asm | 121 +++++++++------------ Private/HALKit/AMD64/HalKernelMain.cxx | 22 ++-- Private/HALKit/AMD64/HalPageAlloc.cpp | 20 ++-- Private/HALKit/AMD64/Processor.hpp | 34 ++---- Private/NewBoot/Source/makefile | 4 +- Private/Source/String.cxx | 1 + Private/makefile | 2 +- Public/Kits/SystemKit/CoreAPI.hxx | 3 + Public/Kits/SystemKit/FileAPI.hxx | 2 +- Public/Kits/SystemKit/HeapAPI.hxx | 2 +- Public/Kits/SystemKit/XIFF.hxx | 22 ++-- 17 files changed, 149 insertions(+), 173 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index da97a75e..73f8888c 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -4,7 +4,8 @@ "name": "HCore", "includePath": [ "${workspaceFolder}/Private/**", - "${workspaceFolder}/Private/NewBoot/*" + "${workspaceFolder}/Private/NewBoot/**", + "${workspaceFolder}/Public/Kits/**", ], "defines": ["__HCORE__", "__HAVE_HCORE_APIS__", "__FSKIT_NEWFS__"], "cStandard": "c17", diff --git a/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp b/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp index 2acfc454..9f2e37d8 100644 --- a/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp +++ b/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp @@ -50,22 +50,24 @@ static const char* kExceptionMessages[32] = { #define kKernelSyscallInterrupt (0x21) EXTERN_C { + HCore::Void rt_handle_interrupts( + HCore::HAL::StackFramePtr stack) { + switch (stack->IntNum) { + case kKernelSyscallInterrupt: { + HCore::kcout << "HCoreKrnl: System call raised, checking.." + << HCore::end_line(); + rt_syscall_handle(nullptr); + break; + } -HCore::UIntPtr rt_handle_interrupts(HCore::HAL::StackFramePtr sf) { - MUST_PASS(sf); + default: + break; + } - if (sf->IntNum < 32) { - } else if (sf->IntNum == 0x21) { - rt_syscall_handle(sf); - } + if ((stack->IntNum - 32) >= 12) { + HCore::HAL::Out8(0xA0, 0x20); + } - if ((sf->IntNum - 32) >= 12) { - HCore::HAL::Out8(0xA0, 0x20); + HCore::HAL::Out8(0x20, 0x20); } - - HCore::HAL::Out8(0x20, 0x20); - - return (HCore::UIntPtr)sf; -} - } \ No newline at end of file diff --git a/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp b/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp index d1483ef3..486c1513 100644 --- a/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp @@ -11,17 +11,7 @@ #include #include -#include "KernelKit/DebugOutput.hpp" - -extern "C" void idt_handle_system_call(HCore::UIntPtr rsp) { - HCore::HAL::StackFrame *sf = reinterpret_cast(rsp); - rt_syscall_handle(sf); - - HCore::kcout << "System Call with ID: " - << HCore::StringBuilder::FromInt("syscall{%}", sf->R15); -} - -extern "C" void idt_handle_gpf(HCore::UIntPtr rsp) { +EXTERN_C void idt_handle_gpf(HCore::UIntPtr rsp) { MUST_PASS(HCore::ProcessManager::Shared().Leak().GetCurrent()); HCore::kcout << HCore::StringBuilder::FromInt("rsp{%}", rsp); diff --git a/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp b/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp index 3a3b49b3..24eee910 100644 --- a/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp @@ -16,8 +16,10 @@ typedef HCore::Void (*rt_syscall_proc)(HCore::Int32 id, HCore::HAL::StackFramePt HCore::Array kSyscalls; /// @brief Interrupt system call handler. -extern "C" void rt_syscall_handle(HCore::HAL::StackFramePtr stack) { - if (stack->R15 < kKernelMaxSystemCalls && kSyscalls[stack->R15] != 0) { - (kSyscalls[stack->R15].Leak().Leak())(stack->R15, stack); +EXTERN_C void rt_syscall_handle(HCore::HAL::StackFramePtr stack) { + if (!stack) return; + + if (stack->Rcx < kKernelMaxSystemCalls && kSyscalls[stack->Rcx] != 0) { + (kSyscalls[stack->Rcx].Leak().Leak())(stack->Rcx, stack); } } diff --git a/Private/HALKit/AMD64/HalDescriptorLoader.cpp b/Private/HALKit/AMD64/HalDescriptorLoader.cpp index 53218c17..3c84f151 100644 --- a/Private/HALKit/AMD64/HalDescriptorLoader.cpp +++ b/Private/HALKit/AMD64/HalDescriptorLoader.cpp @@ -10,9 +10,9 @@ #include namespace HCore::HAL { -STATIC Register64 kRegGdt; +STATIC RegisterGDT kRegGdt; -void GDTLoader::Load(Register64 &gdt) { +void GDTLoader::Load(RegisterGDT &gdt) { kRegGdt.Base = gdt.Base; kRegGdt.Limit = gdt.Limit; @@ -21,6 +21,9 @@ void GDTLoader::Load(Register64 &gdt) { STATIC HAL::Register64 kRegIdt; +STATIC ::HCore::Detail::AMD64::InterruptDescriptorAMD64 + kInterruptVectorTable[kKernelIdtSize]; + void IDTLoader::Load(Register64 &idt) { UInt8 a1, a2; @@ -48,32 +51,30 @@ void IDTLoader::Load(Register64 &idt) { HAL::rt_wait_400ns(); HAL::Out8(0xA1, a2); - volatile ::HCore::UIntPtr *baseIdt = (::HCore::UIntPtr *)idt.Base; + volatile ::HCore::UIntPtr **baseIdt = (volatile ::HCore::UIntPtr **)idt.Base; MUST_PASS(baseIdt[0]); - ::HCore::Detail::AMD64::InterruptDescriptorAMD64 *kInterruptVectorTable = - new ::HCore::Detail::AMD64::InterruptDescriptorAMD64[kKernelIdtSize]; - - for (auto i = 0; i < kKernelIdtSize; i++) { + for (UInt16 i = 0; i < 32; i++) { kInterruptVectorTable[i].Selector = kGdtCodeSelector; kInterruptVectorTable[i].Ist = 0x0; kInterruptVectorTable[i].TypeAttributes = kInterruptGate; - kInterruptVectorTable[i].OffsetLow = (baseIdt[i] & 0xFF); - kInterruptVectorTable[i].OffsetMid = ((baseIdt[i] & 0xFFFF) >> 16); - kInterruptVectorTable[i].OffsetHigh = ((baseIdt[i] & 0xFFFFFFFF) >> 32); + kInterruptVectorTable[i].OffsetLow = ((UIntPtr)baseIdt[i] & 0xFFFF); + kInterruptVectorTable[i].OffsetMid = (((UIntPtr)baseIdt[i] >> 16) & 0xFFFF); + kInterruptVectorTable[i].OffsetHigh = + (((UIntPtr)baseIdt[i] >> 32) & 0xFFFFFFFF); kInterruptVectorTable[i].Zero = 0x0; } - kRegIdt.Base = (UIntPtr)&kInterruptVectorTable[0]; + kRegIdt.Base = (UIntPtr)kInterruptVectorTable; kRegIdt.Limit = sizeof(::HCore::Detail::AMD64::InterruptDescriptorAMD64) * - kKernelIdtSize - - 1; + kKernelIdtSize - + 1; rt_load_idt(kRegIdt); } -void GDTLoader::Load(Ref &gdt) { GDTLoader::Load(gdt.Leak()); } +void GDTLoader::Load(Ref &gdt) { GDTLoader::Load(gdt.Leak()); } void IDTLoader::Load(Ref &idt) { IDTLoader::Load(idt.Leak()); } } // namespace HCore::HAL diff --git a/Private/HALKit/AMD64/HalHardwareAPIC.cpp b/Private/HALKit/AMD64/HalHardwareAPIC.cpp index cae54658..d587975e 100644 --- a/Private/HALKit/AMD64/HalHardwareAPIC.cpp +++ b/Private/HALKit/AMD64/HalHardwareAPIC.cpp @@ -17,8 +17,7 @@ namespace HCore { void rt_wakeup_thread(HAL::StackFrame* stack) { HAL::rt_cli(); - stack->Rbp = stack->R15; - stack->Rsi = stack->Rbp; + // TODO HAL::rt_sti(); } @@ -33,9 +32,7 @@ static void __rt_hang_proc(void) { void rt_hang_thread(HAL::StackFrame* stack) { __asm__ volatile("cli"); - stack->R15 = stack->Rbp; - stack->Rbp = (HAL::Reg)&__rt_hang_proc; - stack->Rsp = stack->Rbp; + // TODO __asm__ volatile("sti"); } diff --git a/Private/HALKit/AMD64/HalInterruptRouting.asm b/Private/HALKit/AMD64/HalInterruptRouting.asm index 1ed802b4..8d10ed4f 100644 --- a/Private/HALKit/AMD64/HalInterruptRouting.asm +++ b/Private/HALKit/AMD64/HalInterruptRouting.asm @@ -11,22 +11,62 @@ [bits 64] -%macro IntDecl 1 - dq __HCR_INT_%1 -%endmacro - %macro IntExp 1 __HCR_INT_%1: - push 0 + cli + + push 1 push %1 - call ke_handle_irq + + push rax + push rcx + push rdx + push rbx + push rbp + push rsi + push rdi + + jmp rt_handle_interrupts + + pop rdi + pop rsi + pop rbp + pop rbx + pop rdx + pop rcx + pop rax + + add rsp, 16 + sti iretq %endmacro %macro IntNormal 1 __HCR_INT_%1: + cli + + push 0 push %1 - call ke_handle_irq + + push rax + push rcx + push rdx + push rbx + push rbp + push rsi + push rdi + + jmp rt_handle_interrupts + + pop rdi + pop rsi + pop rbp + pop rbx + pop rdx + pop rcx + pop rax + + sti iretq %endmacro @@ -40,47 +80,6 @@ global kInterruptVectorTable section .text -ke_handle_irq: - push rax - push rbx - push rcx - push rdx - push rsi - push rdi - push rbp - push r8 - push r9 - push r10 - push r11 - push r12 - push r13 - push r14 - push r15 - - mov rcx, rsp - call rt_handle_interrupts - mov rsp, rcx - - pop r15 - pop r14 - pop r13 - pop r12 - pop r11 - pop r10 - pop r9 - pop r8 - pop rbp - pop rdi - pop rsi - pop rdx - pop rcx - pop rbx - pop rax - - ret - -section .data - IntNormal 0 IntNormal 1 IntNormal 2 @@ -114,24 +113,11 @@ IntNormal 29 IntExp 30 IntNormal 31 -%assign i 32 -%rep 255 - IntNormal i -%assign i i+1 -%endrep - -section .text - ;; this one is doing a POST for us. ;; testing interrupts. _ke_power_on_self_test: - int 0x21 - int 0x21 - int 0x21 - int 0x21 - int 0x21 - int 0x21 - int 0x21 + mov rcx, 0x80 + mov rdx, 0x01 int 0x21 ret @@ -155,17 +141,14 @@ rt_reload_segments: global rt_load_idt -section .text - rt_load_idt: lidt [rcx] + sti ret -section .data - kInterruptVectorTable: %assign i 0 - %rep 255 - IntDecl i + %rep 32 + dq __HCR_INT_%+i %assign i i+1 %endrep diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx index d799e5ae..eaddb338 100644 --- a/Private/HALKit/AMD64/HalKernelMain.cxx +++ b/Private/HALKit/AMD64/HalKernelMain.cxx @@ -23,7 +23,7 @@ ///! @brief Disk contains HCore files. #define kInstalledMedia 0xDD -EXTERN_C VoidStar kInterruptVectorTable[]; +EXTERN_C HCore::VoidPtr kInterruptVectorTable[]; namespace Detail { using namespace HCore; @@ -69,10 +69,10 @@ EXTERN_C void RuntimeMain( {0, 0, 0, 0x92, 0xaf, 0}, // kernel data {0, 0, 0, 0x00, 0x00, 0}, // null entry {0, 0, 0, 0x9a, 0xaf, 0}, // user code - {0, 0, 0, 0x92, 0xaf, 0}, // user data + {0, 0, 0, 0x92, 0xaf, 0}, // user data }; - HCore::HAL::Register64 gdtBase; + HCore::HAL::RegisterGDT gdtBase; gdtBase.Base = (HCore::UIntPtr)&GDT; gdtBase.Limit = sizeof(Detail::HC_GDT) - 1; @@ -91,6 +91,10 @@ EXTERN_C void RuntimeMain( HCore::HAL::IDTLoader idt; idt.Load(idtBase); + Detail::_ke_power_on_self_test(); + + HCore::kcout << "HCoreKrnl: System Call issued, everything is OK...\r\n"; + if (HandoverHeader->f_Bootloader == kInstalledMedia) { /// Mounts a NewFS block. HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager()); @@ -98,21 +102,17 @@ EXTERN_C void RuntimeMain( // Open file from first hard-drive. HCore::PEFLoader img("A:/System/HCoreServer.exe"); - /// Run the shell. - if (!HCore::Utils::execute_from_image(img)) { - HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); - } + /// Run the server executive. + HCore::Utils::execute_from_image(img); } else { /** ** This does the POST. */ - Detail::_ke_power_on_self_test(); - /** This mounts the NewFS drive. */ - - HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } + + HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } diff --git a/Private/HALKit/AMD64/HalPageAlloc.cpp b/Private/HALKit/AMD64/HalPageAlloc.cpp index 84ddc665..30996d19 100644 --- a/Private/HALKit/AMD64/HalPageAlloc.cpp +++ b/Private/HALKit/AMD64/HalPageAlloc.cpp @@ -25,12 +25,14 @@ static auto hal_try_alloc_new_page(SizeT sz, Boolean rw, Boolean user) MUST_PASS(sz != 0); PageTable64 *pte = - reinterpret_cast((UIntPtr)kKernelVirtualStart); + &reinterpret_cast((UIntPtr)kKernelVirtualStart)->Pte[0]; pte->Rw = rw; pte->User = user; pte->Present = true; + write_cr3((UIntPtr)kKernelVirtualStart); + kKernelVirtualStart = (VoidPtr)((UIntPtr)kKernelVirtualStart + kPageCnt + sz + kKernelPagingPadding); return pte; @@ -38,16 +40,20 @@ static auto hal_try_alloc_new_page(SizeT sz, Boolean rw, Boolean user) auto hal_alloc_page(SizeT sz, Boolean rw, Boolean user) -> PageTable64 * { for (SizeT i = 0; i < kPageCnt; ++i) { - PageTable64 *pte = reinterpret_cast( + PageDirectory64 *pte = reinterpret_cast( (UIntPtr)kKernelVirtualStart + kPageCnt); - if (!pte->Present) { - pte->User = user; - pte->Rw = rw; - pte->Present = true; + for (size_t indexPte = 0; indexPte < kPTEMax; ++indexPte) + { + if (!pte->Pte[indexPte].Present) { + pte->Pte[indexPte].User = user; + pte->Pte[indexPte].Rw = rw; + pte->Pte[indexPte].Present = true; - return pte; + return &(pte->Pte[indexPte]); + } } + } return hal_try_alloc_new_page(sz, rw, user); diff --git a/Private/HALKit/AMD64/Processor.hpp b/Private/HALKit/AMD64/Processor.hpp index 035b095f..435847a8 100644 --- a/Private/HALKit/AMD64/Processor.hpp +++ b/Private/HALKit/AMD64/Processor.hpp @@ -61,12 +61,17 @@ EXTERN_C void rt_cli(); EXTERN_C void rt_sti(); EXTERN_C void rt_cld(); -class PACKED Register64 { - public: +struct PACKED Register64 final { + UShort Limit; + UIntPtr Base; +}; + +struct PACKED RegisterGDT final { UShort Limit; UIntPtr Base; }; + using RawRegister = UInt64; using InterruptId = UShort; /* For each element in the IVT */ @@ -75,23 +80,8 @@ using interruptTrap = UIntPtr(UIntPtr sp); typedef UIntPtr Reg; struct PACKED StackFrame { - Reg IntNum; - Reg Rax; - Reg Rbx; - Reg Rcx; - Reg Rdx; - Reg Rsi; - Reg Rdi; - Reg Rbp; - Reg Rsp; - Reg R8; - Reg R9; - Reg R10; - Reg R11; - Reg R12; - Reg R13; - Reg R14; - Reg R15; + Reg IntNum, ErrCode; + Reg Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax; }; typedef StackFrame *StackFramePtr; @@ -138,8 +128,8 @@ using SegmentArray = Array; class GDTLoader final { public: - static void Load(Register64 &gdt); - static void Load(Ref &gdt); + static void Load(RegisterGDT &gdt); + static void Load(Ref &gdt); }; class IDTLoader final { @@ -158,7 +148,7 @@ EXTERN_C void idt_handle_math(HCore::UIntPtr rsp); EXTERN_C void idt_handle_pf(HCore::UIntPtr rsp); EXTERN_C void rt_load_idt(HCore::HAL::Register64 ptr); -EXTERN_C void rt_load_gdt(HCore::HAL::Register64 ptr); +EXTERN_C void rt_load_gdt(HCore::HAL::RegisterGDT ptr); /// @brief Maximum size of the IDT. #define kKernelIdtSize 256 diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index 933dd1dd..6931362c 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -10,7 +10,7 @@ ASM=nasm OBJ=$(wildcard *.o) $(wildcard ../../Obj/*.obj) $(wildcard HEL/AMD64/*.obj) FLAG_ASM=-f win64 -FLAG_GNU=-fshort-wchar -fPIC -O0 -D__DEBUG__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -I./ -I$(HOME)/ +FLAG_GNU=-fshort-wchar -fPIC -D__DEBUG__ -maccumulate-outgoing-args -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -I./ -I$(HOME)/ .PHONY: invalid-recipe invalid-recipe: @@ -27,7 +27,7 @@ bootloader-amd64: .PHONY: run-efi-amd64 run-efi-amd64: - qemu-system-x86_64 -net none -smp 2 -m 4G -M q35 -bios OVMF.fd -drive file=fat:rw:CDROM,index=1,format=raw -d int + qemu-system-x86_64 -net none -smp 2 -m 4G -M q35 -bios OVMF.fd -drive file=fat:rw:CDROM,index=1,format=raw -serial stdio .PHONY: download-edk download-edk: diff --git a/Private/Source/String.cxx b/Private/Source/String.cxx index 0e1b7f41..b51a560b 100644 --- a/Private/Source/String.cxx +++ b/Private/Source/String.cxx @@ -9,6 +9,7 @@ #include #include +#include namespace HCore { Char *StringView::Data() { return m_Data; } diff --git a/Private/makefile b/Private/makefile index 37245e2c..2eda7358 100644 --- a/Private/makefile +++ b/Private/makefile @@ -5,7 +5,7 @@ CC = x86_64-w64-mingw32-g++ LD = x86_64-w64-mingw32-ld -CCFLAGS = -c -ffreestanding -O0 -fPIC -D__DEBUG__ -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__HAVE_HCORE_APIS__ -D__HCORE__ -I../ -I./ -I$(HOME)/ +CCFLAGS = -c -ffreestanding -fPIC -D__DEBUG__ -maccumulate-outgoing-args -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__HAVE_HCORE_APIS__ -D__HCORE__ -I../ -I./ -I$(HOME)/ ASM = nasm ASMFLAGS = -f win64 LDFLAGS = -e Main --subsystem=17 diff --git a/Public/Kits/SystemKit/CoreAPI.hxx b/Public/Kits/SystemKit/CoreAPI.hxx index 5d9bfb1a..9d907104 100644 --- a/Public/Kits/SystemKit/CoreAPI.hxx +++ b/Public/Kits/SystemKit/CoreAPI.hxx @@ -31,6 +31,9 @@ typedef __UINT16_TYPE__ WORD; typedef __UINT32_TYPE__ DWORD; typedef __UINT64_TYPE__ QWORD; +typedef __WCHAR_TYPE__ WCHAR; +typedef WCHAR* PWCHAR; + #ifdef __x86_64__ # define _M_AMD64 #endif diff --git a/Public/Kits/SystemKit/FileAPI.hxx b/Public/Kits/SystemKit/FileAPI.hxx index cc91a8a5..e0213c57 100644 --- a/Public/Kits/SystemKit/FileAPI.hxx +++ b/Public/Kits/SystemKit/FileAPI.hxx @@ -15,7 +15,7 @@ using namespace HCore; -/// @brief OC class, translated to C++ +/// @brief SOM class, translated to C++ class HFile final { public: diff --git a/Public/Kits/SystemKit/HeapAPI.hxx b/Public/Kits/SystemKit/HeapAPI.hxx index c4c4a297..9470de99 100644 --- a/Public/Kits/SystemKit/HeapAPI.hxx +++ b/Public/Kits/SystemKit/HeapAPI.hxx @@ -12,7 +12,7 @@ #include #include -/// @brief OC class, translated to C++ +/// @brief SOM class, translated to C++ using namespace HCore; diff --git a/Public/Kits/SystemKit/XIFF.hxx b/Public/Kits/SystemKit/XIFF.hxx index c2a8371b..acaf9103 100644 --- a/Public/Kits/SystemKit/XIFF.hxx +++ b/Public/Kits/SystemKit/XIFF.hxx @@ -12,7 +12,7 @@ ------------------------------------------------------- */ -#include +#include /*** * @brief Generic XIFF header @@ -20,17 +20,17 @@ */ struct PACKED XiffHeader final { - unsigned char f_Mag[5]; // XIFF string (includes \0) - unsigned int f_Size; // overall size of header (XiffHeader) in bytes - unsigned int f_FormatType; // format type. generic - unsigned char f_SpecificMag[4]; // The sub header magic - unsigned int f_SpecificSize; // length of the format data - unsigned int f_SpecificFormatType; // format type. generic + BYTE f_Mag[5]; // XIFF string (includes \0) + DWORD f_Size; // overall size of header (XiffHeader) in bytes + DWORD f_FormatType; // format type. generic + BYTE f_SpecificMag[4]; // The sub header magic + DWORD f_SpecificSize; // length of the format data + DWORD f_SpecificFormatType; // format type. generic }; -#define kXIFFVideo "XVFF" -#define kXIFFAudio "XAFF" -#define kXIFFInstaller "XnFF" -#define kXIFFGeneric "XIFF" +#define kXIFFContainerVideo "XVFF" +#define kXIFFContainerAudio "XAFF" +#define kXIFFContainerInstaller "XnFF" +#define kXIFFContainerGeneric "XIFF" #endif // ifndef __XIFF__ -- cgit v1.2.3