2021-03-01 04:16:45 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2021 Hugh McMaster
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __REG_TEST_H__
|
|
|
|
#define __REG_TEST_H__
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
/* Common #defines */
|
2021-03-04 11:42:49 +01:00
|
|
|
#define lok ok_(file,line)
|
2021-03-01 04:16:45 +01:00
|
|
|
#define KEY_WINE "Software\\Wine"
|
|
|
|
#define KEY_BASE KEY_WINE "\\reg_test"
|
|
|
|
#define REG_EXIT_SUCCESS 0
|
|
|
|
#define REG_EXIT_FAILURE 1
|
|
|
|
|
2021-04-14 14:47:41 +02:00
|
|
|
#define TODO_REG_TYPE (0x0001u)
|
|
|
|
#define TODO_REG_SIZE (0x0002u)
|
|
|
|
#define TODO_REG_DATA (0x0004u)
|
|
|
|
#define TODO_REG_COMPARE (0x0008u)
|
|
|
|
|
2021-03-01 04:16:53 +01:00
|
|
|
/* add.c */
|
2021-03-04 11:42:49 +01:00
|
|
|
#define run_reg_exe(c,r) run_reg_exe_(__FILE__,__LINE__,c,r)
|
|
|
|
BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc);
|
2021-03-01 04:16:45 +01:00
|
|
|
|
2021-03-04 11:42:49 +01:00
|
|
|
#define verify_reg(k,v,t,d,s,todo) verify_reg_(__FILE__,__LINE__,k,v,t,d,s,todo)
|
|
|
|
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);
|
2021-03-01 04:16:47 +01:00
|
|
|
|
2021-03-04 11:42:49 +01:00
|
|
|
#define verify_reg_nonexist(k,v) verify_reg_nonexist_(__FILE__,__LINE__,k,v)
|
|
|
|
void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value);
|
2021-03-01 04:16:45 +01:00
|
|
|
|
2021-06-16 14:43:06 +02:00
|
|
|
#define open_key(r,p,s,k) open_key_(__FILE__,__LINE__,r,p,s,k)
|
|
|
|
void open_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam, HKEY *hkey);
|
2021-03-01 04:16:47 +01:00
|
|
|
|
2021-03-04 11:42:49 +01:00
|
|
|
#define close_key(k) close_key_(__FILE__,__LINE__,k)
|
|
|
|
void close_key_(const char *file, unsigned line, HKEY hkey);
|
2021-03-01 04:16:45 +01:00
|
|
|
|
2021-06-16 14:43:07 +02:00
|
|
|
#define verify_key(r,p,s) verify_key_(__FILE__,__LINE__,r,p,s)
|
|
|
|
void verify_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
|
2021-03-01 04:16:45 +01:00
|
|
|
|
2021-06-16 14:43:08 +02:00
|
|
|
#define verify_key_nonexist(r,p,s) verify_key_nonexist_(__FILE__,__LINE__,r,p,s)
|
|
|
|
void verify_key_nonexist_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
|
2021-03-01 04:16:45 +01:00
|
|
|
|
2021-06-16 14:43:10 +02:00
|
|
|
#define add_key(r,p,s,k) add_key_(__FILE__,__LINE__,r,p,s,k)
|
|
|
|
void add_key_(const char *file, unsigned line, const HKEY root, const char *path, REGSAM sam, HKEY *hkey);
|
2021-03-01 04:16:45 +01:00
|
|
|
|
2021-06-16 14:43:05 +02:00
|
|
|
#define delete_key(r,p,s) delete_key_(__FILE__,__LINE__,r,p,s)
|
|
|
|
void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
|
2021-03-01 04:16:46 +01:00
|
|
|
|
2021-03-01 04:16:45 +01:00
|
|
|
LONG delete_tree(const HKEY key, const char *subkey);
|
|
|
|
|
2021-03-04 11:42:49 +01:00
|
|
|
#define add_value(k,n,t,d,s) add_value_(__FILE__,__LINE__,k,n,t,d,s)
|
|
|
|
void add_value_(const char *file, unsigned line, HKEY hkey, const char *name,
|
|
|
|
DWORD type, const void *data, size_t size);
|
2021-03-01 04:16:45 +01:00
|
|
|
|
2021-03-04 11:42:49 +01:00
|
|
|
#define delete_value(k,n) delete_value_(__FILE__,__LINE__,k,n)
|
2021-06-16 14:43:09 +02:00
|
|
|
void delete_value_(const char *file, unsigned line, HKEY hkey, const char *name);
|
2021-03-01 04:16:47 +01:00
|
|
|
|
2021-05-13 14:36:56 +02:00
|
|
|
/* export.c */
|
|
|
|
#define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo)
|
|
|
|
BOOL compare_export_(const char *file, unsigned line, const char *filename,
|
|
|
|
const char *expected, DWORD todo);
|
|
|
|
extern const char *empty_key_test;
|
|
|
|
extern const char *simple_data_test;
|
2021-05-14 14:58:01 +02:00
|
|
|
extern const char *complex_data_test;
|
2021-05-17 15:41:03 +02:00
|
|
|
extern const char *key_order_test;
|
|
|
|
extern const char *value_order_test;
|
2021-05-14 14:58:01 +02:00
|
|
|
extern const char *empty_hex_test;
|
|
|
|
extern const char *empty_hex_test2;
|
|
|
|
extern const char *hex_types_test;
|
2021-05-14 14:58:02 +02:00
|
|
|
extern const char *slashes_test;
|
|
|
|
extern const char *embedded_null_test;
|
|
|
|
extern const char *escaped_null_test;
|
2021-05-13 14:36:56 +02:00
|
|
|
|
2021-03-01 04:16:47 +01:00
|
|
|
/* import.c */
|
2021-06-17 15:34:03 +02:00
|
|
|
BOOL is_elevated_process(void);
|
|
|
|
|
2021-03-04 11:42:49 +01:00
|
|
|
#define test_import_str(c,r) import_reg(__FILE__,__LINE__,c,FALSE,r)
|
|
|
|
#define test_import_wstr(c,r) import_reg(__FILE__,__LINE__,c,TRUE,r)
|
|
|
|
BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc);
|
2021-03-01 04:16:47 +01:00
|
|
|
|
2021-03-01 04:16:45 +01:00
|
|
|
#endif /* __REG_TEST_H__ */
|