xref: /reactos/dll/win32/advapi32/misc/efs.c (revision c2c66aff)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS system libraries
4  * FILE:            dlls/win32/advapi32/misc/efs.c
5  * PURPOSE:         Encrypted File System support
6  * PROGRAMMER:      Christoph_vW
7  */
8 
9 #include <advapi32.h>
10 
11 #include <winefs.h>
12 
13 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
14 
15 /*
16  * @unimplemented
17  */
18 DWORD WINAPI
AddUsersToEncryptedFile(LPCWSTR lpcwstr,PENCRYPTION_CERTIFICATE_LIST pencryption_certificate_list)19 AddUsersToEncryptedFile(LPCWSTR lpcwstr,
20                         PENCRYPTION_CERTIFICATE_LIST pencryption_certificate_list)
21 {
22     FIXME("%s() not implemented!\n", __FUNCTION__);
23     return ERROR_CALL_NOT_IMPLEMENTED;
24 }
25 
26 
27 /*
28  * @implemented
29  */
30 BOOL WINAPI
DecryptFileA(LPCSTR lpFileName,DWORD dwReserved)31 DecryptFileA(LPCSTR lpFileName,
32              DWORD dwReserved)
33 {
34     UNICODE_STRING FileName;
35     BOOL ret;
36 
37     if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
38     {
39         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
40         return FALSE;
41     }
42 
43     ret = DecryptFileW(FileName.Buffer, dwReserved);
44 
45     if (FileName.Buffer != NULL)
46         RtlFreeUnicodeString(&FileName);
47     return ret;
48 }
49 
50 
51 /*
52  * @unimplemented
53  */
54 BOOL WINAPI
DecryptFileW(LPCWSTR lpFileName,DWORD dwReserved)55 DecryptFileW(LPCWSTR lpFileName,
56              DWORD dwReserved)
57 {
58     FIXME("%s(%S) not implemented!\n", __FUNCTION__, lpFileName);
59     return TRUE;
60 }
61 
62 
63 /*
64  * @implemented
65  */
66 BOOL WINAPI
EncryptFileA(LPCSTR lpFileName)67 EncryptFileA(LPCSTR lpFileName)
68 {
69     UNICODE_STRING FileName;
70     BOOL ret;
71 
72     if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
73     {
74         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
75         return FALSE;
76     }
77 
78     ret = EncryptFileW(FileName.Buffer);
79 
80     if (FileName.Buffer != NULL)
81         RtlFreeUnicodeString(&FileName);
82     return ret;
83 }
84 
85 
86 /*
87  * @unimplemented
88  */
89 BOOL WINAPI
EncryptFileW(LPCWSTR lpFileName)90 EncryptFileW(LPCWSTR lpFileName)
91 {
92     FIXME("%s() not implemented!\n", __FUNCTION__);
93     return TRUE;
94 }
95 
96 
97 /*
98  * @unimplemented
99  */
100 BOOL WINAPI
EncryptionDisable(LPCWSTR DirPath,BOOL Disable)101 EncryptionDisable(LPCWSTR DirPath,
102                   BOOL Disable)
103 {
104     FIXME("%s() not implemented!\n", __FUNCTION__);
105     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
106     return FALSE;
107 }
108 
109 
110 /*
111  * @implemented
112  */
113 BOOL WINAPI
FileEncryptionStatusA(LPCSTR lpFileName,LPDWORD lpStatus)114 FileEncryptionStatusA(LPCSTR lpFileName,
115                       LPDWORD lpStatus)
116 {
117     UNICODE_STRING FileName;
118     BOOL ret = FALSE;
119 
120     TRACE("(%s, %p)\n", lpFileName, lpStatus);
121 
122     FileName.Buffer = NULL;
123 
124     if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
125     {
126         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
127         goto cleanup;
128     }
129 
130     ret = FileEncryptionStatusW(FileName.Buffer, lpStatus);
131 
132 cleanup:
133     if (FileName.Buffer != NULL)
134         RtlFreeUnicodeString(&FileName);
135 
136     return ret;
137 }
138 
139 /*
140  * @unimplemented
141  */
142 BOOL WINAPI
FileEncryptionStatusW(LPCWSTR lpFileName,LPDWORD lpStatus)143 FileEncryptionStatusW(LPCWSTR lpFileName,
144                       LPDWORD lpStatus)
145 {
146     FIXME("%s(%S) not implemented!\n", __FUNCTION__, lpFileName);
147 
148     if (!lpStatus)
149         return FALSE;
150 
151     *lpStatus = FILE_SYSTEM_NOT_SUPPORT;
152 
153     return TRUE;
154 }
155 
156 
157 /*
158  * @unimplemented
159  */
160 VOID WINAPI
FreeEncryptionCertificateHashList(PENCRYPTION_CERTIFICATE_HASH_LIST pencryption_certificate_hash_list)161 FreeEncryptionCertificateHashList(PENCRYPTION_CERTIFICATE_HASH_LIST pencryption_certificate_hash_list)
162 {
163     FIXME("%s() not implemented!\n", __FUNCTION__);
164     return;
165 }
166 
167 
168 /*
169  * @unimplemented
170  */
171 DWORD WINAPI
QueryRecoveryAgentsOnEncryptedFile(LPCWSTR lpctstr,PENCRYPTION_CERTIFICATE_HASH_LIST * pencryption_certificate_hash_list)172 QueryRecoveryAgentsOnEncryptedFile(LPCWSTR lpctstr,
173                                    PENCRYPTION_CERTIFICATE_HASH_LIST* pencryption_certificate_hash_list)
174 {
175     FIXME("%s() not implemented!\n", __FUNCTION__);
176     return ERROR_CALL_NOT_IMPLEMENTED;
177 }
178 
179 
180 /*
181  * @unimplemented
182  */
183 DWORD WINAPI
QueryUsersOnEncryptedFile(LPCWSTR lpctstr,PENCRYPTION_CERTIFICATE_HASH_LIST * pencryption_certificate_hash_list)184 QueryUsersOnEncryptedFile(LPCWSTR lpctstr,
185                           PENCRYPTION_CERTIFICATE_HASH_LIST* pencryption_certificate_hash_list)
186 {
187     FIXME("%s() not implemented!\n", __FUNCTION__);
188     return ERROR_CALL_NOT_IMPLEMENTED;
189 }
190 
191 
192 /*
193  * @unimplemented
194  */
195 DWORD WINAPI
RemoveUsersFromEncryptedFile(LPCWSTR lpcwstr,PENCRYPTION_CERTIFICATE_HASH_LIST pencryption_certificate_hash_list)196 RemoveUsersFromEncryptedFile(LPCWSTR lpcwstr,
197                              PENCRYPTION_CERTIFICATE_HASH_LIST pencryption_certificate_hash_list)
198 {
199     FIXME("%s() not implemented!\n", __FUNCTION__);
200     return ERROR_CALL_NOT_IMPLEMENTED;
201 }
202 
203 /* EOF */
204