PRB: Incorrect SESSION_INFO_XX Pulled in when Compiling _MBCS (247405)



The information in this article applies to:

  • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
  • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
  • Microsoft Visual C++, 32-bit Professional Edition 5.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0
  • Microsoft Visual C++, 32-bit Learning Edition 6.0

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:

STATUS

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

Modification Type:MajorLast Reviewed:12/11/2003
Keywords:kbAPI kbfile kbpending kbprb kbWNet KB247405