Excellent Matthew, this does the trick, obviously the call stack was not lying correctly against __cdecl. I shall check with ks.h conventions more often. Regards, Richard Lince, From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde Sent: 23 August 2013 15:37 To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: AVStream Clock CorrelatedTime Callback Invalid PKSPIN From ks.h: _IRQL_requires_max_(DISPATCH_LEVEL) typedef LONGLONG (FASTCALL *PFNKSPINCORRELATEDTIME)( _In_ PKSPIN Pin, _Out_ PLONGLONG SystemTime ); Try adding FASTCALL to your DispatchCorrelatedTime declaration: static LONGLONG FASTCALL DispatchCorrelatedTime ... If you add /Gr to your compiler flags, that will cause the compiler to default to FASTCALL for functions which don't have an explicit calling convention. From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Richard Lince Sent: Friday, August 23, 2013 4:15 AM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] AVStream Clock CorrelatedTime Callback Invalid PKSPIN Hi folks, Im trying to Implement an audio clock in an AVStream driver as follows, however, the callback argument is an invalid pin pointer (and 'this' pointer in debugger). It seems to be common on the internet as an issue with no resolution, any ideas? //class header const static KSCLOCK_DISPATCH AudioClockDispatch; static LONGLONG DispatchCorrelatedTime ( IN PKSPIN Pin, OUT PLONGLONG SystemTime) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! invalid PKSPIN Pin on callback !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! return (reinterpret_cast <CCaptureAudioPin *> (Pin -> Context)) -> CorrelatedTime ( Pin, SystemTime); } //class body const KSCLOCK_DISPATCH CCaptureAudioPin::AudioClockDispatch = { NULL,//PFNKSPINSETTIMER SetTimer; NULL,//PFNKSPINCANCELTIMER CancelTimer; (PFNKSPINCORRELATEDTIME)CCaptureAudioPin::DispatchCorrelatedTime, //PFNKSPINCORRELATEDTIME CorrelatedTime; (PFNKSPINRESOLUTION)CCaptureAudioPin::DispatchResolution //PFNKSPINRESOLUTION Resolution; }; const KSPIN_DISPATCH CaptureAudioPinDispatch = { CCaptureAudioPin::DispatchCreate, // Pin Create NULL, // Pin Close CCaptureAudioPin::DispatchProcess, // Pin Process NULL, // Pin Reset CCaptureAudioPin::DispatchSetFormat, // Pin Set Data Format CCaptureAudioPin::DispatchSetState, // Pin Set Device State NULL, // Pin Connect NULL, // Pin Disconnect &CCaptureAudioPin::AudioClockDispatch, // Clock Dispatch NULL // Allocator Dispatch }; Compiles and callback time is fine. Thanks in advance if you have any ideas. Rich. ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________