• R/O
  • HTTP
  • SSH
  • HTTPS

MUtilities: 提交

MUtilities development repository


Commit MetaInfo

修订版0bad6355d0c06564804eb629ba9874a6799f0561 (tree)
时间2015-05-03 03:52:10
作者LoRd_MuldeR <mulder2@gmx....>
CommiterLoRd_MuldeR

Log Message

Fixed a memory leak + fixed check condition.

更改概述

差异

--- a/MUtilities_VS2013.vcxproj
+++ b/MUtilities_VS2013.vcxproj
@@ -164,7 +164,7 @@
164164 <SubSystem>Windows</SubSystem>
165165 <GenerateDebugInformation>true</GenerateDebugInformation>
166166 <AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\Win32</AdditionalLibraryDirectories>
167- <AdditionalDependencies>QtCored4.lib;QtGuid4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;%(AdditionalDependencies)</AdditionalDependencies>
167+ <AdditionalDependencies>QtCored4.lib;QtGuid4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
168168 </Link>
169169 </ItemDefinitionGroup>
170170 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -193,7 +193,7 @@
193193 <EnableCOMDATFolding>true</EnableCOMDATFolding>
194194 <OptimizeReferences>true</OptimizeReferences>
195195 <AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\Win32</AdditionalLibraryDirectories>
196- <AdditionalDependencies>QtCore4.lib;QtGui4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;%(AdditionalDependencies)</AdditionalDependencies>
196+ <AdditionalDependencies>QtCore4.lib;QtGui4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
197197 <GenerateDebugInformation>false</GenerateDebugInformation>
198198 </Link>
199199 </ItemDefinitionGroup>
--- a/src/Registry_Win32.cpp
+++ b/src/Registry_Win32.cpp
@@ -106,6 +106,7 @@ MUtils::Registry::RegistryKey::~RegistryKey(void)
106106 p->m_hKey = NULL;
107107 p->m_isOpen = false;
108108 }
109+ delete p;
109110 }
110111
111112 inline bool MUtils::Registry::RegistryKey::isOpen(void)
@@ -128,7 +129,7 @@ bool MUtils::Registry::RegistryKey::value_write(const QString &valueName, const
128129 bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, quint32 &value) const
129130 {
130131 DWORD size = sizeof(quint32), type = -1;
131- CHECK_STATUS(false);
132+ CHECK_STATUS(true);
132133 return (RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&value), &size) == ERROR_SUCCESS) && (type == REG_DWORD);
133134 }
134135
@@ -136,7 +137,7 @@ bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, QString
136137 {
137138 wchar_t buffer[2048];
138139 DWORD size = sizeof(wchar_t) * 2048, type = -1;
139- CHECK_STATUS(false);
140+ CHECK_STATUS(true);
140141 if((RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&value), &size) == ERROR_SUCCESS) && ((type == REG_SZ) || (type == REG_EXPAND_SZ)))
141142 {
142143 value = QString::fromUtf16(reinterpret_cast<const ushort*>(buffer));
Show on old repository browser