diff options
Diffstat (limited to 'vidix/dhahelperwin')
-rw-r--r-- | vidix/dhahelperwin/NMAKEFILE | 7 | ||||
-rw-r--r-- | vidix/dhahelperwin/SOURCES | 6 | ||||
-rw-r--r-- | vidix/dhahelperwin/common.ver | 207 | ||||
-rw-r--r-- | vidix/dhahelperwin/dhahelper.c | 390 | ||||
-rw-r--r-- | vidix/dhahelperwin/dhahelper.h | 72 | ||||
-rw-r--r-- | vidix/dhahelperwin/dhahelper.rc | 35 | ||||
-rw-r--r-- | vidix/dhahelperwin/dhasetup.c | 116 | ||||
-rw-r--r-- | vidix/dhahelperwin/ntverp.h | 156 |
8 files changed, 0 insertions, 989 deletions
diff --git a/vidix/dhahelperwin/NMAKEFILE b/vidix/dhahelperwin/NMAKEFILE deleted file mode 100644 index 58189757d6..0000000000 --- a/vidix/dhahelperwin/NMAKEFILE +++ /dev/null @@ -1,7 +0,0 @@ -# -# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source -# file to this component. This file merely indirects to the real make file -# that is shared by all the driver components of the Windows NT DDK -# - -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/vidix/dhahelperwin/SOURCES b/vidix/dhahelperwin/SOURCES deleted file mode 100644 index c1adcc37f4..0000000000 --- a/vidix/dhahelperwin/SOURCES +++ /dev/null @@ -1,6 +0,0 @@ -TARGETNAME=dhahelper -TARGETPATH=. -TARGETTYPE=DRIVER -NTDEBUG=ntsd - -SOURCES= dhahelper.c dhahelper.rc diff --git a/vidix/dhahelperwin/common.ver b/vidix/dhahelperwin/common.ver deleted file mode 100644 index 3295b44320..0000000000 --- a/vidix/dhahelperwin/common.ver +++ /dev/null @@ -1,207 +0,0 @@ -/*
- * PROJECT: ReactOS
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: include/psdk/common.ver
- * PURPOSE: Common Version File.
- * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
- */
-
-//
-// Copyright Year
-//
-#ifndef VER_LEGALCOPYRIGHT_YEARS
-#define VER_LEGALCOPYRIGHT_YEARS "2007"
-#endif
-
-//
-// Copyright String
-//
-#ifndef VER_LEGALCOPYRIGHT_STR
-#if defined(RC_INVOKED) && !defined(WIN16)
-#define VER_LEGALCOPYRIGHT_STR L"\251 ReactOS Foundation. All rights reserved."
-#else
-#define VER_LEGALCOPYRIGHT_STR "Copyright (c) ReactOS Foundation. All rights reserved."
-#endif
-#endif
-
-//
-// Product Name String
-//
-#ifndef VER_PRODUCTNAME_STR
-#ifdef RC_INVOKED
-#define VER_PRODUCTNAME_STR L"ReactOS\256 Operating System"
-#else
-#define VER_PRODUCTNAME_STR "ReactOS (R) Operating System"
-#endif
-#endif
-
-//
-// The File Version is the same as the Product Version
-//
-#ifndef VER_FILEVERSION
-#define VER_FILEVERSION VER_PRODUCTVERSION
-#endif
-#ifndef VER_FILEVERSION_STR
-#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR
-#endif
-
-//
-// If no Original Name was given, use the Internal NAme
-//
-#ifndef VER_ORIGINALFILENAME_STR
-#define VER_ORIGINALFILENAME_STR VER_INTERNALNAME_STR
-#endif
-
-//
-// Allow tagging a Build by Machine/Date
-//
-#if defined(__BUILDMACHINE__)
-#if defined(__BUILDDATE__)
-#define B2(x,y) " (" #x "." #y ")"
-#define B1(x,y) B2(x, y)
-#define BUILD_MACHINE_TAG B1(__BUILDMACHINE__, __BUILDDATE__)
-#else
-#define B2(x) " built by: " #x
-#define B1(x) B2(x)
-#define BUILD_MACHINE_TAG B1(__BUILDMACHINE__)
-#endif
-#if defined(__BUILDMACHINE_LEN__)
-#if __BUILDMACHINE_LEN__ >= 25
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG
-#elif __BUILDMACHINE_LEN__ == 24
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 23
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 22
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 21
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 20
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 19
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 18
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 17
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 16
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 15
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 14
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 13
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 12
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 11
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 10
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 9
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 8
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 7
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 6
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 5
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 4
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 3
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 2
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#elif __BUILDMACHINE_LEN__ == 1
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "
-#else
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG
-#endif
-#else
-#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG
-#endif
-#else
-#define BUILD_MACHINE_TAG
-#define BUILD_MACHINE_TAG_PADDED
-#endif
-
-//
-// Set default neutral Unicode Language ID
-//
-#ifndef VER_VERSION_UNICODE_LANG
-#define VER_VERSION_UNICODE_LANG "000004B0"
-#endif
-
-//
-// Set default netural ANSI Language ID
-//
-#ifndef VER_VERSION_ANSI_LANG
-#define VER_VERSION_ANSI_LANG "000004E4"
-#endif
-
-//
-// Set default netural translation ID
-//
-#ifndef VER_VERSION_TRANSLATION
-#define VER_VERSION_TRANSLATION 0x0000, 0x04B0
-#endif
-
-//
-// Make sure the Resource Compiler called us.
-// If so, then build the actual version resource.
-//
-#ifdef RC_INVOKED
-
-VS_VERSION_INFO VERSIONINFO
-FILEVERSION VER_FILEVERSION
-PRODUCTVERSION VER_PRODUCTVERSION
-FILEFLAGSMASK VER_FILEFLAGSMASK
-FILEFLAGS VER_FILEFLAGS
-FILEOS VER_FILEOS
-FILETYPE VER_FILETYPE
-FILESUBTYPE VER_FILESUBTYPE
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK VER_VERSION_UNICODE_LANG
- BEGIN
- VALUE "CompanyName", VER_COMPANYNAME_STR
- VALUE "FileDescription", VER_FILEDESCRIPTION_STR
- VALUE "FileVersion", VER_FILEVERSION_STR BUILD_MACHINE_TAG_PADDED
- VALUE "InternalName", VER_INTERNALNAME_STR
- VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
- VALUE "OriginalFilename",VER_ORIGINALFILENAME_STR
- VALUE "ProductName", VER_PRODUCTNAME_STR
- VALUE "ProductVersion", VER_PRODUCTVERSION_STR
-#ifdef VER_OLESELFREGISTER
- VALUE "OleSelfRegister", "\0"
-#endif
- END
-
-#ifdef VER_ANSICP
- BLOCK VER_VERSION_ANSI_LANG
- BEGIN
- VALUE "CompanyName", VER_COMPANYNAME_STR
- VALUE "FileDescription", VER_FILEDESCRIPTION_STR EXPORT_TAG
- VALUE "FileVersion", VER_FILEVERSION_STR
- VALUE "InternalName", VER_INTERNALNAME_STR
- VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
- VALUE "OriginalFilename",VER_ORIGINALFILENAME_STR
- VALUE "ProductName", VER_PRODUCTNAME_STR
- VALUE "ProductVersion", VER_PRODUCTVERSION_STR
-#ifdef VER_OLESELFREGISTER
- VALUE "OleSelfRegister", "\0"
-#endif
- END
-#endif
- END
-
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", VER_VERSION_TRANSLATION
- END
-END
-
-#endif
diff --git a/vidix/dhahelperwin/dhahelper.c b/vidix/dhahelperwin/dhahelper.c deleted file mode 100644 index 702f3e52c1..0000000000 --- a/vidix/dhahelperwin/dhahelper.c +++ /dev/null @@ -1,390 +0,0 @@ -/* - * direct hardware access under Windows NT/2000/XP - * - * Copyright (c) 2004 Sascha Sommer <saschasommer@freenet.de> - * Patched to compile with MinGW by Kevin Kofler: - * Copyright (c) 2007 Kevin Kofler - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - - -#if defined(_MSC_VER) -#include <ntddk.h> -#ifndef STDCALL -#define STDCALL /* nothing */ -#endif -#elif defined(__MINGW32__) -#include <ddk/ntddk.h> -#define NO_SEH /* FIXME */ -#else -#error Unsupported compiler. This driver requires MSVC+DDK or MinGW to build. -#endif - -#include "dhahelper.h" - -#define OutputDebugString DbgPrint - -#define IOPM_SIZE 0x2000 -typedef char IOPM[IOPM_SIZE]; -static IOPM *pIOPM = NULL; - - - -typedef struct { - PMDL Mdl; - PVOID SystemVirtualAddress; - PVOID UserVirtualAddress; - ULONG PhysMemSizeInBytes; -}alloc_priv; -static alloc_priv* alloclist; -static unsigned int alloccount=0; - - - - - - - -static STDCALL NTSTATUS dhahelperdispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -static STDCALL void dhahelperunload(IN PDRIVER_OBJECT DriverObject); -static STDCALL NTSTATUS UnmapPhysicalMemory(PVOID UserVirtualAddress); -static STDCALL NTSTATUS MapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,ULONG PhysMemSizeInBytes,PVOID *PhysMemLin); - -void STDCALL Ke386SetIoAccessMap(int, IOPM *); -void STDCALL Ke386QueryIoAccessMap(int, IOPM *); -void STDCALL Ke386IoSetAccessProcess(PEPROCESS, int); - - - - -//entry point -STDCALL NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING RegistryPath){ - UNICODE_STRING DeviceNameUnicodeString; - UNICODE_STRING DeviceLinkUnicodeString; - NTSTATUS ntStatus; - PDEVICE_OBJECT DeviceObject = NULL; - - OutputDebugString ("dhahelper: entering DriverEntry"); - - RtlInitUnicodeString (&DeviceNameUnicodeString, L"\\Device\\DHAHELPER"); - - // Create an EXCLUSIVE device object (only 1 thread at a time - // can make requests to this device). - - ntStatus = IoCreateDevice(DriverObject,0,&DeviceNameUnicodeString,FILE_DEVICE_DHAHELPER,0,TRUE,&DeviceObject); - - if (NT_SUCCESS(ntStatus)){ - // Create dispatch points for device control, create, close. - DriverObject->MajorFunction[IRP_MJ_CREATE] = - DriverObject->MajorFunction[IRP_MJ_CLOSE] = - DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = dhahelperdispatch; - DriverObject->DriverUnload = dhahelperunload; - - // Create a symbolic link, e.g. a name that a Win32 app can specify - // to open the device. - - RtlInitUnicodeString (&DeviceLinkUnicodeString, L"\\DosDevices\\DHAHELPER"); - - ntStatus = IoCreateSymbolicLink(&DeviceLinkUnicodeString,&DeviceNameUnicodeString); - - if (!NT_SUCCESS(ntStatus)){ - // Symbolic link creation failed- note this & then delete the - // device object (it's useless if a Win32 app can't get at it). - OutputDebugString ("dhahelper: IoCreateSymbolicLink failed"); - IoDeleteDevice (DeviceObject); - } - } - else{ - OutputDebugString ("dhahelper: IoCreateDevice failed"); - } - OutputDebugString ("dhahelper: leaving DriverEntry"); - return ntStatus; -} - - -// Process the IRPs sent to this device - -static STDCALL NTSTATUS dhahelperdispatch(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp){ - PIO_STACK_LOCATION IrpStack; - ULONG dwInputBufferLength; - ULONG dwOutputBufferLength; - ULONG dwIoControlCode; - PVOID pvIOBuffer; - NTSTATUS ntStatus; - dhahelper_t dhahelper_priv; - - OutputDebugString ("dhahelper: entering dhahelperdispatch"); - - // Init to default settings - - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - - IrpStack = IoGetCurrentIrpStackLocation(Irp); - - // Get the pointer to the input/output buffer and it's length - - pvIOBuffer = Irp->AssociatedIrp.SystemBuffer; - dwInputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength; - dwOutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength; - - switch (IrpStack->MajorFunction){ - case IRP_MJ_CREATE: - OutputDebugString("dhahelper: IRP_MJ_CREATE"); - break; - case IRP_MJ_CLOSE: - OutputDebugString("dhahelper: IRP_MJ_CLOSE"); - break; - case IRP_MJ_DEVICE_CONTROL: - OutputDebugString("dhahelper: IRP_MJ_DEVICE_CONTROL"); - dwIoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode; - switch (dwIoControlCode){ - case IOCTL_DHAHELPER_ENABLEDIRECTIO: - OutputDebugString("dhahelper: IOCTL_DHAHELPER_ENABLEDIRECTIO"); - pIOPM = MmAllocateNonCachedMemory(sizeof(IOPM)); - if (pIOPM){ - RtlZeroMemory(pIOPM, sizeof(IOPM)); - Ke386IoSetAccessProcess(PsGetCurrentProcess(), 1); - Ke386SetIoAccessMap(1, pIOPM); - } - else Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - break; - case IOCTL_DHAHELPER_DISABLEDIRECTIO: - OutputDebugString("dhahelper: IOCTL_DHAHELPER_DISABLEDIRECTIO"); - if (pIOPM){ - Ke386IoSetAccessProcess(PsGetCurrentProcess(), 0); - Ke386SetIoAccessMap(1, pIOPM); - MmFreeNonCachedMemory(pIOPM, sizeof(IOPM)); - pIOPM = NULL; - } - break; - case IOCTL_DHAHELPER_MAPPHYSTOLIN: - OutputDebugString("dhahelper: IOCTL_DHAHELPER_MAPPHYSTOLIN"); - if (dwInputBufferLength){ - memcpy (&dhahelper_priv, pvIOBuffer, dwInputBufferLength); - ntStatus = MapPhysicalMemoryToLinearSpace(dhahelper_priv.base,dhahelper_priv.size,&dhahelper_priv.ptr); - if (NT_SUCCESS(ntStatus)){ - memcpy (pvIOBuffer, &dhahelper_priv, dwInputBufferLength); - Irp->IoStatus.Information = dwInputBufferLength; - } - Irp->IoStatus.Status = ntStatus; - } - else Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - break; - case IOCTL_DHAHELPER_UNMAPPHYSADDR: - OutputDebugString("dhahelper: IOCTL_DHAHELPER_UNMAPPHYSADDR"); - if (dwInputBufferLength){ - memcpy (&dhahelper_priv, pvIOBuffer, dwInputBufferLength); - ntStatus = UnmapPhysicalMemory(dhahelper_priv.ptr); - Irp->IoStatus.Status = ntStatus; - } - else - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - break; - default: - OutputDebugString("dhahelper: unknown IRP_MJ_DEVICE_CONTROL"); - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - break; - } - break; - } - - // DON'T get cute and try to use the status field of the irp in the - // return status. That IRP IS GONE as soon as you call IoCompleteRequest. - - ntStatus = Irp->IoStatus.Status; - - IoCompleteRequest (Irp, IO_NO_INCREMENT); - - // We never have pending operation so always return the status code. - - OutputDebugString("dhahelper: leaving dhahelperdispatch"); - - return ntStatus; -} - -// Delete the associated device and return - -static STDCALL void dhahelperunload(IN PDRIVER_OBJECT DriverObject){ - UNICODE_STRING DeviceLinkUnicodeString; - NTSTATUS ntStatus=STATUS_SUCCESS; - OutputDebugString ("dhahelper: entering dhahelperunload"); - OutputDebugString ("dhahelper: unmapping remaining memory"); - - while(alloccount && (ntStatus==STATUS_SUCCESS))ntStatus = UnmapPhysicalMemory(alloclist[alloccount-1].UserVirtualAddress); - RtlInitUnicodeString (&DeviceLinkUnicodeString, L"\\DosDevices\\DHAHELPER"); - ntStatus = IoDeleteSymbolicLink (&DeviceLinkUnicodeString); - - if (NT_SUCCESS(ntStatus)){ - IoDeleteDevice (DriverObject->DeviceObject); - } - else { - OutputDebugString ("dhahelper: IoDeleteSymbolicLink failed"); - } - OutputDebugString ("dhahelper: leaving dhahelperunload"); -} - - - - - - -/************************* memory mapping functions ******************************/ -//unlike the functions of other io helpers these functions allow to map adapter memory on windows xp -//even if it has alread been mapped by the original driver -//the technique used is described in -//http://support.microsoft.com/default.aspx?scid=kb;en-us;q189327 -//furthermore it keeps a list of mapped areas to free them when the driver gets unloaded -//I'm not sure what the limitations of ZwMapViewOfSection are but mapping 128MB videoram (that is probably already mapped by the gfxcard driver) -//won't work so it is generally a good idea to map only the memory you really need - -static STDCALL NTSTATUS MapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,ULONG PhysMemSizeInBytes,PVOID *PhysMemLin){ - alloc_priv* alloclisttmp; - PMDL Mdl=NULL; - PVOID SystemVirtualAddress=NULL; - PVOID UserVirtualAddress=NULL; - PHYSICAL_ADDRESS pStartPhysAddress; - OutputDebugString ("dhahelper: entering MapPhysicalMemoryToLinearSpace"); - -#ifdef _WIN64 - pStartPhysAddress.QuadPart = (ULONGLONG)pPhysAddress; -#else - pStartPhysAddress.QuadPart = (ULONGLONG)(ULONG)pPhysAddress; -#endif -#ifndef NO_SEH - __try { -#endif - SystemVirtualAddress=MmMapIoSpace(pStartPhysAddress,PhysMemSizeInBytes, /*MmWriteCombined*/MmNonCached); - if(!SystemVirtualAddress){ - OutputDebugString("dhahelper: MmMapIoSpace failed"); - return STATUS_INVALID_PARAMETER; - } - OutputDebugString("dhahelper: SystemVirtualAddress 0x%x",SystemVirtualAddress); - Mdl=IoAllocateMdl(SystemVirtualAddress, PhysMemSizeInBytes, FALSE, FALSE,NULL); - if(!Mdl){ - OutputDebugString("dhahelper: IoAllocateMdl failed"); - return STATUS_INSUFFICIENT_RESOURCES; - } - OutputDebugString("dhahelper: Mdl 0x%x",Mdl); - MmBuildMdlForNonPagedPool(Mdl); -#ifdef _WIN64 - UserVirtualAddress = (PVOID)(((ULONGLONG)PAGE_ALIGN(MmMapLockedPages(Mdl,UserMode))) + MmGetMdlByteOffset(Mdl)); -#else - UserVirtualAddress = (PVOID)(((ULONG)PAGE_ALIGN(MmMapLockedPages(Mdl,UserMode))) + MmGetMdlByteOffset(Mdl)); -#endif - if(!UserVirtualAddress){ - OutputDebugString("dhahelper: MmMapLockedPages failed"); - return STATUS_INSUFFICIENT_RESOURCES; - } - OutputDebugString("dhahelper: UserVirtualAddress 0x%x",UserVirtualAddress); -#ifndef NO_SEH - }__except(EXCEPTION_EXECUTE_HANDLER){ - NTSTATUS ntStatus; - ntStatus = GetExceptionCode(); - OutputDebugString("dhahelper: MapPhysicalMemoryToLinearSpace failed due to exception 0x%0x\n", ntStatus); - return ntStatus; - } -#endif - - - OutputDebugString("dhahelper: adding data to internal allocation list"); - alloclisttmp=MmAllocateNonCachedMemory((alloccount+1)*sizeof(alloc_priv)); - - - if(!alloclisttmp){ - OutputDebugString("dhahelper: not enough memory to create temporary allocation list"); - MmUnmapLockedPages(UserVirtualAddress, Mdl); - IoFreeMdl(Mdl); - return STATUS_INSUFFICIENT_RESOURCES; - } - if(alloccount){ - memcpy(alloclisttmp,alloclist,alloccount * sizeof(alloc_priv)); - MmFreeNonCachedMemory(alloclist,alloccount*sizeof(alloc_priv)); - } - alloclist=alloclisttmp; - alloclist[alloccount].Mdl=Mdl; - alloclist[alloccount].SystemVirtualAddress=SystemVirtualAddress; - alloclist[alloccount].UserVirtualAddress=UserVirtualAddress; - alloclist[alloccount].PhysMemSizeInBytes=PhysMemSizeInBytes; - ++alloccount; - - *PhysMemLin=UserVirtualAddress; - - OutputDebugString("dhahelper: leaving MapPhysicalMemoryToLinearSpace"); - return STATUS_SUCCESS; -} - -static STDCALL NTSTATUS UnmapPhysicalMemory(PVOID UserVirtualAddress){ - unsigned int i; - unsigned int x=0; - unsigned int alloccounttmp=alloccount; - OutputDebugString("dhahelper: entering UnmapPhysicalMemory to unmapp 0x%x",UserVirtualAddress); - if(!alloccount){ - OutputDebugString("dhahelper: UnmapPhysicalMemory: nothing todo -> leaving..."); - return STATUS_SUCCESS; - } - - for(i=0;i<alloccount;i++){ - if(alloclist[i].UserVirtualAddress!=UserVirtualAddress){ - if(x!=i){ - alloclist[x].Mdl=alloclist[i].Mdl; - alloclist[x].SystemVirtualAddress=alloclist[i].SystemVirtualAddress; - alloclist[x].UserVirtualAddress=alloclist[i].UserVirtualAddress; - alloclist[x].PhysMemSizeInBytes=alloclist[i].PhysMemSizeInBytes; - - } - x++; - } - else if(alloclist[i].UserVirtualAddress==UserVirtualAddress){ - if(x==i){ -#ifndef NO_SEH - __try { -#endif - MmUnmapLockedPages(alloclist[x].UserVirtualAddress, alloclist[x].Mdl); - IoFreeMdl(alloclist[x].Mdl); - MmUnmapIoSpace(alloclist[x].SystemVirtualAddress,alloclist[x].PhysMemSizeInBytes); -#ifndef NO_SEH - }__except(EXCEPTION_EXECUTE_HANDLER){ - NTSTATUS ntStatus; - ntStatus = GetExceptionCode(); - OutputDebugString("dhahelper: UnmapPhysicalMemory failed due to exception 0x%0x (Mdl 0x%x)\n", ntStatus,alloclist[x].Mdl); - return ntStatus; - } -#endif - } - alloccounttmp--; - } - - } - - if(alloccounttmp){ - alloc_priv* alloclisttmp; - alloclisttmp=MmAllocateNonCachedMemory(alloccounttmp*sizeof(alloc_priv)); - if(!alloclisttmp){ - OutputDebugString("dhahelper: not enough memory to create temporary allocation list"); - return STATUS_INSUFFICIENT_RESOURCES; - } - memcpy(alloclisttmp,alloclist,alloccounttmp * sizeof(alloc_priv)); - MmFreeNonCachedMemory(alloclist,alloccount*sizeof(alloc_priv)); - alloclist=alloclisttmp; - } - alloccount=alloccounttmp; - - OutputDebugString("dhahelper: leaving UnmapPhysicalMemory"); - return STATUS_SUCCESS; -} diff --git a/vidix/dhahelperwin/dhahelper.h b/vidix/dhahelperwin/dhahelper.h deleted file mode 100644 index a41880a97d..0000000000 --- a/vidix/dhahelperwin/dhahelper.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * direct hardware access under Windows NT/2000/XP - * - * Copyright (c) 2004 Sascha Sommer <saschasommer@freenet.de> - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_DHAHELPER_H -#define MPLAYER_DHAHELPER_H - -// Define the various device type values. Note that values used by Microsoft -// Corporation are in the range 0-32767, and 32768-65535 are reserved for use -// by customers. - -#define FILE_DEVICE_DHAHELPER 0x00008011 - -// Macro definition for defining IOCTL and FSCTL function control codes. -// Note that function codes 0-2047 are reserved for Microsoft Corporation, -// and 2048-4095 are reserved for customers. - -#define DHAHELPER_IOCTL_INDEX 0x810 - -#define IOCTL_DHAHELPER_MAPPHYSTOLIN CTL_CODE(FILE_DEVICE_DHAHELPER, \ - DHAHELPER_IOCTL_INDEX, \ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - -#define IOCTL_DHAHELPER_UNMAPPHYSADDR CTL_CODE(FILE_DEVICE_DHAHELPER, \ - DHAHELPER_IOCTL_INDEX + 1, \ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - -#define IOCTL_DHAHELPER_ENABLEDIRECTIO CTL_CODE(FILE_DEVICE_DHAHELPER, \ - DHAHELPER_IOCTL_INDEX + 2, \ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - -#define IOCTL_DHAHELPER_DISABLEDIRECTIO CTL_CODE(FILE_DEVICE_DHAHELPER, \ - DHAHELPER_IOCTL_INDEX + 3, \ - METHOD_BUFFERED, \ - FILE_ANY_ACCESS) - - -#if !defined(__MINGW32__) && !defined(__CYGWIN__) -#pragma pack(1) -typedef struct dhahelper_t { -#else -struct __attribute__((__packed__)) dhahelper_t { -#endif - unsigned int size; - void* base; - void* ptr; -}; - -typedef struct dhahelper_t dhahelper_t; - -#endif /* MPLAYER_DHAHELPER_H */ diff --git a/vidix/dhahelperwin/dhahelper.rc b/vidix/dhahelperwin/dhahelper.rc deleted file mode 100644 index 1869a57a4e..0000000000 --- a/vidix/dhahelperwin/dhahelper.rc +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <windows.h> - -#include <ntverp.h> - -#undef VER_COMPANYNAME_STR -#undef VER_PRODUCTNAME_STR - -#define VER_FILETYPE VFT_DRV -#define VER_FILESUBTYPE VFT2_DRV_SYSTEM -#define VER_FILEDESCRIPTION_STR "DhaHelper - Direct HardWare Access Driver" -#define VER_INTERNALNAME_STR "DhaHelper.sys" -#define VER_ORIGINALFILENAME_STR "DhaHelper.sys" -#define VER_LEGALCOPYRIGHT_STR "Sascha Sommer" -#define VER_COMPANYNAME_STR "MPlayer <http://svn.mplayerhq.hu/mplayer/trunk/vidix/dhahelperwin/>" -#define VER_PRODUCTNAME_STR "DhaHelper Driver V1.0" - -#include "common.ver" diff --git a/vidix/dhahelperwin/dhasetup.c b/vidix/dhahelperwin/dhasetup.c deleted file mode 100644 index 8642fa490c..0000000000 --- a/vidix/dhahelperwin/dhasetup.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * dhasetup - dhahelper setup program - * - * Copyright (c) 2004 - 2007 Sascha Sommer (MPlayer) - * - * some parts from dhasetup.c source code - * http://svn.tilp.info/cgi-bin/viewcvs.cgi/libticables/trunk/src/win32/dha/ - * - * Copyright (C) 2007 Romain Lievin (tilp) - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <windows.h> -#include <stdio.h> -#include <winioctl.h> - -static void print_last_error(char *s){ - LPTSTR lpMsgBuf; - - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) & lpMsgBuf, 0, NULL); - if(strlen(lpMsgBuf) >= 2) - lpMsgBuf[strlen(lpMsgBuf)-2] = 0; - - printf("%s (%i -> %s)\n", s, GetLastError(), lpMsgBuf); - LocalFree(lpMsgBuf); -} - -int main(int argc,char* argv[]){ - SC_HANDLE hSCManager = NULL; - SC_HANDLE hService = NULL; - char path[MAX_PATH]; - printf("dhasetup (c) 2004 Sascha Sommer\n"); - GetWindowsDirectory(path,MAX_PATH); - strcpy(path+strlen(path),"\\system32\\drivers\\dhahelper.sys"); - if(argc==1){ - printf("Usage:\n"); - printf("dhasetup install - Copies dhahelper.sys from the current directory to\n%s and configures it to start at boot.\n", path); - printf("dhasetup remove - Removes the dhahelper utility.\n"); - return 0; - } - hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if(!strcmp(argv[1],"install")){ - printf("Installing dhahelper..."); - if(!CopyFile("dhahelper.sys",path,FALSE)){ - printf("Copying dhahelper.sys failed.\nEither dhahelper.sys is not in the current directory or you lack sufficient\nprivileges to write to %s.", path); - return 1; - } - // Install the driver - hService = CreateService(hSCManager, - "DHAHELPER", - "DHAHELPER", - SERVICE_ALL_ACCESS, - SERVICE_KERNEL_DRIVER, - SERVICE_SYSTEM_START, - SERVICE_ERROR_NORMAL, - path, - NULL, - NULL, - NULL, - NULL, - NULL); - if(!hService){ - print_last_error("Unable to register DhaHelper Service"); - return 1; - } - - if(!StartService(hService, 0, NULL)){ - print_last_error("Error while starting service"); - return 1; - } - - printf("Success!\n"); - } - else if(!strcmp(argv[1],"remove")){ - SERVICE_STATUS ServiceStatus; - - printf("Removing dhahelper... "); - hService = OpenService(hSCManager, "DHAHELPER", SERVICE_ALL_ACCESS); - if(!hService){ - print_last_error("Error opening dhahelper service"); - return 1; - } - if(!ControlService(hService, SERVICE_CONTROL_STOP, &ServiceStatus)) - print_last_error("Error while stopping service"); - if(!DeleteService(hService)) - print_last_error("Error while deleting service"); - DeleteFile(path); - printf("Done!\n"); - } - else { - printf("unknown parameter: %s\n",argv[1]); - } - CloseServiceHandle(hService); - CloseServiceHandle(hSCManager); - return 0; -} diff --git a/vidix/dhahelperwin/ntverp.h b/vidix/dhahelperwin/ntverp.h deleted file mode 100644 index 5d94e60573..0000000000 --- a/vidix/dhahelperwin/ntverp.h +++ /dev/null @@ -1,156 +0,0 @@ -/*
- * PROJECT: ReactOS
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: include/psdk/ntverp.h
- * PURPOSE: Master Version File.
- * This file should be modified only by the official builder
- * to update VERSION, VER_PRODUCTVERSION, VER_PRODUCTVERSION_
- * STR and VER_PRODUCTBETA_STR values.
- * The VER_PRODUCTBUILD lines must contain the product
- * comments and end with the build#<CR><LF>.
- * The VER_PRODUCTBETA_STR lines must contain the product
- * comments and end with "somestring"<CR><LF.
- * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
- */
-
-#ifndef MPLAYER_NTVERP_H
-#define MPLAYER_NTVERP_H
-
-//
-// Windows NT Build 3790.1830
-//
-#define VER_PRODUCTBUILD 3790
-#define VER_PRODUCTBUILD_QFE 1830
-
-//
-// Windows NT Version 5.2
-//
-#define VER_PRODUCTMAJORVERSION 5
-#define VER_PRODUCTMINORVERSION 2
-#define VER_PRODUCTVERSION_W (0x0502)
-#define VER_PRODUCTVERSION_DW (0x05020000 | VER_PRODUCTBUILD)
-
-//
-// Not a beta
-//
-#define VER_PRODUCTBETA_STR ""
-
-//
-// ANSI String Generating Macros
-//
-#define VER_PRODUCTVERSION_MAJORMINOR2(x,y) \
- #x "." #y
-#define VER_PRODUCTVERSION_MAJORMINOR1(x,y) \
- VER_PRODUCTVERSION_MAJORMINOR2(x, y)
-#define VER_PRODUCTVERSION_STRING \
- VER_PRODUCTVERSION_MAJORMINOR1(VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION)
-
-//
-// Unicode String Generating Macros
-//
-#define LVER_PRODUCTVERSION_MAJORMINOR2(x,y)\
- L#x L"." L#y
-#define LVER_PRODUCTVERSION_MAJORMINOR1(x,y)\
- LVER_PRODUCTVERSION_MAJORMINOR2(x, y)
-#define LVER_PRODUCTVERSION_STRING \
- LVER_PRODUCTVERSION_MAJORMINOR1(VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION)
-
-//
-// Full Product Version
-//
-#define VER_PRODUCTVERSION |