mirror of
https://github.com/reactos/reactos.git
synced 2024-07-07 13:15:07 +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
|
typedef struct _MANAGER_HANDLE
|
||||||
{
|
{
|
||||||
SCMGR_HANDLE Handle;
|
SCMGR_HANDLE Handle;
|
||||||
|
|
||||||
/* FIXME: Insert more data here */
|
|
||||||
|
|
||||||
WCHAR DatabaseName[1];
|
WCHAR DatabaseName[1];
|
||||||
} MANAGER_HANDLE, *PMANAGER_HANDLE;
|
} MANAGER_HANDLE, *PMANAGER_HANDLE;
|
||||||
|
|
||||||
|
@ -41,11 +38,7 @@ typedef struct _MANAGER_HANDLE
|
||||||
typedef struct _SERVICE_HANDLE
|
typedef struct _SERVICE_HANDLE
|
||||||
{
|
{
|
||||||
SCMGR_HANDLE Handle;
|
SCMGR_HANDLE Handle;
|
||||||
|
|
||||||
PSERVICE ServiceEntry;
|
PSERVICE ServiceEntry;
|
||||||
|
|
||||||
/* FIXME: Insert more data here */
|
|
||||||
|
|
||||||
} SERVICE_HANDLE, *PSERVICE_HANDLE;
|
} SERVICE_HANDLE, *PSERVICE_HANDLE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +142,7 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
|
||||||
if (lpDatabaseName == NULL)
|
if (lpDatabaseName == NULL)
|
||||||
lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
|
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);
|
DPRINT("Database %S, does not exist\n",lpDatabaseName);
|
||||||
return ERROR_DATABASE_DOES_NOT_EXIST;
|
return ERROR_DATABASE_DOES_NOT_EXIST;
|
||||||
|
@ -168,8 +161,6 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
|
||||||
|
|
||||||
Ptr->Handle.Tag = MANAGER_TAG;
|
Ptr->Handle.Tag = MANAGER_TAG;
|
||||||
|
|
||||||
/* FIXME: initialize more data here */
|
|
||||||
|
|
||||||
wcscpy(Ptr->DatabaseName, lpDatabaseName);
|
wcscpy(Ptr->DatabaseName, lpDatabaseName);
|
||||||
|
|
||||||
*Handle = (SC_HANDLE)Ptr;
|
*Handle = (SC_HANDLE)Ptr;
|
||||||
|
@ -192,7 +183,6 @@ ScmCreateServiceHandle(PSERVICE lpServiceEntry,
|
||||||
|
|
||||||
Ptr->Handle.Tag = SERVICE_TAG;
|
Ptr->Handle.Tag = SERVICE_TAG;
|
||||||
|
|
||||||
/* FIXME: initialize more data here */
|
|
||||||
Ptr->ServiceEntry = lpServiceEntry;
|
Ptr->ServiceEntry = lpServiceEntry;
|
||||||
|
|
||||||
*Handle = (SC_HANDLE)Ptr;
|
*Handle = (SC_HANDLE)Ptr;
|
||||||
|
@ -453,9 +443,10 @@ DWORD RCloseServiceHandle(
|
||||||
if (*hSCObject == 0)
|
if (*hSCObject == 0)
|
||||||
return ERROR_INVALID_HANDLE;
|
return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
hManager = (PMANAGER_HANDLE)*hSCObject;
|
hManager = ScmGetServiceManagerFromHandle(*hSCObject);
|
||||||
hService = (PSERVICE_HANDLE)*hSCObject;
|
hService = ScmGetServiceFromHandle(*hSCObject);
|
||||||
if (hManager->Handle.Tag == MANAGER_TAG)
|
|
||||||
|
if (hManager != NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Found manager handle\n");
|
DPRINT("Found manager handle\n");
|
||||||
|
|
||||||
|
@ -467,7 +458,7 @@ DWORD RCloseServiceHandle(
|
||||||
DPRINT("RCloseServiceHandle() done\n");
|
DPRINT("RCloseServiceHandle() done\n");
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
else if (hService->Handle.Tag == SERVICE_TAG)
|
else if (hService != NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Found service handle\n");
|
DPRINT("Found service handle\n");
|
||||||
|
|
||||||
|
@ -561,6 +552,8 @@ DWORD RControlService(
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError = ERROR_SUCCESS;
|
||||||
DWORD pcbBytesNeeded = 0;
|
DWORD pcbBytesNeeded = 0;
|
||||||
DWORD dwServicesReturned = 0;
|
DWORD dwServicesReturned = 0;
|
||||||
|
DWORD dwControlsAccepted;
|
||||||
|
DWORD dwCurrentState;
|
||||||
HKEY hServicesKey = NULL;
|
HKEY hServicesKey = NULL;
|
||||||
|
|
||||||
DPRINT("RControlService() called\n");
|
DPRINT("RControlService() called\n");
|
||||||
|
@ -662,6 +655,49 @@ DWORD RControlService(
|
||||||
}
|
}
|
||||||
else
|
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 */
|
/* Send control code to the service */
|
||||||
dwError = ScmControlService(lpService,
|
dwError = ScmControlService(lpService,
|
||||||
dwControl);
|
dwControl);
|
||||||
|
|
|
@ -169,7 +169,7 @@ SharedPtrToKernel(PVOID Ptr)
|
||||||
static __inline BOOL
|
static __inline BOOL
|
||||||
IsThreadHooked(PCLIENTINFO pci)
|
IsThreadHooked(PCLIENTINFO pci)
|
||||||
{
|
{
|
||||||
return pci->fsHooks != 0;
|
return (pci->fsHooks|pci->pDeskInfo->fsHooks) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline PDESKTOPINFO
|
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_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 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 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_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}};
|
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_
|
STDMETHOD_(NTSTATUS, Init)(THIS_
|
||||||
IN KSPIN_CONNECT *ConnectDetails,
|
IN KSPIN_CONNECT *ConnectDetails,
|
||||||
IN ULONG FrameSize,
|
IN ULONG FrameSize,
|
||||||
IN ULONG Alignment,
|
IN ULONG Alignment) PURE;
|
||||||
IN PVOID SilenceBuffer) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(NTSTATUS, AddMapping)(THIS_
|
STDMETHOD_(NTSTATUS, AddMapping)(THIS_
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
|
@ -363,8 +362,7 @@ DECLARE_INTERFACE_(IIrpQueue, IUnknown)
|
||||||
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
|
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
|
||||||
IN KSPIN_CONNECT *ConnectDetails, \
|
IN KSPIN_CONNECT *ConnectDetails, \
|
||||||
IN ULONG FrameSize, \
|
IN ULONG FrameSize, \
|
||||||
IN ULONG Alignment, \
|
IN ULONG Alignment); \
|
||||||
IN PVOID SilenceBuffer); \
|
|
||||||
\
|
\
|
||||||
STDMETHODIMP_(NTSTATUS) AddMapping(THIS_ \
|
STDMETHODIMP_(NTSTATUS) AddMapping(THIS_ \
|
||||||
IN PIRP Irp, \
|
IN PIRP Irp, \
|
||||||
|
|
|
@ -43,7 +43,6 @@ protected:
|
||||||
LIST_ENTRY m_IrpList;
|
LIST_ENTRY m_IrpList;
|
||||||
LIST_ENTRY m_FreeIrpList;
|
LIST_ENTRY m_FreeIrpList;
|
||||||
PIRP m_Irp;
|
PIRP m_Irp;
|
||||||
PVOID m_SilenceBuffer;
|
|
||||||
|
|
||||||
ULONG m_OutOfMapping;
|
ULONG m_OutOfMapping;
|
||||||
ULONG m_MaxFrameSize;
|
ULONG m_MaxFrameSize;
|
||||||
|
@ -84,12 +83,10 @@ NTAPI
|
||||||
CIrpQueue::Init(
|
CIrpQueue::Init(
|
||||||
IN KSPIN_CONNECT *ConnectDetails,
|
IN KSPIN_CONNECT *ConnectDetails,
|
||||||
IN ULONG FrameSize,
|
IN ULONG FrameSize,
|
||||||
IN ULONG Alignment,
|
IN ULONG Alignment)
|
||||||
IN PVOID SilenceBuffer)
|
|
||||||
{
|
{
|
||||||
m_ConnectDetails = ConnectDetails;
|
m_ConnectDetails = ConnectDetails;
|
||||||
m_MaxFrameSize = FrameSize;
|
m_MaxFrameSize = FrameSize;
|
||||||
m_SilenceBuffer = SilenceBuffer;
|
|
||||||
m_Alignment = Alignment;
|
m_Alignment = Alignment;
|
||||||
|
|
||||||
InitializeListHead(&m_IrpList);
|
InitializeListHead(&m_IrpList);
|
||||||
|
@ -259,22 +256,13 @@ CIrpQueue::GetMapping(
|
||||||
m_CurrentOffset = Offset = 0;
|
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)
|
if (!Irp)
|
||||||
{
|
{
|
||||||
// no irp buffer available
|
// no irp buffer available
|
||||||
|
DPRINT("NoIrp\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get stream header
|
// get stream header
|
||||||
StreamHeader = (PKSSTREAM_HEADER)Irp->Tail.Overlay.DriverContext[2];
|
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))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IrpQueue_Init failed with %x\n", Status);
|
DPRINT("IrpQueue_Init failed with %x\n", Status);
|
||||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
||||||
ULONG m_StopCount;
|
ULONG m_StopCount;
|
||||||
KSAUDIO_POSITION m_Position;
|
KSAUDIO_POSITION m_Position;
|
||||||
KSALLOCATOR_FRAMING m_AllocatorFraming;
|
KSALLOCATOR_FRAMING m_AllocatorFraming;
|
||||||
SUBDEVICE_DESCRIPTOR m_Descriptor;
|
PSUBDEVICE_DESCRIPTOR m_Descriptor;
|
||||||
|
|
||||||
KSPIN_LOCK m_EventListLock;
|
KSPIN_LOCK m_EventListLock;
|
||||||
LIST_ENTRY m_EventList;
|
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 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 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 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_CONNECTIONSET(PinWaveCyclicConnectionSet, PinWaveCyclicState, PinWaveCyclicDataFormat, PinWaveCyclicAllocatorFraming);
|
||||||
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition);
|
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition);
|
||||||
|
DEFINE_KSPROPERTY_DRMSET(PinWaveCyclicDRMSet, PinWaveCyclicDRMHandler);
|
||||||
|
|
||||||
KSEVENT_ITEM PinWaveCyclicConnectionEventSet =
|
KSEVENT_ITEM PinWaveCyclicConnectionEventSet =
|
||||||
{
|
{
|
||||||
|
@ -146,6 +148,13 @@ KSPROPERTY_SET PinWaveCyclicPropertySet[] =
|
||||||
(const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
|
(const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
|
||||||
0,
|
0,
|
||||||
NULL
|
NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
&KSPROPSETID_DrmAudioStream,
|
||||||
|
sizeof(PinWaveCyclicDRMSet) / sizeof(KSPROPERTY_ITEM),
|
||||||
|
(const KSPROPERTY_ITEM*)&PinWaveCyclicDRMSet,
|
||||||
|
0,
|
||||||
|
NULL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -192,6 +201,19 @@ CPortPinWaveCyclic::QueryInterface(
|
||||||
return STATUS_UNSUCCESSFUL;
|
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
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PinWaveCyclicAddEndOfStreamEvent(
|
PinWaveCyclicAddEndOfStreamEvent(
|
||||||
|
@ -448,12 +470,14 @@ PinWaveCyclicState(
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
// complete with successful state
|
// complete with successful state
|
||||||
|
Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
|
||||||
Pin->m_IrpQueue->CancelBuffers();
|
Pin->m_IrpQueue->CancelBuffers();
|
||||||
Pin->m_Position.PlayOffset = 0;
|
Pin->m_Position.PlayOffset = 0;
|
||||||
Pin->m_Position.WriteOffset = 0;
|
Pin->m_Position.WriteOffset = 0;
|
||||||
}
|
}
|
||||||
else if (Pin->m_State == KSSTATE_STOP)
|
else if (Pin->m_State == KSSTATE_STOP)
|
||||||
{
|
{
|
||||||
|
Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
|
||||||
Pin->m_IrpQueue->CancelBuffers();
|
Pin->m_IrpQueue->CancelBuffers();
|
||||||
Pin->m_Position.PlayOffset = 0;
|
Pin->m_Position.PlayOffset = 0;
|
||||||
Pin->m_Position.WriteOffset = 0;
|
Pin->m_Position.WriteOffset = 0;
|
||||||
|
@ -662,6 +686,7 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
||||||
ULONG BufferLength;
|
ULONG BufferLength;
|
||||||
ULONG BytesToCopy;
|
ULONG BytesToCopy;
|
||||||
ULONG BufferSize;
|
ULONG BufferSize;
|
||||||
|
ULONG Gap;
|
||||||
PUCHAR Buffer;
|
PUCHAR Buffer;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
@ -672,7 +697,18 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
||||||
{
|
{
|
||||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
||||||
if (!NT_SUCCESS(Status))
|
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);
|
BytesToCopy = min(BufferLength, BufferSize);
|
||||||
|
|
||||||
|
@ -688,7 +724,7 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
||||||
m_IrpQueue->UpdateMapping(BytesToCopy);
|
m_IrpQueue->UpdateMapping(BytesToCopy);
|
||||||
m_CommonBufferOffset += BytesToCopy;
|
m_CommonBufferOffset += BytesToCopy;
|
||||||
|
|
||||||
BufferLength = Position - m_CommonBufferOffset;
|
BufferLength -= BytesToCopy;
|
||||||
m_Position.PlayOffset += BytesToCopy;
|
m_Position.PlayOffset += BytesToCopy;
|
||||||
|
|
||||||
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
||||||
|
@ -720,7 +756,18 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
||||||
{
|
{
|
||||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
||||||
if (!NT_SUCCESS(Status))
|
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);
|
BytesToCopy = min(BufferLength, BufferSize);
|
||||||
|
|
||||||
|
@ -741,7 +788,7 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
||||||
m_CommonBufferOffset += BytesToCopy;
|
m_CommonBufferOffset += BytesToCopy;
|
||||||
m_Position.PlayOffset += BytesToCopy;
|
m_Position.PlayOffset += BytesToCopy;
|
||||||
|
|
||||||
BufferLength = m_CommonBufferSize - m_CommonBufferOffset;
|
BufferLength -=BytesToCopy;
|
||||||
|
|
||||||
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
||||||
{
|
{
|
||||||
|
@ -751,7 +798,6 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
||||||
m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
|
m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gap == Length)
|
if (Gap == Length)
|
||||||
|
@ -773,22 +819,13 @@ CPortPinWaveCyclic::RequestService()
|
||||||
{
|
{
|
||||||
ULONG Position;
|
ULONG Position;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PUCHAR Buffer;
|
|
||||||
ULONG BufferSize;
|
|
||||||
ULONGLONG OldOffset, NewOffset;
|
ULONGLONG OldOffset, NewOffset;
|
||||||
|
|
||||||
PC_ASSERT_IRQL(DISPATCH_LEVEL);
|
PC_ASSERT_IRQL(DISPATCH_LEVEL);
|
||||||
|
|
||||||
if (m_State == KSSTATE_RUN)
|
if (m_State == KSSTATE_RUN)
|
||||||
{
|
{
|
||||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = m_Stream->GetPosition(&Position);
|
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;
|
OldOffset = m_Position.PlayOffset;
|
||||||
|
|
||||||
|
@ -841,7 +878,7 @@ CPortPinWaveCyclic::DeviceIoControl(
|
||||||
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
|
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
|
||||||
{
|
{
|
||||||
/* handle property with subdevice descriptor */
|
/* 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)
|
if (Status == STATUS_NOT_FOUND)
|
||||||
{
|
{
|
||||||
|
@ -854,11 +891,11 @@ CPortPinWaveCyclic::DeviceIoControl(
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT)
|
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)
|
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)
|
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
|
||||||
{
|
{
|
||||||
|
@ -1120,7 +1157,6 @@ CPortPinWaveCyclic::Init(
|
||||||
PKSDATAFORMAT DataFormat;
|
PKSDATAFORMAT DataFormat;
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
BOOLEAN Capture;
|
BOOLEAN Capture;
|
||||||
PVOID SilenceBuffer;
|
|
||||||
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
|
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
|
||||||
//IDrmAudioStream * DrmAudio = NULL;
|
//IDrmAudioStream * DrmAudio = NULL;
|
||||||
|
|
||||||
|
@ -1179,7 +1215,6 @@ CPortPinWaveCyclic::Init(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DPRINT1("CPortPinWaveCyclic::Init Status %x PinId %u Capture %u\n", Status, ConnectDetails->PinId, Capture);
|
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))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1203,18 +1238,26 @@ CPortPinWaveCyclic::Init(
|
||||||
InitializeListHead(&m_EventList);
|
InitializeListHead(&m_EventList);
|
||||||
KeInitializeSpinLock(&m_EventListLock);
|
KeInitializeSpinLock(&m_EventListLock);
|
||||||
|
|
||||||
/* set up subdevice descriptor */
|
Status = PcCreateSubdeviceDescriptor(&m_Descriptor,
|
||||||
RtlZeroMemory(&m_Descriptor, sizeof(SUBDEVICE_DESCRIPTOR));
|
SubDeviceDescriptor->InterfaceCount,
|
||||||
m_Descriptor.FilterPropertySet = PinWaveCyclicPropertySet;
|
SubDeviceDescriptor->Interfaces,
|
||||||
m_Descriptor.FilterPropertySetCount = sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET);
|
0, /* FIXME KSINTERFACE_STANDARD with KSINTERFACE_STANDARD_STREAMING / KSINTERFACE_STANDARD_LOOPED_STREAMING */
|
||||||
m_Descriptor.UnknownStream = (PUNKNOWN)m_Stream;
|
NULL,
|
||||||
m_Descriptor.DeviceDescriptor = SubDeviceDescriptor->DeviceDescriptor;
|
sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET),
|
||||||
m_Descriptor.UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
|
PinWaveCyclicPropertySet,
|
||||||
m_Descriptor.PortPin = (PVOID)this;
|
0,
|
||||||
m_Descriptor.EventSetCount = sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET);
|
0,
|
||||||
m_Descriptor.EventSet = PinWaveCyclicEventSet;
|
0,
|
||||||
m_Descriptor.EventList = &m_EventList;
|
NULL,
|
||||||
m_Descriptor.EventListLock = &m_EventListLock;
|
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
|
// initialize reset state
|
||||||
m_ResetState = KSRESET_END;
|
m_ResetState = KSRESET_END;
|
||||||
|
@ -1247,9 +1290,7 @@ CPortPinWaveCyclic::Init(
|
||||||
PC_ASSERT(NT_SUCCESS(Status));
|
PC_ASSERT(NT_SUCCESS(Status));
|
||||||
PC_ASSERT(m_FrameSize);
|
PC_ASSERT(m_FrameSize);
|
||||||
|
|
||||||
SilenceBuffer = AllocateItem(NonPagedPool, m_FrameSize, TAG_PORTCLASS);
|
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);
|
||||||
if (!SilenceBuffer)
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
|
|
||||||
|
|
||||||
/* set up allocator framing */
|
/* set up allocator framing */
|
||||||
|
@ -1260,10 +1301,9 @@ CPortPinWaveCyclic::Init(
|
||||||
m_AllocatorFraming.Reserved = 0;
|
m_AllocatorFraming.Reserved = 0;
|
||||||
m_AllocatorFraming.FrameSize = m_FrameSize;
|
m_AllocatorFraming.FrameSize = m_FrameSize;
|
||||||
|
|
||||||
m_Stream->Silence(SilenceBuffer, m_FrameSize);
|
|
||||||
m_Stream->Silence(m_CommonBuffer, m_CommonBufferSize);
|
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))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
m_IrpQueue->Release();
|
m_IrpQueue->Release();
|
||||||
|
@ -1282,9 +1322,6 @@ CPortPinWaveCyclic::Init(
|
||||||
m_Port = Port;
|
m_Port = Port;
|
||||||
m_Filter = Filter;
|
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;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -919,7 +919,7 @@ CPortPinWavePci::Init(
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize irp queue
|
// 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))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
// this should never happen
|
// this should never happen
|
||||||
|
|
|
@ -587,7 +587,7 @@ CPortPinWaveRT::Init(
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL);
|
Status = m_IrpQueue->Init(ConnectDetails, 0, 0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
|
@ -356,6 +356,22 @@ DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
||||||
DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\
|
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,\
|
#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\
|
||||||
PropGeneral, PropInstances, PropIntersection)\
|
PropGeneral, PropInstances, PropIntersection)\
|
||||||
DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
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)
|
if (!HalpGetInfoFromACPI)
|
||||||
{
|
{
|
||||||
/* No, so use our local table */
|
/* No, so use our local table */
|
||||||
Port = HalpComPortIrqMapping[0][0];
|
for (i = 0, Port = HalpComPortIrqMapping[i][0];
|
||||||
for (i = 0; Port; i++)
|
Port;
|
||||||
|
i++, Port = HalpComPortIrqMapping[i][0])
|
||||||
{
|
{
|
||||||
/* Is this the port we want? */
|
/* Is this the port we want? */
|
||||||
if (Port == (ULONG_PTR)KdComPortInUse)
|
if (Port == (ULONG_PTR)KdComPortInUse)
|
||||||
|
@ -248,9 +249,6 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
PRIMARY_VECTOR_BASE,
|
PRIMARY_VECTOR_BASE,
|
||||||
HIGH_LEVEL);
|
HIGH_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next port */
|
|
||||||
Port = HalpComPortIrqMapping[i][0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -509,6 +507,9 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
|
||||||
IN PVOID Handler,
|
IN PVOID Handler,
|
||||||
IN KINTERRUPT_MODE Mode)
|
IN KINTERRUPT_MODE Mode)
|
||||||
{
|
{
|
||||||
|
/* Set the IDT_LATCHED flag for latched interrupts */
|
||||||
|
if (Mode == Latched) Flags |= IDT_LATCHED;
|
||||||
|
|
||||||
/* Register the vector */
|
/* Register the vector */
|
||||||
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
|
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
|
||||||
|
|
||||||
|
|
|
@ -1005,11 +1005,6 @@ DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_Genera
|
||||||
KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY
|
KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KSPROPSETID_DrmAudioStream
|
|
||||||
/*
|
|
||||||
KSPROPERTY_DRMAUDIOSTREAM_CONTENTID
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define KSPROPSETID_Hrtf3d
|
#define KSPROPSETID_Hrtf3d
|
||||||
/*
|
/*
|
||||||
KSPROPERTY_HRTF3D_FILTER_FORMAT
|
KSPROPERTY_HRTF3D_FILTER_FORMAT
|
||||||
|
|
|
@ -565,6 +565,15 @@ typedef struct {
|
||||||
#endif // !_NTDDK_
|
#endif // !_NTDDK_
|
||||||
} LOOPEDSTREAMING_POSITION_EVENT_DATA, *PLOOPEDSTREAMING_POSITION_EVENT_DATA ;
|
} 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
|
SysAudio Properties
|
||||||
|
|
|
@ -514,6 +514,21 @@ IopAssignDeviceResources(
|
||||||
IN PDEVICE_NODE DeviceNode
|
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
|
// PNP Routines
|
||||||
//
|
//
|
||||||
|
|
|
@ -841,7 +841,7 @@ IoGetConfigurationInformation(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @halfplemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
||||||
|
@ -876,13 +876,48 @@ IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
||||||
* a conflict is detected with another driver.
|
* a conflict is detected with another driver.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
*ConflictDetected = FALSE;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
return STATUS_SUCCESS;
|
|
||||||
|
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
|
NTSTATUS NTAPI
|
||||||
IoAssignResources(PUNICODE_STRING RegistryPath,
|
IoAssignResources(PUNICODE_STRING RegistryPath,
|
||||||
|
@ -892,8 +927,23 @@ IoAssignResources(PUNICODE_STRING RegistryPath,
|
||||||
PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
|
PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
|
||||||
PCM_RESOURCE_LIST* AllocatedResources)
|
PCM_RESOURCE_LIST* AllocatedResources)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
return(STATUS_NOT_IMPLEMENTED);
|
|
||||||
|
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,
|
IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
|
||||||
PVOID Context);
|
PVOID Context);
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
IopDetectResourceConflict(IN PCM_RESOURCE_LIST ResourceList);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
PpSetCustomTargetEvent(IN PDEVICE_OBJECT DeviceObject,
|
PpSetCustomTargetEvent(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN OUT PKEVENT SyncEvent OPTIONAL,
|
IN OUT PKEVENT SyncEvent OPTIONAL,
|
||||||
|
@ -379,7 +376,7 @@ IoReportResourceForDetection(IN PDRIVER_OBJECT DriverObject,
|
||||||
ResourceList = DriverList;
|
ResourceList = DriverList;
|
||||||
|
|
||||||
/* Look for a resource conflict */
|
/* Look for a resource conflict */
|
||||||
Status = IopDetectResourceConflict(ResourceList);
|
Status = IopDetectResourceConflict(ResourceList, FALSE, NULL);
|
||||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||||
{
|
{
|
||||||
/* Oh noes */
|
/* Oh noes */
|
||||||
|
|
|
@ -12,12 +12,6 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
IopDetectResourceConflict(
|
|
||||||
IN PCM_RESOURCE_LIST ResourceList,
|
|
||||||
IN BOOLEAN Silent,
|
|
||||||
OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor);
|
|
||||||
|
|
||||||
static
|
static
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IopCheckDescriptorForConflict(PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor)
|
IopCheckDescriptorForConflict(PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor)
|
||||||
|
@ -187,8 +181,8 @@ IopFindInterruptResource(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
NTSTATUS
|
NTSTATUS NTAPI
|
||||||
IopCreateResourceListFromRequirements(
|
IopCreateResourceListFromRequirements(
|
||||||
IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList,
|
IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList,
|
||||||
OUT PCM_RESOURCE_LIST *ResourceList)
|
OUT PCM_RESOURCE_LIST *ResourceList)
|
||||||
|
@ -336,9 +330,6 @@ IopCheckResourceDescriptor(
|
||||||
ULONG i, ii;
|
ULONG i, ii;
|
||||||
BOOLEAN Result = FALSE;
|
BOOLEAN Result = FALSE;
|
||||||
|
|
||||||
if (ResDesc->ShareDisposition == CmResourceShareShared)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
for (i = 0; i < ResourceList->Count; i++)
|
for (i = 0; i < ResourceList->Count; i++)
|
||||||
{
|
{
|
||||||
PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList->List[i].PartialResourceList;
|
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)
|
if (DeviceNode->ResourceList)
|
||||||
{
|
{
|
||||||
PWCHAR DeviceName = NULL;
|
|
||||||
UNICODE_STRING NameU;
|
UNICODE_STRING NameU;
|
||||||
UNICODE_STRING Suffix;
|
UNICODE_STRING RawSuffix, TranslatedSuffix;
|
||||||
ULONG OldLength = 0;
|
ULONG OldLength = 0;
|
||||||
|
|
||||||
ASSERT(DeviceNode->ResourceListTranslated);
|
ASSERT(DeviceNode->ResourceListTranslated);
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&TranslatedSuffix, L".Translated");
|
||||||
|
RtlInitUnicodeString(&RawSuffix, L".Raw");
|
||||||
|
|
||||||
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
||||||
DevicePropertyPhysicalDeviceObjectName,
|
DevicePropertyPhysicalDeviceObjectName,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
&OldLength);
|
&OldLength);
|
||||||
if ((OldLength != 0) && (Status == STATUS_BUFFER_TOO_SMALL))
|
if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
DeviceName = ExAllocatePool(NonPagedPool, OldLength);
|
ASSERT(OldLength);
|
||||||
ASSERT(DeviceName);
|
|
||||||
|
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,
|
RtlAppendUnicodeStringToString(&NameU, &RawSuffix);
|
||||||
DevicePropertyPhysicalDeviceObjectName,
|
|
||||||
OldLength,
|
|
||||||
DeviceName,
|
|
||||||
&OldLength);
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&NameU, DeviceName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Some failure */
|
|
||||||
ASSERT(!NT_SUCCESS(Status));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&Suffix, L".Raw");
|
|
||||||
RtlAppendUnicodeStringToString(&NameU, &Suffix);
|
|
||||||
|
|
||||||
Status = ZwSetValueKey(PnpMgrLevel2,
|
Status = ZwSetValueKey(PnpMgrLevel2,
|
||||||
&NameU,
|
&NameU,
|
||||||
|
@ -659,14 +671,14 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ZwClose(PnpMgrLevel2);
|
ZwClose(PnpMgrLevel2);
|
||||||
|
ExFreePool(NameU.Buffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "Remove" the suffix by setting the length back to what it used to be */
|
/* "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, &TranslatedSuffix);
|
||||||
RtlAppendUnicodeStringToString(&NameU, &Suffix);
|
|
||||||
|
|
||||||
Status = ZwSetValueKey(PnpMgrLevel2,
|
Status = ZwSetValueKey(PnpMgrLevel2,
|
||||||
&NameU,
|
&NameU,
|
||||||
|
@ -675,8 +687,8 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
||||||
DeviceNode->ResourceListTranslated,
|
DeviceNode->ResourceListTranslated,
|
||||||
PnpDetermineResourceListSize(DeviceNode->ResourceListTranslated));
|
PnpDetermineResourceListSize(DeviceNode->ResourceListTranslated));
|
||||||
ZwClose(PnpMgrLevel2);
|
ZwClose(PnpMgrLevel2);
|
||||||
ASSERT(DeviceName);
|
ExFreePool(NameU.Buffer);
|
||||||
ExFreePool(DeviceName);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +730,7 @@ IopTranslateDeviceResources(
|
||||||
DeviceNode->ResourceListTranslated = ExAllocatePool(PagedPool, ListSize);
|
DeviceNode->ResourceListTranslated = ExAllocatePool(PagedPool, ListSize);
|
||||||
if (!DeviceNode->ResourceListTranslated)
|
if (!DeviceNode->ResourceListTranslated)
|
||||||
{
|
{
|
||||||
Status =STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
RtlCopyMemory(DeviceNode->ResourceListTranslated, DeviceNode->ResourceList, ListSize);
|
RtlCopyMemory(DeviceNode->ResourceListTranslated, DeviceNode->ResourceList, ListSize);
|
||||||
|
@ -743,6 +755,7 @@ IopTranslateDeviceResources(
|
||||||
&DescriptorTranslated->u.Port.Start))
|
&DescriptorTranslated->u.Port.Start))
|
||||||
{
|
{
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
DPRINT1("Failed to translate port resource (Start: 0xI64x)\n", DescriptorRaw->u.Port.Start.QuadPart);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -756,6 +769,14 @@ IopTranslateDeviceResources(
|
||||||
DescriptorRaw->u.Interrupt.Vector,
|
DescriptorRaw->u.Interrupt.Vector,
|
||||||
(PKIRQL)&DescriptorTranslated->u.Interrupt.Level,
|
(PKIRQL)&DescriptorTranslated->u.Interrupt.Level,
|
||||||
&DescriptorTranslated->u.Interrupt.Affinity);
|
&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;
|
break;
|
||||||
}
|
}
|
||||||
case CmResourceTypeMemory:
|
case CmResourceTypeMemory:
|
||||||
|
@ -769,6 +790,7 @@ IopTranslateDeviceResources(
|
||||||
&DescriptorTranslated->u.Memory.Start))
|
&DescriptorTranslated->u.Memory.Start))
|
||||||
{
|
{
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
DPRINT1("Failed to translate memory resource (Start: 0xI64x)\n", DescriptorRaw->u.Memory.Start.QuadPart);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -864,16 +886,21 @@ IopAssignDeviceResources(
|
||||||
Status = IopCreateResourceListFromRequirements(DeviceNode->ResourceRequirements,
|
Status = IopCreateResourceListFromRequirements(DeviceNode->ResourceRequirements,
|
||||||
&DeviceNode->ResourceList);
|
&DeviceNode->ResourceList);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create a resource list from supplied resources for %wZ\n", &DeviceNode->InstancePath);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
}
|
||||||
|
|
||||||
Status = IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL);
|
/* IopCreateResourceListFromRequirements should NEVER succeed with a conflicting list */
|
||||||
if (!NT_SUCCESS(Status))
|
ASSERT(IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL) != STATUS_CONFLICTING_ADDRESSES);
|
||||||
goto ByeBye;
|
|
||||||
|
|
||||||
Finish:
|
Finish:
|
||||||
Status = IopTranslateDeviceResources(DeviceNode);
|
Status = IopTranslateDeviceResources(DeviceNode);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to translate resources for %wZ\n", &DeviceNode->InstancePath);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
}
|
||||||
|
|
||||||
Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
|
Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -935,7 +962,7 @@ ByeBye:
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS NTAPI
|
||||||
IopDetectResourceConflict(
|
IopDetectResourceConflict(
|
||||||
IN PCM_RESOURCE_LIST ResourceList,
|
IN PCM_RESOURCE_LIST ResourceList,
|
||||||
IN BOOLEAN Silent,
|
IN BOOLEAN Silent,
|
||||||
|
|
|
@ -2306,7 +2306,7 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PMMVAD Vad = NULL;
|
PMMVAD Vad = NULL;
|
||||||
PVOID Address, NextAddress;
|
PVOID Address, NextAddress;
|
||||||
BOOLEAN Found;
|
BOOLEAN Found = FALSE;
|
||||||
ULONG NewProtect, NewState, BaseVpn;
|
ULONG NewProtect, NewState, BaseVpn;
|
||||||
MEMORY_BASIC_INFORMATION MemoryInfo;
|
MEMORY_BASIC_INFORMATION MemoryInfo;
|
||||||
KAPC_STATE ApcState;
|
KAPC_STATE ApcState;
|
||||||
|
@ -2390,11 +2390,44 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
/* Was a VAD found? */
|
/* Was a VAD found? */
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
/* We don't handle this yet */
|
Address = PAGE_ALIGN(BaseAddress);
|
||||||
UNIMPLEMENTED;
|
|
||||||
while (TRUE);
|
/* 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 */
|
/* This must be a VM VAD */
|
||||||
ASSERT(Vad->u.VadFlags.PrivateMemory);
|
ASSERT(Vad->u.VadFlags.PrivateMemory);
|
||||||
|
|
||||||
|
|
|
@ -503,7 +503,7 @@ co_IntCallHookProc(INT HookId,
|
||||||
RtlCopyMemory( &CbtCreatewndExtra->Cs, CbtCreateWnd->lpcs, sizeof(CREATESTRUCTW) );
|
RtlCopyMemory( &CbtCreatewndExtra->Cs, CbtCreateWnd->lpcs, sizeof(CREATESTRUCTW) );
|
||||||
CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
|
CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
|
||||||
Extra = (PCHAR) (CbtCreatewndExtra + 1);
|
Extra = (PCHAR) (CbtCreatewndExtra + 1);
|
||||||
CbtCreatewndExtra->Cs.lpszClass = ClassName.Buffer; // if Atom
|
CbtCreatewndExtra->Cs.lpszClass = CbtCreateWnd->lpcs->lpszClass; // if Atom
|
||||||
|
|
||||||
if (Ansi)
|
if (Ansi)
|
||||||
{
|
{
|
||||||
|
@ -517,7 +517,7 @@ co_IntCallHookProc(INT HookId,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (asWindowName.Buffer)
|
if (WindowName.Buffer)
|
||||||
RtlCopyMemory(Extra, WindowName.Buffer, WindowName.Length);
|
RtlCopyMemory(Extra, WindowName.Buffer, WindowName.Length);
|
||||||
CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR) CbtCreatewndExtra);
|
CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR) CbtCreatewndExtra);
|
||||||
Extra += WindowName.Length;
|
Extra += WindowName.Length;
|
||||||
|
@ -526,7 +526,7 @@ co_IntCallHookProc(INT HookId,
|
||||||
Extra += sizeof(WCHAR);
|
Extra += sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_ATOM(ClassName.Buffer))
|
if (!IS_ATOM(CbtCreateWnd->lpcs->lpszClass))
|
||||||
{
|
{
|
||||||
if (Ansi)
|
if (Ansi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -582,7 +582,11 @@ UserCallNextHookEx( PHOOK Hook,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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_JOURNALPLAYBACK:
|
||||||
case WH_JOURNALRECORD:
|
case WH_JOURNALRECORD:
|
||||||
{
|
{
|
||||||
|
@ -660,8 +664,6 @@ UserCallNextHookEx( PHOOK Hook,
|
||||||
DPRINT1("Unsupported HOOK Id -> %d\n",Hook->HookId);
|
DPRINT1("Unsupported HOOK Id -> %d\n",Hook->HookId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Hook->HookId == WH_JOURNALPLAYBACK && lResult == 0)
|
|
||||||
lResult = -1;
|
|
||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,8 +875,7 @@ co_HOOK_CallHooks( INT HookId,
|
||||||
|
|
||||||
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
|
ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
|
||||||
|
|
||||||
pti = GetW32ThreadInfo(); // Need to call this!
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if (!pti || !pti->pDeskInfo)
|
if (!pti || !pti->pDeskInfo)
|
||||||
goto Exit; // Must have a desktop running for hooks.
|
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);
|
DPRINT("Ret: Global HookId %d Result 0x%x\n", HookId,Result);
|
||||||
}
|
}
|
||||||
Exit:
|
Exit:
|
||||||
if (HookId == WH_JOURNALPLAYBACK && Result == 0)
|
|
||||||
Result = -1;
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1179,6 +1178,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
||||||
HookId == WH_MOUSE_LL ||
|
HookId == WH_MOUSE_LL ||
|
||||||
HookId == WH_SYSMSGFILTER)
|
HookId == WH_SYSMSGFILTER)
|
||||||
{
|
{
|
||||||
|
DPRINT1("Local hook installing Global HookId: %d\n",HookId);
|
||||||
/* these can only be global */
|
/* these can only be global */
|
||||||
SetLastWin32Error(ERROR_GLOBAL_ONLY_HOOK);
|
SetLastWin32Error(ERROR_GLOBAL_ONLY_HOOK);
|
||||||
RETURN( NULL);
|
RETURN( NULL);
|
||||||
|
@ -1197,6 +1197,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
||||||
|
|
||||||
if ( pti->rpdesk != ptiCurrent->rpdesk) // gptiCurrent->rpdesk)
|
if ( pti->rpdesk != ptiCurrent->rpdesk) // gptiCurrent->rpdesk)
|
||||||
{
|
{
|
||||||
|
DPRINT1("Local hook wrong desktop HookId: %d\n",HookId);
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
RETURN( NULL);
|
RETURN( NULL);
|
||||||
}
|
}
|
||||||
|
@ -1213,6 +1214,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
||||||
HookId == WH_FOREGROUNDIDLE ||
|
HookId == WH_FOREGROUNDIDLE ||
|
||||||
HookId == WH_CALLWNDPROCRET) )
|
HookId == WH_CALLWNDPROCRET) )
|
||||||
{
|
{
|
||||||
|
DPRINT1("Local hook needs hMod HookId: %d\n",HookId);
|
||||||
SetLastWin32Error(ERROR_HOOK_NEEDS_HMOD);
|
SetLastWin32Error(ERROR_HOOK_NEEDS_HMOD);
|
||||||
RETURN( NULL);
|
RETURN( NULL);
|
||||||
}
|
}
|
||||||
|
@ -1246,6 +1248,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
||||||
HookId == WH_FOREGROUNDIDLE ||
|
HookId == WH_FOREGROUNDIDLE ||
|
||||||
HookId == WH_CALLWNDPROCRET) )
|
HookId == WH_CALLWNDPROCRET) )
|
||||||
{
|
{
|
||||||
|
DPRINT1("Global hook needs hMod HookId: %d\n",HookId);
|
||||||
SetLastWin32Error(ERROR_HOOK_NEEDS_HMOD);
|
SetLastWin32Error(ERROR_HOOK_NEEDS_HMOD);
|
||||||
RETURN( NULL);
|
RETURN( NULL);
|
||||||
}
|
}
|
||||||
|
@ -1377,6 +1380,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
|
||||||
else
|
else
|
||||||
Hook->offPfn = 0;
|
Hook->offPfn = 0;
|
||||||
|
|
||||||
|
DPRINT1("Installing: HookId %d Global %s\n", HookId, !ThreadId ? "TRUE" : "FALSE");
|
||||||
RETURN( Handle);
|
RETURN( Handle);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
|
|
|
@ -1003,9 +1003,7 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
|
||||||
KeSetEvent(Message->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(Message->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the callback if the message wa
|
/* Call the callback if the message was sent with SendMessageCallback */
|
||||||
|
|
||||||
s sent with SendMessageCallback */
|
|
||||||
if (Message->CompletionCallback != NULL)
|
if (Message->CompletionCallback != NULL)
|
||||||
{
|
{
|
||||||
co_IntCallSentMessageCallback(Message->CompletionCallback,
|
co_IntCallSentMessageCallback(Message->CompletionCallback,
|
||||||
|
|
Loading…
Reference in a new issue