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
December
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
January 2012
----- 2024 -----
December 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
19 participants
559 discussions
Start a n
N
ew thread
[akhaldi] 55097: [ADVPACK] * Sync to Wine 1.3.37.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Jan 23 12:26:32 2012 New Revision: 55097 URL:
http://svn.reactos.org/svn/reactos?rev=55097&view=rev
Log: [ADVPACK] * Sync to Wine 1.3.37. Modified: trunk/reactos/dll/win32/advpack/advpack.c trunk/reactos/dll/win32/advpack/advpack_private.h trunk/reactos/dll/win32/advpack/install.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/advpack/advpack.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/advpack.…
============================================================================== --- trunk/reactos/dll/win32/advpack/advpack.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advpack/advpack.c [iso-8859-1] Mon Jan 23 12:26:32 2012 @@ -452,7 +452,7 @@ } /* registers the OCX if do_reg is TRUE, unregisters it otherwise */ -HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg) +HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param) { DLLREGISTER reg_func; @@ -519,7 +519,7 @@ if (!hm) goto done; - hr = do_ocx_reg(hm, TRUE); + hr = do_ocx_reg(hm, TRUE, str_flags, param); done: FreeLibrary(hm); Modified: trunk/reactos/dll/win32/advpack/advpack_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/advpack_…
============================================================================== --- trunk/reactos/dll/win32/advpack/advpack_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advpack/advpack_private.h [iso-8859-1] Mon Jan 23 12:26:32 2012 @@ -21,10 +21,10 @@ #ifndef __ADVPACK_PRIVATE_H #define __ADVPACK_PRIVATE_H -HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg); -LPWSTR get_parameter(LPWSTR *params, WCHAR separator); -void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir); +HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param) DECLSPEC_HIDDEN; +LPWSTR get_parameter(LPWSTR *params, WCHAR separator) DECLSPEC_HIDDEN; +void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir) DECLSPEC_HIDDEN; -HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE); +HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE) DECLSPEC_HIDDEN; #endif /* __ADVPACK_PRIVATE_H */ Modified: trunk/reactos/dll/win32/advpack/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/install.…
============================================================================== --- trunk/reactos/dll/win32/advpack/install.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advpack/install.c [iso-8859-1] Mon Jan 23 12:26:32 2012 @@ -161,7 +161,7 @@ hm = LoadLibraryExW(buffer, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (hm) { - if (do_ocx_reg(hm, TRUE) != S_OK) + if (do_ocx_reg(hm, TRUE, NULL, NULL) != S_OK) hr = E_FAIL; FreeLibrary(hm); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Mon Jan 23 12:26:32 2012 @@ -40,7 +40,7 @@ reactos/dll/directx/msdmo # Autosync reactos/dll/directx/qedit # Autosync reactos/dll/directx/quartz # Autosync -reactos/dll/win32/advpack # Autosync +reactos/dll/win32/advpack # Synced to Wine-1.3.37 reactos/dll/win32/atl # Autosync reactos/dll/win32/avifil32 # Autosync reactos/dll/win32/bcrypt # Autosync
12 years, 11 months
1
0
0
0
[akhaldi] 55096: [TOOLS/UNICODE] * Sync to Wine 1.3.37.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Jan 23 12:03:23 2012 New Revision: 55096 URL:
http://svn.reactos.org/svn/reactos?rev=55096&view=rev
Log: [TOOLS/UNICODE] * Sync to Wine 1.3.37. Modified: trunk/reactos/media/doc/README.WINE trunk/reactos/tools/unicode/string.c Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Mon Jan 23 12:03:23 2012 @@ -21,7 +21,7 @@ The following build tools are shared with Wine. -reactos/tools/unicode # Synced to Wine-1.3.29 +reactos/tools/unicode # Synced to Wine-1.3.37 reactos/tools/widl # Synced to Wine-1.3.26 reactos/tools/winebuild # Synced to Wine-1_1_13 reactos/tools/wmc # Synced to Wine-20081105 (~Wine-1.1.7) Modified: trunk/reactos/tools/unicode/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/unicode/string.c?rev…
============================================================================== --- trunk/reactos/tools/unicode/string.c [iso-8859-1] (original) +++ trunk/reactos/tools/unicode/string.c [iso-8859-1] Mon Jan 23 12:03:23 2012 @@ -351,7 +351,7 @@ { unsigned int written = 0; const WCHAR *iter = format; - char bufa[256], fmtbufa[64], *fmta; + char bufa[512], fmtbufa[64], *fmta; while (*iter) {
12 years, 11 months
1
0
0
0
[akhaldi] 55095: [DDK] * Update ndis.h annotations.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Jan 23 12:01:07 2012 New Revision: 55095 URL:
http://svn.reactos.org/svn/reactos?rev=55095&view=rev
Log: [DDK] * Update ndis.h annotations. Modified: trunk/reactos/include/ddk/ndis.h Modified: trunk/reactos/include/ddk/ndis.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ndis.h?rev=550…
============================================================================== --- trunk/reactos/include/ddk/ndis.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ndis.h [iso-8859-1] Mon Jan 23 12:01:07 2012 @@ -42,7 +42,7 @@ #include "netevent.h" #include <qos.h> -typedef int NDIS_STATUS, *PNDIS_STATUS; +typedef _Return_type_success_(return >= 0) int NDIS_STATUS, *PNDIS_STATUS; #include "ntddndis.h" @@ -53,6 +53,8 @@ #ifdef __cplusplus extern "C" { #endif + +__drv_Mode_impl(NDIS_INCLUDED) #ifndef __NET_PNP__ #define __NET_PNP__ @@ -625,12 +627,15 @@ /* Timer */ +_IRQL_requires_(DISPATCH_LEVEL) +_IRQL_requires_same_ +_Function_class_(NDIS_TIMER_FUNCTION) typedef VOID (NTAPI NDIS_TIMER_FUNCTION)( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); + _In_ PVOID SystemSpecific1, + _In_ PVOID FunctionContext, + _In_ PVOID SystemSpecific2, + _In_ PVOID SystemSpecific3); typedef NDIS_TIMER_FUNCTION *PNDIS_TIMER_FUNCTION; typedef struct _NDIS_TIMER { @@ -926,7 +931,7 @@ typedef struct _BINARY_DATA { USHORT Length; - PVOID Buffer; + _Field_size_bytes_(Length) PVOID Buffer; } BINARY_DATA; typedef struct _NDIS_CONFIGURATION_PARAMETER { @@ -965,17 +970,17 @@ typedef NTSTATUS (NTAPI *TDI_REGISTER_CALLBACK)( - IN PUNICODE_STRING DeviceName, - OUT HANDLE *TdiHandle); + _In_ PUNICODE_STRING DeviceName, + _Out_ HANDLE *TdiHandle); typedef NTSTATUS (NTAPI *TDI_PNP_HANDLER)( - IN PUNICODE_STRING UpperComponent, - IN PUNICODE_STRING LowerComponent, - IN PUNICODE_STRING BindList, - IN PVOID ReconfigBuffer, - IN UINT ReconfigBufferSize, - IN UINT Operation); + _In_ PUNICODE_STRING UpperComponent, + _In_ PUNICODE_STRING LowerComponent, + _In_ PUNICODE_STRING BindList, + _In_ PVOID ReconfigBuffer, + _In_ UINT ReconfigBufferSize, + _In_ UINT Operation); typedef struct _OID_LIST OID_LIST, *POID_LIST; @@ -1517,40 +1522,45 @@ /* Prototypes for NDIS 5.0 protocol characteristics */ +_IRQL_requires_(PASSIVE_LEVEL) typedef VOID (NTAPI *CO_SEND_COMPLETE_HANDLER)( - IN NDIS_STATUS Status, - IN NDIS_HANDLE ProtocolVcContext, - IN PNDIS_PACKET Packet); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE ProtocolVcContext, + _In_ PNDIS_PACKET Packet); + +_IRQL_requires_max_(DISPATCH_LEVEL) typedef VOID (NTAPI *CO_STATUS_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_HANDLE ProtocolVcContext OPTIONAL, - IN NDIS_STATUS GeneralStatus, - IN PVOID StatusBuffer, - IN UINT StatusBufferSize); - + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_opt_ NDIS_HANDLE ProtocolVcContext, + _In_ NDIS_STATUS GeneralStatus, + _In_ PVOID StatusBuffer, + _In_ UINT StatusBufferSize); + +_IRQL_requires_max_(DISPATCH_LEVEL) typedef UINT (NTAPI *CO_RECEIVE_PACKET_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_HANDLE ProtocolVcContext, - IN PNDIS_PACKET Packet); - + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ NDIS_HANDLE ProtocolVcContext, + _In_ PNDIS_PACKET Packet); + +_IRQL_requires_max_(DISPATCH_LEVEL) typedef NDIS_STATUS (NTAPI *CO_REQUEST_HANDLER)( - IN NDIS_HANDLE ProtocolAfContext, - IN NDIS_HANDLE ProtocolVcContext OPTIONAL, - IN NDIS_HANDLE ProtocolPartyContext OPTIONAL, - IN OUT PNDIS_REQUEST NdisRequest); - + _In_ NDIS_HANDLE ProtocolAfContext, + _In_opt_ NDIS_HANDLE ProtocolVcContext, + _In_opt_ NDIS_HANDLE ProtocolPartyContext, + _Inout_ PNDIS_REQUEST NdisRequest); + +_IRQL_requires_max_(DISPATCH_LEVEL) typedef VOID (NTAPI *CO_REQUEST_COMPLETE_HANDLER)( - IN NDIS_STATUS Status, - IN NDIS_HANDLE ProtocolAfContext OPTIONAL, - IN NDIS_HANDLE ProtocolVcContext OPTIONAL, - IN NDIS_HANDLE ProtocolPartyContext OPTIONAL, - IN PNDIS_REQUEST NdisRequest); + _In_ NDIS_STATUS Status, + _In_opt_ NDIS_HANDLE ProtocolAfContext, + _In_opt_ NDIS_HANDLE ProtocolVcContext, + _In_opt_ NDIS_HANDLE ProtocolPartyContext, + _In_ PNDIS_REQUEST NdisRequest); typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS { UCHAR MajorVersion; @@ -1694,55 +1704,55 @@ typedef VOID (NTAPI *OPEN_ADAPTER_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status, - IN NDIS_STATUS OpenErrorStatus); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ NDIS_STATUS Status, + _In_ NDIS_STATUS OpenErrorStatus); typedef VOID (NTAPI *CLOSE_ADAPTER_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ NDIS_STATUS Status); typedef VOID (NTAPI *RESET_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ NDIS_STATUS Status); typedef VOID (NTAPI *REQUEST_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_REQUEST NdisRequest, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ PNDIS_REQUEST NdisRequest, + _In_ NDIS_STATUS Status); typedef VOID (NTAPI *STATUS_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS GeneralStatus, - IN PVOID StatusBuffer, - IN UINT StatusBufferSize); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ NDIS_STATUS GeneralStatus, + _In_ PVOID StatusBuffer, + _In_ UINT StatusBufferSize); typedef VOID (NTAPI *STATUS_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext); + _In_ NDIS_HANDLE ProtocolBindingContext); typedef VOID (NTAPI *SEND_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PACKET Packet, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ PNDIS_PACKET Packet, + _In_ NDIS_STATUS Status); typedef VOID (NTAPI *WAN_SEND_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_WAN_PACKET Packet, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ PNDIS_WAN_PACKET Packet, + _In_ NDIS_STATUS Status); typedef VOID (NTAPI *TRANSFER_DATA_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PACKET Packet, - IN NDIS_STATUS Status, - IN UINT BytesTransferred); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ PNDIS_PACKET Packet, + _In_ NDIS_STATUS Status, + _In_ UINT BytesTransferred); typedef VOID (NTAPI *WAN_TRANSFER_DATA_COMPLETE_HANDLER)( @@ -1750,23 +1760,23 @@ typedef NDIS_STATUS (NTAPI *RECEIVE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_HANDLE MacReceiveContext, - IN PVOID HeaderBuffer, - IN UINT HeaderBufferSize, - IN PVOID LookAheadBuffer, - IN UINT LookaheadBufferSize, - IN UINT PacketSize); + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ NDIS_HANDLE MacReceiveContext, + _In_ PVOID HeaderBuffer, + _In_ UINT HeaderBufferSize, + _In_ PVOID LookAheadBuffer, + _In_ UINT LookaheadBufferSize, + _In_ UINT PacketSize); typedef NDIS_STATUS (NTAPI *WAN_RECEIVE_HANDLER)( - IN NDIS_HANDLE NdisLinkHandle, - IN PUCHAR Packet, - IN ULONG PacketSize); + _In_ NDIS_HANDLE NdisLinkHandle, + _In_ PUCHAR Packet, + _In_ ULONG PacketSize); typedef VOID (NTAPI *RECEIVE_COMPLETE_HANDLER)( - IN NDIS_HANDLE ProtocolBindingContext); + _In_ NDIS_HANDLE ProtocolBindingContext); /* Protocol characteristics for NDIS 3.0 protocols */ @@ -1906,115 +1916,114 @@ typedef BOOLEAN (NTAPI *W_CHECK_FOR_HANG_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext); + _In_ NDIS_HANDLE MiniportAdapterContext); typedef VOID (NTAPI *W_DISABLE_INTERRUPT_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext); + _In_ NDIS_HANDLE MiniportAdapterContext); typedef VOID (NTAPI *W_ENABLE_INTERRUPT_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext); + _In_ NDIS_HANDLE MiniportAdapterContext); typedef VOID (NTAPI *W_HALT_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext); + _In_ NDIS_HANDLE MiniportAdapterContext); typedef VOID (NTAPI *W_HANDLE_INTERRUPT_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext); + _In_ NDIS_HANDLE MiniportAdapterContext); typedef NDIS_STATUS (NTAPI *W_INITIALIZE_HANDLER)( - OUT PNDIS_STATUS OpenErrorStatus, - OUT PUINT SelectedMediumIndex, - IN PNDIS_MEDIUM MediumArray, - IN UINT MediumArraySize, - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_HANDLE WrapperConfigurationContext); + _Out_ PNDIS_STATUS OpenErrorStatus, + _Out_ PUINT SelectedMediumIndex, + _In_ PNDIS_MEDIUM MediumArray, + _In_ UINT MediumArraySize, + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_HANDLE WrapperConfigurationContext); typedef VOID (NTAPI *W_ISR_HANDLER)( - OUT PBOOLEAN InterruptRecognized, - OUT PBOOLEAN QueueMiniportHandleInterrupt, - IN NDIS_HANDLE MiniportAdapterContext); + _Out_ PBOOLEAN InterruptRecognized, + _Out_ PBOOLEAN QueueMiniportHandleInterrupt, + _In_ NDIS_HANDLE MiniportAdapterContext); typedef NDIS_STATUS (NTAPI *W_QUERY_INFORMATION_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_OID Oid, - IN PVOID InformationBuffer, - IN ULONG InformationBufferLength, - OUT PULONG BytesWritten, - OUT PULONG BytesNeeded); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_OID Oid, + _In_ PVOID InformationBuffer, + _In_ ULONG InformationBufferLength, + _Out_ PULONG BytesWritten, + _Out_ PULONG BytesNeeded); typedef NDIS_STATUS (NTAPI *W_RECONFIGURE_HANDLER)( - OUT PNDIS_STATUS OpenErrorStatus, - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_HANDLE WrapperConfigurationContext); + _Out_ PNDIS_STATUS OpenErrorStatus, + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_HANDLE WrapperConfigurationContext); typedef NDIS_STATUS (NTAPI *W_RESET_HANDLER)( - OUT PBOOLEAN AddressingReset, - IN NDIS_HANDLE MiniportAdapterContext); + _Out_ PBOOLEAN AddressingReset, + _In_ NDIS_HANDLE MiniportAdapterContext); typedef NDIS_STATUS (NTAPI *W_SEND_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PNDIS_PACKET Packet, - IN UINT Flags); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ PNDIS_PACKET Packet, + _In_ UINT Flags); typedef NDIS_STATUS (NTAPI *WM_SEND_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_HANDLE NdisLinkHandle, - IN PNDIS_WAN_PACKET Packet); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_HANDLE NdisLinkHandle, + _In_ PNDIS_WAN_PACKET Packet); typedef NDIS_STATUS (NTAPI *W_SET_INFORMATION_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_OID Oid, - IN PVOID InformationBuffer, - IN ULONG InformationBufferLength, - OUT PULONG BytesRead, - OUT PULONG BytesNeeded); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_OID Oid, + _In_ PVOID InformationBuffer, + _In_ ULONG InformationBufferLength, + _Out_ PULONG BytesRead, + _Out_ PULONG BytesNeeded); typedef NDIS_STATUS (NTAPI *W_TRANSFER_DATA_HANDLER)( - OUT PNDIS_PACKET Packet, - OUT PUINT BytesTransferred, - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_HANDLE MiniportReceiveContext, - IN UINT ByteOffset, - IN UINT BytesToTransfer); + _Out_ PNDIS_PACKET Packet, + _Out_ PUINT BytesTransferred, + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_HANDLE MiniportReceiveContext, + _In_ UINT ByteOffset, + _In_ UINT BytesToTransfer); typedef NDIS_STATUS -(NTAPI *WM_TRANSFER_DATA_HANDLER)( - VOID); +(NTAPI *WM_TRANSFER_DATA_HANDLER)(VOID); typedef VOID (NTAPI *ADAPTER_SHUTDOWN_HANDLER)( - IN PVOID ShutdownContext); + _In_ PVOID ShutdownContext); typedef VOID (NTAPI *W_RETURN_PACKET_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PNDIS_PACKET Packet); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ PNDIS_PACKET Packet); typedef VOID (NTAPI *W_SEND_PACKETS_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET PacketArray, - IN UINT NumberOfPackets); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ PPNDIS_PACKET PacketArray, + _In_ UINT NumberOfPackets); typedef VOID (NTAPI *W_ALLOCATE_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PVOID VirtualAddress, - IN PNDIS_PHYSICAL_ADDRESS PhysicalAddress, - IN ULONG Length, - IN PVOID Context); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ PVOID VirtualAddress, + _In_ PNDIS_PHYSICAL_ADDRESS PhysicalAddress, + _In_ ULONG Length, + _In_ PVOID Context); /* NDIS structures available only to miniport drivers */ @@ -2064,40 +2073,48 @@ /* Extensions for NDIS 5.0 miniports */ +_IRQL_requires_max_(DISPATCH_LEVEL) +_Function_class_(MINIPORT_CO_CREATE_VC) typedef NDIS_STATUS (NTAPI MINIPORT_CO_CREATE_VC)( - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_HANDLE NdisVcHandle, - OUT PNDIS_HANDLE MiniportVcContext); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_HANDLE NdisVcHandle, + _Out_ PNDIS_HANDLE MiniportVcContext); typedef MINIPORT_CO_CREATE_VC *W_CO_CREATE_VC_HANDLER; +_IRQL_requires_max_(DISPATCH_LEVEL) +_Function_class_(MINIPORT_CO_DELETE_VC) typedef NDIS_STATUS (NTAPI MINIPORT_CO_DELETE_VC)( - IN NDIS_HANDLE MiniportVcContext); + _In_ NDIS_HANDLE MiniportVcContext); typedef MINIPORT_CO_DELETE_VC *W_CO_DELETE_VC_HANDLER; +_IRQL_requires_max_(DISPATCH_LEVEL) +_Function_class_(MINIPORT_CO_ACTIVATE_VC) typedef NDIS_STATUS (NTAPI MINIPORT_CO_ACTIVATE_VC)( - IN NDIS_HANDLE MiniportVcContext, - IN OUT PCO_CALL_PARAMETERS CallParameters); + _In_ NDIS_HANDLE MiniportVcContext, + _Inout_ PCO_CALL_PARAMETERS CallParameters); typedef MINIPORT_CO_ACTIVATE_VC *W_CO_ACTIVATE_VC_HANDLER; +_IRQL_requires_max_(DISPATCH_LEVEL) +_Function_class_(MINIPORT_CO_DEACTIVATE_VC) typedef NDIS_STATUS (NTAPI MINIPORT_CO_DEACTIVATE_VC)( - IN NDIS_HANDLE MiniportVcContext); + _In_ NDIS_HANDLE MiniportVcContext); typedef MINIPORT_CO_DEACTIVATE_VC *W_CO_DEACTIVATE_VC_HANDLER; typedef VOID (NTAPI *W_CO_SEND_PACKETS_HANDLER)( - IN NDIS_HANDLE MiniportVcContext, - IN PPNDIS_PACKET PacketArray, - IN UINT NumberOfPackets); + _In_ NDIS_HANDLE MiniportVcContext, + _In_ PPNDIS_PACKET PacketArray, + _In_ UINT NumberOfPackets); typedef NDIS_STATUS (NTAPI *W_CO_REQUEST_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_HANDLE MiniportVcContext OPTIONAL, - IN OUT PNDIS_REQUEST NdisRequest); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_opt_ NDIS_HANDLE MiniportVcContext, + _Inout_ PNDIS_REQUEST NdisRequest); #ifdef __cplusplus @@ -2131,19 +2148,19 @@ typedef VOID (NTAPI *W_CANCEL_SEND_PACKETS_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PVOID CancelId); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ PVOID CancelId); typedef VOID (NTAPI *W_PNP_EVENT_NOTIFY_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN NDIS_DEVICE_PNP_EVENT PnPEvent, - IN PVOID InformationBuffer, - IN ULONG InformationBufferLength); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ NDIS_DEVICE_PNP_EVENT PnPEvent, + _In_ PVOID InformationBuffer, + _In_ ULONG InformationBufferLength); typedef VOID (NTAPI *W_MINIPORT_SHUTDOWN_HANDLER)( - IN PVOID ShutdownContext); + _In_ PVOID ShutdownContext); #ifdef __cplusplus @@ -2284,18 +2301,18 @@ typedef VOID (NTAPI *ETH_RCV_COMPLETE_HANDLER)( - IN PETH_FILTER Filter); + _In_ PETH_FILTER Filter); typedef VOID (NTAPI *ETH_RCV_INDICATE_HANDLER)( - IN PETH_FILTER Filter, - IN NDIS_HANDLE MacReceiveContext, - IN PCHAR Address, - IN PVOID HeaderBuffer, - IN UINT HeaderBufferSize, - IN PVOID LookaheadBuffer, - IN UINT LookaheadBufferSize, - IN UINT PacketSize); + _In_ PETH_FILTER Filter, + _In_ NDIS_HANDLE MacReceiveContext, + _In_ PCHAR Address, + _In_ PVOID HeaderBuffer, + _In_ UINT HeaderBufferSize, + _In_ PVOID LookaheadBuffer, + _In_ UINT LookaheadBufferSize, + _In_ UINT PacketSize); typedef VOID (NTAPI *FDDI_RCV_COMPLETE_HANDLER)( @@ -2315,36 +2332,36 @@ typedef VOID (NTAPI *FILTER_PACKET_INDICATION_HANDLER)( - IN NDIS_HANDLE Miniport, - IN PPNDIS_PACKET PacketArray, - IN UINT NumberOfPackets); + _In_ NDIS_HANDLE Miniport, + _In_ PPNDIS_PACKET PacketArray, + _In_ UINT NumberOfPackets); typedef VOID (NTAPI *TR_RCV_COMPLETE_HANDLER)( - IN PTR_FILTER Filter); + _In_ PTR_FILTER Filter); typedef VOID (NTAPI *TR_RCV_INDICATE_HANDLER)( - IN PTR_FILTER Filter, - IN NDIS_HANDLE MacReceiveContext, - IN PVOID HeaderBuffer, - IN UINT HeaderBufferSize, - IN PVOID LookaheadBuffer, - IN UINT LookaheadBufferSize, - IN UINT PacketSize); + _In_ PTR_FILTER Filter, + _In_ NDIS_HANDLE MacReceiveContext, + _In_ PVOID HeaderBuffer, + _In_ UINT HeaderBufferSize, + _In_ PVOID LookaheadBuffer, + _In_ UINT LookaheadBufferSize, + _In_ UINT PacketSize); typedef VOID (NTAPI *WAN_RCV_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisLinkContext); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ NDIS_HANDLE NdisLinkContext); typedef VOID (NTAPI *WAN_RCV_HANDLER)( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisLinkContext, - IN PUCHAR Packet, - IN ULONG PacketSize); + _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ NDIS_HANDLE NdisLinkContext, + _In_ PUCHAR Packet, + _In_ ULONG PacketSize); typedef VOID (FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)( @@ -2366,51 +2383,51 @@ typedef VOID (NTAPI *NDIS_M_REQ_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ NDIS_STATUS Status); typedef VOID (NTAPI *NDIS_M_RESET_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_STATUS Status, - IN BOOLEAN AddressingReset); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ NDIS_STATUS Status, + _In_ BOOLEAN AddressingReset); typedef VOID (NTAPI *NDIS_M_SEND_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle, - IN PNDIS_PACKET Packet, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ PNDIS_PACKET Packet, + _In_ NDIS_STATUS Status); typedef VOID (NTAPI *NDIS_M_SEND_RESOURCES_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle); + _In_ NDIS_HANDLE MiniportAdapterHandle); typedef BOOLEAN (FASTCALL *NDIS_M_START_SENDS)( - IN PNDIS_MINIPORT_BLOCK Miniport); + _In_ PNDIS_MINIPORT_BLOCK Miniport); typedef VOID (NTAPI *NDIS_M_STATUS_HANDLER)( - IN NDIS_HANDLE MiniportHandle, - IN NDIS_STATUS GeneralStatus, - IN PVOID StatusBuffer, - IN UINT StatusBufferSize); + _In_ NDIS_HANDLE MiniportHandle, + _In_ NDIS_STATUS GeneralStatus, + _In_ PVOID StatusBuffer, + _In_ UINT StatusBufferSize); typedef VOID (NTAPI *NDIS_M_STS_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle); + _In_ NDIS_HANDLE MiniportAdapterHandle); typedef VOID (NTAPI *NDIS_M_TD_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle, - IN PNDIS_PACKET Packet, - IN NDIS_STATUS Status, - IN UINT BytesTransferred); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ PNDIS_PACKET Packet, + _In_ NDIS_STATUS Status, + _In_ UINT BytesTransferred); typedef VOID (NTAPI *NDIS_WM_SEND_COMPLETE_HANDLER)( - IN NDIS_HANDLE MiniportAdapterHandle, - IN PVOID Packet, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ PVOID Packet, + _In_ NDIS_STATUS Status); #if ARCNET @@ -2647,38 +2664,38 @@ typedef NDIS_STATUS (NTAPI *WAN_SEND_HANDLER)( - IN NDIS_HANDLE MacBindingHandle, - IN NDIS_HANDLE LinkHandle, - IN PVOID Packet); + _In_ NDIS_HANDLE MacBindingHandle, + _In_ NDIS_HANDLE LinkHandle, + _In_ PVOID Packet); typedef VOID (NTAPI *SEND_PACKETS_HANDLER)( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET PacketArray, - IN UINT NumberOfPackets); + _In_ NDIS_HANDLE MiniportAdapterContext, + _In_ PPNDIS_PACKET PacketArray, + _In_ UINT NumberOfPackets); typedef NDIS_STATUS (NTAPI *SEND_HANDLER)( - IN NDIS_HANDLE NdisBindingHandle, - IN PNDIS_PACKET Packet); + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ PNDIS_PACKET Packet); typedef NDIS_STATUS (NTAPI *TRANSFER_DATA_HANDLER)( - IN NDIS_HANDLE NdisBindingHandle, - IN NDIS_HANDLE MacReceiveContext, - IN UINT ByteOffset, - IN UINT BytesToTransfer, - OUT PNDIS_PACKET Packet, - OUT PUINT BytesTransferred); + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ NDIS_HANDLE MacReceiveContext, + _In_ UINT ByteOffset, + _In_ UINT BytesToTransfer, + _Out_ PNDIS_PACKET Packet, + _Out_ PUINT BytesTransferred); typedef NDIS_STATUS (NTAPI *RESET_HANDLER)( - IN NDIS_HANDLE NdisBindingHandle); + _In_ NDIS_HANDLE NdisBindingHandle); typedef NDIS_STATUS (NTAPI *REQUEST_HANDLER)( - IN NDIS_HANDLE NdisBindingHandle, - IN PNDIS_REQUEST NdisRequest); + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ PNDIS_REQUEST NdisRequest); #endif /* NDIS_LEGACY_DRIVER */ @@ -2758,49 +2775,55 @@ #define NDIS_M_MAX_LOOKAHEAD 526 +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisInitializeTimer( - PNDIS_TIMER Timer, - PNDIS_TIMER_FUNCTION TimerFunction, - PVOID FunctionContext); - + _Inout_ PNDIS_TIMER Timer, + _In_ PNDIS_TIMER_FUNCTION TimerFunction, + _In_opt_ _Points_to_data_ PVOID FunctionContext); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCancelTimer( - PNDIS_TIMER Timer, - PBOOLEAN TimerCancelled); - + _In_ PNDIS_TIMER Timer, + _Out_ _At_(*TimerCancelled, _Must_inspect_result_) PBOOLEAN TimerCancelled); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisSetTimer( - PNDIS_TIMER Timer, - UINT MillisecondsToDelay); + _In_ PNDIS_TIMER Timer, + _In_ UINT MillisecondsToDelay); NDISAPI VOID NTAPI NdisSetPeriodicTimer( - PNDIS_TIMER NdisTimer, - UINT MillisecondsPeriod); - + _In_ PNDIS_TIMER NdisTimer, + _In_ UINT MillisecondsPeriod); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisSetTimerEx( - PNDIS_TIMER NdisTimer, - UINT MillisecondsToDelay, - PVOID FunctionContext); - + _In_ PNDIS_TIMER NdisTimer, + _In_ UINT MillisecondsToDelay, + _In_ PVOID FunctionContext); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI PVOID NTAPI NdisGetRoutineAddress( - PNDIS_STRING NdisRoutineName); - + _In_ PNDIS_STRING NdisRoutineName); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI UINT NTAPI @@ -2808,29 +2831,32 @@ #if NDIS_LEGACY_DRIVER +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisAllocateBuffer( - OUT PNDIS_STATUS Status, - OUT PNDIS_BUFFER *Buffer, - IN NDIS_HANDLE PoolHandle OPTIONAL, - IN PVOID VirtualAddress, - IN UINT Length); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_BUFFER *Buffer, + _In_opt_ NDIS_HANDLE PoolHandle, + _In_reads_bytes_(Length) PVOID VirtualAddress, + _In_ UINT Length); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisAllocateBufferPool( - OUT PNDIS_STATUS Status, - OUT PNDIS_HANDLE PoolHandle, - IN UINT NumberOfDescriptors); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_HANDLE PoolHandle, + _In_ UINT NumberOfDescriptors); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisFreeBufferPool( - IN NDIS_HANDLE PoolHandle); + _In_ NDIS_HANDLE PoolHandle); /* NDISAPI @@ -2841,104 +2867,118 @@ */ #define NdisFreeBuffer IoFreeMdl +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisAllocatePacketPool( - OUT PNDIS_STATUS Status, - OUT PNDIS_HANDLE PoolHandle, - IN UINT NumberOfDescriptors, - IN UINT ProtocolReservedLength); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_HANDLE PoolHandle, + _In_ UINT NumberOfDescriptors, + _In_ UINT ProtocolReservedLength); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisAllocatePacketPoolEx( - OUT PNDIS_STATUS Status, - OUT PNDIS_HANDLE PoolHandle, - IN UINT NumberOfDescriptors, - IN UINT NumberOfOverflowDescriptors, - IN UINT ProtocolReservedLength); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_HANDLE PoolHandle, + _In_ UINT NumberOfDescriptors, + _In_ UINT NumberOfOverflowDescriptors, + _In_ UINT ProtocolReservedLength); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisSetPacketPoolProtocolId( - IN NDIS_HANDLE PacketPoolHandle, - IN UINT ProtocolId); - + _In_ NDIS_HANDLE PacketPoolHandle, + _In_ UINT ProtocolId); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI UINT NTAPI NdisPacketPoolUsage( - IN NDIS_HANDLE PoolHandle); - + _In_ NDIS_HANDLE PoolHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI UINT NTAPI NdisPacketSize( - IN UINT ProtocolReservedSize); - + _In_ UINT ProtocolReservedSize); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_HANDLE NTAPI NdisGetPoolFromPacket( - IN PNDIS_PACKET Packet); - + _In_ PNDIS_PACKET Packet); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI PNDIS_PACKET_STACK NTAPI NdisIMGetCurrentPacketStack( - IN PNDIS_PACKET Packet, - OUT BOOLEAN * StacksRemaining); - + _In_ PNDIS_PACKET Packet, + _Out_ BOOLEAN *StacksRemaining); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisFreePacketPool( - IN NDIS_HANDLE PoolHandle); - + _In_ NDIS_HANDLE PoolHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisFreePacket( - IN PNDIS_PACKET Packet); - + _In_ PNDIS_PACKET Packet); + +_IRQL_requires_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisDprFreePacket( - IN PNDIS_PACKET Packet); - + _In_ PNDIS_PACKET Packet); + +_IRQL_requires_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisDprFreePacketNonInterlocked( - IN PNDIS_PACKET Packet); - + _In_ PNDIS_PACKET Packet); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisAllocatePacket( - OUT PNDIS_STATUS Status, - OUT PNDIS_PACKET *Packet, - IN NDIS_HANDLE PoolHandle); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_PACKET *Packet, + _In_ NDIS_HANDLE PoolHandle); + +_IRQL_requires_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisDprAllocatePacket( - OUT PNDIS_STATUS Status, - OUT PNDIS_PACKET *Packet, - IN NDIS_HANDLE PoolHandle); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_PACKET *Packet, + _In_ NDIS_HANDLE PoolHandle); + +_IRQL_requires_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisDprAllocatePacketNonInterlocked( - OUT PNDIS_STATUS Status, - OUT PNDIS_PACKET *Packet, - IN NDIS_HANDLE PoolHandle); + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_PACKET *Packet, + _In_ NDIS_HANDLE PoolHandle); /* * VOID @@ -3091,16 +3131,17 @@ IN OUT PNDIS_PACKET Packet, OUT PNDIS_BUFFER *Buffer); +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCopyFromPacketToPacket( - IN PNDIS_PACKET Destination, - IN UINT DestinationOffset, - IN UINT BytesToCopy, - IN PNDIS_PACKET Source, - IN UINT SourceOffset, - OUT PUINT BytesCopied); + _In_ PNDIS_PACKET Destination, + _In_ UINT DestinationOffset, + _In_ UINT BytesToCopy, + _In_ PNDIS_PACKET Source, + _In_ UINT SourceOffset, + _Out_ PUINT BytesCopied); NDISAPI VOID @@ -3114,67 +3155,77 @@ OUT PUINT BytesCopied, IN MM_PAGE_PRIORITY Priority); +_IRQL_requires_max_(DISPATCH_LEVEL) +__drv_preferredFunction("NdisAllocateMemoryWithTag", "Obsolete") NDISAPI NDIS_STATUS NTAPI NdisAllocateMemory( - OUT PVOID *VirtualAddress, - IN UINT Length, - IN UINT MemoryFlags, - IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress); + _At_(*VirtualAddress, __drv_allocatesMem(Mem)) _Outptr_result_bytebuffer_(Length) + PVOID *VirtualAddress, + _In_ UINT Length, + _In_ UINT MemoryFlags, + _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress); #define NdisInitializeWorkItem(_WI_, _R_, _C_) { \ (_WI_)->Context = _C_; \ (_WI_)->Routine = _R_; \ } +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisScheduleWorkItem( - IN PNDIS_WORK_ITEM WorkItem); - + _In_ __drv_aliasesMem PNDIS_WORK_ITEM WorkItem); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisSetPacketStatus( - IN PNDIS_PACKET Packet, - IN NDIS_STATUS Status, - IN NDIS_HANDLE Handle, - IN ULONG Code); + _In_ PNDIS_PACKET Packet, + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE Handle, + _In_ ULONG Code); #endif /* NDIS_LEGACY_DRIVER */ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisOpenFile( - OUT PNDIS_STATUS Status, - OUT PNDIS_HANDLE FileHandle, - OUT PUINT FileLength, - IN PNDIS_STRING FileName, - IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_HANDLE FileHandle, + _Out_ PUINT FileLength, + _In_ PNDIS_STRING FileName, + _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisCloseFile( - IN NDIS_HANDLE FileHandle); - + _In_ NDIS_HANDLE FileHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMapFile( - OUT PNDIS_STATUS Status, - OUT PVOID *MappedBuffer, - IN NDIS_HANDLE FileHandle); - + _Out_ PNDIS_STATUS Status, + _Out_ PVOID *MappedBuffer, + _In_ NDIS_HANDLE FileHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisUnmapFile( - IN NDIS_HANDLE FileHandle); - + _In_ NDIS_HANDLE FileHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI ULONG NTAPI @@ -3183,16 +3234,17 @@ #define NdisFlushBuffer(Buffer,WriteToDevice) \ KeFlushIoBuffers((Buffer),!(WriteToDevice), TRUE) +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCopyBuffer( - OUT PNDIS_STATUS Status, - OUT PNDIS_BUFFER *Buffer, - IN NDIS_HANDLE PoolHandle, - IN PVOID MemoryDescriptor, - IN UINT Offset, - IN UINT Length); + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_BUFFER *Buffer, + _In_ NDIS_HANDLE PoolHandle, + _In_ PVOID MemoryDescriptor, + _In_ UINT Offset, + _In_ UINT Length); /* * VOID @@ -3663,13 +3715,17 @@ #define NdisMUpdateSharedMemory(_H, _L, _V, _P) \ NdisUpdateSharedMemory(_H, _L, _V, _P) +_When_(MemoryFlags==0, _IRQL_requires_max_(DISPATCH_LEVEL)) +_When_(MemoryFlags==NDIS_MEMORY_CONTIGUOUS, _IRQL_requires_(PASSIVE_LEVEL)) +_When_(MemoryFlags==NDIS_MEMORY_NONCACHED, _IRQL_requires_max_(APC_LEVEL)) NDISAPI VOID NTAPI NdisFreeMemory( - IN PVOID VirtualAddress, - IN UINT Length, - IN UINT MemoryFlags); + _In_reads_bytes_(Length) __drv_freesMem(Mem) PVOID VirtualAddress, + _In_ UINT Length, + _In_ _Pre_satisfies_(MemoryFlags == 0 || MemoryFlags == NDIS_MEMORY_NONCACHED || MemoryFlags == NDIS_MEMORY_CONTIGUOUS) + UINT MemoryFlags); NDISAPI VOID @@ -3696,24 +3752,28 @@ IN PUCHAR Buffer, IN ULONG Length); +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMAllocateSharedMemory( - IN NDIS_HANDLE MiniportAdapterHandle, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ ULONG Length, + _In_ BOOLEAN Cached, + _Outptr_result_bytebuffer_(Length) _At_(*VirtualAddress, _Must_inspect_result_) + PVOID *VirtualAddress, + _Out_ _At_(*PhysicalAddress, _Must_inspect_result_) + PNDIS_PHYSICAL_ADDRESS PhysicalAddress); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMAllocateSharedMemoryAsync( - IN NDIS_HANDLE MiniportAdapterHandle, - IN ULONG Length, - IN BOOLEAN Cached, - IN PVOID Context); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ ULONG Length, + _In_ BOOLEAN Cached, + _In_ PVOID Context); #if defined(NDIS50) @@ -3848,23 +3908,28 @@ /* Configuration routines */ #if NDIS_LEGACY_DRIVER +_IRQL_requires_(PASSIVE_LEVEL) +_Success_(*Status >= 0) NDISAPI VOID NTAPI NdisOpenConfiguration( - OUT PNDIS_STATUS Status, - OUT PNDIS_HANDLE ConfigurationHandle, - IN NDIS_HANDLE WrapperConfigurationContext); + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_HANDLE ConfigurationHandle, + _In_ NDIS_HANDLE WrapperConfigurationContext); #endif +_IRQL_requires_(PASSIVE_LEVEL) +_Success_(*Status >= 0) NDISAPI VOID NTAPI NdisReadNetworkAddress( - OUT PNDIS_STATUS Status, - OUT PVOID *NetworkAddress, - OUT PUINT NetworkAddressLength, - IN NDIS_HANDLE ConfigurationHandle); + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _Outptr_result_bytebuffer_to_(*NetworkAddressLength, *NetworkAddressLength) + PVOID *NetworkAddress, + _Out_ PUINT NetworkAddressLength, + _In_ NDIS_HANDLE ConfigurationHandle); NDISAPI VOID @@ -3887,43 +3952,47 @@ #if NDIS_LEGACY_MINIPORT +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI ULONG NTAPI NdisReadPciSlotInformation( - IN NDIS_HANDLE NdisAdapterHandle, - IN ULONG SlotNumber, - IN ULONG Offset, - OUT PVOID Buffer, - IN ULONG Length); - + _In_ NDIS_HANDLE NdisAdapterHandle, + _In_ ULONG SlotNumber, + _In_ ULONG Offset, + _Out_writes_bytes_(Length) PVOID Buffer, + _In_ ULONG Length); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI ULONG NTAPI NdisWritePciSlotInformation( - IN NDIS_HANDLE NdisAdapterHandle, - IN ULONG SlotNumber, - IN ULONG Offset, - IN PVOID Buffer, - IN ULONG Length); - + _In_ NDIS_HANDLE NdisAdapterHandle, + _In_ ULONG SlotNumber, + _In_ ULONG Offset, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Length); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI ULONG NTAPI NdisReadPcmciaAttributeMemory( - IN NDIS_HANDLE NdisAdapterHandle, - IN ULONG Offset, - OUT PVOID Buffer, - IN ULONG Length); - + _In_ NDIS_HANDLE NdisAdapterHandle, + _In_ ULONG Offset, + _Out_writes_bytes_(Length) PVOID Buffer, + _In_ ULONG Length); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI ULONG NTAPI NdisWritePcmciaAttributeMemory( - IN NDIS_HANDLE NdisAdapterHandle, - IN ULONG Offset, - IN PVOID Buffer, - IN ULONG Length); + _In_ NDIS_HANDLE NdisAdapterHandle, + _In_ ULONG Offset, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Length); #endif /* NDIS_LEGACY_MINIPORT */ @@ -4301,46 +4370,53 @@ /* Miscellaneous routines */ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisCloseConfiguration( - IN NDIS_HANDLE ConfigurationHandle); - + _In_ __drv_freesMem(mem) NDIS_HANDLE ConfigurationHandle); + +_IRQL_requires_(PASSIVE_LEVEL) +_Success_(*Status >= 0) NDISAPI VOID NTAPI NdisReadConfiguration( - OUT PNDIS_STATUS Status, - OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue, - IN NDIS_HANDLE ConfigurationHandle, - IN PNDIS_STRING Keyword, - IN NDIS_PARAMETER_TYPE ParameterType); - + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_CONFIGURATION_PARAMETER *ParameterValue, + _In_ NDIS_HANDLE ConfigurationHandle, + _In_ PNDIS_STRING Keyword, + _In_ NDIS_PARAMETER_TYPE ParameterType); + +_IRQL_requires_(PASSIVE_LEVEL) +_Success_(*Status >= 0) NDISAPI VOID NTAPI NdisWriteConfiguration( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE WrapperConfigurationContext, - IN PNDIS_STRING Keyword, - IN PNDIS_CONFIGURATION_PARAMETER ParameterValue); - + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE WrapperConfigurationContext, + _In_ PNDIS_STRING Keyword, + _In_ PNDIS_CONFIGURATION_PARAMETER ParameterValue); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID __cdecl NdisWriteErrorLogEntry( - IN NDIS_HANDLE NdisAdapterHandle, - IN NDIS_ERROR_CODE ErrorCode, - IN ULONG NumberOfErrorValues, - IN ...); - + _In_ NDIS_HANDLE NdisAdapterHandle, + _In_ NDIS_ERROR_CODE ErrorCode, + _In_ ULONG NumberOfErrorValues, + ...); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisInitializeString( - OUT PNDIS_STRING Destination, - IN PUCHAR Source); + _Out_ _At_(Destination->Buffer, __drv_allocatesMem(Mem)) PNDIS_STRING Destination, + _In_opt_z_ PUCHAR Source); /* * VOID @@ -4359,6 +4435,7 @@ #define NdisGetCurrentSystemTime KeQuerySystemTime #if NDIS_SUPPORT_60_COMPATIBLE_API +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI CCHAR NTAPI @@ -4392,15 +4469,16 @@ /* NDIS 4.0 extensions */ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMFreeSharedMemory( - IN NDIS_HANDLE MiniportAdapterHandle, - IN ULONG Length, - IN BOOLEAN Cached, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ ULONG Length, + _In_ BOOLEAN Cached, + _In_reads_bytes_(Length) PVOID VirtualAddress, + _In_ NDIS_PHYSICAL_ADDRESS PhysicalAddress); NDISAPI VOID @@ -4440,21 +4518,24 @@ /* NDIS 5.0 extensions */ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisAllocateMemoryWithTag( - OUT PVOID *VirtualAddress, - IN UINT Length, - IN ULONG Tag); - + _At_(*VirtualAddress, __drv_allocatesMem(Mem)) _Outptr_result_bytebuffer_(Length) + PVOID *VirtualAddress, + _In_ UINT Length, + _In_ ULONG Tag); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisGetCurrentProcessorCounts( - OUT PULONG pIdleCount, - OUT PULONG pKernelAndUser, - OUT PULONG pIndex); + _Out_ PULONG pIdleCount, + _Out_ PULONG pKernelAndUser, + _Out_ PULONG pIndex); #if NDIS_LEGACY_DRIVER NDISAPI @@ -4466,26 +4547,34 @@ #if NDIS_SUPPORT_60_COMPATIBLE_API +_IRQL_requires_max_(DISPATCH_LEVEL) +_IRQL_raises_(DISPATCH_LEVEL) +_When_(fWrite, _Acquires_exclusive_lock_(*Lock)) +_When_(!fWrite, _Acquires_shared_lock_(*Lock)) NDISAPI VOID NTAPI NdisAcquireReadWriteLock( - IN OUT PNDIS_RW_LOCK Lock, - IN BOOLEAN fWrite, - OUT PLOCK_STATE LockState); - + _Inout_ PNDIS_RW_LOCK Lock, + _In_ BOOLEAN fWrite, + _Out_ _IRQL_saves_ PLOCK_STATE LockState); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisInitializeReadWriteLock( - OUT PNDIS_RW_LOCK Lock); - + _Out_ PNDIS_RW_LOCK Lock); + +_IRQL_requires_(DISPATCH_LEVEL) +_Requires_lock_held_(*Lock) +_Releases_lock_(*Lock) NDISAPI VOID NTAPI NdisReleaseReadWriteLock( - IN OUT PNDIS_RW_LOCK Lock, - IN PLOCK_STATE LockState); + _Inout_ PNDIS_RW_LOCK Lock, + _In_ _IRQL_restores_ PLOCK_STATE LockState); #if NDIS_SUPPORT_NDIS6 @@ -4508,369 +4597,428 @@ #endif /* NDIS_SUPPORT_60_COMPATIBLE_API */ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMDeregisterDevice( - IN NDIS_HANDLE NdisDeviceHandle); - + _In_ NDIS_HANDLE NdisDeviceHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMGetDeviceProperty( - IN NDIS_HANDLE MiniportAdapterHandle, - IN OUT PDEVICE_OBJECT *PhysicalDeviceObject OPTIONAL, - IN OUT PDEVICE_OBJECT *FunctionalDeviceObject OPTIONAL, - IN OUT PDEVICE_OBJECT *NextDeviceObject OPTIONAL, - IN OUT PCM_RESOURCE_LIST *AllocatedResources OPTIONAL, - IN OUT PCM_RESOURCE_LIST *AllocatedResourcesTranslated OPTIONAL); - + _In_ NDIS_HANDLE MiniportAdapterHandle, + _Inout_opt_ PDEVICE_OBJECT *PhysicalDeviceObject, + _Inout_opt_ PDEVICE_OBJECT *FunctionalDeviceObject, + _Inout_opt_ PDEVICE_OBJECT *NextDeviceObject, + _Inout_opt_ PCM_RESOURCE_LIST *AllocatedResources, + _Inout_opt_ PCM_RESOURCE_LIST *AllocatedResourcesTranslated); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMInitializeScatterGatherDma( - IN NDIS_HANDLE MiniportAdapterHandle, - IN BOOLEAN Dma64BitAddresses, - IN ULONG MaximumPhysicalMapping); - + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ BOOLEAN Dma64BitAddresses, + _In_ ULONG MaximumPhysicalMapping); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMPromoteMiniport( - IN NDIS_HANDLE MiniportAdapterHandle); - + _In_ NDIS_HANDLE MiniportAdapterHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMQueryAdapterInstanceName( - OUT PNDIS_STRING AdapterInstanceName, - IN NDIS_HANDLE MiniportAdapterHandle); - + _Out_ PNDIS_STRING AdapterInstanceName, + _In_ NDIS_HANDLE MiniportAdapterHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMRegisterDevice( - IN NDIS_HANDLE NdisWrapperHandle, - IN PNDIS_STRING DeviceName, - IN PNDIS_STRING SymbolicName, - IN PDRIVER_DISPATCH MajorFunctions[], - OUT PDEVICE_OBJECT *pDeviceObject, - OUT NDIS_HANDLE *NdisDeviceHandle); - + _In_ NDIS_HANDLE NdisWrapperHandle, + _In_ PNDIS_STRING DeviceName, + _In_ PNDIS_STRING SymbolicName, + _In_reads_(IRP_MJ_PNP) PDRIVER_DISPATCH *MajorFunctions, + _Out_ PDEVICE_OBJECT *pDeviceObject, + _Out_ NDIS_HANDLE *NdisDeviceHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMRegisterUnloadHandler( - IN NDIS_HANDLE NdisWrapperHandle, - IN PDRIVER_UNLOAD UnloadHandler); - + _In_ NDIS_HANDLE NdisWrapperHandle, + _In_ PDRIVER_UNLOAD UnloadHandler); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMRemoveMiniport( - IN NDIS_HANDLE MiniportAdapterHandle); - + _In_ NDIS_HANDLE MiniportAdapterHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMSetMiniportSecondary( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE PrimaryMiniportAdapterHandle); - + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ NDIS_HANDLE PrimaryMiniportAdapterHandle); + +_IRQL_requires_max_(APC_LEVEL) +_Success_(*Status >= 0) NDISAPI VOID NTAPI NdisOpenConfigurationKeyByIndex( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE ConfigurationHandle, - IN ULONG Index, - OUT PNDIS_STRING KeyName, - OUT PNDIS_HANDLE KeyHandle); - + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE ConfigurationHandle, + _In_ ULONG Index, + _Out_ PNDIS_STRING KeyName, + _Out_ PNDIS_HANDLE KeyHandle); + +_IRQL_requires_max_(APC_LEVEL) +_Success_(*Status >= 0) NDISAPI VOID NTAPI NdisOpenConfigurationKeyByName( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE ConfigurationHandle, - IN PNDIS_STRING SubKeyName, - OUT PNDIS_HANDLE SubKeyHandle); - + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE ConfigurationHandle, + _In_ PNDIS_STRING SubKeyName, + _Out_ PNDIS_HANDLE SubKeyHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisQueryAdapterInstanceName( - OUT PNDIS_STRING AdapterInstanceName, - IN NDIS_HANDLE NdisBindingHandle); - + _Out_ PNDIS_STRING AdapterInstanceName, + _In_ NDIS_HANDLE NdisBindingHandle); + +_Must_inspect_result_ NDISAPI NDIS_STATUS NTAPI NdisQueryBindInstanceName( - OUT PNDIS_STRING pAdapterInstanceName, - IN NDIS_HANDLE BindingContext); - + _Out_ PNDIS_STRING pAdapterInstanceName, + _In_ NDIS_HANDLE BindingContext); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisWriteEventLogEntry( - IN PVOID LogHandle, - IN NDIS_STATUS EventCode, - IN ULONG UniqueEventValue, - IN USHORT NumStrings, - IN PVOID StringsList OPTIONAL, - IN ULONG DataSize, - IN PVOID Data OPTIONAL); + _In_ _Points_to_data_ PVOID LogHandle, + _In_ NDIS_STATUS EventCode, + _In_ ULONG UniqueEventValue, + _In_ USHORT NumStrings, + _In_opt_ PVOID StringsList, + _In_ ULONG DataSize, + _In_reads_bytes_opt_(DataSize) PVOID Data); /* Connectionless services */ +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClAddParty( - IN NDIS_HANDLE NdisVcHandle, - IN NDIS_HANDLE ProtocolPartyContext, - IN OUT PCO_CALL_PARAMETERS CallParameters, - OUT PNDIS_HANDLE NdisPartyHandle); - + _In_ NDIS_HANDLE NdisVcHandle, + _In_ NDIS_HANDLE ProtocolPartyContext, + _In_ PCO_CALL_PARAMETERS CallParameters, + _Out_ PNDIS_HANDLE NdisPartyHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClCloseAddressFamily( - IN NDIS_HANDLE NdisAfHandle); - + _In_ NDIS_HANDLE NdisAfHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClCloseCall( - IN NDIS_HANDLE NdisVcHandle, - IN NDIS_HANDLE NdisPartyHandle OPTIONAL, - IN PVOID Buffer OPTIONAL, - IN UINT Size); - + _In_ NDIS_HANDLE NdisVcHandle, + _In_opt_ NDIS_HANDLE NdisPartyHandle, + _In_reads_bytes_opt_(Size) PVOID Buffer, + _In_ UINT Size); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClDeregisterSap( - IN NDIS_HANDLE NdisSapHandle); - + _In_ NDIS_HANDLE NdisSapHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClDropParty( - IN NDIS_HANDLE NdisPartyHandle, - IN PVOID Buffer OPTIONAL, - IN UINT Size); - + _In_ NDIS_HANDLE NdisPartyHandle, + _In_reads_bytes_opt_(Size) PVOID Buffer, + _In_opt_ UINT Size); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisClIncomingCallComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisVcHandle, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClMakeCall( - IN NDIS_HANDLE NdisVcHandle, - IN OUT PCO_CALL_PARAMETERS CallParameters, - IN NDIS_HANDLE ProtocolPartyContext OPTIONAL, - OUT PNDIS_HANDLE NdisPartyHandle OPTIONAL); - + _In_ NDIS_HANDLE NdisVcHandle, + _Inout_ PCO_CALL_PARAMETERS CallParameters, + _In_opt_ NDIS_HANDLE ProtocolPartyContext, + _Out_opt_ PNDIS_HANDLE NdisPartyHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClModifyCallQoS( - IN NDIS_HANDLE NdisVcHandle, - IN PCO_CALL_PARAMETERS CallParameters); - - + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_Must_inspect_result_ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClOpenAddressFamily( - IN NDIS_HANDLE NdisBindingHandle, - IN PCO_ADDRESS_FAMILY AddressFamily, - IN NDIS_HANDLE ProtocolAfContext, - IN PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics, - IN UINT SizeOfClCharacteristics, - OUT PNDIS_HANDLE NdisAfHandle); - + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ PCO_ADDRESS_FAMILY AddressFamily, + _In_ NDIS_HANDLE ProtocolAfContext, + _In_ PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics, + _In_ UINT SizeOfClCharacteristics, + _Out_ PNDIS_HANDLE NdisAfHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisClRegisterSap( - IN NDIS_HANDLE NdisAfHandle, - IN NDIS_HANDLE ProtocolSapContext, - IN PCO_SAP Sap, - OUT PNDIS_HANDLE NdisSapHandle); + _In_ NDIS_HANDLE NdisAfHandle, + _In_ NDIS_HANDLE ProtocolSapContext, + _In_ PCO_SAP Sap, + _Out_ PNDIS_HANDLE NdisSapHandle); /* Call Manager services */ +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisCmActivateVc( - IN NDIS_HANDLE NdisVcHandle, - IN OUT PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_HANDLE NdisVcHandle, + _Inout_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmAddPartyComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisPartyHandle, - IN NDIS_HANDLE CallMgrPartyContext OPTIONAL, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisPartyHandle, + _In_opt_ NDIS_HANDLE CallMgrPartyContext, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmCloseAddressFamilyComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisAfHandle); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisAfHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmCloseCallComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisVcHandle, - IN NDIS_HANDLE NdisPartyHandle OPTIONAL); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisVcHandle, + _In_opt_ NDIS_HANDLE NdisPartyHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisCmDeactivateVc( - IN NDIS_HANDLE NdisVcHandle); - + _In_ NDIS_HANDLE NdisVcHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmDeregisterSapComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisSapHandle); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisSapHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmDispatchCallConnected( - IN NDIS_HANDLE NdisVcHandle); - + _In_ NDIS_HANDLE NdisVcHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisCmDispatchIncomingCall( - IN NDIS_HANDLE NdisSapHandle, - IN NDIS_HANDLE NdisVcHandle, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_HANDLE NdisSapHandle, + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmDispatchIncomingCallQoSChange( - IN NDIS_HANDLE NdisVcHandle, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmDispatchIncomingCloseCall( - IN NDIS_STATUS CloseStatus, - IN NDIS_HANDLE NdisVcHandle, - IN PVOID Buffer OPTIONAL, - IN UINT Size); - + _In_ NDIS_STATUS CloseStatus, + _In_ NDIS_HANDLE NdisVcHandle, + _In_reads_bytes_opt_(Size) PVOID Buffer, + _In_ UINT Size); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmDispatchIncomingDropParty( - IN NDIS_STATUS DropStatus, - IN NDIS_HANDLE NdisPartyHandle, - IN PVOID Buffer OPTIONAL, - IN UINT Size); - + _In_ NDIS_STATUS DropStatus, + _In_ NDIS_HANDLE NdisPartyHandle, + _In_reads_bytes_opt_(Size) PVOID Buffer, + _In_ UINT Size); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmDropPartyComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisPartyHandle); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisPartyHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmMakeCallComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisVcHandle, - IN NDIS_HANDLE NdisPartyHandle OPTIONAL, - IN NDIS_HANDLE CallMgrPartyContext OPTIONAL, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisVcHandle, + _In_opt_ NDIS_HANDLE NdisPartyHandle, + _In_opt_ NDIS_HANDLE CallMgrPartyContext, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmModifyCallQoSComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisVcHandle, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmOpenAddressFamilyComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisAfHandle, - IN NDIS_HANDLE CallMgrAfContext); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisAfHandle, + _In_ NDIS_HANDLE CallMgrAfContext); + +_Must_inspect_result_ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisCmRegisterAddressFamily( - IN NDIS_HANDLE NdisBindingHandle, - IN PCO_ADDRESS_FAMILY AddressFamily, - IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics, - IN UINT SizeOfCmCharacteristics); - + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ PCO_ADDRESS_FAMILY AddressFamily, + _In_ PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics, + _In_ UINT SizeOfCmCharacteristics); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCmRegisterSapComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisSapHandle, - IN NDIS_HANDLE CallMgrSapContext); - - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisSapHandle, + _In_ NDIS_HANDLE CallMgrSapContext); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMCmActivateVc( - IN NDIS_HANDLE NdisVcHandle, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMCmCreateVc( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisAfHandle, - IN NDIS_HANDLE MiniportVcContext, - OUT PNDIS_HANDLE NdisVcHandle); - + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ NDIS_HANDLE NdisAfHandle, + _In_ NDIS_HANDLE MiniportVcContext, + _Out_ PNDIS_HANDLE NdisVcHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMCmDeactivateVc( - IN NDIS_HANDLE NdisVcHandle); - + _In_ NDIS_HANDLE NdisVcHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMCmDeleteVc( - IN NDIS_HANDLE NdisVcHandle); + _In_ NDIS_HANDLE NdisVcHandle); NDISAPI NDIS_STATUS @@ -4881,132 +5029,150 @@ IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics, IN UINT SizeOfCmCharacteristics); +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMCmRequest( - IN NDIS_HANDLE NdisAfHandle, - IN NDIS_HANDLE NdisVcHandle OPTIONAL, - IN NDIS_HANDLE NdisPartyHandle OPTIONAL, - IN OUT PNDIS_REQUEST NdisRequest); + _In_ NDIS_HANDLE NdisAfHandle, + _In_opt_ NDIS_HANDLE NdisVcHandle, + _In_opt_ NDIS_HANDLE NdisPartyHandle, + _Inout_ PNDIS_REQUEST NdisRequest); /* Connection-oriented services */ +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisCoCreateVc( - IN NDIS_HANDLE NdisBindingHandle, - IN NDIS_HANDLE NdisAfHandle OPTIONAL, - IN NDIS_HANDLE ProtocolVcContext, - IN OUT PNDIS_HANDLE NdisVcHandle); - + _In_ NDIS_HANDLE NdisBindingHandle, + _In_opt_ NDIS_HANDLE NdisAfHandle , + _In_ NDIS_HANDLE ProtocolVcContext, + _Inout_ PNDIS_HANDLE NdisVcHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisCoDeleteVc( - IN NDIS_HANDLE NdisVcHandle); - + _In_ NDIS_HANDLE NdisVcHandle); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisCoRequest( - IN NDIS_HANDLE NdisBindingHandle, - IN NDIS_HANDLE NdisAfHandle OPTIONAL, - IN NDIS_HANDLE NdisVcHandle OPTIONAL, - IN NDIS_HANDLE NdisPartyHandle OPTIONAL, - IN OUT PNDIS_REQUEST NdisRequest); - + _In_ NDIS_HANDLE NdisBindingHandle, + _In_opt_ NDIS_HANDLE NdisAfHandle, + _In_opt_ NDIS_HANDLE NdisVcHandle, + _In_opt_ NDIS_HANDLE NdisPartyHandle, + _Inout_ PNDIS_REQUEST NdisRequest); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCoRequestComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisAfHandle, - IN NDIS_HANDLE NdisVcHandle OPTIONAL, - IN NDIS_HANDLE NdisPartyHandle OPTIONAL, - IN PNDIS_REQUEST NdisRequest); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisAfHandle, + _In_opt_ NDIS_HANDLE NdisVcHandle, + _In_opt_ NDIS_HANDLE NdisPartyHandle, + _In_ PNDIS_REQUEST NdisRequest); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCoSendPackets( - IN NDIS_HANDLE NdisVcHandle, - IN PPNDIS_PACKET PacketArray, - IN UINT NumberOfPackets); - + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PPNDIS_PACKET PacketArray, + _In_ UINT NumberOfPackets); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCoActivateVcComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisVcHandle, - IN PCO_CALL_PARAMETERS CallParameters); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PCO_CALL_PARAMETERS CallParameters); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCoDeactivateVcComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisVcHandle); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisVcHandle); + +_IRQL_requires_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCoIndicateReceivePacket( - IN NDIS_HANDLE NdisVcHandle, - IN PPNDIS_PACKET PacketArray, - IN UINT NumberOfPackets); - + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PPNDIS_PACKET PacketArray, + _In_ UINT NumberOfPackets); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCoIndicateStatus( - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_HANDLE NdisVcHandle OPTIONAL, - IN NDIS_STATUS GeneralStatus, - IN PVOID StatusBuffer OPTIONAL, - IN ULONG StatusBufferSize); - + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_opt_ NDIS_HANDLE NdisVcHandle, + _In_ NDIS_STATUS GeneralStatus, + _In_reads_bytes_opt_(StatusBufferSize) PVOID StatusBuffer, + _In_ ULONG StatusBufferSize); + +_IRQL_requires_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCoReceiveComplete( - IN NDIS_HANDLE MiniportAdapterHandle); - + _In_ NDIS_HANDLE MiniportAdapterHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCoRequestComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE MiniportAdapterHandle, - IN PNDIS_REQUEST Request); - + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ PNDIS_REQUEST Request); + +_IRQL_requires_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCoSendComplete( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisVcHandle, - IN PNDIS_PACKET Packet); + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisVcHandle, + _In_ PNDIS_PACKET Packet); /* NDIS 5.0 extensions for intermediate drivers */ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisIMAssociateMiniport( - IN NDIS_HANDLE DriverHandle, - IN NDIS_HANDLE ProtocolHandle); - + _In_ NDIS_HANDLE DriverHandle, + _In_ NDIS_HANDLE ProtocolHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisIMCancelInitializeDeviceInstance( - IN NDIS_HANDLE DriverHandle, - IN PNDIS_STRING DeviceInstance); + _In_ NDIS_HANDLE DriverHandle, + _In_ PNDIS_STRING DeviceInstance); NDISAPI VOID @@ -5022,31 +5188,35 @@ IN PNDIS_PACKET DstPacket, IN PNDIS_PACKET SrcPacket); +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisIMDeregisterLayeredMiniport( - IN NDIS_HANDLE DriverHandle); - + _In_ NDIS_HANDLE DriverHandle); + +_IRQL_requires_max_(APC_LEVEL) NDISAPI NDIS_HANDLE NTAPI NdisIMGetBindingContext( - IN NDIS_HANDLE NdisBindingHandle); - + _In_ NDIS_HANDLE NdisBindingHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_HANDLE NTAPI NdisIMGetDeviceContext( - IN NDIS_HANDLE MiniportAdapterHandle); - + _In_ NDIS_HANDLE MiniportAdapterHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisIMInitializeDeviceInstanceEx( - IN NDIS_HANDLE DriverHandle, - IN PNDIS_STRING DriverInstance, - IN NDIS_HANDLE DeviceContext OPTIONAL); + _In_ NDIS_HANDLE DriverHandle, + _In_ PNDIS_STRING DriverInstance, + _In_opt_ NDIS_HANDLE DeviceContext); /* NDISAPI @@ -5119,15 +5289,18 @@ IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +_Must_inspect_result_ +_IRQL_requires_(PASSIVE_LEVEL) +__drv_preferredFunction("NdisMInitializeScatterGatherDma", "See details in NdisMAllocateMapRegisters documentation") NDISAPI NDIS_STATUS NTAPI NdisMAllocateMapRegisters( - IN NDIS_HANDLE MiniportAdapterHandle, - IN UINT DmaChannel, - IN NDIS_DMA_SIZE DmaSize, - IN ULONG PhysicalMapRegistersNeeded, - IN ULONG MaximumPhysicalMapping); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ UINT DmaChannel, + _In_ NDIS_DMA_SIZE DmaSize, + _In_ ULONG PhysicalMapRegistersNeeded, + _In_ ULONG MaximumPhysicalMapping); /* * VOID @@ -5165,41 +5338,45 @@ ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->ArcDB); \ } +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMCloseLog( - IN NDIS_HANDLE LogHandle); - + _In_ NDIS_HANDLE LogHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMCreateLog( - IN NDIS_HANDLE MiniportAdapterHandle, - IN UINT Size, - OUT PNDIS_HANDLE LogHandle); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ UINT Size, + _Out_ PNDIS_HANDLE LogHandle); NDISAPI VOID NTAPI NdisMDeregisterAdapterShutdownHandler( - IN NDIS_HANDLE MiniportHandle); + _In_ NDIS_HANDLE MiniportHandle); #if NDIS_LEGACY_MINIPORT +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMDeregisterInterrupt( - IN PNDIS_MINIPORT_INTERRUPT Interrupt); - + _In_ PNDIS_MINIPORT_INTERRUPT Interrupt); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMRegisterAdapterShutdownHandler( - IN NDIS_HANDLE MiniportHandle, - IN PVOID ShutdownContext, - IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler); + _In_ NDIS_HANDLE MiniportHandle, + _In_ PVOID ShutdownContext, + _In_ ADAPTER_SHUTDOWN_HANDLER ShutdownHandler); NDISAPI NDIS_STATUS @@ -5230,14 +5407,15 @@ IN PVOID SynchronizeContext); #endif /* NDIS_LEGACY_MINIPORT */ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMDeregisterIoPortRange( - IN NDIS_HANDLE MiniportAdapterHandle, - IN UINT InitialPort, - IN UINT NumberOfPorts, - IN PVOID PortOffset); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ UINT InitialPort, + _In_ UINT NumberOfPorts, + _In_ PVOID PortOffset); /* * VOID @@ -5326,17 +5504,19 @@ ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FddiDB); \ } +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMFlushLog( - IN NDIS_HANDLE LogHandle); - + _In_ NDIS_HANDLE LogHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMFreeMapRegisters( - IN NDIS_HANDLE MiniportAdapterHandle); + _In_ NDIS_HANDLE MiniportAdapterHandle); /* * VOID @@ -5391,14 +5571,16 @@ (SystemSpecific2), \ (SystemSpecific3)) +_Must_inspect_result_ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMMapIoSpace( - OUT PVOID *VirtualAddress, - IN NDIS_HANDLE MiniportAdapterHandle, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - IN UINT Length); + _Outptr_result_bytebuffer_(Length) PVOID *VirtualAddress, + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ NDIS_PHYSICAL_ADDRESS PhysicalAddress, + _In_ UINT Length); /* * VOID @@ -5409,14 +5591,16 @@ #define NdisMQueryInformationComplete(MiniportAdapterHandle, Status) \ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->QueryCompleteHandler)(MiniportAdapterHandle, Status) +_Must_inspect_result_ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMRegisterIoPortRange( - OUT PVOID *PortOffset, - IN NDIS_HANDLE MiniportAdapterHandle, - IN UINT InitialPort, - IN UINT NumberOfPorts); + _Out_ PVOID *PortOffset, + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ UINT InitialPort, + _In_ UINT NumberOfPorts); NDISAPI VOID @@ -5425,28 +5609,31 @@ IN PNDIS_MINIPORT_TIMER Timer, IN UINT MillisecondsToDelay); +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMInitializeTimer( - IN OUT PNDIS_MINIPORT_TIMER Timer, - IN NDIS_HANDLE MiniportAdapterHandle, - IN PNDIS_TIMER_FUNCTION TimerFunction, - IN PVOID FunctionContext); - + _Inout_ PNDIS_MINIPORT_TIMER Timer, + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_ PNDIS_TIMER_FUNCTION TimerFunction, + _In_ PVOID FunctionContext); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMSetPeriodicTimer( - IN PNDIS_MINIPORT_TIMER Timer, - IN UINT MillisecondPeriod); - + _In_ PNDIS_MINIPORT_TIMER Timer, + _In_ UINT MillisecondPeriod); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisMCancelTimer( - IN PNDIS_MINIPORT_TIMER Timer, - OUT PBOOLEAN TimerCancelled); + _In_ PNDIS_MINIPORT_TIMER Timer, + _Out_ _At_(*TimerCancelled, _Must_inspect_result_) PBOOLEAN TimerCancelled); #if !defined(NDIS_WRAPPER) @@ -5457,7 +5644,7 @@ * IN NDIS_STATUS Status, * IN BOOLEAN AddressingReset); */ -#define NdisMResetComplete(MiniportAdapterHandle, \ +#define NdisMResetComplete(MiniportAdapterHandle, \ Status, \ AddressingReset) \ { \ @@ -5550,11 +5737,12 @@ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SetCompleteHandler)( \ MiniportAdapterHandle, Status) +_IRQL_requires_max_(APC_LEVEL) NDISAPI VOID NTAPI NdisMSleep( - IN ULONG MicrosecondsToSleep); + _In_ ULONG MicrosecondsToSleep); /* * VOID @@ -5597,64 +5785,73 @@ ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->TrDB); \ } +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisMWriteLogData( - IN NDIS_HANDLE LogHandle, - IN PVOID LogBuffer, - IN UINT LogBufferSize); - + _In_ NDIS_HANDLE LogHandle, + _In_reads_bytes_(LogBufferSize) PVOID LogBuffer, + _In_ UINT LogBufferSize); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMQueryAdapterResources( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE WrapperConfigurationContext, - OUT PNDIS_RESOURCE_LIST ResourceList, - IN OUT PUINT BufferSize); - + _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE WrapperConfigurationContext, + _Out_ PNDIS_RESOURCE_LIST ResourceList, + _Inout_ PUINT BufferSize); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisTerminateWrapper( - IN NDIS_HANDLE NdisWrapperHandle, - IN PVOID SystemSpecific); - + _In_ NDIS_HANDLE NdisWrapperHandle, + _In_opt_ PVOID SystemSpecific); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisMUnmapIoSpace( - IN NDIS_HANDLE MiniportAdapterHandle, - IN PVOID VirtualAddress, - IN UINT Length); + _In_ NDIS_HANDLE MiniportAdapterHandle, + _In_reads_bytes_(Length) PVOID VirtualAddress, + _In_ UINT Length); /* Event functions */ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisInitializeEvent( - OUT PNDIS_EVENT Event); - + _Out_ PNDIS_EVENT Event); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisSetEvent( - IN PNDIS_EVENT Event); - + _In_ PNDIS_EVENT Event); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisResetEvent( - IN PNDIS_EVENT Event); - + _In_ PNDIS_EVENT Event); + +_When_(MsToWait != 0, _Check_return_) +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI BOOLEAN NTAPI NdisWaitEvent( - IN PNDIS_EVENT Event, - IN UINT Timeout); + _In_ PNDIS_EVENT Event, + _In_ UINT Timeout); /* NDIS intermediate miniport structures */ @@ -5664,11 +5861,12 @@ /* Routines for intermediate miniport drivers */ +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisIMDeInitializeDeviceInstance( - IN NDIS_HANDLE NdisMiniportHandle); + _In_ NDIS_HANDLE NdisMiniportHandle); /* * NDIS_STATUS @@ -5717,10 +5915,10 @@ NDIS_STATUS NTAPI NdisIMRegisterLayeredMiniport( - IN NDIS_HANDLE NdisWrapperHandle, - IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, - IN UINT CharacteristicsLength, - OUT PNDIS_HANDLE DriverHandle); + _In_ NDIS_HANDLE NdisWrapperHandle, + _In_ PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, + _In_ UINT CharacteristicsLength, + _Out_ PNDIS_HANDLE DriverHandle); NDISAPI VOID @@ -5750,101 +5948,111 @@ IN PPNDIS_PACKET PacketArray, IN UINT NumberOfPackets); +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisRequest( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE NdisBindingHandle, - IN PNDIS_REQUEST NdisRequest); - + _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ PNDIS_REQUEST NdisRequest); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisReset( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE NdisBindingHandle); - + _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE NdisBindingHandle); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisDeregisterProtocol( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE NdisProtocolHandle); - + _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE NdisProtocolHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisOpenAdapter( - OUT PNDIS_STATUS Status, - OUT PNDIS_STATUS OpenErrorStatus, - OUT PNDIS_HANDLE NdisBindingHandle, - OUT PUINT SelectedMediumIndex, - IN PNDIS_MEDIUM MediumArray, - IN UINT MediumArraySize, - IN NDIS_HANDLE NdisProtocolHandle, - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_STRING AdapterName, - IN UINT OpenOptions, - IN PSTRING AddressingInformation OPTIONAL); - + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_STATUS OpenErrorStatus, + _Out_ PNDIS_HANDLE NdisBindingHandle, + _Out_ PUINT SelectedMediumIndex, + _In_reads_(MediumArraySize) PNDIS_MEDIUM MediumArray, + _In_ UINT MediumArraySize, + _In_ NDIS_HANDLE NdisProtocolHandle, + _In_ NDIS_HANDLE ProtocolBindingContext, + _In_ PNDIS_STRING AdapterName, + _In_ UINT OpenOptions, + _In_opt_ PSTRING AddressingInformation); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisCloseAdapter( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE NdisBindingHandle); - + _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE NdisBindingHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisCompleteBindAdapter( - IN NDIS_HANDLE BindAdapterContext, - IN NDIS_STATUS Status, - IN NDIS_STATUS OpenStatus); - + _In_ NDIS_HANDLE BindAdapterContext, + _In_ NDIS_STATUS Status, + _In_ NDIS_STATUS OpenStatus); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisCompleteUnbindAdapter( - IN NDIS_HANDLE UnbindAdapterContext, - IN NDIS_STATUS Status); + _In_ NDIS_HANDLE UnbindAdapterContext, + _In_ NDIS_STATUS Status); NDISAPI VOID NTAPI NdisSetProtocolFilter( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE NdisBindingHandle, - IN RECEIVE_HANDLER ReceiveHandler, - IN RECEIVE_PACKET_HANDLER ReceivePacketHandler, - IN NDIS_MEDIUM Medium, - IN UINT Offset, - IN UINT Size, - IN PUCHAR Pattern); - + _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status, + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ RECEIVE_HANDLER ReceiveHandler, + _In_ RECEIVE_PACKET_HANDLER ReceivePacketHandler, + _In_ NDIS_MEDIUM Medium, + _In_ UINT Offset, + _In_ UINT Size, + _In_ PUCHAR Pattern); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisGetDriverHandle( - IN PNDIS_HANDLE NdisBindingHandle, - OUT PNDIS_HANDLE NdisDriverHandle); - + _In_ PNDIS_HANDLE NdisBindingHandle, + _Out_ PNDIS_HANDLE NdisDriverHandle); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisOpenProtocolConfiguration( - OUT PNDIS_STATUS Status, - OUT PNDIS_HANDLE ConfigurationHandle, - IN PNDIS_STRING ProtocolSection); - + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_HANDLE ConfigurationHandle, + _In_ PNDIS_STRING ProtocolSection); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisCompletePnPEvent( - IN NDIS_STATUS Status, - IN NDIS_HANDLE NdisBindingHandle, - IN PNET_PNP_EVENT NetPnPEvent); + _In_ NDIS_STATUS Status, + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ PNET_PNP_EVENT NetPnPEvent); /* * VOID @@ -5856,62 +6064,71 @@ #define NdisQuerySendFlags(_Packet,_Flags) *(_Flags) = (_Packet)->Private.Flags +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisReturnPackets( - IN PNDIS_PACKET *PacketsToReturn, - IN UINT NumberOfPackets); - + _In_reads_(NumberOfPackets) PNDIS_PACKET *PacketsToReturn, + _In_ UINT NumberOfPackets); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI PNDIS_PACKET NTAPI NdisGetReceivedPacket( - IN PNDIS_HANDLE NdisBindingHandle, - IN PNDIS_HANDLE MacContext); - + _In_ PNDIS_HANDLE NdisBindingHandle, + _In_ PNDIS_HANDLE MacContext); + +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI VOID NTAPI NdisCancelSendPackets( - IN NDIS_HANDLE NdisBindingHandle, - IN PVOID CancelId); - + _In_ NDIS_HANDLE NdisBindingHandle, + _In_ _Points_to_data_ PVOID CancelId); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI NDIS_STATUS NTAPI NdisQueryPendingIOCount( - IN PVOID NdisBindingHandle, - OUT PULONG IoCount); - + _In_ _Points_to_data_ PVOID NdisBindingHandle, + _Out_ PULONG IoCount); + +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisRegisterProtocol( - OUT PNDIS_STATUS Status, - OUT PNDIS_HANDLE NdisProtocolHandle, - IN PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics, - IN UINT CharacteristicsLength); + _Out_ PNDIS_STATUS Status, + _Out_ PNDIS_HANDLE NdisProtocolHandle, + _In_ PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics, + _In_ UINT CharacteristicsLength); #endif /* NDIS_LEGACY_PROTOCOL */ +_IRQL_requires_max_(DISPATCH_LEVEL) NDISAPI UCHAR NTAPI NdisGeneratePartialCancelId(VOID); +_IRQL_requires_(PASSIVE_LEVEL) NDISAPI VOID NTAPI NdisReEnumerateProtocolBindings( - IN NDIS_HANDLE NdisProtocolHandle); + _In_ NDIS_HANDLE NdisProtocolHandle); NDISAPI VOID NTAPI NdisRegisterTdiCallBack( - IN TDI_REGISTER_CALLBACK RegisterCallback, - IN TDI_PNP_HANDLER PnPHandler); + _In_ TDI_REGISTER_CALLBACK RegisterCallback, + _In_ TDI_PNP_HANDLER PnPHandler); NDISAPI VOID
12 years, 11 months
1
0
0
0
[cgutman] 55094: [USB-BRINGUP-TRUNK] - Compute the frame interval correctly - Fixes a deadlock on real hardware after enabling interrupts
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jan 23 10:10:51 2012 New Revision: 55094 URL:
http://svn.reactos.org/svn/reactos?rev=55094&view=rev
Log: [USB-BRINGUP-TRUNK] - Compute the frame interval correctly - Fixes a deadlock on real hardware after enabling interrupts Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] Mon Jan 23 10:10:51 2012 @@ -551,6 +551,7 @@ // get frame interval // FrameInterval = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_FRAME_INTERVAL_OFFSET)); + FrameInterval = ((FrameInterval & OHCI_FRAME_INTERVAL_TOGGLE) ^ OHCI_FRAME_INTERVAL_TOGGLE); DPRINT1("FrameInterval %x IntervalValue %x\n", FrameInterval, m_IntervalValue); FrameInterval |= OHCI_FSMPS(m_IntervalValue) | m_IntervalValue; DPRINT1("FrameInterval %x\n", FrameInterval);
12 years, 11 months
1
0
0
0
[ion] 55093: [KERNEL32]: Fix a copy-pasta (and a regression). Thanks vicmarcal/testbot.
by ion@svn.reactos.org
Author: ion Date: Mon Jan 23 05:32:11 2012 New Revision: 55093 URL:
http://svn.reactos.org/svn/reactos?rev=55093&view=rev
Log: [KERNEL32]: Fix a copy-pasta (and a regression). Thanks vicmarcal/testbot. Modified: trunk/reactos/dll/win32/kernel32/client/proc.c Modified: trunk/reactos/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Mon Jan 23 05:32:11 2012 @@ -1558,7 +1558,7 @@ /* Copy the data out of there */ lpStartupInfo->cb = sizeof(STARTUPINFOW); - lpStartupInfo->lpReserved = Params->ShellInfo.Buffer; + lpStartupInfo->lpReserved = Params->ShellInfo.Buffer; lpStartupInfo->lpDesktop = Params->DesktopInfo.Buffer; lpStartupInfo->lpTitle = Params->WindowTitle.Buffer; lpStartupInfo->dwX = Params->StartingX; @@ -1659,7 +1659,7 @@ if (NT_SUCCESS(Status)) { /* Save it */ - StartupInfo->lpReserved = TitleString.Buffer; + StartupInfo->lpTitle = TitleString.Buffer; /* We finished with the ANSI version, try to cache it */ if (!InterlockedCompareExchangePointer(&BaseAnsiStartupInfo,
12 years, 11 months
1
0
0
0
[ion] 55092: [KERNEL32]: Changes to proc.c: - ReadProcessMemory/WriteProcessMemory only write to *lpNumberOfBytesRead/Written if user-mode passed in the parameter, as its an optional argument in Wi...
by ion@svn.reactos.org
Author: ion Date: Mon Jan 23 04:57:12 2012 New Revision: 55092 URL:
http://svn.reactos.org/svn/reactos?rev=55092&view=rev
Log: [KERNEL32]: Changes to proc.c: - ReadProcessMemory/WriteProcessMemory only write to *lpNumberOfBytesRead/Written if user-mode passed in the parameter, as its an optional argument in Win32, but not in NT. Instead, use a local variable. This means that anyone calling ReadProcessMemory/WriteProcessMemory in ReactOS before with a NULL output argument (totally valid) was getting an error before! - WriteProcessMemory actually returns STATUS_ACCESS_VIOLATION in a few cases, even if it's defined as a BOOL function. Code on Google shows major applications depending on this, which we weren't doing. - Rewrite InitCommandLines to be much simpler. No normalization or copying or ANSi/OEM logic is needed. - GetProcessAffinityMask should use the BaseStaticServerData from CSRSS instead of querying system information each time. - GetProcessShutdownParameters and SetProcessShutdownParameters should use the LPC status code from CSRSS, not the LPC API status code. - GetProcessWorkingSetSize now calls GetProcessWorkingSetSizeEx. - Implement GetProcessWorkingSetSizeEx. - SetProcessWorkingSetSize now calls SetProcessWorkingSetSizeEx. - Implement SetProcessWorkingSetSizeEx. - Acquire the required privilege in SetProcessWorkingSetSize(Ex). - Fail with correct status code in SetProcessWorkingSetSize(Ex). - GetExitCodeProcess should check if this is a VDM process and get the exit code that way. - GetStartupInfoW should not fail if the input is NULL. It should crash. - GetStartupInfoW was not filling out the lpReserved field, which should contain the ShellInfo buffer. - GetStartupInfoW was always setting standard handles -- it should not do so if those are console handles. - GetStartupInfoA was not thread-safe. - GetStartupInfoA was assuming all Unicode->ANSI conversions will be successful. - GetStartupInfoA was not filling out lpReserved either. - ExitProcess was not using SEH and was not using the PEB lock. - TerminateProcess was not setting ERROR_INVALID_HANDLE last error code. - FatalAppExitA was not using static TEB buffer, and was always assuming success. - FatalAppExitW was doing some sort of bizarre hack. It now raises as a hard error as it should. - FatalExit now displays a debugger input interface on checked builds, just like Windows. - SetPriorityClass now tries to acquire the real time privilege when needed, and handles failure to do so. - GetProcessVersion rewritten to be cleaner and simpler. - Annotate and reformat functions where needed. - Rename lpfnGlobalRegisterWaitForInputIdle to UserWaitForInputIdleRoutine - GetProcessPriorityBoost is now BOOL-safe. - IsWow64Process now sets NT error code using only one API. - CommandLineStringA/W -> BaseAnsiCommandLine/BaseUnicodeCommandLine. Modified: trunk/reactos/dll/win32/kernel32/client/loader.c trunk/reactos/dll/win32/kernel32/client/proc.c trunk/reactos/dll/win32/kernel32/include/kernel32.h trunk/reactos/include/ndk/extypes.h Modified: trunk/reactos/dll/win32/kernel32/client/loader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] Mon Jan 23 04:57:12 2012 @@ -1026,9 +1026,9 @@ } /* Wait up to 30 seconds for the process to become idle */ - if (lpfnGlobalRegisterWaitForInputIdle) - { - lpfnGlobalRegisterWaitForInputIdle(ProcessInformation.hProcess, 30000); + if (UserWaitForInputIdleRoutine) + { + UserWaitForInputIdleRoutine(ProcessInformation.hProcess, 30000); } /* Close handles */ Modified: trunk/reactos/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Mon Jan 23 04:57:12 2012 @@ -16,39 +16,20 @@ #define NDEBUG #include <debug.h> -typedef INT (WINAPI *MessageBoxW_Proc) (HWND, LPCWSTR, LPCWSTR, UINT); - /* GLOBALS *******************************************************************/ -static UNICODE_STRING CommandLineStringW; -static ANSI_STRING CommandLineStringA; +WaitForInputIdleType UserWaitForInputIdleRoutine; +UNICODE_STRING BaseUnicodeCommandLine; +ANSI_STRING BaseAnsiCommandLine; UNICODE_STRING BasePathVariableName = RTL_CONSTANT_STRING(L"PATH"); - -static BOOL bCommandLineInitialized = FALSE; - -WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle; - -LPSTARTUPINFOA lpLocalStartupInfo = NULL; - -VOID WINAPI -RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle); - +LPSTARTUPINFOA BaseAnsiStartupInfo = NULL; PLDR_DATA_TABLE_ENTRY BasepExeLdrEntry; - -#define CMD_STRING L"cmd /c " - -extern __declspec(noreturn) -VOID -CALLBACK -ConsoleControlDispatcher(DWORD CodeAndFlag); - BOOLEAN g_AppCertInitialized; BOOLEAN g_HaveAppCerts; LIST_ENTRY BasepAppCertDllsList; RTL_CRITICAL_SECTION gcsAppCert; PBASEP_APPCERT_EMBEDDED_FUNC fEmbeddedCertFunc; NTSTATUS g_AppCertStatus; - RTL_QUERY_REGISTRY_TABLE BasepAppCertTable[2] = { { @@ -64,6 +45,11 @@ PSAFER_REPLACE_PROCESS_THREAD_TOKENS g_SaferReplaceProcessThreadTokens; HMODULE gSaferHandle = (HMODULE)-1; + +VOID WINAPI +RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle); + +#define CMD_STRING L"cmd /c " /* FUNCTIONS ****************************************************************/ @@ -1128,68 +1114,33 @@ WINAPI InitCommandLines(VOID) { - PRTL_USER_PROCESS_PARAMETERS Params; - - /* get command line */ - Params = NtCurrentPeb()->ProcessParameters; - RtlNormalizeProcessParams (Params); - - /* initialize command line buffers */ - CommandLineStringW.Length = Params->CommandLine.Length; - CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR); - CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(), - HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, - CommandLineStringW.MaximumLength); - if (CommandLineStringW.Buffer == NULL) - { - return; - } - - RtlInitAnsiString(&CommandLineStringA, NULL); - - /* Copy command line */ - RtlCopyUnicodeString(&CommandLineStringW, - &(Params->CommandLine)); - CommandLineStringW.Buffer[CommandLineStringW.Length / sizeof(WCHAR)] = 0; - - /* convert unicode string to ansi (or oem) */ - if (bIsFileApiAnsi) - RtlUnicodeStringToAnsiString(&CommandLineStringA, - &CommandLineStringW, - TRUE); - else - RtlUnicodeStringToOemString(&CommandLineStringA, - &CommandLineStringW, - TRUE); - - CommandLineStringA.Buffer[CommandLineStringA.Length] = 0; - - bCommandLineInitialized = TRUE; -} + NTSTATUS Status; + + /* Read the UNICODE_STRING from the PEB */ + BaseUnicodeCommandLine = NtCurrentPeb()->ProcessParameters->CommandLine; + + /* Convert to ANSI_STRING for the *A callers */ + Status = RtlUnicodeStringToAnsiString(&BaseAnsiCommandLine, + &BaseUnicodeCommandLine, + TRUE); + if (!NT_SUCCESS(Status)) RtlInitEmptyAnsiString(&BaseAnsiCommandLine, 0, 0); +} + +/* PUBLIC FUNCTIONS ***********************************************************/ /* * @implemented */ BOOL WINAPI -GetProcessAffinityMask(HANDLE hProcess, - PDWORD_PTR lpProcessAffinityMask, - PDWORD_PTR lpSystemAffinityMask) +GetProcessAffinityMask(IN HANDLE hProcess, + OUT PDWORD_PTR lpProcessAffinityMask, + OUT PDWORD_PTR lpSystemAffinityMask) { PROCESS_BASIC_INFORMATION ProcessInfo; - SYSTEM_BASIC_INFORMATION SystemInfo; - NTSTATUS Status; - - Status = NtQuerySystemInformation(SystemBasicInformation, - &SystemInfo, - sizeof(SystemInfo), - NULL); - if (!NT_SUCCESS(Status)) - { - BaseSetLastNTError(Status); - return FALSE; - } - + NTSTATUS Status; + + /* Query information on the process from the kernel */ Status = NtQueryInformationProcess(hProcess, ProcessBasicInformation, (PVOID)&ProcessInfo, @@ -1197,174 +1148,237 @@ NULL); if (!NT_SUCCESS(Status)) { + /* Fail */ BaseSetLastNTError(Status); return FALSE; } + /* Copy the affinity mask, and get the system one from our shared data */ *lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask; - *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessorsAffinityMask; - + *lpSystemAffinityMask = (DWORD)BaseStaticServerData->SysInfo.ActiveProcessorsAffinityMask; return TRUE; } - /* * @implemented */ BOOL WINAPI -SetProcessAffinityMask(HANDLE hProcess, - DWORD_PTR dwProcessAffinityMask) -{ - NTSTATUS Status; - +SetProcessAffinityMask(IN HANDLE hProcess, + IN DWORD_PTR dwProcessAffinityMask) +{ + NTSTATUS Status; + + /* Directly set the affinity mask */ Status = NtSetInformationProcess(hProcess, ProcessAffinityMask, (PVOID)&dwProcessAffinityMask, sizeof(DWORD)); if (!NT_SUCCESS(Status)) { + /* Handle failure */ BaseSetLastNTError(Status); return FALSE; } + /* Everything was ok */ return TRUE; } - /* * @implemented */ BOOL WINAPI -GetProcessShutdownParameters(LPDWORD lpdwLevel, - LPDWORD lpdwFlags) +GetProcessShutdownParameters(OUT LPDWORD lpdwLevel, + OUT LPDWORD lpdwFlags) { CSR_API_MESSAGE CsrRequest; - ULONG Request; - NTSTATUS Status; - - Request = GET_SHUTDOWN_PARAMETERS; + NTSTATUS Status; + + /* Ask CSRSS for shutdown information */ Status = CsrClientCallServer(&CsrRequest, NULL, - MAKE_CSR_API(Request, CSR_NATIVE), + MAKE_CSR_API(GET_SHUTDOWN_PARAMETERS, CSR_NATIVE), + sizeof(CSR_API_MESSAGE)); + if (!(NT_SUCCESS(Status)) || !(NT_SUCCESS(CsrRequest.Status))) + { + /* Return the failure from CSRSS */ + BaseSetLastNTError(CsrRequest.Status); + return FALSE; + } + + /* Get the data out of the LCP reply */ + *lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level; + *lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags; + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetProcessShutdownParameters(IN DWORD dwLevel, + IN DWORD dwFlags) +{ + CSR_API_MESSAGE CsrRequest; + NTSTATUS Status; + + /* Write the data into the CSRSS request and send it */ + CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel; + CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags; + Status = CsrClientCallServer(&CsrRequest, + NULL, + MAKE_CSR_API(SET_SHUTDOWN_PARAMETERS, CSR_NATIVE), sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) { - BaseSetLastNTError(Status); + /* Return the failure from CSRSS */ + BaseSetLastNTError(CsrRequest.Status); return FALSE; } - *lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level; - *lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags; - + /* All went well */ return TRUE; } - /* * @implemented */ BOOL WINAPI -SetProcessShutdownParameters(DWORD dwLevel, - DWORD dwFlags) -{ - CSR_API_MESSAGE CsrRequest; - ULONG Request; - NTSTATUS Status; - - CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel; - CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags; - - Request = SET_SHUTDOWN_PARAMETERS; - Status = CsrClientCallServer(&CsrRequest, - NULL, - MAKE_CSR_API(Request, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) - { - BaseSetLastNTError(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessWorkingSetSize(HANDLE hProcess, - PSIZE_T lpMinimumWorkingSetSize, - PSIZE_T lpMaximumWorkingSetSize) -{ - QUOTA_LIMITS QuotaLimits; - NTSTATUS Status; - +GetProcessWorkingSetSizeEx(IN HANDLE hProcess, + OUT PSIZE_T lpMinimumWorkingSetSize, + OUT PSIZE_T lpMaximumWorkingSetSize, + OUT PDWORD Flags) +{ + QUOTA_LIMITS_EX QuotaLimits; + NTSTATUS Status; + + /* Query the kernel about this */ Status = NtQueryInformationProcess(hProcess, ProcessQuotaLimits, &QuotaLimits, - sizeof(QUOTA_LIMITS), + sizeof(QUOTA_LIMITS_EX), NULL); if (!NT_SUCCESS(Status)) { + /* Return error */ BaseSetLastNTError(Status); return FALSE; } + /* Copy the quota information out */ *lpMinimumWorkingSetSize = QuotaLimits.MinimumWorkingSetSize; *lpMaximumWorkingSetSize = QuotaLimits.MaximumWorkingSetSize; - + *Flags = QuotaLimits.Flags; return TRUE; } - /* * @implemented */ BOOL WINAPI -SetProcessWorkingSetSize(HANDLE hProcess, - SIZE_T dwMinimumWorkingSetSize, - SIZE_T dwMaximumWorkingSetSize) -{ - QUOTA_LIMITS QuotaLimits; - NTSTATUS Status; - - QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize; - QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize; - - Status = NtSetInformationProcess(hProcess, - ProcessQuotaLimits, - &QuotaLimits, - sizeof(QUOTA_LIMITS)); - if (!NT_SUCCESS(Status)) - { - BaseSetLastNTError(Status); - return FALSE; - } - - return TRUE; -} - +GetProcessWorkingSetSize(IN HANDLE hProcess, + OUT PSIZE_T lpMinimumWorkingSetSize, + OUT PSIZE_T lpMaximumWorkingSetSize) +{ + DWORD Dummy; + return GetProcessWorkingSetSizeEx(hProcess, + lpMinimumWorkingSetSize, + lpMaximumWorkingSetSize, + &Dummy); +} /* * @implemented */ BOOL WINAPI -GetProcessTimes(HANDLE hProcess, - LPFILETIME lpCreationTime, - LPFILETIME lpExitTime, - LPFILETIME lpKernelTime, - LPFILETIME lpUserTime) +SetProcessWorkingSetSizeEx(IN HANDLE hProcess, + IN SIZE_T dwMinimumWorkingSetSize, + IN SIZE_T dwMaximumWorkingSetSize, + IN DWORD Flags) +{ + QUOTA_LIMITS_EX QuotaLimits; + NTSTATUS Status, ReturnStatus; + BOOL Result; + PVOID State; + ULONG Privilege = SE_INC_BASE_PRIORITY_PRIVILEGE; + + /* Zero out the input structure */ + RtlZeroMemory(&QuotaLimits, sizeof(QuotaLimits)); + + /* Check if the caller sent any limits */ + if ((dwMinimumWorkingSetSize) && (dwMaximumWorkingSetSize)) + { + /* Write the quota information */ + QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize; + QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize; + QuotaLimits.Flags = Flags; + + /* Acquire the required privilege */ + Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State); + + /* Request the new quotas */ + ReturnStatus = NtSetInformationProcess(hProcess, + ProcessQuotaLimits, + &QuotaLimits, + sizeof(QuotaLimits)); + Result = NT_SUCCESS(ReturnStatus); + if (NT_SUCCESS(Status)) + { + /* Release the privilege and set succes code */ + ASSERT(State != NULL); + RtlReleasePrivilege(State); + State = NULL; + } + } + else + { + /* No limits, fail the call */ + ReturnStatus = STATUS_INVALID_PARAMETER; + Result = FALSE; + } + + /* Return result code, set error code if this was a failure */ + if (!Result) BaseSetLastNTError(ReturnStatus); + return Result; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetProcessWorkingSetSize(IN HANDLE hProcess, + IN SIZE_T dwMinimumWorkingSetSize, + IN SIZE_T dwMaximumWorkingSetSize) +{ + /* Call the newer API */ + return SetProcessWorkingSetSizeEx(hProcess, + dwMinimumWorkingSetSize, + dwMaximumWorkingSetSize, + 0); +} + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessTimes(IN HANDLE hProcess, + IN LPFILETIME lpCreationTime, + IN LPFILETIME lpExitTime, + IN LPFILETIME lpKernelTime, + IN LPFILETIME lpUserTime) { KERNEL_USER_TIMES Kut; NTSTATUS Status; + /* Query the times */ Status = NtQueryInformationProcess(hProcess, ProcessTimes, &Kut, @@ -1372,26 +1386,23 @@ NULL); if (!NT_SUCCESS(Status)) { + /* Handle failure */ BaseSetLastNTError(Status); return FALSE; } + /* Copy all the times and return success */ lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart; lpCreationTime->dwHighDateTime = Kut.CreateTime.u.HighPart; - lpExitTime->dwLowDateTime = Kut.ExitTime.u.LowPart; lpExitTime->dwHighDateTime = Kut.ExitTime.u.HighPart; - lpKernelTime->dwLowDateTime = Kut.KernelTime.u.LowPart; lpKernelTime->dwHighDateTime = Kut.KernelTime.u.HighPart; - lpUserTime->dwLowDateTime = Kut.UserTime.u.LowPart; lpUserTime->dwHighDateTime = Kut.UserTime.u.HighPart; - return TRUE; } - /* * @implemented */ @@ -1402,7 +1413,6 @@ return (HANDLE)NtCurrentProcess(); } - /* * @implemented */ @@ -1413,7 +1423,6 @@ return (HANDLE)NtCurrentThread(); } - /* * @implemented */ @@ -1421,21 +1430,21 @@ WINAPI GetCurrentProcessId(VOID) { - return HandleToUlong(GetTeb()->ClientId.UniqueProcess); -} - + return HandleToUlong(NtCurrentTeb()->ClientId.UniqueProcess); +} /* * @implemented */ BOOL WINAPI -GetExitCodeProcess(HANDLE hProcess, - LPDWORD lpExitCode) +GetExitCodeProcess(IN HANDLE hProcess, + IN LPDWORD lpExitCode) { PROCESS_BASIC_INFORMATION ProcessBasic; NTSTATUS Status; + /* Ask the kernel */ Status = NtQueryInformationProcess(hProcess, ProcessBasicInformation, &ProcessBasic, @@ -1443,26 +1452,30 @@ NULL); if (!NT_SUCCESS(Status)) { + /* We failed, was this because this is a VDM process? */ + if (BaseCheckForVDM(hProcess, lpExitCode) == TRUE) return TRUE; + + /* Not a VDM process, fail the call */ BaseSetLastNTError(Status); return FALSE; } + /* Succes case, return the exit code */ *lpExitCode = (DWORD)ProcessBasic.ExitStatus; - return TRUE; } - /* * @implemented */ DWORD WINAPI -GetProcessId(HANDLE Process) +GetProcessId(IN HANDLE Process) { PROCESS_BASIC_INFORMATION ProcessBasic; NTSTATUS Status; + /* Query the kernel */ Status = NtQueryInformationProcess(Process, ProcessBasicInformation, &ProcessBasic, @@ -1470,105 +1483,65 @@ NULL); if (!NT_SUCCESS(Status)) { + /* Handle failure */ BaseSetLastNTError(Status); return 0; } + /* Return the PID */ return (DWORD)ProcessBasic.UniqueProcessId; } - /* * @implemented */ HANDLE WINAPI -OpenProcess(DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwProcessId) -{ - NTSTATUS errCode; +OpenProcess(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN DWORD dwProcessId) +{ + NTSTATUS Status; HANDLE ProcessHandle; OBJECT_ATTRIBUTES ObjectAttributes; CLIENT_ID ClientId; + /* Setup the input client ID structure */ ClientId.UniqueProcess = UlongToHandle(dwProcessId); ClientId.UniqueThread = 0; + /* This is needed just to define the inheritance flags */ InitializeObjectAttributes(&ObjectAttributes, NULL, (bInheritHandle ? OBJ_INHERIT : 0), NULL, NULL); - errCode = NtOpenProcess(&ProcessHandle, - dwDesiredAccess, - &ObjectAttributes, - &ClientId); - if (!NT_SUCCESS(errCode)) - { - BaseSetLastNTError(errCode); + /* Now try to open the process */ + Status = NtOpenProcess(&ProcessHandle, + dwDesiredAccess, + &ObjectAttributes, + &ClientId); + if (!NT_SUCCESS(Status)) + { + /* Handle failure */ + BaseSetLastNTError(Status); return NULL; } + /* Otherwise return a handle to the process */ return ProcessHandle; } - -/* - * @implemented - */ -UINT -WINAPI -WinExec(LPCSTR lpCmdLine, - UINT uCmdShow) -{ - STARTUPINFOA StartupInfo; - PROCESS_INFORMATION ProcessInformation; - DWORD dosErr; - - RtlZeroMemory(&StartupInfo, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(STARTUPINFOA); - StartupInfo.wShowWindow = (WORD)uCmdShow; - StartupInfo.dwFlags = 0; - - if (!CreateProcessA(NULL, - (PVOID)lpCmdLine, - NULL, - NULL, - FALSE, - 0, - NULL, - NULL, - &StartupInfo, - &ProcessInformation)) - { - dosErr = GetLastError(); - return dosErr < 32 ? dosErr : ERROR_BAD_FORMAT; - } - - if (NULL != lpfnGlobalRegisterWaitForInputIdle) - { - lpfnGlobalRegisterWaitForInputIdle(ProcessInformation.hProcess, - 10000); - } - - NtClose(ProcessInformation.hProcess); - NtClose(ProcessInformation.hThread); - - return 33; /* Something bigger than 31 means success. */ -} - - /* * @implemented */ VOID WINAPI -RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle) -{ - lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle; - return; +RegisterWaitForInputIdle(IN WaitForInputIdleType lpfnRegisterWaitForInputIdle) +{ + /* Write the global function pointer */ + UserWaitForInputIdleRoutine = lpfnRegisterWaitForInputIdle; } /* @@ -1576,19 +1549,16 @@ */ VOID WINAPI -GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo) +GetStartupInfoW(IN LPSTARTUPINFOW lpStartupInfo) { PRTL_USER_PROCESS_PARAMETERS Params; - if (lpStartupInfo == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return; - } - + /* Get the process parameters */ Params = NtCurrentPeb()->ProcessParameters; + /* Copy the data out of there */ lpStartupInfo->cb = sizeof(STARTUPINFOW); + lpStartupInfo->lpReserved = Params->ShellInfo.Buffer; lpStartupInfo->lpDesktop = Params->DesktopInfo.Buffer; lpStartupInfo->lpTitle = Params->WindowTitle.Buffer; lpStartupInfo->dwX = Params->StartingX; @@ -1603,298 +1573,393 @@ lpStartupInfo->cbReserved2 = Params->RuntimeData.Length; lpStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer; - lpStartupInfo->hStdInput = Params->StandardInput; - lpStartupInfo->hStdOutput = Params->StandardOutput; - lpStartupInfo->hStdError = Params->StandardError; -} - + /* Check if the standard handles are being used for other features */ + if (lpStartupInfo->dwFlags & (STARTF_USESTDHANDLES | + STARTF_USEHOTKEY | + STARTF_SHELLPRIVATE)) + { + /* These are, so copy the standard handles too */ + lpStartupInfo->hStdInput = Params->StandardInput; + lpStartupInfo->hStdOutput = Params->StandardOutput; + lpStartupInfo->hStdError = Params->StandardError; + } +} /* * @implemented */ VOID WINAPI -GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo) +GetStartupInfoA(IN LPSTARTUPINFOA lpStartupInfo) { PRTL_USER_PROCESS_PARAMETERS Params; - ANSI_STRING AnsiString; - - if (lpStartupInfo == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return; - } - - Params = NtCurrentPeb ()->ProcessParameters; - - RtlAcquirePebLock (); - - /* FIXME - not thread-safe */ - if (lpLocalStartupInfo == NULL) - { - /* create new local startup info (ansi) */ - lpLocalStartupInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - sizeof(STARTUPINFOA)); - if (lpLocalStartupInfo == NULL) - { - RtlReleasePebLock(); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return; - } - - lpLocalStartupInfo->cb = sizeof(STARTUPINFOA); - - /* copy window title string */ - RtlUnicodeStringToAnsiString(&AnsiString, - &Params->WindowTitle, - TRUE); - lpLocalStartupInfo->lpTitle = AnsiString.Buffer; - - /* copy desktop info string */ - RtlUnicodeStringToAnsiString(&AnsiString, - &Params->DesktopInfo, - TRUE); - lpLocalStartupInfo->lpDesktop = AnsiString.Buffer; - - /* copy shell info string */ - RtlUnicodeStringToAnsiString(&AnsiString, - &Params->ShellInfo, - TRUE); - lpLocalStartupInfo->lpReserved = AnsiString.Buffer; - - lpLocalStartupInfo->dwX = Params->StartingX; - lpLocalStartupInfo->dwY = Params->StartingY; - lpLocalStartupInfo->dwXSize = Params->CountX; - lpLocalStartupInfo->dwYSize = Params->CountY; - lpLocalStartupInfo->dwXCountChars = Params->CountCharsX; - lpLocalStartupInfo->dwYCountChars = Params->CountCharsY; - lpLocalStartupInfo->dwFillAttribute = Params->FillAttribute; - lpLocalStartupInfo->dwFlags = Params->WindowFlags; - lpLocalStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags; - lpLocalStartupInfo->cbReserved2 = Params->RuntimeData.Length; - lpLocalStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer; - - lpLocalStartupInfo->hStdInput = Params->StandardInput; - lpLocalStartupInfo->hStdOutput = Params->StandardOutput; - lpLocalStartupInfo->hStdError = Params->StandardError; - } - - RtlReleasePebLock(); - - /* copy local startup info data to external startup info */ - memcpy(lpStartupInfo, - lpLocalStartupInfo, - sizeof(STARTUPINFOA)); -} - + ANSI_STRING TitleString, ShellString, DesktopString; + LPSTARTUPINFOA StartupInfo; + NTSTATUS Status; + + /* Get the cached information as well as the PEB parameters */ + StartupInfo = BaseAnsiStartupInfo; + Params = NtCurrentPeb()->ProcessParameters; + + /* Check if this is the first time we have to get the cached version */ + while (!StartupInfo) + { + /* Create new ANSI startup info */ + StartupInfo = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + sizeof(*StartupInfo)); + if (StartupInfo) + { + /* Zero out string pointers in case we fail to create them */ + StartupInfo->lpReserved = 0; + StartupInfo->lpDesktop = 0; + StartupInfo->lpTitle = 0; + + /* Set the size */ + StartupInfo->cb = sizeof(*StartupInfo); + + /* Copy what's already stored in the PEB */ + StartupInfo->dwX = Params->StartingX; + StartupInfo->dwY = Params->StartingY; + StartupInfo->dwXSize = Params->CountX; + StartupInfo->dwYSize = Params->CountY; + StartupInfo->dwXCountChars = Params->CountCharsX; + StartupInfo->dwYCountChars = Params->CountCharsY; + StartupInfo->dwFillAttribute = Params->FillAttribute; + StartupInfo->dwFlags = Params->WindowFlags; + StartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags; + StartupInfo->cbReserved2 = Params->RuntimeData.Length; + StartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer; + StartupInfo->hStdInput = Params->StandardInput; + StartupInfo->hStdOutput = Params->StandardOutput; + StartupInfo->hStdError = Params->StandardError; + + /* Copy shell info string */ + Status = RtlUnicodeStringToAnsiString(&ShellString, + &Params->ShellInfo, + TRUE); + if (NT_SUCCESS(Status)) + { + /* Save it */ + StartupInfo->lpReserved = ShellString.Buffer; + + /* Copy desktop info string */ + Status = RtlUnicodeStringToAnsiString(&DesktopString, + &Params->DesktopInfo, + TRUE); + if (NT_SUCCESS(Status)) + { + /* Save it */ + StartupInfo->lpDesktop = DesktopString.Buffer; + + /* Copy window title string */ + Status = RtlUnicodeStringToAnsiString(&TitleString, + &Params->WindowTitle, + TRUE); + if (NT_SUCCESS(Status)) + { + /* Save it */ + StartupInfo->lpReserved = TitleString.Buffer; + + /* We finished with the ANSI version, try to cache it */ + if (!InterlockedCompareExchangePointer(&BaseAnsiStartupInfo, + StartupInfo, + NULL)) + { + /* We were the first thread through, use the data */ + break; + } + + /* Someone beat us to it, use their data instead */ + StartupInfo = BaseAnsiStartupInfo; + Status = STATUS_SUCCESS; + + /* We're going to free our own stuff, but not raise */ + RtlFreeAnsiString(&TitleString); + } + RtlFreeAnsiString(&DesktopString); + } + RtlFreeAnsiString(&ShellString); + } + RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo); + } + else + { + /* No memory, fail */ + Status = STATUS_NO_MEMORY; + } + + /* Raise an error unless we got here due to the race condition */ + if (!NT_SUCCESS(Status)) RtlRaiseStatus(Status); + } + + /* Now copy from the cached ANSI version */ + lpStartupInfo->cb = StartupInfo->cb; + lpStartupInfo->lpReserved = StartupInfo->lpReserved; + lpStartupInfo->lpDesktop = StartupInfo->lpDesktop; + lpStartupInfo->lpTitle = StartupInfo->lpTitle; + lpStartupInfo->dwX = StartupInfo->dwX; + lpStartupInfo->dwY = StartupInfo->dwY; + lpStartupInfo->dwXSize = StartupInfo->dwXSize; + lpStartupInfo->dwYSize = StartupInfo->dwYSize; + lpStartupInfo->dwXCountChars = StartupInfo->dwXCountChars; + lpStartupInfo->dwYCountChars = StartupInfo->dwYCountChars; + lpStartupInfo->dwFillAttribute = StartupInfo->dwFillAttribute; + lpStartupInfo->dwFlags = StartupInfo->dwFlags; + lpStartupInfo->wShowWindow = StartupInfo->wShowWindow; + lpStartupInfo->cbReserved2 = StartupInfo->cbReserved2; + lpStartupInfo->lpReserved2 = StartupInfo->lpReserved2; + + /* Check if the shell is hijacking the handles for other features */ + if (lpStartupInfo->dwFlags & + (STARTF_USESTDHANDLES | STARTF_USEHOTKEY | STARTF_SHELLPRIVATE)) + { + /* It isn't, so we can return the raw values */ + lpStartupInfo->hStdInput = StartupInfo->hStdInput; + lpStartupInfo->hStdOutput = StartupInfo->hStdOutput; + lpStartupInfo->hStdError = StartupInfo->hStdError; + } + else + { + /* It is, so make sure nobody uses these as console handles */ + lpStartupInfo->hStdInput = INVALID_HANDLE_VALUE; + lpStartupInfo->hStdOutput = INVALID_HANDLE_VALUE; + lpStartupInfo->hStdError = INVALID_HANDLE_VALUE; + } +} /* * @implemented */ BOOL WINAPI -FlushInstructionCache(HANDLE hProcess, - LPCVOID lpBaseAddress, - SIZE_T dwSize) -{ - NTSTATUS Status; - - Status = NtFlushInstructionCache(hProcess, - (PVOID)lpBaseAddress, - dwSize); +FlushInstructionCache(IN HANDLE hProcess, + IN LPCVOID lpBaseAddress, + IN SIZE_T dwSize) +{ + NTSTATUS Status; + + /* Call the native function */ + Status = NtFlushInstructionCache(hProcess, (PVOID)lpBaseAddress, dwSize); if (!NT_SUCCESS(Status)) { + /* Handle failure case */ BaseSetLastNTError(Status); return FALSE; } + /* All good */ return TRUE; } - /* * @implemented */ VOID WINAPI -ExitProcess(UINT uExitCode) +ExitProcess(IN UINT uExitCode) { CSR_API_MESSAGE CsrRequest; - ULONG Request; - NTSTATUS Status; - - /* kill sibling threads ... we want to be alone at this point */ - NtTerminateProcess(NULL, 0); - - /* unload all dll's */ - LdrShutdownProcess(); - - /* notify csrss of process termination */ - Request = TERMINATE_PROCESS; - Status = CsrClientCallServer(&CsrRequest, - NULL, - MAKE_CSR_API(Request, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) - { - DPRINT("Failed to tell csrss about terminating process\n"); - } - - NtTerminateProcess(NtCurrentProcess (), - uExitCode); + ASSERT(!BaseRunningInServerProcess); + + _SEH2_TRY + { + /* Acquire the PEB lock */ + RtlAcquirePebLock(); + + /* Kill all the threads */ + NtTerminateProcess(NULL, 0); + + /* Unload all DLLs */ + LdrShutdownProcess(); + + /* Notify Base Server of process termination */ + CsrClientCallServer(&CsrRequest, + NULL, + MAKE_CSR_API(TERMINATE_PROCESS, CSR_NATIVE), + sizeof(CSR_API_MESSAGE)); + + /* Now do it again */ + NtTerminateProcess(NtCurrentProcess(), uExitCode); + } + _SEH2_FINALLY + { + /* Release the PEB lock */ + RtlReleasePebLock(); + } + _SEH2_END; /* should never get here */ ASSERT(0); while(1); } - /* * @implemented */ BOOL WINAPI -TerminateProcess(HANDLE hProcess, - UINT uExitCode) -{ - NTSTATUS Status; - - if (hProcess == NULL) - { - return FALSE; - } - - Status = NtTerminateProcess(hProcess, uExitCode); +TerminateProcess(IN HANDLE hProcess, + IN UINT uExitCode) +{ + NTSTATUS Status; + + /* Check if no handle was passed in */ + if (!hProcess) + { + /* Set error code */ + SetLastError(ERROR_INVALID_HANDLE); + } + else + { + /* Otherwise, try to terminate the process */ + Status = NtTerminateProcess(hProcess, uExitCode); + if (NT_SUCCESS(Status)) return TRUE; + + /* It failed, convert error code */ + BaseSetLastNTError(Status); + } + + /* This is the failure path */ + return FALSE; +} + +/* + * @implemented + */ +VOID +WINAPI +FatalAppExitA(UINT uAction, + LPCSTR lpMessageText) +{ + PUNICODE_STRING MessageTextU; + ANSI_STRING MessageText; + NTSTATUS Status; + + /* Initialize the string using the static TEB pointer */ + MessageTextU = &NtCurrentTeb()->StaticUnicodeString; + RtlInitAnsiString(&MessageText, (LPSTR)lpMessageText); + + /* Convert to unicode and just exit normally if this failed */ + Status = RtlAnsiStringToUnicodeString(MessageTextU, &MessageText, FALSE); + if (!NT_SUCCESS(Status)) ExitProcess(0); + + /* Call the Wide function */ + FatalAppExitW(uAction, MessageTextU->Buffer); +} + +/* + * @implemented + */ +VOID +WINAPI +FatalAppExitW(IN UINT uAction, + IN LPCWSTR lpMessageText) +{ + UNICODE_STRING UnicodeString; + ULONG Response; + NTSTATUS Status; + + /* Setup the stirng to print out */ + RtlInitUnicodeString(&UnicodeString, lpMessageText); + + /* Display the hard error no matter what */ + Status = NtRaiseHardError(STATUS_FATAL_APP_EXIT | HARDERROR_OVERRIDE_ERRORMODE, + 1, + 1, + (PULONG_PTR)&UnicodeString, + OptionOkCancel, + &Response); + + /* Give the user a chance to abort */ + if ((NT_SUCCESS(Status)) && (Response == ResponseCancel)) return; + + /* Otherwise kill the process */ + ExitProcess(0); +} + +/* + * @implemented + */ +VOID +WINAPI +FatalExit(IN int ExitCode) +{ +#if DBG + /* On Checked builds, Windows gives you a nice little debugger UI */ + CHAR ch[2]; + DbgPrint("FatalExit...\n"); + DbgPrint("\n"); + + while (TRUE) + { + DbgPrompt( "A (Abort), B (Break), I (Ignore)? ", ch, sizeof(ch)); + switch (ch[0]) + { + case 'B': case 'b': + DbgBreakPoint(); + break; + + case 'A': case 'a': + ExitProcess(ExitCode); + + case 'I': case 'i': + return; + } + } +#endif + /* On other builds, just kill the process */ + ExitProcess(ExitCode); +} + +/* + * @implemented + */ +DWORD +WINAPI +GetPriorityClass(IN HANDLE hProcess) +{ + NTSTATUS Status; + PROCESS_PRIORITY_CLASS PriorityClass; + + /* Query the kernel */ + Status = NtQueryInformationProcess(hProcess, + ProcessPriorityClass, + &PriorityClass, + sizeof(PROCESS_PRIORITY_CLASS), + NULL); if (NT_SUCCESS(Status)) { - return TRUE; - } - + /* Handle the conversion from NT to Win32 classes */ + switch (PriorityClass.PriorityClass) + { + case PROCESS_PRIORITY_CLASS_IDLE: return IDLE_PRIORITY_CLASS; + case PROCESS_PRIORITY_CLASS_BELOW_NORMAL: return BELOW_NORMAL_PRIORITY_CLASS; + case PROCESS_PRIORITY_CLASS_ABOVE_NORMAL: return ABOVE_NORMAL_PRIORITY_CLASS; + case PROCESS_PRIORITY_CLASS_HIGH: return HIGH_PRIORITY_CLASS; + case PROCESS_PRIORITY_CLASS_REALTIME: return REALTIME_PRIORITY_CLASS; + case PROCESS_PRIORITY_CLASS_NORMAL: default: return NORMAL_PRIORITY_CLASS; + } + } + + /* Failure path */ BaseSetLastNTError(Status); return FALSE; } - -/* - * @unimplemented - */ -VOID -WINAPI -FatalAppExitA(UINT uAction, - LPCSTR lpMessageText) -{ - UNICODE_STRING MessageTextU; - ANSI_STRING MessageText; - - RtlInitAnsiString(&MessageText, (LPSTR)lpMessageText); - - RtlAnsiStringToUnicodeString(&MessageTextU, - &MessageText, - TRUE); - - FatalAppExitW(uAction, MessageTextU.Buffer); - - RtlFreeUnicodeString(&MessageTextU); -} - - -/* - * @unimplemented - */ -VOID -WINAPI -FatalAppExitW(UINT uAction, - LPCWSTR lpMessageText) -{ - static const WCHAR szUser32[] = L"user32.dll\0"; - - HMODULE hModule = GetModuleHandleW(szUser32); - MessageBoxW_Proc pMessageBoxW = NULL; - - DPRINT1("AppExit\n"); - - if (hModule) - pMessageBoxW = (MessageBoxW_Proc)GetProcAddress(hModule, "MessageBoxW"); - - if (pMessageBoxW) - pMessageBoxW(0, lpMessageText, NULL, MB_SYSTEMMODAL | MB_OK); - else - DPRINT1("%s\n", lpMessageText); - - ExitProcess(0); -} - - -/* - * @implemented - */ -VOID -WINAPI -FatalExit(int ExitCode) -{ - ExitProcess(ExitCode); -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetPriorityClass(HANDLE hProcess) -{ - NTSTATUS Status; - PROCESS_PRIORITY_CLASS PriorityClass; - - Status = NtQueryInformationProcess(hProcess, - ProcessPriorityClass, - &PriorityClass, - sizeof(PROCESS_PRIORITY_CLASS), - NULL); - if(NT_SUCCESS(Status)) - { - switch(PriorityClass.PriorityClass) - { - case PROCESS_PRIORITY_CLASS_IDLE: - return IDLE_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_BELOW_NORMAL: - return BELOW_NORMAL_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_NORMAL: - return NORMAL_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_ABOVE_NORMAL: - return ABOVE_NORMAL_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_HIGH: - return HIGH_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_REALTIME: - return REALTIME_PRIORITY_CLASS; - - default: - return NORMAL_PRIORITY_CLASS; - } - } - - BaseSetLastNTError(Status); - return FALSE; -} - - /* * @implemented */ BOOL WINAPI -SetPriorityClass(HANDLE hProcess, - DWORD dwPriorityClass) -{ - NTSTATUS Status; +SetPriorityClass(IN HANDLE hProcess, + IN DWORD dwPriorityClass) +{ + NTSTATUS Status; + PVOID State = NULL; PROCESS_PRIORITY_CLASS PriorityClass; + /* Handle conversion from Win32 to NT priority classes */ switch (dwPriorityClass) { case IDLE_PRIORITY_CLASS: @@ -1918,68 +1983,85 @@ break; case REALTIME_PRIORITY_CLASS: - PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_REALTIME; + /* Try to acquire the privilege. If it fails, just use HIGH */ + State = BasepIsRealtimeAllowed(TRUE); + PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_HIGH; + PriorityClass.PriorityClass += (State != NULL); break; default: + /* Unrecognized priority classes don't make it to the kernel */ SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } + /* Send the request to the kernel, and don't touch the foreground flag */ PriorityClass.Foreground = FALSE; - Status = NtSetInformationProcess(hProcess, ProcessPriorityClass, &PriorityClass, sizeof(PROCESS_PRIORITY_CLASS)); + + /* Release the privilege if we had it */ + if (State) RtlReleasePrivilege(State); if (!NT_SUCCESS(Status)) { + /* Handle error path */ BaseSetLastNTError(Status); return FALSE; } + /* All done */ return TRUE; } - /* * @implemented */ DWORD WINAPI -GetProcessVersion(DWORD ProcessId) +GetProcessVersion(IN DWORD ProcessId) { DWORD Version = 0; - PIMAGE_NT_HEADERS NtHeader = NULL; - IMAGE_NT_HEADERS NtHeaders; - IMAGE_DOS_HEADER DosHeader; + PIMAGE_NT_HEADERS NtHeader; + PIMAGE_DOS_HEADER DosHeader; + PPEB Peb; PROCESS_BASIC_INFORMATION ProcessBasicInfo; - PVOID BaseAddress = NULL; + PVOID BaseAddress; + ULONG e_lfanew; HANDLE ProcessHandle = NULL; NTSTATUS Status; - SIZE_T Count; - PEB Peb; - + USHORT VersionData[2]; + BOOLEAN Result; + + /* We'll be accessing stuff that can fault, so protect everything with SEH */ _SEH2_TRY { - if (0 == ProcessId || GetCurrentProcessId() == ProcessId) - { - /* Caller's */ - BaseAddress = (PVOID) NtCurrentPeb()->ImageBaseAddress; - NtHeader = RtlImageNtHeader(BaseAddress); - - Version = (NtHeader->OptionalHeader.MajorOperatingSystemVersion << 16) | - (NtHeader->OptionalHeader.MinorOperatingSystemVersion); + /* It this an in-process or out-of-process request? */ + if (!(ProcessId) || (GetCurrentProcessId() == ProcessId)) + { + /* It's in-process, so just read our own header */ + NtHeader = RtlImageNtHeader(NtCurrentPeb()->ImageBaseAddress); + if (!NtHeader) + { + /* Unable to read the NT header, something is wrong here... */ + Status = STATUS_INVALID_IMAGE_FORMAT; + goto Error; + } + + /* Get the version straight out of the NT header */ + Version = MAKELONG(NtHeader->OptionalHeader.MinorSubsystemVersion, + NtHeader->OptionalHeader.MajorSubsystemVersion); } else { - /* Other process */ + /* Out-of-process, so open it */ ProcessHandle = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, ProcessId); - if (!ProcessHandle) return 0; + /* Try to find out where its PEB lives */ Status = NtQueryInformationProcess(ProcessHandle, ProcessBasicInformation, &ProcessBasicInfo, @@ -1987,65 +2069,64 @@ NULL); if (!NT_SUCCESS(Status)) goto Error; - - Status = NtReadVirtualMemory(ProcessHandle, - ProcessBasicInfo.PebBaseAddress, - &Peb, - sizeof(Peb), - &Count); - - if (!NT_SUCCESS(Status) || Count != sizeof(Peb)) goto Error; - - memset(&DosHeader, 0, sizeof(DosHeader)); - Status = NtReadVirtualMemory(ProcessHandle, - Peb.ImageBaseAddress, - &DosHeader, - sizeof(DosHeader), - &Count); - - if (!NT_SUCCESS(Status) || Count != sizeof(DosHeader)) goto Error; - if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) goto Error; - - memset(&NtHeaders, 0, sizeof(NtHeaders)); - Status = NtReadVirtualMemory(ProcessHandle, - (char *)Peb.ImageBaseAddress + DosHeader.e_lfanew, - &NtHeaders, - sizeof(NtHeaders), - &Count); - - if (!NT_SUCCESS(Status) || Count != sizeof(NtHeaders)) goto Error; - if (NtHeaders.Signature != IMAGE_NT_SIGNATURE) goto Error; - - Version = MAKELONG(NtHeaders.OptionalHeader.MinorSubsystemVersion, - NtHeaders.OptionalHeader.MajorSubsystemVersion); + Peb = ProcessBasicInfo.PebBaseAddress; + + /* Now that we have the PEB, read the image base address out of it */ + Result = ReadProcessMemory(ProcessHandle, + &Peb->ImageBaseAddress, + &BaseAddress, + sizeof(BaseAddress), + NULL); + if (!Result) goto Error; + + /* Now read the e_lfanew (offset to NT header) from the base */ + DosHeader = BaseAddress; + Result = ReadProcessMemory(ProcessHandle, + &DosHeader->e_lfanew, + &e_lfanew, + sizeof(e_lfanew), + NULL); + if (!Result) goto Error; + + /* And finally, read the NT header itself by adding the offset */ + NtHeader = (PVOID)((ULONG_PTR)BaseAddress + e_lfanew); + Result = ReadProcessMemory(ProcessHandle, + &NtHeader->OptionalHeader.MajorSubsystemVersion, + &VersionData, + sizeof(VersionData), + NULL); + if (!Result) goto Error; + + /* Get the version straight out of the NT header */ + Version = MAKELONG(VersionData[0], VersionData[1]); Error: - if (!NT_SUCCESS(Status)) - { - BaseSetLastNTError(Status); - } + /* If there was an error anywhere, set the last error */ + if (!NT_SUCCESS(Status)) BaseSetLastNTError(Status); } } _SEH2_FINALLY { + /* Close the process handle */ if (ProcessHandle) CloseHandle(ProcessHandle); } _SEH2_END; + /* And return the version data */ return Version; } - /* * @implemented */ BOOL WINAPI -GetProcessIoCounters(HANDLE hProcess, - PIO_COUNTERS lpIoCounters) -{ - NTSTATUS Status; - +GetProcessIoCounters(IN HANDLE hProcess, + OUT PIO_COUNTERS lpIoCounters) +{ + NTSTATUS Status; + + /* Query the kernel. Structures are identical, so let it do the copy too. */ Status = NtQueryInformationProcess(hProcess, ProcessIoCounters, lpIoCounters, @@ -2053,25 +2134,27 @@ NULL); if (!NT_SUCCESS(Status)) { + /* Handle error path */ BaseSetLastNTError(Status); return FALSE; } + /* All done */ return TRUE; } - /* * @implemented */ BOOL WINAPI -GetProcessPriorityBoost(HANDLE hProcess, - PBOOL pDisablePriorityBoost) +GetProcessPriorityBoost(IN HANDLE hProcess, + OUT PBOOL pDisablePriorityBoost) { NTSTATUS Status; ULONG PriorityBoost; + /* Query the kernel */ Status = NtQueryInformationProcess(hProcess, ProcessPriorityBoost, &PriorityBoost, @@ -2079,78 +2162,85 @@ NULL); if (NT_SUCCESS(Status)) { - *pDisablePriorityBoost = PriorityBoost; + /* Convert from ULONG to a BOOL */ + *pDisablePriorityBoost = PriorityBoost ? TRUE : FALSE; return TRUE; } + /* Handle error path */ BaseSetLastNTError(Status); return FALSE; } - /* * @implemented */ BOOL WINAPI -SetProcessPriorityBoost(HANDLE hProcess, - BOOL bDisablePriorityBoost) -{ - NTSTATUS Status; - ULONG PriorityBoost = (bDisablePriorityBoost ? TRUE : FALSE); /* prevent setting values other than 1 and 0 */ - +SetProcessPriorityBoost(IN HANDLE hProcess, + IN BOOL bDisablePriorityBoost) +{ + NTSTATUS Status; + ULONG PriorityBoost; + + /* Enforce that this is a BOOL, and send it to the kernel as a ULONG */ + PriorityBoost = (bDisablePriorityBoost ? TRUE : FALSE); Status = NtSetInformationProcess(hProcess, ProcessPriorityBoost, &PriorityBoost, sizeof(ULONG)); if (!NT_SUCCESS(Status)) { + /* Handle error path */ BaseSetLastNTError(Status); return FALSE; } + /* All done */ return TRUE; } - /* * @implemented */ BOOL WINAPI -GetProcessHandleCount(HANDLE hProcess, - PDWORD pdwHandleCount) +GetProcessHandleCount(IN HANDLE hProcess, + OUT PDWORD pdwHandleCount) { ULONG phc; NTSTATUS Status; + /* Query the kernel */ Status = NtQueryInformationProcess(hProcess, ProcessHandleCount, &phc, sizeof(ULONG), NULL); - if(NT_SUCCESS(Status)) - { - *pdwHandleCount = phc; - return TRUE; - } - + if (NT_SUCCESS(Status)) + { + /* Copy the count and return sucecss */ + *pdwHandleCount = phc; + return TRUE; + } + + /* Handle error path */ BaseSetLastNTError(Status); return FALSE; } - /* * @implemented */ BOOL WINAPI -IsWow64Process(HANDLE hProcess, - PBOOL Wow64Process) +IsWow64Process(IN HANDLE hProcess, + OUT PBOOL Wow64Process) { ULONG_PTR pbi; NTSTATUS Status; + /* Query the kernel */ Status = NtQueryInformationProcess(hProcess, ProcessWow64Information, &pbi, @@ -2158,12 +2248,13 @@ NULL); if (!NT_SUCCESS(Status)) { - SetLastError(RtlNtStatusToDosError(Status)); + /* Handle error path */ + BaseSetLastNTError(Status); return FALSE; } + /* Enforce this is a BOOL, and return success */ *Wow64Process = (pbi != 0); - return TRUE; } @@ -2174,10 +2265,8 @@ WINAPI GetCommandLineA(VOID) { - DPRINT("CommandLine \'%s\'\n", CommandLineStringA.Buffer); - return CommandLineStringA.Buffer; -} - + return BaseAnsiCommandLine.Buffer; +} /* * @implemented @@ -2186,8 +2275,7 @@ WINAPI GetCommandLineW(VOID) { - DPRINT("CommandLine \'%S\'\n", CommandLineStringW.Buffer); - return CommandLineStringW.Buffer; + return BaseUnicodeCommandLine.Buffer; } /* @@ -2208,11 +2296,14 @@ (PVOID)lpBaseAddress, lpBuffer, nSize, - lpNumberOfBytesRead); + &nSize); + + /* In user-mode, this parameter is optional */ + if (lpNumberOfBytesRead) *lpNumberOfBytesRead = nSize; if (!NT_SUCCESS(Status)) { /* We failed */ - BaseSetLastNTError (Status); + BaseSetLastNTError(Status); return FALSE; } @@ -2268,7 +2359,11 @@ lpBaseAddress, (LPVOID)lpBuffer, nSize, - lpNumberOfBytesWritten); + &nSize); + + /* In Win32, the parameter is optional, so handle this case */ + if (lpNumberOfBytesWritten) *lpNumberOfBytesWritten = nSize; + if (!NT_SUCCESS(Status)) { /* We failed */ @@ -2283,7 +2378,7 @@ else { /* Check if we were read only */ - if ((OldValue & PAGE_NOACCESS) || (OldValue & PAGE_READONLY)) + if (OldValue & (PAGE_NOACCESS | PAGE_READONLY)) { /* Restore protection and fail */ NtProtectVirtualMemory(hProcess, @@ -2292,7 +2387,9 @@ OldValue, &OldValue); BaseSetLastNTError(STATUS_ACCESS_VIOLATION); - return FALSE; + + /* Note: This is what Windows returns and code depends on it */ + return STATUS_ACCESS_VIOLATION; } /* Otherwise, do the write */ @@ -2300,7 +2397,10 @@ lpBaseAddress, (LPVOID)lpBuffer, nSize, - lpNumberOfBytesWritten); + &nSize); + + /* In Win32, the parameter is optional, so handle this case */ + if (lpNumberOfBytesWritten) *lpNumberOfBytesWritten = nSize; /* And restore the protection */ NtProtectVirtualMemory(hProcess, @@ -2312,7 +2412,9 @@ { /* We failed */ BaseSetLastNTError(STATUS_ACCESS_VIOLATION); - return FALSE; + + /* Note: This is what Windows returns and code depends on it */ + return STATUS_ACCESS_VIOLATION; } /* Flush the ITLB */ @@ -2334,7 +2436,7 @@ BOOL WINAPI ProcessIdToSessionId(IN DWORD dwProcessId, - OUT DWORD *pSessionId) + OUT PDWORD pSessionId) { PROCESS_SESSION_INFORMATION SessionInformation; OBJECT_ATTRIBUTES ObjectAttributes; @@ -2342,61 +2444,43 @@ HANDLE ProcessHandle; NTSTATUS Status; + /* Do a quick check if the pointer is not writable */ if (IsBadWritePtr(pSessionId, sizeof(DWORD))) { + /* Fail fast */ SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } + /* Open the process passed in by ID */ ClientId.UniqueProcess = UlongToHandle(dwProcessId); ClientId.UniqueThread = 0; - InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); - Status = NtOpenProcess(&ProcessHandle, PROCESS_QUERY_INFORMATION, &ObjectAttributes, &ClientId); if (NT_SUCCESS(Status)) { + /* Query the session ID from the kernel */ Status = NtQueryInformationProcess(ProcessHandle, ProcessSessionInformation, &SessionInformation, sizeof(SessionInformation), NULL); + + /* Close the handle and check if we suceeded */ NtClose(ProcessHandle); - if (NT_SUCCESS(Status)) { + /* Return the session ID */ *pSessionId = SessionInformation.SessionId; return TRUE; } } + /* Set error code and fail */ BaseSetLastNTError(Status); - return FALSE; -} - -BOOL -WINAPI -SetProcessWorkingSetSizeEx(IN HANDLE hProcess, - IN SIZE_T dwMinimumWorkingSetSize, - IN SIZE_T dwMaximumWorkingSetSize, - IN DWORD Flags) -{ - STUB; - return FALSE; -} - - -BOOL -WINAPI -GetProcessWorkingSetSizeEx(IN HANDLE hProcess, - OUT PSIZE_T lpMinimumWorkingSetSize, - OUT PSIZE_T lpMaximumWorkingSetSize, - OUT PDWORD Flags) -{ - STUB; return FALSE; } @@ -3419,4 +3503,48 @@ NULL); } +/* + * @implemented + */ +UINT +WINAPI +WinExec(LPCSTR lpCmdLine, + UINT uCmdShow) +{ + STARTUPINFOA StartupInfo; + PROCESS_INFORMATION ProcessInformation; + DWORD dosErr; + + RtlZeroMemory(&StartupInfo, sizeof(StartupInfo)); + StartupInfo.cb = sizeof(STARTUPINFOA); + StartupInfo.wShowWindow = (WORD)uCmdShow; + StartupInfo.dwFlags = 0; + + if (!CreateProcessA(NULL, + (PVOID)lpCmdLine, + NULL, + NULL, + FALSE, + 0, + NULL, + NULL, + &StartupInfo, + &ProcessInformation)) + { + dosErr = GetLastError(); + return dosErr < 32 ? dosErr : ERROR_BAD_FORMAT; + } + + if (NULL != UserWaitForInputIdleRoutine) + { + UserWaitForInputIdleRoutine(ProcessInformation.hProcess, + 10000); + } + + NtClose(ProcessInformation.hProcess); + NtClose(ProcessInformation.hThread); + + return 33; /* Something bigger than 31 means success. */ +} + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/include/kernel32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
============================================================================== --- trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Mon Jan 23 04:57:12 2012 @@ -158,7 +158,7 @@ extern BOOLEAN InWindows; -extern WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle; +extern WaitForInputIdleType UserWaitForInputIdleRoutine; /* GLOBAL VARIABLES **********************************************************/ @@ -493,6 +493,13 @@ IN ULONG FileAttributes ); +BOOL +WINAPI +BaseCheckForVDM( + IN HANDLE ProcessHandle, + OUT LPDWORD ExitCode +); + /* FIXME: This is EXPORTED! It should go in an external kernel32.h header */ VOID WINAPI Modified: trunk/reactos/include/ndk/extypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/extypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/extypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/extypes.h [iso-8859-1] Mon Jan 23 04:57:12 2012 @@ -127,9 +127,10 @@ #define PROFILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | PROFILE_CONTROL) // -// Maximum Parameters for NtRaiseHardError +// NtRaiseHardError-related parameters // #define MAXIMUM_HARDERROR_PARAMETERS 4 +#define HARDERROR_OVERRIDE_ERRORMODE 0x10000000 // // Pushlock bits
12 years, 11 months
1
0
0
0
[janderwald] 55091: [USBEHCI] - Don't complete irps with lock held
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Jan 23 04:22:11 2012 New Revision: 55091 URL:
http://svn.reactos.org/svn/reactos?rev=55091&view=rev
Log: [USBEHCI] - Don't complete irps with lock held Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] Mon Jan 23 04:22:11 2012 @@ -695,6 +695,7 @@ IUSBRequest * Request; BOOLEAN ShouldReleaseWhenDone; USBD_STATUS UrbStatus; + KIRQL OldLevel; // // sanity checks @@ -764,9 +765,19 @@ if (Request->GetQueueHead(&NewQueueHead) == STATUS_SUCCESS) { // + // first acquire request lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // // add to pending list // InsertTailList(&m_PendingRequestAsyncList, &NewQueueHead->LinkedQueueHeads); + + // + // release queue head + // + KeReleaseSpinLock(&m_Lock, OldLevel); // // Done for now @@ -860,9 +871,19 @@ Request = (IUSBRequest*) CurrentQH->Request; // + // release lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); + + // // complete request now // QueueHeadCleanup(CurrentQH); + + // + // first acquire request lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); } //
12 years, 11 months
1
0
0
0
[janderwald] 55090: [USBEHCI] - Don't acquire spinlock twice
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Jan 23 03:50:11 2012 New Revision: 55090 URL:
http://svn.reactos.org/svn/reactos?rev=55090&view=rev
Log: [USBEHCI] - Don't acquire spinlock twice Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] Mon Jan 23 03:50:11 2012 @@ -580,16 +580,18 @@ // // now unlink the queue head // FIXME: implement chained queue heads - // - - KeAcquireSpinLock(&m_Lock, &OldLevel); - + // no need to acquire locks, as it is called with locks held + // + + // + // unlink queue head + // UnlinkQueueHead(CurrentQH); + // + // insert into completed list + // InsertTailList(&m_CompletedRequestAsyncList, &CurrentQH->LinkedQueueHeads); - - KeReleaseSpinLock(&m_Lock, OldLevel); - } VOID
12 years, 11 months
1
0
0
0
[janderwald] 55089: [USBSTOR] - Fix attempt #2 the offset bug - fix identation
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Jan 23 02:58:52 2012 New Revision: 55089 URL:
http://svn.reactos.org/svn/reactos?rev=55089&view=rev
Log: [USBSTOR] - Fix attempt #2 the offset bug - fix identation Modified: branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c Modified: branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] Mon Jan 23 02:58:52 2012 @@ -589,12 +589,16 @@ if (CommandLength == UFI_READ_WRITE_CMD_LEN) { MdlVirtualAddress = MmGetMdlVirtualAddress(OriginalRequest->MdlAddress); + + // + // is there an offset + // if (MdlVirtualAddress != Context->TransferData) - { + { // // lets build an mdl // - Context->TransferBufferMDL = IoAllocateMdl(Context->TransferData, MmGetMdlByteCount(OriginalRequest->MdlAddress), FALSE, FALSE, NULL); + Context->TransferBufferMDL = IoAllocateMdl(Context->TransferData, MmGetMdlByteCount(OriginalRequest->MdlAddress), FALSE, FALSE, NULL); if (!Context->TransferBufferMDL) { // @@ -603,17 +607,20 @@ return STATUS_INSUFFICIENT_RESOURCES; } - // - // now build the partial mdl - // - IoBuildPartialMdl(OriginalRequest->MdlAddress, Context->TransferBufferMDL, Context->TransferData, Context->TransferDataLength); - } + // + // now build the partial mdl + // + IoBuildPartialMdl(OriginalRequest->MdlAddress, Context->TransferBufferMDL, Context->TransferData, Context->TransferDataLength); + } } - // - // I/O paging request - // - Context->TransferBufferMDL = OriginalRequest->MdlAddress; + if (!Context->TransferBufferMDL) + { + // + // I/O paging request + // + Context->TransferBufferMDL = OriginalRequest->MdlAddress; + } } else {
12 years, 11 months
1
0
0
0
[janderwald] 55088: [USBSTOR] - Fix bug in usbstor, which did not take the offset into account
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Jan 23 02:49:40 2012 New Revision: 55088 URL:
http://svn.reactos.org/svn/reactos?rev=55088&view=rev
Log: [USBSTOR] - Fix bug in usbstor, which did not take the offset into account Modified: branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c Modified: branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] Mon Jan 23 02:49:40 2012 @@ -576,7 +576,7 @@ if (Context->TransferDataLength) { // - // check if the original request already does not have an mdl associated + // check if the original request already does have an mdl associated // if (OriginalRequest) { @@ -589,7 +589,25 @@ if (CommandLength == UFI_READ_WRITE_CMD_LEN) { MdlVirtualAddress = MmGetMdlVirtualAddress(OriginalRequest->MdlAddress); - ASSERT(MdlVirtualAddress == Context->TransferData); + if (MdlVirtualAddress != Context->TransferData) + { + // + // lets build an mdl + // + Context->TransferBufferMDL = IoAllocateMdl(Context->TransferData, MmGetMdlByteCount(OriginalRequest->MdlAddress), FALSE, FALSE, NULL); + if (!Context->TransferBufferMDL) + { + // + // failed to allocate MDL + // + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // now build the partial mdl + // + IoBuildPartialMdl(OriginalRequest->MdlAddress, Context->TransferBufferMDL, Context->TransferData, Context->TransferDataLength); + } } //
12 years, 11 months
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
...
56
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Results per page:
10
25
50
100
200