Open SynSnipe opened 3 years ago
Simple Code that I was trying to compile...
import psutil
proc main : void =
echo "psutil test"
let pidList = pids()
echo $pidList
when isMainModule:
main()
Again works on Linux but not on Windows.
Sorry for the issue, i'll take a look soon-ish and provide an update.
Hi, I'm having the same issue.
I know how to solve the issue, and did it in the code on my PC, but don't know how to edit the code here, otherwise I would.
Anyway:
In psutil_windows.nim, everwhere you get a LPWSTR error the var should be declared as wstring, for a LPSTR error, declare the var as cstring. These variables were declared as TCHAR or char arrays Example code:
##### var szProcessName: array[MAX_PATH, TCHAR]
var szProcessName: wstring
##### var filename: array[MAX_PATH, char]
var filename: cstring
##### var wcUser: array[512, TCHAR]
##### var wcDomain: array[512, TCHAR]
var wcUser: wstring
var wcDomain: wstring
It is in several places in the code that the declarations should be changed. It got broken because of a change in winim.
BTW pid_names() doesn't work, it returns a seq with PIDs and a seq with empty strings. I don't need that, so did not check why.
Mind that processexists() is case sensitive_ ! If you want it case insensitive find the code and change to
if name.toLowerAscii() == processName.toLowerAscii():
exists = true
Type Issues in Windows side of psutil. I assume something changed in winim but I am uncertain. Linux compiles and runs without issues.
Nim Version
winim version
psutil version
compilation output
The issues are not limited to this proc. I tried to run down my list of issues that I had as a result of trying to create a windows process list. Unfortunately the type issues go a bit deeper than I understand at this point.