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,
61 typedef DWORD WINAPI (*TGetIfEntry) (PMIB_IFROW pIfRow);
62 typedef DWORD WINAPI (*TGetIpAddrTable) (PMIB_IPADDRTABLE pIpAddrTable,
63 PULONG pdwSize, BOOL bOrder);
64 typedef DWORD WINAPI (*TGetIfTable) (PMIB_IFTABLE pIfTable, PULONG pdwSize,
66 typedef DWORD WINAPI (*TCreateHardLink) (LPCTSTR lpFileName,
67 LPCTSTR lpExistingFileName,
69 lpSecurityAttributes);
70 typedef SC_HANDLE WINAPI (*TOpenSCManager) (LPCTSTR lpMachineName,
71 LPCTSTR lpDatabaseName,
72 DWORD dwDesiredAccess);
73 typedef SC_HANDLE WINAPI (*TCreateService) (SC_HANDLE hSCManager,
74 LPCTSTR lpServiceName,
75 LPCTSTR lpDisplayName,
76 DWORD dwDesiredAccess,
80 LPCTSTR lpBinaryPathName,
81 LPCTSTR lpLoadOrderGroup,
83 LPCTSTR lpDependencies,
84 LPCTSTR lpServiceStartName,
86 typedef BOOL WINAPI (*TCloseServiceHandle) (SC_HANDLE hSCObject);
87 typedef BOOL WINAPI (*TDeleteService) (SC_HANDLE hService);
88 typedef SERVICE_STATUS_HANDLE WINAPI (*TRegisterServiceCtrlHandler) (LPCTSTR
92 typedef BOOL WINAPI (*TSetServiceStatus) (SERVICE_STATUS_HANDLE
94 LPSERVICE_STATUS lpServiceStatus);
95 typedef BOOL WINAPI (*TStartServiceCtrlDispatcher) (const
98 typedef BOOL WINAPI (*TControlService) (SC_HANDLE hService, DWORD dwControl,
99 LPSERVICE_STATUS lpServiceStatus);
100 typedef SC_HANDLE WINAPI (*TOpenService) (SC_HANDLE hSCManager,
101 LPCTSTR lpServiceName,
102 DWORD dwDesiredAccess);
103 typedef DWORD WINAPI (*TGetBestInterface) (IPAddr dwDestAddr,
104 PDWORD pdwBestIfIndex);
105 typedef DWORD WINAPI (*TGetAdaptersInfo) (PIP_ADAPTER_INFO pAdapterInfo,
107 typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE,
109 typedef NET_API_STATUS WINAPI (*TNetUserSetInfo) (LPCWSTR servername,
111 DWORD level, LPBYTE buf,
113 typedef NTSTATUS NTAPI (*TLsaOpenPolicy) (PLSA_UNICODE_STRING,
114 PLSA_OBJECT_ATTRIBUTES,
115 ACCESS_MASK, PLSA_HANDLE);
116 typedef NTSTATUS NTAPI (*TLsaAddAccountRights) (LSA_HANDLE, PSID,
117 PLSA_UNICODE_STRING, ULONG);
118 typedef NTSTATUS NTAPI (*TLsaRemoveAccountRights) (LSA_HANDLE, PSID,
122 typedef NTSTATUS NTAPI (*TLsaClose) (LSA_HANDLE);
123 typedef BOOL WINAPI (*TLookupAccountName) (LPCTSTR lpSystemName,
124 LPCTSTR lpAccountName, PSID Sid,
126 LPTSTR ReferencedDomainName,
127 LPDWORD cchReferencedDomainName,
128 PSID_NAME_USE peUse);
130 typedef BOOL WINAPI (*TGetFileSecurity) (LPCTSTR lpFileName,
132 RequestedInformation,
134 pSecurityDescriptor, DWORD nLength,
135 LPDWORD lpnLengthNeeded);
136 typedef BOOL WINAPI (*TInitializeSecurityDescriptor) (PSECURITY_DESCRIPTOR
139 typedef BOOL WINAPI (*TGetSecurityDescriptorDacl) (PSECURITY_DESCRIPTOR
141 LPBOOL lpbDaclPresent,
143 LPBOOL lpbDaclDefaulted);
144 typedef BOOL WINAPI (*TGetAclInformation) (PACL pAcl,
145 LPVOID pAclInformation,
146 DWORD nAclInformationLength,
147 ACL_INFORMATION_CLASS
148 dwAclInformationClass);
149 typedef BOOL WINAPI (*TInitializeAcl) (PACL pAcl, DWORD nAclLength,
150 DWORD dwAclRevision);
151 typedef BOOL WINAPI (*TGetAce) (PACL pAcl, DWORD dwAceIndex, LPVOID * pAce);
152 typedef BOOL WINAPI (*TEqualSid) (PSID pSid1, PSID pSid2);
153 typedef BOOL WINAPI (*TAddAce) (PACL pAcl, DWORD dwAceRevision,
154 DWORD dwStartingAceIndex, LPVOID pAceList,
155 DWORD nAceListLength);
156 typedef BOOL WINAPI (*TAddAccessAllowedAce) (PACL pAcl, DWORD dwAceRevision,
157 DWORD AccessMask, PSID pSid);
158 typedef BOOL WINAPI (*TSetNamedSecurityInfo) (LPTSTR pObjectName,
159 SE_OBJECT_TYPE ObjectType,
161 SecurityInfo, PSID psidOwner,
162 PSID psidGroup, PACL pDacl,
165 extern TNtQuerySystemInformation GNNtQuerySystemInformation;
166 extern TGetIfEntry GNGetIfEntry;
167 extern TGetIpAddrTable GNGetIpAddrTable;
168 extern TGetIfTable GNGetIfTable;
169 extern TCreateHardLink GNCreateHardLink;
170 extern TOpenSCManager GNOpenSCManager;
171 extern TCreateService GNCreateService;
172 extern TCloseServiceHandle GNCloseServiceHandle;
173 extern TDeleteService GNDeleteService;
174 extern TRegisterServiceCtrlHandler GNRegisterServiceCtrlHandler;
175 extern TSetServiceStatus GNSetServiceStatus;
176 extern TStartServiceCtrlDispatcher GNStartServiceCtrlDispatcher;
177 extern TControlService GNControlService;
178 extern TOpenService GNOpenService;
179 extern TGetBestInterface GNGetBestInterface;
180 extern TGetAdaptersInfo GGetAdaptersInfo;
181 extern TNetUserAdd GNNetUserAdd;
182 extern TNetUserSetInfo GNNetUserSetInfo;
183 extern TLsaOpenPolicy GNLsaOpenPolicy;
184 extern TLsaAddAccountRights GNLsaAddAccountRights;
185 extern TLsaRemoveAccountRights GNLsaRemoveAccountRights;
186 extern TLsaClose GNLsaClose;
187 extern TLookupAccountName GNLookupAccountName;
188 extern TGetFileSecurity GNGetFileSecurity;
189 extern TInitializeSecurityDescriptor GNInitializeSecurityDescriptor;
190 extern TGetSecurityDescriptorDacl GNGetSecurityDescriptorDacl;
191 extern TGetAclInformation GNGetAclInformation;
192 extern TInitializeAcl GNInitializeAcl;
193 extern TGetAce GNGetAce;
194 extern TEqualSid GNEqualSid;
195 extern TAddAce GNAddAce;
196 extern TAddAccessAllowedAce GNAddAccessAllowedAce;
197 extern TSetNamedSecurityInfo GNSetNamedSecurityInfo;
200 BOOL CreateShortcut (const char *pszSrc, const char *pszDest);
201 BOOL DereferenceShortcut (char *pszShortcut);
202 long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSubKey,
203 char *pszBuffer, long *pdLength);
204 int ListNICs (void (*callback) (void *, const char *, int), void *cls);
205 BOOL AddPathAccessRights (char *lpszFileName, char *lpszAccountName,
207 char *winErrorStr (const char *prefix, int dwErr);
208 void EnumNICs(PMIB_IFTABLE *pIfTable, PMIB_IPADDRTABLE *pAddrTable);
210 void GNShutdownWinEnv ();