Is there anyone who can help me delete this post? I accidentally revealed some information that shouldn't have been disclosed and need to retract and repost it. Thank you.
Post
Replies
Boosts
Views
Activity
Is there anyone who can help me delete this post? I accidentally revealed some information that shouldn't have been disclosed and need to retract and repost it. Thank you.
Thank you so much, Kevin Elliott! I’ll definitely take the time to dig into the IOKit and Kext architecture docs you mentioned. It might take me a while to go through everything, if I have any question, I'll be back and ask for some help.
Don't say that, Smith. Valuable information about dext is almost impossible to find online, so any help you provide is incredibly significant to me. I'm truly grateful.
This is my first time working on dext development, I always ask Copilot or ChatGPT for help, but their answers are mostly non-functional code, which is truly frustrating.
For example, when I try to connect to this dext, their user space client code is not workable also.
May I politely ask if you have a basic and functional Xcode project for both the dext and client sides that I could use as a reference?
Thanks, Smith,
Thanks for your quick response. There are so few resource about DriverKit developing that I can find. So, thank you very much!
I follow your suggestion, add the code for NewUserClient
kern_return_t IMPL(testinfo, NewUserClient)
{
kern_return_t ret = kIOReturnSuccess;
IOService* client = nullptr;
Log("fredapp NewUserClient()");
ret = Create(this, "UserClientProperties", &client);
if (ret != kIOReturnSuccess)
{
Log("fredapp NewUserClient() - Failed to create UserClientProperties with error: 0x%08x.", ret);
goto Exit;
}
*userClient = OSDynamicCast(IOUserClient, client);
if (*userClient == NULL)
{
Log("fredapp NewUserClient() - Failed to cast new client.");
client->release();
ret = kIOReturnError;
goto Exit;
}
Log("fredapp NewUserClient() - Finished.");
Exit:
return ret;
}
And change the CppUserClient
ret = IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceNameMatching(dextIdentifier), &iterator);
But still got the message: Failed to match to device.
By the way, in CppUserClient.cpp
ret = IOServiceOpen(service, mach_task_self_, kIOHIDServerConnectType, &connection);
our dext is using the PCIDriverKit.framework, and include the headers
#include <DriverKit/IOUserServer.h>
#include <DriverKit/IOLib.h>
#include <PCIDriverKit/PCIDriverKit.h>
#include <DriverKit/IODMACommand.h>
#include <DriverKit/IODispatchSource.h>
#include <DriverKit/IOTimerDispatchSource.h>
#include <DriverKit/IOInterruptDispatchSource.h>
So I try to replace the kIOHIDServerConnectType to kIOPCIDeviceConnectType, but I do not know how to import the correct header file. I try to include
#include <IOKit/PCIDriverKit.h>
but Xcode report file not found.
What's the next step to try?
And I find a Github repository SamsungDS/MacVFN, in the file MacVFN/MacVFNUserClient.cpp,
#include <DriverKit/IOUserServer.h>
#include <DriverKit/IOLib.h>
#include <DriverKit/OSData.h>
#include <DriverKit/OSDictionary.h>
#include <DriverKit/OSNumber.h>
#include <PCIDriverKit/PCIDriverKit.h>
If it is workable (because I was failed to include PCIDriverKit/PCIDriverKit.h),
and I will try to download and inspect the code to find some information and try to figure out how to fix my problem.
Best Regards,
Charles