Hi,
Your registration function looks
like it's almost identical to mine one (I've pasted my one in below so
that you can compare yourself).
Did your compreg.dat file
contain entries for your dll after you touched .autoreg and restarted
firefox?
I'm not really sure why your dll
isn't being called - are you sure your dll isn't being loaded by
Firefox? Maybe Firefox is loading it but because your missing something
or something is different with firefox on windows your dll is being
loaded but doesn't work? One thing I did to check if my dll was even
being loaded by firefox was to use a program called filemon (http://www.sysinternals.com/ntw2k/source/filemon.shtml)
to check if my dll was being touched when starting and running firefox.
The reason I did this is because I had a problem before where my dll
was being loaded but because I'd failed to implement a piece of
functionality it wasn't working properly - at least by doing this
you'll be able to tell if your dll is even being picked up by firefox.
sorry I can't be any more help,
Damien
static NS_METHOD
ObMozRegistration(
nsIComponentManager *aCompMgr, nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const
nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servman =
do_QueryInterface((nsISupports*)aCompMgr, &rv);
if
(NS_FAILED(rv))
return rv;
nsCOMPtr<nsICategoryManager> catman;
servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID,
NS_GET_IID(nsICategoryManager),
getter_AddRefs(catman));
if
(NS_FAILED(rv))
return rv;
char*
previous = nsnull;
rv = catman->AddCategoryEntry("xpcom-startup",
"ObMoz",
ObMoz_ContractID,
PR_TRUE,
PR_TRUE,
&previous);
if (previous)
nsMemory::Free(previous);
return rv;
}
Hi Damien,
I did the steps you said in your mail and see compreg.dat recreated
under profiles directory.
But, the observer notification for xpcom-startup didn't came while
firefox starts.
The following code registers for the xpcom-startup notification to category manager
static NS_METHOD nsQEngineRegistrationProc(nsIComponentManager
*aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo
*info)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> server =
do_QueryInterface((nsISupports*)aCompMgr,&rv);
nsCOMPtr<nsICategoryManager> catman;
server->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID,NS_GET_IID(nsICategoryManager),getter_AddRefs(catman));
if(NS_SUCCEEDED(rv))
{
char* previous = nsnull;
catman->AddCategoryEntry("xpcom-startup","nsQEngineImpl",NS_QENGINE_CONTRACTID,PR_TRUE,PR_TRUE,&previous);
}
return NS_OK;
}
Please let me know this is the way by which we should register for
xpcom-startup notification.
One more pointer the same code works with Firefox under Linux Platform.
I will appreciate your help in this regard.
Thanks & Regards
Raghavan
Damien O'Brien wrote:
Hi,
Yes this did work for me. The steps are as
follows
1) Shutdown any running instances of Firefox
2) Copy your dll into the components folder
(C:\Program Files\Mozilla Firefox\components)
3) "Touch" e.g. open and save the file
.autoreg - You will find this in the same folder as firefox.exe
(C:\Program Files\Mozilla Firefox)
4) Restart Firefox.
Once you've done this you should be able to
use your dll (depending on what it does).
According to Doug Turner in that link I
sent you there are a number of other ways of doing this;
A) touch a file .autoreg next to the executable.
B) run regxpcom with the right commands.
C) install the component
via xpinstall.
D) run some priveleged js (as your code above attempts to do)
I tried using regxpcom to do this but like you this
didn't work for me. I haven't tried using xpinstall.
If you mange to figure out another way of doing this
I'd appreciate you sending it on to me ;-)
Thanks,
Damien
--
"Buy what you want. Sell what you don't want. Use
this portal, www.finepick.com,
for FREE. Simple!"