Skip to content

Commit

Permalink
windows.cfg: Added support for obsolete UpdateTraceW()/UpdateTraceA(). (
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitcowboy authored Jun 27, 2024
1 parent 781ef2a commit 16ebe0b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cfg/windows.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6775,6 +6775,21 @@ HFONT CreateFont(
<not-bool/>
</arg>
</function>
<!-- ULONG UpdateTraceA(CONTROLTRACE_ID TraceId, LPCSTR InstanceName, PEVENT_TRACE_PROPERTIES Properties); -->
<!-- ULONG UpdateTraceW(CONTROLTRACE_ID TraceId, LPCWSTR InstanceName, PEVENT_TRACE_PROPERTIES Properties); -->
<function name="UpdateTraceA,UpdateTraceW">
<noreturn>false</noreturn>
<returnValue type="ULONG"/>
<use-retval/>
<warn severity="style" alternatives="ControlTrace" reason="Obsolete">This function is obsolete. The ControlTrace function supersedes this function.</warn>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="out"/>
</function>
<!-- BOOL DeviceIoControl(
_In_ HANDLE hDevice,
_In_ DWORD dwIoControlCode,
Expand Down
12 changes: 12 additions & 0 deletions test/cfg/windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <WinCon.h>
#include <cstdio>
#include <direct.h>
#include <evntrace.h>
#include <cstdlib>
#include <ctime>
#include <memory.h>
Expand All @@ -22,6 +23,17 @@
#include <atlstr.h>
#include <string>

bool UpdateTraceACalled(TRACEHANDLE traceHandle, LPCSTR loggerName, EVENT_TRACE_PROPERTIES* pProperties)
{
// cppcheck-suppress UpdateTraceACalled
return UpdateTraceA(traceHandle, loggerName, pProperties) != ERROR_SUCCESS;
}
bool UpdateTraceWCalled(TRACEHANDLE traceHandle, LPCWSTR loggerName, EVENT_TRACE_PROPERTIES* pProperties)
{
// cppcheck-suppress UpdateTraceWCalled
return UpdateTraceW(traceHandle, loggerName, pProperties) != ERROR_SUCCESS;
}

void invalidHandle_CreateFile(LPCWSTR lpFileName)
{
HANDLE file = CreateFile(lpFileName, GENERIC_READ, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
Expand Down

0 comments on commit 16ebe0b

Please sign in to comment.