C++ named pipe not working after protection

Issues related to VMProtect
Post Reply
smurfin4tor
Posts: 1
Joined: Mon Jul 12, 2021 7:12 pm

C++ named pipe not working after protection

Post by smurfin4tor »

Hey,

I have two solutions, one C# .NET, one C++.
The C# solution created a named pipe to which the c++ solution connects after executing.
Protecting the C# solution is fine but once I protect the c++ solution as well the named pipe won't work anymore.

This is how i create the named pipe in the C++ solution:

Code: Select all

 HANDLE hPipe;

    do
    {
        hPipe = CreateFile(PIPE_NAME, GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr);
        std::cout << "INVALID_HANDLE_VALUE" << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(1));
    } while (hPipe == INVALID_HANDLE_VALUE);
   
    if (hPipe == INVALID_HANDLE_VALUE)
    {
        std::cout << "INVALID_HANDLE_VALUE" << GetLastError() << std::endl;
        return -1;
    }

    DWORD mode = PIPE_READMODE_MESSAGE;
    SetNamedPipeHandleState(hPipe, &mode, nullptr, nullptr);
    bool success = false;
    DWORD read;
    while (!success)
    {
        TCHAR chBuff[BUFF_SIZE];
        do
        {
            std::this_thread::sleep_for(std::chrono::milliseconds(1));
            success = ReadFile(hPipe, chBuff, BUFF_SIZE * sizeof(TCHAR), &read, nullptr);
        } while (!success);

        SimulatePipeResult(chBuff);
    }
Admin
Site Admin
Posts: 2566
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: C++ named pipe not working after protection

Post by Admin »

We need a very simple example (original binary + vmp files) that shows your problem.
Post Reply