2004-03-08 21:58:17 +00:00
|
|
|
/*
|
|
|
|
* Win32 advapi functions
|
|
|
|
*
|
|
|
|
* Copyright 1995 Sven Verdoolaege
|
|
|
|
* Copyright 1998 Juergen Schmied
|
|
|
|
* Copyright 2003 Mike Hearn
|
2018-02-25 15:31:00 +00:00
|
|
|
* Copyright 2007 Hervé Poussineau
|
2004-03-08 21:58:17 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-10-27 10:34:16 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2004-03-08 21:58:17 +00:00
|
|
|
*/
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2005-08-05 10:31:28 +00:00
|
|
|
#include <advapi32.h>
|
2014-01-20 13:16:06 +00:00
|
|
|
|
|
|
|
#include <ndk/kefuncs.h>
|
|
|
|
#include <eventlogrpc_c.h>
|
|
|
|
|
2008-02-08 17:04:39 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
2004-03-08 21:58:17 +00:00
|
|
|
|
2010-02-03 20:46:21 +00:00
|
|
|
static RPC_UNICODE_STRING EmptyStringU = { 0, 0, L"" };
|
|
|
|
static RPC_STRING EmptyStringA = { 0, 0, "" };
|
2008-10-31 22:18:12 +00:00
|
|
|
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2008-10-31 22:18:12 +00:00
|
|
|
handle_t __RPC_USER
|
|
|
|
EVENTLOG_HANDLE_A_bind(EVENTLOG_HANDLE_A UNCServerName)
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
{
|
2008-10-31 22:18:12 +00:00
|
|
|
handle_t hBinding = NULL;
|
2018-02-25 15:31:00 +00:00
|
|
|
RPC_CSTR pszStringBinding;
|
2018-03-25 10:03:07 +00:00
|
|
|
RPC_STATUS status;
|
2008-10-31 22:18:12 +00:00
|
|
|
|
|
|
|
TRACE("EVENTLOG_HANDLE_A_bind() called\n");
|
|
|
|
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcStringBindingComposeA(NULL,
|
2018-02-25 15:31:00 +00:00
|
|
|
(RPC_CSTR)"ncacn_np",
|
|
|
|
(RPC_CSTR)UNCServerName,
|
|
|
|
(RPC_CSTR)"\\pipe\\EventLog",
|
2008-10-31 22:18:12 +00:00
|
|
|
NULL,
|
2018-02-25 15:31:00 +00:00
|
|
|
&pszStringBinding);
|
2018-03-25 10:03:07 +00:00
|
|
|
if (status)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the binding handle that will be used to bind to the server. */
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcBindingFromStringBindingA(pszStringBinding,
|
2008-10-31 22:18:12 +00:00
|
|
|
&hBinding);
|
2018-03-25 10:03:07 +00:00
|
|
|
if (status != RPC_S_OK)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
}
|
|
|
|
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcStringFreeA(&pszStringBinding);
|
|
|
|
if (status != RPC_S_OK)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcStringFree returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return hBinding;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
EVENTLOG_HANDLE_A_unbind(EVENTLOG_HANDLE_A UNCServerName,
|
|
|
|
handle_t hBinding)
|
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
RPC_STATUS status;
|
2008-10-31 22:18:12 +00:00
|
|
|
|
|
|
|
TRACE("EVENTLOG_HANDLE_A_unbind() called\n");
|
|
|
|
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcBindingFree(&hBinding);
|
|
|
|
if (status != RPC_S_OK)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcBindingFree returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handle_t __RPC_USER
|
|
|
|
EVENTLOG_HANDLE_W_bind(EVENTLOG_HANDLE_W UNCServerName)
|
|
|
|
{
|
|
|
|
handle_t hBinding = NULL;
|
2018-02-25 15:31:00 +00:00
|
|
|
RPC_WSTR pszStringBinding;
|
2018-03-25 10:03:07 +00:00
|
|
|
RPC_STATUS status;
|
2008-10-31 22:18:12 +00:00
|
|
|
|
|
|
|
TRACE("EVENTLOG_HANDLE_W_bind() called\n");
|
|
|
|
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcStringBindingComposeW(NULL,
|
2008-10-31 22:18:12 +00:00
|
|
|
L"ncacn_np",
|
2016-05-23 02:03:49 +00:00
|
|
|
UNCServerName,
|
2008-10-31 22:18:12 +00:00
|
|
|
L"\\pipe\\EventLog",
|
|
|
|
NULL,
|
|
|
|
&pszStringBinding);
|
2018-03-25 10:03:07 +00:00
|
|
|
if (status != RPC_S_OK)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcStringBindingCompose returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the binding handle that will be used to bind to the server. */
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcBindingFromStringBindingW(pszStringBinding,
|
2008-10-31 22:18:12 +00:00
|
|
|
&hBinding);
|
2018-03-25 10:03:07 +00:00
|
|
|
if (status != RPC_S_OK)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcBindingFromStringBinding returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
}
|
|
|
|
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcStringFreeW(&pszStringBinding);
|
|
|
|
if (status != RPC_S_OK)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcStringFree returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return hBinding;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
EVENTLOG_HANDLE_W_unbind(EVENTLOG_HANDLE_W UNCServerName,
|
|
|
|
handle_t hBinding)
|
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
RPC_STATUS status;
|
2008-10-31 22:18:12 +00:00
|
|
|
|
|
|
|
TRACE("EVENTLOG_HANDLE_W_unbind() called\n");
|
|
|
|
|
2018-03-25 10:03:07 +00:00
|
|
|
status = RpcBindingFree(&hBinding);
|
|
|
|
if (status != RPC_S_OK)
|
2008-10-31 22:18:12 +00:00
|
|
|
{
|
2018-03-25 10:03:07 +00:00
|
|
|
ERR("RpcBindingFree returned 0x%x\n", status);
|
2008-10-31 22:18:12 +00:00
|
|
|
}
|
|
|
|
}
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-05-18 16:01:29 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* BackupEventLogA [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfBackupEventLogFileA(IN HANDLE hEventLog,
|
|
|
|
IN PANSI_STRING BackupFileNameA)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
if (!BackupFileNameA || (BackupFileNameA->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrBackupELFA(hEventLog,
|
|
|
|
(PRPC_STRING)BackupFileNameA);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
BOOL WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
BackupEventLogA(IN HANDLE hEventLog,
|
|
|
|
IN LPCSTR lpBackupFileName)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
BOOL Success;
|
|
|
|
NTSTATUS Status;
|
2012-01-05 22:07:33 +00:00
|
|
|
ANSI_STRING BackupFileNameA;
|
|
|
|
UNICODE_STRING BackupFileNameW;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-02-08 17:04:39 +00:00
|
|
|
TRACE("%p, %s\n", hEventLog, lpBackupFileName);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
if (lpBackupFileName == NULL)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
2012-01-05 22:07:33 +00:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
RtlInitAnsiString(&BackupFileNameA, lpBackupFileName);
|
|
|
|
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&BackupFileNameW,
|
|
|
|
&BackupFileNameA,
|
|
|
|
TRUE);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Success = BackupEventLogW(hEventLog,
|
|
|
|
BackupFileNameW.Buffer);
|
2012-01-05 22:07:33 +00:00
|
|
|
|
|
|
|
RtlFreeUnicodeString(&BackupFileNameW);
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Success;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* BackupEventLogW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* lpBackupFileName []
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfBackupEventLogFileW(IN HANDLE hEventLog,
|
|
|
|
IN PUNICODE_STRING BackupFileNameU)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
if (!BackupFileNameU || (BackupFileNameU->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrBackupELFW(hEventLog,
|
|
|
|
(PRPC_UNICODE_STRING)BackupFileNameU);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
BOOL WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
BackupEventLogW(IN HANDLE hEventLog,
|
|
|
|
IN LPCWSTR lpBackupFileName)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2008-10-31 22:18:12 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
UNICODE_STRING BackupFileName;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-05-18 15:29:53 +00:00
|
|
|
TRACE("%p, %s\n", hEventLog, debugstr_w(lpBackupFileName));
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
if (lpBackupFileName == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!RtlDosPathNameToNtPathName_U(lpBackupFileName, &BackupFileName,
|
2012-01-05 22:07:33 +00:00
|
|
|
NULL, NULL))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfBackupEventLogFileW(hEventLog, &BackupFileName);
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, BackupFileName.Buffer);
|
2012-01-05 22:07:33 +00:00
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* ClearEventLogA [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfClearEventLogFileA(IN HANDLE hEventLog,
|
|
|
|
IN PANSI_STRING BackupFileNameA)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrClearELFA(hEventLog,
|
|
|
|
(PRPC_STRING)BackupFileNameA);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
BOOL WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
ClearEventLogA(IN HANDLE hEventLog,
|
|
|
|
IN LPCSTR lpBackupFileName)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
BOOL Success;
|
|
|
|
NTSTATUS Status;
|
2012-01-05 22:07:33 +00:00
|
|
|
ANSI_STRING BackupFileNameA;
|
|
|
|
UNICODE_STRING BackupFileNameW;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-02-08 17:04:39 +00:00
|
|
|
TRACE("%p, %s\n", hEventLog, lpBackupFileName);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
if (lpBackupFileName == NULL)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
2012-01-05 22:07:33 +00:00
|
|
|
RtlInitUnicodeString(&BackupFileNameW, NULL);
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
2012-01-05 22:07:33 +00:00
|
|
|
else
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
2012-01-05 22:07:33 +00:00
|
|
|
RtlInitAnsiString(&BackupFileNameA, lpBackupFileName);
|
|
|
|
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&BackupFileNameW,
|
|
|
|
&BackupFileNameA,
|
|
|
|
TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Success = ClearEventLogW(hEventLog,
|
|
|
|
BackupFileNameW.Buffer);
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
RtlFreeUnicodeString(&BackupFileNameW);
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Success;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* ClearEventLogW [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfClearEventLogFileW(IN HANDLE hEventLog,
|
|
|
|
IN PUNICODE_STRING BackupFileNameU)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrClearELFW(hEventLog,
|
|
|
|
(PRPC_UNICODE_STRING)BackupFileNameU);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
BOOL WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
ClearEventLogW(IN HANDLE hEventLog,
|
|
|
|
IN LPCWSTR lpBackupFileName)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2008-10-31 22:18:12 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
UNICODE_STRING BackupFileName;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-05-18 15:29:53 +00:00
|
|
|
TRACE("%p, %s\n", hEventLog, debugstr_w(lpBackupFileName));
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
if (lpBackupFileName == NULL)
|
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
RtlInitUnicodeString(&BackupFileName, NULL);
|
2012-01-05 22:07:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!RtlDosPathNameToNtPathName_U(lpBackupFileName, &BackupFileName,
|
2012-01-05 22:07:33 +00:00
|
|
|
NULL, NULL))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfClearEventLogFileW(hEventLog, &BackupFileName);
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2012-01-05 22:07:33 +00:00
|
|
|
if (lpBackupFileName != NULL)
|
2016-05-23 02:03:49 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, BackupFileName.Buffer);
|
2012-01-05 22:07:33 +00:00
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* CloseEventLog [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfCloseEventLog(IN HANDLE hEventLog)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = ElfrCloseEL(&hEventLog);
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
CloseEventLog(IN HANDLE hEventLog)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
TRACE("%p\n", hEventLog);
|
|
|
|
|
|
|
|
Status = ElfCloseEventLog(hEventLog);
|
2008-10-31 22:18:12 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
{
|
2008-10-31 22:18:12 +00:00
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* DeregisterEventSource [ADVAPI32.@]
|
|
|
|
* Closes a handle to the specified event log
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog [I] Handle to event log
|
|
|
|
*
|
|
|
|
* RETURNS STD
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfDeregisterEventSource(IN HANDLE hEventLog)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2007-08-14 08:49:29 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = ElfrDeregisterEventSource(&hEventLog);
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
DeregisterEventSource(IN HANDLE hEventLog)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
TRACE("%p\n", hEventLog);
|
|
|
|
|
|
|
|
Status = ElfDeregisterEventSource(hEventLog);
|
2007-08-14 08:49:29 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2007-08-14 08:49:29 +00:00
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2010-01-01 14:41:44 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GetEventLogInformation [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog [I] Handle to event log
|
|
|
|
* dwInfoLevel [I] Level of event log information to return
|
|
|
|
* lpBuffer [O] Buffer that receives the event log information
|
|
|
|
* cbBufSize [I] Size of the lpBuffer buffer
|
|
|
|
* pcbBytesNeeded [O] Required buffer size
|
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
GetEventLogInformation(IN HANDLE hEventLog,
|
|
|
|
IN DWORD dwInfoLevel,
|
|
|
|
OUT LPVOID lpBuffer,
|
|
|
|
IN DWORD cbBufSize,
|
|
|
|
OUT LPDWORD pcbBytesNeeded)
|
|
|
|
{
|
2010-02-03 20:46:21 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2010-03-14 12:26:49 +00:00
|
|
|
if (dwInfoLevel != EVENTLOG_FULL_INFO)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_LEVEL);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-02-03 20:46:21 +00:00
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrGetLogInformation(hEventLog,
|
|
|
|
dwInfoLevel,
|
|
|
|
(LPBYTE)lpBuffer,
|
|
|
|
cbBufSize,
|
|
|
|
pcbBytesNeeded);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2010-01-01 14:41:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GetNumberOfEventLogRecords [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* NumberOfRecords []
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfNumberOfRecords(IN HANDLE hEventLog,
|
|
|
|
OUT PULONG NumberOfRecords)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!NumberOfRecords)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
2010-02-03 20:46:21 +00:00
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfrNumberOfRecords(hEventLog, NumberOfRecords);
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
GetNumberOfEventLogRecords(IN HANDLE hEventLog,
|
|
|
|
OUT PDWORD NumberOfRecords)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
TRACE("%p, %p\n", hEventLog, NumberOfRecords);
|
|
|
|
|
|
|
|
Status = ElfNumberOfRecords(hEventLog, NumberOfRecords);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GetOldestEventLogRecord [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* OldestRecord []
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfOldestRecord(IN HANDLE hEventLog,
|
|
|
|
OUT PULONG OldestRecordNumber)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!OldestRecordNumber)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
2010-02-03 20:46:21 +00:00
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfrOldestRecord(hEventLog, OldestRecordNumber);
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
GetOldestEventLogRecord(IN HANDLE hEventLog,
|
|
|
|
OUT PDWORD OldestRecord)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
TRACE("%p, %p\n", hEventLog, OldestRecord);
|
|
|
|
|
|
|
|
Status = ElfOldestRecord(hEventLog, OldestRecord);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* NotifyChangeEventLog [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* hEvent []
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfChangeNotify(IN HANDLE hEventLog,
|
|
|
|
IN HANDLE hEvent)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
CLIENT_ID ClientId = NtCurrentTeb()->ClientId;
|
|
|
|
RPC_CLIENT_ID RpcClientId;
|
|
|
|
|
|
|
|
RpcClientId.UniqueProcess = HandleToUlong(ClientId.UniqueProcess);
|
|
|
|
RpcClientId.UniqueThread = HandleToUlong(ClientId.UniqueThread);
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
2019-04-07 16:26:26 +00:00
|
|
|
Status = ElfrChangeNotify(hEventLog, RpcClientId, HandleToUlong(hEvent));
|
2016-05-23 02:03:49 +00:00
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
BOOL WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
NotifyChangeEventLog(IN HANDLE hEventLog,
|
|
|
|
IN HANDLE hEvent)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
TRACE("%p, %p\n", hEventLog, hEvent);
|
|
|
|
|
|
|
|
Status = ElfChangeNotify(hEventLog, hEvent);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* OpenBackupEventLogA [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfOpenBackupEventLogA(IN PANSI_STRING UNCServerNameA,
|
|
|
|
IN PANSI_STRING BackupFileNameA,
|
|
|
|
OUT PHANDLE phEventLog)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
PSTR pUNCServerName = NULL;
|
|
|
|
|
|
|
|
if (!phEventLog || !BackupFileNameA || (BackupFileNameA->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
if (UNCServerNameA && (UNCServerNameA->Length != 0))
|
|
|
|
pUNCServerName = UNCServerNameA->Buffer;
|
|
|
|
|
|
|
|
*phEventLog = NULL;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrOpenBELA(pUNCServerName,
|
|
|
|
(PRPC_STRING)BackupFileNameA,
|
|
|
|
1, 1,
|
|
|
|
(IELF_HANDLE*)phEventLog);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
HANDLE WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
OpenBackupEventLogA(IN LPCSTR lpUNCServerName,
|
|
|
|
IN LPCSTR lpFileName)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE LogHandle;
|
2012-01-08 10:08:33 +00:00
|
|
|
ANSI_STRING UNCServerNameA;
|
|
|
|
UNICODE_STRING UNCServerNameW;
|
|
|
|
ANSI_STRING FileNameA;
|
|
|
|
UNICODE_STRING FileNameW;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-02-08 17:04:39 +00:00
|
|
|
TRACE("%s, %s\n", lpUNCServerName, lpFileName);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2012-01-08 10:08:33 +00:00
|
|
|
/* Convert the server name to unicode */
|
|
|
|
if (lpUNCServerName == NULL)
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
{
|
2012-01-08 10:08:33 +00:00
|
|
|
RtlInitUnicodeString(&UNCServerNameW, NULL);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
}
|
2012-01-08 10:08:33 +00:00
|
|
|
else
|
2010-02-03 20:46:21 +00:00
|
|
|
{
|
2012-01-08 10:08:33 +00:00
|
|
|
RtlInitAnsiString(&UNCServerNameA, lpUNCServerName);
|
|
|
|
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&UNCServerNameW,
|
|
|
|
&UNCServerNameA,
|
|
|
|
TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-02-03 20:46:21 +00:00
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2012-01-08 10:08:33 +00:00
|
|
|
/* Convert the file name to unicode */
|
|
|
|
if (lpFileName == NULL)
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
{
|
2012-01-08 10:08:33 +00:00
|
|
|
RtlInitUnicodeString(&FileNameW, NULL);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
}
|
2012-01-08 10:08:33 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
RtlInitAnsiString(&FileNameA, lpFileName);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2012-01-08 10:08:33 +00:00
|
|
|
Status = RtlAnsiStringToUnicodeString(&FileNameW,
|
|
|
|
&FileNameA,
|
|
|
|
TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
RtlFreeUnicodeString(&UNCServerNameW);
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call the unicode function */
|
|
|
|
LogHandle = OpenBackupEventLogW(UNCServerNameW.Buffer,
|
|
|
|
FileNameW.Buffer);
|
|
|
|
|
|
|
|
/* Free the unicode strings */
|
|
|
|
RtlFreeUnicodeString(&UNCServerNameW);
|
|
|
|
RtlFreeUnicodeString(&FileNameW);
|
|
|
|
|
|
|
|
return LogHandle;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* OpenBackupEventLogW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpUNCServerName []
|
|
|
|
* lpFileName []
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfOpenBackupEventLogW(IN PUNICODE_STRING UNCServerNameU,
|
|
|
|
IN PUNICODE_STRING BackupFileNameU,
|
|
|
|
OUT PHANDLE phEventLog)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
PWSTR pUNCServerName = NULL;
|
|
|
|
|
|
|
|
if (!phEventLog || !BackupFileNameU || (BackupFileNameU->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
if (UNCServerNameU && (UNCServerNameU->Length != 0))
|
|
|
|
pUNCServerName = UNCServerNameU->Buffer;
|
|
|
|
|
|
|
|
*phEventLog = NULL;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrOpenBELW(pUNCServerName,
|
|
|
|
(PRPC_UNICODE_STRING)BackupFileNameU,
|
2018-03-25 10:03:07 +00:00
|
|
|
1,
|
|
|
|
1,
|
2016-05-23 02:03:49 +00:00
|
|
|
(IELF_HANDLE*)phEventLog);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
HANDLE WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
OpenBackupEventLogW(IN LPCWSTR lpUNCServerName,
|
|
|
|
IN LPCWSTR lpFileName)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2008-10-31 22:18:12 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
HANDLE hEventLog;
|
|
|
|
UNICODE_STRING UNCServerName, FileName;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-05-18 15:29:53 +00:00
|
|
|
TRACE("%s, %s\n", debugstr_w(lpUNCServerName), debugstr_w(lpFileName));
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2012-01-08 10:08:33 +00:00
|
|
|
if (lpFileName == NULL)
|
|
|
|
{
|
2012-02-04 19:56:21 +00:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return NULL;
|
2012-01-08 10:08:33 +00:00
|
|
|
}
|
2012-02-04 19:56:21 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!RtlDosPathNameToNtPathName_U(lpFileName, &FileName,
|
2012-02-04 19:56:21 +00:00
|
|
|
NULL, NULL))
|
2012-01-08 10:08:33 +00:00
|
|
|
{
|
2012-02-04 19:56:21 +00:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return NULL;
|
2012-01-08 10:08:33 +00:00
|
|
|
}
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
RtlInitUnicodeString(&UNCServerName, lpUNCServerName);
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfOpenBackupEventLogW(&UNCServerName, &FileName, &hEventLog);
|
2018-03-25 10:03:07 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (FileName.Buffer != NULL)
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
|
2012-01-08 10:08:33 +00:00
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return hEventLog;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* OpenEventLogA [ADVAPI32.@]
|
2010-01-18 16:03:30 +00:00
|
|
|
*
|
|
|
|
* Opens a handle to the specified event log.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpUNCServerName [I] UNC name of the server on which the event log is
|
|
|
|
* opened.
|
|
|
|
* lpSourceName [I] Name of the log.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: Handle to an event log.
|
|
|
|
* Failure: NULL
|
2004-03-08 21:58:17 +00:00
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfOpenEventLogA(IN PANSI_STRING UNCServerNameA,
|
|
|
|
IN PANSI_STRING SourceNameA,
|
|
|
|
OUT PHANDLE phEventLog)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2010-02-03 20:46:21 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
PSTR pUNCServerName = NULL;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!phEventLog || !SourceNameA || (SourceNameA->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (UNCServerNameA && (UNCServerNameA->Length != 0))
|
|
|
|
pUNCServerName = UNCServerNameA->Buffer;
|
2010-02-03 20:46:21 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
*phEventLog = NULL;
|
2010-02-03 20:46:21 +00:00
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfrOpenELA(pUNCServerName,
|
|
|
|
(PRPC_STRING)SourceNameA,
|
2010-02-03 20:46:21 +00:00
|
|
|
&EmptyStringA,
|
2018-03-25 10:03:07 +00:00
|
|
|
1,
|
|
|
|
1,
|
2016-05-23 02:03:49 +00:00
|
|
|
(IELF_HANDLE*)phEventLog);
|
2010-02-03 20:46:21 +00:00
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WINAPI
|
|
|
|
OpenEventLogA(IN LPCSTR lpUNCServerName,
|
|
|
|
IN LPCSTR lpSourceName)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE hEventLog;
|
|
|
|
ANSI_STRING UNCServerName, SourceName;
|
|
|
|
|
|
|
|
TRACE("%s, %s\n", lpUNCServerName, lpSourceName);
|
|
|
|
|
|
|
|
RtlInitAnsiString(&UNCServerName, lpUNCServerName);
|
|
|
|
RtlInitAnsiString(&SourceName, lpSourceName);
|
|
|
|
|
|
|
|
Status = ElfOpenEventLogA(&UNCServerName, &SourceName, &hEventLog);
|
2010-02-03 20:46:21 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return hEventLog;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* OpenEventLogW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
* lpUNCServerName []
|
|
|
|
* lpSourceName []
|
2004-03-08 21:58:17 +00:00
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfOpenEventLogW(IN PUNICODE_STRING UNCServerNameU,
|
|
|
|
IN PUNICODE_STRING SourceNameU,
|
|
|
|
OUT PHANDLE phEventLog)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2008-10-31 22:18:12 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
PWSTR pUNCServerName = NULL;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!phEventLog || !SourceNameU || (SourceNameU->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
2010-02-03 20:46:21 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (UNCServerNameU && (UNCServerNameU->Length != 0))
|
|
|
|
pUNCServerName = UNCServerNameU->Buffer;
|
2010-02-03 20:46:21 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
*phEventLog = NULL;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfrOpenELW(pUNCServerName,
|
|
|
|
(PRPC_UNICODE_STRING)SourceNameU,
|
2010-02-03 20:46:21 +00:00
|
|
|
&EmptyStringU,
|
2018-03-25 10:03:07 +00:00
|
|
|
1,
|
|
|
|
1,
|
2016-05-23 02:03:49 +00:00
|
|
|
(IELF_HANDLE*)phEventLog);
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WINAPI
|
|
|
|
OpenEventLogW(IN LPCWSTR lpUNCServerName,
|
|
|
|
IN LPCWSTR lpSourceName)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE hEventLog;
|
|
|
|
UNICODE_STRING UNCServerName, SourceName;
|
|
|
|
|
|
|
|
TRACE("%s, %s\n", debugstr_w(lpUNCServerName), debugstr_w(lpSourceName));
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&UNCServerName, lpUNCServerName);
|
|
|
|
RtlInitUnicodeString(&SourceName, lpSourceName);
|
|
|
|
|
|
|
|
Status = ElfOpenEventLogW(&UNCServerName, &SourceName, &hEventLog);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return hEventLog;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* ReadEventLogA [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfReadEventLogA(IN HANDLE hEventLog,
|
|
|
|
IN ULONG ReadFlags,
|
|
|
|
IN ULONG RecordOffset,
|
|
|
|
OUT LPVOID Buffer,
|
|
|
|
IN ULONG NumberOfBytesToRead,
|
|
|
|
OUT PULONG NumberOfBytesRead,
|
|
|
|
OUT PULONG MinNumberOfBytesNeeded)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
ULONG Flags;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!Buffer || !NumberOfBytesRead || !MinNumberOfBytesNeeded)
|
2010-01-17 21:40:39 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
return STATUS_INVALID_PARAMETER;
|
2010-01-17 21:40:39 +00:00
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Flags = ReadFlags & (EVENTLOG_SEQUENTIAL_READ | EVENTLOG_SEEK_READ);
|
|
|
|
if (Flags == (EVENTLOG_SEQUENTIAL_READ | EVENTLOG_SEEK_READ))
|
2009-05-17 11:31:58 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
return STATUS_INVALID_PARAMETER;
|
2012-02-04 19:56:21 +00:00
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Flags = ReadFlags & (EVENTLOG_FORWARDS_READ | EVENTLOG_BACKWARDS_READ);
|
|
|
|
if (Flags == (EVENTLOG_FORWARDS_READ | EVENTLOG_BACKWARDS_READ))
|
2012-02-04 19:56:21 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
return STATUS_INVALID_PARAMETER;
|
2009-05-17 11:31:58 +00:00
|
|
|
}
|
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = ElfrReadELA(hEventLog,
|
2016-05-23 02:03:49 +00:00
|
|
|
ReadFlags,
|
|
|
|
RecordOffset,
|
|
|
|
NumberOfBytesToRead,
|
|
|
|
Buffer,
|
|
|
|
NumberOfBytesRead,
|
|
|
|
MinNumberOfBytesNeeded);
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
ReadEventLogA(IN HANDLE hEventLog,
|
|
|
|
IN DWORD dwReadFlags,
|
|
|
|
IN DWORD dwRecordOffset,
|
|
|
|
OUT LPVOID lpBuffer,
|
|
|
|
IN DWORD nNumberOfBytesToRead,
|
|
|
|
OUT DWORD *pnBytesRead,
|
|
|
|
OUT DWORD *pnMinNumberOfBytesNeeded)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
TRACE("%p, %lu, %lu, %p, %lu, %p, %p\n",
|
|
|
|
hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
|
|
|
|
nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
|
2009-05-17 11:31:58 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfReadEventLogA(hEventLog,
|
|
|
|
dwReadFlags,
|
|
|
|
dwRecordOffset,
|
|
|
|
lpBuffer,
|
|
|
|
nNumberOfBytesToRead,
|
|
|
|
pnBytesRead,
|
|
|
|
pnMinNumberOfBytesNeeded);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* ReadEventLogW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* dwReadFlags []
|
|
|
|
* dwRecordOffset []
|
|
|
|
* lpBuffer []
|
|
|
|
* nNumberOfBytesToRead []
|
|
|
|
* pnBytesRead []
|
|
|
|
* pnMinNumberOfBytesNeeded []
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfReadEventLogW(IN HANDLE hEventLog,
|
|
|
|
IN ULONG ReadFlags,
|
|
|
|
IN ULONG RecordOffset,
|
|
|
|
OUT LPVOID Buffer,
|
|
|
|
IN ULONG NumberOfBytesToRead,
|
|
|
|
OUT PULONG NumberOfBytesRead,
|
|
|
|
OUT PULONG MinNumberOfBytesNeeded)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
ULONG Flags;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!Buffer || !NumberOfBytesRead || !MinNumberOfBytesNeeded)
|
2010-01-17 21:40:39 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
return STATUS_INVALID_PARAMETER;
|
2010-01-17 21:40:39 +00:00
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Flags = ReadFlags & (EVENTLOG_SEQUENTIAL_READ | EVENTLOG_SEEK_READ);
|
|
|
|
if (Flags == (EVENTLOG_SEQUENTIAL_READ | EVENTLOG_SEEK_READ))
|
2009-05-17 11:31:58 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
return STATUS_INVALID_PARAMETER;
|
2012-02-04 19:56:21 +00:00
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Flags = ReadFlags & (EVENTLOG_FORWARDS_READ | EVENTLOG_BACKWARDS_READ);
|
|
|
|
if (Flags == (EVENTLOG_FORWARDS_READ | EVENTLOG_BACKWARDS_READ))
|
2012-02-04 19:56:21 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
return STATUS_INVALID_PARAMETER;
|
2009-05-17 11:31:58 +00:00
|
|
|
}
|
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = ElfrReadELW(hEventLog,
|
2016-05-23 02:03:49 +00:00
|
|
|
ReadFlags,
|
|
|
|
RecordOffset,
|
|
|
|
NumberOfBytesToRead,
|
|
|
|
Buffer,
|
|
|
|
NumberOfBytesRead,
|
|
|
|
MinNumberOfBytesNeeded);
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
ReadEventLogW(IN HANDLE hEventLog,
|
|
|
|
IN DWORD dwReadFlags,
|
|
|
|
IN DWORD dwRecordOffset,
|
|
|
|
OUT LPVOID lpBuffer,
|
|
|
|
IN DWORD nNumberOfBytesToRead,
|
|
|
|
OUT DWORD *pnBytesRead,
|
|
|
|
OUT DWORD *pnMinNumberOfBytesNeeded)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
2009-05-17 11:31:58 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
TRACE("%p, %lu, %lu, %p, %lu, %p, %p\n",
|
|
|
|
hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
|
|
|
|
nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
|
|
|
|
|
|
|
|
Status = ElfReadEventLogW(hEventLog,
|
|
|
|
dwReadFlags,
|
|
|
|
dwRecordOffset,
|
|
|
|
lpBuffer,
|
|
|
|
nNumberOfBytesToRead,
|
|
|
|
pnBytesRead,
|
|
|
|
pnMinNumberOfBytesNeeded);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* RegisterEventSourceA [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfRegisterEventSourceA(IN PANSI_STRING UNCServerNameA,
|
|
|
|
IN PANSI_STRING SourceNameA,
|
|
|
|
OUT PHANDLE phEventLog)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2010-02-03 20:46:21 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
PSTR pUNCServerName = NULL;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!phEventLog || !SourceNameA || (SourceNameA->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (UNCServerNameA && (UNCServerNameA->Length != 0))
|
|
|
|
pUNCServerName = UNCServerNameA->Buffer;
|
|
|
|
|
|
|
|
*phEventLog = NULL;
|
2010-02-03 20:46:21 +00:00
|
|
|
|
|
|
|
RpcTryExcept
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfrRegisterEventSourceA(pUNCServerName,
|
|
|
|
(PRPC_STRING)SourceNameA,
|
2010-02-03 20:46:21 +00:00
|
|
|
&EmptyStringA,
|
2018-03-25 10:03:07 +00:00
|
|
|
1,
|
|
|
|
1,
|
2016-05-23 02:03:49 +00:00
|
|
|
(IELF_HANDLE*)phEventLog);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
}
|
2010-02-03 20:46:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WINAPI
|
|
|
|
RegisterEventSourceA(IN LPCSTR lpUNCServerName,
|
|
|
|
IN LPCSTR lpSourceName)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE hEventLog;
|
|
|
|
ANSI_STRING UNCServerName, SourceName;
|
|
|
|
|
|
|
|
TRACE("%s, %s\n", lpUNCServerName, lpSourceName);
|
|
|
|
|
|
|
|
RtlInitAnsiString(&UNCServerName, lpUNCServerName);
|
|
|
|
RtlInitAnsiString(&SourceName, lpSourceName);
|
|
|
|
|
|
|
|
Status = ElfRegisterEventSourceA(&UNCServerName, &SourceName, &hEventLog);
|
2010-02-03 20:46:21 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
{
|
2010-02-03 20:46:21 +00:00
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return hEventLog;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* RegisterEventSourceW [ADVAPI32.@]
|
|
|
|
* Returns a registered handle to an event log
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpUNCServerName [I] Server name for source
|
|
|
|
* lpSourceName [I] Source name for registered handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: Handle
|
|
|
|
* Failure: NULL
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfRegisterEventSourceW(IN PUNICODE_STRING UNCServerNameU,
|
|
|
|
IN PUNICODE_STRING SourceNameU,
|
|
|
|
OUT PHANDLE phEventLog)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2008-10-31 22:18:12 +00:00
|
|
|
NTSTATUS Status;
|
2016-05-23 02:03:49 +00:00
|
|
|
PWSTR pUNCServerName = NULL;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (!phEventLog || !SourceNameU || (SourceNameU->Length == 0))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
2007-08-14 08:49:29 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
if (UNCServerNameU && (UNCServerNameU->Length != 0))
|
|
|
|
pUNCServerName = UNCServerNameU->Buffer;
|
|
|
|
|
|
|
|
*phEventLog = NULL;
|
2007-08-14 08:49:29 +00:00
|
|
|
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcTryExcept
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfrRegisterEventSourceW(pUNCServerName,
|
|
|
|
(PRPC_UNICODE_STRING)SourceNameU,
|
2010-02-03 20:46:21 +00:00
|
|
|
&EmptyStringU,
|
2018-03-25 10:03:07 +00:00
|
|
|
1,
|
|
|
|
1,
|
2016-05-23 02:03:49 +00:00
|
|
|
(IELF_HANDLE*)phEventLog);
|
2008-11-01 20:37:04 +00:00
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
2008-11-01 20:37:04 +00:00
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
2009-01-07 09:44:21 +00:00
|
|
|
RpcEndExcept;
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WINAPI
|
|
|
|
RegisterEventSourceW(IN LPCWSTR lpUNCServerName,
|
|
|
|
IN LPCWSTR lpSourceName)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE hEventLog;
|
|
|
|
UNICODE_STRING UNCServerName, SourceName;
|
|
|
|
|
|
|
|
TRACE("%s, %s\n", debugstr_w(lpUNCServerName), debugstr_w(lpSourceName));
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&UNCServerName, lpUNCServerName);
|
|
|
|
RtlInitUnicodeString(&SourceName, lpSourceName);
|
|
|
|
|
|
|
|
Status = ElfRegisterEventSourceW(&UNCServerName, &SourceName, &hEventLog);
|
2007-08-14 08:49:29 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
return hEventLog;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* ReportEventA [ADVAPI32.@]
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfReportEventA(IN HANDLE hEventLog,
|
|
|
|
IN USHORT EventType,
|
|
|
|
IN USHORT EventCategory,
|
|
|
|
IN ULONG EventID,
|
|
|
|
IN PSID UserSID,
|
|
|
|
IN USHORT NumStrings,
|
|
|
|
IN ULONG DataSize,
|
|
|
|
IN PANSI_STRING* Strings,
|
|
|
|
IN PVOID Data,
|
|
|
|
IN USHORT Flags,
|
|
|
|
IN OUT PULONG RecordNumber,
|
|
|
|
IN OUT PULONG TimeWritten)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
LARGE_INTEGER SystemTime;
|
|
|
|
ULONG Time;
|
|
|
|
ULONG dwSize;
|
|
|
|
ANSI_STRING ComputerName;
|
|
|
|
CHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
|
|
|
|
|
|
|
dwSize = ARRAYSIZE(szComputerName);
|
|
|
|
GetComputerNameA(szComputerName, &dwSize);
|
|
|
|
RtlInitAnsiString(&ComputerName, szComputerName);
|
|
|
|
|
|
|
|
NtQuerySystemTime(&SystemTime);
|
|
|
|
RtlTimeToSecondsSince1970(&SystemTime, &Time);
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrReportEventA(hEventLog,
|
|
|
|
Time,
|
|
|
|
EventType,
|
|
|
|
EventCategory,
|
|
|
|
EventID,
|
|
|
|
NumStrings,
|
|
|
|
DataSize,
|
|
|
|
(PRPC_STRING)&ComputerName,
|
2018-02-25 15:31:00 +00:00
|
|
|
(PRPC_SID)UserSID,
|
2016-05-23 02:03:49 +00:00
|
|
|
(PRPC_STRING*)Strings,
|
|
|
|
Data,
|
|
|
|
Flags,
|
|
|
|
RecordNumber,
|
|
|
|
TimeWritten);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
BOOL WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
ReportEventA(IN HANDLE hEventLog,
|
|
|
|
IN WORD wType,
|
|
|
|
IN WORD wCategory,
|
|
|
|
IN DWORD dwEventID,
|
|
|
|
IN PSID lpUserSid,
|
|
|
|
IN WORD wNumStrings,
|
|
|
|
IN DWORD dwDataSize,
|
|
|
|
IN LPCSTR *lpStrings,
|
|
|
|
IN LPVOID lpRawData)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2010-02-03 20:46:21 +00:00
|
|
|
NTSTATUS Status;
|
2011-12-12 21:54:20 +00:00
|
|
|
PANSI_STRING *Strings;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
WORD i;
|
2004-03-08 21:58:17 +00:00
|
|
|
|
2010-02-03 20:46:21 +00:00
|
|
|
TRACE("%p, %u, %u, %lu, %p, %u, %lu, %p, %p\n",
|
|
|
|
hEventLog, wType, wCategory, dwEventID, lpUserSid,
|
|
|
|
wNumStrings, dwDataSize, lpStrings, lpRawData);
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2010-02-03 20:46:21 +00:00
|
|
|
Strings = HeapAlloc(GetProcessHeap(),
|
2011-12-12 21:54:20 +00:00
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
wNumStrings * sizeof(PANSI_STRING));
|
2010-02-03 20:46:21 +00:00
|
|
|
if (!Strings)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2010-02-03 20:46:21 +00:00
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2010-02-03 20:46:21 +00:00
|
|
|
for (i = 0; i < wNumStrings; i++)
|
2011-12-12 21:54:20 +00:00
|
|
|
{
|
|
|
|
Strings[i] = HeapAlloc(GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
sizeof(ANSI_STRING));
|
|
|
|
if (Strings[i])
|
|
|
|
{
|
|
|
|
RtlInitAnsiString(Strings[i], lpStrings[i]);
|
|
|
|
}
|
|
|
|
}
|
2010-02-03 20:46:21 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfReportEventA(hEventLog,
|
|
|
|
wType,
|
|
|
|
wCategory,
|
|
|
|
dwEventID,
|
|
|
|
lpUserSid,
|
|
|
|
wNumStrings,
|
|
|
|
dwDataSize,
|
|
|
|
Strings,
|
|
|
|
lpRawData,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2011-12-12 21:54:20 +00:00
|
|
|
for (i = 0; i < wNumStrings; i++)
|
|
|
|
{
|
|
|
|
if (Strings[i] != NULL)
|
|
|
|
HeapFree(GetProcessHeap(), 0, Strings[i]);
|
|
|
|
}
|
|
|
|
|
2010-02-03 20:46:21 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, Strings);
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
2010-02-03 20:46:21 +00:00
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2010-02-03 20:46:21 +00:00
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-25 11:30:07 +00:00
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* ReportEventW [ADVAPI32.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hEventLog []
|
|
|
|
* wType []
|
|
|
|
* wCategory []
|
|
|
|
* dwEventID []
|
|
|
|
* lpUserSid []
|
|
|
|
* wNumStrings []
|
|
|
|
* dwDataSize []
|
|
|
|
* lpStrings []
|
|
|
|
* lpRawData []
|
|
|
|
*/
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfReportEventW(IN HANDLE hEventLog,
|
|
|
|
IN USHORT EventType,
|
|
|
|
IN USHORT EventCategory,
|
|
|
|
IN ULONG EventID,
|
|
|
|
IN PSID UserSID,
|
|
|
|
IN USHORT NumStrings,
|
|
|
|
IN ULONG DataSize,
|
|
|
|
IN PUNICODE_STRING* Strings,
|
|
|
|
IN PVOID Data,
|
|
|
|
IN USHORT Flags,
|
|
|
|
IN OUT PULONG RecordNumber,
|
|
|
|
IN OUT PULONG TimeWritten)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
LARGE_INTEGER SystemTime;
|
|
|
|
ULONG Time;
|
|
|
|
ULONG dwSize;
|
|
|
|
UNICODE_STRING ComputerName;
|
|
|
|
WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
|
|
|
|
|
|
|
dwSize = ARRAYSIZE(szComputerName);
|
|
|
|
GetComputerNameW(szComputerName, &dwSize);
|
|
|
|
RtlInitUnicodeString(&ComputerName, szComputerName);
|
|
|
|
|
|
|
|
NtQuerySystemTime(&SystemTime);
|
|
|
|
RtlTimeToSecondsSince1970(&SystemTime, &Time);
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrReportEventW(hEventLog,
|
|
|
|
Time,
|
|
|
|
EventType,
|
|
|
|
EventCategory,
|
|
|
|
EventID,
|
|
|
|
NumStrings,
|
|
|
|
DataSize,
|
|
|
|
(PRPC_UNICODE_STRING)&ComputerName,
|
2018-02-25 15:31:00 +00:00
|
|
|
(PRPC_SID)UserSID,
|
2016-05-23 02:03:49 +00:00
|
|
|
(PRPC_UNICODE_STRING*)Strings,
|
|
|
|
Data,
|
|
|
|
Flags,
|
|
|
|
RecordNumber,
|
|
|
|
TimeWritten);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2004-03-08 21:58:17 +00:00
|
|
|
BOOL WINAPI
|
2008-09-21 13:55:53 +00:00
|
|
|
ReportEventW(IN HANDLE hEventLog,
|
|
|
|
IN WORD wType,
|
|
|
|
IN WORD wCategory,
|
|
|
|
IN DWORD dwEventID,
|
|
|
|
IN PSID lpUserSid,
|
|
|
|
IN WORD wNumStrings,
|
|
|
|
IN DWORD dwDataSize,
|
|
|
|
IN LPCWSTR *lpStrings,
|
|
|
|
IN LPVOID lpRawData)
|
2004-03-08 21:58:17 +00:00
|
|
|
{
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
NTSTATUS Status;
|
2011-12-12 21:54:20 +00:00
|
|
|
PUNICODE_STRING *Strings;
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
WORD i;
|
|
|
|
|
2008-02-08 17:04:39 +00:00
|
|
|
TRACE("%p, %u, %u, %lu, %p, %u, %lu, %p, %p\n",
|
2008-11-01 20:37:04 +00:00
|
|
|
hEventLog, wType, wCategory, dwEventID, lpUserSid,
|
|
|
|
wNumStrings, dwDataSize, lpStrings, lpRawData);
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2008-09-21 13:55:53 +00:00
|
|
|
Strings = HeapAlloc(GetProcessHeap(),
|
2016-05-23 02:03:49 +00:00
|
|
|
HEAP_ZERO_MEMORY,
|
2011-12-12 21:54:20 +00:00
|
|
|
wNumStrings * sizeof(PUNICODE_STRING));
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
if (!Strings)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
for (i = 0; i < wNumStrings; i++)
|
2011-12-12 21:54:20 +00:00
|
|
|
{
|
|
|
|
Strings[i] = HeapAlloc(GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
2016-05-23 02:03:49 +00:00
|
|
|
sizeof(UNICODE_STRING));
|
2011-12-12 21:54:20 +00:00
|
|
|
if (Strings[i])
|
|
|
|
{
|
|
|
|
RtlInitUnicodeString(Strings[i], lpStrings[i]);
|
|
|
|
}
|
|
|
|
}
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
Status = ElfReportEventW(hEventLog,
|
|
|
|
wType,
|
|
|
|
wCategory,
|
|
|
|
dwEventID,
|
|
|
|
lpUserSid,
|
|
|
|
wNumStrings,
|
|
|
|
dwDataSize,
|
|
|
|
Strings,
|
|
|
|
lpRawData,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2008-11-01 20:37:04 +00:00
|
|
|
|
2011-12-12 21:54:20 +00:00
|
|
|
for (i = 0; i < wNumStrings; i++)
|
|
|
|
{
|
|
|
|
if (Strings[i] != NULL)
|
|
|
|
HeapFree(GetProcessHeap(), 0, Strings[i]);
|
|
|
|
}
|
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, Strings);
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-09-21 13:55:53 +00:00
|
|
|
|
Implement BackupEventLogA/W, ClearEventLogA/W, CloseEventLog, DeregisterEventSource, GetNumberOfEventLogRecords, GetOldestEventLogRecord, OpenBackupEventLogA/W, OpenEventLogA/W, ReadEventLogA/W, RegisterEventSourceA/W by calling appropriate method in eventlog.exe
Add correct implementation for ReportEventW, but do not activate it (WIDL doesn't support the prototype)
svn path=/trunk/; revision=28338
2007-08-14 13:20:14 +00:00
|
|
|
return TRUE;
|
2004-03-08 21:58:17 +00:00
|
|
|
}
|
Sync aclui, advapi32, atl, authz, kernel32, msi, oledlg, powrprof, qmgr, riched20, samlib to Wine 1.2rc5
Update some psdk Headers to get some more synched winetests build
svn path=/trunk/; revision=47930
2010-07-03 12:42:55 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfReportEventAndSourceW(IN HANDLE hEventLog,
|
|
|
|
IN ULONG Time,
|
|
|
|
IN PUNICODE_STRING ComputerName,
|
|
|
|
IN USHORT EventType,
|
|
|
|
IN USHORT EventCategory,
|
|
|
|
IN ULONG EventID,
|
|
|
|
IN PSID UserSID,
|
|
|
|
IN PUNICODE_STRING SourceName,
|
|
|
|
IN USHORT NumStrings,
|
|
|
|
IN ULONG DataSize,
|
|
|
|
IN PUNICODE_STRING* Strings,
|
|
|
|
IN PVOID Data,
|
|
|
|
IN USHORT Flags,
|
|
|
|
IN OUT PULONG RecordNumber,
|
|
|
|
IN OUT PULONG TimeWritten)
|
2014-11-27 14:21:43 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS Status;
|
2014-11-27 14:21:43 +00:00
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrReportEventAndSourceW(hEventLog,
|
|
|
|
Time,
|
|
|
|
EventType,
|
|
|
|
EventCategory,
|
|
|
|
EventID,
|
|
|
|
(PRPC_UNICODE_STRING)SourceName,
|
|
|
|
NumStrings,
|
|
|
|
DataSize,
|
|
|
|
(PRPC_UNICODE_STRING)ComputerName,
|
|
|
|
(PRPC_SID)UserSID,
|
|
|
|
(PRPC_UNICODE_STRING*)Strings,
|
|
|
|
(PBYTE)Data,
|
|
|
|
Flags,
|
|
|
|
RecordNumber,
|
|
|
|
TimeWritten);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
2014-11-27 14:21:43 +00:00
|
|
|
}
|
|
|
|
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ElfFlushEventLog(IN HANDLE hEventLog)
|
2014-11-27 14:21:43 +00:00
|
|
|
{
|
2016-05-23 02:03:49 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
Status = ElfrFlushEL(hEventLog);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return Status;
|
2014-11-27 18:59:19 +00:00
|
|
|
}
|