Microsoft KB Archive/247405

= PRB: Incorrect SESSION_INFO_XX Pulled in when Compiling _MBCS =

Article ID: 247405

Article Last Modified on 8/27/2007

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q247405



SYMPTOMS
When calling the NetSessionEnum Win32 API function in an application compiled with _MBCS defined, the SESSION_INFO_XX structure fields are not filled in correctly.



CAUSE
The NetSessionEnum Win32 API function always returns values in Unicode in the SESSION_INFO_XX structures. However, the definitions for these structures in %MSVCDir%\Include\LMSHARE.h are incorrect. For instance, SESSION_INFO_10 is defined incorrectly as: typedef struct _SESSION_INFO_10 { LPTSTR   sesi10_cname;             // client name (no backslashes) LPTSTR   sesi10_username; DWORD    sesi10_time; DWORD    sesi10_idle_time; } SESSION_INFO_10, *PSESSION_INFO_10, *LPSESSION_INFO_10; Note that the string fields are defined as LPTSTR, when they should have been LPWSTR.



RESOLUTION
The Platform SDK version of LMSHARE.h has the SESSION_INFO_XX structures defined correctly. Compiling with the Platform SDK version of LMSHARE.h gives correct results. You can download the latest release of the Platform SDK from the following Microsoft Web site:

http://support.microsoft.com/default.aspx?pr=psdk



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

