Skip to content

Commit

Permalink
Reverts feature 'Save As...' (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hsilgos authored Feb 20, 2021
1 parent 2d9aa3f commit dd5bf2e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
9 changes: 0 additions & 9 deletions NppSaveAsAdminLib/plugin/SaveAsAdminImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ class SaveAsAdminImpl::Impl {
m_close_handle = inject_in_module(
"Kernel32.dll", CloseHandle,
make_injection_callback(*this, &Impl::close_handle_hook));
m_get_save_file_name_w = inject_in_module(
"Comdlg32.dll", GetSaveFileNameW,
make_injection_callback(*this, &Impl::get_save_file_name_hook));
}

void allow_process_file() { m_is_process_allowed = true; }
Expand Down Expand Up @@ -102,11 +99,6 @@ class SaveAsAdminImpl::Impl {
return result;
}

BOOL get_save_file_name_hook(LPOPENFILENAMEW ofn) {
ofn->Flags |= OFN_NOTESTFILECREATE;
return m_get_save_file_name_w->call_original(ofn);
}

BOOL close_handle_hook(HANDLE handle) {
HandleMap::iterator it = m_file_handles.find(handle);
if (it != m_file_handles.end()) {
Expand Down Expand Up @@ -149,7 +141,6 @@ class SaveAsAdminImpl::Impl {
injection_ptr_type(CreateFileW) m_create_filew;
injection_ptr_type(GetFileType) m_get_file_type;
injection_ptr_type(CloseHandle) m_close_handle;
injection_ptr_type(GetSaveFileNameW) m_get_save_file_name_w;
};

namespace {
Expand Down
8 changes: 0 additions & 8 deletions UnitTests/TestSaveAsAdminImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,8 @@ struct SaveAsAdminImplFixture : public ::testing::Test {
MockAdminAccessRunner mock_admin_access_runner;
SaveAsAdminImpl save_as_admin_impl;

void ensure_that_comdlg32_dll_is_imported() {
std::ifstream file("none_existing.file");
if (file) {
GetSaveFileNameW(NULL);
}
}

SaveAsAdminImplFixture()
: execution_thread(false), save_as_admin_impl(mock_admin_access_runner) {
ensure_that_comdlg32_dll_is_imported();
ON_CALL(mock_winapi_rename, create_file_a(_, _, _, _, _, _, _))
.WillByDefault(
Invoke(this, &SaveAsAdminImplFixture::create_file_a_rename));
Expand Down

0 comments on commit dd5bf2e

Please sign in to comment.