Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into windivs8-dev
  • Loading branch information
errortek committed Oct 27, 2023
2 parents 95ab108 + 18db1c3 commit 27037f2
Show file tree
Hide file tree
Showing 59 changed files with 1,268 additions and 1,085 deletions.
8 changes: 5 additions & 3 deletions base/applications/regedit/regedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ static void output_writeconsole(const WCHAR *str, DWORD wlen)
#ifdef __REACTOS__
/* This is win32gui application, don't ever try writing to console.
* For the console version we have a separate reg.exe application. */
WCHAR AppStr[255];
LoadStringW(hInst, IDS_APP_TITLE, AppStr, ARRAY_SIZE(AppStr));
MessageBoxW(NULL, str, AppStr, MB_OK | MB_ICONINFORMATION);
MessageBoxW(NULL, str, NULL, MB_ICONERROR);
#else
DWORD count;

Expand Down Expand Up @@ -219,7 +217,11 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
break;
}
default:
#ifdef __REACTOS__
output_message(STRING_UNHANDLED_ACTION);
#else
error_exit(STRING_UNHANDLED_ACTION);
#endif
break;
}
}
Expand Down
42 changes: 35 additions & 7 deletions base/applications/regedit/regproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,11 +1105,23 @@ void delete_registry_key(WCHAR *reg_key_name)
if (!(key_class = parse_key_name(reg_key_name, &key_name)))
{
if (key_name) *(key_name - 1) = 0;
#ifdef __REACTOS__
output_message(STRING_INVALID_SYSTEM_KEY, reg_key_name);
return;
#else
error_exit(STRING_INVALID_SYSTEM_KEY, reg_key_name);
#endif
}

if (!key_name || !*key_name)
#ifdef __REACTOS__
{
output_message(STRING_DELETE_FAILED, reg_key_name);
return;
}
#else
error_exit(STRING_DELETE_FAILED, reg_key_name);
#endif

#ifdef __REACTOS__
SHDeleteKey(key_class, key_name);
Expand Down Expand Up @@ -1191,7 +1203,8 @@ static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode)
WCHAR *str = REGPROC_escape_string(name, len, &line_len);
WCHAR *buf = malloc((line_len + 4) * sizeof(WCHAR));
#ifdef __REACTOS__
line_len = swprintf(buf, L"\"%s\"=", str);
StringCchPrintfW(buf, line_len + 4, L"\"%s\"=", str);
line_len = wcslen(buf);
#else
line_len = swprintf(buf, line_len + 4, L"\"%s\"=", str);
#endif
Expand All @@ -1218,7 +1231,7 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
str = REGPROC_escape_string(data, len, &line_len);
*buf = malloc((line_len + 3) * sizeof(WCHAR));
#ifdef __REACTOS__
swprintf(*buf, L"\"%s\"", str);
StringCchPrintfW(*buf, line_len + 3, L"\"%s\"", str);
#else
swprintf(*buf, line_len + 3, L"\"%s\"", str);
#endif
Expand All @@ -1229,7 +1242,7 @@ static void export_dword_data(WCHAR **buf, DWORD *data)
{
*buf = malloc(15 * sizeof(WCHAR));
#ifdef __REACTOS__
swprintf(*buf, L"dword:%08x", *data);
StringCchPrintfW(*buf, 15, L"dword:%08x", *data);
#else
swprintf(*buf, 15, L"dword:%08x", *data);
#endif
Expand All @@ -1249,7 +1262,8 @@ static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode)
{
WCHAR *buf = malloc(15 * sizeof(WCHAR));
#ifdef __REACTOS__
line_len = swprintf(buf, L"hex(%x):", type);
StringCchPrintfW(buf, 15, L"hex(%x):", type);
line_len = wcslen(buf);
#else
line_len = swprintf(buf, 15, L"hex(%x):", type);
#endif
Expand Down Expand Up @@ -1280,7 +1294,8 @@ static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len,
for (i = 0, pos = 0; i < size; i++)
{
#ifdef __REACTOS__
pos += swprintf(*buf + pos, L"%02x", ((BYTE *)data)[i]);
StringCchPrintfW(*buf + pos, 3, L"%02x", ((BYTE *)data)[i]);
pos += wcslen(*buf + pos);
#else
pos += swprintf(*buf + pos, 3, L"%02x", ((BYTE *)data)[i]);
#endif
Expand Down Expand Up @@ -1346,7 +1361,7 @@ static WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name,

subkey_path = malloc((path_len + subkey_len + 2) * sizeof(WCHAR));
#ifdef __REACTOS__
swprintf(subkey_path, L"%s\\%s", path, subkey_name);
StringCchPrintfW(subkey_path, path_len + subkey_len + 2, L"%s\\%s", path, subkey_name);
#else
swprintf(subkey_path, path_len + subkey_len + 2, L"%s\\%s", path, subkey_name);
#endif
Expand All @@ -1360,7 +1375,7 @@ static void export_key_name(FILE *fp, WCHAR *name, BOOL unicode)

buf = malloc((lstrlenW(name) + 7) * sizeof(WCHAR));
#ifdef __REACTOS__
swprintf(buf, L"\r\n[%s]\r\n", name);
StringCchPrintfW(buf, lstrlenW(name) + 7, L"\r\n[%s]\r\n", name);
#else
swprintf(buf, lstrlenW(name) + 7, L"\r\n[%s]\r\n", name);
#endif
Expand Down Expand Up @@ -1457,7 +1472,12 @@ static FILE *REGPROC_open_export_file(WCHAR *file_name, BOOL unicode)
if (!file)
{
_wperror(L"regedit");
#ifdef __REACTOS__
output_message(STRING_CANNOT_OPEN_FILE, file_name);
return NULL;
#else
error_exit(STRING_CANNOT_OPEN_FILE, file_name);
#endif
}
}

Expand Down Expand Up @@ -1503,6 +1523,10 @@ static BOOL export_key(WCHAR *file_name, WCHAR *path, BOOL unicode)
return FALSE;

fp = REGPROC_open_export_file(file_name, unicode);
#ifdef __REACTOS__
if (!fp)
return TRUE; /* Error message is already displayed */
#endif
export_registry_data(fp, key, path, unicode);
export_newline(fp, unicode);
fclose(fp);
Expand All @@ -1519,6 +1543,10 @@ static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
WCHAR *class_name;

fp = REGPROC_open_export_file(file_name, unicode);
#ifdef __REACTOS__
if (!fp)
return TRUE; /* Error message is already displayed */
#endif

for (i = 0; i < ARRAY_SIZE(classes); i++)
{
Expand Down
Loading

0 comments on commit 27037f2

Please sign in to comment.