minor nits
This commit is contained in:
parent
00c7647594
commit
306ad30753
|
@ -47,6 +47,8 @@ winrt::hstring BaseApplicationState::FilePath() const noexcept
|
||||||
void BaseApplicationState::_read() const noexcept
|
void BaseApplicationState::_read() const noexcept
|
||||||
try
|
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{});
|
const auto data = _readFileContents().value_or(std::string{});
|
||||||
if (data.empty())
|
if (data.empty())
|
||||||
{
|
{
|
||||||
|
@ -77,6 +79,9 @@ try
|
||||||
|
|
||||||
Json::StreamWriterBuilder wbuilder;
|
Json::StreamWriterBuilder wbuilder;
|
||||||
const auto content = Json::writeString(wbuilder, root);
|
const auto content = Json::writeString(wbuilder, root);
|
||||||
|
|
||||||
|
// Use the derived class's implementation of _writeFileContents to write the
|
||||||
|
// file to disk.
|
||||||
_writeFileContents(content);
|
_writeFileContents(content);
|
||||||
}
|
}
|
||||||
CATCH_LOG()
|
CATCH_LOG()
|
||||||
|
|
|
@ -23,47 +23,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||||
// Returns the application-global ElevatedState object.
|
// Returns the application-global ElevatedState object.
|
||||||
Microsoft::Terminal::Settings::Model::ElevatedState ElevatedState::SharedInstance()
|
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);
|
static auto state = winrt::make_self<ElevatedState>(GetBaseSettingsPath() / stateFileName);
|
||||||
state->Reload();
|
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;
|
return *state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue