reg: Add stub 'reg' program.
This commit is contained in:
parent
2115a90a68
commit
2087ad46a9
|
@ -566,6 +566,7 @@ programs/net/net
|
||||||
programs/notepad/notepad
|
programs/notepad/notepad
|
||||||
programs/oleview/oleview
|
programs/oleview/oleview
|
||||||
programs/progman/progman
|
programs/progman/progman
|
||||||
|
programs/reg/reg
|
||||||
programs/regedit/regedit
|
programs/regedit/regedit
|
||||||
programs/regsvr32/regsvr32
|
programs/regsvr32/regsvr32
|
||||||
programs/rpcss/irot.h
|
programs/rpcss/irot.h
|
||||||
|
|
|
@ -521,6 +521,7 @@ ALL_MAKEFILES = \
|
||||||
programs/notepad/Makefile \
|
programs/notepad/Makefile \
|
||||||
programs/oleview/Makefile \
|
programs/oleview/Makefile \
|
||||||
programs/progman/Makefile \
|
programs/progman/Makefile \
|
||||||
|
programs/reg/Makefile \
|
||||||
programs/regedit/Makefile \
|
programs/regedit/Makefile \
|
||||||
programs/regsvr32/Makefile \
|
programs/regsvr32/Makefile \
|
||||||
programs/rpcss/Makefile \
|
programs/rpcss/Makefile \
|
||||||
|
@ -939,6 +940,7 @@ programs/net/Makefile: programs/net/Makefile.in programs/Makeprog.rules
|
||||||
programs/notepad/Makefile: programs/notepad/Makefile.in programs/Makeprog.rules
|
programs/notepad/Makefile: programs/notepad/Makefile.in programs/Makeprog.rules
|
||||||
programs/oleview/Makefile: programs/oleview/Makefile.in programs/Makeprog.rules
|
programs/oleview/Makefile: programs/oleview/Makefile.in programs/Makeprog.rules
|
||||||
programs/progman/Makefile: programs/progman/Makefile.in programs/Makeprog.rules
|
programs/progman/Makefile: programs/progman/Makefile.in programs/Makeprog.rules
|
||||||
|
programs/reg/Makefile: programs/reg/Makefile.in programs/Makeprog.rules
|
||||||
programs/regedit/Makefile: programs/regedit/Makefile.in programs/Makeprog.rules
|
programs/regedit/Makefile: programs/regedit/Makefile.in programs/Makeprog.rules
|
||||||
programs/regsvr32/Makefile: programs/regsvr32/Makefile.in programs/Makeprog.rules
|
programs/regsvr32/Makefile: programs/regsvr32/Makefile.in programs/Makeprog.rules
|
||||||
programs/rpcss/Makefile: programs/rpcss/Makefile.in programs/Makeprog.rules
|
programs/rpcss/Makefile: programs/rpcss/Makefile.in programs/Makeprog.rules
|
||||||
|
|
|
@ -21904,6 +21904,8 @@ ac_config_files="$ac_config_files programs/oleview/Makefile"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files programs/progman/Makefile"
|
ac_config_files="$ac_config_files programs/progman/Makefile"
|
||||||
|
|
||||||
|
ac_config_files="$ac_config_files programs/reg/Makefile"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files programs/regedit/Makefile"
|
ac_config_files="$ac_config_files programs/regedit/Makefile"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files programs/regsvr32/Makefile"
|
ac_config_files="$ac_config_files programs/regsvr32/Makefile"
|
||||||
|
@ -22913,6 +22915,7 @@ do
|
||||||
"programs/notepad/Makefile") CONFIG_FILES="$CONFIG_FILES programs/notepad/Makefile" ;;
|
"programs/notepad/Makefile") CONFIG_FILES="$CONFIG_FILES programs/notepad/Makefile" ;;
|
||||||
"programs/oleview/Makefile") CONFIG_FILES="$CONFIG_FILES programs/oleview/Makefile" ;;
|
"programs/oleview/Makefile") CONFIG_FILES="$CONFIG_FILES programs/oleview/Makefile" ;;
|
||||||
"programs/progman/Makefile") CONFIG_FILES="$CONFIG_FILES programs/progman/Makefile" ;;
|
"programs/progman/Makefile") CONFIG_FILES="$CONFIG_FILES programs/progman/Makefile" ;;
|
||||||
|
"programs/reg/Makefile") CONFIG_FILES="$CONFIG_FILES programs/reg/Makefile" ;;
|
||||||
"programs/regedit/Makefile") CONFIG_FILES="$CONFIG_FILES programs/regedit/Makefile" ;;
|
"programs/regedit/Makefile") CONFIG_FILES="$CONFIG_FILES programs/regedit/Makefile" ;;
|
||||||
"programs/regsvr32/Makefile") CONFIG_FILES="$CONFIG_FILES programs/regsvr32/Makefile" ;;
|
"programs/regsvr32/Makefile") CONFIG_FILES="$CONFIG_FILES programs/regsvr32/Makefile" ;;
|
||||||
"programs/rpcss/Makefile") CONFIG_FILES="$CONFIG_FILES programs/rpcss/Makefile" ;;
|
"programs/rpcss/Makefile") CONFIG_FILES="$CONFIG_FILES programs/rpcss/Makefile" ;;
|
||||||
|
|
|
@ -2025,6 +2025,7 @@ AC_CONFIG_FILES([programs/net/Makefile])
|
||||||
AC_CONFIG_FILES([programs/notepad/Makefile])
|
AC_CONFIG_FILES([programs/notepad/Makefile])
|
||||||
AC_CONFIG_FILES([programs/oleview/Makefile])
|
AC_CONFIG_FILES([programs/oleview/Makefile])
|
||||||
AC_CONFIG_FILES([programs/progman/Makefile])
|
AC_CONFIG_FILES([programs/progman/Makefile])
|
||||||
|
AC_CONFIG_FILES([programs/reg/Makefile])
|
||||||
AC_CONFIG_FILES([programs/regedit/Makefile])
|
AC_CONFIG_FILES([programs/regedit/Makefile])
|
||||||
AC_CONFIG_FILES([programs/regsvr32/Makefile])
|
AC_CONFIG_FILES([programs/regsvr32/Makefile])
|
||||||
AC_CONFIG_FILES([programs/rpcss/Makefile])
|
AC_CONFIG_FILES([programs/rpcss/Makefile])
|
||||||
|
|
|
@ -21,6 +21,7 @@ SUBDIRS = \
|
||||||
notepad \
|
notepad \
|
||||||
oleview \
|
oleview \
|
||||||
progman \
|
progman \
|
||||||
|
reg \
|
||||||
regedit \
|
regedit \
|
||||||
regsvr32 \
|
regsvr32 \
|
||||||
rpcss \
|
rpcss \
|
||||||
|
@ -66,6 +67,7 @@ INSTALLSUBDIRS = \
|
||||||
notepad \
|
notepad \
|
||||||
oleview \
|
oleview \
|
||||||
progman \
|
progman \
|
||||||
|
reg \
|
||||||
regedit \
|
regedit \
|
||||||
regsvr32 \
|
regsvr32 \
|
||||||
rpcss \
|
rpcss \
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* REG.EXE - Wine-compatible reg program.
|
||||||
|
* English language support
|
||||||
|
*
|
||||||
|
* Copyright 2008 Andrew Riedi
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
{
|
||||||
|
STRING_USAGE, "The syntax of this command is:\n\nREG [ ADD | DELETE | QUERY ]\nREG command /?\n"
|
||||||
|
STRING_ADD_USAGE, "REG ADD key_name [/v value_name | /ve] [/t type] [/s separator] [/d data] [/f]\n"
|
||||||
|
STRING_DELETE_USAGE, "REG DELETE key_name [/v value_name | /ve | /va] [/f]\n"
|
||||||
|
STRING_QUERY_USAGE, "REG QUERY key_name [/v value_name | /ve] [/s]\n"
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
TOPSRCDIR = @top_srcdir@
|
||||||
|
TOPOBJDIR = ../..
|
||||||
|
SRCDIR = @srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
MODULE = reg.exe
|
||||||
|
APPMODE = -mconsole -municode
|
||||||
|
IMPORTS = advapi32 user32 kernel32
|
||||||
|
EXTRADEFS = -DUNICODE
|
||||||
|
|
||||||
|
C_SRCS = reg.c
|
||||||
|
|
||||||
|
RC_SRCS = rsrc.rc
|
||||||
|
|
||||||
|
@MAKE_PROG_RULES@
|
||||||
|
|
||||||
|
@DEPENDENCIES@ # everything below this line is overwritten by make depend
|
|
@ -0,0 +1,200 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2008 Andrew Riedi
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "reg.h"
|
||||||
|
|
||||||
|
static int reg_printfW(const WCHAR *msg, ...)
|
||||||
|
{
|
||||||
|
va_list va_args;
|
||||||
|
int wlen;
|
||||||
|
DWORD count, ret;
|
||||||
|
WCHAR msg_buffer[8192];
|
||||||
|
|
||||||
|
va_start(va_args, msg);
|
||||||
|
wvsprintf(msg_buffer, msg, va_args);
|
||||||
|
va_end(va_args);
|
||||||
|
|
||||||
|
wlen = lstrlenW(msg_buffer);
|
||||||
|
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
DWORD len;
|
||||||
|
char *msgA;
|
||||||
|
|
||||||
|
len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen,
|
||||||
|
NULL, 0, NULL, NULL);
|
||||||
|
msgA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
|
||||||
|
if (!msgA)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen, msgA, len,
|
||||||
|
NULL, NULL);
|
||||||
|
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE);
|
||||||
|
HeapFree(GetProcessHeap(), 0, msgA);
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int reg_message(int msg, ...)
|
||||||
|
{
|
||||||
|
va_list va_args;
|
||||||
|
WCHAR msg_buffer[8192];
|
||||||
|
|
||||||
|
LoadString(GetModuleHandle(NULL), msg, msg_buffer,
|
||||||
|
sizeof(msg_buffer)/sizeof(WCHAR));
|
||||||
|
va_start(va_args, msg);
|
||||||
|
reg_printfW(msg_buffer, va_args);
|
||||||
|
va_end(va_args);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
|
||||||
|
WCHAR *type, WCHAR separator, WCHAR *data, BOOL force)
|
||||||
|
{
|
||||||
|
const WCHAR stubW[] = {'S','T','U','B',' ','A','D','D',' ','-',' ','%','s',
|
||||||
|
' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0};
|
||||||
|
reg_printfW(stubW, key_name, value_name, value_empty, type, data, force);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
|
||||||
|
BOOL value_all, BOOL force)
|
||||||
|
{
|
||||||
|
const WCHAR stubW[] = {'S','T','U','B',' ','D','E','L','E','T','E',' ','-',
|
||||||
|
' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n',0};
|
||||||
|
reg_printfW(stubW, key_name, value_name, value_empty, value_all, force);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
|
||||||
|
BOOL subkey)
|
||||||
|
{
|
||||||
|
const WCHAR stubW[] = {'S','T','U','B',' ','Q','U','E','R','Y',' ','-',' ',
|
||||||
|
'%','s',' ','%','s',' ','%','d',' ','%','d','\n',0};
|
||||||
|
reg_printfW(stubW, key_name, value_name, value_empty, subkey);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wmain(int argc, WCHAR *argvW[])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
const WCHAR addW[] = {'a','d','d',0};
|
||||||
|
const WCHAR deleteW[] = {'d','e','l','e','t','e',0};
|
||||||
|
const WCHAR queryW[] = {'q','u','e','r','y',0};
|
||||||
|
const WCHAR slashDW[] = {'/','d',0};
|
||||||
|
const WCHAR slashFW[] = {'/','f',0};
|
||||||
|
const WCHAR slashSW[] = {'/','s',0};
|
||||||
|
const WCHAR slashTW[] = {'/','t',0};
|
||||||
|
const WCHAR slashVW[] = {'/','v',0};
|
||||||
|
const WCHAR slashVAW[] = {'/','v','a',0};
|
||||||
|
const WCHAR slashVEW[] = {'/','v','e',0};
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
reg_message(STRING_USAGE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lstrcmpiW(argvW[1], addW))
|
||||||
|
{
|
||||||
|
WCHAR *key_name, *value_name = NULL, *type = NULL, separator = '\0', *data = NULL;
|
||||||
|
BOOL value_empty = FALSE, force = FALSE;
|
||||||
|
|
||||||
|
if (argc < 3)
|
||||||
|
{
|
||||||
|
reg_message(STRING_ADD_USAGE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
key_name = argvW[2];
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (!lstrcmpiW(argvW[i], slashVW))
|
||||||
|
value_name = argvW[++i];
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashVEW))
|
||||||
|
value_empty = TRUE;
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashTW))
|
||||||
|
type = argvW[++i];
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashSW))
|
||||||
|
separator = argvW[++i][0];
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashDW))
|
||||||
|
data = argvW[++i];
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashFW))
|
||||||
|
force = TRUE;
|
||||||
|
}
|
||||||
|
return reg_add(key_name, value_name, value_empty, type, separator,
|
||||||
|
data, force);
|
||||||
|
}
|
||||||
|
else if (!lstrcmpiW(argvW[1], deleteW))
|
||||||
|
{
|
||||||
|
WCHAR *key_name, *value_name = NULL;
|
||||||
|
BOOL value_empty = FALSE, value_all = FALSE, force = FALSE;
|
||||||
|
|
||||||
|
if (argc < 3)
|
||||||
|
{
|
||||||
|
reg_message(STRING_DELETE_USAGE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
key_name = argvW[2];
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (!lstrcmpiW(argvW[i], slashVW))
|
||||||
|
value_name = argvW[++i];
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashVEW))
|
||||||
|
value_empty = TRUE;
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashVAW))
|
||||||
|
value_all = TRUE;
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashFW))
|
||||||
|
force = TRUE;
|
||||||
|
}
|
||||||
|
return reg_delete(key_name, value_name, value_empty, value_all, force);
|
||||||
|
}
|
||||||
|
else if (!lstrcmpiW(argvW[1], queryW))
|
||||||
|
{
|
||||||
|
WCHAR *key_name, *value_name = NULL;
|
||||||
|
BOOL value_empty = FALSE, subkey = FALSE;
|
||||||
|
|
||||||
|
if (argc < 3)
|
||||||
|
{
|
||||||
|
reg_message(STRING_QUERY_USAGE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
key_name = argvW[2];
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (!lstrcmpiW(argvW[i], slashVW))
|
||||||
|
value_name = argvW[++i];
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashVEW))
|
||||||
|
value_empty = TRUE;
|
||||||
|
else if (!lstrcmpiW(argvW[i], slashSW))
|
||||||
|
subkey = TRUE;
|
||||||
|
}
|
||||||
|
return reg_query(key_name, value_name, value_empty, subkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* REG.EXE - Wine-compatible reg program.
|
||||||
|
*
|
||||||
|
* Copyright 2008 Andrew Riedi
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Translation IDs. */
|
||||||
|
#define STRING_USAGE 101
|
||||||
|
#define STRING_ADD_USAGE 102
|
||||||
|
#define STRING_DELETE_USAGE 103
|
||||||
|
#define STRING_QUERY_USAGE 104
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2008 Andrew Riedi
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windef.h>
|
||||||
|
|
||||||
|
#include <reg.h>
|
||||||
|
|
||||||
|
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
|
#include "En.rc"
|
Loading…
Reference in New Issue