Microsoft KB Archive/104314

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 21:57, 16 July 2020 by X010 (talk | contribs) (1 revision imported: importing part 2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Win32s NetBIOS Programming Considerations


The information in this article applies to:

  • Microsoft Win32s versions 1.0, 1.1, 1.2


This article addresses common questions about NetBIOS programming under Win32s.

Under Windows 3.1, you normally do not issue a RESET command due to the common name table. When running your Win32-based application under Windows version 3.1, you may issue a NetBIOS RESET command. Win32s keeps an internal list of all the names added in the Windows 3.1 NetBIOS name table by Win32 processes. A RESET on Win32s mimics the RESET on Windows NT by clearing the names added by that process from the system-wide name table. As a result, issuing a RESET command as the first NetBIOS command (as required by Windows NT) on Win32s does not clear out all of the names.

The Windows 3.1 NetBIOS VxD expects memory allocated for the NetBIOS Control Block (NCB) and the data buffer (NCB.ncb_buffer) to be allocated with GlobalAlloc(). The VxD will lock the specified memory page. If a Win32- based application running under Win32s passes the Netbios() command virtual memory, Netbios() will return error 0x22, indicating that there are too many commands outstanding. On Win32s, each piece of memory that might pass through Netbios() must be allocated with GlobalAlloc().

The Win32s NetBIOS thunk layer translates the ncb_buffer pointer in the NCB itself. The translation back from a 16-bit to original 32-bit pointer is done for asynchronous commands in the Win32s private post routine. A problem might occur when an application checks the NCB and finds that the netbios() command is completed (ncb_retcode == NRC_GOODRET), but the Win32s post routine was not called yet. The ncb_buffer has not been translated back. The best way to avoid problems is to define and use a post routine. At that point you are sure that the netbios() command is completed and the NCB is correct. If you don't want to use a post routine, you should make sure that the command was completed by checking the the ncb_retcode field and verifying that the ncb_buffer pointer is a 32-bit pointer.

There is also no need to page lock the NetBIOS post routine code under Win32s. NetBIOS post routine on Win32s is not called at interrupt time. The post routine is called in the context of the process, and therefore there is no need to page lock the post routine code.

Additional query words: 1.00 1.10 1.20

Keywords :
Issue type :
Technology : kbWin32sSearch kbWin32s100 kbWin32s110 kbWin32s120

Last Reviewed: January 12, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.