2011年4月6日 星期三

modify entry in ioregistry

OSDictionary *dic = OSDictionary::withCapacity(6);
OSNumber *index = OSNumber::withNumber(100, 32);
dic->setObject("TEST_INDEX", index);
index->release();
this->setProperty("TEST_DIC", dic);
dic->release();
index->setValue(1);

note:
we can not modify collection directly
Following code will trigger crash
dic->setObject("testIndex", OSNumber::withNumber(200, 32));
If we want to add or delete entry in collection,
we must create new collection and  use setProperty to replace old collection

沒有留言:

張貼留言