[wdmaudiodev] Re: How to Get PID of a audio player in the audio driver

  • From: Frank Yerrace <Frank.Yerrace@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Tue, 6 Oct 2009 06:42:29 +0000

Note that on Vista and Windows 7 the audio driver is almost always called from 
one user mode process (audiodg.exe). The audio driver is not called directly 
from the application process.

Frank Yerrace
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.

From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Dennis Scott
Sent: Monday, October 05, 2009 11:38 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: How to Get PID of a audio player in the audio driver

i am trying to do is,

call PsGetCurrentProcess() to get the current process and then trying to get 
sessionId from this process using unDocumented PsGetProcessSessionId(), some 
times this will give me correct Session id but under some scenarios this will 
return only 0.

ULONG CurrentSessionID = (ULONG)PsGetProcessSessionId ( PsGetCurrentProcess());
On Tue, Oct 6, 2009 at 11:58 AM, Eugene Muzychenko 
<emuzychenko@xxxxxxxxx<mailto:emuzychenko@xxxxxxxxx>> wrote:
Hello Dennis,

> if i find a way to get the Process OR processId then i can map this
> process OR processId to SessionID.
For example, you could obtain a pointer to PsGetCurrentProcessId,
using MmGetSystemRoutineAddress. Then call PsGetCurrentProcessId at
every request from higher layers (Port driver and/or IOCTLs). In most
cases, you will get either 0 (a DPC-level call) or 4 (a system
process). But sometimes you can get a valid user-mode process ID.

Regards,
Eugene

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subscribe:    
mailto:wdmaudiodev-request@xxxxxxxxxxxxx<mailto:wdmaudiodev-request@xxxxxxxxxxxxx>?subject=subscribe
Unsubscribe:  
mailto:wdmaudiodev-request@xxxxxxxxxxxxx<mailto:wdmaudiodev-request@xxxxxxxxxxxxx>?subject=unsubscribe
Moderator:    
mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx<mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx>

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: