ReactOS 0.4.16-dev-205-g7b2bb7e
SaferIdentifyLevel.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for SaferIdentifyLevel
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8#include "precomp.h"
9
10#include <winsafer.h>
11
12#define SaferIdentifyLevel(c, p, h, r) SaferIdentifyLevel(c, (PSAFER_CODE_PROPERTIES)(p), h, r)
13
15{
16 BOOL ret;
18 SAFER_LEVEL_HANDLE handle;
20
21 StartSeh()
22 SetLastError(0xbadbad00);
25 ok(ret == FALSE, "ret = %d\n", ret);
26 ok(error == ERROR_NOACCESS, "error = %lu\n", error);
28
29 StartSeh()
32
33 StartSeh()
34 ZeroMemory(props, sizeof(props));
35 SetLastError(0xbadbad00);
38 ok(ret == FALSE, "ret = %d\n", ret);
39 ok(error == ERROR_BAD_LENGTH, "error = %lu\n", error);
41
42 StartSeh()
43 ZeroMemory(props, sizeof(props));
44 SetLastError(0xbadbad00);
47 ok(ret == FALSE, "ret = %d\n", ret);
48 ok(error == ERROR_NOACCESS, "error = %lu\n", error);
50
51 StartSeh()
53 ZeroMemory(props, sizeof(props));
54 SetLastError(0xbadbad00);
57 ok(ret == FALSE, "ret = %d\n", ret);
58 ok(handle == InvalidPointer, "handle = %p\n", handle);
59 ok(error == ERROR_BAD_LENGTH, "error = %lu\n", error);
63
64 /* Struct sizes */
65 StartSeh()
67 ZeroMemory(props, sizeof(props));
68 props[0].cbSize = sizeof(SAFER_CODE_PROPERTIES_V1);
69 SetLastError(0xbadbad00);
72 ok(ret == TRUE, "ret = %d\n", ret);
73 ok(handle != NULL && handle != INVALID_HANDLE_VALUE && handle != InvalidPointer, "handle = %p\n", handle);
74 ok(error == 0xbadbad00, "error = %lu\n", error);
76 {
78 ok(ret == TRUE, "ret = %d\n", ret);
79 }
81
82 StartSeh()
84 ZeroMemory(props, sizeof(props));
85 props[0].cbSize = sizeof(SAFER_CODE_PROPERTIES_V2);
86 SetLastError(0xbadbad00);
89 ok(ret == FALSE, "ret = %d\n", ret);
90 ok(handle == InvalidPointer, "handle = %p\n", handle);
91 ok(error == ERROR_BAD_LENGTH, "error = %lu\n", error);
95
96 /* Test SaferCloseLevel too */
97 StartSeh()
100 ok(ret == FALSE, "ret = %d\n", ret);
101 ok(error == ERROR_INVALID_HANDLE, "error = %lu\n", error);
103
104 StartSeh()
107 ok(ret == FALSE, "ret = %d\n", ret);
108 ok(error == ERROR_INVALID_HANDLE, "error = %lu\n", error);
110
111 StartSeh()
114 ok(ret == FALSE, "ret = %d\n", ret);
115 ok(error == ERROR_INVALID_HANDLE, "error = %lu\n", error);
117}
#define InvalidPointer
#define SaferIdentifyLevel(c, p, h, r)
#define StartSeh()
Definition: _sntprintf.h:16
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
#define VOID
Definition: acefi.h:82
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define error(str)
Definition: mkdosfs.c:1605
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
BOOL WINAPI SaferCloseLevel(_In_ SAFER_LEVEL_HANDLE hLevelHandle)
Definition: safer.c:80
#define STATUS_SUCCESS
Definition: shellext.h:65
static const WCHAR props[]
Definition: wbemdisp.c:288
int ret
#define ZeroMemory
Definition: winbase.h:1736
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_BAD_LENGTH
Definition: winerror.h:127
#define ERROR_NOACCESS
Definition: winerror.h:578
struct _SAFER_CODE_PROPERTIES_V1 SAFER_CODE_PROPERTIES_V1
struct _SAFER_CODE_PROPERTIES_V2 SAFER_CODE_PROPERTIES_V2