Mercurial > mplayer.hg
annotate vidix/sysdep/pci_win32.c @ 24436:c1b98b43b897
Fix off-by-one error if fsize is odd (does handling that case even make sense?)
and remove a TODO comment that no longer applies.
author | reimar |
---|---|
date | Fri, 14 Sep 2007 12:52:13 +0000 |
parents | a9e111b88c4a |
children | 9c4ad35fabc5 |
rev | line source |
---|---|
4164 | 1 /* |
2 This file is based on: | |
3 $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ | |
4 Modified for readability by Nick Kurshev | |
5 */ | |
6 #include <windows.h> | |
12056 | 7 #include <ddk/ntddk.h> |
8 #include "../dhahelperwin/dhahelper.h" | |
4164 | 9 |
12056 | 10 static HANDLE hDriver; |
11 extern int IsWinNT(); | |
12 | |
13 | |
14 | |
15 | |
4164 | 16 |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
17 static __inline__ int enable_os_io(void) |
4164 | 18 { |
12056 | 19 if(IsWinNT()){ |
20 DWORD dwBytesReturned; | |
21 hDriver = CreateFile("\\\\.\\DHAHELPER",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); | |
22 if(!DeviceIoControl(hDriver, IOCTL_DHAHELPER_ENABLEDIRECTIO, NULL,0, NULL, 0, &dwBytesReturned, NULL)){ | |
17971 | 23 fprintf(stderr,"Unable to enable directio please install dhahelper.sys.\n"); |
12056 | 24 return(1); |
25 } | |
26 } | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
27 return(0); |
4164 | 28 } |
29 | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
30 static __inline__ int disable_os_io(void) |
4164 | 31 { |
12056 | 32 if(IsWinNT()){ |
33 DWORD dwBytesReturned; | |
34 DeviceIoControl(hDriver, IOCTL_DHAHELPER_DISABLEDIRECTIO, NULL,0, NULL, 0, &dwBytesReturned, NULL); | |
35 CloseHandle(hDriver); | |
36 } | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
37 return(0); |
4164 | 38 } |