mirror of
https://github.com/reactos/reactos.git
synced 2024-07-04 19:54:58 +00:00
Merge trunk head (r49270)
svn path=/branches/reactos-yarotows/; revision=49272
This commit is contained in:
parent
8a28b85f48
commit
7a2f3e30fc
|
@ -31,9 +31,6 @@ typedef struct _SCMGR_HANDLE
|
|||
typedef struct _MANAGER_HANDLE
|
||||
{
|
||||
SCMGR_HANDLE Handle;
|
||||
|
||||
/* FIXME: Insert more data here */
|
||||
|
||||
WCHAR DatabaseName[1];
|
||||
} MANAGER_HANDLE, *PMANAGER_HANDLE;
|
||||
|
||||
|
@ -41,11 +38,7 @@ typedef struct _MANAGER_HANDLE
|
|||
typedef struct _SERVICE_HANDLE
|
||||
{
|
||||
SCMGR_HANDLE Handle;
|
||||
|
||||
PSERVICE ServiceEntry;
|
||||
|
||||
/* FIXME: Insert more data here */
|
||||
|
||||
} SERVICE_HANDLE, *PSERVICE_HANDLE;
|
||||
|
||||
|
||||
|
@ -149,7 +142,7 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
|
|||
if (lpDatabaseName == NULL)
|
||||
lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
|
||||
|
||||
if (_wcsicmp(lpDatabaseName,SERVICES_FAILED_DATABASEW)==0)
|
||||
if (_wcsicmp(lpDatabaseName, SERVICES_FAILED_DATABASEW) == 0)
|
||||
{
|
||||
DPRINT("Database %S, does not exist\n",lpDatabaseName);
|
||||
return ERROR_DATABASE_DOES_NOT_EXIST;
|
||||
|
@ -168,8 +161,6 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
|
|||
|
||||
Ptr->Handle.Tag = MANAGER_TAG;
|
||||
|
||||
/* FIXME: initialize more data here */
|
||||
|
||||
wcscpy(Ptr->DatabaseName, lpDatabaseName);
|
||||
|
||||
*Handle = (SC_HANDLE)Ptr;
|
||||
|
@ -192,7 +183,6 @@ ScmCreateServiceHandle(PSERVICE lpServiceEntry,
|
|||
|
||||
Ptr->Handle.Tag = SERVICE_TAG;
|
||||
|
||||
/* FIXME: initialize more data here */
|
||||
Ptr->ServiceEntry = lpServiceEntry;
|
||||
|
||||
*Handle = (SC_HANDLE)Ptr;
|
||||
|
@ -453,9 +443,10 @@ DWORD RCloseServiceHandle(
|
|||
if (*hSCObject == 0)
|
||||
return ERROR_INVALID_HANDLE;
|
||||
|
||||
hManager = (PMANAGER_HANDLE)*hSCObject;
|
||||
hService = (PSERVICE_HANDLE)*hSCObject;
|
||||
if (hManager->Handle.Tag == MANAGER_TAG)
|
||||
hManager = ScmGetServiceManagerFromHandle(*hSCObject);
|
||||
hService = ScmGetServiceFromHandle(*hSCObject);
|
||||
|
||||
if (hManager != NULL)
|
||||
{
|
||||
DPRINT("Found manager handle\n");
|
||||
|
||||
|
@ -467,7 +458,7 @@ DWORD RCloseServiceHandle(
|
|||
DPRINT("RCloseServiceHandle() done\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
else if (hService->Handle.Tag == SERVICE_TAG)
|
||||
else if (hService != NULL)
|
||||
{
|
||||
DPRINT("Found service handle\n");
|
||||
|
||||
|
@ -561,6 +552,8 @@ DWORD RControlService(
|
|||
DWORD dwError = ERROR_SUCCESS;
|
||||
DWORD pcbBytesNeeded = 0;
|
||||
DWORD dwServicesReturned = 0;
|
||||
DWORD dwControlsAccepted;
|
||||
DWORD dwCurrentState;
|
||||
HKEY hServicesKey = NULL;
|
||||
|
||||
DPRINT("RControlService() called\n");
|
||||
|
@ -662,6 +655,49 @@ DWORD RControlService(
|
|||
}
|
||||
else
|
||||
{
|
||||
dwControlsAccepted = lpService->Status.dwControlsAccepted;
|
||||
dwCurrentState = lpService->Status.dwCurrentState;
|
||||
|
||||
/* Check the current state before sending a control request */
|
||||
switch (dwCurrentState)
|
||||
{
|
||||
case SERVICE_STOP_PENDING:
|
||||
case SERVICE_STOPPED:
|
||||
return ERROR_SERVICE_CANNOT_ACCEPT_CTRL;
|
||||
|
||||
case SERVICE_START_PENDING:
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_STOP:
|
||||
break;
|
||||
|
||||
case SERVICE_CONTROL_INTERROGATE:
|
||||
RtlCopyMemory(lpServiceStatus,
|
||||
&lpService->Status,
|
||||
sizeof(SERVICE_STATUS));
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
default:
|
||||
return ERROR_SERVICE_CANNOT_ACCEPT_CTRL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check if the control code is acceptable to the service */
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_STOP:
|
||||
if ((dwControlsAccepted & SERVICE_ACCEPT_STOP) == 0)
|
||||
return ERROR_INVALID_SERVICE_CONTROL;
|
||||
break;
|
||||
|
||||
case SERVICE_CONTROL_PAUSE:
|
||||
case SERVICE_CONTROL_CONTINUE:
|
||||
if ((dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) == 0)
|
||||
return ERROR_INVALID_SERVICE_CONTROL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Send control code to the service */
|
||||
dwError = ScmControlService(lpService,
|
||||
dwControl);
|
||||
|
|
|
@ -169,7 +169,7 @@ SharedPtrToKernel(PVOID Ptr)
|
|||
static __inline BOOL
|
||||
IsThreadHooked(PCLIENTINFO pci)
|
||||
{
|
||||
return pci->fsHooks != 0;
|
||||
return (pci->fsHooks|pci->pDeskInfo->fsHooks) != 0;
|
||||
}
|
||||
|
||||
static __inline PDESKTOPINFO
|
||||
|
|
|
@ -79,6 +79,7 @@ const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {
|
|||
const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}};
|
||||
const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
||||
const GUID KSPROPTYPESETID_General = {0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
||||
const GUID KSPROPSETID_DrmAudioStream = {0x2f2c8ddd, 0x4198, 0x4fac, {0xba, 0x29, 0x61, 0xbb, 0x05, 0xb7, 0xde, 0x06}};
|
||||
|
||||
const GUID KSEVENTSETID_LoopedStreaming = {0x4682B940L, 0xC6EF, 0x11D0, {0x96, 0xD8, 0x00, 0xAA, 0x00, 0x51, 0xE5, 0x1D}};
|
||||
const GUID KSEVENTSETID_Connection = {0x7f4bcbe0L, 0x9ea5, 0x11cf, {0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00}};
|
||||
|
|
|
@ -321,8 +321,7 @@ DECLARE_INTERFACE_(IIrpQueue, IUnknown)
|
|||
STDMETHOD_(NTSTATUS, Init)(THIS_
|
||||
IN KSPIN_CONNECT *ConnectDetails,
|
||||
IN ULONG FrameSize,
|
||||
IN ULONG Alignment,
|
||||
IN PVOID SilenceBuffer) PURE;
|
||||
IN ULONG Alignment) PURE;
|
||||
|
||||
STDMETHOD_(NTSTATUS, AddMapping)(THIS_
|
||||
IN PIRP Irp,
|
||||
|
@ -363,8 +362,7 @@ DECLARE_INTERFACE_(IIrpQueue, IUnknown)
|
|||
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
|
||||
IN KSPIN_CONNECT *ConnectDetails, \
|
||||
IN ULONG FrameSize, \
|
||||
IN ULONG Alignment, \
|
||||
IN PVOID SilenceBuffer); \
|
||||
IN ULONG Alignment); \
|
||||
\
|
||||
STDMETHODIMP_(NTSTATUS) AddMapping(THIS_ \
|
||||
IN PIRP Irp, \
|
||||
|
|
|
@ -43,7 +43,6 @@ protected:
|
|||
LIST_ENTRY m_IrpList;
|
||||
LIST_ENTRY m_FreeIrpList;
|
||||
PIRP m_Irp;
|
||||
PVOID m_SilenceBuffer;
|
||||
|
||||
ULONG m_OutOfMapping;
|
||||
ULONG m_MaxFrameSize;
|
||||
|
@ -84,12 +83,10 @@ NTAPI
|
|||
CIrpQueue::Init(
|
||||
IN KSPIN_CONNECT *ConnectDetails,
|
||||
IN ULONG FrameSize,
|
||||
IN ULONG Alignment,
|
||||
IN PVOID SilenceBuffer)
|
||||
IN ULONG Alignment)
|
||||
{
|
||||
m_ConnectDetails = ConnectDetails;
|
||||
m_MaxFrameSize = FrameSize;
|
||||
m_SilenceBuffer = SilenceBuffer;
|
||||
m_Alignment = Alignment;
|
||||
|
||||
InitializeListHead(&m_IrpList);
|
||||
|
@ -259,22 +256,13 @@ CIrpQueue::GetMapping(
|
|||
m_CurrentOffset = Offset = 0;
|
||||
}
|
||||
|
||||
if (!Irp && m_SilenceBuffer && m_MaxFrameSize)
|
||||
{
|
||||
DPRINT("NoIrp\n");
|
||||
// no irp available, use silence buffer
|
||||
*Buffer = (PUCHAR)m_SilenceBuffer;
|
||||
*BufferSize = m_MaxFrameSize;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!Irp)
|
||||
{
|
||||
// no irp buffer available
|
||||
DPRINT("NoIrp\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
// get stream header
|
||||
StreamHeader = (PKSSTREAM_HEADER)Irp->Tail.Overlay.DriverContext[2];
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ CPortPinDMus::Init(
|
|||
}
|
||||
}
|
||||
|
||||
Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL);
|
||||
Status = m_IrpQueue->Init(ConnectDetails, 0, 0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("IrpQueue_Init failed with %x\n", Status);
|
||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
|||
ULONG m_StopCount;
|
||||
KSAUDIO_POSITION m_Position;
|
||||
KSALLOCATOR_FRAMING m_AllocatorFraming;
|
||||
SUBDEVICE_DESCRIPTOR m_Descriptor;
|
||||
PSUBDEVICE_DESCRIPTOR m_Descriptor;
|
||||
|
||||
KSPIN_LOCK m_EventListLock;
|
||||
LIST_ENTRY m_EventList;
|
||||
|
@ -105,10 +105,12 @@ NTSTATUS NTAPI PinWaveCyclicAudioPosition(IN PIRP Irp, IN PKSIDENTIFIER Request,
|
|||
NTSTATUS NTAPI PinWaveCyclicAllocatorFraming(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data);
|
||||
NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry);
|
||||
NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry);
|
||||
NTSTATUS NTAPI PinWaveCyclicDRMHandler(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data);
|
||||
|
||||
|
||||
DEFINE_KSPROPERTY_CONNECTIONSET(PinWaveCyclicConnectionSet, PinWaveCyclicState, PinWaveCyclicDataFormat, PinWaveCyclicAllocatorFraming);
|
||||
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition);
|
||||
DEFINE_KSPROPERTY_DRMSET(PinWaveCyclicDRMSet, PinWaveCyclicDRMHandler);
|
||||
|
||||
KSEVENT_ITEM PinWaveCyclicConnectionEventSet =
|
||||
{
|
||||
|
@ -146,6 +148,13 @@ KSPROPERTY_SET PinWaveCyclicPropertySet[] =
|
|||
(const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
|
||||
0,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
&KSPROPSETID_DrmAudioStream,
|
||||
sizeof(PinWaveCyclicDRMSet) / sizeof(KSPROPERTY_ITEM),
|
||||
(const KSPROPERTY_ITEM*)&PinWaveCyclicDRMSet,
|
||||
0,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -192,6 +201,19 @@ CPortPinWaveCyclic::QueryInterface(
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PinWaveCyclicDRMHandler(
|
||||
IN PIRP Irp,
|
||||
IN PKSIDENTIFIER Request,
|
||||
IN OUT PVOID Data)
|
||||
{
|
||||
DPRINT1("PinWaveCyclicDRMHandler\n");
|
||||
ASSERT(0);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PinWaveCyclicAddEndOfStreamEvent(
|
||||
|
@ -448,12 +470,14 @@ PinWaveCyclicState(
|
|||
{
|
||||
// FIXME
|
||||
// complete with successful state
|
||||
Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
|
||||
Pin->m_IrpQueue->CancelBuffers();
|
||||
Pin->m_Position.PlayOffset = 0;
|
||||
Pin->m_Position.WriteOffset = 0;
|
||||
}
|
||||
else if (Pin->m_State == KSSTATE_STOP)
|
||||
{
|
||||
Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
|
||||
Pin->m_IrpQueue->CancelBuffers();
|
||||
Pin->m_Position.PlayOffset = 0;
|
||||
Pin->m_Position.WriteOffset = 0;
|
||||
|
@ -662,6 +686,7 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
|||
ULONG BufferLength;
|
||||
ULONG BytesToCopy;
|
||||
ULONG BufferSize;
|
||||
ULONG Gap;
|
||||
PUCHAR Buffer;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
@ -672,7 +697,18 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
|||
{
|
||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return;
|
||||
{
|
||||
Gap = Position - m_CommonBufferOffset;
|
||||
if (Gap > m_FrameSize)
|
||||
{
|
||||
// insert silence samples
|
||||
DPRINT1("Inserting Silence Buffer Offset %lu GapLength %lu\n", m_CommonBufferOffset, BufferLength);
|
||||
m_Stream->Silence((PUCHAR)m_CommonBuffer + m_CommonBufferOffset, BufferLength);
|
||||
|
||||
m_CommonBufferOffset += BufferLength;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BytesToCopy = min(BufferLength, BufferSize);
|
||||
|
||||
|
@ -688,7 +724,7 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
|||
m_IrpQueue->UpdateMapping(BytesToCopy);
|
||||
m_CommonBufferOffset += BytesToCopy;
|
||||
|
||||
BufferLength = Position - m_CommonBufferOffset;
|
||||
BufferLength -= BytesToCopy;
|
||||
m_Position.PlayOffset += BytesToCopy;
|
||||
|
||||
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
||||
|
@ -720,7 +756,18 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
|||
{
|
||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return;
|
||||
{
|
||||
Gap = m_CommonBufferSize - m_CommonBufferOffset + Position;
|
||||
if (Gap > m_FrameSize)
|
||||
{
|
||||
// insert silence samples
|
||||
DPRINT1("Overlap Inserting Silence Buffer Size %lu Offset %lu Gap %lu Position %lu\n", m_CommonBufferSize, m_CommonBufferOffset, Gap, Position);
|
||||
m_Stream->Silence((PUCHAR)m_CommonBuffer + m_CommonBufferOffset, BufferLength);
|
||||
|
||||
m_CommonBufferOffset += BufferLength;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
BytesToCopy = min(BufferLength, BufferSize);
|
||||
|
||||
|
@ -741,7 +788,7 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
|||
m_CommonBufferOffset += BytesToCopy;
|
||||
m_Position.PlayOffset += BytesToCopy;
|
||||
|
||||
BufferLength = m_CommonBufferSize - m_CommonBufferOffset;
|
||||
BufferLength -=BytesToCopy;
|
||||
|
||||
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
||||
{
|
||||
|
@ -751,7 +798,6 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
|||
m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Gap == Length)
|
||||
|
@ -773,22 +819,13 @@ CPortPinWaveCyclic::RequestService()
|
|||
{
|
||||
ULONG Position;
|
||||
NTSTATUS Status;
|
||||
PUCHAR Buffer;
|
||||
ULONG BufferSize;
|
||||
ULONGLONG OldOffset, NewOffset;
|
||||
|
||||
PC_ASSERT_IRQL(DISPATCH_LEVEL);
|
||||
|
||||
if (m_State == KSSTATE_RUN)
|
||||
{
|
||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Status = m_Stream->GetPosition(&Position);
|
||||
DPRINT("Position %u Buffer %p BufferSize %u ActiveIrpOffset %u Capture %u\n", Position, Buffer, m_CommonBufferSize, BufferSize, m_Capture);
|
||||
|
||||
OldOffset = m_Position.PlayOffset;
|
||||
|
||||
|
@ -841,7 +878,7 @@ CPortPinWaveCyclic::DeviceIoControl(
|
|||
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
|
||||
{
|
||||
/* handle property with subdevice descriptor */
|
||||
Status = PcHandlePropertyWithTable(Irp, m_Descriptor.FilterPropertySetCount, m_Descriptor.FilterPropertySet, &m_Descriptor);
|
||||
Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount, m_Descriptor->FilterPropertySet, m_Descriptor);
|
||||
|
||||
if (Status == STATUS_NOT_FOUND)
|
||||
{
|
||||
|
@ -854,11 +891,11 @@ CPortPinWaveCyclic::DeviceIoControl(
|
|||
}
|
||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT)
|
||||
{
|
||||
Status = PcHandleEnableEventWithTable(Irp, &m_Descriptor);
|
||||
Status = PcHandleEnableEventWithTable(Irp, m_Descriptor);
|
||||
}
|
||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_DISABLE_EVENT)
|
||||
{
|
||||
Status = PcHandleDisableEventWithTable(Irp, &m_Descriptor);
|
||||
Status = PcHandleDisableEventWithTable(Irp, m_Descriptor);
|
||||
}
|
||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
|
||||
{
|
||||
|
@ -1120,7 +1157,6 @@ CPortPinWaveCyclic::Init(
|
|||
PKSDATAFORMAT DataFormat;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
BOOLEAN Capture;
|
||||
PVOID SilenceBuffer;
|
||||
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
|
||||
//IDrmAudioStream * DrmAudio = NULL;
|
||||
|
||||
|
@ -1179,7 +1215,6 @@ CPortPinWaveCyclic::Init(
|
|||
#endif
|
||||
|
||||
DPRINT1("CPortPinWaveCyclic::Init Status %x PinId %u Capture %u\n", Status, ConnectDetails->PinId, Capture);
|
||||
DPRINT1("Bits %u Samples %u Channels %u Tag %u FrameSize %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wBitsPerSample, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nSamplesPerSec, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nChannels, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wFormatTag, m_FrameSize);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
@ -1203,18 +1238,26 @@ CPortPinWaveCyclic::Init(
|
|||
InitializeListHead(&m_EventList);
|
||||
KeInitializeSpinLock(&m_EventListLock);
|
||||
|
||||
/* set up subdevice descriptor */
|
||||
RtlZeroMemory(&m_Descriptor, sizeof(SUBDEVICE_DESCRIPTOR));
|
||||
m_Descriptor.FilterPropertySet = PinWaveCyclicPropertySet;
|
||||
m_Descriptor.FilterPropertySetCount = sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET);
|
||||
m_Descriptor.UnknownStream = (PUNKNOWN)m_Stream;
|
||||
m_Descriptor.DeviceDescriptor = SubDeviceDescriptor->DeviceDescriptor;
|
||||
m_Descriptor.UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
|
||||
m_Descriptor.PortPin = (PVOID)this;
|
||||
m_Descriptor.EventSetCount = sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET);
|
||||
m_Descriptor.EventSet = PinWaveCyclicEventSet;
|
||||
m_Descriptor.EventList = &m_EventList;
|
||||
m_Descriptor.EventListLock = &m_EventListLock;
|
||||
Status = PcCreateSubdeviceDescriptor(&m_Descriptor,
|
||||
SubDeviceDescriptor->InterfaceCount,
|
||||
SubDeviceDescriptor->Interfaces,
|
||||
0, /* FIXME KSINTERFACE_STANDARD with KSINTERFACE_STANDARD_STREAMING / KSINTERFACE_STANDARD_LOOPED_STREAMING */
|
||||
NULL,
|
||||
sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET),
|
||||
PinWaveCyclicPropertySet,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET),
|
||||
PinWaveCyclicEventSet,
|
||||
SubDeviceDescriptor->DeviceDescriptor);
|
||||
|
||||
m_Descriptor->UnknownStream = (PUNKNOWN)m_Stream;
|
||||
m_Descriptor->UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
|
||||
m_Descriptor->PortPin = (PVOID)this;
|
||||
m_Descriptor->EventList = &m_EventList;
|
||||
m_Descriptor->EventListLock = &m_EventListLock;
|
||||
|
||||
// initialize reset state
|
||||
m_ResetState = KSRESET_END;
|
||||
|
@ -1247,9 +1290,7 @@ CPortPinWaveCyclic::Init(
|
|||
PC_ASSERT(NT_SUCCESS(Status));
|
||||
PC_ASSERT(m_FrameSize);
|
||||
|
||||
SilenceBuffer = AllocateItem(NonPagedPool, m_FrameSize, TAG_PORTCLASS);
|
||||
if (!SilenceBuffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
DPRINT1("Bits %u Samples %u Channels %u Tag %u FrameSize %u CommonBufferSize %lu\n", ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wBitsPerSample, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nSamplesPerSec, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nChannels, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wFormatTag, m_FrameSize, m_CommonBufferSize);
|
||||
|
||||
|
||||
/* set up allocator framing */
|
||||
|
@ -1260,10 +1301,9 @@ CPortPinWaveCyclic::Init(
|
|||
m_AllocatorFraming.Reserved = 0;
|
||||
m_AllocatorFraming.FrameSize = m_FrameSize;
|
||||
|
||||
m_Stream->Silence(SilenceBuffer, m_FrameSize);
|
||||
m_Stream->Silence(m_CommonBuffer, m_CommonBufferSize);
|
||||
|
||||
Status = m_IrpQueue->Init(ConnectDetails, m_FrameSize, 0, SilenceBuffer);
|
||||
Status = m_IrpQueue->Init(ConnectDetails, m_FrameSize, 0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
m_IrpQueue->Release();
|
||||
|
@ -1282,9 +1322,6 @@ CPortPinWaveCyclic::Init(
|
|||
m_Port = Port;
|
||||
m_Filter = Filter;
|
||||
|
||||
//DPRINT("Setting state to acquire %x\n", m_Stream->SetState(KSSTATE_ACQUIRE));
|
||||
//DPRINT("Setting state to pause %x\n", m_Stream->SetState(KSSTATE_PAUSE));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -919,7 +919,7 @@ CPortPinWavePci::Init(
|
|||
}
|
||||
|
||||
// initialize irp queue
|
||||
Status = m_IrpQueue->Init(ConnectDetails, m_AllocatorFraming.FrameSize, m_AllocatorFraming.FileAlignment, NULL);
|
||||
Status = m_IrpQueue->Init(ConnectDetails, m_AllocatorFraming.FrameSize, m_AllocatorFraming.FileAlignment);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
// this should never happen
|
||||
|
|
|
@ -587,7 +587,7 @@ CPortPinWaveRT::Init(
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL);
|
||||
Status = m_IrpQueue->Init(ConnectDetails, 0, 0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto cleanup;
|
||||
|
|
|
@ -356,6 +356,22 @@ DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
|||
DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\
|
||||
}
|
||||
|
||||
|
||||
#define DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(SetHandler)\
|
||||
DEFINE_KSPROPERTY_ITEM(\
|
||||
KSPROPERTY_DRMAUDIOSTREAM_CONTENTID,\
|
||||
NULL,\
|
||||
sizeof(KSPROPERTY),\
|
||||
sizeof(ULONG),\
|
||||
(SetHandler),\
|
||||
NULL, 0, NULL, NULL, 0)
|
||||
|
||||
#define DEFINE_KSPROPERTY_DRMSET(PinSet,\
|
||||
PropPositionHandler)\
|
||||
DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
||||
DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(PropPositionHandler)\
|
||||
}
|
||||
|
||||
#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\
|
||||
PropGeneral, PropInstances, PropIntersection)\
|
||||
DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -235,8 +235,9 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
|||
if (!HalpGetInfoFromACPI)
|
||||
{
|
||||
/* No, so use our local table */
|
||||
Port = HalpComPortIrqMapping[0][0];
|
||||
for (i = 0; Port; i++)
|
||||
for (i = 0, Port = HalpComPortIrqMapping[i][0];
|
||||
Port;
|
||||
i++, Port = HalpComPortIrqMapping[i][0])
|
||||
{
|
||||
/* Is this the port we want? */
|
||||
if (Port == (ULONG_PTR)KdComPortInUse)
|
||||
|
@ -248,9 +249,6 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
|||
PRIMARY_VECTOR_BASE,
|
||||
HIGH_LEVEL);
|
||||
}
|
||||
|
||||
/* Next port */
|
||||
Port = HalpComPortIrqMapping[i][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -509,6 +507,9 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
|
|||
IN PVOID Handler,
|
||||
IN KINTERRUPT_MODE Mode)
|
||||
{
|
||||
/* Set the IDT_LATCHED flag for latched interrupts */
|
||||
if (Mode == Latched) Flags |= IDT_LATCHED;
|
||||
|
||||
/* Register the vector */
|
||||
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
|
||||
|
||||
|
|
|
@ -1005,11 +1005,6 @@ DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_Genera
|
|||
KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY
|
||||
*/
|
||||
|
||||
#define KSPROPSETID_DrmAudioStream
|
||||
/*
|
||||
KSPROPERTY_DRMAUDIOSTREAM_CONTENTID
|
||||
*/
|
||||
|
||||
#define KSPROPSETID_Hrtf3d
|
||||
/*
|
||||
KSPROPERTY_HRTF3D_FILTER_FORMAT
|
||||
|
|
|
@ -565,6 +565,15 @@ typedef struct {
|
|||
#endif // !_NTDDK_
|
||||
} LOOPEDSTREAMING_POSITION_EVENT_DATA, *PLOOPEDSTREAMING_POSITION_EVENT_DATA ;
|
||||
|
||||
#define STATIC_KSPROPSETID_DrmAudioStream\
|
||||
0x2f2c8ddd, 0x4198, 0x4fac, 0xba, 0x29, 0x61, 0xbb, 0x5, 0xb7, 0xde, 0x6
|
||||
DEFINE_GUIDSTRUCT("2F2C8DDD-4198-4fac-BA29-61BB05B7DE06", KSPROPSETID_DrmAudioStream);
|
||||
#define KSPROPSETID_DrmAudioStream DEFINE_GUIDNAMED(KSPROPSETID_DrmAudioStream)
|
||||
|
||||
typedef enum {
|
||||
KSPROPERTY_DRMAUDIOSTREAM_CONTENTID
|
||||
} KSPROPERTY_DRMAUDIOSTREAM;
|
||||
|
||||
|
||||
/*
|
||||
SysAudio Properties
|
||||
|
|
|
@ -514,6 +514,21 @@ IopAssignDeviceResources(
|
|||
IN PDEVICE_NODE DeviceNode
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
IopCreateResourceListFromRequirements(
|
||||
IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList,
|
||||
OUT PCM_RESOURCE_LIST *ResourceList
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
IopDetectResourceConflict(
|
||||
IN PCM_RESOURCE_LIST ResourceList,
|
||||
IN BOOLEAN Silent,
|
||||
OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor
|
||||
);
|
||||
|
||||
//
|
||||
// PNP Routines
|
||||
//
|
||||
|
|
|
@ -841,7 +841,7 @@ IoGetConfigurationInformation(VOID)
|
|||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @halfplemented
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
||||
|
@ -876,13 +876,48 @@ IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
|||
* a conflict is detected with another driver.
|
||||
*/
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
*ConflictDetected = FALSE;
|
||||
return STATUS_SUCCESS;
|
||||
NTSTATUS Status;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
|
||||
DPRINT1("IoReportResourceUsage is halfplemented!\n");
|
||||
|
||||
if (!DriverList && !DeviceList)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
if (DeviceList)
|
||||
ResourceList = DeviceList;
|
||||
else
|
||||
ResourceList = DriverList;
|
||||
|
||||
Status = IopDetectResourceConflict(ResourceList, FALSE, NULL);
|
||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||
{
|
||||
*ConflictDetected = TRUE;
|
||||
|
||||
if (!OverrideConflict)
|
||||
{
|
||||
DPRINT1("Denying an attempt to claim resources currently in use by another device!\n");
|
||||
return STATUS_CONFLICTING_ADDRESSES;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("Proceeding with conflicting resources\n");
|
||||
}
|
||||
}
|
||||
else if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* TODO: Claim resources in registry */
|
||||
|
||||
*ConflictDetected = FALSE;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @halfplemented
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
IoAssignResources(PUNICODE_STRING RegistryPath,
|
||||
|
@ -892,8 +927,23 @@ IoAssignResources(PUNICODE_STRING RegistryPath,
|
|||
PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
|
||||
PCM_RESOURCE_LIST* AllocatedResources)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(STATUS_NOT_IMPLEMENTED);
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT1("IoAssignResources is halfplemented!\n");
|
||||
|
||||
Status = IopCreateResourceListFromRequirements(RequestedResources,
|
||||
AllocatedResources);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||
DPRINT1("Denying an attempt to claim resources currently in use by another device!\n");
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* TODO: Claim resources in registry */
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,9 +38,6 @@ NTSTATUS
|
|||
IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
|
||||
PVOID Context);
|
||||
|
||||
NTSTATUS
|
||||
IopDetectResourceConflict(IN PCM_RESOURCE_LIST ResourceList);
|
||||
|
||||
NTSTATUS
|
||||
PpSetCustomTargetEvent(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN OUT PKEVENT SyncEvent OPTIONAL,
|
||||
|
@ -379,7 +376,7 @@ IoReportResourceForDetection(IN PDRIVER_OBJECT DriverObject,
|
|||
ResourceList = DriverList;
|
||||
|
||||
/* Look for a resource conflict */
|
||||
Status = IopDetectResourceConflict(ResourceList);
|
||||
Status = IopDetectResourceConflict(ResourceList, FALSE, NULL);
|
||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||
{
|
||||
/* Oh noes */
|
||||
|
|
|
@ -12,12 +12,6 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
NTSTATUS
|
||||
IopDetectResourceConflict(
|
||||
IN PCM_RESOURCE_LIST ResourceList,
|
||||
IN BOOLEAN Silent,
|
||||
OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor);
|
||||
|
||||
static
|
||||
BOOLEAN
|
||||
IopCheckDescriptorForConflict(PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor)
|
||||
|
@ -187,8 +181,8 @@ IopFindInterruptResource(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
|
||||
NTSTATUS NTAPI
|
||||
IopCreateResourceListFromRequirements(
|
||||
IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList,
|
||||
OUT PCM_RESOURCE_LIST *ResourceList)
|
||||
|
@ -336,9 +330,6 @@ IopCheckResourceDescriptor(
|
|||
ULONG i, ii;
|
||||
BOOLEAN Result = FALSE;
|
||||
|
||||
if (ResDesc->ShareDisposition == CmResourceShareShared)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < ResourceList->Count; i++)
|
||||
{
|
||||
PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList->List[i].PartialResourceList;
|
||||
|
@ -615,40 +606,61 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
|||
|
||||
if (DeviceNode->ResourceList)
|
||||
{
|
||||
PWCHAR DeviceName = NULL;
|
||||
UNICODE_STRING NameU;
|
||||
UNICODE_STRING Suffix;
|
||||
UNICODE_STRING RawSuffix, TranslatedSuffix;
|
||||
ULONG OldLength = 0;
|
||||
|
||||
ASSERT(DeviceNode->ResourceListTranslated);
|
||||
|
||||
RtlInitUnicodeString(&TranslatedSuffix, L".Translated");
|
||||
RtlInitUnicodeString(&RawSuffix, L".Raw");
|
||||
|
||||
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
||||
DevicePropertyPhysicalDeviceObjectName,
|
||||
0,
|
||||
NULL,
|
||||
&OldLength);
|
||||
if ((OldLength != 0) && (Status == STATUS_BUFFER_TOO_SMALL))
|
||||
{
|
||||
DeviceName = ExAllocatePool(NonPagedPool, OldLength);
|
||||
ASSERT(DeviceName);
|
||||
if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
ASSERT(OldLength);
|
||||
|
||||
NameU.Buffer = ExAllocatePool(PagedPool, OldLength + TranslatedSuffix.Length);
|
||||
if (!NameU.Buffer)
|
||||
{
|
||||
ZwClose(PnpMgrLevel2);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
NameU.Length = 0;
|
||||
NameU.MaximumLength = OldLength + TranslatedSuffix.Length;
|
||||
|
||||
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
||||
DevicePropertyPhysicalDeviceObjectName,
|
||||
NameU.MaximumLength,
|
||||
NameU.Buffer,
|
||||
&OldLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ZwClose(PnpMgrLevel2);
|
||||
ExFreePool(NameU.Buffer);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
else if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Some failure */
|
||||
ZwClose(PnpMgrLevel2);
|
||||
return Status;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This should never happen */
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
|
||||
NameU.Length = OldLength;
|
||||
|
||||
IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
||||
DevicePropertyPhysicalDeviceObjectName,
|
||||
OldLength,
|
||||
DeviceName,
|
||||
&OldLength);
|
||||
|
||||
RtlInitUnicodeString(&NameU, DeviceName);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Some failure */
|
||||
ASSERT(!NT_SUCCESS(Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&Suffix, L".Raw");
|
||||
RtlAppendUnicodeStringToString(&NameU, &Suffix);
|
||||
RtlAppendUnicodeStringToString(&NameU, &RawSuffix);
|
||||
|
||||
Status = ZwSetValueKey(PnpMgrLevel2,
|
||||
&NameU,
|
||||
|
@ -659,14 +671,14 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ZwClose(PnpMgrLevel2);
|
||||
ExFreePool(NameU.Buffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* "Remove" the suffix by setting the length back to what it used to be */
|
||||
NameU.Length = (USHORT)OldLength;
|
||||
NameU.Length = OldLength;
|
||||
|
||||
RtlInitUnicodeString(&Suffix, L".Translated");
|
||||
RtlAppendUnicodeStringToString(&NameU, &Suffix);
|
||||
RtlAppendUnicodeStringToString(&NameU, &TranslatedSuffix);
|
||||
|
||||
Status = ZwSetValueKey(PnpMgrLevel2,
|
||||
&NameU,
|
||||
|
@ -675,8 +687,8 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
|||
DeviceNode->ResourceListTranslated,
|
||||
PnpDetermineResourceListSize(DeviceNode->ResourceListTranslated));
|
||||
ZwClose(PnpMgrLevel2);
|
||||
ASSERT(DeviceName);
|
||||
ExFreePool(DeviceName);
|
||||
ExFreePool(NameU.Buffer);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
}
|
||||
|
@ -718,7 +730,7 @@ IopTranslateDeviceResources(
|
|||
DeviceNode->ResourceListTranslated = ExAllocatePool(PagedPool, ListSize);
|
||||
if (!DeviceNode->ResourceListTranslated)
|
||||
{
|
||||
Status =STATUS_NO_MEMORY;
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
RtlCopyMemory(DeviceNode->ResourceListTranslated, DeviceNode->ResourceList, ListSize);
|
||||
|
@ -743,6 +755,7 @@ IopTranslateDeviceResources(
|
|||
&DescriptorTranslated->u.Port.Start))
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
DPRINT1("Failed to translate port resource (Start: 0xI64x)\n", DescriptorRaw->u.Port.Start.QuadPart);
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
|
@ -756,6 +769,14 @@ IopTranslateDeviceResources(
|
|||
DescriptorRaw->u.Interrupt.Vector,
|
||||
(PKIRQL)&DescriptorTranslated->u.Interrupt.Level,
|
||||
&DescriptorTranslated->u.Interrupt.Affinity);
|
||||
|
||||
if (!DescriptorTranslated->u.Interrupt.Vector)
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
DPRINT1("Failed to translate interrupt resource (Vector: 0x%x | Level: 0x%x)\n", DescriptorRaw->u.Interrupt.Vector,
|
||||
DescriptorRaw->u.Interrupt.Level);
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CmResourceTypeMemory:
|
||||
|
@ -769,6 +790,7 @@ IopTranslateDeviceResources(
|
|||
&DescriptorTranslated->u.Memory.Start))
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
DPRINT1("Failed to translate memory resource (Start: 0xI64x)\n", DescriptorRaw->u.Memory.Start.QuadPart);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
@ -864,16 +886,21 @@ IopAssignDeviceResources(
|
|||
Status = IopCreateResourceListFromRequirements(DeviceNode->ResourceRequirements,
|
||||
&DeviceNode->ResourceList);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to create a resource list from supplied resources for %wZ\n", &DeviceNode->InstancePath);
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Status = IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
/* IopCreateResourceListFromRequirements should NEVER succeed with a conflicting list */
|
||||
ASSERT(IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL) != STATUS_CONFLICTING_ADDRESSES);
|
||||
|
||||
Finish:
|
||||
Status = IopTranslateDeviceResources(DeviceNode);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to translate resources for %wZ\n", &DeviceNode->InstancePath);
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -935,7 +962,7 @@ ByeBye:
|
|||
return Result;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTSTATUS NTAPI
|
||||
IopDetectResourceConflict(
|
||||
IN PCM_RESOURCE_LIST ResourceList,
|
||||
IN BOOLEAN Silent,
|
||||
|
|
|
@ -2306,7 +2306,7 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
|||
NTSTATUS Status;
|
||||
PMMVAD Vad = NULL;
|
||||
PVOID Address, NextAddress;
|
||||
BOOLEAN Found;
|
||||
BOOLEAN Found = FALSE;
|
||||
ULONG NewProtect, NewState, BaseVpn;
|
||||
MEMORY_BASIC_INFORMATION MemoryInfo;
|
||||
KAPC_STATE ApcState;
|
||||
|
@ -2390,11 +2390,44 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
|||
/* Was a VAD found? */
|
||||
if (!Found)
|
||||
{
|
||||
/* We don't handle this yet */
|
||||
UNIMPLEMENTED;
|
||||
while (TRUE);
|
||||
Address = PAGE_ALIGN(BaseAddress);
|
||||
|
||||
/* Calculate region size */
|
||||
if (Vad)
|
||||
{
|
||||
/* We don't handle this yet */
|
||||
UNIMPLEMENTED;
|
||||
while (TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Maximum possible region size with that base address */
|
||||
MemoryInfo.RegionSize = (PCHAR)MM_HIGHEST_VAD_ADDRESS + 1 - (PCHAR)Address;
|
||||
}
|
||||
|
||||
/* Check if we were attached */
|
||||
if (ProcessHandle != NtCurrentProcess())
|
||||
{
|
||||
/* Detach and derefernece the process */
|
||||
KeUnstackDetachProcess(&ApcState);
|
||||
ObDereferenceObject(TargetProcess);
|
||||
}
|
||||
|
||||
/* Build the rest of the initial information block */
|
||||
MemoryInfo.BaseAddress = Address;
|
||||
MemoryInfo.AllocationBase = NULL;
|
||||
MemoryInfo.AllocationProtect = 0;
|
||||
MemoryInfo.State = MEM_FREE;
|
||||
MemoryInfo.Protect = PAGE_NOACCESS;
|
||||
MemoryInfo.Type = 0;
|
||||
|
||||
/* Return the data (FIXME: Use SEH) */
|
||||
*(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo;
|
||||
if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* This must be a VM VAD */
|
||||
ASSERT(Vad->u.VadFlags.PrivateMemory);
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ co_IntCallHookProc(INT HookId,
|
|||
RtlCopyMemory( &CbtCreatewndExtra->Cs, CbtCreateWnd->lpcs, sizeof(CREATESTRUCTW) );
|
||||
CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
|
||||
Extra = (PCHAR) (CbtCreatewndExtra + 1);
|
||||
CbtCreatewndExtra->Cs.lpszClass = ClassName.Buffer; // if Atom
|
||||
CbtCreatewndExtra->Cs.lpszClass = CbtCreateWnd->lpcs->lpszClass; // if Atom
|
||||
|
||||
if (Ansi)
|
||||
{
|
||||
|
@ -517,7 +517,7 @@ co_IntCallHookProc(INT HookId,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (asWindowName.Buffer)
|
||||
if (WindowName.Buffer)
|
||||
RtlCopyMemory(Extra, WindowName.Buffer, WindowName.Length);
|
||||
CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR) CbtCreatewndExtra);
|
||||
Extra += WindowName.Length;
|
||||
|
@ -526,7 +526,7 @@ co_IntCallHookProc(INT HookId,
|
|||
Extra += sizeof(WCHAR);
|
||||
}
|
||||
|
||||
if (!IS_ATOM(ClassName.Buffer))
|
||||
if (!IS_ATOM(CbtCreateWnd->lpcs->lpszClass))
|
||||
{
|
||||
if (Ansi)
|
||||
{
|
||||
|
|
|
@ -582,7 +582,11 @@ UserCallNextHookEx( PHOOK Hook,
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
Note WH_JOURNALPLAYBACK,
|
||||
"To have the system wait before processing the message, the return value
|
||||
must be the amount of time, in clock ticks, that the system should wait."
|
||||
*/
|
||||
case WH_JOURNALPLAYBACK:
|
||||
case WH_JOURNALRECORD:
|
||||
{
|
||||
|
@ -660,8 +664,6 @@ UserCallNextHookEx( PHOOK Hook,
|
|||
DPRINT1("Unsupported HOOK Id -> %d\n",Hook->HookId);
|
||||
break;
|
||||
}
|
||||
if (Hook->HookId == WH_JOURNALPLAYBACK && lResult == 0)
|
||||
lResult = -1;
|
||||
return lResult;
|
||||
}
|
||||
|
||||
|
@ -873,8 +875,7 @@ co_HOOK_CallHooks( INT HookId,
|
|||
|
||||
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
|
||||
|
||||
pti = GetW32ThreadInfo(); // Need to call this!
|
||||
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
if (!pti || !pti->pDeskInfo)
|
||||
goto Exit; // Must have a desktop running for hooks.
|
||||
|
||||
|
@ -1006,8 +1007,6 @@ co_HOOK_CallHooks( INT HookId,
|
|||
DPRINT("Ret: Global HookId %d Result 0x%x\n", HookId,Result);
|
||||
}
|
||||
Exit:
|
||||
if (HookId == WH_JOURNALPLAYBACK && Result == 0)
|
||||
Result = -1;
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -1179,6 +1178,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
|||
HookId == WH_MOUSE_LL ||
|
||||
HookId == WH_SYSMSGFILTER)
|
||||
{
|
||||
DPRINT1("Local hook installing Global HookId: %d\n",HookId);
|
||||
/* these can only be global */
|
||||
SetLastWin32Error(ERROR_GLOBAL_ONLY_HOOK);
|
||||
RETURN( NULL);
|
||||
|
@ -1197,6 +1197,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
|||
|
||||
if ( pti->rpdesk != ptiCurrent->rpdesk) // gptiCurrent->rpdesk)
|
||||
{
|
||||
DPRINT1("Local hook wrong desktop HookId: %d\n",HookId);
|
||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||
RETURN( NULL);
|
||||
}
|
||||
|
@ -1213,6 +1214,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
|||
HookId == WH_FOREGROUNDIDLE ||
|
||||
HookId == WH_CALLWNDPROCRET) )
|
||||
{
|
||||
DPRINT1("Local hook needs hMod HookId: %d\n",HookId);
|
||||
SetLastWin32Error(ERROR_HOOK_NEEDS_HMOD);
|
||||
RETURN( NULL);
|
||||
}
|
||||
|
@ -1246,6 +1248,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
|||
HookId == WH_FOREGROUNDIDLE ||
|
||||
HookId == WH_CALLWNDPROCRET) )
|
||||
{
|
||||
DPRINT1("Global hook needs hMod HookId: %d\n",HookId);
|
||||
SetLastWin32Error(ERROR_HOOK_NEEDS_HMOD);
|
||||
RETURN( NULL);
|
||||
}
|
||||
|
@ -1377,6 +1380,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
|||
else
|
||||
Hook->offPfn = 0;
|
||||
|
||||
DPRINT1("Installing: HookId %d Global %s\n", HookId, !ThreadId ? "TRUE" : "FALSE");
|
||||
RETURN( Handle);
|
||||
|
||||
CLEANUP:
|
||||
|
|
|
@ -1003,9 +1003,7 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
|
|||
KeSetEvent(Message->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
|
||||
/* Call the callback if the message wa
|
||||
|
||||
s sent with SendMessageCallback */
|
||||
/* Call the callback if the message was sent with SendMessageCallback */
|
||||
if (Message->CompletionCallback != NULL)
|
||||
{
|
||||
co_IntCallSentMessageCallback(Message->CompletionCallback,
|
||||
|
|
Loading…
Reference in a new issue