Author: ekohl
Date: Thu Jan 5 22:07:33 2012
New Revision: 54846
URL:
http://svn.reactos.org/svn/reactos?rev=54846&view=rev
Log:
[ADVAPI32]
Pass nt paths to ElfrBackupELFW and ElfrClearELFW.
Modified:
trunk/reactos/dll/win32/advapi32/service/eventlog.c
Modified: trunk/reactos/dll/win32/advapi32/service/eventlog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/service/eventlog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/service/eventlog.c [iso-8859-1] Thu Jan 5 22:07:33
2012
@@ -145,32 +145,38 @@
BackupEventLogA(IN HANDLE hEventLog,
IN LPCSTR lpBackupFileName)
{
- ANSI_STRING BackupFileName;
- NTSTATUS Status;
+ ANSI_STRING BackupFileNameA;
+ UNICODE_STRING BackupFileNameW;
+ NTSTATUS Status;
+ BOOL Result;
TRACE("%p, %s\n", hEventLog, lpBackupFileName);
- RtlInitAnsiString(&BackupFileName, lpBackupFileName);
-
- RpcTryExcept
- {
- Status = ElfrBackupELFA(hEventLog,
- (PRPC_STRING)&BackupFileName);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- Status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
-
- if (!NT_SUCCESS(Status))
- {
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
- }
-
- return TRUE;
-}
+ if (lpBackupFileName == NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ RtlInitAnsiString(&BackupFileNameA, lpBackupFileName);
+
+ Status = RtlAnsiStringToUnicodeString(&BackupFileNameW,
+ &BackupFileNameA,
+ TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+
+ Result = BackupEventLogW(hEventLog,
+ BackupFileNameW.Buffer);
+
+ RtlFreeUnicodeString(&BackupFileNameW);
+
+ return(Result);
+}
+
/******************************************************************************
* BackupEventLogW [ADVAPI32.@]
@@ -183,23 +189,36 @@
BackupEventLogW(IN HANDLE hEventLog,
IN LPCWSTR lpBackupFileName)
{
- UNICODE_STRING BackupFileName;
+ UNICODE_STRING BackupFileNameW;
NTSTATUS Status;
TRACE("%p, %s\n", hEventLog, debugstr_w(lpBackupFileName));
- RtlInitUnicodeString(&BackupFileName, lpBackupFileName);
+ if (lpBackupFileName == NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ if (!RtlDosPathNameToNtPathName_U(lpBackupFileName, &BackupFileNameW,
+ NULL, NULL))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
RpcTryExcept
{
Status = ElfrBackupELFW(hEventLog,
- (PRPC_UNICODE_STRING)&BackupFileName);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- Status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
+ (PRPC_UNICODE_STRING)&BackupFileNameW);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ RtlFreeHeap(RtlGetProcessHeap(), 0, BackupFileNameW.Buffer);
if (!NT_SUCCESS(Status))
{
@@ -218,31 +237,37 @@
ClearEventLogA(IN HANDLE hEventLog,
IN LPCSTR lpBackupFileName)
{
- ANSI_STRING BackupFileName;
- NTSTATUS Status;
+ ANSI_STRING BackupFileNameA;
+ UNICODE_STRING BackupFileNameW;
+ NTSTATUS Status;
+ BOOL Result;
TRACE("%p, %s\n", hEventLog, lpBackupFileName);
- RtlInitAnsiString(&BackupFileName, lpBackupFileName);
-
- RpcTryExcept
- {
- Status = ElfrClearELFA(hEventLog,
- (PRPC_STRING)&BackupFileName);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- Status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
-
- if (!NT_SUCCESS(Status))
- {
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
- }
-
- return TRUE;
+ if (lpBackupFileName == NULL)
+ {
+ RtlInitUnicodeString(&BackupFileNameW, NULL);
+ }
+ else
+ {
+ RtlInitAnsiString(&BackupFileNameA, lpBackupFileName);
+
+ Status = RtlAnsiStringToUnicodeString(&BackupFileNameW,
+ &BackupFileNameA,
+ TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+ }
+
+ Result = ClearEventLogW(hEventLog,
+ BackupFileNameW.Buffer);
+
+ RtlFreeUnicodeString(&BackupFileNameW);
+
+ return Result;
}
@@ -253,23 +278,38 @@
ClearEventLogW(IN HANDLE hEventLog,
IN LPCWSTR lpBackupFileName)
{
- UNICODE_STRING BackupFileName;
+ UNICODE_STRING BackupFileNameW;
NTSTATUS Status;
TRACE("%p, %s\n", hEventLog, debugstr_w(lpBackupFileName));
- RtlInitUnicodeString(&BackupFileName,lpBackupFileName);
+ if (lpBackupFileName == NULL)
+ {
+ RtlInitUnicodeString(&BackupFileNameW, NULL);
+ }
+ else
+ {
+ if (!RtlDosPathNameToNtPathName_U(lpBackupFileName, &BackupFileNameW,
+ NULL, NULL))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ }
RpcTryExcept
{
Status = ElfrClearELFW(hEventLog,
- (PRPC_UNICODE_STRING)&BackupFileName);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- Status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
+ (PRPC_UNICODE_STRING)&BackupFileNameW);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ if (lpBackupFileName != NULL)
+ RtlFreeHeap(RtlGetProcessHeap(), 0, BackupFileNameW.Buffer);
if (!NT_SUCCESS(Status))
{