aboutsummaryrefslogtreecommitdiff
path: root/src/gns/w32nsp-install.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-06 07:39:24 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-06 07:39:24 +0000
commitec59e6a4f56f68916cf8ec8fefca3282a70d16d2 (patch)
treee9fce0d2f7b8dceb717ba434731bde4db594eb0a /src/gns/w32nsp-install.c
parent2dda2c0e3a7c3813fc334d983b65d9f698953143 (diff)
downloadgnunet-ec59e6a4f56f68916cf8ec8fefca3282a70d16d2.tar.gz
gnunet-ec59e6a4f56f68916cf8ec8fefca3282a70d16d2.zip
-LRN: W32 NS provider for GNS
Also a helper service. A couple tools for installing/removing the provder. And a resolver tool that loads the provider directly.
Diffstat (limited to 'src/gns/w32nsp-install.c')
-rw-r--r--src/gns/w32nsp-install.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/gns/w32nsp-install.c b/src/gns/w32nsp-install.c
new file mode 100644
index 000000000..c9ba9944e
--- /dev/null
+++ b/src/gns/w32nsp-install.c
@@ -0,0 +1,56 @@
1#define INITGUID
2#include <windows.h>
3#include <nspapi.h>
4#include <ws2spi.h>
5#include <gnunet_w32nsp_lib.h>
6#include <stdio.h>
7
8int
9main (int argc, char **argv)
10{
11 int ret;
12 int r = 1;
13 WSADATA wsd;
14 GUID id = GNUNET_NAMESPACE_PROVIDER_DNS;
15 wchar_t *cmdl;
16 int wargc;
17 wchar_t **wargv;
18
19 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
20 {
21 fprintf (stderr, "WSAStartup() failed: %lu\n", GetLastError());
22 return 5;
23 }
24
25 cmdl = GetCommandLineW ();
26 if (cmdl == NULL)
27 {
28 WSACleanup();
29 return 2;
30 }
31 wargv = CommandLineToArgvW (cmdl, &wargc);
32 if (wargv == NULL)
33 {
34 WSACleanup();
35 return 3;
36 }
37 r = 4;
38
39 if (wargc == 2)
40 {
41 ret = WSCInstallNameSpace (L"GNUnet DNS provider", wargv[1], NS_DNS, 1, &id);
42 if (ret == NO_ERROR)
43 {
44 r = 0;
45 }
46 else
47 {
48 r = 1;
49 fprintf (stderr,
50 "WSCInstallNameSpace(L\"GNUnet DNS provider\", \"%S\", %d, 0, %p) failed: %lu\n",
51 wargv[1], NS_DNS, &id, GetLastError ());
52 }
53 }
54 WSACleanup();
55 return r;
56} \ No newline at end of file