ReactOS 0.4.16-dev-334-g4d9f67c
reg_test.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Hugh McMaster
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#ifndef __REG_TEST_H__
20#define __REG_TEST_H__
21
22#include <stdio.h>
23#include <windows.h>
24#include "wine/test.h"
25
26/* Common #defines */
27#define lok ok_(file,line)
28#define KEY_WINE "Software\\Wine"
29#define KEY_BASE KEY_WINE "\\reg_test"
30#define REG_EXIT_SUCCESS 0
31#define REG_EXIT_FAILURE 1
32
33#define TODO_REG_TYPE (0x0001u)
34#define TODO_REG_SIZE (0x0002u)
35#define TODO_REG_DATA (0x0004u)
36#define TODO_REG_COMPARE (0x0008u)
37
38/* add.c */
39#define run_reg_exe(c,r) run_reg_exe_(__FILE__,__LINE__,c,r)
40BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc);
41
42#define verify_reg(k,v,t,d,s,todo) verify_reg_(__FILE__,__LINE__,k,v,t,d,s,todo)
43void verify_reg_(const char *file, unsigned line, HKEY hkey, const char *value,
44 DWORD exp_type, const void *exp_data, DWORD exp_size, DWORD todo);
45
46#define verify_reg_nonexist(k,v) verify_reg_nonexist_(__FILE__,__LINE__,k,v)
47void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value);
48
49#define open_key(r,p,s,k) open_key_(__FILE__,__LINE__,r,p,s,k)
50void open_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam, HKEY *hkey);
51
52#define close_key(k) close_key_(__FILE__,__LINE__,k)
53void close_key_(const char *file, unsigned line, HKEY hkey);
54
55#define verify_key(r,p,s) verify_key_(__FILE__,__LINE__,r,p,s)
56void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
57
58#define verify_key_nonexist(r,p,s) verify_key_nonexist_(__FILE__,__LINE__,r,p,s)
59void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
60
61#define add_key(r,p,s,k) add_key_(__FILE__,__LINE__,r,p,s,k)
62void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey);
63
64#define delete_key(r,p,s) delete_key_(__FILE__,__LINE__,r,p,s)
65void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
66
67#define delete_tree(r,p,s) delete_tree_(__FILE__,__LINE__,r,p,s)
68LONG delete_tree_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
69
70#define add_value(k,n,t,d,s) add_value_(__FILE__,__LINE__,k,n,t,d,s)
71void add_value_(const char *file, unsigned line, HKEY hkey, const char *name,
72 DWORD type, const void *data, size_t size);
73
74#define delete_value(k,n) delete_value_(__FILE__,__LINE__,k,n)
75void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name);
76
77/* export.c */
78#define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo)
79BOOL compare_export_(const char *file, unsigned line, const char *filename,
80 const char *expected, DWORD todo);
81extern const char *empty_key_test;
82extern const char *simple_data_test;
83extern const char *complex_data_test;
84extern const char *key_order_test;
85extern const char *value_order_test;
86extern const char *empty_hex_test;
87extern const char *empty_hex_test2;
88extern const char *hex_types_test;
89extern const char *slashes_test;
90extern const char *embedded_null_test;
91extern const char *escaped_null_test;
92extern const char *registry_view_test;
93
94/* import.c */
96
97#define delete_file(f) delete_file_(__FILE__,__LINE__,f)
98BOOL delete_file_(const char *file, unsigned line, const char *fname);
99
100#define test_import_str(c,r) import_reg(__FILE__,__LINE__,c,FALSE,r)
101#define test_import_wstr(c,r) import_reg(__FILE__,__LINE__,c,TRUE,r)
102BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc);
103
104#endif /* __REG_TEST_H__ */
static REGSAM sam
Definition: query.c:143
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
const char * filename
Definition: ioapi.h:137
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
static const char * contents
Definition: parser.c:511
long LONG
Definition: pedump.c:60
const char * empty_hex_test2
Definition: export.c:125
const char * hex_types_test
Definition: export.c:132
const char * complex_data_test
Definition: export.c:75
void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:139
void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name)
Definition: add.c:213
const char * escaped_null_test
Definition: export.c:158
const char * key_order_test
Definition: export.c:101
BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc)
Definition: add.c:21
LONG delete_tree_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:157
const char * slashes_test
Definition: export.c:151
void add_value_(const char *file, unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size)
Definition: add.c:204
void open_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam, HKEY *hkey)
Definition: add.c:84
BOOL compare_export_(const char *file, unsigned line, const char *filename, const char *expected, DWORD todo)
Definition: export.c:21
const char * embedded_null_test
Definition: export.c:139
const char * simple_data_test
Definition: export.c:69
BOOL is_elevated_process(void)
Definition: import.c:21
const char * registry_view_test
Definition: export.c:168
void verify_reg_(const char *file, unsigned line, HKEY hkey, const char *value, DWORD exp_type, const void *exp_data, DWORD exp_size, DWORD todo)
Definition: add.c:50
const char * value_order_test
Definition: export.c:107
BOOL delete_file_(const char *file, unsigned line, const char *fname)
Definition: import.c:44
BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc)
Definition: import.c:96
void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:112
const char * empty_hex_test
Definition: export.c:113
void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value)
Definition: add.c:75
const char * empty_key_test
Definition: export.c:65
void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey)
Definition: add.c:124
void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:100
void close_key_(const char *file, unsigned line, HKEY hkey)
Definition: add.c:92
struct ChNotifyTest * exp_data
Definition: shlfolder.c:4868
Definition: ftp_var.h:139
Definition: fci.c:127
Definition: parser.c:49
Definition: name.c:39
Definition: pdh_main.c:94
ACCESS_MASK REGSAM
Definition: winreg.h:69