我正在嘗試收集事件日誌,並且希望在沒有管理員權限的情況下執行此操作。使用沒有管理員權限的Windows API收集事件日誌
這是我的代碼..
#include "stdafx.h"
#pragma comment(lib, "wevtapi.lib")
#include <Windows.h>
#include <winevt.h>
int _tmain(int argc, _TCHAR* argv[])
{
BOOL flag=EvtExportLog(
NULL,
L"%SystemRoot%\\System32\\Winevt\\Logs\\System.evtx",
L"*",
L"D:\\SomePath\\Des.evtx",
EvtExportLogFilePath
);
int i = GetLastError();
}
當我嘗試這樣做,我得到拒絕訪問錯誤。我能夠查看使用eventvwr
事件日誌,我可以得到這%SystemRoot%\System32\Winevt\Logs\System.evtx
日誌文件的路徑,但是當我再次嘗試穿上run
路徑我得到Access denied進行查看。
我想複製.evtx
日誌文件,而無需任何管理權限,那麼,有沒有辦法做下去。