n4ru / FakeSlice

Discharge USB-C Power Banks before internal battery on newer ThinkPads.
89 stars 6 forks source link

Vantage no longer includes ThinkBatteryPlugin #7

Open Prototyped opened 1 year ago

Prototyped commented 1 year ago

I tried to use CopyDLLs.bat, but the files it copies no longer exist in current versions of Lenovo Vantage:

C:\util>copy C:\ProgramData\Lenovo\ImController\Plugins\ThinkBatteryPlugin\x86\Lenovo.Modern.Portable.Battery.dll Lenovo.Modern.Portable.Battery.dll
The system cannot find the path specified.

C:\util>copy C:\ProgramData\Lenovo\ImController\Plugins\ThinkBatteryPlugin\x86\Plugins.Battery.Think.Native.dll Plugins.Battery.Think.Native.dll
The system cannot find the path specified.

C:\util>dir "\ProgramData\Lenovo\ImController\Plugins"
 Volume in drive C is SYSTEM
 Volume Serial Number is 7444-155C

 Directory of C:\ProgramData\Lenovo\ImController\Plugins

01/07/2023  09:40    <DIR>          .
01/07/2023  09:40    <DIR>          ..
12/01/2019  16:53    <DIR>          GenericActiveDirectoryPlugin
01/12/2021  22:37    <DIR>          GenericCorePlugin
30/06/2023  17:20    <DIR>          GenericMessagingPlugin
21/06/2020  23:37    <DIR>          GenericNetworkPlugin
17/09/2022  14:17    <DIR>          GenericTelemetryPlugin
12/01/2019  13:43    <DIR>          LenovoAppPromotionPlugin
28/03/2022  07:05    <DIR>          LenovoCompanionAppPlugin
03/11/2022  23:20    <DIR>          LenovoHardwareScanPlugin
16/09/2022  06:38    <DIR>          LenovoSystemUpdatePlugin
               0 File(s)              0 bytes
              11 Dir(s)  12,334,665,728 bytes free

The only DLLs whose names contained the word "Battery" were the following:


C:\util>dir "\ProgramData\Lenovo\ImController"\*Battery*dll /s
 Volume in drive C is SYSTEM
 Volume Serial Number is 7444-155C

 Directory of C:\ProgramData\Lenovo\ImController\Plugins\LenovoSystemUpdatePlugin\x64

27/11/2020  06:40            40,336 Lenovo.Modern.Contracts.BatteryManagement.dll
               1 File(s)         40,336 bytes

 Directory of C:\ProgramData\Lenovo\ImController\Plugins\LenovoSystemUpdatePlugin\x86

27/11/2020  06:40            40,336 Lenovo.Modern.Contracts.BatteryManagement.dll
               1 File(s)         40,336 bytes

     Total Files Listed:
               2 File(s)         80,672 bytes
               0 Dir(s)  12,331,180,032 bytes free

I don't know if you're still interested in maintaining ThinkSlice, but if so, it might need an update.

Prototyped commented 1 year ago

Looks like the new assembly of interest is "Contract_Battery.dll" at %ProgramData%\lenovo\Vantage\Addins\DeviceSettingsHeartbeatAddin\1.0.3.8\Contract_Battery.dll.

image

Prototyped commented 1 year ago

That turned out to be a bit of a red herring -- those are request shapes used with an RPC client to talk to the LenovoVantageService which then enacts the change via a kernel-mode driver.

Lenovo themselves provide a command-line client, ChargeThreshold.exe, that works with that driver directly. I'm using this with AutoHotKey instead of FakeSlice. Documentation on Lenovo community forums.