Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/247405

From BetaArchive Wiki
Knowledge Base


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:

STATUS

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


Additional query words: platform SESSION_INFO_XX, NetSessionEnum() SESSION_INFO_0 SESSION_INFO_1 SESSION_INFO_2 SESSION_INFO_10

Keywords: kbapi kbfile kbpending kbprb kbwnet KB247405