update for HEAD-2003021201
[reactos.git] / apps / tests / regdump / regproc.h
1 /*
2  * Copyright 1999 Sylvain St-Germain
3  * Copyright 2002 Andriy Palamarchuk
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 /******************************************************************************
21  * Defines and consts
22  */
23 #define KEY_MAX_LEN             1024
24
25 /* Return values */
26 #define SUCCESS               0
27 #define KEY_VALUE_ALREADY_SET 2
28
29 typedef void (*CommandAPI)(LPTSTR lpsLine);
30
31 void doSetValue(LPTSTR lpsLine);
32 void doDeleteValue(LPTSTR lpsLine);
33 void doCreateKey(LPTSTR lpsLine);
34 void doDeleteKey(LPTSTR lpsLine);
35 void doQueryValue(LPTSTR lpsLine);
36 void doRegisterDLL(LPTSTR lpsLine);
37 void doUnregisterDLL(LPTSTR lpsLine);
38
39 BOOL export_registry_key(TCHAR* file_name, TCHAR* reg_key_name);
40 BOOL import_registry_file(LPTSTR filename);
41 void delete_registry_key(TCHAR* reg_key_name);
42
43 void processRegLines(FILE* in, CommandAPI command);
44
45 /*
46  * Generic prototypes
47  */
48 #ifdef _UNICODE
49 #define get_file_name get_file_nameW
50 #else
51 #define get_file_name get_file_nameA
52 #endif
53
54 char*   getToken(char** str, const char* delims);
55 void    get_file_nameA(CHAR** command_line, CHAR* filename, int max_filename);
56 void    get_file_nameW(CHAR** command_line, WCHAR* filename, int max_filename);
57 DWORD   convertHexToDWord(TCHAR* str, BYTE* buf);
58 DWORD   convertHexCSVToHex(TCHAR* str, BYTE* buf, ULONG bufLen);
59 LPTSTR  convertHexToHexCSV(BYTE* buf, ULONG len);
60 LPTSTR  convertHexToDWORDStr(BYTE* buf, ULONG len);
61 LPTSTR  getRegKeyName(LPTSTR lpLine);
62 HKEY    getRegClass(LPTSTR lpLine);
63 DWORD   getDataType(LPTSTR* lpValue, DWORD* parse_type);
64 LPTSTR  getArg(LPTSTR arg);
65 HRESULT openKey(LPTSTR stdInput);
66 void    closeKey(VOID);
67
68 /*
69  * api setValue prototypes
70  */
71 void    processSetValue(LPTSTR cmdline);
72 HRESULT setValue(LPTSTR val_name, LPTSTR val_data);
73
74 /*
75  * api queryValue prototypes
76  */
77 void    processQueryValue(LPTSTR cmdline);
78
79 #ifdef __GNUC__
80 #ifdef WIN32_REGDBG
81 //typedef UINT_PTR SIZE_T, *PSIZE_T;
82 //#define _MAX_PATH   260 /* max. length of full pathname */
83 #endif /*WIN32_REGDBG*/
84
85 #ifdef UNICODE
86 #define _tfopen     _wfopen
87 #else
88 #define _tfopen     fopen
89 #endif
90
91 #endif /*__GNUC__*/
92
93 LPVOID RegHeapAlloc(
94   HANDLE hHeap,   // handle to private heap block
95   DWORD dwFlags,  // heap allocation control
96   SIZE_T dwBytes  // number of bytes to allocate
97 );
98
99 LPVOID RegHeapReAlloc(
100   HANDLE hHeap,   // handle to heap block
101   DWORD dwFlags,  // heap reallocation options
102   LPVOID lpMem,   // pointer to memory to reallocate
103   SIZE_T dwBytes  // number of bytes to reallocate
104 );
105
106 BOOL RegHeapFree(
107   HANDLE hHeap,  // handle to heap
108   DWORD dwFlags, // heap free options
109   LPVOID lpMem   // pointer to memory
110 );