Microsoft KB Archive/48697

From BetaArchive Wiki

Indirectly Calling LocalAlloc()

PSS ID Number: Q48697 Article last modified on 11-05-1993

2.03 2.10 3.00 MS-DOS

The information in this article applies to:
- Microsoft Windows Software Development Kit for Windows version 3.0


Some Windows API routines call LocalAlloc(). Each of these calls has the potential of moving the Data Segment (DS) because LocalAlloc() decrements the lock count on DS. This, in turn, will invalidate any FAR pointers to data items in DGROUP. Which Windows API routines directly or indirectly call LocalAlloc()?


We cannot document which functions call LocalAlloc() because the functions may change in a future release of Windows. Instead, you should use LockData() to guarantee the validity of your FAR pointers to DGROUP, as shown in the following code fragment: LockData(0); /* generate and use FAR pointers to DGROUP here / UnlockData (0); / don’t use those DGROUP pointers any more! */

Additional reference words: 2.03 2.10 3.00 KBCategory: KBSubcategory: KrMmLocalmem Copyright Microsoft Corporation 1993.