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. IoGetDeviceObje ctPointer
(http://msdn.microsoft.com/library/de...2c3471.xml.asp)
2. VideoPortDDCMon itorHelper
(http://msdn.microsoft.com/library/de...9be157.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 (SetupDiGetDevi ceRegistryPrope rty( //PDO
devInfoSet,
&devInfoData ,
SPDRP_PHYSICAL_ DEVICE_OBJECT_N AME,
NULL,
(PBYTE)(&PDO),
sizeof(PDO),
NULL))
{
fprintf_s(stdou t, " PDO = %s\n", PDO);
sprintf_s(temp, sizeof(temp), " PDO = %s\n", PDO);
strcat_s(log, sizeof(log), temp);
/* get device object pointer */
if (IoGetDeviceObj ectPointer(&PDO , FILE_READ_DATA, &fileObject,
&deviceObjec t)) {
fprintf_s(stdou t, " Device object pointer obtained.\n");
strcat_s(log, sizeof(log), " Device object pointer obtained.\n");
/* get device extension pointer */
HwDeviceExtensi on = VideoPortGetAss ociatedDeviceEx tension(&device Object)
if (HwDeviceExtens ion != NULL) {
fprintf_s(stdou t, " Device extension obtained.\n", PDO);
strcat_s(log, sizeof(log), " Device extension obtained.\n", PDO);
if (VideoPortDDCMo nitorHelper(HwD eviceExtension, &DDCControl,
EDIDdata, sizeof(EDIDdata ))) {
sprintf_s(regMa nID, sizeof(regManID ), "");
sprintf_s(regPr oID, sizeof(regProID ), "");
sprintf_s(regSe rialA, sizeof(regSeria lA), "");
sprintf_s(regSe rialB, sizeof(regSeria lB), "");
sprintf_s(regNa me, sizeof(regName) , "");
fprintf_s(stdou t, "\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(regMan ID, sizeof(regManID ), temp);
}
fprintf_s(stdou t, " 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\260 0.1106\inc\wxp\ ntdef.h(81) : warning C4005:
'MAX_NATURAL_AL IGNMENT' : macro redefinition
1> c:\program files\microsoft visual studio
8\vc\platformsd k\include\winnt .h(53) : see previous definition of
'MAX_NATURAL_AL IGNMENT'
1>c:\winddk\260 0.1106\inc\wxp\ ntdef.h(108) : warning C4005:
'PROBE_ALIGNMEN T' : macro redefinition
1> c:\program files\microsoft visual studio
8\vc\platformsd k\include\winnt .h(86) : see previous definition of
'PROBE_ALIGNMEN T'
1>c:\winddk\260 0.1106\inc\wxp\ ntdef.h(134) : warning C4005: 'POINTER_64' :
macro redefinition
1> c:\program files\microsoft visual studio
8\vc\platformsd k\include\baset sd.h(36) : see previous definition of
'POINTER_64'
(SECTION ABBREVIATED)
1> c:\program files\microsoft visual studio
8\vc\platformsd k\include\winnt .h(2934) : see declaration of
'_FLOATING_SAVE _AREA'
1>c:\winddk\260 0.1106\inc\ddk\ wxp\ntddk.h(627 ) : error C2011: '_CONTEXT' :
'struct' type redefinition
1> c:\program files\microsoft visual studio
8\vc\platformsd k\include\winnt .h(2958) : see declaration of '_CONTEXT'
1>c:\winddk\260 0.1106\inc\ddk\ wxp\ntddk.h(155 1) : error C2011:
'_GENERIC_MAPPI NG' : 'struct' type redefinition
1> c:\program files\microsoft visual studio
8\vc\platformsd k\include\winnt .h(3951) : see declaration of '_GENERIC_MAPPI NG'
1>c:\winddk\260 0.1106\inc\ddk\ wxp\ntddk.h(157 2) : error C2011:
'_LUID_AND_ATTR IBUTES' : 'struct' type redefinition
(SECTION ABBREVIATED)
1>c:\winddk\260 0.1106\inc\ddk\ wxp\ntddk.h(294 1) : fatal error C1003: error
count exceeds 100; stopping compilation
1>Build log was saved at
"file://c:\PMT\loadLUT2-1\_loadLUT\load LUT\Debug\Build Log.htm"
1>loadLUT - 102 error(s), 54 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========