Skip to content

Commit 73c3194

Browse files
committed
Make reg smaller
1 parent f42b380 commit 73c3194

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

basebin/reg.exe

17 KB
Binary file not shown.

reg.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@
1515
* License along with this library; if not, write to the Free Software
1616
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
1717
*/
18-
18+
#ifndef UNICODE
19+
#define UNICODE
20+
#endif
21+
#ifndef _UNICODE
22+
#define _UNICODE
23+
#endif
1924
#include <stdarg.h>
2025
#include <stdio.h>
21-
#include <windef.h>
22-
#include <winbase.h>
23-
#include <winuser.h>
26+
#include <windows.h>
27+
#ifdef __TINYC__
28+
LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR, int*);
29+
#else
30+
#include <shlwapi.h>
31+
#endif
2432
#if defined( __MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 4
2533
typedef struct {
2634
DWORD style;
@@ -36,11 +44,15 @@ __MINGW_TYPEDEF_AW(LPCDLGTEMPLATE)
3644
WINUSERAPI int WINAPI LoadStringW (HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int cchBufferMax);
3745
#define sprintfW swprintf
3846
#else
47+
#ifdef __TINYC__
48+
#define sprintfW swprintf
49+
#else
3950
#define sprintfW _swprintf
4051
#endif
52+
#endif
4153
#include <winreg.h>
4254
#include <wincon.h>
43-
#include <shlwapi.h>
55+
4456
//#include <wine/unicode.h>
4557
//#include <wine/debug.h>
4658
#include <errno.h>
@@ -1086,7 +1098,7 @@ static enum operations get_operation(const WCHAR *str, int *op_help)
10861098
return REG_INVALID;
10871099
}
10881100

1089-
int wmain(int argc, WCHAR *argvW[])
1101+
int main(int argc, char **argv)
10901102
{
10911103
int i, op, op_help, ret;
10921104
BOOL show_op_help = FALSE;
@@ -1095,6 +1107,7 @@ int wmain(int argc, WCHAR *argvW[])
10951107
WCHAR *key_name, *path, *value_name = NULL, *type = NULL, *data = NULL, separator = '\0';
10961108
BOOL value_empty = FALSE, value_all = FALSE, recurse = FALSE, force = FALSE;
10971109
HKEY root;
1110+
wchar_t** argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
10981111

10991112
if (argc == 1)
11001113
{

reg.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ STRINGTABLE
7373
STRING_VALUEALL_FAILED, "reg: Unable to delete all registry values in '%1'. An unexpected error occurred.\n"
7474
STRING_GENERAL_FAILURE, "reg: Unable to complete the specified operation. An unexpected error occurred.\n"
7575
STRING_MATCHES_FOUND, "Search complete. Number of matches found: %1!d!\n"
76-
STRING_INVALID_SYNTAX, "reg: Invalid syntax. "
77-
STRING_INVALID_OPTION, "reg: Invalid option [%1]. "
76+
STRING_INVALID_SYNTAX, "reg: Invalid syntax.\n"
77+
STRING_INVALID_OPTION, "reg: Invalid option [%1].\n"
7878
STRING_REG_HELP, "Type ""REG /?"" for help.\n"
7979
STRING_FUNC_HELP, "Type ""REG %1 /?"" for help.\n"
8080
STRING_VALUE_NOT_SET, "(value not set)"

0 commit comments

Comments
 (0)