Article View: borland.public.cppbuilder.nativeapi
Article #457Re: using WTSGetActiveConsoleSessionId()
From: Ed Mulroy [TeamB]
Date: Thu, 17 Apr 2008 16:06
Date: Thu, 17 Apr 2008 16:06
43 lines
3016 bytes
3016 bytes
WTSQueryUserToken is dealt with in another reply.
As you most likely already know, most of the Windows headers are
modifications of ones provided by Microsoft (they copyrighted the API and
have sued companies who independently developed their own headers). I can
confirm what you found from what is on my machine. The winwlx.h header does
not have an extern "C" guard. However the wtsapi32.h header does have it.
WTSGetActiveConsoleSessionId is, as mentioned before, found in import32.lib,
a library which the IDE includes by default in a build. If you are building
from the command line then check that import32.lib is included in the list
of libraries used in the link phase.
There is nothing odd, questionable or wrong with your explicit linking of
WTSGetActiveConsoleSessionId. What you did merely duplicates what the
Windows loader does when implicitly linking via an import library. In fact
it might actually speed loading of your gina dll if the function is called a
lot because the loader doesn't have to fix up the function address at each
point where WTSGetActiveConsoleSessionId is called.
. Ed
> Mike Collins wrote in message
> news:480758e5@newsgroups.borland.com...
>
> Hay Ed thanks for the pointer, I actually resolved it by dynamically
> loading it, like this:
>
> typedef DWORD (WINAPI *WTSGETACTIVECONSOLESESSIONID)(VOID);
> WTSGETACTIVECONSOLESESSIONID lpfnWTSGetActiveConsoleSessionId = NULL;
> lpfnWTSGetActiveConsoleSessionId =
> (WTSGETACTIVECONSOLESESSIONID)GetProcAddress(GetModuleHandle("kernel32.dll"),
> "WTSGetActiveConsoleSessionId");
>
> The project that i'm calling it from is a gina and i had to do some
> playing around to get the dll to export the named functions correctly i.e.
> extern "C"
> {
> #include <winwlx.h>
> };
>
> otherwise winlogon would not load it correctly - maybe this is the cause.
> However, I still stuck with the WTSQueryUserToken issue. Any thoughts?
Technical Details
Message-ID:
<480775a3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<48074a72@newsgroups.borland.com> <48075419$1@newsgroups.borland.com> <480758e5@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,61b1edc79d66af39 X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Newsgroups: borland.public.cppbuilder.nativeapi References: <48074a72@newsgroups.borland.com> <48075419$1@newsgroups.borland.com> <480758e5@newsgroups.borland.com> Subject: Re: using WTSGetActiveConsoleSessionId() Date: Thu, 17 Apr 2008 12:06:56 -0400 Lines: 45 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 71.77.48.179 Message-ID: <480775a3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1208448419 71.77.48.179 (17 Apr 2008 09:06:59 -0700) X-Authenticated-User: edmulroy Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail