WbemObject.Terminate失败原因

时间:2016-05-16 07:29:01

标签: wmi inno-setup

就目前而言,我正在改进我的Inno Setup安装程序中的日志记录,因此如果消费者会出现某种错误,我可以很容易地看到,出了什么问题。

作为安装操作之一,如果正在运行,我会终止应用程序进程,以正常覆盖文件。要杀死应用程序,我使用方法Inno Setup Kill a running process中描述的方法 - 获取WbemObject并调用WbemObject.Terminate

至于现在,如果Terminate成功,我想跟踪。从我的测试中,我发现它实际上返回了布尔值,表明应用程序是否已成功终止。但如果它失败了,它只会返回" false"。我想知道更详细的原因。

那么,有没有办法获得WbemObject.Terminate的实际失败原因?

1 个答案:

答案 0 :(得分:1)

你拥有的,不是<li class="corePrettyStyle prettylink map accredited-training-rto disability-employment-services disability-management-services-dms employment-services employment-support-services-ess job-in-jeopardy training-services wa " data-title="Armadale, WA" data-lat="-32.15511" data-long="116.01419499999997" data-locationindex="0"><a title="View Armadale, WA" href="#" class="viewLocationDetail">Armadale, WA <span class="mapcategories">Categories: <span>Accredited Training – RTO Disability Employment Services Disability Management Services (DMS) Employment Services Employment Support Services (ESS) Job in Jeopardy Training Services WA </span></span></a> <div class="mapLocationDetail"> <div class="mapDescription clearfix"> <ul class="maploc-des"> <li>12/47 William Street</li> <li>Armadale, WA 6112</li> <li><strong>Ph:</strong>&nbsp; (08) 6267 2555</li> <li><strong>Fax:</strong> (08) 6267 2556</li> </ul> For queries not related to Employment Services, please call 1300 677 789.</div> <a href="https://staging.orsgroup.com.au/location/armadale-wa/" class="viewLocationPage btn corePrettyStyle">Location &amp; service details</a> <div class="getDirections">Get directions from <input id="directionsPostcode" type="text" value="" size="10"> <a href="#" class="getdirections btn corePrettyStyle">go</a> <div class="mapLocationDirectionsHolder"></div> </div> </div> </li> ,而是jsfiddle

Win32_Process object确实返回WbemObject(Pascal中的uint32),而不是Cardinal

  

如果进程成功终止,则返回值0(零),以及指示错误的任何其他数字。有关其他错误代码,请参阅Win32_Process.Terminate methodWMI Error Constants。对于一般 HRESULT 值,请参阅WbemErrorEnum

     

圆满完成(0)
  拒绝访问(2)
  权限不足(3)
  未知故障(8)
  未找到路径(9)
  参数无效(21)
  其他(22-4294967295)