[ADVAPI32]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 27 Apr 2013 09:15:24 +0000 (09:15 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 27 Apr 2013 09:15:24 +0000 (09:15 +0000)
- Properly stub some commonly used safer functions
CORE-6942 #resolve

svn path=/trunk/; revision=58868

reactos/dll/win32/advapi32/CMakeLists.txt
reactos/dll/win32/advapi32/advapi32.spec
reactos/dll/win32/advapi32/sec/misc.c
reactos/dll/win32/advapi32/sec/safer.c [new file with mode: 0644]

index 7058322..6e79c73 100644 (file)
@@ -14,7 +14,6 @@ add_rpc_files(client
     ${REACTOS_SOURCE_DIR}/include/reactos/idl/eventlogrpc.idl
     ${REACTOS_SOURCE_DIR}/include/reactos/idl/lsa.idl
     ${REACTOS_SOURCE_DIR}/include/reactos/idl/svcctl.idl)
-    
 
 list(APPEND SOURCE
     crypt/crypt.c
@@ -38,6 +37,7 @@ list(APPEND SOURCE
     sec/cred.c
     sec/lsa.c
     sec/misc.c
+    sec/safer.c
     sec/sec.c
     sec/sid.c
     sec/trustee.c
index 9c99329..104203b 100644 (file)
 @ stdcall ReportEventA(long long long long ptr long long str ptr)
 @ stdcall ReportEventW(long long long long ptr long long wstr ptr)
 @ stdcall RevertToSelf()
-@ stub SaferCloseLevel
-@ stub SaferComputeTokenFromLevel
+@ stdcall SaferCloseLevel(ptr)
+@ stdcall SaferComputeTokenFromLevel(ptr ptr ptr long ptr)
 @ stdcall SaferCreateLevel(long long long ptr ptr)
 @ stub SaferGetLevelInformation
 @ stdcall SaferGetPolicyInformation(long long long ptr ptr ptr)
-@ stub SaferIdentifyLevel
-@ stub SaferRecordEventLogEntry
+@ stdcall SaferIdentifyLevel(long ptr ptr ptr)
+@ stdcall SaferRecordEventLogEntry(ptr wstr ptr)
 @ stub SaferSetLevelInformation
 @ stub SaferSetPolicyInformation
 @ stub SaferiChangeRegistryScope
index 3f87bca..4a30926 100644 (file)
@@ -2279,26 +2279,6 @@ TreeResetNamedSecurityInfoA(LPSTR pObjectName,
 #endif
 }
 
-/******************************************************************************
- * SaferCreateLevel   [ADVAPI32.@]
- */
-BOOL WINAPI SaferCreateLevel(DWORD ScopeId, DWORD LevelId, DWORD OpenFlags,
-                             SAFER_LEVEL_HANDLE* LevelHandle, LPVOID lpReserved)
-{
-    FIXME("(%u, %x, %u, %p, %p) stub\n", ScopeId, LevelId, OpenFlags, LevelHandle, lpReserved);
-    return FALSE;
-}
-
-/******************************************************************************
- * SaferGetPolicyInformation   [ADVAPI32.@]
- */
-BOOL WINAPI SaferGetPolicyInformation(DWORD scope, SAFER_POLICY_INFO_CLASS class, DWORD size,
-                                      PVOID buffer, PDWORD required, LPVOID lpReserved)
-{
-    FIXME("(%u %u %u %p %p %p) stub\n", scope, class, size, buffer, required, lpReserved);
-    return FALSE;
-}
-
 /******************************************************************************
  * QueryWindows31FilesMigration [ADVAPI32.@]
  *
diff --git a/reactos/dll/win32/advapi32/sec/safer.c b/reactos/dll/win32/advapi32/sec/safer.c
new file mode 100644 (file)
index 0000000..3905db1
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ * PROJECT:         ReactOS system libraries
+ * LICENSE:         GPLv2+ - See COPYING in the top level directory
+ * PURPOSE:         Safer functions
+ * PROGRAMMER:      Thomas Faber <thomas.faber@reactos.org>
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <advapi32.h>
+WINE_DEFAULT_DEBUG_CHANNEL(advapi);
+
+
+/* FUNCTIONS *****************************************************************/
+
+/**********************************************************************
+ *  SaferCreateLevel
+ *
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SaferCreateLevel(
+    _In_ DWORD dwScopeId,
+    _In_ DWORD dwLevelId,
+    _In_ DWORD OpenFlags,
+    _Outptr_ SAFER_LEVEL_HANDLE *pLevelHandle,
+    _Reserved_ PVOID pReserved)
+{
+    FIXME("(%lu, %lu, %lu, %p, %p) stub\n", dwScopeId, dwLevelId, OpenFlags, pLevelHandle, pReserved);
+    *pLevelHandle = (SAFER_LEVEL_HANDLE)0x42;
+    return TRUE;
+}
+
+
+/**********************************************************************
+ *  SaferIdentifyLevel
+ *
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SaferIdentifyLevel(
+    _In_ DWORD dwNumProperties,
+    _In_reads_opt_(dwNumProperties) PSAFER_CODE_PROPERTIES pCodeProperties,
+    _Outptr_ SAFER_LEVEL_HANDLE *pLevelHandle,
+    _Reserved_ PVOID pReserved)
+{
+    DWORD i;
+
+    if (pLevelHandle == NULL)
+    {
+        SetLastError(ERROR_NOACCESS);
+        return FALSE;
+    }
+
+    for (i = 0; i < dwNumProperties; i++)
+    {
+        if (pCodeProperties[i].cbSize != sizeof(SAFER_CODE_PROPERTIES_V1))
+        {
+            SetLastError(ERROR_BAD_LENGTH);
+            return FALSE;
+        }
+    }
+
+    FIXME("(%lu, %p, %p, %p) stub\n", dwNumProperties, pCodeProperties, pLevelHandle, pReserved);
+
+    *pLevelHandle = (SAFER_LEVEL_HANDLE)0x42;
+    return TRUE;
+}
+
+
+/**********************************************************************
+ *  SaferCloseLevel
+ *
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SaferCloseLevel(
+    _In_ SAFER_LEVEL_HANDLE hLevelHandle)
+{
+    FIXME("(%p) stub\n", hLevelHandle);
+    if (hLevelHandle != (SAFER_LEVEL_HANDLE)0x42)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+    return TRUE;
+}
+
+
+BOOL
+WINAPI
+SaferGetLevelInformation(
+    _In_ SAFER_LEVEL_HANDLE LevelHandle,
+    _In_ SAFER_OBJECT_INFO_CLASS dwInfoType,
+    _Out_writes_bytes_opt_(dwInBufferSize) PVOID pQueryBuffer,
+    _In_ DWORD dwInBufferSize,
+    _Out_ PDWORD pdwOutBufferSize);
+
+
+BOOL
+WINAPI
+SaferSetLevelInformation(
+    _In_ SAFER_LEVEL_HANDLE LevelHandle,
+    _In_ SAFER_OBJECT_INFO_CLASS dwInfoType,
+    _In_reads_bytes_(dwInBufferSize) PVOID pQueryBuffer,
+    _In_ DWORD dwInBufferSize);
+
+
+/**********************************************************************
+ *  SaferGetPolicyInformation
+ *
+ * @unimplemented
+ */
+BOOL
+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)
+{
+    FIXME("(%lu, %d, %lu, %p, %p, %p) stub\n", dwScopeId, SaferPolicyInfoClass, InfoBufferSize, InfoBuffer, InfoBufferRetSize, pReserved);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+BOOL
+WINAPI
+SaferSetPolicyInformation(
+    _In_ DWORD dwScopeId,
+    _In_ SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass,
+    _In_ DWORD InfoBufferSize,
+    _In_reads_bytes_(InfoBufferSize) PVOID InfoBuffer,
+    _Reserved_ PVOID pReserved);
+
+
+/**********************************************************************
+ *  SaferComputeTokenFromLevel
+ *
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SaferComputeTokenFromLevel(
+    _In_ SAFER_LEVEL_HANDLE LevelHandle,
+    _In_opt_ HANDLE InAccessToken,
+    _Out_ PHANDLE OutAccessToken,
+    _In_ DWORD dwFlags,
+    _Inout_opt_ PVOID pReserved)
+{
+    FIXME("(%p, %p, %p, 0x%lx, %p) stub\n", LevelHandle, InAccessToken, OutAccessToken, dwFlags, pReserved);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/**********************************************************************
+ *  SaferRecordEventLogEntry
+ *
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SaferRecordEventLogEntry(
+    _In_ SAFER_LEVEL_HANDLE hLevel,
+    _In_ PCWSTR szTargetPath,
+    _Reserved_ PVOID pReserved)
+{
+    FIXME("(%p, %s, %p) stub\n", hLevel, wine_dbgstr_w(szTargetPath), pReserved);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+BOOL
+WINAPI
+SaferiIsExecutableFileType(
+    _In_ PCWSTR szFullPath,
+    _In_ BOOLEAN bFromShellExecute);
+
+/* EOF */