4 ms·
> by linking with PowrProf.dll, and then calling this function from powersetting.h as follows > This function is part of User32.lib, and is defined in winuser.
by TimTheTinker 5y ago
> by linking with PowrProf.dll, and then calling this function from powersetting.h as follows
> This function is part of User32.lib, and is defined in winuser.h which is included in Windows.h.
This is one reason I think Windows is such a mess of an OS. (Look at the contents of C:\Windows and tell me it's not, if you can do so with a straight face!)
To make what ought to be a system call you have to load some DLL, sys, or lib file at a random (but fixed) path and call a function on it.
That combined with COM, and the registry, and I don't want to touch it with a ten-foot pole.
- Someone 5y ago> To make what ought to be a system call you have to load some DLL, sys, or lib file at a random (but fixed) path and call a function on it. “Ought to be a system call” is a matter of opinion. Among OSes, Linux is an outlier in that it keeps its system call interface stable. Many other OSes choose to provide a library with a stable interface through which system calls can (and, in some cases must. See https://lwn.net/Articles/806776/ https://lwn.net/Articles/806776/; discussed in https://news.ycombinator.com/item?id=21859612 https://news.ycombinator.com/item?id=21859612) be called. That allows them to change the system call ABI, for example to retire calls that have been superseded by other ones. (ideally, IMO, that library should not be the C library. There should be two libraries, a “Kernel interface library” and a “C library”. That’s a different subject, though)
- pjc50 5y agoThis isn't especially different from Linux's dependency on /lib/ld.so. There's a design choice to not have syscalls and instead make you go through the libraries, to discourage people making themselves dependent on undocumented syscalls. Of course, there probably shouldn't be undocumented syscalls in the first place, since that's a bit suspicious. > combined with COM, and the registry And yet GNOME has dconf and CORBA, because in order to do certain things you converge on the same solutions. (Now, if you want a mess, the attempts to retrofit secure containers onto this with UWP definitely count!)