Modify some function names.

This commit is contained in:
BeneficialCode
2024-07-16 11:07:17 +08:00
parent d29e40e0d6
commit 70bfa048af
10 changed files with 21 additions and 21 deletions
+4 -4
View File
@@ -68,10 +68,10 @@ WinSys::ProcessPriorityClass ProcessInfoEx::GetPriorityClass() {
return _process ? _process->GetPriorityClass() : WinSys::ProcessPriorityClass::Unknown;
}
const std::wstring& ProcessInfoEx::GetCommandLine() const {
const std::wstring& ProcessInfoEx::GetCmdLine() const {
if (_commandLine.empty() && _pi->Id > 4) {
if (_process)
_commandLine = _process->GetCommandLine();
_commandLine = _process->GetCmdLine();
}
return _commandLine;
}
@@ -93,7 +93,7 @@ std::wstring ProcessInfoEx::GetCurDirectory() const {
if (!hProcess)
return L"";
auto dir = WinSys::Process::GetCurrentDirectory(hProcess);
auto dir = WinSys::Process::GetCurDirectory(hProcess);
if (hProcess)
::CloseHandle(hProcess);
return dir;
@@ -179,7 +179,7 @@ const std::wstring& ProcessInfoEx::UserName() const {
_username = L"NT AUTHORITY\\SYSTEM";
else {
if (_process)
_username = _process->GetUserName();
_username = _process->GetTokenUserName();
if (_username.empty())
_username = L"<¾Ü¾ø·ÃÎÊ>";
}
+1 -1
View File
@@ -24,7 +24,7 @@ public:
//WinSys::IoPriority GetIoPriority() const;
int GetMemoryPriority() const;
WinSys::ProcessPriorityClass GetPriorityClass();
const std::wstring& GetCommandLine() const;
const std::wstring& GetCmdLine() const;
//bool IsElevated() const;
/*uint32_t GetGdiObjects() const;
uint32_t GetUserObjects() const;
+2 -2
View File
@@ -62,7 +62,7 @@ void CProcessPropertiesDlg::InitProcess() {
imagePath = true;
SetDlgItemText(IDC_PATH, path.c_str());
}
SetDlgItemText(IDC_COMMANDLINE, m_px.GetCommandLine().c_str());
SetDlgItemText(IDC_COMMANDLINE, m_px.GetCmdLine().c_str());
text.Format(L"%d bit", m_px.GetBitness());
SetDlgItemText(IDC_PLATFORM, text);
SetDlgItemText(IDC_USERNAME, m_px.UserName().c_str());
@@ -174,7 +174,7 @@ LRESULT CProcessPropertiesDlg::OnExploreDirectory(WORD /*wNotifyCode*/, WORD wID
}
LRESULT CProcessPropertiesDlg::OnCopy(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
auto& cmd = m_px.GetCommandLine();
auto& cmd = m_px.GetCmdLine();
if (!cmd.empty()) {
ClipboardHelper::CopyText(*this, cmd.c_str());
}
+1 -1
View File
@@ -76,7 +76,7 @@ int CProcessTable::ParseTableEntry(CString& s, char& mask, int& select, std::sha
s = px.GetExecutablePath().c_str();
break;
case ProcessColumn::CmdLine:
s = px.GetCommandLine().c_str();
s = px.GetCmdLine().c_str();
if (s.GetLength() > MAX_PATH) {
select = DRAW_HILITE;
}
+1 -1
View File
@@ -11,7 +11,7 @@ const std::vector<std::shared_ptr<ThreadInfo>>& ProcessInfo::GetThreads() const
return _threads;
}
const std::wstring& WinSys::ProcessInfo::GetUserName() const {
const std::wstring& WinSys::ProcessInfo::GetTokenUserName() const {
if (_userName.empty())
return _userName;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace WinSys {
return _nativeImagePath;
}
const std::vector<std::shared_ptr<ThreadInfo>>& GetThreads() const;
const std::wstring& GetUserName() const;
const std::wstring& GetTokenUserName() const;
int BasePriority;
uint32_t Id;
+5 -5
View File
@@ -144,7 +144,7 @@ std::wstring Process::GetFullImageName() const {
return success ? std::wstring(name) : L"";
}
std::wstring Process::GetCommandLine() const {
std::wstring Process::GetCmdLine() const {
if (::IsWindows8OrGreater()) {
ULONG size = 8192;
auto buffer = std::make_unique<BYTE[]>(size);
@@ -163,7 +163,7 @@ std::wstring Process::GetCommandLine() const {
return L"";
}
std::wstring Process::GetUserName() const {
std::wstring Process::GetTokenUserName() const {
wil::unique_handle hToken;
if (!::OpenProcessToken(_handle.get(), TOKEN_QUERY, hToken.addressof()))
return L"";
@@ -304,15 +304,15 @@ HANDLE WinSys::Process::GetNextThread(HANDLE hThread, ThreadAccessMask access) {
return hNewThread;
}
std::wstring WinSys::Process::GetCurrentDirectory() const {
std::wstring WinSys::Process::GetCurDirectory() const {
wil::unique_handle h;
if (!::DuplicateHandle(::GetCurrentProcess(), _handle.get(), ::GetCurrentProcess(), h.addressof(),
PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, 0))
return L"";
return GetCurrentDirectory(h.get());
return GetCurDirectory(h.get());
}
std::wstring Process::GetCurrentDirectory(HANDLE hProcess) {
std::wstring Process::GetCurDirectory(HANDLE hProcess) {
std::wstring path;
PEB peb;
if (!GetProcessPeb(hProcess, &peb))
+4 -4
View File
@@ -94,8 +94,8 @@ namespace WinSys {
bool IsValid() const;
std::wstring GetFullImageName() const;
std::wstring GetCommandLine() const;
std::wstring GetUserName() const;
std::wstring GetCmdLine() const;
std::wstring GetTokenUserName() const;
std::wstring GetName() const;
std::wstring GetWindowTitle() const;
@@ -114,8 +114,8 @@ namespace WinSys {
int GetMemoryPriority() const;
IoPriority GetIoPriority() const;
ProcessPriorityClass GetPriorityClass() const;
std::wstring GetCurrentDirectory() const;
static std::wstring GetCurrentDirectory(HANDLE hProcess);
std::wstring GetCurDirectory() const;
static std::wstring GetCurDirectory(HANDLE hProcess);
static std::wstring GetCmdLine(HANDLE hProcess);
static std::vector<std::pair<std::wstring, std::wstring>> GetEnvironment(HANDLE hProcess);
std::vector<std::pair<std::wstring, std::wstring>> GetEnvironment() const;
+1 -1
View File
@@ -46,7 +46,7 @@ std::pair<std::wstring, Sid> Token::GetUserNameAndSid() const {
return { L"",Sid() };
}
std::wstring WinSys::Token::GetUserName() const {
std::wstring WinSys::Token::GetTokenUserName() const {
return GetUserNameAndSid().first;
}
+1 -1
View File
@@ -58,7 +58,7 @@ namespace WinSys {
bool EnablePrivilege(PCWSTR privName, bool enable);
std::pair<std::wstring, Sid> GetUserNameAndSid() const;
std::wstring GetUserName() const;
std::wstring GetTokenUserName() const;
bool IsValid() const;
operator const bool() const {