diff --git a/src/cascadia/TerminalSettingsModel/BaseApplicationState.cpp b/src/cascadia/TerminalSettingsModel/BaseApplicationState.cpp index 3b5c02446..378043c82 100644 --- a/src/cascadia/TerminalSettingsModel/BaseApplicationState.cpp +++ b/src/cascadia/TerminalSettingsModel/BaseApplicationState.cpp @@ -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() diff --git a/src/cascadia/TerminalSettingsModel/ElevatedState.cpp b/src/cascadia/TerminalSettingsModel/ElevatedState.cpp index f7d72207e..de8136571 100644 --- a/src/cascadia/TerminalSettingsModel/ElevatedState.cpp +++ b/src/cascadia/TerminalSettingsModel/ElevatedState.cpp @@ -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(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; }