Skip to content

Commit

Permalink
Modify some function names.
Browse files Browse the repository at this point in the history
  • Loading branch information
BeneficialCode committed Jul 16, 2024
1 parent d29e40e commit 70bfa04
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions WinArk/ProcessInfoEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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"<¾Ü¾ø·ÃÎÊ>";
}
Expand Down
2 changes: 1 addition & 1 deletion WinArk/ProcessInfoEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProcessInfoEx {
//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;
Expand Down
4 changes: 2 additions & 2 deletions WinArk/ProcessPropertiesDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
}
Expand Down
2 changes: 1 addition & 1 deletion WinArk/ProcessTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion WinSysCore/ProcessInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion WinSysCore/ProcessInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions WinSysCore/Processes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"";
Expand Down Expand Up @@ -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))
Expand Down
8 changes: 4 additions & 4 deletions WinSysCore/Processes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion WinSysCore/Token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion WinSysCore/Token.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 70bfa04

Please sign in to comment.