Fixed a memory leak + fixed check condition.
This commit is contained in:
parent
636e61c484
commit
0bad6355d0
@ -164,7 +164,7 @@
|
|||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\Win32</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\Win32</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>QtCored4.lib;QtGuid4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>QtCored4.lib;QtGuid4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@ -193,7 +193,7 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\Win32</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\Win32</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>QtCore4.lib;QtGui4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>QtCore4.lib;QtGui4.lib;Winmm.lib;Psapi.lib;Sensapi.lib;PowrProf.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -106,6 +106,7 @@ MUtils::Registry::RegistryKey::~RegistryKey(void)
|
|||||||
p->m_hKey = NULL;
|
p->m_hKey = NULL;
|
||||||
p->m_isOpen = false;
|
p->m_isOpen = false;
|
||||||
}
|
}
|
||||||
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool MUtils::Registry::RegistryKey::isOpen(void)
|
inline bool MUtils::Registry::RegistryKey::isOpen(void)
|
||||||
@ -128,7 +129,7 @@ bool MUtils::Registry::RegistryKey::value_write(const QString &valueName, const
|
|||||||
bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, quint32 &value) const
|
bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, quint32 &value) const
|
||||||
{
|
{
|
||||||
DWORD size = sizeof(quint32), type = -1;
|
DWORD size = sizeof(quint32), type = -1;
|
||||||
CHECK_STATUS(false);
|
CHECK_STATUS(true);
|
||||||
return (RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&value), &size) == ERROR_SUCCESS) && (type == REG_DWORD);
|
return (RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&value), &size) == ERROR_SUCCESS) && (type == REG_DWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, QString
|
|||||||
{
|
{
|
||||||
wchar_t buffer[2048];
|
wchar_t buffer[2048];
|
||||||
DWORD size = sizeof(wchar_t) * 2048, type = -1;
|
DWORD size = sizeof(wchar_t) * 2048, type = -1;
|
||||||
CHECK_STATUS(false);
|
CHECK_STATUS(true);
|
||||||
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)))
|
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)))
|
||||||
{
|
{
|
||||||
value = QString::fromUtf16(reinterpret_cast<const ushort*>(buffer));
|
value = QString::fromUtf16(reinterpret_cast<const ushort*>(buffer));
|
||||||
|
Loading…
Reference in New Issue
Block a user