Author: hbelusca
Date: Fri May 16 00:56:46 2014
New Revision: 63311
URL:
http://svn.reactos.org/svn/reactos?rev=63311&view=rev
Log:
[NTVDM]
Implement INT 21h, AH=5Ch "Lock/Unlock Region of File".
Modified:
trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
Modified: trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/dos32…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] Fri May 16 00:56:46
2014
@@ -2622,6 +2622,59 @@
break;
}
+ /* Lock/Unlock Region of File */
+ case 0x5C:
+ {
+ HANDLE Handle = DosGetRealHandle(getBX());
+
+ if (Handle == INVALID_HANDLE_VALUE)
+ {
+ /* The handle is invalid */
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+ setAX(ERROR_INVALID_HANDLE);
+ break;
+ }
+
+ if (getAL() == 0x00)
+ {
+ /* Lock region of file */
+ if (LockFile(Handle,
+ MAKELONG(getCX(), getDX()), 0,
+ MAKELONG(getSI(), getDI()), 0))
+ {
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
+ }
+ else
+ {
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+ setAX(GetLastError());
+ }
+ }
+ else if (getAL() == 0x01)
+ {
+ /* Unlock region of file */
+ if (UnlockFile(Handle,
+ MAKELONG(getCX(), getDX()), 0,
+ MAKELONG(getSI(), getDI()), 0))
+ {
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
+ }
+ else
+ {
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+ setAX(GetLastError());
+ }
+ }
+ else
+ {
+ /* Invalid subfunction */
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+ setAX(ERROR_INVALID_FUNCTION);
+ }
+
+ break;
+ }
+
/* Canonicalize File Name or Path */
case 0x60:
{