Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

CreateNamedPipe identifier not found?

Code:
Code
#include "pch.h" //windows.h
#include <stdio.h>
#include <iostream>

using namespace std;

DWORD WINAPI hook(LPVOID lpParam);
BOOL startsWith(const char *needle, const char *haystack);
void externalCall(const char *called);

BOOL WINAPI APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        threadHandle = CreateThread(NULL, 0, hook, 0, 0, NULL);
        break;
    case DLL_THREAD_ATTACH: break;
    case DLL_THREAD_DETACH: break;
    case DLL_PROCESS_DETACH:
        //TerminateThread(threadHandle, 0);
        //CloseHandle(threadHandle);
        break;
    }
    return TRUE;
}

DWORD WINAPI hook(LPVOID lpParam) {
    HANDLE pipeHandle;
    char buffer[1024];
    DWORD dwRead;

    pipeHandle = CreateNamedPipe(TEXT("\\\\.\\pipe\\OmniBotPipe"), PIPE_ACCESS_DUPLEX | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, PIPE_WAIT, 1, (1024 * 16), (1024 * 16), NMPWAIT_USE_DEFAULT_WAIT, NULL);
    while (pipeHandle != NULL) {
        if (ConnectNamedPipe(pipeHandle, NULL) != FALSE) {
            while (ReadFile(pipeHandle, buffer, sizeof(buffer), &dwRead, NULL) != FALSE) {
                externalCall(buffer);
            }
        }
    }
    DisconnectNamedPipe(pipeHandle);
}

void externalCall(const char *called) {
    if (startsWith("char", called)) {
        //todo
    }
}

BOOL startsWith(const char *needle, const char *haystack) {
    return (strncmp(haystack, needle, strlen(needle)) == 0);
}

In short, it tells me that CreateNamedPipe, ConnectNamedPipe and DisconnectNamedPipe are not found even though they're in WinBase.h (which is included in Windows.h) - is there any reason for this?
New to trading cryptocurrencies but don't know where to start? Join Binance here! Binance is my favourite exchange for cryptocurrencies w/ low fees.

[Image: 793854efd3c9ee7d90ddd413ae9deed6.png]
You have to use either the ASCII or Unicode version of it, so either CreateNamedPipeW or CreateNamedPipeA.
Same for the other APIs
(Mar 25, 2016 06:01 PM)Dam Son Wrote:  You have to use either the ASCII or Unicode version of it, so either CreateNamedPipeW or CreateNamedPipeA.
Same for the other APIs

Same problem when trying to use W/A versions.
New to trading cryptocurrencies but don't know where to start? Join Binance here! Binance is my favourite exchange for cryptocurrencies w/ low fees.

[Image: 793854efd3c9ee7d90ddd413ae9deed6.png]
(Mar 25, 2016 06:07 PM)Chickendipper Wrote:  Same problem when trying to use W/A versions.

Are you using a non-standard build config? (whats up with the pch.h)
make sure you include windows.h in your project.
(Mar 25, 2016 06:29 PM)Dam Son Wrote:  Are you using a non-standard build config? (whats up with the pch.h)

I literally just opened up VS2015, made a new Universal DLL and put in that code. I think pch is just a precompiled header which I already include windows.h in

(Mar 25, 2016 07:52 PM)excr4sh Wrote:  make sure you include windows.h in your project.

It's in pch.h
New to trading cryptocurrencies but don't know where to start? Join Binance here! Binance is my favourite exchange for cryptocurrencies w/ low fees.

[Image: 793854efd3c9ee7d90ddd413ae9deed6.png]
(Mar 26, 2016 03:26 AM)Chickendipper Wrote:  It's in pch.h
Define it in your C/CPP file, there is nothing wrong with that and as a recommendation, I suggest you switch to VS2013. VS2015 is unstable and overloads the CPU on large projects.
(Mar 26, 2016 03:38 AM)excr4sh Wrote:  Define it in your C/CPP file, there is nothing wrong with that and as a recommendation, I suggest you switch to VS2013. VS2015 is unstable and overloads the CPU on large projects.

Exact same code, switched to VS2013, and no errors. Amazing.

Thanks :D
New to trading cryptocurrencies but don't know where to start? Join Binance here! Binance is my favourite exchange for cryptocurrencies w/ low fees.

[Image: 793854efd3c9ee7d90ddd413ae9deed6.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by YoungHackerDec 16, 2014 06:27 AM 5 138 Dec 16, 2014 06:27 AM
Last Post: Mouse❤️
[C] by Benoit ᵇᵃˡˡˢNov 17, 2014 12:00 PM 4 289 Nov 17, 2014 12:00 PM
Last Post: Benoit ᵇᵃˡˡˢ
[Python] by seizeableOct 18, 2014 07:30 PM 4 251 Oct 18, 2014 07:30 PM
Last Post: glob