Recent

Author Topic: shlwapi.pp SHRegSetValue definition problem  (Read 1373 times)

440bx

  • Hero Member
  • *****
  • Posts: 6362
shlwapi.pp SHRegSetValue definition problem
« on: August 11, 2025, 05:11:47 am »
Hello,

The file shlwapi.pp defines the function SHRegSetValue but, that entry point no longer exists (at least since Windows 7.)  Calling this function will cause the program not to load due to an unresolved entry point.

That said, the function does exist but, it is mapped to ordinal 631.  Using the ordinal the function is available all the way to Win 11.  That fact is undocumented and MS "recommends" using RegSetValue.

see:
https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-shregsetvalue

Just FYI,

In some versions of Windows, shlwapi ordinal 631 is a direct jump to RegSetValue.  (IOW, they are the same function.)

HTH.

ETA: added the bolded text.  The implementation differs depending on the version of Windows.  e.g, in Win 7, it is coded in place, in Win 11 it's a jump instruction.

« Last Edit: August 11, 2025, 05:24:03 am by 440bx »
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

gues1

  • Guest
Re: shlwapi.pp SHRegSetValue definition problem
« Reply #1 on: August 11, 2025, 11:25:42 am »
Thanks for reporting this. I hope no one will dream of using a function officially declared UNSUPPORTED, either as an ordinal function or otherwise.

And by the way, regarding your comment that they are "the same function", well, I'd say that's really a lottery guess, given that the DLL is not under our control and therefore it is like this now and in two minutes it might not be anymore.

The message should be: NOT USE IT ANYMORE.

440bx

  • Hero Member
  • *****
  • Posts: 6362
Re: shlwapi.pp SHRegSetValue definition problem
« Reply #2 on: August 11, 2025, 01:08:25 pm »
Everything leads to believe that at one time this was a supported function, therefore it wouldn't be surprising that it is used in some code somewhere (legacy code obviously.)

Another problem is, when MS decides they will no longer support some function, even if they document it, not everyone that used it will notice that the function is no longer supported. 

What makes it worse is that, the function is actually supported, the code is there all the way to Win 11 but, MS makes it available only by ordinal.

if MS actually supports the function, as they obviously do since it is implemented in Win 11, they should let legacy code use it.  It makes no sense to support it and claim it is not supported when the reality is the opposite of that.

The only real difference between the "unsupported" function and the supported one is the name.  It's a "You say potato, I say pot-ah-to" situation.

Just as a factoid, there are dozens (if not more) of undocumented functions that are either forwarders to documented functions or direct jumps to a documented function.  Why in the world there is an undocumented name for a documented function is a "Microsoft mystery" ;)  Maybe they just like to create undocumented stuff to waste people's time (about 60 seconds per occurrence since a disassembly clearly shows the equivalence.)

Anyway, defining SHRegSetValue (as it is in shlwapi) is, as you know, a potential problem since the _named_ entry point no longer exists.

FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

gues1

  • Guest
Re: shlwapi.pp SHRegSetValue definition problem
« Reply #3 on: August 11, 2025, 02:39:06 pm »
I used to act like you, precisely to uncover the depths of hidden "things."
When using these depths created serious problems for me, meaning that from one moment to the next, the provided applications would stop running... well, I changed my perspective.
These things are fine for fun, research, or documentation purposes, but the message should be "DO NOT USE THEM," at least for "productive" purposes.
A feature marked as UNSUPPORTED by its developer must be treated as such. It doesn't matter whether it's supported or not, and in what way; it's simply unsupported and could cease to exist now or tomorrow, or perhaps even be discontinued yesterday.

440bx

  • Hero Member
  • *****
  • Posts: 6362
Re: shlwapi.pp SHRegSetValue definition problem
« Reply #4 on: August 11, 2025, 08:46:42 pm »
A feature marked as UNSUPPORTED by its developer must be treated as such. It doesn't matter whether it's supported or not, and in what way; it's simply unsupported and could cease to exist now or tomorrow, or perhaps even be discontinued yesterday.
I'm afraid I have to disagree. 

"Someplace" it is "documented" that Earth is at the center of the universe and Adam and Even are the "origin of the species", to boot, that documentation is supposedly "sacred".  Last I checked, MS' documentation isn't sacred and just because MS says one thing doesn't mean it's right. MS is free to say whatever they want (which is far from always right...) and programmers are free to do as they please with whatever MS says.

As a wise man often recommended... "use the code" (or something like that...)
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12771
  • FPC developer.

440bx

  • Hero Member
  • *****
  • Posts: 6362
Re: shlwapi.pp SHRegSetValue definition problem
« Reply #6 on: August 12, 2025, 03:51:20 pm »
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018