advapi32: Add some input parameter checks to BackupEventLog.
This commit is contained in:
parent
b90ef8c6d9
commit
d2227cb8a4
|
@ -64,8 +64,14 @@ static inline LPWSTR SERV_dup( LPCSTR str )
|
|||
*/
|
||||
BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
|
||||
{
|
||||
FIXME("(%p,%s) stub\n", hEventLog, debugstr_a(lpBackupFileName));
|
||||
return TRUE;
|
||||
LPWSTR backupW;
|
||||
BOOL ret;
|
||||
|
||||
backupW = SERV_dup(lpBackupFileName);
|
||||
ret = BackupEventLogW(hEventLog, backupW);
|
||||
HeapFree(GetProcessHeap(), 0, backupW);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -75,8 +81,27 @@ BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
|
|||
*/
|
||||
BOOL WINAPI BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
|
||||
{
|
||||
FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
|
||||
return TRUE;
|
||||
FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
|
||||
|
||||
if (!lpBackupFileName)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!hEventLog)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (GetFileAttributesW(lpBackupFileName) != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
SetLastError(ERROR_ALREADY_EXISTS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -223,15 +223,11 @@ static void test_backup(void)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = BackupEventLogA(NULL, NULL);
|
||||
todo_wine
|
||||
{
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = BackupEventLogA(NULL, backup);
|
||||
todo_wine
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetFileAttributesA(backup) == INVALID_FILE_ATTRIBUTES, "Expected no backup file\n");
|
||||
|
||||
|
@ -239,11 +235,8 @@ static void test_backup(void)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = BackupEventLogA(handle, NULL);
|
||||
todo_wine
|
||||
{
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
}
|
||||
|
||||
ret = BackupEventLogA(handle, backup);
|
||||
ok(ret, "Expected succes\n");
|
||||
|
|
Loading…
Reference in New Issue