forked from rime/weasel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix WeaselSetup false positive in anti-virus programs
- Loading branch information
Showing
39 changed files
with
50,870 additions
and
364 deletions.
There are no files selected for viewing
153 changes: 77 additions & 76 deletions
153
WeaselSetup/InstallOptionsDialog.cpp → WeaselSetup/InstallOptionsDlg.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,77 @@ | ||
#include "stdafx.h" | ||
#include "InstallOptionsDialog.h" | ||
|
||
int uninstall(bool silent); | ||
|
||
InstallOptionsDialog::InstallOptionsDialog() | ||
: installed(false), hant(false), user_dir() | ||
{ | ||
} | ||
|
||
InstallOptionsDialog::~InstallOptionsDialog() | ||
{ | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) { | ||
cn_.Attach(GetDlgItem(IDC_RADIO_CN)); | ||
tw_.Attach(GetDlgItem(IDC_RADIO_TW)); | ||
remove_.Attach(GetDlgItem(IDC_REMOVE)); | ||
default_dir_.Attach(GetDlgItem(IDC_RADIO_DEFAULT_DIR)); | ||
custom_dir_.Attach(GetDlgItem(IDC_RADIO_CUSTOM_DIR)); | ||
dir_.Attach(GetDlgItem(IDC_EDIT_DIR)); | ||
|
||
CheckRadioButton(IDC_RADIO_CN, IDC_RADIO_TW, | ||
(hant? IDC_RADIO_TW : IDC_RADIO_CN)); | ||
CheckRadioButton(IDC_RADIO_DEFAULT_DIR, IDC_RADIO_CUSTOM_DIR, | ||
(user_dir.empty() ? IDC_RADIO_DEFAULT_DIR : IDC_RADIO_CUSTOM_DIR)); | ||
dir_.SetWindowTextW(user_dir.c_str()); | ||
|
||
cn_.EnableWindow(!installed); | ||
tw_.EnableWindow(!installed); | ||
remove_.EnableWindow(installed); | ||
dir_.EnableWindow(user_dir.empty() ? FALSE : TRUE); | ||
|
||
CenterWindow(); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnClose(UINT, WPARAM, LPARAM, BOOL&) { | ||
EndDialog(IDCANCEL); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnOK(WORD, WORD code, HWND, BOOL&) { | ||
hant = (IsDlgButtonChecked(IDC_RADIO_TW) == BST_CHECKED); | ||
if (IsDlgButtonChecked(IDC_RADIO_CUSTOM_DIR) == BST_CHECKED) { | ||
CStringW text; | ||
dir_.GetWindowTextW(text); | ||
user_dir = text; | ||
} | ||
else { | ||
user_dir.clear(); | ||
} | ||
EndDialog(IDOK); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnRemove(WORD, WORD code, HWND, BOOL&) { | ||
const bool non_silent = false; | ||
uninstall(non_silent); | ||
installed = false; | ||
cn_.EnableWindow(!installed); | ||
tw_.EnableWindow(!installed); | ||
remove_.EnableWindow(installed); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnUseDefaultDir(WORD, WORD code, HWND, BOOL&) { | ||
dir_.EnableWindow(FALSE); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnUseCustomDir(WORD, WORD code, HWND, BOOL&) { | ||
dir_.EnableWindow(TRUE); | ||
dir_.SetFocus(); | ||
return 0; | ||
} | ||
#include "stdafx.h" | ||
#include "InstallOptionsDlg.h" | ||
#include <atlstr.h> | ||
|
||
int uninstall(bool silent); | ||
|
||
InstallOptionsDialog::InstallOptionsDialog() | ||
: installed(false), hant(false), user_dir() | ||
{ | ||
} | ||
|
||
InstallOptionsDialog::~InstallOptionsDialog() | ||
{ | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) { | ||
cn_.Attach(GetDlgItem(IDC_RADIO_CN)); | ||
tw_.Attach(GetDlgItem(IDC_RADIO_TW)); | ||
remove_.Attach(GetDlgItem(IDC_REMOVE)); | ||
default_dir_.Attach(GetDlgItem(IDC_RADIO_DEFAULT_DIR)); | ||
custom_dir_.Attach(GetDlgItem(IDC_RADIO_CUSTOM_DIR)); | ||
dir_.Attach(GetDlgItem(IDC_EDIT_DIR)); | ||
|
||
CheckRadioButton(IDC_RADIO_CN, IDC_RADIO_TW, | ||
(hant ? IDC_RADIO_TW : IDC_RADIO_CN)); | ||
CheckRadioButton(IDC_RADIO_DEFAULT_DIR, IDC_RADIO_CUSTOM_DIR, | ||
(user_dir.empty() ? IDC_RADIO_DEFAULT_DIR : IDC_RADIO_CUSTOM_DIR)); | ||
dir_.SetWindowTextW(user_dir.c_str()); | ||
|
||
cn_.EnableWindow(!installed); | ||
tw_.EnableWindow(!installed); | ||
remove_.EnableWindow(installed); | ||
dir_.EnableWindow(user_dir.empty() ? FALSE : TRUE); | ||
|
||
CenterWindow(); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnClose(UINT, WPARAM, LPARAM, BOOL&) { | ||
EndDialog(IDCANCEL); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnOK(WORD, WORD code, HWND, BOOL&) { | ||
hant = (IsDlgButtonChecked(IDC_RADIO_TW) == BST_CHECKED); | ||
if (IsDlgButtonChecked(IDC_RADIO_CUSTOM_DIR) == BST_CHECKED) { | ||
CStringW text; | ||
dir_.GetWindowTextW(text); | ||
user_dir = text; | ||
} | ||
else { | ||
user_dir.clear(); | ||
} | ||
EndDialog(IDOK); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnRemove(WORD, WORD code, HWND, BOOL&) { | ||
const bool non_silent = false; | ||
uninstall(non_silent); | ||
installed = false; | ||
cn_.EnableWindow(!installed); | ||
tw_.EnableWindow(!installed); | ||
remove_.EnableWindow(installed); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnUseDefaultDir(WORD, WORD code, HWND, BOOL&) { | ||
dir_.EnableWindow(FALSE); | ||
return 0; | ||
} | ||
|
||
LRESULT InstallOptionsDialog::OnUseCustomDir(WORD, WORD code, HWND, BOOL&) { | ||
dir_.EnableWindow(TRUE); | ||
dir_.SetFocus(); | ||
return 0; | ||
} |
84 changes: 42 additions & 42 deletions
84
WeaselSetup/InstallOptionsDialog.h → WeaselSetup/InstallOptionsDlg.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
#pragma once | ||
|
||
#include "resource.h" | ||
|
||
class InstallOptionsDialog : public CDialogImpl<InstallOptionsDialog> | ||
{ | ||
public: | ||
enum { IDD = IDD_INSTALL_OPTIONS }; | ||
|
||
InstallOptionsDialog(); | ||
~InstallOptionsDialog(); | ||
|
||
bool installed; | ||
bool hant; | ||
std::wstring user_dir; | ||
|
||
protected: | ||
BEGIN_MSG_MAP(InstallOptionsDialog) | ||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) | ||
MESSAGE_HANDLER(WM_CLOSE, OnClose) | ||
COMMAND_ID_HANDLER(IDOK, OnOK) | ||
COMMAND_ID_HANDLER(IDC_REMOVE, OnRemove) | ||
COMMAND_ID_HANDLER(IDC_RADIO_DEFAULT_DIR, OnUseDefaultDir) | ||
COMMAND_ID_HANDLER(IDC_RADIO_CUSTOM_DIR, OnUseCustomDir) | ||
END_MSG_MAP() | ||
|
||
LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL&); | ||
LRESULT OnClose(UINT, WPARAM, LPARAM, BOOL&); | ||
LRESULT OnOK(WORD, WORD code, HWND, BOOL&); | ||
LRESULT OnRemove(WORD, WORD code, HWND, BOOL&); | ||
LRESULT OnUseDefaultDir(WORD, WORD code, HWND, BOOL&); | ||
LRESULT OnUseCustomDir(WORD, WORD code, HWND, BOOL&); | ||
|
||
void UpdateWidgets(); | ||
|
||
CButton cn_; | ||
CButton tw_; | ||
CButton remove_; | ||
CButton default_dir_; | ||
CButton custom_dir_; | ||
CEdit dir_; | ||
}; | ||
#pragma once | ||
|
||
#include "resource.h" | ||
|
||
class InstallOptionsDialog : public CDialogImpl<InstallOptionsDialog> | ||
{ | ||
public: | ||
enum { IDD = IDD_INSTALL_OPTIONS }; | ||
|
||
InstallOptionsDialog(); | ||
~InstallOptionsDialog(); | ||
|
||
bool installed; | ||
bool hant; | ||
std::wstring user_dir; | ||
|
||
protected: | ||
BEGIN_MSG_MAP(InstallOptionsDialog) | ||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) | ||
MESSAGE_HANDLER(WM_CLOSE, OnClose) | ||
COMMAND_ID_HANDLER(IDOK, OnOK) | ||
COMMAND_ID_HANDLER(IDC_REMOVE, OnRemove) | ||
COMMAND_ID_HANDLER(IDC_RADIO_DEFAULT_DIR, OnUseDefaultDir) | ||
COMMAND_ID_HANDLER(IDC_RADIO_CUSTOM_DIR, OnUseCustomDir) | ||
END_MSG_MAP() | ||
|
||
LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL&); | ||
LRESULT OnClose(UINT, WPARAM, LPARAM, BOOL&); | ||
LRESULT OnOK(WORD, WORD code, HWND, BOOL&); | ||
LRESULT OnRemove(WORD, WORD code, HWND, BOOL&); | ||
LRESULT OnUseDefaultDir(WORD, WORD code, HWND, BOOL&); | ||
LRESULT OnUseCustomDir(WORD, WORD code, HWND, BOOL&); | ||
|
||
void UpdateWidgets(); | ||
|
||
CButton cn_; | ||
CButton tw_; | ||
CButton remove_; | ||
CButton default_dir_; | ||
CButton custom_dir_; | ||
CEdit dir_; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
#pragma once | ||
|
||
#include "resource.h" | ||
// WeaselSetup.h |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.