https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ea1f7249289c399a15f50…
commit ea1f7249289c399a15f5053cc361737794ef38c8
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Tue Apr 27 18:40:23 2021 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Tue Apr 27 18:40:23 2021 +0300
[FC] Add Russian (ru-RU) translation
Addendum to 2db87ebd.
---
base/applications/cmdutils/fc/lang/ru-RU.rc | 66 ++++++++++++++---------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/base/applications/cmdutils/fc/lang/ru-RU.rc b/base/applications/cmdutils/fc/lang/ru-RU.rc
index b3f0698943c..64d99eabc8f 100644
--- a/base/applications/cmdutils/fc/lang/ru-RU.rc
+++ b/base/applications/cmdutils/fc/lang/ru-RU.rc
@@ -2,40 +2,40 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
STRINGTABLE
BEGIN
- IDS_USAGE "Compares two files or sets of files and displays the differences between\n\
-them\n\
+ IDS_USAGE "Сравнение двух файлов или двух наборов файлов\n\
+и вывод различий между ними\n\
\n\
FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]\n\
- [drive1:][path1]filename1 [drive2:][path2]filename2\n\
-FC /B [drive1:][path1]filename1 [drive2:][path2]filename2\n\
+ [диск1:][путь1]имя_файла1 [диск2:][путь2]имя_файла2\n\
+FC /B [диск1:][путь1]имя_файла1 [диск2:][путь2]имя_файла2\n\
\n\
- /A Displays only first and last lines for each set of differences.\n\
- /B Performs a binary comparison.\n\
- /C Disregards the case of letters.\n\
- /L Compares files as ASCII text.\n\
- /LBn Sets the maximum consecutive mismatches to the specified\n\
- number of lines (default: 100).\n\
- /N Displays the line numbers on an ASCII comparison.\n\
- /OFF[LINE] Doesn't skip files with offline attribute set.\n\
- /T Doesn't expand tabs to spaces (default: expand).\n\
- /U Compare files as UNICODE text files.\n\
- /W Compresses white space (tabs and spaces) for comparison.\n\
- /nnnn Specifies the number of consecutive lines that must match\n\
- after a mismatch (default: 2).\n\
- [drive1:][path1]filename1\n\
- Specifies the first file or set of files to compare.\n\
- [drive2:][path2]filename2\n\
- Specifies the second file or set of files to compare.\n"
- IDS_NO_DIFFERENCE "FC: no differences encountered\n"
- IDS_LONGER_THAN "FC: %ls longer than %ls\n"
- IDS_COMPARING "Comparing files %ls and %ls\n"
- IDS_OUT_OF_MEMORY "FC: Out of memory\n"
- IDS_CANNOT_READ "FC: cannot read from %ls\n"
- IDS_INVALID_SWITCH "FC: Invalid Switch\n"
- IDS_CANNOT_OPEN "FC: cannot open %ls - No such file or folder\n"
- IDS_NEEDS_FILES "FC: Insufficient number of file specifications\n"
- IDS_CANT_USE_WILDCARD "Wildcard ('*' and '?') are not supported yet\n"
- IDS_DIFFERENT "FC: File %ls and %ls are different\n"
- IDS_TOO_LARGE "FC: File %ls too large\n"
- IDS_RESYNCH_FAILED "Resynch failed. Files are too different.\n"
+ /A Вывод только первой и последней строк для каждой группы различий.\n\
+ /B Сравнение двоичных файлов.\n\
+ /C Сравнение без учёта регистра символов.\n\
+ /L Сравнение файлов в формате ASCII.\n\
+ /LBn Максимальное число несоответствий\n\
+ для заданного числа строк (по умолчанию: 100).\n\
+ /N Вывод номеров строк при сравнении текстовых файлов ASCII.\n\
+ /OFF[LINE] Не пропускать файлы с установленным атрибутом ""Автономный"".\n\
+ /T Не заменять символы табуляции пробелами (по умолчанию: заменяет).\n\
+ /U Сравнение файлов в формате UNICODE.\n\
+ /W Пропуск пробелов и символов табуляции при сравнении.\n\
+ /nnnn Число последовательных совпадающих строк, которое\n\
+ должно встретиться после группы несовпадающих (по умолчанию: 2).\n\
+ [диск1:][путь1]имя_файла1\n\
+ Указывает первый файл или набор файлов для сравнения.\n\
+ [диск2:][путь2]имя_файла2\n\
+ Указывает второй файл или набор файлов для сравнения.\n"
+ IDS_NO_DIFFERENCE "FC: различия не найдены\n"
+ IDS_LONGER_THAN "FC: %ls длиннее, чем %ls\n"
+ IDS_COMPARING "Сравнение файлов %ls и %ls\n"
+ IDS_OUT_OF_MEMORY "FC: Недостаточно памяти\n"
+ IDS_CANNOT_READ "FC: не удаётся прочитать %ls\n"
+ IDS_INVALID_SWITCH "FC: Недопустимый ключ\n"
+ IDS_CANNOT_OPEN "FC: не удаётся открыть %ls - файл либо папка не существует\n"
+ IDS_NEEDS_FILES "FC: Недостаточное количество имён файлов\n"
+ IDS_CANT_USE_WILDCARD "Подстановочные знаки ('*' и '?') пока не поддерживаются\n"
+ IDS_DIFFERENT "FC: Файлы %ls и %ls различны\n"
+ IDS_TOO_LARGE "FC: Файл %ls слишком большой\n"
+ IDS_RESYNCH_FAILED "Не удаётся синхронизировать строки. Слишком много различий между файлами.\n"
END
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=44fb528fcc0fe0ea65bbb…
commit 44fb528fcc0fe0ea65bbbe953a015f302983a65e
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Thu Mar 25 21:48:38 2021 +0100
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Tue Apr 27 12:25:03 2021 +0200
[NTOS:SE] Implement the NtImpersonateAnonymousToken system call
Implement SepImpersonateAnonymousToken private helpers, which is necessary for the complete implementation of NtImpersonateAnonymousToken function and thus finally we're able to impersonate the anonymous logon token.
---
ntoskrnl/se/token.c | 172 ++++++++++++++++++++++++++++++++++++++++++++--
sdk/include/ndk/sefuncs.h | 2 +-
2 files changed, 168 insertions(+), 6 deletions(-)
diff --git a/ntoskrnl/se/token.c b/ntoskrnl/se/token.c
index d38fe29517e..1849a16c3a7 100644
--- a/ntoskrnl/se/token.c
+++ b/ntoskrnl/se/token.c
@@ -363,6 +363,119 @@ Quit:
return STATUS_SUCCESS;
}
+/**
+ * @brief
+ * Private function that impersonates the system's anonymous logon token.
+ * The major bulk of the impersonation procedure is done here.
+ *
+ * @param[in] Thread
+ * The executive thread object that is to impersonate the client.
+ *
+ * @param[in] PreviousMode
+ * The access processor mode, indicating if the call is executed
+ * in kernel or user mode.
+ *
+ * @return
+ * Returns STATUS_SUCCESS if the impersonation has succeeded.
+ * STATUS_UNSUCCESSFUL is returned if the primary token couldn't be
+ * obtained from the current process to perform additional tasks.
+ * STATUS_ACCESS_DENIED is returned if the process' primary token is
+ * restricted, which for this matter we cannot impersonate onto a
+ * restricted process. Otherwise a failure NTSTATUS code is returned.
+ */
+static
+NTSTATUS
+SepImpersonateAnonymousToken(
+ _In_ PETHREAD Thread,
+ _In_ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status;
+ PTOKEN TokenToImpersonate, ProcessToken;
+ ULONG IncludeEveryoneValueData;
+ PAGED_CODE();
+
+ /*
+ * We must check first which kind of token
+ * shall we assign for the thread to impersonate,
+ * the one with Everyone Group SID or the other
+ * without. Invoke the registry helper to
+ * return the data value for us.
+ */
+ Status = SepRegQueryHelper(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\Lsa",
+ L"EveryoneIncludesAnonymous",
+ REG_DWORD,
+ sizeof(IncludeEveryoneValueData),
+ &IncludeEveryoneValueData);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("SepRegQueryHelper(): Failed to query the registry value (Status 0x%lx)\n", Status);
+ return Status;
+ }
+
+ if (IncludeEveryoneValueData == 0)
+ {
+ DPRINT("SepImpersonateAnonymousToken(): Assigning the token not including the Everyone Group SID...\n");
+ TokenToImpersonate = SeAnonymousLogonTokenNoEveryone;
+ }
+ else
+ {
+ DPRINT("SepImpersonateAnonymousToken(): Assigning the token including the Everyone Group SID...\n");
+ TokenToImpersonate = SeAnonymousLogonToken;
+ }
+
+ /*
+ * Tell the object manager that we're going to use this token
+ * object now by incrementing the reference count.
+ */
+ Status = ObReferenceObjectByPointer(TokenToImpersonate,
+ TOKEN_IMPERSONATE,
+ SeTokenObjectType,
+ PreviousMode);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("SepImpersonateAnonymousToken(): Couldn't be able to use the token, bail out...\n");
+ return Status;
+ }
+
+ /*
+ * Reference the primary token of the current process that the anonymous
+ * logon token impersonation procedure is being performed. We'll be going
+ * to use the process' token to figure out if the process is actually
+ * restricted or not.
+ */
+ ProcessToken = PsReferencePrimaryToken(PsGetCurrentProcess());
+ if (!ProcessToken)
+ {
+ DPRINT1("SepImpersonateAnonymousToken(): Couldn't be able to get the process' primary token, bail out...\n");
+ ObDereferenceObject(TokenToImpersonate);
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* Now, is the token from the current process restricted? */
+ if (SeTokenIsRestricted(ProcessToken))
+ {
+ DPRINT1("SepImpersonateAnonymousToken(): The process is restricted, can't do anything. Bail out...\n");
+ PsDereferencePrimaryToken(ProcessToken);
+ ObDereferenceObject(TokenToImpersonate);
+ return STATUS_ACCESS_DENIED;
+ }
+
+ /*
+ * Finally it's time to impersonate! But first, fast dereference the
+ * process' primary token as we no longer need it.
+ */
+ ObFastDereferenceObject(&PsGetCurrentProcess()->Token, ProcessToken);
+ Status = PsImpersonateClient(Thread, TokenToImpersonate, TRUE, FALSE, SecurityImpersonation);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("SepImpersonateAnonymousToken(): Failed to impersonate, bail out...\n");
+ ObDereferenceObject(TokenToImpersonate);
+ return Status;
+ }
+
+ return Status;
+}
+
static
VOID
SepUpdateSinglePrivilegeFlagToken(
@@ -4304,15 +4417,64 @@ NtFilterToken(IN HANDLE ExistingTokenHandle,
return STATUS_NOT_IMPLEMENTED;
}
-/*
- * @unimplemented
+/**
+ * @brief
+ * Allows the calling thread to impersonate the system's anonymous
+ * logon token.
+ *
+ * @param[in] ThreadHandle
+ * A handle to the thread to start the procedure of logon token
+ * impersonation. The thread must have the THREAD_IMPERSONATE
+ * access right.
+ *
+ * @return
+ * Returns STATUS_SUCCESS if the thread has successfully impersonated the
+ * anonymous logon token, otherwise a failure NTSTATUS code is returned.
+ *
+ * @remarks
+ * By default the system gives the opportunity to the caller to impersonate
+ * the anonymous logon token without including the Everyone Group SID.
+ * In cases where the caller wants to impersonate the token including such
+ * group, the EveryoneIncludesAnonymous registry value setting has to be set
+ * to 1, from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa registry
+ * path. The calling thread must invoke PsRevertToSelf when impersonation
+ * is no longer needed or RevertToSelf if the calling execution is done
+ * in user mode.
*/
NTSTATUS
NTAPI
-NtImpersonateAnonymousToken(IN HANDLE Thread)
+NtImpersonateAnonymousToken(
+ _In_ HANDLE ThreadHandle)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ PETHREAD Thread;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status;
+ PAGED_CODE();
+
+ PreviousMode = ExGetPreviousMode();
+
+ /* Obtain the thread object from the handle */
+ Status = ObReferenceObjectByHandle(ThreadHandle,
+ THREAD_IMPERSONATE,
+ PsThreadType,
+ PreviousMode,
+ (PVOID*)&Thread,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtImpersonateAnonymousToken(): Failed to reference the object (Status 0x%lx)\n", Status);
+ return Status;
+ }
+
+ /* Call the private routine to impersonate the token */
+ Status = SepImpersonateAnonymousToken(Thread, PreviousMode);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtImpersonateAnonymousToken(): Failed to impersonate the token (Status 0x%lx)\n", Status);
+ }
+
+ ObDereferenceObject(Thread);
+ return Status;
}
/* EOF */
diff --git a/sdk/include/ndk/sefuncs.h b/sdk/include/ndk/sefuncs.h
index 96164320acc..8907bbc4e51 100644
--- a/sdk/include/ndk/sefuncs.h
+++ b/sdk/include/ndk/sefuncs.h
@@ -239,7 +239,7 @@ NTSYSCALLAPI
NTSTATUS
NTAPI
NtImpersonateAnonymousToken(
- _In_ HANDLE Thread
+ _In_ HANDLE ThreadHandle
);
__kernel_entry