1 /*
2 * PROJECT: ReactOS system libraries
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Safer functions
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8 /* INCLUDES ******************************************************************/
9
10 #include <advapi32.h>
11 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
12
13
14 /* FUNCTIONS *****************************************************************/
15
16 /**********************************************************************
17 * SaferCreateLevel
18 *
19 * @unimplemented
20 */
21 BOOL
22 WINAPI
SaferCreateLevel(_In_ DWORD dwScopeId,_In_ DWORD dwLevelId,_In_ DWORD OpenFlags,_Outptr_ SAFER_LEVEL_HANDLE * pLevelHandle,_Reserved_ PVOID pReserved)23 SaferCreateLevel(
24 _In_ DWORD dwScopeId,
25 _In_ DWORD dwLevelId,
26 _In_ DWORD OpenFlags,
27 _Outptr_ SAFER_LEVEL_HANDLE *pLevelHandle,
28 _Reserved_ PVOID pReserved)
29 {
30 FIXME("(%lu, %lu, %lu, %p, %p) stub\n", dwScopeId, dwLevelId, OpenFlags, pLevelHandle, pReserved);
31 *pLevelHandle = (SAFER_LEVEL_HANDLE)0x42;
32 return TRUE;
33 }
34
35
36 /**********************************************************************
37 * SaferIdentifyLevel
38 *
39 * @unimplemented
40 */
41 BOOL
42 WINAPI
SaferIdentifyLevel(_In_ DWORD dwNumProperties,_In_reads_opt_ (dwNumProperties)PSAFER_CODE_PROPERTIES pCodeProperties,_Outptr_ SAFER_LEVEL_HANDLE * pLevelHandle,_Reserved_ PVOID pReserved)43 SaferIdentifyLevel(
44 _In_ DWORD dwNumProperties,
45 _In_reads_opt_(dwNumProperties) PSAFER_CODE_PROPERTIES pCodeProperties,
46 _Outptr_ SAFER_LEVEL_HANDLE *pLevelHandle,
47 _Reserved_ PVOID pReserved)
48 {
49 DWORD i;
50
51 if (pLevelHandle == NULL)
52 {
53 SetLastError(ERROR_NOACCESS);
54 return FALSE;
55 }
56
57 for (i = 0; i < dwNumProperties; i++)
58 {
59 if (pCodeProperties[i].cbSize != sizeof(SAFER_CODE_PROPERTIES_V1))
60 {
61 SetLastError(ERROR_BAD_LENGTH);
62 return FALSE;
63 }
64 }
65
66 FIXME("(%lu, %p, %p, %p) stub\n", dwNumProperties, pCodeProperties, pLevelHandle, pReserved);
67
68 *pLevelHandle = (SAFER_LEVEL_HANDLE)0x42;
69 return TRUE;
70 }
71
72
73 /**********************************************************************
74 * SaferCloseLevel
75 *
76 * @unimplemented
77 */
78 BOOL
79 WINAPI
SaferCloseLevel(_In_ SAFER_LEVEL_HANDLE hLevelHandle)80 SaferCloseLevel(
81 _In_ SAFER_LEVEL_HANDLE hLevelHandle)
82 {
83 FIXME("(%p) stub\n", hLevelHandle);
84 if (hLevelHandle != (SAFER_LEVEL_HANDLE)0x42)
85 {
86 SetLastError(ERROR_INVALID_HANDLE);
87 return FALSE;
88 }
89 return TRUE;
90 }
91
92
93 BOOL
94 WINAPI
95 SaferGetLevelInformation(
96 _In_ SAFER_LEVEL_HANDLE LevelHandle,
97 _In_ SAFER_OBJECT_INFO_CLASS dwInfoType,
98 _Out_writes_bytes_opt_(dwInBufferSize) PVOID pQueryBuffer,
99 _In_ DWORD dwInBufferSize,
100 _Out_ PDWORD pdwOutBufferSize);
101
102
103 BOOL
104 WINAPI
105 SaferSetLevelInformation(
106 _In_ SAFER_LEVEL_HANDLE LevelHandle,
107 _In_ SAFER_OBJECT_INFO_CLASS dwInfoType,
108 _In_reads_bytes_(dwInBufferSize) PVOID pQueryBuffer,
109 _In_ DWORD dwInBufferSize);
110
111
112 /**********************************************************************
113 * SaferGetPolicyInformation
114 *
115 * @unimplemented
116 */
117 BOOL
118 WINAPI
SaferGetPolicyInformation(_In_ DWORD dwScopeId,_In_ SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass,_In_ DWORD InfoBufferSize,_Out_writes_bytes_opt_ (InfoBufferSize)PVOID InfoBuffer,_Out_ PDWORD InfoBufferRetSize,_Reserved_ PVOID pReserved)119 SaferGetPolicyInformation(
120 _In_ DWORD dwScopeId,
121 _In_ SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass,
122 _In_ DWORD InfoBufferSize,
123 _Out_writes_bytes_opt_(InfoBufferSize) PVOID InfoBuffer,
124 _Out_ PDWORD InfoBufferRetSize,
125 _Reserved_ PVOID pReserved)
126 {
127 FIXME("(%lu, %d, %lu, %p, %p, %p) stub\n", dwScopeId, SaferPolicyInfoClass, InfoBufferSize, InfoBuffer, InfoBufferRetSize, pReserved);
128 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
129 return FALSE;
130 }
131
132
133 BOOL
134 WINAPI
135 SaferSetPolicyInformation(
136 _In_ DWORD dwScopeId,
137 _In_ SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass,
138 _In_ DWORD InfoBufferSize,
139 _In_reads_bytes_(InfoBufferSize) PVOID InfoBuffer,
140 _Reserved_ PVOID pReserved);
141
142
143 /**********************************************************************
144 * SaferComputeTokenFromLevel
145 *
146 * @unimplemented
147 */
148 BOOL
149 WINAPI
SaferComputeTokenFromLevel(_In_ SAFER_LEVEL_HANDLE LevelHandle,_In_opt_ HANDLE InAccessToken,_Out_ PHANDLE OutAccessToken,_In_ DWORD dwFlags,_Inout_opt_ PVOID pReserved)150 SaferComputeTokenFromLevel(
151 _In_ SAFER_LEVEL_HANDLE LevelHandle,
152 _In_opt_ HANDLE InAccessToken,
153 _Out_ PHANDLE OutAccessToken,
154 _In_ DWORD dwFlags,
155 _Inout_opt_ PVOID pReserved)
156 {
157 FIXME("(%p, %p, %p, 0x%lx, %p) stub\n", LevelHandle, InAccessToken, OutAccessToken, dwFlags, pReserved);
158 *OutAccessToken = (dwFlags & SAFER_TOKEN_NULL_IF_EQUAL) ? NULL : UlongToHandle(0xdeadf00d);
159 return TRUE;
160 }
161
162
163 /**********************************************************************
164 * SaferRecordEventLogEntry
165 *
166 * @unimplemented
167 */
168 BOOL
169 WINAPI
SaferRecordEventLogEntry(_In_ SAFER_LEVEL_HANDLE hLevel,_In_ PCWSTR szTargetPath,_Reserved_ PVOID pReserved)170 SaferRecordEventLogEntry(
171 _In_ SAFER_LEVEL_HANDLE hLevel,
172 _In_ PCWSTR szTargetPath,
173 _Reserved_ PVOID pReserved)
174 {
175 FIXME("(%p, %s, %p) stub\n", hLevel, wine_dbgstr_w(szTargetPath), pReserved);
176 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
177 return FALSE;
178 }
179
180
181 BOOL
182 WINAPI
183 SaferiIsExecutableFileType(
184 _In_ PCWSTR szFullPath,
185 _In_ BOOLEAN bFromShellExecute);
186
187 /* EOF */
188