Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordnobori <da.git@softether.co.jp>2014-03-26 07:38:30 +0400
committerdnobori <da.git@softether.co.jp>2014-03-26 07:38:30 +0400
commit16d73ccb57d0ac82b5b203e0d36a89f68e8c18ef (patch)
treebc90013d2ff8e1b2b236a902ba6b770d8250c1de /src/Mayaqua
parente61fca4d9da6c141e1b2f55bd8459e315ae311b6 (diff)
v4.06-9435-beta
Diffstat (limited to 'src/Mayaqua')
-rw-r--r--src/Mayaqua/Microsoft.c41
-rw-r--r--src/Mayaqua/Microsoft.h2
2 files changed, 43 insertions, 0 deletions
diff --git a/src/Mayaqua/Microsoft.c b/src/Mayaqua/Microsoft.c
index 21c91a30..17c835bd 100644
--- a/src/Mayaqua/Microsoft.c
+++ b/src/Mayaqua/Microsoft.c
@@ -1484,6 +1484,47 @@ BUF *MsRegSubkeysToBuf(UINT root, char *keyname, bool force32bit, bool force64bi
return b;
}
+// Get the process name of the specified process ID
+bool MsGetProcessNameFromId(wchar_t *exename, UINT exename_size, UINT pid)
+{
+ LIST *o;
+ bool ret = false;
+ UINT i;
+ // Validate arguments
+ if (pid == 0)
+ {
+ return false;
+ }
+
+ o = MsGetProcessList();
+
+ for (i = 0;i < LIST_NUM(o);i++)
+ {
+ MS_PROCESS *proc = LIST_DATA(o, i);
+
+ if (proc->ProcessId == pid)
+ {
+ if (exename != NULL)
+ {
+ UniStrCpy(exename, exename_size, proc->ExeFilenameW);
+ }
+
+ ret = true;
+ break;
+ }
+ }
+
+ MsFreeProcessList(o);
+
+ return ret;
+}
+
+// Check whether the specified process ID exists
+bool MsIsProcessIdExists(UINT pid)
+{
+ return MsGetProcessNameFromId(NULL, 0, pid);
+}
+
// Check whether the process of specified EXE file name exists
bool MsIsProcessExists(char *exename)
{
diff --git a/src/Mayaqua/Microsoft.h b/src/Mayaqua/Microsoft.h
index 774bd6dd..25c3e7be 100644
--- a/src/Mayaqua/Microsoft.h
+++ b/src/Mayaqua/Microsoft.h
@@ -1002,6 +1002,8 @@ void *MsRunAsUserExInnerW(wchar_t *filename, wchar_t *arg, bool hide);
UINT MsGetCursorPosHash();
bool MsIsProcessExists(char *exename);
bool MsIsProcessExistsW(wchar_t *exename);
+bool MsGetProcessNameFromId(wchar_t *exename, UINT exename_size, UINT pid);
+bool MsIsProcessIdExists(UINT pid);
void MsGetComputerName(char *name, UINT size);
void MsGetComputerNameFull(wchar_t *name, UINT size);