WMI query with multiple sets causes stack overflow

Forums Desktop Info WMI query with multiple sets causes stack overflow

Tagged: 

Viewing 6 reply threads
  • Author
    Posts
    • #3817
      Avatarcmd
      Participant

      Hello 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
    • #3820
      Avatarrtruss
      Participant

      I 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
    • #3821
      Avatarcmd
      Participant

      Hey 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
    • #3823
      GlennGlenn
      Keymaster

      I’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
    • #3824
      Avatarcmd
      Participant

      Awesome 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
    • #3826
      GlennGlenn
      Keymaster

      I just loaded up 2.10.1 and reproduced your error so I can say the bug has been fixed in the next release.

      +1
    • #3829
      Avatarcmd
      Participant

      Incredible! I wish everything had the same sort of turnaround you do, Glenn. Thanks a heap!

      0
      • #3830
        GlennGlenn
        Keymaster

        Having said that, I notice it’s been 2 months since the last release which is unusual. I like to do updates monthly. But I have a good excuse (I think), I’ve been experimenting with a plugin system.

        0
Viewing 6 reply threads
  • You must be logged in to reply to this topic.
Glenn's Page