diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-05-29 00:46:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-05-29 00:46:26 +0000 |
commit | 0a217a8df1657b4334b55b0e4a6c7837a8dbcfd9 (patch) | |
tree | 6b552f40eb089db96409a312a98d9b12bd669102 /src/include/winproc.h | |
download | gnunet-0a217a8df1657b4334b55b0e4a6c7837a8dbcfd9.tar.gz gnunet-0a217a8df1657b4334b55b0e4a6c7837a8dbcfd9.zip |
ng
Diffstat (limited to 'src/include/winproc.h')
-rw-r--r-- | src/include/winproc.h | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/src/include/winproc.h b/src/include/winproc.h new file mode 100644 index 000000000..a4a173a13 --- /dev/null +++ b/src/include/winproc.h | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other contributing authors) | ||
4 | |||
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. | ||
9 | |||
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. | ||
14 | |||
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. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file util/winproc.h | ||
23 | * @brief Definitions for MS Windows | ||
24 | * @author Nils Durner | ||
25 | **/ | ||
26 | |||
27 | #ifndef _WINPROC_H | ||
28 | #define _WINPROC_H | ||
29 | |||
30 | #include <io.h> | ||
31 | #include <stdio.h> | ||
32 | #include <sys/types.h> | ||
33 | #include <sys/stat.h> | ||
34 | #include <sys/timeb.h> | ||
35 | #include <time.h> | ||
36 | #include <dirent.h> | ||
37 | #include <windows.h> | ||
38 | #include <winsock.h> | ||
39 | #include <winerror.h> | ||
40 | #include <iphlpapi.h> | ||
41 | #include <shlobj.h> | ||
42 | #include <objbase.h> | ||
43 | #include <sys/param.h> /* #define BYTE_ORDER */ | ||
44 | #include <Ntsecapi.h> | ||
45 | #include <lm.h> | ||
46 | #include <Aclapi.h> | ||
47 | #include "gnunet_util.h" | ||
48 | #include "platform.h" | ||
49 | |||
50 | #ifdef __cplusplus | ||
51 | extern "C" | ||
52 | { | ||
53 | #endif | ||
54 | |||
55 | #ifndef MAX_NAME_LENGTH | ||
56 | #define MAX_NAME_LENGTH 25 | ||
57 | #endif | ||
58 | |||
59 | typedef DWORD WINAPI (*TNtQuerySystemInformation) (int, PVOID, ULONG, | ||
60 | PULONG); | ||
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, | ||
65 | BOOL bOrder); | ||
66 | typedef DWORD WINAPI (*TCreateHardLink) (LPCTSTR lpFileName, | ||
67 | LPCTSTR lpExistingFileName, | ||
68 | LPSECURITY_ATTRIBUTES | ||
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, | ||
77 | DWORD dwServiceType, | ||
78 | DWORD dwStartType, | ||
79 | DWORD dwErrorControl, | ||
80 | LPCTSTR lpBinaryPathName, | ||
81 | LPCTSTR lpLoadOrderGroup, | ||
82 | LPDWORD lpdwTagId, | ||
83 | LPCTSTR lpDependencies, | ||
84 | LPCTSTR lpServiceStartName, | ||
85 | LPCTSTR lpPassword); | ||
86 | typedef BOOL WINAPI (*TCloseServiceHandle) (SC_HANDLE hSCObject); | ||
87 | typedef BOOL WINAPI (*TDeleteService) (SC_HANDLE hService); | ||
88 | typedef SERVICE_STATUS_HANDLE WINAPI (*TRegisterServiceCtrlHandler) (LPCTSTR | ||
89 | lpServiceName, | ||
90 | LPHANDLER_FUNCTION | ||
91 | lpHandlerProc); | ||
92 | typedef BOOL WINAPI (*TSetServiceStatus) (SERVICE_STATUS_HANDLE | ||
93 | hServiceStatus, | ||
94 | LPSERVICE_STATUS lpServiceStatus); | ||
95 | typedef BOOL WINAPI (*TStartServiceCtrlDispatcher) (const | ||
96 | LPSERVICE_TABLE_ENTRY | ||
97 | lpServiceTable); | ||
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, | ||
106 | PULONG pOutBufLen); | ||
107 | typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE, | ||
108 | PDWORD); | ||
109 | typedef NET_API_STATUS WINAPI (*TNetUserSetInfo) (LPCWSTR servername, | ||
110 | LPCWSTR username, | ||
111 | DWORD level, LPBYTE buf, | ||
112 | LPDWORD parm_err); | ||
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, | ||
119 | BOOLEAN, | ||
120 | PLSA_UNICODE_STRING, | ||
121 | ULONG); | ||
122 | typedef NTSTATUS NTAPI (*TLsaClose) (LSA_HANDLE); | ||
123 | typedef BOOL WINAPI (*TLookupAccountName) (LPCTSTR lpSystemName, | ||
124 | LPCTSTR lpAccountName, PSID Sid, | ||
125 | LPDWORD cbSid, | ||
126 | LPTSTR ReferencedDomainName, | ||
127 | LPDWORD cchReferencedDomainName, | ||
128 | PSID_NAME_USE peUse); | ||
129 | |||
130 | typedef BOOL WINAPI (*TGetFileSecurity) (LPCTSTR lpFileName, | ||
131 | SECURITY_INFORMATION | ||
132 | RequestedInformation, | ||
133 | PSECURITY_DESCRIPTOR | ||
134 | pSecurityDescriptor, DWORD nLength, | ||
135 | LPDWORD lpnLengthNeeded); | ||
136 | typedef BOOL WINAPI (*TInitializeSecurityDescriptor) (PSECURITY_DESCRIPTOR | ||
137 | pSecurityDescriptor, | ||
138 | DWORD dwRevision); | ||
139 | typedef BOOL WINAPI (*TGetSecurityDescriptorDacl) (PSECURITY_DESCRIPTOR | ||
140 | pSecurityDescriptor, | ||
141 | LPBOOL lpbDaclPresent, | ||
142 | PACL * pDacl, | ||
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, | ||
160 | SECURITY_INFORMATION | ||
161 | SecurityInfo, PSID psidOwner, | ||
162 | PSID psidGroup, PACL pDacl, | ||
163 | PACL pSacl); | ||
164 | |||
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; | ||
198 | |||
199 | |||
200 | BOOL CreateShortcut (const char *pszSrc, const char *pszDest); | ||
201 | BOOL DereferenceShortcut (char *pszShortcut); | ||
202 | long QueryRegistry (HKEY hMainKey, char *pszKey, char *pszSubKey, | ||
203 | char *pszBuffer, long *pdLength); | ||
204 | int ListNICs (void (*callback) (const char *, int, void *), void *cls); | ||
205 | BOOL AddPathAccessRights (char *lpszFileName, char *lpszAccountName, | ||
206 | DWORD dwAccessMask); | ||
207 | char *winErrorStr (const char *prefix, int dwErr); | ||
208 | |||
209 | void GNInitWinEnv (); | ||
210 | void GNShutdownWinEnv (); | ||
211 | |||
212 | #ifdef __cplusplus | ||
213 | } | ||
214 | #endif | ||
215 | |||
216 | #endif | ||