Author: aandrejevic
Date: Fri Jun 21 22:14:07 2013
New Revision: 59277
URL:
http://svn.reactos.org/svn/reactos?rev=59277&view=rev
Log:
[NTVDM]
Use local time instead of system time for the clock.
Implement the "set system date" and "set system time" DOS functions.
Modified:
branches/ntvdm/subsystems/ntvdm/dos.c
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Fri Jun 21 22:14:07 2013
@@ -570,7 +570,7 @@
/* Get system date */
case 0x2A:
{
- GetSystemTime(&SystemTime);
+ GetLocalTime(&SystemTime);
EmulatorSetRegister(EMULATOR_REG_CX,
(Ecx & 0xFFFF0000) | SystemTime.wYear);
EmulatorSetRegister(EMULATOR_REG_DX,
@@ -581,11 +581,33 @@
(Eax & 0xFFFFFF00) | SystemTime.wDayOfWeek);
break;
}
+
+ /* Set system date */
+ case 0x2B:
+ {
+ GetLocalTime(&SystemTime);
+ SystemTime.wYear = LOWORD(Ecx);
+ SystemTime.wMonth = HIBYTE(Edx);
+ SystemTime.wDay = LOBYTE(Edx);
+
+ if (SetLocalTime(&SystemTime))
+ {
+ /* Return success */
+ EmulatorSetRegister(EMULATOR_REG_AX, Eax & 0xFFFFFF00);
+ }
+ else
+ {
+ /* Return failure */
+ EmulatorSetRegister(EMULATOR_REG_AX, Eax | 0xFF);
+ }
+
+ break;
+ }
/* Get system time */
case 0x2C:
{
- GetSystemTime(&SystemTime);
+ GetLocalTime(&SystemTime);
EmulatorSetRegister(EMULATOR_REG_CX,
(Ecx & 0xFFFF0000)
| (SystemTime.wHour << 8)
@@ -594,6 +616,29 @@
(Edx & 0xFFFF0000)
| (SystemTime.wSecond << 8)
| (SystemTime.wMilliseconds / 10));
+ break;
+ }
+
+ /* Set system time */
+ case 0x2D:
+ {
+ GetLocalTime(&SystemTime);
+ SystemTime.wHour = HIBYTE(Ecx);
+ SystemTime.wMinute = LOBYTE(Ecx);
+ SystemTime.wSecond = HIBYTE(Edx);
+ SystemTime.wMilliseconds = LOBYTE(Edx) * 10;
+
+ if (SetLocalTime(&SystemTime))
+ {
+ /* Return success */
+ EmulatorSetRegister(EMULATOR_REG_AX, Eax & 0xFFFFFF00);
+ }
+ else
+ {
+ /* Return failure */
+ EmulatorSetRegister(EMULATOR_REG_AX, Eax | 0xFF);
+ }
+
break;
}