Trying to read EDID directly from the monitor.

G

Guest

I am having this issue with both Visual C++ 6.0 and Visual Studio 2005 Beta
2. I have the SDK and DDK installed. I am trying to write a program to
retrieve the EDID for a specific monitor in a multi-monitor system. I
already know how to get this information from the registry, but I wish to get
the EDID from the monitor directly.

So far I have been unable to compile my program. The compiler generates
over 102 errors and 54 warnings, all of which seem to be from header files.
Below is a section of the code containing the two mentioned functions as well
as a sample of the error messages recieved from the build attempt.

I have included the headers ntddk.h and video.h and linked to the libraries
ntoskrnl.exe, wdm.lib, wdmsec.lib, and videoprt.lib. I believe my problems
stem from one or more of these.

There are two functions that I am using that require these headers/libraries:
1. IoGetDeviceObjectPointe
(http://msdn.microsoft.com/library/d..._c57b87e5-8316-4c45-a245-0fe7592c3471.xml.asp)

2. VideoPortDDCMonitorHelpe
(http://msdn.microsoft.com/library/d..._dc0bda84-97c5-49ba-9084-04149f9be157.xml.asp)

Why won't it recognize the headers properly? Any thoughts on what is
causing these errors? Am I using the wrong headers, linking the wrong
libraries? Is there an easier way to do this?

Thank you for your time.


Code sample:
/* get device object name */
if (SetupDiGetDeviceRegistryProperty( //PDO
devInfoSet,
&devInfoData,
SPDRP_PHYSICAL_DEVICE_OBJECT_NAME,
NULL,
(PBYTE)(&PDO),
sizeof(PDO),
NULL))
{
fprintf_s(stdout, " PDO = %s\n", PDO);
sprintf_s(temp, sizeof(temp), " PDO = %s\n", PDO);
strcat_s(log, sizeof(log), temp);

/* get device object pointer */
if (IoGetDeviceObjectPointer(&PDO, FILE_READ_DATA, &fileObject,
&deviceObject)) {
fprintf_s(stdout, " Device object pointer obtained.\n");
strcat_s(log, sizeof(log), " Device object pointer obtained.\n");

/* get device extension pointer */
HwDeviceExtension = VideoPortGetAssociatedDeviceExtension(&deviceObject)
if (HwDeviceExtension != NULL) {
fprintf_s(stdout, " Device extension obtained.\n", PDO);
strcat_s(log, sizeof(log), " Device extension obtained.\n", PDO);

if (VideoPortDDCMonitorHelper(HwDeviceExtension, &DDCControl,
EDIDdata, sizeof(EDIDdata))) {
sprintf_s(regManID, sizeof(regManID), "");
sprintf_s(regProID, sizeof(regProID), "");
sprintf_s(regSerialA, sizeof(regSerialA), "");
sprintf_s(regSerialB, sizeof(regSerialB), "");
sprintf_s(regName, sizeof(regName), "");
fprintf_s(stdout, "\n EDID information\n");
strcat_s(log, sizeof(log), "\n EDID information\n");
for (i=8; i < 10; i++) { //Manufacturer ID (08h-09h)
sprintf_s(temp, sizeof(temp), "%02X ", EDIDdata);
strcat_s(regManID, sizeof(regManID), temp);
}

fprintf_s(stdout, " Manufacturer ID (hex) = %s \n", regManID);
sprintf_s(temp, sizeof(temp), " Manufacturer ID (hex) = %s \n",
regManID);
strcat_s(log, sizeof(log), temp);
}
}
}
}



Build output sample:


1>------ Build started: Project: loadLUT, Configuration: Debug Win32 ------

1>Compiling...

1>loadLUT.cpp

1>c:\winddk\2600.1106\inc\wxp\ntdef.h(81) : warning C4005:
'MAX_NATURAL_ALIGNMENT' : macro redefinition

1> c:\program files\microsoft visual studio
8\vc\platformsdk\include\winnt.h(53) : see previous definition of
'MAX_NATURAL_ALIGNMENT'

1>c:\winddk\2600.1106\inc\wxp\ntdef.h(108) : warning C4005:
'PROBE_ALIGNMENT' : macro redefinition

1> c:\program files\microsoft visual studio
8\vc\platformsdk\include\winnt.h(86) : see previous definition of
'PROBE_ALIGNMENT'

1>c:\winddk\2600.1106\inc\wxp\ntdef.h(134) : warning C4005: 'POINTER_64' :
macro redefinition

1> c:\program files\microsoft visual studio
8\vc\platformsdk\include\basetsd.h(36) : see previous definition of
'POINTER_64'

(SECTION ABBREVIATED)

1> c:\program files\microsoft visual studio
8\vc\platformsdk\include\winnt.h(2934) : see declaration of
'_FLOATING_SAVE_AREA'

1>c:\winddk\2600.1106\inc\ddk\wxp\ntddk.h(627) : error C2011: '_CONTEXT' :
'struct' type redefinition

1> c:\program files\microsoft visual studio
8\vc\platformsdk\include\winnt.h(2958) : see declaration of '_CONTEXT'

1>c:\winddk\2600.1106\inc\ddk\wxp\ntddk.h(1551) : error C2011:
'_GENERIC_MAPPING' : 'struct' type redefinition

1> c:\program files\microsoft visual studio
8\vc\platformsdk\include\winnt.h(3951) : see declaration of '_GENERIC_MAPPING'

1>c:\winddk\2600.1106\inc\ddk\wxp\ntddk.h(1572) : error C2011:
'_LUID_AND_ATTRIBUTES' : 'struct' type redefinition

(SECTION ABBREVIATED)

1>c:\winddk\2600.1106\inc\ddk\wxp\ntddk.h(2941) : fatal error C1003: error
count exceeds 100; stopping compilation

1>Build log was saved at
"file://c:\PMT\loadLUT2-1\_loadLUT\loadLUT\Debug\BuildLog.htm"

1>loadLUT - 102 error(s), 54 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top