aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-04-21 13:37:03 +0000
committerLRN <lrn1986@gmail.com>2013-04-21 13:37:03 +0000
commit88e70911ee4a023f3e3a442f22f7a7693fe642a7 (patch)
tree04b942419d03647f46af4dfc3751f3b2cdb4dd86 /src/util
parent5ce430baaf7790495efd7b99cdcb3920fdb74218 (diff)
downloadgnunet-88e70911ee4a023f3e3a442f22f7a7693fe642a7.tar.gz
gnunet-88e70911ee4a023f3e3a442f22f7a7693fe642a7.zip
Better mingw-w64 compatibility for win.c
Diffstat (limited to 'src/util')
-rw-r--r--src/util/win.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/util/win.c b/src/util/win.c
index 99b8b692c..5cbe5c672 100644
--- a/src/util/win.c
+++ b/src/util/win.c
@@ -33,7 +33,6 @@
33#include "gnunet_connection_lib.h" 33#include "gnunet_connection_lib.h"
34 34
35#include <ntdef.h> 35#include <ntdef.h>
36
37#ifndef INHERITED_ACE 36#ifndef INHERITED_ACE
38#define INHERITED_ACE 0x10 37#define INHERITED_ACE 0x10
39#endif 38#endif
@@ -73,6 +72,7 @@ typedef struct _IP_ADAPTER_UNICAST_ADDRESS##suffix { \
73_IP_ADAPTER_UNICAST_ADDRESS_DEFINE(_VISTA,_IP_ADAPTER_UNICAST_ADDRESS_ADD_VISTA) 72_IP_ADAPTER_UNICAST_ADDRESS_DEFINE(_VISTA,_IP_ADAPTER_UNICAST_ADDRESS_ADD_VISTA)
74 73
75 74
75#ifndef __MINGW64_VERSION_MAJOR
76typedef struct _IP_ADAPTER_WINS_SERVER_ADDRESS { 76typedef struct _IP_ADAPTER_WINS_SERVER_ADDRESS {
77 union { 77 union {
78 ULONGLONG Alignment; 78 ULONGLONG Alignment;
@@ -96,10 +96,12 @@ typedef struct _IP_ADAPTER_GATEWAY_ADDRESS {
96 struct _IP_ADAPTER_GATEWAY_ADDRESS *Next; 96 struct _IP_ADAPTER_GATEWAY_ADDRESS *Next;
97 SOCKET_ADDRESS Address; 97 SOCKET_ADDRESS Address;
98} IP_ADAPTER_GATEWAY_ADDRESS, *PIP_ADAPTER_GATEWAY_ADDRESS, *PIP_ADAPTER_GATEWAY_ADDRESS_LH; 98} IP_ADAPTER_GATEWAY_ADDRESS, *PIP_ADAPTER_GATEWAY_ADDRESS, *PIP_ADAPTER_GATEWAY_ADDRESS_LH;
99#endif
99 100
100typedef UINT32 NET_IF_COMPARTMENT_ID; 101typedef UINT32 NET_IF_COMPARTMENT_ID;
101typedef GUID NET_IF_NETWORK_GUID; 102typedef GUID NET_IF_NETWORK_GUID;
102 103
104#ifndef __MINGW64_VERSION_MAJOR
103typedef enum _NET_IF_CONNECTION_TYPE { 105typedef enum _NET_IF_CONNECTION_TYPE {
104 NET_IF_CONNECTION_DEDICATED = 1, 106 NET_IF_CONNECTION_DEDICATED = 1,
105 NET_IF_CONNECTION_PASSIVE, 107 NET_IF_CONNECTION_PASSIVE,
@@ -116,6 +118,7 @@ typedef enum {
116 TUNNEL_TYPE_TEREDO, 118 TUNNEL_TYPE_TEREDO,
117 TUNNEL_TYPE_IPHTTPS 119 TUNNEL_TYPE_IPHTTPS
118} TUNNEL_TYPE, *PTUNNEL_TYPE; 120} TUNNEL_TYPE, *PTUNNEL_TYPE;
121#endif
119 122
120/* 123/*
121A DUID consists of a two-octet type code represented in network byte 124A DUID consists of a two-octet type code represented in network byte
@@ -125,6 +128,7 @@ A DUID consists of a two-octet type code represented in network byte
125*/ 128*/
126#define MAX_DHCPV6_DUID_LENGTH 130 129#define MAX_DHCPV6_DUID_LENGTH 130
127 130
131#ifndef __MINGW64_VERSION_MAJOR
128typedef union _NET_LUID { 132typedef union _NET_LUID {
129 ULONG64 Value; 133 ULONG64 Value;
130 struct { 134 struct {
@@ -140,6 +144,7 @@ typedef struct _IP_ADAPTER_DNS_SUFFIX {
140 struct _IP_ADAPTER_DNS_SUFFIX *Next; 144 struct _IP_ADAPTER_DNS_SUFFIX *Next;
141 WCHAR String[MAX_DNS_SUFFIX_STRING_LENGTH]; 145 WCHAR String[MAX_DNS_SUFFIX_STRING_LENGTH];
142} IP_ADAPTER_DNS_SUFFIX, *PIP_ADAPTER_DNS_SUFFIX; 146} IP_ADAPTER_DNS_SUFFIX, *PIP_ADAPTER_DNS_SUFFIX;
147#endif
143 148
144 149
145 150
@@ -712,10 +717,12 @@ int UninstallService(char *servicename)
712 return 2; 717 return 2;
713 718
714 if (! (hService = GNOpenService(hManager, (LPCTSTR) servicename, DELETE))) 719 if (! (hService = GNOpenService(hManager, (LPCTSTR) servicename, DELETE)))
720 {
715 if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) 721 if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST)
716 return 3; 722 return 3;
717 else 723 else
718 goto closeSCM; 724 goto closeSCM;
725 }
719 726
720 if (! GNDeleteService(hService)) 727 if (! GNDeleteService(hService))
721 if (GetLastError() != ERROR_SERVICE_MARKED_FOR_DELETE) 728 if (GetLastError() != ERROR_SERVICE_MARKED_FOR_DELETE)
@@ -877,6 +884,7 @@ NTSTATUS _SetPrivilegeOnAccount(LSA_HANDLE PolicyHandle,/* open policy handle */
877 &PrivilegeString, /* privileges */ 884 &PrivilegeString, /* privileges */
878 1 /* privilege count */ 885 1 /* privilege count */
879 ); 886 );
887 return i;
880 } 888 }
881 else 889 else
882 { 890 {
@@ -925,13 +933,12 @@ int CreateServiceAccount(const char *pszName, const char *pszDesc)
925 ui2.usri1008_flags = UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD; 933 ui2.usri1008_flags = UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD;
926 GNNetUserSetInfo(NULL, wszName, 1008, (LPBYTE)&ui2, NULL); 934 GNNetUserSetInfo(NULL, wszName, 1008, (LPBYTE)&ui2, NULL);
927 935
928 if (_OpenPolicy(NULL, POLICY_ALL_ACCESS, &hPolicy) != 936 if (!NT_SUCCESS(_OpenPolicy(NULL, POLICY_ALL_ACCESS, &hPolicy)))
929 STATUS_SUCCESS)
930 return 3; 937 return 3;
931 938
932 _GetAccountSid(NULL, (LPCTSTR) pszName, &pSID); 939 _GetAccountSid(NULL, (LPCTSTR) pszName, &pSID);
933 940
934 if (_SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeServiceLogonRight", TRUE) != STATUS_SUCCESS) 941 if (!NT_SUCCESS(_SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeServiceLogonRight", TRUE)))
935 return 4; 942 return 4;
936 943
937 _SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeDenyInteractiveLogonRight", TRUE); 944 _SetPrivilegeOnAccount(hPolicy, pSID, (LPWSTR) L"SeDenyInteractiveLogonRight", TRUE);