Hi,
I've been trying to create a NamedPipe with security attributes
but at compile time throws:
Error 42: Symbol Undefined _InitializeSecurityDescriptor@8
Error 42: Symbol Undefined _SetSecurityDescriptorDacl@16
This is my code, I'm trying to do it using a class:
module asi.pipe;
import core.sys.windows.windows;
import core.sys.windows.winbase;
import core.stdc.stdlib;
class Pipe
{
private HANDLE hPipe;
private SECURITY_ATTRIBUTES sa;
this(string name)
{
CreatePipe(name);
}
private void CreatePipe(string pipename)
{
sa.lpSecurityDescriptor = malloc(SECURITY_DESCRIPTOR.sizeof);
InitializeSecurityDescriptor(cast(PSECURITY_DESCRIPTOR)sa.lpSecurityDescriptor,
1);
SetSecurityDescriptorDacl(cast(PSECURITY_DESCRIPTOR)sa.lpSecurityDescriptor,
TRUE, cast(ACL*)0, FALSE);
sa.nLength = sa.sizeof;
sa.bInheritHandle = TRUE;
CreateNamedPipeA(cast(char*)pipename,
PIPE_ACCESS_DUPLEX,
(PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE | PIPE_WAIT),
PIPE_UNLIMITED_INSTANCES,
4096,
1536,
0,
&sa);
}
}
Additional Info:
The installer came with just a few files to handle with Windows,
comparing the the huge files that are in the repository of
druntime:
https://github.com/D-Programming-Language/druntime/tree/master/src/core/sys/windows
So I renamed the old import to Windows2 and copied this whole
github/windows folder there and used its winbase.d because there
are the functions definitions that I needed.
This functions that throw me errors belongs to the advapi32.dll
file. I tried to add pragma(lib "advapi32"); but it didn't work.
I'm new/noob dealing with D and I would appreciate any help.
thanks.