Microsoft KB Archive/71150

INF: The GlobalDosAlloc Function and CD-ROM I/O ID Number: Q71150

1.00 WINDOWS

Summary:

An application that allocates buffers for data to be passed to the waveOutPrepareHeader and waveOutWrite functions should use the GlobalAlloc function and specify the GMEM_MOVEABLE and GMEM_SHARE attributes. GMEM_MOVEABLE is required due to a problem with Microsoft Windows version 3.0 that causes fixed memory blocks to be page locked. (This problem has been fixed in Windows 3.1.) GMEM_SHARE is required so that the application will be compatible with future versions of Windows.

MS-DOS I/O (input and output) performance is often better when buffer memory is allocated by the GlobalDosAlloc function. However, GlobalDosAlloc memory is very limited because it is allocated from the physical memory addressed below 1 MB (MS-DOS memory). Because most of this memory is used by MS-DOS, terminate-and-stay-resident programs (TSRs), and Windows itself, very little memory is available for application program use. Allocations of more than 4K are likely not to succeed. This small limit is in direct conflict with the 32K optimum read size for a CD-ROM device.

To achieve acceptable performance with the large amounts of data associated with CD-ROM based applications, it is necessary to use large (32K) buffers. Use the GlobalAlloc function to allocate the buffer.

In the present implementation of the Multimedia Extensions to Microsoft Windows, the waveOut* functions accept memory blocks allocated with GlobalDosAlloc. However, this behavior is not guaranteed and may change in future versions of Windows.

Additional reference words: 1.00