首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在没有电池设备的Windows工作站上编程模拟电池?

如何在没有电池设备的Windows工作站上编程模拟电池?
EN

Stack Overflow用户
提问于 2018-06-03 00:14:43
回答 1查看 2K关注 0票数 2

出于测试目的,我需要强制Windows认为它在工作站PC上有电池。

有没有办法在没有电池设备的Windows工作站上模拟/模拟电池状态/低电平/充电/放电?

我可以在Windows上以编程方式设置电池电量吗?

EN

回答 1

Stack Overflow用户

发布于 2019-01-03 22:00:40

奥列格的回答非常简单易懂,但我无法让它模拟电池--禁用和启用真实电池的操作确实成功了。

代码语言:javascript
复制
PS C:\RunTime> .\RegisterWDTF.exe
This version of WDTF is compatible with Windows Build 17763.
-Delete registry state.
-Get registry path.
-Register COM DLLs.
   Process "C:\RunTime\Actions\Deprecated\DeviceManagement.dll".
   Process "C:\RunTime\Actions\DeviceSupport\WDTFDeviceSupportAction.dll".
   Process "C:\RunTime\Actions\DrvPkgLibExt.dll".
      Not a COM DLL

   Process "C:\RunTime\Actions\EDT\WDTFEDTAction.dll".
   Process "C:\RunTime\Actions\IoSpy\WDTFIoAttackAction.dll".
   Process "C:\RunTime\Actions\IoSpy\WDTFIoSpyAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\SimpleIO_D3DTest.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFAnySimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFAudioSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFBluetoothSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFCDROMSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFMobileBroadbandSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFMUTT2STRESSSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFMUTT2TCDSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFNetworkSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\wdtfsensorsiosimpleioaction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFVolumeSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFWebcamSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFWirelessSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimpleIO\WDTFWPDSimpleIoAction.dll".
   Process "C:\RunTime\Actions\SimulatedBattery\WDTFSimulatedBatterySystemAction.dll".
   Process "C:\RunTime\Actions\System\WDTFSystemAction.dll".
   Process "C:\RunTime\Actions\WDTFConcurrentIOAction.dll".
   Process "C:\RunTime\Actions\WDTFCpuUtilizationSystemAction.dll".
   Process "C:\RunTime\Actions\WDTFDriverPackageAction.dll".
   Process "C:\RunTime\Actions\WDTFDriverSetupDeviceAction.dll".
   Process "C:\RunTime\Actions\WDTFDriverSetupSystemAction.dll".
   Process "C:\RunTime\Actions\WDTFDriverVerifierSystemAction.dll".
   Process "C:\RunTime\Actions\WDTFFuzzTestAction.dll".
   Process "C:\RunTime\Actions\WDTFInterfaces\WDTFInterfaces.dll".
   Process "C:\RunTime\Actions\WDTFPNPAction.dll".
   Process "C:\RunTime\Actions\WDTFSUPAction.dll".
   Process "C:\RunTime\WDTF.DLL".
-Update registry state.
-Install Drivers.
-Done

 WDTF Registration Successful
PS C:\RunTime> cscript.exe .\fake-battery.vbs
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

Loading Wex.Logger.dll from systemdata.cpp linep 922 failed.
WDTF_TARGET               : INFO  :  - GetInterface("SimulatedBatterySystem")
WDTF_TARGET               : INFO  :          Target: ORANGE
WDTF_SIMBATT              : INFO  : DisableRealBatteries()
WDTF_SIMBATT              : INFO  : EnableSimulatedBattery()
WDTF_SIMBATT              : ERROR : SimulatedBatterySystem critical error installing battbus device. HRESULT=0xE0000203
C:\RunTime\fake-battery.vbs(22, 1) WDTF.SimulatedBatterySystem.1: SimulatedBatterySystem critical error installing battbus device. HRESULT=0xE0000203

不幸的是,我在公共互联网上找不到关于这些错误的信息。希望有人能遇到这个问题,并知道下一步该怎么做!

--

编辑:似乎Visual Studio除了测试框架之外还安装了各种驱动程序,所以简单地复制RunTime文件夹是不够的。我最终从另一个工作站使用VS将我的工作站添加为一个完整的目标。然后让我来模拟电池。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50658822

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档