Python library - WMI.py RegistryValueChangeEvent

Chris Angelico rosuav at gmail.com
Mon Apr 6 19:49:57 EDT 2015


On Tue, Apr 7, 2015 at 8:02 AM, Khyati <shrivastavkhyati at gmail.com> wrote:
> I have a question about RegistryValueChangeEvent that I have not been able to find an answer to on the internet so far. I would appreciate any help since I have already spent a lot of time finding any material that explains this:
>
> What I am trying to do:
> - create an event when a value for a registry key changes

Thanks for being clear about this part! Unfortunately, there are a few
other parts that aren't clear yet, so hopefully you can expand on your
question a bit.

> How I am doing it:
>>raw_wql = "SELECT * FROM RegistryValueChangeEvent WHERE Hive='HKEY_LOCAL_MACHINE' AND KeyPath='Software\\\\Temp' AND ValueName='Name\'"

Tip: Try adding "print(raw_wql)" just underneath this line, to see if
you're getting back what you really want. The backslash at the end of
ValueName is not currently doing anything.

>>watcher = c.watch_for(raw_wql=raw_wql,wmi_class = "__ExtrinsicEvent")
>>while TRUE:
>>    process_created = watcher()

This code isn't complete. Can you post a complete (and minimal)
example piece of code?

> Problem:
> the _wmi_event object returned is not coming back as Extrinsic event -
> So, in wmi.py, in class _wmi_watcher:
>    "self.is_extrinsic" returns false and I get an exception from the else part - [line 1186 - 1195]

It'd help hugely if you could post the entire traceback here - what
exception you're getting, and the exact lines that produce it.

> What I need
> - Any reference/idea/explanation on => why does RegistryValueChangeEvent returns as a Non-Extrinsic  event? even though it has been derived from __ExtrinsicEvent
>
> Other information:
> Running on Windows 8 64 Bit
>>>> platform.machine()
> 'AMD64'
>>>> platform.architecture()
> ('64bit', 'WindowsPE')
>>>> platform.python_version()
> '2.7.8'
>>>> platform.python_implementation()
> 'CPython'
>
> Using WMI-1.4.9.win32 - downloaded via PIP
> pywin32-219.win-amd64-py2.7

Just for reference, this is a general Python discussion list. Lots of
us won't know specific libraries, so all we can offer is fairly
general information. If you can't get the help you need here, you may
do better to look for more specific help about this module.

All the best!

ChrisA



More information about the Python-list mailing list