Re: Interacting with Shell from Win32 Service
From: andrew (avl58ripn_at_yahoo.com)
Date: 08/30/04
- Next message: Prashanth: "CPU hog - sockets"
- Previous message: Chuck Chopp: "Re: WTSQuerySessionInformation() - memory leak on WinXP/2K3"
- In reply to: Arnaud Debaene: "Re: Interacting with Shell from Win32 Service"
- Next in thread: Tim Robinson: "Re: Interacting with Shell from Win32 Service"
- Reply: Tim Robinson: "Re: Interacting with Shell from Win32 Service"
- Messages sorted by: [ date ] [ thread ]
Date: 30 Aug 2004 05:50:17 -0700
Hi,
Thanks for the response,
Unfortunately FindFirstChange/FindNextChange doesn't return the name
of the object in the way if you are monitoring all of the objects
within the subTree.
I'm just want to monitor changes in any folder on the specific drives,
and if changes occur I'd like to write details to the log file. I saw
one sample on the MS site how to get the file name from handle (in the
current case received from FindFirstChange....) but I was greatly
suprised that is used QueryDosDevice function inside.
Regards,
Andrew
"Arnaud Debaene" <adebaene@club-internet.fr> wrote in message news:<O6oMNYhiEHA.4092@TK2MSFTNGP10.phx.gbl>...
> andrew wrote:
> > Hi,
> > Does anybody knows is that possible to interact with Shell from Win32
> > Service.
> Is it possible but is generally considered as a very bad practice for
> security reasons. In fact, it's not the shell per-se that is dangerous, but
> using any window message in a service is a potential security breach. Google
> on "shatter attack" to learn why and how.
>
> > I'm not an expert in Win32 Services and Kernel Mode programming
> Services and kernel mode programming (a.k.a. drivers) are 2 totally
> unrelated things!
>
> > and
> > there is no any docs about that.
> Untrue! Reference for services :
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/services.asp?frame=true
>
> > I've no ideas where/how I can receive Messages posted from Shell to my
> > Service after SHChangeNotifyRegister executed within my service.
>
> First, are you aware that the shell may terminate during the lifetime of
> your service? The shell namespace is user specific, and the shell runs only
> when someone is logged in (which also means there can be several shell
> running in case of Terminal Services or Fast User Switching), whereas your
> service runs all the time and is unique.
>
> Second, what kind of notifications are you looking for? There is probably
> another way to do what you want.
> - For directory changes notifications, see FindFirstChange/FindNextChange.
> - for device insertion/removal, see RegisterDeviceNotification (please note
> that the hRecipient parameter can be a window OR a service handle - see
> HandlerEx and SERVICE_CONTROL_DEVICEEVENT for details).
>
> PS : To MS people : why is the Shell documentation still so poor! The
> fEvents parameter of SHChangeNotifyRegister is not documented at all (you
> must guess it's the same thing as the wEventId from SHChangeNotify), and
> there is no example for this function! :-(
>
> Arnaud
> MVP - VC
- Next message: Prashanth: "CPU hog - sockets"
- Previous message: Chuck Chopp: "Re: WTSQuerySessionInformation() - memory leak on WinXP/2K3"
- In reply to: Arnaud Debaene: "Re: Interacting with Shell from Win32 Service"
- Next in thread: Tim Robinson: "Re: Interacting with Shell from Win32 Service"
- Reply: Tim Robinson: "Re: Interacting with Shell from Win32 Service"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|