From a242a67b73ab17dbe28990c15f212d95c3e03570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 16 May 2014 00:34:54 +0000 Subject: [PATCH] [NTVDM] Partially implement INT 21h, AH=60h -- "Canonicalize File Name or Path". svn path=/trunk/; revision=63310 --- reactos/subsystems/ntvdm/dos/dos32krnl/dos.c | 31 +++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c b/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c index 4928ca443fe..f0f3b7ef215 100644 --- a/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c +++ b/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c @@ -2625,7 +2625,36 @@ VOID WINAPI DosInt21h(LPWORD Stack) /* Canonicalize File Name or Path */ case 0x60: { - // TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /* + * See Ralf Brown: http://www.ctyme.com/intr/rb-3137.htm + * for more information. + */ + + /* + * We suppose that the DOS app gave to us a valid + * 128-byte long buffer for the canonicalized name. + */ + DWORD dwRetVal = GetFullPathNameA(SEG_OFF_TO_PTR(getDS(), getSI()), + 128, + SEG_OFF_TO_PTR(getES(), getDI()), + NULL); + if (dwRetVal == 0) + { + Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF; + setAX(GetLastError()); + } + else + { + Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; + setAX(0x0000); + } + + // FIXME: Convert the full path name into short version. + // We cannot reliably use GetShortPathName, because it fails + // if the path name given doesn't exist. However this DOS + // function AH=60h should be able to work even for non-existing + // path and file names. + break; }