ReactOS  0.4.15-dev-5606-gf34e425
reg.h File Reference
#include <stdlib.h>
#include <windows.h>
#include "resource.h"
Include dependency graph for reg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  reg_type_rels
 

Macros

#define MAX_SUBKEY_LEN   257
 

Functions

void output_writeconsole (const WCHAR *str, DWORD wlen)
 
void WINAPIV output_message (unsigned int id,...)
 
void WINAPIV output_string (const WCHAR *fmt,...)
 
BOOL ask_confirm (unsigned int msgid, WCHAR *reg_info)
 
HKEY path_get_rootkey (const WCHAR *path)
 
WCHARbuild_subkey_path (WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len)
 
WCHARget_long_key (HKEY root, WCHAR *path)
 
BOOL parse_registry_key (const WCHAR *key, HKEY *root, WCHAR **path)
 
BOOL is_char (const WCHAR s, const WCHAR c)
 
BOOL is_switch (const WCHAR *s, const WCHAR c)
 
int reg_add (int argc, WCHAR *argvW[])
 
int reg_copy (int argc, WCHAR *argvW[])
 
int reg_delete (int argc, WCHAR *argvW[])
 
int reg_export (int argc, WCHAR *argvW[])
 
int reg_import (int argc, WCHAR *argvW[])
 
int reg_query (int argc, WCHAR *argvW[])
 

Variables

const struct reg_type_rels type_rels [8]
 

Macro Definition Documentation

◆ MAX_SUBKEY_LEN

#define MAX_SUBKEY_LEN   257

Definition at line 26 of file reg.h.

Function Documentation

◆ ask_confirm()

BOOL ask_confirm ( unsigned int  msgid,
WCHAR reg_info 
)

Definition at line 127 of file reg.c.

128 {
129  HMODULE hmod;
130  WCHAR Ybuffer[4];
131  WCHAR Nbuffer[4];
132  WCHAR defval[32];
133  WCHAR answer[MAX_PATH];
134  WCHAR *str;
135  DWORD count;
136 
138  LoadStringW(hmod, STRING_YES, Ybuffer, ARRAY_SIZE(Ybuffer));
139  LoadStringW(hmod, STRING_NO, Nbuffer, ARRAY_SIZE(Nbuffer));
140  LoadStringW(hmod, STRING_DEFAULT_VALUE, defval, ARRAY_SIZE(defval));
141 
142  str = (reg_info && *reg_info) ? reg_info : defval;
143 
144  while (1)
145  {
146  output_message(msgid, str);
149  answer[0] = towupper(answer[0]);
150  if (answer[0] == Ybuffer[0])
151  return TRUE;
152  if (answer[0] == Nbuffer[0])
153  return FALSE;
154  }
155 }
#define STRING_NO
Definition: resource.h:29
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define FALSE
Definition: types.h:117
const WCHAR * str
#define STRING_YES
Definition: resource.h:28
#define STD_INPUT_HANDLE
Definition: winbase.h:267
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleW(IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN PCONSOLE_READCONSOLE_CONTROL pInputControl OPTIONAL)
Definition: readwrite.c:1174
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
#define STRING_DEFAULT_VALUE
Definition: resource.h:40
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
#define STRING_YESNO
Definition: resource.h:31
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define towupper(c)
Definition: wctype.h:99

Referenced by get_file_handle(), run_add(), and run_delete().

◆ build_subkey_path()

WCHAR* build_subkey_path ( WCHAR path,
DWORD  path_len,
WCHAR subkey_name,
DWORD  subkey_len 
)

Definition at line 198 of file reg.c.

199 {
200  WCHAR *subkey_path;
201 
202  subkey_path = malloc((path_len + subkey_len + 2) * sizeof(WCHAR));
203  swprintf(subkey_path, L"%s\\%s", path, subkey_name);
204 
205  return subkey_path;
206 }
#define L(x)
Definition: ntvdm.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
int _cdecl swprintf(const WCHAR *,...)
static DWORD path_len
Definition: batch.c:31
#define malloc
Definition: debug_ros.c:4

Referenced by export_registry_data(), query_all(), and query_value().

◆ get_long_key()

WCHAR* get_long_key ( HKEY  root,
WCHAR path 
)

Definition at line 208 of file reg.c.

209 {
210  int i, len;
211  WCHAR *long_key;
212 
213  for (i = 0; i < ARRAY_SIZE(root_rels); i++)
214  {
215  if (root == root_rels[i].key)
216  break;
217  }
218 
220 
221  if (!path)
222  {
223  long_key = malloc((len + 1) * sizeof(WCHAR));
224  lstrcpyW(long_key, root_rels[i].long_name);
225  return long_key;
226  }
227 
228  len += lstrlenW(path) + 1; /* add one for the concatenating backslash */
229  long_key = malloc((len + 1) * sizeof(WCHAR));
230  swprintf(long_key, L"%s\\%s", root_rels[i].long_name, path);
231  return long_key;
232 }
#define lstrlenW
Definition: compat.h:750
#define L(x)
Definition: ntvdm.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
const WCHAR * long_name
Definition: reg.c:30
int _cdecl swprintf(const WCHAR *,...)
#define lstrcpyW
Definition: compat.h:749
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ARRAY_SIZE(a)
Definition: main.h:24
#define malloc
Definition: debug_ros.c:4
static const struct @2 root_rels[]
Definition: copy.c:22

Referenced by reg_delete(), reg_export(), and reg_query().

◆ is_char()

BOOL is_char ( const WCHAR  s,
const WCHAR  c 
)

Definition at line 267 of file reg.c.

268 {
269  return (s == c || s == towupper(c));
270 }
const GLubyte * c
Definition: glext.h:8905
GLdouble s
Definition: gl.h:2039
#define towupper(c)
Definition: wctype.h:99

Referenced by is_switch(), and reg_export().

◆ is_switch()

BOOL is_switch ( const WCHAR s,
const WCHAR  c 
)

Definition at line 272 of file reg.c.

273 {
274  if (lstrlenW(s) > 2)
275  return FALSE;
276 
277  return ((s[0] == '/' || s[0] == '-') && is_char(s[1], c));
278 }
#define lstrlenW
Definition: compat.h:750
#define FALSE
Definition: types.h:117
const GLubyte * c
Definition: glext.h:8905
GLdouble s
Definition: gl.h:2039
BOOL is_char(const WCHAR s, const WCHAR c)
Definition: reg.c:267

Referenced by is_help_switch().

◆ output_message()

void WINAPIV output_message ( unsigned int  id,
  ... 
)

Definition at line 92 of file reg.c.

93 {
94  WCHAR *fmt = NULL;
95  int len;
96  va_list va_args;
97 
98  if (!(len = LoadStringW(GetModuleHandleW(NULL), id, (WCHAR *)&fmt, 0)))
99  {
100  WINE_FIXME("LoadString failed with %d\n", GetLastError());
101  return;
102  }
103 
104  len++;
105  fmt = malloc(len * sizeof(WCHAR));
106  if (!fmt) return;
107 
109 
110  va_start(va_args, id);
111  output_formatstring(fmt, va_args);
112  va_end(va_args);
113 
114  free(fmt);
115 }
#define free
Definition: debug_ros.c:5
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define va_end(ap)
Definition: acmsvcex.h:90
static void output_formatstring(const WCHAR *fmt, va_list va_args)
Definition: reg.c:76
char * va_list
Definition: acmsvcex.h:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
va_start(ap, x)
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define malloc
Definition: debug_ros.c:4
Definition: dsound.c:943
#define WINE_FIXME
Definition: debug.h:366

◆ output_string()

void WINAPIV output_string ( const WCHAR fmt,
  ... 
)

Definition at line 117 of file reg.c.

118 {
119  va_list va_args;
120 
121  va_start(va_args, fmt);
122  output_formatstring(fmt, va_args);
123  va_end(va_args);
124 }
#define va_end(ap)
Definition: acmsvcex.h:90
static void output_formatstring(const WCHAR *fmt, va_list va_args)
Definition: reg.c:76
char * va_list
Definition: acmsvcex.h:78
va_start(ap, x)
Definition: dsound.c:943

Referenced by output_value(), query_all(), query_value(), and run_query().

◆ output_writeconsole()

void output_writeconsole ( const WCHAR str,
DWORD  wlen 
)

Definition at line 53 of file reg.c.

54 {
55  DWORD count, ret;
56 
58  if (!ret)
59  {
60  DWORD len;
61  char *msgA;
62 
63  /* On Windows WriteConsoleW() fails if the output is redirected. So fall
64  * back to WriteFile(), assuming the console encoding is still the right
65  * one in that case.
66  */
68  msgA = malloc(len);
69 
70  WideCharToMultiByte(GetConsoleOutputCP(), 0, str, wlen, msgA, len, NULL, NULL);
72  free(msgA);
73  }
74 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define WideCharToMultiByte
Definition: compat.h:111
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1447
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define free
Definition: debug_ros.c:5
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
#define FALSE
Definition: types.h:117
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(VOID)
Definition: console.c:2451
const WCHAR * str
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define STD_OUTPUT_HANDLE
Definition: winbase.h:268
#define NULL
Definition: types.h:112
#define malloc
Definition: debug_ros.c:4

Referenced by get_file_handle(), and output_formatstring().

◆ parse_registry_key()

BOOL parse_registry_key ( const WCHAR key,
HKEY root,
WCHAR **  path 
)

Definition at line 234 of file reg.c.

235 {
236  WCHAR *p;
237 
238  if (!sane_path(key))
239  return FALSE;
240 
242  if (!*root)
243  {
245  return FALSE;
246  }
247 
248  *path = wcschr(key, '\\');
249 
250  if (!*path)
251  return TRUE;
252 
253  (*path)++;
254 
255  if (!**path)
256  {
258  return FALSE;
259  }
260 
261  p = *path + lstrlenW(*path) - 1;
262  if (*p == '\\') *p = 0;
263 
264  return TRUE;
265 }
#define TRUE
Definition: types.h:120
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
#define lstrlenW
Definition: compat.h:750
#define FALSE
Definition: types.h:117
#define STRING_INVALID_SYSTEM_KEY
Definition: resource.h:54
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL sane_path(const WCHAR *key)
Definition: reg.c:179
HKEY path_get_rootkey(const WCHAR *path)
Definition: reg.c:165
GLfloat GLfloat p
Definition: glext.h:8902
Definition: copy.c:22

Referenced by reg_add(), reg_copy(), reg_delete(), reg_export(), and reg_query().

◆ path_get_rootkey()

HKEY path_get_rootkey ( const WCHAR path)

Definition at line 165 of file reg.c.

166 {
167  DWORD i;
168 
169  for (i = 0; i < ARRAY_SIZE(root_rels); i++)
170  {
173  return root_rels[i].key;
174  }
175 
176  return NULL;
177 }
static BOOL path_rootname_cmp(const WCHAR *input_path, const WCHAR *rootkey_name)
Definition: reg.c:157
unsigned long DWORD
Definition: ntddk_ex.h:95
const WCHAR * short_name
Definition: reg.c:29
const WCHAR * long_name
Definition: reg.c:30
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
static const struct @2 root_rels[]
Definition: copy.c:22

Referenced by parse_key_name(), and parse_registry_key().

◆ reg_add()

int reg_add ( int  argc,
WCHAR argvW[] 
)

Definition at line 227 of file add.c.

228 {
229  HKEY root;
230  WCHAR *path, *value_name = NULL, *type = NULL, *data = NULL, separator = '\0';
231  BOOL value_empty = FALSE, force = FALSE;
232  REGSAM sam = 0;
233  int i;
234 
235  if (!parse_registry_key(argvW[2], &root, &path))
236  return 1;
237 
238  for (i = 3; i < argc; i++)
239  {
240  WCHAR *str;
241 
242  if (argvW[i][0] != '/' && argvW[i][0] != '-')
243  goto invalid;
244 
245  str = &argvW[i][1];
246 
247  if (!lstrcmpiW(str, L"ve"))
248  {
249  if (value_empty) goto invalid;
250  value_empty = TRUE;
251  continue;
252  }
253  else if (!lstrcmpiW(str, L"reg:32"))
254  {
255  if (sam & KEY_WOW64_32KEY) goto invalid;
256  sam |= KEY_WOW64_32KEY;
257  continue;
258  }
259  else if (!lstrcmpiW(str, L"reg:64"))
260  {
261  if (sam & KEY_WOW64_64KEY) goto invalid;
262  sam |= KEY_WOW64_64KEY;
263  continue;
264  }
265  else if (!str[0] || str[1])
266  goto invalid;
267 
268  switch (towlower(*str))
269  {
270  case 'v':
271  if (value_name || !(value_name = argvW[++i]))
272  goto invalid;
273  break;
274  case 't':
275  if (type || !(type = argvW[++i]))
276  goto invalid;
277  break;
278  case 'd':
279  if (data || !(data = argvW[++i]))
280  goto invalid;
281  break;
282  case 's':
283  str = argvW[++i];
284  if (separator || !str || lstrlenW(str) != 1)
285  goto invalid;
286  separator = str[0];
287  break;
288  case 'f':
289  if (force) goto invalid;
290  force = TRUE;
291  break;
292  default:
293  goto invalid;
294  }
295  }
296 
297  if (value_name && value_empty)
298  goto invalid;
299 
301  goto invalid;
302 
303  return run_add(root, path, sam, value_name, value_empty, type, separator, data, force);
304 
305 invalid:
308  return 1;
309 }
static const WCHAR invalid[]
Definition: assoc.c:39
static int argc
Definition: ServiceArgs.c:12
static const WCHAR separator[]
Definition: asmname.c:65
#define TRUE
Definition: types.h:120
GLsizei const GLchar ** path
Definition: glext.h:7234
struct _root root
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static int run_add(HKEY root, WCHAR *path, REGSAM sam, WCHAR *value_name, BOOL value_empty, WCHAR *type, WCHAR separator, WCHAR *data, BOOL force)
Definition: add.c:161
const WCHAR * str
#define STRING_FUNC_HELP
Definition: resource.h:34
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_INVALID_SYNTAX
Definition: resource.h:33
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define NULL
Definition: types.h:112
static REGSAM sam
Definition: query.c:143
#define towlower(c)
Definition: wctype.h:97
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
Definition: reg.c:234

Referenced by wmain().

◆ reg_copy()

int reg_copy ( int  argc,
WCHAR argvW[] 
)

Definition at line 193 of file copy.c.

194 {
195  struct key src, dest;
196  BOOL recurse = FALSE, force = FALSE;
197  REGSAM sam = 0;
198  int i;
199 
200  if (argc == 3)
201  goto invalid;
202 
203  if (!parse_registry_key(argvW[2], &src.root, &src.subkey))
204  return 1;
205 
206  if (!parse_registry_key(argvW[3], &dest.root, &dest.subkey))
207  return 1;
208 
209  for (i = 4; i < argc; i++)
210  {
211  WCHAR *str;
212 
213  if (argvW[i][0] != '/' && argvW[i][0] != '-')
214  goto invalid;
215 
216  str = &argvW[i][1];
217 
218  if (!lstrcmpiW(str, L"reg:32"))
219  {
220  if (sam & KEY_WOW64_32KEY) goto invalid;
221  sam |= KEY_WOW64_32KEY;
222  continue;
223  }
224  else if (!lstrcmpiW(str, L"reg:64"))
225  {
226  if (sam & KEY_WOW64_64KEY) goto invalid;
227  sam |= KEY_WOW64_64KEY;
228  continue;
229  }
230  else if (!str[0] || str[1])
231  goto invalid;
232 
233  switch (towlower(*str))
234  {
235  case 's':
236  if (recurse) goto invalid;
237  recurse = TRUE;
238  break;
239  case 'f':
240  if (force) goto invalid;
241  force = TRUE;
242  break;
243  default:
244  goto invalid;
245  }
246  }
247 
249  goto invalid;
250 
251  if (src.root == dest.root && !lstrcmpiW(src.subkey, dest.subkey))
252  {
254  return 1;
255  }
256 
257  src.path = src.subkey;
258 
259  return run_copy(&src, &dest, sam, recurse, force);
260 
261 invalid:
264  return 1;
265 }
static const WCHAR invalid[]
Definition: assoc.c:39
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
#define STRING_COPY_SRC_DEST_SAME
Definition: resource.h:67
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * str
#define STRING_FUNC_HELP
Definition: resource.h:34
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_INVALID_SYNTAX
Definition: resource.h:33
GLenum src
Definition: glext.h:6340
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ACCESS_MASK REGSAM
Definition: winreg.h:69
static REGSAM sam
Definition: query.c:143
#define towlower(c)
Definition: wctype.h:97
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
static char * dest
Definition: rtl.c:135
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
Definition: reg.c:234
static int run_copy(struct key *src, struct key *dest, REGSAM sam, BOOL recurse, BOOL force)
Definition: copy.c:80
Definition: copy.c:22

Referenced by wmain().

◆ reg_delete()

int reg_delete ( int  argc,
WCHAR argvW[] 
)

Definition at line 134 of file delete.c.

135 {
136  HKEY root;
137  WCHAR *path, *key_name, *value_name = NULL;
138  BOOL value_all = FALSE, value_empty = FALSE, force = FALSE;
139  REGSAM sam = 0;
140  int i;
141 
142  if (!parse_registry_key(argvW[2], &root, &path))
143  return 1;
144 
145  for (i = 3; i < argc; i++)
146  {
147  WCHAR *str;
148 
149  if (argvW[i][0] != '/' && argvW[i][0] != '-')
150  goto invalid;
151 
152  str = &argvW[i][1];
153 
154  if (!lstrcmpiW(str, L"va"))
155  {
156  if (value_all) goto invalid;
157  value_all = TRUE;
158  continue;
159  }
160  else if (!lstrcmpiW(str, L"ve"))
161  {
162  if (value_empty) goto invalid;
163  value_empty = TRUE;
164  continue;
165  }
166  else if (!lstrcmpiW(str, L"reg:32"))
167  {
168  if (sam & KEY_WOW64_32KEY) goto invalid;
169  sam |= KEY_WOW64_32KEY;
170  continue;
171  }
172  else if (!lstrcmpiW(str, L"reg:64"))
173  {
174  if (sam & KEY_WOW64_64KEY) goto invalid;
175  sam |= KEY_WOW64_64KEY;
176  continue;
177  }
178  else if (!str[0] || str[1])
179  goto invalid;
180 
181  switch (towlower(*str))
182  {
183  case 'v':
184  if (value_name || !(value_name = argvW[++i]))
185  goto invalid;
186  break;
187  case 'f':
188  if (force) goto invalid;
189  force = TRUE;
190  break;
191  default:
192  goto invalid;
193  }
194  }
195 
196  if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all))
197  goto invalid;
198 
200  goto invalid;
201 
203 
204  return run_delete(root, path, sam, key_name, value_name, value_empty, value_all, force);
205 
206 invalid:
209  return 1;
210 }
static const WCHAR invalid[]
Definition: assoc.c:39
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
GLsizei const GLchar ** path
Definition: glext.h:7234
struct _root root
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
static int run_delete(HKEY root, WCHAR *path, REGSAM sam, WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL value_all, BOOL force)
Definition: delete.c:38
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * str
#define STRING_FUNC_HELP
Definition: resource.h:34
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_INVALID_SYNTAX
Definition: resource.h:33
WCHAR * get_long_key(HKEY root, WCHAR *path)
Definition: reg.c:208
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define NULL
Definition: types.h:112
static REGSAM sam
Definition: query.c:143
#define towlower(c)
Definition: wctype.h:97
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
Definition: reg.c:234

Referenced by wmain().

◆ reg_export()

int reg_export ( int  argc,
WCHAR argvW[] 
)

Definition at line 347 of file export.c.

348 {
349  HKEY root, hkey;
350  WCHAR *path, *key_name;
351  BOOL overwrite_file = FALSE;
352  REGSAM sam = 0;
353  HANDLE hFile;
354  int i, ret;
355 
356  if (argc < 4) goto invalid;
357 
358  if (!parse_registry_key(argvW[2], &root, &path))
359  return 1;
360 
361  for (i = 4; i < argc; i++)
362  {
363  WCHAR *str;
364 
365  if (argvW[i][0] != '/' && argvW[i][0] != '-')
366  goto invalid;
367 
368  str = &argvW[i][1];
369 
370  if (is_char(*str, 'y') && !str[1])
371  overwrite_file = TRUE;
372  else if (!lstrcmpiW(str, L"reg:32"))
373  {
374  if (sam & KEY_WOW64_32KEY) goto invalid;
375  sam |= KEY_WOW64_32KEY;
376  continue;
377  }
378  else if (!lstrcmpiW(str, L"reg:64"))
379  {
380  if (sam & KEY_WOW64_64KEY) goto invalid;
381  sam |= KEY_WOW64_64KEY;
382  continue;
383  }
384  else
385  goto invalid;
386  }
387 
389  goto invalid;
390 
391  if (RegOpenKeyExW(root, path, 0, KEY_READ|sam, &hkey))
392  {
394  return 1;
395  }
396 
398 
399  hFile = get_file_handle(argvW[3], overwrite_file);
404 
405  RegCloseKey(hkey);
406 
407  return ret;
408 
409 invalid:
412  return 1;
413 }
static const WCHAR invalid[]
Definition: assoc.c:39
static int argc
Definition: ServiceArgs.c:12
#define CloseHandle
Definition: compat.h:739
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
GLsizei const GLchar ** path
Definition: glext.h:7234
struct _root root
static void export_newline(HANDLE hFile)
Definition: export.c:175
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * str
#define STRING_FUNC_HELP
Definition: resource.h:34
static void export_file_header(HANDLE hFile)
Definition: export.c:302
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_INVALID_SYNTAX
Definition: resource.h:33
int ret
WCHAR * get_long_key(HKEY root, WCHAR *path)
Definition: reg.c:208
_In_ HANDLE hFile
Definition: mswsock.h:90
static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path, REGSAM sam)
Definition: export.c:228
HKEY hkey
Definition: copy.c:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ACCESS_MASK REGSAM
Definition: winreg.h:69
static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file)
Definition: export.c:314
#define STRING_KEY_NONEXIST
Definition: resource.h:38
static REGSAM sam
Definition: query.c:143
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
Definition: reg.c:234
#define RegCloseKey(hKey)
Definition: registry.h:47
BOOL is_char(const WCHAR s, const WCHAR c)
Definition: reg.c:267

Referenced by wmain().

◆ reg_import()

int reg_import ( int  argc,
WCHAR argvW[] 
)

Definition at line 975 of file import.c.

976 {
977  WCHAR *filename, *pos;
978  FILE *fp;
979  BYTE s[2];
980  struct parser parser;
981 
982  if (argc > 4) goto invalid;
983 
984  parser.sam = 0;
985 
986  if (argc == 4)
987  {
988  WCHAR *str = argvW[3];
989 
990  if (*str != '/' && *str != '-')
991  goto invalid;
992 
993  str++;
994 
995  if (!lstrcmpiW(str, L"reg:32"))
997  else if (!lstrcmpiW(str, L"reg:64"))
999  else
1000  goto invalid;
1001  }
1002 
1003  filename = argvW[2];
1004 
1005  fp = _wfopen(filename, L"rb");
1006  if (!fp)
1007  {
1009  return 1;
1010  }
1011 
1012  if (fread(s, sizeof(WCHAR), 1, fp) != 1)
1013  goto error;
1014 
1015  parser.is_unicode = (s[0] == 0xff && s[1] == 0xfe);
1017 
1018  parser.file = fp;
1019  parser.two_wchars[0] = s[0];
1020  parser.two_wchars[1] = s[1];
1021  parser.reg_version = -1;
1022  parser.hkey = NULL;
1023  parser.key_name = NULL;
1025  parser.parse_type = 0;
1026  parser.data_type = 0;
1027  parser.data = NULL;
1028  parser.data_size = 0;
1030  parser.state = HEADER;
1031 
1032  pos = parser.two_wchars;
1033 
1034  /* parser main loop */
1035  while (pos)
1037 
1039  goto error;
1040 
1042  close_key(&parser);
1043 
1044  fclose(fp);
1045  return 0;
1046 
1047 error:
1048  fclose(fp);
1049  return 1;
1050 
1051 invalid:
1054  return 1;
1055 }
static const parser_state_func parser_funcs[NB_PARSER_STATES]
Definition: import.c:119
static const WCHAR invalid[]
Definition: assoc.c:39
static int argc
Definition: ServiceArgs.c:12
#define error(str)
Definition: mkdosfs.c:1605
BOOL is_unicode
Definition: import.c:84
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
#define free
Definition: debug_ros.c:5
static WCHAR * get_lineA(FILE *fp)
Definition: import.c:865
enum parser_state state
Definition: import.c:95
static WCHAR * get_lineW(FILE *fp)
Definition: import.c:923
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
const char * filename
Definition: ioapi.h:137
BOOL backslash
Definition: import.c:94
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
DWORD parse_type
Definition: import.c:90
#define L(x)
Definition: ntvdm.h:50
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
#define FALSE
Definition: types.h:117
static void close_key(struct parser *parser)
Definition: import.c:352
REGSAM sam
Definition: import.c:86
const WCHAR * str
#define STRING_FUNC_HELP
Definition: resource.h:34
short int reg_version
Definition: import.c:85
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
static WCHAR *(* get_line)(FILE *)
Definition: import.c:55
WCHAR * key_name
Definition: import.c:88
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_INVALID_SYNTAX
Definition: resource.h:33
FILE * file
Definition: import.c:82
Definition: import.c:60
#define STRING_FILE_NOT_FOUND
Definition: resource.h:8
HKEY hkey
Definition: import.c:87
GLdouble s
Definition: gl.h:2039
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
unsigned char BYTE
Definition: xxhash.c:193
WCHAR * value_name
Definition: import.c:89
#define NULL
Definition: types.h:112
void * data
Definition: import.c:92
WCHAR two_wchars[2]
Definition: import.c:83
Definition: import.c:80
DWORD data_type
Definition: import.c:91
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
DWORD data_size
Definition: import.c:93

Referenced by wmain().

◆ reg_query()

int reg_query ( int  argc,
WCHAR argvW[] 
)

Definition at line 339 of file query.c.

340 {
341  HKEY root;
343  BOOL value_empty = FALSE, recurse = FALSE;
344  int i;
345 
346  if (!parse_registry_key(argvW[2], &root, &path))
347  return 1;
348 
349  for (i = 3; i < argc; i++)
350  {
351  WCHAR *str;
352 
353  if (argvW[i][0] != '/' && argvW[i][0] != '-')
354  goto invalid;
355 
356  str = &argvW[i][1];
357 
358  if (!lstrcmpiW(str, L"ve"))
359  {
360  if (value_empty) goto invalid;
361  value_empty = TRUE;
362  continue;
363  }
364  else if (!lstrcmpiW(str, L"reg:32"))
365  {
366  if (sam & KEY_WOW64_32KEY) goto invalid;
367  sam |= KEY_WOW64_32KEY;
368  continue;
369  }
370  else if (!lstrcmpiW(str, L"reg:64"))
371  {
372  if (sam & KEY_WOW64_64KEY) goto invalid;
373  sam |= KEY_WOW64_64KEY;
374  continue;
375  }
376  else if (!str[0] || str[1])
377  goto invalid;
378 
379  switch (towlower(*str))
380  {
381  case 'v':
382  if (value_name || !(value_name = argvW[++i]))
383  goto invalid;
384  break;
385  case 's':
386  if (recurse) goto invalid;
387  recurse = TRUE;
388  break;
389  default:
390  goto invalid;
391  }
392  }
393 
394  if (value_name && value_empty)
395  goto invalid;
396 
398  goto invalid;
399 
401 
402  return run_query(root, path, key_name, value_name, value_empty, recurse);
403 
404 invalid:
407  return 1;
408 }
static const WCHAR invalid[]
Definition: assoc.c:39
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
GLsizei const GLchar ** path
Definition: glext.h:7234
struct _root root
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * str
#define STRING_FUNC_HELP
Definition: resource.h:34
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
WCHAR * key_name
Definition: import.c:88
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_INVALID_SYNTAX
Definition: resource.h:33
static int run_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL recurse)
Definition: query.c:311
WCHAR * get_long_key(HKEY root, WCHAR *path)
Definition: reg.c:208
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WCHAR * value_name
Definition: import.c:89
#define NULL
Definition: types.h:112
static REGSAM sam
Definition: query.c:143
#define towlower(c)
Definition: wctype.h:97
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
Definition: reg.c:234

Referenced by wmain().

Variable Documentation

◆ type_rels

const struct reg_type_rels type_rels[8]

Definition at line 41 of file reg.c.

Referenced by reg_type_to_wchar(), and wchar_get_type().