Hi,
Thanks, I tested on Windows 10 with Visual Studio build and works as
expected.
A few nitpicks:
+ if (!WriteFile(pipe, &dhcp, sizeof(dhcp), &len, NULL)
> + || !ReadFile(pipe, &ack, sizeof(ack), &len, NULL))
> + {
> + msg(M_WARN, "TUN: could not talk to service: %s [%lu]",
> + strerror_win32(GetLastError(), &gc), GetLastError());
> + goto out;
> + }
>
A very similar code (communicate with service) is used in
do_address_service and do_dns6_service, so
how about factoring that code into separate method?
> + /* Path of netsh */
> + int n = GetSystemDirectory(argv0, MAX_PATH);
> + if (n > 0 && n < MAX_PATH) /* got system directory */
> + {
> + wcsncat(argv0, L"\\netsh.exe", MAX_PATH - n - 1);
> + }
> + else
> + {
> + wcsncpy(argv0, L"C:\\Windows\\system32\\netsh.exe", MAX_PATH);
> + }
>
Same as above (code in netsh_dns_cmd).
> + /* max cmdline length in wchars -- include room for if index */
> + size_t ncmdline = wcslen(fmt) + 10 + 1;
>
Maybe comment that 10 is a max string length of int type and 1 is a nul
terminator (do we need it here?).
-Lev
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel