Memory Access Methods for Protected Mode ApplicationsLast reviewed: July 23, 1997Article ID: Q77226 |
3.00 3.10
WINDOWS
kbprg
The information in this article applies to:
SUMMARYApplications that will run solely in one of Windows protected modes (standard mode or enhanced mode) can take advantage of the attributes of protected mode to reduce the size and improve the speed of the application. These techniques do not apply to applications that can be run in Windows real mode.
MORE INFORMATIONTo assure compatibility with future versions of Windows, an application should not make any assumptions about the protection ring of memory selectors the system provides for memory allocations. Using global memory can be more straightforward when an application is developed for the protected-mode environment. The following four steps provide a procedure for using memory:
The four steps above may be used for discardable memory. However, Windows cannot discard the memory while it is locked. Therefore, even in protected mode, applications that use discardable memory objects should unlock each object when it is not in use. This makes these memory blocks candidates for discarding should the system run out of memory. Selectors should not be shared between applications unless the rules outlined in the dynamic data exchange (DDE) specification are followed. In particular, the GMEM_DDESHARE or GMEM_SHARE flag must be specified in memory allocation requests. Future versions of Windows may implement separate address spaces; any applications that improperly share memory will not function properly in any such release. An application that uses any of these techniques should specify the Resource Compiler -T switch when resources are added to the application. This will prevent the application from running in real mode. Additional techniques to decrease the size and increase the speed of an application developed for protected mode can be found by searching on the words in this Knowledge Base:
streamlined |
Additional reference words: 3.00 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |