Microsoft KB Archive/116438

From BetaArchive Wiki

BUG: _dos_lock() Uses SI and DI Without Restoring Values

Q116438

1.00 1.50 MS-DOS kbprg kbbuglist ---------------------------------------------------------------------- The information in this article applies to: - The C Run-time (CRT), included with: Microsoft Visual C++ for Windows, versions 1.0 and 1.5 ---------------------------------------------------------------------- SYMPTOMS ======== After returning from a call to _dos_lock(), both the SI and the DI registers change their values. Their original values before the call to _dos_lock() are not restored. RESOLUTION ========== As a workaround, save SI and DI before calling _dos_lock() and then restore them after the call to _dos_lock(). STATUS ====== Microsoft has confirmed this to be a bug with Visual C++ for Windows, versions 1.0 and 1.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ You can use the following sample code to demonstrate this problem: Sample Code ----------- /* Compile options needed: none */ #include #include #include void main() { int fh; if( _dos_open( "c:\\config.sb", _O_RDONLY, &fh ) != 0 ) perror( "Open failed on input file" ); else { printf( "Open succeeded on input file\n" ); // Save the SI And DI registers and then // restore them __asm push si __asm push di _dos_lock(fh,0, 0L,20); __asm pop di __asm pop si if( _dos_close( fh ) != 0 ) perror( "Close failed" ); else printf( "File successfully closed\n" ); } } Additional reference words: 1.00 1.50 KBCategory: kbprg kbbuglist KBSubcategory: CRTIss

Keywords : kb16bitonly
Issue type :
Technology : kbVCsearch kbAudDeveloper kbCRT


Last Reviewed: July 25, 1997
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.