Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.

This commit is contained in:
Colin Finck 2017-10-03 07:45:34 +00:00
parent b94e2d8ca0
commit c2c66aff7d
24198 changed files with 0 additions and 37285 deletions

View file

@ -0,0 +1,45 @@
// main.c :
//
#include <windows.h>
#include <stdio.h>
#include "regdump.h"
HANDLE OutputHandle;
HANDLE InputHandle;
DWORD GetInput(char* Buffer, int buflen)
{
DWORD Result;
ReadConsoleA(InputHandle, Buffer, buflen, &Result, NULL);
return Result;
}
int __cdecl main(int argc, char* argv[])
{
//AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
//return regmain(argc, argv);
return regdump(argc, argv);
}
#ifndef __GNUC__
//__declspec(dllimport) int __stdcall DllMain(void* hinstDll, unsigned long dwReason, void* reserved);
char* args[] = { "regdump.exe", "0", "ansi", "verbose"};
int __cdecl mainCRTStartup(void)
{
//DllMain(NULL, DLL_PROCESS_ATTACH, NULL);
main(1, args);
return 0;
}
#endif /*__GNUC__*/

View file

@ -0,0 +1,223 @@
/*
* ReactOS regedit
*
* regcmds.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Original Work Copyright 2002 Andriy Palamarchuk
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#ifdef WIN32_REGDBG
#else
#include <ctype.h>
#endif
#include "regproc.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
static char *usage =
"Usage:\n"
" regedit filename\n"
" regedit /E filename [regpath]\n"
" regedit /D regpath\n"
"\n"
"filename - registry file name\n"
"regpath - name of the registry key\n"
"\n"
"When is called without any switches adds contents of the specified\n"
"registry file to the registry\n"
"\n"
"Switches:\n"
" /E - exports contents of the specified registry key to the specified\n"
" file. Exports the whole registry if no key is specified.\n"
" /D - deletes specified registry key\n"
" /S - silent execution, can be used with any other switch.\n"
" The only existing mode, exists for compatibility with Windows regedit.\n"
" /V - advanced mode, can be used with any other switch.\n"
" Ignored, exists for compatibility with Windows regedit.\n"
" /L - location of system.dat file. Can be used with any other switch.\n"
" Ignored. Exists for compatibility with Windows regedit.\n"
" /R - location of user.dat file. Can be used with any other switch.\n"
" Ignored. Exists for compatibility with Windows regedit.\n"
" /? - print this help. Any other switches are ignored.\n"
" /C - create registry from. Not implemented.\n"
"\n"
"The switches are case-insensitive, can be prefixed either by '-' or '/'.\n"
"This program is command-line compatible with Microsoft Windows\n"
"regedit. The difference with Windows regedit - this application has\n"
"command-line interface only.\n";
typedef enum {
ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE, ACTION_VIEW
} REGEDIT_ACTION;
/**
* Process unknown switch.
*
* Params:
* chu - the switch character in upper-case.
* s - the command line string where s points to the switch character.
*/
void error_unknown_switch(char chu, char *s)
{
if (isalpha(chu)) {
printf("Undefined switch /%c!\n", chu);
} else {
printf("Alphabetic character is expected after '%c' "
"in switch specification\n", *(s - 1));
}
//exit(1);
}
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
{
TCHAR filename[MAX_PATH];
TCHAR reg_key_name[KEY_MAX_LEN];
switch (action) {
case ACTION_ADD:
get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) {
printf("No file name is specified\n%s", usage);
return FALSE;
//exit(1);
}
while (filename[0]) {
if (!import_registry_file(filename)) {
perror("");
printf("Can't open file \"%s\"\n", filename);
return FALSE;
//exit(1);
}
get_file_name(&s, filename, MAX_PATH);
}
break;
case ACTION_DELETE:
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
if (!reg_key_name[0]) {
printf("No registry key is specified for removal\n%s", usage);
return FALSE;
//exit(1);
}
delete_registry_key(reg_key_name);
break;
case ACTION_EXPORT:
filename[0] = '\0';
get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) {
printf("No file name is specified\n%s", usage);
return FALSE;
//exit(1);
}
if (s[0]) {
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
export_registry_key(filename, reg_key_name);
} else {
export_registry_key(filename, NULL);
}
break;
default:
printf("Unhandled action!\n");
return FALSE;
}
return TRUE;
}
BOOL ProcessCmdLine(LPSTR lpCmdLine)
{
REGEDIT_ACTION action = ACTION_UNDEF;
LPSTR s = lpCmdLine; /* command line pointer */
CHAR ch = *s; /* current character */
while (ch && ((ch == '-') || (ch == '/'))) {
char chu;
char ch2;
s++;
ch = *s;
ch2 = *(s+1);
chu = toupper(ch);
if (!ch2 || isspace(ch2)) {
if (chu == 'S' || chu == 'V') {
/* ignore these switches */
} else {
switch (chu) {
case 'D':
action = ACTION_DELETE;
break;
case 'E':
action = ACTION_EXPORT;
break;
case 'V':
action = ACTION_VIEW;
break;
case '?':
printf(usage);
return FALSE;
//exit(0);
break;
default:
error_unknown_switch(chu, s);
return FALSE;
break;
}
}
s++;
} else {
if (ch2 == ':') {
switch (chu) {
case 'L':
/* fall through */
case 'R':
s += 2;
while (*s && !isspace(*s)) {
s++;
}
break;
default:
error_unknown_switch(chu, s);
return FALSE;
break;
}
} else {
/* this is a file name, starting from '/' */
s--;
break;
}
}
/* skip spaces to the next parameter */
ch = *s;
while (ch && isspace(ch)) {
s++;
ch = *s;
}
}
if (action == ACTION_UNDEF) {
action = ACTION_ADD;
}
return PerformRegAction(action, s);
}

View file

@ -0,0 +1,166 @@
/*
* ReactOS regedit
*
* regdump.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include "regdump.h"
#ifdef UNICODE
//#define dprintf _tprintf
#define dprintf printf
#else
#define dprintf printf
#endif
void RegKeyPrint(int which);
const char* default_cmd_line1 = "/E HKLM_EXPORT.TXT HKEY_LOCAL_MACHINE";
const char* default_cmd_line2 = "TEST_IMPORT.TXT";
const char* default_cmd_line3 = "/P HKEY_LOCAL_MACHINE\\SYSTEM";
const char* default_cmd_line4 = "/P HKEY_LOCAL_MACHINE\\SOFTWARE";
const char* default_cmd_line5 = "/P HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes";
const char* default_cmd_line6 = "/E HKCR_EXPORT.TXT HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes";
const char* default_cmd_line7 = "/D HKEY_LOCAL_MACHINE\\SYSTEM";
const char* default_cmd_line8 = "/D HKEY_LOCAL_MACHINE\\SOFTWARE";
const char* default_cmd_line9 = "/D HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes";
/* Show usage */
void usage(const char* appName)
{
fprintf(stderr, "%s: Dump registry key to console\n", appName);
fprintf(stderr, "%s HKCR | HKCU | HKLM | HKU | HKCC | HKRR\n", appName);
}
void show_menu(void)
{
_tprintf(_T("\nchoose test :\n"));
_tprintf(_T(" 0 = Exit\n"));
printf(" 1 = %s\n", default_cmd_line1);
printf(" 2 = %s\n", default_cmd_line2);
printf(" 3 = %s\n", default_cmd_line3);
printf(" 4 = %s\n", default_cmd_line4);
printf(" 5 = %s\n", default_cmd_line5);
printf(" 6 = %s\n", default_cmd_line6);
printf(" 7 = %s\n", default_cmd_line7);
printf(" 8 = %s\n", default_cmd_line8);
printf(" 9 = %s\n", default_cmd_line9);
/*
_tprintf(_T(" 1 = %s\n"), default_cmd_line1);
_tprintf(_T(" 2 = %s\n"), default_cmd_line2);
_tprintf(_T(" 3 = %s\n"), default_cmd_line3);
_tprintf(_T(" 4 = %s\n"), default_cmd_line4);
_tprintf(_T(" 5 = %s\n"), default_cmd_line5);
_tprintf(_T(" 6 = %s\n"), default_cmd_line6);
_tprintf(_T(" 7 = %s\n"), default_cmd_line7);
_tprintf(_T(" 8 = %s\n"), default_cmd_line8);
_tprintf(_T(" 9 = %s\n"), default_cmd_line9);
*/
// _tprintf(_T(" A = HKEY_CLASSES_ROOT\n"));
// _tprintf(_T(" B = HKEY_CURRENT_USER\n"));
// _tprintf(_T(" C = HKEY_LOCAL_MACHINE\n"));
// _tprintf(_T(" D = HKEY_USERS\n"));
// _tprintf(_T(" E = HKEY_CURRENT_CONFIG\n"));
// _tprintf(_T(" F = REGISTRY ROOT\n"));
}
int regdump(int argc, char* argv[])
{
char Buffer[500];
if (argc > 1) {
// if (0 == _tcsstr(argv[1], _T("HKLM"))) {
if (strstr(argv[1], "help")) {
usage(argv[0]);
} else if (strstr(argv[1], "HKCR")) {
RegKeyPrint('1');
} else if (strstr(argv[1], "HKCU")) {
RegKeyPrint('2');
} else if (strstr(argv[1], "HKLM")) {
RegKeyPrint('3');
} else if (strstr(argv[1], "HKU")) {
RegKeyPrint('4');
} else if (strstr(argv[1], "HKCC")) {
RegKeyPrint('5');
} else if (strstr(argv[1], "HKRR")) {
RegKeyPrint('6');
} else {
dprintf("started with argc = %d, argv[1] = %s (unknown?)\n", argc, argv[1]);
}
return 0;
}
show_menu();
while (1) {
GetInput(Buffer, sizeof(Buffer));
switch (toupper(Buffer[0])) {
case '0':
return(0);
case '1':
strcpy(Buffer, default_cmd_line1);
goto doit;
case '2':
strcpy(Buffer, default_cmd_line2);
goto doit;
case '3':
strcpy(Buffer, default_cmd_line3);
goto doit;
case '4':
strcpy(Buffer, default_cmd_line4);
goto doit;
case '5':
strcpy(Buffer, default_cmd_line5);
goto doit;
case '6':
strcpy(Buffer, default_cmd_line6);
goto doit;
case '7':
strcpy(Buffer, default_cmd_line7);
goto doit;
case '8':
strcpy(Buffer, default_cmd_line8);
goto doit;
case '9':
strcpy(Buffer, default_cmd_line9);
goto doit;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
RegKeyPrint(toupper(Buffer[0]) - 'A' + 1);
break;
default: doit:
if (!ProcessCmdLine(Buffer)) {
dprintf("invalid input.\n");
show_menu();
} else {
dprintf("done.\n");
}
break;
}
}
return 0;
}

View file

@ -0,0 +1,44 @@
/*
* ReactOS
*
* regdump.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __REGDUMP_H__
#define __REGDUMP_H__
#ifdef __cplusplus
extern "C" {
#endif
extern HANDLE OutputHandle;
extern HANDLE InputHandle;
DWORD GetInput(char* Buffer, int buflen);
//void dprintf(char* fmt, ...);
int regdump(int argc, char* argv[]);
BOOL ProcessCmdLine(LPSTR lpCmdLine);
#ifdef __cplusplus
};
#endif
#endif // __REGDUMP_H__

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,110 @@
/*
* Copyright 1999 Sylvain St-Germain
* Copyright 2002 Andriy Palamarchuk
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/******************************************************************************
* Defines and consts
*/
#define KEY_MAX_LEN 1024
/* Return values */
#define SUCCESS 0
#define KEY_VALUE_ALREADY_SET 2
typedef void (*CommandAPI)(LPTSTR lpsLine);
void doSetValue(LPTSTR lpsLine);
void doDeleteValue(LPTSTR lpsLine);
void doCreateKey(LPTSTR lpsLine);
void doDeleteKey(LPTSTR lpsLine);
void doQueryValue(LPTSTR lpsLine);
void doRegisterDLL(LPTSTR lpsLine);
void doUnregisterDLL(LPTSTR lpsLine);
BOOL export_registry_key(TCHAR* file_name, TCHAR* reg_key_name);
BOOL import_registry_file(LPTSTR filename);
void delete_registry_key(TCHAR* reg_key_name);
void processRegLines(FILE* in, CommandAPI command);
/*
* Generic prototypes
*/
#ifdef _UNICODE
#define get_file_name get_file_nameW
#else
#define get_file_name get_file_nameA
#endif
char* getToken(char** str, const char* delims);
void get_file_nameA(CHAR** command_line, CHAR* filename, int max_filename);
void get_file_nameW(CHAR** command_line, WCHAR* filename, int max_filename);
DWORD convertHexToDWord(TCHAR* str, BYTE* buf);
DWORD convertHexCSVToHex(TCHAR* str, BYTE* buf, ULONG bufLen);
LPTSTR convertHexToHexCSV(BYTE* buf, ULONG len);
LPTSTR convertHexToDWORDStr(BYTE* buf, ULONG len);
LPTSTR getRegKeyName(LPTSTR lpLine);
HKEY getRegClass(LPTSTR lpLine);
DWORD getDataType(LPTSTR* lpValue, DWORD* parse_type);
LPTSTR getArg(LPTSTR arg);
HRESULT openKey(LPTSTR stdInput);
void closeKey(VOID);
/*
* api setValue prototypes
*/
void processSetValue(LPTSTR cmdline);
HRESULT setValue(LPTSTR val_name, LPTSTR val_data);
/*
* api queryValue prototypes
*/
void processQueryValue(LPTSTR cmdline);
#ifdef __GNUC__
#ifdef WIN32_REGDBG
//typedef UINT_PTR SIZE_T, *PSIZE_T;
//#define _MAX_PATH 260 /* max. length of full pathname */
#endif /*WIN32_REGDBG*/
#ifdef UNICODE
#define _tfopen _wfopen
#else
#define _tfopen fopen
#endif
#endif /*__GNUC__*/
LPVOID RegHeapAlloc(
HANDLE hHeap, // handle to private heap block
DWORD dwFlags, // heap allocation control
SIZE_T dwBytes // number of bytes to allocate
);
LPVOID RegHeapReAlloc(
HANDLE hHeap, // handle to heap block
DWORD dwFlags, // heap reallocation options
LPVOID lpMem, // pointer to memory to reallocate
SIZE_T dwBytes // number of bytes to reallocate
);
BOOL RegHeapFree(
HANDLE hHeap, // handle to heap
DWORD dwFlags, // heap free options
LPVOID lpMem // pointer to memory
);