Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
20th June 2019, 21:43 | #41 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
I don't think so. I'll look into it.
Edit: From this page: Quote:
__________________
Groucho's Avisynth Stuff Last edited by Groucho2004; 20th June 2019 at 21:49. |
|
20th June 2019, 22:03 | #42 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
__________________
Groucho's Avisynth Stuff |
|
20th June 2019, 22:08 | #43 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Thanks G2K4,
I take it that all three SSE, SSE2 and SSE3 are integer SSE, and so maybe in AVS ISSE is just shorthand for the lot. Just thought that additional nicety might be the current or Parent process name, in RT_stats we have RT_GetProcessName(), might be handy in your plug too. I have used to make small changes when using eg MPC-HC (where eg enable output of float audio), and some other reason connected with Vdub current process, cant offhand remember what that was. Code:
RT_GetProcessName(bool "parent"=false,bool "debug"=false) Returns string, name of current process eg "VirtualDubMod.exe" or "AvsPMod.exe" or name of parent process (the one that started our process eg "Explorer.exe"). Debug outputs some info to DebugView. Code:
/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "RT_Stats.h" #define DPRINTFNAME "RT_GetProcessName: " AVSValue __cdecl RT_GetProcessName(AVSValue args, void*, IScriptEnvironment* env) { bool parent= args[0].AsBool(false); bool debug = args[1].AsBool(false); // DWORD WINAPI GetCurrentProcessId(void); // Return value: The return value is the process identifier of the calling process. // Minimum supported client:- Windows XP WinBase.h (Processthreadsapi.h W8 Server 2012) // ssS, Rubbish, also works fine on W2K DWORD PID = GetCurrentProcessId(); // Cannot fail (I think) as current process is obviously running. // HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags,DWORD th32ProcessID); // // // The th32ProcessID argument is only used if TH32CS_SNAPHEAPLIST or // TH32CS_SNAPMODULE is specified. th32ProcessID == 0 means the current // process. // // NOTE that all of the snapshots are global except for the heap and module // lists which are process specific. To enumerate the heap or module // state for all WIN32 processes call with TH32CS_SNAPALL and the // current process. Then for each process in the TH32CS_SNAPPROCESS // list that isn't the current process, do a call with just // TH32CS_SNAPHEAPLIST and/or TH32CS_SNAPMODULE. // // dwFlags // // #define TH32CS_SNAPHEAPLIST 0x00000001 // #define TH32CS_SNAPPROCESS 0x00000002 // #define TH32CS_SNAPTHREAD 0x00000004 // #define TH32CS_SNAPMODULE 0x00000008 // #define TH32CS_SNAPMODULE32 0x00000010 // #define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE) // #define TH32CS_INHERIT 0x80000000 // HANDLE hProcessSnap = NULL; // Take a snapshot of all processes in the system. hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // Returns an open handle to the specified snapshot if successful or INVALID_HANDLE_VALUE otherwise. // The snapshot taken by this function is examined by the other tool help functions to provide their results. // Access to the snapshot is read only. The snapshot handle acts like an object handle and is subject to the same // rules regarding which processes and threads it is valid in. // To retrieve an extended error status code generated by this function, use the GetLastError function. // To destroy the snapshot, use the CloseHandle function. if (hProcessSnap == INVALID_HANDLE_VALUE) return -1; // Describes an entry from a list that enumerates the processes residing in the system address space when a snapshot was taken. // // typedef struct tagPROCESSENTRY32 { // DWORD dwSize; // DWORD cntUsage; // DWORD th32ProcessID; // ULONG_PTR th32DefaultHeapID; // DWORD th32ModuleID; // DWORD cntThreads; // DWORD th32ParentProcessID; // LONG pcPriClassBase; // DWORD dwFlags; // TCHAR szExeFile[MAX_PATH]; // } PROCESSENTRY32; // typedef PROCESSENTRY32 *PPROCESSENTRY32; // // Members // // dwSize // Specifies the length, in bytes, of the structure. Before calling the Process32First function, set this member to // sizeof(PROCESSENTRY32). If you do not initialize dwSize, Process32First will fail. // cntUsage // Number of references to the process. A process exists as long as its usage count is nonzero. As soon as its usage // count becomes zero, a process terminates. // th32ProcessID // Identifier of the process. // th32DefaultHeapID // Identifier of the default heap for the process. The contents of this member has meaning only to the tool help // functions. It is not a handle, nor is it usable by functions other than the ToolHelp functions. // th32ModuleID // Module identifier of the process. The contents of this member has meaning only to the tool help functions // It is not a handle, nor is it usable by functions other than the ToolHelp functions. // cntThreads // Number of execution threads started by the process. // th32ParentProcessID // Identifier of the process that created the process being examined. // pcPriClassBase // Base priority of any threads created by this process. // dwFlags // Reserved; do not use. // szExeFile // Path and filename of the executable file for the process. // // Requirements:- Windows NT/2000/XP: Included in Windows 2000 and later. ::: Tlhelp32.h. PROCESSENTRY32 pe32 = {0}; // Fill in the size of the structure before using it. pe32.dwSize = sizeof(PROCESSENTRY32); // Walk the snapshot of the processes, and for each process, // BOOL WINAPI Process32First(HANDLE hSnapshot,LPPROCESSENTRY32 lppe); if (!Process32First(hProcessSnap, &pe32)) { CloseHandle (hProcessSnap); return -2; // Cant find first process } AVSValue ret = -3; // Init to cant find my own PID do { if(pe32.th32ProcessID == PID) { if(debug) { dprintf(DPRINTFNAME"ExeFile = %s\n",pe32.szExeFile); dprintf(DPRINTFNAME"ProcessID = 0x%08X\n",pe32.th32ProcessID); dprintf(DPRINTFNAME"Threads = %d\n",pe32.cntThreads); dprintf(DPRINTFNAME"ParentProc = 0x%08X\n",pe32.th32ParentProcessID); } if(parent==false) { ret = env->SaveString(pe32.szExeFile); } else { ret = -4; // Init Cant find parent DWORD PARPID = pe32.th32ParentProcessID; if (Process32First(hProcessSnap, &pe32)) { do { if(pe32.th32ProcessID == PARPID) { if(debug) { dprintf(DPRINTFNAME"ExeFile = %s\n",pe32.szExeFile); dprintf(DPRINTFNAME"ProcessID = 0x%08X\n",pe32.th32ProcessID); dprintf(DPRINTFNAME"Threads = %d\n",pe32.cntThreads); dprintf(DPRINTFNAME"ParentProc = 0x%08X\n",pe32.th32ParentProcessID); } ret = env->SaveString(pe32.szExeFile); break; } } while (Process32Next(hProcessSnap, &pe32)); } } break; // DONE } } while (Process32Next(hProcessSnap, &pe32)); CloseHandle (hProcessSnap); // Cleanup process snapshot return (ret); } EDIT: Quote:
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 20th June 2019 at 22:20. |
|
20th June 2019, 22:12 | #44 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Yep, sounds like a good idea, thanks for the code snippet.
__________________
Groucho's Avisynth Stuff |
20th June 2019, 22:14 | #45 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
I do like "Fred()".
__________________
Groucho's Avisynth Stuff |
|
20th June 2019, 22:23 | #46 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
On Qwerty Keyboard, all 4 keys are adjacent, so easy to type for us lazy coders [Fred].
Note also the comment below code on lots of '32' snippits in code block, maybe not work on x64. EDIT: Off to pub for last orders.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
20th June 2019, 22:24 | #47 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
I wrote a ProcessInfo() class for AVSMeter so there should not be any problems with 64 bit.
__________________
Groucho's Avisynth Stuff |
21st June 2019, 11:36 | #48 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Edit: It's actually as simple as this: Code:
char szBuffer[MAX_PATH]; GetModuleFileName(NULL, (LPTSTR)szBuffer, sizeof(szBuffer));
__________________
Groucho's Avisynth Stuff |
|
21st June 2019, 12:15 | #49 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Will you be implementing both Current Process Name, & Parent Process Name ? [I intially wrote parent, but meant current process, RT_ returns either].
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
21st June 2019, 12:18 | #50 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Edit: Ok, I see what you mean. Can you give me an example where it's useful to know the parent process?
__________________
Groucho's Avisynth Stuff Last edited by Groucho2004; 21st June 2019 at 12:23. |
|
21st June 2019, 12:24 | #51 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Difference is, Current Process is eg MPC-HC or AvsPMod or VirtualDub or MeGUI, Parent is whatever started current, eg Windows Explorer, or maybe command line [maybe Cmd.Exe, not sure] or whatever.
Parent might be of use on rare occasion. EDIT: I think parent may sometimes not exist, if has been killed since current process start.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 21st June 2019 at 12:26. |
21st June 2019, 12:31 | #52 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Until a flash of enlightenment reveals its usefulness to me I think I'll give 'parent process name' a miss.
__________________
Groucho's Avisynth Stuff |
21st June 2019, 13:27 | #53 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
v0.1.1.0
- Added 'SI_ProcessName'
__________________
Groucho's Avisynth Stuff |
21st June 2019, 14:05 | #54 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Ooo lovely
EDIT: nothing wrong with a pat on the head (so long as its not a cow pat).
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 22nd June 2019 at 18:54. |
22nd July 2019, 10:01 | #55 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
v0.1.1.1
- Updated libcpuid (AMD Zen 2 support)
__________________
Groucho's Avisynth Stuff |
26th July 2019, 20:39 | #56 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
v0.1.1.2
- Added SI_GetEnvVar
__________________
Groucho's Avisynth Stuff |
26th October 2019, 11:43 | #57 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
No hurry, but if updating dll, please add a SysInfo dll version number, just so we know what we got available, will display it in AvsInit thingy.
Thanx muchly
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
26th October 2019, 11:50 | #58 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
It has a version resource.
__________________
Groucho's Avisynth Stuff |
26th October 2019, 11:52 | #59 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Arh, so I gotta write something to extract version from version resource. [was wantin' it at runtime, check minimum requirement, likely future mandatory Sysinfo of minimum version]
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th October 2019 at 11:55. |
26th October 2019, 11:57 | #60 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Do you mean to add it to the return value of AvisynthPluginInit? Extracting it from the version resource it easy, have a look at AVSMeter, utility.h, GetFileVersion()/GetProductVersion().
__________________
Groucho's Avisynth Stuff |
Thread Tools | Search this Thread |
Display Modes | |
|
|