mercredi 21 octobre 2020

How to detect windows OOBE?

My goal is to detect OOBE notification from my app.

I found a c++ API RegisterWaitUntilOOBECompleted but I can't implement it programatically. Can anyone help me?

main.cpp

#include "oobenotification.h"
#include "header.h"

COOBENotifyHandle::~COOBENotifyHandle()
{
    if (m_handle != nullptr)
        UnregisterWaitUntilOOBECompleted(m_handle);;
}

void COOBENotifyHandle::Register()
{
    if (!RegisterWaitUntilOOBECompleted(OOBECompletedCallback, NULL, (HANDLE*)m_handle))
    {
        // failed
    }
}


void main()
{
    COOBENotifyHandle hnd;
    hnd.Register();
    
    // ...
}

header.cpp

class COOBENotifyHandle
{
private:
    OOBE_COMPLETED_CALLBACK OOBECompletedCallback;
    HANDLE m_handle = nullptr;
public:
    COOBENotifyHandle() = default;
    COOBENotifyHandle(const COOBENotifyHandle&) = delete;
    COOBENotifyHandle& operator=(const COOBENotifyHandle&) = delete;
    ~COOBENotifyHandle();
    void Register();
};

Aucun commentaire:

Enregistrer un commentaire