From f70a31c90b28782e61cb0dbfd8f6663f70c047bb Mon Sep 17 00:00:00 2001 From: Ayowel Date: Tue, 21 Dec 2021 00:35:42 +0100 Subject: [PATCH] Add eventlog methods definitions --- src/um/winbase.rs | 94 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 79 insertions(+), 15 deletions(-) diff --git a/src/um/winbase.rs b/src/um/winbase.rs index 1891738e2..92fbb8aff 100644 --- a/src/um/winbase.rs +++ b/src/um/winbase.rs @@ -128,6 +128,11 @@ pub type LPLDT_ENTRY = LPVOID; // TODO - fix this for 32-bit // DATABITS_* // STOPBITS_* // PARITY_* +pub const EVENTLOG_FULL_INFO: DWORD = 0; +STRUCT!{struct EVENTLOG_FULL_INFORMATION { + dwFull: DWORD, +}} +pub type LPEVENTLOG_FULL_INFORMATION = *mut EVENTLOG_FULL_INFORMATION; STRUCT!{struct COMMPROP { wPacketLength: WORD, wPacketVersion: WORD, @@ -2007,19 +2012,48 @@ extern "system" { lpTransferSize: LPDWORD, lpNumOutstandingRequests: LPDWORD, ) -> BOOL; - // pub fn ClearEventLogA(); - // pub fn ClearEventLogW(); - // pub fn BackupEventLogA(); - // pub fn BackupEventLogW(); - // pub fn CloseEventLog(); + pub fn ClearEventLogA( + hEventLog: HANDLE, + lpBackupFileName: LPCSTR, + ) -> BOOL; + pub fn ClearEventLogW( + hEventLog: HANDLE, + lpBackupFileName: LPCWSTR, + ) -> BOOL; + pub fn BackupEventLogA( + hEventLog: HANDLE, + lpBackupFileName: LPCSTR, + ) -> BOOL; + pub fn BackupEventLogW( + hEventLog: HANDLE, + lpBackupFileName: LPCWSTR, + ) -> BOOL; + pub fn CloseEventLog( + hEventLog: HANDLE, + ) -> BOOL; pub fn DeregisterEventSource( hEventLog: HANDLE, ) -> BOOL; - // pub fn NotifyChangeEventLog(); - // pub fn GetNumberOfEventLogRecords(); - // pub fn GetOldestEventLogRecord(); - // pub fn OpenEventLogA(); - // pub fn OpenEventLogW(); + pub fn NotifyChangeEventLog( + hEventLog: HANDLE, + hEvent: HANDLE, + ) -> BOOL; + pub fn GetNumberOfEventLogRecords( + hEventLog: HANDLE, + NumberOfRecords: PDWORD, + ) -> BOOL; + pub fn GetOldestEventLogRecord( + hEventLog: HANDLE, + OldestRecord: PDWORD, + ) -> BOOL; + pub fn OpenEventLogA( + lpUNCServerName: LPCSTR, + lpSourceName: LPCSTR, + ) -> HANDLE; + pub fn OpenEventLogW( + lpUNCServerName: LPCWSTR, + lpSourceName: LPCWSTR, + ) -> HANDLE; pub fn RegisterEventSourceA( lpUNCServerName: LPCSTR, lpSourceName: LPCSTR, @@ -2028,10 +2062,34 @@ extern "system" { lpUNCServerName: LPCWSTR, lpSourceName: LPCWSTR, ) -> HANDLE; - // pub fn OpenBackupEventLogA(); - // pub fn OpenBackupEventLogW(); - // pub fn ReadEventLogA(); - // pub fn ReadEventLogW(); + pub fn OpenBackupEventLogA( + lpUNCServerName: LPCSTR, + lpFileName: LPCSTR, + ) -> HANDLE; + pub fn OpenBackupEventLogW( + lpUNCServerName: LPCWSTR, + lpFileName: LPCWSTR, + ) -> HANDLE; + pub fn ReadEventLogA( + hEventLog: HANDLE, + dwReadFlags: DWORD, + dwRecordOffset: DWORD, + lpBuffer: LPVOID, + //lpBuffer: PEVENTLOGRECORD, + nNumberOfBytesToRead: DWORD, + pnBytesRead: *mut DWORD, + pnMinNumberOfBytesNeeded: *mut DWORD, + ) -> BOOL; + pub fn ReadEventLogW( + hEventLog: HANDLE, + dwReadFlags: DWORD, + dwRecordOffset: DWORD, + lpBuffer: LPVOID, + //lpBuffer: PEVENTLOGRECORD, + nNumberOfBytesToRead: DWORD, + pnBytesRead: *mut DWORD, + pnMinNumberOfBytesNeeded: *mut DWORD, + ) -> BOOL; pub fn ReportEventA( hEventLog: HANDLE, wType: WORD, @@ -2054,7 +2112,13 @@ extern "system" { lpStrings: *mut LPCWSTR, lpRawData: LPVOID, ) -> BOOL; - // pub fn GetEventLogInformation(); + pub fn GetEventLogInformation( + hEventLog: HANDLE, + dwInfoLevel: DWORD, + lpBuffer: LPVOID, + cbBufSize: DWORD, + pcbBytesNeeded: LPDWORD, + ) -> BOOL; // pub fn OperationStart(); // pub fn OperationEnd(); // pub fn AccessCheckAndAuditAlarmA();