[ros-diffs] [reactos] 01/01: [ADVAPI32][SERVICES] Use the context handle to encrypt and decrypt service passwords
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4cae349811a5737127113c3135f9e2d3f3d5e4fb commit 4cae349811a5737127113c3135f9e2d3f3d5e4fb Author: Eric Kohl AuthorDate: Sat Jul 17 16:26:16 2021 +0200 Commit: Eric Kohl CommitDate: Sat Jul 17 16:26:16 2021 +0200 [ADVAPI32][SERVICES] Use the context handle to encrypt and decrypt service passwords --- base/system/services/config.c| 3 ++- base/system/services/rpcserver.c | 8 +--- base/system/services/services.h | 1 + dll/win32/advapi32/service/scm.c | 15 ++- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/base/system/services/config.c b/base/system/services/config.c index a4b809b76f7..db1b0dafc79 100644 --- a/base/system/services/config.c +++ b/base/system/services/config.c @@ -699,6 +699,7 @@ done: DWORD ScmDecryptPassword( +_In_ PVOID ContextHandle, _In_ PBYTE pPassword, _In_ DWORD dwPasswordSize, _Out_ PWSTR *pClearTextPassword) @@ -709,7 +710,7 @@ ScmDecryptPassword( NTSTATUS Status; /* Get the session key */ -Status = SystemFunction028(NULL, +Status = SystemFunction028(ContextHandle, SessionKey); if (!NT_SUCCESS(Status)) { diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c index 136d86b1e50..741dc1c84e1 100644 --- a/base/system/services/rpcserver.c +++ b/base/system/services/rpcserver.c @@ -4,7 +4,7 @@ * FILE:base/system/services/rpcserver.c * PURPOSE: RPC server interface for the advapi32 calls * COPYRIGHT: Copyright 2005-2006 Eric Kohl - * Copyright 2006-2007 Herv� Poussineau + * Copyright 2006-2007 Hervé Poussineau * Copyright 2007 Ged Murphy */ @@ -2208,7 +2208,8 @@ RChangeServiceConfigW( if (*(LPWSTR)lpPassword != 0) { /* Decrypt the password */ -dwError = ScmDecryptPassword(lpPassword, +dwError = ScmDecryptPassword(hService, + lpPassword, dwPwSize, &lpClearTextPassword); if (dwError != ERROR_SUCCESS) @@ -2609,7 +2610,8 @@ RCreateServiceW( if (lpPassword != NULL && *(LPWSTR)lpPassword != 0) { /* Decrypt the password */ -dwError = ScmDecryptPassword(lpPassword, +dwError = ScmDecryptPassword(hSCManager, + lpPassword, dwPwSize, &lpClearTextPassword); if (dwError != ERROR_SUCCESS) diff --git a/base/system/services/services.h b/base/system/services/services.h index 6a9dd5d3783..cbaa4a93329 100644 --- a/base/system/services/services.h +++ b/base/system/services/services.h @@ -155,6 +155,7 @@ ScmDeleteRegKey( DWORD ScmDecryptPassword( +_In_ PVOID ContextHandle, _In_ PBYTE pPassword, _In_ DWORD dwPasswordSize, _Out_ PWSTR *pDecryptedPassword); diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c index f373f311add..621e5753247 100644 --- a/dll/win32/advapi32/service/scm.c +++ b/dll/win32/advapi32/service/scm.c @@ -171,6 +171,7 @@ ScmRpcStatusToWinError(RPC_STATUS Status) static DWORD ScmEncryptPassword( +_In_ PVOID ContextHandle, _In_ PCWSTR pClearTextPassword, _Out_ PBYTE *pEncryptedPassword, _Out_ PDWORD pEncryptedPasswordSize) @@ -181,7 +182,7 @@ ScmEncryptPassword( NTSTATUS Status; /* Get the session key */ -Status = SystemFunction028(NULL, +Status = SystemFunction028(ContextHandle, SessionKey); if (!NT_SUCCESS(Status)) { @@ -417,7 +418,8 @@ ChangeServiceConfigA(SC_HANDLE hService, (int)(strlen(lpPassword) + 1)); /* Encrypt the unicode password */ -dwError = ScmEncryptPassword(lpPasswordW, +dwError = ScmEncryptPassword(hService, + lpPasswordW, &lpEncryptedPassword, &dwPasswordSize); if (dwError != ERROR_SUCCESS) @@ -517,7 +519,8 @@ ChangeServiceConfigW(SC_HANDLE hService, if (lpPassword != NULL) { -dwError = ScmEncryptPassword(lpPassword, +dwError = ScmEncryptPassword(hService, + lpPassword, &lpEncryptedPassword, &dwPasswordSize); if (dwError != ERROR_SUCCESS) @@ -742,7 +745,8 @@ CreateServiceA(SC_HANDLE hSCManager, (int)(strlen(lpPassword) + 1)); /* Encrypt the password */ -dwError = ScmEncryptPassword(lpPasswordW, +dwError = ScmEncryptPassword(hSCManager, +
[ros-diffs] [reactos] 01/01: [EVENTVWR] Add a context menu to TreeView items. (#3828)
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4bfe8f78bd359e0a2fa9e6ca4bdbd105ea2b78d commit e4bfe8f78bd359e0a2fa9e6ca4bdbd105ea2b78d Author: Jose Carlos Jesus AuthorDate: Sat Jul 17 18:26:48 2021 +0100 Commit: GitHub CommitDate: Sat Jul 17 19:26:48 2021 +0200 [EVENTVWR] Add a context menu to TreeView items. (#3828) Same as in Windows XP/2003. + Specify a default extension when opening or saving an event-log file. --- base/applications/mscutils/eventvwr/eventvwr.c| 33 --- base/applications/mscutils/eventvwr/lang/bg-BG.rc | 13 + base/applications/mscutils/eventvwr/lang/cs-CZ.rc | 13 + base/applications/mscutils/eventvwr/lang/de-DE.rc | 13 + base/applications/mscutils/eventvwr/lang/el-GR.rc | 13 + base/applications/mscutils/eventvwr/lang/en-US.rc | 13 + base/applications/mscutils/eventvwr/lang/es-ES.rc | 13 + base/applications/mscutils/eventvwr/lang/fr-FR.rc | 13 + base/applications/mscutils/eventvwr/lang/he-IL.rc | 13 + base/applications/mscutils/eventvwr/lang/it-IT.rc | 13 + base/applications/mscutils/eventvwr/lang/ja-JP.rc | 13 + base/applications/mscutils/eventvwr/lang/ko-KR.rc | 13 + base/applications/mscutils/eventvwr/lang/no-NO.rc | 13 + base/applications/mscutils/eventvwr/lang/pl-PL.rc | 13 + base/applications/mscutils/eventvwr/lang/pt-BR.rc | 13 + base/applications/mscutils/eventvwr/lang/pt-PT.rc | 13 + base/applications/mscutils/eventvwr/lang/ro-RO.rc | 13 + base/applications/mscutils/eventvwr/lang/ru-RU.rc | 13 + base/applications/mscutils/eventvwr/lang/sk-SK.rc | 13 + base/applications/mscutils/eventvwr/lang/sq-AL.rc | 13 + base/applications/mscutils/eventvwr/lang/sv-SE.rc | 13 + base/applications/mscutils/eventvwr/lang/tr-TR.rc | 13 + base/applications/mscutils/eventvwr/lang/uk-UA.rc | 13 + base/applications/mscutils/eventvwr/lang/zh-CN.rc | 13 + base/applications/mscutils/eventvwr/lang/zh-TW.rc | 13 + base/applications/mscutils/eventvwr/resource.h| 1 + 26 files changed, 343 insertions(+), 3 deletions(-) diff --git a/base/applications/mscutils/eventvwr/eventvwr.c b/base/applications/mscutils/eventvwr/eventvwr.c index 94e67095b73..fad78d4e3bc 100644 --- a/base/applications/mscutils/eventvwr/eventvwr.c +++ b/base/applications/mscutils/eventvwr/eventvwr.c @@ -3271,7 +3271,7 @@ InitInstance(HINSTANCE hInstance) sfn.lpstrFilter = szSaveFilter; sfn.lpstrInitialDir = NULL; sfn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_SHAREAWARE; -sfn.lpstrDefExt = NULL; +sfn.lpstrDefExt = L"evt"; ShowWindow(hwndMainWindow, Settings.wpPos.showCmd); UpdateWindow(hwndMainWindow); @@ -3673,11 +3673,38 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_INITMENUPOPUP: lParam = lParam; break; +#endif case WM_CONTEXTMENU: -lParam = lParam; +{ +RECT rc; +HTREEITEM hItem; +TVHITTESTINFO hInfo = {0}; + +INT xPos = GET_X_LPARAM(lParam); +INT yPos = GET_Y_LPARAM(lParam); + +GetWindowRect(hwndTreeView, &rc); +hInfo.pt.x = xPos - rc.left; +hInfo.pt.y = yPos - rc.top; + +hItem = TreeView_HitTest(hwndTreeView, &hInfo); +if (hItem) +{ +TreeView_SelectItem(hwndTreeView, hItem); + +if (TreeView_GetParent(hwndTreeView, hItem)) +{ +HMENU hCtxMenu = GetSubMenu(LoadMenuW(hInst, MAKEINTRESOURCEW(IDM_EVENTWR_CTX)), 0); + +DWORD dwCmdID = TrackPopupMenuEx(hCtxMenu, + TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD, + xPos, yPos, hWnd, NULL); +SendMessageW(hWnd, WM_COMMAND, (WPARAM)dwCmdID, (LPARAM)hwndTreeView); +} +} break; -#endif +} case WM_SETCURSOR: { diff --git a/base/applications/mscutils/eventvwr/lang/bg-BG.rc b/base/applications/mscutils/eventvwr/lang/bg-BG.rc index 3dd9bcca011..8c0f17dcb8c 100644 --- a/base/applications/mscutils/eventvwr/lang/bg-BG.rc +++ b/base/applications/mscutils/eventvwr/lang/bg-BG.rc @@ -38,6 +38,19 @@ BEGIN END END +IDM_EVENTWR_CTX MENU +BEGIN +POPUP "" +BEGIN +MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG +MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG +MENUITEM SEPARATOR +MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS +MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG +MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS +END +END + IDA_EVENTVWR ACCELERATORS BEGIN "?", IDM_ABOUT, ASCII,