2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file include/winproc.h
23 * @brief Definitions for MS Windows
32 #include <sys/types.h>
34 #include <sys/timeb.h>
44 #include <sys/param.h> /* #define BYTE_ORDER */
55 #ifndef MAX_NAME_LENGTH
56 #define MAX_NAME_LENGTH 25
59 typedef DWORD WINAPI (*TNtQuerySystemInformation) (int, PVOID, ULONG, PULONG);
60 typedef DWORD WINAPI (*TGetIfEntry) (PMIB_IFROW pIfRow);
61 typedef DWORD WINAPI (*TGetIpAddrTable) (PMIB_IPADDRTABLE pIpAddrTable,
62 PULONG pdwSize, BOOL bOrder);
63 typedef DWORD WINAPI (*TGetIfTable) (PMIB_IFTABLE pIfTable, PULONG pdwSize,
65 typedef DWORD WINAPI (*TCreateHardLink) (LPCTSTR lpFileName,
66 LPCTSTR lpExistingFileName,
68 lpSecurityAttributes);
69 typedef SC_HANDLE WINAPI (*TOpenSCManager) (LPCTSTR lpMachineName,
70 LPCTSTR lpDatabaseName,
71 DWORD dwDesiredAccess);
72 typedef SC_HANDLE WINAPI (*TCreateService) (SC_HANDLE hSCManager,
73 LPCTSTR lpServiceName,
74 LPCTSTR lpDisplayName,
75 DWORD dwDesiredAccess,
79 LPCTSTR lpBinaryPathName,
80 LPCTSTR lpLoadOrderGroup,
82 LPCTSTR lpDependencies,
83 LPCTSTR lpServiceStartName,
85 typedef BOOL WINAPI (*TCloseServiceHandle) (SC_HANDLE hSCObject);
86 typedef BOOL WINAPI (*TDeleteService) (SC_HANDLE hService);
87 typedef SERVICE_STATUS_HANDLE WINAPI (*TRegisterServiceCtrlHandler) (LPCTSTR
91 typedef BOOL WINAPI (*TSetServiceStatus) (SERVICE_STATUS_HANDLE
93 LPSERVICE_STATUS lpServiceStatus);
94 typedef BOOL WINAPI (*TStartServiceCtrlDispatcher) (const
97 typedef BOOL WINAPI (*TControlService) (SC_HANDLE hService, DWORD dwControl,
98 LPSERVICE_STATUS lpServiceStatus);
99 typedef SC_HANDLE WINAPI (*TOpenService) (SC_HANDLE hSCManager,
100 LPCTSTR lpServiceName,
101 DWORD dwDesiredAccess);
102 typedef DWORD WINAPI (*TGetBestInterface) (IPAddr dwDestAddr,
103 PDWORD pdwBestIfIndex);
104 typedef DWORD WINAPI (*TGetAdaptersInfo) (PIP_ADAPTER_INFO pAdapterInfo,
106 typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE, PDWORD);
107 typedef NET_API_STATUS WINAPI (*TNetUserSetInfo) (LPCWSTR servername,
109 DWORD level, LPBYTE buf,
111 typedef NTSTATUS NTAPI (*TLsaOpenPolicy) (PLSA_UNICODE_STRING,
112 PLSA_OBJECT_ATTRIBUTES,
113 ACCESS_MASK, PLSA_HANDLE);
114 typedef NTSTATUS NTAPI (*TLsaAddAccountRights) (LSA_HANDLE, PSID,
115 PLSA_UNICODE_STRING, ULONG);
116 typedef NTSTATUS NTAPI (*TLsaRemoveAccountRights) (LSA_HANDLE, PSID,
120 typedef NTSTATUS NTAPI (*TLsaClose) (LSA_HANDLE);
121 typedef BOOL WINAPI (*TLookupAccountName) (LPCTSTR lpSystemName,
122 LPCTSTR lpAccountName, PSID Sid,
124 LPTSTR ReferencedDomainName,
125 LPDWORD cchReferencedDomainName,
126 PSID_NAME_USE peUse);
128 typedef BOOL WINAPI (*TGetFileSecurity) (LPCTSTR lpFileName,
130 RequestedInformation,
132 pSecurityDescriptor, DWORD nLength,
133 LPDWORD lpnLengthNeeded);
134 typedef BOOL WINAPI (*TInitializeSecurityDescriptor) (PSECURITY_DESCRIPTOR
137 typedef BOOL WINAPI (*TGetSecurityDescriptorDacl) (PSECURITY_DESCRIPTOR
139 LPBOOL lpbDaclPresent,
141 LPBOOL lpbDaclDefaulted);
142 typedef BOOL WINAPI (*TGetAclInformation) (PACL pAcl,
143 LPVOID pAclInformation,
144 DWORD nAclInformationLength,
145 ACL_INFORMATION_CLASS
146 dwAclInformationClass);
147 typedef BOOL WINAPI (*TInitializeAcl) (PACL pAcl, DWORD nAclLength,
148 DWORD dwAclRevision);
149 typedef BOOL WINAPI (*TGetAce) (PACL pAcl, DWORD dwAceIndex, LPVOID * pAce);
150 typedef BOOL WINAPI (*TEqualSid) (PSID pSid1, PSID pSid2);
151 typedef BOOL WINAPI (*TAddAce) (PACL pAcl, DWORD dwAceRevision,
152 DWORD dwStartingAceIndex, LPVOID pAceList,
153 DWORD nAceListLength);
154 typedef BOOL WINAPI (*TAddAccessAllowedAce) (PACL pAcl, DWORD dwAceRevision,
155 DWORD AccessMask, PSID pSid);
156 typedef BOOL WINAPI (*TSetNamedSecurityInfo) (LPTSTR pObjectName,
157 SE_OBJECT_TYPE ObjectType,
159 SecurityInfo, PSID psidOwner,
160 PSID psidGroup, PACL pDacl,
163 extern TNtQuerySystemInformation GNNtQuerySystemInformation;
164 extern TGetIfEntry GNGetIfEntry;
165 extern TGetIpAddrTable GNGetIpAddrTable;
166 extern TGetIfTable GNGetIfTable;
167 extern TCreateHardLink GNCreateHardLink;
168 extern TOpenSCManager GNOpenSCManager;
169 extern TCreateService GNCreateService;
170 extern TCloseServiceHandle GNCloseServiceHandle;
171 extern TDeleteService GNDeleteService;
172 extern TRegisterServiceCtrlHandler GNRegisterServiceCtrlHandler;
173 extern TSetServiceStatus GNSetServiceStatus;
174 extern TStartServiceCtrlDispatcher GNStartServiceCtrlDispatcher;
175 extern TControlService GNControlService;
176 extern TOpenService GNOpenService;
177 extern TGetBestInterface GNGetBestInterface;
178 extern TGetAdaptersInfo GGetAdaptersInfo;
179 extern TNetUserAdd GNNetUserAdd;
180 extern TNetUserSetInfo GNNetUserSetInfo;
181 extern TLsaOpenPolicy GNLsaOpenPolicy;
182 extern TLsaAddAccountRights GNLsaAddAccountRights;
183 extern TLsaRemoveAccountRights GNLsaRemoveAccountRights;
184 extern TLsaClose GNLsaClose;
185 extern TLookupAccountName GNLookupAccountName;
186 extern TGetFileSecurity GNGetFileSecurity;
187 extern TInitializeSecurityDescriptor GNInitializeSecurityDescriptor;
188 extern TGetSecurityDescriptorDacl GNGetSecurityDescriptorDacl;
189 extern TGetAclInformation GNGetAclInformation;
190 extern TInitializeAcl GNInitializeAcl;
191 extern TGetAce GNGetAce;
192 extern TEqualSid GNEqualSid;
193 extern TAddAce GNAddAce;
194 extern TAddAccessAllowedAce GNAddAccessAllowedAce;
195 extern TSetNamedSecurityInfo GNSetNamedSecurityInfo;
198 BOOL CreateShortcut (const char *pszSrc, const char *pszDest);
199 BOOL DereferenceShortcut (char *pszShortcut);
200 long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSubKey,
201 char *pszBuffer, long *pdLength);
202 int ListNICs (void (*callback) (void *, const char *, int), void *cls);
203 BOOL AddPathAccessRights (char *lpszFileName, char *lpszAccountName,
205 char *winErrorStr (const char *prefix, int dwErr);
206 void EnumNICs (PMIB_IFTABLE * pIfTable, PMIB_IPADDRTABLE * pAddrTable);
208 void GNShutdownWinEnv ();