/*
This file is part of GNUnet.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
* @file util/win.c
* @brief Helper functions for MS Windows in C++
* @author Nils Durner
*/
#ifndef _WIN_C
#define _WIN_C
#include "winproc.h"
#include "platform.h"
#include "gnunet_crypto_lib.h"
#include "gnunet_common.h"
#include "gnunet_connection_lib.h"
#include <ntdef.h>
#ifndef INHERITED_ACE
#define INHERITED_ACE 0x10
#endif
int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
#define _IP_ADAPTER_UNICAST_ADDRESS_HEAD \
union { \
struct { \
ULONG Length; \
DWORD Flags; \
}; \
};
#define _IP_ADAPTER_UNICAST_ADDRESS_BASE \
SOCKET_ADDRESS Address; \
IP_PREFIX_ORIGIN PrefixOrigin; \
IP_SUFFIX_ORIGIN SuffixOrigin; \
IP_DAD_STATE DadState; \
ULONG ValidLifetime; \
ULONG PreferredLifetime; \
ULONG LeaseLifetime;
#define _IP_ADAPTER_UNICAST_ADDRESS_ADD_VISTA \
UINT8 OnLinkPrefixLength;
#define _IP_ADAPTER_UNICAST_ADDRESS_DEFINE(suffix,addition) \
typedef struct _IP_ADAPTER_UNICAST_ADDRESS##suffix { \
_IP_ADAPTER_UNICAST_ADDRESS_HEAD \
struct _IP_ADAPTER_UNICAST_ADDRESS##suffix *Next; \
_IP_ADAPTER_UNICAST_ADDRESS_BASE \
addition \
} IP_ADAPTER_UNICAST_ADDRESS##suffix, *PIP_ADAPTER_UNICAST_ADDRESS##suffix;
/* _IP_ADAPTER_UNICAST_ADDRESS_DEFINE(,) defined in w32api headers */
_IP_ADAPTER_UNICAST_ADDRESS_DEFINE(_VISTA,_IP_ADAPTER_UNICAST_ADDRESS_ADD_VISTA)
#ifndef __MINGW64_VERSION_MAJOR
typedef struct _IP_ADAPTER_WINS_SERVER_ADDRESS {
union {
ULONGLONG Alignment;
struct {
ULONG Length;
DWORD Reserved;
};
};
struct _IP_ADAPTER_WINS_SERVER_ADDRESS *Next;
SOCKET_ADDRESS Address;
} IP_ADAPTER_WINS_SERVER_ADDRESS, *PIP_ADAPTER_WINS_SERVER_ADDRESS, *PIP_ADAPTER_WINS_SERVER_ADDRESS_LH;
typedef struct _IP_ADAPTER_GATEWAY_ADDRESS {
union {
ULONGLONG Alignment;
struct {
ULONG Length;
DWORD Reserved;
};
};
struct _IP_ADAPTER_GATEWAY_ADDRESS *Next;
SOCKET_ADDRESS Address;
} IP_ADAPTER_GATEWAY_ADDRESS, *PIP_ADAPTER_GATEWAY_ADDRESS, *PIP_ADAPTER_GATEWAY_ADDRESS_LH;
#endif
typedef UINT32 NET_IF_COMPARTMENT_ID;
typedef GUID NET_IF_NETWORK_GUID;
#ifndef __MINGW64_VERSION_MAJOR
typedef enum _NET_IF_CONNECTION_TYPE {
NET_IF_CONNECTION_DEDICATED = 1,
NET_IF_CONNECTION_PASSIVE,
NET_IF_CONNECTION_DEMAND,
NET_IF_CONNECTION_MAXIMUM
} NET_IF_CONNECTION_TYPE, *PNET_IF_CONNECTION_TYPE;
typedef enum {
TUNNEL_TYPE_NONE = 0,
TUNNEL_TYPE_OTHER,
TUNNEL_TYPE_DIRECT,
TUNNEL_TYPE_6TO4,
TUNNEL_TYPE_ISATAP,
TUNNEL_TYPE_TEREDO,
TUNNEL_TYPE_IPHTTPS
} TUNNEL_TYPE, *PTUNNEL_TYPE;
#endif
/*
A DUID consists of a two-octet type code represented in network byte
order, followed by a variable number of octets that make up the
actual identifier. A DUID can be no more than 128 o