Write to Windows event log: Difference between revisions
Content added Content deleted
(Added C implementation.) |
|||
Line 230: | Line 230: | ||
PROC_comexit</lang> |
PROC_comexit</lang> |
||
=={{header|C}} |
=={{header|C}}== |
||
The following is a wrapper on the EventCreate utility provided in Windows. Note that to use this wrapper, the code must be executed from a console/IDE running as Administrator. The utility itself does extensive error-checking and validation, so apart from the check that 5 arguments have been supplied, no other validations or checks are performed. |
The following is a wrapper on the EventCreate utility provided in Windows. Note that to use this wrapper, the code must be executed from a console/IDE running as Administrator. The utility itself does extensive error-checking and validation, so apart from the check that 5 arguments have been supplied, no other validations or checks are performed. |
||
<lang C> |
<lang C> |
||
Line 259: | Line 259: | ||
</pre> |
</pre> |
||
Microsoft does provide an C/C++ API for EventCreate, but as with everything Microsoft, it's so wonderfully convoluted, that I will just give a link to the [https://msdn.microsoft.com/en-us/library/aa363680(v=vs.85).aspx ReportEvent] example. |
Microsoft does provide an C/C++ API for EventCreate, but as with everything Microsoft, it's so wonderfully convoluted, that I will just give a link to the [https://msdn.microsoft.com/en-us/library/aa363680(v=vs.85).aspx ReportEvent] example. |
||
=={{header|C sharp}}== |
=={{header|C sharp}}== |
||
In Windows Vista and later or Windows Server 2003, you must have administrative privileges to execute this code. |
In Windows Vista and later or Windows Server 2003, you must have administrative privileges to execute this code. |