www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.6 required=5.0 tests=BAYES_00 |
X-Spam-Check-By: | sourceware.org |
X-ASG-Debug-ID: | 1233954739-4f4200010000-w5GHUG |
X-Barracuda-URL: | http://10.10.100.8:8000/cgi-bin/mark.cgi |
MIME-Version: | 1.0 |
X-ASG-Orig-Subj: | w32api 3.13-1 Incorrect #define of WTS_CURRENT_SESSION in wtsapi32.h |
Subject: | w32api 3.13-1 Incorrect #define of WTS_CURRENT_SESSION in wtsapi32.h |
Date: | Fri, 6 Feb 2009 16:12:26 -0500 |
Message-ID: | <DCF0BC3A6120BA458855EE58D5A3D72E016DA9@TRIVINMAIL.corp.trivininc.com> |
From: | "Linton Miller" <Linton DOT Miller AT trivininc DOT com> |
To: | <cygwin AT cygwin DOT com> |
X-Barracuda-Connect: | UNKNOWN[10.10.100.232] |
X-Barracuda-Start-Time: | 1233954740 |
X-Barracuda-Virus-Scanned: | by Barracuda Spam Firewall at trivininc.com |
X-Barracuda-Spam-Score: | -1002.00 |
X-Barracuda-Spam-Status: | No, SCORE=-1002.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Note-from-DJ: | This may be spam |
In w32api, the definition of WTS_CURRENT_SESSION in wtsapi32.h is #define WTS_CURRENT_SESSION 0 However, from the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5 (http://www.microsoft.com/downloads/details.aspx?FamilyId=3DE6E1C3DF-A74F- 4207-8586-711EBE331CDC&displaylang=3Den), the definition is=20 /* * Specifies the current session (SessionId) */ #define WTS_CURRENT_SESSION ((DWORD)-1) This results in the wrong session being referenced when used in WTS API calls such as WTSQuerySessionInformation. The following small example demonstrates the problem: when I run this over an RDP connection to my Windows box (logged in as an admin user), it prints Is a remote connection: 0 which is obviously incorrect. If the "WTS_CURRENT_SESSION" is changed to "-1", then the expected result Is a remote connection: 1 is returned. /* Compile with gcc -Wall -DWINVER=3D0x0501 -o test-wts test-wts.c -lwtsapi32 */ #include <windows.h> #include <wtsapi32.h> #include <stdio.h> int main(void) { USHORT *clnProto; DWORD size; if (WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSClientProtocolType, (LPTSTR *)&clnProto, &size)) { printf("Is a remote connection: %d\n", (*clnProto !=3D 0)); WTSFreeMemory(clnProto); } return 0; } Linton -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |