Ticket #214 (new enhancement)

Opened 5 years ago

Replacing use of SHGetMalloc in CLogFile.cpp

Reported by: michelpons Owned by: Michael Halloran
Priority: minor Milestone: 2.5
Component: COLoggers Version: 2.4
Keywords: Cc: michaelhalloran

Description

At line 60 of CLogFile.cpp, as part of the COLTT Controller source code, as per commit 334, line is:
SHGetMalloc(&pMalloc);
When analyzing the code in Visual Studio 2015 Community Edition, this line raises a warning:
Return value ignored: ‘SHGetMalloc’
But more than that, the Windows Dev Center says (https://docs.microsoft.com/en-us/windows/desktop/api/shlobj_core/nf-shlobj_core-shgetmalloc):
“SHGetMalloc is available through Windows Vista and Windows Server 2003, but may be altered or unavailable in subsequent versions of the operating system or product. See the Remarks section for alternate recommendations.”
The alternate recommendations lead to CoTaskMemAlloc and CoTaskMemFree functions as replacement. CoTaskMemAlloc/COTaskMemAlloc are supported from Windows 2000 upward so cover the operating systems targeted by COLTT. Would it make sense to replace SHGetMalloc by the recommendations above?

Note: See TracTickets for help on using tickets.