Moved MulDiv() and VGA routines out of GDI.
diff --git a/files/dos_fs.c b/files/dos_fs.c
index dec37fa..0c4782d 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -1868,6 +1868,59 @@
/***********************************************************************
+ * MulDiv (KERNEL32.391)
+ * RETURNS
+ * Result of multiplication and division
+ * -1: Overflow occurred or Divisor was 0
+ */
+INT WINAPI MulDiv(
+ INT nMultiplicand,
+ INT nMultiplier,
+ INT nDivisor)
+{
+#if SIZEOF_LONG_LONG >= 8
+ long long ret;
+
+ if (!nDivisor) return -1;
+
+ /* We want to deal with a positive divisor to simplify the logic. */
+ if (nDivisor < 0)
+ {
+ nMultiplicand = - nMultiplicand;
+ nDivisor = -nDivisor;
+ }
+
+ /* If the result is positive, we "add" to round. else, we subtract to round. */
+ if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
+ ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
+ ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
+ else
+ ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
+
+ if ((ret > 2147483647) || (ret < -2147483647)) return -1;
+ return ret;
+#else
+ if (!nDivisor) return -1;
+
+ /* We want to deal with a positive divisor to simplify the logic. */
+ if (nDivisor < 0)
+ {
+ nMultiplicand = - nMultiplicand;
+ nDivisor = -nDivisor;
+ }
+
+ /* If the result is positive, we "add" to round. else, we subtract to round. */
+ if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
+ ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
+ return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
+
+ return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
+
+#endif
+}
+
+
+/***********************************************************************
* DosDateTimeToFileTime (KERNEL32.76)
*/
BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft)