Merge branch 'dev/migrie/f/just-elevated-state-2' into dev/migrie/f/non-terminal-content-elevation-warning
This commit is contained in:
commit
edd71265d8
1
.github/actions/spelling/allow/allow.txt
vendored
1
.github/actions/spelling/allow/allow.txt
vendored
|
@ -1,3 +1,4 @@
|
|||
admins
|
||||
apc
|
||||
calt
|
||||
ccmp
|
||||
|
|
6
.github/actions/spelling/allow/apis.txt
vendored
6
.github/actions/spelling/allow/apis.txt
vendored
|
@ -1,5 +1,7 @@
|
|||
ACCEPTFILES
|
||||
ACCESSDENIED
|
||||
acl
|
||||
aclapi
|
||||
alignas
|
||||
alignof
|
||||
APPLYTOSUBMENUS
|
||||
|
@ -19,6 +21,7 @@ comparand
|
|||
cstdint
|
||||
CXICON
|
||||
CYICON
|
||||
Dacl
|
||||
dataobject
|
||||
dcomp
|
||||
DERR
|
||||
|
@ -112,9 +115,12 @@ OSVERSIONINFOEXW
|
|||
otms
|
||||
OUTLINETEXTMETRICW
|
||||
overridable
|
||||
PACL
|
||||
PAGESCROLL
|
||||
PEXPLICIT
|
||||
PICKFOLDERS
|
||||
pmr
|
||||
ptstr
|
||||
rcx
|
||||
REGCLS
|
||||
RETURNCMD
|
||||
|
|
|
@ -47,6 +47,8 @@ winrt::hstring BaseApplicationState::FilePath() const noexcept
|
|||
void BaseApplicationState::_read() const noexcept
|
||||
try
|
||||
{
|
||||
// Use the derived class's implementation of _readFileContents to get the
|
||||
// actual contents of the file.
|
||||
const auto data = _readFileContents().value_or(std::string{});
|
||||
if (data.empty())
|
||||
{
|
||||
|
@ -77,6 +79,9 @@ try
|
|||
|
||||
Json::StreamWriterBuilder wbuilder;
|
||||
const auto content = Json::writeString(wbuilder, root);
|
||||
|
||||
// Use the derived class's implementation of _writeFileContents to write the
|
||||
// file to disk.
|
||||
_writeFileContents(content);
|
||||
}
|
||||
CATCH_LOG()
|
||||
|
|
|
@ -3,10 +3,12 @@ Copyright (c) Microsoft Corporation
|
|||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- ApplicationState.h
|
||||
- BaseApplicationState.h
|
||||
|
||||
Abstract:
|
||||
- TODO!
|
||||
- This is the common core for both ApplicationState and ElevatedState. This
|
||||
handles more of the mechanics of serializing these structures to/from json, as
|
||||
well as the mechanics of loading the file.
|
||||
--*/
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -23,47 +23,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||
// Returns the application-global ElevatedState object.
|
||||
Microsoft::Terminal::Settings::Model::ElevatedState ElevatedState::SharedInstance()
|
||||
{
|
||||
// TODO! place in a totally different file! and path!
|
||||
static auto state = winrt::make_self<ElevatedState>(GetBaseSettingsPath() / stateFileName);
|
||||
state->Reload();
|
||||
|
||||
// const auto testPath{ GetBaseSettingsPath() / L"test.json" };
|
||||
|
||||
// PSID pEveryoneSID = NULL;
|
||||
// SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_NT_AUTHORITY;
|
||||
// BOOL success = AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_LOCAL_SYSTEM_RID, 0, 0, 0, 0, 0, 0, 0, &pEveryoneSID);
|
||||
|
||||
// EXPLICIT_ACCESS ea[1];
|
||||
// ZeroMemory(&ea, 1 * sizeof(EXPLICIT_ACCESS));
|
||||
// ea[0].grfAccessPermissions = KEY_READ;
|
||||
// ea[0].grfAccessMode = SET_ACCESS;
|
||||
// ea[0].grfInheritance = NO_INHERITANCE;
|
||||
// ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
||||
// ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
|
||||
// ea[0].Trustee.ptstrName = (LPTSTR)pEveryoneSID;
|
||||
|
||||
// ACL acl;
|
||||
// PACL pAcl = &acl;
|
||||
// DWORD dwRes = SetEntriesInAcl(1, ea, NULL, &pAcl);
|
||||
// dwRes;
|
||||
|
||||
// SECURITY_DESCRIPTOR sd;
|
||||
// success = InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
|
||||
// success = SetSecurityDescriptorDacl(&sd,
|
||||
// TRUE, // bDaclPresent flag
|
||||
// pAcl,
|
||||
// FALSE);
|
||||
|
||||
// SECURITY_ATTRIBUTES sa;
|
||||
// // Initialize a security attributes structure.
|
||||
// sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
// sa.lpSecurityDescriptor = &sd;
|
||||
// sa.bInheritHandle = FALSE;
|
||||
// success;
|
||||
|
||||
// wil::unique_hfile file{ CreateFileW(testPath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr) };
|
||||
// THROW_LAST_ERROR_IF(!file);
|
||||
|
||||
return *state;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue