IOKitTest.h
#include <IOKit/IOService.h>class com_osxkernel_driver_IOKitTest : public IOService{ OSDeclareDefaultStructors(com_osxkernel_driver_IOKitTest)public: virtual bool init (OSDictionary* dictionary = NULL); virtual void free (void); virtual IOService* probe (IOService* provider, SInt32* score); virtual bool start (IOService* provider); virtual void stop (IOService* provider);};
IOKitTest.cpp
#include "IOKitTest.h"#include <IOKit/IOLib.h>//定义超类#define super IOService//表示提供构造与析构函数的声明 以及元数据OSDefineMetaClassAndStructors(com_osxkernel_driver_IOKitTest, IOService)//构造函数bool com_osxkernel_driver_IOKitTest::init (OSDictionary* dict){ bool res = super::init(dict); IOLog("IOKitTest::init\n"); return res;}void com_osxkernel_driver_IOKitTest::free (void){ IOLog("IOKitTest::free\n"); super::free();}//检查硬件设备IOService* com_osxkernel_driver_IOKitTest::probe (IOService* provider, SInt32* score){ IOService *res = super::probe(provider, score); IOLog("IOKitTest::probe\n"); return res;}bool com_osxkernel_driver_IOKitTest::start (IOService *provider){ bool res = super::start(provider); IOLog("IOKitTest::start\n"); return res;}void com_osxkernel_driver_IOKitTest::stop (IOService *provider){ IOLog("IOKitTest::stop\n"); super::stop(provider);}
Note the point:
Kernel version
Compiler version
Installation:
A Ioregistryexplorer tool may be installed to view:
Mac Ox Driver developed C + + version