interactive services namedpipes working directpry

Post Reply
nbk01
OpenVpn Newbie
Posts: 3
Joined: Tue Jun 18, 2019 12:13 pm

interactive services namedpipes working directpry

Post by nbk01 » Tue Jun 18, 2019 12:15 pm

Hi,
my OS is windows 7 X64 and i try to open a openvpn process via named Pipes in vb.Net

Code: Select all

                Dim pipeClient As New NamedPipeClientStream( _
                    ".", "openvpn\service", _
                    PipeDirection.InOut, PipeOptions.Asynchronous)

                pipeClient.Connect(100000)

the code opens the NamedPipe without problems.

Then i send the start request

Code: Select all

               
               Dim Nullbyte As Byte = &H0
                Dim getbytes_xpb As Byte() = System.Text.Encoding.ASCII.GetBytes(workingdir_xps & Chr(Nullbyte) & vpnoptioons_xps & Chr(Nullbyte) & Chr(Nullbyte))
                pipeClient.Write(getbytes_xpb, 0, getbytes_xpb.Length)
But the only Response I get is
Startup data ends at working directory
I changed the Variable workingdir_xps to something like C:\Pedro but nothing works so far.
It doesn't matter, if i send the folder of openvpn.exe or any other Folder i have access to .
When i send C:\Pedro\ the service Responds with
Startup data is not NULL terminated
I looked at the source code

Code: Select all

    sud->directory = data;
    len = wcslen(sud->directory) + 1;
    size -= len;
    if (size <= 0)
    {
        MsgToEventLog(M_ERR, TEXT("Startup data ends at working directory"));
        ReturnError(pipe, ERROR_STARTUP_DATA, L"GetStartupData", 1, &exit_event);
        goto err;
}
but that didn't help at all, because i clearly send something, so len should not be 0
I hope somebody can give me a hint, what open expects from me.
thx
Last edited by nbk01 on Tue Jun 18, 2019 1:04 pm, edited 1 time in total.

novaflash
I should be on the dev team.
Posts: 991
Joined: Fri Apr 13, 2012 8:43 pm

Re: interactive servoces namepipes working directpry

Post by novaflash » Tue Jun 18, 2019 12:49 pm

This topic is entirely not related to OpenVPN Access Server.

nbk01
OpenVpn Newbie
Posts: 3
Joined: Tue Jun 18, 2019 12:13 pm

Re: interactive services namedpipes working directpry

Post by nbk01 » Tue Jun 18, 2019 1:13 pm

Then you should explain were the topic should go.

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 6008
Joined: Fri Jun 03, 2016 1:17 pm

Re: interactive services namedpipes working directpry

Post by TinCanTech » Tue Jun 18, 2019 1:18 pm


nbk01
OpenVpn Newbie
Posts: 3
Joined: Tue Jun 18, 2019 12:13 pm

Re: interactive services namedpipes working directpry

Post by nbk01 » Wed Jun 19, 2019 12:12 pm

So, after opening a bug ticket i got the explanation.
The interactive service needs 16 Bit UTF
In Vb.net you need to

Code: Select all

 Dim uni As New UnicodeEncoding()
            'System.Text.Encoding.ASCII.
            Dim getbytes_xpb As Byte() = uni.GetBytes(workingdir_xps & Chr(Nullbyte) & vpnoptioons_xps & Chr(Nullbyte) & Chr(Nullbyte))
This it anybody looks for the same thing

Post Reply