mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:02:59 +00:00
[ADVAPI]
Sync OpenEventLogA with wine. RtlCreateUnicodeStringFromAsciiz breaks null checks. svn path=/trunk/; revision=45131
This commit is contained in:
parent
ebaf29efc8
commit
f783339b11
1 changed files with 33 additions and 24 deletions
|
@ -28,6 +28,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
||||||
|
|
||||||
static RPC_UNICODE_STRING EmptyString = { 0, 0, L"" };
|
static RPC_UNICODE_STRING EmptyString = { 0, 0, L"" };
|
||||||
|
|
||||||
|
static inline LPWSTR SERV_dup( LPCSTR str )
|
||||||
|
{
|
||||||
|
UINT len;
|
||||||
|
LPWSTR wstr;
|
||||||
|
|
||||||
|
if( !str )
|
||||||
|
return NULL;
|
||||||
|
len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
||||||
|
wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) );
|
||||||
|
MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, len );
|
||||||
|
return wstr;
|
||||||
|
}
|
||||||
|
|
||||||
handle_t __RPC_USER
|
handle_t __RPC_USER
|
||||||
EVENTLOG_HANDLE_A_bind(EVENTLOG_HANDLE_A UNCServerName)
|
EVENTLOG_HANDLE_A_bind(EVENTLOG_HANDLE_A UNCServerName)
|
||||||
|
@ -575,35 +587,32 @@ OpenBackupEventLogW(IN LPCWSTR lpUNCServerName,
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* OpenEventLogA [ADVAPI32.@]
|
* OpenEventLogA [ADVAPI32.@]
|
||||||
|
*
|
||||||
|
* 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
|
||||||
*/
|
*/
|
||||||
HANDLE WINAPI
|
HANDLE WINAPI
|
||||||
OpenEventLogA(IN LPCSTR lpUNCServerName,
|
OpenEventLogA(IN LPCSTR uncname,
|
||||||
IN LPCSTR lpSourceName)
|
IN LPCSTR source)
|
||||||
{
|
{
|
||||||
UNICODE_STRING UNCServerName;
|
LPWSTR uncnameW, sourceW;
|
||||||
UNICODE_STRING SourceName;
|
HANDLE handle;
|
||||||
HANDLE Handle;
|
|
||||||
|
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&UNCServerName, lpUNCServerName))
|
uncnameW = SERV_dup(uncname);
|
||||||
{
|
sourceW = SERV_dup(source);
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
handle = OpenEventLogW(uncnameW, sourceW);
|
||||||
return NULL;
|
HeapFree(GetProcessHeap(), 0, uncnameW);
|
||||||
}
|
HeapFree(GetProcessHeap(), 0, sourceW);
|
||||||
|
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&SourceName, lpSourceName))
|
return handle;
|
||||||
{
|
|
||||||
RtlFreeUnicodeString(&UNCServerName);
|
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle = OpenEventLogW(UNCServerName.Buffer,
|
|
||||||
SourceName.Buffer);
|
|
||||||
|
|
||||||
RtlFreeUnicodeString(&UNCServerName);
|
|
||||||
RtlFreeUnicodeString(&SourceName);
|
|
||||||
|
|
||||||
return Handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue