diff options
Diffstat (limited to 'embeddable-dll-service/README.md')
-rw-r--r-- | embeddable-dll-service/README.md | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/embeddable-dll-service/README.md b/embeddable-dll-service/README.md index c93b4345..a326dc70 100644 --- a/embeddable-dll-service/README.md +++ b/embeddable-dll-service/README.md @@ -1,6 +1,6 @@ ## Embeddable WireGuard Tunnel Library -This allows embedding WireGuard as a service inside of another application. Build `tunnel.dll` by running `./build.bat` in this folder. The first time you run it, it will invoke `..\build.bat` simply for downloading dependencies. After, you should have `amd64/tunnel.dll` and `x86/tunnel.dll`. +This allows embedding WireGuard as a service inside of another application. Build `tunnel.dll` by running `./build.bat` in this folder. The first time you run it, it will invoke `..\build.bat` simply for downloading dependencies. After, you should have `amd64/tunnel.dll`, `x86/tunnel.dll`, and `arm64/tunnel.dll`. In addition, `tunnel.dll` requires `wireguard.dll`, which can be downloaded from [the wireguard-nt download server](https://download.wireguard.com/wireguard-nt/). The basic setup to use `tunnel.dll` is: @@ -24,23 +24,18 @@ is absolutely essential; do not forget it. ##### 2. Have your program's main function handle the `/service` switch: ```c -if (!strcmp(argv[1], "/service") && argc == 3) { +if (wargc == 3 && !wcscmp(wargv[1], L"/service")) { HMODULE tunnel_lib = LoadLibrary("tunnel.dll"); if (!tunnel_lib) abort(); - tunnel_proc_t tunnel_proc = (tunnel_proc_t)GetProcAddress(tunnel_lib, "WireGuardTunnelService"); + BOOL (_cdecl *tunnel_proc)(_In_ LPCWSTR conf_file); + *(FARPROC*)&tunnel_proc = GetProcAddress(tunnel_lib, "WireGuardTunnelService"); if (!tunnel_proc) abort(); - struct go_string conf_file = { - .str = argv[2], - .n = strlen(argv[2]) - }; - return tunnel_proc(conf_file); + return tunnel_proc(wargv[2]); } ``` ##### 3. Scoop up logs by implementing a ringlogger format reader. -##### 4. Talk to the service over its named pipe. - There is a sample implementation of bits and pieces of this inside of the `csharp\` directory. |