From 5138a352959a8a000dc54578d952f388b9ff8508 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 18 Aug 2000 23:43:37 +0000 Subject: [PATCH] Append .DRV to name only if no extension present. --- graphics/win16drv/prtdrv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/graphics/win16drv/prtdrv.c b/graphics/win16drv/prtdrv.c index 03a35534c72..4aca0e0709c 100644 --- a/graphics/win16drv/prtdrv.c +++ b/graphics/win16drv/prtdrv.c @@ -167,10 +167,15 @@ LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver) } { - char *drvName = malloc(strlen(pszDriver)+5); + char *p, *drvName = HeapAlloc(GetProcessHeap(), 0, strlen(pszDriver) + 5); strcpy(drvName, pszDriver); - strcat(drvName, ".DRV"); + + /* Append .DRV to name if no extension present */ + if (!(p = strrchr(drvName, '.')) || strchr(p, '/') || strchr(p, '\\')) + strcat(drvName, ".DRV"); + hInst = LoadLibrary16(drvName); + HeapFree(GetProcessHeap(), 0, drvName); }