Discussion:
Problem with Registering filter on windows mobile
(too old to reply)
suresh
2007-02-15 13:14:03 UTC
Permalink
Hi,

I am facing following couple of problems with ds filter. Can you
please give your comment on these issues.
Thanks,


Issue1: Problem with Registering filter
Normally we use the following function to register the filter.
STDAPI DllRegisterServer(void)
{
return AMovieDllRegisterServer( );
}

This function should register the dll with filter informations that
are provided in struct `AMOVIESETUP_FILTER`.

But when I call this function, only the dll informations are getting
registered ( clsid & dll name) but not the filter information (pins,
media types etc). At the same time the function always returns failure
on windows mobile. Someone says it is not supported on windows mobile.

I have found that `IFilterMapper` interface can used to register the
information of filter, so changed the function as mentioned below. Is
it the right thing to do?

STDAPI DllRegisterServer(void)
{
HRESULT hr = AMovieDllRegisterServer( );
IFilterMapper *pFm = 0;
hr = pFm->RegisterFilter()
hr = pFm->RegisterPin()
hr = pFm->RegisterPinType()
pFm->Release();
}

Issue2: Not able to use Registered filter.
We use "CoCreateFunction(CLSID_NEEDFILTER)" function to get the
registered filter. But it always returns the error "Error in the dll"
on emulator. I have used some other functions
(LoadLibrary ,GetProcAddress ) to make sure that the dll got
registered properly. Any solution for this issue?
Amit
2007-02-16 05:42:05 UTC
Permalink
DirectShow is supported on Windows Mobile 5.
Debug your code and see where its failing.
To debug it Write an exe that does
LoadLibrary->GetProcAddress(DllRegisterServer) and the call the function.
--
Thanks and Regards
Amit Ranjan
blog:http://amitranjan.wordpress.com
Post by suresh
Hi,
I am facing following couple of problems with ds filter. Can you
please give your comment on these issues.
Thanks,
Issue1: Problem with Registering filter
Normally we use the following function to register the filter.
STDAPI DllRegisterServer(void)
{
return AMovieDllRegisterServer( );
}
This function should register the dll with filter informations that
are provided in struct `AMOVIESETUP_FILTER`.
But when I call this function, only the dll informations are getting
registered ( clsid & dll name) but not the filter information (pins,
media types etc). At the same time the function always returns failure
on windows mobile. Someone says it is not supported on windows mobile.
I have found that `IFilterMapper` interface can used to register the
information of filter, so changed the function as mentioned below. Is
it the right thing to do?
STDAPI DllRegisterServer(void)
{
HRESULT hr = AMovieDllRegisterServer( );
IFilterMapper *pFm = 0;
hr = pFm->RegisterFilter()
hr = pFm->RegisterPin()
hr = pFm->RegisterPinType()
pFm->Release();
}
Issue2: Not able to use Registered filter.
We use "CoCreateFunction(CLSID_NEEDFILTER)" function to get the
registered filter. But it always returns the error "Error in the dll"
on emulator. I have used some other functions
(LoadLibrary ,GetProcAddress ) to make sure that the dll got
registered properly. Any solution for this issue?
Gary Daniels [MS]
2007-02-16 21:50:26 UTC
Permalink
I suspect your problem is because of a slight difference between DirectShow
on desktop Windows and Windows Mobile. Add the following function to your
source file (this particular version is from the sample grabber filter):

#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CSampleGrabber::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudSampleGrabber; }
#endif

Without this function defined the DirectShow registration doesn't work, but
the dll registration does.

Gary Daniels
Windows CE Multimedia and Graphics

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by suresh
Hi,
I am facing following couple of problems with ds filter. Can you
please give your comment on these issues.
Thanks,
Issue1: Problem with Registering filter
Normally we use the following function to register the filter.
STDAPI DllRegisterServer(void)
{
return AMovieDllRegisterServer( );
}
This function should register the dll with filter informations that
are provided in struct `AMOVIESETUP_FILTER`.
But when I call this function, only the dll informations are getting
registered ( clsid & dll name) but not the filter information (pins,
media types etc). At the same time the function always returns failure
on windows mobile. Someone says it is not supported on windows mobile.
I have found that `IFilterMapper` interface can used to register the
information of filter, so changed the function as mentioned below. Is
it the right thing to do?
STDAPI DllRegisterServer(void)
{
HRESULT hr = AMovieDllRegisterServer( );
IFilterMapper *pFm = 0;
hr = pFm->RegisterFilter()
hr = pFm->RegisterPin()
hr = pFm->RegisterPinType()
pFm->Release();
}
Issue2: Not able to use Registered filter.
We use "CoCreateFunction(CLSID_NEEDFILTER)" function to get the
registered filter. But it always returns the error "Error in the dll"
on emulator. I have used some other functions
(LoadLibrary ,GetProcAddress ) to make sure that the dll got
registered properly. Any solution for this issue?
suresh
2007-02-21 14:36:17 UTC
Permalink
Dear Gary Daniels,

Thanks you so much for looking at this issue.

I have added the function which you had given, but it was not getting
called while invoking AMovieDllRegisterServer() function, But I am
getting the crash in AddRef(void) function . Following is the stack
trace of the crash.

SourceFilter.dll!CFruitFilter::AddRef(void) Line: 37, Byte Offsets:
0x10
SourceFilter.dll!GetInterface(IUnknown* pUnk = 0x00120630, void** ppv
= 0x2611f198) Line: 213, Byte Offsets: 0x28
SourceFilter.dll!CBaseFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x00000000) Line: 319, Byte
SourceFilter.dll!CFruitFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x2611f198) Line: 224, Byte
SourceFilter.dll!CClassFactory::CreateInstance(IUnknown* pUnkOuter =
0x2611f198, _GUID& riid = {...},
SourceFilter.dll!AMovieDllRegisterServer(void) Line: 410, Byte
Offsets: 0x130 C++

Can you able to make out whether I am doing any mistake here ? For
last 2 weeks, I have been trying to create ds filter , but still not
able to get. I have attached the source code of my filter. Can you
please look at this issue and give your feedback?

I am not able to find any sample custom filter for windows mobile 5.0.
Is it possible to get atlease one simple filter for windows mobile
5.0?

Thanks & regards,
Awaiting for your kind response...

*.h File:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CFruitFilter: public CSource, public IFileSourceFilter
{
public:
static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT
*phr);
OLECHAR m_szFileName[_MAX_PATH];
private:
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef()
{
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release()
{
return GetOwner()->Release();
};
STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName,AM_MEDIA_TYPE
*pmt);
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE
__RPC_FAR *pmt);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **
ppv);

CFruitFilter(LPUNKNOWN lpunk, HRESULT *phr);

LPAMOVIESETUP_FILTER GetSetupData();
};
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++
.cpp file
// SourceFilter.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>

#include <streams.h>
#include <olectl.h>
#include <initguid.h>
#include "js97uuid.h"
#include "fFilter.h"
#include "fTxtStrm.h"


extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
BOOL a= DllEntryPoint((HINSTANCE)(hModule), ul_reason_for_call,
lpReserved);

return TRUE;
}


STDAPI DllRegisterServer()
{

hr = AMovieDllRegisterServer1( );
//return hr;
hr = CoCreateInstance( CLSID_FilterMapper
, NULL
, CLSCTX_INPROC_SERVER
, IID_IFilterMapper
, (void **)&pFm );

if(FAILED(hr))
return hr;

hr = pFm->RegisterFilter(
CLSID_FruitFilter,
L"ABC - Invert Filter", // name shown to the user
MERIT_DO_NOT_USE);


hr = pFm->RegisterPin(CLSID_FruitFilter,L"Output", FALSE, TRUE,
FALSE, FALSE, CLSID_NULL,NULL);
hr = pFm-
RegisterPinType(CLSID_FruitFilter,L"Output",MEDIATYPE_JS97Text,MEDIASUBTYPE_NULL);
return hr;
}


//
// DllUnregisterServer
//
STDAPI DllUnregisterServer()
{
TCHAR achTemp[MAX_PATH];
OLECHAR szCLSID[CHARS_IN_GUID];

// Convert GUID to a string
HRESULT hr = StringFromGUID2( MEDIATYPE_JS97Text, szCLSID,
CHARS_IN_GUID );

// Delete Key in registry
wsprintf( achTemp, L"Media Type\\%ls", szCLSID);
RegDeleteKey(HKEY_CLASSES_ROOT, (LPCTSTR)achTemp);

return AMovieDllUnregisterServer( );

}


const AMOVIESETUP_MEDIATYPE sudOpPinTypes =
{
&MEDIATYPE_JS97Text, // Major type
&MEDIASUBTYPE_NULL // Minor type
};

const AMOVIESETUP_PIN sudOpPin =
{
L"Text", // Pin string name
FALSE, // Is it rendered
TRUE, // Is it an output
FALSE, // Can we have none
FALSE, // Can we have many
&CLSID_NULL, // Connects to filter
NULL, // Connects to pin
1, // Number of types
&sudOpPinTypes }; // Pin details

AMOVIESETUP_FILTER sudFruitFilter=
{
&CLSID_FruitFilter, // Filter CLSID
L"ABC - Fruit Source Filter", // String name
MERIT_DO_NOT_USE, // Filter merit
1, // Number pins
&sudOpPin // Pin details
};


// COM global table of objects in this dll

CFactoryTemplate g_Templates[] = {
{ L"ABC - Fruit Source Filter"
, &CLSID_FruitFilter
, CFruitFilter::CreateInstance
, NULL
, &sudFruitFilter }
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);



// CreateInstance
//
CUnknown * WINAPI CFruitFilter::CreateInstance(LPUNKNOWN lpunk,
HRESULT *phr)
{
CUnknown *punk = new CFruitFilter(lpunk, phr);
if (punk == NULL) {
*phr = E_OUTOFMEMORY;
}
return punk;

}


// Constructor
CFruitFilter::CFruitFilter(LPUNKNOWN lpunk, HRESULT *phr) :
CSource(NAME("Fruit Source Filter"), lpunk, CLSID_FruitFilter)
{
CAutoLock cAutoLock(&m_cStateLock);

new CFruitStreamText(phr, this, L"Text!");
if (m_paStreams[0] == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
}



// NonDelegatingQueryInterface

STDMETHODIMP CFruitFilter::NonDelegatingQueryInterface(REFIID riid,
void ** ppv)
{
CheckPointer(ppv,E_POINTER);
//CAutoLock lock(&m_Lock);

// Do we have this interface
if (riid == IID_IFileSourceFilter)
return GetInterface((IFileSourceFilter *) this, ppv);

return CSource::NonDelegatingQueryInterface(riid, ppv);
}




#include <string.h>

STDMETHODIMP CFruitFilter::Load(LPCOLESTR pszFileName,const
AM_MEDIA_TYPE *pmt)
{


wcscpy(m_szFileName, pszFileName);
return NOERROR;
}

STDMETHODIMP CFruitFilter::GetCurFile(LPOLESTR *
ppszFileName,AM_MEDIA_TYPE *pmt)
{
CheckPointer(ppszFileName, E_POINTER);
*ppszFileName = (LPOLESTR)
CoTaskMemAlloc(sizeof(WCHAR) * (1+lstrlenW(m_szFileName)));
if (*ppszFileName != NULL) {
wcscpy(*ppszFileName, m_szFileName);
}

if(pmt) {
ZeroMemory(pmt, sizeof(*pmt));
pmt->majortype = MEDIATYPE_NULL;
pmt->subtype = MEDIASUBTYPE_NULL;
}
return S_OK;
}


#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CFruitFilter::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudFruitFilter; }
#endif
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I suspect your problem is because of a slight difference between DirectShow
on desktop Windows and Windows Mobile. Add the following function to your
#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CSampleGrabber::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudSampleGrabber; }
#endif
Without this function defined the DirectShow registration doesn't work, but
the dll registration does.
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by suresh
Hi,
I am facing following couple of problems with ds filter. Can you
please give your comment on these issues.
Thanks,
Issue1: Problem with Registering filter
Normally we use the following function to register the filter.
STDAPI DllRegisterServer(void)
{
return AMovieDllRegisterServer( );
}
This function should register the dll with filter informations that
are provided in struct `AMOVIESETUP_FILTER`.
But when I call this function, only the dll informations are getting
registered ( clsid & dll name) but not the filter information (pins,
media types etc). At the same time the function always returns failure
on windows mobile. Someone says it is not supported on windows mobile.
I have found that `IFilterMapper` interface can used to register the
information of filter, so changed the function as mentioned below. Is
it the right thing to do?
STDAPI DllRegisterServer(void)
{
HRESULT hr = AMovieDllRegisterServer( );
IFilterMapper *pFm = 0;
hr = pFm->RegisterFilter()
hr = pFm->RegisterPin()
hr = pFm->RegisterPinType()
pFm->Release();
}
Issue2: Not able to use Registered filter.
We use "CoCreateFunction(CLSID_NEEDFILTER)" function to get the
registered filter. But it always returns the error "Error in the dll"
on emulator. I have used some other functions
(LoadLibrary ,GetProcAddress ) to make sure that the dll got
registered properly. Any solution for this issue?- Hide quoted text -
- Show quoted text -
Gary Daniels [MS]
2007-02-21 19:09:40 UTC
Permalink
If you install the desktop DirectX SDK, the sample grabber filter shipped
with that will register and work on windows mobile. The only modification
necessary is the addition of GetSetupData. Sample filters are shipped with
Windows CE, but not with the Windows Mobile SDK yet. You could download the
evaluation version of Windows CE to look at them.

AMovieDllRegisterServer has been deprecated, try using
AMovieDllRegisterServer2 instead. It will use the setup data to register the
filter, so you don't need to call RegisterFilter, RegisterPins, etc.

Gary Daniels
Windows CE Multimedia and Graphics

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by suresh
Dear Gary Daniels,
Thanks you so much for looking at this issue.
I have added the function which you had given, but it was not getting
called while invoking AMovieDllRegisterServer() function, But I am
getting the crash in AddRef(void) function . Following is the stack
trace of the crash.
0x10
SourceFilter.dll!GetInterface(IUnknown* pUnk = 0x00120630, void** ppv
= 0x2611f198) Line: 213, Byte Offsets: 0x28
SourceFilter.dll!CBaseFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x00000000) Line: 319, Byte
SourceFilter.dll!CFruitFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x2611f198) Line: 224, Byte
SourceFilter.dll!CClassFactory::CreateInstance(IUnknown* pUnkOuter =
0x2611f198, _GUID& riid = {...},
SourceFilter.dll!AMovieDllRegisterServer(void) Line: 410, Byte
Offsets: 0x130 C++
Can you able to make out whether I am doing any mistake here ? For
last 2 weeks, I have been trying to create ds filter , but still not
able to get. I have attached the source code of my filter. Can you
please look at this issue and give your feedback?
I am not able to find any sample custom filter for windows mobile 5.0.
Is it possible to get atlease one simple filter for windows mobile
5.0?
Thanks & regards,
Awaiting for your kind response...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CFruitFilter: public CSource, public IFileSourceFilter
{
static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT
*phr);
OLECHAR m_szFileName[_MAX_PATH];
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef()
{
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release()
{
return GetOwner()->Release();
};
STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName,AM_MEDIA_TYPE
*pmt);
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE
__RPC_FAR *pmt);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **
ppv);
CFruitFilter(LPUNKNOWN lpunk, HRESULT *phr);
LPAMOVIESETUP_FILTER GetSetupData();
};
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++
.cpp file
// SourceFilter.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <streams.h>
#include <olectl.h>
#include <initguid.h>
#include "js97uuid.h"
#include "fFilter.h"
#include "fTxtStrm.h"
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
BOOL a= DllEntryPoint((HINSTANCE)(hModule), ul_reason_for_call,
lpReserved);
return TRUE;
}
STDAPI DllRegisterServer()
{
hr = AMovieDllRegisterServer1( );
//return hr;
hr = CoCreateInstance( CLSID_FilterMapper
, NULL
, CLSCTX_INPROC_SERVER
, IID_IFilterMapper
, (void **)&pFm );
if(FAILED(hr))
return hr;
hr = pFm->RegisterFilter(
CLSID_FruitFilter,
L"ABC - Invert Filter", // name shown to the user
MERIT_DO_NOT_USE);
hr = pFm->RegisterPin(CLSID_FruitFilter,L"Output", FALSE, TRUE,
FALSE, FALSE, CLSID_NULL,NULL);
hr = pFm-
RegisterPinType(CLSID_FruitFilter,L"Output",MEDIATYPE_JS97Text,MEDIASUBTYPE_NULL);
return hr;
}
//
// DllUnregisterServer
//
STDAPI DllUnregisterServer()
{
TCHAR achTemp[MAX_PATH];
OLECHAR szCLSID[CHARS_IN_GUID];
// Convert GUID to a string
HRESULT hr = StringFromGUID2( MEDIATYPE_JS97Text, szCLSID,
CHARS_IN_GUID );
// Delete Key in registry
wsprintf( achTemp, L"Media Type\\%ls", szCLSID);
RegDeleteKey(HKEY_CLASSES_ROOT, (LPCTSTR)achTemp);
return AMovieDllUnregisterServer( );
}
const AMOVIESETUP_MEDIATYPE sudOpPinTypes =
{
&MEDIATYPE_JS97Text, // Major type
&MEDIASUBTYPE_NULL // Minor type
};
const AMOVIESETUP_PIN sudOpPin =
{
L"Text", // Pin string name
FALSE, // Is it rendered
TRUE, // Is it an output
FALSE, // Can we have none
FALSE, // Can we have many
&CLSID_NULL, // Connects to filter
NULL, // Connects to pin
1, // Number of types
&sudOpPinTypes }; // Pin details
AMOVIESETUP_FILTER sudFruitFilter=
{
&CLSID_FruitFilter, // Filter CLSID
L"ABC - Fruit Source Filter", // String name
MERIT_DO_NOT_USE, // Filter merit
1, // Number pins
&sudOpPin // Pin details
};
// COM global table of objects in this dll
CFactoryTemplate g_Templates[] = {
{ L"ABC - Fruit Source Filter"
, &CLSID_FruitFilter
, CFruitFilter::CreateInstance
, NULL
, &sudFruitFilter }
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
// CreateInstance
//
CUnknown * WINAPI CFruitFilter::CreateInstance(LPUNKNOWN lpunk,
HRESULT *phr)
{
CUnknown *punk = new CFruitFilter(lpunk, phr);
if (punk == NULL) {
*phr = E_OUTOFMEMORY;
}
return punk;
}
// Constructor
CSource(NAME("Fruit Source Filter"), lpunk, CLSID_FruitFilter)
{
CAutoLock cAutoLock(&m_cStateLock);
new CFruitStreamText(phr, this, L"Text!");
if (m_paStreams[0] == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
}
// NonDelegatingQueryInterface
STDMETHODIMP CFruitFilter::NonDelegatingQueryInterface(REFIID riid,
void ** ppv)
{
CheckPointer(ppv,E_POINTER);
//CAutoLock lock(&m_Lock);
// Do we have this interface
if (riid == IID_IFileSourceFilter)
return GetInterface((IFileSourceFilter *) this, ppv);
return CSource::NonDelegatingQueryInterface(riid, ppv);
}
#include <string.h>
STDMETHODIMP CFruitFilter::Load(LPCOLESTR pszFileName,const
AM_MEDIA_TYPE *pmt)
{
wcscpy(m_szFileName, pszFileName);
return NOERROR;
}
STDMETHODIMP CFruitFilter::GetCurFile(LPOLESTR *
ppszFileName,AM_MEDIA_TYPE *pmt)
{
CheckPointer(ppszFileName, E_POINTER);
*ppszFileName = (LPOLESTR)
CoTaskMemAlloc(sizeof(WCHAR) * (1+lstrlenW(m_szFileName)));
if (*ppszFileName != NULL) {
wcscpy(*ppszFileName, m_szFileName);
}
if(pmt) {
ZeroMemory(pmt, sizeof(*pmt));
pmt->majortype = MEDIATYPE_NULL;
pmt->subtype = MEDIASUBTYPE_NULL;
}
return S_OK;
}
#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CFruitFilter::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudFruitFilter; }
#endif
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I suspect your problem is because of a slight difference between DirectShow
on desktop Windows and Windows Mobile. Add the following function to your
#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CSampleGrabber::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudSampleGrabber; }
#endif
Without this function defined the DirectShow registration doesn't work, but
the dll registration does.
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by suresh
Hi,
I am facing following couple of problems with ds filter. Can you
please give your comment on these issues.
Thanks,
Issue1: Problem with Registering filter
Normally we use the following function to register the filter.
STDAPI DllRegisterServer(void)
{
return AMovieDllRegisterServer( );
}
This function should register the dll with filter informations that
are provided in struct `AMOVIESETUP_FILTER`.
But when I call this function, only the dll informations are getting
registered ( clsid & dll name) but not the filter information (pins,
media types etc). At the same time the function always returns failure
on windows mobile. Someone says it is not supported on windows mobile.
I have found that `IFilterMapper` interface can used to register the
information of filter, so changed the function as mentioned below. Is
it the right thing to do?
STDAPI DllRegisterServer(void)
{
HRESULT hr = AMovieDllRegisterServer( );
IFilterMapper *pFm = 0;
hr = pFm->RegisterFilter()
hr = pFm->RegisterPin()
hr = pFm->RegisterPinType()
pFm->Release();
}
Issue2: Not able to use Registered filter.
We use "CoCreateFunction(CLSID_NEEDFILTER)" function to get the
registered filter. But it always returns the error "Error in the dll"
on emulator. I have used some other functions
(LoadLibrary ,GetProcAddress ) to make sure that the dll got
registered properly. Any solution for this issue?- Hide quoted text -
- Show quoted text -
suresh
2007-02-22 10:09:16 UTC
Permalink
Dear Gary Daniels,

Thank you for your update.

I tried to use `Sample Grabber` directshow filter on windows mobile
5.0, but I got the same issue (crash in AddRef() ) as mentioned in my
earlier discussion.

Issue: Crashing when the CSampleGrabber constructor is called and it
calls the CBaseRenderer constructor. If I replace DECLARE_IUNKNOWN in
SampleGrabber.h with the expanded macro then I see it is crashing in
AddRef because GetOwner() is returning 0x000001 andthen crashing on
GetOwner()->AddRef().

It looks like few other people are also facing the same issue.

e.g
1. http://www.itpost.cn/en/1951/posts/195130814.shtml
2.
http://groups.google.co.in/group/microsoft.public.pocketpc.developer/browse_thread/thread/73d9baf31bf9f877/18de5059b33ec9c3?lnk=st&q=Sample+Grabber+windows+mobile&rnum=2&hl=en#18de5059b33ec9c3

3. http://www.eggheadcafe.com/forumarchives/win32programmerdirectxaudio/sep2005/post23723142.asp

Please let me know if you have any comment on link(1) & link(2).

Is it possible for you to provide the solution for our problem? It
will be really useful for everyone who develops a ds filter windows
mobile 5.0.

Awaiting for your response,
Thanks & Regards,





On Feb 22, 12:09 am, "Gary Daniels [MS]"
If you install the desktop DirectX SDK, the sample grabberfiltershipped
with that will register and work onwindowsmobile. The only modification
necessary is the addition of GetSetupData. Sample filters are shipped withWindowsCE, but not with theWindowsMobileSDK yet. You could download the
evaluation version ofWindowsCE to look at them.
AMovieDllRegisterServer has been deprecated, try using
AMovieDllRegisterServer2 instead. It will use the setup data to register thefilter, so you don't need to call RegisterFilter, RegisterPins, etc.
Gary DanielsWindowsCE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by suresh
Dear Gary Daniels,
Thanks you so much for looking at this issue.
I have added the function which you had given, but it was not getting
called while invoking AMovieDllRegisterServer() function, But I am
getting the crash in AddRef(void) function . Following is the stack
trace of the crash.
0x10
SourceFilter.dll!GetInterface(IUnknown* pUnk = 0x00120630, void** ppv
= 0x2611f198) Line: 213, Byte Offsets: 0x28
SourceFilter.dll!CBaseFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x00000000) Line: 319, Byte
SourceFilter.dll!CFruitFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x2611f198) Line: 224, Byte
SourceFilter.dll!CClassFactory::CreateInstance(IUnknown* pUnkOuter =
0x2611f198, _GUID& riid = {...},
SourceFilter.dll!AMovieDllRegisterServer(void) Line: 410, Byte
Offsets: 0x130 C++
Can you able to make out whether I am doing any mistake here ? For
last 2 weeks, I have been trying to create dsfilter, but still not
able to get. I have attached the source code of myfilter. Can you
please look at this issue and give your feedback?
I am not able to find any sample customfilterforwindowsmobile5.0.
Is it possible to get atlease one simplefilterforwindowsmobile
5.0?
Thanks & regards,
Awaiting for your kind response...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CFruitFilter: public CSource, public IFileSourceFilter
{
static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT
*phr);
OLECHAR m_szFileName[_MAX_PATH];
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef()
{
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release()
{
return GetOwner()->Release();
};
STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName,AM_MEDIA_TYPE
*pmt);
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE
__RPC_FAR *pmt);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **
ppv);
CFruitFilter(LPUNKNOWN lpunk, HRESULT *phr);
LPAMOVIESETUP_FILTER GetSetupData();
};
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++
.cpp file
// SourceFilter.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <streams.h>
#include <olectl.h>
#include <initguid.h>
#include "js97uuid.h"
#include "fFilter.h"
#include "fTxtStrm.h"
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
BOOL a= DllEntryPoint((HINSTANCE)(hModule), ul_reason_for_call,
lpReserved);
return TRUE;
}
STDAPI DllRegisterServer()
{
hr = AMovieDllRegisterServer1( );
//return hr;
hr = CoCreateInstance( CLSID_FilterMapper
, NULL
, CLSCTX_INPROC_SERVER
, IID_IFilterMapper
, (void **)&pFm );
if(FAILED(hr))
return hr;
hr = pFm->RegisterFilter(
CLSID_FruitFilter,
L"ABC - InvertFilter", // name shown to the user
MERIT_DO_NOT_USE);
hr = pFm->RegisterPin(CLSID_FruitFilter,L"Output", FALSE, TRUE,
FALSE, FALSE, CLSID_NULL,NULL);
hr = pFm-
RegisterPinType(CLSID_FruitFilter,L"Output",MEDIATYPE_JS97Text,MEDIASUBTY­PE_NULL);
return hr;
}
//
// DllUnregisterServer
//
STDAPI DllUnregisterServer()
{
TCHAR achTemp[MAX_PATH];
OLECHAR szCLSID[CHARS_IN_GUID];
// Convert GUID to a string
HRESULT hr = StringFromGUID2( MEDIATYPE_JS97Text, szCLSID,
CHARS_IN_GUID );
// Delete Key in registry
wsprintf( achTemp, L"Media Type\\%ls", szCLSID);
RegDeleteKey(HKEY_CLASSES_ROOT, (LPCTSTR)achTemp);
return AMovieDllUnregisterServer( );
}
const AMOVIESETUP_MEDIATYPE sudOpPinTypes =
{
&MEDIATYPE_JS97Text, // Major type
&MEDIASUBTYPE_NULL // Minor type
};
const AMOVIESETUP_PIN sudOpPin =
{
L"Text", // Pin string name
FALSE, // Is it rendered
TRUE, // Is it an output
FALSE, // Can we have none
FALSE, // Can we have many
&CLSID_NULL, // Connects tofilter
NULL, // Connects to pin
1, // Number of types
&sudOpPinTypes }; // Pin details
AMOVIESETUP_FILTER sudFruitFilter=
{
&CLSID_FruitFilter, //FilterCLSID
L"ABC - Fruit SourceFilter", // String name
MERIT_DO_NOT_USE, //Filtermerit
1, // Number pins
&sudOpPin // Pin details
};
// COM global table of objects in this dll
CFactoryTemplate g_Templates[] = {
{ L"ABC - Fruit SourceFilter"
, &CLSID_FruitFilter
, CFruitFilter::CreateInstance
, NULL
, &sudFruitFilter }
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
// CreateInstance
//
CUnknown * WINAPI CFruitFilter::CreateInstance(LPUNKNOWN lpunk,
HRESULT *phr)
{
CUnknown *punk = new CFruitFilter(lpunk, phr);
if (punk == NULL) {
*phr = E_OUTOFMEMORY;
}
return punk;
}
// Constructor
CSource(NAME("Fruit SourceFilter"), lpunk, CLSID_FruitFilter)
{
CAutoLock cAutoLock(&m_cStateLock);
new CFruitStreamText(phr, this, L"Text!");
if (m_paStreams[0] == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
}
// NonDelegatingQueryInterface
STDMETHODIMP CFruitFilter::NonDelegatingQueryInterface(REFIID riid,
void ** ppv)
{
CheckPointer(ppv,E_POINTER);
//CAutoLock lock(&m_Lock);
// Do we have this interface
if (riid == IID_IFileSourceFilter)
return GetInterface((IFileSourceFilter *) this, ppv);
return CSource::NonDelegatingQueryInterface(riid, ppv);
}
#include <string.h>
STDMETHODIMP CFruitFilter::Load(LPCOLESTR pszFileName,const
AM_MEDIA_TYPE *pmt)
{
wcscpy(m_szFileName, pszFileName);
return NOERROR;
}
STDMETHODIMP CFruitFilter::GetCurFile(LPOLESTR *
ppszFileName,AM_MEDIA_TYPE *pmt)
{
CheckPointer(ppszFileName, E_POINTER);
*ppszFileName = (LPOLESTR)
CoTaskMemAlloc(sizeof(WCHAR) * (1+lstrlenW(m_szFileName)));
if (*ppszFileName != NULL) {
wcscpy(*ppszFileName, m_szFileName);
}
if(pmt) {
ZeroMemory(pmt, sizeof(*pmt));
pmt->majortype = MEDIATYPE_NULL;
pmt->subtype = MEDIASUBTYPE_NULL;
}
return S_OK;
}
#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CFruitFilter::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudFruitFilter; }
#endif
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I suspect your problem is because of a slight difference between DirectShow
on desktopWindowsandWindowsMobile. Add the following function to your
#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CSampleGrabber::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudSampleGrabber; }
#endif
Without this function defined theDirectShowregistration doesn't work,
but
the dll registration does.
Gary Daniels
WindowsCE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Hi,
I am facing following couple of problems with dsfilter. Can you
please give your comment on these issues.
Thanks,
Issue1: Problem with Registeringfilter
Normally we use the following function to register thefilter.
STDAPI DllRegisterServer(void)
{
return AMovieDllRegisterServer( );
}
This function should register the dll withfilterinformations that
are provided in struct `AMOVIESETUP_FILTER`.
But when I call this function, only the dll informations are getting
registered ( clsid & dll name) but not thefilterinformation (pins,
media types etc). At the same time the function always returns failure
onwindowsmobile. Someone says it is not supported onwindowsmobile.
I have found that `IFilterMapper` interface can used to register the
information offilter, so changed the function as mentioned below. Is
it the right thing to do?
STDAPI
...
read more »- Hide quoted text -
- Show quoted text -
suresh
2007-02-23 15:35:54 UTC
Permalink
Dear Gary Daniels,

Any suggestion/solution for the probelm?

Regards,
Post by suresh
Dear Gary Daniels,
Thank you for your update.
I tried to use `Sample Grabber` directshow filter on windows mobile
5.0, but I got the same issue (crash in AddRef() ) as mentioned in my
earlier discussion.
Issue: Crashing when the CSampleGrabber constructor is called and it
calls the CBaseRenderer constructor. If I replace DECLARE_IUNKNOWN in
SampleGrabber.h with the expanded macro then I see it is crashing in
AddRef because GetOwner() is returning 0x000001 andthen crashing on
GetOwner()->AddRef().
It looks like few other people are also facing the same issue.
e.g
1.http://www.itpost.cn/en/1951/posts/195130814.shtml
2.http://groups.google.co.in/group/microsoft.public.pocketpc.developer/...
3.http://www.eggheadcafe.com/forumarchives/win32programmerdirectxaudio/...
Please let me know if you have any comment on link(1) & link(2).
Is it possible for you to provide the solution for our problem? It
will be really useful for everyone who develops a ds filter windows
mobile 5.0.
Awaiting for your response,
Thanks & Regards,
On Feb 22, 12:09 am, "Gary Daniels [MS]"
If you install the desktop DirectX SDK, the sample grabberfiltershipped
with that will register and work onwindowsmobile. The only modification
necessary is the addition of GetSetupData. Sample filters are shipped withWindowsCE, but not with theWindowsMobileSDK yet. You could download the
evaluation version ofWindowsCE to look at them.
AMovieDllRegisterServer has been deprecated, try using
AMovieDllRegisterServer2 instead. It will use the setup data to register thefilter, so you don't need to call RegisterFilter, RegisterPins, etc.
Gary DanielsWindowsCE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by suresh
Dear Gary Daniels,
Thanks you so much for looking at this issue.
I have added the function which you had given, but it was not getting
called while invoking AMovieDllRegisterServer() function, But I am
getting the crash in AddRef(void) function . Following is the stack
trace of the crash.
0x10
SourceFilter.dll!GetInterface(IUnknown* pUnk = 0x00120630, void** ppv
= 0x2611f198) Line: 213, Byte Offsets: 0x28
SourceFilter.dll!CBaseFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x00000000) Line: 319, Byte
SourceFilter.dll!CFruitFilter::NonDelegatingQueryInterface(_GUID& riid
= {...}, void** ppv = 0x2611f198) Line: 224, Byte
SourceFilter.dll!CClassFactory::CreateInstance(IUnknown* pUnkOuter =
0x2611f198, _GUID& riid = {...},
SourceFilter.dll!AMovieDllRegisterServer(void) Line: 410, Byte
Offsets: 0x130 C++
Can you able to make out whether I am doing any mistake here ? For
last 2 weeks, I have been trying to create dsfilter, but still not
able to get. I have attached the source code of myfilter. Can you
please look at this issue and give your feedback?
I am not able to find any sample customfilterforwindowsmobile5.0.
Is it possible to get atlease one simplefilterforwindowsmobile
5.0?
Thanks & regards,
Awaiting for your kind response...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CFruitFilter: public CSource, public IFileSourceFilter
{
static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT
*phr);
OLECHAR m_szFileName[_MAX_PATH];
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef()
{
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release()
{
return GetOwner()->Release();
};
STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName,AM_MEDIA_TYPE
*pmt);
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE
__RPC_FAR *pmt);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **
ppv);
CFruitFilter(LPUNKNOWN lpunk, HRESULT *phr);
LPAMOVIESETUP_FILTER GetSetupData();
};
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++
.cpp file
// SourceFilter.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <streams.h>
#include <olectl.h>
#include <initguid.h>
#include "js97uuid.h"
#include "fFilter.h"
#include "fTxtStrm.h"
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
BOOL a= DllEntryPoint((HINSTANCE)(hModule), ul_reason_for_call,
lpReserved);
return TRUE;
}
STDAPI DllRegisterServer()
{
hr = AMovieDllRegisterServer1( );
//return hr;
hr = CoCreateInstance( CLSID_FilterMapper
, NULL
, CLSCTX_INPROC_SERVER
, IID_IFilterMapper
, (void **)&pFm );
if(FAILED(hr))
return hr;
hr = pFm->RegisterFilter(
CLSID_FruitFilter,
L"ABC - InvertFilter", // name shown to the user
MERIT_DO_NOT_USE);
hr = pFm->RegisterPin(CLSID_FruitFilter,L"Output", FALSE, TRUE,
FALSE, FALSE, CLSID_NULL,NULL);
hr = pFm-
RegisterPinType(CLSID_FruitFilter,L"Output",MEDIATYPE_JS97Text,MEDIASUBTY­­PE_NULL);
return hr;
}
//
// DllUnregisterServer
//
STDAPI DllUnregisterServer()
{
TCHAR achTemp[MAX_PATH];
OLECHAR szCLSID[CHARS_IN_GUID];
// Convert GUID to a string
HRESULT hr = StringFromGUID2( MEDIATYPE_JS97Text, szCLSID,
CHARS_IN_GUID );
// Delete Key in registry
wsprintf( achTemp, L"Media Type\\%ls", szCLSID);
RegDeleteKey(HKEY_CLASSES_ROOT, (LPCTSTR)achTemp);
return AMovieDllUnregisterServer( );
}
const AMOVIESETUP_MEDIATYPE sudOpPinTypes =
{
&MEDIATYPE_JS97Text, // Major type
&MEDIASUBTYPE_NULL // Minor type
};
const AMOVIESETUP_PIN sudOpPin =
{
L"Text", // Pin string name
FALSE, // Is it rendered
TRUE, // Is it an output
FALSE, // Can we have none
FALSE, // Can we have many
&CLSID_NULL, // Connects tofilter
NULL, // Connects to pin
1, // Number of types
&sudOpPinTypes }; // Pin details
AMOVIESETUP_FILTER sudFruitFilter=
{
&CLSID_FruitFilter, //FilterCLSID
L"ABC - Fruit SourceFilter", // String name
MERIT_DO_NOT_USE, //Filtermerit
1, // Number pins
&sudOpPin // Pin details
};
// COM global table of objects in this dll
CFactoryTemplate g_Templates[] = {
{ L"ABC - Fruit SourceFilter"
, &CLSID_FruitFilter
, CFruitFilter::CreateInstance
, NULL
, &sudFruitFilter }
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
// CreateInstance
//
CUnknown * WINAPI CFruitFilter::CreateInstance(LPUNKNOWN lpunk,
HRESULT *phr)
{
CUnknown *punk = new CFruitFilter(lpunk, phr);
if (punk == NULL) {
*phr = E_OUTOFMEMORY;
}
return punk;
}
// Constructor
CSource(NAME("Fruit SourceFilter"), lpunk, CLSID_FruitFilter)
{
CAutoLock cAutoLock(&m_cStateLock);
new CFruitStreamText(phr, this, L"Text!");
if (m_paStreams[0] == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
}
// NonDelegatingQueryInterface
STDMETHODIMP CFruitFilter::NonDelegatingQueryInterface(REFIID riid,
void ** ppv)
{
CheckPointer(ppv,E_POINTER);
//CAutoLock lock(&m_Lock);
// Do we have this interface
if (riid == IID_IFileSourceFilter)
return GetInterface((IFileSourceFilter *) this, ppv);
return CSource::NonDelegatingQueryInterface(riid, ppv);
}
#include <string.h>
STDMETHODIMP CFruitFilter::Load(LPCOLESTR pszFileName,const
AM_MEDIA_TYPE *pmt)
{
wcscpy(m_szFileName, pszFileName);
return NOERROR;
}
STDMETHODIMP CFruitFilter::GetCurFile(LPOLESTR *
ppszFileName,AM_MEDIA_TYPE *pmt)
{
CheckPointer(ppszFileName, E_POINTER);
*ppszFileName = (LPOLESTR)
CoTaskMemAlloc(sizeof(WCHAR) * (1+lstrlenW(m_szFileName)));
if (*ppszFileName != NULL) {
wcscpy(*ppszFileName, m_szFileName);
}
if(pmt) {
ZeroMemory(pmt, sizeof(*pmt));
pmt->majortype = MEDIATYPE_NULL;
pmt->subtype = MEDIASUBTYPE_NULL;
}
return S_OK;
}
#ifdef UNDER_CE
LPAMOVIESETUP_FILTER CFruitFilter::GetSetupData() {return
(LPAMOVIESETUP_FILTER) &sudFruitFilter; }
#endif
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I suspect your problem is because of a slight difference between DirectShow
on desktopWindowsandWindowsMobile. Add the following
...
read more »- Hide quoted text -
- Show quoted text -
j***@gmail.com
2007-02-26 10:33:21 UTC
Permalink
Dear Gary,

I am also facing exactly the same issue as Suresh. Please help us
resolve this issue. I am explaining the issue again:

I tried to build your sample ( from the link:
http://groups.google.com/group/microsoft.public.smartphone.developer/browse_thread/thread/c9a4b3a393d4aa8a/9a025c9c22b01105?lnk=st&q=CNullRend&rnum=1
) by creating a "Smart Device Win32 Dll application" (Windows Mobile
5.0 PPC). I created an empty project and added a .cpp and a .def file
and added the code you have given. When I try to register it (using
regsvrce), it fails at DECLARE_IUNKNOWN insided CNullRend Class
definition. When I replaced the DECLARE_IUNKNOWN macro with the
expansion:

STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef() {
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release() {
return GetOwner()->Release();
};

I found that it fails at return GetOwner()->AddRef(); with the error:

"Unhandled exception at 0x013c12e0 in regsvrce.exe: 0xC0000005: Access
violation reading location 0x00000001."

The same is the case with any directshow filter I try to register on
WM5.0.

Please help! I am stuck with this problem for over a month :-(

Thank you
Gary Daniels [MS]
2007-02-27 02:14:09 UTC
Permalink
I'm working on reproducing this problem, I haven't ever seen this problem
and have no guesses on the cause. I've contacted a few other people in the
Multimedia team and they also aren't aware of any problems.

I'm assuming you're using visual studio with the PPC SDK. Is there anything
you can tell me about the versions, QFE's, etc. of the tools you have
installed?

Thanks,
Gary Daniels
Windows CE Multimedia and Graphics

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by j***@gmail.com
Dear Gary,
I am also facing exactly the same issue as Suresh. Please help us
http://groups.google.com/group/microsoft.public.smartphone.developer/browse_thread/thread/c9a4b3a393d4aa8a/9a025c9c22b01105?lnk=st&q=CNullRend&rnum=1
) by creating a "Smart Device Win32 Dll application" (Windows Mobile
5.0 PPC). I created an empty project and added a .cpp and a .def file
and added the code you have given. When I try to register it (using
regsvrce), it fails at DECLARE_IUNKNOWN insided CNullRend Class
definition. When I replaced the DECLARE_IUNKNOWN macro with the
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef() {
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release() {
return GetOwner()->Release();
};
"Unhandled exception at 0x013c12e0 in regsvrce.exe: 0xC0000005: Access
violation reading location 0x00000001."
The same is the case with any directshow filter I try to register on
WM5.0.
Please help! I am stuck with this problem for over a month :-(
Thank you
raj
2007-02-27 09:01:47 UTC
Permalink
I have sent you the detail mail to your email id.

Using the following setup/tools to built DS filter for windows mobile
5.0.
- Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200)
- Windows Mobile 5.0 Pocket PC SDK:
- Strmbase.lib strmiids.lib are available in this.
- Default emulator - WM 5.0 which comes with Visual Studio.
- Using debug settings to build the project

Procedure to debug:
a) copy regsvrce.exe & NullRender.dll into `MyDevice` folder of
emulator
b) Right click the project and select property pages. it will open
up
the dialog.
c) Select "Debugging" and set Remote executable as "regsvrce" and
command argument is "NullRender.dll".
d) Keep the break point in DllRegisterServer function then press F5.
e) You will get a crash in Addref() function due to access
violations.

If possible can you please share your output dll for NULL Render. I
will try to register on my emulator and see whether it works fine for
me. You can send your dll to my email id which is mentioned in my
profile.

Thanks & Regards,
Post by Gary Daniels [MS]
I'm working on reproducing this problem, I haven't ever seen this problem
and have no guesses on the cause. I've contacted a few other people in the
Multimedia team and they also aren't aware of any problems.
I'm assuming you're using visual studio with the PPC SDK. Is there anything
you can tell me about the versions, QFE's, etc. of the tools you have
installed?
Thanks,
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by j***@gmail.com
Dear Gary,
I am also facing exactly the same issue as Suresh. Please help us
http://groups.google.com/group/microsoft.public.smartphone.developer/...
) by creating a "Smart Device Win32 Dll application" (Windows Mobile
5.0 PPC). I created an empty project and added a .cpp and a .def file
and added the code you have given. When I try to register it (using
regsvrce), it fails at DECLARE_IUNKNOWN insided CNullRend Class
definition. When I replaced the DECLARE_IUNKNOWN macro with the
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef() {
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release() {
return GetOwner()->Release();
};
"Unhandled exception at 0x013c12e0 in regsvrce.exe: 0xC0000005: Access
violation reading location 0x00000001."
The same is the case with any directshow filter I try to register on
WM5.0.
Please help! I am stuck with this problem for over a month :-(
Thank you- Hide quoted text -
- Show quoted text -
Gary Daniels [MS]
2007-03-01 00:21:54 UTC
Permalink
I was able to get this to work, here is what I found:

- same version of Visual Studio as you
- installed the WM5 PPC SDK from the microsoft web site, strmbase.lib,
mmtimer.lib, strmiids.lib are there
- used the WM5 emulator (note, it tried to default to the WM2003 emulator, i
had to select WM5, this won't work with WM2003)
- Added strmiids.lib, mmtimer.lib, strmbase.lib to the linker "additional
dependencies"
- Had to define the CLSID_NullRend guid (all 0's isn't valid)
- used retail settings. For debug "CBaseFilter::NonDelegatingRelease" is an
unresolved external because it's only defined in debug builds, but the SDK
doesn't come with the debug libraries. I'm not sure how you built as debug.
- Had to go into the project settings->C/C++->Lanugage-> turn off "Treat
wchar_t as Built-in Type". Without this were were 4 other unresolved
externals.
- modified the command line to do a regsvr on the dll
- i had some getprocaddress failures. I found that if i added a new .def to
the project using the visual studio wizard it worked, dragging and dropping
the .def file didn't seem to compile it into the project. I suspect this
isn't your problem since you're getting further than that.
- dll registration succeeded.

How did you work around the linker problems with strmbase.lib? Did you run
into the same problems when building debug? Other than the exception, is
there any other ways your experience different than my experience building
this?

BTW, the experience was much more difficult than I had expected, I'll get
the bugs filed so this becomes easier in the next release. I didn't expect
to have to turn off obscure langage settings and track down why it couldn't
link when debug. Also, I was unaware that the visual studio compiler has no
distinction between sourcelibs and target libs. In the Windows CE build
environment used in general embedded you must mark strmbase.lib as a source
lib, but that's not an issue in Visual Studio. I'm sorry if I confused you
by referring to sourcelibs, that was my own inexperience developing apps
under Visual Studio.

Gary Daniels
Windows CE Multimedia and Graphics

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by raj
I have sent you the detail mail to your email id.
Using the following setup/tools to built DS filter for windows mobile
5.0.
- Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200)
- Strmbase.lib strmiids.lib are available in this.
- Default emulator - WM 5.0 which comes with Visual Studio.
- Using debug settings to build the project
a) copy regsvrce.exe & NullRender.dll into `MyDevice` folder of
emulator
b) Right click the project and select property pages. it will open
up
the dialog.
c) Select "Debugging" and set Remote executable as "regsvrce" and
command argument is "NullRender.dll".
d) Keep the break point in DllRegisterServer function then press F5.
e) You will get a crash in Addref() function due to access
violations.
If possible can you please share your output dll for NULL Render. I
will try to register on my emulator and see whether it works fine for
me. You can send your dll to my email id which is mentioned in my
profile.
Thanks & Regards,
Post by Gary Daniels [MS]
I'm working on reproducing this problem, I haven't ever seen this problem
and have no guesses on the cause. I've contacted a few other people in the
Multimedia team and they also aren't aware of any problems.
I'm assuming you're using visual studio with the PPC SDK. Is there anything
you can tell me about the versions, QFE's, etc. of the tools you have
installed?
Thanks,
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by j***@gmail.com
Dear Gary,
I am also facing exactly the same issue as Suresh. Please help us
http://groups.google.com/group/microsoft.public.smartphone.developer/...
) by creating a "Smart Device Win32 Dll application" (Windows Mobile
5.0 PPC). I created an empty project and added a .cpp and a .def file
and added the code you have given. When I try to register it (using
regsvrce), it fails at DECLARE_IUNKNOWN insided CNullRend Class
definition. When I replaced the DECLARE_IUNKNOWN macro with the
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef() {
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release() {
return GetOwner()->Release();
};
"Unhandled exception at 0x013c12e0 in regsvrce.exe: 0xC0000005: Access
violation reading location 0x00000001."
The same is the case with any directshow filter I try to register on
WM5.0.
Please help! I am stuck with this problem for over a month :-(
Thank you- Hide quoted text -
- Show quoted text -
raj
2007-03-01 13:54:16 UTC
Permalink
Dear Gary Daniels,

Thank you so much for looking at this issue. My problem has been
resolved. The fix is to modify C/C++ preprocessor definitions in the
visual studio project settings. i.e remove "_debug" & "debug" line
from preprocessor definition.

Regards,
Post by Gary Daniels [MS]
- same version of Visual Studio as you
- installed the WM5 PPC SDK from the microsoft web site, strmbase.lib,
mmtimer.lib, strmiids.lib are there
- used the WM5 emulator (note, it tried to default to the WM2003 emulator, i
had to select WM5, this won't work with WM2003)
- Added strmiids.lib, mmtimer.lib, strmbase.lib to the linker "additional
dependencies"
- Had to define the CLSID_NullRend guid (all 0's isn't valid)
- used retail settings. For debug "CBaseFilter::NonDelegatingRelease" is an
unresolved external because it's only defined in debug builds, but the SDK
doesn't come with the debug libraries. I'm not sure how you built as debug.
- Had to go into the project settings->C/C++->Lanugage-> turn off "Treat
wchar_t as Built-in Type". Without this were were 4 other unresolved
externals.
- modified the command line to do a regsvr on the dll
- i had some getprocaddress failures. I found that if i added a new .def to
the project using the visual studio wizard it worked, dragging and dropping
the .def file didn't seem to compile it into the project. I suspect this
isn't your problem since you're getting further than that.
- dll registration succeeded.
How did you work around the linker problems with strmbase.lib? Did you run
into the same problems when building debug? Other than the exception, is
there any other ways your experience different than my experience building
this?
BTW, the experience was much more difficult than I had expected, I'll get
the bugs filed so this becomes easier in the next release. I didn't expect
to have to turn off obscure langage settings and track down why it couldn't
link when debug. Also, I was unaware that the visual studio compiler has no
distinction between sourcelibs and target libs. In the Windows CE build
environment used in general embedded you must mark strmbase.lib as a source
lib, but that's not an issue in Visual Studio. I'm sorry if I confused you
by referring to sourcelibs, that was my own inexperience developing apps
under Visual Studio.
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by raj
I have sent you the detail mail to your email id.
Using the following setup/tools to built DS filter for windows mobile
5.0.
- Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200)
- Strmbase.lib strmiids.lib are available in this.
- Default emulator - WM 5.0 which comes with Visual Studio.
- Using debug settings to build the project
a) copy regsvrce.exe & NullRender.dll into `MyDevice` folder of
emulator
b) Right click the project and select property pages. it will open
up
the dialog.
c) Select "Debugging" and set Remote executable as "regsvrce" and
command argument is "NullRender.dll".
d) Keep the break point in DllRegisterServer function then press F5.
e) You will get a crash in Addref() function due to access
violations.
If possible can you please share your output dll for NULL Render. I
will try to register on my emulator and see whether it works fine for
me. You can send your dll to my email id which is mentioned in my
profile.
Thanks & Regards,
Post by Gary Daniels [MS]
I'm working on reproducing this problem, I haven't ever seen this problem
and have no guesses on the cause. I've contacted a few other people in the
Multimedia team and they also aren't aware of any problems.
I'm assuming you're using visual studio with the PPC SDK. Is there anything
you can tell me about the versions, QFE's, etc. of the tools you have
installed?
Thanks,
Gary Daniels
Windows CE Multimedia and Graphics
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Post by j***@gmail.com
Dear Gary,
I am also facing exactly the same issue as Suresh. Please help us
http://groups.google.com/group/microsoft.public.smartphone.developer/...
) by creating a "Smart Device Win32 Dll application" (Windows Mobile
5.0 PPC). I created an empty project and added a .cpp and a .def file
and added the code you have given. When I try to register it (using
regsvrce), it fails at DECLARE_IUNKNOWN insided CNullRend Class
definition. When I replaced the DECLARE_IUNKNOWN macro with the
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) {
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef() {
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release() {
return GetOwner()->Release();
};
"Unhandled exception at 0x013c12e0 in regsvrce.exe: 0xC0000005: Access
violation reading location 0x00000001."
The same is the case with any directshow filter I try to register on
WM5.0.
Please help! I am stuck with this problem for over a month :-(
Thank you- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
Continue reading on narkive:
Loading...