2

I'm currently using C# and Win32 interop to register power setting notifications, enumerate power setting guids, etc. In the process of this, I came across a function in the MSDN documentation called "PowerIsSettingRangeDefined" that looked useful. When I imported the function and tried to test it, the compiler threw "System.EntryPointNotFound" exception. Obviously I double checked my spelling, etc, to no avail. So I looked for the header file on my computer and I did find the function listed in the 'powrprof.h' header for the 8.0 SDK, however, I don't have a copy of the 7.0 or 7.0A SDK on this computer. But according to the documentation, this was supposed to have been implemented starting with Windows 7. So this should have worked...

Then I used ProcessHacker to inspect the export table of the 'powrprof.dll' module in my process. The function was NOT there! To take it one step further, I used PE Explorer on the actual 'powrprof.dll' file located in "C:\Windows\SysWOW64\" and the entry point in question, again, was NOT in the name list. So the official header files include this function with "#if (NTDDI_VERSION >= NTDDI_WIN7)" above, and the documentation shows the function exists starting with Win7, however, it seems the MS team did not include it when compiling 'powrprof.dll' for Windows 7.

Maybe someone can check their copy in Windows 8.1/10 to see if this issue is only on Windows 7? I don't have another version of Windows in this building or I'd test it myself. And I wanted to bring it to attention here first, before trying to report this to Microsoft, just in case I'm missing something.

5
  • I have found it on Windows 10.0.14393. what is your fileversion/productversion of the powrprof.dll? Jun 3, 2018 at 23:10
  • @dlatikay File version and Product version are both: 6.1.7600.16385. I think it's worth mentioning my system is completely up-to-date as well. And if memory serves me right, this file version is the same revision that Windows 7 launched with. So I guess they haven't done any updates to this particular DLL, even with SP1. Jun 3, 2018 at 23:30
  • Seems to have turned up in Windows 8 and later, see here and here. Can you get this information on W7 by poking around in the registry? And good luck getting Microsoft's attention about this, I can't see that happening, but maybe they will offer you a workaround Jun 4, 2018 at 5:40
  • @PaulSanders Yeah you're probably right about the Microsoft thing, and I'm not sure about the registry being a viable solution. I'm not sure how the registry would keep track of power setting GUIDs having a 'range' or not. Only because the documentation isn't very clear about what 'range' refers to. If they're referring to the min and max values, then I suppose I could just use "ReadValueM(in|ax)" functions to determine that by catching an exception if it were to fail. Can't find any clues other than what I can see in "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings". Jun 4, 2018 at 14:39
  • Yes, looks pretty gruesome in there. Let's just forget I suggested that. Jun 4, 2018 at 19:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.