SaferRecordEventLogEntry function (winsafer.h)

The SaferRecordEventLogEntry function saves messages to an event log.


BOOL SaferRecordEventLogEntry(
  [in] LPCWSTR            szTargetPath,
       LPVOID             lpReserved


[in] hLevel

SAFER_LEVEL_HANDLE that contains the details of the rule to send to the event log.

[in] szTargetPath

Path of the file that attempted to run.


Reserved for future use. This parameter should be set to NULL.

Return value

TRUE if the function succeeds; otherwise, FALSE. For extended error information, call GetLastError.


If SaferIdentifyLevel returns a SAFER_LEVEL_HANDLE with a LevelId that is anything other than SAFER_LEVELID_FULLYTRUSTED (0x40000), SaferRecordEventLogEntry can be called to facilitate troubleshooting. For example, clicking a button in excel.exe might attempt to launch another process that is not fully trusted. This might display an obscure error message because the program remapped the error returned from CreateProcess. To ease troubleshooting, some Safer functions call SaferRecordEventLogEntry to send an event to the event log.


Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winsafer.h
Library Advapi32.lib
DLL Advapi32.dll
API set ext-ms-win-advapi32-safer-l1-1-0 (introduced in Windows 8)