diff --git a/cfg/windows.cfg b/cfg/windows.cfg
index 98a09c088..5413e673e 100644
--- a/cfg/windows.cfg
+++ b/cfg/windows.cfg
@@ -1176,6 +1176,10 @@
_freea
+
+ AllocateAndInitializeSid
+ FreeSid
+
false
@@ -4188,6 +4192,161 @@ HFONT CreateFont(
+
+
+
+ false
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+ 0:
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0:
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh
index 978bd63f6..252f60d22 100755
--- a/test/cfg/runtests.sh
+++ b/test/cfg/runtests.sh
@@ -40,6 +40,6 @@ ${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.cpp
# windows.cpp
# Syntax check via g++ does not work because it can not find a valid windows.h
#${CXX} ${CXX_OPT} ${DIR}windows.cpp
-${CPPCHECK} ${CPPCHECK_OPT} --platform=win32A ${DIR}windows.cpp
-${CPPCHECK} ${CPPCHECK_OPT} --platform=win32W ${DIR}windows.cpp
-${CPPCHECK} ${CPPCHECK_OPT} --platform=win64 ${DIR}windows.cpp
+${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32A ${DIR}windows.cpp
+${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win32W ${DIR}windows.cpp
+${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --platform=win64 ${DIR}windows.cpp
diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp
index 25e204a0f..c507abae7 100644
--- a/test/cfg/windows.cpp
+++ b/test/cfg/windows.cpp
@@ -79,6 +79,21 @@ void validCode()
void *pMem2 = _alloca(10);
memset(pMem2, 0, 10);
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+
+ DWORD lastError = GetLastError();
+ SetLastError(lastError);
+
+ PSID pEveryoneSID = NULL;
+ SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
+ AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pEveryoneSID)
+ FreeSid(pEveryoneSID);
+
+ LPVOID pMem = HeapAlloc(GetProcessHeap(), 0, 10);
+ pMem = HeapReAlloc(GetProcessHeap(), 0, pMem, 0);
+ HeapFree(GetProcessHeap(), 0, pMem);
+
// Valid Library usage, no leaks, valid arguments
HINSTANCE hInstLib = LoadLibrary(L"My.dll");
FreeLibrary(hInstLib);
@@ -152,6 +167,11 @@ void nullPointer()
// cppcheck-suppress struprCalled
// cppcheck-suppress nullPointer
strupr(str);
+
+ // cppcheck-suppress nullPointer
+ GetSystemTime(NULL);
+ // cppcheck-suppress nullPointer
+ GetLocalTime(NULL);
}
void memleak_malloca()
@@ -161,6 +181,24 @@ void memleak_malloca()
// cppcheck-suppress memleak
}
+void memleak_AllocateAndInitializeSid()
+{
+ PSID pEveryoneSID = NULL;
+ SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
+ AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pEveryoneSID)
+ // TODO: enable when #6994 is implemented cppcheck-suppress memleak
+}
+
+void memleak_HeapAlloc()
+{
+ LPVOID pMem;
+ pMem = HeapAlloc(GetProcessHeap(), 0, 10);
+ HeapValidate(GetProcessHeap(), 0, pMem);
+ // cppcheck-suppress unreadVariable
+ SIZE_T memSize = HeapSize(GetProcessHeap(), 0, pMem);
+ // cppcheck-suppress memleak
+}
+
void resourceLeak_CreateSemaphoreA()
{
HANDLE hSemaphore;
@@ -280,6 +318,16 @@ void ignoredReturnValue()
_malloca(10);
// cppcheck-suppress ignoredReturnValue
_alloca(5);
+
+ // cppcheck-suppress ignoredReturnValue
+ GetLastError();
+
+ // cppcheck-suppress ignoredReturnValue
+ GetProcessHeap()
+ // cppcheck-suppress leakReturnValNotUsed
+ HeapAlloc(GetProcessHeap(), 0, 10);
+ // cppcheck-suppress leakReturnValNotUsed
+ HeapReAlloc(GetProcessHeap(), 0, 1, 0);
}
void invalidFunctionArg()
@@ -361,6 +409,10 @@ void uninitvar()
// cppcheck-suppress struprCalled
// cppcheck-suppress uninitvar
strupr(buf_uninit);
+
+ DWORD dwordUninit;
+ // cppcheck-suppress uninitvar
+ SetLastError(dwordUninit);
}
void allocDealloc_GetModuleHandleEx()