windows.cfg: Improved configuration for OpenProcess(). (#5651)

This commit is contained in:
orbitcowboy 2023-11-11 14:08:21 +01:00 committed by GitHub
parent 2d232dcaac
commit f4df28d5ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -4800,6 +4800,23 @@ HFONT CreateFont(
<not-bool/>
</arg>
</function>
<!-- HANDLE OpenProcess([in] DWORD dwDesiredAccess,
[in] BOOL bInheritHandle,
[in] DWORD dwProcessId); -->
<function name="OpenProcess">
<use-retval/>
<noreturn>false</noreturn>
<returnValue type="HANDLE"/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
</arg>
</function>
<!--VOID WINAPI FreeLibraryAndExitThread(
_In_ HMODULE hModule,
_In_ DWORD dwExitCode);-->

View File

@ -19,6 +19,13 @@
#include <atlstr.h>
#include <string>
void resourceLeak_OpenProcess(const DWORD dwDesiredAccess, const BOOL bInheritHandle, const DWORD dwProcessId)
{
HANDLE proc = OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId);
if (proc != INVALID_HANDLE_VALUE) {}
// cppcheck-suppress resourceLeak
}
/// https://learn.microsoft.com/en-us/windows/console/flushconsoleinputbuffer
BOOL unreachableCode_FlushConsoleInputBuffer(int &val)
{