Celebrating the 22th anniversary of the UltraVNC: https://forum.uvnc.com/viewtopic.php?t=38031
Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Bluesky/AT Protocol: https://bsky.app/profile/ultravnc.bsky.social
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

Error: Can't locate WTSGetActiveConsoleSessionId in kernel32

Post Reply
Alex3939

Error: Can't locate WTSGetActiveConsoleSessionId in kernel32

Post by Alex3939 »

The latest version of the UtraVnc can't be started under my Win2k Pro. The error is the following:

Error: Can't locate WTSGetActiveConsoleSessionId in kernel32.dll.
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6883
Joined: 2004-04-23 10:21
Contact:

Post by Rudi De Vos »

Latest version contain winvncxxx.exe and winvncxxxXP.exe
XP version need WTSGetActiveConsoleSessionId
Alex3939

Post by Alex3939 »

Rudi De Vos wrote:XP version need WTSGetActiveConsoleSessionId
Really? The function is called from the function mytest() :) If the WTSGetActiveConsoleSessionId call is really needed it'll be more smart to load the function from kernel32 dinamically, imho?
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6883
Joined: 2004-04-23 10:21
Contact:

Post by Rudi De Vos »

loadlibrary and getprocadress does not find the function
in kernel32.dll
All other wts functions can be loaded dynamic, this one failes.

Are you sure the function is in kernel32, MS doc says, but it just doen't work.

Spend last weeks more then time on it, and finaly made a dubble compile.
If you can find the correct syntax, please share.
Alex3939

Post by Alex3939 »

Ok. I understand the problem now.
I'll let you know if I'll find a solution.
But it'll be a bit difficult for me as far as I have no XP.
Could you send the XP kernel32.dll to me, please.

Thanks.
Marscha
Former moderator
Former moderator
Posts: 464
Joined: 2004-05-14 06:48

Post by Marscha »

Maybe my proposal is stupid, but why not replace the compile time

Code: Select all

#ifdef _XP
with a runtime check for XP

Code: Select all

if (isXP())
?
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6883
Joined: 2004-04-23 10:21
Contact:

Post by Rudi De Vos »

#ifdef exclude at compilation level
if (ISXP) is run level information, function is compiled in the code and checked on startup. Doesn't matter if it is used or not.

The only way is the loadlibrary... like we did for all other OS
only functions.
Alex3939

Post by Alex3939 »

2 Rudi De Vos
Hmm... The standard code works fine for me (at least in one XP box I've founded for testing). Here is the code:

Code: Select all

  hLib = LoadLibrary("kernel32.dll");
  if (NULL == hLib) 
  {
    MessageBox(NULL, "Can't load kernel32.dll", "Error", MB_OK | MB_ICONERROR);
  }
  else
  {
    MessageBox(NULL, "kernel32.dll is loaded ok", "Info", MB_OK | MB_ICONEXCLAMATION);
    PVOID _imp_WTSGetActiveConsoleSessionId = GetProcAddress(hLib, "WTSGetActiveConsoleSessionId");

    if (NULL == _imp_WTSGetActiveConsoleSessionId) 
    {
      MessageBox(NULL, "Can't load WTSGetActiveConsoleSessionId from kernel32.dll", "Error", MB_OK | MB_ICONERROR);
    }
    else
    {
      MessageBox(NULL, "WTSGetActiveConsoleSessionId is loaded from kernel32.dll ok", "Info", MB_OK | MB_ICONEXCLAMATION);
}
At least the _imp_WTSGetActiveConsoleSessionId is not NULL (and callable) after GetProcAddress.
May be it's a security issue? Have you checked the code from under Admin account?
Alex3939

Post by Alex3939 »

Are there any news concerning the problem?

Thanks.
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6883
Joined: 2004-04-23 10:21
Contact:

Post by Rudi De Vos »

Will check your code....and compare to my old.

I just hope i didn't make a stupid typo in the function name,
because this is identical to how i did it.
Alex3939

Post by Alex3939 »

Ok. Please let me know about the results.

Thanks a lot.
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6883
Joined: 2004-04-23 10:21
Contact:

Post by Rudi De Vos »

Dammmmmm typo
Id != id
All back in 1 compilation, it works...

The power of opensource back in action :crazy:
Post Reply