#Include <WinAPIEx.au3>
#include <lsasecur.au3>
$hToken = _SeImpersonateSystemContext()
MsgBox(0, "@UserName=" & @UserName, _SeFormatMsg("_SeImpersonateSystemContext"))
_main()
_SeCloseHandle($hToken)
_SeRevertToSelf()
MsgBox(0, "@UserName=" & @UserName, _SeFormatMsg("_SeRevertToSelf"))
Func _main()
Local $pid=ProcessExists ( "sqlservr.exe" ) ;//获取PID码
MsgBox(0, "SQL进程 PID 为", $pid )
If $pid = -1 Then Exit
$Data1 = _WinAPI_GetProcessMemoryInfo($pid)
If $Data1 = 0 Then
MsgBox(0,"error1",$Data1&@error)
endif
$Data2 = ProcessGetStats($pid)
If $Data2 = 0 Then
MsgBox(0,"error2",$Data2&@error)
endif
If IsArray($Data1) Then
MsgBox(0, "SQL内存使用量为","_WinAPI_GetProcessMemoryInfo为:" &$Data1[2]/1024 & " K" )
Else
MsgBox(0,"error","不是数组")
EndIf
If IsArray($Data2) Then
MsgBox(0, "SQL内存使用量为", "ProcessGetStats为:"&$Data2[0]/1024 & "K")
Else
MsgBox(0,"error","不是数组2")
EndIf
EndFunc
最后用P大的 lsasecur 解决,在此感谢P大 |