Microsoft KB Archive/813488

= FIX: The bool Type Does Not Marshal Correctly from Unmanaged Code to Managed Code =

Article ID: 813488

Article Last Modified on 10/21/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-





For a Microsoft Visual Studio .NET 2003 version of this article, see 823071.



SYMPTOMS
When you call unmanaged code that returns a bool type value of false from managed code, the return value may appear as true.



CAUSE
In some cases, the native bool type does not marshal correctly from unmanaged code to managed code.



WORKAROUND
There are two ways to work around this issue:
 * Change existing native DLLs to use BOOL return types instead of bool.
 * Use DllImport and the platform invoke services to call to the unmanaged DLL.



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



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

Note You must have a Visual Studio license agreement to obtain this hotfix.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.   Date         Time   Version      Size       File name -  23-Jan-2003  01:27  13.0.9658.0  2,105,344  C1xx.dll 23-Jan-2003 01:28  13.0.9658.0  1,753,088  C2.dll

Keywords: kbqfe kbprb kbhotfixserver KB813488

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.