X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fplatform%2Fwindows%2Fos-edid.cpp;h=d040257fe001f33aeb98accb22b64b4e1b9f9971;hb=5d71f08c3211791a51f6d7b0bde3d41f2e56d71f;hp=f9a127078016bc59b9857d55178bff4a8f12f919;hpb=b9761e8922a75fbff7887cf7fd5b6e4e3eba0709;p=deb_libcec.git diff --git a/src/lib/platform/windows/os-edid.cpp b/src/lib/platform/windows/os-edid.cpp index f9a1270..d040257 100644 --- a/src/lib/platform/windows/os-edid.cpp +++ b/src/lib/platform/windows/os-edid.cpp @@ -1,7 +1,7 @@ /* * This file is part of the libCEC(R) library. * - * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. * libCEC(R) is an original work, containing original code. * * libCEC(R) is a trademark of Pulse-Eight Limited. @@ -30,7 +30,8 @@ * http://www.pulse-eight.net/ */ -#include "../util/edid.h" +#include "env.h" +#include "lib/platform/util/edid.h" #include "windows.h" #include "setupapi.h" @@ -40,6 +41,7 @@ using namespace PLATFORM; static GUID MONITOR_GUID = { 0x4D36E96E, 0xE325, 0x11CE, { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } }; +#define PA_MAX_REGENTRIES_TO_CHECK 1024 uint16_t GetPhysicalAddressFromDevice(IN HDEVINFO hDevHandle, IN PSP_DEVINFO_DATA deviceInfoData) { @@ -51,16 +53,16 @@ uint16_t GetPhysicalAddressFromDevice(IN HDEVINFO hDevHandle, IN PSP_DEVINFO_DAT CHAR regEntryName[128]; DWORD regEntryNameLength(128); DWORD type; - LONG retVal(0); + LONG retVal(ERROR_SUCCESS); - for (LONG ptr = 0; iPA == 0 && retVal != ERROR_NO_MORE_ITEMS; ptr++) + for (LONG ptr = 0; iPA == 0 && retVal == ERROR_SUCCESS && ptr < PA_MAX_REGENTRIES_TO_CHECK; ptr++) { BYTE regEntryData[1024]; DWORD regEntryDataSize = sizeof(regEntryData); retVal = RegEnumValue(hDevRegKey, ptr, ®EntryName[0], ®EntryNameLength, NULL, &type, regEntryData, ®EntryDataSize); - if (retVal == 0 && !strcmp(regEntryName,"EDID")) + if (retVal == ERROR_SUCCESS && !strcmp(regEntryName,"EDID")) iPA = CEDIDParser::GetPhysicalAddressFromEDID(regEntryData, regEntryDataSize); } RegCloseKey(hDevRegKey);