diff --git a/rejistry++/src/VKRecord.cpp b/rejistry++/src/VKRecord.cpp index cdafdef2a14cf69e02e0626e517f468d304a19e3..e222e7ccea00962da3f5a64482ac74da95c555fe 100644 --- a/rejistry++/src/VKRecord.cpp +++ b/rejistry++/src/VKRecord.cpp @@ -34,6 +34,7 @@ namespace Rejistry { const std::string VKRecord::MAGIC = "vk"; + const std::wstring VKRecord::DEFAULT_VALUE_NAME = L"(Default)"; VKRecord::VKRecord(RegistryByteBuffer * buf, uint32_t offset) : Record(buf, offset) { if (!(getMagic() == MAGIC)) { @@ -41,6 +42,9 @@ namespace Rejistry { } } + VKRecord::VKRecord(const VKRecord& sourceRecord) : Record(sourceRecord._buf, sourceRecord._offset) { + } + bool VKRecord::hasName() const { return (getWord(NAME_LENGTH_OFFSET) != 0x0); } @@ -51,7 +55,7 @@ namespace Rejistry { std::wstring VKRecord::getName() const { if (! hasName()) { - return L""; + return VKRecord::DEFAULT_VALUE_NAME; } uint32_t nameLength = getWord(NAME_LENGTH_OFFSET); diff --git a/rejistry++/src/VKRecord.h b/rejistry++/src/VKRecord.h index 9bbfed6cfd6e2a3c78d16324d42f5762b57b324a..c0a048fb0adb2bb07bc434af4905e4e31445b506 100644 --- a/rejistry++/src/VKRecord.h +++ b/rejistry++/src/VKRecord.h @@ -43,6 +43,8 @@ namespace Rejistry { */ class VKRecord : public Record { public: + static const std::wstring DEFAULT_VALUE_NAME; + typedef VKRecord * VKRecordPtr; typedef std::vector< VKRecordPtr > VKRecordPtrList; @@ -81,7 +83,7 @@ namespace Rejistry { }; VKRecord(RegistryByteBuffer * buf, uint32_t offset); - + VKRecord(const VKRecord &); virtual ~VKRecord() {} /** diff --git a/rejistry++/src/ValueListRecord.cpp b/rejistry++/src/ValueListRecord.cpp index 306414932eaca77bba4ddac955fc7986b91343fe..cdfce00ec3347cb79e1302e7dce862faf962f76b 100644 --- a/rejistry++/src/ValueListRecord.cpp +++ b/rejistry++/src/ValueListRecord.cpp @@ -61,7 +61,10 @@ namespace Rejistry { VKRecord::VKRecordPtrList::iterator it = recordList.begin(); for (; it != recordList.end(); ++it) { - if (_wcsicmp(name.c_str(), (*it)->getName().c_str()) == 0) { + // If we have a name match or we are searching for the "default" entry + // (which matches a record with no name) we are done. + if ((!(*it)->hasName() && name == VKRecord::DEFAULT_VALUE_NAME) || + (_wcsicmp(name.c_str(), (*it)->getName().c_str()) == 0)) { // Create a copy of the record to return as the records // in the list will be deleted. foundRecord = new VKRecord(*(*it));