OSDN Git Service

Timeval struct bitness issue [#2059]
[mingw/mingw-org-wsl.git] / include / winefs.h
1 /**
2  * @file winefs.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _WINEFS_H
25 #define _WINEFS_H
26 #pragma GCC system_header
27 #include <_mingw.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #define ___API_DWORD__ WINADVAPI DWORD WINAPI
34 #define ___API_BOOL__  WINADVAPI BOOL  WINAPI
35 #define ___API_VOID__  WINADVAPI VOID  WINAPI
36 #define ___API_DWORD_DEPRECATED__ __MINGW_DEPRECATED (WINADVAPI DWORD WINAPI)
37 #define ___API_VOID_DEPRECATED__  __MINGW_DEPRECATED WINADVAPI VOID  WINAPI
38
39 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
40 #define WINEFS_SETUSERKEY_SET_CAPABILITIES 0x00000001
41
42 typedef struct _CERTIFICATE_BLOB {
43   DWORD dwCertEncodingType;
44 #ifdef MIDL_PASS
45   [range(0,32768)]
46 #endif
47   DWORD cbData;
48 #ifdef MIDL_PASS
49   [size_is(cbData)]
50 #endif
51   PBYTE pbData;
52 } EFS_CERTIFICATE_BLOB, *PEFS_CERTIFICATE_BLOB;
53
54 typedef struct _EFS_HASH_BLOB {
55 #ifdef MIDL_PASS
56   [range(0,100)]
57 #endif
58   DWORD cbData;
59 #ifdef MIDL_PASS
60   [size_is(dbData)]
61 #endif
62   PBYTE pbData;
63 } EFS_HASH_BLOB, *PEFS_HASH_BLOB;
64
65 typedef struct _ENCRYPTION_CERTIFICATE {
66   DWORD cbTotalLength;
67   SID * PUserSid;
68   PEFS_CERTIFICATE_BLOB pCertBlob;
69 } ENCRYPTION_CERTIFICATE, *PENCRYPTION_CERTIFICATE;
70
71 #define MAX_SID_SIZE 256
72
73 typedef struct _ENCRYPTION_CERTIFICATE_HASH {
74   DWORD cbTotalLength;
75   SID * pUserSid;
76   PEFS_HASH_BLOB pHash;
77 #ifdef MIDL_PASS
78   [string]
79 #endif
80   LPWSTR lpDisplayInformation;
81 } ENCRYPTION_CERTIFICATE_HASH, *PENCRYPTION_CERTIFICATE_HASH;
82
83 typedef struct _ENCRYPTION_CERTIFICATE_HASH_LIST {
84 #ifdef MIDL_PASS
85   [range(0,500)]
86 #endif
87   DWORD nCert_Hash;
88 #ifdef MIDL_PASS
89   [size_is(nCert_Hash)]
90 #endif
91   PENCRYPTION_CERTIFICATE_HASH * pUsers;
92 } ENCRYPTION_CERTIFICATE_HASH_LIST, *PENCRYPTION_CERTIFICATE_HASH_LIST;
93
94 typedef struct _ENCRYPTION_CERTIFICATE_LIST {
95 #ifdef MIDL_PASS
96   [range(0,500)]
97 #endif
98   DWORD nUsers;
99 #ifdef MIDL_PASS
100   [size_is(nUsers)]
101 #endif
102   PENCRYPTION_CERTIFICATE * pUsers;
103 } ENCRYPTION_CERTIFICATE_LIST, *PENCRYPTION_CERTIFICATE_LIST;
104
105 ___API_DWORD__ QueryUsersOnEncryptedFile(LPCWSTR, PENCRYPTION_CERTIFICATE_HASH_LIST);
106 ___API_DWORD__ QueryRecoveryAgentsOnEncryptedFile(LPCWSTR, PENCRYPTION_CERTIFICATE_HASH_LIST);
107 ___API_DWORD__ RemoveUsersFromEncryptedFile(LPCWSTR, PENCRYPTION_CERTIFICATE_HASH_LIST);
108 ___API_DWORD__ AddUsersToEncryptedFile(LPCWSTR, PENCRYPTION_CERTIFICATE_HASH_LIST);
109 ___API_DWORD__ SetUserFileEncryptionKey(PENCRYPTION_CERTIFICATE);
110 ___API_VOID__  FreeEncryptionCertificateHashList(PENCRYPTION_CERTIFICATE_HASH_LIST);
111 ___API_BOOL__  EncryptionDisable(LPCWSTR, BOOL);
112
113 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_WIN2K) */
114
115 #if (_WIN32_WINNT >= _WIN32_WINNT_WS03 && _WIN32_WINNT < _WIN32_WINNT_WINXP)
116 ___API_DWORD__ DuplicateEncryptionInfoFile(LPCWSTR, LPCWSTR, DWORD, DWORD, CONST LPSECURITY_ATTRIBUTES);
117 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_WS03 && _WIN32_WINNT < _WIN32_WINNT_WINXP) */
118
119 #if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
120 #ifndef ALGIDDEF
121 #define ALGIDDEF
122 typedef unsigned int ALG_ID;
123 #endif /* ndef ALGIDDEF */
124
125 typedef struct _EFS_RPC_BLOB {
126 #ifdef MIDL_PASS
127   [range(0,266240)]
128 #endif
129   DWORD cbData;
130 #ifdef MIDL_PASS
131   PBYTE pbData;
132 #endif
133 } EFS_RPC_BLOB, *PEFS_RPC_BLOB;
134
135 typedef struct _EFS_KEY_INFO {
136   DWORD  dwVersion;
137   ULONG  Entropy;
138   ALG_ID Algorithm;
139   ULONG  KeyLength;
140 } EFS_KEY_INFO, *PEFS_KEY_INFO;
141
142 ___API_DWORD__ DuplicateEncryptionInfoFile(LPCWSTR, LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES);
143
144 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_WINXP) */
145
146 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
147 typedef struct _EFS_PIN_BLOB {
148 #ifdef MIDL_PASS
149   [range(0,8)]
150 #endif
151   DWORD cbPadding;
152 #ifdef MIDL_PASS
153   [range(0,2048)]
154 #endif
155   DWORD cbData;
156 #ifdef MIDL_PASS
157   [size_is(cbData+cbPadding)]
158 #endif
159   PBYTE pbData;
160 } EFS_PIN_BLOB, *PEFS_PIN_BLOB;
161
162 typedef struct _EFS_DECRYPTION_STATUS_INFO {
163   DWORD dwDecryptionError;
164   DWORD dwHashOffset;
165   DWORD cbHash;
166 } EFS_DECRYPTION_STATUS_INFO, *PEFS_DECRYPTION_STATUS_INFO;
167
168 typedef struct _EFS_ENCRYPTION_STATUS_INFO {
169   BOOL  bHasCurrentKey;
170   DWORD dwEncryptionError;
171 } EFS_ENCRYPTION_STATUS_INFO, *PEFS_ENCRYPTION_STATUS_INFO;
172
173 #define EFS_METADATA_ADD_USER     0x00000001
174 #define EFS_METADATA_REMOVE_USER  0x00000002
175 #define EFS_METADATA_REPLACE_USER 0x00000004
176 #define EFS_METADATA_GENERAL_OP   0x00000008
177
178 typedef struct _ENCRYPTED_FILE_METADATA_SIGNATURE {
179   DWORD                             dwEfsAccessType;
180   PENCRYPTION_CERTIFICATE_HASH_LIST pCertificatesAdded;
181   PENCRYPTION_CERTIFICATE           pEncryptionCertificate;
182   PEFS_RPC_BLOB                     pEfsStreamSignature;
183 } ENCRYPTED_FILE_METADATA_SIGNATURE, *PENCRYPTED_FILE_METADATA_SIGNATURE;
184
185 ___API_DWORD__ SetUserFileEncryptionKeyEx(PENCRYPTION_CERTIFICATE, DWORD, DWORD, LPVOID);
186
187 ___API_DWORD_DEPRECATED__ GetEncryptedFileMetadata(LPCWSTR, PDWORD, PBYTE);
188 ___API_DWORD_DEPRECATED__ SetEncryptedFileMetadata(LPCWSTR, PBYTE, PBYTE, PENCRYPTION_CERTIFICATE_HASH, DWORD, PENCRYPTION_CERTIFICATE_HASH_LIST);
189 ___API_VOID_DEPRICATED__  FreeEncryptedFileMetadata(PBYTE);
190
191 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_VISTA) */
192
193 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
194 typedef struct _EFS_COMPATIBILITY_INFO {
195   DWORD EfsVersion;
196 } EFS_COMPATIBILITY_INFO, *PEFS_COMPATIBILITY_INFO;
197
198 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_WIN7) */
199
200 #undef ___API_DWORD__
201 #undef ___API_BOOL__
202 #undef ___API_VOID__
203 #undef ___API_DWORD_DEPRECATED__
204 #undef ___API_VOID_DEPRECATED__
205
206 #ifdef __cplusplus
207 }
208 #endif
209
210 #endif /* ndef _WINEFS_H */