Re: Simple custom filter crash (AddRef()) on Windows Mobile 5.0



How do I debug the application?
1. First copy regsvrce.exe & NullRender.dll into MyDevice folder.
2. Right click the project and select property pages. it will open up
the dialog.
Select "Debugging " and set Remote executable as "regsvrce" and
command argument is "NullRender.dll".
3. Keep the break point in DllRegisterServer function then press F5.

Regards,


On Feb 26, 5:23 pm, "raj" <raja_t_...@xxxxxxxxxxxxx> wrote:
Thanks Amit for looking at this issue.

I am using "regsvrce.exe" to register the filter. If you have the
working version of the project, can you please share it with me.
Are you using VS 2005 IDE? Did you create win32 smart device DLL
application? Did you try on emulator/ windows mobile 5.0?

I got struck because of this issue. Can you please help me out to
resolve the probelm?

Thanks in advance, waiting for your response,

On Feb 26, 5:12 pm, Amit <amitranjan@nospam-saskendotcom> wrote:



How are you registering the filter....have used the same code and it is
working for me.
How are you debugging the application?
--
Thanks and Regards
Amit Ranjan
blog:http://amitranjan.wordpress.com

"raj" wrote:
I have created "NULL Render" custom filter for windows mobile 5.0.
Please note that I used the following code which is given by Gary
Daniels[MS] in one of the forum.

When I call AMovieDllRegisterServer2() I crash, into disassembly.If I
replace DECLARE_IUNKNOWN in the following example with the expanded
macro then I see it is crashing in AddRef because GetOwner() is
returning 0x000001 and then crashing on
GetOwner()->AddRef().

I try to run this on emulator & Dell Axim 51v PDA and I get the same
crash.

I would really appreciate any ideas you have to solve this issue.

Regards,
Raj

IDE Used: Visual Studio 2005
Project: Win32 smart device application(DLL)

LIBRARIES ===
You need to link to these libraries in order to compile.
Include Libs: are strmbase.lib
, strmiids.lib, uuid.lib, ole32.lib, mmtimer.lib, and
coredll.lib
End LIBRARIES ====

NULLREND.def ==========
// These exports are necessary in order for com to register the
filter
LIBRARY nullrend.dll
EXPORTS
DllMain PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

End NULLREND.DEF ===================

NULLREND.CPP ====================================
#include <windows.h>
#include <streams.h>
#include <initguid.h>

// this is needed for COM to register the component with RegSvr
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
STDAPI DllRegisterServer() { return
AMovieDllRegisterServer2( TRUE ); }
STDAPI DllUnregisterServer() { return
AMovieDllRegisterServer2( FALSE ); }
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID
lpReserved)
{ return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved); }

// Define your filter guid here
DEFINE_GUID(CLSID_NullRend,
0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00);

// Fill in media type information below, this information is used
when
registering the filter with dshow
const AMOVIESETUP_MEDIATYPE sudPinTypes =
{ &MEDIATYPE_NULL, &MEDIASUBTYPE_NULL };
const AMOVIESETUP_PIN sudPins =
{ L"Null", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, 1,
&sudPinTypes };
const AMOVIESETUP_FILTER sudNULL =
{ &CLSID_NullRend, L"NullRend", MERIT_DO_NOT_USE, 1, &sudPins };

// this filter is based off of the base renderer, so it has 1 input
pin and
no output pins.
// It's currently a no-op renderer which will connect to anything
(CheckMediaType always
// succeeds and DoRenderSample does nothing with the sample.
class CNullRend : public CBaseRenderer
{
public:
DECLARE_IUNKNOWN;

CNullRend(LPUNKNOWN pUnk, HRESULT *phr) :
CBaseRenderer(CLSID_NullRend, NAME("CNullRend"), pUnk, phr)
{}

static CUnknown* WINAPI CreateInstance(LPUNKNOWN punk, HRESULT
*phr)

{ return
new CNullRend(punk, phr); }
HRESULT CheckMediaType(const CMediaType *pMT) { return S_OK; }
// This is called for each media sample received.
HRESULT DoRenderSample(IMediaSample *pMediaSample) { return
S_OK; }
// this is necessary for automatic registration of the filter when
doing
a regsvr32.
AMOVIESETUP_FILTER *GetSetupData() { return((AMOVIESETUP_FILTER
*)&sudNULL); }

private:

};

CFactoryTemplate g_Templates[] =
{ L"NullRend", &CLSID_NullRend, CNullRend::CreateInstance, NULL,
&sudNULL };
int g_cTemplates = 1;

End NULLREND.cpp =================================- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -


.



Relevant Pages

  • Re: Simple custom filter crash (AddRef()) on Windows Mobile 5.0
    ... I am using "regsvrce.exe" to register the filter. ... const AMOVIESETUP_MEDIATYPE sudPinTypes = ... CBaseRenderer, pUnk, phr) ...
    (microsoft.public.windowsce.app.development)
  • I Cant register the custom directshow filter in debug entironment on Windows Mobile 5.0 device
    ... These exports are necessary in order for com to register the filter ... CSampleGrabber(LPUNKNOWN pUnk, HRESULT *phr); ... HRESULT CheckMediaType(const CMediaType *pMT); ... // this is needed for COM to register the component with RegSvr ...
    (microsoft.public.pocketpc.developer)
  • Re: can you give me some advice or some samples?
    ... now i even can't compile dshow sdk's filter samples correctly on wm5.0. ... ** I successed to compile + register NullRend and SampleGrabber. ... const AMOVIESETUP_MEDIATYPE sudPinTypes = ... HRESULT CSampleGrabber::CheckMediaType ...
    (microsoft.public.pocketpc.developer)
  • Problem (crashing) registering null renderer graph filter
    ... I am having this problem trying to build a really simple graph filter that ... CSampleGrabber(LPUNKNOWN pUnk, HRESULT *phr); ... HRESULT CheckMediaType(const CMediaType *pMT); ... // this is needed for COM to register the component with RegSvr ...
    (microsoft.public.windowsce.app.development)
  • Re: Problem with Registering filter on windows mobile
    ... If you install the desktop DirectX SDK, the sample grabber filter shipped ... with that will register and work on windows mobile. ... but not with the Windows Mobile SDK yet. ... STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName,AM_MEDIA_TYPE ...
    (microsoft.public.windowsce.app.development)

Quantcast