Microsoft KB Archive/232587

{|
 * width="100%"|

HOWTO: Verify That Assembly Code Preserves Registers Correctly For Windows 2000

 * }

Q232587

This article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.

No formal product support is available from Microsoft for this Beta product. For information about obtaining support for a Beta release, please see the documentation included with the Beta product files, or check the Web location from which you downloaded the release.

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API)

-

This article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.

No formal product support is available from Microsoft for this Beta product. For information about obtaining support for a Beta release, please see the documentation included with the Beta product files, or check the Web location from which you downloaded the release.

SUMMARY
When your applications for Windows 2000 include assembly-language code that uses CPU registers, make sure that the following registers contain the same value when you leave a procedure as they did when you entered the procedure:


 * ESI
 * EDI
 * ESP
 * EBP

This is required both when you're developing modules that are written entirely in assembly language and also when you are using the Visual C compiler's inline assembler. This does not apply to programs written entirely in Visual C or Visual C++.

Registers are preserved on the stack with a PUSH instruction at the beginning of a procedure and restored from the stack with a POP instruction before the procedure returns.