Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows graphics changes #855

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

shoustech
Copy link

@shoustech shoustech commented Sep 19, 2023

Note:

I am not using the previously used variable ssections because I could not find a reliable way to map any of the displays to the values output. I can go back in and add pixelDepth and main with the value from the main display in ssections as the default for all the monitors.

Description

I am opening this pull request because after #853 was submitted I ended up looking at the commands being used to pull the information on windows and noticed that there was some room for improvement. I fixed an issue where in some situations the output would exclude displays. I have also added the fields displayId and productionYear which was previously only available on MacOS.

Notable changes

The number of displays is now based on the variable tsections. I then match the InstanceName property to the Instance name property in msections and isections. For dsections I am finding the correct display by matching tsections.InstanceName to dsections.PNPDeviceID

After all of the objects associated with the display have been found the app will then pull variables in this order:
tsection
dsection
msection
and finally isection

Since the output of dsection is the most complete I pulled what I could from that object first and then went down the list from there. If a variable was not pulled from dsection or the correlated object could not be found I would then fill in blank values or pull backup variables from the other objects.

Also:

  • Added the fields: displayId and productionYear

Examples

In this situation I am using a RDP connection to a different desktop

Existing module

    "displays": [
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY17",
        "main": true,
        "builtin": false,
        "connection": "DVI",
        "resolutionX": 2560,
        "resolutionY": 1440,
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": 32,
        "currentResX": 2560,
        "currentResY": 1440,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 84
      }
    ]

Modified module

    "displays": [
      {
        "vendor": "Dell Inc.",
        "deviceName": "Dell E2414H (Digital - DVI)",
        "model": "Dell E2414H",
        "productionYear": 2014,
        "serial": "VMT444ASU",
        "displayId": "DISPLAY\\DEL4091\\5&21dbb09b&0&UID24832_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": 0,
        "resolutionX": 2560,
        "resolutionY": 1440,
        "currentResX": 2560,
        "currentResY": 1440,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "D E L",
        "deviceName": "DELL U719D",
        "model": "DELL U719D",
        "productionYear": 2018,
        "serial": "GLQW7R",
        "displayId": "DISPLAY\\DEL415F\\5&21dbb09b&0&UID24833_0",
        "main": "",
        "builtin": false,
        "connection": "HDMI",
        "sizeX": 60,
        "sizeY": 34,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "L E X",
        "deviceName": "A409U",
        "model": "A409U",
        "productionYear": 2015,
        "serial": "16843009",
        "displayId": "DISPLAY\\LEX0000\\5&21dbb09b&0&UID24836_0",
        "main": "",
        "builtin": false,
        "connection": "DP",
        "sizeX": 128,
        "sizeY": 72,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "H W",
        "deviceName": "H V41",
        "model": "H V41",
        "productionYear": 2014,
        "serial": "3CQ4113RS",
        "displayId": "DISPLAY\\HWP311F\\5&21dbb09b&0&UID24839_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 52,
        "sizeY": 29,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "(Standard monitor types)", //Current display 17
        "deviceName": "Generic Non-PnP Monitor",
        "model": "Generic Non-PnP Monitor",
        "productionYear": 0,
        "displayId": "DISPLAY\\Default_Monitor\\1&31c5ecd4&0&UID256_0",
        "main": "",
        "builtin": true,
        "connection": "RDP",
        "sizeX": 0,
        "sizeY": 0,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      }
    ]

Without RDP original code:

    "displays": [
      {
        "vendor": "Dell Inc.",
        "model": "Dell E2414H (Digital - DVI)",
        "deviceName": "\\\\.\\DISPLAY1",
        "main": false,
        "builtin": false,
        "connection": "DVI",
        "resolutionX": 2560,
        "resolutionY": 1440,
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": "32",
        "currentResX": 2560,
        "currentResY": 1440,
        "positionX": -2560,
        "positionY": 740,
        "currentRefreshRate": 84
      },
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY2",
        "main": true,
        "builtin": false,
        "connection": "HDMI",
        "resolutionX": 3840,
        "resolutionY": 2160,
        "sizeX": 60,
        "sizeY": 34,
        "pixelDepth": "32",
        "currentResX": 3840,
        "currentResY": 2160,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 84
      },
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY3",
        "main": false,
        "builtin": false,
        "connection": "DP",
        "resolutionX": 1920,
        "resolutionY": 1080,
        "sizeX": 128,
        "sizeY": 72,
        "pixelDepth": "32",
        "currentResX": 1920,
        "currentResY": 1080,
        "positionX": 7,
        "positionY": -1080,
        "currentRefreshRate": 84
      },
      {
        "vendor": "",
        "model": "",
        "deviceName": "\\\\.\\DISPLAY4",
        "main": false,
        "builtin": false,
        "connection": "DVI",
        "resolutionX": 1920,
        "resolutionY": 1080,
        "sizeX": 52,
        "sizeY": 29,
        "pixelDepth": "32",
        "currentResX": 1920,
        "currentResY": 1080,
        "positionX": 1927,
        "positionY": -1080,
        "currentRefreshRate": 84
      }
    ]

Without RDP modified code:

"displays": [
      {
        "vendor": "Dell Inc.",
        "deviceName": "Dell E2414H (Digital - DVI)",
        "model": "Dell E2414H",
        "productionYear": 2014,
        "serial": "VMT444ASU",
        "displayId": "DISPLAY\\DEL4091\\5&21dbb09b&0&UID24832_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 53,
        "sizeY": 30,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "D E L",
        "deviceName": "DELL U719D",
        "model": "DELL U719D",
        "productionYear": 2018,
        "serial": "GLQW7R",
        "displayId": "DISPLAY\\DEL415F\\5&21dbb09b&0&UID24833_0",
        "main": "",
        "builtin": false,
        "connection": "HDMI",
        "sizeX": 60,
        "sizeY": 34,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "L E X",
        "deviceName": "A409U",
        "model": "A409U",
        "productionYear": 2015,
        "serial": "16843009",
        "displayId": "DISPLAY\\LEX0000\\5&21dbb09b&0&UID24836_0",
        "main": "",
        "builtin": false,
        "connection": "DP",
        "sizeX": 128,
        "sizeY": 72,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      },
      {
        "vendor": "H W",
        "deviceName": "H V41",
        "model": "H V41",
        "productionYear": 2014,
        "serial": "3CQ4113RS",
        "displayId": "DISPLAY\\HWP311F\\5&21dbb09b&0&UID24839_0",
        "main": "",
        "builtin": false,
        "connection": "DVI",
        "sizeX": 52,
        "sizeY": 29,
        "pixelDepth": 0,
        "resolutionX": 0,
        "resolutionY": 0,
        "currentResX": 0,
        "currentResY": 0,
        "positionX": 0,
        "positionY": 0,
        "currentRefreshRate": 0
      }
    ]

@shoustech shoustech changed the title Completed Windows graphic changes Windows graphics changes Sep 19, 2023
@sebhildebrandt
Copy link
Owner

@shoustech wow, thank you! I will check it the upcoming days and if is also works here on my side, I will crate a new release.

shoustech and others added 5 commits September 20, 2023 12:02
Removed unneeded if statements. Added a backup for when we do not recognize the monitor display technology.
Fixed an issue on mac systems where wifi.js was reporting an error when trying to list networks.
@shoustech
Copy link
Author

shoustech commented Apr 24, 2024

I have been using this change on a few hundred PCs for about 3-4 months now and it has been working without issue. I am going to be updating my agent and will be updating my systeminformation dependency.

Would you like an updated pull request?

I also have code we are using outside of the module that would be good features if you wanted the pull requests.

  • Windows TPMs (I can possibly write a Ubuntu script if required)
  • Windows Bitlocker Status (Status by drive and Recovery passwords)
  • Windows Local Users (All users profiles on the PC)
  • Browser history (from chrome currently reading the History file with the NPM SQLite client. Good info but might not be a good fit due to the SQlite dependency and requires copying the History database to a temp directory due to chrome keeping a consistent lock on the DB)
  • Software installed (Windows, Ubuntu, OSX)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants