mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:25:55 +00:00
Forward RegisterEventSourceW and DeregisterEventSource to eventlog service
svn path=/trunk/; revision=28337
This commit is contained in:
parent
91add81a87
commit
3bf2d78767
6 changed files with 169 additions and 21 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <services/services.h>
|
||||
#include "svcctl_c.h"
|
||||
#include "lsa_c.h"
|
||||
#include "eventlogrpc_c.h"
|
||||
|
||||
#ifndef HAS_FN_PROGRESSW
|
||||
#define FN_PROGRESSW FN_PROGRESS
|
||||
|
@ -36,6 +37,16 @@
|
|||
#define FN_PROGRESSA FN_PROGRESS
|
||||
#endif
|
||||
|
||||
/* rpc.c */
|
||||
|
||||
RPC_STATUS EvtBindRpc(LPCWSTR pszMachine,
|
||||
RPC_BINDING_HANDLE* BindingHandle);
|
||||
RPC_STATUS EvtUnbindRpc(RPC_BINDING_HANDLE *BindingHandle);
|
||||
|
||||
BOOL
|
||||
EvtGetLocalHandle(RPC_BINDING_HANDLE *BindingHandle);
|
||||
RPC_STATUS EvtUnbindLocalHandle(void);
|
||||
|
||||
/* Interface to ntmarta.dll **************************************************/
|
||||
|
||||
typedef struct _NTMARTA
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<include base="advapi32">.</include>
|
||||
<include base="scm_client">.</include>
|
||||
<include base="lsa_client">.</include>
|
||||
<include base="eventlog_client">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="WINVER">0x600</define>
|
||||
<define name="_WIN32_IE">0x0500</define>
|
||||
|
@ -12,6 +13,7 @@
|
|||
<define name="_UNICODE"></define>
|
||||
<library>scm_client</library>
|
||||
<library>lsa_client</library>
|
||||
<library>eventlog_client</library>
|
||||
<library>ntdll</library>
|
||||
<library>rpcrt4</library>
|
||||
<library>wine</library>
|
||||
|
@ -49,6 +51,7 @@
|
|||
</directory>
|
||||
<directory name="service">
|
||||
<file>eventlog.c</file>
|
||||
<file>rpc.c</file>
|
||||
<file>scm.c</file>
|
||||
<file>sctrl.c</file>
|
||||
<file>undoc.c</file>
|
||||
|
|
|
@ -899,7 +899,7 @@ LookupAccountSidW (
|
|||
PSID_NAME_USE peUse )
|
||||
{
|
||||
LSA_UNICODE_STRING SystemName;
|
||||
LSA_OBJECT_ATTRIBUTES ObjectAttributes = {0};
|
||||
LSA_OBJECT_ATTRIBUTES ObjectAttributes = {0};
|
||||
LSA_HANDLE PolicyHandle = NULL;
|
||||
NTSTATUS Status;
|
||||
PLSA_REFERENCED_DOMAIN_LIST ReferencedDomain = NULL;
|
||||
|
|
|
@ -97,10 +97,30 @@ CloseEventLog (HANDLE hEventLog)
|
|||
* RETURNS STD
|
||||
*/
|
||||
BOOL WINAPI
|
||||
DeregisterEventSource (HANDLE hEventLog)
|
||||
DeregisterEventSource(
|
||||
IN HANDLE hEventLog)
|
||||
{
|
||||
DPRINT1("(%p): stub\n",hEventLog);
|
||||
return TRUE;
|
||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||
LOGHANDLE Handle = (LOGHANDLE)hEventLog;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("%p\n", hEventLog);
|
||||
|
||||
if (!EvtGetLocalHandle(&BindingHandle))
|
||||
{
|
||||
SetLastError(ERROR_GEN_FAILURE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = ElfrDeregisterEventSource(
|
||||
BindingHandle,
|
||||
&Handle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -291,12 +311,44 @@ RegisterEventSourceA (LPCSTR lpUNCServerName,
|
|||
* Failure: NULL
|
||||
*/
|
||||
HANDLE WINAPI
|
||||
RegisterEventSourceW (LPCWSTR lpUNCServerName,
|
||||
LPCWSTR lpSourceName)
|
||||
RegisterEventSourceW(
|
||||
IN LPCWSTR lpUNCServerName,
|
||||
IN LPCWSTR lpSourceName)
|
||||
{
|
||||
DPRINT1("(%S, %S): stub\n",
|
||||
lpUNCServerName, lpSourceName);
|
||||
return (HANDLE)1;
|
||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||
LOGHANDLE Handle;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("%S, %S\n", lpUNCServerName, lpSourceName);
|
||||
|
||||
if (lpUNCServerName != NULL)
|
||||
{
|
||||
DPRINT1("lpUNCServerName argument not supported\n");
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!EvtGetLocalHandle(&BindingHandle))
|
||||
{
|
||||
SetLastError(ERROR_GEN_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = ElfrRegisterEventSourceW(
|
||||
BindingHandle,
|
||||
(LPWSTR)lpUNCServerName,
|
||||
(LPWSTR)lpSourceName,
|
||||
L"",
|
||||
0,
|
||||
0,
|
||||
&Handle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (HANDLE)Handle;
|
||||
}
|
||||
|
||||
|
||||
|
@ -415,6 +467,10 @@ ReportEventW (HANDLE hEventLog,
|
|||
DPRINT1("Warning: %S\n", lpStrings[i]);
|
||||
break;
|
||||
|
||||
case EVENTLOG_INFORMATION_TYPE:
|
||||
DPRINT1("Info: %S\n", lpStrings[i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("Type %hu: %S\n", wType, lpStrings[i]);
|
||||
break;
|
||||
|
|
90
reactos/dll/win32/advapi32/service/rpc.c
Normal file
90
reactos/dll/win32/advapi32/service/rpc.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/advapi32/service/rpc.c
|
||||
* PURPOSE: RPC support routines
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <advapi32.h>
|
||||
|
||||
static RPC_BINDING_HANDLE LocalBindingHandle = NULL;
|
||||
|
||||
RPC_STATUS
|
||||
EvtBindRpc(LPCWSTR pszMachine,
|
||||
RPC_BINDING_HANDLE* BindingHandle)
|
||||
{
|
||||
PWSTR pszStringBinding = NULL;
|
||||
RPC_STATUS Status;
|
||||
|
||||
Status = RpcStringBindingComposeW(NULL,
|
||||
L"ncacn_np",
|
||||
(LPWSTR)pszMachine,
|
||||
L"\\pipe\\EventLog",
|
||||
NULL,
|
||||
&pszStringBinding);
|
||||
if (Status != RPC_S_OK)
|
||||
return Status;
|
||||
|
||||
Status = RpcBindingFromStringBindingW(pszStringBinding,
|
||||
BindingHandle);
|
||||
|
||||
RpcStringFreeW(&pszStringBinding);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
RPC_STATUS
|
||||
EvtUnbindRpc(RPC_BINDING_HANDLE *BindingHandle)
|
||||
{
|
||||
if (BindingHandle != NULL)
|
||||
{
|
||||
RpcBindingFree(*BindingHandle);
|
||||
*BindingHandle = NULL;
|
||||
}
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
BOOL
|
||||
EvtGetLocalHandle(RPC_BINDING_HANDLE *BindingHandle)
|
||||
{
|
||||
if (LocalBindingHandle != NULL)
|
||||
{
|
||||
if (BindingHandle != NULL)
|
||||
*BindingHandle = LocalBindingHandle;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (EvtBindRpc(NULL, &LocalBindingHandle) != RPC_S_OK)
|
||||
return FALSE;
|
||||
|
||||
if (BindingHandle != NULL)
|
||||
*BindingHandle = LocalBindingHandle;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
RPC_STATUS
|
||||
EvtUnbindLocalHandle(VOID)
|
||||
{
|
||||
return EvtUnbindRpc(&LocalBindingHandle);
|
||||
}
|
||||
|
||||
void __RPC_FAR * __RPC_USER
|
||||
midl_user_allocate(size_t len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||
}
|
||||
|
||||
|
||||
void __RPC_USER
|
||||
midl_user_free(void __RPC_FAR * ptr)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ptr);
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -2163,16 +2163,4 @@ NotifyBootConfigStatus(BOOL BootAcceptable)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||
}
|
||||
|
||||
|
||||
void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ptr);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue