[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 01/11] xenvkbd: sync common files with xenbus


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Mon, 19 Oct 2026 15:14:27 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Cc: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Delivery-date: Mon, 19 Oct 2026 13:14:58 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Sync xenbus interfaces and shared libraries.

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 include/cache_interface.h     | 130 ++++++++++++++--------------
 include/debug_interface.h     |  88 +++++++++----------
 include/evtchn_interface.h    | 136 ++++++++++++++---------------
 include/gnttab_interface.h    | 148 ++++++++++++++++----------------
 include/range_set_interface.h | 100 +++++++++++-----------
 include/store_interface.h     | 156 +++++++++++++++++-----------------
 include/suspend_interface.h   |  80 ++++++++---------
 src/xenvkbd/assert.h          |  80 ++++++++---------
 src/xenvkbd/dbg_print.h       |  34 +++-----
 src/xenvkbd/util.h            |  87 ++++++++++---------
 10 files changed, 516 insertions(+), 523 deletions(-)

diff --git a/include/cache_interface.h b/include/cache_interface.h
index 97fa315..e5f4ce9 100644
--- a/include/cache_interface.h
+++ b/include/cache_interface.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -51,20 +51,20 @@ typedef struct _XENBUS_CACHE    XENBUS_CACHE, 
*PXENBUS_CACHE;
     \brief Acquire a reference to the CACHE interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_CACHE_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_CACHE_RELEASE
     \brief Release a reference to the CACHE interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_CACHE_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_CACHE_CTOR
@@ -79,8 +79,8 @@ typedef VOID
 */
 typedef NTSTATUS
 (*XENBUS_CACHE_CTOR)(
-    IN  PVOID   Argument,
-    IN  PVOID   Object
+    _In_ PVOID  Argument,
+    _In_ PVOID  Object
     );
 
 /*! \typedef XENBUS_CACHE_DTOR
@@ -94,8 +94,8 @@ typedef NTSTATUS
 */
 typedef VOID
 (*XENBUS_CACHE_DTOR)(
-    IN  PVOID   Argument,
-    IN  PVOID   Object
+    _In_ PVOID  Argument,
+    _In_ PVOID  Object
     );
 
 /*! \typedef XENBUS_CACHE_ACQUIRE_LOCK
@@ -108,7 +108,7 @@ typedef VOID
 */
 typedef VOID
 (*XENBUS_CACHE_ACQUIRE_LOCK)(
-    IN  PVOID   Argument
+    _In_ PVOID  Argument
     );
 
 /*! \typedef XENBUS_CACHE_RELEASE_LOCK
@@ -121,21 +121,21 @@ typedef VOID
 */
 typedef VOID
 (*XENBUS_CACHE_RELEASE_LOCK)(
-    IN  PVOID   Argument
+    _In_ PVOID  Argument
     );
 
 typedef NTSTATUS
 (*XENBUS_CACHE_CREATE_V1)(
-    IN  PINTERFACE                  Interface,
-    IN  const CHAR                  *Name,
-    IN  ULONG                       Size,
-    IN  ULONG                       Reservation,
-    IN  XENBUS_CACHE_CTOR           Ctor,
-    IN  XENBUS_CACHE_DTOR           Dtor,
-    IN  XENBUS_CACHE_ACQUIRE_LOCK   AcquireLock,
-    IN  XENBUS_CACHE_RELEASE_LOCK   ReleaseLock,
-    IN  PVOID                       Argument OPTIONAL,
-    OUT PXENBUS_CACHE               *Cache
+    _In_ PINTERFACE                 Interface,
+    _In_ PCSTR                      Name,
+    _In_ ULONG                      Size,
+    _In_ ULONG                      Reservation,
+    _In_ XENBUS_CACHE_CTOR          Ctor,
+    _In_ XENBUS_CACHE_DTOR          Dtor,
+    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
+    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
+    _In_opt_ PVOID                  Argument,
+    _Outptr_ PXENBUS_CACHE          *Cache
     );
 
 /*! \typedef XENBUS_CACHE_CREATE
@@ -155,20 +155,20 @@ typedef NTSTATUS
 
     If a non-zero \a Reservation is specified then this method will fail
     unless that number of objects can be immediately created.
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_CACHE_CREATE)(
-    IN  PINTERFACE                  Interface,
-    IN  const CHAR                  *Name,
-    IN  ULONG                       Size,
-    IN  ULONG                       Reservation,
-    IN  ULONG                       Cap,
-    IN  XENBUS_CACHE_CTOR           Ctor,
-    IN  XENBUS_CACHE_DTOR           Dtor,
-    IN  XENBUS_CACHE_ACQUIRE_LOCK   AcquireLock,
-    IN  XENBUS_CACHE_RELEASE_LOCK   ReleaseLock,
-    IN  PVOID                       Argument OPTIONAL,
-    OUT PXENBUS_CACHE               *Cache
+    _In_ PINTERFACE                 Interface,
+    _In_ PCSTR                      Name,
+    _In_ ULONG                      Size,
+    _In_ ULONG                      Reservation,
+    _In_ ULONG                      Cap,
+    _In_ XENBUS_CACHE_CTOR          Ctor,
+    _In_ XENBUS_CACHE_DTOR          Dtor,
+    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
+    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
+    _In_opt_ PVOID                  Argument,
+    _Outptr_ PXENBUS_CACHE          *Cache
     );
 
 /*! \typedef XENBUS_CACHE_GET
@@ -181,9 +181,9 @@ typedef NTSTATUS
 */
 typedef PVOID
 (*XENBUS_CACHE_GET)(
-    IN  PINTERFACE      Interface,
-    IN  PXENBUS_CACHE   Cache,
-    IN  BOOLEAN         Locked
+    _In_ PINTERFACE     Interface,
+    _In_ PXENBUS_CACHE  Cache,
+    _In_ BOOLEAN        Locked
     );
 
 /*! \typedef XENBUS_CACHE_PUT
@@ -196,10 +196,10 @@ typedef PVOID
 */
 typedef VOID
 (*XENBUS_CACHE_PUT)(
-    IN  PINTERFACE      Interface,
-    IN  PXENBUS_CACHE   Cache,
-    IN  PVOID           Object,
-    IN  BOOLEAN         Locked
+    _In_ PINTERFACE     Interface,
+    _In_ PXENBUS_CACHE  Cache,
+    _In_ PVOID          Object,
+    _In_ BOOLEAN        Locked
     );
 
 /*! \typedef XENBUS_CACHE_DESTROY
@@ -212,12 +212,12 @@ typedef VOID
 */
 typedef VOID
 (*XENBUS_CACHE_DESTROY)(
-    IN  PINTERFACE      Interface,
-    IN  PXENBUS_CACHE   Cache
+    _In_ PINTERFACE     Interface,
+    _In_ PXENBUS_CACHE  Cache
     );
 
 // {A98DFD78-416A-4949-92A5-E084F2F4B44E}
-DEFINE_GUID(GUID_XENBUS_CACHE_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_CACHE_INTERFACE,
 0xa98dfd78, 0x416a, 0x4949, 0x92, 0xa5, 0xe0, 0x84, 0xf2, 0xf4, 0xb4, 0x4e);
 
 /*! \struct _XENBUS_CACHE_INTERFACE_V1
diff --git a/include/debug_interface.h b/include/debug_interface.h
index 79729c7..251902c 100644
--- a/include/debug_interface.h
+++ b/include/debug_interface.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -50,20 +50,20 @@ typedef struct _XENBUS_DEBUG_CALLBACK   
XENBUS_DEBUG_CALLBACK, *PXENBUS_DEBUG_CA
     \brief Acquire a reference to the DEBUG interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_DEBUG_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_DEBUG_RELEASE
     \brief Release a reference to the DEBUG interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_DEBUG_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_DEBUG_FUNCTION
@@ -74,11 +74,11 @@ typedef VOID
     part of pre-crash logging
 
     Debug callback functions are always invoked with IRQL == HIGH_LEVEL
-*/  
+*/
 typedef VOID
 (*XENBUS_DEBUG_FUNCTION)(
-    IN  PVOID   Argument,
-    IN  BOOLEAN Crashing
+    _In_ PVOID      Argument,
+    _In_ BOOLEAN    Crashing
     );
 
 /*! \typedef XENBUS_DEBUG_REGISTER
@@ -89,14 +89,14 @@ typedef VOID
     \param Function The callback function
     \param Argument An optional context argument passed to the callback
     \param Callback A pointer to a callback handle to be initialized
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_DEBUG_REGISTER)(
-    IN  PINTERFACE              Interface,
-    IN  PCHAR                   Prefix,
-    IN  XENBUS_DEBUG_FUNCTION   Function,
-    IN  PVOID                   Argument OPTIONAL,
-    OUT PXENBUS_DEBUG_CALLBACK  *Callback
+    _In_ PINTERFACE                 Interface,
+    _In_ PSTR                       Prefix,
+    _In_ XENBUS_DEBUG_FUNCTION      Function,
+    _In_opt_ PVOID                  Argument,
+    _Outptr_ PXENBUS_DEBUG_CALLBACK *Callback
     );
 
 /*! \typedef XENBUS_DEBUG_PRINTF
@@ -108,11 +108,11 @@ typedef NTSTATUS
 
     This method must only be invoked from the context of a debug
     callback
-*/  
+*/
 typedef VOID
 (*XENBUS_DEBUG_PRINTF)(
-    IN  PINTERFACE              Interface,
-    IN  const CHAR              *Format,
+    _In_ PINTERFACE             Interface,
+    _In_ PCSTR                  Format,
     ...
     );
 
@@ -124,8 +124,8 @@ typedef VOID
 */
 typedef VOID
 (*XENBUS_DEBUG_DEREGISTER)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_DEBUG_CALLBACK  Callback
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_DEBUG_CALLBACK Callback
     );
 
 /*! \typedef XENBUS_DEBUG_TRIGGER
@@ -137,12 +137,12 @@ typedef VOID
 */
 typedef VOID
 (*XENBUS_DEBUG_TRIGGER)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_DEBUG_CALLBACK  Callback OPTIONAL
+    _In_ PINTERFACE                 Interface,
+    _In_opt_ PXENBUS_DEBUG_CALLBACK Callback
     );
 
 // {0DF600AE-6B20-4227-BF94-03DA9A26A114}
-DEFINE_GUID(GUID_XENBUS_DEBUG_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_DEBUG_INTERFACE,
 0xdf600ae, 0x6b20, 0x4227, 0xbf, 0x94, 0x3, 0xda, 0x9a, 0x26, 0xa1, 0x14);
 
 /*! \struct _XENBUS_DEBUG_INTERFACE_V1
diff --git a/include/evtchn_interface.h b/include/evtchn_interface.h
index ef67487..5c46f97 100644
--- a/include/evtchn_interface.h
+++ b/include/evtchn_interface.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -54,27 +54,27 @@ typedef enum _XENBUS_EVTCHN_TYPE {
 
 /*! \typedef XENBUS_EVTCHN_CHANNEL
     \brief Event channel handle
-*/  
+*/
 typedef struct _XENBUS_EVTCHN_CHANNEL XENBUS_EVTCHN_CHANNEL, 
*PXENBUS_EVTCHN_CHANNEL;
 
 /*! \typedef XENBUS_EVTCHN_ACQUIRE
     \brief Acquire a reference to the EVTCHN interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_EVTCHN_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_EVTCHN_RELEASE
     \brief Release a reference to the EVTCHN interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_EVTCHN_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_EVTCHN_OPEN
@@ -105,13 +105,13 @@ typedef VOID
     \param Number The relative number of the CPU that should handle the VIRQ
 
     \return Event channel handle
-*/  
+*/
 typedef PXENBUS_EVTCHN_CHANNEL
 (*XENBUS_EVTCHN_OPEN)(
-    IN  PINTERFACE          Interface,
-    IN  XENBUS_EVTCHN_TYPE  Type,
-    IN  PKSERVICE_ROUTINE   Function,
-    IN  PVOID               Argument OPTIONAL,
+    _In_ PINTERFACE         Interface,
+    _In_ XENBUS_EVTCHN_TYPE Type,
+    _In_ PKSERVICE_ROUTINE  Function,
+    _In_opt_ PVOID          Argument,
     ...
     );
 
@@ -125,17 +125,17 @@ typedef PXENBUS_EVTCHN_CHANNEL
 */
 typedef NTSTATUS
 (*XENBUS_EVTCHN_BIND)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  USHORT                  Group,
-    IN  UCHAR                   Number
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ USHORT                 Group,
+    _In_ UCHAR                  Number
     );
 
 typedef VOID
 (*XENBUS_EVTCHN_UNMASK_V4)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  BOOLEAN                 InCallback
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ BOOLEAN                InCallback
     );
 
 /*! \typedef XENBUS_EVTCHN_UNMASK
@@ -148,16 +148,16 @@ typedef VOID
 */
 typedef BOOLEAN
 (*XENBUS_EVTCHN_UNMASK)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  BOOLEAN                 InCallback,
-    IN  BOOLEAN                 Force
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ BOOLEAN                InCallback,
+    _In_ BOOLEAN                Force
     );
 
 typedef VOID
 (*XENBUS_EVTCHN_SEND_V1)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     );
 
 /*! \typedef XENBUS_EVTCHN_SEND
@@ -168,11 +168,11 @@ typedef VOID
 
     \param Interface The interface header
     \param Channel The channel handle
-*/  
+*/
 typedef VOID
 (*XENBUS_EVTCHN_SEND)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     );
 
 /*! \typedef XENBUS_EVTCHN_TRIGGER
@@ -180,11 +180,11 @@ typedef VOID
 
     \param Interface The interface header
     \param Channel The channel handle
-*/  
+*/
 typedef VOID
 (*XENBUS_EVTCHN_TRIGGER)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     );
 
 /*! \typedef XENBUS_EVTCHN_GET_COUNT
@@ -196,15 +196,15 @@ typedef VOID
 */
 typedef ULONG
 (*XENBUS_EVTCHN_GET_COUNT)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     );
 
 typedef NTSTATUS
 (*XENBUS_EVTCHN_WAIT_V5)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  PLARGE_INTEGER          Timeout OPTIONAL
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_opt_ PLARGE_INTEGER     Timeout
     );
 
 /*! \typedef XENBUS_EVTCHN_WAIT
@@ -217,10 +217,10 @@ typedef NTSTATUS
 */
 typedef NTSTATUS
 (*XENBUS_EVTCHN_WAIT)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  ULONG                   Count,
-    IN  PLARGE_INTEGER          Timeout OPTIONAL
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ ULONG                  Count,
+    _In_opt_ PLARGE_INTEGER     Timeout
     );
 
 /*! \typedef XENBUS_EVTCHN_GET_PORT
@@ -229,11 +229,11 @@ typedef NTSTATUS
     \param Interface The interface header
     \param Channel The channel handle
     \return The port number
-*/  
+*/
 typedef ULONG
 (*XENBUS_EVTCHN_GET_PORT)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     );
 
 /*! \typedef XENBUS_EVTCHN_CLOSE
@@ -241,15 +241,15 @@ typedef ULONG
 
     \param Interface The interface header
     \param Channel The channel handle
-*/  
+*/
 typedef VOID
 (*XENBUS_EVTCHN_CLOSE)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     );
 
 // {BE2440AC-1098-4150-AF4D-452FADCEF923}
-DEFINE_GUID(GUID_XENBUS_EVTCHN_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_EVTCHN_INTERFACE,
 0xbe2440ac, 0x1098, 0x4150, 0xaf, 0x4d, 0x45, 0x2f, 0xad, 0xce, 0xf9, 0x23);
 
 /*! \struct _XENBUS_EVTCHN_INTERFACE_V5
diff --git a/include/gnttab_interface.h b/include/gnttab_interface.h
index 4fc8f1f..92a95a7 100644
--- a/include/gnttab_interface.h
+++ b/include/gnttab_interface.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -57,31 +57,31 @@ typedef struct _XENBUS_GNTTAB_CACHE XENBUS_GNTTAB_CACHE, 
*PXENBUS_GNTTAB_CACHE;
     \brief Acquire a reference to the GNTTAB interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_GNTTAB_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_GNTTAB_RELEASE
     \brief Release a reference to the GNTTAB interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_GNTTAB_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 typedef NTSTATUS
 (*XENBUS_GNTTAB_CREATE_CACHE_V1)(
-    IN  PINTERFACE                  Interface,
-    IN  const CHAR                  *Name,
-    IN  ULONG                       Reservation,
-    IN  XENBUS_CACHE_ACQUIRE_LOCK   AcquireLock,
-    IN  XENBUS_CACHE_RELEASE_LOCK   ReleaseLock,
-    IN  PVOID                       Argument OPTIONAL,
-    OUT PXENBUS_GNTTAB_CACHE        *Cache
+    _In_ PINTERFACE                 Interface,
+    _In_ PCSTR                      Name,
+    _In_ ULONG                      Reservation,
+    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
+    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
+    _In_opt_ PVOID                  Argument,
+    _Outptr_ PXENBUS_GNTTAB_CACHE   *Cache
     );
 
 /*! \typedef XENBUS_GNTTAB_CREATE_CACHE
@@ -95,17 +95,17 @@ typedef NTSTATUS
     \param ReleaseLock A callback invoked to release the spinlock
     \param Argument An optional context argument passed to the callbacks
     \param Cache A pointer to a grant table cache handle to be initialized
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_GNTTAB_CREATE_CACHE)(
-    IN  PINTERFACE                  Interface,
-    IN  const CHAR                  *Name,
-    IN  ULONG                       Reservation,
-    IN  ULONG                       Cap,
-    IN  XENBUS_CACHE_ACQUIRE_LOCK   AcquireLock,
-    IN  XENBUS_CACHE_RELEASE_LOCK   ReleaseLock,
-    IN  PVOID                       Argument OPTIONAL,
-    OUT PXENBUS_GNTTAB_CACHE        *Cache
+    _In_ PINTERFACE                 Interface,
+    _In_ PCSTR                      Name,
+    _In_ ULONG                      Reservation,
+    _In_ ULONG                      Cap,
+    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
+    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
+    _In_opt_ PVOID                  Argument,
+    _Outptr_ PXENBUS_GNTTAB_CACHE   *Cache
     );
 
 /*! \typedef XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS
@@ -123,13 +123,13 @@ typedef NTSTATUS
 */
 typedef NTSTATUS
 (*XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_GNTTAB_CACHE        Cache,
-    IN  BOOLEAN                     Locked,
-    IN  USHORT                      Domain,
-    IN  PFN_NUMBER                  Pfn,
-    IN  BOOLEAN                     ReadOnly,
-    OUT PXENBUS_GNTTAB_ENTRY        *Entry
+    _In_ PINTERFACE                 Interface,
+    _In_ PXENBUS_GNTTAB_CACHE       Cache,
+    _In_ BOOLEAN                    Locked,
+    _In_ USHORT                     Domain,
+    _In_ PFN_NUMBER                 Pfn,
+    _In_ BOOLEAN                    ReadOnly,
+    _Outptr_ PXENBUS_GNTTAB_ENTRY   *Entry
     );
 
 /*! \typedef XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS
@@ -143,10 +143,10 @@ typedef NTSTATUS
 */
 typedef NTSTATUS
 (*XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_GNTTAB_CACHE        Cache,
-    IN  BOOLEAN                     Locked,
-    IN  PXENBUS_GNTTAB_ENTRY        Entry
+    _In_ PINTERFACE                 Interface,
+    _In_ PXENBUS_GNTTAB_CACHE       Cache,
+    _In_ BOOLEAN                    Locked,
+    _In_ PXENBUS_GNTTAB_ENTRY       Entry
     );
 
 /*! \typedef XENBUS_GNTTAB_GET_REFERENCE
@@ -155,11 +155,11 @@ typedef NTSTATUS
     \param Interface The interface header
     \param Entry The grant table entry handle
     \return The reference number
-*/  
+*/
 typedef ULONG
 (*XENBUS_GNTTAB_GET_REFERENCE)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_GNTTAB_ENTRY        Entry
+    _In_ PINTERFACE                 Interface,
+    _In_ PXENBUS_GNTTAB_ENTRY       Entry
     );
 
 /*! \typedef XENBUS_GNTTAB_QUERY_REFERENCE
@@ -172,10 +172,10 @@ typedef ULONG
 */
 typedef NTSTATUS
 (*XENBUS_GNTTAB_QUERY_REFERENCE)(
-    IN  PINTERFACE  Interface,
-    IN  ULONG       Reference,
-    OUT PPFN_NUMBER Pfn OPTIONAL,
-    OUT PBOOLEAN    ReadOnly OPTIONAL
+    _In_ PINTERFACE         Interface,
+    _In_ ULONG              Reference,
+    _Out_opt_ PPFN_NUMBER   Pfn,
+    _Out_opt_ PBOOLEAN      ReadOnly
     );
 
 #define XENBUS_GNTTAB_CONSOLE_REFERENCE 0
@@ -189,12 +189,12 @@ typedef NTSTATUS
     \param Cache The grant table cache handle
 
     All grant table entries must have been revoked prior to destruction
-    of the cache 
-*/  
+    of the cache
+*/
 typedef VOID
 (*XENBUS_GNTTAB_DESTROY_CACHE)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_GNTTAB_CACHE    Cache
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_GNTTAB_CACHE   Cache
     );
 
 /*! \typedef XENBUS_GNTTAB_MAP_FOREIGN_PAGES
@@ -210,12 +210,12 @@ typedef VOID
 
 typedef NTSTATUS
 (*XENBUS_GNTTAB_MAP_FOREIGN_PAGES)(
-    IN  PINTERFACE              Interface,
-    IN  USHORT                  Domain,
-    IN  ULONG                   NumberPages,
-    IN  PULONG                  References,
-    IN  BOOLEAN                 ReadOnly,
-    OUT PHYSICAL_ADDRESS        *Address
+    _In_ PINTERFACE             Interface,
+    _In_ USHORT                 Domain,
+    _In_ ULONG                  NumberPages,
+    _In_ PULONG                 References,
+    _In_ BOOLEAN                ReadOnly,
+    _Out_ PHYSICAL_ADDRESS      *Address
     );
 
 /*! \typedef XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES
@@ -226,12 +226,12 @@ typedef NTSTATUS
 */
 typedef NTSTATUS
 (*XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES)(
-    IN  PINTERFACE              Interface,
-    IN  PHYSICAL_ADDRESS        Address
+    _In_ PINTERFACE             Interface,
+    _In_ PHYSICAL_ADDRESS       Address
     );
 
 // {763679C5-E5C2-4A6D-8B88-6BB02EC42D8E}
-DEFINE_GUID(GUID_XENBUS_GNTTAB_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_GNTTAB_INTERFACE,
 0x763679c5, 0xe5c2, 0x4a6d, 0x8b, 0x88, 0x6b, 0xb0, 0x2e, 0xc4, 0x2d, 0x8e);
 
 /*! \struct _XENBUS_GNTTAB_INTERFACE_V2
diff --git a/include/range_set_interface.h b/include/range_set_interface.h
index c45a161..cebe42e 100644
--- a/include/range_set_interface.h
+++ b/include/range_set_interface.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -51,20 +51,20 @@ typedef struct _XENBUS_RANGE_SET    XENBUS_RANGE_SET, 
*PXENBUS_RANGE_SET;
     \brief Acquire a reference to the RANGE_SET interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_RANGE_SET_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_RANGE_SET_RELEASE
     \brief Release a reference to the RANGE_SET interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_RANGE_SET_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_RANGE_SET_CREATE
@@ -73,12 +73,12 @@ typedef VOID
     \param Interface The interface header
     \param Name A name for the ramge-set which will be used in debug output
     \param RangeSet A pointer to a range-set handle to be initialized
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_RANGE_SET_CREATE)(
-    IN  PINTERFACE          Interface,
-    IN  const CHAR          *Name,
-    OUT PXENBUS_RANGE_SET   *RangeSet
+    _In_ PINTERFACE             Interface,
+    _In_ PCSTR                  Name,
+    _Outptr_ PXENBUS_RANGE_SET  *RangeSet
     );
 
 /*! \typedef XENBUS_RANGE_SET_PUT
@@ -88,13 +88,13 @@ typedef NTSTATUS
     \param RangeSet The range-set handle
     \param Start The base of the range
     \param Count The number of items of the range
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_RANGE_SET_PUT)(
-    IN  PINTERFACE          Interface,
-    IN  PXENBUS_RANGE_SET   RangeSet,
-    IN  LONGLONG            Start,
-    IN  ULONGLONG           Count
+    _In_ PINTERFACE         Interface,
+    _In_ PXENBUS_RANGE_SET  RangeSet,
+    _In_ LONGLONG           Start,
+    _In_ ULONGLONG          Count
     );
 
 /*! \typedef XENBUS_RANGE_SET_POP
@@ -105,13 +105,13 @@ typedef NTSTATUS
     \param Count The number of items required
     \param Start A pointer to a value which will be set to the base of
     a suitable range
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_RANGE_SET_POP)(
-    IN  PINTERFACE          Interface,
-    IN  PXENBUS_RANGE_SET   RangeSet,
-    IN  ULONGLONG           Count,
-    OUT PLONGLONG           Start
+    _In_ PINTERFACE         Interface,
+    _In_ PXENBUS_RANGE_SET  RangeSet,
+    _In_ ULONGLONG          Count,
+    _Out_ PLONGLONG         Start
     );
 
 /*! \typedef XENBUS_RANGE_SET_GET
@@ -121,13 +121,13 @@ typedef NTSTATUS
     \param RangeSet The range-set handle
     \param Start The base of the range
     \param Count The number of items in the range
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_RANGE_SET_GET)(
-    IN  PINTERFACE          Interface,
-    IN  PXENBUS_RANGE_SET   RangeSet,
-    IN  LONGLONG            Start,
-    IN  ULONGLONG           Count
+    _In_ PINTERFACE         Interface,
+    _In_ PXENBUS_RANGE_SET  RangeSet,
+    _In_ LONGLONG           Start,
+    _In_ ULONGLONG          Count
     );
 
 /*! \typedef XENBUS_RANGE_SET_DESTROY
@@ -137,15 +137,15 @@ typedef NTSTATUS
     \param RangeSet The range-set handle
 
     The range-set must be empty when it is destroyed
-*/  
+*/
 typedef VOID
 (*XENBUS_RANGE_SET_DESTROY)(
-    IN  PINTERFACE          Interface,
-    IN  PXENBUS_RANGE_SET   RangeSet
+    _In_ PINTERFACE         Interface,
+    _In_ PXENBUS_RANGE_SET  RangeSet
     );
 
 // {EE7E78A2-6847-48C5-B123-BB012F0EABF4}
-DEFINE_GUID(GUID_XENBUS_RANGE_SET_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_RANGE_SET_INTERFACE,
 0xee7e78a2, 0x6847, 0x48c5, 0xb1, 0x23, 0xbb, 0x1, 0x2f, 0xe, 0xab, 0xf4);
 
 /*! \struct _XENBUS_RANGE_SET_INTERFACE_V1
diff --git a/include/store_interface.h b/include/store_interface.h
index ca883bd..208be0e 100644
--- a/include/store_interface.h
+++ b/include/store_interface.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -72,20 +72,20 @@ typedef struct _XENBUS_STORE_PERMISSION {
     \brief Acquire a reference to the STORE interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_STORE_RELEASE
     \brief Release a reference to the STORE interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_STORE_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_STORE_FREE
@@ -93,11 +93,11 @@ typedef VOID
 
     \param Interface The interface header
     \param Buffer Pointer to the memory buffer
-*/  
+*/
 typedef VOID
 (*XENBUS_STORE_FREE)(
-    IN  PINTERFACE  Interface,
-    IN  PCHAR       Buffer
+    _In_ PINTERFACE Interface,
+    _In_ PSTR       Buffer
     );
 
 /*! \typedef XENBUS_STORE_READ
@@ -113,14 +113,14 @@ typedef VOID
     buffer containing the value read
 
     The \a Buffer should be freed using \a XENBUS_STORE_FREE
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_READ)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    OUT PCHAR                       *Buffer
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PSTR                       Prefix,
+    _In_ PSTR                           Node,
+    _Outptr_result_z_ PSTR              *Buffer
     );
 
 /*! \typedef XENBUS_STORE_PRINTF
@@ -136,14 +136,14 @@ typedef NTSTATUS
     \param ... Additional parameters required by \a Format
 
     If the \a Node does not exist then it is created
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_PRINTF)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    IN  const CHAR                  *Format,
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PSTR                       Prefix,
+    _In_ PSTR                           Node,
+    _In_ PCSTR                          Format,
     ...
     );
 
@@ -156,13 +156,13 @@ typedef NTSTATUS
     \param Prefix An optional prefix for the \a Node
     \param Node The concatenation of the \a Prefix and this value specifies
     the XenStore key to remove
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_REMOVE)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PSTR                       Prefix,
+    _In_ PSTR                           Node
     );
 
 /*! \typedef XENBUS_STORE_DIRECTORY
@@ -178,14 +178,14 @@ typedef NTSTATUS
     buffer containing a NUL separated list of key names
 
     The \a Buffer should be freed using \a XENBUS_STORE_FREE
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_DIRECTORY)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    OUT PCHAR                       *Buffer
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PSTR                       Prefix,
+    _In_ PSTR                           Node,
+    _Outptr_result_z_ PSTR              *Buffer
     );
 
 /*! \typedef XENBUS_STORE_TRANSACTION_START
@@ -193,11 +193,11 @@ typedef NTSTATUS
 
     \param Interface The interface header
     \param Transaction Pointer to a transaction handle to be initialized
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_TRANSACTION_START)(
-    IN  PINTERFACE                  Interface,
-    OUT PXENBUS_STORE_TRANSACTION   *Transaction
+    _In_ PINTERFACE                     Interface,
+    _Outptr_ PXENBUS_STORE_TRANSACTION  *Transaction
     );
 
 /*! \typedef XENBUS_STORE_TRANSACTION_END
@@ -210,12 +210,12 @@ typedef NTSTATUS
 
     If \a Commit is TRUE and the transaction to found to clash then
     STATUS_RETRY will be returned
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_TRANSACTION_END)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction,
-    IN  BOOLEAN                     Commit
+    _In_ PINTERFACE                 Interface,
+    _In_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_ BOOLEAN                    Commit
     );
 
 /*! \typedef XENBUS_STORE_WATCH_ADD
@@ -228,14 +228,14 @@ typedef NTSTATUS
     \param Event A pointer to an event object to be signalled when the
     watch fires
     \param Watch A pointer to a watch handle to be initialized
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_WATCH_ADD)(
-    IN  PINTERFACE          Interface,
-    IN  PCHAR               Prefix OPTIONAL,
-    IN  PCHAR               Node,
-    IN  PKEVENT             Event,
-    OUT PXENBUS_STORE_WATCH *Watch
+    _In_ PINTERFACE                 Interface,
+    _In_opt_ PSTR                   Prefix,
+    _In_ PSTR                       Node,
+    _In_ PKEVENT                    Event,
+    _Outptr_ PXENBUS_STORE_WATCH    *Watch
     );
 
 /*! \typedef XENBUS_STORE_WATCH_REMOVE
@@ -243,11 +243,11 @@ typedef NTSTATUS
 
     \param Interface The interface header
     \param Watch The watch handle
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_STORE_WATCH_REMOVE)(
-    IN  PINTERFACE          Interface,
-    IN  PXENBUS_STORE_WATCH Watch
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_STORE_WATCH    Watch
     );
 
 /*! \typedef XENBUS_STORE_POLL
@@ -259,10 +259,10 @@ typedef NTSTATUS
     activity then this will block the normal STORE interface DPC so this
     method must be regularly invoked during the spin loop to check for
     XenStore activity
-*/  
+*/
 typedef VOID
 (*XENBUS_STORE_POLL)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_STORE_PERMISSIONS_SET
@@ -279,16 +279,16 @@ typedef VOID
 */
 typedef NTSTATUS
 (*XENBUS_STORE_PERMISSIONS_SET)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    IN  PXENBUS_STORE_PERMISSION    Permissions,
-    IN  ULONG                       NumberPermissions
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PSTR                       Prefix,
+    _In_ PSTR                           Node,
+    _In_ PXENBUS_STORE_PERMISSION       Permissions,
+    _In_ ULONG                          NumberPermissions
     );
 
 // {86824C3B-D34E-4753-B281-2F1E3AD214D7}
-DEFINE_GUID(GUID_XENBUS_STORE_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_STORE_INTERFACE,
 0x86824c3b, 0xd34e, 0x4753, 0xb2, 0x81, 0x2f, 0x1e, 0x3a, 0xd2, 0x14, 0xd7);
 
 /*! \struct _XENBUS_STORE_INTERFACE_V2
diff --git a/include/suspend_interface.h b/include/suspend_interface.h
index 4176dc3..a20f616 100644
--- a/include/suspend_interface.h
+++ b/include/suspend_interface.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -52,27 +52,27 @@ typedef enum _XENBUS_SUSPEND_CALLBACK_TYPE {
 
 /*! \typedef XENBUS_SUSPEND_CALLBACK
     \brief Suspend callback handle
-*/  
+*/
 typedef struct _XENBUS_SUSPEND_CALLBACK   XENBUS_SUSPEND_CALLBACK, 
*PXENBUS_SUSPEND_CALLBACK;
 
 /*! \typedef XENBUS_SUSPEND_ACQUIRE
     \brief Acquire a reference to the SUSPEND interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_SUSPEND_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_SUSPEND_RELEASE
     \brief Release a reference to the SUSPEND interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_SUSPEND_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_SUSPEND_FUNCTION
@@ -84,10 +84,10 @@ typedef VOID
     vCPUs corralled at the same IRQL as the callback. \a Early callback
     functions are always invoked with IRQL == HIGH_LEVEL and \a Late callback
     functions are always invoked with IRQL == DISPATCH_LEVEL
-*/  
+*/
 typedef VOID
 (*XENBUS_SUSPEND_FUNCTION)(
-    IN  PVOID   Argument
+    _In_ PVOID  Argument
     );
 
 /*! \typedef XENBUS_SUSPEND_REGISTER
@@ -98,14 +98,14 @@ typedef VOID
     \param Function The callback function
     \param Argument An optional context argument passed to the callback
     \param Callback A pointer to a callback handle to be initialized
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_SUSPEND_REGISTER)(
-    IN  PINTERFACE                      Interface,
-    IN  XENBUS_SUSPEND_CALLBACK_TYPE    Type,
-    IN  XENBUS_SUSPEND_FUNCTION         Function,
-    IN  PVOID                           Argument OPTIONAL,
-    OUT PXENBUS_SUSPEND_CALLBACK        *Callback
+    _In_ PINTERFACE                     Interface,
+    _In_ XENBUS_SUSPEND_CALLBACK_TYPE   Type,
+    _In_ XENBUS_SUSPEND_FUNCTION        Function,
+    _In_opt_ PVOID                      Argument,
+    _Outptr_ PXENBUS_SUSPEND_CALLBACK   *Callback
     );
 
 /*! \typedef XENBUS_SUSPEND_DEREGISTER
@@ -116,8 +116,8 @@ typedef NTSTATUS
 */
 typedef VOID
 (*XENBUS_SUSPEND_DEREGISTER)(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_SUSPEND_CALLBACK    Callback
+    _In_ PINTERFACE                 Interface,
+    _In_ PXENBUS_SUSPEND_CALLBACK   Callback
     );
 
 /*! \typedef XENBUS_SUSPEND_TRIGGER
@@ -129,7 +129,7 @@ typedef VOID
 */
 typedef NTSTATUS
 (*XENBUS_SUSPEND_TRIGGER)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_SUSPEND_GET_COUNT
@@ -140,7 +140,7 @@ typedef NTSTATUS
 */
 typedef ULONG
 (*XENBUS_SUSPEND_GET_COUNT)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 // {0554F2AF-B510-4C71-AC03-1C503E394238}
diff --git a/src/xenvkbd/assert.h b/src/xenvkbd/assert.h
index fe76f98..ec2650c 100644
--- a/src/xenvkbd/assert.h
+++ b/src/xenvkbd/assert.h
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
  * that the following conditions are met:
- * 
- * *   Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the
  *     following disclaimer.
- * *   Redistributions in binary form must reproduce the above 
- *     copyright notice, this list of conditions and the 
- *     following disclaimer in the documentation and/or other 
+ * *   Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the
+ *     following disclaimer in the documentation and/or other
  *     materials provided with the distribution.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
@@ -39,11 +39,11 @@
 
 static FORCEINLINE VOID
 __Bug(
-    IN  ULONG       Code,
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG      Code,
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
 #pragma prefast(suppress:28159)
@@ -58,8 +58,8 @@ __Bug(
 
 #define BUG(_TEXT)                                              \
         do {                                                    \
-            const CHAR  *_Text = (_TEXT);                       \
-            const CHAR  *_File = __FILE__;                      \
+            PCSTR       _Text = (_TEXT);                       \
+            PCSTR       _File = __FILE__;                      \
             ULONG       _Line = __LINE__;                       \
                                                                 \
             Error("BUG: " _TEXT "\n");                          \
@@ -89,7 +89,7 @@ __Bug(
 #define ASSERT(_EXP)                    \
         do {                            \
             __ASSERT(_EXP);             \
-            __analysis_assume(_EXP);    \
+            _Analysis_assume_(_EXP);    \
         } while (FALSE)
 
 #define ASSERT3U(_X, _OP, _Y)                       \
@@ -132,7 +132,7 @@ __Bug(
 
 #define ASSERT(_EXP)                    \
         do {                            \
-            __analysis_assume(_EXP);    \
+            _Analysis_assume_(_EXP);    \
         } while (FALSE)
 
 #define ASSERT3U(_X, _OP, _Y)           \
@@ -154,10 +154,10 @@ __Bug(
 
 static __inline BOOLEAN
 _IsZeroMemory(
-    IN  const PCHAR Caller,
-    IN  const PCHAR Name,
-    IN  PVOID       Buffer,
-    IN  ULONG       Length
+    _In_ PCSTR      Caller,
+    _In_ PCSTR      Name,
+    _In_ PVOID      Buffer,
+    _In_ ULONG      Length
     )
 {
     ULONG           Offset;
@@ -178,10 +178,10 @@ _IsZeroMemory(
 
 static __inline BOOLEAN
 _IsZeroMemory(
-    IN  const PCHAR Caller,
-    IN  const PCHAR Name,
-    IN  PVOID       Buffer,
-    IN  ULONG       Length
+    _In_ PCSTR  Caller,
+    _In_ PCSTR  Name,
+    _In_ PVOID  Buffer,
+    _In_ ULONG  Length
     )
 {
     UNREFERENCED_PARAMETER(Caller);
diff --git a/src/xenvkbd/dbg_print.h b/src/xenvkbd/dbg_print.h
index dc9f8b1..6ab4606 100644
--- a/src/xenvkbd/dbg_print.h
+++ b/src/xenvkbd/dbg_print.h
@@ -44,8 +44,8 @@
 
 static __inline VOID
 __Error(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
@@ -67,8 +67,8 @@ __Error(
 
 static __inline VOID
 __Warning(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
@@ -92,8 +92,8 @@ __Warning(
 
 static __inline VOID
 __Trace(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
@@ -110,28 +110,16 @@ __Trace(
     va_end(Arguments);
 }
 
-#else   // DBG
-
-static __inline VOID
-__Trace(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
-    ...
-    )
-{
-    UNREFERENCED_PARAMETER(Prefix);
-    UNREFERENCED_PARAMETER(Format);
-}
-
-#endif  // DBG
-
 #define Trace(...)  \
         __Trace(__MODULE__ "|" __FUNCTION__ ": ", __VA_ARGS__)
+#else   // DBG
+#define Trace(...)  (VOID)(__VA_ARGS__)
+#endif  // DBG
 
 static __inline VOID
 __Info(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ PCSTR      Prefix,
+    _In_ PCSTR      Format,
     ...
     )
 {
diff --git a/src/xenvkbd/util.h b/src/xenvkbd/util.h
index 495162e..431f433 100644
--- a/src/xenvkbd/util.h
+++ b/src/xenvkbd/util.h
@@ -38,12 +38,12 @@
 
 #include "assert.h"
 
-#define        P2ROUNDUP(_x, _a)   \
-        (-(-(_x) & -(_a)))
+#define        P2ROUNDUP(_t, _x, _a)   \
+        (-(-((_t)(_x)) & -(((_t)(_a)))))
 
 static FORCEINLINE LONG
 __ffs(
-    IN  unsigned long long  mask
+    _In_ unsigned long long mask
     )
 {
     unsigned char           *array = (unsigned char *)&mask;
@@ -82,14 +82,14 @@ __ffs(
 
 static FORCEINLINE VOID
 __CpuId(
-    IN  ULONG   Leaf,
-    OUT PULONG  EAX OPTIONAL,
-    OUT PULONG  EBX OPTIONAL,
-    OUT PULONG  ECX OPTIONAL,
-    OUT PULONG  EDX OPTIONAL
+    _In_ ULONG          Leaf,
+    _Out_opt_ PULONG    EAX,
+    _Out_opt_ PULONG    EBX,
+    _Out_opt_ PULONG    ECX,
+    _Out_opt_ PULONG    EDX
     )
 {
-    int         Value[4] = {0};
+    int                 Value[4] = {0};
 
     __cpuid(Value, Leaf);
 
@@ -108,12 +108,12 @@ __CpuId(
 
 static FORCEINLINE LONG
 __InterlockedAdd(
-    IN  LONG    *Value,
-    IN  LONG    Delta
+    _Inout_ LONG    *Value,
+    _In_ LONG       Delta
     )
 {
-    LONG        New;
-    LONG        Old;
+    LONG            New;
+    LONG            Old;
 
     do {
         Old = *Value;
@@ -125,12 +125,12 @@ __InterlockedAdd(
 
 static FORCEINLINE LONG
 __InterlockedSubtract(
-    IN  LONG    *Value,
-    IN  LONG    Delta
+    _Inout_ LONG    *Value,
+    _In_ LONG       Delta
     )
 {
-    LONG        New;
-    LONG        Old;
+    LONG            New;
+    LONG            Old;
 
     do {
         Old = *Value;
@@ -140,23 +140,24 @@ __InterlockedSubtract(
     return New;
 }
 
-__checkReturn
+_Check_return_
 static FORCEINLINE PVOID
 __AllocatePoolWithTag(
-    IN  POOL_TYPE   PoolType,
-    IN  SIZE_T      NumberOfBytes,
-    IN  ULONG       Tag
+    _In_ POOL_TYPE  PoolType,
+    _In_ SIZE_T     NumberOfBytes,
+    _In_ ULONG      Tag
     )
 {
     PUCHAR          Buffer;
 
-    __analysis_assume(PoolType == NonPagedPool ||
+    _Analysis_assume_(PoolType == NonPagedPool ||
                       PoolType == PagedPool);
 
     if (NumberOfBytes == 0)
         return NULL;
 
 #if (_MSC_VER >= 1928) // VS 16.9 (EWDK 20344 or later)
+#pragma warning(suppress:28160) // annotation error
     Buffer = ExAllocatePoolUninitialized(PoolType, NumberOfBytes, Tag);
 #else
 #pragma warning(suppress:28160) // annotation error
@@ -171,8 +172,8 @@ __AllocatePoolWithTag(
 
 static FORCEINLINE VOID
 __FreePoolWithTag(
-    IN  PVOID   Buffer,
-    IN  ULONG   Tag
+    _In_ PVOID  Buffer,
+    _In_ ULONG  Tag
     )
 {
     ExFreePoolWithTag(Buffer, Tag);
@@ -180,7 +181,7 @@ __FreePoolWithTag(
 
 static FORCEINLINE PMDL
 __AllocatePages(
-    IN  ULONG           Count
+    _In_ ULONG          Count
     )
 {
     PHYSICAL_ADDRESS    LowAddress;
@@ -249,10 +250,10 @@ fail1:
 
 static FORCEINLINE VOID
 __FreePages(
-    IN PMDL    Mdl
+    _In_ PMDL   Mdl
     )
 {
-    PUCHAR     MdlMappedSystemVa;
+    PUCHAR      MdlMappedSystemVa;
 
     ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
     MdlMappedSystemVa = Mdl->MappedSystemVa;
@@ -265,15 +266,17 @@ __FreePages(
 
 #define __FreePage(_Mdl)    __FreePages(_Mdl)
 
-static FORCEINLINE PCHAR
+static FORCEINLINE PSTR
 __strtok_r(
-    IN      PCHAR   Buffer,
-    IN      PCHAR   Delimiter,
-    IN OUT  PCHAR   *Context
+    _Inout_opt_ PSTR    Buffer,
+    _In_ PSTR           Delimiter,
+    _When_(Buffer != NULL, _Outptr_)
+    _When_(Buffer == NULL, _Inout_)
+    PSTR                *Context
     )
 {
-    PCHAR           Token;
-    PCHAR           End;
+    PSTR                Token;
+    PSTR                End;
 
     if (Buffer != NULL)
         *Context = Buffer;
@@ -303,15 +306,17 @@ __strtok_r(
     return Token;
 }
 
-static FORCEINLINE PWCHAR
+static FORCEINLINE PWSTR
 __wcstok_r(
-    IN      PWCHAR  Buffer,
-    IN      PWCHAR  Delimiter,
-    IN OUT  PWCHAR  *Context
+    _Inout_opt_ PWSTR   Buffer,
+    _In_ PWSTR          Delimiter,
+    _When_(Buffer != NULL, _Outptr_)
+    _When_(Buffer == NULL, _Inout_)
+    PWSTR               *Context
     )
 {
-    PWCHAR          Token;
-    PWCHAR          End;
+    PWSTR               Token;
+    PWSTR               End;
 
     if (Buffer != NULL)
         *Context = Buffer;
@@ -343,7 +348,7 @@ __wcstok_r(
 
 static FORCEINLINE CHAR
 __toupper(
-    IN  CHAR    Character
+    _In_ CHAR   Character
     )
 {
     if (Character < 'a' || Character > 'z')
@@ -354,7 +359,7 @@ __toupper(
 
 static FORCEINLINE CHAR
 __tolower(
-    IN  CHAR    Character
+    _In_ CHAR   Character
     )
 {
     if (Character < 'A' || Character > 'Z')
-- 
2.55.0.windows.5



--
Césaire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.