ReactOS  0.4.15-dev-5649-gd5999c6
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)
40 BOOL 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)
43 void 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)
47 void 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)
50 void 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)
53 void close_key_(const char *file, unsigned line, HKEY hkey);
54 
55 #define verify_key(r,p,s) verify_key_(__FILE__,__LINE__,r,p,s)
56 void 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)
59 void 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)
62 void 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)
65 void 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)
68 LONG 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)
71 void 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)
75 void 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)
79 BOOL compare_export_(const char *file, unsigned line, const char *filename,
80  const char *expected, DWORD todo);
81 extern const char *empty_key_test;
82 extern const char *simple_data_test;
83 extern const char *complex_data_test;
84 extern const char *key_order_test;
85 extern const char *value_order_test;
86 extern const char *empty_hex_test;
87 extern const char *empty_hex_test2;
88 extern const char *hex_types_test;
89 extern const char *slashes_test;
90 extern const char *embedded_null_test;
91 extern const char *escaped_null_test;
92 extern const char *registry_view_test;
93 
94 /* import.c */
96 
97 #define delete_file(f) delete_file_(__FILE__,__LINE__,f)
98 BOOL 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)
102 BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc);
103 
104 #endif /* __REG_TEST_H__ */
const char * simple_data_test
Definition: export.c:69
Definition: pdh_main.c:93
const char * escaped_null_test
Definition: export.c:158
Definition: ftp_var.h:139
const char * complex_data_test
Definition: export.c:75
void close_key_(const char *file, unsigned line, HKEY hkey)
Definition: add.c:92
BOOL todo
Definition: filedlg.c:313
BOOL is_elevated_process(void)
Definition: import.c:21
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
const char * filename
Definition: ioapi.h:137
BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc)
Definition: import.c:96
const char * hex_types_test
Definition: export.c:132
void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey)
Definition: add.c:124
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value)
Definition: add.c:75
struct ChNotifyTest * exp_data
Definition: shlfolder.c:4868
const char * registry_view_test
Definition: export.c:168
Definition: parser.c:48
const char * empty_hex_test2
Definition: export.c:125
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
BOOL compare_export_(const char *file, unsigned line, const char *filename, const char *expected, DWORD todo)
Definition: export.c:21
const char * empty_key_test
Definition: export.c:65
GLsizeiptr size
Definition: glext.h:5919
BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc)
Definition: add.c:21
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const char * slashes_test
Definition: export.c:151
void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name)
Definition: add.c:213
void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:100
const char * key_order_test
Definition: export.c:101
LONG delete_tree_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:157
const char * value_order_test
Definition: export.c:107
ACCESS_MASK REGSAM
Definition: winreg.h:69
const char * empty_hex_test
Definition: export.c:113
Definition: name.c:38
const char * embedded_null_test
Definition: export.c:139
static REGSAM sam
Definition: query.c:143
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL delete_file_(const char *file, unsigned line, const char *fname)
Definition: import.c:44
void open_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam, HKEY *hkey)
Definition: add.c:84
void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:139
BOOL expected
Definition: store.c:2063
void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
Definition: add.c:112
Definition: fci.c:126