ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2013
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
10 participants
327 discussions
Start a n
N
ew thread
[ion] 59772: [CPORTLIB/KDBG/FREELDR]: Fix CpGetByte and its callers -- it takes a 4th parameter for polling. [NTOSKRNL]: Implement InbvPortPollOnly and InbvPortGetByte. [NTOSKRNL]: Implement Headle...
by ion@svn.reactos.org
Author: ion Date: Sun Aug 18 17:47:19 2013 New Revision: 59772 URL:
http://svn.reactos.org/svn/reactos?rev=59772&view=rev
Log: [CPORTLIB/KDBG/FREELDR]: Fix CpGetByte and its callers -- it takes a 4th parameter for polling. [NTOSKRNL]: Implement InbvPortPollOnly and InbvPortGetByte. [NTOSKRNL]: Implement HeadlessCmdClearDisplay and HeadlessCmdGetByte. [SACDRV]: Implement the TimerDpcRoutine which calls HeadlessCmdGetByte. We now consume characters in the EMS port. [SACDRV]: Implement ConMgrSerialPortConsumer. We now do full VT-100 input parsing. DEL, BS, TAB, SPACE all work. Pressing ENTER results in an ASSERT in ConMgrProcessLine as expected. Modified: trunk/reactos/boot/freeldr/freeldr/comm/rs232.c trunk/reactos/boot/freeldr/freeldr/windows/headless.c trunk/reactos/drivers/sac/driver/conmgr.c trunk/reactos/drivers/sac/driver/data.c trunk/reactos/drivers/sac/driver/dispatch.c trunk/reactos/drivers/sac/driver/sacdrv.h trunk/reactos/drivers/sac/driver/util.c trunk/reactos/include/reactos/libs/cportlib/cportlib.h trunk/reactos/lib/cportlib/cport.c trunk/reactos/ntoskrnl/ex/hdlsterm.c trunk/reactos/ntoskrnl/inbv/inbvport.c trunk/reactos/ntoskrnl/include/internal/hdl.h trunk/reactos/ntoskrnl/include/internal/inbv.h trunk/reactos/ntoskrnl/kd/i386/kdbg.c Modified: trunk/reactos/boot/freeldr/freeldr/comm/rs232.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/comm/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/comm/rs232.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/comm/rs232.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -100,7 +100,7 @@ if (PortInitialized == FALSE) return FALSE; - return (CpGetByte(&Rs232ComPort, ByteReceived, TRUE) == CP_GET_SUCCESS); + return (CpGetByte(&Rs232ComPort, ByteReceived, TRUE, FALSE) == CP_GET_SUCCESS); } /* Modified: trunk/reactos/boot/freeldr/freeldr/windows/headless.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/headless.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/headless.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -143,7 +143,7 @@ WinLdrPortGetByte(IN ULONG PortId, OUT PUCHAR Data) { - return CpGetByte(&Port[PortId], Data, TRUE) == CP_GET_SUCCESS; + return CpGetByte(&Port[PortId], Data, TRUE, FALSE) == CP_GET_SUCCESS; } BOOLEAN @@ -151,7 +151,7 @@ { UCHAR Dummy; - return CpGetByte(&Port[PortId], &Dummy, FALSE) == CP_GET_SUCCESS; + return CpGetByte(&Port[PortId], &Dummy, FALSE, TRUE) == CP_GET_SUCCESS; } VOID Modified: trunk/reactos/drivers/sac/driver/conmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/conmgr.…
============================================================================== --- trunk/reactos/drivers/sac/driver/conmgr.c [iso-8859-1] (original) +++ trunk/reactos/drivers/sac/driver/conmgr.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -27,76 +27,10 @@ ULONG ExecutePostConsumerCommand; PSAC_CHANNEL ExecutePostConsumerCommandData; +BOOLEAN InputInEscape, InputInEscTab, ConMgrLastCharWasCR; +CHAR InputBuffer[80]; + /* FUNCTIONS *****************************************************************/ - -VOID -NTAPI -ConMgrSerialPortConsumer(VOID) -{ - NTSTATUS Status; - CHAR Char; - SAC_DBG(0x2000, "SAC TimerDpcRoutine: Entering.\n"); //bug - - /* Acquire the manager lock and make sure a channel is selected */ - SacAcquireMutexLock(); - ASSERT(CurrentChannel); - - /* Read whatever came off the serial port */ - for (Status = SerialBufferGetChar(&Char); - NT_SUCCESS(Status); - Status = SerialBufferGetChar(&Char)) - { - /* If nothing came through, bail out */ - if (Status == STATUS_NO_DATA_DETECTED) break; - } - - /* We're done, release the lock */ - SacReleaseMutexLock(); - SAC_DBG(0x2000, "SAC TimerDpcRoutine: Exiting.\n"); //bug -} - -VOID -NTAPI -ConMgrWorkerProcessEvents(IN PSAC_DEVICE_EXTENSION DeviceExtension) -{ - SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC WorkerProcessEvents: Entering.\n"); - - /* Enter the main loop */ - while (TRUE) - { - /* Wait for something to do */ - KeWaitForSingleObject(&DeviceExtension->Event, - Executive, - KernelMode, - FALSE, - NULL); - - /* Consume data off the serial port */ - ConMgrSerialPortConsumer(); - switch (ExecutePostConsumerCommand) - { - case 1: - /* A reboot was sent, do it */ - DoRebootCommand(FALSE); - break; - - case 2: - /* A close was sent, do it */ - ChanMgrCloseChannel(ExecutePostConsumerCommandData); - ChanMgrReleaseChannel(ExecutePostConsumerCommandData); - break; - - case 3: - /* A shutdown was sent, do it */ - DoRebootCommand(TRUE); - break; - } - - /* Clear the serial port consumer state */ - ExecutePostConsumerCommand = 0; - ExecutePostConsumerCommandData = NULL; - } -} VOID NTAPI @@ -512,6 +446,319 @@ return Status; } +VOID +NTAPI +ConMgrProcessInputLine(VOID) +{ + ASSERT(FALSE); +} + +#define Nothing 0 + +VOID +NTAPI +ConMgrSerialPortConsumer(VOID) +{ + NTSTATUS Status; + CHAR Char, LastChar; + CHAR WriteBuffer[2], ReadBuffer[2]; + ULONG ReadBufferSize, i; + WCHAR StringBuffer[2]; + SAC_DBG(SAC_DBG_MACHINE, "SAC TimerDpcRoutine: Entering.\n"); //bug + + /* Acquire the manager lock and make sure a channel is selected */ + SacAcquireMutexLock(); + ASSERT(CurrentChannel); + + /* Read whatever came off the serial port */ + for (Status = SerialBufferGetChar(&Char); + NT_SUCCESS(Status); + Status = SerialBufferGetChar(&Char)) + { + /* If nothing came through, bail out */ + if (Status == STATUS_NO_DATA_DETECTED) break; + + /* Check if ESC was pressed */ + if (Char == '\x1B') + { + /* Was it already pressed? */ + if (!InputInEscape) + { + /* First time ESC is pressed! Remember and reset TAB state */ + InputInEscTab = FALSE; + InputInEscape = TRUE; + continue; + } + } + else if (Char == '\t') + { + /* TAB was pressed, is it following ESC (VT-100 sequence)? */ + if (InputInEscape) + { + /* Yes! This must be the only ESC-TAB we see in once moment */ + ASSERT(InputInEscTab == FALSE); + + /* No longer treat us as being in ESC */ + InputInEscape = FALSE; + + /* ESC-TAB is the sequence for changing channels */ + Status = ConMgrAdvanceCurrentChannel(); + if (!NT_SUCCESS(Status)) break; + + /* Remember ESC-TAB was pressed */ + InputInEscTab = TRUE; + continue; + } + } + else if ((Char == '0') && (InputInEscTab)) + { + /* It this ESC-TAB-0? */ + ASSERT(InputInEscape == FALSE); + InputInEscTab = FALSE; + + /* If writes are already enabled, don't do this */ + if (!CurrentChannel->WriteEnabled) + { + /* Reset the channel, this is our special sequence */ + Status = ConMgrResetCurrentChannel(FALSE); + if (!NT_SUCCESS(Status)) break; + } + + continue; + } + else + { + /* This is ESC-TAB-something else */ + InputInEscTab = FALSE; + + /* If writes are already enabled, don't do this */ + if (!CurrentChannel->WriteEnabled) + { + /* Display the current channel */ + InputInEscape = FALSE; + Status = ConMgrDisplayCurrentChannel(); + if (!NT_SUCCESS(Status)) break; + continue; + } + } + + /* Check if an ESC-sequence was being typed into a command channel */ + if ((InputInEscape) && (CurrentChannel != SacChannel)) + { + /* Store the ESC in the current channel buffer */ + WriteBuffer[0] = '\x1B'; + ChannelIWrite(CurrentChannel, WriteBuffer, sizeof(CHAR)); + } + + /* Check if we are no longer pressing ESC and exit the mode if so */ + if (Char != '\x1B') InputInEscape = FALSE; + + /* Whatever was typed in, save it int eh current channel */ + ChannelIWrite(CurrentChannel, &Char, sizeof(Char)); + + /* If this is a command channel, we're done, nothing to process */ + if (CurrentChannel != SacChannel) continue; + + /* Check for line feed right after a carriage return */ + if ((ConMgrLastCharWasCR) && (Char == '\n')) + { + /* Ignore the line feed, but clear the carriage return */ + ChannelIReadLast(CurrentChannel); + ConMgrLastCharWasCR = 0; + continue; + } + + /* Check if the user did a carriage return */ + ConMgrLastCharWasCR = (Char == '\n'); + + /* If the user did an "ENTER", we need to run the command */ + if ((Char == '\n') || (Char == '\r')) + { + /* Echo back to the terminal */ + SacPutString(L"\r\n"); + +DoLineParsing: + /* Inhibit the character (either CR or LF) */ + ChannelIReadLast(CurrentChannel); + + /* NULL-terminate the channel's input buffer */ + WriteBuffer[0] = ANSI_NULL; + ChannelIWrite(CurrentChannel, WriteBuffer, sizeof(CHAR)); + + /* Loop over every last character */ + do + { + /* Read every character in the channel, and strip whitespace */ + LastChar = ChannelIReadLast(CurrentChannel); + WriteBuffer[0] = LastChar; + } while ((!(LastChar) || + (LastChar == ' ') || + (LastChar == '\t')) && + (ChannelIBufferLength(CurrentChannel))); + + /* Write back into the channel the last character */ + ChannelIWrite(CurrentChannel, WriteBuffer, sizeof(CHAR)); + + /* NULL-terminate the input buffer */ + WriteBuffer[0] = ANSI_NULL; + ChannelIWrite(CurrentChannel, WriteBuffer, sizeof(WCHAR)); + + /* Now loop over every first character */ + do + { + /* Read every character in the channel, and strip whitespace */ + ChannelIRead(CurrentChannel, + ReadBuffer, + sizeof(ReadBuffer), + &ReadBufferSize); + WriteBuffer[0] = ReadBuffer[0]; + } while ((ReadBufferSize) && + ((ReadBuffer[0] != ' ') || (ReadBuffer[0] != '\t'))); + + /* We read one more than we should, so treat that as our first one */ + InputBuffer[0] = ReadBuffer[0]; + i = 1; + + /* And now loop reading all the others */ + do + { + /* Read each character -- there should be max 80 */ + ChannelIRead(CurrentChannel, + ReadBuffer, + sizeof(ReadBuffer), + &ReadBufferSize); + ASSERT(i < SAC_VTUTF8_COL_WIDTH); + InputBuffer[i++] = ReadBuffer[0]; + } while (ReadBufferSize); + + /* Now go over the entire input stream */ + for (i = 0; InputBuffer[i]; i++) + { + /* Again it should be less than 80 characters */ + ASSERT(i < SAC_VTUTF8_COL_WIDTH); + + /* And upcase each character */ + Char = InputBuffer[i]; + if ((Char >= 'A') && (Char <= 'Z')) InputBuffer[i] = Char + ' '; + } + + /* Ok, at this point, no pending command should exist */ + ASSERT(ExecutePostConsumerCommand == Nothing); + + /* Go and process the input, then show the prompt again */ + ConMgrProcessInputLine(); + SacPutSimpleMessage(SAC_PROMPT); + + /* If the user typed a valid command, get out of here */ + if (ExecutePostConsumerCommand != Nothing) break; + + /* Keep going */ + continue; + } + + /* Check if the user typed backspace or delete */ + if ((Char == '\b') || (Char == '\x7F')) + { + /* Omit the last character, which should be the DEL/BS itself */ + if (ChannelIBufferLength(CurrentChannel)) + { + ChannelIReadLast(CurrentChannel); + } + + /* Omit the before-last character, which is the one to delete */ + if (ChannelIBufferLength(CurrentChannel)) + { + /* Also send two backspaces back to the console */ + SacPutString(L"\b \b"); + ChannelIReadLast(CurrentChannel); + } + + /* Keep going */ + continue; + } + + /* If the user pressed CTRL-C at this point, treat it like ENTER */ + if (Char == '\x03') goto DoLineParsing; + + /* Check if the user pressed TAB */ + if (Char == '\t') + { + /* Omit it, send a BELL, and keep going. We ignore TABs */ + ChannelIReadLast(CurrentChannel); + SacPutString(L"\a"); + continue; + } + + /* Check if the user is getting close to the end of the screen */ + if (ChannelIBufferLength(CurrentChannel) == (SAC_VTUTF8_COL_WIDTH - 2)) + { + /* Delete the last character, replacing it with this one instead */ + swprintf(StringBuffer, L"\b%c", Char); + SacPutString(StringBuffer); + + /* Omit the last two characters from the buffer */ + ChannelIReadLast(CurrentChannel); + ChannelIReadLast(CurrentChannel); + + /* NULL-terminate it */ + WriteBuffer[0] = Char; + ChannelIWrite(CurrentChannel, WriteBuffer, sizeof(CHAR)); + continue; + } + + /* Nothing of interest happened, just write the character back */ + swprintf(StringBuffer, L"%c", Char); + SacPutString(StringBuffer); + } + + /* We're done, release the lock */ + SacReleaseMutexLock(); + SAC_DBG(SAC_DBG_MACHINE, "SAC TimerDpcRoutine: Exiting.\n"); //bug +} + +VOID +NTAPI +ConMgrWorkerProcessEvents(IN PSAC_DEVICE_EXTENSION DeviceExtension) +{ + SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC WorkerProcessEvents: Entering.\n"); + + /* Enter the main loop */ + while (TRUE) + { + /* Wait for something to do */ + KeWaitForSingleObject(&DeviceExtension->Event, + Executive, + KernelMode, + FALSE, + NULL); + + /* Consume data off the serial port */ + ConMgrSerialPortConsumer(); + switch (ExecutePostConsumerCommand) + { + case 1: + /* A reboot was sent, do it */ + DoRebootCommand(FALSE); + break; + + case 2: + /* A close was sent, do it */ + ChanMgrCloseChannel(ExecutePostConsumerCommandData); + ChanMgrReleaseChannel(ExecutePostConsumerCommandData); + break; + + case 3: + /* A shutdown was sent, do it */ + DoRebootCommand(TRUE); + break; + } + + /* Clear the serial port consumer state */ + ExecutePostConsumerCommand = 0; + ExecutePostConsumerCommandData = NULL; + } +} + NTSTATUS NTAPI ConMgrGetChannelCloseMessage(IN PSAC_CHANNEL Channel, @@ -522,13 +769,6 @@ return STATUS_NOT_IMPLEMENTED; } -VOID -NTAPI -ConMgrProcessInputLine(VOID) -{ - ASSERT(FALSE); -} - NTSTATUS NTAPI ConMgrHandleEvent(IN ULONG EventCode, Modified: trunk/reactos/drivers/sac/driver/data.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/data.c?…
============================================================================== --- trunk/reactos/drivers/sac/driver/data.c [iso-8859-1] (original) +++ trunk/reactos/drivers/sac/driver/data.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -238,7 +238,7 @@ KeInitializeTimer(&DeviceExtension->Timer); KeInitializeDpc(&DeviceExtension->Dpc, TimerDpcRoutine, DeviceExtension); KeInitializeSpinLock(&DeviceExtension->Lock); - KeInitializeEvent(&DeviceExtension->Event, SynchronizationEvent, 0); + KeInitializeEvent(&DeviceExtension->Event, SynchronizationEvent, FALSE); InitializeListHead(&DeviceExtension->List); /* Attempt to enable HDL support */ @@ -317,8 +317,8 @@ DeviceExtension->PriorityFail = TRUE; /* Initialize rundown and wait for the thread to do it */ - KeInitializeEvent(&DeviceExtension->RundownEvent, SynchronizationEvent, 0); - KeSetEvent(&DeviceExtension->Event, DeviceExtension->PriorityBoost, 0); + KeInitializeEvent(&DeviceExtension->RundownEvent, SynchronizationEvent, FALSE); + KeSetEvent(&DeviceExtension->Event, DeviceExtension->PriorityBoost, FALSE); Status = KeWaitForSingleObject(&DeviceExtension->RundownEvent, Executive, KernelMode, Modified: trunk/reactos/drivers/sac/driver/dispatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/dispatc…
============================================================================== --- trunk/reactos/drivers/sac/driver/dispatch.c [iso-8859-1] (original) +++ trunk/reactos/drivers/sac/driver/dispatch.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -11,6 +11,8 @@ #include "sacdrv.h" /* GLOBALS *******************************************************************/ + +LONG TimerDpcCount; /* FUNCTIONS *****************************************************************/ @@ -61,7 +63,48 @@ IN PVOID SystemArgument1, IN PVOID SystemArgument2) { + HEADLESS_RSP_GET_BYTE ByteValue; + ULONG ValueSize; + BOOLEAN GotChar; + NTSTATUS Status; + PSAC_DEVICE_EXTENSION SacExtension; + /* Update our counter */ + _InterlockedExchangeAdd(&TimerDpcCount, 1); + + /* Set defaults and loop for new characters */ + GotChar = FALSE; + ValueSize = sizeof(ByteValue); + do + { + /* Ask the kernel for a byte */ + Status = HeadlessDispatch(HeadlessCmdGetByte, + NULL, + 0, + &ByteValue, + &ValueSize); + + /* Break out if there's nothing interesting */ + if (!NT_SUCCESS(Status)) break; + if (!ByteValue.Value) break; + + /* Update the serial port buffer */ + SerialPortBuffer[SerialPortProducerIndex] = ByteValue.Value; + GotChar = TRUE; + + /* Update the index, let it roll-over if needed */ + _InterlockedExchange(&SerialPortProducerIndex, + (SerialPortProducerIndex + 1) & + (SAC_SERIAL_PORT_BUFFER_SIZE - 1)); + } while (ByteValue.Value); + + /* Did we get anything */ + if (GotChar) + { + /* Signal the worker thread that there is work to do */ + SacExtension = DeferredContext; + KeSetEvent(&SacExtension->Event, SacExtension->PriorityBoost, FALSE); + } } VOID Modified: trunk/reactos/drivers/sac/driver/sacdrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/sacdrv.…
============================================================================== --- trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] (original) +++ trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -156,6 +156,7 @@ #define SAC_MAX_CHANNELS 10 #define SAC_SERIAL_PORT_BUFFER_SIZE 1024 // 1KB #define SAC_MAX_MESSAGES 200 +#define SAC_VTUTF8_COL_WIDTH 80 // // Channel flags @@ -766,6 +767,35 @@ IN PSAC_CHANNEL Channel ); +NTSTATUS +NTAPI +ChannelIWrite( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize +); + +UCHAR +NTAPI +ChannelIReadLast( + IN PSAC_CHANNEL Channel +); + +ULONG +NTAPI +ChannelIBufferLength( + IN PSAC_CHANNEL Channel +); + +NTSTATUS +NTAPI +ChannelIRead( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize, + IN OUT PULONG ResultBufferSize +); + // // RAW Channel Table // @@ -901,6 +931,7 @@ extern KMUTEX CurrentChannelLock; extern LONG CurrentChannelRefCount; extern PCHAR SerialPortBuffer; +extern LONG SerialPortConsumerIndex, SerialPortProducerIndex; extern PCHAR Utf8ConversionBuffer; extern ULONG Utf8ConversionBufferSize; Modified: trunk/reactos/drivers/sac/driver/util.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/util.c?…
============================================================================== --- trunk/reactos/drivers/sac/driver/util.c [iso-8859-1] (original) +++ trunk/reactos/drivers/sac/driver/util.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -14,7 +14,9 @@ PCHAR Utf8ConversionBuffer; ULONG Utf8ConversionBufferSize = PAGE_SIZE; + PSAC_MACHINE_INFO MachineInformation; + PVOID RequestSacCmdEventObjectBody; PKEVENT RequestSacCmdEventWaitObjectBody; PVOID RequestSacCmdSuccessEventObjectBody; Modified: trunk/reactos/include/reactos/libs/cportlib/cportlib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/cport…
============================================================================== --- trunk/reactos/include/reactos/libs/cportlib/cportlib.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/libs/cportlib/cportlib.h [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -71,7 +71,8 @@ CpGetByte( IN PCPPORT Port, OUT PUCHAR Byte, - IN BOOLEAN Wait + IN BOOLEAN Wait, + IN BOOLEAN Poll ); VOID Modified: trunk/reactos/lib/cportlib/cport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cportlib/cport.c?rev=5…
============================================================================== --- trunk/reactos/lib/cportlib/cport.c [iso-8859-1] (original) +++ trunk/reactos/lib/cportlib/cport.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -255,7 +255,8 @@ NTAPI CpGetByte(IN PCPPORT Port, OUT PUCHAR Byte, - IN BOOLEAN Wait) + IN BOOLEAN Wait, + IN BOOLEAN Poll) { UCHAR Lsr; ULONG LimitCount = Wait ? TIMEOUT_COUNT : 1; @@ -277,6 +278,9 @@ return CP_GET_ERROR; } + /* If only polling was requested by caller, return now */ + if (Poll) return CP_GET_SUCCESS; + /* Otherwise read the byte and return it */ *Byte = READ_PORT_UCHAR(Port->Address + RECEIVE_BUFFER_REGISTER); Modified: trunk/reactos/ntoskrnl/ex/hdlsterm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/hdlsterm.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ex/hdlsterm.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/hdlsterm.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -262,6 +262,7 @@ PHEADLESS_RSP_QUERY_INFO HeadlessInfo; PHEADLESS_CMD_PUT_STRING PutString; PHEADLESS_CMD_ENABLE_TERMINAL EnableTerminal; + PHEADLESS_RSP_GET_BYTE GetByte; NTSTATUS Status = STATUS_NOT_IMPLEMENTED; ASSERT(HeadlessGlobals != NULL); // ASSERT(HeadlessGlobals->PageLockHandle != NULL); @@ -328,8 +329,18 @@ Status = STATUS_SUCCESS; break; - case HeadlessCmdClearDisplay: - break; + case HeadlessCmdClearDisplay: + + /* Send the VT100 claer screen command if the terminal is enabled */ + if (HeadlessGlobals->TerminalEnabled) + { + HdlspSendStringAtBaud((PUCHAR)"\033[2J"); + } + + /* Return success either way */ + Status = STATUS_SUCCESS; + break; + case HeadlessCmdClearToEndOfDisplay: break; case HeadlessCmdClearToEndOfLine: @@ -344,8 +355,46 @@ break; case HeadlessCmdTerminalPoll: break; - case HeadlessCmdGetByte: - break; + + case HeadlessCmdGetByte: + + /* Make sure the caller passed valid data */ + if (!(OutputBuffer) || + !(OutputBufferSize) || + (*OutputBufferSize < sizeof(*GetByte))) + { + DPRINT1("Invalid buffer\n"); + Status = STATUS_INVALID_PARAMETER; + break; + } + + /* Make sure the terminal is enabled */ + GetByte = OutputBuffer; + if (HeadlessGlobals->TerminalEnabled) + { + /* Poll if something is on the wire */ + if (InbvPortPollOnly(HeadlessGlobals->TerminalPort)) + { + /* If so, read it */ + InbvPortGetByte(HeadlessGlobals->TerminalPort, + &GetByte->Value); + } + else + { + /* Nothing is there, return 0 */ + GetByte->Value = 0; + } + } + else + { + /* Otherwise return nothing */ + GetByte->Value = 0; + } + + /* Return success either way */ + Status = STATUS_SUCCESS; + break; + case HeadlessCmdGetLine: break; case HeadlessCmdStartBugCheck: Modified: trunk/reactos/ntoskrnl/inbv/inbvport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/inbv/inbvport.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/inbv/inbvport.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/inbv/inbvport.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -22,6 +22,25 @@ }; /* FUNCTIONS *****************************************************************/ + +BOOLEAN +NTAPI +InbvPortPollOnly(IN ULONG PortId) +{ + UCHAR Dummy; + + /* Poll a byte from the port */ + return CpGetByte(&Port[PortId], &Dummy, FALSE, TRUE) == CP_GET_SUCCESS; +} + +BOOLEAN +NTAPI +InbvPortGetByte(IN ULONG PortId, + OUT PUCHAR Char) +{ + /* Read a byte from the port */ + return CpGetByte(&Port[PortId], Char, TRUE, FALSE) == CP_GET_SUCCESS; +} VOID NTAPI Modified: trunk/reactos/ntoskrnl/include/internal/hdl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/hdl.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/hdl.h [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -192,6 +192,11 @@ UCHAR String[1]; } HEADLESS_CMD_PUT_STRING, *PHEADLESS_CMD_PUT_STRING; +typedef struct _HEADLESS_RSP_GET_BYTE +{ + UCHAR Value; +} HEADLESS_RSP_GET_BYTE, *PHEADLESS_RSP_GET_BYTE; + NTSTATUS NTAPI HeadlessDispatch( Modified: trunk/reactos/ntoskrnl/include/internal/inbv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/inbv.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/inbv.h [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -107,4 +107,17 @@ IN BOOLEAN IsMMIODevice ); +BOOLEAN +NTAPI +InbvPortPollOnly( + IN ULONG PortId +); + +BOOLEAN +NTAPI +InbvPortGetByte( + IN ULONG PortId, + OUT PUCHAR Char +); + extern BOOLEAN InbvBootDriverInstalled; Modified: trunk/reactos/ntoskrnl/kd/i386/kdbg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/i386/kdbg.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/kd/i386/kdbg.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kd/i386/kdbg.c [iso-8859-1] Sun Aug 18 17:47:19 2013 @@ -136,7 +136,7 @@ IN PCPPORT PortInformation, OUT PUCHAR ByteReceived) { - return (CpGetByte(PortInformation, ByteReceived, FALSE) == CP_GET_SUCCESS); + return (CpGetByte(PortInformation, ByteReceived, FALSE, TRUE) == CP_GET_SUCCESS); } VOID
11 years, 2 months
1
0
0
0
[akhaldi] 59771: [PSDK] * Annotate msi.h.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Aug 18 14:47:51 2013 New Revision: 59771 URL:
http://svn.reactos.org/svn/reactos?rev=59771&view=rev
Log: [PSDK] * Annotate msi.h. Modified: trunk/reactos/include/psdk/msi.h Modified: trunk/reactos/include/psdk/msi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/msi.h?rev=597…
============================================================================== --- trunk/reactos/include/psdk/msi.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/msi.h [iso-8859-1] Sun Aug 18 14:47:51 2013 @@ -22,6 +22,8 @@ #ifndef _MSI_NO_CRYPTO #include <wincrypt.h> #endif + +#define MAX_GUID_CHARS 38 #ifdef __cplusplus extern "C" { @@ -413,295 +415,1116 @@ typedef INT (CALLBACK *INSTALLUI_HANDLER_RECORD)(LPVOID, UINT, MSIHANDLE); typedef INSTALLUI_HANDLER_RECORD* PINSTALLUI_HANDLER_RECORD; -UINT WINAPI MsiAdvertiseProductA(LPCSTR, LPCSTR, LPCSTR, LANGID); -UINT WINAPI MsiAdvertiseProductW(LPCWSTR, LPCWSTR, LPCWSTR, LANGID); +UINT +WINAPI +MsiAdvertiseProductA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_opt_ LPCSTR, + _In_ LANGID); + +UINT +WINAPI +MsiAdvertiseProductW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ LANGID); + #define MsiAdvertiseProduct WINELIB_NAME_AW(MsiAdvertiseProduct) -UINT WINAPI MsiAdvertiseProductExA(LPCSTR, LPCSTR, LPCSTR, LANGID, DWORD, DWORD); -UINT WINAPI MsiAdvertiseProductExW(LPCWSTR, LPCWSTR, LPCWSTR, LANGID, DWORD, DWORD); +UINT +WINAPI +MsiAdvertiseProductExA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_opt_ LPCSTR, + _In_ LANGID, + _In_ DWORD, + _In_ DWORD); + +UINT +WINAPI +MsiAdvertiseProductExW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ LANGID, + _In_ DWORD, + _In_ DWORD); + #define MsiAdvertiseProductEx WINELIB_NAME_AW(MsiAdvertiseProductEx) -UINT WINAPI MsiInstallProductA(LPCSTR, LPCSTR); -UINT WINAPI MsiInstallProductW(LPCWSTR, LPCWSTR); +UINT WINAPI MsiInstallProductA(_In_ LPCSTR, _In_opt_ LPCSTR); +UINT WINAPI MsiInstallProductW(_In_ LPCWSTR, _In_opt_ LPCWSTR); #define MsiInstallProduct WINELIB_NAME_AW(MsiInstallProduct) -UINT WINAPI MsiReinstallProductA(LPCSTR, DWORD); -UINT WINAPI MsiReinstallProductW(LPCWSTR, DWORD); +UINT WINAPI MsiReinstallProductA(_In_ LPCSTR, _In_ DWORD); +UINT WINAPI MsiReinstallProductW(_In_ LPCWSTR, _In_ DWORD); #define MsiReinstallProduct WINELIB_NAME_AW(MsiReinstallProduct) -UINT WINAPI MsiApplyPatchA(LPCSTR, LPCSTR, INSTALLTYPE, LPCSTR); -UINT WINAPI MsiApplyPatchW(LPCWSTR, LPCWSTR, INSTALLTYPE, LPCWSTR); +UINT +WINAPI +MsiApplyPatchA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ INSTALLTYPE, + _In_opt_ LPCSTR); + +UINT +WINAPI +MsiApplyPatchW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ INSTALLTYPE, + _In_opt_ LPCWSTR); + #define MsiApplyPatch WINELIB_NAME_AW(MsiApplyPatch) UINT WINAPI MsiEnumComponentCostsA(MSIHANDLE, LPCSTR, DWORD, INSTALLSTATE, LPSTR, LPDWORD, LPINT, LPINT); UINT WINAPI MsiEnumComponentCostsW(MSIHANDLE, LPCWSTR, DWORD, INSTALLSTATE, LPWSTR, LPDWORD, LPINT, LPINT); #define MsiEnumComponentCosts WINELIB_NAME_AW(MsiEnumComponentCosts) -UINT WINAPI MsiEnumProductsA(DWORD, LPSTR); -UINT WINAPI MsiEnumProductsW(DWORD, LPWSTR); +UINT +WINAPI +MsiEnumProductsA( + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPSTR); + +UINT +WINAPI +MsiEnumProductsW( + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPWSTR); + #define MsiEnumProducts WINELIB_NAME_AW(MsiEnumProducts) -UINT WINAPI MsiEnumProductsExA(LPCSTR, LPCSTR, DWORD, DWORD, CHAR[39], MSIINSTALLCONTEXT*, LPSTR, LPDWORD); -UINT WINAPI MsiEnumProductsExW(LPCWSTR, LPCWSTR, DWORD, DWORD, WCHAR[39], MSIINSTALLCONTEXT*, LPWSTR, LPDWORD); +UINT +WINAPI +MsiEnumProductsExA( + _In_opt_ LPCSTR, + _In_opt_ LPCSTR, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(MAX_GUID_CHARS + 1) CHAR[39], + _Out_opt_ MSIINSTALLCONTEXT*, + _Out_writes_opt_(*pcchSid) LPSTR, + _Inout_opt_ LPDWORD pcchSid); + +UINT +WINAPI +MsiEnumProductsExW( + _In_opt_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(MAX_GUID_CHARS + 1) WCHAR[39], + _Out_opt_ MSIINSTALLCONTEXT*, + _Out_writes_opt_(*pcchSid) LPWSTR, + _Inout_opt_ LPDWORD pcchSid); + #define MsiEnumProductsEx WINELIB_NAME_AW(MsiEnumProductsEx) -UINT WINAPI MsiEnumFeaturesA(LPCSTR, DWORD, LPSTR, LPSTR); -UINT WINAPI MsiEnumFeaturesW(LPCWSTR, DWORD, LPWSTR, LPWSTR); +UINT +WINAPI +MsiEnumFeaturesA( + _In_ LPCSTR, + _In_ DWORD, + _Out_writes_(MAX_FEATURE_CHARS + 1) LPSTR, + _Out_writes_opt_(MAX_FEATURE_CHARS + 1) LPSTR); + +UINT +WINAPI +MsiEnumFeaturesW( + _In_ LPCWSTR, + _In_ DWORD, + _Out_writes_(MAX_FEATURE_CHARS + 1) LPWSTR, + _Out_writes_opt_(MAX_FEATURE_CHARS + 1) LPWSTR); + #define MsiEnumFeatures WINELIB_NAME_AW(MsiEnumFeatures) -UINT WINAPI MsiEnumComponentsA(DWORD, LPSTR); -UINT WINAPI MsiEnumComponentsW(DWORD, LPWSTR); +UINT +WINAPI +MsiEnumComponentsA( + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPSTR); + +UINT +WINAPI +MsiEnumComponentsW( + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPWSTR); + #define MsiEnumComponents WINELIB_NAME_AW(MsiEnumComponents) -UINT WINAPI MsiEnumComponentsExA(LPCSTR, DWORD, DWORD, CHAR[39], - MSIINSTALLCONTEXT *, LPSTR, LPDWORD); -UINT WINAPI MsiEnumComponentsExW(LPCWSTR, DWORD, DWORD, WCHAR[39], - MSIINSTALLCONTEXT *, LPWSTR, LPDWORD); +UINT +WINAPI +MsiEnumComponentsExA( + _In_opt_ LPCSTR, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(MAX_GUID_CHARS + 1) CHAR[39], + _Out_opt_ MSIINSTALLCONTEXT *, + _Out_writes_opt_(*pcchSid) LPSTR, + _Inout_opt_ LPDWORD pcchSid); + +UINT +WINAPI +MsiEnumComponentsExW( + _In_opt_ LPCWSTR, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(MAX_GUID_CHARS + 1) WCHAR[39], + _Out_opt_ MSIINSTALLCONTEXT *, + _Out_writes_opt_(*pcchSid) LPWSTR, + _Inout_opt_ LPDWORD pcchSid); + #define MsiEnumComponentsEx WINELIB_NAME_AW(MsiEnumComponentsEx) -UINT WINAPI MsiEnumClientsA(LPCSTR, DWORD, LPSTR); -UINT WINAPI MsiEnumClientsW(LPCWSTR, DWORD, LPWSTR); +UINT +WINAPI +MsiEnumClientsA( + _In_ LPCSTR, + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPSTR); + +UINT +WINAPI +MsiEnumClientsW( + _In_ LPCWSTR, + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPWSTR); + #define MsiEnumClients WINELIB_NAME_AW(MsiEnumClients) -UINT WINAPI MsiOpenPackageA(LPCSTR, MSIHANDLE*); -UINT WINAPI MsiOpenPackageW(LPCWSTR, MSIHANDLE*); +UINT WINAPI MsiOpenPackageA(_In_ LPCSTR, _Out_ MSIHANDLE*); +UINT WINAPI MsiOpenPackageW(_In_ LPCWSTR, _Out_ MSIHANDLE*); #define MsiOpenPackage WINELIB_NAME_AW(MsiOpenPackage) -UINT WINAPI MsiOpenPackageExA(LPCSTR, DWORD, MSIHANDLE*); -UINT WINAPI MsiOpenPackageExW(LPCWSTR, DWORD, MSIHANDLE*); +UINT WINAPI MsiOpenPackageExA(_In_ LPCSTR, _In_ DWORD, _Out_ MSIHANDLE*); +UINT WINAPI MsiOpenPackageExW(_In_ LPCWSTR, _In_ DWORD, _Out_ MSIHANDLE*); #define MsiOpenPackageEx WINELIB_NAME_AW(MsiOpenPackageEx) -UINT WINAPI MsiOpenProductA(LPCSTR, MSIHANDLE*); -UINT WINAPI MsiOpenProductW(LPCWSTR, MSIHANDLE*); +UINT WINAPI MsiOpenProductA(_In_ LPCSTR, _Out_ MSIHANDLE*); +UINT WINAPI MsiOpenProductW(_In_ LPCWSTR, _Out_ MSIHANDLE*); #define MsiOpenProduct WINELIB_NAME_AW(MsiOpenProduct) -UINT WINAPI MsiGetProductPropertyA(MSIHANDLE,LPCSTR,LPSTR,LPDWORD); -UINT WINAPI MsiGetProductPropertyW(MSIHANDLE,LPCWSTR,LPWSTR,LPDWORD); +UINT +WINAPI +MsiGetProductPropertyA( + _In_ MSIHANDLE, + _In_ LPCSTR, + _Out_writes_opt_(*pcchValueBuf) LPSTR, + _Inout_opt_ LPDWORD pcchValueBuf); + +UINT +WINAPI +MsiGetProductPropertyW( + _In_ MSIHANDLE, + _In_ LPCWSTR, + _Out_writes_opt_(*pcchValueBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchValueBuf); + #define MsiGetProductProperty WINELIB_NAME_AW(MsiGetProductProperty) -UINT WINAPI MsiVerifyPackageA(LPCSTR); -UINT WINAPI MsiVerifyPackageW(LPCWSTR); +UINT WINAPI MsiVerifyPackageA(_In_ LPCSTR); +UINT WINAPI MsiVerifyPackageW(_In_ LPCWSTR); #define MsiVerifyPackage WINELIB_NAME_AW(MsiVerifyPackage) -UINT WINAPI MsiQueryComponentStateA(LPCSTR,LPCSTR,MSIINSTALLCONTEXT,LPCSTR,INSTALLSTATE*); -UINT WINAPI MsiQueryComponentStateW(LPCWSTR,LPCWSTR,MSIINSTALLCONTEXT,LPCWSTR,INSTALLSTATE*); +UINT +WINAPI +MsiQueryComponentStateA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCSTR, + _Out_opt_ INSTALLSTATE*); + +UINT +WINAPI +MsiQueryComponentStateW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCWSTR, + _Out_opt_ INSTALLSTATE*); + #define MsiQueryComponentState WINELIB_NAME_AW(MsiQueryComponentState) -INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR); -INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR); +INSTALLSTATE WINAPI MsiQueryProductStateA(_In_ LPCSTR); +INSTALLSTATE WINAPI MsiQueryProductStateW(_In_ LPCWSTR); #define MsiQueryProductState WINELIB_NAME_AW(MsiQueryProductState) -UINT WINAPI MsiConfigureProductA(LPCSTR, int, INSTALLSTATE); -UINT WINAPI MsiConfigureProductW(LPCWSTR, int, INSTALLSTATE); +UINT WINAPI MsiConfigureProductA(_In_ LPCSTR, _In_ int, _In_ INSTALLSTATE); +UINT WINAPI MsiConfigureProductW(_In_ LPCWSTR, _In_ int, _In_ INSTALLSTATE); #define MsiConfigureProduct WINELIB_NAME_AW(MsiConfigureProduct); -UINT WINAPI MsiConfigureProductExA(LPCSTR, int, INSTALLSTATE, LPCSTR); -UINT WINAPI MsiConfigureProductExW(LPCWSTR, int, INSTALLSTATE, LPCWSTR); +UINT +WINAPI +MsiConfigureProductExA( + _In_ LPCSTR, + _In_ int, + _In_ INSTALLSTATE, + _In_opt_ LPCSTR); + +UINT +WINAPI +MsiConfigureProductExW( + _In_ LPCWSTR, + _In_ int, + _In_ INSTALLSTATE, + _In_opt_ LPCWSTR); + #define MsiConfigureProductEx WINELIB_NAME_AW(MsiConfigureProductEx); -UINT WINAPI MsiConfigureFeatureA(LPCSTR, LPCSTR, INSTALLSTATE); -UINT WINAPI MsiConfigureFeatureW(LPCWSTR, LPCWSTR, INSTALLSTATE); +UINT +WINAPI +MsiConfigureFeatureA( + _In_ LPCSTR, + _In_ LPCSTR, + _In_ INSTALLSTATE); + +UINT +WINAPI +MsiConfigureFeatureW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _In_ INSTALLSTATE); + #define MsiConfigureFeature WINELIB_NAME_AW(MsiConfigureFeature); -UINT WINAPI MsiGetProductCodeA(LPCSTR, LPSTR); -UINT WINAPI MsiGetProductCodeW(LPCWSTR, LPWSTR); +UINT +WINAPI +MsiGetProductCodeA( + _In_ LPCSTR, + _Out_writes_(MAX_GUID_CHARS + 1) LPSTR); + +UINT +WINAPI +MsiGetProductCodeW( + _In_ LPCWSTR, + _Out_writes_(MAX_GUID_CHARS + 1) LPWSTR); + #define MsiGetProductCode WINELIB_NAME_AW(MsiGetProductCode) -UINT WINAPI MsiGetProductInfoA(LPCSTR, LPCSTR, LPSTR, LPDWORD); -UINT WINAPI MsiGetProductInfoW(LPCWSTR, LPCWSTR, LPWSTR, LPDWORD); +UINT +WINAPI +MsiGetProductInfoA( + _In_ LPCSTR, + _In_ LPCSTR, + _Out_writes_opt_(*pcchValueBuf) LPSTR, + _Inout_opt_ LPDWORD pcchValueBuf); + +UINT +WINAPI +MsiGetProductInfoW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _Out_writes_opt_(*pcchValueBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchValueBuf); + #define MsiGetProductInfo WINELIB_NAME_AW(MsiGetProductInfo) -UINT WINAPI MsiGetProductInfoExA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, LPDWORD); -UINT WINAPI MsiGetProductInfoExW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, LPCWSTR, LPWSTR, LPDWORD); +UINT +WINAPI +MsiGetProductInfoExA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCSTR, + _Out_writes_opt_(*pcchValue) LPSTR, + _Inout_opt_ LPDWORD pcchValue); + +UINT +WINAPI +MsiGetProductInfoExW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCWSTR, + _Out_writes_opt_(*pcchValue) LPWSTR, + _Inout_opt_ LPDWORD pcchValue); + #define MsiGetProductInfoEx WINELIB_NAME_AW(MsiGetProductInfoEx) -UINT WINAPI MsiGetPatchInfoExA(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, LPDWORD); -UINT WINAPI MsiGetPatchInfoExW(LPCWSTR, LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, LPCWSTR, LPWSTR, LPDWORD); +UINT +WINAPI +MsiGetPatchInfoExA( + _In_ LPCSTR, + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCSTR, + _Out_writes_opt_(*pcchValue) LPSTR, + _Inout_opt_ LPDWORD pcchValue); + +UINT +WINAPI +MsiGetPatchInfoExW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCWSTR, + _Out_writes_opt_(*pcchValue) LPWSTR, + _Inout_opt_ LPDWORD pcchValue); + #define MsiGetPatchInfoEx WINELIB_NAME_AW(MsiGetPatchInfoEx) -UINT WINAPI MsiGetPatchInfoA(LPCSTR, LPCSTR, LPSTR, LPDWORD); -UINT WINAPI MsiGetPatchInfoW(LPCWSTR, LPCWSTR, LPWSTR, LPDWORD); +UINT +WINAPI +MsiGetPatchInfoA( + _In_ LPCSTR, + _In_ LPCSTR, + _Out_writes_opt_(*pcchValueBuf) LPSTR, + _Inout_opt_ LPDWORD pcchValueBuf); + +UINT +WINAPI +MsiGetPatchInfoW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _Out_writes_opt_(*pcchValueBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchValueBuf); + #define MsiGetPatchInfo WINELIB_NAME_AW(MsiGetPatchInfo) -UINT WINAPI MsiEnableLogA(DWORD, LPCSTR, DWORD); -UINT WINAPI MsiEnableLogW(DWORD, LPCWSTR, DWORD); +UINT WINAPI MsiEnableLogA(_In_ DWORD, _In_opt_ LPCSTR, _In_ DWORD); +UINT WINAPI MsiEnableLogW(_In_ DWORD, _In_opt_ LPCWSTR, _In_ DWORD); #define MsiEnableLog WINELIB_NAME_AW(MsiEnableLog) -INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA, DWORD, LPVOID); -INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW(INSTALLUI_HANDLERW, DWORD, LPVOID); +INSTALLUI_HANDLERA +WINAPI +MsiSetExternalUIA( + _In_opt_ INSTALLUI_HANDLERA, + _In_ DWORD, + _In_opt_ LPVOID); + +INSTALLUI_HANDLERW +WINAPI +MsiSetExternalUIW( + _In_opt_ INSTALLUI_HANDLERW, + _In_ DWORD, + _In_opt_ LPVOID); + #define MsiSetExternalUI WINELIB_NAME_AW(MsiSetExternalUI) -INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR, LPCSTR, LPSTR, LPDWORD); -INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR, LPCWSTR, LPWSTR, LPDWORD); +INSTALLSTATE +WINAPI +MsiGetComponentPathA( + _In_ LPCSTR, + _In_ LPCSTR, + _Out_writes_opt_(*pcchBuf) LPSTR, + _Inout_opt_ LPDWORD pcchBuf); + +INSTALLSTATE +WINAPI +MsiGetComponentPathW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _Out_writes_opt_(*pcchBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchBuf); + #define MsiGetComponentPath WINELIB_NAME_AW(MsiGetComponentPath) -INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR, LPCSTR); -INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR, LPCWSTR); +INSTALLSTATE WINAPI MsiQueryFeatureStateA(_In_ LPCSTR, _In_ LPCSTR); +INSTALLSTATE WINAPI MsiQueryFeatureStateW(_In_ LPCWSTR, _In_ LPCWSTR); #define MsiQueryFeatureState WINELIB_NAME_AW(MsiQueryFeatureState) -UINT WINAPI MsiQueryFeatureStateExA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*); -UINT WINAPI MsiQueryFeatureStateExW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, LPCWSTR, INSTALLSTATE*); +UINT +WINAPI +MsiQueryFeatureStateExA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCSTR, + _Out_opt_ INSTALLSTATE*); + +UINT +WINAPI +MsiQueryFeatureStateExW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ LPCWSTR, + _Out_opt_ INSTALLSTATE*); + #define MsiQueryFeatureStateEx WINELIB_NAME_AW(MsiQueryFeatureStateEx) -UINT WINAPI MsiGetFeatureInfoA(MSIHANDLE, LPCSTR, LPDWORD, LPSTR, LPDWORD, LPSTR, LPDWORD); -UINT WINAPI MsiGetFeatureInfoW(MSIHANDLE, LPCWSTR, LPDWORD, LPWSTR, LPDWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiGetFeatureInfoA( + _In_ MSIHANDLE, + _In_ LPCSTR, + _Out_opt_ LPDWORD, + _Out_writes_opt_(*pcchTitleBuf) LPSTR, + _Inout_opt_ LPDWORD pcchTitleBuf, + _Out_writes_opt_(*pcchHelpBuf) LPSTR, + _Inout_opt_ LPDWORD pcchHelpBuf); + +UINT +WINAPI +MsiGetFeatureInfoW( + _In_ MSIHANDLE, + _In_ LPCWSTR, + _Out_opt_ LPDWORD, + _Out_writes_opt_(*pcchTitleBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchTitleBuf, + _Out_writes_opt_(*pcchHelpBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchHelpBuf); + #define MsiGetFeatureInfo WINELIB_NAME_AW(MsiGetFeatureInfo) -UINT WINAPI MsiGetFeatureUsageA(LPCSTR, LPCSTR, LPDWORD, LPWORD); -UINT WINAPI MsiGetFeatureUsageW(LPCWSTR, LPCWSTR, LPDWORD, LPWORD); +UINT +WINAPI +MsiGetFeatureUsageA( + _In_ LPCSTR, + _In_ LPCSTR, + _Out_opt_ LPDWORD, + _Out_opt_ LPWORD); + +UINT +WINAPI +MsiGetFeatureUsageW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _Out_opt_ LPDWORD, + _Out_opt_ LPWORD); + #define MsiGetFeatureUsage WINELIB_NAME_AW(MsiGetFeatureUsage) -UINT WINAPI MsiEnumRelatedProductsA(LPCSTR, DWORD, DWORD, LPSTR); -UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR, DWORD, DWORD, LPWSTR); +UINT +WINAPI +MsiEnumRelatedProductsA( + _In_ LPCSTR, + _Reserved_ DWORD, + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPSTR); + +UINT +WINAPI +MsiEnumRelatedProductsW( + _In_ LPCWSTR, + _Reserved_ DWORD, + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPWSTR); + #define MsiEnumRelatedProducts WINELIB_NAME_AW(MsiEnumRelatedProducts) -UINT WINAPI MsiProvideAssemblyA(LPCSTR, LPCSTR, DWORD, DWORD, LPSTR, LPDWORD); -UINT WINAPI MsiProvideAssemblyW(LPCWSTR, LPCWSTR, DWORD, DWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiProvideAssemblyA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(*pcchPathBuf) LPSTR, + _Inout_opt_ LPDWORD pcchPathBuf); + +UINT +WINAPI +MsiProvideAssemblyW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(*pcchPathBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchPathBuf); + #define MsiProvideAssembly WINELIB_NAME_AW(MsiProvideAssembly) -UINT WINAPI MsiEnumComponentQualifiersA(LPCSTR, DWORD, LPSTR, LPDWORD, LPSTR, LPDWORD); -UINT WINAPI MsiEnumComponentQualifiersW(LPCWSTR, DWORD, LPWSTR, LPDWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiEnumComponentQualifiersA( + _In_ LPCSTR, + _In_ DWORD, + _Out_writes_(*pcchQualifierBuf) LPSTR, + _Inout_ LPDWORD pcchQualifierBuf, + _Out_writes_opt_(*pcchApplicationDataBuf) LPSTR, + _Inout_opt_ LPDWORD pcchApplicationDataBuf); + +UINT +WINAPI +MsiEnumComponentQualifiersW( + _In_ LPCWSTR, + _In_ DWORD, + _Out_writes_(*pcchQualifierBuf) LPWSTR, + _Inout_ LPDWORD pcchQualifierBuf, + _Out_writes_opt_(*pcchApplicationDataBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchApplicationDataBuf); + #define MsiEnumComponentQualifiers WINELIB_NAME_AW(MsiEnumComponentQualifiers) -UINT WINAPI MsiGetFileVersionA(LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD); -UINT WINAPI MsiGetFileVersionW(LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiGetFileVersionA( + _In_ LPCSTR, + _Out_writes_opt_(*pcchVersionBuf) LPSTR, + _Inout_opt_ LPDWORD pcchVersionBuf, + _Out_writes_opt_(*pcchLangBuf) LPSTR, + _Inout_opt_ LPDWORD pcchLangBuf); + +UINT +WINAPI +MsiGetFileVersionW( + _In_ LPCWSTR, + _Out_writes_opt_(*pcchVersionBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchVersionBuf, + _Out_writes_opt_(*pcchLangBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchLangBuf); + #define MsiGetFileVersion WINELIB_NAME_AW(MsiGetFileVersion) UINT WINAPI MsiMessageBoxA(HWND, LPCSTR, LPCSTR, UINT, WORD, DWORD); UINT WINAPI MsiMessageBoxW(HWND, LPCWSTR, LPCWSTR, UINT, WORD, DWORD); #define MsiMessageBox WINELIB_NAME_AW(MsiMessageBox) -UINT WINAPI MsiProvideQualifiedComponentExA(LPCSTR, LPCSTR, DWORD, LPCSTR, DWORD, DWORD, LPSTR, LPDWORD); -UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR, LPCWSTR, DWORD, LPCWSTR, DWORD, DWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiProvideQualifiedComponentExA( + _In_ LPCSTR, + _In_ LPCSTR, + _In_ DWORD, + _In_opt_ LPCSTR, + _Reserved_ DWORD, + _Reserved_ DWORD, + _Out_writes_opt_(*pcchPathBuf) LPSTR, + _Inout_opt_ LPDWORD pcchPathBuf); + +UINT +WINAPI +MsiProvideQualifiedComponentExW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _In_ DWORD, + _In_opt_ LPCWSTR, + _Reserved_ DWORD, + _Reserved_ DWORD, + _Out_writes_opt_(*pcchPathBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchPathBuf); + #define MsiProvideQualifiedComponentEx WINELIB_NAME_AW(MsiProvideQualifiedComponentEx) -UINT WINAPI MsiProvideQualifiedComponentA(LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD); -UINT WINAPI MsiProvideQualifiedComponentW(LPCWSTR, LPCWSTR, DWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiProvideQualifiedComponentA( + _In_ LPCSTR, + _In_ LPCSTR, + _In_ DWORD, + _Out_writes_opt_(*pcchPathBuf) LPSTR, + _Inout_opt_ LPDWORD pcchPathBuf); + +UINT +WINAPI +MsiProvideQualifiedComponentW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _In_ DWORD, + _Out_writes_opt_(*pcchPathBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchPathBuf); + #define MsiProvideQualifiedComponent WINELIB_NAME_AW(MsiProvideQualifiedComponent) -USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD, LPSTR, LPDWORD); -USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, LPWSTR, LPDWORD); +USERINFOSTATE +WINAPI +MsiGetUserInfoA( + _In_ LPCSTR, + _Out_writes_opt_(*pcchUserNameBuf) LPSTR, + _Inout_opt_ LPDWORD pcchUserNameBuf, + _Out_writes_opt_(*pcchOrgNameBuf) LPSTR, + _Inout_opt_ LPDWORD pcchOrgNameBuf, + _Out_writes_opt_(*pcchSerialBuf) LPSTR, + _Inout_opt_ LPDWORD pcchSerialBuf); + +USERINFOSTATE +WINAPI +MsiGetUserInfoW( + _In_ LPCWSTR, + _Out_writes_opt_(*pcchUserNameBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchUserNameBuf, + _Out_writes_opt_(*pcchOrgNameBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchOrgNameBuf, + _Out_writes_opt_(*pcchSerialBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchSerialBuf); + #define MsiGetUserInfo WINELIB_NAME_AW(MsiGetUserInfo) -UINT WINAPI MsiCollectUserInfoA(LPCSTR); -UINT WINAPI MsiCollectUserInfoW(LPCWSTR); +UINT WINAPI MsiCollectUserInfoA(_In_ LPCSTR); +UINT WINAPI MsiCollectUserInfoW(_In_ LPCWSTR); #define MsiCollectUserInfo WINELIB_NAME_AW(MsiCollectUserInfo) -UINT WINAPI MsiReinstallFeatureA(LPCSTR, LPCSTR, DWORD); -UINT WINAPI MsiReinstallFeatureW(LPCWSTR, LPCWSTR, DWORD); +UINT WINAPI MsiReinstallFeatureA(_In_ LPCSTR, _In_ LPCSTR, _In_ DWORD); +UINT WINAPI MsiReinstallFeatureW(_In_ LPCWSTR, _In_ LPCWSTR, _In_ DWORD); #define MsiReinstallFeature WINELIB_NAME_AW(MsiReinstallFeature) -UINT WINAPI MsiGetShortcutTargetA(LPCSTR, LPSTR, LPSTR, LPSTR); -UINT WINAPI MsiGetShortcutTargetW(LPCWSTR, LPWSTR, LPWSTR, LPWSTR); +UINT +WINAPI +MsiGetShortcutTargetA( + _In_ LPCSTR, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPSTR, + _Out_writes_opt_(MAX_FEATURE_CHARS + 1) LPSTR, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPSTR); + +UINT +WINAPI +MsiGetShortcutTargetW( + _In_ LPCWSTR, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPWSTR, + _Out_writes_opt_(MAX_FEATURE_CHARS + 1) LPWSTR, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPWSTR); + #define MsiGetShortcutTarget WINELIB_NAME_AW(MsiGetShortcutTarget) -INSTALLSTATE WINAPI MsiUseFeatureW(LPCWSTR, LPCWSTR); -INSTALLSTATE WINAPI MsiUseFeatureA(LPCSTR, LPCSTR); +INSTALLSTATE WINAPI MsiUseFeatureW(_In_ LPCWSTR, _In_ LPCWSTR); +INSTALLSTATE WINAPI MsiUseFeatureA(_In_ LPCSTR, _In_ LPCSTR); #define MsiUseFeature WINELIB_NAME_AW(MsiUseFeature) -INSTALLSTATE WINAPI MsiUseFeatureExW(LPCWSTR, LPCWSTR, DWORD, DWORD); -INSTALLSTATE WINAPI MsiUseFeatureExA(LPCSTR, LPCSTR, DWORD, DWORD); +INSTALLSTATE +WINAPI +MsiUseFeatureExW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _In_ DWORD, + _Reserved_ DWORD); + +INSTALLSTATE +WINAPI +MsiUseFeatureExA( + _In_ LPCSTR, + _In_ LPCSTR, + _In_ DWORD, + _Reserved_ DWORD); + #define MsiUseFeatureEx WINELIB_NAME_AW(MsiUseFeatureEx) -HRESULT WINAPI MsiGetFileSignatureInformationA(LPCSTR, DWORD, PCCERT_CONTEXT*, LPBYTE, LPDWORD); -HRESULT WINAPI MsiGetFileSignatureInformationW(LPCWSTR, DWORD, PCCERT_CONTEXT*, LPBYTE, LPDWORD); +HRESULT +WINAPI +MsiGetFileSignatureInformationA( + _In_ LPCSTR, + _In_ DWORD, + _Outptr_ PCCERT_CONTEXT*, + _Out_writes_bytes_opt_(*pcbHashData) LPBYTE, + _Inout_opt_ LPDWORD pcbHashData); + +HRESULT +WINAPI +MsiGetFileSignatureInformationW( + _In_ LPCWSTR, + _In_ DWORD, + _Outptr_ PCCERT_CONTEXT*, + _Out_writes_bytes_opt_(*pcbHashData) LPBYTE, + _Inout_opt_ LPDWORD pcbHashData); + #define MsiGetFileSignatureInformation WINELIB_NAME_AW(MsiGetFileSignatureInformation) -INSTALLSTATE WINAPI MsiLocateComponentA(LPCSTR, LPSTR, LPDWORD); -INSTALLSTATE WINAPI MsiLocateComponentW(LPCWSTR, LPWSTR, LPDWORD); +INSTALLSTATE +WINAPI +MsiLocateComponentA( + _In_ LPCSTR, + _Out_writes_opt_(*pcchBuf) LPSTR, + _Inout_opt_ LPDWORD pcchBuf); + +INSTALLSTATE +WINAPI +MsiLocateComponentW( + _In_ LPCWSTR, + _Out_writes_opt_(*pcchBuf) LPWSTR, + _Inout_opt_ LPDWORD pcchBuf); + #define MsiLocateComponent WINELIB_NAME_AW(MsiLocateComponent) -UINT WINAPI MsiSourceListAddSourceA(LPCSTR, LPCSTR, DWORD, LPCSTR); -UINT WINAPI MsiSourceListAddSourceW(LPCWSTR, LPCWSTR, DWORD, LPCWSTR); +UINT +WINAPI +MsiSourceListAddSourceA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _Reserved_ DWORD, + _In_ LPCSTR); + +UINT +WINAPI +MsiSourceListAddSourceW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _Reserved_ DWORD, + _In_ LPCWSTR); + #define MsiSourceListAddSource WINELIB_NAME_AW(MsiSourceListAddSource) -UINT WINAPI MsiSourceListEnumMediaDisksA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPDWORD, - LPSTR, LPDWORD, LPSTR, LPDWORD); -UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPDWORD, - LPWSTR, LPDWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiSourceListEnumMediaDisksA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ DWORD, + _Out_opt_ LPDWORD, + _Out_writes_opt_(*pcchVolumeLabel) LPSTR, + _Inout_opt_ LPDWORD pcchVolumeLabel, + _Out_writes_opt_(*pcchDiskPrompt) LPSTR, + _Inout_opt_ LPDWORD pcchDiskPrompt); + +UINT +WINAPI +MsiSourceListEnumMediaDisksW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ DWORD, + _Out_opt_ LPDWORD, + _Out_writes_opt_(*pcchVolumeLabel) LPWSTR, + _Inout_opt_ LPDWORD pcchVolumeLabel, + _Out_writes_opt_(*pcchDiskPrompt) LPWSTR, + _Inout_opt_ LPDWORD pcchDiskPrompt); + #define MsiSourceListEnumMediaDisks WINELIB_NAME_AW(MsiSourceListEnumMediaDisks) -UINT WINAPI MsiSourceListEnumSourcesA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD); -UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPWSTR, LPDWORD); +UINT +WINAPI +MsiSourceListEnumSourcesA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(*pcchSource) LPSTR, + _Inout_opt_ LPDWORD pcchSource); + +UINT +WINAPI +MsiSourceListEnumSourcesW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(*pcchSource) LPWSTR, + _Inout_opt_ LPDWORD pcchSource); + #define MsiSourceListEnumSources WINELIB_NAME_AW(MsiSourceListEnumSources) -UINT WINAPI MsiSourceListClearSourceA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR); -UINT WINAPI MsiSourceListClearSourceW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, LPCWSTR); +UINT +WINAPI +MsiSourceListClearSourceA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCSTR); + +UINT +WINAPI +MsiSourceListClearSourceW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCWSTR); + #define MsiSourceListClearSource WINELIB_NAME_AW(MsiSourceListClearSource) -UINT WINAPI MsiSourceListClearAllA(LPCSTR, LPCSTR, DWORD); -UINT WINAPI MsiSourceListClearAllW(LPCWSTR, LPCWSTR, DWORD); +UINT +WINAPI +MsiSourceListClearAllA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _Reserved_ DWORD); + +UINT +WINAPI +MsiSourceListClearAllW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _Reserved_ DWORD); + #define MsiSourceListClearAll WINELIB_NAME_AW(MsiSourceListClearAll) -UINT WINAPI MsiSourceListGetInfoA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD); -UINT WINAPI MsiSourceListGetInfoW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, LPCWSTR, LPWSTR, LPDWORD); +UINT +WINAPI +MsiSourceListGetInfoA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCSTR, + _Out_writes_opt_(*pcchValue) LPSTR, + _Inout_opt_ LPDWORD pcchValue); + +UINT +WINAPI +MsiSourceListGetInfoW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCWSTR, + _Out_writes_opt_(*pcchValue) LPWSTR, + _Inout_opt_ LPDWORD pcchValue); + #define MsiSourceListGetInfo WINELIB_NAME_AW(MsiSourceListGetInfo) -UINT WINAPI MsiSourceListSetInfoA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPCSTR); -UINT WINAPI MsiSourceListSetInfoW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, LPCWSTR, LPCWSTR); +UINT +WINAPI +MsiSourceListSetInfoA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCSTR, + _In_ LPCSTR); + +UINT +WINAPI +MsiSourceListSetInfoW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCWSTR, + _In_ LPCWSTR); + #define MsiSourceListSetInfo WINELIB_NAME_AW(MsiSourceListSetInfo) -UINT WINAPI MsiSourceListAddSourceExA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, DWORD); -UINT WINAPI MsiSourceListAddSourceExW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, LPCWSTR, DWORD); +UINT +WINAPI +MsiSourceListAddSourceExA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCSTR, + _In_ DWORD); + +UINT +WINAPI +MsiSourceListAddSourceExW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ LPCWSTR, + _In_ DWORD); + #define MsiSourceListAddSourceEx WINELIB_NAME_AW(MsiSourceListAddSourceEx) -UINT WINAPI MsiSourceListAddMediaDiskA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPCSTR, LPCSTR); -UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPCWSTR, LPCWSTR); +UINT +WINAPI +MsiSourceListAddMediaDiskA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ DWORD, + _In_opt_ LPCSTR, + _In_opt_ LPCSTR); + +UINT +WINAPI +MsiSourceListAddMediaDiskW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD, + _In_ DWORD, + _In_opt_ LPCWSTR, + _In_opt_ LPCWSTR); + #define MsiSourceListAddMediaDisk WINELIB_NAME_AW(MsiSourceListAddMediaDisk) -UINT WINAPI MsiEnumPatchesA(LPCSTR, DWORD, LPSTR, LPSTR, LPDWORD); -UINT WINAPI MsiEnumPatchesW(LPCWSTR, DWORD, LPWSTR, LPWSTR, LPDWORD); +UINT +WINAPI +MsiEnumPatchesA( + _In_ LPCSTR, + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPSTR, + _Out_writes_(*pcchTransformsBuf) LPSTR, + _Inout_ LPDWORD pcchTransformsBuf); + +UINT +WINAPI +MsiEnumPatchesW( + _In_ LPCWSTR, + _In_ DWORD, + _Out_writes_(MAX_GUID_CHARS + 1) LPWSTR, + _Out_writes_(*pcchTransformsBuf) LPWSTR, + _Inout_ LPDWORD pcchTransformsBuf); + #define MsiEnumPatches WINELIB_NAME_AW(MsiEnumPatches) -UINT WINAPI MsiEnumPatchesExA(LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR, LPSTR, - MSIINSTALLCONTEXT*, LPSTR, LPDWORD); -UINT WINAPI MsiEnumPatchesExW(LPCWSTR, LPCWSTR, DWORD, DWORD, DWORD, LPWSTR, LPWSTR, - MSIINSTALLCONTEXT*, LPWSTR, LPDWORD); +UINT +WINAPI +MsiEnumPatchesExA( + _In_opt_ LPCSTR, + _In_opt_ LPCSTR, + _In_ DWORD, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPSTR, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPSTR, + _Out_opt_ MSIINSTALLCONTEXT*, + _Out_writes_opt_(*pcchTargetUserSid) LPSTR, + _Inout_opt_ LPDWORD pcchTargetUserSid); + +UINT +WINAPI +MsiEnumPatchesExW( + _In_opt_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ DWORD, + _In_ DWORD, + _In_ DWORD, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPWSTR, + _Out_writes_opt_(MAX_GUID_CHARS + 1) LPWSTR, + _Out_opt_ MSIINSTALLCONTEXT*, + _Out_writes_opt_(*pcchTargetUserSid) LPWSTR, + _Inout_opt_ LPDWORD pcchTargetUserSid); + #define MsiEnumPatchesEx WINELIB_NAME_AW(MsiEnumPatchesEx) -UINT WINAPI MsiGetFileHashA(LPCSTR, DWORD, PMSIFILEHASHINFO); -UINT WINAPI MsiGetFileHashW(LPCWSTR, DWORD, PMSIFILEHASHINFO); +UINT +WINAPI +MsiGetFileHashA( + _In_ LPCSTR, + _In_ DWORD, + _Inout_ PMSIFILEHASHINFO); + +UINT +WINAPI +MsiGetFileHashW( + _In_ LPCWSTR, + _In_ DWORD, + _Inout_ PMSIFILEHASHINFO); + #define MsiGetFileHash WINELIB_NAME_AW(MsiGetFileHash) -UINT WINAPI MsiAdvertiseScriptA(LPCSTR, DWORD, PHKEY, BOOL); -UINT WINAPI MsiAdvertiseScriptW(LPCWSTR, DWORD, PHKEY, BOOL); +UINT +WINAPI +MsiAdvertiseScriptA( + _In_ LPCSTR, + _In_ DWORD, + _In_opt_ PHKEY, + _In_ BOOL); + +UINT +WINAPI +MsiAdvertiseScriptW( + _In_ LPCWSTR, + _In_ DWORD, + _In_opt_ PHKEY, + _In_ BOOL); + #define MsiAdvertiseScript WINELIB_NAME_AW(MsiAdvertiseScript) -UINT WINAPI MsiIsProductElevatedA(LPCSTR, BOOL *); -UINT WINAPI MsiIsProductElevatedW(LPCWSTR, BOOL *); +UINT WINAPI MsiIsProductElevatedA(_In_ LPCSTR, _Out_ BOOL *); +UINT WINAPI MsiIsProductElevatedW(_In_ LPCWSTR, _Out_ BOOL *); #define MsiIsProductElevated WINELIB_NAME_AW(MsiIsProductElevated) UINT WINAPI MsiDatabaseMergeA(MSIHANDLE, MSIHANDLE, LPCSTR); UINT WINAPI MsiDatabaseMergeW(MSIHANDLE, MSIHANDLE, LPCWSTR); #define MsiDatabaseMerge WINELIB_NAME_AW(MsiDatabaseMerge) -UINT WINAPI MsiInstallMissingComponentA(LPCSTR, LPCSTR, INSTALLSTATE); -UINT WINAPI MsiInstallMissingComponentW(LPCWSTR, LPCWSTR, INSTALLSTATE); +UINT +WINAPI +MsiInstallMissingComponentA( + _In_ LPCSTR, + _In_ LPCSTR, + _In_ INSTALLSTATE); + +UINT +WINAPI +MsiInstallMissingComponentW( + _In_ LPCWSTR, + _In_ LPCWSTR, + _In_ INSTALLSTATE); + #define MsiInstallMissingComponent WINELIB_NAME_AW(MsiInstallMissingComponent) -UINT WINAPI MsiDetermineApplicablePatchesA(LPCSTR, DWORD, PMSIPATCHSEQUENCEINFOA); -UINT WINAPI MsiDetermineApplicablePatchesW(LPCWSTR, DWORD, PMSIPATCHSEQUENCEINFOW); +UINT +WINAPI +MsiDetermineApplicablePatchesA( + _In_ LPCSTR, + _In_ DWORD cPatchInfo, + _Inout_updates_(cPatchInfo) PMSIPATCHSEQUENCEINFOA); + +UINT +WINAPI +MsiDetermineApplicablePatchesW( + _In_ LPCWSTR, + _In_ DWORD cPatchInfo, + _Inout_updates_(cPatchInfo) PMSIPATCHSEQUENCEINFOW); + #define MsiDetermineApplicablePatches WINELIB_NAME_AW(MsiDetermineApplicablePatches) -UINT WINAPI MsiDeterminePatchSequenceA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, PMSIPATCHSEQUENCEINFOA); -UINT WINAPI MsiDeterminePatchSequenceW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, PMSIPATCHSEQUENCEINFOW); +UINT +WINAPI +MsiDeterminePatchSequenceA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD cPatchInfo, + _Inout_updates_(cPatchInfo) PMSIPATCHSEQUENCEINFOA); + +UINT +WINAPI +MsiDeterminePatchSequenceW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_ MSIINSTALLCONTEXT, + _In_ DWORD cPatchInfo, + _Inout_updates_(cPatchInfo) PMSIPATCHSEQUENCEINFOW); + #define MsiDeterminePatchSequence WINELIB_NAME_AW(MsiDeterminePatchSequence) -UINT WINAPI MsiApplyMultiplePatchesA(LPCSTR, LPCSTR, LPCSTR); -UINT WINAPI MsiApplyMultiplePatchesW(LPCWSTR, LPCWSTR, LPCWSTR); +UINT +WINAPI +MsiApplyMultiplePatchesA( + _In_ LPCSTR, + _In_opt_ LPCSTR, + _In_opt_ LPCSTR); + +UINT +WINAPI +MsiApplyMultiplePatchesW( + _In_ LPCWSTR, + _In_opt_ LPCWSTR, + _In_opt_ LPCWSTR); + #define MsiApplyMultiplePatches WINELIB_NAME_AW(MsiApplyMultiplePatches) -UINT WINAPI MsiBeginTransactionA(LPCSTR, DWORD, MSIHANDLE *, HANDLE *); -UINT WINAPI MsiBeginTransactionW(LPCWSTR, DWORD, MSIHANDLE *, HANDLE *); +UINT +WINAPI +MsiBeginTransactionA( + _In_ LPCSTR, + _In_ DWORD, + _Out_ MSIHANDLE *, + _Out_ HANDLE *); + +UINT +WINAPI +MsiBeginTransactionW( + _In_ LPCWSTR, + _In_ DWORD, + _Out_ MSIHANDLE *, + _Out_ HANDLE *); + #define MsiBeginTransaction WINELIB_NAME_AW(MsiBeginTransaction) -UINT WINAPI MsiEndTransaction(DWORD); +UINT WINAPI MsiEndTransaction(_In_ DWORD); /* Non Unicode */ UINT WINAPI MsiCloseHandle(MSIHANDLE); UINT WINAPI MsiCloseAllHandles(void); -INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL, HWND*); -UINT WINAPI MsiSetExternalUIRecord(INSTALLUI_HANDLER_RECORD, DWORD, LPVOID, PINSTALLUI_HANDLER_RECORD); +INSTALLUILEVEL WINAPI MsiSetInternalUI(_In_ INSTALLUILEVEL, _Inout_opt_ HWND*); + +UINT +WINAPI +MsiSetExternalUIRecord( + _In_opt_ INSTALLUI_HANDLER_RECORD, + _In_ DWORD, + _In_opt_ LPVOID, + _Out_opt_ PINSTALLUI_HANDLER_RECORD); #ifdef __cplusplus }
11 years, 2 months
1
0
0
0
[ekohl] 59770: [SAMLIB] SamSetInformationUser.UserAllInformation: Pass hashed passwords to SamrSetInformationUser. [SAMSRV] SampSetUserAll: - Get fixed user data at the start of the function and se...
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Aug 18 13:26:33 2013 New Revision: 59770 URL:
http://svn.reactos.org/svn/reactos?rev=59770&view=rev
Log: [SAMLIB] SamSetInformationUser.UserAllInformation: Pass hashed passwords to SamrSetInformationUser. [SAMSRV] SampSetUserAll: - Get fixed user data at the start of the function and set it only if it has been modified. - Set user password hashes. Modified: trunk/reactos/dll/win32/samlib/samlib.c trunk/reactos/dll/win32/samsrv/samrpc.c Modified: trunk/reactos/dll/win32/samlib/samlib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.c?…
============================================================================== --- trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] Sun Aug 18 13:26:33 2013 @@ -1847,7 +1847,7 @@ { PSAMPR_USER_SET_PASSWORD_INFORMATION PasswordBuffer; SAMPR_USER_INTERNAL1_INFORMATION Internal1Buffer; - PUSER_ALL_INFORMATION AllBuffer; + USER_ALL_INFORMATION InternalAllBuffer; OEM_STRING LmPwdString; CHAR LmPwdBuffer[15]; NTSTATUS Status; @@ -1914,23 +1914,118 @@ if (!NT_SUCCESS(Status)) { TRACE("SamrSetInformation() failed (Status 0x%08lx)\n", Status); - return Status; - } + } + + return Status; } else if (UserInformationClass == UserAllInformation) { - AllBuffer = (PUSER_ALL_INFORMATION)Buffer; - - if (AllBuffer->WhichFields & (USER_ALL_LMPASSWORDPRESENT | USER_ALL_NTPASSWORDPRESENT)) - { - Status = SampCheckPassword(UserHandle, - &AllBuffer->NtPassword); - if (!NT_SUCCESS(Status)) + RtlCopyMemory(&InternalAllBuffer, + Buffer, + sizeof(USER_ALL_INFORMATION)); + + if (InternalAllBuffer.WhichFields & (USER_ALL_LMPASSWORDPRESENT | USER_ALL_NTPASSWORDPRESENT)) + { + if (InternalAllBuffer.WhichFields & USER_ALL_OWFPASSWORD) { - TRACE("SampCheckPassword failed (Status 0x%08lx)\n", Status); - return Status; + /* Check NT password hash */ + if (InternalAllBuffer.WhichFields & USER_ALL_NTPASSWORDPRESENT) + { + if (InternalAllBuffer.NtPassword.Length != sizeof(ENCRYPTED_NT_OWF_PASSWORD)) + return STATUS_INVALID_PARAMETER; + } + + /* Check LM password hash */ + if (InternalAllBuffer.WhichFields & USER_ALL_LMPASSWORDPRESENT) + { + if (InternalAllBuffer.LmPassword.Length != sizeof(ENCRYPTED_LM_OWF_PASSWORD)) + return STATUS_INVALID_PARAMETER; + } } - } + else + { + /* + * Only allow the NT password to be set. + * The LM password will be created here. + */ + if (InternalAllBuffer.WhichFields & USER_ALL_LMPASSWORDPRESENT) + { + TRACE("Do not try to set a clear text LM password!\n"); + return STATUS_INVALID_PARAMETER; + } + + if (InternalAllBuffer.WhichFields & USER_ALL_NTPASSWORDPRESENT) + { + Status = SampCheckPassword(UserHandle, + &InternalAllBuffer.NtPassword); + if (!NT_SUCCESS(Status)) + { + TRACE("SampCheckPassword failed (Status 0x%08lx)\n", Status); + return Status; + } + + /* Calculate the NT password hash */ + Status = SystemFunction007((PUNICODE_STRING)&InternalAllBuffer.NtPassword, + (LPBYTE)&Internal1Buffer.EncryptedNtOwfPassword); + if (!NT_SUCCESS(Status)) + { + TRACE("SystemFunction007 failed (Status 0x%08lx)\n", Status); + return Status; + } + + InternalAllBuffer.NtPasswordPresent = TRUE; + InternalAllBuffer.LmPasswordPresent = FALSE; + + InternalAllBuffer.NtPassword.Length = sizeof(ENCRYPTED_NT_OWF_PASSWORD); + InternalAllBuffer.NtPassword.MaximumLength = sizeof(ENCRYPTED_NT_OWF_PASSWORD); + InternalAllBuffer.NtPassword.Buffer = (LPWSTR)&Internal1Buffer.EncryptedNtOwfPassword; + + /* Build the LM password */ + LmPwdString.Length = 15; + LmPwdString.MaximumLength = 15; + LmPwdString.Buffer = LmPwdBuffer; + ZeroMemory(LmPwdString.Buffer, LmPwdString.MaximumLength); + + Status = RtlUpcaseUnicodeStringToOemString(&LmPwdString, + (PUNICODE_STRING)&InternalAllBuffer.NtPassword, + FALSE); + if (NT_SUCCESS(Status)) + { + /* Calculate the LM password hash */ + Status = SystemFunction006(LmPwdString.Buffer, + (LPSTR)&Internal1Buffer.EncryptedLmOwfPassword); + if (NT_SUCCESS(Status)) + { + InternalAllBuffer.WhichFields |= USER_ALL_LMPASSWORDPRESENT; + InternalAllBuffer.LmPasswordPresent = TRUE; + + InternalAllBuffer.LmPassword.Length = sizeof(ENCRYPTED_LM_OWF_PASSWORD); + InternalAllBuffer.LmPassword.MaximumLength = sizeof(ENCRYPTED_LM_OWF_PASSWORD); + InternalAllBuffer.LmPassword.Buffer = (LPWSTR)&Internal1Buffer.EncryptedLmOwfPassword; + } + } + } + } + } + + RpcTryExcept + { + Status = SamrSetInformationUser((SAMPR_HANDLE)UserHandle, + UserAllInformation, + (PVOID)&InternalAllBuffer); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + if (!NT_SUCCESS(Status)) + { + TRACE("SamrSetInformation() failed (Status 0x%08lx)\n", Status); + } + + return Status; } RpcTryExcept Modified: trunk/reactos/dll/win32/samsrv/samrpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
============================================================================== --- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Sun Aug 18 13:26:33 2013 @@ -7115,9 +7115,24 @@ SAM_USER_FIXED_DATA FixedData; ULONG Length = 0; ULONG WhichFields; + PENCRYPTED_NT_OWF_PASSWORD NtPassword = NULL; + PENCRYPTED_LM_OWF_PASSWORD LmPassword = NULL; + BOOLEAN NtPasswordPresent = FALSE; + BOOLEAN LmPasswordPresent = FALSE; + BOOLEAN WriteFixedData = FALSE; NTSTATUS Status = STATUS_SUCCESS; WhichFields = Buffer->All.WhichFields; + + /* Get the fixed size attributes */ + Length = sizeof(SAM_USER_FIXED_DATA); + Status = SampGetObjectAttribute(UserObject, + L"F", + NULL, + (PVOID)&FixedData, + &Length); + if (!NT_SUCCESS(Status)) + goto done; if (WhichFields & USER_ALL_USERNAME) { @@ -7234,39 +7249,72 @@ goto done; } - if (WhichFields & (USER_ALL_PRIMARYGROUPID | - USER_ALL_ACCOUNTEXPIRES | - USER_ALL_USERACCOUNTCONTROL | - USER_ALL_COUNTRYCODE | - USER_ALL_CODEPAGE)) - { - Length = sizeof(SAM_USER_FIXED_DATA); - Status = SampGetObjectAttribute(UserObject, - L"F", - NULL, - (PVOID)&FixedData, - &Length); + if (WhichFields & USER_ALL_PRIMARYGROUPID) + { + FixedData.PrimaryGroupId = Buffer->All.PrimaryGroupId; + WriteFixedData = TRUE; + } + + if (WhichFields & USER_ALL_ACCOUNTEXPIRES) + { + FixedData.AccountExpires.LowPart = Buffer->All.AccountExpires.LowPart; + FixedData.AccountExpires.HighPart = Buffer->All.AccountExpires.HighPart; + WriteFixedData = TRUE; + } + + if (WhichFields & USER_ALL_USERACCOUNTCONTROL) + { + FixedData.UserAccountControl = Buffer->All.UserAccountControl; + WriteFixedData = TRUE; + } + + if (WhichFields & USER_ALL_COUNTRYCODE) + { + FixedData.CountryCode = Buffer->All.CountryCode; + WriteFixedData = TRUE; + } + + if (WhichFields & USER_ALL_CODEPAGE) + { + FixedData.CodePage = Buffer->All.CodePage; + WriteFixedData = TRUE; + } + + if (WhichFields & (USER_ALL_NTPASSWORDPRESENT | + USER_ALL_LMPASSWORDPRESENT)) + { + if (WhichFields & USER_ALL_NTPASSWORDPRESENT) + { + NtPassword = (PENCRYPTED_NT_OWF_PASSWORD)Buffer->All.NtOwfPassword.Buffer; + NtPasswordPresent = Buffer->All.NtPasswordPresent; + } + + if (WhichFields & USER_ALL_LMPASSWORDPRESENT) + { + LmPassword = (PENCRYPTED_LM_OWF_PASSWORD)Buffer->All.LmOwfPassword.Buffer; + LmPasswordPresent = Buffer->All.LmPasswordPresent; + } + + Status = SampSetUserPassword(UserObject, + NtPassword, + NtPasswordPresent, + LmPassword, + LmPasswordPresent); if (!NT_SUCCESS(Status)) goto done; - if (WhichFields & USER_ALL_PRIMARYGROUPID) - FixedData.PrimaryGroupId = Buffer->All.PrimaryGroupId; - - if (WhichFields & USER_ALL_ACCOUNTEXPIRES) - { - FixedData.AccountExpires.LowPart = Buffer->All.AccountExpires.LowPart; - FixedData.AccountExpires.HighPart = Buffer->All.AccountExpires.HighPart; - } - - if (WhichFields & USER_ALL_USERACCOUNTCONTROL) - FixedData.UserAccountControl = Buffer->All.UserAccountControl; - - if (WhichFields & USER_ALL_COUNTRYCODE) - FixedData.CountryCode = Buffer->Preferences.CountryCode; - - if (WhichFields & USER_ALL_CODEPAGE) - FixedData.CodePage = Buffer->Preferences.CodePage; - + /* The password has just been set */ + Status = NtQuerySystemTime(&FixedData.PasswordLastSet); + if (!NT_SUCCESS(Status)) + goto done; + + WriteFixedData = TRUE; + } + + /* FIXME: USER_ALL_PASSWORDEXPIRED */ + + if (WriteFixedData == TRUE) + { Status = SampSetObjectAttribute(UserObject, L"F", REG_BINARY, @@ -7276,15 +7324,7 @@ goto done; } -/* -FIXME: - USER_ALL_NTPASSWORDPRESENT - USER_ALL_LMPASSWORDPRESENT - USER_ALL_PASSWORDEXPIRED -*/ - done: - return Status; }
11 years, 2 months
1
0
0
0
[ekohl] 59769: [SAMSRV] SampSetUserPassword: Fix check for vaild password hashes.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Aug 18 11:33:51 2013 New Revision: 59769 URL:
http://svn.reactos.org/svn/reactos?rev=59769&view=rev
Log: [SAMSRV] SampSetUserPassword: Fix check for vaild password hashes. Modified: trunk/reactos/dll/win32/samsrv/user.c Modified: trunk/reactos/dll/win32/samsrv/user.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/user.c?re…
============================================================================== --- trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] Sun Aug 18 11:33:51 2013 @@ -402,12 +402,14 @@ NTSTATUS Status; UseNtPassword = - ((memcmp(NtPassword, &EmptyNtHash, sizeof(ENCRYPTED_NT_OWF_PASSWORD)) != 0) && - (NtPasswordPresent != FALSE)); + ((NtPasswordPresent != FALSE) && + (NtPassword != NULL) && + (memcmp(NtPassword, &EmptyNtHash, sizeof(ENCRYPTED_NT_OWF_PASSWORD)) != 0)); UseLmPassword = - ((memcmp(LmPassword, &EmptyLmHash, sizeof(ENCRYPTED_LM_OWF_PASSWORD)) != 0) && - (LmPasswordPresent != FALSE)); + ((LmPasswordPresent != FALSE) && + (LmPassword != NULL) && + (memcmp(LmPassword, &EmptyLmHash, sizeof(ENCRYPTED_LM_OWF_PASSWORD)) != 0)); /* Update the NT password history only if we have a new non-empty NT password */ if (UseNtPassword)
11 years, 2 months
1
0
0
0
[akhaldi] 59768: [PSDK] * Apply some formatting consistency in ks.h.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Aug 17 23:51:10 2013 New Revision: 59768 URL:
http://svn.reactos.org/svn/reactos?rev=59768&view=rev
Log: [PSDK] * Apply some formatting consistency in ks.h. Modified: trunk/reactos/include/psdk/ks.h Modified: trunk/reactos/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ks.h?rev=5976…
============================================================================== --- trunk/reactos/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ks.h [iso-8859-1] Sat Aug 17 23:51:10 2013 @@ -51,15 +51,15 @@ #define KSSTRING_AllocatorEx L"{091BB63B-603F-11D1-B067-00A0C9062802}" #define KSSTRING_TopologyNode L"{0621061A-EE75-11D0-B915-00A0C9223196}" -#define KSDATAFORMAT_BIT_ATTRIBUTES 1 -#define KSDATAFORMAT_ATTRIBUTES (1 << KSDATAFORMAT_BIT_ATTRIBUTES) +#define KSDATAFORMAT_BIT_ATTRIBUTES 1 +#define KSDATAFORMAT_ATTRIBUTES (1 << KSDATAFORMAT_BIT_ATTRIBUTES) #if defined(_NTDDK_) typedef PVOID PKSWORKER; #endif #ifndef SIZEOF_ARRAY - #define SIZEOF_ARRAY(a) (sizeof(a)/sizeof((a)[0])) +#define SIZEOF_ARRAY(a) (sizeof(a)/sizeof((a)[0])) #endif /* =============================================================== @@ -67,33 +67,38 @@ */ #ifndef _NTRTL_ - #ifndef DEFINE_GUIDEX - #ifdef _MSC_VER - #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name - #else - #define DEFINE_GUIDEX(name) EXTERN_C const GUID name - #endif - #endif - - #ifndef STATICGUIDOF - #define STATICGUIDOF(guid) STATIC_##guid - #endif + +#ifndef DEFINE_GUIDEX +#ifdef _MSC_VER +#define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name +#else +#define DEFINE_GUIDEX(name) EXTERN_C const GUID name #endif +#endif /* !DEFINE_GUIDEX */ + +#ifndef STATICGUIDOF +#define STATICGUIDOF(guid) STATIC_##guid +#endif + +#endif /* !_NTRTL_ */ #if defined(__cplusplus) - #if _MSC_VER >= 1100 - #define DEFINE_GUIDSTRUCT(guid, name) struct __declspec(uuid(guid)) name - #define DEFINE_GUIDNAMED(name) __uuidof(struct name) - #else - #define DEFINE_GUIDSTRUCT(guid, name) \ - extern const DECLSPEC_SELECTANY GUID __uuid__##name={STATIC_##name}; - #define DEFINE_GUIDNAMED(name) __uuid__##name - #endif + +#if _MSC_VER >= 1100 +#define DEFINE_GUIDSTRUCT(guid, name) struct __declspec(uuid(guid)) name +#define DEFINE_GUIDNAMED(name) __uuidof(struct name) #else - #define DEFINE_GUIDSTRUCT(guid, name) DEFINE_GUIDEX(name) - #define DEFINE_GUIDNAMED(name) name +#define DEFINE_GUIDSTRUCT(guid, name) \ + extern const DECLSPEC_SELECTANY GUID __uuid__##name={STATIC_##name}; +#define DEFINE_GUIDNAMED(name) __uuid__##name #endif +#else /* __cplusplus */ + +#define DEFINE_GUIDSTRUCT(guid, name) DEFINE_GUIDEX(name) +#define DEFINE_GUIDNAMED(name) name + +#endif /* __cplusplus */ #define STATIC_GUID_NULL \ 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} @@ -165,7 +170,6 @@ METHOD_NEITHER, \ FILE_ANY_ACCESS) - /* =============================================================== Categories */ @@ -249,11 +253,10 @@ Common */ -typedef struct -{ - GUID Set; - ULONG Id; - ULONG Flags; +typedef struct { + GUID Set; + ULONG Id; + ULONG Flags; } KSIDENTIFIER, *PKSIDENTIFIER; typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY; @@ -266,26 +269,23 @@ typedef KSIDENTIFIER KSPIN_MEDIUM, *PKSPIN_MEDIUM; typedef union { - struct { - ULONG FormatSize; - ULONG Flags; - ULONG SampleSize; - ULONG Reserved; - GUID MajorFormat; - GUID SubFormat; - GUID Specifier; - }; - LONGLONG Alignment; + struct { + ULONG FormatSize; + ULONG Flags; + ULONG SampleSize; + ULONG Reserved; + GUID MajorFormat; + GUID SubFormat; + GUID Specifier; + }; + LONGLONG Alignment; } KSDATAFORMAT, *PKSDATAFORMAT, KSDATARANGE, *PKSDATARANGE; - -typedef struct -{ - ULONG Size; - ULONG Flags; - GUID Attribute; +typedef struct { + ULONG Size; + ULONG Flags; + GUID Attribute; } KSATTRIBUTE, *PKSATTRIBUTE; - /* =============================================================== @@ -294,103 +294,91 @@ #if 0 #define KSINTERFACESETID_Media - #define KSINTERFACE_STANDARD_STREAMING #define KSINTERFACE_STANDARD_LOOPED_STREAMING #define KSINTERFACE_STANDARD_CONTROL #endif #define STATIC_KSINTERFACESETID_Standard \ - 0x1A8766A0L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0x1A8766A0L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("1A8766A0-62CE-11CF-A5D6-28DB04C10000", KSINTERFACESETID_Standard); #define KSINTERFACESETID_Standard DEFINE_GUIDNAMED(KSINTERFACESETID_Standard) -typedef enum -{ - KSINTERFACE_STANDARD_STREAMING, - KSINTERFACE_STANDARD_LOOPED_STREAMING, - KSINTERFACE_STANDARD_CONTROL +typedef enum { + KSINTERFACE_STANDARD_STREAMING, + KSINTERFACE_STANDARD_LOOPED_STREAMING, + KSINTERFACE_STANDARD_CONTROL } KSINTERFACE_STANDARD; #define STATIC_KSINTERFACESETID_FileIo \ - 0x8C6F932CL, 0xE771, 0x11D0, {0xB8, 0xFF, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + 0x8C6F932CL, 0xE771, 0x11D0, {0xB8, 0xFF, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} DEFINE_GUIDSTRUCT("8C6F932C-E771-11D0-B8FF-00A0C9223196", KSINTERFACESETID_FileIo); #define KSINTERFACESETID_FileIo DEFINE_GUIDNAMED(KSINTERFACESETID_FileIo) - - - /* =============================================================== Mediums */ -typedef enum -{ - KSINTERFACE_FILEIO_STREAMING +typedef enum { + KSINTERFACE_FILEIO_STREAMING } KSINTERFACE_FILEIO; #define KSMEDIUM_TYPE_ANYINSTANCE 0 #define STATIC_KSMEDIUMSETID_Standard \ - 0x4747B320L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0x4747B320L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("4747B320-62CE-11CF-A5D6-28DB04C10000", KSMEDIUMSETID_Standard); #define KSMEDIUMSETID_Standard DEFINE_GUIDNAMED(KSMEDIUMSETID_Standard) - /* =============================================================== Clock Properties/Methods/Events */ #define STATIC_KSPROPSETID_Clock \ - 0xDF12A4C0L, 0xAC17, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0xDF12A4C0L, 0xAC17, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("DF12A4C0-AC17-11CF-A5D6-28DB04C10000", KSPROPSETID_Clock); #define KSPROPSETID_Clock DEFINE_GUIDNAMED(KSPROPSETID_Clock) -typedef enum -{ - KSPROPERTY_CLOCK_TIME, - KSPROPERTY_CLOCK_PHYSICALTIME, - KSPROPERTY_CLOCK_CORRELATEDTIME, - KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME, - KSPROPERTY_CLOCK_RESOLUTION, - KSPROPERTY_CLOCK_STATE, +typedef enum { + KSPROPERTY_CLOCK_TIME, + KSPROPERTY_CLOCK_PHYSICALTIME, + KSPROPERTY_CLOCK_CORRELATEDTIME, + KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME, + KSPROPERTY_CLOCK_RESOLUTION, + KSPROPERTY_CLOCK_STATE, #if defined(_NTDDK_) - KSPROPERTY_CLOCK_FUNCTIONTABLE + KSPROPERTY_CLOCK_FUNCTIONTABLE #endif // defined(_NTDDK_) } KSPROPERTY_CLOCK; #define STATIC_KSEVENTSETID_Clock \ - 0x364D8E20L, 0x62C7, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0x364D8E20L, 0x62C7, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("364D8E20-62C7-11CF-A5D6-28DB04C10000", KSEVENTSETID_Clock); #define KSEVENTSETID_Clock DEFINE_GUIDNAMED(KSEVENTSETID_Clock) -typedef enum -{ - KSEVENT_CLOCK_INTERVAL_MARK, - KSEVENT_CLOCK_POSITION_MARK +typedef enum { + KSEVENT_CLOCK_INTERVAL_MARK, + KSEVENT_CLOCK_POSITION_MARK } KSEVENT_CLOCK_POSITION; - /* =============================================================== Connection Properties/Methods/Events */ #define STATIC_KSPROPSETID_Connection \ - 0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("1D58C920-AC9B-11CF-A5D6-28DB04C10000", KSPROPSETID_Connection); #define KSPROPSETID_Connection DEFINE_GUIDNAMED(KSPROPSETID_Connection) - -typedef enum -{ - KSPROPERTY_CONNECTION_STATE, - KSPROPERTY_CONNECTION_PRIORITY, - KSPROPERTY_CONNECTION_DATAFORMAT, - KSPROPERTY_CONNECTION_ALLOCATORFRAMING, - KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT, - KSPROPERTY_CONNECTION_ACQUIREORDERING, - KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX, - KSPROPERTY_CONNECTION_STARTAT +typedef enum { + KSPROPERTY_CONNECTION_STATE, + KSPROPERTY_CONNECTION_PRIORITY, + KSPROPERTY_CONNECTION_DATAFORMAT, + KSPROPERTY_CONNECTION_ALLOCATORFRAMING, + KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT, + KSPROPERTY_CONNECTION_ACQUIREORDERING, + KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX, + KSPROPERTY_CONNECTION_STARTAT } KSPROPERTY_CONNECTION; #define DEFINE_KSPROPERTY_ITEM_CONNECTION_STATE(GetHandler, SetHandler)\ @@ -462,16 +450,13 @@ (Handler),\ NULL, 0, NULL, NULL, 0) - -typedef enum -{ - KSEVENT_CONNECTION_POSITIONUPDATE, - KSEVENT_CONNECTION_DATADISCONTINUITY, - KSEVENT_CONNECTION_TIMEDISCONTINUITY, - KSEVENT_CONNECTION_PRIORITY, - KSEVENT_CONNECTION_ENDOFSTREAM +typedef enum { + KSEVENT_CONNECTION_POSITIONUPDATE, + KSEVENT_CONNECTION_DATADISCONTINUITY, + KSEVENT_CONNECTION_TIMEDISCONTINUITY, + KSEVENT_CONNECTION_PRIORITY, + KSEVENT_CONNECTION_ENDOFSTREAM } KSEVENT_CONNECTION; - /* =============================================================== General @@ -479,16 +464,13 @@ */ #define STATIC_KSPROPSETID_General\ - 0x1464EDA5L, 0x6A8F, 0x11D1, {0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + 0x1464EDA5L, 0x6A8F, 0x11D1, {0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} DEFINE_GUIDSTRUCT("1464EDA5-6A8F-11D1-9AA7-00A0C9223196", KSPROPSETID_General); #define KSPROPSETID_General DEFINE_GUIDNAMED(KSPROPSETID_General) - -typedef enum -{ - KSPROPERTY_GENERAL_COMPONENTID +typedef enum { + KSPROPERTY_GENERAL_COMPONENTID } KSPROPERTY_GENERAL; - /* =============================================================== Graph Manager @@ -496,16 +478,14 @@ */ #define KSPROPSETID_GM \ - 0xAF627536L, 0xE719, 0x11D2, {0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D} - -typedef enum -{ - KSPROPERTY_GM_GRAPHMANAGER, - KSPROPERTY_GM_TIMESTAMP_CLOCK, - KSPROPERTY_GM_RATEMATCH, - KSPROPERTY_GM_RENDERCLOCK + 0xAF627536L, 0xE719, 0x11D2, {0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D} + +typedef enum { + KSPROPERTY_GM_GRAPHMANAGER, + KSPROPERTY_GM_TIMESTAMP_CLOCK, + KSPROPERTY_GM_RATEMATCH, + KSPROPERTY_GM_RENDERCLOCK } KSPROPERTY_GM; - /* =============================================================== Media Seeking @@ -513,60 +493,60 @@ */ #define STATIC_KSPROPSETID_MediaSeeking\ - 0xEE904F0CL, 0xD09B, 0x11D0, {0xAB, 0xE9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + 0xEE904F0CL, 0xD09B, 0x11D0, {0xAB, 0xE9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} DEFINE_GUIDSTRUCT("EE904F0C-D09B-11D0-ABE9-00A0C9223196", KSPROPSETID_MediaSeeking); #define KSPROPSETID_MediaSeeking DEFINE_GUIDNAMED(KSPROPSETID_MediaSeeking) typedef enum { - KSPROPERTY_MEDIASEEKING_CAPABILITIES, - KSPROPERTY_MEDIASEEKING_FORMATS, - KSPROPERTY_MEDIASEEKING_TIMEFORMAT, - KSPROPERTY_MEDIASEEKING_POSITION, - KSPROPERTY_MEDIASEEKING_STOPPOSITION, - KSPROPERTY_MEDIASEEKING_POSITIONS, - KSPROPERTY_MEDIASEEKING_DURATION, - KSPROPERTY_MEDIASEEKING_AVAILABLE, - KSPROPERTY_MEDIASEEKING_PREROLL, - KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT + KSPROPERTY_MEDIASEEKING_CAPABILITIES, + KSPROPERTY_MEDIASEEKING_FORMATS, + KSPROPERTY_MEDIASEEKING_TIMEFORMAT, + KSPROPERTY_MEDIASEEKING_POSITION, + KSPROPERTY_MEDIASEEKING_STOPPOSITION, + KSPROPERTY_MEDIASEEKING_POSITIONS, + KSPROPERTY_MEDIASEEKING_DURATION, + KSPROPERTY_MEDIASEEKING_AVAILABLE, + KSPROPERTY_MEDIASEEKING_PREROLL, + KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT } KSPROPERTY_MEDIASEEKING; typedef enum { - KS_SEEKING_NoPositioning, - KS_SEEKING_AbsolutePositioning, - KS_SEEKING_RelativePositioning, - KS_SEEKING_IncrementalPositioning, - KS_SEEKING_PositioningBitsMask = 0x3, - KS_SEEKING_SeekToKeyFrame, - KS_SEEKING_ReturnTime = 0x8 + KS_SEEKING_NoPositioning, + KS_SEEKING_AbsolutePositioning, + KS_SEEKING_RelativePositioning, + KS_SEEKING_IncrementalPositioning, + KS_SEEKING_PositioningBitsMask = 0x3, + KS_SEEKING_SeekToKeyFrame, + KS_SEEKING_ReturnTime = 0x8 } KS_SEEKING_FLAGS; typedef enum { - KS_SEEKING_CanSeekAbsolute = 0x1, - KS_SEEKING_CanSeekForwards = 0x2, - KS_SEEKING_CanSeekBackwards = 0x4, - KS_SEEKING_CanGetCurrentPos = 0x8, - KS_SEEKING_CanGetStopPos = 0x10, - KS_SEEKING_CanGetDuration = 0x20, - KS_SEEKING_CanPlayBackwards = 0x40 + KS_SEEKING_CanSeekAbsolute = 0x1, + KS_SEEKING_CanSeekForwards = 0x2, + KS_SEEKING_CanSeekBackwards = 0x4, + KS_SEEKING_CanGetCurrentPos = 0x8, + KS_SEEKING_CanGetStopPos = 0x10, + KS_SEEKING_CanGetDuration = 0x20, + KS_SEEKING_CanPlayBackwards = 0x40 } KS_SEEKING_CAPABILITIES; typedef struct { - LONGLONG Current; - LONGLONG Stop; - KS_SEEKING_FLAGS CurrentFlags; - KS_SEEKING_FLAGS StopFlags; + LONGLONG Current; + LONGLONG Stop; + KS_SEEKING_FLAGS CurrentFlags; + KS_SEEKING_FLAGS StopFlags; } KSPROPERTY_POSITIONS, *PKSPROPERTY_POSITIONS; typedef struct { - LONGLONG Earliest; - LONGLONG Latest; + LONGLONG Earliest; + LONGLONG Latest; } KSPROPERTY_MEDIAAVAILABLE, *PKSPROPERTY_MEDIAAVAILABLE; typedef struct { - KSPROPERTY Property; - GUID SourceFormat; - GUID TargetFormat; - LONGLONG Time; + KSPROPERTY Property; + GUID SourceFormat; + GUID TargetFormat; + LONGLONG Time; } KSP_TIMEFORMAT, *PKSP_TIMEFORMAT; #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_CAPABILITIES(Handler)\ @@ -657,57 +637,51 @@ */ #define STATIC_KSPROPSETID_Pin\ - 0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00} + 0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("8C134960-51AD-11CF-878A-94F801C10000", KSPROPSETID_Pin); #define KSPROPSETID_Pin DEFINE_GUIDNAMED(KSPROPSETID_Pin) #define STATIC_KSNAME_Pin\ - 0x146F1A80L, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0x146F1A80L, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("146F1A80-4791-11D0-A5D6-28DB04C10000", KSNAME_Pin); #define KSNAME_Pin DEFINE_GUIDNAMED(KSNAME_Pin) - -typedef enum -{ - KSPROPERTY_PIN_CINSTANCES, - KSPROPERTY_PIN_CTYPES, - KSPROPERTY_PIN_DATAFLOW, - KSPROPERTY_PIN_DATARANGES, - KSPROPERTY_PIN_DATAINTERSECTION, - KSPROPERTY_PIN_INTERFACES, - KSPROPERTY_PIN_MEDIUMS, - KSPROPERTY_PIN_COMMUNICATION, - KSPROPERTY_PIN_GLOBALCINSTANCES, - KSPROPERTY_PIN_NECESSARYINSTANCES, - KSPROPERTY_PIN_PHYSICALCONNECTION, - KSPROPERTY_PIN_CATEGORY, - KSPROPERTY_PIN_NAME, - KSPROPERTY_PIN_CONSTRAINEDDATARANGES, - KSPROPERTY_PIN_PROPOSEDATAFORMAT +typedef enum { + KSPROPERTY_PIN_CINSTANCES, + KSPROPERTY_PIN_CTYPES, + KSPROPERTY_PIN_DATAFLOW, + KSPROPERTY_PIN_DATARANGES, + KSPROPERTY_PIN_DATAINTERSECTION, + KSPROPERTY_PIN_INTERFACES, + KSPROPERTY_PIN_MEDIUMS, + KSPROPERTY_PIN_COMMUNICATION, + KSPROPERTY_PIN_GLOBALCINSTANCES, + KSPROPERTY_PIN_NECESSARYINSTANCES, + KSPROPERTY_PIN_PHYSICALCONNECTION, + KSPROPERTY_PIN_CATEGORY, + KSPROPERTY_PIN_NAME, + KSPROPERTY_PIN_CONSTRAINEDDATARANGES, + KSPROPERTY_PIN_PROPOSEDATAFORMAT } KSPROPERTY_PIN; -typedef struct -{ - KSPROPERTY Property; - ULONG PinId; - ULONG Reserved; +typedef struct { + KSPROPERTY Property; + ULONG PinId; + ULONG Reserved; } KSP_PIN, *PKSP_PIN; -#define KSINSTANCE_INDETERMINATE ((ULONG)-1) - -typedef struct -{ - ULONG PossibleCount; - ULONG CurrentCount; +#define KSINSTANCE_INDETERMINATE ((ULONG)-1) + +typedef struct { + ULONG PossibleCount; + ULONG CurrentCount; } KSPIN_CINSTANCES, *PKSPIN_CINSTANCES; -typedef struct -{ - ULONG Size; - ULONG Pin; - WCHAR SymbolicLinkName[1]; +typedef struct { + ULONG Size; + ULONG Pin; + WCHAR SymbolicLinkName[1]; } KSPIN_PHYSICALCONNECTION, *PKSPIN_PHYSICALCONNECTION; - /* =============================================================== Quality @@ -715,14 +689,12 @@ */ #define KSPROPSETID_Quality \ - 0xD16AD380L, 0xAC1A, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 - -typedef enum -{ - KSPROPERTY_QUALITY_REPORT, - KSPROPERTY_QUALITY_ERROR + 0xD16AD380L, 0xAC1A, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 + +typedef enum { + KSPROPERTY_QUALITY_REPORT, + KSPROPERTY_QUALITY_ERROR } KSPROPERTY_QUALITY; - /* =============================================================== Stream @@ -730,23 +702,22 @@ */ #define STATIC_KSPROPSETID_Stream\ - 0x65aaba60L, 0x98ae, 0x11cf, {0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4} + 0x65aaba60L, 0x98ae, 0x11cf, {0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4} DEFINE_GUIDSTRUCT("65aaba60-98ae-11cf-a10d-0020afd156e4", KSPROPSETID_Stream); #define KSPROPSETID_Stream DEFINE_GUIDNAMED(KSPROPSETID_Stream) -typedef enum -{ - KSPROPERTY_STREAM_ALLOCATOR, - KSPROPERTY_STREAM_QUALITY, - KSPROPERTY_STREAM_DEGRADATION, - KSPROPERTY_STREAM_MASTERCLOCK, - KSPROPERTY_STREAM_TIMEFORMAT, - KSPROPERTY_STREAM_PRESENTATIONTIME, - KSPROPERTY_STREAM_PRESENTATIONEXTENT, - KSPROPERTY_STREAM_FRAMETIME, - KSPROPERTY_STREAM_RATECAPABILITY, - KSPROPERTY_STREAM_RATE, - KSPROPERTY_STREAM_PIPE_ID +typedef enum { + KSPROPERTY_STREAM_ALLOCATOR, + KSPROPERTY_STREAM_QUALITY, + KSPROPERTY_STREAM_DEGRADATION, + KSPROPERTY_STREAM_MASTERCLOCK, + KSPROPERTY_STREAM_TIMEFORMAT, + KSPROPERTY_STREAM_PRESENTATIONTIME, + KSPROPERTY_STREAM_PRESENTATIONEXTENT, + KSPROPERTY_STREAM_FRAMETIME, + KSPROPERTY_STREAM_RATECAPABILITY, + KSPROPERTY_STREAM_RATE, + KSPROPERTY_STREAM_PIPE_ID } KSPROPERTY_STREAM; #define DEFINE_KSPROPERTY_ITEM_STREAM_ALLOCATOR(GetHandler, SetHandler)\ @@ -849,34 +820,29 @@ */ #define STATIC_KSPROPSETID_StreamAllocator\ - 0xcf6e4342L, 0xec87, 0x11cf, {0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4} + 0xcf6e4342L, 0xec87, 0x11cf, {0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4} DEFINE_GUIDSTRUCT("cf6e4342-ec87-11cf-a130-0020afd156e4", KSPROPSETID_StreamAllocator); #define KSPROPSETID_StreamAllocator DEFINE_GUIDNAMED(KSPROPSETID_StreamAllocator) -typedef enum -{ - KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE, - KSPROPERTY_STREAMALLOCATOR_STATUS +typedef enum { + KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE, + KSPROPERTY_STREAMALLOCATOR_STATUS } KSPROPERTY_STREAMALLOCATOR; #define KSMETHODSETID_StreamAllocator \ - 0xcf6e4341L, 0xec87, 0x11cf, {0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4} - -typedef enum -{ - KSMETHOD_STREAMALLOCATOR_ALLOC, - KSMETHOD_STREAMALLOCATOR_FREE + 0xcf6e4341L, 0xec87, 0x11cf, {0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4} + +typedef enum { + KSMETHOD_STREAMALLOCATOR_ALLOC, + KSMETHOD_STREAMALLOCATOR_FREE } KSMETHOD_STREAMALLOCATOR; - #define KSEVENTSETID_StreamAllocator -typedef enum -{ - KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME, - KSEVENT_STREAMALLOCATOR_FREEFRAME +typedef enum { + KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME, + KSEVENT_STREAMALLOCATOR_FREEFRAME } KSEVENT_STREAMALLOCATOR; - /* =============================================================== StreamInterface @@ -884,13 +850,11 @@ */ #define KSPROPSETID_StreamInterface \ - 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a - -typedef enum -{ - KSPROPERTY_STREAMINTERFACE_HEADERSIZE + 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a + +typedef enum { + KSPROPERTY_STREAMINTERFACE_HEADERSIZE } KSPROPERTY_STREAMINTERFACE; - /* =============================================================== Topology @@ -898,15 +862,15 @@ */ #define STATIC_KSPROPSETID_Topology\ - 0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("720D4AC0-7533-11D0-A5D6-28DB04C10000", KSPROPSETID_Topology); #define KSPROPSETID_Topology DEFINE_GUIDNAMED(KSPROPSETID_Topology) typedef enum { - KSPROPERTY_TOPOLOGY_CATEGORIES, - KSPROPERTY_TOPOLOGY_NODES, - KSPROPERTY_TOPOLOGY_CONNECTIONS, - KSPROPERTY_TOPOLOGY_NAME + KSPROPERTY_TOPOLOGY_CATEGORIES, + KSPROPERTY_TOPOLOGY_NODES, + KSPROPERTY_TOPOLOGY_CONNECTIONS, + KSPROPERTY_TOPOLOGY_NAME } KSPROPERTY_TOPOLOGY; /* =============================================================== @@ -914,7 +878,7 @@ */ #define STATIC_KSPROPTYPESETID_General \ - 0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} + 0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_General); #define KSPROPTYPESETID_General DEFINE_GUIDNAMED(KSPROPTYPESETID_General) @@ -1065,51 +1029,43 @@ KSNODETYPE_VOLUME */ - -typedef PVOID KSDEVICE_HEADER, - KSOBJECT_HEADER, - KSOBJECT_BAG; - - - +typedef PVOID KSDEVICE_HEADER, KSOBJECT_HEADER, KSOBJECT_BAG; /* =============================================================== Method Types */ -#define KSMETHOD_TYPE_NONE 0x00000000 -#define KSMETHOD_TYPE_READ 0x00000001 -#define KSMETHOD_TYPE_WRITE 0x00000002 -#define KSMETHOD_TYPE_MODIFY 0x00000003 -#define KSMETHOD_TYPE_SOURCE 0x00000004 -#define KSMETHOD_TYPE_SEND 0x00000001 -#define KSMETHOD_TYPE_SETSUPPORT 0x00000100 -#define KSMETHOD_TYPE_BASICSUPPORT 0x00000200 - +#define KSMETHOD_TYPE_NONE 0x00000000 +#define KSMETHOD_TYPE_READ 0x00000001 +#define KSMETHOD_TYPE_WRITE 0x00000002 +#define KSMETHOD_TYPE_MODIFY 0x00000003 +#define KSMETHOD_TYPE_SOURCE 0x00000004 +#define KSMETHOD_TYPE_SEND 0x00000001 +#define KSMETHOD_TYPE_SETSUPPORT 0x00000100 +#define KSMETHOD_TYPE_BASICSUPPORT 0x00000200 /* =============================================================== Property Types */ -#define KSPROPERTY_TYPE_GET 0x00000001 -#define KSPROPERTY_TYPE_SET 0x00000002 -#define KSPROPERTY_TYPE_SETSUPPORT 0x00000100 -#define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200 -#define KSPROPERTY_TYPE_RELATIONS 0x00000400 -#define KSPROPERTY_TYPE_SERIALIZESET 0x00000800 -#define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000 -#define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000 -#define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000 -#define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000 -#define KSPROPERTY_TYPE_DEFAULT_VALUES 0x00010000 - +#define KSPROPERTY_TYPE_GET 0x00000001 +#define KSPROPERTY_TYPE_SET 0x00000002 +#define KSPROPERTY_TYPE_SETSUPPORT 0x00000100 +#define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200 +#define KSPROPERTY_TYPE_RELATIONS 0x00000400 +#define KSPROPERTY_TYPE_SERIALIZESET 0x00000800 +#define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000 +#define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000 +#define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000 +#define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000 +#define KSPROPERTY_TYPE_DEFAULT_VALUES 0x00010000 /* =============================================================== Topology Methods/Properties */ -#define KSMETHOD_TYPE_TOPOLOGY 0x10000000 -#define KSPROPERTY_TYPE_TOPOLOGY 0x10000000 +#define KSMETHOD_TYPE_TOPOLOGY 0x10000000 +#define KSPROPERTY_TYPE_TOPOLOGY 0x10000000 /* #define DEFINE_KS_GUID(GA,GB,GC,GD,GE,GF,GG,GH,GI,GJ,GK) \ @@ -1221,10 +1177,9 @@ */ #define STATIC_KSDATAFORMAT_SPECIFIER_NONE\ - 0x0F6417D6L, 0xC318, 0x11D0, {0xA4, 0x3F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + 0x0F6417D6L, 0xC318, 0x11D0, {0xA4, 0x3F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} DEFINE_GUIDSTRUCT("0F6417D6-C318-11D0-A43F-00A0C9223196", KSDATAFORMAT_SPECIFIER_NONE); #define KSDATAFORMAT_SPECIFIER_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_NONE) - /* =============================================================== KSMEMORY_TYPE_xxx @@ -1274,244 +1229,224 @@ #endif - -typedef enum -{ - KsObjectTypeDevice, - KsObjectTypeFilterFactory, - KsObjectTypeFilter, - KsObjectTypePin +typedef enum { + KsObjectTypeDevice, + KsObjectTypeFilterFactory, + KsObjectTypeFilter, + KsObjectTypePin } KSOBJECTTYPE; -typedef enum -{ - KSSTATE_STOP, - KSSTATE_ACQUIRE, - KSSTATE_PAUSE, - KSSTATE_RUN +typedef enum { + KSSTATE_STOP, + KSSTATE_ACQUIRE, + KSSTATE_PAUSE, + KSSTATE_RUN } KSSTATE, *PKSSTATE; -typedef enum -{ - KSTARGET_STATE_DISABLED, - KSTARGET_STATE_ENABLED +typedef enum { + KSTARGET_STATE_DISABLED, + KSTARGET_STATE_ENABLED } KSTARGET_STATE; -typedef enum -{ - KSRESET_BEGIN, - KSRESET_END +typedef enum { + KSRESET_BEGIN, + KSRESET_END } KSRESET; -typedef enum -{ - KSEVENTS_NONE, - KSEVENTS_SPINLOCK, - KSEVENTS_MUTEX, - KSEVENTS_FMUTEX, - KSEVENTS_FMUTEXUNSAFE, - KSEVENTS_INTERRUPT, - KSEVENTS_ERESOURCE +typedef enum { + KSEVENTS_NONE, + KSEVENTS_SPINLOCK, + KSEVENTS_MUTEX, + KSEVENTS_FMUTEX, + KSEVENTS_FMUTEXUNSAFE, + KSEVENTS_INTERRUPT, + KSEVENTS_ERESOURCE } KSEVENTS_LOCKTYPE; -typedef enum -{ - KSDEGRADE_STANDARD_SIMPLE, - KSDEGRADE_STANDARD_QUALITY, - KSDEGRADE_STANDARD_COMPUTATION, - KSDEGRADE_STANDARD_SKIP +typedef enum { + KSDEGRADE_STANDARD_SIMPLE, + KSDEGRADE_STANDARD_QUALITY, + KSDEGRADE_STANDARD_COMPUTATION, + KSDEGRADE_STANDARD_SKIP } KSDEGRADE_STANDARD; -typedef enum -{ - KSPIN_DATAFLOW_IN = 1, - KSPIN_DATAFLOW_OUT +typedef enum { + KSPIN_DATAFLOW_IN = 1, + KSPIN_DATAFLOW_OUT } KSPIN_DATAFLOW, *PKSPIN_DATAFLOW; -typedef enum -{ - KSPIN_COMMUNICATION_NONE, - KSPIN_COMMUNICATION_SINK, - KSPIN_COMMUNICATION_SOURCE, - KSPIN_COMMUNICATION_BOTH, - KSPIN_COMMUNICATION_BRIDGE +typedef enum { + KSPIN_COMMUNICATION_NONE, + KSPIN_COMMUNICATION_SINK, + KSPIN_COMMUNICATION_SOURCE, + KSPIN_COMMUNICATION_BOTH, + KSPIN_COMMUNICATION_BRIDGE } KSPIN_COMMUNICATION, *PKSPIN_COMMUNICATION; -typedef enum -{ - KsListEntryTail, - KsListEntryHead +typedef enum { + KsListEntryTail, + KsListEntryHead } KSLIST_ENTRY_LOCATION; -typedef enum -{ - KsStackCopyToNewLocation, - KsStackReuseCurrentLocation, - KsStackUseNewLocation +typedef enum { + KsStackCopyToNewLocation, + KsStackReuseCurrentLocation, + KsStackUseNewLocation } KSSTACK_USE; -typedef enum -{ - KsAcquireOnly, - KsAcquireAndRemove, - KsAcquireOnlySingleItem, - KsAcquireAndRemoveOnlySingleItem +typedef enum { + KsAcquireOnly, + KsAcquireAndRemove, + KsAcquireOnlySingleItem, + KsAcquireAndRemoveOnlySingleItem } KSIRP_REMOVAL_OPERATION; -typedef enum -{ - KsInvokeOnSuccess = 1, - KsInvokeOnError = 2, - KsInvokeOnCancel = 4 +typedef enum { + KsInvokeOnSuccess = 1, + KsInvokeOnError = 2, + KsInvokeOnCancel = 4 } KSCOMPLETION_INVOCATION; #if defined(_NTDDK_) && !defined(__wtypes_h__) enum VARENUM { - VT_EMPTY = 0, - VT_NULL = 1, - VT_I2 = 2, - VT_I4 = 3, - VT_R4 = 4, - VT_R8 = 5, - VT_CY = 6, - VT_DATE = 7, - VT_BSTR = 8, - VT_DISPATCH = 9, - VT_ERROR = 10, - VT_BOOL = 11, - VT_VARIANT = 12, - VT_UNKNOWN = 13, - VT_DECIMAL = 14, - VT_I1 = 16, - VT_UI1 = 17, - VT_UI2 = 18, - VT_UI4 = 19, - VT_I8 = 20, - VT_UI8 = 21, - VT_INT = 22, - VT_UINT = 23, - VT_VOID = 24, - VT_HRESULT = 25, - VT_PTR = 26, - VT_SAFEARRAY = 27, - VT_CARRAY = 28, - VT_USERDEFINED = 29, - VT_LPSTR = 30, - VT_LPWSTR = 31, - VT_FILETIME = 64, - VT_BLOB = 65, - VT_STREAM = 66, - VT_STORAGE = 67, - VT_STREAMED_OBJECT = 68, - VT_STORED_OBJECT = 69, - VT_BLOB_OBJECT = 70, - VT_CF = 71, - VT_CLSID = 72, - VT_VECTOR = 0x1000, - VT_ARRAY = 0x2000, - VT_BYREF = 0x4000, - VT_RESERVED = 0x8000, - VT_ILLEGAL = 0xffff, - VT_ILLEGALMASKED = 0xfff, - VT_TYPEMASK = 0xfff + VT_EMPTY = 0, + VT_NULL = 1, + VT_I2 = 2, + VT_I4 = 3, + VT_R4 = 4, + VT_R8 = 5, + VT_CY = 6, + VT_DATE = 7, + VT_BSTR = 8, + VT_DISPATCH = 9, + VT_ERROR = 10, + VT_BOOL = 11, + VT_VARIANT = 12, + VT_UNKNOWN = 13, + VT_DECIMAL = 14, + VT_I1 = 16, + VT_UI1 = 17, + VT_UI2 = 18, + VT_UI4 = 19, + VT_I8 = 20, + VT_UI8 = 21, + VT_INT = 22, + VT_UINT = 23, + VT_VOID = 24, + VT_HRESULT = 25, + VT_PTR = 26, + VT_SAFEARRAY = 27, + VT_CARRAY = 28, + VT_USERDEFINED = 29, + VT_LPSTR = 30, + VT_LPWSTR = 31, + VT_FILETIME = 64, + VT_BLOB = 65, + VT_STREAM = 66, + VT_STORAGE = 67, + VT_STREAMED_OBJECT = 68, + VT_STORED_OBJECT = 69, + VT_BLOB_OBJECT = 70, + VT_CF = 71, + VT_CLSID = 72, + VT_VECTOR = 0x1000, + VT_ARRAY = 0x2000, + VT_BYREF = 0x4000, + VT_RESERVED = 0x8000, + VT_ILLEGAL = 0xffff, + VT_ILLEGALMASKED = 0xfff, + VT_TYPEMASK = 0xfff }; #endif -#define STATIC_KSDATAFORMAT_TYPE_WILDCARD STATIC_GUID_NULL -#define KSDATAFORMAT_TYPE_WILDCARD GUID_NULL - -#define STATIC_KSDATAFORMAT_SUBTYPE_WILDCARD STATIC_GUID_NULL -#define KSDATAFORMAT_SUBTYPE_WILDCARD GUID_NULL - -#define STATIC_KSDATAFORMAT_SPECIFIER_WILDCARD STATIC_GUID_NULL -#define KSDATAFORMAT_SPECIFIER_WILDCARD GUID_NULL +#define STATIC_KSDATAFORMAT_TYPE_WILDCARD STATIC_GUID_NULL +#define KSDATAFORMAT_TYPE_WILDCARD GUID_NULL + +#define STATIC_KSDATAFORMAT_SUBTYPE_WILDCARD STATIC_GUID_NULL +#define KSDATAFORMAT_SUBTYPE_WILDCARD GUID_NULL + +#define STATIC_KSDATAFORMAT_SPECIFIER_WILDCARD STATIC_GUID_NULL +#define KSDATAFORMAT_SPECIFIER_WILDCARD GUID_NULL /* =============================================================== Framing */ -typedef struct -{ - ULONG MinFrameSize; - ULONG MaxFrameSize; - ULONG Stepping; +typedef struct { + ULONG MinFrameSize; + ULONG MaxFrameSize; + ULONG Stepping; } KS_FRAMING_RANGE, *PKS_FRAMING_RANGE; -typedef struct -{ - KS_FRAMING_RANGE Range; - ULONG InPlaceWeight; - ULONG NotInPlaceWeight; +typedef struct { + KS_FRAMING_RANGE Range; + ULONG InPlaceWeight; + ULONG NotInPlaceWeight; } KS_FRAMING_RANGE_WEIGHTED, *PKS_FRAMING_RANGE_WEIGHTED; -typedef struct -{ - GUID MemoryType; - GUID BusType; - ULONG MemoryFlags; - ULONG BusFlags; - ULONG Flags; - ULONG Frames; - ULONG FileAlignment; - ULONG MemoryTypeWeight; - KS_FRAMING_RANGE PhysicalRange; - KS_FRAMING_RANGE_WEIGHTED FramingRange; +typedef struct { + GUID MemoryType; + GUID BusType; + ULONG MemoryFlags; + ULONG BusFlags; + ULONG Flags; + ULONG Frames; + ULONG FileAlignment; + ULONG MemoryTypeWeight; + KS_FRAMING_RANGE PhysicalRange; + KS_FRAMING_RANGE_WEIGHTED FramingRange; } KS_FRAMING_ITEM, *PKS_FRAMING_ITEM; -typedef struct -{ - ULONG RatioNumerator; - ULONG RatioDenominator; - ULONG RatioConstantMargin; +typedef struct { + ULONG RatioNumerator; + ULONG RatioDenominator; + ULONG RatioConstantMargin; } KS_COMPRESSION, *PKS_COMPRESSION; - /* =============================================================== Priorities */ -#define KSPRIORITY_LOW 0x00000001 -#define KSPRIORITY_NORMAL 0x40000000 -#define KSPRIORITY_HIGH 0x80000000 -#define KSPRIORITY_EXCLUSIVE 0xFFFFFFFF - -typedef struct -{ - ULONG PriorityClass; - ULONG PrioritySubClass; +#define KSPRIORITY_LOW 0x00000001 +#define KSPRIORITY_NORMAL 0x40000000 +#define KSPRIORITY_HIGH 0x80000000 +#define KSPRIORITY_EXCLUSIVE 0xFFFFFFFF + +typedef struct { + ULONG PriorityClass; + ULONG PrioritySubClass; } KSPRIORITY, *PKSPRIORITY; - /* =============================================================== Dispatch Table
http://www.osronline.com/DDKx/stream/ks-struct_494j.htm
*/ + #if defined(_NTDDK_) -typedef struct -{ - PDRIVER_DISPATCH DeviceIoControl; - PDRIVER_DISPATCH Read; - PDRIVER_DISPATCH Write; - PDRIVER_DISPATCH Flush; - PDRIVER_DISPATCH Close; - PDRIVER_DISPATCH QuerySecurity; - PDRIVER_DISPATCH SetSecurity; - PFAST_IO_DEVICE_CONTROL FastDeviceIoControl; - PFAST_IO_READ FastRead; - PFAST_IO_WRITE FastWrite; + +typedef struct { + PDRIVER_DISPATCH DeviceIoControl; + PDRIVER_DISPATCH Read; + PDRIVER_DISPATCH Write; + PDRIVER_DISPATCH Flush; + PDRIVER_DISPATCH Close; + PDRIVER_DISPATCH QuerySecurity; + PDRIVER_DISPATCH SetSecurity; + PFAST_IO_DEVICE_CONTROL FastDeviceIoControl; + PFAST_IO_READ FastRead; + PFAST_IO_WRITE FastWrite; } KSDISPATCH_TABLE, *PKSDISPATCH_TABLE; - -#define KSCREATE_ITEM_IRP_STORAGE(Irp) (*(PKSOBJECT_CREATE_ITEM*)&(Irp)->Tail.Overlay.DriverContext[0]) -#define KSEVENT_SET_IRP_STORAGE(Irp) (*(const KSEVENT_SET**)&(Irp)->Tail.Overlay.DriverContext[0]) -#define KSEVENT_ITEM_IRP_STORAGE(Irp) (*(const KSEVENT_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3]) -#define KSEVENT_ENTRY_IRP_STORAGE(Irp) (*(PKSEVENT_ENTRY*)&(Irp)->Tail.Overlay.DriverContext[0]) -#define KSMETHOD_SET_IRP_STORAGE(Irp) (*(const KSMETHOD_SET**)&(Irp)->Tail.Overlay.DriverContext[0]) -#define KSMETHOD_ITEM_IRP_STORAGE(Irp) (*(const KSMETHOD_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3]) -#define KSMETHOD_TYPE_IRP_STORAGE(Irp) (*(ULONG_PTR*)(&(Irp)->Tail.Overlay.DriverContext[2])) -#define KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) (*(PKSPIN_LOCK*)&(Irp)->Tail.Overlay.DriverContext[1]) -#define KSPROPERTY_SET_IRP_STORAGE(Irp) (*(const KSPROPERTY_SET**)&(Irp)->Tail.Overlay.DriverContext[0]) -#define KSPROPERTY_ITEM_IRP_STORAGE(Irp) (*(const KSPROPERTY_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3]) +#define KSCREATE_ITEM_IRP_STORAGE(Irp) (*(PKSOBJECT_CREATE_ITEM*)&(Irp)->Tail.Overlay.DriverContext[0]) +#define KSEVENT_SET_IRP_STORAGE(Irp) (*(const KSEVENT_SET**)&(Irp)->Tail.Overlay.DriverContext[0]) +#define KSEVENT_ITEM_IRP_STORAGE(Irp) (*(const KSEVENT_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3]) +#define KSEVENT_ENTRY_IRP_STORAGE(Irp) (*(PKSEVENT_ENTRY*)&(Irp)->Tail.Overlay.DriverContext[0]) +#define KSMETHOD_SET_IRP_STORAGE(Irp) (*(const KSMETHOD_SET**)&(Irp)->Tail.Overlay.DriverContext[0]) +#define KSMETHOD_ITEM_IRP_STORAGE(Irp) (*(const KSMETHOD_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3]) +#define KSMETHOD_TYPE_IRP_STORAGE(Irp) (*(ULONG_PTR*)(&(Irp)->Tail.Overlay.DriverContext[2])) +#define KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) (*(PKSPIN_LOCK*)&(Irp)->Tail.Overlay.DriverContext[1]) +#define KSPROPERTY_SET_IRP_STORAGE(Irp) (*(const KSPROPERTY_SET**)&(Irp)->Tail.Overlay.DriverContext[0]) +#define KSPROPERTY_ITEM_IRP_STORAGE(Irp) (*(const KSPROPERTY_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3]) #define KSPROPERTY_ATTRIBUTES_IRP_STORAGE(Irp) (*(PKSATTRIBUTE_LIST*)&(Irp)->Tail.Overlay.DriverContext[2]) _IRQL_requires_max_(PASSIVE_LEVEL) @@ -1530,136 +1465,121 @@ _In_ PVOID Context, _Inout_ PWCHAR *String); -typedef struct -{ - INTERFACE Interface; - PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject; - PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject; - PFNQUERYREFERENCESTRING QueryReferenceString; +typedef struct { + INTERFACE Interface; + PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject; + PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject; + PFNQUERYREFERENCESTRING QueryReferenceString; } BUS_INTERFACE_REFERENCE, *PBUS_INTERFACE_REFERENCE; -typedef struct -{ - KDPC Dpc; - ULONG ReferenceCount; - KSPIN_LOCK AccessLock; +typedef struct { + KDPC Dpc; + ULONG ReferenceCount; + KSPIN_LOCK AccessLock; } KSDPC_ITEM, *PKSDPC_ITEM; -typedef struct -{ - KSDPC_ITEM DpcItem; - LIST_ENTRY BufferList; +typedef struct { + KSDPC_ITEM DpcItem; + LIST_ENTRY BufferList; } KSBUFFER_ITEM, *PKSBUFFER_ITEM; +#endif /* _NTDDK_ */ + +typedef struct { + GUID Manufacturer; + GUID Product; + GUID Component; + GUID Name; + ULONG Version; + ULONG Revision; +} KSCOMPONENTID, *PKSCOMPONENTID; + +/* =============================================================== + Properties +*/ + +typedef struct { + GUID PropertySet; + ULONG Count; +} KSPROPERTY_SERIALHDR, *PKSPROPERTY_SERIALHDR; + +typedef struct { + KSIDENTIFIER PropTypeSet; + ULONG Id; + ULONG PropertyLength; +} KSPROPERTY_SERIAL, *PKSPROPERTY_SERIAL; + +typedef union { + struct { + LONG SignedMinimum; + LONG SignedMaximum; +#if defined( _KS_NO_ANONYMOUS_STRUCTURES_ ) + } _SIGNED; +#else + }; #endif - -typedef struct -{ - GUID Manufacturer; - GUID Product; - GUID Component; - GUID Name; - ULONG Version; - ULONG Revision; -} KSCOMPONENTID, *PKSCOMPONENTID; - -/* =============================================================== - Properties -*/ - -typedef struct -{ - GUID PropertySet; - ULONG Count; -} KSPROPERTY_SERIALHDR, *PKSPROPERTY_SERIALHDR; - -typedef struct -{ - KSIDENTIFIER PropTypeSet; - ULONG Id; - ULONG PropertyLength; -} KSPROPERTY_SERIAL, *PKSPROPERTY_SERIAL; - - -typedef union -{ - struct { - LONG SignedMinimum; - LONG SignedMaximum; - + struct { + ULONG UnsignedMinimum; + ULONG UnsignedMaximum; #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ ) - }_SIGNED; + } _UNSIGNED; #else - }; + }; #endif - - struct { - ULONG UnsignedMinimum; - ULONG UnsignedMaximum; +} KSPROPERTY_BOUNDS_LONG, *PKSPROPERTY_BOUNDS_LONG; + +typedef union { + struct { + LONGLONG SignedMinimum; + LONGLONG SignedMaximum; #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ ) - }_UNSIGNED; + } _SIGNED64; #else - }; + }; #endif - -} KSPROPERTY_BOUNDS_LONG, *PKSPROPERTY_BOUNDS_LONG; - -typedef union -{ - struct { - LONGLONG SignedMinimum; - LONGLONG SignedMaximum; -#if defined( _KS_NO_ANONYMOUS_STRUCTURES_ ) - }_SIGNED64; + struct { +#if defined(_NTDDK_) + ULONGLONG UnsignedMinimum; + ULONGLONG UnsignedMaximum; #else - }; -#endif - - struct { -#if defined(_NTDDK_) - ULONGLONG UnsignedMinimum; - ULONGLONG UnsignedMaximum; -#else - DWORDLONG UnsignedMinimum; - DWORDLONG UnsignedMaximum; + DWORDLONG UnsignedMinimum; + DWORDLONG UnsignedMaximum; #endif #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ ) - }_UNSIGNED64; + } _UNSIGNED64; #else - }; + }; #endif } KSPROPERTY_BOUNDS_LONGLONG, *PKSPROPERTY_BOUNDS_LONGLONG; -typedef struct -{ - ULONG AccessFlags; - ULONG DescriptionSize; - KSIDENTIFIER PropTypeSet; - ULONG MembersListCount; - ULONG Reserved; +typedef struct { + ULONG AccessFlags; + ULONG DescriptionSize; + KSIDENTIFIER PropTypeSet; + ULONG MembersListCount; + ULONG Reserved; } KSPROPERTY_DESCRIPTION, *PKSPROPERTY_DESCRIPTION; -typedef struct -{ - ULONG MembersFlags; - ULONG MembersSize; - ULONG MembersCount; - ULONG Flags; +typedef struct { + ULONG MembersFlags; + ULONG MembersSize; + ULONG MembersCount; + ULONG Flags; } KSPROPERTY_MEMBERSHEADER, *PKSPROPERTY_MEMBERSHEADER; typedef struct { - KSPROPERTY_MEMBERSHEADER MembersHeader; - const VOID* Members; + KSPROPERTY_MEMBERSHEADER MembersHeader; + const VOID *Members; } KSPROPERTY_MEMBERSLIST, *PKSPROPERTY_MEMBERSLIST; -#define KSPROPERTY_MEMBER_RANGES 0x00000001 -#define KSPROPERTY_MEMBER_STEPPEDRANGES 0x00000002 -#define KSPROPERTY_MEMBER_VALUES 0x00000003 - -#define KSPROPERTY_MEMBER_FLAG_DEFAULT 0x00000001 +#define KSPROPERTY_MEMBER_RANGES 0x00000001 +#define KSPROPERTY_MEMBER_STEPPEDRANGES 0x00000002 +#define KSPROPERTY_MEMBER_VALUES 0x00000003 + +#define KSPROPERTY_MEMBER_FLAG_DEFAULT 0x00000001 #if (NTDDI_VERSION >= NTDDI_WINXP) -#define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_MULTICHANNEL 0x00000002 -#define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_UNIFORM 0x00000004 +#define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_MULTICHANNEL 0x00000002 +#define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_UNIFORM 0x00000004 #endif typedef struct { @@ -1713,16 +1633,16 @@ _Out_ PIO_STATUS_BLOCK IoStatus); typedef struct { - ULONG PropertyId; - union { - PFNKSFASTHANDLER GetPropertyHandler; - BOOLEAN GetSupported; - }; - union { - PFNKSFASTHANDLER SetPropertyHandler; - BOOLEAN SetSupported; - }; - ULONG Reserved; + ULONG PropertyId; + union { + PFNKSFASTHANDLER GetPropertyHandler; + BOOLEAN GetSupported; + }; + union { + PFNKSFASTHANDLER SetPropertyHandler; + BOOLEAN SetSupported; + }; + ULONG Reserved; } KSFASTPROPERTY_ITEM, *PKSFASTPROPERTY_ITEM; typedef struct { @@ -1733,153 +1653,143 @@ const KSFASTPROPERTY_ITEM *FastIoTable; } KSPROPERTY_SET, *PKSPROPERTY_SET; +#endif /* _NTDDK_ */ + +typedef struct { + ULONG SteppingDelta; + ULONG Reserved; + KSPROPERTY_BOUNDS_LONG Bounds; +} KSPROPERTY_STEPPING_LONG, *PKSPROPERTY_STEPPING_LONG; + +typedef struct { +#if defined(_NTDDK_) + ULONGLONG SteppingDelta; +#else + DWORDLONG SteppingDelta; #endif - -typedef struct -{ - ULONG SteppingDelta; - ULONG Reserved; - KSPROPERTY_BOUNDS_LONG Bounds; -} KSPROPERTY_STEPPING_LONG, *PKSPROPERTY_STEPPING_LONG; - -typedef struct -{ + KSPROPERTY_BOUNDS_LONGLONG Bounds; +} KSPROPERTY_STEPPING_LONGLONG, *PKSPROPERTY_STEPPING_LONGLONG; + +/* =============================================================== + Allocator Framing +*/ + +typedef struct { + union { + ULONG OptionsFlags; + ULONG RequirementsFlags; + }; #if defined(_NTDDK_) - ULONGLONG SteppingDelta; + POOL_TYPE PoolType; #else - DWORDLONG SteppingDelta; + ULONG PoolType; #endif - KSPROPERTY_BOUNDS_LONGLONG Bounds; -} KSPROPERTY_STEPPING_LONGLONG, *PKSPROPERTY_STEPPING_LONGLONG; - -/* =============================================================== - Allocator Framing -*/ - -typedef struct -{ - union { - ULONG OptionsFlags; - ULONG RequirementsFlags; - }; + ULONG Frames; + ULONG FrameSize; + ULONG FileAlignment; + ULONG Reserved; +} KSALLOCATOR_FRAMING, *PKSALLOCATOR_FRAMING; + +typedef struct { + ULONG CountItems; + ULONG PinFlags; + KS_COMPRESSION OutputCompression; + ULONG PinWeight; + KS_FRAMING_ITEM FramingItem[1]; +} KSALLOCATOR_FRAMING_EX, *PKSALLOCATOR_FRAMING_EX; + +#define KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER 0x00000001 +#define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY 0x00000002 +#define KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY 0x00000004 +#define KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE 0x00000008 +#define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY 0x80000000 + +#define KSALLOCATOR_OPTIONF_COMPATIBLE 0x00000001 +#define KSALLOCATOR_OPTIONF_SYSTEM_MEMORY 0x00000002 +#define KSALLOCATOR_OPTIONF_VALID 0x00000003 + +#define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010 +#define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020 +#define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040 +#define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080 + +/* =============================================================== + Quality +*/ + +typedef struct { + PVOID Context; + ULONG Proportion; + LONGLONG DeltaTime; +} KSQUALITY, *PKSQUALITY; + +typedef struct { + HANDLE QualityManager; + PVOID Context; +} KSQUALITY_MANAGER, *PKSQUALITY_MANAGER; + +typedef struct { + LONGLONG PresentationStart; + LONGLONG Duration; + KSPIN_INTERFACE Interface; + LONG Rate; + ULONG Flags; +} KSRATE, *PKSRATE; + +typedef struct { + KSPROPERTY Property; + KSRATE Rate; +} KSRATE_CAPABILITY, *PKSRATE_CAPABILITY; + +typedef struct { + LONGLONG Granularity; + LONGLONG Error; +} KSRESOLUTION, *PKSRESOLUTION; + +typedef struct { + ULONG NotificationType; + union { + struct { + HANDLE Event; + ULONG_PTR Reserved[2]; + } EventHandle; + struct { + HANDLE Semaphore; + ULONG Reserved; + LONG Adjustment; + } SemaphoreHandle; #if defined(_NTDDK_) - POOL_TYPE PoolType; -#else - ULONG PoolType; -#endif - ULONG Frames; - ULONG FrameSize; - ULONG FileAlignment; - ULONG Reserved; -} KSALLOCATOR_FRAMING, *PKSALLOCATOR_FRAMING; - -typedef struct -{ - ULONG CountItems; - ULONG PinFlags; - KS_COMPRESSION OutputCompression; - ULONG PinWeight; - KS_FRAMING_ITEM FramingItem[1]; -} KSALLOCATOR_FRAMING_EX, *PKSALLOCATOR_FRAMING_EX; - -#define KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER 0x00000001 -#define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY 0x00000002 -#define KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY 0x00000004 -#define KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE 0x00000008 -#define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY 0x80000000 - -#define KSALLOCATOR_OPTIONF_COMPATIBLE 0x00000001 -#define KSALLOCATOR_OPTIONF_SYSTEM_MEMORY 0x00000002 -#define KSALLOCATOR_OPTIONF_VALID 0x00000003 - -#define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010 -#define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020 -#define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040 -#define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080 - -/* =============================================================== - Quality -*/ - -typedef struct -{ - PVOID Context; - ULONG Proportion; - LONGLONG DeltaTime; -} KSQUALITY, *PKSQUALITY; - -typedef struct -{ - HANDLE QualityManager; - PVOID Context; -} KSQUALITY_MANAGER, *PKSQUALITY_MANAGER; - -typedef struct -{ - LONGLONG PresentationStart; - LONGLONG Duration; - KSPIN_INTERFACE Interface; - LONG Rate; - ULONG Flags; -} KSRATE, *PKSRATE; - -typedef struct -{ - KSPROPERTY Property; - KSRATE Rate; -} KSRATE_CAPABILITY, *PKSRATE_CAPABILITY; - -typedef struct -{ - LONGLONG Granularity; - LONGLONG Error; -} KSRESOLUTION, *PKSRESOLUTION; - -typedef struct -{ - ULONG NotificationType; - union { - struct { - HANDLE Event; - ULONG_PTR Reserved[2]; - } EventHandle; - struct { - HANDLE Semaphore; - ULONG Reserved; - LONG Adjustment; - } SemaphoreHandle; -#if defined(_NTDDK_) - struct { - PVOID Event; - KPRIORITY Increment; - ULONG_PTR Reserved; - } EventObject; - struct { - PVOID Semaphore; - KPRIORITY Increment; - LONG Adjustment; - } SemaphoreObject; - struct { - PKDPC Dpc; - ULONG ReferenceCount; - ULONG_PTR Reserved; - } Dpc; - struct { - PWORK_QUEUE_ITEM WorkQueueItem; - WORK_QUEUE_TYPE WorkQueueType; - ULONG_PTR Reserved; - } WorkItem; - struct { - PWORK_QUEUE_ITEM WorkQueueItem; - PKSWORKER KsWorkerObject; - ULONG_PTR Reserved; - } KsWorkItem; + struct { + PVOID Event; + KPRIORITY Increment; + ULONG_PTR Reserved; + } EventObject; + struct { + PVOID Semaphore; + KPRIORITY Increment; + LONG Adjustment; + } SemaphoreObject; + struct { + PKDPC Dpc; + ULONG ReferenceCount; + ULONG_PTR Reserved; + } Dpc; + struct { + PWORK_QUEUE_ITEM WorkQueueItem; + WORK_QUEUE_TYPE WorkQueueType; + ULONG_PTR Reserved; + } WorkItem; + struct { + PWORK_QUEUE_ITEM WorkQueueItem; + PKSWORKER KsWorkerObject; + ULONG_PTR Reserved; + } KsWorkItem; #endif - struct { - PVOID Unused; - LONG_PTR Alignment[2]; - } Alignment; - }; + struct { + PVOID Unused; + LONG_PTR Alignment[2]; + } Alignment; + }; } KSEVENTDATA, *PKSEVENTDATA; #define KSEVENTF_EVENT_HANDLE 0x00000001 @@ -1900,77 +1810,68 @@ #define KSEVENT_TYPE_BASICSUPPORT 0x00000200 #define KSEVENT_TYPE_QUERYBUFFER 0x00000400 -#define KSEVENT_TYPE_TOPOLOGY 0x10000000 - -typedef struct -{ - ULONG Size; - ULONG Flags; - union { - HANDLE ObjectHandle; - PVOID ObjectPointer; - }; - PVOID Reserved; - KSEVENT Event; - KSEVENTDATA EventData; +#define KSEVENT_TYPE_TOPOLOGY 0x10000000 + +typedef struct { + ULONG Size; + ULONG Flags; + union { + HANDLE ObjectHandle; + PVOID ObjectPointer; + }; + PVOID Reserved; + KSEVENT Event; + KSEVENTDATA EventData; } KSRELATIVEEVENT, *PKSRELATIVEEVENT; -#define KSRELATIVEEVENT_FLAG_HANDLE 0x00000001 +#define KSRELATIVEEVENT_FLAG_HANDLE 0x00000001 #define KSRELATIVEEVENT_FLAG_POINTER 0x00000002 /* =============================================================== Timing */ - -typedef struct { - KSEVENTDATA EventData; - LONGLONG MarkTime; +typedef struct { + KSEVENTDATA EventData; + LONGLONG MarkTime; } KSEVENT_TIME_MARK, *PKSEVENT_TIME_MARK; typedef struct { - KSEVENTDATA EventData; - LONGLONG TimeBase; - LONGLONG Interval; + KSEVENTDATA EventData; + LONGLONG TimeBase; + LONGLONG Interval; } KSEVENT_TIME_INTERVAL, *PKSEVENT_TIME_INTERVAL; typedef struct { - LONGLONG TimeBase; - LONGLONG Interval; + LONGLONG TimeBase; + LONGLONG Interval; } KSINTERVAL, *PKSINTERVAL; - - -typedef struct -{ - LONGLONG Time; - ULONG Numerator; - ULONG Denominator; +typedef struct { + LONGLONG Time; + ULONG Numerator; + ULONG Denominator; } KSTIME, *PKSTIME; -typedef struct -{ - LONGLONG Time; - LONGLONG SystemTime; +typedef struct { + LONGLONG Time; + LONGLONG SystemTime; } KSCORRELATED_TIME, *PKSCORRELATED_TIME; -typedef struct -{ - LONGLONG Duration; - ULONG FrameFlags; - ULONG Reserved; +typedef struct { + LONGLONG Duration; + ULONG FrameFlags; + ULONG Reserved; } KSFRAMETIME, *PKSFRAMETIME; - /* =============================================================== Clocks */ -typedef PVOID PKSDEFAULTCLOCK; - -typedef struct -{ - ULONG CreateFlags; +typedef PVOID PKSDEFAULTCLOCK; + +typedef struct { + ULONG CreateFlags; } KSCLOCK_CREATE, *PKSCLOCK_CREATE; #if defined(_NTDDK_) @@ -1986,14 +1887,12 @@ _In_ PFILE_OBJECT FileObject, _Out_ PLONGLONG SystemTime); -typedef struct -{ - PFNKSCLOCK_GETTIME GetTime; - PFNKSCLOCK_GETTIME GetPhysicalTime; - PFNKSCLOCK_CORRELATEDTIME GetCorrelatedTime; - PFNKSCLOCK_CORRELATEDTIME GetCorrelatedPhysicalTime; +typedef struct { + PFNKSCLOCK_GETTIME GetTime; + PFNKSCLOCK_GETTIME GetPhysicalTime; + PFNKSCLOCK_CORRELATEDTIME GetCorrelatedTime; + PFNKSCLOCK_CORRELATEDTIME GetCorrelatedPhysicalTime; } KSCLOCK_FUNCTIONTABLE, *PKSCLOCK_FUNCTIONTABLE; - #define DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(Handler)\ DEFINE_KSPROPERTY_ITEM(\ @@ -2069,18 +1968,17 @@ Objects ??? SORT ME! */ -#define KSCREATE_ITEM_SECURITYCHANGED 0x1 -#define KSCREATE_ITEM_WILDCARD 0x2 -#define KSCREATE_ITEM_NOPARAMETERS 0x4 -#define KSCREATE_ITEM_FREEONSTOP 0x8 - -typedef struct -{ - PDRIVER_DISPATCH Create; - PVOID Context; - UNICODE_STRING ObjectClass; - PSECURITY_DESCRIPTOR SecurityDescriptor; - ULONG Flags; +#define KSCREATE_ITEM_SECURITYCHANGED 0x1 +#define KSCREATE_ITEM_WILDCARD 0x2 +#define KSCREATE_ITEM_NOPARAMETERS 0x4 +#define KSCREATE_ITEM_FREEONSTOP 0x8 + +typedef struct { + PDRIVER_DISPATCH Create; + PVOID Context; + UNICODE_STRING ObjectClass; + PSECURITY_DESCRIPTOR SecurityDescriptor; + ULONG Flags; } KSOBJECT_CREATE_ITEM, *PKSOBJECT_CREATE_ITEM; typedef struct { @@ -2092,43 +1990,40 @@ (NTAPI *PFNKSITEMFREECALLBACK)( _In_ PKSOBJECT_CREATE_ITEM CreateItem); -#endif - -typedef struct -{ - ULONG Size; - ULONG Count; +#endif /* _NTDDK_ */ + +typedef struct { + ULONG Size; + ULONG Count; } KSMULTIPLE_ITEM, *PKSMULTIPLE_ITEM; -typedef struct -{ - KSEVENT Event; - PKSEVENTDATA EventData; - PVOID Reserved; +typedef struct { + KSEVENT Event; + PKSEVENTDATA EventData; + PVOID Reserved; } KSQUERYBUFFER, *PKSQUERYBUFFER; -typedef struct -{ - PVOID Context; - ULONG Status; +typedef struct { + PVOID Context; + ULONG Status; } KSERROR, *PKSERROR; /* =============================================================== Methods */ + #if defined(_NTDDK_) -typedef struct -{ - ULONG MethodId; - union { - PFNKSHANDLER MethodHandler; - BOOLEAN MethodSupported; - }; - ULONG MinMethod; - ULONG MinData; - PFNKSHANDLER SupportHandler; - ULONG Flags; +typedef struct { + ULONG MethodId; + union { + PFNKSHANDLER MethodHandler; + BOOLEAN MethodSupported; + }; + ULONG MinMethod; + ULONG MinData; + PFNKSHANDLER SupportHandler; + ULONG Flags; } KSMETHOD_ITEM, *PKSMETHOD_ITEM; #ifndef _MSC_VER @@ -2151,18 +2046,14 @@ SupportHandler, Flags\ } - - #endif - -typedef struct -{ - ULONG MethodId; - union { - PFNKSFASTHANDLER MethodHandler; - BOOLEAN MethodSupported; - }; +typedef struct { + ULONG MethodId; + union { + PFNKSFASTHANDLER MethodHandler; + BOOLEAN MethodSupported; + }; } KSFASTMETHOD_ITEM, *PKSFASTMETHOD_ITEM; #define DEFINE_KSFASTMETHOD_ITEM(MethodId, MethodHandler)\ @@ -2191,41 +2082,39 @@ FastIoTable\ } -#endif +#endif /* _NTDDK_ */ + /* =============================================================== Nodes */ -typedef struct -{ - KSPROPERTY Property; - ULONG NodeId; - ULONG Reserved; +typedef struct { + KSPROPERTY Property; + ULONG NodeId; + ULONG Reserved; } KSP_NODE, *PKSP_NODE; -typedef struct -{ - KSMETHOD Method; - ULONG NodeID; - ULONG Reserved; +typedef struct { + KSMETHOD Method; + ULONG NodeID; + ULONG Reserved; } KSM_NODE, *PKSM_NODE; -typedef struct -{ - KSEVENT Event; - ULONG NodeId; - ULONG Reserved; +typedef struct { + KSEVENT Event; + ULONG NodeId; + ULONG Reserved; } KSE_NODE, *PKSE_NODE; typedef struct { - ULONG CreateFlags; - ULONG Node; + ULONG CreateFlags; + ULONG Node; } KSNODE_CREATE, *PKSNODE_CREATE; - /* =============================================================== Events */ + typedef struct _KSEVENT_ENTRY KSEVENT_ENTRY, *PKSEVENT_ENTRY; #if defined(_NTDDK_) @@ -2241,14 +2130,13 @@ _In_ PFILE_OBJECT FileObject, _In_ struct _KSEVENT_ENTRY *EventEntry); -typedef struct -{ - ULONG EventId; - ULONG DataInput; - ULONG ExtraEntryData; - PFNKSADDEVENT AddHandler; - PFNKSREMOVEEVENT RemoveHandler; - PFNKSHANDLER SupportHandler; +typedef struct { + ULONG EventId; + ULONG DataInput; + ULONG ExtraEntryData; + PFNKSADDEVENT AddHandler; + PFNKSREMOVEEVENT RemoveHandler; + PFNKSHANDLER SupportHandler; } KSEVENT_ITEM, *PKSEVENT_ITEM; typedef struct { @@ -2257,25 +2145,25 @@ _Field_size_(EventsCount) const KSEVENT_ITEM *EventItem; } KSEVENT_SET, *PKSEVENT_SET; -struct _KSEVENT_ENTRY -{ - LIST_ENTRY ListEntry; - PVOID Object; - union { - PKSDPC_ITEM DpcItem; - PKSBUFFER_ITEM BufferItem; - }; - PKSEVENTDATA EventData; - ULONG NotificationType; - const KSEVENT_SET* EventSet; - const KSEVENT_ITEM* EventItem; - PFILE_OBJECT FileObject; - ULONG SemaphoreAdjustment; - ULONG Reserved; - ULONG Flags; +struct _KSEVENT_ENTRY { + LIST_ENTRY ListEntry; + PVOID Object; + union { + PKSDPC_ITEM DpcItem; + PKSBUFFER_ITEM BufferItem; + }; + PKSEVENTDATA EventData; + ULONG NotificationType; + const KSEVENT_SET *EventSet; + const KSEVENT_ITEM *EventItem; + PFILE_OBJECT FileObject; + ULONG SemaphoreAdjustment; + ULONG Reserved; + ULONG Flags; }; -#endif +#endif /* _NTDDK_ */ + /* =============================================================== Pins */ @@ -2291,9 +2179,9 @@ #define IOCTL_KS_HANDSHAKE CTL_CODE(FILE_DEVICE_KS, 0x007, METHOD_NEITHER, FILE_ANY_ACCESS) typedef struct { - GUID ProtocolId; - PVOID Argument1; - PVOID Argument2; + GUID ProtocolId; + PVOID Argument1; + PVOID Argument2; } KSHANDSHAKE, *PKSHANDSHAKE; _IRQL_requires_max_(PASSIVE_LEVEL) @@ -2368,18 +2256,17 @@ typedef struct _KSCLOCK_DISPATCH KSCLOCK_DISPATCH, *PKSCLOCK_DISPATCH; typedef struct _KSALLOCATOR_DISPATCH KSALLOCATOR_DISPATCH, *PKSALLOCATOR_DISPATCH; -typedef struct -{ - PFNKSPINIRP Create; - PFNKSPINIRP Close; - PFNKSPIN Process; - PFNKSPINVOID Reset; - PFNKSPINSETDATAFORMAT SetDataFormat; - PFNKSPINSETDEVICESTATE SetDeviceState; - PFNKSPIN Connect; - PFNKSPINVOID Disconnect; - const KSCLOCK_DISPATCH* Clock; - const KSALLOCATOR_DISPATCH* Allocator; +typedef struct { + PFNKSPINIRP Create; + PFNKSPINIRP Close; + PFNKSPIN Process; + PFNKSPINVOID Reset; + PFNKSPINSETDATAFORMAT SetDataFormat; + PFNKSPINSETDEVICESTATE SetDeviceState; + PFNKSPIN Connect; + PFNKSPINVOID Disconnect; + const KSCLOCK_DISPATCH* Clock; + const KSALLOCATOR_DISPATCH* Allocator; } KSPIN_DISPATCH, *PKSPIN_DISPATCH; _IRQL_requires_max_(DISPATCH_LEVEL) @@ -2409,10 +2296,10 @@ _Out_ PKSRESOLUTION Resolution); struct _KSCLOCK_DISPATCH { - PFNKSPINSETTIMER SetTimer; - PFNKSPINCANCELTIMER CancelTimer; - PFNKSPINCORRELATEDTIME CorrelatedTime; - PFNKSPINRESOLUTION Resolution; + PFNKSPINSETTIMER SetTimer; + PFNKSPINCANCELTIMER CancelTimer; + PFNKSPINCORRELATEDTIME CorrelatedTime; + PFNKSPINRESOLUTION Resolution; }; _IRQL_requires_max_(PASSIVE_LEVEL) @@ -2436,10 +2323,10 @@ _In_ PVOID Buffer); struct _KSALLOCATOR_DISPATCH { - PFNKSPININITIALIZEALLOCATOR InitializeAllocator; - PFNKSDELETEALLOCATOR DeleteAllocator; - PFNKSDEFAULTALLOCATE Allocate; - PFNKSDEFAULTFREE Free; + PFNKSPININITIALIZEALLOCATOR InitializeAllocator; + PFNKSDELETEALLOCATOR DeleteAllocator; + PFNKSDEFAULTALLOCATE Allocate; + PFNKSDEFAULTFREE Free; }; typedef struct KSAUTOMATION_TABLE_ { @@ -2499,71 +2386,71 @@ _Out_writes_bytes_to_opt_(DataBufferSize, *DataSize) PVOID Data, _Out_ PULONG DataSize); -typedef struct -{ - const KSPIN_DISPATCH* Dispatch; - const KSAUTOMATION_TABLE* AutomationTable; - KSPIN_DESCRIPTOR PinDescriptor; - ULONG Flags; - ULONG InstancesPossible; - ULONG InstancesNecessary; - const KSALLOCATOR_FRAMING_EX* AllocatorFraming; - PFNKSINTERSECTHANDLEREX IntersectHandler; +typedef struct { + const KSPIN_DISPATCH* Dispatch; + const KSAUTOMATION_TABLE* AutomationTable; + KSPIN_DESCRIPTOR PinDescriptor; + ULONG Flags; + ULONG InstancesPossible; + ULONG InstancesNecessary; + const KSALLOCATOR_FRAMING_EX* AllocatorFraming; + PFNKSINTERSECTHANDLEREX IntersectHandler; } KSPIN_DESCRIPTOR_EX, *PKSPIN_DESCRIPTOR_EX; -#define KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING 0x00000001 -#define KSFILTER_FLAG_CRITICAL_PROCESSING 0x00000002 -#define KSFILTER_FLAG_HYPERCRITICAL_PROCESSING 0x00000004 +#define KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING 0x00000001 +#define KSFILTER_FLAG_CRITICAL_PROCESSING 0x00000002 +#define KSFILTER_FLAG_HYPERCRITICAL_PROCESSING 0x00000004 #define KSFILTER_FLAG_RECEIVE_ZERO_LENGTH_SAMPLES 0x00000008 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) -#define KSFILTER_FLAG_DENY_USERMODE_ACCESS 0x80000000 +#define KSFILTER_FLAG_DENY_USERMODE_ACCESS 0x80000000 #endif - #define KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING #define KSPIN_FLAG_CRITICAL_PROCESSING KSFILTER_FLAG_CRITICAL_PROCESSING #define KSPIN_FLAG_HYPERCRITICAL_PROCESSING KSFILTER_FLAG_HYPERCRITICAL_PROCESSING -#define KSPIN_FLAG_ASYNCHRONOUS_PROCESSING 0x00000008 -#define KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING 0x00000010 + +#define KSPIN_FLAG_ASYNCHRONOUS_PROCESSING 0x00000008 +#define KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING 0x00000010 #define KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL 0x00000020 -#define KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING 0x00000040 -#define KSPIN_FLAG_ENFORCE_FIFO 0x00000080 - -#define KSPIN_FLAG_GENERATE_MAPPINGS 0x00000100 +#define KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING 0x00000040 +#define KSPIN_FLAG_ENFORCE_FIFO 0x00000080 + +#define KSPIN_FLAG_GENERATE_MAPPINGS 0x00000100 #define KSPIN_FLAG_DISTINCT_TRAILING_EDGE 0x00000200 -#define KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY 0x00010000 -#define KSPIN_FLAG_SPLITTER 0x00020000 -#define KSPIN_FLAG_USE_STANDARD_TRANSPORT 0x00040000 +#define KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY 0x00010000 +#define KSPIN_FLAG_SPLITTER 0x00020000 +#define KSPIN_FLAG_USE_STANDARD_TRANSPORT 0x00040000 #define KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT 0x00080000 -#define KSPIN_FLAG_FIXED_FORMAT 0x00100000 -#define KSPIN_FLAG_GENERATE_EOS_EVENTS 0x00200000 +#define KSPIN_FLAG_FIXED_FORMAT 0x00100000 +#define KSPIN_FLAG_GENERATE_EOS_EVENTS 0x00200000 + #define KSPIN_FLAG_RENDERER (KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY|KSPIN_FLAG_GENERATE_EOS_EVENTS) -#define KSPIN_FLAG_IMPLEMENT_CLOCK 0x00400000 + +#define KSPIN_FLAG_IMPLEMENT_CLOCK 0x00400000 #define KSPIN_FLAG_SOME_FRAMES_REQUIRED_FOR_PROCESSING 0x00800000 -#define KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE 0x01000000 +#define KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE 0x01000000 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) -#define KSPIN_FLAG_DENY_USERMODE_ACCESS 0x80000000 +#define KSPIN_FLAG_DENY_USERMODE_ACCESS 0x80000000 #endif -struct _KSPIN -{ - const KSPIN_DESCRIPTOR_EX* Descriptor; - KSOBJECT_BAG Bag; - PVOID Context; - ULONG Id; - KSPIN_COMMUNICATION Communication; - BOOLEAN ConnectionIsExternal; - KSPIN_INTERFACE ConnectionInterface; - KSPIN_MEDIUM ConnectionMedium; - KSPRIORITY ConnectionPriority; - PKSDATAFORMAT ConnectionFormat; - PKSMULTIPLE_ITEM AttributeList; - ULONG StreamHeaderSize; - KSPIN_DATAFLOW DataFlow; - KSSTATE DeviceState; - KSRESET ResetState; - KSSTATE ClientState; +struct _KSPIN { + const KSPIN_DESCRIPTOR_EX *Descriptor; + KSOBJECT_BAG Bag; + PVOID Context; + ULONG Id; + KSPIN_COMMUNICATION Communication; + BOOLEAN ConnectionIsExternal; + KSPIN_INTERFACE ConnectionInterface; + KSPIN_MEDIUM ConnectionMedium; + KSPRIORITY ConnectionPriority; + PKSDATAFORMAT ConnectionFormat; + PKSMULTIPLE_ITEM AttributeList; + ULONG StreamHeaderSize; + KSPIN_DATAFLOW DataFlow; + KSSTATE DeviceState; + KSRESET ResetState; + KSSTATE ClientState; }; #define DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(Handler)\ @@ -2721,30 +2608,28 @@ (NTAPI *PFNKSFREE)( _In_ PVOID Data); -#define DEFINE_KSPROPERTY_TABLE(tablename)\ - const KSPROPERTY_ITEM tablename[] = - -#endif - -typedef struct -{ - KSPIN_INTERFACE Interface; - KSPIN_MEDIUM Medium; - ULONG PinId; - HANDLE PinToHandle; - KSPRIORITY Priority; +#define DEFINE_KSPROPERTY_TABLE(tablename) \ + const KSPROPERTY_ITEM tablename[] = + +#endif /* _NTDDK_ */ + +typedef struct { + KSPIN_INTERFACE Interface; + KSPIN_MEDIUM Medium; + ULONG PinId; + HANDLE PinToHandle; + KSPRIORITY Priority; } KSPIN_CONNECT, *PKSPIN_CONNECT; /* =============================================================== Topology */ -typedef struct -{ - ULONG FromNode; - ULONG FromNodePin; - ULONG ToNode; - ULONG ToNodePin; +typedef struct { + ULONG FromNode; + ULONG FromNodePin; + ULONG ToNode; + ULONG ToNodePin; } KSTOPOLOGY_CONNECTION, *PKSTOPOLOGY_CONNECTION; typedef struct { @@ -2849,34 +2734,31 @@ PFNALLOCATOR_FREEFRAME FreeFrame; } KSSTREAMALLOCATOR_FUNCTIONTABLE, *PKSSTREAMALLOCATOR_FUNCTIONTABLE; -#endif - -typedef struct -{ - KSALLOCATOR_FRAMING Framing; - ULONG AllocatedFrames; - ULONG Reserved; +#endif /* _NTDDK_ */ + +typedef struct { + KSALLOCATOR_FRAMING Framing; + ULONG AllocatedFrames; + ULONG Reserved; } KSSTREAMALLOCATOR_STATUS, *PKSSTREAMALLOCATOR_STATUS; -typedef struct -{ - KSALLOCATOR_FRAMING_EX Framing; - ULONG AllocatedFrames; - ULONG Reserved; +typedef struct { + KSALLOCATOR_FRAMING_EX Framing; + ULONG AllocatedFrames; + ULONG Reserved; } KSSTREAMALLOCATOR_STATUS_EX, *PKSSTREAMALLOCATOR_STATUS_EX; -typedef struct -{ - ULONG Size; - ULONG TypeSpecificFlags; - KSTIME PresentationTime; - LONGLONG Duration; - ULONG FrameExtent; - ULONG DataUsed; - PVOID Data; - ULONG OptionsFlags; +typedef struct { + ULONG Size; + ULONG TypeSpecificFlags; + KSTIME PresentationTime; + LONGLONG Duration; + ULONG FrameExtent; + ULONG DataUsed; + PVOID Data; + ULONG OptionsFlags; #ifdef _WIN64 - ULONG Reserved; + ULONG Reserved; #endif } KSSTREAM_HEADER, *PKSSTREAM_HEADER; @@ -2896,13 +2778,14 @@ /* =============================================================== XP / DX8 */ + #if defined(_NTDDK_) typedef struct _KSGATE KSGATE, *PKSGATE; struct _KSGATE { - LONG Count; - PKSGATE NextGate; + LONG Count; + PKSGATE NextGate; }; #ifndef _NTOS_ @@ -3136,50 +3019,48 @@ } } -#endif - +#endif /* !_NTOS_ */ struct _KSMAPPING { - PHYSICAL_ADDRESS PhysicalAddress; - ULONG ByteCount; - ULONG Alignment; + PHYSICAL_ADDRESS PhysicalAddress; + ULONG ByteCount; + ULONG Alignment; }; -#endif + +#endif /* _NTDDK_ */ typedef enum { - KSSTREAM_POINTER_STATE_UNLOCKED = 0, - KSSTREAM_POINTER_STATE_LOCKED + KSSTREAM_POINTER_STATE_UNLOCKED = 0, + KSSTREAM_POINTER_STATE_LOCKED } KSSTREAM_POINTER_STATE; typedef struct _KSPROCESSPIN_INDEXENTRY KSPROCESSPIN_INDEXENTRY, *PKSPROCESSPIN_INDEXENTRY; -struct _KSSTREAM_POINTER_OFFSET -{ +struct _KSSTREAM_POINTER_OFFSET { #if defined(_NTDDK_) - union { - PUCHAR Data; - PKSMAPPING Mappings; - }; + union { + PUCHAR Data; + PKSMAPPING Mappings; + }; #else - PUCHAR Data; + PUCHAR Data; #endif #if !defined(_WIN64) - PVOID Alignment; + PVOID Alignment; #endif - ULONG Count; - ULONG Remaining; + ULONG Count; + ULONG Remaining; }; #if defined(_NTDDK_) -struct _KSSTREAM_POINTER -{ - PVOID Context; - PKSPIN Pin; - PKSSTREAM_HEADER StreamHeader; - PKSSTREAM_POINTER_OFFSET Offset; - KSSTREAM_POINTER_OFFSET OffsetIn; - KSSTREAM_POINTER_OFFSET OffsetOut; +struct _KSSTREAM_POINTER { + PVOID Context; + PKSPIN Pin; + PKSSTREAM_HEADER StreamHeader; + PKSSTREAM_POINTER_OFFSET Offset; + KSSTREAM_POINTER_OFFSET OffsetIn; + KSSTREAM_POINTER_OFFSET OffsetOut; }; struct _KSPROCESSPIN { @@ -3200,13 +3081,11 @@ ULONG Count; }; -#endif +#endif /* _NTDDK_ */ /* =============================================================== Device Dispatch */ - - #if defined(_NTDDK_) @@ -3274,50 +3153,51 @@ _In_ DEVICE_POWER_STATE From); typedef struct _KSDEVICE_DISPATCH { - PFNKSDEVICECREATE Add; - PFNKSDEVICEPNPSTART Start; - PFNKSDEVICE PostStart; - PFNKSDEVICEIRP QueryStop; - PFNKSDEVICEIRPVOID CancelStop; - PFNKSDEVICEIRPVOID Stop; - PFNKSDEVICEIRP QueryRemove; - PFNKSDEVICEIRPVOID CancelRemove; - PFNKSDEVICEIRPVOID Remove; - PFNKSDEVICEQUERYCAPABILITIES QueryCapabilities; - PFNKSDEVICEIRPVOID SurpriseRemoval; - PFNKSDEVICEQUERYPOWER QueryPower; - PFNKSDEVICESETPOWER SetPower; - PFNKSDEVICEIRP QueryInterface; -}KSDEVICE_DISPATCH, *PKSDEVICE_DISPATCH; + PFNKSDEVICECREATE Add; + PFNKSDEVICEPNPSTART Start; + PFNKSDEVICE PostStart; + PFNKSDEVICEIRP QueryStop; + PFNKSDEVICEIRPVOID CancelStop; + PFNKSDEVICEIRPVOID Stop; + PFNKSDEVICEIRP QueryRemove; + PFNKSDEVICEIRPVOID CancelRemove; + PFNKSDEVICEIRPVOID Remove; + PFNKSDEVICEQUERYCAPABILITIES QueryCapabilities; + PFNKSDEVICEIRPVOID SurpriseRemoval; + PFNKSDEVICEQUERYPOWER QueryPower; + PFNKSDEVICESETPOWER SetPower; + PFNKSDEVICEIRP QueryInterface; +} KSDEVICE_DISPATCH, *PKSDEVICE_DISPATCH; #if (NTDDI_VERSION >= NTDDI_LONGHORN) #define KSDEVICE_DESCRIPTOR_VERSION_2 (0x110) -#define MIN_DEV_VER_FOR_FLAGS (0x110) +#define MIN_DEV_VER_FOR_FLAGS (0x110) #endif -struct _KSDEVICE -{ - const KSDEVICE_DESCRIPTOR* Descriptor; - KSOBJECT_BAG Bag; - PVOID Context; - PDEVICE_OBJECT FunctionalDeviceObject; - PDEVICE_OBJECT PhysicalDeviceObject; - PDEVICE_OBJECT NextDeviceObject; - BOOLEAN Started; - SYSTEM_POWER_STATE SystemPowerState; - DEVICE_POWER_STATE DevicePowerState; +struct _KSDEVICE { + const KSDEVICE_DESCRIPTOR* Descriptor; + KSOBJECT_BAG Bag; + PVOID Context; + PDEVICE_OBJECT FunctionalDeviceObject; + PDEVICE_OBJECT PhysicalDeviceObject; + PDEVICE_OBJECT NextDeviceObject; + BOOLEAN Started; + SYSTEM_POWER_STATE SystemPowerState; + DEVICE_POWER_STATE DevicePowerState; }; -#endif + +#endif /* _NTDDK_ */ /* =============================================================== Filter Dispatch */ + #if defined(_NTDDK_) -struct _KSFILTER -{ - const KSFILTER_DESCRIPTOR* Descriptor; - KSOBJECT_BAG Bag; - PVOID Context; + +struct _KSFILTER { + const KSFILTER_DESCRIPTOR* Descriptor; + KSOBJECT_BAG Bag; + PVOID Context; }; _IRQL_requires_max_(PASSIVE_LEVEL) @@ -3342,21 +3222,19 @@ (NTAPI *PFNKSFILTERVOID)( _In_ PKSFILTER Filter); -struct _KSFILTER_DISPATCH -{ - PFNKSFILTERIRP Create; - PFNKSFILTERIRP Close; - PFNKSFILTERPROCESS Process; - PFNKSFILTERVOID Reset; +struct _KSFILTER_DISPATCH { + PFNKSFILTERIRP Create; + PFNKSFILTERIRP Close; + PFNKSFILTERPROCESS Process; + PFNKSFILTERVOID Reset; }; -struct _KSNODE_DESCRIPTOR -{ - const KSAUTOMATION_TABLE* AutomationTable; - const GUID* Type; - const GUID* Name; +struct _KSNODE_DESCRIPTOR { + const KSAUTOMATION_TABLE *AutomationTable; + const GUID *Type; + const GUID *Name; #if !defined(_WIN64) - PVOID Alignment; + PVOID Alignment; #endif }; @@ -3390,9 +3268,9 @@ }; struct _KSFILTERFACTORY { - const KSFILTER_DESCRIPTOR* FilterDescriptor; - KSOBJECT_BAG Bag; - PVOID Context; + const KSFILTER_DESCRIPTOR* FilterDescriptor; + KSOBJECT_BAG Bag; + PVOID Context; }; #define DEFINE_KSFILTER_DESCRIPTOR(descriptor)\ @@ -3433,25 +3311,32 @@ 0,\ NULL +#endif /* _NTDDK_ */ + +/* =============================================================== + Minidriver Callbacks +*/ + +#if defined(_NTDDK_) + +typedef NTSTATUS +(NTAPI *KStrMethodHandler)( + IN PIRP Irp, + IN PKSIDENTIFIER Request, + IN OUT PVOID Data); + +typedef NTSTATUS +(NTAPI *KStrSupportHandler)( + IN PIRP Irp, + IN PKSIDENTIFIER Request, + IN OUT PVOID Data); + #endif -/* =============================================================== - Minidriver Callbacks -*/ -#if defined(_NTDDK_) -typedef NTSTATUS (NTAPI *KStrMethodHandler)( - IN PIRP Irp, - IN PKSIDENTIFIER Request, - IN OUT PVOID Data); - -typedef NTSTATUS (NTAPI *KStrSupportHandler)( - IN PIRP Irp, - IN PKSIDENTIFIER Request, - IN OUT PVOID Data); -#endif /* =============================================================== Allocator Functions */ + #if defined(_NTDDK_) _IRQL_requires_max_(PASSIVE_LEVEL) @@ -3499,11 +3384,12 @@ _In_ ULONG BufferSize, _In_ const KSALLOCATOR_FRAMING_EX *PinFraming); -#endif +#endif /* _NTDDK_ */ /* =============================================================== Clock Functions */ + #if defined(_NTDDK_) _IRQL_requires_max_(DISPATCH_LEVEL) @@ -3607,7 +3493,7 @@ _In_ PKSDEFAULTCLOCK DefaultClock, _In_ LONGLONG Time); -#endif +#endif /* _NTDDK_ */ /* =============================================================== Method Functions @@ -3617,17 +3503,19 @@ #if defined(_NTDDK_) #if 0 + VOID KSMETHOD_SET_IRP_STORAGE( - IN IRP Irp); + IN IRP Irp); VOID KSMETHOD_ITEM_IRP_STORAGE( - IN IRP Irp); + IN IRP Irp); VOID KSMETHOD_TYPE_IRP_STORAGE( - IN IRP Irp); + IN IRP Irp); + #endif _IRQL_requires_max_(PASSIVE_LEVEL) @@ -3664,7 +3552,7 @@ _In_ ULONG MethodSetsCount, _In_reads_(MethodSetsCount) const KSMETHOD_SET *MethodSet); -#endif +#endif /* _NTDDK_ */ /* =============================================================== Property Functions @@ -3715,7 +3603,7 @@ _In_ ULONG PropertySetsCount, _In_reads_(PropertySetsCount) const KSPROPERTY_SET *PropertySet); -#endif +#endif /* _NTDDK_ */ /* =============================================================== Event Functions @@ -3730,13 +3618,13 @@ #define KSPROBE_SYSTEMADDRESS 0x00000040 #define KSPROBE_MODIFY 0x00000200 #define KSPROBE_STREAMWRITEMODIFY (KSPROBE_MODIFY | KSPROBE_STREAMWRITE) -#define KSPROBE_ALLOWFORMATCHANGE 0x00000080 - -#define KSSTREAM_READ KSPROBE_STREAMREAD -#define KSSTREAM_WRITE KSPROBE_STREAMWRITE -#define KSSTREAM_PAGED_DATA 0x00000000 -#define KSSTREAM_NONPAGED_DATA 0x00000100 -#define KSSTREAM_SYNCHRONOUS 0x00001000 +#define KSPROBE_ALLOWFORMATCHANGE 0x00000080 + +#define KSSTREAM_READ KSPROBE_STREAMREAD +#define KSSTREAM_WRITE KSPROBE_STREAMWRITE +#define KSSTREAM_PAGED_DATA 0x00000000 +#define KSSTREAM_NONPAGED_DATA 0x00000100 +#define KSSTREAM_SYNCHRONOUS 0x00001000 #define KSSTREAM_FAILUREEXCEPTION 0x00002000 _IRQL_requires_max_(DISPATCH_LEVEL) @@ -3935,7 +3823,6 @@ KsPinGetNextSiblingPin( _In_ PKSPIN Pin); - /* Does this belong here? */ _IRQL_requires_max_(PASSIVE_LEVEL) @@ -3947,7 +3834,6 @@ _In_ ULONG DataItemsCount, _In_ ULONG DataItemSize, _In_reads_bytes_(DataItemsCount * DataItemSize) const VOID *DataItems); - /* =============================================================== IRP Helper Functions @@ -4301,7 +4187,6 @@ _In_opt_ ULONG Key, _In_ KPROCESSOR_MODE RequestorMode); - KSDDKAPI NTSTATUS NTAPI @@ -4358,7 +4243,6 @@ KsQueueWorkItem( _In_ PKSWORKER Worker, _In_ PWORK_QUEUE_ITEM WorkItem); - /* =============================================================== Resources / Images @@ -4547,7 +4431,7 @@ KsPinGetConnectedPinFileObject( _In_ PKSPIN Pin); -#else +#else /* _NTDDK_ */ #if !defined( KS_NO_CREATE_FUNCTIONS ) @@ -4591,7 +4475,7 @@ #endif -#endif +#endif /* _NTDDK_ */ /* =============================================================== AVStream Functions (XP / DirectX 8) @@ -4839,11 +4723,11 @@ return (PKSDEVICE) KsGetParent((PVOID) FilterFactory); } -#define KsDeleteFilterFactory(FilterFactory) \ - KsFreeObjectCreateItemsByContext( \ - *(KSDEVICE_HEADER *)( \ - KsFilterFactoryGetParentDevice(FilterFactory)->FunctionalDeviceObject-> \ - DeviceExtension), \ +#define KsDeleteFilterFactory(FilterFactory) \ + KsFreeObjectCreateItemsByContext( \ + *(KSDEVICE_HEADER *)( \ + KsFilterFactoryGetParentDevice(FilterFactory)->FunctionalDeviceObject-> \ + DeviceExtension), \ FilterFactory) _IRQL_requires_max_(PASSIVE_LEVEL) @@ -5067,4 +4951,4 @@ } #endif -#endif +#endif /* _KS_ */
11 years, 2 months
1
0
0
0
[akhaldi] 59767: [PSDK] * Annotate ks.h.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Aug 17 22:29:40 2013 New Revision: 59767 URL:
http://svn.reactos.org/svn/reactos?rev=59767&view=rev
Log: [PSDK] * Annotate ks.h. Modified: trunk/reactos/include/psdk/ks.h Modified: trunk/reactos/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ks.h?rev=5976…
============================================================================== --- trunk/reactos/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ks.h [iso-8859-1] Sat Aug 17 22:29:40 2013 @@ -1364,14 +1364,6 @@ KsInvokeOnError = 2, KsInvokeOnCancel = 4 } KSCOMPLETION_INVOCATION; - - -#if defined(_NTDDK_) -/* MOVE ME */ -typedef NTSTATUS (NTAPI *PFNKSCONTEXT_DISPATCH)( - IN PVOID Context, - IN PIRP Irp); -#endif #if defined(_NTDDK_) && !defined(__wtypes_h__) enum VARENUM { @@ -1522,24 +1514,21 @@ #define KSPROPERTY_ITEM_IRP_STORAGE(Irp) (*(const KSPROPERTY_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3]) #define KSPROPERTY_ATTRIBUTES_IRP_STORAGE(Irp) (*(PKSATTRIBUTE_LIST*)&(Irp)->Tail.Overlay.DriverContext[2]) -typedef -VOID -(NTAPI *PFNREFERENCEDEVICEOBJECT)( - IN PVOID Context - ); - -typedef -VOID -(NTAPI *PFNDEREFERENCEDEVICEOBJECT)( - IN PVOID Context - ); - -typedef -NTSTATUS -(NTAPI *PFNQUERYREFERENCESTRING)( - IN PVOID Context, - IN OUT PWCHAR *String - ); +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef VOID +(NTAPI *PFNREFERENCEDEVICEOBJECT)( + _In_ PVOID Context); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef VOID +(NTAPI *PFNDEREFERENCEDEVICEOBJECT)( + _In_ PVOID Context); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNQUERYREFERENCESTRING)( + _In_ PVOID Context, + _Inout_ PWCHAR *String); typedef struct { @@ -1673,51 +1662,55 @@ #define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_UNIFORM 0x00000004 #endif - typedef struct { - KSIDENTIFIER PropTypeSet; - ULONG MembersListCount; - const KSPROPERTY_MEMBERSLIST* MembersList; + KSIDENTIFIER PropTypeSet; + ULONG MembersListCount; + _Field_size_(MembersListCount) const KSPROPERTY_MEMBERSLIST *MembersList; } KSPROPERTY_VALUES, *PKSPROPERTY_VALUES; #if defined(_NTDDK_) -typedef NTSTATUS (NTAPI *PFNKSHANDLER)( - IN PIRP Irp, - IN PKSIDENTIFIER Request, - IN OUT PVOID Data); - -typedef struct -{ - ULONG PropertyId; - union - { - PFNKSHANDLER GetPropertyHandler; - BOOLEAN GetSupported; - }; - ULONG MinProperty; - ULONG MinData; - union { - PFNKSHANDLER SetPropertyHandler; - BOOLEAN SetSupported; - }; - const KSPROPERTY_VALUES * Values; - ULONG RelationsCount; - const KSPROPERTY * Relations; - PFNKSHANDLER SupportHandler; - ULONG SerializedSize; + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSCONTEXT_DISPATCH)( + _In_ PVOID Context, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSHANDLER)( + _In_ PIRP Irp, + _In_ PKSIDENTIFIER Request, + _Inout_ PVOID Data); + +typedef struct { + ULONG PropertyId; + union { + PFNKSHANDLER GetPropertyHandler; + BOOLEAN GetSupported; + }; + ULONG MinProperty; + ULONG MinData; + union { + PFNKSHANDLER SetPropertyHandler; + BOOLEAN SetSupported; + }; + const KSPROPERTY_VALUES *Values; + ULONG RelationsCount; + _Field_size_(RelationsCount) const KSPROPERTY *Relations; + PFNKSHANDLER SupportHandler; + ULONG SerializedSize; } KSPROPERTY_ITEM, *PKSPROPERTY_ITEM; - -typedef -BOOLEAN +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef BOOLEAN (NTAPI *PFNKSFASTHANDLER)( - IN PFILE_OBJECT FileObject, - IN PKSIDENTIFIER Request, - IN ULONG RequestLength, - IN OUT PVOID Data, - IN ULONG DataLength, - OUT PIO_STATUS_BLOCK IoStatus - ); + _In_ PFILE_OBJECT FileObject, + _In_reads_bytes_(RequestLength) PKSIDENTIFIER Request, + _In_ ULONG RequestLength, + _Inout_updates_bytes_(DataLength) PVOID Data, + _In_ ULONG DataLength, + _Out_ PIO_STATUS_BLOCK IoStatus); typedef struct { ULONG PropertyId; @@ -1732,13 +1725,12 @@ ULONG Reserved; } KSFASTPROPERTY_ITEM, *PKSFASTPROPERTY_ITEM; -typedef struct -{ - const GUID* Set; - ULONG PropertiesCount; - const KSPROPERTY_ITEM * PropertyItem; - ULONG FastIoCount; - const KSFASTPROPERTY_ITEM* FastIoTable; +typedef struct { + const GUID *Set; + ULONG PropertiesCount; + _Field_size_(PropertiesCount) const KSPROPERTY_ITEM *PropertyItem; + ULONG FastIoCount; + const KSFASTPROPERTY_ITEM *FastIoTable; } KSPROPERTY_SET, *PKSPROPERTY_SET; #endif @@ -1983,16 +1975,16 @@ #if defined(_NTDDK_) -typedef -LONGLONG +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef LONGLONG (FASTCALL *PFNKSCLOCK_GETTIME)( - IN PFILE_OBJECT FileObject - ); -typedef -LONGLONG + _In_ PFILE_OBJECT FileObject); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef LONGLONG (FASTCALL *PFNKSCLOCK_CORRELATEDTIME)( - IN PFILE_OBJECT FileObject, - OUT PLONGLONG SystemTime); + _In_ PFILE_OBJECT FileObject, + _Out_ PLONGLONG SystemTime); typedef struct { @@ -2091,14 +2083,14 @@ ULONG Flags; } KSOBJECT_CREATE_ITEM, *PKSOBJECT_CREATE_ITEM; -typedef struct -{ - ULONG CreateItemsCount; - PKSOBJECT_CREATE_ITEM CreateItemsList; +typedef struct { + ULONG CreateItemsCount; + _Field_size_(CreateItemsCount) PKSOBJECT_CREATE_ITEM CreateItemsList; } KSOBJECT_CREATE, *PKSOBJECT_CREATE; -typedef VOID (NTAPI *PFNKSITEMFREECALLBACK)( - IN PKSOBJECT_CREATE_ITEM CreateItem); +typedef VOID +(NTAPI *PFNKSITEMFREECALLBACK)( + _In_ PKSOBJECT_CREATE_ITEM CreateItem); #endif @@ -2178,16 +2170,13 @@ MethodId, (PFNKSFASTHANDLER)MethodHandler\ } - -typedef struct -{ - const GUID* Set; - ULONG MethodsCount; - const KSMETHOD_ITEM* MethodItem; - ULONG FastIoCount; - const KSFASTMETHOD_ITEM*FastIoTable; +typedef struct { + const GUID *Set; + ULONG MethodsCount; + _Field_size_(MethodsCount) const KSMETHOD_ITEM *MethodItem; + ULONG FastIoCount; + _Field_size_(FastIoCount) const KSFASTMETHOD_ITEM *FastIoTable; } KSMETHOD_SET, *PKSMETHOD_SET; - #define DEFINE_KSMETHOD_SET(Set,\ MethodsCount,\ @@ -2240,18 +2229,17 @@ typedef struct _KSEVENT_ENTRY KSEVENT_ENTRY, *PKSEVENT_ENTRY; #if defined(_NTDDK_) - -typedef NTSTATUS (NTAPI *PFNKSADDEVENT)( - IN PIRP Irp, - IN PKSEVENTDATA EventData, - IN struct _KSEVENT_ENTRY* EventEntry); - -typedef -VOID + +typedef NTSTATUS +(NTAPI *PFNKSADDEVENT)( + _In_ PIRP Irp, + _In_ PKSEVENTDATA EventData, + _In_ struct _KSEVENT_ENTRY *EventEntry); + +typedef VOID (NTAPI *PFNKSREMOVEEVENT)( - IN PFILE_OBJECT FileObject, - IN struct _KSEVENT_ENTRY* EventEntry - ); + _In_ PFILE_OBJECT FileObject, + _In_ struct _KSEVENT_ENTRY *EventEntry); typedef struct { @@ -2263,11 +2251,10 @@ PFNKSHANDLER SupportHandler; } KSEVENT_ITEM, *PKSEVENT_ITEM; -typedef struct -{ - const GUID* Set; - ULONG EventsCount; - const KSEVENT_ITEM* EventItem; +typedef struct { + const GUID *Set; + ULONG EventsCount; + _Field_size_(EventsCount) const KSEVENT_ITEM *EventItem; } KSEVENT_SET, *PKSEVENT_SET; struct _KSEVENT_ENTRY @@ -2309,86 +2296,74 @@ PVOID Argument2; } KSHANDSHAKE, *PKSHANDSHAKE; -typedef -NTSTATUS +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS (NTAPI *PFNKSPINHANDSHAKE)( - IN PKSPIN Pin, - IN PKSHANDSHAKE In, - IN PKSHANDSHAKE Out - ); - -typedef -void + _In_ PKSPIN Pin, + _In_ PKSHANDSHAKE In, + _In_ PKSHANDSHAKE Out); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef void (NTAPI *PFNKSPINPOWER)( - IN PKSPIN Pin, - IN DEVICE_POWER_STATE State - ); - -typedef -void + _In_ PKSPIN Pin, + _In_ DEVICE_POWER_STATE State); + +typedef void (NTAPI *PFNKSPINFRAMERETURN)( - IN PKSPIN Pin, - IN PVOID Data OPTIONAL, - IN ULONG Size OPTIONAL, - IN PMDL Mdl OPTIONAL, - IN PVOID Context OPTIONAL, - IN NTSTATUS Status - ); - -typedef -void + _In_ PKSPIN Pin, + _In_reads_bytes_opt_(Size) PVOID Data, + _In_opt_ ULONG Size, + _In_opt_ PMDL Mdl, + _In_opt_ PVOID Context, + _In_ NTSTATUS Status); + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef void (NTAPI *PFNKSPINIRPCOMPLETION)( - IN PKSPIN Pin, - IN PIRP Irp - ); - -typedef -NTSTATUS + _In_ PKSPIN Pin, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS (NTAPI *PFNKSPINIRP)( - IN PKSPIN Pin, - IN PIRP Irp - ); - -typedef -NTSTATUS + _In_ PKSPIN Pin, + _In_ PIRP Irp); + +typedef NTSTATUS (NTAPI *PFNKSPIN)( - IN PKSPIN Pin - ); - -typedef -void + _In_ PKSPIN Pin); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef void (NTAPI *PFNKSPINVOID)( - IN PKSPIN Pin - ); - -typedef -void + _In_ PKSPIN Pin); + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef void (NTAPI *PFNKSSTREAMPOINTER)( - IN PKSSTREAM_POINTER StreamPointer - ); + _In_ PKSSTREAM_POINTER StreamPointer); typedef struct { - ULONG Count; - PKSATTRIBUTE* Attributes; + ULONG Count; + _Field_size_(Count) PKSATTRIBUTE *Attributes; } KSATTRIBUTE_LIST, *PKSATTRIBUTE_LIST; -typedef -NTSTATUS +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS (NTAPI *PFNKSPINSETDATAFORMAT)( - IN PKSPIN Pin, - IN PKSDATAFORMAT OldFormat OPTIONAL, - IN PKSMULTIPLE_ITEM OldAttributeList OPTIONAL, - IN const KSDATARANGE* DataRange, - IN const KSATTRIBUTE_LIST* AttributeRange OPTIONAL - ); - -typedef -NTSTATUS + _In_ PKSPIN Pin, + _In_opt_ PKSDATAFORMAT OldFormat, + _In_opt_ PKSMULTIPLE_ITEM OldAttributeList, + _In_ const KSDATARANGE* DataRange, + _In_opt_ const KSATTRIBUTE_LIST* AttributeRange); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS (NTAPI *PFNKSPINSETDEVICESTATE)( - IN PKSPIN Pin, - IN KSSTATE ToState, - IN KSSTATE FromState - ); + _In_ PKSPIN Pin, + _In_ KSSTATE ToState, + _In_ KSSTATE FromState); typedef struct _KSCLOCK_DISPATCH KSCLOCK_DISPATCH, *PKSCLOCK_DISPATCH; typedef struct _KSALLOCATOR_DISPATCH KSALLOCATOR_DISPATCH, *PKSALLOCATOR_DISPATCH; @@ -2407,35 +2382,31 @@ const KSALLOCATOR_DISPATCH* Allocator; } KSPIN_DISPATCH, *PKSPIN_DISPATCH; -typedef -BOOLEAN +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef BOOLEAN (NTAPI *PFNKSPINSETTIMER)( - IN PKSPIN Pin, - IN PKTIMER Timer, - IN LARGE_INTEGER DueTime, - IN PKDPC Dpc - ); - -typedef -BOOLEAN + _In_ PKSPIN Pin, + _In_ PKTIMER Timer, + _In_ LARGE_INTEGER DueTime, + _In_ PKDPC Dpc); + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef BOOLEAN (NTAPI *PFNKSPINCANCELTIMER)( - IN PKSPIN Pin, - IN PKTIMER Timer - ); - -typedef -LONGLONG + _In_ PKSPIN Pin, + _In_ PKTIMER Timer); + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef LONGLONG (FASTCALL *PFNKSPINCORRELATEDTIME)( - IN PKSPIN Pin, - OUT PLONGLONG SystemTime - ); - -typedef -void + _In_ PKSPIN Pin, + _Out_ PLONGLONG SystemTime); + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef void (NTAPI *PFNKSPINRESOLUTION)( - IN PKSPIN Pin, - OUT PKSRESOLUTION Resolution - ); + _In_ PKSPIN Pin, + _Out_ PKSRESOLUTION Resolution); struct _KSCLOCK_DISPATCH { PFNKSPINSETTIMER SetTimer; @@ -2444,23 +2415,25 @@ PFNKSPINRESOLUTION Resolution; }; -typedef -NTSTATUS +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS (NTAPI *PFNKSPININITIALIZEALLOCATOR)( - IN PKSPIN Pin, - IN PKSALLOCATOR_FRAMING AllocatorFraming, - OUT PVOID* Context - ); - -typedef PVOID (NTAPI *PFNKSDELETEALLOCATOR)( - IN PVOID Context); - -typedef PVOID (NTAPI *PFNKSDEFAULTALLOCATE)( - IN PVOID Context); - -typedef PVOID (NTAPI *PFNKSDEFAULTFREE)( - IN PVOID Context, - IN PVOID Buffer); + _In_ PKSPIN Pin, + _In_ PKSALLOCATOR_FRAMING AllocatorFraming, + _Out_ PVOID *Context); + +typedef PVOID +(NTAPI *PFNKSDELETEALLOCATOR)( + _In_ PVOID Context); + +typedef PVOID +(NTAPI *PFNKSDEFAULTALLOCATE)( + _In_ PVOID Context); + +typedef PVOID +(NTAPI *PFNKSDEFAULTFREE)( + _In_ PVOID Context, + _In_ PVOID Buffer); struct _KSALLOCATOR_DISPATCH { PFNKSPININITIALIZEALLOCATOR InitializeAllocator; @@ -2469,66 +2442,62 @@ PFNKSDEFAULTFREE Free; }; -typedef struct -{ - ULONG PropertySetsCount; - ULONG PropertyItemSize; - const KSPROPERTY_SET* PropertySets; - ULONG MethodSetsCount; - ULONG MethodItemSize; - const KSMETHOD_SET* MethodSets; - ULONG EventSetsCount; - ULONG EventItemSize; - const KSEVENT_SET* EventSets; +typedef struct KSAUTOMATION_TABLE_ { + ULONG PropertySetsCount; + ULONG PropertyItemSize; + _Field_size_bytes_(PropertySetsCount * PropertyItemSize) const KSPROPERTY_SET *PropertySets; + ULONG MethodSetsCount; + ULONG MethodItemSize; + _Field_size_bytes_(MethodSetsCount * MethodItemSize) const KSMETHOD_SET *MethodSets; + ULONG EventSetsCount; + ULONG EventItemSize; + _Field_size_bytes_(EventSetsCount * EventItemSize) const KSEVENT_SET *EventSets; #if !defined(_WIN64) - PVOID Alignment; + PVOID Alignment; #endif } KSAUTOMATION_TABLE, *PKSAUTOMATION_TABLE; - - -typedef struct -{ - ULONG InterfacesCount; - const KSPIN_INTERFACE* Interfaces; - ULONG MediumsCount; - const KSPIN_MEDIUM* Mediums; - ULONG DataRangesCount; - const PKSDATARANGE* DataRanges; - KSPIN_DATAFLOW DataFlow; - KSPIN_COMMUNICATION Communication; - const GUID* Category; - const GUID* Name; - union { - LONGLONG Reserved; - struct { - ULONG ConstrainedDataRangesCount; - PKSDATARANGE* ConstrainedDataRanges; - }; +typedef struct { + ULONG InterfacesCount; + _Field_size_(InterfacesCount) const KSPIN_INTERFACE *Interfaces; + ULONG MediumsCount; + _Field_size_(MediumsCount) const KSPIN_MEDIUM *Mediums; + ULONG DataRangesCount; + _Field_size_(DataRangesCount) const PKSDATARANGE *DataRanges; + KSPIN_DATAFLOW DataFlow; + KSPIN_COMMUNICATION Communication; + const GUID *Category; + const GUID *Name; + union { + LONGLONG Reserved; + struct { + ULONG ConstrainedDataRangesCount; + _Field_size_(ConstrainedDataRangesCount) PKSDATARANGE *ConstrainedDataRanges; }; + }; } KSPIN_DESCRIPTOR, *PKSPIN_DESCRIPTOR; -typedef -NTSTATUS +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS (NTAPI *PFNKSINTERSECTHANDLER)( - IN PIRP Irp, - IN PKSP_PIN Pin, - IN PKSDATARANGE DataRange, - OUT PVOID Data OPTIONAL - ); - -typedef -NTSTATUS + _In_ PIRP Irp, + _In_ PKSP_PIN Pin, + _In_ PKSDATARANGE DataRange, + _Out_opt_ PVOID Data); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS (NTAPI *PFNKSINTERSECTHANDLEREX)( - IN PVOID Context, - IN PIRP Irp, - IN PKSP_PIN Pin, - IN PKSDATARANGE DataRange, - IN PKSDATARANGE MatchingDataRange, - IN ULONG DataBufferSize, - OUT PVOID Data OPTIONAL, - OUT PULONG DataSize - ); + _In_ PVOID Context, + _In_ PIRP Irp, + _In_ PKSP_PIN Pin, + _In_ PKSDATARANGE DataRange, + _In_ PKSDATARANGE MatchingDataRange, + _In_ ULONG DataBufferSize, + _Out_writes_bytes_to_opt_(DataBufferSize, *DataSize) PVOID Data, + _Out_ PULONG DataSize); typedef struct { @@ -2748,15 +2717,9 @@ DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral)\ } - - -typedef -void +typedef void (NTAPI *PFNKSFREE)( - IN PVOID Data - ); - - + _In_ PVOID Data); #define DEFINE_KSPROPERTY_TABLE(tablename)\ const KSPROPERTY_ITEM tablename[] = @@ -2784,16 +2747,15 @@ ULONG ToNodePin; } KSTOPOLOGY_CONNECTION, *PKSTOPOLOGY_CONNECTION; -typedef struct -{ - ULONG CategoriesCount; - const GUID* Categories; - ULONG TopologyNodesCount; - const GUID* TopologyNodes; - ULONG TopologyConnectionsCount; - const KSTOPOLOGY_CONNECTION* TopologyConnections; - const GUID* TopologyNodesNames; - ULONG Reserved; +typedef struct { + ULONG CategoriesCount; + _Field_size_(CategoriesCount) const GUID *Categories; + ULONG TopologyNodesCount; + _Field_size_(TopologyNodesCount) const GUID *TopologyNodes; + ULONG TopologyConnectionsCount; + _Field_size_(TopologyConnectionsCount) const KSTOPOLOGY_CONNECTION *TopologyConnections; + _Field_size_(TopologyNodesCount) const GUID *TopologyNodesNames; + ULONG Reserved; } KSTOPOLOGY, *PKSTOPOLOGY; @@ -2844,41 +2806,43 @@ /* TODO */ typedef void* UNKNOWN; -typedef PVOID (NTAPI *PFNKSINITIALIZEALLOCATOR)( - IN PVOID InitialContext, - IN PKSALLOCATOR_FRAMING AllocatorFraming, - OUT PVOID* Context); +typedef PVOID +(NTAPI *PFNKSINITIALIZEALLOCATOR)( + _In_ PVOID InitialContext, + _In_ PKSALLOCATOR_FRAMING AllocatorFraming, + _Outptr_ PVOID *Context); #if defined(_NTDDK_) -typedef NTSTATUS (NTAPI *PFNKSALLOCATOR)( - IN PIRP Irp, - IN ULONG BufferSize, - IN BOOLEAN InputOperation); - -typedef NTSTATUS (NTAPI *PFNKINTERSECTHANDLEREX)( - IN PVOID Context, - IN PIRP Irp, - IN PKSP_PIN Pin, - IN PKSDATARANGE DataRange, - IN PKSDATARANGE MatchingDataRange, - IN ULONG DataBufferSize, - OUT PVOID Data OPTIONAL, - OUT PULONG DataSize); - - -typedef -NTSTATUS + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSALLOCATOR)( + _In_ PIRP Irp, + _In_ ULONG BufferSize, + _In_ BOOLEAN InputOperation); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKINTERSECTHANDLEREX)( + _In_ PVOID Context, + _In_ PIRP Irp, + _In_ PKSP_PIN Pin, + _In_ PKSDATARANGE DataRange, + _In_ PKSDATARANGE MatchingDataRange, + _In_ ULONG DataBufferSize, + _Out_writes_bytes_to_opt_(DataBufferSize, *DataSize) PVOID Data, + _Out_ PULONG DataSize); + +typedef NTSTATUS (NTAPI *PFNALLOCATOR_ALLOCATEFRAME)( - IN PFILE_OBJECT FileObject, - PVOID *Frame - ); - -typedef -VOID + _In_ PFILE_OBJECT FileObject, + _Outptr_ PVOID *Frame); + +typedef VOID (NTAPI *PFNALLOCATOR_FREEFRAME)( - IN PFILE_OBJECT FileObject, - IN PVOID Frame - ); + _In_ PFILE_OBJECT FileObject, + _In_ PVOID Frame); typedef struct { PFNALLOCATOR_ALLOCATEFRAME AllocateFrame; @@ -2943,11 +2907,12 @@ #ifndef _NTOS_ +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateTurnInputOn( - IN PKSGATE Gate OPTIONAL) + _In_opt_ PKSGATE Gate) { while (Gate && (InterlockedIncrement(&Gate->Count) == 1)) { @@ -2955,11 +2920,12 @@ } } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateTurnInputOff( - IN PKSGATE Gate OPTIONAL) + _In_opt_ PKSGATE Gate) { while (Gate && (InterlockedDecrement(&Gate->Count) == 0)) { @@ -2967,21 +2933,23 @@ } } +_IRQL_requires_max_(HIGH_LEVEL) static BOOLEAN __inline KsGateGetStateUnsafe( - IN PKSGATE Gate) + _In_ PKSGATE Gate) { ASSERT(Gate); return((BOOLEAN)(Gate->Count > 0)); } +_IRQL_requires_max_(HIGH_LEVEL) static BOOLEAN __inline KsGateCaptureThreshold( - IN PKSGATE Gate) + _In_ PKSGATE Gate) { BOOLEAN captured; @@ -2997,15 +2965,15 @@ return captured; } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateInitialize( - IN PKSGATE Gate, - IN LONG InitialCount, - IN PKSGATE NextGate OPTIONAL, - IN BOOLEAN StateToPropagate - ) + _In_ PKSGATE Gate, + _In_ LONG InitialCount, + _In_opt_ PKSGATE NextGate, + _In_ BOOLEAN StateToPropagate) { ASSERT(Gate); Gate->Count = InitialCount; @@ -3030,103 +2998,114 @@ } } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateInitializeAnd( - IN PKSGATE AndGate, - IN PKSGATE NextOrGate OPTIONAL) + _In_ PKSGATE AndGate, + _In_opt_ PKSGATE NextOrGate) { KsGateInitialize(AndGate,1,NextOrGate,TRUE); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateInitializeOr( - IN PKSGATE OrGate, - IN PKSGATE NextAndGate OPTIONAL) + _In_ PKSGATE OrGate, + _In_opt_ PKSGATE NextAndGate) { KsGateInitialize(OrGate,0,NextAndGate,FALSE); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateAddOnInputToAnd( - IN PKSGATE AndGate) + _In_ PKSGATE AndGate) { UNREFERENCED_PARAMETER (AndGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateAddOffInputToAnd( - IN PKSGATE AndGate) + _In_ PKSGATE AndGate) { KsGateTurnInputOff(AndGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateRemoveOnInputFromAnd( - IN PKSGATE AndGate) + _In_ PKSGATE AndGate) { UNREFERENCED_PARAMETER (AndGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateRemoveOffInputFromAnd( - IN PKSGATE AndGate) + _In_ PKSGATE AndGate) { KsGateTurnInputOn(AndGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateAddOnInputToOr( - IN PKSGATE OrGate) + _In_ PKSGATE OrGate) { KsGateTurnInputOn(OrGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateAddOffInputToOr( - IN PKSGATE OrGate) + _In_ PKSGATE OrGate) { UNREFERENCED_PARAMETER (OrGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateRemoveOnInputFromOr( - IN PKSGATE OrGate) + _In_ PKSGATE OrGate) { KsGateTurnInputOff(OrGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateRemoveOffInputFromOr( - IN PKSGATE OrGate) + _In_ PKSGATE OrGate) { UNREFERENCED_PARAMETER (OrGate); } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateTerminateAnd( - IN PKSGATE AndGate) + _In_ PKSGATE AndGate) { ASSERT(AndGate); if (KsGateGetStateUnsafe(AndGate)) @@ -3139,11 +3118,12 @@ } } +_IRQL_requires_max_(HIGH_LEVEL) static void __inline KsGateTerminateOr( - IN PKSGATE OrGate) + _In_ PKSGATE OrGate) { ASSERT(OrGate); if (KsGateGetStateUnsafe(OrGate)) @@ -3189,7 +3169,9 @@ ULONG Count; ULONG Remaining; }; + #if defined(_NTDDK_) + struct _KSSTREAM_POINTER { PVOID Context; @@ -3200,25 +3182,24 @@ KSSTREAM_POINTER_OFFSET OffsetOut; }; -struct _KSPROCESSPIN -{ - PKSPIN Pin; - PKSSTREAM_POINTER StreamPointer; - PKSPROCESSPIN InPlaceCounterpart; - PKSPROCESSPIN DelegateBranch; - PKSPROCESSPIN CopySource; - PVOID Data; - ULONG BytesAvailable; - ULONG BytesUsed; - ULONG Flags; - BOOLEAN Terminate; +struct _KSPROCESSPIN { + PKSPIN Pin; + PKSSTREAM_POINTER StreamPointer; + PKSPROCESSPIN InPlaceCounterpart; + PKSPROCESSPIN DelegateBranch; + PKSPROCESSPIN CopySource; + _Field_size_bytes_(BytesAvailable) PVOID Data; + ULONG BytesAvailable; + ULONG BytesUsed; + ULONG Flags; + BOOLEAN Terminate; }; -struct _KSPROCESSPIN_INDEXENTRY -{ - PKSPROCESSPIN* Pins; - ULONG Count; +struct _KSPROCESSPIN_INDEXENTRY { + _Field_size_(Count) PKSPROCESSPIN *Pins; + ULONG Count; }; + #endif /* =============================================================== @@ -3236,45 +3217,61 @@ typedef struct _KSFILTER_DESCRIPTOR KSFILTER_DESCRIPTOR, *PKSFILTER_DESCRIPTOR; typedef struct _KSDEVICE_DESCRIPTOR KSDEVICE_DESCRIPTOR, *PKSDEVICE_DESCRIPTOR; -typedef NTSTATUS (NTAPI *PFNKSDEVICECREATE)( - IN PKSDEVICE Device); - -typedef NTSTATUS (NTAPI *PFNKSDEVICEPNPSTART)( - IN PKSDEVICE Device, - IN PIRP Irp, - IN PCM_RESOURCE_LIST TranslatedResourceList OPTIONAL, - IN PCM_RESOURCE_LIST UntranslatedResourceList OPTIONAL); - -typedef NTSTATUS (NTAPI *PFNKSDEVICE)( - IN PKSDEVICE Device); - -typedef NTSTATUS (NTAPI *PFNKSDEVICEIRP)( - IN PKSDEVICE Device, - IN PIRP Irp); - -typedef VOID (NTAPI *PFNKSDEVICEIRPVOID)( - IN PKSDEVICE Device, - IN PIRP Irp); - -typedef NTSTATUS (NTAPI *PFNKSDEVICEQUERYCAPABILITIES)( - IN PKSDEVICE Device, - IN PIRP Irp, - IN OUT PDEVICE_CAPABILITIES Capabilities); - -typedef NTSTATUS (NTAPI *PFNKSDEVICEQUERYPOWER)( - IN PKSDEVICE Device, - IN PIRP Irp, - IN DEVICE_POWER_STATE DeviceTo, - IN DEVICE_POWER_STATE DeviceFrom, - IN SYSTEM_POWER_STATE SystemTo, - IN SYSTEM_POWER_STATE SystemFrom, - IN POWER_ACTION Action); - -typedef VOID (NTAPI *PFNKSDEVICESETPOWER)( - IN PKSDEVICE Device, - IN PIRP Irp, - IN DEVICE_POWER_STATE To, - IN DEVICE_POWER_STATE From); +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSDEVICECREATE)( + _In_ PKSDEVICE Device); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSDEVICEPNPSTART)( + _In_ PKSDEVICE Device, + _In_ PIRP Irp, + _In_opt_ PCM_RESOURCE_LIST TranslatedResourceList, + _In_opt_ PCM_RESOURCE_LIST UntranslatedResourceList); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSDEVICE)( + _In_ PKSDEVICE Device); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSDEVICEIRP)( + _In_ PKSDEVICE Device, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef VOID +(NTAPI *PFNKSDEVICEIRPVOID)( + _In_ PKSDEVICE Device, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSDEVICEQUERYCAPABILITIES)( + _In_ PKSDEVICE Device, + _In_ PIRP Irp, + _Inout_ PDEVICE_CAPABILITIES Capabilities); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSDEVICEQUERYPOWER)( + _In_ PKSDEVICE Device, + _In_ PIRP Irp, + _In_ DEVICE_POWER_STATE DeviceTo, + _In_ DEVICE_POWER_STATE DeviceFrom, + _In_ SYSTEM_POWER_STATE SystemTo, + _In_ SYSTEM_POWER_STATE SystemFrom, + _In_ POWER_ACTION Action); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef VOID +(NTAPI *PFNKSDEVICESETPOWER)( + _In_ PKSDEVICE Device, + _In_ PIRP Irp, + _In_ DEVICE_POWER_STATE To, + _In_ DEVICE_POWER_STATE From); typedef struct _KSDEVICE_DISPATCH { PFNKSDEVICECREATE Add; @@ -3323,23 +3320,27 @@ PVOID Context; }; -typedef -void +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef void (NTAPI *PFNKSFILTERPOWER)( - IN PKSFILTER Filter, - IN DEVICE_POWER_STATE State - ); - -typedef NTSTATUS (NTAPI *PFNKSFILTERIRP)( - IN PKSFILTER Filter, - IN PIRP Irp); - -typedef NTSTATUS (NTAPI *PFNKSFILTERPROCESS)( - IN PKSFILTER Filter, - IN PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex); - -typedef NTSTATUS (NTAPI *PFNKSFILTERVOID)( - IN PKSFILTER Filter); + _In_ PKSFILTER Filter, + _In_ DEVICE_POWER_STATE State); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSFILTERIRP)( + _In_ PKSFILTER Filter, + _In_ PIRP Irp); + +typedef NTSTATUS +(NTAPI *PFNKSFILTERPROCESS)( + _In_ PKSFILTER Filter, + _In_ PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSFILTERVOID)( + _In_ PKSFILTER Filter); struct _KSFILTER_DISPATCH { @@ -3359,35 +3360,33 @@ #endif }; -struct _KSFILTER_DESCRIPTOR -{ - const KSFILTER_DISPATCH* Dispatch; - const KSAUTOMATION_TABLE* AutomationTable; - ULONG Version; - ULONG Flags; - const GUID* ReferenceGuid; - ULONG PinDescriptorsCount; - ULONG PinDescriptorSize; - const KSPIN_DESCRIPTOR_EX* PinDescriptors; - ULONG CategoriesCount; - const GUID* Categories; - ULONG NodeDescriptorsCount; - ULONG NodeDescriptorSize; - const KSNODE_DESCRIPTOR* NodeDescriptors; - ULONG ConnectionsCount; - const KSTOPOLOGY_CONNECTION* Connections; - const KSCOMPONENTID* ComponentId; +struct _KSFILTER_DESCRIPTOR { + const KSFILTER_DISPATCH *Dispatch; + const KSAUTOMATION_TABLE *AutomationTable; + ULONG Version; + ULONG Flags; + const GUID *ReferenceGuid; + ULONG PinDescriptorsCount; + ULONG PinDescriptorSize; + _Field_size_bytes_(PinDescriptorsCount * PinDescriptorSize) const KSPIN_DESCRIPTOR_EX *PinDescriptors; + ULONG CategoriesCount; + _Field_size_(CategoriesCount) const GUID *Categories; + ULONG NodeDescriptorsCount; + ULONG NodeDescriptorSize; + _Field_size_bytes_(NodeDescriptorsCount * NodeDescriptorSize) const KSNODE_DESCRIPTOR *NodeDescriptors; + ULONG ConnectionsCount; + _Field_size_(ConnectionsCount) const KSTOPOLOGY_CONNECTION *Connections; + const KSCOMPONENTID *ComponentId; }; #define KSFILTER_DESCRIPTOR_VERSION ((ULONG)-1) -struct _KSDEVICE_DESCRIPTOR -{ - const KSDEVICE_DISPATCH* Dispatch; - ULONG FilterDescriptorsCount; - const KSFILTER_DESCRIPTOR*const* FilterDescriptors; - ULONG Version; - ULONG Flags; +struct _KSDEVICE_DESCRIPTOR { + const KSDEVICE_DISPATCH *Dispatch; + ULONG FilterDescriptorsCount; + _Field_size_(FilterDescriptorsCount) const KSFILTER_DESCRIPTOR * const *FilterDescriptors; + ULONG Version; + ULONG Flags; }; struct _KSFILTERFACTORY { @@ -3454,106 +3453,160 @@ Allocator Functions */ #if defined(_NTDDK_) -KSDDKAPI NTSTATUS NTAPI + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsCreateAllocator( - IN HANDLE ConnectionHandle, - IN PKSALLOCATOR_FRAMING AllocatorFraming, - OUT PHANDLE AllocatorHandle); - -KSDDKAPI NTSTATUS NTAPI + _In_ HANDLE ConnectionHandle, + _In_ PKSALLOCATOR_FRAMING AllocatorFraming, + _Out_ PHANDLE AllocatorHandle); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsCreateDefaultAllocator( - IN PIRP Irp); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsValidateAllocatorCreateRequest( - IN PIRP Irp, - OUT PKSALLOCATOR_FRAMING* AllocatorFraming); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _Out_ PKSALLOCATOR_FRAMING *AllocatorFraming); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsCreateDefaultAllocatorEx( - IN PIRP Irp, - IN PVOID InitializeContext OPTIONAL, - IN PFNKSDEFAULTALLOCATE DefaultAllocate OPTIONAL, - IN PFNKSDEFAULTFREE DefaultFree OPTIONAL, - IN PFNKSINITIALIZEALLOCATOR InitializeAllocator OPTIONAL, - IN PFNKSDELETEALLOCATOR DeleteAllocator OPTIONAL); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _In_opt_ PVOID InitializeContext, + _In_opt_ PFNKSDEFAULTALLOCATE DefaultAllocate, + _In_opt_ PFNKSDEFAULTFREE DefaultFree, + _In_opt_ PFNKSINITIALIZEALLOCATOR InitializeAllocator, + _In_opt_ PFNKSDELETEALLOCATOR DeleteAllocator); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsValidateAllocatorFramingEx( - IN PKSALLOCATOR_FRAMING_EX Framing, - IN ULONG BufferSize, - IN const KSALLOCATOR_FRAMING_EX* PinFraming); + _In_ PKSALLOCATOR_FRAMING_EX Framing, + _In_ ULONG BufferSize, + _In_ const KSALLOCATOR_FRAMING_EX *PinFraming); + #endif /* =============================================================== Clock Functions */ #if defined(_NTDDK_) -typedef BOOLEAN (NTAPI *PFNKSSETTIMER)( - IN PVOID Context, - IN PKTIMER Timer, - IN LARGE_INTEGER DueTime, - IN PKDPC Dpc); - -typedef BOOLEAN (NTAPI *PFNKSCANCELTIMER)( - IN PVOID Context, - IN PKTIMER Timer); - -typedef LONGLONG (FASTCALL *PFNKSCORRELATEDTIME)( - IN PVOID Context, - OUT PLONGLONG SystemTime); - -KSDDKAPI NTSTATUS NTAPI + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef BOOLEAN +(NTAPI *PFNKSSETTIMER)( + _In_ PVOID Context, + _In_ PKTIMER Timer, + _In_ LARGE_INTEGER DueTime, + _In_ PKDPC Dpc); + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef BOOLEAN +(NTAPI *PFNKSCANCELTIMER)( + _In_ PVOID Context, + _In_ PKTIMER Timer); + +typedef LONGLONG +(FASTCALL *PFNKSCORRELATEDTIME)( + _In_ PVOID Context, + _Out_ PLONGLONG SystemTime); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsCreateClock( - IN HANDLE ConnectionHandle, - IN PKSCLOCK_CREATE ClockCreate, - OUT PHANDLE ClockHandle); - -KSDDKAPI NTSTATUS NTAPI + _In_ HANDLE ConnectionHandle, + _In_ PKSCLOCK_CREATE ClockCreate, + _Out_ PHANDLE ClockHandle); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsCreateDefaultClock( - IN PIRP Irp, - IN PKSDEFAULTCLOCK DefaultClock); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _In_ PKSDEFAULTCLOCK DefaultClock); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsAllocateDefaultClock( - OUT PKSDEFAULTCLOCK* DefaultClock); - -KSDDKAPI NTSTATUS NTAPI + _Out_ PKSDEFAULTCLOCK *DefaultClock); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsAllocateDefaultClockEx( - OUT PKSDEFAULTCLOCK* DefaultClock, - IN PVOID Context OPTIONAL, - IN PFNKSSETTIMER SetTimer OPTIONAL, - IN PFNKSCANCELTIMER CancelTimer OPTIONAL, - IN PFNKSCORRELATEDTIME CorrelatedTime OPTIONAL, - IN const KSRESOLUTION* Resolution OPTIONAL, - IN ULONG Flags); - -KSDDKAPI VOID NTAPI + _Out_ PKSDEFAULTCLOCK *DefaultClock, + _In_opt_ PVOID Context, + _In_opt_ PFNKSSETTIMER SetTimer, + _In_opt_ PFNKSCANCELTIMER CancelTimer, + _In_opt_ PFNKSCORRELATEDTIME CorrelatedTime, + _In_opt_ const KSRESOLUTION *Resolution, + _In_ ULONG Flags); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsFreeDefaultClock( - IN PKSDEFAULTCLOCK DefaultClock); - -KSDDKAPI NTSTATUS NTAPI + _In_ PKSDEFAULTCLOCK DefaultClock); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsValidateClockCreateRequest( - IN PIRP Irp, - OUT PKSCLOCK_CREATE* ClockCreate); - -KSDDKAPI KSSTATE NTAPI + _In_ PIRP Irp, + _Outptr_ PKSCLOCK_CREATE *ClockCreate); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +KSSTATE +NTAPI KsGetDefaultClockState( - IN PKSDEFAULTCLOCK DefaultClock); - -KSDDKAPI VOID NTAPI + _In_ PKSDEFAULTCLOCK DefaultClock); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +VOID +NTAPI KsSetDefaultClockState( - IN PKSDEFAULTCLOCK DefaultClock, - IN KSSTATE State); - -KSDDKAPI LONGLONG NTAPI + _In_ PKSDEFAULTCLOCK DefaultClock, + _In_ KSSTATE State); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +LONGLONG +NTAPI KsGetDefaultClockTime( - IN PKSDEFAULTCLOCK DefaultClock); - -KSDDKAPI VOID NTAPI + _In_ PKSDEFAULTCLOCK DefaultClock); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +VOID +NTAPI KsSetDefaultClockTime( - IN PKSDEFAULTCLOCK DefaultClock, - IN LONGLONG Time); + _In_ PKSDEFAULTCLOCK DefaultClock, + _In_ LONGLONG Time); + #endif /* =============================================================== @@ -3562,6 +3615,7 @@ /* Method sets - TODO: Make into macros! */ #if defined(_NTDDK_) + #if 0 VOID KSMETHOD_SET_IRP_STORAGE( @@ -3576,66 +3630,91 @@ IN IRP Irp); #endif -KSDDKAPI NTSTATUS NTAPI +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsMethodHandler( - IN PIRP Irp, - IN ULONG MethodSetsCount, - IN PKSMETHOD_SET MethodSet); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _In_ ULONG MethodSetsCount, + _In_reads_(MethodSetsCount) const PKSMETHOD_SET MethodSet); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsMethodHandlerWithAllocator( - IN PIRP Irp, - IN ULONG MethodSetsCount, - IN PKSMETHOD_SET MethodSet, - IN PFNKSALLOCATOR Allocator OPTIONAL, - IN ULONG MethodItemSize OPTIONAL); - -KSDDKAPI BOOLEAN NTAPI + _In_ PIRP Irp, + _In_ ULONG MethodSetsCount, + _In_reads_(MethodSetsCount) const PKSMETHOD_SET MethodSet, + _In_opt_ PFNKSALLOCATOR Allocator, + _In_opt_ ULONG MethodItemSize); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +BOOLEAN +NTAPI KsFastMethodHandler( - IN PFILE_OBJECT FileObject, - IN PKSMETHOD UNALIGNED Method, - IN ULONG MethodLength, - IN OUT PVOID UNALIGNED Data, - IN ULONG DataLength, - OUT PIO_STATUS_BLOCK IoStatus, - IN ULONG MethodSetsCount, - IN const KSMETHOD_SET* MethodSet); + _In_ PFILE_OBJECT FileObject, + _In_reads_bytes_(MethodLength) PKSMETHOD UNALIGNED Method, + _In_ ULONG MethodLength, + _Inout_updates_bytes_(DataLength) PVOID UNALIGNED Data, + _In_ ULONG DataLength, + _Out_ PIO_STATUS_BLOCK IoStatus, + _In_ ULONG MethodSetsCount, + _In_reads_(MethodSetsCount) const KSMETHOD_SET *MethodSet); + #endif /* =============================================================== Property Functions */ + #if defined(_NTDDK_) -KSDDKAPI NTSTATUS NTAPI + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsPropertyHandler( - IN PIRP Irp, - IN ULONG PropertySetsCount, - IN const KSPROPERTY_SET* PropertySet); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _In_ ULONG PropertySetsCount, + _In_reads_(PropertySetsCount) const KSPROPERTY_SET *PropertySet); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsPropertyHandlerWithAllocator( - IN PIRP Irp, - IN ULONG PropertySetsCount, - IN PKSPROPERTY_SET PropertySet, - IN PFNKSALLOCATOR Allocator OPTIONAL, - IN ULONG PropertyItemSize OPTIONAL); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _In_ ULONG PropertySetsCount, + _In_reads_(PropertySetsCount) const PKSPROPERTY_SET PropertySet, + _In_opt_ PFNKSALLOCATOR Allocator, + _In_opt_ ULONG PropertyItemSize); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsUnserializeObjectPropertiesFromRegistry( - IN PFILE_OBJECT FileObject, - IN HANDLE ParentKey OPTIONAL, - IN PUNICODE_STRING RegistryPath OPTIONAL); - -KSDDKAPI BOOLEAN NTAPI + _In_ PFILE_OBJECT FileObject, + _In_opt_ HANDLE ParentKey, + _In_opt_ PUNICODE_STRING RegistryPath); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +BOOLEAN +NTAPI KsFastPropertyHandler( - IN PFILE_OBJECT FileObject, - IN PKSPROPERTY UNALIGNED Property, - IN ULONG PropertyLength, - IN OUT PVOID UNALIGNED Data, - IN ULONG DataLength, - OUT PIO_STATUS_BLOCK IoStatus, - IN ULONG PropertySetsCount, - IN const KSPROPERTY_SET* PropertySet); + _In_ PFILE_OBJECT FileObject, + _In_reads_bytes_(PropertyLength) PKSPROPERTY UNALIGNED Property, + _In_ ULONG PropertyLength, + _In_reads_bytes_(DataLength) PVOID UNALIGNED Data, + _In_ ULONG DataLength, + _Out_ PIO_STATUS_BLOCK IoStatus, + _In_ ULONG PropertySetsCount, + _In_reads_(PropertySetsCount) const KSPROPERTY_SET *PropertySet); + #endif /* =============================================================== @@ -3660,634 +3739,856 @@ #define KSSTREAM_SYNCHRONOUS 0x00001000 #define KSSTREAM_FAILUREEXCEPTION 0x00002000 -typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef BOOLEAN +(NTAPI *PFNKSGENERATEEVENTCALLBACK)( + _In_ PVOID Context, + _In_ PKSEVENT_ENTRY EventEntry); + +KSDDKAPI +NTSTATUS +NTAPI +KsGenerateEvent( + _In_ PKSEVENT_ENTRY EntryEvent); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +void +NTAPI +KsGenerateEvents( + _In_ PVOID Object, + _In_opt_ const GUID *EventSet, + _In_ ULONG EventId, + _In_ ULONG DataSize, + _In_reads_bytes_opt_(DataSize) PVOID Data, + _In_opt_ PFNKSGENERATEEVENTCALLBACK CallBack, + _In_opt_ PVOID CallBackContext); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsEnableEventWithAllocator( + _In_ PIRP Irp, + _In_ ULONG EventSetsCount, + _In_reads_(EventSetsCount) const PKSEVENT_SET EventSet, + _Inout_opt_ PLIST_ENTRY EventsList, + _In_opt_ KSEVENTS_LOCKTYPE EventsFlags, + _In_opt_ PVOID EventsLock, + _In_opt_ PFNKSALLOCATOR Allocator, + _In_opt_ ULONG EventItemSize); + +KSDDKAPI +NTSTATUS +NTAPI +KsGenerateDataEvent( + _In_ PKSEVENT_ENTRY EventEntry, + _In_ ULONG DataSize, + _In_reads_bytes_(DataSize) PVOID Data); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsEnableEvent( + _In_ PIRP Irp, + _In_ ULONG EventSetsCount, + _In_reads_(EventSetsCount) KSEVENT_SET *EventSet, + _Inout_opt_ PLIST_ENTRY EventsList, + _In_opt_ KSEVENTS_LOCKTYPE EventsFlags, + _In_opt_ PVOID EventsLock); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI +KsDiscardEvent( + _In_ PKSEVENT_ENTRY EventEntry); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsDisableEvent( + _In_ PIRP Irp, + _Inout_ PLIST_ENTRY EventsList, + _In_ KSEVENTS_LOCKTYPE EventsFlags, + _In_ PVOID EventsLock); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI +KsFreeEventList( + _In_ PFILE_OBJECT FileObject, + _Inout_ PLIST_ENTRY EventsList, + _In_ KSEVENTS_LOCKTYPE EventsFlags, + _In_ PVOID EventsLock); + +/* =============================================================== + Topology Functions +*/ + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsValidateTopologyNodeCreateRequest( + _In_ PIRP Irp, + _In_ PKSTOPOLOGY Topology, + _Out_ PKSNODE_CREATE *NodeCreate); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsCreateTopologyNode( + _In_ HANDLE ParentHandle, + _In_ PKSNODE_CREATE NodeCreate, + _In_ ACCESS_MASK DesiredAccess, + _Out_ PHANDLE NodeHandle); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsTopologyPropertyHandler( + _In_ PIRP Irp, + _In_ PKSPROPERTY Property, + _Inout_ PVOID Data, + _In_ const KSTOPOLOGY *Topology); + +/* =============================================================== + Connectivity Functions +*/ + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsCreatePin( + _In_ HANDLE FilterHandle, + _In_ PKSPIN_CONNECT Connect, + _In_ ACCESS_MASK DesiredAccess, + _Out_ PHANDLE ConnectionHandle); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsValidateConnectRequest( + _In_ PIRP Irp, + _In_ ULONG DescriptorsCount, + _In_reads_(DescriptorsCount) KSPIN_DESCRIPTOR *Descriptor, + _Out_ PKSPIN_CONNECT *Connect); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsPinPropertyHandler( + _In_ PIRP Irp, + _In_ PKSPROPERTY Property, + _Inout_ PVOID Data, + _In_ ULONG DescriptorsCount, + _In_reads_(DescriptorsCount) const KSPIN_DESCRIPTOR *Descriptor); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsPinDataIntersection( + _In_ PIRP Irp, + _In_ PKSP_PIN Pin, + _Out_opt_ PVOID Data, + _In_ ULONG DescriptorsCount, + _In_reads_(DescriptorsCount) const KSPIN_DESCRIPTOR *Descriptor, + _In_ PFNKSINTERSECTHANDLER IntersectHandler); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsPinDataIntersectionEx( + _In_ PIRP Irp, + _In_ PKSP_PIN Pin, + _Out_ PVOID Data, + _In_ ULONG DescriptorsCount, + _In_reads_bytes_(DescriptorsCount * DescriptorSize) const KSPIN_DESCRIPTOR *Descriptor, + _In_ ULONG DescriptorSize, + _In_opt_ PFNKSINTERSECTHANDLEREX IntersectHandler, + _In_opt_ PVOID HandlerContext); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +PKSFILTER +NTAPI +KsPinGetParentFilter( + _In_ PKSPIN Pin); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +PKSPIN +NTAPI +KsPinGetNextSiblingPin( + _In_ PKSPIN Pin); + + +/* Does this belong here? */ + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsHandleSizedListQuery( + _In_ PIRP Irp, + _In_ ULONG DataItemsCount, + _In_ ULONG DataItemSize, + _In_reads_bytes_(DataItemsCount * DataItemSize) const VOID *DataItems); + + +/* =============================================================== + IRP Helper Functions +*/ + +_IRQL_requires_max_(DISPATCH_LEVEL) +typedef NTSTATUS +(NTAPI *PFNKSIRPLISTCALLBACK)( + _In_ PIRP Irp, + _In_ PVOID Context); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsAcquireResetValue( + _In_ PIRP Irp, + _Out_ KSRESET *ResetValue); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +VOID +NTAPI +KsAddIrpToCancelableQueue( + _Inout_ PLIST_ENTRY QueueHead, + _In_ PKSPIN_LOCK SpinLock, + _In_ PIRP Irp, + _In_ KSLIST_ENTRY_LOCATION ListLocation, + _In_opt_ PDRIVER_CANCEL DriverCancel); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsAddObjectCreateItemToDeviceHeader( + _In_ KSDEVICE_HEADER Header, + _In_ PDRIVER_DISPATCH Create, + _In_ PVOID Context, + _In_ PWSTR ObjectClass, + _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsAddObjectCreateItemToObjectHeader( + _In_ KSOBJECT_HEADER Header, + _In_ PDRIVER_DISPATCH Create, + _In_ PVOID Context, + _In_ PWSTR ObjectClass, + _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor); + +_IRQL_requires_max_(APC_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsAllocateDeviceHeader( + _Out_ KSDEVICE_HEADER *Header, + _In_ ULONG ItemsCount, + _In_reads_opt_(ItemsCount) PKSOBJECT_CREATE_ITEM ItemsList); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsAllocateExtraData( + _Inout_ PIRP Irp, + _In_ ULONG ExtraSize, + _Out_ PVOID *ExtraBuffer); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsAllocateObjectCreateItem( + _In_ KSDEVICE_HEADER Header, + _In_ PKSOBJECT_CREATE_ITEM CreateItem, + _In_ BOOLEAN AllocateEntry, + _In_opt_ PFNKSITEMFREECALLBACK ItemFreeCallback); + +_IRQL_requires_max_(APC_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsAllocateObjectHeader( + _Out_ KSOBJECT_HEADER *Header, + _In_ ULONG ItemsCount, + _In_reads_opt_(ItemsCount) PKSOBJECT_CREATE_ITEM ItemsList, + _In_ PIRP Irp, + _In_ KSDISPATCH_TABLE *Table); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +VOID +NTAPI +KsCancelIo( + _Inout_ PLIST_ENTRY QueueHead, + _In_ PKSPIN_LOCK SpinLock); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +VOID +NTAPI +KsCancelRoutine( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsDefaultDeviceIoCompletion( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI BOOLEAN -(NTAPI *PFNKSGENERATEEVENTCALLBACK)( - IN PVOID Context, - IN PKSEVENT_ENTRY EventEntry - ); - -KSDDKAPI NTSTATUS NTAPI -KsGenerateEvent( - IN PKSEVENT_ENTRY EntryEvent); - -KSDDKAPI void NTAPI -KsGenerateEvents( - IN PVOID Object, - IN const GUID* EventSet OPTIONAL, - IN ULONG EventId, - IN ULONG DataSize, - IN PVOID Data OPTIONAL, - IN PFNKSGENERATEEVENTCALLBACK CallBack OPTIONAL, - IN PVOID CallBackContext OPTIONAL - ); - - -KSDDKAPI NTSTATUS NTAPI -KsEnableEventWithAllocator( - IN PIRP Irp, - IN ULONG EventSetsCount, - IN PKSEVENT_SET EventSet, - IN OUT PLIST_ENTRY EventsList OPTIONAL, - IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL, - IN PVOID EventsLock OPTIONAL, - IN PFNKSALLOCATOR Allocator OPTIONAL, - IN ULONG EventItemSize OPTIONAL); - -KSDDKAPI NTSTATUS NTAPI -KsGenerateDataEvent( - IN PKSEVENT_ENTRY EventEntry, - IN ULONG DataSize, - IN PVOID Data); - -KSDDKAPI NTSTATUS NTAPI -KsEnableEvent( - IN PIRP Irp, - IN ULONG EventSetsCount, - IN KSEVENT_SET* EventSet, - IN OUT PLIST_ENTRY EventsList OPTIONAL, - IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL, - IN PVOID EventsLock OPTIONAL); - -KSDDKAPI VOID NTAPI -KsDiscardEvent( - IN PKSEVENT_ENTRY EventEntry); - -KSDDKAPI NTSTATUS NTAPI -KsDisableEvent( - IN PIRP Irp, - IN OUT PLIST_ENTRY EventsList, - IN KSEVENTS_LOCKTYPE EventsFlags, - IN PVOID EventsLock); - -KSDDKAPI VOID NTAPI -KsFreeEventList( - IN PFILE_OBJECT FileObject, - IN OUT PLIST_ENTRY EventsList, - IN KSEVENTS_LOCKTYPE EVentsFlags, - IN PVOID EventsLock); - -/* =============================================================== - Topology Functions -*/ - -KSDDKAPI NTSTATUS NTAPI -KsValidateTopologyNodeCreateRequest( - IN PIRP Irp, - IN PKSTOPOLOGY Topology, - OUT PKSNODE_CREATE* NodeCreate); - -KSDDKAPI NTSTATUS NTAPI -KsCreateTopologyNode( - IN HANDLE ParentHandle, - IN PKSNODE_CREATE NodeCreate, - IN ACCESS_MASK DesiredAccess, - OUT PHANDLE NodeHandle); - -KSDDKAPI NTSTATUS NTAPI -KsTopologyPropertyHandler( - IN PIRP Irp, - IN PKSPROPERTY Property, - IN OUT PVOID Data, - IN const KSTOPOLOGY* Topology); - - - -/* =============================================================== - Connectivity Functions -*/ - -KSDDKAPI NTSTATUS NTAPI -KsCreatePin( - IN HANDLE FilterHandle, - IN PKSPIN_CONNECT Connect, - IN ACCESS_MASK DesiredAccess, - OUT PHANDLE ConnectionHandle); - -KSDDKAPI NTSTATUS NTAPI -KsValidateConnectRequest( - IN PIRP Irp, - IN ULONG DescriptorsCount, - IN KSPIN_DESCRIPTOR* Descriptor, - OUT PKSPIN_CONNECT* Connect); - -KSDDKAPI NTSTATUS NTAPI -KsPinPropertyHandler( - IN PIRP Irp, - IN PKSPROPERTY Property, - IN OUT PVOID Data, - IN ULONG DescriptorsCount, - IN const KSPIN_DESCRIPTOR* Descriptor); - -KSDDKAPI NTSTATUS NTAPI -KsPinDataIntersection( - IN PIRP Irp, - IN PKSP_PIN Pin, - OUT PVOID Data, - IN ULONG DescriptorsCount, - IN const KSPIN_DESCRIPTOR* Descriptor, - IN PFNKSINTERSECTHANDLER IntersectHandler); - -KSDDKAPI NTSTATUS NTAPI -KsPinDataIntersectionEx( - IN PIRP Irp, - IN PKSP_PIN Pin, - OUT PVOID Data, - IN ULONG DescriptorsCount, - IN const KSPIN_DESCRIPTOR* Descriptor, - IN ULONG DescriptorSize, - IN PFNKSINTERSECTHANDLEREX IntersectHandler OPTIONAL, - IN PVOID HandlerContext OPTIONAL); - -KSDDKAPI PKSFILTER NTAPI -KsPinGetParentFilter( - IN PKSPIN Pin - ); - -KSDDKAPI PKSPIN NTAPI -KsPinGetNextSiblingPin( - IN PKSPIN Pin - ); - - -/* Does this belong here? */ - -KSDDKAPI NTSTATUS NTAPI -KsHandleSizedListQuery( - IN PIRP Irp, - IN ULONG DataItemsCount, - IN ULONG DataItemSize, - IN const VOID* DataItems); - - -/* =============================================================== - IRP Helper Functions -*/ - -typedef NTSTATUS (NTAPI *PFNKSIRPLISTCALLBACK)( - IN PIRP Irp, - IN PVOID Context); - -KSDDKAPI NTSTATUS NTAPI -KsAcquireResetValue( - IN PIRP Irp, - OUT KSRESET* ResetValue); - -KSDDKAPI VOID NTAPI -KsAddIrpToCancelableQueue( - IN OUT PLIST_ENTRY QueueHead, - IN PKSPIN_LOCK SpinLock, - IN PIRP Irp, - IN KSLIST_ENTRY_LOCATION ListLocation, - IN PDRIVER_CANCEL DriverCancel OPTIONAL); - -KSDDKAPI NTSTATUS NTAPI -KsAddObjectCreateItemToDeviceHeader( - IN KSDEVICE_HEADER Header, - IN PDRIVER_DISPATCH Create, - IN PVOID Context, - IN PWCHAR ObjectClass, - IN PSECURITY_DESCRIPTOR SecurityDescriptor); - -KSDDKAPI NTSTATUS NTAPI -KsAddObjectCreateItemToObjectHeader( - IN KSOBJECT_HEADER Header, - IN PDRIVER_DISPATCH Create, - IN PVOID Context, - IN PWCHAR ObjectClass, - IN PSECURITY_DESCRIPTOR SecurityDescriptor); - -KSDDKAPI NTSTATUS NTAPI -KsAllocateDeviceHeader( - OUT KSDEVICE_HEADER* Header, - IN ULONG ItemsCount, - IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL); - -KSDDKAPI NTSTATUS NTAPI -KsAllocateExtraData( - IN PIRP Irp, - IN ULONG ExtraSize, - OUT PVOID* ExtraBuffer); - -KSDDKAPI NTSTATUS NTAPI -KsAllocateObjectCreateItem( - IN KSDEVICE_HEADER Header, - IN PKSOBJECT_CREATE_ITEM CreateItem, - IN BOOLEAN AllocateEntry, - IN PFNKSITEMFREECALLBACK ItemFreeCallback OPTIONAL); - -KSDDKAPI NTSTATUS NTAPI -KsAllocateObjectHeader( - OUT KSOBJECT_HEADER *Header, - IN ULONG ItemsCount, - IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL, - IN PIRP Irp, - IN KSDISPATCH_TABLE* Table); - -KSDDKAPI VOID NTAPI -KsCancelIo( - IN OUT PLIST_ENTRY QueueHead, - IN PKSPIN_LOCK SpinLock); - -KSDDKAPI VOID NTAPI -KsCancelRoutine( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); - -KSDDKAPI NTSTATUS NTAPI -KsDefaultDeviceIoCompletion( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); - -/* ELSEWHERE -KSDDKAPI ULONG NTAPI -KsDecrementCountedWorker( - IN PKSWORKER Worker); -*/ - -KSDDKAPI BOOLEAN NTAPI +NTAPI KsDispatchFastIoDeviceControlFailure( - IN PFILE_OBJECT FileObject, - IN BOOLEAN Wait, - IN PVOID InputBuffer OPTIONAL, - IN ULONG InputBufferLength, - OUT PVOID OutputBuffer OPTIONAL, - IN ULONG OutputBufferLength, - IN ULONG IoControlCode, - OUT PIO_STATUS_BLOCK IoStatus, - IN PDEVICE_OBJECT DeviceObject); /* always return false */ - -KSDDKAPI BOOLEAN NTAPI + _In_ PFILE_OBJECT FileObject, + _In_ BOOLEAN Wait, + _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, + _In_ ULONG InputBufferLength, + _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, + _In_ ULONG OutputBufferLength, + _In_ ULONG IoControlCode, + _Out_ PIO_STATUS_BLOCK IoStatus, + _In_ PDEVICE_OBJECT DeviceObject); /* always return false */ + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +BOOLEAN +NTAPI KsDispatchFastReadFailure( - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, - IN ULONG Length, - IN BOOLEAN Wait, - IN ULONG LockKey, - OUT PVOID Buffer, - OUT PIO_STATUS_BLOCK IoStatus, - IN PDEVICE_OBJECT DeviceObject); /* always return false */ + _In_ PFILE_OBJECT FileObject, + _In_ PLARGE_INTEGER FileOffset, + _In_ ULONG Length, + _In_ BOOLEAN Wait, + _In_ ULONG LockKey, + _Out_ PVOID Buffer, + _Out_ PIO_STATUS_BLOCK IoStatus, + _In_ PDEVICE_OBJECT DeviceObject); /* always return false */ /* This function does the same as the above */ #define KsDispatchFastWriteFailure KsDispatchFastReadFailure -KSDDKAPI NTSTATUS NTAPI +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsDispatchInvalidDeviceRequest( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); - -KSDDKAPI NTSTATUS NTAPI + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsDispatchIrp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); - -KSDDKAPI NTSTATUS NTAPI + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsDispatchSpecificMethod( - IN PIRP Irp, - IN PFNKSHANDLER Handler); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _In_ PFNKSHANDLER Handler); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsDispatchSpecificProperty( - IN PIRP Irp, - IN PFNKSHANDLER Handler); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _In_ PFNKSHANDLER Handler); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsForwardAndCatchIrp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PFILE_OBJECT FileObject, - IN KSSTACK_USE StackUse); - -KSDDKAPI NTSTATUS NTAPI + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp, + _In_ PFILE_OBJECT FileObject, + _In_ KSSTACK_USE StackUse); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsForwardIrp( - IN PIRP Irp, - IN PFILE_OBJECT FileObject, - IN BOOLEAN ReuseStackLocation); - -KSDDKAPI VOID NTAPI + _In_ PIRP Irp, + _In_ PFILE_OBJECT FileObject, + _In_ BOOLEAN ReuseStackLocation); + +_IRQL_requires_max_(APC_LEVEL) +KSDDKAPI +VOID +NTAPI KsFreeDeviceHeader( - IN KSDEVICE_HEADER Header); - -KSDDKAPI VOID NTAPI + _In_ KSDEVICE_HEADER Header); + +_IRQL_requires_max_(APC_LEVEL) +KSDDKAPI +VOID +NTAPI KsFreeObjectHeader( - IN PVOID Header); - -KSDDKAPI NTSTATUS NTAPI + _In_ PVOID Header); + +KSDDKAPI +NTSTATUS +NTAPI KsGetChildCreateParameter( - IN PIRP Irp, - OUT PVOID* CreateParameter); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp, + _Out_ PVOID *CreateParameter); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsMoveIrpsOnCancelableQueue( - IN OUT PLIST_ENTRY SourceList, - IN PKSPIN_LOCK SourceLock, - IN OUT PLIST_ENTRY DestinationList, - IN PKSPIN_LOCK DestinationLock OPTIONAL, - IN KSLIST_ENTRY_LOCATION ListLocation, - IN PFNKSIRPLISTCALLBACK ListCallback, - IN PVOID Context); - -KSDDKAPI NTSTATUS NTAPI + _Inout_ PLIST_ENTRY SourceList, + _In_ PKSPIN_LOCK SourceLock, + _Inout_ PLIST_ENTRY DestinationList, + _In_opt_ PKSPIN_LOCK DestinationLock, + _In_ KSLIST_ENTRY_LOCATION ListLocation, + _In_ PFNKSIRPLISTCALLBACK ListCallback, + _In_ PVOID Context); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsProbeStreamIrp( - IN PIRP Irp, - IN ULONG ProbeFlags, - IN ULONG HeaderSize); - -KSDDKAPI NTSTATUS NTAPI + _Inout_ PIRP Irp, + _In_ ULONG ProbeFlags, + _In_ ULONG HeaderSize); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsQueryInformationFile( - IN PFILE_OBJECT FileObject, - OUT PVOID FileInformation, - IN ULONG Length, - IN FILE_INFORMATION_CLASS FileInformationClass); - -KSDDKAPI ACCESS_MASK NTAPI + _In_ PFILE_OBJECT FileObject, + _Out_writes_bytes_(Length) PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +ACCESS_MASK +NTAPI KsQueryObjectAccessMask( - IN KSOBJECT_HEADER Header); - -KSDDKAPI PKSOBJECT_CREATE_ITEM NTAPI + _In_ KSOBJECT_HEADER Header); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +PKSOBJECT_CREATE_ITEM +NTAPI KsQueryObjectCreateItem( - IN KSOBJECT_HEADER Header); - -KSDDKAPI NTSTATUS NTAPI + _In_ KSOBJECT_HEADER Header); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsReadFile( - IN PFILE_OBJECT FileObject, - IN PKEVENT Event OPTIONAL, - IN PVOID PortContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - OUT PVOID Buffer, - IN ULONG Length, - IN ULONG Key OPTIONAL, - IN KPROCESSOR_MODE RequestorMode); - -KSDDKAPI VOID NTAPI + _In_ PFILE_OBJECT FileObject, + _In_opt_ PKEVENT Event, + _In_opt_ PVOID PortContext, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Out_writes_bytes_(Length) PVOID Buffer, + _In_ ULONG Length, + _In_opt_ ULONG Key, + _In_ KPROCESSOR_MODE RequestorMode); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +VOID +NTAPI KsReleaseIrpOnCancelableQueue( - IN PIRP Irp, - IN PDRIVER_CANCEL DriverCancel OPTIONAL); - -KSDDKAPI PIRP NTAPI + _In_ PIRP Irp, + _In_opt_ PDRIVER_CANCEL DriverCancel); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +PIRP +NTAPI KsRemoveIrpFromCancelableQueue( - IN OUT PLIST_ENTRY QueueHead, - IN PKSPIN_LOCK SpinLock, - IN KSLIST_ENTRY_LOCATION ListLocation, - IN KSIRP_REMOVAL_OPERATION RemovalOperation); - -KSDDKAPI VOID NTAPI + _Inout_ PLIST_ENTRY QueueHead, + _In_ PKSPIN_LOCK SpinLock, + _In_ KSLIST_ENTRY_LOCATION ListLocation, + _In_ KSIRP_REMOVAL_OPERATION RemovalOperation); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +VOID +NTAPI KsRemoveSpecificIrpFromCancelableQueue( - IN PIRP Irp); - -KSDDKAPI NTSTATUS NTAPI + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsSetInformationFile( - IN PFILE_OBJECT FileObject, - IN PVOID FileInformation, - IN ULONG Length, - IN FILE_INFORMATION_CLASS FileInformationClass); - -KSDDKAPI NTSTATUS NTAPI + _In_ PFILE_OBJECT FileObject, + _In_reads_bytes_(Length) PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsSetMajorFunctionHandler( - IN PDRIVER_OBJECT DriverObject, - IN ULONG MajorFunction); - -KSDDKAPI NTSTATUS NTAPI + _In_ PDRIVER_OBJECT DriverObject, + _In_ ULONG MajorFunction); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsStreamIo( - IN PFILE_OBJECT FileObject, - IN PKEVENT Event OPTIONAL, - IN PVOID PortContext OPTIONAL, - IN PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL, - IN PVOID CompletionContext OPTIONAL, - IN KSCOMPLETION_INVOCATION CompletionInvocationFlags OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN OUT PVOID StreamHeaders, - IN ULONG Length, - IN ULONG Flags, - IN KPROCESSOR_MODE RequestorMode); - -KSDDKAPI NTSTATUS NTAPI - KsWriteFile( - IN PFILE_OBJECT FileObject, - IN PKEVENT Event OPTIONAL, - IN PVOID PortContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN PVOID Buffer, - IN ULONG Length, - IN ULONG Key OPTIONAL, - IN KPROCESSOR_MODE RequestorMode); - - -KSDDKAPI NTSTATUS NTAPI - KsDefaultForwardIrp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); + _In_ PFILE_OBJECT FileObject, + _In_opt_ PKEVENT Event, + _In_opt_ PVOID PortContext, + _In_opt_ PIO_COMPLETION_ROUTINE CompletionRoutine, + _In_opt_ PVOID CompletionContext, + _In_opt_ KSCOMPLETION_INVOCATION CompletionInvocationFlags, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Inout_updates_bytes_(Length) PVOID StreamHeaders, + _In_ ULONG Length, + _In_ ULONG Flags, + _In_ KPROCESSOR_MODE RequestorMode); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsWriteFile( + _In_ PFILE_OBJECT FileObject, + _In_opt_ PKEVENT Event, + _In_opt_ PVOID PortContext, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Length, + _In_opt_ ULONG Key, + _In_ KPROCESSOR_MODE RequestorMode); + + +KSDDKAPI +NTSTATUS +NTAPI +KsDefaultForwardIrp( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); /* =============================================================== Worker Management Functions */ -KSDDKAPI NTSTATUS NTAPI +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsRegisterWorker( - IN WORK_QUEUE_TYPE WorkQueueType, - OUT PKSWORKER* Worker); - -KSDDKAPI VOID NTAPI + _In_ WORK_QUEUE_TYPE WorkQueueType, + _Out_ PKSWORKER* Worker); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsUnregisterWorker( - IN PKSWORKER Worker); - -KSDDKAPI NTSTATUS NTAPI + _In_ PKSWORKER Worker); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsRegisterCountedWorker( - IN WORK_QUEUE_TYPE WorkQueueType, - IN PWORK_QUEUE_ITEM CountedWorkItem, - OUT PKSWORKER* Worker); - -KSDDKAPI ULONG NTAPI + _In_ WORK_QUEUE_TYPE WorkQueueType, + _In_ PWORK_QUEUE_ITEM CountedWorkItem, + _Out_ PKSWORKER *Worker); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +ULONG +NTAPI KsDecrementCountedWorker( - IN PKSWORKER Worker); - -KSDDKAPI ULONG NTAPI + _In_ PKSWORKER Worker); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +ULONG +NTAPI KsIncrementCountedWorker( - IN PKSWORKER Worker); - -KSDDKAPI NTSTATUS NTAPI + _In_ PKSWORKER Worker); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsQueueWorkItem( - IN PKSWORKER Worker, - IN PWORK_QUEUE_ITEM WorkItem); + _In_ PKSWORKER Worker, + _In_ PWORK_QUEUE_ITEM WorkItem); /* =============================================================== Resources / Images */ -KSDDKAPI NTSTATUS NTAPI +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsLoadResource( - IN PVOID ImageBase, - IN POOL_TYPE PoolType, - IN ULONG_PTR ResourceName, - IN ULONG ResourceType, - OUT PVOID* Resource, - OUT PULONG ResourceSize); - -/* TODO: Implement -KSDDKAPI NTSTATUS NTAPI + _In_ PVOID ImageBase, + _In_ POOL_TYPE PoolType, + _In_ ULONG_PTR ResourceName, + _In_ ULONG ResourceType, + _Outptr_result_bytebuffer_(ResourceSize) PVOID *Resource, + _Out_opt_ PULONG ResourceSize); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsGetImageNameAndResourceId( - IN HANDLE RegKey, - OUT PUNICODE_STRING ImageName, - OUT PULONG_PTR ResourceId, - OUT PULONG ValueType); - -KSDDKAPI NTSTATUS NTAPI + _In_ HANDLE RegKey, + _Out_ PUNICODE_STRING ImageName, + _Out_ PULONG_PTR ResourceId, + _Out_ PULONG ValueType); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsMapModuleName( - IN PDEVICE_OBJECT PhysicalDeviceObject, - IN PUNICODE_STRING ModuleName, - OUT PUNICODE_STRING ImageName, - OUT PULONG_PTR ResourceId, - OUT PULONG ValueType); -*/ - + _In_ PDEVICE_OBJECT PhysicalDeviceObject, + _In_ PUNICODE_STRING ModuleName, + _Out_ PUNICODE_STRING ImageName, + _Out_ PULONG_PTR ResourceId, + _Out_ PULONG ValueType); /* =============================================================== Misc. Helper Functions */ -KSDDKAPI PVOID NTAPI +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +PVOID +NTAPI KsGetNextSibling( - IN PVOID Object); - - -KSDDKAPI NTSTATUS NTAPI + _In_ PVOID Object); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsCacheMedium( - IN PUNICODE_STRING SymbolicLink, - IN PKSPIN_MEDIUM Medium, - IN ULONG PinDirection); - -KSDDKAPI NTSTATUS NTAPI + _In_ PUNICODE_STRING SymbolicLink, + _In_ PKSPIN_MEDIUM Medium, + _In_ ULONG PinDirection); + +KSDDKAPI +NTSTATUS +NTAPI KsDefaultDispatchPnp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); - -KSDDKAPI VOID NTAPI + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsSetDevicePnpAndBaseObject( - IN KSDEVICE_HEADER Header, - IN PDEVICE_OBJECT PnpDeviceObject, - IN PDEVICE_OBJECT BaseDevice); - -KSDDKAPI NTSTATUS NTAPI + _In_ KSDEVICE_HEADER Header, + _In_ PDEVICE_OBJECT PnpDeviceObject, + _In_ PDEVICE_OBJECT BaseDevice); + +KSDDKAPI +NTSTATUS +NTAPI KsDefaultDispatchPower( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); - -KSDDKAPI VOID NTAPI + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsSetPowerDispatch( - IN KSOBJECT_HEADER Header, - IN PFNKSCONTEXT_DISPATCH PowerDispatch OPTIONAL, - IN PVOID PowerContext OPTIONAL); - -KSDDKAPI NTSTATUS NTAPI + _In_ KSOBJECT_HEADER Header, + _In_opt_ PFNKSCONTEXT_DISPATCH PowerDispatch, + _In_opt_ PVOID PowerContext); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsReferenceBusObject( - IN KSDEVICE_HEADER Header); - -KSDDKAPI VOID NTAPI + _In_ KSDEVICE_HEADER Header); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsDereferenceBusObject( - IN KSDEVICE_HEADER Header); - -KSDDKAPI NTSTATUS NTAPI + _In_ KSDEVICE_HEADER Header); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsFreeObjectCreateItem( - IN KSDEVICE_HEADER Header, - IN PUNICODE_STRING CreateItem); - -KSDDKAPI NTSTATUS NTAPI + _In_ KSDEVICE_HEADER Header, + _In_ PUNICODE_STRING CreateItem); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsFreeObjectCreateItemsByContext( - IN KSDEVICE_HEADER Header, - IN PVOID Context); - -KSDDKAPI VOID NTAPI + _In_ KSDEVICE_HEADER Header, + _In_ PVOID Context); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsNullDriverUnload( - IN PDRIVER_OBJECT DriverObject); - -KSDDKAPI PDEVICE_OBJECT NTAPI + _In_ PDRIVER_OBJECT DriverObject); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +PDEVICE_OBJECT +NTAPI KsQueryDevicePnpObject( - IN KSDEVICE_HEADER Header); - -KSDDKAPI VOID NTAPI + _In_ KSDEVICE_HEADER Header); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsRecalculateStackDepth( - IN KSDEVICE_HEADER Header, - IN BOOLEAN ReuseStackLocation); - -KSDDKAPI VOID NTAPI + _In_ KSDEVICE_HEADER Header, + _In_ BOOLEAN ReuseStackLocation); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsSetTargetDeviceObject( - IN KSOBJECT_HEADER Header, - IN PDEVICE_OBJECT TargetDevice OPTIONAL); - -KSDDKAPI VOID NTAPI + _In_ KSOBJECT_HEADER Header, + _In_opt_ PDEVICE_OBJECT TargetDevice); + +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +VOID +NTAPI KsSetTargetState( - IN KSOBJECT_HEADER Header, - IN KSTARGET_STATE TargetState); - -KSDDKAPI NTSTATUS NTAPI + _In_ KSOBJECT_HEADER Header, + _In_ KSTARGET_STATE TargetState); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI KsSynchronousIoControlDevice( - IN PFILE_OBJECT FileObject, - IN KPROCESSOR_MODE RequestorMode, - IN ULONG IoControl, - IN PVOID InBuffer, - IN ULONG InSize, - OUT PVOID OutBuffer, - IN ULONG OUtSize, - OUT PULONG BytesReturned); - + _In_ PFILE_OBJECT FileObject, + _In_ KPROCESSOR_MODE RequestorMode, + _In_ ULONG IoControl, + _In_reads_bytes_(InSize) PVOID InBuffer, + _In_ ULONG InSize, + _Out_writes_bytes_to_(OutSize, *BytesReturned) PVOID OutBuffer, + _In_ ULONG OutSize, + _Out_ PULONG BytesReturned); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PKSPIN NTAPI KsFilterGetFirstChildPin( - IN PKSFILTER Filter, - IN ULONG PinId - ); - + _In_ PKSFILTER Filter, + _In_ ULONG PinId); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PFILE_OBJECT NTAPI KsPinGetConnectedPinFileObject( - IN PKSPIN Pin - ); + _In_ PKSPIN Pin); #else #if !defined( KS_NO_CREATE_FUNCTIONS ) +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI DWORD WINAPI KsCreateAllocator( - IN HANDLE ConnectionHandle, - IN PKSALLOCATOR_FRAMING AllocatorFraming, - OUT PHANDLE AllocatorHandle - ); - + _In_ HANDLE ConnectionHandle, + _In_ PKSALLOCATOR_FRAMING AllocatorFraming, + _Out_ PHANDLE AllocatorHandle); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI DWORD NTAPI KsCreateClock( - IN HANDLE ConnectionHandle, - IN PKSCLOCK_CREATE ClockCreate, - OUT PHANDLE ClockHandle - ); - + _In_ HANDLE ConnectionHandle, + _In_ PKSCLOCK_CREATE ClockCreate, + _Out_ PHANDLE ClockHandle); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI DWORD WINAPI KsCreatePin( - IN HANDLE FilterHandle, - IN PKSPIN_CONNECT Connect, - IN ACCESS_MASK DesiredAccess, - OUT PHANDLE ConnectionHandle - ); - + _In_ HANDLE FilterHandle, + _In_ PKSPIN_CONNECT Connect, + _In_ ACCESS_MASK DesiredAccess, + _Out_ PHANDLE ConnectionHandle); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI DWORD WINAPI KsCreateTopologyNode( - IN HANDLE ParentHandle, - IN PKSNODE_CREATE NodeCreate, - IN ACCESS_MASK DesiredAccess, - OUT PHANDLE NodeHandle - ); - + _In_ HANDLE ParentHandle, + _In_ PKSNODE_CREATE NodeCreate, + _In_ ACCESS_MASK DesiredAccess, + _Out_ PHANDLE NodeHandle); + #endif #endif @@ -4300,227 +4601,243 @@ #if defined(_NTDDK_) +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsMergeAutomationTables( - OUT PKSAUTOMATION_TABLE* AutomationTableAB, - IN PKSAUTOMATION_TABLE AutomationTableA OPTIONAL, - IN PKSAUTOMATION_TABLE AutomationTableB OPTIONAL, - IN KSOBJECT_BAG Bag OPTIONAL - ); - + _Out_ PKSAUTOMATION_TABLE *AutomationTableAB, + _In_opt_ PKSAUTOMATION_TABLE AutomationTableA, + _In_opt_ PKSAUTOMATION_TABLE AutomationTableB, + _In_opt_ KSOBJECT_BAG Bag); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsInitializeDriver( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath, - IN const KSDEVICE_DESCRIPTOR *Descriptor OPTIONAL); + _In_ PDRIVER_OBJECT DriverObject, + _In_ PUNICODE_STRING RegistryPath, + _In_opt_ const KSDEVICE_DESCRIPTOR *Descriptor); typedef struct _KSFILTERFACTORY KSFILTERFACTORY, *PKSFILTERFACTORY; //FIXME - - +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsInitializeDevice ( - IN PDEVICE_OBJECT FunctionalDeviceObject, - IN PDEVICE_OBJECT PhysicalDeviceObject, - IN PDEVICE_OBJECT NextDeviceObject, - IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL); - - -typedef void (NTAPI *PFNKSFILTERFACTORYPOWER)( - IN PKSFILTERFACTORY FilterFactory, - IN DEVICE_POWER_STATE State); - + _In_ PDEVICE_OBJECT FunctionalDeviceObject, + _In_ PDEVICE_OBJECT PhysicalDeviceObject, + _In_ PDEVICE_OBJECT NextDeviceObject, + _In_opt_ const KSDEVICE_DESCRIPTOR *Descriptor); + +_IRQL_requires_max_(PASSIVE_LEVEL) +typedef void +(NTAPI *PFNKSFILTERFACTORYPOWER)( + _In_ PKSFILTERFACTORY FilterFactory, + _In_ DEVICE_POWER_STATE State); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI _KsEdit( - IN KSOBJECT_BAG ObjectBag, - IN OUT PVOID* PointerToPointerToItem, - IN ULONG NewSize, - IN ULONG OldSize, - IN ULONG Tag); - + _In_ KSOBJECT_BAG ObjectBag, + _Inout_ PVOID *PointerToPointerToItem, + _In_ ULONG NewSize, + _In_ ULONG OldSize, + _In_ ULONG Tag); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI VOID NTAPI KsAcquireControl( - IN PVOID Object); - + _In_ PVOID Object); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI VOID NTAPI KsAcquireDevice( - IN PKSDEVICE Device); - + _In_ PKSDEVICE Device); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsAddDevice( - IN PDRIVER_OBJECT DriverObject, - IN PDEVICE_OBJECT PhysicalDeviceObject); - + _In_ PDRIVER_OBJECT DriverObject, + _In_ PDEVICE_OBJECT PhysicalDeviceObject); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI VOID NTAPI KsAddEvent( - IN PVOID Object, - IN PKSEVENT_ENTRY EventEntry); - + _In_ PVOID Object, + _In_ PKSEVENT_ENTRY EventEntry); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsAddItemToObjectBag( - IN KSOBJECT_BAG ObjectBag, - IN PVOID Item, - IN PFNKSFREE Free OPTIONAL); - + _In_ KSOBJECT_BAG ObjectBag, + _In_ __drv_aliasesMem PVOID Item, + _In_opt_ PFNKSFREE Free); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI ULONG NTAPI KsRemoveItemFromObjectBag( - IN KSOBJECT_BAG ObjectBag, - IN PVOID Item, - IN BOOLEAN Free); - + _In_ KSOBJECT_BAG ObjectBag, + _In_ PVOID Item, + _In_ BOOLEAN Free); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsAllocateObjectBag( - IN PKSDEVICE Device, - OUT KSOBJECT_BAG* ObjectBag); - + _In_ PKSDEVICE Device, + _Out_ KSOBJECT_BAG *ObjectBag); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI VOID NTAPI KsFreeObjectBag( - IN KSOBJECT_BAG ObjectBag - ); - + _In_ KSOBJECT_BAG ObjectBag); + +_IRQL_requires_max_(DISPATCH_LEVEL) KSDDKAPI VOID NTAPI KsCompletePendingRequest( - IN PIRP Irp); - + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsCopyObjectBagItems( - IN KSOBJECT_BAG ObjectBagDestination, - IN KSOBJECT_BAG ObjectBagSource); - + _In_ KSOBJECT_BAG ObjectBagDestination, + _In_ KSOBJECT_BAG ObjectBagSource); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsCreateDevice( - IN PDRIVER_OBJECT DriverObject, - IN PDEVICE_OBJECT PhysicalDeviceObject, - IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL, - IN ULONG ExtensionSize OPTIONAL, - OUT PKSDEVICE* Device OPTIONAL); - + _In_ PDRIVER_OBJECT DriverObject, + _In_ PDEVICE_OBJECT PhysicalDeviceObject, + _In_opt_ const KSDEVICE_DESCRIPTOR *Descriptor, + _In_ ULONG ExtensionSize, + _Out_opt_ PKSDEVICE *Device); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsCreateFilterFactory( - IN PDEVICE_OBJECT DeviceObject, - IN const KSFILTER_DESCRIPTOR* Descriptor, - IN PWCHAR RefString OPTIONAL, - IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, - IN ULONG CreateItemFlags, - IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, - IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, - OUT PKSFILTERFACTORY *FilterFactory OPTIONAL); - + _In_ PDEVICE_OBJECT DeviceObject, + _In_ const KSFILTER_DESCRIPTOR *Descriptor, + _In_opt_ PWSTR RefString, + _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor, + _In_ ULONG CreateItemFlags, + _In_opt_ PFNKSFILTERFACTORYPOWER SleepCallback, + _In_opt_ PFNKSFILTERFACTORYPOWER WakeCallback, + _Out_opt_ PKSFILTERFACTORY *FilterFactory); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsFilterFactorySetDeviceClassesState( - IN PKSFILTERFACTORY FilterFactory, - IN BOOLEAN NewState - ); - + _In_ PKSFILTERFACTORY FilterFactory, + _In_ BOOLEAN NewState); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsFilterFactoryUpdateCacheData( - IN PKSFILTERFACTORY FilterFactory, - IN const KSFILTER_DESCRIPTOR *FilterDescriptor OPTIONAL - ); - + _In_ PKSFILTERFACTORY FilterFactory, + _In_opt_ const KSFILTER_DESCRIPTOR *FilterDescriptor); + +_IRQL_requires_max_(DISPATCH_LEVEL) KSDDKAPI PKSPIN NTAPI KsGetPinFromIrp( - IN PIRP Irp - ); - + _In_ PIRP Irp); + +_IRQL_requires_max_(DISPATCH_LEVEL) KSDDKAPI PKSFILTER NTAPI KsGetFilterFromIrp( - IN PIRP Irp - ); - + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsDefaultAddEventHandler( - IN PIRP Irp, - IN PKSEVENTDATA EventData, - IN OUT PKSEVENT_ENTRY EventEntry); - + _In_ PIRP Irp, + _In_ PKSEVENTDATA EventData, + _Inout_ PKSEVENT_ENTRY EventEntry); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsDispatchQuerySecurity( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsDispatchSetSecurity( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PVOID NTAPI KsGetParent( - IN PVOID Object - ); - - + _In_ PVOID Object); + +_IRQL_requires_max_(PASSIVE_LEVEL) static PKSFILTERFACTORY __inline KsFilterGetParentFilterFactory( - IN PKSFILTER Filter - ) + _In_ PKSFILTER Filter) { return (PKSFILTERFACTORY) KsGetParent((PVOID) Filter); } +_IRQL_requires_max_(PASSIVE_LEVEL) static PKSDEVICE __inline KsFilterFactoryGetParentDevice( - IN PKSFILTERFACTORY FilterFactory - ) + _In_ PKSFILTERFACTORY FilterFactory) { return (PKSDEVICE) KsGetParent((PVOID) FilterFactory); } - - #define KsDeleteFilterFactory(FilterFactory) \ KsFreeObjectCreateItemsByContext( \ @@ -4529,55 +4846,57 @@ DeviceExtension), \ FilterFactory) +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI ULONG NTAPI KsDeviceGetBusData( - IN PKSDEVICE Device, - IN ULONG DataType, - IN PVOID Buffer, - IN ULONG Offset, - IN ULONG Length); - - + _In_ PKSDEVICE Device, + _In_ ULONG DataType, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Offset, + _In_ ULONG Length); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PVOID NTAPI KsGetFirstChild( - IN PVOID Object - ); - + _In_ PVOID Object); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PKSFILTERFACTORY NTAPI KsDeviceGetFirstChildFilterFactory( - IN PKSDEVICE Device); + _In_ PKSDEVICE Device); #if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__) +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PUNKNOWN NTAPI KsGetOuterUnknown( - IN PVOID Object - ); - + _In_ PVOID Object); + +_IRQL_requires_max_(PASSIVE_LEVEL) static __inline PUNKNOWN KsDeviceGetOuterUnknown( - IN PKSDEVICE Device) + _In_ PKSDEVICE Device) { return KsGetOuterUnknown((PVOID) Device); } +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PUNKNOWN NTAPI KsDeviceRegisterAggregatedClientUnknown( - IN PKSDEVICE Device, - IN PUNKNOWN ClientUnknown); - + _In_ PKSDEVICE Device, + _In_ PUNKNOWN ClientUnknown); #endif @@ -4596,16 +4915,16 @@ STDMETHOD_(LONGLONG,GetPhysicalTime)(THIS ) PURE; STDMETHOD_(LONGLONG,GetCorrelatedTime)(THIS_ - OUT PLONGLONG SystemTime + _Out_ PLONGLONG SystemTime ) PURE; STDMETHOD_(LONGLONG,GetCorrelatedPhysicalTime)(THIS_ - OUT PLONGLONG SystemTime + _Out_ PLONGLONG SystemTime ) PURE; STDMETHOD_(NTSTATUS, GetResolution)(THIS_ - OUT PKSRESOLUTION Resolution + _Out_ PKSRESOLUTION Resolution ) PURE; STDMETHOD_(NTSTATUS, GetState)(THIS_ - OUT PKSSTATE State + _Out_ PKSSTATE State ) PURE; }; @@ -4625,25 +4944,25 @@ STDMETHOD_(ULONG, Release)(THIS) PURE; STDMETHOD_(NTSTATUS, KsProperty)(THIS_ - IN PKSPROPERTY Property, - IN ULONG PropertyLength, - IN OUT PVOID PropertyData, - IN ULONG DataLength, - OUT ULONG* BytesReturned + _In_reads_bytes_(PropertyLength) PKSPROPERTY Property, + _In_ ULONG PropertyLength, + _Inout_updates_bytes_(DataLength) PVOID PropertyData, + _In_ ULONG DataLength, + _Out_ ULONG *BytesReturned ) PURE; STDMETHOD_(NTSTATUS, KsMethod)(THIS_ - IN PKSMETHOD Method, - IN ULONG MethodLength, - IN OUT PVOID MethodData, - IN ULONG DataLength, - OUT ULONG* BytesReturned + _In_reads_bytes_(MethodLength) PKSMETHOD Method, + _In_ ULONG MethodLength, + _Inout_updates_bytes_(DataLength) PVOID MethodData, + _In_ ULONG DataLength, + _Out_ ULONG *BytesReturned ) PURE; STDMETHOD_(NTSTATUS, KsEvent)(THIS_ - IN PKSEVENT Event OPTIONAL, - IN ULONG EventLength, - IN OUT PVOID EventData, - IN ULONG DataLength, - OUT ULONG* BytesReturned + _In_reads_bytes_opt_(EventLength) PKSEVENT Event, + _In_ ULONG EventLength, + _Inout_updates_bytes_(DataLength) PVOID EventData, + _In_ ULONG DataLength, + _Out_ ULONG *BytesReturned ) PURE; }; @@ -4652,32 +4971,33 @@ #endif +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI VOID NTAPI KsDeviceRegisterAdapterObject( - IN PKSDEVICE Device, - IN PADAPTER_OBJECT AdapterObject, - IN ULONG MaxMappingByteCount, - IN ULONG MappingTableStride); - + _In_ PKSDEVICE Device, + _In_ PADAPTER_OBJECT AdapterObject, + _In_ ULONG MaxMappingByteCount, + _In_ ULONG MappingTableStride); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI ULONG NTAPI KsDeviceSetBusData( - IN PKSDEVICE Device, - IN ULONG DataType, - IN PVOID Buffer, - IN ULONG Offset, - IN ULONG Length); - - + _In_ PKSDEVICE Device, + _In_ ULONG DataType, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Offset, + _In_ ULONG Length); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI VOID NTAPI KsReleaseControl( - IN PVOID Object - ); + _In_ PVOID Object); #define KsDiscard(object, pointer) \ KsRemoveItemFromObjectBag(object->Bag, pointer, TRUE) @@ -4691,49 +5011,54 @@ #define KsFilterAddEvent(Filter, EventEntry) \ KsAddEvent(Filter,EventEntry); +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI VOID NTAPI KsFilterAcquireProcessingMutex( - IN PKSFILTER Filter); - - + _In_ PKSFILTER Filter); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsFilterAddTopologyConnections( - IN PKSFILTER Filter, - IN ULONG NewConnectionsCount, - IN const KSTOPOLOGY_CONNECTION *const NewTopologyConnections); - + _In_ PKSFILTER Filter, + _In_ ULONG NewConnectionsCount, + _In_reads_(NewConnectionsCount) const KSTOPOLOGY_CONNECTION *const NewTopologyConnections); + +_IRQL_requires_max_(DISPATCH_LEVEL) KSDDKAPI VOID NTAPI KsFilterAttemptProcessing( - IN PKSFILTER Filter, - IN BOOLEAN Asynchronous); - + _In_ PKSFILTER Filter, + _In_ BOOLEAN Asynchronous); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsFilterCreateNode( - IN PKSFILTER Filter, - IN const KSNODE_DESCRIPTOR *const NodeDescriptor, - OUT PULONG NodeID); - + _In_ PKSFILTER Filter, + _In_ const KSNODE_DESCRIPTOR *const NodeDescriptor, + _Out_ PULONG NodeID); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS NTAPI KsFilterCreatePinFactory( - IN PKSFILTER Filter, - IN const KSPIN_DESCRIPTOR_EX *const PinDescriptor, - OUT PULONG PinID); - + _In_ PKSFILTER Filter, + _In_ const KSPIN_DESCRIPTOR_EX *const PinDescriptor, + _Out_ PULONG PinID); + +_IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI PKSDEVICE __inline KsFilterFactoryGetDevice( - IN PKSFILTERFACTORY FilterFactory); + _In_ PKSFILTERFACTORY FilterFactory); /* etc. */ #endif /* avstream */
11 years, 2 months
1
0
0
0
[hbelusca] 59766: [SOFT386] - In the interface header soft386.h, do not include other particular headers (windows.h and debug.h). Those must be included by the different applications which also wil...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Aug 17 21:15:55 2013 New Revision: 59766 URL:
http://svn.reactos.org/svn/reactos?rev=59766&view=rev
Log: [SOFT386] - In the interface header soft386.h, do not include other particular headers (windows.h and debug.h). Those must be included by the different applications which also will include soft386.h. - LPVOID --> PVOID (do it general, not just à-la Win32). - The .c files include the headers, and each .c files must have its "#define NDEBUG\n#include <debug.h>" lines, to activate (or deactivate here in the example) debugging output. - In the .c files, include the header windef.h for having the basic types, and temporarily comment out the needed #defines which will be needed if one needs to include other win***.h files. Those will be deleted if they aren't needed at the end. Modified: branches/ntvdm/include/reactos/libs/soft386/soft386.h branches/ntvdm/lib/soft386/common.c branches/ntvdm/lib/soft386/common.h branches/ntvdm/lib/soft386/soft386.c Modified: branches/ntvdm/include/reactos/libs/soft386/soft386.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/include/reactos/libs/soft…
============================================================================== --- branches/ntvdm/include/reactos/libs/soft386/soft386.h [iso-8859-1] (original) +++ branches/ntvdm/include/reactos/libs/soft386/soft386.h [iso-8859-1] Sat Aug 17 21:15:55 2013 @@ -8,11 +8,6 @@ #ifndef _SOFT386_H_ #define _SOFT386_H_ - -/* INCLUDES *******************************************************************/ - -#include <windows.h> -#include <debug.h> /* DEFINES ********************************************************************/ @@ -34,8 +29,7 @@ #define SOFT386_CR0_PG (1 << 31) struct _SOFT386_STATE; -typedef struct _SOFT386_STATE SOFT386_STATE; -typedef struct _SOFT386_STATE *PSOFT386_STATE; +typedef struct _SOFT386_STATE SOFT386_STATE, *PSOFT386_STATE; enum _SOFT386_GEN_REGS { @@ -89,7 +83,7 @@ ( PSOFT386_STATE State, ULONG Address, - LPVOID Buffer, + PVOID Buffer, ULONG Size ); @@ -99,7 +93,7 @@ ( PSOFT386_STATE State, ULONG Address, - LPVOID Buffer, + PVOID Buffer, ULONG Size ); @@ -109,7 +103,7 @@ ( PSOFT386_STATE State, ULONG Port, - LPVOID Buffer, + PVOID Buffer, ULONG Size ); @@ -119,7 +113,7 @@ ( PSOFT386_STATE State, ULONG Port, - LPVOID Buffer, + PVOID Buffer, ULONG Size ); @@ -131,7 +125,7 @@ UCHAR HighByte; }; USHORT LowWord; - ULONG Long; + ULONG Long; } SOFT386_REG, *PSOFT386_REG; typedef struct _SOFT386_SEG_REG @@ -185,7 +179,7 @@ typedef struct _SOFT386_TABLE_REG { USHORT Size; - ULONG Address; + ULONG Address; } SOFT386_TABLE_REG, *PSOFT386_TABLE_REG; typedef union _SOFT386_FLAGS_REG Modified: branches/ntvdm/lib/soft386/common.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/common.c?rev=…
============================================================================== --- branches/ntvdm/lib/soft386/common.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/common.c [iso-8859-1] Sat Aug 17 21:15:55 2013 @@ -8,7 +8,15 @@ /* INCLUDES *******************************************************************/ +// #define WIN32_NO_STATUS +// #define _INC_WINDOWS +#include <windef.h> + +#include <soft386.h> #include "common.h" + +// #define NDEBUG +#include <debug.h> /* PRIVATE FUNCTIONS **********************************************************/ @@ -100,7 +108,7 @@ else { /* Read the memory directly */ - RtlMoveMemory(Buffer, (LPVOID)LinearAddress, Size); + RtlMoveMemory(Buffer, (PVOID)LinearAddress, Size); } return TRUE; @@ -177,7 +185,7 @@ else { /* Write the memory directly */ - RtlMoveMemory((LPVOID)LinearAddress, Buffer, Size); + RtlMoveMemory((PVOID)LinearAddress, Buffer, Size); } return TRUE; @@ -344,7 +352,7 @@ else { RtlMoveMemory(&GdtEntry, - (LPVOID)(State->Gdtr.Address + (PVOID)(State->Gdtr.Address + GET_SEGMENT_INDEX(Selector)), sizeof(GdtEntry)); } Modified: branches/ntvdm/lib/soft386/common.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/common.h?rev=…
============================================================================== --- branches/ntvdm/lib/soft386/common.h [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/common.h [iso-8859-1] Sat Aug 17 21:15:55 2013 @@ -8,10 +8,6 @@ #ifndef _COMMON_H_ #define _COMMON_H_ - -/* INCLUDES *******************************************************************/ - -#include <soft386.h> /* DEFINES ********************************************************************/ Modified: branches/ntvdm/lib/soft386/soft386.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/soft386.c?rev…
============================================================================== --- branches/ntvdm/lib/soft386/soft386.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/soft386.c [iso-8859-1] Sat Aug 17 21:15:55 2013 @@ -8,7 +8,15 @@ /* INCLUDES *******************************************************************/ +// #define WIN32_NO_STATUS +// #define _INC_WINDOWS +#include <windef.h> + +#include <soft386.h> #include "common.h" + +// #define NDEBUG +#include <debug.h> /* DEFINES ********************************************************************/
11 years, 2 months
1
0
0
0
[hbelusca] 59765: [SERVICES] Clarify the fact that WaitForSingleObject returns WAIT_OBJECT_0 (which happens to be equal to ERROR_SUCCESS...)
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Aug 17 20:07:39 2013 New Revision: 59765 URL:
http://svn.reactos.org/svn/reactos?rev=59765&view=rev
Log: [SERVICES] Clarify the fact that WaitForSingleObject returns WAIT_OBJECT_0 (which happens to be equal to ERROR_SUCCESS...) Modified: trunk/reactos/base/system/services/database.c Modified: trunk/reactos/base/system/services/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/datab…
============================================================================== --- trunk/reactos/base/system/services/database.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/database.c [iso-8859-1] Sat Aug 17 20:07:39 2013 @@ -956,7 +956,7 @@ dwError = ERROR_SERVICE_REQUEST_TIMEOUT; goto Done; } - else if (dwError == ERROR_SUCCESS) + else if (dwError == WAIT_OBJECT_0) { bResult = GetOverlappedResult(Service->lpImage->hControlPipe, &Overlapped, @@ -1010,7 +1010,7 @@ dwError = ERROR_SERVICE_REQUEST_TIMEOUT; goto Done; } - else if (dwError == ERROR_SUCCESS) + else if (dwError == WAIT_OBJECT_0) { bResult = GetOverlappedResult(Service->lpImage->hControlPipe, &Overlapped, @@ -1207,7 +1207,7 @@ dwError = ERROR_SERVICE_REQUEST_TIMEOUT; goto Done; } - else if (dwError == ERROR_SUCCESS) + else if (dwError == WAIT_OBJECT_0) { bResult = GetOverlappedResult(Service->lpImage->hControlPipe, &Overlapped, @@ -1261,7 +1261,7 @@ dwError = ERROR_SERVICE_REQUEST_TIMEOUT; goto Done; } - else if (dwError == ERROR_SUCCESS) + else if (dwError == WAIT_OBJECT_0) { bResult = GetOverlappedResult(Service->lpImage->hControlPipe, &Overlapped, @@ -1425,9 +1425,9 @@ return ERROR_SERVICE_REQUEST_TIMEOUT; } - else if (dwError == ERROR_SUCCESS) - { - DPRINT("WaitForSingleObject() returned ERROR_SUCCESS\n"); + else if (dwError == WAIT_OBJECT_0) + { + DPRINT("WaitForSingleObject() returned WAIT_OBJECT_0\n"); DPRINT("Process Id: %lu\n", dwProcessId);
11 years, 2 months
1
0
0
0
[aandrejevic] 59764: [SOFT386] Implement Soft386LoadSegment. [NTVDM] Fix BiosPrintCharacter (Adapted from a patch by Hermes Belusca-Maito).
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Sat Aug 17 18:44:16 2013 New Revision: 59764 URL:
http://svn.reactos.org/svn/reactos?rev=59764&view=rev
Log: [SOFT386] Implement Soft386LoadSegment. [NTVDM] Fix BiosPrintCharacter (Adapted from a patch by Hermes Belusca-Maito). Modified: branches/ntvdm/lib/soft386/common.c branches/ntvdm/lib/soft386/common.h branches/ntvdm/subsystems/ntvdm/bios.c Modified: branches/ntvdm/lib/soft386/common.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/common.c?rev=…
============================================================================== --- branches/ntvdm/lib/soft386/common.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/common.c [iso-8859-1] Sat Aug 17 18:44:16 2013 @@ -10,6 +10,16 @@ #include "common.h" +/* PRIVATE FUNCTIONS **********************************************************/ + +static +inline +INT +Soft386GetCurrentPrivLevel(PSOFT386_STATE State) +{ + return GET_SEGMENT_RPL(State->SegmentRegs[SOFT386_REG_CS].Selector); +} + /* PUBLIC FUNCTIONS ***********************************************************/ inline @@ -48,7 +58,7 @@ return FALSE; } - if (GET_SEGMENT_DPL(CachedDescriptor->Selector) > CachedDescriptor->Dpl) + if (GET_SEGMENT_RPL(CachedDescriptor->Selector) > CachedDescriptor->Dpl) { // TODO: Generate exception #GP return FALSE; @@ -131,7 +141,7 @@ return FALSE; } - if (GET_SEGMENT_DPL(CachedDescriptor->Selector) > CachedDescriptor->Dpl) + if (GET_SEGMENT_RPL(CachedDescriptor->Selector) > CachedDescriptor->Dpl) { // TODO: Generate exception #GP return FALSE; @@ -299,4 +309,114 @@ return TRUE; } +inline +BOOLEAN +Soft386LoadSegment(PSOFT386_STATE State, INT Segment, WORD Selector) +{ + PSOFT386_SEG_REG CachedDescriptor; + SOFT386_GDT_ENTRY GdtEntry; + + ASSERT(Segment < SOFT386_NUM_SEG_REGS); + + /* Get the cached descriptor */ + CachedDescriptor = &State->SegmentRegs[Segment]; + + /* Check for protected mode */ + if (State->ControlRegisters[SOFT386_REG_CR0] & SOFT386_CR0_PE) + { + /* Make sure the GDT contains the entry */ + if (GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1)) + { + // TODO: Exception #GP + return FALSE; + } + + /* Read the GDT */ + // FIXME: This code is only correct when paging is disabled!!! + if (State->MemReadCallback) + { + State->MemReadCallback(State, + State->Gdtr.Address + + GET_SEGMENT_INDEX(Selector), + &GdtEntry, + sizeof(GdtEntry)); + } + else + { + RtlMoveMemory(&GdtEntry, + (LPVOID)(State->Gdtr.Address + + GET_SEGMENT_INDEX(Selector)), + sizeof(GdtEntry)); + } + + /* Check if we are loading SS */ + if (Segment == SOFT386_REG_SS) + { + if (GET_SEGMENT_INDEX(Selector) == 0) + { + // TODO: Exception #GP + return FALSE; + } + + if (GdtEntry.Executable || !GdtEntry.ReadWrite) + { + // TODO: Exception #GP + return FALSE; + } + + if ((GET_SEGMENT_RPL(Selector) != Soft386GetCurrentPrivLevel(State)) + || (GET_SEGMENT_RPL(Selector) != GdtEntry.Dpl)) + { + // TODO: Exception #GP + return FALSE; + } + + if (!GdtEntry.Present) + { + // TODO: Exception #SS + return FALSE; + } + } + else + { + if ((GET_SEGMENT_RPL(Selector) > GdtEntry.Dpl) + && (Soft386GetCurrentPrivLevel(State) > GdtEntry.Dpl)) + { + // TODO: Exception #GP + return FALSE; + } + + if (!GdtEntry.Present) + { + // TODO: Exception #NP + return FALSE; + } + } + + /* Update the cache entry */ + CachedDescriptor->Selector = Selector; + CachedDescriptor->Base = GdtEntry.Base | (GdtEntry.BaseHigh << 24); + CachedDescriptor->Limit = GdtEntry.Limit | (GdtEntry.LimitHigh << 16); + CachedDescriptor->Accessed = GdtEntry.Accessed; + CachedDescriptor->ReadWrite = GdtEntry.ReadWrite; + CachedDescriptor->DirConf = GdtEntry.DirConf; + CachedDescriptor->Executable = GdtEntry.Executable; + CachedDescriptor->SystemType = GdtEntry.SystemType; + CachedDescriptor->Dpl = GdtEntry.Dpl; + CachedDescriptor->Present = GdtEntry.Present; + CachedDescriptor->Size = GdtEntry.Size; + + /* Check for page granularity */ + if (GdtEntry.Granularity) CachedDescriptor->Limit <<= 12; + } + else + { + /* Update the selector and base */ + CachedDescriptor->Selector = Selector; + CachedDescriptor->Base = Selector << 4; + } + + return TRUE; +} + /* EOF */ Modified: branches/ntvdm/lib/soft386/common.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/common.h?rev=…
============================================================================== --- branches/ntvdm/lib/soft386/common.h [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/common.h [iso-8859-1] Sat Aug 17 18:44:16 2013 @@ -15,7 +15,8 @@ /* DEFINES ********************************************************************/ -#define GET_SEGMENT_DPL(s) ((s) & 3) +#define GET_SEGMENT_RPL(s) ((s) & 3) +#define GET_SEGMENT_INDEX(s) ((s) & 0xFFF8) /* FUNCTIONS ******************************************************************/ @@ -58,6 +59,15 @@ PULONG Value ); +inline +BOOLEAN +Soft386LoadSegment +( + PSOFT386_STATE State, + INT Segment, + WORD Selector +); + #endif // _COMMON_H_ /* EOF */ Modified: branches/ntvdm/subsystems/ntvdm/bios.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?r…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Sat Aug 17 18:44:16 2013 @@ -356,7 +356,7 @@ { Character = Buffer[Counter++]; - /* Read from video memory */ + /* Write to video memory */ VgaWriteMemory(VideoAddress + (i * Bda->ScreenColumns + j) * sizeof(WORD), (LPVOID)&Character, sizeof(WORD)); @@ -701,33 +701,78 @@ Row = HIBYTE(Bda->CursorPosition[Page]); Column = LOBYTE(Bda->CursorPosition[Page]); - /* Write the character */ - VgaWriteMemory(TO_LINEAR(TEXT_VIDEO_SEG, - (Row * Bda->ScreenColumns + Column) * sizeof(WORD)), - (LPVOID)&CharData, - sizeof(WORD)); - - /* Advance the cursor */ - Column++; + if (Character == '\a') + { + /* Bell control character */ + // NOTE: We may use what the terminal emulator offers to us... + Beep(800, 200); + return; + } + else if (Character == '\b') + { + /* Backspace control character */ + if (Column > 0) + { + Column--; + } + else if (Row > 0) + { + Column = Bda->ScreenColumns - 1; + Row--; + } + + /* Erase the existing character */ + CharData = (Attribute << 8) | ' '; + VgaWriteMemory(TO_LINEAR(TEXT_VIDEO_SEG, + Page * Bda->VideoPageSize + + (Row * Bda->ScreenColumns + Column) * sizeof(WORD)), + (LPVOID)&CharData, + sizeof(WORD)); + } + else if (Character == '\n') + { + /* Line Feed control character */ + Row++; + } + else if (Character == '\r') + { + /* Carriage Return control character */ + Column = 0; + } + else + { + /* Default character */ + + /* Write the character */ + VgaWriteMemory(TO_LINEAR(TEXT_VIDEO_SEG, + Page * Bda->VideoPageSize + + (Row * Bda->ScreenColumns + Column) * sizeof(WORD)), + (LPVOID)&CharData, + sizeof(WORD)); + + /* Advance the cursor */ + Column++; + } /* Check if it passed the end of the row */ - if (Column == Bda->ScreenColumns) - { - /* Return to the first column */ + if (Column >= Bda->ScreenColumns) + { + /* Return to the first column and go to the next line */ Column = 0; - - if (Row == Bda->ScreenRows) - { - /* The screen must be scrolled */ - SMALL_RECT Rectangle = { 0, 0, Bda->ScreenColumns - 1, Bda->ScreenRows }; - - BiosScrollWindow(SCROLL_DIRECTION_UP, - 1, - Rectangle, - Page, - DEFAULT_ATTRIBUTE); - } - else Row++; + Row++; + } + + /* Scroll the screen up if needed */ + if (Row > Bda->ScreenRows) + { + /* The screen must be scrolled up */ + SMALL_RECT Rectangle = { 0, 0, Bda->ScreenColumns - 1, Bda->ScreenRows }; + + BiosScrollWindow(SCROLL_DIRECTION_UP, + 1, + Rectangle, + Page, + DEFAULT_ATTRIBUTE); } /* Set the cursor position */ @@ -820,8 +865,8 @@ }; /* Call the internal function */ - BiosScrollWindow((HIBYTE(Eax) == 0x06) - ? SCROLL_DIRECTION_UP : SCROLL_DIRECTION_DOWN, + BiosScrollWindow((HIBYTE(Eax) == 0x06) ? SCROLL_DIRECTION_UP + : SCROLL_DIRECTION_DOWN, LOBYTE(Eax), Rectangle, Bda->VideoPage,
11 years, 2 months
1
0
0
0
[akhaldi] 59763: [PSDK] * Annotate oledlg.h.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Aug 17 18:19:52 2013 New Revision: 59763 URL:
http://svn.reactos.org/svn/reactos?rev=59763&view=rev
Log: [PSDK] * Annotate oledlg.h. Modified: trunk/reactos/include/psdk/oledlg.h Modified: trunk/reactos/include/psdk/oledlg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/oledlg.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/oledlg.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/oledlg.h [iso-8859-1] Sat Aug 17 18:19:52 2013 @@ -744,20 +744,38 @@ DECLARE_INTERFACE_(IOleUILinkContainerA,IUnknown) { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(HRESULT,QueryInterface)(THIS_ + _In_ REFIID riid, + _Outptr_ void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IOleUILinkContainerA methods ***/ - STDMETHOD_(DWORD,GetNextLink)(THIS_ DWORD dwLink) PURE; - STDMETHOD(SetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD dwUpdateOpt) PURE; - STDMETHOD(GetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD *lpdwUpdateOpt) PURE; - STDMETHOD(SetLinkSource)(THIS_ DWORD dwLink, LPSTR lpszDisplayName, - ULONG lenFileName, ULONG *pchEaten, BOOL fValidateSource) PURE; - STDMETHOD(GetLinkSource)(THIS_ DWORD dwLink, LPSTR *lplpszDisplayName, ULONG *lplenFileName, - LPSTR *lplpszFullLinkType, LPSTR *lplpszShortLinkType, - BOOL *lpfSourceAvailable, BOOL *lpfIsSelected) PURE; - STDMETHOD(OpenLinkSource)(THIS_ DWORD dwLink) PURE; - STDMETHOD(UpdateLink)(THIS_ DWORD dwLink, BOOL fErrorMessage, BOOL fReserved) PURE; + STDMETHOD_(DWORD,GetNextLink)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(SetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _In_ DWORD dwUpdateOpt) PURE; + STDMETHOD(GetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _Out_ DWORD *lpdwUpdateOpt) PURE; + STDMETHOD(SetLinkSource)(THIS_ + _In_ DWORD dwLink, + _In_ LPSTR lpszDisplayName, + _In_ ULONG lenFileName, + _Out_ ULONG *pchEaten, + _In_ BOOL fValidateSource) PURE; + STDMETHOD(GetLinkSource)(THIS_ + _In_ DWORD dwLink, + _Outptr_opt_result_maybenull_ LPSTR *lplpszDisplayName, + _Out_ ULONG *lplenFileName, + _Outptr_opt_result_maybenull_ LPSTR *lplpszFullLinkType, + _Outptr_opt_result_maybenull_ LPSTR *lplpszShortLinkType, + _Out_ BOOL *lpfSourceAvailable, + _Out_ BOOL *lpfIsSelected) PURE; + STDMETHOD(OpenLinkSource)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(UpdateLink)(THIS_ + _In_ DWORD dwLink, + _In_ BOOL fErrorMessage, + _In_ BOOL fReserved) PURE; STDMETHOD(CancelLink)(THIS_ DWORD dwLink) PURE; }; #undef INTERFACE @@ -766,20 +784,38 @@ DECLARE_INTERFACE_(IOleUILinkContainerW,IUnknown) { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(HRESULT,QueryInterface)(THIS_ + _In_ REFIID riid, + _Outptr_ void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IOleUILinkContainerW methods ***/ - STDMETHOD_(DWORD,GetNextLink)(THIS_ DWORD dwLink) PURE; - STDMETHOD(SetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD dwUpdateOpt) PURE; - STDMETHOD(GetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD *lpdwUpdateOpt) PURE; - STDMETHOD(SetLinkSource)(THIS_ DWORD dwLink, LPWSTR lpszDisplayName, - ULONG lenFileName, ULONG *pchEaten, BOOL fValidateSource) PURE; - STDMETHOD(GetLinkSource)(THIS_ DWORD dwLink, LPWSTR *lplpszDisplayName, ULONG *lplenFileName, - LPWSTR *lplpszFullLinkType, LPWSTR *lplpszShortLinkType, - BOOL *lpfSourceAvailable, BOOL *lpfIsSelected) PURE; - STDMETHOD(OpenLinkSource)(THIS_ DWORD dwLink) PURE; - STDMETHOD(UpdateLink)(THIS_ DWORD dwLink, BOOL fErrorMessage, BOOL fReserved) PURE; + STDMETHOD_(DWORD,GetNextLink)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(SetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _In_ DWORD dwUpdateOpt) PURE; + STDMETHOD(GetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _Out_ DWORD *lpdwUpdateOpt) PURE; + STDMETHOD(SetLinkSource)(THIS_ + _In_ DWORD dwLink, + _In_ LPWSTR lpszDisplayName, + _In_ ULONG lenFileName, + _Out_ ULONG *pchEaten, + _In_ BOOL fValidateSource) PURE; + STDMETHOD(GetLinkSource)(THIS_ + _In_ DWORD dwLink, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszDisplayName, + _Out_ ULONG *lplenFileName, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszFullLinkType, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszShortLinkType, + _Out_ BOOL *lpfSourceAvailable, + _Out_ BOOL *lpfIsSelected) PURE; + STDMETHOD(OpenLinkSource)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(UpdateLink)(THIS_ + _In_ DWORD dwLink, + _In_ BOOL fErrorMessage, + _In_ BOOL fReserved) PURE; STDMETHOD(CancelLink)(THIS_ DWORD dwLink) PURE; }; #undef INTERFACE @@ -812,23 +848,43 @@ DECLARE_INTERFACE_(IOleUILinkInfoA,IOleUILinkContainerA) { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(HRESULT, QueryInterface)(THIS_ + _In_ REFIID riid, + _Outptr_ void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IOleUILinkContainerA methods ***/ - STDMETHOD_(DWORD,GetNextLink)(THIS_ DWORD dwLink) PURE; - STDMETHOD(SetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD dwUpdateOpt) PURE; - STDMETHOD(GetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD *lpdwUpdateOpt) PURE; - STDMETHOD(SetLinkSource)(THIS_ DWORD dwLink, LPSTR lpszDisplayName, - ULONG lenFileName, ULONG *pchEaten, BOOL fValidateSource) PURE; - STDMETHOD(GetLinkSource)(THIS_ DWORD dwLink, LPSTR *lplpszDisplayName, ULONG *lplenFileName, - LPSTR *lplpszFullLinkType, LPSTR *lplpszShortLinkType, - BOOL *lpfSourceAvailable, BOOL *lpfIsSelected) PURE; - STDMETHOD(OpenLinkSource)(THIS_ DWORD dwLink) PURE; - STDMETHOD(UpdateLink)(THIS_ DWORD dwLink, BOOL fErrorMessage, BOOL fReserved) PURE; + STDMETHOD_(DWORD, GetNextLink)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(SetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _In_ DWORD dwUpdateOpt) PURE; + STDMETHOD(GetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _Out_ DWORD *lpdwUpdateOpt) PURE; + STDMETHOD(SetLinkSource)(THIS_ + _In_ DWORD dwLink, + _In_ LPSTR lpszDisplayName, + _In_ ULONG lenFileName, + _Out_ ULONG *pchEaten, + _In_ BOOL fValidateSource) PURE; + STDMETHOD(GetLinkSource)(THIS_ + _In_ DWORD dwLink, + _Outptr_opt_result_maybenull_ LPSTR *lplpszDisplayName, + _Out_ ULONG *lplenFileName, + _Outptr_opt_result_maybenull_ LPSTR *lplpszFullLinkType, + _Outptr_opt_result_maybenull_ LPSTR *lplpszShortLinkType, + _Out_ BOOL *lpfSourceAvailable, + _Out_ BOOL *lpfIsSelected) PURE; + STDMETHOD(OpenLinkSource)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(UpdateLink)(THIS_ + _In_ DWORD dwLink, + _In_ BOOL fErrorMessage, + _In_ BOOL fReserved) PURE; STDMETHOD(CancelLink)(THIS_ DWORD dwLink) PURE; /*** IOleUILinkInfoA methods ***/ - STDMETHOD(GetLastUpdate)(THIS_ DWORD dwLink, FILETIME *lpLastUpdate) PURE; + STDMETHOD(GetLastUpdate)(THIS_ + _In_ DWORD dwLink, + _Out_ FILETIME *lpLastUpdate) PURE; }; #undef INTERFACE @@ -836,23 +892,43 @@ DECLARE_INTERFACE_(IOleUILinkInfoW,IOleUILinkContainerW) { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(HRESULT,QueryInterface)(THIS_ + _In_ REFIID riid, + _Outptr_ void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IOleUILinkContainerW methods ***/ - STDMETHOD_(DWORD,GetNextLink)(THIS_ DWORD dwLink) PURE; - STDMETHOD(SetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD dwUpdateOpt) PURE; - STDMETHOD(GetLinkUpdateOptions)(THIS_ DWORD dwLink, DWORD *lpdwUpdateOpt) PURE; - STDMETHOD(SetLinkSource)(THIS_ DWORD dwLink, LPWSTR lpszDisplayName, - ULONG lenFileName, ULONG *pchEaten, BOOL fValidateSource) PURE; - STDMETHOD(GetLinkSource)(THIS_ DWORD dwLink, LPWSTR *lplpszDisplayName, ULONG *lplenFileName, - LPWSTR *lplpszFullLinkType, LPWSTR *lplpszShortLinkType, - BOOL *lpfSourceAvailable, BOOL *lpfIsSelected) PURE; - STDMETHOD(OpenLinkSource)(THIS_ DWORD dwLink) PURE; - STDMETHOD(UpdateLink)(THIS_ DWORD dwLink, BOOL fErrorMessage, BOOL fReserved) PURE; + STDMETHOD_(DWORD, GetNextLink)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(SetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _In_ DWORD dwUpdateOpt) PURE; + STDMETHOD(GetLinkUpdateOptions)(THIS_ + _In_ DWORD dwLink, + _Out_ DWORD *lpdwUpdateOpt) PURE; + STDMETHOD(SetLinkSource)(THIS_ + _In_ DWORD dwLink, + _In_ LPWSTR lpszDisplayName, + _In_ ULONG lenFileName, + _Out_ ULONG *pchEaten, + _In_ BOOL fValidateSource) PURE; + STDMETHOD(GetLinkSource)(THIS_ + _In_ DWORD dwLink, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszDisplayName, + _Out_ ULONG *lplenFileName, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszFullLinkType, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszShortLinkType, + _Out_ BOOL *lpfSourceAvailable, + _Out_ BOOL *lpfIsSelected) PURE; + STDMETHOD(OpenLinkSource)(THIS_ _In_ DWORD dwLink) PURE; + STDMETHOD(UpdateLink)(THIS_ + _In_ DWORD dwLink, + _In_ BOOL fErrorMessage, + _In_ BOOL fReserved) PURE; STDMETHOD(CancelLink)(THIS_ DWORD dwLink) PURE; /*** IOleUILinkInfoW methods ***/ - STDMETHOD(GetLastUpdate)(THIS_ DWORD dwLink, FILETIME *lpLastUpdate) PURE; + STDMETHOD(GetLastUpdate)(THIS_ + _In_ DWORD dwLink, + _Out_ FILETIME *lpLastUpdate) PURE; }; #undef INTERFACE @@ -886,18 +962,40 @@ DECLARE_INTERFACE_(IOleUIObjInfoA,IUnknown) { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(HRESULT,QueryInterface)(THIS_ + _In_ REFIID riid, + _Outptr_ void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IOleUIObjInfoA methods ***/ - STDMETHOD(GetObjectInfo)(THIS_ DWORD dwObject, DWORD *lpdwObjSize, LPSTR *lplpszLabel, - LPSTR *lplpszType, LPSTR *lplpszShortType, LPSTR *lplpszLocation) PURE; - STDMETHOD(GetConvertInfo)(THIS_ DWORD dwObject, CLSID *lpClassID, WORD *lpwFormat, - CLSID *lpConvertDefaultClassID, LPCLSID *lplpClsidExclude, UINT *lpcClsidExclude) PURE; - STDMETHOD(ConvertObject)(THIS_ DWORD dwObject, REFCLSID clsidNew) PURE; - STDMETHOD(GetViewInfo)(THIS_ DWORD dwObject, HGLOBAL *phMetaPict, DWORD *pdvAspect, INT *pnCurrentScale) PURE; - STDMETHOD(SetViewInfo)(THIS_ DWORD dwObject, HGLOBAL hMetaPict, DWORD dvAspect, - INT nCurrentScale, BOOL bRelativeToOrig) PURE; + STDMETHOD(GetObjectInfo)(THIS_ + _In_ DWORD dwObject, + _Out_ DWORD *lpdwObjSize, + _Outptr_opt_result_maybenull_ LPSTR *lplpszLabel, + _Outptr_opt_result_maybenull_ LPSTR *lplpszType, + _Outptr_opt_result_maybenull_ LPSTR *lplpszShortType, + _Outptr_opt_result_maybenull_ LPSTR *lplpszLocation) PURE; + STDMETHOD(GetConvertInfo)(THIS_ + _In_ DWORD dwObject, + _Out_ CLSID *lpClassID, + _Out_ WORD *lpwFormat, + _Out_ CLSID *lpConvertDefaultClassID, + _Outptr_result_maybenull_ LPCLSID *lplpClsidExclude, + _Out_opt_ UINT *lpcClsidExclude) PURE; + STDMETHOD(ConvertObject)(THIS_ + _In_ DWORD dwObject, + _In_ REFCLSID clsidNew) PURE; + STDMETHOD(GetViewInfo)(THIS_ + _In_ DWORD dwObject, + _In_opt_ HGLOBAL *phMetaPict, + _In_opt_ DWORD *pdvAspect, + _In_opt_ INT *pnCurrentScale) PURE; + STDMETHOD(SetViewInfo)(THIS_ + _In_ DWORD dwObject, + _In_ HGLOBAL hMetaPict, + _In_ DWORD dvAspect, + _In_ INT nCurrentScale, + _In_ BOOL bRelativeToOrig) PURE; }; #undef INTERFACE @@ -905,18 +1003,40 @@ DECLARE_INTERFACE_(IOleUIObjInfoW,IUnknown) { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(HRESULT,QueryInterface)(THIS_ + _In_ REFIID riid, + _Outptr_ void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IOleUIObjInfoW methods ***/ - STDMETHOD(GetObjectInfo)(THIS_ DWORD dwObject, DWORD *lpdwObjSize, LPWSTR *lplpszLabel, - LPWSTR *lplpszType, LPWSTR *lplpszShortType, LPWSTR *lplpszLocation) PURE; - STDMETHOD(GetConvertInfo)(THIS_ DWORD dwObject, CLSID *lpClassID, WORD *lpwFormat, - CLSID *lpConvertDefaultClassID, LPCLSID *lplpClsidExclude, UINT *lpcClsidExclude) PURE; - STDMETHOD(ConvertObject)(THIS_ DWORD dwObject, REFCLSID clsidNew) PURE; - STDMETHOD(GetViewInfo)(THIS_ DWORD dwObject, HGLOBAL *phMetaPict, DWORD *pdvAspect, INT *pnCurrentScale) PURE; - STDMETHOD(SetViewInfo)(THIS_ DWORD dwObject, HGLOBAL hMetaPict, DWORD dvAspect, - INT nCurrentScale, BOOL bRelativeToOrig) PURE; + STDMETHOD(GetObjectInfo)(THIS_ + _In_ DWORD dwObject, + _Out_ DWORD *lpdwObjSize, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszLabel, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszType, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszShortType, + _Outptr_opt_result_maybenull_ LPWSTR *lplpszLocation) PURE; + STDMETHOD(GetConvertInfo)(THIS_ + _In_ DWORD dwObject, + _Out_ CLSID *lpClassID, + _Out_ WORD *lpwFormat, + _Out_ CLSID *lpConvertDefaultClassID, + _Outptr_result_maybenull_ LPCLSID *lplpClsidExclude, + _Out_opt_ UINT *lpcClsidExclude) PURE; + STDMETHOD(ConvertObject)(THIS_ + _In_ DWORD dwObject, + _In_ REFCLSID clsidNew) PURE; + STDMETHOD(GetViewInfo)(THIS_ + _In_ DWORD dwObject, + _In_opt_ HGLOBAL *phMetaPict, + _In_opt_ DWORD *pdvAspect, + _In_opt_ INT *pnCurrentScale) PURE; + STDMETHOD(SetViewInfo)(THIS_ + _In_ DWORD dwObject, + _In_ HGLOBAL hMetaPict, + _In_ DWORD dvAspect, + _In_ INT nCurrentScale, + _In_ BOOL bRelativeToOrig) PURE; }; #undef INTERFACE @@ -937,37 +1057,76 @@ #define IOleUIObjInfo_SetViewInfo(p,a,b,c,d,e) (p)->lpVtbl->SetViewInfo(p,a,b,c,d,e) #endif -UINT WINAPI OleUIInsertObjectW(LPOLEUIINSERTOBJECTW); -UINT WINAPI OleUIInsertObjectA(LPOLEUIINSERTOBJECTA); +UINT WINAPI OleUIInsertObjectW(_In_ LPOLEUIINSERTOBJECTW); +UINT WINAPI OleUIInsertObjectA(_In_ LPOLEUIINSERTOBJECTA); #define OleUIInsertObject WINELIB_NAME_AW(OleUIInsertObject) -UINT WINAPI OleUIConvertA(LPOLEUICONVERTA); -UINT WINAPI OleUIConvertW(LPOLEUICONVERTW); +UINT WINAPI OleUIConvertA(_In_ LPOLEUICONVERTA); +UINT WINAPI OleUIConvertW(_In_ LPOLEUICONVERTW); #define OleUIConvert WINELIB_NAME_AW(OleUIConvert) -UINT WINAPI OleUIChangeIconA(LPOLEUICHANGEICONA); -UINT WINAPI OleUIChangeIconW(LPOLEUICHANGEICONW); +UINT WINAPI OleUIChangeIconA(_In_ LPOLEUICHANGEICONA); +UINT WINAPI OleUIChangeIconW(_In_ LPOLEUICHANGEICONW); #define OleUIChangeIcon WINELIB_NAME_AW(OleUIChangeIcon) -UINT WINAPI OleUIBusyA(LPOLEUIBUSYA); -UINT WINAPI OleUIBusyW(LPOLEUIBUSYW); +UINT WINAPI OleUIBusyA(_In_ LPOLEUIBUSYA); +UINT WINAPI OleUIBusyW(_In_ LPOLEUIBUSYW); #define OleUIBusy WINELIB_NAME_AW(OleUIBusy) -UINT WINAPI OleUIObjectPropertiesA(LPOLEUIOBJECTPROPSA); -UINT WINAPI OleUIObjectPropertiesW(LPOLEUIOBJECTPROPSW); +UINT WINAPI OleUIObjectPropertiesA(_In_ LPOLEUIOBJECTPROPSA); +UINT WINAPI OleUIObjectPropertiesW(_In_ LPOLEUIOBJECTPROPSW); #define OleUIObjectProperties WINELIB_NAME_AW(OleUIObjectProperties) -UINT WINAPI OleUIChangeSourceW(LPOLEUICHANGESOURCEW); -UINT WINAPI OleUIChangeSourceA(LPOLEUICHANGESOURCEA); +UINT WINAPI OleUIChangeSourceW(_In_ LPOLEUICHANGESOURCEW); +UINT WINAPI OleUIChangeSourceA(_In_ LPOLEUICHANGESOURCEA); #define OleUIChangeSource WINELIB_NAME_AW(OleUIChangeSource) -UINT WINAPI OleUIEditLinksA(LPOLEUIEDITLINKSA lpOleUIEditLinks); -UINT WINAPI OleUIEditLinksW(LPOLEUIEDITLINKSW lpOleUIEditLinks); +UINT WINAPI OleUIEditLinksA(_In_ LPOLEUIEDITLINKSA lpOleUIEditLinks); +UINT WINAPI OleUIEditLinksW(_In_ LPOLEUIEDITLINKSW lpOleUIEditLinks); #define OleUIEditLinks WINELIB_NAME_AW(OleUIEditLinks) -BOOL WINAPI OleUIUpdateLinksA(LPOLEUILINKCONTAINERA lpOleUILinkCntr, HWND hwndParent, LPSTR lpszTitle, INT cLinks); -BOOL WINAPI OleUIUpdateLinksW(LPOLEUILINKCONTAINERW lpOleUILinkCntr, HWND hwndParent, LPWSTR lpszTitle, INT cLinks); -#define OleUIUpdateLinks WINELIB_NAME_AW(OleUIUpdateLinks) -BOOL WINAPI OleUIAddVerbMenuA(LPOLEOBJECT lpOleObj, LPCSTR lpszShortType, HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax, - BOOL bAddConvert, UINT idConvert, HMENU *lphMenu); -BOOL WINAPI OleUIAddVerbMenuW(LPOLEOBJECT lpOleObj, LPCWSTR lpszShortType, HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax, - BOOL bAddConvert, UINT idConvert, HMENU *lphMenu); -#define OleUIAddVerbMenu WINELIB_NAME_AW(OleUIAddVerbMenu) -UINT WINAPI OleUIPasteSpecialA(LPOLEUIPASTESPECIALA lpOleUIPasteSpecial); -UINT WINAPI OleUIPasteSpecialW(LPOLEUIPASTESPECIALW lpOleUIPasteSpecial); + +BOOL +WINAPI +OleUIUpdateLinksA( + _In_ LPOLEUILINKCONTAINERA lpOleUILinkCntr, + _In_ HWND hwndParent, + _In_ LPSTR lpszTitle, + _In_ INT cLinks); + +BOOL +WINAPI +OleUIUpdateLinksW( + _In_ LPOLEUILINKCONTAINERW lpOleUILinkCntr, + _In_ HWND hwndParent, + _In_ LPWSTR lpszTitle, + _In_ INT cLinks); + +#define OleUIUpdateLinks WINELIB_NAME_AW(OleUIUpdateLinks) + +BOOL +WINAPI +OleUIAddVerbMenuA( + _In_opt_ LPOLEOBJECT lpOleObj, + _In_opt_ LPCSTR lpszShortType, + _In_ HMENU hMenu, + _In_ UINT uPos, + _In_ UINT uIDVerbMin, + _In_ UINT uIDVerbMax, + _In_ BOOL bAddConvert, + _In_ UINT idConvert, + _Out_ HMENU *lphMenu); + +BOOL +WINAPI +OleUIAddVerbMenuW( + _In_opt_ LPOLEOBJECT lpOleObj, + _In_opt_ LPCWSTR lpszShortType, + _In_ HMENU hMenu, + _In_ UINT uPos, + _In_ UINT uIDVerbMin, + _In_ UINT uIDVerbMax, + _In_ BOOL bAddConvert, + _In_ UINT idConvert, + _Out_ HMENU *lphMenu); + +#define OleUIAddVerbMenu WINELIB_NAME_AW(OleUIAddVerbMenu) + +UINT WINAPI OleUIPasteSpecialA(_In_ LPOLEUIPASTESPECIALA lpOleUIPasteSpecial); +UINT WINAPI OleUIPasteSpecialW(_In_ LPOLEUIPASTESPECIALW lpOleUIPasteSpecial); #define OleUIPasteSpecial WINELIB_NAME_AW(OleUIPasteSpecial) INT __cdecl OleUIPromptUserA(INT,HWND, ...); INT __cdecl OleUIPromptUserW(INT,HWND, ...);
11 years, 2 months
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
20
...
33
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Results per page:
10
25
50
100
200