读取windows日志

#include "stdafx.h"
 
#include
#include
#include

#pragma comment(lib, "wevtapi.lib")
#include
#include
#include
#include
 

 
#include
#include
#include
#include
 
const DWORD BUFFER_SIZE = 40960;

std::unique_ptr buffer(new BYTE[BUFFER_SIZE]);

void ReadEventLog(const std::string& logName)
{
    HANDLE eventLog = OpenEventLogA(nullptr, logName.c_str());
    if (eventLog == nullptr)
    {
        std::cout << "Failed to open event log: " << logName << std::endl;
        return;
    }

    DWORD bytesRead;
    DWORD totalBytes;

    if (

你可能感兴趣的:(windows)