How can I get the CommandLine through the process start event provided by Microsoft-Windows-Kernel-Process in etw

小虫 吴 20 Reputation points
2023-07-17T09:30:34.4366667+00:00

I saw here (https://learn.microsoft.com/zh-cn/windows/win32/etw/process-typegroup1) that the property of the ProcessStart event has CommandLine, so I tried to use logman to capture the start event of the process.

logman create trace ProcessTest -p Microsoft-Windows-Kernel-Process

But I found that there is no CommandLine item in the process start event I caught.

What am I doing wrong, or is there any way to get it?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,756 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 11,341 Reputation points Microsoft External Staff
    2023-07-18T01:46:07.35+00:00

    Hello,

    Welcome to Microsoft Q&A!

    According to your description, whether you want to get the CommandLine of another process? If so, I don't advise you to do this.

    Win32 doesn’t expose a process’s command line to other processes. From Win32’s point of view, the command line is just a string that is copied into the address space of the new process. How the launching process and the new process interpret this string is governed not by rules but by convention.

    For more details, I suggest you could refer to the Blog: How do I get the command line of another process?

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.