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

  • From: Dennis Scott <dennis.scott@xxxxxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Tue, 6 Oct 2009 12:07:47 +0530

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>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
> Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
> Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
> Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx
>
> URL to WDMAUDIODEV page:
> http://www.wdmaudiodev.com/
>
>

Other related posts: