Merge to trunk head (r46631)

svn path=/branches/reactos-yarotows/; revision=46633
This commit is contained in:
Timo Kreuzer 2010-04-01 02:52:00 +00:00
commit 49d7aed889
286 changed files with 48255 additions and 8326 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="makefile-amd64.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
<project name="ReactOS" makefile="makefile-amd64.auto" xmlns:xi="http://www.w3.org/2001/XInclude" allowwarnings="true">
<xi:include href="config-amd64.rbuild">
<xi:fallback>
<xi:include href="config-amd64.template.rbuild" />
@ -28,12 +28,14 @@
<compilerflag>-ftracer</compilerflag>
<compilerflag>-momit-leaf-frame-pointer</compilerflag>
</if>
<compilerflag>-fms-extensions</compilerflag>
<compilerflag>-mpreferred-stack-boundary=4</compilerflag>
<compilerflag compiler="midl">-m64 --win64</compilerflag>
<!-- compilerflag compiler="cc,cxx">-gstabs+</compilerflag -->
<!-- compilerflag compiler="as">-gstabs+</compilerflag -->
<compilerflag>-U_X86_</compilerflag>
<compilerflag>-Wno-format</compilerflag>
<compilerflag>-fno-leading-underscore</compilerflag>
</group>
<group linkerset="ld">

View file

@ -9,9 +9,12 @@
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */
#define _TIMEZONE_DEFINED
struct timezone {
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
int tz_minuteswest;
int tz_dsttime;
};
int gettimeofday(struct timeval *tv, struct timezone *tz);
extern int __cdecl gettimeofday (struct timeval *p, struct timezone *z);
#endif

View file

@ -4,19 +4,9 @@
<include base="ftp">.</include>
<define name="lint" />
<!-- FIXME: workarounds until we have a proper oldnames library -->
<define name="chdir">_chdir</define>
<define name="getcwd">_getcwd</define>
<define name="mktemp">_mktemp</define>
<define name="unlink">_unlink</define>
<define name="close">_close</define>
<define name="fileno">_fileno</define>
<define name="read">_read</define>
<define name="write">_write</define>
<define name="lseek">_lseek</define>
<library>ws2_32</library>
<library>iphlpapi</library>
<library>oldnames</library>
<file>cmds.c</file>
<file>cmdtab.c</file>
<file>domacro.c</file>

View file

@ -4,16 +4,11 @@
<include base="dhcp">.</include>
<include base="dhcp">include</include>
<!-- FIXME: workarounds until we have a proper oldnames library -->
<define name="tzset">_tzset</define>
<define name="close">_close</define>
<define name="read">_read</define>
<define name="write">_write</define>
<library>ntdll</library>
<library>ws2_32</library>
<library>iphlpapi</library>
<library>advapi32</library>
<library>oldnames</library>
<file>adapter.c</file>
<file>alloc.c</file>
<file>api.c</file>

View file

@ -24,6 +24,7 @@
<property name="BASEADDRESS_PSTOREC" value="0x513d0000" />
<property name="BASEADDRESS_LPK" value="0x516c0000" />
<property name="BASEADDRESS_MSGSM32ACM" value="0x56db0000" />
<property name="BASEADDRESS_MSDVBNP" value="0x58280000" />
<property name="BASEADDRESS_MSG711ACM" value="0x584f0000" />
<property name="BASEADDRESS_IMAADP32ACM" value="0x585e0000" />
<property name="BASEADDRESS_BDAPLGIN" value="0x58600000" />
@ -32,6 +33,7 @@
<property name="BASEADDRESS_MMSYS" value="0x588a0000" />
<property name="BASEADDRESS_JOY" value="0x589b0000" />
<property name="BASEADDRESS_QMGR" value="0x59620000" />
<property name="BASEADDRESS_MSVIDCTL" value="0x59660000" />
<property name="BASEADDRESS_UXTHEME" value="0x5ad70000" />
<property name="BASEADDRESS_VDMDBG" value="0x5b0d0000" />
<property name="BASEADDRESS_UNTFS" value="0x5b340000" />

View file

@ -151,6 +151,7 @@ dll\cpl\timedate\timedate.cpl 1
;dll\cpl\usrmgr\usrmgr.cpl 1
dll\directx\amstream\amstream.dll 1
dll\directx\bdaplgin\bdaplgin.ax 1
dll\directx\dinput\dinput.dll 1
dll\directx\dinput8\dinput8.dll 1
dll\directx\dmusic\dmusic.dll 1
@ -164,6 +165,8 @@ dll\directx\devenum\devenum.dll 1
dll\directx\ksproxy\ksproxy.ax 1
dll\directx\ksuser\ksuser.dll 1
dll\directx\msdmo\msdmo.dll 1
dll\directx\msdvbnp\msdvbnp.ax 1
dll\directx\msvidctl\msvidctl.dll 1
dll\directx\quartz\quartz.dll 1
dll\directx\qedit\qedit.dll 1
dll\directx\wine\d3d8\d3d8.dll 1
@ -502,6 +505,7 @@ drivers\input\mouclass\mouclass.sys 2
drivers\input\sermouse\sermouse.sys 2
drivers\ksfilter\ks\ks.sys 2
drivers\multimedia\bdasup\bdasup.sys 2
drivers\network\afd\afd.sys 2
drivers\network\ndis\ndis.sys 2

View file

@ -385,7 +385,7 @@ SpiCreatePortConfig(
}
VOID
DDKCDECLAPI
__cdecl
ScsiDebugPrint(
IN ULONG DebugPrintLevel,
IN PCCHAR DebugMessage,
@ -421,7 +421,7 @@ ScsiDebugPrint(
}
VOID
DDKAPI
NTAPI
ScsiPortCompleteRequest(
IN PVOID HwDeviceExtension,
IN UCHAR PathId,
@ -435,7 +435,7 @@ ScsiPortCompleteRequest(
#undef ScsiPortConvertPhysicalAddressToUlong
ULONG
DDKAPI
NTAPI
ScsiPortConvertPhysicalAddressToUlong(
IN SCSI_PHYSICAL_ADDRESS Address)
{
@ -443,7 +443,7 @@ ScsiPortConvertPhysicalAddressToUlong(
}
SCSI_PHYSICAL_ADDRESS
DDKAPI
NTAPI
ScsiPortConvertUlongToPhysicalAddress(
IN ULONG UlongAddress)
{
@ -451,7 +451,7 @@ ScsiPortConvertUlongToPhysicalAddress(
}
VOID
DDKAPI
NTAPI
ScsiPortFlushDma(
IN PVOID DeviceExtension)
{
@ -460,7 +460,7 @@ ScsiPortFlushDma(
}
VOID
DDKAPI
NTAPI
ScsiPortFreeDeviceBase(
IN PVOID HwDeviceExtension,
IN PVOID MappedAddress)
@ -469,7 +469,7 @@ ScsiPortFreeDeviceBase(
}
ULONG
DDKAPI
NTAPI
ScsiPortGetBusData(
IN PVOID DeviceExtension,
IN ULONG BusDataType,
@ -482,7 +482,7 @@ ScsiPortGetBusData(
}
PVOID
DDKAPI
NTAPI
ScsiPortGetDeviceBase(
IN PVOID HwDeviceExtension,
IN INTERFACE_TYPE BusType,
@ -514,7 +514,7 @@ ScsiPortGetDeviceBase(
}
PVOID
DDKAPI
NTAPI
ScsiPortGetLogicalUnit(
IN PVOID HwDeviceExtension,
IN UCHAR PathId,
@ -527,7 +527,7 @@ ScsiPortGetLogicalUnit(
}
SCSI_PHYSICAL_ADDRESS
DDKAPI
NTAPI
ScsiPortGetPhysicalAddress(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
@ -564,7 +564,7 @@ ScsiPortGetPhysicalAddress(
}
PSCSI_REQUEST_BLOCK
DDKAPI
NTAPI
ScsiPortGetSrb(
IN PVOID DeviceExtension,
IN UCHAR PathId,
@ -641,7 +641,7 @@ SpiAllocateCommonBuffer(
}
PVOID
DDKAPI
NTAPI
ScsiPortGetUncachedExtension(
IN PVOID HwDeviceExtension,
IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
@ -726,7 +726,7 @@ ScsiPortGetUncachedExtension(
}
PVOID
DDKAPI
NTAPI
ScsiPortGetVirtualAddress(
IN PVOID HwDeviceExtension,
IN SCSI_PHYSICAL_ADDRESS PhysicalAddress)
@ -1031,7 +1031,7 @@ SpiGetPciConfigData(
}
ULONG
DDKAPI
NTAPI
ScsiPortInitialize(
IN PVOID Argument1,
IN PVOID Argument2,
@ -1186,7 +1186,7 @@ ScsiPortInitialize(
}
VOID
DDKAPI
NTAPI
ScsiPortIoMapTransfer(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb,
@ -1198,7 +1198,7 @@ ScsiPortIoMapTransfer(
}
VOID
DDKAPI
NTAPI
ScsiPortLogError(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
@ -1213,7 +1213,7 @@ ScsiPortLogError(
}
VOID
DDKAPI
NTAPI
ScsiPortMoveMemory(
IN PVOID WriteBuffer,
IN PVOID ReadBuffer,
@ -1223,7 +1223,7 @@ ScsiPortMoveMemory(
}
VOID
DDKCDECLAPI
__cdecl
ScsiPortNotification(
IN SCSI_NOTIFICATION_TYPE NotificationType,
IN PVOID HwDeviceExtension,
@ -1259,7 +1259,7 @@ ScsiPortNotification(
}
VOID
DDKAPI
NTAPI
ScsiPortReadPortBufferUchar(
IN PUCHAR Port,
OUT PUCHAR Buffer,
@ -1269,7 +1269,7 @@ ScsiPortReadPortBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortReadPortBufferUlong(
IN PULONG Port,
OUT PULONG Buffer,
@ -1279,7 +1279,7 @@ ScsiPortReadPortBufferUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortReadPortBufferUshort(
IN PUSHORT Port,
OUT PUSHORT Buffer,
@ -1289,7 +1289,7 @@ ScsiPortReadPortBufferUshort(
}
UCHAR
DDKAPI
NTAPI
ScsiPortReadPortUchar(
IN PUCHAR Port)
{
@ -1300,7 +1300,7 @@ ScsiPortReadPortUchar(
}
ULONG
DDKAPI
NTAPI
ScsiPortReadPortUlong(
IN PULONG Port)
{
@ -1308,7 +1308,7 @@ ScsiPortReadPortUlong(
}
USHORT
DDKAPI
NTAPI
ScsiPortReadPortUshort(
IN PUSHORT Port)
{
@ -1316,7 +1316,7 @@ ScsiPortReadPortUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortReadRegisterBufferUchar(
IN PUCHAR Register,
IN PUCHAR Buffer,
@ -1327,7 +1327,7 @@ ScsiPortReadRegisterBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortReadRegisterBufferUlong(
IN PULONG Register,
IN PULONG Buffer,
@ -1338,7 +1338,7 @@ ScsiPortReadRegisterBufferUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortReadRegisterBufferUshort(
IN PUSHORT Register,
IN PUSHORT Buffer,
@ -1349,7 +1349,7 @@ ScsiPortReadRegisterBufferUshort(
}
UCHAR
DDKAPI
NTAPI
ScsiPortReadRegisterUchar(
IN PUCHAR Register)
{
@ -1357,7 +1357,7 @@ ScsiPortReadRegisterUchar(
}
ULONG
DDKAPI
NTAPI
ScsiPortReadRegisterUlong(
IN PULONG Register)
{
@ -1365,7 +1365,7 @@ ScsiPortReadRegisterUlong(
}
USHORT
DDKAPI
NTAPI
ScsiPortReadRegisterUshort(
IN PUSHORT Register)
{
@ -1373,7 +1373,7 @@ ScsiPortReadRegisterUshort(
}
ULONG
DDKAPI
NTAPI
ScsiPortSetBusDataByOffset(
IN PVOID DeviceExtension,
IN ULONG BusDataType,
@ -1389,7 +1389,7 @@ ScsiPortSetBusDataByOffset(
}
VOID
DDKAPI
NTAPI
ScsiPortStallExecution(
IN ULONG Delay)
{
@ -1397,7 +1397,7 @@ ScsiPortStallExecution(
}
BOOLEAN
DDKAPI
NTAPI
ScsiPortValidateRange(
IN PVOID HwDeviceExtension,
IN INTERFACE_TYPE BusType,
@ -1417,7 +1417,7 @@ ScsiPortValidateRange(
VOID
DDKAPI
NTAPI
ScsiPortWritePortBufferUchar(
IN PUCHAR Port,
IN PUCHAR Buffer,
@ -1427,7 +1427,7 @@ ScsiPortWritePortBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortBufferUlong(
IN PULONG Port,
IN PULONG Buffer,
@ -1437,7 +1437,7 @@ ScsiPortWritePortBufferUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortBufferUshort(
IN PUSHORT Port,
IN PUSHORT Buffer,
@ -1447,7 +1447,7 @@ ScsiPortWritePortBufferUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortUchar(
IN PUCHAR Port,
IN UCHAR Value)
@ -1456,7 +1456,7 @@ ScsiPortWritePortUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortUlong(
IN PULONG Port,
IN ULONG Value)
@ -1465,7 +1465,7 @@ ScsiPortWritePortUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortUshort(
IN PUSHORT Port,
IN USHORT Value)
@ -1474,7 +1474,7 @@ ScsiPortWritePortUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterBufferUchar(
IN PUCHAR Register,
IN PUCHAR Buffer,
@ -1485,7 +1485,7 @@ ScsiPortWriteRegisterBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterBufferUlong(
IN PULONG Register,
IN PULONG Buffer,
@ -1496,7 +1496,7 @@ ScsiPortWriteRegisterBufferUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterBufferUshort(
IN PUSHORT Register,
IN PUSHORT Buffer,
@ -1507,7 +1507,7 @@ ScsiPortWriteRegisterBufferUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterUchar(
IN PUCHAR Register,
IN ULONG Value)
@ -1516,7 +1516,7 @@ ScsiPortWriteRegisterUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterUlong(
IN PULONG Register,
IN ULONG Value)
@ -1525,7 +1525,7 @@ ScsiPortWriteRegisterUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterUshort(
IN PUSHORT Register,
IN USHORT Value)

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE directory SYSTEM "../../../tools/rbuild/project.dtd">
<module name="freeldr_arch" type="objectlibrary">
<module name="freeldr_arch" type="objectlibrary" crt="static">
<include base="freeldr_base">include</include>
<include base="freeldr_base">cache</include>
<include base="ntoskrnl">include</include>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="freeldr_base" type="objectlibrary">
<module name="freeldr_base" type="objectlibrary" crt="static">
<include base="freeldr_base">include</include>
<include base="freeldr_base">cache</include>
<include base="cmlib">.</include>

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="freeldr_main" type="objectlibrary">
<module name="freeldr_main" type="objectlibrary" crt="static">
<include base="freeldr_main">include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHAL_" />

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="setupldr_main" type="objectlibrary">
<module name="setupldr_main" type="objectlibrary" crt="static">
<include base="setupldr_main">include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHAL_" />

View file

@ -232,7 +232,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
PVOID DriverBase;
// Separate the path to file name and directory path
snprintf(DriverPath, sizeof(DriverPath), "%wZ", FilePath);
_snprintf(DriverPath, sizeof(DriverPath), "%wZ", FilePath);
DriverNamePos = strrchr(DriverPath, '\\');
if (DriverNamePos != NULL)
{
@ -261,7 +261,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
}
// It's not loaded, we have to load it
snprintf(FullPath, sizeof(FullPath), "%s%wZ", BootPath, FilePath);
_snprintf(FullPath, sizeof(FullPath), "%s%wZ", BootPath, FilePath);
Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
if (!Status)
return FALSE;

View file

@ -52,7 +52,27 @@ HRESULT
WINAPI
DllUnregisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass;
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_SET_VALUE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
RegDeleteKeyW(hClass, pStr);
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
extern "C"
@ -61,7 +81,39 @@ HRESULT
WINAPI
DllRegisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass, hKey, hSubKey;
static LPCWSTR ModuleName = L"bdaplgin.ax";
static LPCWSTR ThreadingModel = L"Both";
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
if (RegCreateKeyExW(hClass, pStr, 0, 0, 0, KEY_WRITE, NULL, &hKey, 0) == ERROR_SUCCESS)
{
if (RegCreateKeyExW(hKey, L"InprocServer32", 0, 0, 0, KEY_WRITE, NULL, &hSubKey, 0) == ERROR_SUCCESS)
{
RegSetValueExW(hSubKey, 0, 0, REG_SZ, (const BYTE*)ModuleName, (wcslen(ModuleName) + 1) * sizeof(WCHAR));
RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ, (const BYTE*)ThreadingModel, (wcslen(ThreadingModel) + 1) * sizeof(WCHAR));
RegCloseKey(hSubKey);
}
RegCloseKey(hKey);
}
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
KSDDKAPI

View file

@ -3,6 +3,7 @@
<group>
<module name="bdaplgin" type="win32dll" baseaddress="${BASEADDRESS_BDAPLGIN}" installbase="system32" installname="bdaplgin.ax">
<importlibrary definition="bdaplgin.spec" />
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<include base="bdaplgin">.</include>
<library>ntdll</library>
<library>kernel32</library>

View file

@ -43,6 +43,12 @@
<directory name="msdmo">
<xi:include href="msdmo/msdmo.rbuild" />
</directory>
<directory name="msdvbnp">
<xi:include href="msdvbnp/msdvbnp.rbuild" />
</directory>
<directory name="msvidctl">
<xi:include href="msvidctl/msvidctl.rbuild" />
</directory>
<directory name="qedit">
<xi:include href="qedit/qedit.rbuild" />
</directory>

View file

@ -343,7 +343,27 @@ HRESULT
WINAPI
DllUnregisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass;
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_SET_VALUE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
RegDeleteKeyW(hClass, pStr);
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
extern "C"
@ -352,7 +372,39 @@ HRESULT
WINAPI
DllRegisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass, hKey, hSubKey;
static LPCWSTR ModuleName = L"ksproxy.ax";
static LPCWSTR ThreadingModel = L"Both";
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
if (RegCreateKeyExW(hClass, pStr, 0, 0, 0, KEY_WRITE, NULL, &hKey, 0) == ERROR_SUCCESS)
{
if (RegCreateKeyExW(hKey, L"InprocServer32", 0, 0, 0, KEY_WRITE, NULL, &hSubKey, 0) == ERROR_SUCCESS)
{
RegSetValueExW(hSubKey, 0, 0, REG_SZ, (const BYTE*)ModuleName, (wcslen(ModuleName) + 1) * sizeof(WCHAR));
RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ, (const BYTE*)ThreadingModel, (wcslen(ThreadingModel) + 1) * sizeof(WCHAR));
RegCloseKey(hSubKey);
}
RegCloseKey(hKey);
}
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
KSDDKAPI

View file

@ -3,6 +3,7 @@
<group>
<module name="ksproxy" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_KSPROXY}" installbase="system32" installname="ksproxy.ax">
<importlibrary definition="ksproxy.spec" />
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<include base="ksproxy">.</include>
<library>ntdll</library>
<library>kernel32</library>

View file

@ -0,0 +1,169 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS BDA Proxy
* FILE: dll/directx/msdvbnp/ethernetfilter.cpp
* PURPOSE: IBDA_EthernetFilter interface
*
* PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
*/
#include "precomp.h"
class CEthernetFilter : public IBDA_EthernetFilter
{
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
//IBDA_EthernetFilter
HRESULT STDMETHODCALLTYPE GetMulticastListSize(ULONG *pulcbAddresses);
HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE * pAddressList);
HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList);
HRESULT STDMETHODCALLTYPE PutMulticastMode(ULONG ulModeMask);
HRESULT STDMETHODCALLTYPE GetMulticastMode(ULONG *pulModeMask);
CEthernetFilter(IBDA_NetworkProvider * pNetworkProvider);
virtual ~CEthernetFilter();
protected:
IBDA_NetworkProvider * m_pNetworkProvider;
ULONG m_ulcbAddresses;
BYTE * m_pAddressList;
ULONG m_ulModeMask;
};
CEthernetFilter::CEthernetFilter(
IBDA_NetworkProvider * pNetworkProvider) : m_pNetworkProvider(pNetworkProvider),
m_ulcbAddresses(0),
m_pAddressList(0),
m_ulModeMask(0)
{
}
CEthernetFilter::~CEthernetFilter()
{
if (m_pAddressList)
CoTaskMemFree(m_pAddressList);
}
HRESULT
STDMETHODCALLTYPE
CEthernetFilter::QueryInterface(
REFIID InterfaceId,
PVOID* Interface)
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->QueryInterface(InterfaceId, Interface);
}
ULONG
STDMETHODCALLTYPE
CEthernetFilter::AddRef()
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->AddRef();
}
ULONG
STDMETHODCALLTYPE
CEthernetFilter::Release()
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->Release();
}
//-------------------------------------------------------------------
//IBDA_EthernetFilter
//
HRESULT
STDMETHODCALLTYPE
CEthernetFilter::PutMulticastList(
ULONG ulcbAddresses,
BYTE * pAddressList)
{
if (!ulcbAddresses || !pAddressList)
return E_POINTER;
if (m_pAddressList)
CoTaskMemFree(m_pAddressList);
m_pAddressList = (BYTE*)CoTaskMemAlloc(ulcbAddresses);
if (!m_pAddressList)
return E_OUTOFMEMORY;
CopyMemory(m_pAddressList, pAddressList, ulcbAddresses);
m_ulcbAddresses = ulcbAddresses;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CEthernetFilter::GetMulticastList(
ULONG *pulcbAddresses,
BYTE *pAddressList)
{
if (!pulcbAddresses || !pAddressList)
return E_POINTER;
if (*pulcbAddresses < m_ulcbAddresses)
return E_OUTOFMEMORY;
CopyMemory(pAddressList, m_pAddressList, m_ulcbAddresses);
*pulcbAddresses = m_ulcbAddresses;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CEthernetFilter::GetMulticastListSize(
ULONG *pulcbAddresses)
{
if (!pulcbAddresses)
return E_POINTER;
*pulcbAddresses = m_ulcbAddresses;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CEthernetFilter::PutMulticastMode(
ULONG ulModeMask)
{
m_ulModeMask = ulModeMask;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CEthernetFilter::GetMulticastMode(
ULONG *pulModeMask)
{
*pulModeMask = m_ulModeMask;
return NOERROR;
}
HRESULT
WINAPI
CEthernetFilter_fnConstructor(
IBDA_NetworkProvider * pNetworkProvider,
REFIID riid,
LPVOID * ppv)
{
CEthernetFilter * filter = new CEthernetFilter(pNetworkProvider);
if (!filter)
return E_OUTOFMEMORY;
if (FAILED(filter->QueryInterface(riid, ppv)))
{
/* not supported */
delete filter;
return E_NOINTERFACE;
}
return NOERROR;
}

View file

@ -0,0 +1,170 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS BDA Proxy
* FILE: dll/directx/msdvbnp/ipv4.cpp
* PURPOSE: IBDA_IPV4Filter interface
*
* PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
*/
#include "precomp.h"
class CIPV4Filter : public IBDA_IPV4Filter
{
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
//IBDA_IPV4Filter
HRESULT STDMETHODCALLTYPE GetMulticastListSize(ULONG *pulcbAddresses);
HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE * pAddressList);
HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList);
HRESULT STDMETHODCALLTYPE PutMulticastMode(ULONG ulModeMask);
HRESULT STDMETHODCALLTYPE GetMulticastMode(ULONG *pulModeMask);
CIPV4Filter(IBDA_NetworkProvider * pNetworkProvider);
virtual ~CIPV4Filter();
protected:
IBDA_NetworkProvider * m_pNetworkProvider;
ULONG m_ulcbAddresses;
BYTE * m_pAddressList;
ULONG m_ulModeMask;
};
CIPV4Filter::CIPV4Filter(
IBDA_NetworkProvider * pNetworkProvider) : m_pNetworkProvider(pNetworkProvider),
m_ulcbAddresses(0),
m_pAddressList(0),
m_ulModeMask(0)
{
}
CIPV4Filter::~CIPV4Filter()
{
if (m_pAddressList)
CoTaskMemFree(m_pAddressList);
}
HRESULT
STDMETHODCALLTYPE
CIPV4Filter::QueryInterface(
REFIID InterfaceId,
PVOID* Interface)
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->QueryInterface(InterfaceId, Interface);
}
ULONG
STDMETHODCALLTYPE
CIPV4Filter::AddRef()
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->AddRef();
}
ULONG
STDMETHODCALLTYPE
CIPV4Filter::Release()
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->Release();
}
//-------------------------------------------------------------------
//IBDA_IPV4Filter
//
HRESULT
STDMETHODCALLTYPE
CIPV4Filter::GetMulticastListSize(
ULONG *pulcbAddresses)
{
if (!pulcbAddresses)
return E_POINTER;
*pulcbAddresses = 0;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV4Filter::PutMulticastList(
ULONG ulcbAddresses,
BYTE * pAddressList)
{
if (!ulcbAddresses || !pAddressList)
return E_POINTER;
if (m_pAddressList)
CoTaskMemFree(m_pAddressList);
m_pAddressList = (BYTE*)CoTaskMemAlloc(ulcbAddresses);
if (!m_pAddressList)
return E_OUTOFMEMORY;
CopyMemory(m_pAddressList, pAddressList, ulcbAddresses);
m_ulcbAddresses = ulcbAddresses;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV4Filter::GetMulticastList(
ULONG *pulcbAddresses,
BYTE *pAddressList)
{
if (!pulcbAddresses || !pAddressList)
return E_POINTER;
if (*pulcbAddresses < m_ulcbAddresses)
return E_OUTOFMEMORY;
CopyMemory(pAddressList, m_pAddressList, m_ulcbAddresses);
*pulcbAddresses = m_ulcbAddresses;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV4Filter::PutMulticastMode(
ULONG ulModeMask)
{
m_ulModeMask = ulModeMask;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV4Filter::GetMulticastMode(
ULONG *pulModeMask)
{
*pulModeMask = m_ulModeMask;
return NOERROR;
}
HRESULT
WINAPI
CIPV4Filter_fnConstructor(
IBDA_NetworkProvider * pNetworkProvider,
REFIID riid,
LPVOID * ppv)
{
CIPV4Filter * filter = new CIPV4Filter(pNetworkProvider);
if (!filter)
return E_OUTOFMEMORY;
if (FAILED(filter->QueryInterface(riid, ppv)))
{
/* not supported */
delete filter;
return E_NOINTERFACE;
}
return NOERROR;
}

View file

@ -0,0 +1,167 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS BDA Proxy
* FILE: dll/directx/msdvbnp/ipv6.cpp
* PURPOSE: IBDA_IPV6Filter interface
*
* PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
*/
#include "precomp.h"
class CIPV6Filter : public IBDA_IPV6Filter
{
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
//IBDA_IPV6Filter
HRESULT STDMETHODCALLTYPE GetMulticastListSize(ULONG *pulcbAddresses);
HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE * pAddressList);
HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList);
HRESULT STDMETHODCALLTYPE PutMulticastMode(ULONG ulModeMask);
HRESULT STDMETHODCALLTYPE GetMulticastMode(ULONG *pulModeMask);
CIPV6Filter(IBDA_NetworkProvider * pNetworkProvider);
virtual ~CIPV6Filter();
protected:
IBDA_NetworkProvider * m_pNetworkProvider;
ULONG m_ulcbAddresses;
BYTE * m_pAddressList;
ULONG m_ulModeMask;
};
CIPV6Filter::CIPV6Filter(
IBDA_NetworkProvider * pNetworkProvider) : m_pNetworkProvider(pNetworkProvider),
m_ulcbAddresses(0),
m_pAddressList(0),
m_ulModeMask(0)
{
}
CIPV6Filter::~CIPV6Filter()
{
if (m_pAddressList)
CoTaskMemFree(m_pAddressList);
}
HRESULT
STDMETHODCALLTYPE
CIPV6Filter::QueryInterface(
REFIID InterfaceId,
PVOID* Interface)
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->QueryInterface(InterfaceId, Interface);
}
ULONG
STDMETHODCALLTYPE
CIPV6Filter::AddRef()
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->AddRef();
}
ULONG
STDMETHODCALLTYPE
CIPV6Filter::Release()
{
assert(m_pNetworkProvider);
return m_pNetworkProvider->Release();
}
//-------------------------------------------------------------------
//IBDA_IPV6Filter
//
HRESULT
STDMETHODCALLTYPE
CIPV6Filter::GetMulticastListSize(
ULONG *pulcbAddresses)
{
if (!pulcbAddresses)
return E_POINTER;
*pulcbAddresses = 0;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV6Filter::GetMulticastList(
ULONG *pulcbAddresses,
BYTE *pAddressList)
{
if (!pulcbAddresses || !pAddressList)
return E_POINTER;
if (*pulcbAddresses < m_ulcbAddresses)
return E_OUTOFMEMORY;
CopyMemory(pAddressList, m_pAddressList, m_ulcbAddresses);
*pulcbAddresses = m_ulcbAddresses;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV6Filter::PutMulticastList(
ULONG ulcbAddresses,
BYTE * pAddressList)
{
if (!ulcbAddresses || !pAddressList)
return E_POINTER;
if (m_pAddressList)
CoTaskMemFree(m_pAddressList);
m_pAddressList = (BYTE*)CoTaskMemAlloc(ulcbAddresses);
if (!m_pAddressList)
return E_OUTOFMEMORY;
CopyMemory(m_pAddressList, pAddressList, ulcbAddresses);
m_ulcbAddresses = ulcbAddresses;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV6Filter::PutMulticastMode(
ULONG ulModeMask)
{
m_ulModeMask = ulModeMask;
return NOERROR;
}
HRESULT
STDMETHODCALLTYPE
CIPV6Filter::GetMulticastMode(
ULONG *pulModeMask)
{
*pulModeMask = m_ulModeMask;
return NOERROR;
}
HRESULT
WINAPI
CIPV6Filter_fnConstructor(
IBDA_NetworkProvider * pNetworkProvider,
REFIID riid,
LPVOID * ppv)
{
CIPV6Filter * filter = new CIPV6Filter(pNetworkProvider);
if (!filter)
return E_OUTOFMEMORY;
if (FAILED(filter->QueryInterface(riid, ppv)))
{
/* not supported */
delete filter;
return E_NOINTERFACE;
}
return NOERROR;
}

View file

@ -48,7 +48,27 @@ HRESULT
WINAPI
DllUnregisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass;
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_SET_VALUE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
RegDeleteKeyW(hClass, pStr);
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
extern "C"
@ -57,7 +77,39 @@ HRESULT
WINAPI
DllRegisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass, hKey, hSubKey;
static LPCWSTR ModuleName = L"msdvbnp.ax";
static LPCWSTR ThreadingModel = L"Both";
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
if (RegCreateKeyExW(hClass, pStr, 0, 0, 0, KEY_WRITE, NULL, &hKey, 0) == ERROR_SUCCESS)
{
if (RegCreateKeyExW(hKey, L"InprocServer32", 0, 0, 0, KEY_WRITE, NULL, &hSubKey, 0) == ERROR_SUCCESS)
{
RegSetValueExW(hSubKey, 0, 0, REG_SZ, (const BYTE*)ModuleName, (wcslen(ModuleName) + 1) * sizeof(WCHAR));
RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ, (const BYTE*)ThreadingModel, (wcslen(ThreadingModel) + 1) * sizeof(WCHAR));
RegCloseKey(hSubKey);
}
RegCloseKey(hKey);
}
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
KSDDKAPI

View file

@ -3,6 +3,7 @@
<group>
<module name="msdvbnp" type="win32dll" baseaddress="${BASEADDRESS_MSDVBNP}" installbase="system32" installname="msdvbnp.ax">
<importlibrary definition="msdvbnp.spec" />
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<include base="msdvbnp">.</include>
<library>ntdll</library>
<library>kernel32</library>
@ -22,8 +23,11 @@
<file>classfactory.cpp</file>
<file>enum_mediatypes.cpp</file>
<file>enumpins.cpp</file>
<file>ethernetfilter.cpp</file>
<file>msdvbnp.cpp</file>
<file>msdvbnp.rc</file>
<file>ipv4.cpp</file>
<file>ipv6.cpp</file>
<file>networkprovider.cpp</file>
<file>pin.cpp</file>
<file>scanningtuner.cpp</file>

View file

@ -74,6 +74,9 @@ protected:
GUID m_ClassID;
DeviceFilterStack m_DeviceFilters;
IScanningTuner * m_Tuner;
IBDA_IPV6Filter * m_IPV6Filter;
IBDA_IPV4Filter * m_IPV4Filter;
IBDA_EthernetFilter * m_EthernetFilter;
};
HRESULT
@ -116,6 +119,51 @@ CNetworkProvider::QueryInterface(
return NOERROR;
}
if (IsEqualGUID(refiid, IID_IBDA_IPV6Filter))
{
// construct scanning tuner
if (!m_IPV6Filter)
{
HRESULT hr = CIPV6Filter_fnConstructor((IBDA_NetworkProvider*)this, refiid, (void**)&m_IPV6Filter);
if (FAILED(hr))
return hr;
}
m_IPV6Filter->AddRef();
*Output = (IUnknown*)m_IPV6Filter;
return NOERROR;
}
if (IsEqualGUID(refiid, IID_IBDA_IPV4Filter))
{
// construct scanning tuner
if (!m_IPV4Filter)
{
HRESULT hr = CIPV4Filter_fnConstructor((IBDA_NetworkProvider*)this, refiid, (void**)&m_IPV4Filter);
if (FAILED(hr))
return hr;
}
m_IPV4Filter->AddRef();
*Output = (IUnknown*)m_IPV4Filter;
return NOERROR;
}
if (IsEqualGUID(refiid, IID_IBDA_EthernetFilter))
{
// construct scanning tuner
if (!m_EthernetFilter)
{
HRESULT hr = CIPV4Filter_fnConstructor((IBDA_NetworkProvider*)this, refiid, (void**)&m_EthernetFilter);
if (FAILED(hr))
return hr;
}
m_EthernetFilter->AddRef();
*Output = (IUnknown*)m_EthernetFilter;
return NOERROR;
}
if (IsEqualGUID(refiid, IID_IBDA_NetworkProvider))
{
*Output = (IBDA_NetworkProvider*)(this);
@ -163,7 +211,10 @@ CNetworkProvider::CNetworkProvider(LPCGUID ClassID) : m_Ref(0),
m_ReferenceClock(0),
m_FilterState(State_Stopped),
m_DeviceFilters(),
m_Tuner(0)
m_Tuner(0),
m_IPV6Filter(0),
m_IPV4Filter(0),
m_EthernetFilter(0)
{
m_Pins[0] = 0;

View file

@ -82,6 +82,30 @@ CEnumMediaTypes_fnConstructor(
REFIID riid,
LPVOID * ppv);
/* ethernetfilter.cpp */
HRESULT
WINAPI
CEthernetFilter_fnConstructor(
IBDA_NetworkProvider * pNetworkProvider,
REFIID riid,
LPVOID * ppv);
/* ipv6.cpp */
HRESULT
WINAPI
CIPV6Filter_fnConstructor(
IBDA_NetworkProvider * pNetworkProvider,
REFIID riid,
LPVOID * ppv);
/* ipv4.cpp */
HRESULT
WINAPI
CIPV4Filter_fnConstructor(
IBDA_NetworkProvider * pNetworkProvider,
REFIID riid,
LPVOID * ppv);
#ifndef _MSC_VER
extern const GUID CLSID_DVBTNetworkProvider;
#endif

View file

@ -287,7 +287,7 @@ CScanningTunner::performDVBTTune(
IDVBTuneRequest * pDVBTRequest,
IDVBTLocator *pDVBTLocator)
{
HRESULT hr;
HRESULT hr = S_OK;
ULONG Index;
IBDA_Topology *pTopo;
IUnknown *pNode;

View file

@ -48,7 +48,27 @@ HRESULT
WINAPI
DllUnregisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass;
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_SET_VALUE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
RegDeleteKeyW(hClass, pStr);
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
extern "C"
@ -57,7 +77,39 @@ HRESULT
WINAPI
DllRegisterServer(void)
{
return S_OK;
ULONG Index = 0;
LPOLESTR pStr;
HRESULT hr = S_OK;
HKEY hClass, hKey, hSubKey;
static LPCWSTR ModuleName = L"msvidctl.ax";
static LPCWSTR ThreadingModel = L"Both";
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hClass) != ERROR_SUCCESS)
return E_FAIL;
do
{
hr = StringFromCLSID(*InterfaceTable[Index].riid, &pStr);
if (FAILED(hr))
break;
if (RegCreateKeyExW(hClass, pStr, 0, 0, 0, KEY_WRITE, NULL, &hKey, 0) == ERROR_SUCCESS)
{
if (RegCreateKeyExW(hKey, L"InprocServer32", 0, 0, 0, KEY_WRITE, NULL, &hSubKey, 0) == ERROR_SUCCESS)
{
RegSetValueExW(hSubKey, 0, 0, REG_SZ, (const BYTE*)ModuleName, (wcslen(ModuleName) + 1) * sizeof(WCHAR));
RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ, (const BYTE*)ThreadingModel, (wcslen(ThreadingModel) + 1) * sizeof(WCHAR));
RegCloseKey(hSubKey);
}
RegCloseKey(hKey);
}
CoTaskMemFree(pStr);
Index++;
}while(InterfaceTable[Index].lpfnCI != 0);
RegCloseKey(hClass);
return hr;
}
KSDDKAPI

View file

@ -3,6 +3,7 @@
<group>
<module name="msvidctl" type="win32dll" baseaddress="${BASEADDRESS_MSVIDCTL}" installbase="system32" installname="msvidctl.dll">
<importlibrary definition="msvidctl.spec" />
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<include base="msvidctl">.</include>
<library>ntdll</library>
<library>kernel32</library>

View file

@ -12,6 +12,7 @@
<include base="ReactOS">include/reactos/subsys</include>
<define name="__NTDLL__" />
<define name="_NTOSKRNL_" />
<define name="CRTDLL" />
<library>rtl</library>
<library>ntdllsys</library>
<library>libcntpr</library>

View file

@ -5,6 +5,7 @@
<define name="USE_MSVCRT_PREFIX" />
<define name="_MSVCRT_LIB_" />
<define name="_MSVCRT_" />
<define name="CRTDLL" />
<define name="_CTYPE_DISABLE_MACROS" />
<define name="_NO_INLINING" />

View file

@ -292,7 +292,7 @@ CreateBitmap(INT Width,
INT Height,
UINT Planes,
UINT BitsPixel,
PCVOID pUnsafeBits)
CONST VOID* pUnsafeBits)
{
/* FIXME some part should be done in user mode */
if (Width && Height)

View file

@ -673,7 +673,7 @@ GetRelAbs(
/*
* @implemented
*/
DWORD
INT
WINAPI
SetRelAbs(
HDC hdc,

View file

@ -1671,7 +1671,7 @@ RemoveFontResourceExW(LPCWSTR lpFileName,
/*
* @implemented
*/
DWORD
LONG
WINAPI
GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height)
{

View file

@ -10,7 +10,6 @@ typedef VOID
typedef VOID
(WINAPI *PINTERFACE_DEREFERENCE)(
PVOID Context);
#define DDKAPI __stdcall // FIXME
#include <ntndk.h>
#include <hidusage.h>
#include <hidclass.h>

View file

@ -759,13 +759,22 @@
@ stdcall ResetWriteWatch(ptr long)
@ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error
@ stdcall ResumeThread(long)
@ stdcall -arch=x86_64 RtlAddFunctionTable(ptr long double)
@ stdcall RtlCaptureContext(ptr) ntdll.RtlCaptureContext
@ stdcall RtlCaptureStackBackTrace(long long ptr ptr) ntdll.RtlCaptureStackBackTrace
@ stdcall -arch=x86_64 RtlCompareMemory(ptr ptr ptr)
@ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr ptr)
@ stdcall -arch=x86_64 RtlDeleteFunctionTable(ptr)
@ stdcall RtlFillMemory(ptr long long) ntdll.RtlFillMemory
@ stdcall -arch=x86_64 RtlInstallFunctionTableCallback(double double long ptr ptr ptr)
@ stdcall -arch=x86_64 RtlLookupFunctionEntry(ptr ptr ptr) ntdll.RtlLookupFunctionEntry
@ stdcall RtlMoveMemory(ptr ptr long) ntdll.RtlMoveMemory
@ stdcall -arch=x86_64 RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader
@ stdcall -arch=x86_64 RtlRaiseException(ptr) ntdll.RtlRaiseException
@ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext
@ stdcall RtlUnwind(ptr ptr ptr long) ntdll.RtlUnwind
@ stdcall RtlVirtualUnwind(ptr ptr ptr long) ntdll.RtlVirtualUnwind
@ stdcall RtlLookupFunctionEntry(ptr ptr ptr) ntdll.RtlLookupFunctionEntry
@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx
@ stdcall -arch=x86_64 RtlVirtualUnwind(ptr ptr ptr long) ntdll.RtlVirtualUnwind
@ stdcall RtlZeroMemory(ptr long) ntdll.RtlZeroMemory
@ stdcall ScrollConsoleScreenBufferA(long ptr ptr ptr ptr)
@ stdcall ScrollConsoleScreenBufferW(long ptr ptr ptr ptr)

View file

@ -158,9 +158,9 @@ EXPORTS
__p__winminor @153
__p__winver @154
__p__wpgmptr @155
; __pctype_func @156
__pctype_func @156
__pioinfo @157 DATA
; __pwctype_func @158
__pwctype_func @158
__pxcptinfoptrs @159
__set_app_type @160
__setlc_active @161 DATA
@ -583,7 +583,7 @@ EXPORTS
_wcsupr @576
_wctime @577
; _wctime64 @578
; _wctype @579
_wctype @579
_wenviron @580 DATA
_wexecl @581
_wexecle @582

View file

@ -8,6 +8,7 @@
<define name="_MT" />
<define name="_CTYPE_DISABLE_MACROS" />
<define name="_NO_INLINING" />
<define name="CRTDLL" />
<linkerflag linkerset="ld">-enable-stdcall-fixup</linkerflag>
<!-- __MINGW_IMPORT needs to be defined differently because it's defined

View file

@ -6,6 +6,7 @@
<include base="msvcrt20">.</include>
<include base="ReactOS">include/reactos/wine</include>
<define name="__WINESRC__" />
<define name="CRTDLL" />
<file>msvcrt20.c</file>
<library>wine</library>
<library>msvcrt</library>

View file

@ -6,6 +6,7 @@
<include base="msvcrt40">.</include>
<include base="ReactOS">include/reactos/wine</include>
<define name="__WINESRC__" />
<define name="CRTDLL" />
<file>msvcrt40.c</file>
<library>wine</library>
</module>

View file

@ -3662,7 +3662,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
if (!(l = RegOpenKeyExW(HKLM,
lpKeyName,
0,
0,
samDesired,
&hClassesKey)))
{
if (MachineName != NULL)
@ -3699,8 +3699,209 @@ BOOL WINAPI SetupDiOpenDeviceInterfaceW(
DWORD OpenFlags,
PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
{
FIXME("%p %s %08x %p\n",
struct DeviceInfoSet * list;
PCWSTR pEnd;
DWORD dwLength, dwError, dwIndex, dwKeyName, dwSubIndex;
CLSID ClassId;
WCHAR Buffer[MAX_PATH + 1];
WCHAR SymBuffer[MAX_PATH + 1];
WCHAR InstancePath[MAX_PATH + 1];
HKEY hKey, hDevKey, hSymKey;
struct DeviceInfo * deviceInfo;
struct DeviceInterface *deviceInterface;
BOOL Ret;
PLIST_ENTRY ItemList;
PLIST_ENTRY InterfaceListEntry;
TRACE("%p %s %08x %p\n",
DeviceInfoSet, debugstr_w(DevicePath), OpenFlags, DeviceInterfaceData);
if (DeviceInterfaceData && DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
list = (struct DeviceInfoSet * )DeviceInfoSet;
dwLength = wcslen(DevicePath);
if (dwLength < 39)
{
/* path must be at least a guid length + L'\0' */
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
if (DevicePath[0] != L'\\' ||
DevicePath[1] != L'\\' ||
(DevicePath[2] != L'?' && DevicePath[2] != L'.') ||
DevicePath[3] != L'\\')
{
/* invalid formatted path */
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
/* check for reference strings */
pEnd = wcschr(&DevicePath[4], L'\\');
if (!pEnd)
{
/* no reference string */
pEnd = DevicePath + dwLength;
}
/* copy guid */
wcscpy(Buffer, pEnd - 37);
Buffer[36] = L'\0';
dwError = UuidFromStringW(Buffer, &ClassId);
if (dwError != NOERROR)
{
/* invalid formatted path */
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
hKey = SetupDiOpenClassRegKeyExW(&ClassId, KEY_READ, DIOCR_INTERFACE, list->MachineName, NULL);
if (hKey == INVALID_HANDLE_VALUE)
{
/* invalid device class */
return FALSE;
}
ItemList = list->ListHead.Flink;
while (ItemList != &list->ListHead)
{
deviceInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
InterfaceListEntry = deviceInfo->InterfaceListHead.Flink;
while (InterfaceListEntry != &deviceInfo->InterfaceListHead)
{
deviceInterface = CONTAINING_RECORD(InterfaceListEntry, struct DeviceInterface, ListEntry);
if (!IsEqualIID(&deviceInterface->InterfaceClassGuid, &ClassId))
{
InterfaceListEntry = InterfaceListEntry->Flink;
continue;
}
if (!wcsicmp(deviceInterface->SymbolicLink, DevicePath))
{
if (DeviceInterfaceData)
{
DeviceInterfaceData->Reserved = (ULONG_PTR)deviceInterface;
DeviceInterfaceData->Flags = deviceInterface->Flags;
CopyMemory(&DeviceInterfaceData->InterfaceClassGuid, &ClassId, sizeof(GUID));
}
return TRUE;
}
}
}
dwIndex = 0;
do
{
Buffer[0] = 0;
dwKeyName = sizeof(Buffer) / sizeof(WCHAR);
dwError = RegEnumKeyExW(hKey, dwIndex, Buffer, &dwKeyName, NULL, NULL, NULL, NULL);
if (dwError != ERROR_SUCCESS)
break;
if (RegOpenKeyExW(hKey, Buffer, 0, KEY_READ, &hDevKey) != ERROR_SUCCESS)
break;
dwSubIndex = 0;
InstancePath[0] = 0;
dwKeyName = sizeof(InstancePath);
dwError = RegQueryValueExW(hDevKey, L"DeviceInstance", NULL, NULL, (LPBYTE)InstancePath, &dwKeyName);
while(TRUE)
{
Buffer[0] = 0;
dwKeyName = sizeof(Buffer) / sizeof(WCHAR);
dwError = RegEnumKeyExW(hDevKey, dwSubIndex, Buffer, &dwKeyName, NULL, NULL, NULL, NULL);
if (dwError != ERROR_SUCCESS)
break;
dwError = RegOpenKeyExW(hDevKey, Buffer, 0, KEY_READ, &hSymKey);
if (dwError != ERROR_SUCCESS)
break;
/* query for symbolic link */
dwKeyName = sizeof(SymBuffer);
SymBuffer[0] = L'\0';
dwError = RegQueryValueExW(hSymKey, L"SymbolicLink", NULL, NULL, (LPBYTE)SymBuffer, &dwKeyName);
if (dwError != ERROR_SUCCESS)
{
RegCloseKey(hSymKey);
break;
}
if (!wcsicmp(SymBuffer, DevicePath))
{
Ret = CreateDeviceInfo(list, InstancePath, &ClassId, &deviceInfo);
RegCloseKey(hSymKey);
RegCloseKey(hDevKey);
RegCloseKey(hKey);
if (Ret)
{
deviceInterface = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInterface) + (wcslen(SymBuffer) + 1) * sizeof(WCHAR));
if (deviceInterface)
{
CopyMemory(&deviceInterface->InterfaceClassGuid, &ClassId, sizeof(GUID));
deviceInterface->DeviceInfo = deviceInfo;
deviceInterface->Flags = SPINT_ACTIVE; //FIXME
wcscpy(deviceInterface->SymbolicLink, SymBuffer);
InsertTailList(&deviceInfo->InterfaceListHead, &deviceInterface->ListEntry);
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
if (DeviceInterfaceData)
{
DeviceInterfaceData->Reserved = (ULONG_PTR)deviceInterface;
DeviceInterfaceData->Flags = deviceInterface->Flags;
CopyMemory(&DeviceInterfaceData->InterfaceClassGuid, &ClassId, sizeof(GUID));
}
else
{
Ret = FALSE;
SetLastError(ERROR_INVALID_USER_BUFFER);
}
}
}
else
{
HeapFree(GetProcessHeap(), 0, deviceInfo);
Ret = FALSE;
}
return Ret;
}
RegCloseKey(hSymKey);
dwSubIndex++;
}
RegCloseKey(hDevKey);
dwIndex++;
}while(TRUE);
RegCloseKey(hKey);
return FALSE;
}

View file

@ -10,6 +10,7 @@
<define name="wcsnicmp">_wcsnicmp</define>
<define name="_SETUPAPI_" />
<define name="_CFGMGR32_" />
<library>pnp_client</library>
<library>uuid</library>
<library>wine</library>

View file

@ -45,11 +45,6 @@
#include <pseh/pseh2.h>
/* This hack definition is necessary as long as setupapi
depends on Wine "compatibility" headers */
typedef ULONG RESOURCEID;
typedef RESOURCEID *PRESOURCEID;
#include <pnp_c.h>
#include "rpc_private.h"
#include "resource.h"
@ -61,6 +56,8 @@ typedef RESOURCEID *PRESOURCEID;
#define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
#define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
#define CMP_MAGIC 0x01234567
struct DeviceInterface /* Element of DeviceInfo.InterfaceListHead */
{
LIST_ENTRY ListEntry;

View file

@ -522,7 +522,7 @@ GetThreadDesktop(
HDESK
WINAPI
OpenDesktopA(
LPSTR lpszDesktop,
LPCSTR lpszDesktop,
DWORD dwFlags,
BOOL fInherit,
ACCESS_MASK dwDesiredAccess)
@ -558,7 +558,7 @@ OpenDesktopA(
HDESK
WINAPI
OpenDesktopW(
LPWSTR lpszDesktop,
LPCWSTR lpszDesktop,
DWORD dwFlags,
BOOL fInherit,
ACCESS_MASK dwDesiredAccess)

View file

@ -18,7 +18,7 @@
* @implemented
*/
HWINSTA WINAPI
CreateWindowStationA(LPSTR lpwinsta,
CreateWindowStationA(LPCSTR lpwinsta,
DWORD dwReserved,
ACCESS_MASK dwDesiredAccess,
LPSECURITY_ATTRIBUTES lpsa)
@ -52,7 +52,7 @@ CreateWindowStationA(LPSTR lpwinsta,
* @implemented
*/
HWINSTA WINAPI
CreateWindowStationW(LPWSTR lpwinsta,
CreateWindowStationW(LPCWSTR lpwinsta,
DWORD dwReserved,
ACCESS_MASK dwDesiredAccess,
LPSECURITY_ATTRIBUTES lpsa)
@ -266,7 +266,7 @@ EnumWindowStationsW(WINSTAENUMPROCW EnumFunc,
* @implemented
*/
HWINSTA WINAPI
OpenWindowStationA(LPSTR lpszWinSta,
OpenWindowStationA(LPCSTR lpszWinSta,
BOOL fInherit,
ACCESS_MASK dwDesiredAccess)
{
@ -298,7 +298,7 @@ OpenWindowStationA(LPSTR lpszWinSta,
* @implemented
*/
HWINSTA WINAPI
OpenWindowStationW(LPWSTR lpszWinSta,
OpenWindowStationW(LPCWSTR lpszWinSta,
BOOL fInherit,
ACCESS_MASK dwDesiredAccess)
{

View file

@ -851,10 +851,6 @@ DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos)
return 0;
}
/* Undocumented flags. */
#define SWP_NOCLIENTMOVE 0x0800
#define SWP_NOCLIENTSIZE 0x1000
LRESULT
DefWndHandleWindowPosChanged(HWND hWnd, WINDOWPOS* Pos)
{

View file

@ -37,8 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(user32);
/* GLOBALS *******************************************************************/
#define DSS_DEFAULT 0x0040 /* Make it bold */
static const WORD wPattern_AA55[8] = { 0xaaaa, 0x5555, 0xaaaa, 0x5555,
0xaaaa, 0x5555, 0xaaaa, 0x5555 };

View file

@ -9,7 +9,7 @@
#pragma once
#define NOEXTAPI
#include <ntddk.h>
#include <ntifs.h>
#define NDEBUG
#include <halfuncs.h>
#include <stdio.h>

View file

@ -23,7 +23,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
BCLASSAPI
NTSTATUS
DDKAPI
NTAPI
BatteryClassUnload(PVOID ClassData)
{
PBATTERY_CLASS_DATA BattClass = ClassData;
@ -44,7 +44,7 @@ BatteryClassUnload(PVOID ClassData)
BCLASSAPI
NTSTATUS
DDKAPI
NTAPI
BatteryClassSystemControl(PVOID ClassData,
PVOID WmiLibContext,
PDEVICE_OBJECT DeviceObject,
@ -58,7 +58,7 @@ BatteryClassSystemControl(PVOID ClassData,
BCLASSAPI
NTSTATUS
DDKAPI
NTAPI
BatteryClassQueryWmiDataBlock(PVOID ClassData,
PDEVICE_OBJECT DeviceObject,
PIRP Irp,
@ -74,7 +74,7 @@ BatteryClassQueryWmiDataBlock(PVOID ClassData,
BCLASSAPI
NTSTATUS
DDKAPI
NTAPI
BatteryClassStatusNotify(PVOID ClassData)
{
PBATTERY_CLASS_DATA BattClass = ClassData;
@ -129,7 +129,7 @@ BatteryClassStatusNotify(PVOID ClassData)
BCLASSAPI
NTSTATUS
DDKAPI
NTAPI
BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo,
PVOID *ClassData)
{
@ -172,7 +172,7 @@ BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo,
BCLASSAPI
NTSTATUS
DDKAPI
NTAPI
BatteryClassIoctl(PVOID ClassData,
PIRP Irp)
{

View file

@ -27,7 +27,7 @@ CompBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
/* Complete the IRP with success */
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IofCompleteRequest(Irp, IO_NO_INCREMENT);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
/* Return success */
if (CompBattDebug & 0x100) DbgPrint("CompBatt: Exiting OpenClose\n");
@ -56,7 +56,7 @@ CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
/* We don't support WMI */
Status = STATUS_NOT_SUPPORTED;
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
IofCompleteRequest(Irp, IO_NO_INCREMENT);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
/* Return status */
@ -75,18 +75,47 @@ CompBattMonitorIrpComplete(IN PDEVICE_OBJECT DeviceObject,
NTSTATUS
NTAPI
CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_ENTRY BatteryData)
CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_DATA BatteryData)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
VOID
NTAPI
CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
PCOMPBATT_BATTERY_DATA BatteryData;
ULONG Tag;
PLIST_ENTRY ListHead, NextEntry;
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING CompBattRecalculateTag\n");
/* Loop the battery list */
ExAcquireFastMutex(&DeviceExtension->Lock);
ListHead = &DeviceExtension->BatteryList;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Get the battery information and check if it has a tag */
BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
if (BatteryData->Flags & COMPBATT_TAG_ASSIGNED)
{
/* Generate the next tag and exit */
Tag = DeviceExtension->NextTag;
DeviceExtension->Flags |= COMPBATT_TAG_ASSIGNED;
DeviceExtension->Tag = Tag;
DeviceExtension->NextTag = Tag + 1;
break;
}
/* No tag for this device extension, clear it */
DeviceExtension->Tag = 0;
NextEntry = NextEntry->Flink;
}
/* We're done */
ExReleaseFastMutex(&DeviceExtension->Lock);
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING CompBattRecalculateTag\n");
}
NTSTATUS
@ -118,16 +147,61 @@ NTAPI
CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
OUT PULONG Tag)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
NTSTATUS Status;
PAGED_CODE();
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING QueryTag\n");
/* Was a tag assigned? */
if (!(DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED))
{
/* Assign one */
CompBattRecalculateTag(DeviceExtension);
}
/* Do we have a tag now? */
if ((DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED) && (DeviceExtension->Tag))
{
/* Return the tag */
*Tag = DeviceExtension->Tag;
Status = STATUS_SUCCESS;
}
else
{
/* No tag */
*Tag = 0;
Status = STATUS_NO_SUCH_DEVICE;
}
/* Return status */
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING QueryTag\n");
return Status;
}
NTSTATUS
NTAPI
CompBattDisableStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
PCOMPBATT_BATTERY_DATA BatteryData;
PLIST_ENTRY ListHead, NextEntry;
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING DisableStatusNotify\n");
/* Loop the battery list */
ExAcquireFastMutex(&DeviceExtension->Lock);
ListHead = &DeviceExtension->BatteryList;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Get the battery information and clear capacity data */
BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
BatteryData->WaitStatus.LowCapacity = 0;
BatteryData->WaitStatus.HighCapacity = 0x7FFFFFFF;
NextEntry = NextEntry->Flink;
}
/* Done */
ExReleaseFastMutex(&DeviceExtension->Lock);
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING DisableStatusNotify\n");
return STATUS_SUCCESS;
}
NTSTATUS
@ -161,11 +235,158 @@ CompBattQueryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
NTSTATUS
NTAPI
CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInformation,
CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
NTSTATUS Status = STATUS_SUCCESS;
BATTERY_QUERY_INFORMATION InputBuffer;
PCOMPBATT_BATTERY_DATA BatteryData;
PLIST_ENTRY ListHead, NextEntry;
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryInformation\n");
/* Set defaults */
BatteryInfo->DefaultAlert1 = 0;
BatteryInfo->DefaultAlert2 = 0;
BatteryInfo->CriticalBias = 0;
/* Loop the battery list */
ExAcquireFastMutex(&DeviceExtension->Lock);
ListHead = &DeviceExtension->BatteryList;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Try to acquire the remove lock */
BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
if (NT_SUCCESS(IoAcquireRemoveLock(&BatteryData->RemoveLock, 0)))
{
/* Now release the device lock since the battery can't go away */
ExReleaseFastMutex(&DeviceExtension->Lock);
/* Build the query */
InputBuffer.BatteryTag = BatteryData->Tag;
InputBuffer.InformationLevel = BatteryInformation;
InputBuffer.AtRate = 0;
/* Make sure the battery has a tag */
if (BatteryData->Tag)
{
/* Do we already have the data? */
if (!(BatteryData->Flags & COMPBATT_BATTERY_INFORMATION_PRESENT))
{
/* Send the IOCTL to query the information */
RtlZeroMemory(&BatteryData->BatteryInformation,
sizeof(BatteryData->BatteryInformation));
Status = BatteryIoctl(IOCTL_BATTERY_QUERY_INFORMATION,
BatteryData->DeviceObject,
&InputBuffer,
sizeof(InputBuffer),
&BatteryData->BatteryInformation,
sizeof(BatteryData->BatteryInformation),
0);
if (!NT_SUCCESS(Status))
{
/* Fail if the query had a problem */
if (Status == STATUS_DEVICE_REMOVED) Status = STATUS_NO_SUCH_DEVICE;
ExAcquireFastMutex(&DeviceExtension->Lock);
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
break;
}
/* Next time we can use the static copy */
BatteryData->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
if (CompBattDebug & 2)
DbgPrint("CompBattGetBatteryInformation: Read individual BATTERY_INFORMATION\n"
"-------- Capabilities = %x\n-------- Technology = %x\n"
"-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
"-------- FullChargedCapacity = %x\n-------- DefaultAlert1 = %x\n"
"-------- DefaultAlert2 = %x\n-------- CriticalBias = %x\n"
"-------- CycleCount = %x\n",
BatteryData->BatteryInformation.Capabilities,
BatteryData->BatteryInformation.Technology,
BatteryData->BatteryInformation.Chemistry,
BatteryData->BatteryInformation.DesignedCapacity,
BatteryData->BatteryInformation.FullChargedCapacity,
BatteryData->BatteryInformation.DefaultAlert1,
BatteryData->BatteryInformation.DefaultAlert2,
BatteryData->BatteryInformation.CriticalBias,
BatteryData->BatteryInformation.CycleCount);
}
/* Combine capabilities */
BatteryInfo->Capabilities |= BatteryData->BatteryInformation.Capabilities;
/* Add-on capacity */
if (BatteryData->BatteryInformation.DesignedCapacity != BATTERY_UNKNOWN_CAPACITY)
{
BatteryInfo->DesignedCapacity += BatteryData->BatteryInformation.DesignedCapacity;
}
/* Add on fully charged capacity */
if (BatteryData->BatteryInformation.FullChargedCapacity != BATTERY_UNKNOWN_CAPACITY)
{
BatteryInfo->FullChargedCapacity += BatteryData->BatteryInformation.FullChargedCapacity;
}
/* Choose the highest alert */
BatteryInfo->DefaultAlert1 = max(BatteryInfo->DefaultAlert1,
BatteryData->BatteryInformation.DefaultAlert1);
/* Choose the highest alert */
BatteryInfo->DefaultAlert2 = max(BatteryInfo->DefaultAlert2,
BatteryData->BatteryInformation.DefaultAlert2);
/* Choose the highest critical bias */
BatteryInfo->CriticalBias = max(BatteryInfo->CriticalBias,
BatteryData->BatteryInformation.CriticalBias);
}
/* Re-acquire the device extension lock and release the remove lock */
ExAcquireFastMutex(&DeviceExtension->Lock);
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
}
/* Next entry */
NextEntry = NextEntry->Flink;
}
/* We are done with the list, check if the information was queried okay */
ExReleaseFastMutex(&DeviceExtension->Lock);
if (NT_SUCCESS(Status))
{
/* If there's no fully charged capacity, use the design capacity */
if (!BatteryInfo->FullChargedCapacity)
{
BatteryInfo->FullChargedCapacity = BatteryInfo->DesignedCapacity;
}
/* Print out final combined data */
if (CompBattDebug & 2)
DbgPrint("CompBattGetBatteryInformation: Returning BATTERY_INFORMATION\n"
"-------- Capabilities = %x\n-------- Technology = %x\n"
"-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
"-------- FullChargedCapacity = %x\n-------- DefaultAlert1 = %x\n"
"-------- DefaultAlert2 = %x\n-------- CriticalBias = %x\n"
"-------- CycleCount = %x\n",
BatteryInfo->Capabilities,
BatteryInfo->Technology,
BatteryInfo->Chemistry,
BatteryInfo->DesignedCapacity,
BatteryInfo->FullChargedCapacity,
BatteryInfo->DefaultAlert1,
BatteryInfo->DefaultAlert2,
BatteryInfo->CriticalBias,
BatteryInfo->CycleCount);
/* Copy the data into the device extension */
RtlCopyMemory(&DeviceExtension->BatteryInformation,
BatteryInfo,
sizeof(DeviceExtension->BatteryInformation));
DeviceExtension->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
}
/* We are done */
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryInformation\n");
return Status;
}
NTSTATUS
@ -173,8 +394,85 @@ NTAPI
CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
NTSTATUS Status = STATUS_SUCCESS;
BATTERY_QUERY_INFORMATION InputBuffer;
PCOMPBATT_BATTERY_DATA BatteryData;
BATTERY_REPORTING_SCALE BatteryScale[4];
PLIST_ENTRY ListHead, NextEntry;
ULONG i;
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryGranularity\n");
/* Set defaults */
ReportingScale[0].Granularity = -1;
ReportingScale[1].Granularity = -1;
ReportingScale[2].Granularity = -1;
ReportingScale[3].Granularity = -1;
/* Loop the battery list */
ExAcquireFastMutex(&DeviceExtension->Lock);
ListHead = &DeviceExtension->BatteryList;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Try to acquire the remove lock */
BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
if (NT_SUCCESS(IoAcquireRemoveLock(&BatteryData->RemoveLock, 0)))
{
/* Now release the device lock since the battery can't go away */
ExReleaseFastMutex(&DeviceExtension->Lock);
/* Build the query */
InputBuffer.BatteryTag = BatteryData->Tag;
InputBuffer.InformationLevel = BatteryGranularityInformation;
/* Make sure the battery has a tag */
if (BatteryData->Tag)
{
/* Send the IOCTL to query the information */
RtlZeroMemory(&BatteryData->BatteryInformation,
sizeof(BatteryData->BatteryInformation));
Status = BatteryIoctl(IOCTL_BATTERY_QUERY_INFORMATION,
BatteryData->DeviceObject,
&InputBuffer,
sizeof(InputBuffer),
&BatteryScale,
sizeof(BatteryScale),
0);
if (!NT_SUCCESS(Status))
{
/* Fail if the query had a problem */
ExAcquireFastMutex(&DeviceExtension->Lock);
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
break;
}
/* Loop all 4 scales */
for (i = 0; i < 4; i++)
{
/* Check for valid granularity */
if (BatteryScale[i].Granularity)
{
/* If it's smaller, use it instead */
ReportingScale[i].Granularity = min(BatteryScale[i].Granularity,
ReportingScale[i].Granularity);
}
}
}
/* Re-acquire the device extension lock and release the remove lock */
ExAcquireFastMutex(&DeviceExtension->Lock);
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
}
/* Next entry */
NextEntry = NextEntry->Flink;
}
/* All done */
ExReleaseFastMutex(&DeviceExtension->Lock);
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryGranularity\n");
return STATUS_SUCCESS;
}
NTSTATUS
@ -188,7 +486,7 @@ CompBattGetEstimatedTime(OUT PULONG Time,
NTSTATUS
NTAPI
CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION FdoExtension,
CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
IN ULONG Tag,
IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel,
IN OPTIONAL LONG AtRate,
@ -196,8 +494,109 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION FdoExtension,
IN ULONG BufferLength,
OUT PULONG ReturnedLength)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
BATTERY_INFORMATION BatteryInfo;
BATTERY_REPORTING_SCALE BatteryGranularity[4];
PWCHAR BatteryName = L"Composite Battery";
BATTERY_MANUFACTURE_DATE Date;
ULONG Dummy, Time;
PVOID QueryData = NULL;
ULONG QueryLength = 0;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING QueryInformation\n");
/* Check for valid/correct tag */
if ((Tag != DeviceExtension->Tag) ||
(!(DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED)))
{
/* Not right, so fail */
return STATUS_NO_SUCH_DEVICE;
}
/* Check what caller wants */
switch (InfoLevel)
{
case BatteryInformation:
/* Query combined battery information */
RtlZeroMemory(&BatteryInfo, sizeof(BatteryInfo));
Status = CompBattGetBatteryInformation(&BatteryInfo, DeviceExtension);
if (NT_SUCCESS(Status))
{
/* Return the data if successful */
QueryData = &BatteryInfo;
QueryLength = sizeof(BatteryInfo);
}
break;
case BatteryGranularityInformation:
/* Query combined granularity information */
RtlZeroMemory(&BatteryGranularity, sizeof(BatteryGranularity));
Status = CompBattGetBatteryGranularity(BatteryGranularity, DeviceExtension);
if (NT_SUCCESS(Status))
{
/* Return the data if successful */
QueryLength = sizeof(BatteryGranularity);
QueryData = &BatteryGranularity;
}
break;
case BatteryEstimatedTime:
/* Query combined time estimate information */
RtlZeroMemory(&Time, sizeof(Time));
Status = CompBattGetEstimatedTime(&Time, DeviceExtension);
if (NT_SUCCESS(Status))
{
/* Return the data if successful */
QueryLength = sizeof(Time);
QueryData = &Time;
}
break;
case BatteryManufactureName:
case BatteryDeviceName:
/* Return the static buffer */
QueryData = BatteryName;
QueryLength = sizeof(L"Composite Battery");
break;
case BatteryManufactureDate:
/* Static data */
Date.Day = 26;
Date.Month = 06;
Date.Year = 1997;
break;
case BatteryTemperature:
case BatteryUniqueID:
/* Return zero */
Dummy = 0;
QueryData = &Dummy;
QueryLength = sizeof(Dummy);
break;
default:
/* Everything else is unknown */
Status = STATUS_INVALID_PARAMETER;
break;
}
/* Return the required length and check if the caller supplied enough */
*ReturnedLength = QueryLength;
if (BufferLength < QueryLength) Status = STATUS_BUFFER_TOO_SMALL;
/* Copy the data if there's enough space and it exists */
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
/* Return function result */
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING QueryInformation\n");
return Status;
}
NTSTATUS
@ -209,13 +608,12 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
DriverObject->DriverExtension->AddDevice = CompBattAddDevice;
/* Register other handlers */
DriverObject->MajorFunction[0] = CompBattOpenClose;
DriverObject->MajorFunction[2] = CompBattOpenClose;
DriverObject->MajorFunction[14] = CompBattIoctl;
DriverObject->MajorFunction[22] = CompBattPowerDispatch;
DriverObject->MajorFunction[23] = CompBattSystemControl;
DriverObject->MajorFunction[27] = CompBattPnpDispatch;
DriverObject->MajorFunction[IRP_MJ_CREATE] = CompBattOpenClose;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CompBattOpenClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = CompBattIoctl;
DriverObject->MajorFunction[IRP_MJ_POWER] = CompBattPowerDispatch;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = CompBattSystemControl;
DriverObject->MajorFunction[IRP_MJ_PNP] = CompBattPnpDispatch;
return STATUS_SUCCESS;
}

View file

@ -10,8 +10,12 @@
#include <initguid.h>
#include <batclass.h>
#include <debug.h>
#include <wdmguid.h>
typedef struct _COMPBATT_BATTERY_ENTRY
#define COMPBATT_BATTERY_INFORMATION_PRESENT 0x04
#define COMPBATT_TAG_ASSIGNED 0x80
typedef struct _COMPBATT_BATTERY_DATA
{
LIST_ENTRY BatteryLink;
IO_REMOVE_LOCK RemoveLock;
@ -31,7 +35,7 @@ typedef struct _COMPBATT_BATTERY_ENTRY
BATTERY_STATUS BatteryStatus;
ULONGLONG InterruptTime;
UNICODE_STRING BatteryName;
} COMPBATT_BATTERY_ENTRY, *PCOMPBATT_BATTERY_ENTRY;
} COMPBATT_BATTERY_DATA, *PCOMPBATT_BATTERY_DATA;
typedef struct _COMPBATT_DEVICE_EXTENSION
{
@ -114,6 +118,41 @@ CompBattQueryTag(
OUT PULONG Tag
);
NTSTATUS
NTAPI
CompBattMonitorIrpComplete(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PKEVENT Event
);
NTSTATUS
NTAPI
CompBattMonitorIrpCompleteWorker(
IN PCOMPBATT_BATTERY_DATA BatteryData
);
NTSTATUS
NTAPI
CompBattGetDeviceObjectPointer(
IN PUNICODE_STRING DeviceName,
IN ACCESS_MASK DesiredAccess,
OUT PFILE_OBJECT *FileObject,
OUT PDEVICE_OBJECT *DeviceObject
);
NTSTATUS
NTAPI
BatteryIoctl(
IN ULONG IoControlCode,
IN PDEVICE_OBJECT DeviceObject,
IN PVOID InputBuffer,
IN ULONG InputBufferLength,
IN PVOID OutputBuffer,
IN ULONG OutputBufferLength,
IN BOOLEAN InternalDeviceIoControl
);
extern ULONG CompBattDebug;
/* EOF */

View file

@ -22,19 +22,102 @@ BatteryIoctl(IN ULONG IoControlCode,
IN ULONG OutputBufferLength,
IN BOOLEAN InternalDeviceIoControl)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
IO_STATUS_BLOCK IoStatusBlock;
KEVENT Event;
NTSTATUS Status;
PIRP Irp;
PAGED_CODE();
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING BatteryIoctl\n");
/* Initialize the event and IRP */
KeInitializeEvent(&Event, SynchronizationEvent, 0);
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
DeviceObject,
InputBuffer,
InputBufferLength,
OutputBuffer,
OutputBufferLength,
InternalDeviceIoControl,
&Event,
&IoStatusBlock);
if (Irp)
{
/* Call the class driver miniport */
Status = IofCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
/* Wait for result */
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = IoStatusBlock.Status;
}
/* Print failure */
if (!(NT_SUCCESS(Status)) && (CompBattDebug & 8))
DbgPrint("BatteryIoctl: Irp failed - %x\n", Status);
/* Done */
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING BatteryIoctl\n");
}
else
{
/* Out of memory */
if (CompBattDebug & 8) DbgPrint("BatteryIoctl: couldn't create Irp\n");
Status = STATUS_INSUFFICIENT_RESOURCES;
}
/* Return status */
return Status;
}
NTSTATUS
NTAPI
CompBattGetDeviceObjectPointer(IN PCUNICODE_STRING DeviceName,
CompBattGetDeviceObjectPointer(IN PUNICODE_STRING DeviceName,
IN ACCESS_MASK DesiredAccess,
OUT PFILE_OBJECT *FileObject,
OUT PDEVICE_OBJECT *DeviceObject)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
PFILE_OBJECT LocalFileObject;
HANDLE DeviceHandle;
PAGED_CODE();
/* Open a file object handle to the device */
InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL);
Status = ZwCreateFile(&DeviceHandle,
DesiredAccess,
&ObjectAttributes,
&IoStatusBlock,
NULL,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
0,
NULL,
0);
if (NT_SUCCESS(Status))
{
/* Reference the file object */
Status = ObReferenceObjectByHandle(DeviceHandle,
0,
IoFileObjectType,
KernelMode,
(PVOID)&LocalFileObject,
NULL);
if (NT_SUCCESS(Status))
{
/* Return the FO and the associated DO */
*FileObject = LocalFileObject;
*DeviceObject = IoGetRelatedDeviceObject(LocalFileObject);
}
/* Close the handle */
ZwClose(DeviceHandle);
}
/* Return status */
return Status;
}
/* EOF */

View file

@ -28,13 +28,46 @@ CompBattPowerDispatch(IN PDEVICE_OBJECT DeviceObject,
return PoCallDriver(DeviceExtension->AttachedDevice, Irp);
}
PCOMPBATT_BATTERY_ENTRY
PCOMPBATT_BATTERY_DATA
NTAPI
RemoveBatteryFromList(IN PCUNICODE_STRING BatteryName,
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return NULL;
PLIST_ENTRY ListHead, NextEntry;
PCOMPBATT_BATTERY_DATA BatteryData;
if (CompBattDebug & 1)
DbgPrint("CompBatt: ENTERING RemoveBatteryFromList\n");
/* Loop the battery list */
ExAcquireFastMutex(&DeviceExtension->Lock);
ListHead = &DeviceExtension->BatteryList;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Get the battery information and compare the name */
BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
if (!RtlCompareUnicodeString(BatteryName, &BatteryData->BatteryName, TRUE))
{
/* Flush pending deletes and any lock waiters */
IoAcquireRemoveLock(&BatteryData->RemoveLock, 0);
ExReleaseFastMutex(&DeviceExtension->Lock);
IoReleaseRemoveLockAndWait(&BatteryData->RemoveLock, 0);
/* Remove the entry from the list */
ExAcquireFastMutex(&DeviceExtension->Lock);
RemoveEntryList(&BatteryData->BatteryLink);
ExReleaseFastMutex(&DeviceExtension->Lock);
return BatteryData;
}
/* Next */
NextEntry = NextEntry->Flink;
}
/* Done */
ExReleaseFastMutex(&DeviceExtension->Lock);
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING RemoveBatteryFromList\n");
return STATUS_SUCCESS;
}
BOOLEAN
@ -42,17 +75,143 @@ NTAPI
IsBatteryAlreadyOnList(IN PCUNICODE_STRING BatteryName,
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return FALSE;
PLIST_ENTRY ListHead, NextEntry;
PCOMPBATT_BATTERY_DATA BatteryData;
BOOLEAN Found = FALSE;
if (CompBattDebug & 1)
DbgPrint("CompBatt: ENTERING IsBatteryAlreadyOnList\n");
/* Loop the battery list */
ExAcquireFastMutex(&DeviceExtension->Lock);
ListHead = &DeviceExtension->BatteryList;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Get the battery information and compare the name */
BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
if (!RtlCompareUnicodeString(BatteryName, &BatteryData->BatteryName, TRUE))
{
/* Got it */
Found = TRUE;
break;
}
/* Next */
NextEntry = NextEntry->Flink;
}
/* Release the lock and return search status */
ExReleaseFastMutex(&DeviceExtension->Lock);
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING IsBatteryAlreadyOnList\n");
return Found;
}
NTSTATUS
NTAPI
CompBattAddNewBattery(IN PCUNICODE_STRING BatteryName,
CompBattAddNewBattery(IN PUNICODE_STRING BatteryName,
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
NTSTATUS Status = STATUS_SUCCESS;
PCOMPBATT_BATTERY_DATA BatteryData;
PIRP Irp;
PIO_STACK_LOCATION IoStackLocation;
PFILE_OBJECT FileObject;
PAGED_CODE();
if (CompBattDebug & 1)
DbgPrint("CompBatt: ENTERING AddNewBattery \"%w\" \n", BatteryName->Buffer);
/* Is this a new battery? */
if (!IsBatteryAlreadyOnList(BatteryName, DeviceExtension))
{
/* Allocate battery data */
BatteryData = ExAllocatePoolWithTag(NonPagedPool,
sizeof(COMPBATT_BATTERY_DATA) +
BatteryName->Length,
'CtaB');
if (BatteryData)
{
/* Initialize the data and write the battery name */
RtlZeroMemory(BatteryData, sizeof(COMPBATT_BATTERY_DATA));
BatteryData->Tag = 0;
BatteryData->BatteryName.MaximumLength = BatteryName->Length;
BatteryData->BatteryName.Buffer = (PWCHAR)(BatteryData + 1);
RtlCopyUnicodeString(&BatteryData->BatteryName, BatteryName);
/* Get the device object */
Status = CompBattGetDeviceObjectPointer(BatteryName,
FILE_ALL_ACCESS,
&FileObject,
&BatteryData->DeviceObject);
if (NT_SUCCESS(Status))
{
/* Reference the DO and drop the FO */
ObfReferenceObject(BatteryData->DeviceObject);
ObfDereferenceObject(FileObject);
/* Allocate the battery IRP */
Irp = IoAllocateIrp(BatteryData->DeviceObject->StackSize + 1, 0);
if (Irp)
{
/* Save it */
BatteryData->Irp = Irp;
/* Setup the stack location */
IoStackLocation = IoGetNextIrpStackLocation(Irp);
IoStackLocation->Parameters.Others.Argument1 = DeviceExtension;
IoStackLocation->Parameters.Others.Argument2 = BatteryData;
/* Set IRP data */
IoSetNextIrpStackLocation(Irp);
Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
BatteryData->WaitFlag = 0;
/* Insert this battery in the list */
ExAcquireFastMutex(&DeviceExtension->Lock);
InsertTailList(&DeviceExtension->BatteryList,
&BatteryData->BatteryLink);
ExReleaseFastMutex(&DeviceExtension->Lock);
/* Initialize the work item and delete lock */
IoInitializeRemoveLock(&BatteryData->RemoveLock, 0, 0, 0);
ExInitializeWorkItem(&BatteryData->WorkItem,
(PVOID)CompBattMonitorIrpCompleteWorker,
BatteryData);
/* Setup the IRP work entry */
CompBattMonitorIrpComplete(BatteryData->DeviceObject, Irp, 0);
Status = STATUS_SUCCESS;
}
else
{
/* Fail, no memory */
if (CompBattDebug & 8)
DbgPrint("CompBatt: Couldn't allocate new battery Irp\n");
Status = STATUS_INSUFFICIENT_RESOURCES;
ObfDereferenceObject(BatteryData->DeviceObject);
}
}
else if (CompBattDebug & 8)
{
/* Fail */
DbgPrint("CompBattAddNewBattery: Failed to get device Object. status = %lx\n",
Status);
}
/* Free the battery data */
ExFreePool(BatteryData);
}
else
{
/* Fail, no memory */
if (CompBattDebug & 8)
DbgPrint("CompBatt: Couldn't allocate new battery node\n");
Status = STATUS_INSUFFICIENT_RESOURCES;
}
}
/* We're done */
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING AddNewBattery\n");
return Status;
}
NTSTATUS
@ -60,16 +219,65 @@ NTAPI
CompBattRemoveBattery(IN PCUNICODE_STRING BatteryName,
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
PCOMPBATT_BATTERY_DATA BatteryData;
if (CompBattDebug & 1) DbgPrint("CompBatt: RemoveBattery\n");
/* Remove the entry */
BatteryData = RemoveBatteryFromList(BatteryName, DeviceExtension);
if (BatteryData)
{
/* Dereference and free it */
ObfDereferenceObject(BatteryData->DeviceObject);
ExFreePool(BatteryData);
/* Notify class driver */
DeviceExtension->Flags = 0;
BatteryClassStatusNotify(DeviceExtension->ClassData);
}
/* It's done */
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
CompBattGetBatteries(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
PWCHAR p;
NTSTATUS Status;
PWCHAR LinkList;
UNICODE_STRING LinkString;
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteries\n");
/* Get all battery links */
Status = IoGetDeviceInterfaces(&GUID_DEVICE_BATTERY, NULL, 0, &LinkList);
p = LinkList;
if (NT_SUCCESS(Status))
{
/* Loop all strings inside */
while (TRUE)
{
/* Create the string */
RtlInitUnicodeString(&LinkString, p);
if (!LinkString.Length) break;
/* Add this battery and move on */
Status = CompBattAddNewBattery(&LinkString, DeviceExtension);
p += (LinkString.Length / sizeof(WCHAR)) + sizeof(UNICODE_NULL);
}
/* Parsing complete, clean up buffer */
ExFreePool(LinkList);
}
else if (CompBattDebug & 8)
{
/* Fail */
DbgPrint("CompBatt: Couldn't get list of batteries\n");
}
/* Done */
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteries\n");
return Status;
}
NTSTATUS
@ -77,8 +285,32 @@ NTAPI
CompBattPnpEventHandler(IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification,
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING PnpEventHandler\n");
if (CompBattDebug & 2) DbgPrint("CompBatt: Received device interface change notification\n");
/* Check what happened */
if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_ARRIVAL))
{
/* Add the new battery */
if (CompBattDebug & 2)
DbgPrint("CompBatt: Received notification of battery arrival\n");
CompBattAddNewBattery(Notification->SymbolicLinkName, DeviceExtension);
}
else if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_REMOVAL))
{
/* Don't do anything */
if (CompBattDebug & 2)
DbgPrint("CompBatt: Received notification of battery removal\n");
}
else
{
/* Shouldn't happen */
if (CompBattDebug & 2) DbgPrint("CompBatt: Received unhandled PnP event\n");
}
/* Done, return success */
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING PnpEventHandler\n");
return STATUS_SUCCESS;
}
NTSTATUS
@ -251,7 +483,7 @@ CompBattPnpDispatch(IN PDEVICE_OBJECT DeviceObject,
{
/* Complete the request */
Status = Irp->IoStatus.Status;
IofCompleteRequest(Irp, IO_NO_INCREMENT);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
/* Release the remove lock and return status */

View file

@ -1,10 +1,10 @@
/* DDK/NDK/SDK Headers */
#include <ddk/ntddk.h>
#include <ddk/ntddmou.h>
#include <ddk/ntifs.h>
#include <ddk/tvout.h>
#include <ndk/ntndk.h>
#include <ntddk.h>
#include <ntddmou.h>
#include <ntifs.h>
#include <tvout.h>
#include <ntndk.h>
#include <stdarg.h>
#include <windef.h>
@ -16,7 +16,7 @@
#include <dde.h>
#include <ddk/ddkmapi.h>
#include <ddkmapi.h>
/* Prototypes */
VOID DxGetVersionNumber(PVOID lpvInBuffer, LPDDGETVERSIONNUMBER lpvOutBuffer);

View file

@ -1,9 +1,9 @@
/* DDK/NDK/SDK Headers */
#include <ddk/ntddk.h>
#include <ddk/ntddmou.h>
#include <ddk/ntifs.h>
#include <ddk/tvout.h>
#include <ndk/ntndk.h>
#include <ntddk.h>
#include <ntddmou.h>
#include <ntifs.h>
#include <tvout.h>
#include <ntndk.h>
/* Win32 Headers */
#define WINBASEAPI

View file

@ -42,8 +42,11 @@ typedef unsigned char BYTE;
/* REACTOS FIXME */
#undef DeleteFile
/* This is deprecated and should be changed in the EXT2FS driver. */
/* FIXME : Those two definitions already exist in wdm.h
#define RtlLargeIntegerLessThan(a, b) (a).QuadPart < (b).QuadPart
#define RtlLargeIntegerGreaterThan(a, b) (a).QuadPart > (b).QuadPart
*/
// the following include files should be in the inc sub-dir associated with this driver

View file

@ -127,7 +127,7 @@ KsAddItemToObjectBag(
BagEntry->Free = ExFreePool;
/* insert item */
InsertTailList(&Bag->ObjectList, &Bag->Entry);
InsertTailList(&Bag->ObjectList, &BagEntry->Entry);
/* release mutex */
KeReleaseMutex(Bag->BagMutex, FALSE);

View file

@ -74,7 +74,7 @@ IKsDevice_fnInitializeObjectBag(
if (!Mutex)
{
/* use device mutex */
Mutex = &This->DeviceMutex;
Mutex = &This->BagMutex;
}
/* initialize object bag */
@ -220,12 +220,10 @@ IKsDevice_PnpPostStart(
PPNP_POSTSTART_CONTEXT Ctx = (PPNP_POSTSTART_CONTEXT)Context;
/* call driver pnp post routine */
Status = Ctx->DeviceHeader->Descriptor->Dispatch->PostStart(&Ctx->DeviceHeader->KsDevice);
Status = Ctx->DeviceHeader->KsDevice.Descriptor->Dispatch->PostStart(&Ctx->DeviceHeader->KsDevice);
if (!NT_SUCCESS(Status))
{
DPRINT1("Driver: PostStart Routine returned %x\n", Status);
/* set state to disabled */
Ctx->DeviceHeader->TargetState = KSTARGET_STATE_DISABLED;
}
@ -233,6 +231,7 @@ IKsDevice_PnpPostStart(
{
/* set state to enabled */
Ctx->DeviceHeader->TargetState = KSTARGET_STATE_ENABLED;
Status = KspSetFilterFactoriesState(Ctx->DeviceHeader, TRUE);
}
/* free work item */
@ -240,6 +239,8 @@ IKsDevice_PnpPostStart(
/* free work context */
FreeItem(Ctx);
DPRINT("IKsDevice_PnpPostStart: PostStart Routine returned %x\n", Status);
}
NTSTATUS
@ -253,6 +254,10 @@ IKsDevice_PnpStartDevice(
PKSIDEVICE_HEADER DeviceHeader;
PPNP_POSTSTART_CONTEXT Ctx = NULL;
NTSTATUS Status;
PCM_RESOURCE_LIST TranslatedResourceList;
PCM_RESOURCE_LIST UntranslatedResourceList;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor, UnPartialDescriptor;
ULONG Index;
/* get current stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@ -261,6 +266,8 @@ IKsDevice_PnpStartDevice(
/* get device header */
DeviceHeader = DeviceExtension->DeviceHeader;
DPRINT("IKsDevice_PnpStartDevice DeviceHeader %p\n", DeviceHeader);
/* first forward irp to lower device object */
Status = KspForwardIrpSynchronous(DeviceObject, Irp);
@ -273,20 +280,55 @@ IKsDevice_PnpStartDevice(
return Status;
}
TranslatedResourceList = IoStack->Parameters.StartDevice.AllocatedResourcesTranslated;
UntranslatedResourceList = IoStack->Parameters.StartDevice.AllocatedResources;
DPRINT("ResourceDescriptorCount %lu\n", TranslatedResourceList->List[0].PartialResourceList.Count);
for (Index = 0; Index < TranslatedResourceList->List[0].PartialResourceList.Count; Index ++ )
{
PartialDescriptor = &TranslatedResourceList->List[0].PartialResourceList.PartialDescriptors[Index];
UnPartialDescriptor = &UntranslatedResourceList->List[0].PartialResourceList.PartialDescriptors[Index];
DPRINT("Descriptor Type %u\n", PartialDescriptor->Type);
if (PartialDescriptor->Type == CmResourceTypeInterrupt)
{
DPRINT("CmResourceTypeInterrupt Index %u TRANS Interrupt Number Affinity %x Level %u Vector %u Flags %x Share %x\n", Index, PartialDescriptor->u.Interrupt.Affinity, PartialDescriptor->u.Interrupt.Level, PartialDescriptor->u.Interrupt.Vector, PartialDescriptor->Flags, PartialDescriptor->ShareDisposition);
DPRINT("CmResourceTypeInterrupt Index %u UNTRANS Interrupt Number Affinity %x Level %u Vector %u Flags %x Share %x\\n", Index, UnPartialDescriptor->u.Interrupt.Affinity, UnPartialDescriptor->u.Interrupt.Level, UnPartialDescriptor->u.Interrupt.Vector, UnPartialDescriptor->Flags, UnPartialDescriptor->ShareDisposition);
}
else if (PartialDescriptor->Type == CmResourceTypePort)
{
DPRINT("CmResourceTypePort Index %u TRANS Port Length %u Start %u %u Flags %x Share %x\n", Index, PartialDescriptor->u.Port.Length, PartialDescriptor->u.Port.Start.HighPart, PartialDescriptor->u.Port.Start.LowPart, PartialDescriptor->Flags, PartialDescriptor->ShareDisposition);
DPRINT("CmResourceTypePort Index %u UNTRANS Port Length %u Start %u %u Flags %x Share %x\n", Index, UnPartialDescriptor->u.Port.Length, UnPartialDescriptor->u.Port.Start.HighPart, UnPartialDescriptor->u.Port.Start.LowPart, UnPartialDescriptor->Flags, UnPartialDescriptor->ShareDisposition);
}
else if (PartialDescriptor->Type == CmResourceTypeMemory)
{
DPRINT("CmResourceTypeMemory Index %u TRANS Start %x Length %u Flags %x Share %x\n", Index, PartialDescriptor->u.Memory.Start.LowPart, PartialDescriptor->u.Memory.Length, PartialDescriptor->Flags, PartialDescriptor->ShareDisposition);
DPRINT("CmResourceTypeMemory Index %u TRANS Start %x Length %u Flags %x Share %x\n", Index, UnPartialDescriptor->u.Memory.Start.LowPart, UnPartialDescriptor->u.Memory.Length, UnPartialDescriptor->Flags, UnPartialDescriptor->ShareDisposition);
}
}
ASSERT(DeviceHeader->KsDevice.Descriptor);
ASSERT(DeviceHeader->KsDevice.Descriptor->Dispatch);
ASSERT(DeviceHeader->KsDevice.Descriptor->Dispatch->Start);
/* do we have a device descriptor */
if (DeviceHeader->Descriptor)
if (DeviceHeader->KsDevice.Descriptor)
{
/* does the device want pnp notifications */
if (DeviceHeader->Descriptor->Dispatch)
if (DeviceHeader->KsDevice.Descriptor->Dispatch)
{
/* does the driver care about IRP_MN_START_DEVICE */
if (DeviceHeader->Descriptor->Dispatch->Start)
if (DeviceHeader->KsDevice.Descriptor->Dispatch->Start)
{
/* call driver start device routine */
Status = DeviceHeader->Descriptor->Dispatch->Start(&DeviceHeader->KsDevice, Irp,
IoStack->Parameters.StartDevice.AllocatedResourcesTranslated,
IoStack->Parameters.StartDevice.AllocatedResources);
Status = DeviceHeader->KsDevice.Descriptor->Dispatch->Start(&DeviceHeader->KsDevice, Irp,
TranslatedResourceList,
UntranslatedResourceList);
DPRINT("IKsDevice_PnpStartDevice Start %p, Context %p\n", DeviceHeader->KsDevice.Descriptor->Dispatch->Start, DeviceHeader->KsDevice.Context);
ASSERT(Status != STATUS_PENDING);
if (!NT_SUCCESS(Status))
@ -303,7 +345,7 @@ IKsDevice_PnpStartDevice(
}
/* does the driver need post start routine */
if (DeviceHeader->Descriptor->Dispatch->PostStart)
if (DeviceHeader->KsDevice.Descriptor->Dispatch->PostStart)
{
/* allocate pnp post workitem context */
Ctx = (PPNP_POSTSTART_CONTEXT)AllocateItem(NonPagedPool, sizeof(PNP_POSTSTART_CONTEXT));
@ -335,6 +377,7 @@ IKsDevice_PnpStartDevice(
{
/* set state to enabled, IRP_MJ_CREATE request may now succeed */
DeviceHeader->TargetState = KSTARGET_STATE_ENABLED;
Status = KspSetFilterFactoriesState(DeviceHeader, TRUE);
}
}
}
@ -351,6 +394,7 @@ IKsDevice_PnpStartDevice(
}
/* return result */
DPRINT1("IKsDevice_PnpStartDevice Status %x PostStartRoutine %p\n", Status, Ctx);
return Status;
}
@ -375,10 +419,10 @@ IKsDevice_Pnp(
DeviceHeader = DeviceExtension->DeviceHeader;
/* do we have a device descriptor */
if (DeviceHeader->Descriptor)
if (DeviceHeader->KsDevice.Descriptor && DeviceHeader->KsDevice.Descriptor->Dispatch)
{
/* does the device want pnp notifications */
Dispatch = (PKSDEVICE_DISPATCH)DeviceHeader->Descriptor->Dispatch;
Dispatch = (PKSDEVICE_DISPATCH)DeviceHeader->KsDevice.Descriptor->Dispatch;
}
switch (IoStack->MinorFunction)
@ -472,7 +516,7 @@ IKsDevice_Pnp(
/* pass the irp down the driver stack */
Status = KspForwardIrpSynchronous(DeviceObject, Irp);
DPRINT("Next Device: Status %x\n", Status);
DPRINT1("IRP_MN_QUERY_INTERFACE Next Device: Status %x\n", Status);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
@ -480,36 +524,32 @@ IKsDevice_Pnp(
}
case IRP_MN_QUERY_DEVICE_RELATIONS:
{
DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS\n");
/* pass the irp down the driver stack */
Status = KspForwardIrpSynchronous(DeviceObject, Irp);
DPRINT("Next Device: Status %x\n", Status);
DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS Next Device: Status %x\n", Status);
Irp->IoStatus.Status = Status;
//Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
{
DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
/* pass the irp down the driver stack */
Status = KspForwardIrpSynchronous(DeviceObject, Irp);
//Status = KspForwardIrpSynchronous(DeviceObject, Irp);
Status = Irp->IoStatus.Status;
DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS Next Device: Status %x\n", Status);
DPRINT("Next Device: Status %x\n", Status);
Irp->IoStatus.Status = Status;
//Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
{
DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
/* pass the irp down the driver stack */
Status = KspForwardIrpSynchronous(DeviceObject, Irp);
DPRINT("Next Device: Status %x\n", Status);
DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS Next Device: Status %x\n", Status);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
@ -552,7 +592,7 @@ IKsDevice_Create(
PKSIOBJECT_HEADER ObjectHeader;
NTSTATUS Status;
DPRINT("KS / CREATE\n");
DPRINT("IKsDevice_Create\n");
/* get current stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
/* get device extension */
@ -630,9 +670,11 @@ KsInitializeDevice(
PDEVICE_EXTENSION DeviceExtension;
PKSIDEVICE_HEADER Header;
ULONG Index;
IKsDevice * KsDevice;
PKSIOBJECT_BAG Bag;
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("KsInitializeDevice Descriptor %p\n", Descriptor);
/* get device extension */
DeviceExtension = (PDEVICE_EXTENSION)FunctionalDeviceObject->DeviceExtension;
@ -642,10 +684,13 @@ KsInitializeDevice(
/* point to allocated header */
Header = DeviceExtension->DeviceHeader;
DPRINT("DeviceHeader %p\n", DeviceExtension->DeviceHeader);
/* check for success */
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to allocate device header with %x\n", Status);
DPRINT1("KsInitializeDevice Failed to allocate device header with %x\n", Status);
return Status;
}
@ -653,7 +698,7 @@ KsInitializeDevice(
Header->lpVtblIKsDevice = &vt_IKsDevice;
Header->ref = 1;
/* initialize object bag */
/* allocate object bag */
Header->KsDevice.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG));
if (!Header->KsDevice.Bag)
{
@ -662,25 +707,41 @@ KsInitializeDevice(
return STATUS_INSUFFICIENT_RESOURCES;
}
KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice;
KsDevice->lpVtbl->InitializeObjectBag(KsDevice, Header->KsDevice.Bag, NULL);
/* initialize object bag */
KeInitializeMutex(&Header->BagMutex, 0);
KeInitializeMutex(&Header->DeviceMutex, 0);
Bag = (PKSIOBJECT_BAG)Header->KsDevice.Bag;
Bag->BagMutex = &Header->BagMutex;
InitializeListHead(&Header->ObjectBags);
InitializeListHead(&Bag->ObjectList);
Bag->DeviceHeader = (PVOID)Header;
/* insert bag into device list */
InsertTailList(&Header->ObjectBags, &Bag->Entry);
/* initialize device header */
Header->KsDevice.FunctionalDeviceObject = FunctionalDeviceObject;
Header->KsDevice.PhysicalDeviceObject = PhysicalDeviceObject;
Header->KsDevice.NextDeviceObject = NextDeviceObject;
Header->KsDevice.Descriptor = Descriptor;
Header->KsDevice.SystemPowerState = PowerSystemWorking;
Header->KsDevice.DevicePowerState = PowerDeviceD0;
Header->KsDevice.Started = FALSE;
Header->KsDevice.Context = NULL;
KsSetDevicePnpAndBaseObject(Header, PhysicalDeviceObject, NextDeviceObject);
/* FIXME Power state */
if (Descriptor)
{
/* create a filter factory for each filter descriptor */
DPRINT("KsInitializeDevice FilterDescriptorCount %lu\n", Descriptor->FilterDescriptorsCount);
for(Index = 0; Index < Descriptor->FilterDescriptorsCount; Index++)
{
Status = KspCreateFilterFactory(FunctionalDeviceObject, Descriptor->FilterDescriptors[Index], NULL, NULL, 0, NULL, NULL, NULL);
DPRINT("KsInitializeDevice Index %lu KspCreateFilterFactory Status %lx\n", Index, Status);
/* check for success */
if (!NT_SUCCESS(Status))
{
@ -697,6 +758,7 @@ KsInitializeDevice(
Status = Descriptor->Dispatch->Add(&Header->KsDevice);
DPRINT("Driver: AddHandler Status %x\n", Status);
Header->KsDevice.Descriptor = Descriptor;
}
}

View file

@ -17,6 +17,9 @@ KspSetDeviceInterfacesState(
SymEntry = (PSYMBOLIC_LINK_ENTRY)CONTAINING_RECORD(Entry, SYMBOLIC_LINK_ENTRY, Entry);
/* set device interface state */
Status = IoSetDeviceInterfaceState(&SymEntry->SymbolicLink, Enable);
DPRINT("KspSetDeviceInterfacesState SymbolicLink %S Status %lx\n", SymEntry->SymbolicLink.Buffer, Status, Enable);
/* check for success */
if (!NT_SUCCESS(Status))
return Status;
@ -95,4 +98,34 @@ KspRegisterDeviceInterfaces(
return Status;
}
NTSTATUS
KspSetFilterFactoriesState(
IN PKSIDEVICE_HEADER DeviceHeader,
IN BOOLEAN NewState)
{
PCREATE_ITEM_ENTRY CreateEntry;
PLIST_ENTRY Entry;
NTSTATUS Status = STATUS_SUCCESS;
/* grab first device interface */
Entry = DeviceHeader->ItemList.Flink;
while(Entry != &DeviceHeader->ItemList && Status == STATUS_SUCCESS)
{
/* grab create entry */
CreateEntry = CONTAINING_RECORD(Entry, CREATE_ITEM_ENTRY, Entry);
/* sanity check */
ASSERT(CreateEntry->CreateItem);
if (CreateEntry->CreateItem->Create == IKsFilterFactory_Create)
{
/* found our own filterfactory */
Status = KsFilterFactorySetDeviceClassesState((PKSFILTERFACTORY)CreateEntry->CreateItem->Context, NewState);
}
Entry = Entry->Flink;
}
/* store result */
return Status;
}

View file

@ -39,6 +39,8 @@ KsGetDevice(
{
PKSBASIC_HEADER BasicHeader = (PKSBASIC_HEADER)(ULONG_PTR)Object - sizeof(KSBASIC_HEADER);
DPRINT("KsGetDevice %p\n", Object);
ASSERT(BasicHeader->Type == KsObjectTypeFilterFactory || BasicHeader->Type == KsObjectTypeFilter || BasicHeader->Type == BasicHeader->Type);
return BasicHeader->KsDevice;
@ -63,6 +65,8 @@ KsCreateDevice(
if (!ExtensionSize)
ExtensionSize = sizeof(KSDEVICE_HEADER);
DPRINT("KsCreateDevice Descriptor %p ExtensionSize %lu\n", Descriptor, ExtensionSize);
Status = IoCreateDevice(DriverObject, ExtensionSize, NULL, FILE_DEVICE_KS, FILE_DEVICE_SECURE_OPEN, FALSE, &FunctionalDeviceObject);
if (!NT_SUCCESS(Status))
return Status;
@ -120,7 +124,8 @@ KsAddDevice(
const KSDEVICE_DESCRIPTOR *Descriptor = NULL;
/* get stored driver object extension */
DriverObjectExtension = IoGetDriverObjectExtension(DriverObject, (PVOID)KsAddDevice);
DriverObjectExtension = IoGetDriverObjectExtension(DriverObject, (PVOID)KsInitializeDriver);
if (DriverObjectExtension)
{
@ -144,17 +149,23 @@ KsInitializeDriver(
)
{
PKS_DRIVER_EXTENSION DriverObjectExtension;
NTSTATUS Status;
NTSTATUS Status = STATUS_SUCCESS;
if (Descriptor)
{
Status = IoAllocateDriverObjectExtension(DriverObject, (PVOID)KsAddDevice, sizeof(KS_DRIVER_EXTENSION), (PVOID*)&DriverObjectExtension);
Status = IoAllocateDriverObjectExtension(DriverObject, (PVOID)KsInitializeDriver, sizeof(KS_DRIVER_EXTENSION), (PVOID*)&DriverObjectExtension);
if (NT_SUCCESS(Status))
{
DriverObjectExtension->Descriptor = Descriptor;
}
}
/* sanity check */
ASSERT(Status == STATUS_SUCCESS);
if (!NT_SUCCESS(Status))
return Status;
/* Setting our IRP handlers */
DriverObject->MajorFunction[IRP_MJ_CREATE] = IKsDevice_Create;
DriverObject->MajorFunction[IRP_MJ_PNP] = IKsDevice_Pnp;
@ -168,7 +179,7 @@ KsInitializeDriver(
DriverObject->DriverExtension->AddDevice = KsAddDevice;
/* KS handles these */
DPRINT1("Setting KS function handlers\n");
DPRINT1("KsInitializeDriver Setting KS function handlers\n");
KsSetMajorFunctionHandler(DriverObject, IRP_MJ_CLOSE);
KsSetMajorFunctionHandler(DriverObject, IRP_MJ_DEVICE_CONTROL);

View file

@ -338,6 +338,8 @@ KspCreateFilterFactory(
IKsFilterFactory * Filter;
NTSTATUS Status;
DPRINT("KsCreateFilterFactory\n");
/* Lets allocate a filterfactory */
This = AllocateItem(NonPagedPool, sizeof(IKsFilterFactoryImpl));
if (!This)
@ -396,8 +398,10 @@ KsFilterFactorySetDeviceClassesState(
IN PKSFILTERFACTORY FilterFactory,
IN BOOLEAN NewState)
{
IKsFilterFactory * Factory = (IKsFilterFactory*)CONTAINING_RECORD(FilterFactory, IKsFilterFactoryImpl, FilterFactory);
IKsFilterFactory * Factory;
IKsFilterFactoryImpl * This = (IKsFilterFactoryImpl*)CONTAINING_RECORD(FilterFactory, IKsFilterFactoryImpl, FilterFactory);
Factory = (IKsFilterFactory*)&This->lpVtbl;
return Factory->lpVtbl->SetDeviceClassesState(Factory, NewState);
}
@ -465,7 +469,8 @@ KsFilterFactoryUpdateCacheData (
IN const KSFILTER_DESCRIPTOR* FilterDescriptor OPTIONAL)
{
UNIMPLEMENTED
DPRINT("KsFilterFactoryUpdateCacheData %p\n", FilterDescriptor);
return STATUS_NOT_IMPLEMENTED;
return STATUS_SUCCESS;
}

View file

@ -9,7 +9,7 @@
#include "priv.h"
const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x46}};
/* http://msdn2.microsoft.com/en-us/library/ms809781.aspx */
COMDDKAPI NTSTATUS NTAPI

View file

@ -144,3 +144,15 @@ KspPropertyHandler(
IN const KSPROPERTY_SET* PropertySet,
IN PFNKSALLOCATOR Allocator OPTIONAL,
IN ULONG PropertyItemSize OPTIONAL);
NTSTATUS
NTAPI
IKsFilterFactory_Create(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
KspSetFilterFactoriesState(
IN PKSIDEVICE_HEADER DeviceHeader,
IN BOOLEAN NewState);

View file

@ -103,7 +103,7 @@ typedef struct
LIST_ENTRY TargetDeviceList;
KMUTEX DeviceMutex;
KSDEVICE_DESCRIPTOR* Descriptor;
KMUTEX BagMutex;
LIST_ENTRY PowerDispatchList;
LIST_ENTRY ObjectBags;

View file

@ -70,7 +70,7 @@ KspForwardIrpSynchronous(
IoSetCompletionRoutine(Irp, KspForwardIrpSynchronousCompletion, (PVOID)&Event, TRUE, TRUE, TRUE);
/* now call the driver */
Status = IoCallDriver(DeviceHeader->BaseDevice, Irp);
Status = IoCallDriver(DeviceHeader->KsDevice.NextDeviceObject, Irp);
/* did the request complete yet */
if (Status == STATUS_PENDING)
{

View file

@ -52,13 +52,13 @@ KSMETHOD_SET FilterMethodSet =
KSAUTOMATION_TABLE FilterAutomationTable =
{
1,
sizeof(KSPROPERTY_SET),
sizeof(KSPROPERTY_ITEM),
&FilterPropertySet,
1,
sizeof(KSMETHOD_SET),
sizeof(KSMETHOD_ITEM),
&FilterMethodSet,
0,
sizeof(KSEVENT_SET),
sizeof(KSEVENT_ITEM),
NULL
};
@ -80,13 +80,13 @@ KSPROPERTY_SET PinPropertySet =
KSAUTOMATION_TABLE PinAutomationTable =
{
1,
sizeof(KSPROPERTY_SET),
sizeof(KSPROPERTY_ITEM),
&PinPropertySet,
0,
sizeof(KSMETHOD_SET),
sizeof(KSMETHOD_ITEM),
NULL,
0,
sizeof(KSEVENT_SET),
sizeof(KSEVENT_ITEM),
NULL
};
@ -157,6 +157,8 @@ NTAPI
DllInitialize(
PUNICODE_STRING RegistryPath)
{
DPRINT("BDASUP::DllInitialize\n");
KeInitializeSpinLock(&g_Settings.FilterFactoryInstanceListLock);
InitializeListHead(&g_Settings.FilterFactoryInstanceList);
g_Settings.Initialized = TRUE;
@ -171,6 +173,8 @@ NTSTATUS
NTAPI
BdaCheckChanges(IN PIRP Irp)
{
DPRINT("BdaCheckChanges\n");
if (!Irp)
return STATUS_INVALID_PARAMETER;
@ -184,6 +188,8 @@ NTSTATUS
NTAPI
BdaCommitChanges(IN PIRP Irp)
{
DPRINT("BdaCommitChanges\n");
if (!Irp)
return STATUS_INVALID_PARAMETER;
@ -257,6 +263,7 @@ BdaCreateFilterFactoryEx(
NTSTATUS Status;
KSFILTER_DESCRIPTOR FilterDescriptor;
DPRINT("BdaCreateFilterFactoryEx\n");
/* backup filter descriptor */
RtlMoveMemory(&FilterDescriptor, pFilterDescriptor, sizeof(KSFILTER_DESCRIPTOR));
@ -265,7 +272,10 @@ BdaCreateFilterFactoryEx(
/* check for success */
if (!NT_SUCCESS(Status))
{
DPRINT1("KsMergeAutomationTables failed with %lx\n", Status);
return Status;
}
/* allocate filter instance */
FilterInstance = AllocateItem(NonPagedPool, sizeof(BDA_FILTER_INSTANCE_ENTRY));
@ -287,6 +297,7 @@ BdaCreateFilterFactoryEx(
if (!NT_SUCCESS(Status))
{
/* destroy filter instance */
DPRINT1("KsAddItemToObjectBag failed with %lx\n", Status);
FreeItem(FilterInstance);
KsDeleteFilterFactory(FilterFactory);
return Status;
@ -316,9 +327,11 @@ BdaCreateFilterFactoryEx(
{
/* failed to create filter factory */
FreeItem(FilterInstance);
DPRINT1("KsCreateFilterFactory failed with %lx\n", Status);
}
/* done */
DPRINT("BdaCreateFilterFactoryEx Status %x\n", Status);
return Status;
}
@ -339,6 +352,8 @@ BdaCreatePin(
ULONG PinId;
KSPIN_DESCRIPTOR_EX NewPinDescriptor;
DPRINT("BdaCreatePin\n");
if (!pulPinId || !pKSFilter)
return STATUS_INVALID_PARAMETER;
@ -419,6 +434,8 @@ BdaMethodCreatePin(
PKSM_PIN Pin;
PKSFILTER Filter;
DPRINT("BdaMethodCreatePin\n");
if (!Irp)
{
/* invalid parameter */
@ -453,6 +470,8 @@ BdaInitFilter(
ULONG Index, PinId;
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("BdaInitFilter\n");
/* check input parameters */
if (!pKSFilter)
return STATUS_INVALID_PARAMETER;
@ -501,6 +520,8 @@ BdaCreateTopology(
PKSFILTERFACTORY FilterFactory;
KSTOPOLOGY_CONNECTION Connection;
DPRINT("BdaCreateTopology\n");
/* check input parameters */
if (!pKSFilter)
return STATUS_INVALID_PARAMETER;
@ -547,6 +568,7 @@ BdaDeletePin(
IN ULONG *pulPinId)
{
UNIMPLEMENTED
DPRINT("BdaDeletePin\n");
return STATUS_NOT_IMPLEMENTED;
}
@ -559,6 +581,7 @@ BdaFilterFactoryUpdateCacheData(
IN PKSFILTERFACTORY FilterFactory,
IN const KSFILTER_DESCRIPTOR *FilterDescriptor OPTIONAL)
{
DPRINT("BdaFilterFactoryUpdateCacheData\n");
return KsFilterFactoryUpdateCacheData(FilterFactory, FilterDescriptor);
}
@ -571,6 +594,8 @@ BdaGetChangeState(
IN PIRP Irp,
OUT BDA_CHANGE_STATE *ChangeState)
{
DPRINT("BdaGetChangeState\n");
if (Irp && ChangeState)
{
*ChangeState = BDA_CHANGES_COMPLETE;
@ -595,6 +620,8 @@ BdaMethodCreateTopology(
PKSFILTER Filter;
PKSP_BDA_NODE_PIN Node;
DPRINT("BdaMethodCreateTopology\n");
/* check input parameters */
if (!Irp || !pKSMethod)
return STATUS_INVALID_PARAMETER;
@ -622,6 +649,8 @@ BdaMethodDeletePin(
IN KSMETHOD *pKSMethod,
OPTIONAL PVOID pvIgnored)
{
DPRINT("BdaMethodDeletePin\n");
if (!Irp)
return STATUS_INVALID_PARAMETER;
@ -639,6 +668,7 @@ BdaPropertyGetControllingPinId(
OUT ULONG *pulControllingPinId)
{
UNIMPLEMENTED
DPRINT("BdaPropertyGetControllingPinId\n");
return STATUS_NOT_IMPLEMENTED;
}
@ -657,6 +687,8 @@ BdaPropertyGetPinControl(
PKSFILTERFACTORY FilterFactory;
PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
DPRINT("BdaPropertyGetPinControl\n");
/* first get the pin */
Pin = KsGetPinFromIrp(Irp);
ASSERT(Pin);
@ -694,6 +726,7 @@ BdaPropertyNodeDescriptors(
OUT BDANODE_DESCRIPTOR *pNodeDescriptorProperty)
{
UNIMPLEMENTED
DPRINT("BdaPropertyNodeDescriptors\n");
return STATUS_NOT_IMPLEMENTED;
}
@ -708,6 +741,7 @@ BdaPropertyNodeEvents(
OUT GUID *pguidProperty)
{
UNIMPLEMENTED
DPRINT("BdaPropertyNodeEvents\n");
return STATUS_NOT_IMPLEMENTED;
}
@ -722,6 +756,7 @@ BdaPropertyNodeMethods(
OUT GUID *pguidProperty)
{
UNIMPLEMENTED
DPRINT("BdaPropertyNodeMethods\n");
return STATUS_NOT_IMPLEMENTED;
}
@ -736,6 +771,7 @@ BdaPropertyNodeProperties(
OUT GUID *pguidProperty)
{
UNIMPLEMENTED
DPRINT("BdaPropertyNodeProperties\n");
return STATUS_NOT_IMPLEMENTED;
}
@ -755,6 +791,8 @@ BdaPropertyNodeTypes(
PIO_STACK_LOCATION IoStack;
ULONG Index;
DPRINT("BdaPropertyNodeTypes\n");
/* check input parameter */
if (!Irp || !pKSProperty)
return STATUS_INVALID_PARAMETER;
@ -821,6 +859,8 @@ BdaPropertyPinTypes(
PIO_STACK_LOCATION IoStack;
ULONG Index;
DPRINT("BdaPropertyPinTypes\n");
/* check input parameter */
if (!Irp || !pKSProperty)
return STATUS_INVALID_PARAMETER;
@ -886,6 +926,8 @@ BdaPropertyTemplateConnections(
PIO_STACK_LOCATION IoStack;
ULONG Index;
DPRINT("BdaPropertyTemplateConnections\n");
/* validate parameters */
if (!Irp || !pKSProperty)
return STATUS_INVALID_PARAMETER;
@ -941,6 +983,8 @@ NTSTATUS
NTAPI
BdaStartChanges(IN PIRP Irp)
{
DPRINT("BdaStartChanges\n");
if (Irp)
return STATUS_SUCCESS;
else
@ -955,6 +999,7 @@ NTSTATUS
NTAPI
BdaUninitFilter(IN PKSFILTER pKSFilter)
{
DPRINT("BdaUninitFilter\n");
return STATUS_SUCCESS;
}
@ -967,6 +1012,8 @@ BdaValidateNodeProperty(
IN PIRP Irp,
IN KSPROPERTY *KSProperty)
{
DPRINT("BdaValidateNodeProperty\n");
/* check for valid parameter */
if (Irp && KSProperty)
return STATUS_SUCCESS;

View file

@ -17,15 +17,6 @@
#define PST_RS232 1
#define COMMPROP_INITIALIZED 0xE73CF52E
#ifndef _NTIFS_
/* Why is it only defined in ntifs.h file? */
NTSTATUS NTAPI
IoAttachDeviceToDeviceStackSafe(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice,
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
#endif
typedef enum
{
dsStopped,

View file

@ -77,7 +77,7 @@ extern "C" {
SCSIPORT_API
VOID
DDKCDECLAPI
__cdecl
ScsiDebugPrint(
ULONG DebugPrintLevel,
PCCHAR DebugMessage,
@ -1066,7 +1066,7 @@ IdeMediaStatus(
IN UCHAR Channel
);
ULONG DDKAPI
ULONG NTAPI
AtapiFindController(
IN PVOID HwDeviceExtension,
IN PVOID Context,

View file

@ -1015,7 +1015,7 @@ UniataEnumBusMasterController(
PVOID Argument2
);
extern ULONG DDKAPI
extern ULONG NTAPI
UniataFindCompatBusMasterController1(
IN PVOID HwDeviceExtension,
IN PVOID Context,
@ -1025,7 +1025,7 @@ UniataFindCompatBusMasterController1(
OUT PBOOLEAN Again
);
extern ULONG DDKAPI
extern ULONG NTAPI
UniataFindCompatBusMasterController2(
IN PVOID HwDeviceExtension,
IN PVOID Context,
@ -1044,7 +1044,7 @@ UniataAllocateLunExt(
ULONG NewNumberChannels
);
extern ULONG DDKAPI
extern ULONG NTAPI
UniataFindBusMasterController(
IN PVOID HwDeviceExtension,
IN PVOID Context,
@ -1054,7 +1054,7 @@ UniataFindBusMasterController(
OUT PBOOLEAN Again
);
extern ULONG DDKAPI
extern ULONG NTAPI
UniataFindFakeBusMasterController(
IN PVOID HwDeviceExtension,
IN PVOID Context,

View file

@ -86,9 +86,7 @@
/* Compiler dependencies */
/***************************************************/
#define DDKAPI __stdcall
#define DDKFASTAPI __fastcall
#define DDKCDECLAPI __cdecl
/* Are we under GNU C (mingw) ??? */
#ifdef __GNUC__

View file

@ -94,7 +94,7 @@ BOOLEAN WinVer_WDM_Model = FALSE;
UCHAR g_foo = 0;
BOOLEAN
DDKAPI
NTAPI
AtapiResetController__(
IN PVOID HwDeviceExtension,
IN ULONG PathId,
@ -115,7 +115,7 @@ AtapiHwInitialize__(
#ifndef UNIATA_CORE
VOID
DDKAPI
NTAPI
AtapiCallBack_X(
IN PVOID HwDeviceExtension
);
@ -129,13 +129,13 @@ AtapiCallBack_X(
#endif
RETTYPE_XXableInterrupts
DDKAPI
NTAPI
AtapiInterruptDpc(
IN PVOID HwDeviceExtension
);
RETTYPE_XXableInterrupts
DDKAPI
NTAPI
AtapiEnableInterrupts__(
IN PVOID HwDeviceExtension
);
@ -150,7 +150,7 @@ AtapiQueueTimerDpc(
);
SCSI_ADAPTER_CONTROL_STATUS
DDKAPI
NTAPI
AtapiAdapterControl(
IN PVOID HwDeviceExtension,
IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
@ -1005,7 +1005,7 @@ AtaUmode(PIDENTIFY_DATA2 ident)
#ifndef UNIATA_CORE
VOID
DDKAPI
NTAPI
AtapiTimerDpc(
IN PVOID HwDeviceExtension
)
@ -1856,7 +1856,7 @@ Return Value:
--*/
BOOLEAN
DDKAPI
NTAPI
AtapiResetController(
IN PVOID HwDeviceExtension,
IN ULONG PathId
@ -2598,7 +2598,7 @@ Return Value:
--*/
BOOLEAN
DDKAPI
NTAPI
AtapiHwInitialize(
IN PVOID HwDeviceExtension
)
@ -3210,7 +3210,7 @@ Return Value:
--*/
BOOLEAN
DDKAPI
NTAPI
AtapiInterrupt(
IN PVOID HwDeviceExtension
)
@ -3400,7 +3400,7 @@ AtapiInterrupt2(
} // end AtapiInterrupt2()
RETTYPE_XXableInterrupts
DDKAPI
NTAPI
AtapiInterruptDpc(
IN PVOID HwDeviceExtension
)
@ -3437,7 +3437,7 @@ AtapiInterruptDpc(
RETTYPE_XXableInterrupts
DDKAPI
NTAPI
AtapiEnableInterrupts__(
IN PVOID HwDeviceExtension
)
@ -7251,7 +7251,7 @@ Return Value:
--*/
BOOLEAN
DDKAPI
NTAPI
AtapiStartIo(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb
@ -8343,7 +8343,7 @@ Return Value:
--*/
extern "C"
ULONG
DDKAPI
NTAPI
DriverEntry(
IN PVOID DriverObject,
IN PVOID Argument2
@ -9059,7 +9059,7 @@ AtapiRegCheckParameterValue(
SCSI_ADAPTER_CONTROL_STATUS
DDKAPI
NTAPI
AtapiAdapterControl(
IN PVOID HwDeviceExtension,
IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
@ -9152,7 +9152,7 @@ AtapiAdapterControl(
extern "C"
NTHALAPI
VOID
DDKAPI
NTAPI
HalDisplayString (
PUCHAR String
);

View file

@ -424,38 +424,38 @@ typedef struct _SCSI_WMI_REQUEST_BLOCK {
typedef
BOOLEAN
(DDKAPI *PHW_INITIALIZE) (
(NTAPI *PHW_INITIALIZE) (
IN PVOID DeviceExtension
);
typedef
BOOLEAN
(DDKAPI *PHW_STARTIO) (
(NTAPI *PHW_STARTIO) (
IN PVOID DeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb
);
typedef
BOOLEAN
(DDKAPI *PHW_INTERRUPT) (
(NTAPI *PHW_INTERRUPT) (
IN PVOID DeviceExtension
);
typedef
VOID
(DDKAPI *PHW_TIMER) (
(NTAPI *PHW_TIMER) (
IN PVOID DeviceExtension
);
typedef
VOID
(DDKAPI *PHW_DMA_STARTED) (
(NTAPI *PHW_DMA_STARTED) (
IN PVOID DeviceExtension
);
typedef
ULONG
(DDKAPI *PHW_FIND_ADAPTER) (
(NTAPI *PHW_FIND_ADAPTER) (
IN PVOID DeviceExtension,
IN PVOID HwContext,
IN PVOID BusInformation,
@ -466,14 +466,14 @@ ULONG
typedef
BOOLEAN
(DDKAPI *PHW_RESET_BUS) (
(NTAPI *PHW_RESET_BUS) (
IN PVOID DeviceExtension,
IN ULONG PathId
);
typedef
BOOLEAN
(DDKAPI *PHW_ADAPTER_STATE) (
(NTAPI *PHW_ADAPTER_STATE) (
IN PVOID DeviceExtension,
IN PVOID Context,
IN BOOLEAN SaveState
@ -481,7 +481,7 @@ BOOLEAN
typedef
SCSI_ADAPTER_CONTROL_STATUS
(DDKAPI *PHW_ADAPTER_CONTROL) (
(NTAPI *PHW_ADAPTER_CONTROL) (
IN PVOID DeviceExtension,
IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
IN PVOID Parameters
@ -607,7 +607,7 @@ typedef struct _HW_INITIALIZATION_DATA_COMMON {
//
SCSIPORT_API
ULONG DDKAPI
ULONG NTAPI
ScsiPortInitialize(
IN PVOID Argument1,
IN PVOID Argument2,
@ -616,14 +616,14 @@ ScsiPortInitialize(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortFreeDeviceBase(
IN PVOID HwDeviceExtension,
IN PVOID MappedAddress
);
SCSIPORT_API
ULONG DDKAPI
ULONG NTAPI
ScsiPortGetBusData(
IN PVOID DeviceExtension,
IN ULONG BusDataType,
@ -634,7 +634,7 @@ ScsiPortGetBusData(
);
SCSIPORT_API
ULONG DDKAPI
ULONG NTAPI
ScsiPortSetBusDataByOffset(
IN PVOID DeviceExtension,
IN ULONG BusDataType,
@ -646,7 +646,7 @@ ScsiPortSetBusDataByOffset(
);
SCSIPORT_API
PVOID DDKAPI
PVOID NTAPI
ScsiPortGetDeviceBase(
IN PVOID HwDeviceExtension,
IN INTERFACE_TYPE BusType,
@ -657,7 +657,7 @@ ScsiPortGetDeviceBase(
);
SCSIPORT_API
PVOID DDKAPI
PVOID NTAPI
ScsiPortGetLogicalUnit(
IN PVOID HwDeviceExtension,
IN UCHAR PathId,
@ -666,7 +666,7 @@ ScsiPortGetLogicalUnit(
);
SCSIPORT_API
PSCSI_REQUEST_BLOCK DDKAPI
PSCSI_REQUEST_BLOCK NTAPI
ScsiPortGetSrb(
IN PVOID DeviceExtension,
IN UCHAR PathId,
@ -676,7 +676,7 @@ ScsiPortGetSrb(
);
SCSIPORT_API
SCSI_PHYSICAL_ADDRESS DDKAPI
SCSI_PHYSICAL_ADDRESS NTAPI
ScsiPortGetPhysicalAddress(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb,
@ -685,14 +685,14 @@ ScsiPortGetPhysicalAddress(
);
SCSIPORT_API
PVOID DDKAPI
PVOID NTAPI
ScsiPortGetVirtualAddress(
IN PVOID HwDeviceExtension,
IN SCSI_PHYSICAL_ADDRESS PhysicalAddress
);
SCSIPORT_API
PVOID DDKAPI
PVOID NTAPI
ScsiPortGetUncachedExtension(
IN PVOID HwDeviceExtension,
IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
@ -700,13 +700,13 @@ ScsiPortGetUncachedExtension(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortFlushDma(
IN PVOID DeviceExtension
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortIoMapTransfer(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb,
@ -715,7 +715,7 @@ ScsiPortIoMapTransfer(
);
SCSIPORT_API
VOID DDKCDECLAPI
VOID __cdecl
ScsiPortNotification(
IN SCSI_NOTIFICATION_TYPE NotificationType,
IN PVOID HwDeviceExtension,
@ -723,7 +723,7 @@ ScsiPortNotification(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortLogError(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
@ -735,7 +735,7 @@ ScsiPortLogError(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortCompleteRequest(
IN PVOID HwDeviceExtension,
IN UCHAR PathId,
@ -745,7 +745,7 @@ ScsiPortCompleteRequest(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortMoveMemory(
IN PVOID WriteBuffer,
IN PVOID ReadBuffer,
@ -753,25 +753,25 @@ ScsiPortMoveMemory(
);
SCSIPORT_API
UCHAR DDKAPI
UCHAR NTAPI
ScsiPortReadPortUchar(
IN PUCHAR Port
);
SCSIPORT_API
USHORT DDKAPI
USHORT NTAPI
ScsiPortReadPortUshort(
IN PUSHORT Port
);
SCSIPORT_API
ULONG DDKAPI
ULONG NTAPI
ScsiPortReadPortUlong(
IN PULONG Port
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortReadPortBufferUchar(
IN PUCHAR Port,
IN PUCHAR Buffer,
@ -779,7 +779,7 @@ ScsiPortReadPortBufferUchar(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortReadPortBufferUshort(
IN PUSHORT Port,
IN PUSHORT Buffer,
@ -787,7 +787,7 @@ ScsiPortReadPortBufferUshort(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortReadPortBufferUlong(
IN PULONG Port,
IN PULONG Buffer,
@ -795,25 +795,25 @@ ScsiPortReadPortBufferUlong(
);
SCSIPORT_API
UCHAR DDKAPI
UCHAR NTAPI
ScsiPortReadRegisterUchar(
IN PUCHAR Register
);
SCSIPORT_API
USHORT DDKAPI
USHORT NTAPI
ScsiPortReadRegisterUshort(
IN PUSHORT Register
);
SCSIPORT_API
ULONG DDKAPI
ULONG NTAPI
ScsiPortReadRegisterUlong(
IN PULONG Register
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortReadRegisterBufferUchar(
IN PUCHAR Register,
IN PUCHAR Buffer,
@ -821,7 +821,7 @@ ScsiPortReadRegisterBufferUchar(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortReadRegisterBufferUshort(
IN PUSHORT Register,
IN PUSHORT Buffer,
@ -829,7 +829,7 @@ ScsiPortReadRegisterBufferUshort(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortReadRegisterBufferUlong(
IN PULONG Register,
IN PULONG Buffer,
@ -837,34 +837,34 @@ ScsiPortReadRegisterBufferUlong(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortStallExecution(
IN ULONG Delay
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWritePortUchar(
IN PUCHAR Port,
IN UCHAR Value
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWritePortUshort(
IN PUSHORT Port,
IN USHORT Value
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWritePortUlong(
IN PULONG Port,
IN ULONG Value
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWritePortBufferUchar(
IN PUCHAR Port,
IN PUCHAR Buffer,
@ -872,7 +872,7 @@ ScsiPortWritePortBufferUchar(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWritePortBufferUshort(
IN PUSHORT Port,
IN PUSHORT Buffer,
@ -880,7 +880,7 @@ ScsiPortWritePortBufferUshort(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWritePortBufferUlong(
IN PULONG Port,
IN PULONG Buffer,
@ -888,28 +888,28 @@ ScsiPortWritePortBufferUlong(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWriteRegisterUchar(
IN PUCHAR Register,
IN UCHAR Value
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWriteRegisterUshort(
IN PUSHORT Register,
IN USHORT Value
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWriteRegisterUlong(
IN PULONG Register,
IN ULONG Value
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWriteRegisterBufferUchar(
IN PUCHAR Register,
IN PUCHAR Buffer,
@ -917,7 +917,7 @@ ScsiPortWriteRegisterBufferUchar(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWriteRegisterBufferUshort(
IN PUSHORT Register,
IN PUSHORT Buffer,
@ -925,7 +925,7 @@ ScsiPortWriteRegisterBufferUshort(
);
SCSIPORT_API
VOID DDKAPI
VOID NTAPI
ScsiPortWriteRegisterBufferUlong(
IN PULONG Register,
IN PULONG Buffer,
@ -933,13 +933,13 @@ ScsiPortWriteRegisterBufferUlong(
);
SCSIPORT_API
SCSI_PHYSICAL_ADDRESS DDKAPI
SCSI_PHYSICAL_ADDRESS NTAPI
ScsiPortConvertUlongToPhysicalAddress(
ULONG UlongAddress
);
SCSIPORT_API
ULONG DDKAPI
ULONG NTAPI
ScsiPortConvertPhysicalAddressToUlong(
SCSI_PHYSICAL_ADDRESS Address
);
@ -947,7 +947,7 @@ ScsiPortConvertPhysicalAddressToUlong(
#define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart)
SCSIPORT_API
BOOLEAN DDKAPI
BOOLEAN NTAPI
ScsiPortValidateRange(
IN PVOID HwDeviceExtension,
IN INTERFACE_TYPE BusType,
@ -960,7 +960,7 @@ ScsiPortValidateRange(
// begin_ntminitape
SCSIPORT_API
VOID DDKCDECLAPI
VOID __cdecl
ScsiDebugPrint(
ULONG DebugPrintLevel,
PCCHAR DebugMessage,

View file

@ -14,12 +14,8 @@
#define NDEBUG
#include <debug.h>
#ifdef _MSC_VER
#define DDKAPI
#endif
SCSI_PHYSICAL_ADDRESS
DDKAPI
NTAPI
ScsiPortConvertUlongToPhysicalAddress(
IN ULONG UlongAddress)
{
@ -27,7 +23,7 @@ ScsiPortConvertUlongToPhysicalAddress(
}
VOID
DDKAPI
NTAPI
ScsiPortReadPortBufferUchar(
IN PUCHAR Port,
IN PUCHAR Buffer,
@ -37,7 +33,7 @@ ScsiPortReadPortBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortReadPortBufferUshort(
IN PUSHORT Port,
IN PUSHORT Buffer,
@ -47,7 +43,7 @@ ScsiPortReadPortBufferUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortReadPortBufferUlong(
IN PULONG Port,
IN PULONG Buffer,
@ -57,7 +53,7 @@ ScsiPortReadPortBufferUlong(
}
UCHAR
DDKAPI
NTAPI
ScsiPortReadPortUchar(
IN PUCHAR Port)
{
@ -65,7 +61,7 @@ ScsiPortReadPortUchar(
}
USHORT
DDKAPI
NTAPI
ScsiPortReadPortUshort(
IN PUSHORT Port)
{
@ -73,7 +69,7 @@ ScsiPortReadPortUshort(
}
ULONG
DDKAPI
NTAPI
ScsiPortReadPortUlong(
IN PULONG Port)
{
@ -81,7 +77,7 @@ ScsiPortReadPortUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortReadRegisterBufferUchar(
IN PUCHAR Register,
IN PUCHAR Buffer,
@ -91,7 +87,7 @@ ScsiPortReadRegisterBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortReadRegisterBufferUshort(
IN PUSHORT Register,
IN PUSHORT Buffer,
@ -101,7 +97,7 @@ ScsiPortReadRegisterBufferUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortReadRegisterBufferUlong(
IN PULONG Register,
IN PULONG Buffer,
@ -111,7 +107,7 @@ ScsiPortReadRegisterBufferUlong(
}
UCHAR
DDKAPI
NTAPI
ScsiPortReadRegisterUchar(
IN PUCHAR Register)
{
@ -119,7 +115,7 @@ ScsiPortReadRegisterUchar(
}
USHORT
DDKAPI
NTAPI
ScsiPortReadRegisterUshort(
IN PUSHORT Register)
{
@ -127,7 +123,7 @@ ScsiPortReadRegisterUshort(
}
ULONG
DDKAPI
NTAPI
ScsiPortReadRegisterUlong(
IN PULONG Register)
{
@ -135,7 +131,7 @@ ScsiPortReadRegisterUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortBufferUchar(
IN PUCHAR Port,
IN PUCHAR Buffer,
@ -145,7 +141,7 @@ ScsiPortWritePortBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortBufferUshort(
IN PUSHORT Port,
IN PUSHORT Buffer,
@ -155,7 +151,7 @@ ScsiPortWritePortBufferUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortBufferUlong(
IN PULONG Port,
IN PULONG Buffer,
@ -165,7 +161,7 @@ ScsiPortWritePortBufferUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortUchar(
IN PUCHAR Port,
IN UCHAR Value)
@ -174,7 +170,7 @@ ScsiPortWritePortUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortUshort(
IN PUSHORT Port,
IN USHORT Value)
@ -183,7 +179,7 @@ ScsiPortWritePortUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortWritePortUlong(
IN PULONG Port,
IN ULONG Value)
@ -192,7 +188,7 @@ ScsiPortWritePortUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterBufferUchar(
IN PUCHAR Register,
IN PUCHAR Buffer,
@ -202,7 +198,7 @@ ScsiPortWriteRegisterBufferUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterBufferUshort(
IN PUSHORT Register,
IN PUSHORT Buffer,
@ -212,7 +208,7 @@ ScsiPortWriteRegisterBufferUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterBufferUlong(
IN PULONG Register,
IN PULONG Buffer,
@ -222,7 +218,7 @@ ScsiPortWriteRegisterBufferUlong(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterUchar(
IN PUCHAR Register,
IN ULONG Value)
@ -231,7 +227,7 @@ ScsiPortWriteRegisterUchar(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterUshort(
IN PUSHORT Register,
IN USHORT Value)
@ -240,7 +236,7 @@ ScsiPortWriteRegisterUshort(
}
VOID
DDKAPI
NTAPI
ScsiPortWriteRegisterUlong(
IN PULONG Register,
IN ULONG Value)

View file

@ -26,7 +26,6 @@
#define DDKFASTAPI __fastcall
#define FASTCALL __fastcall
#define DDKCDECLAPI __cdecl
ULONG DbgPrint(PCCH Format,...);

View file

@ -8,6 +8,7 @@
<if property="ARCH" value="i386">
<xi:include href="hal.rbuild" />
<xi:include href="halacpi.rbuild" />
<xi:include href="halxbox.rbuild" />
<if property="BUILD_MP" value="1">
<xi:include href="halmps.rbuild" />

View file

@ -0,0 +1,864 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halx86/generic/acpi/halacpi.c
* PURPOSE: HAL ACPI Code
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
LIST_ENTRY HalpAcpiTableCacheList;
FAST_MUTEX HalpAcpiTableCacheLock;
BOOLEAN HalpProcessedACPIPhase0;
BOOLEAN HalpPhysicalMemoryMayAppearAbove4GB;
FADT HalpFixedAcpiDescTable;
PDEBUG_PORT_TABLE HalpDebugPortTable;
PACPI_SRAT HalpAcpiSrat;
PBOOT_TABLE HalpSimpleBootFlagTable;
PHYSICAL_ADDRESS HalpMaxHotPlugMemoryAddress;
PHYSICAL_ADDRESS HalpLowStubPhysicalAddress;
PHARDWARE_PTE HalpPteForFlush;
PVOID HalpVirtAddrForFlush;
PVOID HalpLowStub;
PACPI_BIOS_MULTI_NODE HalpAcpiMultiNode;
LIST_ENTRY HalpAcpiTableMatchList;
ULONG HalpInvalidAcpiTable;
/* PRIVATE FUNCTIONS **********************************************************/
PDESCRIPTION_HEADER
NTAPI
HalpAcpiGetCachedTable(IN ULONG Signature)
{
PLIST_ENTRY ListHead, NextEntry;
PACPI_CACHED_TABLE CachedTable;
/* Loop cached tables */
ListHead = &HalpAcpiTableCacheList;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
{
/* Get the table */
CachedTable = CONTAINING_RECORD(NextEntry, ACPI_CACHED_TABLE, Links);
/* Compare signatures */
if (CachedTable->Header.Signature == Signature) return &CachedTable->Header;
/* Keep going */
NextEntry = NextEntry->Flink;
}
/* Nothing found */
return NULL;
}
VOID
NTAPI
HalpAcpiCacheTable(IN PDESCRIPTION_HEADER TableHeader)
{
PACPI_CACHED_TABLE CachedTable;
/* Get the cached table and link it */
CachedTable = CONTAINING_RECORD(TableHeader, ACPI_CACHED_TABLE, Header);
InsertTailList(&HalpAcpiTableCacheList, &CachedTable->Links);
}
PVOID
NTAPI
HalpAcpiCopyBiosTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PDESCRIPTION_HEADER TableHeader)
{
ULONG Size;
PFN_NUMBER PageCount;
PHYSICAL_ADDRESS PhysAddress;
PACPI_CACHED_TABLE CachedTable;
PDESCRIPTION_HEADER CopiedTable;
/* Size we'll need for the cached table */
Size = TableHeader->Length + FIELD_OFFSET(ACPI_CACHED_TABLE, Header);
if (LoaderBlock)
{
/* Phase 0: Convert to pages and use the HAL heap */
PageCount = BYTES_TO_PAGES(Size);
PhysAddress.LowPart = HalpAllocPhysicalMemory(LoaderBlock,
0x1000000,
PageCount,
FALSE);
if (PhysAddress.LowPart)
{
/* Map it */
CachedTable = HalpMapPhysicalMemory64(PhysAddress, PageCount);
}
else
{
/* No memory, so nothing to map */
CachedTable = NULL;
}
}
else
{
/* Use Mm pool */
CachedTable = ExAllocatePoolWithTag(NonPagedPool, Size, ' laH');
}
/* Do we have the cached table? */
if (CachedTable)
{
/* Copy the data */
CopiedTable = &CachedTable->Header;
RtlCopyMemory(CopiedTable, TableHeader, TableHeader->Length);
}
else
{
/* Nothing to return */
CopiedTable = NULL;
}
/* Return the table */
return CopiedTable;
}
PVOID
NTAPI
HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG Signature)
{
PHYSICAL_ADDRESS PhysicalAddress;
PXSDT Xsdt;
PRSDT Rsdt;
PFADT Fadt;
PDESCRIPTION_HEADER Header = NULL;
ULONG TableLength;
CHAR CheckSum = 0;
ULONG Offset;
ULONG EntryCount, CurrentEntry;
PCHAR CurrentByte;
PFN_NUMBER PageCount;
/* Should not query the RSDT/XSDT by itself */
if ((Signature == RSDT_SIGNATURE) || (Signature == XSDT_SIGNATURE)) return NULL;
/* Special case request for DSDT, because the FADT points to it */
if (Signature == DSDT_SIGNATURE)
{
/* Grab the FADT */
Fadt = HalpAcpiGetTable(LoaderBlock, FADT_SIGNATURE);
if (Fadt)
{
/* Grab the DSDT address and assume 2 pages */
PhysicalAddress.LowPart = Fadt->dsdt;
TableLength = 2 * PAGE_SIZE;
/* Map it */
if (LoaderBlock)
{
/* Phase 0, use HAL heap */
Header = HalpMapPhysicalMemory64(PhysicalAddress, 2u);
}
else
{
/* Phase 1, use Mm */
Header = MmMapIoSpace(PhysicalAddress, 2 * PAGE_SIZE, 0);
}
/* Fail if we couldn't map it */
if (!Header)
{
DbgPrint("HAL: Failed to map ACPI table.\n");
return NULL;
}
/* Validate the signature */
DPRINT1("ACPI DSDT at 0x%p\n", Header);
if (Header->Signature != DSDT_SIGNATURE)
{
/* Fail and unmap */
if (LoaderBlock)
{
/* Using HAL heap */
HalpUnmapVirtualAddress(Header, 2);
}
else
{
/* Using Mm */
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
}
/* Didn't find anything */
return NULL;
}
}
else
{
/* Couldn't find it */
return NULL;
}
}
else
{
/* To find tables, we need the RSDT */
Rsdt = HalpAcpiGetTable(LoaderBlock, RSDT_SIGNATURE);
if (Rsdt)
{
/* Won't be using the XSDT */
Xsdt = NULL;
}
else
{
/* Only other choice is to use the XSDT */
Xsdt = HalpAcpiGetTable(LoaderBlock, XSDT_SIGNATURE);
if (!Xsdt) return NULL;
/* Won't be using the RSDT */
DPRINT1("ACPI XSDT at 0x%p\n", Xsdt);
Rsdt = NULL;
}
/* Smallest RSDT/XSDT is one without table entries */
Offset = FIELD_OFFSET(RSDT, Tables);
if (Xsdt)
{
/* Figure out total size of table and the offset */
TableLength = Xsdt->Header.Length;
if (TableLength < Offset) Offset = Xsdt->Header.Length;
/* The entries are each 64-bits, so count them */
EntryCount = (TableLength - Offset) / sizeof(PHYSICAL_ADDRESS);
}
else
{
/* Figure out total size of table and the offset */
TableLength = Rsdt->Header.Length;
if (TableLength < Offset) Offset = Rsdt->Header.Length;
/* The entries are each 32-bits, so count them */
EntryCount = (TableLength - Offset) / sizeof(ULONG);
}
/* Start at the beginning of the array and loop it */
for (CurrentEntry = 0; CurrentEntry < EntryCount; CurrentEntry++)
{
/* Are we using the XSDT? */
if (!Xsdt)
{
/* Read the 32-bit physical address */
PhysicalAddress.LowPart = Rsdt->Tables[CurrentEntry];
}
else
{
/* Read the 64-bit physical address */
PhysicalAddress = Xsdt->Tables[CurrentEntry];
}
/* Had we already mapped a table? */
if (Header)
{
/* Yes, unmap it */
if (LoaderBlock)
{
/* Using HAL heap */
HalpUnmapVirtualAddress(Header, 2);
}
else
{
/* Using Mm */
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
}
}
/* Now map this table */
if (!LoaderBlock)
{
/* Phase 1: Use HAL heap */
Header = MmMapIoSpace(PhysicalAddress, 2 * PAGE_SIZE, MmNonCached);
}
else
{
/* Phase 0: Use Mm */
Header = HalpMapPhysicalMemory64(PhysicalAddress, 2);
}
/* Check if we mapped it */
if (!Header)
{
/* Game over */
DbgPrint("HAL: Failed to map ACPI table.\n");
return NULL;
}
/* We found it, break out */
DPRINT("Found ACPI table %c%c%c%c at 0x%p\n",
Header->Signature & 0xFF,
(Header->Signature & 0xFF00) >> 8,
(Header->Signature & 0xFF0000) >> 16,
(Header->Signature & 0xFF000000) >> 24,
Header);
if (Header->Signature == Signature) break;
}
/* Did we end up here back at the last entry? */
if (CurrentEntry == EntryCount)
{
/* Yes, unmap the last table we processed */
if (LoaderBlock)
{
/* Using HAL heap */
HalpUnmapVirtualAddress(Header, 2);
}
else
{
/* Using Mm */
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
}
/* Didn't find anything */
return NULL;
}
}
/* Past this point, we assume something was found */
ASSERT(Header);
/* How many pages do we need? */
PageCount = BYTES_TO_PAGES(Header->Length);
if (PageCount != 2)
{
/* We assumed two, but this is not the case, free the current mapping */
if (LoaderBlock)
{
/* Using HAL heap */
HalpUnmapVirtualAddress(Header, 2);
}
else
{
/* Using Mm */
MmUnmapIoSpace(Header, 2 * PAGE_SIZE);
}
/* Now map this table using its correct size */
if (!LoaderBlock)
{
/* Phase 1: Use HAL heap */
Header = MmMapIoSpace(PhysicalAddress, PageCount << PAGE_SHIFT, MmNonCached);
}
else
{
/* Phase 0: Use Mm */
Header = HalpMapPhysicalMemory64(PhysicalAddress, PageCount);
}
}
/* Fail if the remapped failed */
if (!Header) return NULL;
/* All tables in ACPI 3.0 other than the FACP should have correct checksum */
if ((Header->Signature != FADT_SIGNATURE) || (Header->Revision > 2))
{
/* Go to the end of the table */
CheckSum = 0;
CurrentByte = (PCHAR)Header + Header->Length;
while (CurrentByte-- != (PCHAR)Header)
{
/* Add this byte */
CheckSum += *CurrentByte;
}
/* The correct checksum is always 0, anything else is illegal */
if (CheckSum) HalpInvalidAcpiTable = Header->Signature;
}
/* Return the table */
return Header;
}
PVOID
NTAPI
HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG Signature)
{
PFN_NUMBER PageCount;
PDESCRIPTION_HEADER TableAddress, BiosCopy;
/* See if we have a cached table? */
TableAddress = HalpAcpiGetCachedTable(Signature);
if (!TableAddress)
{
/* No cache, search the BIOS */
TableAddress = HalpAcpiGetTableFromBios(LoaderBlock, Signature);
if (TableAddress)
{
/* Found it, copy it into our own memory */
BiosCopy = HalpAcpiCopyBiosTable(LoaderBlock, TableAddress);
/* Get the pages, and unmap the BIOS copy */
PageCount = BYTES_TO_PAGES(TableAddress->Length);
if (LoaderBlock)
{
/* Phase 0, use the HAL heap */
HalpUnmapVirtualAddress(TableAddress, PageCount);
}
else
{
/* Phase 1, use Mm */
MmUnmapIoSpace(TableAddress, PageCount << 12);
}
/* Cache the bios copy */
TableAddress = BiosCopy;
if (BiosCopy) HalpAcpiCacheTable(BiosCopy);
}
}
/* Return the table */
return TableAddress;
}
PVOID
NTAPI
HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG Signature)
{
PDESCRIPTION_HEADER TableHeader;
/* Is this phase0 */
if (LoaderBlock)
{
/* Initialize the cache first */
if (!NT_SUCCESS(HalpAcpiTableCacheInit(LoaderBlock))) return NULL;
}
else
{
/* Lock the cache */
ExAcquireFastMutex(&HalpAcpiTableCacheLock);
}
/* Get the table */
TableHeader = HalpAcpiGetTable(LoaderBlock, Signature);
/* Release the lock in phase 1 */
if (!LoaderBlock) ExReleaseFastMutex(&HalpAcpiTableCacheLock);
/* Return the table */
return TableHeader;
}
VOID
NTAPI
HalpNumaInitializeStaticConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PACPI_SRAT SratTable;
/* Get the SRAT, bail out if it doesn't exist */
SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE);
HalpAcpiSrat = SratTable;
if (!SratTable) return;
}
VOID
NTAPI
HalpGetHotPlugMemoryInfo(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PACPI_SRAT SratTable;
/* Get the SRAT, bail out if it doesn't exist */
SratTable = HalAcpiGetTable(LoaderBlock, SRAT_SIGNATURE);
HalpAcpiSrat = SratTable;
if (!SratTable) return;
}
VOID
NTAPI
HalpDynamicSystemResourceConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
/* For this HAL, it means to get hot plug memory information */
HalpGetHotPlugMemoryInfo(LoaderBlock);
}
VOID
NTAPI
HalpAcpiDetectMachineSpecificActions(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PFADT DescriptionTable)
{
/* Does this HAL specify something? */
if (HalpAcpiTableMatchList.Flink)
{
/* Great, but we don't support it */
DPRINT1("WARNING: Your HAL has specific ACPI hacks to apply!\n");
}
}
VOID
NTAPI
HalpInitBootTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PBOOT_TABLE BootTable;
/* Get the boot table */
BootTable = HalAcpiGetTable(LoaderBlock, BOOT_SIGNATURE);
HalpSimpleBootFlagTable = BootTable;
DPRINT1("ACPI BOOT at 0x%p\n", HalpSimpleBootFlagTable);
/* Validate it */
if ((BootTable) &&
(BootTable->Header.Length >= sizeof(BOOT_TABLE)) &&
(BootTable->CMOSIndex >= 9))
{
DPRINT1("ACPI Boot table found, but not supported!\n");
}
else
{
/* Invalid or doesn't exist, ignore it */
HalpSimpleBootFlagTable = 0;
}
/* Install the end of boot handler */
// HalEndOfBoot = HalpEndOfBoot;
}
NTSTATUS
NTAPI
HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
OUT PACPI_BIOS_MULTI_NODE* AcpiMultiNode)
{
PCONFIGURATION_COMPONENT_DATA ComponentEntry;
PCONFIGURATION_COMPONENT_DATA Next = NULL;
PCM_PARTIAL_RESOURCE_LIST ResourceList;
PACPI_BIOS_MULTI_NODE NodeData;
ULONG NodeLength;
PFN_NUMBER PageCount;
PVOID MappedAddress;
PHYSICAL_ADDRESS PhysicalAddress;
/* Did we already do this once? */
if (HalpAcpiMultiNode)
{
/* Return what we know */
*AcpiMultiNode = HalpAcpiMultiNode;
return STATUS_SUCCESS;
}
/* Assume failure */
*AcpiMultiNode = NULL;
/* Find the multi function adapter key */
ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot,
AdapterClass,
MultiFunctionAdapter,
0,
&Next);
while (ComponentEntry)
{
/* Find the ACPI BIOS key */
if (!_stricmp(ComponentEntry->ComponentEntry.Identifier, "ACPI BIOS"))
{
/* Found it */
break;
}
/* Keep searching */
Next = ComponentEntry;
ComponentEntry = KeFindConfigurationNextEntry(LoaderBlock->ConfigurationRoot,
AdapterClass,
MultiFunctionAdapter,
NULL,
&Next);
}
/* Make sure we found it */
if (!ComponentEntry)
{
DbgPrint("**** HalpAcpiFindRsdtPhase0: did NOT find RSDT\n");
return STATUS_NOT_FOUND;
}
/* The configuration data is a resource list, and the BIOS node follows */
ResourceList = ComponentEntry->ConfigurationData;
NodeData = (PACPI_BIOS_MULTI_NODE)(ResourceList + 1);
/* How many E820 memory entries are there? */
NodeLength = sizeof(ACPI_BIOS_MULTI_NODE) +
(NodeData->Count - 1) * sizeof(ACPI_E820_ENTRY);
/* Convert to pages */
PageCount = BYTES_TO_PAGES(NodeLength);
/* Allocate the memory */
PhysicalAddress.LowPart = HalpAllocPhysicalMemory(LoaderBlock,
0x1000000,
PageCount,
FALSE);
if (PhysicalAddress.LowPart)
{
/* Map it if the allocation worked */
MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, PageCount);
}
else
{
/* Otherwise we'll have to fail */
MappedAddress = NULL;
}
/* Save the multi node, bail out if we didn't find it */
HalpAcpiMultiNode = MappedAddress;
if (!MappedAddress) return STATUS_INSUFFICIENT_RESOURCES;
/* Copy the multi-node data */
RtlCopyMemory(MappedAddress, NodeData, NodeLength);
/* Return the data */
*AcpiMultiNode = HalpAcpiMultiNode;
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PACPI_BIOS_MULTI_NODE AcpiMultiNode;
NTSTATUS Status = STATUS_SUCCESS;
PHYSICAL_ADDRESS PhysicalAddress;
PVOID MappedAddress;
ULONG TableLength;
PRSDT Rsdt;
PLOADER_PARAMETER_EXTENSION LoaderExtension;
/* Only initialize once */
if (HalpAcpiTableCacheList.Flink) return Status;
/* Setup the lock and table */
ExInitializeFastMutex(&HalpAcpiTableCacheLock);
InitializeListHead(&HalpAcpiTableCacheList);
/* Find the RSDT */
Status = HalpAcpiFindRsdtPhase0(LoaderBlock, &AcpiMultiNode);
if (!NT_SUCCESS(Status)) return Status;
/* Map the RSDT */
if (LoaderBlock)
{
/* Phase0: Use HAL Heap to map the RSDT, we assume it's about 2 pages */
PhysicalAddress.QuadPart = AcpiMultiNode->RsdtAddress.QuadPart;
MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, 2);
}
else
{
/* Use an I/O map */
MappedAddress = MmMapIoSpace(PhysicalAddress, PAGE_SIZE * 2, MmNonCached);
}
/* Get the RSDT */
Rsdt = MappedAddress;
if (!MappedAddress)
{
/* Fail, no memory */
DbgPrint("HAL: Failed to map RSDT\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Validate it */
DPRINT1("ACPI RSDT at 0x%p\n", Rsdt);
if ((Rsdt->Header.Signature != RSDT_SIGNATURE) &&
(Rsdt->Header.Signature != XSDT_SIGNATURE))
{
/* Very bad: crash */
HalDisplayString("Bad RSDT pointer\n");
KeBugCheckEx(MISMATCHED_HAL, 4, __LINE__, 0, 0);
}
/* We assumed two pages -- do we need less or more? */
TableLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(PhysicalAddress.LowPart,
Rsdt->Header.Length);
if (TableLength != 2)
{
/* Are we in phase 0 or 1? */
if (!LoaderBlock)
{
/* Unmap the old table, remap the new one, using Mm I/O space */
MmUnmapIoSpace(MappedAddress, 2 * PAGE_SIZE);
MappedAddress = MmMapIoSpace(PhysicalAddress,
TableLength << PAGE_SHIFT,
MmNonCached);
}
else
{
/* Unmap the old table, remap the new one, using HAL heap */
HalpUnmapVirtualAddress(MappedAddress, 2);
MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, TableLength);
}
/* Get the remapped table */
Rsdt = MappedAddress;
if (!MappedAddress)
{
/* Fail, no memory */
DbgPrint("HAL: Couldn't remap RSDT\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
}
/* Now take the BIOS copy and make our own local copy */
Rsdt = HalpAcpiCopyBiosTable(LoaderBlock, &Rsdt->Header);
if (!Rsdt)
{
/* Fail, no memory */
DbgPrint("HAL: Couldn't remap RSDT\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Get rid of the BIOS mapping */
if (LoaderBlock)
{
/* Use HAL heap */
HalpUnmapVirtualAddress(MappedAddress, TableLength);
}
else
{
/* Use Mm */
MmUnmapIoSpace(MappedAddress, TableLength << PAGE_SHIFT);
}
/* Cache the RSDT */
HalpAcpiCacheTable(&Rsdt->Header);
/* Check for compatible loader block extension */
LoaderExtension = LoaderBlock->Extension;
if (LoaderExtension->Size >= 0x58)
{
/* Compatible loader: did it provide an ACPI table override? */
if ((LoaderExtension->AcpiTable) && (LoaderExtension->AcpiTableSize))
{
/* Great, because we don't support it! */
DPRINT1("ACPI Table Overrides Not Supported!\n");
}
}
/* Done */
return Status;
}
VOID
NTAPI
HaliAcpiTimerInit(IN ULONG TimerPort,
IN ULONG TimerValExt)
{
PAGED_CODE();
/* Is this in the init phase? */
if (!TimerPort )
{
/* Get the data from the FADT */
TimerPort = HalpFixedAcpiDescTable.pm_tmr_blk_io_port;
TimerValExt = HalpFixedAcpiDescTable.flags & ACPI_TMR_VAL_EXT;
}
/* FIXME: Now proceed to the timer initialization */
DPRINT1("ACPI Timer at: %Xh (EXT: %d)\n", TimerPort, TimerValExt);
//HalaAcpiTimerInit(TimerPort, TimerValExt);
}
NTSTATUS
NTAPI
HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
NTSTATUS Status;
PFADT Fadt;
ULONG TableLength;
PHYSICAL_ADDRESS PhysicalAddress;
/* Only do this once */
DPRINT1("You are booting the ACPI HAL!\n");
if (HalpProcessedACPIPhase0) return STATUS_SUCCESS;
/* Setup the ACPI table cache */
Status = HalpAcpiTableCacheInit(LoaderBlock);
if (!NT_SUCCESS(Status)) return Status;
/* Grab the FADT */
Fadt = HalAcpiGetTable(LoaderBlock, FADT_SIGNATURE);
if (!Fadt)
{
/* Fail */
DbgPrint("HAL: Didn't find the FACP\n");
return STATUS_NOT_FOUND;
}
/* Assume typical size, otherwise whatever the descriptor table says */
DPRINT1("ACPI FACP at 0x%p\n", Fadt);
TableLength = sizeof(FADT);
if (Fadt->Header.Length < sizeof(FADT)) TableLength = Fadt->Header.Length;
/* Copy it in the HAL static buffer */
RtlCopyMemory(&HalpFixedAcpiDescTable, Fadt, TableLength);
/* Anything special this HAL needs to do? */
HalpAcpiDetectMachineSpecificActions(LoaderBlock, &HalpFixedAcpiDescTable);
/* Get the debug table for KD */
HalpDebugPortTable = HalAcpiGetTable(LoaderBlock, DBGP_SIGNATURE);
DPRINT1("ACPI DBGP at 0x%p\n", HalpDebugPortTable);
/* Initialize NUMA through the SRAT */
HalpNumaInitializeStaticConfiguration(LoaderBlock);
/* Initialize hotplug through the SRAT */
HalpDynamicSystemResourceConfiguration(LoaderBlock);
DPRINT1("ACPI SRAT at 0x%p\n", HalpAcpiSrat);
if (HalpAcpiSrat)
{
DPRINT1("Your machine has a SRAT, but NUMA/HotPlug are not supported!\n");
}
/* Can there be memory higher than 4GB? */
if (HalpMaxHotPlugMemoryAddress.HighPart >= 1)
{
/* We'll need this for DMA later */
HalpPhysicalMemoryMayAppearAbove4GB = TRUE;
}
/* Setup the ACPI timer */
HaliAcpiTimerInit(0, 0);
/* Do we have a low stub address yet? */
if (!HalpLowStubPhysicalAddress.LowPart)
{
/* Allocate it */
HalpLowStubPhysicalAddress.LowPart = HalpAllocPhysicalMemory(LoaderBlock,
0x100000,
1,
FALSE);
if (HalpLowStubPhysicalAddress.LowPart)
{
/* Map it */
HalpLowStub = HalpMapPhysicalMemory64(HalpLowStubPhysicalAddress, 1);
}
}
/* Grab a page for flushes */
PhysicalAddress.QuadPart = 0x100000;
HalpVirtAddrForFlush = HalpMapPhysicalMemory64(PhysicalAddress, 1);
HalpPteForFlush = HalAddressToPte(HalpVirtAddrForFlush);
/* Don't do this again */
HalpProcessedACPIPhase0 = TRUE;
/* Setup the boot table */
HalpInitBootTable(LoaderBlock);
/* Return success */
return STATUS_SUCCESS;
}
/* EOF */

View file

@ -0,0 +1,817 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halx86/generic/acpi/halpnpdd.c
* PURPOSE: HAL Plug and Play Device Driver
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
typedef enum _EXTENSION_TYPE
{
PdoExtensionType = 0xC0,
FdoExtensionType
} EXTENSION_TYPE;
typedef enum _PDO_TYPE
{
AcpiPdo = 0x80,
WdPdo
} PDO_TYPE;
typedef struct _FDO_EXTENSION
{
EXTENSION_TYPE ExtensionType;
struct _PDO_EXTENSION* ChildPdoList;
PDEVICE_OBJECT PhysicalDeviceObject;
PDEVICE_OBJECT FunctionalDeviceObject;
PDEVICE_OBJECT AttachedDeviceObject;
} FDO_EXTENSION, *PFDO_EXTENSION;
typedef struct _PDO_EXTENSION
{
EXTENSION_TYPE ExtensionType;
struct _PDO_EXTENSION* Next;
PDEVICE_OBJECT PhysicalDeviceObject;
PFDO_EXTENSION ParentFdoExtension;
PDO_TYPE PdoType;
PDESCRIPTION_HEADER WdTable;
LONG InterfaceReferenceCount;
} PDO_EXTENSION, *PPDO_EXTENSION;
/* GLOBALS ********************************************************************/
PDRIVER_OBJECT HalpDriverObject;
BOOLEAN HalDisableFirmwareMapper = TRUE;
PWCHAR HalHardwareIdString = L"acpipic_up";
/* PRIVATE FUNCTIONS **********************************************************/
NTSTATUS
NTAPI
HalpMarkAcpiHal(VOID)
{
NTSTATUS Status;
UNICODE_STRING KeyString;
HANDLE KeyHandle;
HANDLE Handle;
/* Open the control set key */
RtlInitUnicodeString(&KeyString,
L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
Status = HalpOpenRegistryKey(&Handle, 0, &KeyString, KEY_ALL_ACCESS, FALSE);
if (NT_SUCCESS(Status))
{
/* Open the PNP key */
RtlInitUnicodeString(&KeyString, L"Control\\Pnp");
Status = HalpOpenRegistryKey(&KeyHandle,
Handle,
&KeyString,
KEY_ALL_ACCESS,
TRUE);
/* Close root key */
ZwClose(Handle);
/* Check if PNP BIOS key exists */
if (NT_SUCCESS(Status))
{
/* Set the disable value to false -- we need the mapper */
RtlInitUnicodeString(&KeyString, L"DisableFirmwareMapper");
Status = ZwSetValueKey(KeyHandle,
&KeyString,
0,
REG_DWORD,
&HalDisableFirmwareMapper,
sizeof(HalDisableFirmwareMapper));
/* Close subkey */
ZwClose(KeyHandle);
}
}
/* Return status */
return Status;
}
NTSTATUS
NTAPI
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT TargetDevice)
{
NTSTATUS Status;
PFDO_EXTENSION FdoExtension;
PPDO_EXTENSION PdoExtension;
PDEVICE_OBJECT DeviceObject, PdoDeviceObject, AttachedDevice;
PDESCRIPTION_HEADER Wdrt;
DbgPrint("HAL: PnP Driver ADD!\n");
/* Create the FDO */
Status = IoCreateDevice(DriverObject,
sizeof(FDO_EXTENSION),
NULL,
FILE_DEVICE_BUS_EXTENDER,
0,
FALSE,
&DeviceObject);
if (!NT_SUCCESS(Status))
{
/* Should not happen */
DbgBreakPoint();
return Status;
}
/* Setup the FDO extension */
FdoExtension = DeviceObject->DeviceExtension;
FdoExtension->ExtensionType = FdoExtensionType;
FdoExtension->PhysicalDeviceObject = TargetDevice;
FdoExtension->FunctionalDeviceObject = DeviceObject;
/* FDO is done initializing */
DeviceObject->Flags &= DO_DEVICE_INITIALIZING;
/* Attach to the physical device object (the bus) */
AttachedDevice = IoAttachDeviceToDeviceStack(DeviceObject, TargetDevice);
if (!AttachedDevice)
{
/* Failed, undo everything */
IoDeleteDevice(DeviceObject);
return STATUS_NO_SUCH_DEVICE;
}
/* Save the attachment */
FdoExtension->AttachedDeviceObject = AttachedDevice;
/* Create the PDO */
Status = IoCreateDevice(DriverObject,
sizeof(PDO_EXTENSION),
NULL,
FILE_DEVICE_BUS_EXTENDER,
FILE_AUTOGENERATED_DEVICE_NAME,
FALSE,
&PdoDeviceObject);
if (!NT_SUCCESS(Status))
{
/* Fail */
DbgPrint("HAL: Could not create ACPI device object status=0x%08x\n", Status);
return Status;
}
/* Setup the PDO device extension */
PdoExtension = PdoDeviceObject->DeviceExtension;
PdoExtension->Next = NULL;
PdoExtension->ExtensionType = PdoExtensionType;
PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
PdoExtension->ParentFdoExtension = FdoExtension;
PdoExtension->PdoType = AcpiPdo;
/* Find the ACPI watchdog table */
Wdrt = HalAcpiGetTable(0, 'TRDW');
if (!Wdrt)
{
/* None exists, there is nothing to do more */
PdoDeviceObject->Flags &= DO_DEVICE_INITIALIZING;
FdoExtension->ChildPdoList = PdoExtension;
}
else
{
/* FIXME: TODO */
DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
PdoDeviceObject->Flags &= DO_DEVICE_INITIALIZING;
FdoExtension->ChildPdoList = PdoExtension;
}
/* Return status */
DPRINT1("Device added %lx\n", Status);
return Status;
}
NTSTATUS
NTAPI
HalpQueryInterface(IN PDEVICE_OBJECT DeviceObject,
IN CONST GUID* InterfaceType,
IN USHORT Version,
IN PVOID InterfaceSpecificData,
IN ULONG InterfaceBufferSize,
IN PINTERFACE Interface,
OUT PULONG Length)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_NO_SUCH_DEVICE;
}
NTSTATUS
NTAPI
HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
IN DEVICE_RELATION_TYPE RelationType,
OUT PDEVICE_RELATIONS* DeviceRelations)
{
EXTENSION_TYPE ExtensionType;
PPDO_EXTENSION PdoExtension;
PFDO_EXTENSION FdoExtension;
PDEVICE_RELATIONS PdoRelations, FdoRelations;
PDEVICE_OBJECT* ObjectEntry;
ULONG i = 0, PdoCount = 0;
/* Get FDO device extension and PDO count */
FdoExtension = DeviceObject->DeviceExtension;
ExtensionType = FdoExtension->ExtensionType;
/* What do they want? */
if (RelationType == BusRelations)
{
/* This better be an FDO */
if (ExtensionType == FdoExtensionType)
{
/* Count how many PDOs we have */
PdoExtension = FdoExtension->ChildPdoList;
while (PdoExtension)
{
/* Next one */
PdoExtension = PdoExtension->Next;
PdoCount++;
}
/* Allocate our structure */
FdoRelations = ExAllocatePoolWithTag(PagedPool,
FIELD_OFFSET(DEVICE_RELATIONS,
Objects) +
4 * PdoCount,
' laH');
if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
/* Save our count */
FdoRelations->Count = PdoCount;
/* Query existing relations */
ObjectEntry = FdoRelations->Objects;
if (*DeviceRelations)
{
/* Check if there were any */
if ((*DeviceRelations)->Count)
{
/* Loop them all */
do
{
/* Copy into our structure */
*ObjectEntry++ = (*DeviceRelations)->Objects[i];
}
while (++i < (*DeviceRelations)->Count);
}
/* Free existing structure */
ExFreePoolWithTag(*DeviceRelations, 0);
}
/* Now check if we have a PDO list */
PdoExtension = FdoExtension->ChildPdoList;
if (PdoExtension)
{
/* Loop the PDOs */
do
{
/* Save our own PDO and reference it */
*ObjectEntry++ = PdoExtension->PhysicalDeviceObject;
ObfReferenceObject(PdoExtension->PhysicalDeviceObject);
/* Go to our next PDO */
PdoExtension = PdoExtension->Next;
}
while (PdoExtension);
}
/* Return the new structure */
*DeviceRelations = FdoRelations;
return STATUS_SUCCESS;
}
}
else
{
/* The only other thing we support is a target relation for the PDO */
if ((RelationType == TargetDeviceRelation) &&
(ExtensionType == PdoExtensionType))
{
/* Only one entry */
PdoRelations = ExAllocatePoolWithTag(PagedPool,
sizeof(DEVICE_RELATIONS),
' laH');
if (!PdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
/* Fill it out and reference us */
PdoRelations->Count = 1;
PdoRelations->Objects[0] = DeviceObject;
ObfReferenceObject(DeviceObject);
/* Return it */
*DeviceRelations = PdoRelations;
return STATUS_SUCCESS;
}
}
/* We don't support anything else */
return STATUS_NOT_SUPPORTED;
}
NTSTATUS
NTAPI
HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject,
OUT PDEVICE_CAPABILITIES Capabilities)
{
PPDO_EXTENSION PdoExtension;
NTSTATUS Status;
PAGED_CODE();
/* Get the extension and check for valid version */
PdoExtension = DeviceObject->DeviceExtension;
ASSERT(Capabilities->Version == 1);
if (Capabilities->Version == 1)
{
/* Can't lock or eject us */
Capabilities->LockSupported = FALSE;
Capabilities->EjectSupported = FALSE;
/* Can't remove or dock us */
Capabilities->Removable = FALSE;
Capabilities->DockDevice = FALSE;
/* Can't access us raw */
Capabilities->RawDeviceOK = FALSE;
/* We have a unique ID, and don't bother the user */
Capabilities->UniqueID = TRUE;
Capabilities->SilentInstall = TRUE;
/* Fill out the adress */
Capabilities->Address = InterfaceTypeUndefined;
Capabilities->UINumber = InterfaceTypeUndefined;
/* Fill out latencies */
Capabilities->D1Latency = 0;
Capabilities->D2Latency = 0;
Capabilities->D3Latency = 0;
/* Fill out supported device states */
Capabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
Capabilities->DeviceState[PowerSystemHibernate] = PowerDeviceD3;
Capabilities->DeviceState[PowerSystemShutdown] = PowerDeviceD3;
Capabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
/* Done */
Status = STATUS_SUCCESS;
}
else
{
/* Fail */
Status = STATUS_NOT_SUPPORTED;
}
/* Return status */
return Status;
}
NTSTATUS
NTAPI
HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
OUT PCM_RESOURCE_LIST *Resources)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_NO_SUCH_DEVICE;
}
NTSTATUS
NTAPI
HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject,
OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
{
UNIMPLEMENTED;
while (TRUE);
return STATUS_NO_SUCH_DEVICE;
}
NTSTATUS
NTAPI
HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject,
IN BUS_QUERY_ID_TYPE IdType,
OUT PUSHORT *BusQueryId)
{
PPDO_EXTENSION PdoExtension;
PDO_TYPE PdoType;
PWCHAR Id;
NTSTATUS Status;
ULONG Length;
PWCHAR Buffer;
/* Get the PDO type */
PdoExtension = DeviceObject->DeviceExtension;
PdoType = PdoExtension->PdoType;
/* What kind of ID is being requested? */
DPRINT("ID: %d\n", IdType);
switch (IdType)
{
case BusQueryDeviceID:
case BusQueryHardwareIDs:
/* What kind of PDO is this? */
if (PdoType == AcpiPdo)
{
/* PCI ID */
Id = L"ACPI_HAL\\PNP0C08";
}
else if (PdoType == WdPdo)
{
/* WatchDog ID */
Id = L"ACPI_HAL\\PNP0C18";
}
else
{
/* Unknown */
return STATUS_NOT_SUPPORTED;
}
/* Static length */
Length = 32;
break;
case BusQueryInstanceID:
/* And our instance ID */
Id = L"0";
Length = sizeof(L"0") + sizeof(UNICODE_NULL);
break;
case BusQueryCompatibleIDs:
default:
/* We don't support anything else */
return STATUS_NOT_SUPPORTED;
}
/* Allocate the buffer */
Buffer = ExAllocatePoolWithTag(PagedPool,
Length + sizeof(UNICODE_NULL),
' laH');
if (Buffer)
{
/* Copy the string and null-terminate it */
RtlCopyMemory(Buffer, Id, Length);
Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
/* Return string */
*BusQueryId = Buffer;
Status = STATUS_SUCCESS;
DPRINT("Returning: %S\n", *BusQueryId);
}
else
{
/* Fail */
Status = STATUS_INSUFFICIENT_RESOURCES;
}
/* Return status */
return Status;
}
NTSTATUS
NTAPI
HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject,
IN BUS_QUERY_ID_TYPE IdType,
OUT PUSHORT *BusQueryId)
{
NTSTATUS Status;
ULONG Length;
PWCHAR Id;
PWCHAR Buffer;
/* What kind of ID is being requested? */
DPRINT("ID: %d\n", IdType);
switch (IdType)
{
case BusQueryDeviceID:
case BusQueryHardwareIDs:
/* This is our hardware ID */
Id = HalHardwareIdString;
Length = wcslen(HalHardwareIdString) + sizeof(UNICODE_NULL);
break;
case BusQueryInstanceID:
/* And our instance ID */
Id = L"0";
Length = sizeof(L"0") + sizeof(UNICODE_NULL);
break;
default:
/* We don't support anything else */
return STATUS_NOT_SUPPORTED;
}
/* Allocate the buffer */
Buffer = ExAllocatePoolWithTag(PagedPool,
Length + sizeof(UNICODE_NULL),
' laH');
if (Buffer)
{
/* Copy the string and null-terminate it */
RtlCopyMemory(Buffer, Id, Length);
Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
/* Return string */
*BusQueryId = Buffer;
Status = STATUS_SUCCESS;
DPRINT("Returning: %S\n", *BusQueryId);
}
else
{
/* Fail */
Status = STATUS_INSUFFICIENT_RESOURCES;
}
/* Return status */
return Status;
}
NTSTATUS
NTAPI
HalpPassIrpFromFdoToPdo(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PFDO_EXTENSION FdoExtension;
/* Get the extension */
FdoExtension = DeviceObject->DeviceExtension;
/* Pass it to the attached device (our PDO) */
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
}
NTSTATUS
NTAPI
HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION IoStackLocation;
PPDO_EXTENSION PdoExtension;
PFDO_EXTENSION FdoExtension;
NTSTATUS Status;
UCHAR Minor;
/* Get the device extension and stack location */
FdoExtension = DeviceObject->DeviceExtension;
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
Minor = IoStackLocation->MinorFunction;
/* FDO? */
if (FdoExtension->ExtensionType == FdoExtensionType)
{
/* Query the IRP type */
switch (Minor)
{
case IRP_MN_QUERY_DEVICE_RELATIONS:
/* Call the worker */
DPRINT("Querying device relations for FDO\n");
Status = HalpQueryDeviceRelations(DeviceObject,
IoStackLocation->Parameters.QueryDeviceRelations.Type,
(PVOID)&Irp->IoStatus.Information);
break;
case IRP_MN_QUERY_INTERFACE:
/* Call the worker */
DPRINT("Querying interface for FDO\n");
Status = HalpQueryInterface(DeviceObject,
IoStackLocation->Parameters.QueryInterface.InterfaceType,
IoStackLocation->Parameters.QueryInterface.Size,
IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
IoStackLocation->Parameters.QueryInterface.Version,
IoStackLocation->Parameters.QueryInterface.Interface,
(PVOID)&Irp->IoStatus.Information);
break;
case IRP_MN_QUERY_ID:
/* Call the worker */
DPRINT("Querying ID for FDO\n");
Status = HalpQueryIdFdo(DeviceObject,
IoStackLocation->Parameters.QueryId.IdType,
(PVOID)&Irp->IoStatus.Information);
break;
default:
/* Pass it to the PDO */
DPRINT("Other IRP: %lx\n", Minor);
return HalpPassIrpFromFdoToPdo(DeviceObject, Irp);
}
/* What happpened? */
if ((NT_SUCCESS(Status)) || (Status == STATUS_NOT_SUPPORTED))
{
/* Set the IRP status, unless this isn't understood */
if (Status != STATUS_NOT_SUPPORTED) Irp->IoStatus.Status = Status;
/* Pass it on */
DPRINT("Passing IRP to PDO\n");
return HalpPassIrpFromFdoToPdo(DeviceObject, Irp);
}
/* Otherwise, we failed, so set the status and complete the request */
DPRINT1("IRP failed with status: %lx\n", Status);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
else
{
/* This is a PDO instead */
ASSERT(FdoExtension->ExtensionType == PdoExtensionType);
PdoExtension = (PPDO_EXTENSION)FdoExtension;
/* Query the IRP type */
Status = STATUS_SUCCESS;
switch (Minor)
{
case IRP_MN_START_DEVICE:
/* We only care about a PCI PDO */
DPRINT1("Start device received\n");
/* Complete the IRP normally */
break;
case IRP_MN_REMOVE_DEVICE:
/* Check if this is a PCI device */
DPRINT1("Remove device received\n");
/* We're done */
Status = STATUS_SUCCESS;
break;
case IRP_MN_SURPRISE_REMOVAL:
/* Inherit whatever status we had */
DPRINT1("Surprise removal IRP\n");
Status = Irp->IoStatus.Status;
break;
case IRP_MN_QUERY_DEVICE_RELATIONS:
/* Query the device relations */
DPRINT("Querying PDO relations\n");
Status = HalpQueryDeviceRelations(DeviceObject,
IoStackLocation->Parameters.QueryDeviceRelations.Type,
(PVOID)&Irp->IoStatus.Information);
break;
case IRP_MN_QUERY_INTERFACE:
/* Call the worker */
DPRINT("Querying interface for PDO\n");
Status = HalpQueryInterface(DeviceObject,
IoStackLocation->Parameters.QueryInterface.InterfaceType,
IoStackLocation->Parameters.QueryInterface.Size,
IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
IoStackLocation->Parameters.QueryInterface.Version,
IoStackLocation->Parameters.QueryInterface.Interface,
(PVOID)&Irp->IoStatus.Information);
break;
case IRP_MN_QUERY_CAPABILITIES:
/* Call the worker */
DPRINT("Querying the capabilities for the PDO\n");
Status = HalpQueryCapabilities(DeviceObject,
IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
break;
case IRP_MN_QUERY_RESOURCES:
/* Call the worker */
DPRINT("Querying the resources for the PDO\n");
Status = HalpQueryResources(DeviceObject, (PVOID)&Irp->IoStatus.Information);
break;
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
/* Call the worker */
DPRINT("Querying the resource requirements for the PDO\n");
Status = HalpQueryResourceRequirements(DeviceObject,
(PVOID)&Irp->IoStatus.Information);
break;
case IRP_MN_QUERY_ID:
/* Call the worker */
DPRINT("Query the ID for the PDO\n");
Status = HalpQueryIdPdo(DeviceObject,
IoStackLocation->Parameters.QueryId.IdType,
(PVOID)&Irp->IoStatus.Information);
break;
default:
/* We don't handle anything else, so inherit the old state */
DPRINT("Illegal IRP: %lx\n", Minor);
Status = Irp->IoStatus.Status;
break;
}
/* If it's not supported, inherit the old status */
if (Status == STATUS_NOT_SUPPORTED) Status = Irp->IoStatus.Status;
/* Complete the IRP */
DPRINT("IRP completed with status: %lx\n", Status);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
}
NTSTATUS
NTAPI
HalpDispatchWmi(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DbgPrint("HAL: PnP Driver WMI!\n");
while (TRUE);
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
HalpDispatchPower(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DbgPrint("HAL: PnP Driver Power!\n");
while (TRUE);
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
HalpDriverEntry(IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath)
{
NTSTATUS Status;
PDEVICE_OBJECT TargetDevice = NULL;
DPRINT("HAL: PnP Driver ENTRY!\n");
/* This is us */
HalpDriverObject = DriverObject;
/* Set up add device */
DriverObject->DriverExtension->AddDevice = HalpAddDevice;
/* Set up the callouts */
DriverObject->MajorFunction[IRP_MJ_PNP] = HalpDispatchPnp;
DriverObject->MajorFunction[IRP_MJ_POWER] = HalpDispatchPower;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = HalpDispatchWmi;
/* Tell the PnP about us */
Status = IoReportDetectedDevice(DriverObject,
InterfaceTypeUndefined,
-1,
-1,
NULL,
NULL,
FALSE,
&TargetDevice);
/* Now add us */
if (NT_SUCCESS(Status)) Status = HalpAddDevice(DriverObject, TargetDevice);
/* Force re-enumeration??? */
IoInvalidateDeviceRelations(TargetDevice, 0);
/* Return to kernel */
return Status;
}
NTSTATUS
NTAPI
HaliInitPnpDriver(VOID)
{
NTSTATUS Status;
UNICODE_STRING DriverString;
PAGED_CODE();
/* Create the driver */
RtlInitUnicodeString(&DriverString, L"\\Driver\\ACPI_HAL");
Status = IoCreateDriver(&DriverString, HalpDriverEntry);
/* Return status */
return Status;
}
/* EOF */

View file

@ -14,10 +14,225 @@
/* GLOBALS *******************************************************************/
/* Share with Mm headers? */
#define MM_HAL_VA_START (PVOID)0xFFC00000
#define MM_HAL_HEAP_START (PVOID)((ULONG_PTR)MM_HAL_VA_START + (1024 * 1024))
BOOLEAN HalpPciLockSettings;
ULONG HalpUsedAllocDescriptors;
MEMORY_ALLOCATION_DESCRIPTOR HalpAllocationDescriptorArray[64];
PVOID HalpHeapStart = MM_HAL_HEAP_START;
/* PRIVATE FUNCTIONS *********************************************************/
ULONG
NTAPI
HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG MaxAddress,
IN ULONG PageCount,
IN BOOLEAN Aligned)
{
ULONG UsedDescriptors, Alignment, PhysicalAddress;
PFN_NUMBER MaxPage, BasePage;
PLIST_ENTRY NextEntry;
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock, NewBlock, FreeBlock;
/* Highest page we'll go */
MaxPage = MaxAddress >> PAGE_SHIFT;
/* We need at least two blocks */
if ((HalpUsedAllocDescriptors + 2) > 64) return 0;
/* Remember how many we have now */
UsedDescriptors = HalpUsedAllocDescriptors;
/* Loop the loader block memory descriptors */
NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
while (NextEntry != &LoaderBlock->MemoryDescriptorListHead)
{
/* Get the block */
MdBlock = CONTAINING_RECORD(NextEntry,
MEMORY_ALLOCATION_DESCRIPTOR,
ListEntry);
/* No alignment by default */
Alignment = 0;
/* Unless requested, in which case we use a 64KB block alignment */
if (Aligned) Alignment = ((MdBlock->BasePage + 0x0F) & ~0x0F) - MdBlock->BasePage;
/* Search for free memory */
if ((MdBlock->MemoryType == LoaderFree) ||
(MdBlock->MemoryType == MemoryFirmwareTemporary))
{
/* Make sure the page is within bounds, including alignment */
BasePage = MdBlock->BasePage;
if ((BasePage) &&
(MdBlock->PageCount >= PageCount + Alignment) &&
(BasePage + PageCount + Alignment < MaxPage))
{
/* We found an address */
PhysicalAddress = (BasePage + Alignment) << PAGE_SHIFT;
break;
}
}
/* Keep trying */
NextEntry = NextEntry->Flink;
}
/* If we didn't find anything, get out of here */
if (NextEntry == &LoaderBlock->MemoryDescriptorListHead) return 0;
/* Okay, now get a descriptor */
NewBlock = &HalpAllocationDescriptorArray[HalpUsedAllocDescriptors];
NewBlock->PageCount = PageCount;
NewBlock->BasePage = MdBlock->BasePage + Alignment;
NewBlock->MemoryType = LoaderHALCachedMemory;
/* Update count */
UsedDescriptors++;
HalpUsedAllocDescriptors = UsedDescriptors;
/* Check if we had any alignment */
if (Alignment)
{
/* Check if we had leftovers */
if ((MdBlock->PageCount - Alignment) != PageCount)
{
/* Get the next descriptor */
FreeBlock = &HalpAllocationDescriptorArray[UsedDescriptors];
FreeBlock->PageCount = MdBlock->PageCount - Alignment - PageCount;
FreeBlock->BasePage = MdBlock->BasePage + Alignment + PageCount;
/* One more */
HalpUsedAllocDescriptors++;
/* Insert it into the list */
InsertHeadList(&MdBlock->ListEntry, &FreeBlock->ListEntry);
}
/* Use this descriptor */
NewBlock->PageCount = Alignment;
InsertHeadList(&MdBlock->ListEntry, &NewBlock->ListEntry);
}
else
{
/* Consume memory from this block */
MdBlock->BasePage += PageCount;
MdBlock->PageCount -= PageCount;
/* Insert the descriptor */
InsertTailList(&MdBlock->ListEntry, &NewBlock->ListEntry);
/* Remove the entry if the whole block was allocated */
if (!MdBlock->PageCount == 0) RemoveEntryList(&MdBlock->ListEntry);
}
/* Return the address */
return PhysicalAddress;
}
PVOID
NTAPI
HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
IN ULONG PageCount)
{
PHARDWARE_PTE PointerPte;
ULONG UsedPages = 0;
PVOID VirtualAddress, BaseAddress;
/* Start at the current HAL heap base */
BaseAddress = HalpHeapStart;
/* Loop until we have all the pages required */
while (UsedPages < PageCount)
{
/* Begin a new loop cycle */
UsedPages = 0;
VirtualAddress = BaseAddress;
/* If this overflows past the HAL heap, it means there's no space */
if (BaseAddress == NULL) return NULL;
/* Loop until we have all the pages required in a single run */
while (UsedPages < PageCount)
{
/* Get the PTE for this address and check if it's available */
PointerPte = HalAddressToPte(VirtualAddress);
if (*(PULONG)PointerPte)
{
/* PTE has data, skip it and start with a new base address */
BaseAddress = (PVOID)((ULONG_PTR)VirtualAddress + PAGE_SIZE);
break;
}
/* PTE is available, keep going on this run */
VirtualAddress = (PVOID)((ULONG_PTR)VirtualAddress + PAGE_SIZE);
UsedPages++;
}
}
/* Take the base address of the page plus the actual offset in the address */
VirtualAddress = (PVOID)((ULONG_PTR)BaseAddress +
BYTE_OFFSET(PhysicalAddress.LowPart));
/* If we are starting at the heap, move the heap */
if (BaseAddress == HalpHeapStart)
{
/* Past this allocation */
HalpHeapStart = (PVOID)((ULONG_PTR)BaseAddress + (PageCount * PAGE_SIZE));
}
/* Loop pages that can be mapped */
while (UsedPages--)
{
/* Fill out the PTE */
PointerPte = HalAddressToPte(BaseAddress);
PointerPte->PageFrameNumber = PhysicalAddress.QuadPart >> PAGE_SHIFT;
PointerPte->Valid = 1;
PointerPte->Write = 1;
/* Move to the next address */
PhysicalAddress.QuadPart += PAGE_SIZE;
BaseAddress = (PVOID)((ULONG_PTR)BaseAddress + PAGE_SIZE);
}
/* Flush the TLB and return the address */
HalpFlushTLB();
return VirtualAddress;
}
VOID
NTAPI
HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
IN ULONG PageCount)
{
PHARDWARE_PTE PointerPte;
ULONG i;
/* Only accept valid addresses */
if (VirtualAddress < MM_HAL_VA_START) return;
/* Align it down to page size */
VirtualAddress = (PVOID)((ULONG_PTR)VirtualAddress & ~(PAGE_SIZE - 1));
/* Loop PTEs */
PointerPte = HalAddressToPte(VirtualAddress);
for (i = 0; i < PageCount; i++)
{
*(PULONG)PointerPte = 0;
PointerPte++;
}
/* Flush the TLB */
HalpFlushTLB();
/* Put the heap back */
if (HalpHeapStart > VirtualAddress) HalpHeapStart = VirtualAddress;
}
VOID
NTAPI
HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
@ -92,6 +307,9 @@ HalInitSystem(IN ULONG BootPhase,
}
#ifndef _MINIHAL_
/* Initialize ACPI */
HalpSetupAcpiPhase0(LoaderBlock);
/* Initialize the PICs */
HalpInitializePICs(TRUE);
#endif

View file

@ -0,0 +1,27 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: hal/halx86/generic/acpi/halpcat.c
* PURPOSE: HAL Legacy Support Code
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
/* PRIVATE FUNCTIONS **********************************************************/
NTSTATUS
NTAPI
HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
/* There is no ACPI on these HALs */
return STATUS_NO_SUCH_DEVICE;
}
/* EOF */

View file

@ -18,6 +18,47 @@ BOOLEAN HalpNMIInProgress;
/* PRIVATE FUNCTIONS **********************************************************/
NTSTATUS
NTAPI
HalpOpenRegistryKey(IN PHANDLE KeyHandle,
IN HANDLE RootKey,
IN PUNICODE_STRING KeyName,
IN ACCESS_MASK DesiredAccess,
IN BOOLEAN Create)
{
NTSTATUS Status;
ULONG Disposition;
OBJECT_ATTRIBUTES ObjectAttributes;
/* Setup the attributes we received */
InitializeObjectAttributes(&ObjectAttributes,
KeyName,
OBJ_CASE_INSENSITIVE,
RootKey,
NULL);
/* What to do? */
if ( Create )
{
/* Create the key */
Status = ZwCreateKey(KeyHandle,
DesiredAccess,
&ObjectAttributes,
0,
NULL,
REG_OPTION_VOLATILE,
&Disposition);
}
else
{
/* Open the key */
Status = ZwOpenKey(KeyHandle, DesiredAccess, &ObjectAttributes);
}
/* We're done */
return Status;
}
VOID
NTAPI
HalpCheckPowerButton(VOID)
@ -28,32 +69,6 @@ HalpCheckPowerButton(VOID)
return;
}
#ifndef _MINIHAL_
PVOID
NTAPI
HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
IN ULONG NumberPage)
{
//
// Use kernel memory manager I/O map facilities
//
return MmMapIoSpace(PhysicalAddress,
NumberPage << PAGE_SHIFT,
MmNonCached);
}
VOID
NTAPI
HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
IN ULONG NumberPages)
{
//
// Use kernel memory manager I/O map facilities
//
MmUnmapIoSpace(VirtualAddress, NumberPages << PAGE_SHIFT);
}
#endif
VOID
NTAPI
HalpFlushTLB(VOID)

View file

@ -8,7 +8,7 @@
<include base="ntoskrnl">include</include>
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<library>hal_generic</library>
<library>hal_generic_legacy</library>
<library>hal_generic_up</library>
<library>ntoskrnl</library>
<library>libcntpr</library>

View file

@ -1,12 +1,65 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../tools/rbuild/project.dtd">
<group>
<module name="hal_generic" type="objectlibrary">
<module name="hal_generic_legacy" type="objectlibrary">
<include>include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<directory name="generic">
<directory name="legacy">
<file>halpcat.c</file>
</directory>
<directory name="bus">
<file>bushndlr.c</file>
<file>isabus.c</file>
<file>halbus.c</file>
<file>pcibus.c</file>
<file>pcidata.c</file>
<file>sysbus.c</file>
</directory>
<file>beep.c</file>
<file>bios.c</file>
<file>cmos.c</file>
<file>display.c</file>
<file>dma.c</file>
<file>drive.c</file>
<file>halinit.c</file>
<file>misc.c</file>
<file>profil.c</file>
<file>reboot.c</file>
<file>sysinfo.c</file>
<file>timer.c</file>
<file>usage.c</file>
<if property="ARCH" value="i386">
<directory name="i386">
<file>portio.c</file>
<file>systimer.S</file>
<file>trap.S</file>
</directory>
</if>
<if property="ARCH" value="amd64">
<directory name="amd64">
<file>x86bios.c</file>
<file>systimer.S</file>
</directory>
</if>
</directory>
<directory name="include">
<pch>hal.h</pch>
</directory>
</module>
<module name="hal_generic_acpi" type="objectlibrary">
<include>include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<directory name="generic">
<directory name="acpi">
<file>halacpi.c</file>
<file>halpnpdd.c</file>
</directory>
<directory name="bus">
<file>bushndlr.c</file>
<file>isabus.c</file>
@ -47,7 +100,7 @@
</directory>
</module>
<module name="mini_hal" type="objectlibrary">
<module name="mini_hal" type="objectlibrary" crt="static">
<include>include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHALDLL_" />
@ -82,7 +135,7 @@
<file>systimer.S</file>
</directory>
</if>
</directory>
</directory>
<directory name="up">
<file>halinit_up.c</file>
<file>pic.c</file>

20
hal/halx86/halacpi.rbuild Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../tools/rbuild/project.dtd">
<group xmlns:xi="http://www.w3.org/2001/XInclude">
<module name="halacpi" type="kernelmodedll" entrypoint="HalInitSystem@8" installbase="system32" installname="halacpi.dll">
<importlibrary base="hal" definition="../hal.pspec" />
<bootstrap installbase="$(CDOUTPUT)" />
<include>include</include>
<include base="ntoskrnl">include</include>
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<library>hal_generic_acpi</library>
<library>hal_generic_up</library>
<library>ntoskrnl</library>
<library>libcntpr</library>
<directory name="up">
<file>halinit_up.c</file>
<file>halup.rc</file>
</directory>
</module>
</group>

View file

@ -10,7 +10,7 @@
<define name="_DISABLE_TIDENTS" />
<define name="_NTHAL_" />
<define name="_X86BIOS_" />
<library>hal_generic</library>
<library>hal_generic_acpi</library>
<library>hal_generic_up</library>
<library>ntoskrnl</library>
<!-- library>x86emu</library -->

View file

@ -9,7 +9,7 @@
<define name="CONFIG_SMP" />
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<library>hal_generic</library>
<library>hal_generic_legacy</library>
<library>hal_generic_mp</library>
<library>ntoskrnl</library>
<library>libcntpr</library>

View file

@ -8,7 +8,7 @@
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<define name="SARCH_XBOX" />
<library>hal_generic</library>
<library>hal_generic_legacy</library>
<library>hal_generic_up</library>
<library>ntoskrnl</library>
<library>libcntpr</library>

View file

@ -48,5 +48,6 @@
#include "halp.h"
#include "mps.h"
#include "ioapic.h"
#include "halacpi.h"
/* EOF */

View file

@ -0,0 +1,237 @@
#pragma once
//
// Should be shared with FreeLDR
//
typedef struct _ACPI_E820_ENTRY
{
PHYSICAL_ADDRESS Base;
LARGE_INTEGER Length;
ULONGLONG Type;
} ACPI_E820_ENTRY, *PACPI_E820_ENTRY;
typedef struct _ACPI_BIOS_MULTI_NODE
{
PHYSICAL_ADDRESS RsdtAddress;
ULONGLONG Count;
ACPI_E820_ENTRY E820Entry[1];
} ACPI_BIOS_MULTI_NODE, *PACPI_BIOS_MULTI_NODE;
//
// ACPI Signatures
//
#define RSDP_SIGNATURE 0x2052545020445352 // "RSD PTR "
#define FACS_SIGNATURE 0x53434146 // "FACS"
#define FADT_SIGNATURE 0x50434146 // "FACP"
#define RSDT_SIGNATURE 0x54445352 // "RSDT"
#define APIC_SIGNATURE 0x43495041 // "APIC"
#define DSDT_SIGNATURE 0x54445344 // "DSDT"
#define SSDT_SIGNATURE 0x54445353 // "SSDT"
#define PSDT_SIGNATURE 0x54445350 // "PSDT"
#define SBST_SIGNATURE 0x54534253 // "SBST"
#define DBGP_SIGNATURE 0x50474244 // "DBGP"
#define XSDT_SIGNATURE 'TDSX'
#define BOOT_SIGNATURE 'TOOB'
#define SRAT_SIGNATURE 'TARS'
//
// FADT Flags
//
#define ACPI_TMR_VAL_EXT 0x100
//
// ACPI Generic Register Address
//
typedef struct _GEN_ADDR
{
UCHAR AddressSpaceID;
UCHAR BitWidth;
UCHAR BitOffset;
UCHAR Reserved;
PHYSICAL_ADDRESS Address;
} GEN_ADDR, *PGEN_ADDR;
//
// ACPI BIOS Structures (packed)
//
#include <pshpack1.h>
typedef struct _RSDP
{
ULONGLONG Signature;
UCHAR Checksum;
UCHAR OEMID[6];
UCHAR Reserved[1];
ULONG RsdtAddress;
} RSDP;
typedef RSDP *PRSDP;
typedef struct _DESCRIPTION_HEADER
{
ULONG Signature;
ULONG Length;
UCHAR Revision;
UCHAR Checksum;
UCHAR OEMID[6];
UCHAR OEMTableID[8];
ULONG OEMRevision;
UCHAR CreatorID[4];
ULONG CreatorRev;
} DESCRIPTION_HEADER;
typedef DESCRIPTION_HEADER *PDESCRIPTION_HEADER;
typedef struct _FACS
{
ULONG Signature;
ULONG Length;
ULONG HardwareSignature;
ULONG pFirmwareWakingVector;
ULONG GlobalLock;
ULONG Flags;
PHYSICAL_ADDRESS x_FirmwareWakingVector;
UCHAR version;
UCHAR Reserved[32];
} FACS;
typedef FACS *PFACS;
typedef struct _FADT
{
DESCRIPTION_HEADER Header;
ULONG facs;
ULONG dsdt;
UCHAR int_model;
UCHAR pm_profile;
USHORT sci_int_vector;
ULONG smi_cmd_io_port;
UCHAR acpi_on_value;
UCHAR acpi_off_value;
UCHAR s4bios_req;
UCHAR pstate_control;
ULONG pm1a_evt_blk_io_port;
ULONG pm1b_evt_blk_io_port;
ULONG pm1a_ctrl_blk_io_port;
ULONG pm1b_ctrl_blk_io_port;
ULONG pm2_ctrl_blk_io_port;
ULONG pm_tmr_blk_io_port;
ULONG gp0_blk_io_port;
ULONG gp1_blk_io_port;
UCHAR pm1_evt_len;
UCHAR pm1_ctrl_len;
UCHAR pm2_ctrl_len;
UCHAR pm_tmr_len;
UCHAR gp0_blk_len;
UCHAR gp1_blk_len;
UCHAR gp1_base;
UCHAR cstate_control;
USHORT lvl2_latency;
USHORT lvl3_latency;
USHORT flush_size;
USHORT flush_stride;
UCHAR duty_offset;
UCHAR duty_width;
UCHAR day_alarm_index;
UCHAR month_alarm_index;
UCHAR century_alarm_index;
USHORT boot_arch;
UCHAR reserved3[1];
ULONG flags;
GEN_ADDR reset_reg;
UCHAR reset_val;
UCHAR reserved4[3];
PHYSICAL_ADDRESS x_firmware_ctrl;
PHYSICAL_ADDRESS x_dsdt;
GEN_ADDR x_pm1a_evt_blk;
GEN_ADDR x_pm1b_evt_blk;
GEN_ADDR x_pm1a_ctrl_blk;
GEN_ADDR x_pm1b_ctrl_blk;
GEN_ADDR x_pm2_ctrl_blk;
GEN_ADDR x_pm_tmr_blk;
GEN_ADDR x_gp0_blk;
GEN_ADDR x_gp1_blk;
} FADT;
typedef FADT *PFADT;
typedef struct _DSDT
{
DESCRIPTION_HEADER Header;
UCHAR DiffDefBlock[ANYSIZE_ARRAY];
} DSDT;
typedef DSDT *PDSDT;
typedef struct _RSDT
{
DESCRIPTION_HEADER Header;
ULONG Tables[ANYSIZE_ARRAY];
} RSDT;
typedef RSDT *PRSDT;
typedef struct _XSDT
{
DESCRIPTION_HEADER Header;
PHYSICAL_ADDRESS Tables[ANYSIZE_ARRAY];
} XSDT;
typedef XSDT *PXSDT;
#include <poppack.h>
//
// Microsoft-specific (pretty much) ACPI Tables, normal MS ABI packing
//
typedef struct _DEBUG_PORT_TABLE
{
DESCRIPTION_HEADER Header;
UCHAR InterfaceType;
UCHAR Reserved[3];
GEN_ADDR BaseAddress;
} DEBUG_PORT_TABLE, *PDEBUG_PORT_TABLE;
typedef struct _BOOT_TABLE
{
DESCRIPTION_HEADER Header;
UCHAR CMOSIndex;
UCHAR Reserved[3];
} BOOT_TABLE, *PBOOT_TABLE;
typedef struct _ACPI_SRAT
{
DESCRIPTION_HEADER Header;
UCHAR TableRevision;
ULONG Reserved[2];
} ACPI_SRAT, *PACPI_SRAT;
//
// Internal HAL structure
//
typedef struct _ACPI_CACHED_TABLE
{
LIST_ENTRY Links;
DESCRIPTION_HEADER Header;
// table follows
// ...
} ACPI_CACHED_TABLE, *PACPI_CACHED_TABLE;
NTSTATUS
NTAPI
HalpAcpiTableCacheInit(
IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
PVOID
NTAPI
HalpAcpiGetTable(
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG Signature
);
NTSTATUS
NTAPI
HalpSetupAcpiPhase0(
IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
PVOID
NTAPI
HalAcpiGetTable(
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG Signature
);
/* EOF */

View file

@ -681,7 +681,31 @@ HalpReleaseCmosSpinLock(
VOID
);
ULONG
NTAPI
HalpAllocPhysicalMemory(
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN ULONG MaxAddress,
IN ULONG PageCount,
IN BOOLEAN Aligned
);
PVOID
NTAPI
HalpMapPhysicalMemory64(
IN PHYSICAL_ADDRESS PhysicalAddress,
IN ULONG PageCount
);
NTSTATUS
NTAPI
HalpOpenRegistryKey(
IN PHANDLE KeyHandle,
IN HANDLE RootKey,
IN PUNICODE_STRING KeyName,
IN ACCESS_MASK DesiredAccess,
IN BOOLEAN Create
);
VOID
FASTCALL

View file

@ -184,7 +184,7 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */
#define USE_MINGW_SETJMP_TWO_ARGS
#endif
/* Diable deprecation for now! */
/* Disable deprecation for now! */
#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE_CORE
#ifdef __WINESRC__
@ -197,5 +197,7 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */
#define _CRT_UNUSED(x) (void)x
#endif
#include "_mingw_mac.h"
#endif /* !_INC_MINGW */

134
include/crt/_mingw_mac.h Normal file
View file

@ -0,0 +1,134 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#ifndef _INC_CRTDEFS_MACRO
#define _INC_CRTDEFS_MACRO
#define __STRINGIFY(x) #x
#define __MINGW64_STRINGIFY(x) __STRINGIFY(x)
#define __MINGW64_VERSION_MAJOR 1
#define __MINGW64_VERSION_MINOR 1
#define __MINGW64_VERSION_STR __MINGW64_STRINGIFY(__MINGW64_VERSION_MAJOR) "." __MINGW64_STRINGIFY(__MINGW64_VERSION_MINOR)
#define __MINGW64_VERSION_STATE "alpha"
/* mingw.org's version macros: these make gcc to define
MINGW32_SUPPORTS_MT_EH and to use the _CRT_MT global
and the __mingwthr_key_dtor() function from the MinGW
CRT in its private gthr-win32.h header. */
#define __MINGW32_MAJOR_VERSION 3
#define __MINGW32_MINOR_VERSION 11
#ifdef _WIN64
/* MS does not prefix symbols by underscores for 64-bit. */
#ifndef __MINGW_USE_UNDERSCORE_PREFIX
/* As we have to support older gcc version, which are using underscores
as symbol prefix for x64, we have to check here for the user label
prefix defined by gcc. */
#ifdef __USER_LABEL_PREFIX__
#pragma push_macro ("_")
#undef _
#define _ 1
#if (__USER_LABEL_PREFIX__ + 0) != 0
#define __MINGW_USE_UNDERSCORE_PREFIX 1
#else
#define __MINGW_USE_UNDERSCORE_PREFIX 0
#endif
#undef _
#pragma pop_macro ("_")
#else
#define __MINGW_USE_UNDERSCORE_PREFIX 0
#endif
#endif
#else
/* For 32-bits we have always to prefix by underscore. */
#undef __MINGW_USE_UNDERSCORE_PREFIX
#define __MINGW_USE_UNDERSCORE_PREFIX 1
#endif
#if __MINGW_USE_UNDERSCORE_PREFIX == 0
#define __MINGW_IMP_SYMBOL(sym) __imp_##sym
#define __MINGW_USYMBOL(sym) sym
#define __MINGW_LSYMBOL(sym) _##sym
#else
#define __MINGW_IMP_SYMBOL(sym) _imp__##sym
#define __MINGW_USYMBOL(sym) _##sym
#define __MINGW_LSYMBOL(sym) sym
#endif
/* Use alias for msvcr80 export of get/set_output_format. */
#ifndef __USE_MINGW_OUTPUT_FORMAT_EMU
#define __USE_MINGW_OUTPUT_FORMAT_EMU 1
#endif
/* Set VC specific compiler target macros. */
#if defined(__x86_64) && defined(_X86_)
#undef _X86_ /* _X86_ is not for __x86_64 */
#endif
#if defined(_X86_) && !defined(_M_IX86) && !defined(_M_IA64) \
&& !defined(_M_AMD64) && !defined(__x86_64)
#if defined(__i486__)
#define _M_IX86 400
#elif defined(__i586__)
#define _M_IX86 500
#else
/* This gives wrong (600 instead of 300) value if -march=i386 is specified
but we cannot check for__i386__ as it is defined for all 32-bit CPUs. */
#define _M_IX86 600
#endif
#endif
#if defined(__x86_64) && !defined(_M_IX86) && !defined(_M_IA64) \
&& !defined(_M_AMD64)
#define _M_AMD64 100
#define _M_X64 100
#endif
#if defined(__ia64__) && !defined(_M_IX86) && !defined(_M_IA64) \
&& !defined(_M_AMD64) && !defined(_X86_) && !defined(__x86_64)
#define _M_IA64 100
#endif
#ifndef __PTRDIFF_TYPE__
#ifdef _WIN64
#define __PTRDIFF_TYPE__ long long int
#else
#define __PTRDIFF_TYPE__ long int
#endif
#endif
#ifndef __SIZE_TYPE__
#ifdef _WIN64
#define __SIZE_TYPE__ long long unsigned int
#else
#define __SIZE_TYPE__ long unsigned int
#endif
#endif
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ unsigned short
#endif
#ifndef __WINT_TYPE__
#define __WINT_TYPE__ unsigned short
#endif
#if defined(__GNUC__) || defined(__GNUG__)
#define __MINGW_EXTENSION __extension__
#else
#define __MINGW_EXTENSION
#endif
#ifdef UNICODE
# define __MINGW_NAME_AW(func) func##W
#else
# define __MINGW_NAME_AW(func) func##A
#endif
#define __MINGW_TYPEDEF_AW(type) \
typedef __MINGW_NAME_AW(type) type;
#endif /* _INC_CRTDEFS_MACRO */

View file

@ -25,6 +25,7 @@
//#define NO_OLDNAMES
//#endif
/** Properties ***************************************************************/
#undef _CRT_PACKING
@ -50,12 +51,14 @@
#endif
#ifndef _CRTIMP
#ifdef _DLL
#ifdef CRTDLL /* Defined for ntdll, crtdll, msvcrt, etc */
#define _CRTIMP __declspec(dllexport)
#elif defined(_DLL)
#define _CRTIMP __declspec(dllimport)
#else
#define _CRTIMP
#endif
#endif
#else /* !CRTDLL && !_DLL */
#define _CRTIMP
#endif /* CRTDLL || _DLL */
#endif /* !_CRTIMP */
//#define _CRT_ALTERNATIVE_INLINES
@ -218,6 +221,7 @@
#define _CRT_OBSOLETE(_NewItem)
#endif
/** Constants ****************************************************************/
#define _ARGMAX 100
@ -231,7 +235,6 @@
#define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
/** Type definitions *********************************************************/
#ifdef __cplusplus

View file

@ -38,7 +38,7 @@ extern "C" {
#ifndef _CRT_WCTYPEDATA_DEFINED
#define _CRT_WCTYPEDATA_DEFINED
# ifndef _CTYPE_DISABLE_MACROS
_CRTDATA(extern unsigned short *_wctype);
_CRTDATA(extern const unsigned short _wctype[]);
_CRTIMP const wctype_t * __cdecl __pwctype_func(void);
# ifndef _M_CEE_PURE
_CRTDATA(extern const wctype_t *_pwctype);

View file

@ -74,6 +74,10 @@ extern "C" {
#define _AddressOfReturnAddress() (&(((void **)(__builtin_frame_address(0)))[1]))
/* TODO: __getcallerseflags but how??? */
/* Maybe the same for x86? */
#ifdef _x86_64
#define _alloca(s) __builtin_alloca(s)
#endif
/*** Atomic operations ***/
@ -565,6 +569,18 @@ __INTRIN_INLINE void __stosd(unsigned long * Dest, const unsigned long Data, siz
);
}
#ifdef _M_AMD64
__INTRIN_INLINE void __stosq(unsigned __int64 * Dest, const unsigned __int64 Data, size_t Count)
{
__asm__ __volatile__
(
"rep; stosq" :
[Dest] "=D" (Dest), [Count] "=c" (Count) :
"[Dest]" (Dest), "a" (Data), "[Count]" (Count)
);
}
#endif
__INTRIN_INLINE void __movsb(unsigned char * Destination, const unsigned char * Source, size_t Count)
{
__asm__ __volatile__
@ -595,6 +611,18 @@ __INTRIN_INLINE void __movsd(unsigned long * Destination, const unsigned long *
);
}
#ifdef _M_AMD64
__INTRIN_INLINE void __movsq(unsigned long * Destination, const unsigned long * Source, size_t Count)
{
__asm__ __volatile__
(
"rep; movsq" :
[Destination] "=D" (Destination), [Source] "=S" (Source), [Count] "=c" (Count) :
"[Destination]" (Destination), "[Source]" (Source), "[Count]" (Count)
);
}
#endif
#if defined(_M_AMD64)
/*** GS segment addressing ***/
@ -787,6 +815,20 @@ __INTRIN_INLINE unsigned char _bittest(const long * const a, const long b)
return retval;
}
#ifdef _M_AMD64
__INTRIN_INLINE unsigned char _bittest64(const __int64 * const a, const __int64 b)
{
unsigned char retval;
if(__builtin_constant_p(b))
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*(a + (b / 64))), [b] "Ir" (b % 64));
else
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*a), [b] "r" (b));
return retval;
}
#endif
__INTRIN_INLINE unsigned char _bittestandcomplement(long * const a, const long b)
{
unsigned char retval;

View file

@ -535,7 +535,7 @@ extern "C" {
_CRTIMP int __cdecl putenv(const char *_EnvString);
_CRTIMP void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes);
_CRTIMP char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix);
_CRTIMP onexit_t __cdecl onexit(onexit_t _Func);
onexit_t __cdecl onexit(onexit_t _Func);
#endif
#endif

View file

@ -624,9 +624,7 @@ extern "C" {
#define _tcscpy_s strcpy_s
#define _tcsdup _strdup
#define _tcslen strlen
#if 0
#define _tcsnlen strnlen
#endif
#define _tcsxfrm strxfrm
#define _tcsxfrm_l _strxfrm_l
#define _tcserror strerror

View file

@ -104,33 +104,33 @@ typedef struct _ARC_FILTER
} ARC_FILTER,*PARC_FILTER;
BOOLEAN
DDKAPI
NTAPI
ArcCreateFilter(
IN struct _NDIS_MINIPORT_BLOCK *Miniport,
IN UCHAR AdapterAddress,
OUT PARC_FILTER *Filter);
VOID
DDKAPI
NTAPI
ArcDeleteFilter(
IN PARC_FILTER Filter);
BOOLEAN
DDKAPI
NTAPI
ArcNoteFilterOpenAdapter(
IN PARC_FILTER Filter,
IN NDIS_HANDLE NdisBindingHandle,
OUT PNDIS_HANDLE NdisFilterHandle);
NDIS_STATUS
DDKAPI
NTAPI
ArcDeleteFilterOpenAdapter(
IN PARC_FILTER Filter,
IN NDIS_HANDLE NdisFilterHandle,
IN PNDIS_REQUEST NdisRequest);
NDIS_STATUS
DDKAPI
NTAPI
ArcFilterAdjust(
IN PARC_FILTER Filter,
IN NDIS_HANDLE NdisFilterHandle,
@ -139,12 +139,12 @@ ArcFilterAdjust(
IN BOOLEAN Set);
VOID
DDKAPI
NTAPI
ArcFilterDprIndicateReceiveComplete(
IN PARC_FILTER Filter);
VOID
DDKAPI
NTAPI
ArcFilterDprIndicateReceive(
IN PARC_FILTER Filter,
IN PUCHAR pRawHeader,
@ -152,7 +152,7 @@ ArcFilterDprIndicateReceive(
IN UINT Length);
NDIS_STATUS
DDKAPI
NTAPI
ArcFilterTransferData(
IN PARC_FILTER Filter,
IN NDIS_HANDLE MacReceiveContext,
@ -162,18 +162,18 @@ ArcFilterTransferData(
OUT PUINT BytesTransfered);
VOID
DDKAPI
NTAPI
ArcFreeNdisPacket(
IN PARC_PACKET Packet);
VOID
DDKAPI
NTAPI
ArcFilterDoIndication(
IN PARC_FILTER Filter,
IN PARC_PACKET Packet);
VOID
DDKAPI
NTAPI
ArcDestroyPacket(
IN PARC_FILTER Filter,
IN PARC_PACKET Packet);

View file

@ -1,8 +1,12 @@
#pragma once
#if (NTDDI_VERSION >= NTDDI_WINXP)
#if defined(__cplusplus)
extern "C" {
#endif
/* Helper macro to enable gcc's extension. */
/* Helper macro to enable gcc's extension. */
#ifndef __GNU_EXTENSION
#ifdef __GNUC__
#define __GNU_EXTENSION __extension__
@ -12,150 +16,190 @@ extern "C" {
#endif
#define STDMETHODCALLTYPE __stdcall
#ifndef _WDMDDK_
typedef GUID *PGUID;
#endif
/* Types */
typedef struct _BDA_PIN_PAIRING
{
ULONG ulInputPin;
ULONG ulOutputPin;
ULONG ulcMaxInputsPerOutput;
ULONG ulcMinInputsPerOutput;
ULONG ulcMaxOutputsPerInput;
ULONG ulcMinOutputsPerInput;
ULONG ulcTopologyJoints;
const ULONG *pTopologyJoints;
typedef ULONG BDA_TOPOLOGY_JOINT, *PBDA_TOPOLOGY_JOINT;
typedef struct _BDA_PIN_PAIRING {
ULONG ulInputPin;
ULONG ulOutputPin;
ULONG ulcMaxInputsPerOutput;
ULONG ulcMinInputsPerOutput;
ULONG ulcMaxOutputsPerInput;
ULONG ulcMinOutputsPerInput;
ULONG ulcTopologyJoints;
const ULONG *pTopologyJoints;
} BDA_PIN_PAIRING, *PBDA_PIN_PAIRING;
typedef struct _BDA_FILTER_TEMPLATE
{
const KSFILTER_DESCRIPTOR *pFilterDescriptor;
ULONG ulcPinPairs;
const BDA_PIN_PAIRING *pPinPairs;
typedef struct _BDA_FILTER_TEMPLATE {
const KSFILTER_DESCRIPTOR *pFilterDescriptor;
ULONG ulcPinPairs;
const BDA_PIN_PAIRING *pPinPairs;
} BDA_FILTER_TEMPLATE, *PBDA_FILTER_TEMPLATE;
typedef struct _KSM_PIN_PAIR {
KSMETHOD Method;
ULONG InputPinId;
ULONG OutputPinId;
ULONG Reserved;
} KSM_PIN_PAIR, * PKSM_PIN_PAIR;
typedef struct _KSM_PIN
{
KSMETHOD Method;
__GNU_EXTENSION union
{
ULONG PinId;
ULONG PinType;
};
ULONG Reserved;
typedef struct _KSM_PIN {
KSMETHOD Method;
__GNU_EXTENSION union {
ULONG PinId;
ULONG PinType;
};
ULONG Reserved;
} KSM_PIN, * PKSM_PIN;
/* Functions */
STDMETHODIMP_(NTSTATUS) BdaCheckChanges(IN PIRP Irp);
STDMETHODIMP_(NTSTATUS) BdaCommitChanges(IN PIRP Irp);
STDMETHODIMP_(NTSTATUS)
BdaCheckChanges(
IN PIRP Irp);
STDMETHODIMP_(NTSTATUS) BdaCreateFilterFactory(
IN PKSDEVICE pKSDevice,
IN const KSFILTER_DESCRIPTOR *pFilterDescriptor,
IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate);
STDMETHODIMP_(NTSTATUS)
BdaCommitChanges(
IN PIRP Irp);
STDMETHODIMP_(NTSTATUS) BdaCreateFilterFactoryEx(
IN PKSDEVICE pKSDevice,
IN const KSFILTER_DESCRIPTOR *pFilterDescriptor,
IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate,
OUT PKSFILTERFACTORY *ppKSFilterFactory);
STDMETHODIMP_(NTSTATUS)
BdaCreateFilterFactory(
IN PKSDEVICE pKSDevice,
IN const KSFILTER_DESCRIPTOR *pFilterDescriptor,
IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate);
STDMETHODIMP_(NTSTATUS) BdaCreatePin(
IN PKSFILTER pKSFilter,
IN ULONG ulPinType,
OUT ULONG *pulPinId);
STDMETHODIMP_(NTSTATUS)
BdaCreateFilterFactoryEx(
IN PKSDEVICE pKSDevice,
IN const KSFILTER_DESCRIPTOR *pFilterDescriptor,
IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate,
OUT PKSFILTERFACTORY *ppKSFilterFactory);
STDMETHODIMP_(NTSTATUS) BdaCreateTopology(
IN PKSFILTER pKSFilter,
IN ULONG InputPinId,
IN ULONG OutputPinId);
STDMETHODIMP_(NTSTATUS)
BdaCreatePin(
IN PKSFILTER pKSFilter,
IN ULONG ulPinType,
OUT ULONG *pulPinId);
STDMETHODIMP_(NTSTATUS) BdaDeletePin(
IN PKSFILTER pKSFilter,
IN ULONG *pulPinId);
STDMETHODIMP_(NTSTATUS)
BdaCreateTopology(
IN PKSFILTER pKSFilter,
IN ULONG InputPinId,
IN ULONG OutputPinId);
STDMETHODIMP_(NTSTATUS) BdaFilterFactoryUpdateCacheData(
IN PKSFILTERFACTORY pFilterFactory,
IN const KSFILTER_DESCRIPTOR *pFilterDescriptor OPTIONAL);
STDMETHODIMP_(NTSTATUS)
BdaDeletePin(
IN PKSFILTER pKSFilter,
IN ULONG *pulPinId);
STDMETHODIMP_(NTSTATUS) BdaGetChangeState(
IN PIRP Irp,
OUT BDA_CHANGE_STATE *pChangeState);
STDMETHODIMP_(NTSTATUS)
BdaFilterFactoryUpdateCacheData(
IN PKSFILTERFACTORY pFilterFactory,
IN const KSFILTER_DESCRIPTOR *pFilterDescriptor OPTIONAL);
STDMETHODIMP_(NTSTATUS) BdaInitFilter(
IN PKSFILTER pKSFilter,
IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate);
STDMETHODIMP_(NTSTATUS)
BdaGetChangeState(
IN PIRP Irp,
OUT BDA_CHANGE_STATE *pChangeState);
STDMETHODIMP_(NTSTATUS) BdaMethodCreatePin(
IN PIRP Irp,
IN KSMETHOD *pKSMethod,
OUT ULONG *pulPinFactoryID);
STDMETHODIMP_(NTSTATUS)
BdaInitFilter(
IN PKSFILTER pKSFilter,
IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate);
STDMETHODIMP_(NTSTATUS) BdaMethodCreateTopology(
IN PIRP Irp,
IN KSMETHOD *pKSMethod,
OPTIONAL PVOID pvIgnored);
STDMETHODIMP_(NTSTATUS)
BdaMethodCreatePin(
IN PIRP Irp,
IN KSMETHOD *pKSMethod,
OUT ULONG *pulPinFactoryID);
STDMETHODIMP_(NTSTATUS) BdaMethodDeletePin(
IN PIRP Irp,
IN KSMETHOD *pKSMethod,
OPTIONAL PVOID pvIgnored);
STDMETHODIMP_(NTSTATUS)
BdaMethodCreateTopology(
IN PIRP Irp,
IN KSMETHOD *pKSMethod,
OPTIONAL PVOID pvIgnored);
STDMETHODIMP_(NTSTATUS) BdaPropertyGetControllingPinId(
IN PIRP Irp,
IN KSP_BDA_NODE_PIN *pProperty,
OUT ULONG *pulControllingPinId);
STDMETHODIMP_(NTSTATUS)
BdaMethodDeletePin(
IN PIRP Irp,
IN KSMETHOD *pKSMethod,
OPTIONAL PVOID pvIgnored);
STDMETHODIMP_(NTSTATUS) BdaPropertyGetPinControl(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT ULONG *pulProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyGetControllingPinId(
IN PIRP Irp,
IN KSP_BDA_NODE_PIN *pProperty,
OUT ULONG *pulControllingPinId);
STDMETHODIMP_(NTSTATUS) BdaPropertyNodeDescriptors(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT BDANODE_DESCRIPTOR *pNodeDescriptorProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyGetPinControl(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT ULONG *pulProperty);
STDMETHODIMP_(NTSTATUS) BdaPropertyNodeEvents(
IN PIRP Irp,
IN KSP_NODE *pKSProperty,
OUT GUID *pguidProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeDescriptors(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT BDANODE_DESCRIPTOR *pNodeDescriptorProperty);
STDMETHODIMP_(NTSTATUS) BdaPropertyNodeMethods(
IN PIRP Irp,
IN KSP_NODE *pKSProperty,
OUT GUID *pguidProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeEvents(
IN PIRP Irp,
IN KSP_NODE *pKSProperty,
OUT GUID *pguidProperty);
STDMETHODIMP_(NTSTATUS) BdaPropertyNodeProperties(
IN PIRP Irp,
IN KSP_NODE *pKSProperty,
OUT GUID *pguidProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeMethods(
IN PIRP Irp,
IN KSP_NODE *pKSProperty,
OUT GUID *pguidProperty);
STDMETHODIMP_(NTSTATUS) BdaPropertyNodeTypes(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT ULONG *pulProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeProperties(
IN PIRP Irp,
IN KSP_NODE *pKSProperty,
OUT GUID *pguidProperty);
STDMETHODIMP_(NTSTATUS) BdaPropertyPinTypes(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT ULONG *pulProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyNodeTypes(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT ULONG *pulProperty);
STDMETHODIMP_(NTSTATUS) BdaPropertyTemplateConnections(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT KSTOPOLOGY_CONNECTION *pConnectionProperty);
STDMETHODIMP_(NTSTATUS)
BdaPropertyPinTypes(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT ULONG *pulProperty);
STDMETHODIMP_(NTSTATUS) BdaStartChanges(IN PIRP Irp);
STDMETHODIMP_(NTSTATUS) BdaUninitFilter(IN PKSFILTER pKSFilter);
STDMETHODIMP_(NTSTATUS)
BdaPropertyTemplateConnections(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty,
OUT KSTOPOLOGY_CONNECTION *pConnectionProperty);
STDMETHODIMP_(NTSTATUS) BdaValidateNodeProperty(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty);
STDMETHODIMP_(NTSTATUS)
BdaStartChanges(
IN PIRP Irp);
STDMETHODIMP_(NTSTATUS)
BdaUninitFilter(
IN PKSFILTER pKSFilter);
STDMETHODIMP_(NTSTATUS)
BdaValidateNodeProperty(
IN PIRP Irp,
IN KSPROPERTY *pKSProperty);
#if defined(__cplusplus)
}
#endif
#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */

View file

@ -229,9 +229,11 @@ typedef struct _IO_CSQ_IRP_CONTEXT {
}
*
*/
#ifndef IO_TYPE_CSQ_EX
typedef NTSTATUS (NTAPI *PIO_CSQ_INSERT_IRP_EX) (struct _IO_CSQ *Csq,
PIRP Irp,
PVOID InsertContext);
#endif
/*
* CANCEL-SAFE QUEUE DDIs

View file

@ -98,11 +98,11 @@ enum DeviceObjectState {
DeviceObjectRemoved
};
typedef VOID (DDKAPI *PHID_STATUS_CHANGE)(
typedef VOID (NTAPI *PHID_STATUS_CHANGE)(
PVOID Context,
enum DeviceObjectState State);
typedef NTSTATUS (DDKAPI *PHIDP_GETCAPS)(
typedef NTSTATUS (NTAPI *PHIDP_GETCAPS)(
IN PHIDP_PREPARSED_DATA PreparsedData,
OUT PHIDP_CAPS Capabilities);

View file

@ -69,7 +69,7 @@ typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
} DUMMYUNIONNAME;
} HIDP_KEYBOARD_MODIFIER_STATE, *PHIDP_KEYBOARD_MODIFIER_STATE;
typedef BOOLEAN (DDKAPI *PHIDP_INSERT_SCANCODES)(
typedef BOOLEAN (NTAPI *PHIDP_INSERT_SCANCODES)(
IN PVOID Context,
IN PCHAR NewScanCodes,
IN ULONG Length);
@ -94,7 +94,7 @@ typedef struct _HIDD_CONFIGURATION {
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_TranslateUsageAndPagesToI8042ScanCodes(
IN PUSAGE_AND_PAGE ChangedUsageList,
IN ULONG UsageListLength,
@ -105,7 +105,7 @@ HidP_TranslateUsageAndPagesToI8042ScanCodes(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_TranslateUsagesToI8042ScanCodes(
IN PUSAGE ChangedUsageList,
IN ULONG UsageListLength,
@ -313,14 +313,14 @@ typedef enum _HIDP_REPORT_TYPE {
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetCaps(
IN PHIDP_PREPARSED_DATA PreparsedData,
OUT PHIDP_CAPS Capabilities);
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetData(
IN HIDP_REPORT_TYPE ReportType,
OUT PHIDP_DATA DataList,
@ -331,7 +331,7 @@ HidP_GetData(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetExtendedAttributes(
IN HIDP_REPORT_TYPE ReportType,
IN USHORT DataIndex,
@ -341,7 +341,7 @@ HidP_GetExtendedAttributes(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetLinkCollectionNodes(
OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
IN OUT PULONG LinkCollectionNodesLength,
@ -349,7 +349,7 @@ HidP_GetLinkCollectionNodes(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetScaledUsageValue(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -362,7 +362,7 @@ HidP_GetScaledUsageValue(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetSpecificButtonCaps(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -374,7 +374,7 @@ HidP_GetSpecificButtonCaps(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetSpecificValueCaps(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -386,7 +386,7 @@ HidP_GetSpecificValueCaps(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetUsages(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -399,7 +399,7 @@ HidP_GetUsages(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetUsagesEx(
IN HIDP_REPORT_TYPE ReportType,
IN USHORT LinkCollection,
@ -411,7 +411,7 @@ HidP_GetUsagesEx(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetUsageValue(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -424,7 +424,7 @@ HidP_GetUsageValue(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_GetUsageValueArray(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -453,7 +453,7 @@ HidP_GetUsageValueArray(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_InitializeReportForID(
IN HIDP_REPORT_TYPE ReportType,
IN UCHAR ReportID,
@ -475,14 +475,14 @@ HidP_InitializeReportForID(
HIDAPI
ULONG
DDKAPI
NTAPI
HidP_MaxDataListLength(
IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_PREPARSED_DATA PreparsedData);
HIDAPI
ULONG
DDKAPI
NTAPI
HidP_MaxUsageListLength(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage OPTIONAL,
@ -509,7 +509,7 @@ HidP_MaxUsageListLength(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_SetData(
IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_DATA DataList,
@ -520,7 +520,7 @@ HidP_SetData(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_SetScaledUsageValue(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -533,7 +533,7 @@ HidP_SetScaledUsageValue(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_SetUsages(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -546,7 +546,7 @@ HidP_SetUsages(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_SetUsageValue(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -559,7 +559,7 @@ HidP_SetUsageValue(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_SetUsageValueArray(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -592,7 +592,7 @@ HidP_SetUsageValueArray(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_UnsetUsages(
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
@ -605,7 +605,7 @@ HidP_UnsetUsages(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_UsageAndPageListDifference(
IN PUSAGE_AND_PAGE PreviousUsageList,
IN PUSAGE_AND_PAGE CurrentUsageList,
@ -615,7 +615,7 @@ HidP_UsageAndPageListDifference(
HIDAPI
NTSTATUS
DDKAPI
NTAPI
HidP_UsageListDifference(
IN PUSAGE PreviousUsageList,
IN PUSAGE CurrentUsageList,

View file

@ -51,7 +51,7 @@ extern "C" {
CHANGERAPI
PVOID
DDKAPI
NTAPI
ChangerClassAllocatePool(
IN POOL_TYPE PoolType,
IN ULONG NumberOfBytes);
@ -64,13 +64,13 @@ ChangerClassDebugPrint(
CHANGERAPI
PVOID
DDKAPI
NTAPI
ChangerClassFreePool(
IN PVOID PoolToFree);
CHANGERAPI
NTSTATUS
DDKAPI
NTAPI
ChangerClassSendSrbSynchronous(
IN PDEVICE_OBJECT DeviceObject,
IN PSCSI_REQUEST_BLOCK Srb,
@ -79,27 +79,27 @@ ChangerClassSendSrbSynchronous(
IN BOOLEAN WriteToDevice);
typedef NTSTATUS DDKAPI
typedef NTSTATUS NTAPI
(*CHANGER_INITIALIZE)(
IN PDEVICE_OBJECT DeviceObject);
typedef ULONG DDKAPI
typedef ULONG NTAPI
(*CHANGER_EXTENSION_SIZE)(
VOID);
typedef VOID DDKAPI
typedef VOID NTAPI
(*CHANGER_ERROR_ROUTINE)(
PDEVICE_OBJECT DeviceObject,
PSCSI_REQUEST_BLOCK Srb,
NTSTATUS *Status,
BOOLEAN *Retry);
typedef NTSTATUS DDKAPI
typedef NTSTATUS NTAPI
(*CHANGER_COMMAND_ROUTINE)(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
typedef NTSTATUS DDKAPI
typedef NTSTATUS NTAPI
(*CHANGER_PERFORM_DIAGNOSTICS)(
IN PDEVICE_OBJECT DeviceObject,
OUT PWMI_CHANGER_PROBLEM_DEVICE_ERROR ChangerDeviceError);
@ -125,7 +125,7 @@ typedef struct _MCD_INIT_DATA {
CHANGERAPI
NTSTATUS
DDKAPI
NTAPI
ChangerClassInitialize(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath,

Some files were not shown because too many files have changed in this diff Show more