Display trace event message in umdf

Hello I’ve created an UMDF driver , now i am trying to get message sending by driver via trace event function , I need to do it from my local Machine, is there any tool or method to do it. I’ve tried with trace log, windbg dbgview…, but without result, I’ve also thought to use socket, but I’ve not succeed. So please if anyone knows how to do it. It will be helpful for me.

Message to who? If you want to write kernel debug log messages, OutputDebugString works, although it is primitive. You’d need to add a printf wrapper.

https://community.osr.com/discussion/292213/outputdebugstring-in-umdf2-drivers

Thank you, i will try that.

Thnks a lot ,it’s working,i can now view trace message using appverif and windbg. If you don’t mind,i have another question please, now I want to communicate with the device to retrieve the version of the firmware installed at its level, is there a possibility of using fileapi if not, will I have to use hid report functions. I don’t know which way I’m going to take.

If it is a HID device, then ReadFile and WriteFile just translate to HID API requests anyway. You’re basically just a plain, ordinary user-mode application. Do whatever you would have done from your test applications.

Many HID devices don’t need a driver at all. What kind of device is it?

It’s nuvoton device , I’ve tools for handle it via test application https://github.com/OpenNuvoton/ISPTool . This tool is based on readfile and write file, from my driver i tried to create handle to interface with device via createFile function, but i could not ,this function require device path to be used,this path i don’t know how to get it in UMDF driver , so I’ve hard coded it ,when testing I had no result. For what i need to use hid command from driver at least to get version of firmware, please if you’ve code how to do this kind of task, it will be helpful for me.

This tool is based on readfile and write file,

Sort of. The tool is based on the hidapi library. They have a wrapper class called CHidIO2 that has functions called ReadFile and WriteFile, but those are just thin wrappers around hidapi. The ISPLdCMD::GetVersion function calls ISPLdCMD::WriteFIle which calls CHidIO2::WriteFile which calls hid_write in the hidapi library, which ends up calling WriteFile, which sends an output report. If you’re writing your own tool, you can just call WriteFile directly – the hidapi stuff is just there to provide platform independence.

You don’t need a driver. HID devices can be used without any special drivers at all.

this function require device path to be used, this path I don’t know how to get …

You get the path the same way that hidapi does – you use the SetupDi APIs to enumerate all of the HID devices until you find the one you want.

But, hang on a moment. What kind of UMDF driver are you writing? If you are writing a driver for that device, with an INF file that claims the VID/PID, then you don’t need to find the path. PnP will hand you the device object you need in order to send commands. If you not writing a driver specifically for that device, then you’re not writing a driver – you’re writing a utility DLL, and you should not be using UMDF at all.

Every driver in Windows maps requests from above into requests from below. What applications are going to use your “driver”? What requests are they going to make? What services are you going to provide? I strongly suspect you are on a very wrong path here.