Changes to System.DeviceAttached/System.DeviceRemoved

Got a good idea? You can suggest new features here.

Add device names and other device data to System.DeviceAttached/System.DeviceRemoved

Yes
14
100%
No
0
No votes
Have no clue what I am talking about
0
No votes
Don't care
0
No votes
 
Total votes: 14

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser » Sat Mar 11, 2017 4:56 am

ok I am going to have to give you a link to the latest and greatest EG build. THIS IS NOT AN OFFICIAL RELEASE!!!. This has a lot of changes to it that are not in the EG 0.5 Beta I am only interested in knowing of issues/problems with the device notification end of things. The reason that i have to give the link is because it is not dependent on changes that are made elsewhere in EG. and i am not going to try to explain how to make those changes in order for this to work.

This is a link to an EG Installer.

**EDIT**
Removed link due to it not functioning properly

Fixed: Floppy drive error on Windows 10.
Fixed: Incorrect drive mounting events.
Added: Removable Drive and Ram Drive for mounting/unmounting of drives
Changed: How WMI was being queried for a drive. The changes were made improved event generation speed
Changed: Removed duplicate code blocks.

If you have debugging turned on you better hold onto your hat. The debugging for this is pretty intense. We have started talking about adding a verbose option for the debugging as a lot of the information that is show would be more for adding support for a device that isn't generating events. and is really not needed for general debugging purposes.


**NOTE
The use of the setup class names and GUIDs is a dead end as far as trying to identify a device... the GUID's are only displayed in the PNPEntity class. I am sure in the future I will be able to link the PNPEntity to an actual device. But this I would like to be able to do without having to check each and every specific class and each device in that class.. It takes way to long to do this I have tried.
If you like the work I have been doing then feel free to Image

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Sat Mar 11, 2017 5:28 am

oooh big shouty warning!!! should we be scared?!! :mrgreen:

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Sat Mar 11, 2017 6:09 am

oh dear! it dont work for me:

05:39:04 Traceback (most recent call last) (WIP-2017.03.11-04.46.21):
05:39:04 File "D:\\EventGhost\eg\Classes\ActionThread.py", line 80, in StartSession
05:39:04 pluginInfo.instance.__start__()
05:39:04 File "D:\EventGhost\plugins\System\__init__.py", line 235, in __start__
05:39:04 self.powerBroadcastNotifier = PowerBroadcastNotifier(self)
05:39:04 File "D:\EventGhost\plugins\System\PowerBroadcastNotifier.py", line 188, in __init__
05:39:04 self.monitorNotify = Register(GUID_CONSOLE_DISPLAY_STATE)
05:39:04 File "D:\EventGhost\plugins\System\PowerBroadcastNotifier.py", line 140, in Register
05:39:04 return windll.user32.RegisterPowerSettingNotification(
05:39:04 File "ctypes\__init__.pyc", line 375, in __getattr__
05:39:04 File "ctypes\__init__.pyc", line 380, in __getitem__
05:39:04 AttributeError: function 'RegisterPowerSettingNotification' not found

'RegisterPowerSettingNotification' is the vista and above only command... is your version checking messed up again?

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Sat Mar 11, 2017 6:13 am

oh, you went back to having no checking for xp at all in 'PowerBroadcastNotifier.py'!

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Sat Mar 11, 2017 6:33 am

is the new plugin included in that download? im so confused right now! maybe you should consider putting version numbers inside the files!

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Sat Mar 11, 2017 6:51 am

ok so i added the latest 'System-1.1.22.egplugin' from the previous posts as i cant tell if this new eg version has an older or newer system plugin and that is working for now

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser » Sun Mar 12, 2017 12:11 am

There is a version number.. i forgot to change it..

But There is an error in the eg.WindowsVersion module. a line has to be added at the bottom of the WindowsVersion.py file.

Code: Select all

WindowsVersion = WindowsVersion()
that should fix the issue.

You have to remember this is a test build.. so some bugfixes have not yet wandered their way into this version.. and that XP thing with the powerbroadcast notifier is one of them.. the eg.WindowsVersion is the start to it..

it's a multi step process. LOL

so just swap out the PowerBroadcastNotifier.py with the one you have that is working. and add that one line to the bottom of the WindowsVersion.py.


the only changes to the system plugin in that build was the DeviceChangeNotifier. so if you installed from a previously attached egplugin file you are running an old version of it.. if you follow the instructions above it should give you the newest working version. sorry for you being my guinea pig..

I am sorry :(
If you like the work I have been doing then feel free to Image

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Sun Mar 12, 2017 6:10 am

yeah i know but the version number is only in the '__init__.py', what about the rest? files can still get mismatched... clearly! lol :lol:

anyway no need to be sorry, being the guinea pig gave me something to do for a while! :mrgreen:

i think your version checking is still a bit dodgy though, if one of these returns true shouldnt the other?

>>> print eg.WindowsVersion.IsXP()
False
>>> print eg.WindowsVersion.IsXP32()
True

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser » Sun Mar 12, 2017 10:42 am

ahh ok so the XP version checking is amiss..

well this is the kind of thing we need to know...
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser » Sun Mar 12, 2017 10:21 pm

OK so here we go again.... the powerbroadcaster fix has been applied. eg.WindowsVersion has been fixed as well. and this contains the latest version of the system plugin. so no need to change it... if something is not working properly with it please let me know.


****************** THIS IS NOT A RELEASE ******************
here is the link.. this is a Work In Progress (WIP) version. please do not report any bugs other then something wrong with the device change notifier. (System Plugin)
https://ci.appveyor.com/api/buildjobs/u ... _Setup.exe
If you like the work I have been doing then feel free to Image

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Mon Mar 13, 2017 6:49 am

getting the firmware revision error again now that IsXP() returns true instead of false:

05:54:44 Exception in thread WMI Thread:
05:54:44 Traceback (most recent call last):
05:54:44 File "threading.pyc", line 801, in __bootstrap_inner
05:54:44 File "D:\EventGhost\plugins\System\DeviceChangeNotifier.py", line 1039, in run
05:54:44 device
05:54:44 File "D:\EventGhost\plugins\System\DeviceChangeNotifier.py", line 679, in _create_event
05:54:44 for attrName in attr_names
05:54:44 File "D:\EventGhost\plugins\System\DeviceChangeNotifier.py", line 679, in <dictcomp>
05:54:44 for attrName in attr_names
05:54:44 File "win32com\client\dynamic.pyc", line 527, in __getattr__
05:54:44 AttributeError: <unknown>.FirmwareRevision

so looking at the code in the 'DeviceChangeNotifier.py' i was just gonna put a 'not' before the IsXP(), but i noticed that in your code you have also skipped some other stuff which i dont think should be (or is there a good reason? let me know... lol) like network adapter so i have changed a section of code so it only skips the offending 'FirmwareRevision' line if running xp.

i didnt really want to add the file as an attachment but when i pasted the code into the forum all the leading spaces magically vanished! :shock:

it now runs error free after doing this. what do you think?

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser » Mon Mar 13, 2017 12:42 pm

you are correct I was supposed to have a not in front of it...


but as far as the other 2 go..


read here

https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

and here

https://msdn.microsoft.com/en-us/librar ... 85%29.aspx


I didn't try to be crafty at all with the names for the GUID's you can search for them specifically and it will bring you to a Microsoft website.. same goes for the cls_name for the devices.. if you search for Win32_ and the cls_name it will bring up wmi class information.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser » Mon Mar 13, 2017 12:46 pm

and now that I have shown you the Microsoft API pages.. you are going to get lost in them for a very long time trying to understand the complete nightmare of a mess they have made of the backend of windows.

Happy Reading :-D :lol:

I have updated the link with that issue fixed also.
If you like the work I have been doing then feel free to Image

Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz » Mon Mar 13, 2017 4:13 pm

ok, yeah i guess thats a good reason lol :oops:

but it makes no sense to me... this is saying that anything less than vista cant have a network adapter? lol

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser » Tue Mar 14, 2017 1:56 am

Nah it just means that WMI has no storage for them
If you like the work I have been doing then feel free to Image

Post Reply