🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10254

Re: Stopping DVD/Audio CD autoplay

#10254
From: Simon Macneall
Date: Mon, 10 May 2004 23:16
61 lines
2986 bytes
"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote in
news:409ad659$1@newsgroups.borland.com: 

> Further reading of MSDN shows the following:
> 
>     "Upon presentation of media, the Shell searches the ROT for a
>     component 
> implementing IQueryCancelAutoPlay. If one is found, ***the class
> identifier (CLSID) of that component's moniker*** is extracted."
> 
> This suggests that your IQueryCancelAutoPlay interface has to support
> the IMoniker interface as well.  IMoniker derives from IPersist, which
> has a GetClassID() method for retreiving the object's CLSID.  I will
> bet that your interface does not support that properly, so when the OS
> goes looking for your object, it can't verify the CLSID so your
> interface doesn't get called to block the AutoRun.  If you look in
> your QueryInterface(), does IID_IMoniker (or similar) ever get
> requested? 
> 
> I do notice that there is a SHCreateQueryCancelAutoPlayMoniker()
> function available as well.
> 
> BTW, how are you adding your interface to the ROT in the first place?
> 
> 

Thanks for your help Remy, I got it working using a sample I found in the 
November 2001 MSDN, and adding the registry key that we talked about 
earlier.

As for adding to the ROT...

namespace
{
DWORD rotReg = 0xf000000;
}

DWORD DirectXUtils::AddGraphToROT(IUnknown* inGraph)
{
   CComPtr<IMoniker> moniker;
   CComPtr<IRunningObjectTable> rot;
   DWORD retVal = 0;
   if (SUCCEEDED(GetRunningObjectTable(0, &rot)))
   {
      WCHAR wsz[256];
      wsprintfW(wsz, L"AutoPlayInterceptor %08x  pid %08x", 0,
                GetCurrentProcessId());
      if (SUCCEEDED(CreateItemMoniker(L"!", wsz, &moniker)))
      {
         retVal = rotReg;
         rot->Register(0, inGraph, moniker, &retVal);
         rotReg = retVal ? rotReg + 1 : rotReg;
      }
   }
   return retVal;
}

was what I had previously, which was adding to the ROT, I am now using 
the code from the MSDN article...

Simon
Technical Details
Message-ID: <Xns94E64A765FD08macnealliinetnetau@207.105.83.66>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <Xns94E15253CC42Fmacnealliinetnetau@207.105.83.66> <409984a1$1@newsgroups.borland.com> <Xns94E160383D857macnealliinetnetau@207.105.83.66> <4099b0ae$1@newsgroups.borland.com> <Xns94E24E78DCBC3macnealliinetnetau@207.105.83.66> <409ad659$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,dcdee2de1c7c274c
X-Google-Attributes: gid10cc67,public
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Stopping DVD/Audio CD autoplay
From: Simon Macneall <macneall-at-iinet.net.au>
References: <Xns94E15253CC42Fmacnealliinetnetau@207.105.83.66> <409984a1$1@newsgroups.borland.com> <Xns94E160383D857macnealliinetnetau@207.105.83.66> <4099b0ae$1@newsgroups.borland.com> <Xns94E24E78DCBC3macnealliinetnetau@207.105.83.66> <409ad659$1@newsgroups.borland.com>
Message-ID: <Xns94E64A765FD08macnealliinetnetau@207.105.83.66>
User-Agent: Xnews/5.04.25
NNTP-Posting-Host: 203.153.243.50
Date: 10 May 2004 16:16:52 -0700
X-Trace: newsgroups.borland.com 1084231012 203.153.243.50 (10 May 2004 16:16:52 -0700)
Lines: 61
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail