Append .DRV to name only if no extension present.

This commit is contained in:
Dmitry Timoshkov 2000-08-18 23:43:37 +00:00 committed by Alexandre Julliard
parent 7d64d7d1d7
commit 5138a35295
1 changed files with 7 additions and 2 deletions

View File

@ -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); strcpy(drvName, pszDriver);
/* Append .DRV to name if no extension present */
if (!(p = strrchr(drvName, '.')) || strchr(p, '/') || strchr(p, '\\'))
strcat(drvName, ".DRV"); strcat(drvName, ".DRV");
hInst = LoadLibrary16(drvName); hInst = LoadLibrary16(drvName);
HeapFree(GetProcessHeap(), 0, drvName);
} }