From: Rolf K. <lab...@us...> - 2008-11-15 21:53:22
|
Update of /cvsroot/opengtoolkit/portIO/c_source In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv918/c_source Modified Files: ogportiodll.c Log Message: Remove the kernel driver from the system directory on uninstallation. Index: ogportiodll.c =================================================================== RCS file: /cvsroot/opengtoolkit/portIO/c_source/ogportiodll.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ogportiodll.c 20 Nov 2007 14:35:26 -0000 1.6 --- ogportiodll.c 15 Nov 2008 21:53:13 -0000 1.7 *************** *** 126,129 **** --- 126,131 ---- } + static CHAR filename[] = "OGPortIO.sys"; + static DWORD InstallPortIODriver(SC_HANDLE hSCManager, BOOL autostart) { *************** *** 132,136 **** CHAR systemFileName[MAX_PATH]; CHAR driverFileName[MAX_PATH]; - static CHAR filename[] = "OGPortIO.sys"; /* GetSystemDirectory. Assumes OGPortIO.sys driver is in this directory. --- 134,137 ---- *************** *** 199,202 **** --- 200,204 ---- SC_HANDLE hSCManager; SC_HANDLE hService; + CHAR systemFileName[MAX_PATH]; BOOL ret; DWORD err = ERROR_SUCCESS; *************** *** 246,249 **** --- 248,261 ---- CloseServiceHandle (hService); CloseServiceHandle(hSCManager); + + if (!GetSystemDirectory(systemFileName, MAX_PATH - 22)) + { + return GetLastError(); + } + + /* Append our driver name */ + PathAppend(systemFileName, "drivers"); + PathAppend(systemFileName, filename); + DeleteFile(systemFileName); } return err; *************** *** 576,580 **** { DWORD BytesReturned, err = ERROR_SUCCESS; ! MEMMAP param; if (!gWinNT) --- 588,592 ---- { DWORD BytesReturned, err = ERROR_SUCCESS; ! PMEMMAP param = NULL; if (!gWinNT) *************** *** 588,596 **** if (err) return err; } ! param.address = address; ! param.size = size; ! param.unit = unit; ! memcpy(param.buf, value, size); if (!DeviceIoControl(hDevice, IOCTL_WRITE_PHYSMEM, --- 600,611 ---- if (err) return err; } + param = malloc(sizeof(MEMMAP) + size); + if (!param) + return ERROR_NOT_ENOUGH_MEMORY; ! param->address = address; ! param->size = size; ! param->unit = unit; ! memcpy(param->buf, value, size); if (!DeviceIoControl(hDevice, IOCTL_WRITE_PHYSMEM, *************** *** 604,607 **** --- 619,623 ---- err = GetLastError(); } + free(param); return err; } |