WMI query with multiple sets causes stack overflow
› Forums › Desktop Info › WMI query with multiple sets causes stack overflow
Tagged: wmi
- This topic has 7 replies, 3 voices, and was last updated 1 month, 1 week ago by
Glenn.
-
AuthorPosts
-
-
26 February, 2021 at 3:35 am #3817
cmd
ParticipantHello again Glenn!
I’ve managed to work myself into a hole again. I’m attempting to use WMI queries to gather information and store it in variables via the
set:
functionality. It seems that specifying a single variable via the WMI %name% return style doesn’t set the value, and instead only puts the literal string%WhateverProperty%
into the variable.The big one though I ran into when attempting to collect multiple pieces of information in a single query. Specifying more than one variable in the
set:
section causes a stack overflow during UpdateEntries (according to the log). DesktopInfo.exe then closes (and will leave DesktopInfo64.exe orphaned if it was running.Windows version: Windows 10 Pro for Workstations 20H2 (19042.804)
Product version: 2.10.1.3742
Expected output: Result: MYMACHINE\myUserName WORKGROUP PC-Model
Actual output: Result: %UserName% %Workgroup% %Model% (Or a stack overflow with no output.)Small ini to reproduce issue: (uncomment one of the WMI lines at a time. I left the stack overflow line in.)
[options] log=desktopinfo.log log-level=debug desktopinfo64=1 inimonitortime=2 [items] # Display DTI version as a sanity check. FILE=active:1,interval:0,color:%Highlight%,type:version,text:DTI Version,file:DesktopInfo.exe,display:%2 # Uncomment one of the WMI lines below. # Works, shows expected values: #WMI=hidden:0,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,display:%UserName% %Workgroup% %Model% # Sets %FullUser% to the literal string "%UserName%", but also does not cause crash: #WMI=hidden:1,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,set:FullUser=%UserName% # Causes Stack Overflow on UpdateEntries: WMI=hidden:1,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,set:FullUser=%UserName% Workgroup=%Workgroup% Model=%Model% # Output COMMENT=text:Result: %FullUser% %Workgroup% %Model%
Log output from stack overflow:
25-02-21 11:29:33:755 DEBUG UpdateEntries Complete. 25-02-21 11:29:33:756 DEBUG GetFileWatch: DesktopInfo.exe 1 25-02-21 11:29:33:757 DEBUG FILE run, time: 0ms 25-02-21 11:29:33:758 DEBUG FILE process 25-02-21 11:29:33:759 DATA FILE 2.10.1.3742 25-02-21 11:29:33:761 DATA FILE () True 25-02-21 11:29:33:762 DEBUG WMI: Namespace=root\cimv2 Query=Win32_ComputerSystem 25-02-21 11:29:33:778 DEBUG WMI run, time: 16ms 25-02-21 11:29:33:779 DEBUG WMI process 25-02-21 11:29:33:780 DATA WMI %rowcount% 25-02-21 11:29:33:782 DATA WMI () True 25-02-21 11:29:34:658 ERROR UpdateEntries: Stack overflow
0 -
2 March, 2021 at 12:26 am #3820
rtruss
ParticipantI was able to get this to work, i am not in a workgroup but it still worked with domain in its place
WMI=hidden:0,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,Row-text:FullUser| DOMAIN| Model,display:%UserName%| %DOMAIN%| %Model%
Workgroup and Model are already ‘known’ to dti i believe so a set would not be needed for those.
hope that helps.
+1 -
2 March, 2021 at 12:58 am #3821
cmd
ParticipantHey rtruss, I appreciate that workaround. I was more demonstrating the stack overflow, as it seems to happen with any time I use multiple sets from a WMI query.
I did manage to work around it for my use case too: if I break each WMI query set into a single set per query, using
display
and a single, non-‘equals’ set like so:WMI=hidden:1,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,set:FullUser,display:%UserName%
Everything works like I’d expect!
Obviously there’s un-needed overhead in running the query multiple times, but the majority of the data I’m collecting I’m doing with
interval:0
, so it’s a relatively small issue for now!0 -
3 March, 2021 at 9:47 am #3823
Glenn
KeymasterI’ve fixed the multi SET for WMI items. I couldn’t reproduce the stack overflow though. It’s possible I fixed it while working on other things.
0 -
3 March, 2021 at 3:27 pm #3824
cmd
ParticipantAwesome news, Glenn!
I’ll keep my eye open for the next release and will see if I can reproduce it at all and let you know if it got fixed along the way!
Cheers
0 -
5 March, 2021 at 8:52 am #3826
Glenn
KeymasterI just loaded up 2.10.1 and reproduced your error so I can say the bug has been fixed in the next release.
+1 -
5 March, 2021 at 9:41 am #3829
cmd
ParticipantIncredible! I wish everything had the same sort of turnaround you do, Glenn. Thanks a heap!
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.