Skip to content

Instantly share code, notes, and snippets.

@pavel-a
Created March 25, 2019 22:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavel-a/b02f1b03f4dc002b60417cb8db3c4d31 to your computer and use it in GitHub Desktop.
Save pavel-a/b02f1b03f4dc002b60417cb8db3c4d31 to your computer and use it in GitHub Desktop.
A little program to dump display EDIDs in hex. Gets extension blocks.
// Read EDIDs from all displays via WMI ...
// https://docs.microsoft.com/en-us/windows/desktop/wmicoreprov/wmimonitorraweedidv1block
using System;
using System.Management;
namespace edid_dump {
class edid_dump
{
static void Main(string[] args)
{
Console.Out.WriteLine("EDID dump for connected monitors: pavel@trego.co.il 25-mar-2019\n");
var mc = new System.Management.ManagementClass(string.Format(@"\\{0}\root\wmi:WmiMonitorDescriptorMethods", Environment.MachineName));
foreach (ManagementObject mo in mc.GetInstances()) //Do this for each connected monitor
{
Console.Out.WriteLine($"Monitor: {mo.GetPropertyValue("InstanceName")}");
for (int i = 0; i < 256; i++)
{
var inParams = mo.GetMethodParameters("WmiGetMonitorRawEEdidV1Block");
inParams["BlockId"] = i;
ManagementBaseObject outParams = null;
try
{
outParams = mo.InvokeMethod("WmiGetMonitorRawEEdidV1Block", inParams, null);
uint blktype = Convert.ToUInt16(outParams["BlockType"]);
Console.Out.WriteLine("Block[{2}] type {0}, content of type {1} ",
blktype, outParams["BlockContent"].GetType(), i);
// Types are: 0-invalid 1=base block 2=block map 255=other (ext.block)
if ((blktype == 1) || (blktype == 255))
{
Byte[] a = (Byte[])outParams["BlockContent"];
Console.Out.WriteLine($"# Length={a.Length} Cksm 0x{a[127].ToString("X2")}");
if ((blktype == 1) && (a.Length == 128) && (a[126] != 0))
{
Console.Out.WriteLine($"# Main block. Number of extensions: {a[126]}");
}
for (int k = 0; k < a.Length; k++ )
{
Console.Out.Write("{0:X2} ", a[k]);
if ((k % 16) == 15)
Console.Out.WriteLine();
}
}
else
{
Console.Out.WriteLine("# weird block [{0}] type", i);
}
}
catch { break; } //No more EDID blocks
}
}
}
}
}
@davidchou6397
Copy link

Hi friend,the code can read extension edid block 1 ?

@pavel-a
Copy link
Author

pavel-a commented May 14, 2020

the code can read extension edid block 1 ?

Yes it can . I don't have such monitor now but remember it showed at least one extension with some monitor.
-- p.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment