From 36ab591ec76b0afe06072fb75ad84f2f43f0600a Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 12 Aug 2005 21:04:45 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'release2_2'. --- pyparallel/src/win32/simpleio.c | 47 ----------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 pyparallel/src/win32/simpleio.c (limited to 'pyparallel/src/win32/simpleio.c') diff --git a/pyparallel/src/win32/simpleio.c b/pyparallel/src/win32/simpleio.c deleted file mode 100644 index 793cfac..0000000 --- a/pyparallel/src/win32/simpleio.c +++ /dev/null @@ -1,47 +0,0 @@ -// Parallel port extension for Win32 -// "inp" and "outp" are used to access the parallelport hardware -// needs giveio.sys driver on NT/2k/XP -// -// (C) 2005 Chris Liechti -// this is distributed under a free software license, see license.txt - -#include -#include - -#define DRIVERNAME "\\\\.\\giveio" - -/* module-functions */ - -WINAPI void outp(int port, int value) { - _outp(port, value); -} - -WINAPI int inp(int port) { - int value; - value = _inp(port); - return value; -} - -WINAPI int init(void) { - OSVERSIONINFO vi; - - //detect OS, on NT,2k,XP the driver needs to be loaded - vi.dwOSVersionInfoSize = sizeof(vi); - GetVersionEx(&vi); - if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT) { - HANDLE h; - //try to open driver - h = CreateFile(DRIVERNAME, GENERIC_READ, 0, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (h == INVALID_HANDLE_VALUE) { - //if it fails again, then we have a problem... -> exception - //"Couldn't access giveio device"; - return 1; - } - //close again immediately. - //the process is now tagged to have the rights it needs, - //the giveio driver remembers that - if (h != NULL) CloseHandle(h); //close the driver's file - } - return 0; -} -- cgit v1.2.1