0
votes

I'm using win xp Professional x64 Edition and i'm trying to send message to Windows Message Service like using net send. Im using mailslot:

LPCTSTR SlotName = TEXT("\\\\.\\mailslot\\messngr");

hFile = CreateFile(SlotName,
        GENERIC_WRITE | GENERIC_READ,
        FILE_SHARE_WRITE | FILE_SHARE_READ,
        (LPSECURITY_ATTRIBUTES)NULL, 
        CREATE_ALWAYS,
        FILE_ATTRIBUTE_NORMAL, 
        (HANDLE)NULL);

and after lunching it i got error 5 from GetLastError() in CreateFile. I don't know how to fix it. I gave all VM permission, i turned messange service ofc and i can open it be notpad like others suggested in: CreateFile() Failed With GetLastError() = 5. I tried many flags but it did't changed anythink. Any guess?

1
Error code 5 stands for "Access is Denied". You should check your user's access rights. - Oscar Chambers

1 Answers

0
votes

Like it says in the mailslot documentation, only the process that created the mailslot can read from it. Mailslots are one-way communication.

Remove the request for read access.