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

[XENBUS PATCH 01/13] Replace old annotations with SAL2 equivalents



* Do a mechanical search-and-replace, where IN and OUT are replaced with
  _In_ and _Out_ respectively
* Parameters annotated with OPTIONAL use the _opt_ equivalents
* Replace __drv IRQL annotations with the _IRQL_ ones
* Existing functions with function class declarations are converted to
  a predeclaration and _Use_decl_annotations_ to check for mismatch

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 include/balloon_interface.h     |  68 +--
 include/cache_interface.h       | 130 ++---
 include/console_interface.h     |  30 +-
 include/debug_interface.h       |  88 ++--
 include/emulated_interface.h    |  78 +--
 include/evtchn_interface.h      | 136 ++---
 include/gnttab_interface.h      | 148 +++---
 include/range_set_interface.h   | 100 ++--
 include/shared_info_interface.h | 106 ++--
 include/store_interface.h       | 156 +++---
 include/suspend_interface.h     |  80 +--
 include/unplug_interface.h      |  72 +--
 include/xen.h                   | 330 ++++++------
 src/common/assert.h             |  72 +--
 src/common/dbg_print.h          |  62 +--
 src/common/high.h               |  63 ++-
 src/common/mutex.h              |  60 +--
 src/common/names.h              |  82 +--
 src/common/registry.c           | 218 ++++----
 src/common/registry.h           | 186 +++----
 src/common/util.h               |  54 +-
 src/monitor/monitor.c           |  43 +-
 src/xen/acpi.c                  |  60 +--
 src/xen/acpi.h                  |  52 +-
 src/xen/bug_check.c             | 149 +++---
 src/xen/config.c                |  26 +-
 src/xen/driver.c                | 120 ++---
 src/xen/driver.h                |   6 +-
 src/xen/event_channel.c         | 116 ++---
 src/xen/filters.c               |  16 +-
 src/xen/grant_table.c           |  90 ++--
 src/xen/hvm.c                   |  80 +--
 src/xen/log.c                   | 140 ++---
 src/xen/memory.c                |  78 +--
 src/xen/module.c                |  84 +--
 src/xen/process.c               |  56 +-
 src/xen/process.h               |  48 +-
 src/xen/sched.c                 |  64 +--
 src/xen/system.c                | 119 ++---
 src/xen/unplug.c                |  30 +-
 src/xen/vcpu.c                  |  20 +-
 src/xen/xen_version.c           |  66 +--
 src/xenbus/balloon.c            | 214 ++++----
 src/xenbus/balloon.h            |  62 +--
 src/xenbus/bus.c                | 138 ++---
 src/xenbus/bus.h                |  52 +-
 src/xenbus/cache.c              | 218 ++++----
 src/xenbus/cache.h              |  62 +--
 src/xenbus/console.c            | 136 ++---
 src/xenbus/console.h            |  16 +-
 src/xenbus/debug.c              | 134 ++---
 src/xenbus/debug.h              |  62 +--
 src/xenbus/dma.c                | 521 +++++++++----------
 src/xenbus/dma.h                |  54 +-
 src/xenbus/driver.c             |  97 ++--
 src/xenbus/driver.h             |  50 +-
 src/xenbus/evtchn.c             | 244 ++++-----
 src/xenbus/evtchn.h             |  64 +--
 src/xenbus/evtchn_2l.c          |  96 ++--
 src/xenbus/evtchn_2l.h          |  56 +-
 src/xenbus/evtchn_abi.h         |  86 ++--
 src/xenbus/evtchn_fifo.c        | 172 +++----
 src/xenbus/evtchn_fifo.h        |  56 +-
 src/xenbus/fdo.c                | 886 ++++++++++++++++----------------
 src/xenbus/fdo.h                | 176 +++----
 src/xenbus/gnttab.c             | 200 +++----
 src/xenbus/gnttab.h             |  62 +--
 src/xenbus/hash_table.c         | 100 ++--
 src/xenbus/hash_table.h         |  68 +--
 src/xenbus/pdo.c                | 374 +++++++-------
 src/xenbus/pdo.h                | 114 ++--
 src/xenbus/range_set.c          | 160 +++---
 src/xenbus/range_set.h          |  62 +--
 src/xenbus/shared_info.c        | 152 +++---
 src/xenbus/shared_info.h        |  62 +--
 src/xenbus/store.c              | 436 ++++++++--------
 src/xenbus/store.h              |  62 +--
 src/xenbus/suspend.c            | 108 ++--
 src/xenbus/suspend.h            |  62 +--
 src/xenbus/sync.c               |  98 ++--
 src/xenbus/sync.h               |  74 +--
 src/xenbus/thread.c             |  74 +--
 src/xenbus/thread.h             |  64 +--
 src/xenbus/unplug.c             |  52 +-
 src/xenbus/unplug.h             |  16 +-
 src/xenfilt/driver.c            | 110 ++--
 src/xenfilt/driver.h            |  66 +--
 src/xenfilt/emulated.c          | 126 ++---
 src/xenfilt/emulated.h          |  74 +--
 src/xenfilt/fdo.c               | 278 +++++-----
 src/xenfilt/fdo.h               |  76 +--
 src/xenfilt/pdo.c               | 293 +++++------
 src/xenfilt/pdo.h               |  80 +--
 src/xenfilt/thread.c            |  78 +--
 src/xenfilt/thread.h            |  64 +--
 95 files changed, 5555 insertions(+), 5524 deletions(-)

diff --git a/include/balloon_interface.h b/include/balloon_interface.h
index b9a64c6..ad2c20d 100644
--- a/include/balloon_interface.h
+++ b/include/balloon_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.
  */
 
@@ -46,20 +46,20 @@
     \brief Acquire a reference to the BALLOON interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_BALLOON_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_BALLOON_RELEASE
     \brief Release a reference to the BALLOON interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_BALLOON_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_BALLOON_ADJUST
@@ -67,31 +67,31 @@ typedef VOID
 
     \param Interface The interface header
     \param Size The target size of the balloon in pages
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_BALLOON_ADJUST)(
-    IN  PINTERFACE  Interface,
-    IN  ULONGLONG   Size
+    _In_ PINTERFACE Interface,
+    _In_ ULONGLONG  Size
     );
 
 /*! \typedef XENBUS_BALLOON_GET_SIZE
     \brief Return the current size of the balloon in pages
 
     \param Interface The interface header
-*/  
+*/
 typedef ULONGLONG
 (*XENBUS_BALLOON_GET_SIZE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 // {D92AA810-BECB-4BD5-A3DA-BD03C135A297}
-DEFINE_GUID(GUID_XENBUS_BALLOON_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_BALLOON_INTERFACE,
 0xd92aa810, 0xbecb, 0x4bd5, 0xa3, 0xda, 0xbd, 0x3, 0xc1, 0x35, 0xa2, 0x97);
 
 /*! \struct _XENBUS_BALLOON_INTERFACE_V1
     \brief BALLOON interface version 1
     \ingroup interfaces
-*/  
+*/
 struct _XENBUS_BALLOON_INTERFACE_V1 {
     INTERFACE                   Interface;
     XENBUS_BALLOON_ACQUIRE      BalloonAcquire;
diff --git a/include/cache_interface.h b/include/cache_interface.h
index 97fa315..dcf0222 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_ 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_opt_ PVOID                  Argument,
+    _Out_ 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_ 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_opt_ PVOID                  Argument,
+    _Out_ 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/console_interface.h b/include/console_interface.h
index 6b4ba7a..9235862 100644
--- a/include/console_interface.h
+++ b/include/console_interface.h
@@ -53,7 +53,7 @@ typedef struct _XENBUS_CONSOLE_WAKEUP   
XENBUS_CONSOLE_WAKEUP, *PXENBUS_CONSOLE_
 */
 typedef NTSTATUS
 (*XENBUS_CONSOLE_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_CONSOLE_RELEASE
@@ -63,7 +63,7 @@ typedef NTSTATUS
 */
 typedef VOID
 (*XENBUS_CONSOLE_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_CONSOLE_CAN_READ
@@ -75,7 +75,7 @@ typedef VOID
 */
 typedef BOOLEAN
 (*XENBUS_CONSOLE_CAN_READ)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_CONSOLE_READ
@@ -89,9 +89,9 @@ typedef BOOLEAN
 */
 typedef ULONG
 (*XENBUS_CONSOLE_READ)(
-    IN  PINTERFACE  Interface,
-    IN  PCHAR       Data,
-    IN  ULONG       Length
+    _In_ PINTERFACE Interface,
+    _In_ PCHAR      Data,
+    _In_ ULONG      Length
     );
 
 /*! \typedef XENBUS_CONSOLE_CAN_WRITE
@@ -103,7 +103,7 @@ typedef ULONG
 */
 typedef BOOLEAN
 (*XENBUS_CONSOLE_CAN_WRITE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_CONSOLE_WRITE
@@ -117,9 +117,9 @@ typedef BOOLEAN
 */
 typedef ULONG
 (*XENBUS_CONSOLE_WRITE)(
-    IN  PINTERFACE  Interface,
-    IN  PCHAR       Data,
-    IN  ULONG       Length
+    _In_ PINTERFACE Interface,
+    _In_ PCHAR      Data,
+    _In_ ULONG      Length
     );
 
 /*! \typedef XENBUS_CONSOLE_WAKEUP_ADD
@@ -132,9 +132,9 @@ typedef ULONG
 */
 typedef NTSTATUS
 (*XENBUS_CONSOLE_WAKEUP_ADD)(
-    IN  PINTERFACE             Interface,
-    IN  PKEVENT                Event,
-    OUT PXENBUS_CONSOLE_WAKEUP *Wakeup
+    _In_ PINTERFACE                 Interface,
+    _In_ PKEVENT                    Event,
+    _Out_ PXENBUS_CONSOLE_WAKEUP    *Wakeup
     );
 
 /*! \typedef XENBUS_CONSOLE_WAKEUP_REMOVE
@@ -145,8 +145,8 @@ typedef NTSTATUS
 */
 typedef VOID
 (*XENBUS_CONSOLE_WAKEUP_REMOVE)(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_CONSOLE_WAKEUP  Wakeup
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_CONSOLE_WAKEUP Wakeup
     );
 
 // {04c4f738-034a-4268-bd20-a92ac90d4f82}
diff --git a/include/debug_interface.h b/include/debug_interface.h
index 79729c7..77f40ba 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_ PCHAR                      Prefix,
+    _In_ XENBUS_DEBUG_FUNCTION      Function,
+    _In_opt_ PVOID                  Argument,
+    _Out_ 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_ const CHAR             *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/emulated_interface.h b/include/emulated_interface.h
index ad5975d..7920c44 100644
--- a/include/emulated_interface.h
+++ b/include/emulated_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.
  */
 
@@ -46,20 +46,20 @@
     \brief Acquire a reference to the EMULATED interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENFILT_EMULATED_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENFILT_EMULATED_RELEASE
     \brief Release a reference to the EMULATED interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENFILT_EMULATED_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENFILT_EMULATED_IS_DEVICE_PRESENT
@@ -71,20 +71,20 @@ typedef VOID
            NULL to match any device instance
     \return TRUE if the specified device is present in the system or
     FALSE if it is not
-*/  
+*/
 typedef BOOLEAN
 (*XENFILT_EMULATED_IS_DEVICE_PRESENT)(
-    IN  PVOID   Context,
-    IN  PCHAR   DeviceID,
-    IN  PCHAR   InstanceID OPTIONAL
+    _In_ PVOID      Context,
+    _In_ PCHAR      DeviceID,
+    _In_opt_ PCHAR  InstanceID
     );
 
 typedef BOOLEAN
 (*XENFILT_EMULATED_IS_DISK_PRESENT_V1)(
-    IN  PVOID   Context,
-    IN  ULONG   Controller,
-    IN  ULONG   Target,
-    IN  ULONG   Lun
+    _In_ PVOID  Context,
+    _In_ ULONG  Controller,
+    _In_ ULONG  Target,
+    _In_ ULONG  Lun
     );
 /*! \typedef XENFILT_EMULATED_IS_DISK_PRESENT
     \brief Determine whether a given emulated disk is present in the VM
@@ -94,15 +94,15 @@ typedef BOOLEAN
                  emulated device is aliasing
     \return TRUE if an emulated disk aliasing the specified paravirtual
     disk index is present in the system or FALSE if not
-*/  
+*/
 typedef BOOLEAN
 (*XENFILT_EMULATED_IS_DISK_PRESENT)(
-    IN  PVOID   Context,
-    IN  ULONG   Index
+    _In_ PVOID  Context,
+    _In_ ULONG  Index
     );
 
 // {959027A1-FCCE-4E78-BCF4-637384F499C5}
-DEFINE_GUID(GUID_XENFILT_EMULATED_INTERFACE, 
+DEFINE_GUID(GUID_XENFILT_EMULATED_INTERFACE,
 0x959027a1, 0xfcce, 0x4e78, 0xbc, 0xf4, 0x63, 0x73, 0x84, 0xf4, 0x99, 0xc5);
 
 /*! \struct _XENFILT_EMULATED_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..1bc9c4e 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_ const CHAR                 *Name,
+    _In_ ULONG                      Reservation,
+    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
+    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
+    _In_opt_ PVOID                  Argument,
+    _Out_ 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_ const CHAR                 *Name,
+    _In_ ULONG                      Reservation,
+    _In_ ULONG                      Cap,
+    _In_ XENBUS_CACHE_ACQUIRE_LOCK  AcquireLock,
+    _In_ XENBUS_CACHE_RELEASE_LOCK  ReleaseLock,
+    _In_opt_ PVOID                  Argument,
+    _Out_ 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,
+    _Out_ 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..7b18eb9 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_ const CHAR                 *Name,
+    _Out_ 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/shared_info_interface.h b/include/shared_info_interface.h
index 7aaf4f5..5fdedfd 100644
--- a/include/shared_info_interface.h
+++ b/include/shared_info_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.
  */
 
@@ -45,20 +45,20 @@
     \brief Acquire a reference to the SHARED_INFO interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_SHARED_INFO_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_SHARED_INFO_RELEASE
     \brief Release a reference to the SHARED_INFO interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_SHARED_INFO_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_SHARED_INFO_UPCALL_SUPPORTED
@@ -66,8 +66,8 @@ typedef VOID
 */
 typedef BOOLEAN
 (*XENBUS_SHARED_INFO_UPCALL_SUPPORTED)(
-    IN  PINTERFACE  Interface,
-    IN  ULONG       Index
+    _In_ PINTERFACE Interface,
+    _In_ ULONG      Index
     );
 
 /*! \typedef XENBUS_SHARED_INFO_UPCALL_PENDING
@@ -75,57 +75,57 @@ typedef BOOLEAN
 */
 typedef BOOLEAN
 (*XENBUS_SHARED_INFO_UPCALL_PENDING)(
-    IN  PINTERFACE  Interface,
-    IN  ULONG       Index
+    _In_ PINTERFACE Interface,
+    _In_ ULONG      Index
     );
 
 typedef BOOLEAN
 (*XENBUS_SHARED_INFO_EVENT)(
-    IN  PVOID   Argument,
-    IN  ULONG   Port
+    _In_ PVOID  Argument,
+    _In_ ULONG  Port
     );
 
 /*! \typedef XENBUS_SHARED_INFO_EVTCHN_POLL
     \brief Private method for EVTCHN inerface
-*/  
+*/
 typedef BOOLEAN
 (*XENBUS_SHARED_INFO_EVTCHN_POLL)(
-    IN  PINTERFACE                  Interface,
-    IN  ULONG                       Index,
-    IN  XENBUS_SHARED_INFO_EVENT    Event,
-    IN  PVOID                       Argument
+    _In_ PINTERFACE                 Interface,
+    _In_ ULONG                      Index,
+    _In_ XENBUS_SHARED_INFO_EVENT   Event,
+    _In_ PVOID                      Argument
     );
 
 /*! \typedef XENBUS_SHARED_INFO_EVTCHN_ACK
     \brief Private method for EVTCHN inerface
-*/  
+*/
 typedef VOID
 (*XENBUS_SHARED_INFO_EVTCHN_ACK)(
-    IN  PINTERFACE  Interface,
-    IN  ULONG       Port
+    _In_ PINTERFACE Interface,
+    _In_ ULONG      Port
     );
 
 /*! \typedef XENBUS_SHARED_INFO_EVTCHN_MASK
     \brief Private method for EVTCHN inerface
-*/  
+*/
 typedef VOID
 (*XENBUS_SHARED_INFO_EVTCHN_MASK)(
-    IN  PINTERFACE  Interface,
-    IN  ULONG       Port
+    _In_ PINTERFACE Interface,
+    _In_ ULONG      Port
     );
 
 /*! \typedef XENBUS_SHARED_INFO_EVTCHN_UNMASK
     \brief Private method for EVTCHN inerface
-*/  
+*/
 typedef BOOLEAN
 (*XENBUS_SHARED_INFO_EVTCHN_UNMASK)(
-    IN  PINTERFACE  Interface,
-    IN  ULONG       Port
+    _In_ PINTERFACE Interface,
+    _In_ ULONG      Port
     );
 
 typedef LARGE_INTEGER
 (*XENBUS_SHARED_INFO_GET_TIME_V2)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_SHARED_INFO_GET_TIME
@@ -134,16 +134,16 @@ typedef LARGE_INTEGER
     \param Interface The interface header
     \param Time The wallclock time
     \param Local Set, on return, if the wallclock is in local time
-*/  
+*/
 typedef VOID
 (*XENBUS_SHARED_INFO_GET_TIME)(
-    IN  PINTERFACE      Interface,
-    OUT PLARGE_INTEGER  Time,
-    OUT PBOOLEAN        Local
+    _In_ PINTERFACE         Interface,
+    _Out_ PLARGE_INTEGER    Time,
+    _Out_ PBOOLEAN          Local
     );
 
 // {7E73C34F-1640-4649-A8F3-263BC930A004}
-DEFINE_GUID(GUID_XENBUS_SHARED_INFO_INTERFACE, 
+DEFINE_GUID(GUID_XENBUS_SHARED_INFO_INTERFACE,
 0x7e73c34f, 0x1640, 0x4649, 0xa8, 0xf3, 0x26, 0x3b, 0xc9, 0x30, 0xa0, 0x4);
 
 /*! \struct _XENBUS_SHARED_INFO_INTERFACE_V2
diff --git a/include/store_interface.h b/include/store_interface.h
index ca883bd..4521ba7 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_ PCHAR      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_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _Out_ PCHAR                         *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_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _In_ const CHAR                     *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_ PCHAR                      Prefix,
+    _In_ PCHAR                          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_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _Out_ PCHAR                         *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,
+    _Out_ 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_ PCHAR              Prefix,
+    _In_ PCHAR                  Node,
+    _In_ PKEVENT                Event,
+    _Out_ 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_ PCHAR                      Prefix,
+    _In_ PCHAR                          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..1444373 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,
+    _Out_ 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/include/unplug_interface.h b/include/unplug_interface.h
index dad3afc..7b030e7 100644
--- a/include/unplug_interface.h
+++ b/include/unplug_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.
  */
 
@@ -45,20 +45,20 @@
     \brief Acquire a reference to the UNPLUG interface
 
     \param Interface The interface header
-*/  
+*/
 typedef NTSTATUS
 (*XENBUS_UNPLUG_ACQUIRE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \typedef XENBUS_UNPLUG_RELEASE
     \brief Release a reference to the UNPLUG interface
 
     \param Interface The interface header
-*/  
+*/
 typedef VOID
 (*XENBUS_UNPLUG_RELEASE)(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     );
 
 /*! \enum _XENBUS_UNPLUG_DEVICE_TYPE
@@ -77,12 +77,12 @@ typedef enum _XENBUS_UNPLUG_DEVICE_TYPE {
     \param Type The type of device
     \param Make Set to TRUE if the request is being made, FALSE if it is
            being revoked.
-*/  
+*/
 typedef VOID
 (*XENBUS_UNPLUG_REQUEST)(
-    IN  PINTERFACE                  Interface,
-    IN  XENBUS_UNPLUG_DEVICE_TYPE   Type,
-    IN  BOOLEAN                     Make
+    _In_ PINTERFACE                 Interface,
+    _In_ XENBUS_UNPLUG_DEVICE_TYPE  Type,
+    _In_ BOOLEAN                    Make
     );
 
 /*! \typedef XENBUS_UNPLUG_IS_REQUESTED
@@ -95,8 +95,8 @@ typedef VOID
 */
 typedef BOOLEAN
 (*XENBUS_UNPLUG_IS_REQUESTED)(
-    IN  PINTERFACE                  Interface,
-    IN  XENBUS_UNPLUG_DEVICE_TYPE   Type
+    _In_ PINTERFACE                 Interface,
+    _In_ XENBUS_UNPLUG_DEVICE_TYPE  Type
     );
 
 /*! \typedef XENBUS_UNPLUG_BOOT_EMULATED
@@ -106,7 +106,7 @@ typedef BOOLEAN
 */
 typedef BOOLEAN
 (*XENBUS_UNPLUG_BOOT_EMULATED)(
-    IN  PINTERFACE                  Interface
+    _In_ PINTERFACE                 Interface
     );
 
 /*! \typedef XENBUS_UNPLUG_REBOOT
@@ -117,8 +117,8 @@ typedef BOOLEAN
 */
 typedef VOID
 (*XENBUS_UNPLUG_REBOOT)(
-    IN  PINTERFACE                  Interface,
-    IN  PCHAR                       Module
+    _In_ PINTERFACE                 Interface,
+    _In_ PCHAR                      Module
     );
 
 // {73db6517-3d06-4937-989f-199b7501e229}
diff --git a/include/xen.h b/include/xen.h
index a874ed1..1ba109c 100644
--- a/include/xen.h
+++ b/include/xen.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.
  */
 
@@ -69,11 +69,11 @@
 XEN_API
 NTSTATUS
 XenTouch(
-    IN  const CHAR  *Name,
-    IN  ULONG       MajorVersion,
-    IN  ULONG       MinorVersion,
-    IN  ULONG       MicroVersion,
-    IN  ULONG       BuildNumber
+    _In_ const CHAR *Name,
+    _In_ ULONG      MajorVersion,
+    _In_ ULONG      MinorVersion,
+    _In_ ULONG      MicroVersion,
+    _In_ ULONG      BuildNumber
     );
 
 // HYPERCALL
@@ -86,229 +86,229 @@ HypercallPopulate(
 
 // HVM
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 HvmSetParam(
-    IN  ULONG       Parameter,
-    IN  ULONGLONG   Value
+    _In_ ULONG      Parameter,
+    _In_ ULONGLONG  Value
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 HvmGetParam(
-    IN  ULONG       Parameter,
-    OUT PULONGLONG  Value
+    _In_ ULONG          Parameter,
+    _Out_ PULONGLONG    Value
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 HvmPagetableDying(
-    IN  PHYSICAL_ADDRESS    Address
+    _In_ PHYSICAL_ADDRESS   Address
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 HvmSetEvtchnUpcallVector(
-    IN  unsigned int    vcpu_id,
-    IN  UCHAR           Vector
+    _In_ unsigned int   vcpu_id,
+    _In_ UCHAR          Vector
     );
 
 // MEMORY
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 MemoryAddToPhysmap(
-    IN  PFN_NUMBER  Pfn,
-    IN  ULONG       Space,
-    IN  ULONG_PTR   Offset
+    _In_ PFN_NUMBER Pfn,
+    _In_ ULONG      Space,
+    _In_ ULONG_PTR  Offset
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 MemoryRemoveFromPhysmap(
-    IN  PFN_NUMBER  Pfn
+    _In_ PFN_NUMBER Pfn
     );
 
 #define PAGE_ORDER_4K   0
 #define PAGE_ORDER_2M   9
 
-__checkReturn
+_Check_return_
 XEN_API
 ULONG
 MemoryDecreaseReservation(
-    IN  ULONG       Order,
-    IN  ULONG       Count,
-    IN  PPFN_NUMBER PfnArray
+    _In_ ULONG          Order,
+    _In_ ULONG          Count,
+    _In_ PPFN_NUMBER    PfnArray
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 ULONG
 MemoryPopulatePhysmap(
-    IN  ULONG       Order,
-    IN  ULONG       Count,
-    IN  PPFN_NUMBER PfnArray
+    _In_ ULONG          Order,
+    _In_ ULONG          Count,
+    _In_ PPFN_NUMBER    PfnArray
     );
 
 // EVENT CHANNEL
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelSend(
-    IN  ULONG   Port
+    _In_ ULONG  Port
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelAllocateUnbound(
-    IN  USHORT  Domain,
-    OUT ULONG   *Port
+    _In_ USHORT Domain,
+    _Out_ ULONG *Port
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelBindInterDomain(
-    IN  USHORT  RemoteDomain,
-    IN  ULONG   RemotePort,
-    OUT ULONG   *LocalPort
+    _In_ USHORT RemoteDomain,
+    _In_ ULONG  RemotePort,
+    _Out_ ULONG *LocalPort
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelBindVirq(
-    IN  ULONG           Virq,
-    IN  unsigned int    vcpu_id,
-    OUT ULONG           *LocalPort
+    _In_ ULONG          Virq,
+    _In_ unsigned int   vcpu_id,
+    _Out_ ULONG         *LocalPort
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelQueryInterDomain(
-    IN  ULONG   LocalPort,
-    OUT USHORT  *RemoteDomain,
-    OUT ULONG   *RemotePort
+    _In_ ULONG      LocalPort,
+    _Out_ USHORT    *RemoteDomain,
+    _Out_ ULONG     *RemotePort
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelClose(
-    IN  ULONG   LocalPort
+    _In_ ULONG  LocalPort
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelExpandArray(
-    IN  PFN_NUMBER  Pfn
+    _In_ PFN_NUMBER Pfn
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelInitControl(
-    IN  PFN_NUMBER      Pfn,
-    IN  unsigned int    vcpu_id
+    _In_ PFN_NUMBER     Pfn,
+    _In_ unsigned int   vcpu_id
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelReset(
     VOID
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelBindVirtualCpu(
-    IN  ULONG           LocalPort,
-    IN  unsigned int    vcpu_id
+    _In_ ULONG          LocalPort,
+    _In_ unsigned int   vcpu_id
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelUnmask(
-    IN  ULONG   LocalPort
+    _In_ ULONG  LocalPort
     );
 
 // GRANT TABLE
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableSetVersion(
-    IN  uint32_t    Version
+    _In_ uint32_t   Version
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableGetVersion(
-    OUT uint32_t    *Version
+    _Out_ uint32_t  *Version
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableCopy(
-    IN  struct gnttab_copy  op[],
-    IN  ULONG               Count
+    _In_ struct gnttab_copy op[],
+    _In_ ULONG              Count
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableMapForeignPage(
-    IN  USHORT              Domain,
-    IN  ULONG               GrantRef,
-    IN  PHYSICAL_ADDRESS    Address,
-    IN  BOOLEAN             ReadOnly,
-    OUT ULONG               *Handle
+    _In_ USHORT             Domain,
+    _In_ ULONG              GrantRef,
+    _In_ PHYSICAL_ADDRESS   Address,
+    _In_ BOOLEAN            ReadOnly,
+    _Out_ ULONG             *Handle
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableUnmapForeignPage(
-    IN  ULONG               Handle,
-    IN  PHYSICAL_ADDRESS    Address
+    _In_ ULONG              Handle,
+    _In_ PHYSICAL_ADDRESS   Address
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableQuerySize(
-    OUT uint32_t    *Current OPTIONAL,
-    OUT uint32_t    *Maximum OPTIONAL
+    _Out_opt_ uint32_t      *Current,
+    _Out_opt_ uint32_t      *Maximum
     );
 
 // SCHED
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 SchedShutdownCode(
-    ULONG   Reason
+    _In_ ULONG  Reason
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 SchedShutdown(
-    ULONG   Reason
+    _In_ ULONG  Reason
     );
 
 XEN_API
@@ -320,25 +320,25 @@ SchedYield(
 XEN_API
 NTSTATUS
 SchedWatchdog(
-    IN OUT  PULONG  Id,
-    IN      ULONG   Seconds
+    _Inout_ PULONG  Id,
+    _In_ ULONG      Seconds
     );
 
 // XEN VERSION
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 XenVersion(
-    OUT PULONG  Major,
-    OUT PULONG  Minor
+    _Out_ PULONG    Major,
+    _Out_ PULONG    Minor
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 XenVersionExtra(
-    OUT PCHAR   Extra
+    _Out_writes_(XEN_EXTRAVERSION_LEN) PCHAR    Extra
     );
 
 // MODULE
@@ -346,9 +346,9 @@ XenVersionExtra(
 XEN_API
 VOID
 ModuleLookup(
-    IN  ULONG_PTR   Address,
-    OUT PCHAR       *Name,
-    OUT PULONG_PTR  Offset
+    _In_ ULONG_PTR      Address,
+    _Out_ PCHAR         *Name,
+    _Out_ PULONG_PTR    Offset
     );
 
 // UNPLUG
@@ -368,19 +368,19 @@ UnplugDevices(
 XEN_API
 NTSTATUS
 UnplugIncrementValue(
-    IN  UNPLUG_TYPE Type
+    _In_ UNPLUG_TYPE    Type
     );
 
 XEN_API
 NTSTATUS
 UnplugDecrementValue(
-    IN  UNPLUG_TYPE Type
+    _In_ UNPLUG_TYPE    Type
     );
 
 XEN_API
 BOOLEAN
 UnplugGetRequest(
-    IN  UNPLUG_TYPE Type
+    _In_ UNPLUG_TYPE    Type
     );
 
 // LOG
@@ -397,34 +397,34 @@ typedef enum _LOG_LEVEL {
 XEN_API
 VOID
 LogCchVPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  ULONG       Count,
-    IN  const CHAR  *Format,
-    IN  va_list     Arguments
+    _In_ LOG_LEVEL  Level,
+    _In_ ULONG      Count,
+    _In_ const CHAR *Format,
+    _In_ va_list    Arguments
     );
 
 XEN_API
 VOID
 LogVPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  const CHAR  *Format,
-    IN  va_list     Arguments
+    _In_ LOG_LEVEL  Level,
+    _In_ const CHAR *Format,
+    _In_ va_list    Arguments
     );
 
 XEN_API
 VOID
 LogCchPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  ULONG       Count,
-    IN  const CHAR  *Format,
+    _In_ LOG_LEVEL  Level,
+    _In_ ULONG      Count,
+    _In_ const CHAR *Format,
     ...
     );
 
 XEN_API
 VOID
 LogPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  const CHAR  *Format,
+    _In_ LOG_LEVEL  Level,
+    _In_ const CHAR *Format,
     ...
     );
 
@@ -437,9 +437,9 @@ LogResume(
 XEN_API
 NTSTATUS
 LogReadLogLevel(
-    IN  HANDLE      Key,
-    IN  PCHAR       Name,
-    OUT PLOG_LEVEL  LogLevel
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _Out_ PLOG_LEVEL    LogLevel
     );
 
 typedef struct _LOG_DISPOSITION LOG_DISPOSITION, *PLOG_DISPOSITION;
@@ -447,16 +447,16 @@ typedef struct _LOG_DISPOSITION LOG_DISPOSITION, 
*PLOG_DISPOSITION;
 XEN_API
 NTSTATUS
 LogAddDisposition(
-    IN  LOG_LEVEL           Mask,
-    IN  VOID                (*Function)(PVOID, PCHAR, ULONG),
-    IN  PVOID               Argument OPTIONAL,
-    OUT PLOG_DISPOSITION    *Disposition
+    _In_ LOG_LEVEL          Mask,
+    _In_ VOID               (*Function)(PVOID, PCHAR, ULONG),
+    _In_opt_ PVOID          Argument,
+    _Out_ PLOG_DISPOSITION  *Disposition
     );
 
 XEN_API
 VOID
 LogRemoveDisposition(
-    IN  PLOG_DISPOSITION    Disposition
+    _In_ PLOG_DISPOSITION   Disposition
     );
 
 
@@ -465,22 +465,22 @@ LogRemoveDisposition(
 XEN_API
 NTSTATUS
 SystemProcessorVcpuId(
-    IN  ULONG           Cpu,
-    OUT unsigned int    *vcpu_id
+    _In_ ULONG          Cpu,
+    _Out_ unsigned int  *vcpu_id
     );
 
 XEN_API
 NTSTATUS
 SystemProcessorVcpuInfo(
-    IN  ULONG       Cpu,
-    OUT vcpu_info_t **Vcpu
+    _In_ ULONG          Cpu,
+    _Out_ vcpu_info_t   **Vcpu
     );
 
 XEN_API
 NTSTATUS
 SystemProcessorRegisterVcpuInfo(
-    IN  ULONG   Cpu,
-    IN  BOOLEAN Force
+    _In_ ULONG      Cpu,
+    _In_ BOOLEAN    Force
     );
 
 XEN_API
@@ -498,7 +498,7 @@ SystemRealTimeIsUniversal(
 XEN_API
 NTSTATUS
 SystemSetWatchdog(
-    IN  ULONG       Seconds
+    _In_ ULONG      Seconds
     );
 
 XEN_API
@@ -509,21 +509,21 @@ SystemStopWatchdog(
 
 // VCPU
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 VcpuSetPeriodicTimer(
-    IN  unsigned int    vcpu_id,
-    IN  PLARGE_INTEGER  Period
+    _In_ unsigned int       vcpu_id,
+    _In_opt_ PLARGE_INTEGER Period
     );
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 VcpuRegisterVcpuInfo(
-    IN  unsigned int                vcpu_id,
-    IN  PFN_NUMBER                  Pfn,
-    IN  ULONG                       Offset
+    _In_ unsigned int               vcpu_id,
+    _In_ PFN_NUMBER                 Pfn,
+    _In_ ULONG                      Offset
     );
 
 // FILTERS
@@ -545,24 +545,24 @@ FiltersUninstall(
 XEN_API
 NTSTATUS
 ConfigGetActive(
-    IN  const CHAR  *Key,
-    OUT PCHAR       *Value
+    _In_ const CHAR *Key,
+    _Out_ PCHAR     *Value
     );
 
 XEN_API
 NTSTATUS
 ConfigSetActive(
-    IN  PCHAR   DeviceID,
-    IN  PCHAR   InstanceID,
-    IN  PCHAR   LocationInformation
+    _In_ PCHAR  DeviceID,
+    _In_ PCHAR  InstanceID,
+    _In_ PCHAR  LocationInformation
     );
 
 XEN_API
 NTSTATUS
 ConfigUpdateActive(
-    IN  PCHAR   DeviceID,
-    IN  PCHAR   InstanceID,
-    IN  PCHAR   LocationInformation
+    _In_ PCHAR  DeviceID,
+    _In_ PCHAR  InstanceID,
+    _In_ PCHAR  LocationInformation
     );
 
 XEN_API
@@ -574,15 +574,15 @@ ConfigClearActive(
 XEN_API
 NTSTATUS
 ConfigRequestReboot(
-    IN  HANDLE      ParametersKey,
-    IN  PCHAR       Module
+    _In_ HANDLE     ParametersKey,
+    _In_ PCHAR      Module
     );
 
 XEN_API
 NTSTATUS
 ConfigQuerySystemStartOption(
-    IN  PCHAR           Key,
-    OUT PANSI_STRING    *Option
+    _In_ PCHAR          Key,
+    _Out_ PANSI_STRING  *Option
     );
 
 #endif  // _XEN_H
diff --git a/src/common/assert.h b/src/common/assert.h
index 0d43ea9..6c6ee28 100644
--- a/src/common/assert.h
+++ b/src/common/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)
@@ -154,10 +154,10 @@ __Bug(
 
 static __inline BOOLEAN
 _IsZeroMemory(
-    IN  const PCHAR Caller,
-    IN  const PCHAR Name,
-    IN  PVOID       Buffer,
-    IN  ULONG       Length
+    _In_ const PCHAR    Caller,
+    _In_ const PCHAR    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_ const PCHAR    Caller,
+    _In_ const PCHAR    Name,
+    _In_ PVOID          Buffer,
+    _In_ ULONG          Length
     )
 {
     UNREFERENCED_PARAMETER(Caller);
diff --git a/src/common/dbg_print.h b/src/common/dbg_print.h
index a0bd727..372fd7b 100644
--- a/src/common/dbg_print.h
+++ b/src/common/dbg_print.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.
  */
 
@@ -44,8 +44,8 @@
 
 static __inline VOID
 __Error(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ const CHAR *Prefix,
+    _In_ const CHAR *Format,
     ...
     )
 {
@@ -67,8 +67,8 @@ __Error(
 
 static __inline VOID
 __Warning(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ const CHAR *Prefix,
+    _In_ const CHAR *Format,
     ...
     )
 {
@@ -91,8 +91,8 @@ __Warning(
 #if DBG
 static __inline VOID
 __Trace(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ const CHAR *Prefix,
+    _In_ const CHAR *Format,
     ...
     )
 {
@@ -117,8 +117,8 @@ __Trace(
 
 static __inline VOID
 __Info(
-    IN  const CHAR  *Prefix,
-    IN  const CHAR  *Format,
+    _In_ const CHAR *Prefix,
+    _In_ const CHAR *Format,
     ...
     )
 {
diff --git a/src/common/high.h b/src/common/high.h
index 40cf0f5..4e21f5b 100644
--- a/src/common/high.h
+++ b/src/common/high.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.
  */
 
@@ -42,12 +42,12 @@ typedef LONG    HIGH_LOCK, *PHIGH_LOCK;
 #define LOCK_MAGIC  0xFEEDFACE
 
 static FORCEINLINE
-__drv_maxIRQL(HIGH_LEVEL)
-__drv_raisesIRQL(HIGH_LEVEL)
-__drv_savesIRQL
+_IRQL_requires_max_(HIGH_LEVEL)
+_IRQL_raises_(HIGH_LEVEL)
+_IRQL_saves_
 KIRQL
 __AcquireHighLock(
-    IN  PHIGH_LOCK  Lock
+    _In_ PHIGH_LOCK Lock
     )
 {
     KIRQL           Irql;
@@ -68,12 +68,11 @@ __AcquireHighLock(
         } while (FALSE)
 
 static FORCEINLINE
-__drv_maxIRQL(HIGH_LEVEL)
-__drv_requiresIRQL(HIGH_LEVEL)
+_IRQL_requires_(HIGH_LEVEL)
 VOID
 ReleaseHighLock(
-    IN  PHIGH_LOCK                  Lock,
-    IN  __drv_restoresIRQL KIRQL    Irql
+    _In_ PHIGH_LOCK                 Lock,
+    _In_  _IRQL_restores_ KIRQL     Irql
     )
 {
     KeMemoryBarrier();
@@ -85,7 +84,7 @@ ReleaseHighLock(
 static FORCEINLINE
 VOID
 InitializeHighLock(
-    IN  PHIGH_LOCK  Lock
+    _In_ PHIGH_LOCK Lock
     )
 {
     RtlZeroMemory(&Lock, sizeof (HIGH_LOCK));
diff --git a/src/common/mutex.h b/src/common/mutex.h
index 4f13236..bdacddb 100644
--- a/src/common/mutex.h
+++ b/src/common/mutex.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.
  */
 
@@ -44,7 +44,7 @@ typedef struct _MUTEX {
 
 static FORCEINLINE VOID
 InitializeMutex(
-    IN  PMUTEX  Mutex
+    _In_ PMUTEX Mutex
     )
 {
     RtlZeroMemory(Mutex, sizeof (MUTEX));
@@ -53,9 +53,9 @@ InitializeMutex(
 }
 
 static FORCEINLINE BOOLEAN
-__drv_maxIRQL(PASSIVE_LEVEL)
+_IRQL_requires_max_(PASSIVE_LEVEL)
 TryAcquireMutex(
-    IN  PMUTEX      Mutex
+    _In_ PMUTEX     Mutex
     )
 {
     LARGE_INTEGER   Timeout;
@@ -80,9 +80,9 @@ TryAcquireMutex(
 }
 
 static FORCEINLINE VOID
-__drv_maxIRQL(PASSIVE_LEVEL)
+_IRQL_requires_max_(PASSIVE_LEVEL)
 AcquireMutex(
-    IN  PMUTEX  Mutex
+    _In_ PMUTEX Mutex
     )
 {
     NTSTATUS    status;
@@ -100,9 +100,9 @@ AcquireMutex(
 }
 
 static FORCEINLINE VOID
-__drv_maxIRQL(PASSIVE_LEVEL)
+_IRQL_requires_max_(PASSIVE_LEVEL)
 ReleaseMutex(
-    IN  PMUTEX  Mutex
+    _In_ PMUTEX Mutex
     )
 {
     ASSERT3P(Mutex->Owner, ==, KeGetCurrentThread());
diff --git a/src/common/names.h b/src/common/names.h
index 9bdfb1c..a7af965 100644
--- a/src/common/names.h
+++ b/src/common/names.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.
  */
 
@@ -38,7 +38,7 @@
 
 static FORCEINLINE const CHAR *
 PowerStateTypeName(
-    IN  POWER_STATE_TYPE    Type
+    _In_ POWER_STATE_TYPE   Type
     )
 {
 #define _POWER_TYPE_NAME(_Type) \
@@ -58,7 +58,7 @@ PowerStateTypeName(
 
 static FORCEINLINE const CHAR *
 SystemPowerStateName(
-    IN  SYSTEM_POWER_STATE State
+    _In_ SYSTEM_POWER_STATE State
     )
 {
 #define _POWER_SYSTEM_STATE_NAME(_State)    \
@@ -84,7 +84,7 @@ SystemPowerStateName(
 
 static FORCEINLINE const CHAR *
 DevicePowerStateName(
-    IN  DEVICE_POWER_STATE State
+    _In_ DEVICE_POWER_STATE State
     )
 {
 #define _POWER_DEVICE_STATE_NAME(_State)    \
@@ -108,7 +108,7 @@ DevicePowerStateName(
 
 static FORCEINLINE const CHAR *
 PowerActionName(
-    IN  POWER_ACTION    Type
+    _In_ POWER_ACTION   Type
     )
 {
 #define _POWER_ACTION_NAME(_Type)   \
@@ -134,7 +134,7 @@ PowerActionName(
 
 static FORCEINLINE const CHAR *
 PowerMinorFunctionName(
-    IN  ULONG   MinorFunction
+    _In_ ULONG  MinorFunction
     )
 {
 #define _POWER_MINOR_FUNCTION_NAME(_Function)   \
@@ -156,7 +156,7 @@ PowerMinorFunctionName(
 
 static FORCEINLINE const CHAR *
 PnpMinorFunctionName(
-    IN  ULONG   Function
+    _In_ ULONG  Function
     )
 {
 #define _PNP_MINOR_FUNCTION_NAME(_Function) \
@@ -199,7 +199,7 @@ PnpMinorFunctionName(
 
 static FORCEINLINE const CHAR *
 ResourceDescriptorTypeName(
-    IN  UCHAR   Type
+    _In_ UCHAR  Type
     )
 {
 #define _RESOURCE_DESCRIPTOR_TYPE_NAME(_Type)   \
@@ -228,7 +228,7 @@ ResourceDescriptorTypeName(
 
 static FORCEINLINE const CHAR *
 ResourceDescriptorShareDispositionName(
-    IN  UCHAR   Disposition
+    _In_ UCHAR  Disposition
     )
 {
 #define _RESOURCE_DESCRIPTOR_SHARE_DISPOSITION_NAME(_Disposition)  \
@@ -251,7 +251,7 @@ ResourceDescriptorShareDispositionName(
 
 static FORCEINLINE const CHAR *
 IrqDevicePolicyName(
-    IN  IRQ_DEVICE_POLICY   Policy
+    _In_ IRQ_DEVICE_POLICY  Policy
     )
 {
 #define _IRQ_DEVICE_POLICY_NAME(_Policy)    \
@@ -276,7 +276,7 @@ IrqDevicePolicyName(
 
 static FORCEINLINE const CHAR *
 IrqPriorityName(
-    IN  IRQ_PRIORITY    Priority
+    _In_ IRQ_PRIORITY   Priority
     )
 {
 #define _IRQ_PRIORITY_NAME(_Priority)   \
@@ -299,7 +299,7 @@ IrqPriorityName(
 
 static FORCEINLINE const CHAR *
 InterruptModeName(
-    IN  KINTERRUPT_MODE Mode
+    _In_ KINTERRUPT_MODE    Mode
     )
 {
 #define _INTERRUPT_MODE_NAME(_Mode) \
@@ -320,7 +320,7 @@ InterruptModeName(
 
 static FORCEINLINE const CHAR *
 DeviceUsageNotificationTypeName(
-    IN  DEVICE_USAGE_NOTIFICATION_TYPE  Type
+    _In_ DEVICE_USAGE_NOTIFICATION_TYPE Type
     )
 {
 #define _DEVICE_USAGE_TYPE_NAME(_Type)  \
@@ -342,7 +342,7 @@ DeviceUsageNotificationTypeName(
 
 static FORCEINLINE const CHAR *
 InterfaceTypeName(
-    IN  INTERFACE_TYPE  Type
+    _In_ INTERFACE_TYPE Type
     )
 {
 #define _INTERFACE_TYPE_NAME(_Type) \
@@ -380,7 +380,7 @@ InterfaceTypeName(
 
 static FORCEINLINE const CHAR *
 DmaWidthName(
-    IN  DMA_WIDTH   Width
+    _In_ DMA_WIDTH  Width
     )
 {
 #define _DMA_WIDTH_NAME(_Width) \
@@ -404,7 +404,7 @@ DmaWidthName(
 
 static FORCEINLINE const CHAR *
 DmaSpeedName(
-    IN  DMA_SPEED   Speed
+    _In_ DMA_SPEED  Speed
     )
 {
 #define _DMA_SPEED_NAME(_Speed) \
@@ -429,7 +429,7 @@ DmaSpeedName(
 
 static FORCEINLINE const CHAR *
 BusQueryIdTypeName(
-    IN  BUS_QUERY_ID_TYPE   Type
+    _In_ BUS_QUERY_ID_TYPE  Type
     )
 {
 #define _BUS_QUERY_ID_TYPE_NAME(_Type)  \
@@ -454,7 +454,7 @@ BusQueryIdTypeName(
 
 static FORCEINLINE const CHAR *
 ProcessorChangeName(
-    IN  KE_PROCESSOR_CHANGE_NOTIFY_STATE    Change
+    _In_ KE_PROCESSOR_CHANGE_NOTIFY_STATE   Change
     )
 {
 #define _PROCESSOR_CHANGE_NAME(_Change) \
@@ -476,7 +476,7 @@ ProcessorChangeName(
 
 static FORCEINLINE const CHAR *
 VirqName(
-    IN  ULONG   Type
+    _In_ ULONG  Type
     )
 {
 #define _VIRQ_NAME(_Type) \
diff --git a/src/common/registry.c b/src/common/registry.c
index fc68941..6a8c73e 100644
--- a/src/common/registry.c
+++ b/src/common/registry.c
@@ -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.
  */
 
@@ -47,7 +47,7 @@ static IOOPENDRIVERREGISTRYKEY __IoOpenDriverRegistryKey;
 
 static FORCEINLINE PVOID
 __RegistryAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, REGISTRY_TAG);
@@ -55,7 +55,7 @@ __RegistryAllocate(
 
 static FORCEINLINE VOID
 __RegistryFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, REGISTRY_TAG);
@@ -63,8 +63,8 @@ __RegistryFree(
 
 NTSTATUS
 RegistryInitialize(
-    IN  PDRIVER_OBJECT  DriverObject,
-    IN  PUNICODE_STRING Path
+    _In_opt_ PDRIVER_OBJECT DriverObject,
+    _In_ PUNICODE_STRING    Path
     )
 {
     UNICODE_STRING      Unicode;
@@ -111,8 +111,8 @@ RegistryTeardown(
 
 NTSTATUS
 RegistryOpenParametersKey(
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       Key
     )
 {
     HANDLE              ServiceKey;
@@ -159,10 +159,10 @@ fail1:
 
 NTSTATUS
 RegistryOpenKey(
-    IN  HANDLE          Parent,
-    IN  PUNICODE_STRING Path,
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_opt_ HANDLE         Parent,
+    _In_ PUNICODE_STRING    Path,
+    _In_ ACCESS_MASK        DesiredAccess,
+    _Out_ PHANDLE           Key
     )
 {
     OBJECT_ATTRIBUTES   Attributes;
@@ -188,9 +188,9 @@ fail1:
 
 static NTSTATUS
 RegistryOpenRoot(
-    IN  PWCHAR          Path,
-    OUT PHANDLE         Parent,
-    OUT PWCHAR          *ChildPath
+    _In_ PWCHAR         Path,
+    _Out_ PHANDLE       Parent,
+    _Out_ PWCHAR        *ChildPath
     )
 {
     const WCHAR         Prefix[] = L"\\Registry\\Machine\\";
@@ -221,10 +221,10 @@ fail1:
 
 NTSTATUS
 RegistryCreateKey(
-    IN  HANDLE          Parent,
-    IN  PUNICODE_STRING Path,
-    IN  ULONG           Options,
-    OUT PHANDLE         Key
+    _In_opt_ HANDLE         Parent,
+    _In_ PUNICODE_STRING    Path,
+    _In_ ULONG              Options,
+    _Out_ PHANDLE           Key
     )
 {
     PWCHAR              Buffer;
@@ -321,8 +321,8 @@ fail1:
 
 NTSTATUS
 RegistryOpenServiceKey(
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       Key
     )
 {
     return RegistryOpenKey(NULL, &RegistryPath, DesiredAccess, Key);
@@ -330,7 +330,7 @@ RegistryOpenServiceKey(
 
 NTSTATUS
 RegistryCreateServiceKey(
-    OUT PHANDLE         Key
+    _Out_ PHANDLE       Key
     )
 {
     return RegistryCreateKey(NULL, &RegistryPath, REG_OPTION_NON_VOLATILE, 
Key);
@@ -338,9 +338,9 @@ RegistryCreateServiceKey(
 
 NTSTATUS
 RegistryOpenSoftwareKey(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       Key
     )
 {
     NTSTATUS            status;
@@ -360,9 +360,9 @@ fail1:
 
 NTSTATUS
 RegistryOpenHardwareKey(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  ACCESS_MASK         DesiredAccess,
-    OUT PHANDLE             Key
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ ACCESS_MASK        DesiredAccess,
+    _Out_ PHANDLE           Key
     )
 {
     HANDLE                  SubKey;
@@ -410,7 +410,7 @@ RegistryOpenHardwareKey(
     ASSERT(Cursor != NULL);
 
     *Cursor = L'\0';
-    
+
     RtlInitUnicodeString(&Unicode, Info->Name);
 
     status = RegistryOpenKey(NULL, &Unicode, DesiredAccess, Key);
@@ -437,10 +437,10 @@ fail1:
 
 NTSTATUS
 RegistryOpenSubKey(
-    IN  PHANDLE         Key,
-    IN  PCHAR           Name,
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         SubKey
+    _In_opt_ PHANDLE    Key,
+    _In_ PCHAR          Name,
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       SubKey
     )
 {
     ANSI_STRING         Ansi;
@@ -470,10 +470,10 @@ fail1:
 
 NTSTATUS
 RegistryCreateSubKey(
-    IN  PHANDLE         Key,
-    IN  PCHAR           Name,
-    IN  ULONG           Options,
-    OUT PHANDLE         SubKey
+    _In_opt_ HANDLE     Key,
+    _In_ PCHAR          Name,
+    _In_ ULONG          Options,
+    _Out_ PHANDLE       SubKey
     )
 {
     ANSI_STRING         Ansi;
@@ -503,8 +503,8 @@ fail1:
 
 NTSTATUS
 RegistryDeleteSubKey(
-    IN  PHANDLE         Key,
-    IN  PCHAR           Name
+    _In_ PHANDLE        Key,
+    _In_ PCHAR          Name
     )
 {
     ANSI_STRING         Ansi;
@@ -544,9 +544,9 @@ fail1:
 
 NTSTATUS
 RegistryEnumerateSubKeys(
-    IN  HANDLE              Key,
-    IN  NTSTATUS            (*Callback)(PVOID, HANDLE, PANSI_STRING),
-    IN  PVOID               Context
+    _In_ HANDLE             Key,
+    _In_ NTSTATUS           (*Callback)(PVOID, HANDLE, PANSI_STRING),
+    _In_ PVOID              Context
     )
 {
     ULONG                   Size;
@@ -615,7 +615,7 @@ RegistryEnumerateSubKeys(
         status = RtlUnicodeStringToAnsiString(&Ansi, &Unicode, FALSE);
         ASSERT(NT_SUCCESS(status));
 
-        Ansi.Length = (USHORT)(strlen(Ansi.Buffer) * sizeof (CHAR));        
+        Ansi.Length = (USHORT)(strlen(Ansi.Buffer) * sizeof (CHAR));
 
         status = Callback(Context, Key, &Ansi);
 
@@ -640,7 +640,7 @@ fail5:
 fail4:
 fail3:
     __RegistryFree(Full);
-    
+
 fail2:
 fail1:
     return status;
@@ -648,9 +648,9 @@ fail1:
 
 NTSTATUS
 RegistryEnumerateValues(
-    IN  HANDLE                      Key,
-    IN  NTSTATUS                    (*Callback)(PVOID, HANDLE, PANSI_STRING, 
ULONG),
-    IN  PVOID                       Context
+    _In_ HANDLE                     Key,
+    _In_ NTSTATUS                   (*Callback)(PVOID, HANDLE, PANSI_STRING, 
ULONG),
+    _In_ PVOID                      Context
     )
 {
     ULONG                           Size;
@@ -722,7 +722,7 @@ RegistryEnumerateValues(
             goto fail7;
         }
 
-        Ansi.Length = (USHORT)(strlen(Ansi.Buffer) * sizeof (CHAR));        
+        Ansi.Length = (USHORT)(strlen(Ansi.Buffer) * sizeof (CHAR));
 
         status = Callback(Context, Key, &Ansi, Basic->Type);
 
@@ -747,7 +747,7 @@ fail5:
 fail4:
 fail3:
     __RegistryFree(Full);
-    
+
 fail2:
 fail1:
     return status;
@@ -755,8 +755,8 @@ fail1:
 
 NTSTATUS
 RegistryDeleteValue(
-    IN  PHANDLE         Key,
-    IN  PCHAR           Name
+    _In_ PHANDLE        Key,
+    _In_ PCHAR          Name
     )
 {
     ANSI_STRING         Ansi;
@@ -786,9 +786,9 @@ fail1:
 
 NTSTATUS
 RegistryQueryDwordValue(
-    IN  HANDLE                      Key,
-    IN  PCHAR                       Name,
-    OUT PULONG                      Value
+    _In_ HANDLE                     Key,
+    _In_ PCHAR                      Name,
+    _Out_ PULONG                    Value
     )
 {
     ANSI_STRING                     Ansi;
@@ -802,7 +802,7 @@ RegistryQueryDwordValue(
     status = RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE);
     if (!NT_SUCCESS(status))
         goto fail1;
-        
+
     status = ZwQueryValueKey(Key,
                              &Unicode,
                              KeyValuePartialInformation,
@@ -834,7 +834,7 @@ RegistryQueryDwordValue(
         Partial->DataLength != sizeof (ULONG))
         goto fail5;
 
-    *Value = *(PULONG)Partial->Data;            
+    *Value = *(PULONG)Partial->Data;
 
     __RegistryFree(Partial);
 
@@ -856,9 +856,9 @@ fail1:
 
 NTSTATUS
 RegistryUpdateDwordValue(
-    IN  HANDLE                      Key,
-    IN  PCHAR                       Name,
-    IN  ULONG                       Value
+    _In_ HANDLE                     Key,
+    _In_ PCHAR                      Name,
+    _In_ ULONG                      Value
     )
 {
     ANSI_STRING                     Ansi;
@@ -871,7 +871,7 @@ RegistryUpdateDwordValue(
     status = RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE);
     if (!NT_SUCCESS(status))
         goto fail1;
-        
+
     Partial = __RegistryAllocate(FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, 
Data) +
                                  sizeof (ULONG));
 
@@ -882,7 +882,7 @@ RegistryUpdateDwordValue(
     Partial->TitleIndex = 0;
     Partial->Type = REG_DWORD;
     Partial->DataLength = sizeof (ULONG);
-    *(PULONG)Partial->Data = Value;            
+    *(PULONG)Partial->Data = Value;
 
     status = ZwSetValueKey(Key,
                            &Unicode,
@@ -912,7 +912,7 @@ fail1:
 
 static PANSI_STRING
 RegistrySzToAnsi(
-    IN  PWCHAR      Buffer
+    _In_ PWCHAR     Buffer
     )
 {
     PANSI_STRING    Ansi;
@@ -951,7 +951,7 @@ fail1:
 
 static PANSI_STRING
 RegistryMultiSzToAnsi(
-    IN  PWCHAR      Buffer
+    _In_ PWCHAR     Buffer
     )
 {
     PANSI_STRING    Ansi;
@@ -1013,10 +1013,10 @@ fail1:
 
 NTSTATUS
 RegistryQuerySzValue(
-    IN  HANDLE                      Key,
-    IN  PCHAR                       Name,
-    OUT PULONG                      Type OPTIONAL,
-    OUT PANSI_STRING                *Array
+    _In_ HANDLE                     Key,
+    _In_ PCHAR                      Name,
+    _Out_opt_ PULONG                Type,
+    _Out_ PANSI_STRING              *Array
     )
 {
     ANSI_STRING                     Ansi;
@@ -1030,7 +1030,7 @@ RegistryQuerySzValue(
     status = RtlAnsiStringToUnicodeString(&Unicode, &Ansi, TRUE);
     if (!NT_SUCCESS(status))
         goto fail1;
-        
+
     status = ZwQueryValueKey(Key,
                              &Unicode,
                              KeyValuePartialInformation,
@@ -1100,10 +1100,10 @@ fail1:
 
 NTSTATUS
 RegistryQueryBinaryValue(
-    IN  HANDLE                      Key,
-    IN  PCHAR                       Name,
-    OUT PVOID                       *Buffer,
-    OUT PULONG                      Length
+    _In_ HANDLE                     Key,
+    _In_ PCHAR                      Name,
+    _Out_ PVOID                     *Buffer,
+    _Out_ PULONG                    Length
     )
 {
     ANSI_STRING                     Ansi;
@@ -1185,10 +1185,10 @@ fail1:
 
 NTSTATUS
 RegistryUpdateBinaryValue(
-    IN  HANDLE                      Key,
-    IN  PCHAR                       Name,
-    IN  PVOID                       Buffer,
-    IN  ULONG                       Length
+    _In_ HANDLE                     Key,
+    _In_ PCHAR                      Name,
+    _In_ PVOID                      Buffer,
+    _In_ ULONG                      Length
     )
 {
     ANSI_STRING                     Ansi;
@@ -1242,8 +1242,8 @@ fail1:
 
 NTSTATUS
 RegistryQueryKeyName(
-    IN  HANDLE              Key,
-    OUT PANSI_STRING        *Array
+    _In_ HANDLE             Key,
+    _Out_ PANSI_STRING      *Array
     )
 {
     PKEY_NAME_INFORMATION   Value;
@@ -1297,8 +1297,8 @@ fail1:
 
 NTSTATUS
 RegistryQuerySystemStartOption(
-    IN  PCHAR                       Prefix,
-    OUT PANSI_STRING                *Value
+    _In_ PCHAR                      Prefix,
+    _Out_ PANSI_STRING              *Value
     )
 {
     UNICODE_STRING                  Unicode;
@@ -1310,7 +1310,7 @@ RegistryQuerySystemStartOption(
     NTSTATUS                        status;
 
     RtlInitUnicodeString(&Unicode, 
L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control");
-    
+
     status = RegistryOpenKey(NULL, &Unicode, KEY_READ, &Key);
     if (!NT_SUCCESS(status))
         goto fail1;
@@ -1467,10 +1467,10 @@ fail1:
 
 NTSTATUS
 RegistryUpdateSzValue(
-    IN  HANDLE                      Key,
-    IN  PCHAR                       Name,
-    IN  ULONG                       Type,
-    IN  PANSI_STRING                Array
+    _In_ HANDLE                     Key,
+    _In_ PCHAR                      Name,
+    _In_ ULONG                      Type,
+    _In_ PANSI_STRING               Array
     )
 {
     ANSI_STRING                     Ansi;
@@ -1531,7 +1531,7 @@ fail1:
 
 VOID
 RegistryFreeSzValue(
-    IN  PANSI_STRING    Array
+    _In_ PANSI_STRING   Array
     )
 {
     ULONG               Index;
@@ -1547,7 +1547,7 @@ RegistryFreeSzValue(
 
 VOID
 RegistryFreeBinaryValue(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __RegistryFree(Buffer);
@@ -1555,7 +1555,7 @@ RegistryFreeBinaryValue(
 
 VOID
 RegistryCloseKey(
-    IN  HANDLE  Key
+    _In_ HANDLE Key
     )
 {
     ZwClose(Key);
diff --git a/src/common/registry.h b/src/common/registry.h
index efa96ea..dd4e035 100644
--- a/src/common/registry.h
+++ b/src/common/registry.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.
  */
 
@@ -37,8 +37,8 @@
 
 extern NTSTATUS
 RegistryInitialize(
-    IN  PDRIVER_OBJECT  DrvObj,
-    IN  PUNICODE_STRING Path
+    _In_opt_ PDRIVER_OBJECT DrvObj,
+    _In_ PUNICODE_STRING    Path
     );
 
 extern VOID
@@ -48,164 +48,164 @@ RegistryTeardown(
 
 extern NTSTATUS
 RegistryOpenParametersKey(
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       Key
     );
 
 extern NTSTATUS
 RegistryOpenKey(
-    IN  HANDLE          Parent,
-    IN  PUNICODE_STRING Path,
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_opt_ HANDLE         Parent,
+    _In_ PUNICODE_STRING    Path,
+    _In_ ACCESS_MASK        DesiredAccess,
+    _Out_ PHANDLE           Key
     );
 
 extern NTSTATUS
 RegistryCreateKey(
-    IN  HANDLE          Parent,
-    IN  PUNICODE_STRING Path,
-    IN  ULONG           Options,
-    OUT PHANDLE         Key
+    _In_opt_ HANDLE         Parent,
+    _In_ PUNICODE_STRING    Path,
+    _In_ ULONG              Options,
+    _Out_ PHANDLE           Key
     );
 
 extern NTSTATUS
 RegistryOpenServiceKey(
-    IN  ACCESS_MASK DesiredAccess,
-    OUT PHANDLE     Key
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       Key
     );
 
 extern NTSTATUS
 RegistryCreateServiceKey(
-    OUT PHANDLE     Key
+    _Out_ PHANDLE   Key
     );
 
 extern NTSTATUS
 RegistryOpenSoftwareKey(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       Key
     );
 
 extern NTSTATUS
 RegistryOpenHardwareKey(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  ACCESS_MASK     DesiredAccess,
-    OUT PHANDLE         Key
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       Key
     );
 
 extern NTSTATUS
 RegistryOpenSubKey(
-    IN  HANDLE      Key,
-    IN  PCHAR       Name,
-    IN  ACCESS_MASK DesiredAccess,
-    OUT PHANDLE     SubKey
+    _In_opt_ HANDLE     Key,
+    _In_ PCHAR          Name,
+    _In_ ACCESS_MASK    DesiredAccess,
+    _Out_ PHANDLE       SubKey
     );
 
 extern NTSTATUS
 RegistryCreateSubKey(
-    IN  HANDLE      Key,
-    IN  PCHAR       Name,
-    IN  ULONG       Options,
-    OUT PHANDLE     SubKey
+    _In_opt_ HANDLE Key,
+    _In_ PCHAR      Name,
+    _In_ ULONG      Options,
+    _Out_ PHANDLE   SubKey
     );
 
 extern NTSTATUS
 RegistryDeleteSubKey(
-    IN  HANDLE      Key,
-    IN  PCHAR       Name
+    _In_ HANDLE     Key,
+    _In_ PCHAR      Name
     );
 
 extern NTSTATUS
 RegistryEnumerateSubKeys(
-    IN  HANDLE      Key,
-    IN  NTSTATUS    (*Callback)(PVOID, HANDLE, PANSI_STRING),
-    IN  PVOID       Context
+    _In_ HANDLE     Key,
+    _In_ NTSTATUS   (*Callback)(PVOID, HANDLE, PANSI_STRING),
+    _In_ PVOID      Context
     );
 
 extern NTSTATUS
 RegistryEnumerateValues(
-    IN  HANDLE      Key,
-    IN  NTSTATUS    (*Callback)(PVOID, HANDLE, PANSI_STRING, ULONG),
-    IN  PVOID       Context
+    _In_ HANDLE     Key,
+    _In_ NTSTATUS   (*Callback)(PVOID, HANDLE, PANSI_STRING, ULONG),
+    _In_ PVOID      Context
     );
 
 extern NTSTATUS
 RegistryDeleteValue(
-    IN  HANDLE      Key,
-    IN  PCHAR       Name
+    _In_ HANDLE     Key,
+    _In_ PCHAR      Name
     );
 
 extern NTSTATUS
 RegistryQueryDwordValue(
-    IN  HANDLE          Key,
-    IN  PCHAR           Name,
-    OUT PULONG          Value
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _Out_ PULONG        Value
     );
-    
+
 extern NTSTATUS
 RegistryUpdateDwordValue(
-    IN  HANDLE          Key,
-    IN  PCHAR           Name,
-    IN  ULONG           Value
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _In_ ULONG          Value
     );
-    
+
 extern NTSTATUS
 RegistryQuerySzValue(
-    IN  HANDLE          Key,
-    IN  PCHAR           Name,
-    OUT PULONG          Type OPTIONAL,
-    OUT PANSI_STRING    *Array
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _Out_opt_ PULONG    Type,
+    _Out_ PANSI_STRING  *Array
     );
 
 extern NTSTATUS
 RegistryQueryBinaryValue(
-    IN  HANDLE          Key,
-    IN  PCHAR           Name,
-    OUT PVOID           *Buffer,
-    OUT PULONG          Length
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _Out_ PVOID         *Buffer,
+    _Out_ PULONG        Length
     );
 
 extern NTSTATUS
 RegistryUpdateBinaryValue(
-    IN  HANDLE          Key,
-    IN  PCHAR           Name,
-    IN  PVOID           Buffer,
-    IN  ULONG           Length
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _In_ PVOID          Buffer,
+    _In_ ULONG          Length
     );
 
 extern NTSTATUS
 RegistryQueryKeyName(
-    IN  HANDLE              Key,
-    OUT PANSI_STRING        *Array
+    _In_ HANDLE             Key,
+    _Out_ PANSI_STRING      *Array
     );
 
 extern NTSTATUS
 RegistryQuerySystemStartOption(
-    IN  PCHAR           Name,
-    OUT PANSI_STRING    *Option
+    _In_ PCHAR          Name,
+    _Out_ PANSI_STRING  *Option
     );
 
 extern VOID
 RegistryFreeSzValue(
-    IN  PANSI_STRING    Array
+    _In_ PANSI_STRING   Array
     );
 
 extern VOID
 RegistryFreeBinaryValue(
-    IN  PVOID           Buffer
+    _In_ PVOID          Buffer
     );
 
 extern NTSTATUS
 RegistryUpdateSzValue(
-    IN  HANDLE          Key,
-    IN  PCHAR           Name,
-    IN  ULONG           Type,
-    IN  PANSI_STRING    Array
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _In_ ULONG          Type,
+    _In_ PANSI_STRING   Array
     );
 
 extern VOID
 RegistryCloseKey(
-    IN  HANDLE  Key
+    _In_ HANDLE Key
     );
 
 #endif  // _COMMON_REGISTRY_H
diff --git a/src/common/util.h b/src/common/util.h
index b020e5b..a658adb 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -43,7 +43,7 @@
 
 static FORCEINLINE LONG
 __ffs(
-    IN  unsigned long long  mask
+    _In_ unsigned long long mask
     )
 {
     unsigned char           *array = (unsigned char *)&mask;
@@ -82,11 +82,11 @@ __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};
@@ -108,8 +108,8 @@ __CpuId(
 
 static FORCEINLINE LONG
 __InterlockedAdd(
-    IN  LONG    *Value,
-    IN  LONG    Delta
+    _In_ LONG   *Value,
+    _In_ LONG   Delta
     )
 {
     LONG        New;
@@ -125,8 +125,8 @@ __InterlockedAdd(
 
 static FORCEINLINE LONG
 __InterlockedSubtract(
-    IN  LONG    *Value,
-    IN  LONG    Delta
+    _In_ LONG   *Value,
+    _In_ LONG   Delta
     )
 {
     LONG        New;
@@ -140,12 +140,12 @@ __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;
@@ -171,8 +171,8 @@ __AllocatePoolWithTag(
 
 static FORCEINLINE VOID
 __FreePoolWithTag(
-    IN  PVOID   Buffer,
-    IN  ULONG   Tag
+    _In_ PVOID  Buffer,
+    _In_ ULONG  Tag
     )
 {
     ExFreePoolWithTag(Buffer, Tag);
@@ -180,8 +180,8 @@ __FreePoolWithTag(
 
 static FORCEINLINE PMDL
 __AllocatePages(
-    IN  ULONG           Count,
-    IN  BOOLEAN         Contiguous
+    _In_ ULONG          Count,
+    _In_ BOOLEAN        Contiguous
     )
 {
     PHYSICAL_ADDRESS    LowAddress;
@@ -258,7 +258,7 @@ fail1:
 
 static FORCEINLINE VOID
 __FreePages(
-    IN PMDL    Mdl
+    _In_ PMDL   Mdl
     )
 {
     PUCHAR     MdlMappedSystemVa;
@@ -276,9 +276,9 @@ __FreePages(
 
 static FORCEINLINE PCHAR
 __strtok_r(
-    IN      PCHAR   Buffer,
-    IN      PCHAR   Delimiter,
-    IN OUT  PCHAR   *Context
+    _In_opt_ PCHAR  Buffer,
+    _In_ PCHAR      Delimiter,
+    _Inout_ PCHAR   *Context
     )
 {
     PCHAR           Token;
@@ -314,9 +314,9 @@ __strtok_r(
 
 static FORCEINLINE PWCHAR
 __wcstok_r(
-    IN      PWCHAR  Buffer,
-    IN      PWCHAR  Delimiter,
-    IN OUT  PWCHAR  *Context
+    _In_opt_ PWCHAR Buffer,
+    _In_ PWCHAR     Delimiter,
+    _Inout_ PWCHAR  *Context
     )
 {
     PWCHAR          Token;
@@ -352,7 +352,7 @@ __wcstok_r(
 
 static FORCEINLINE CHAR
 __toupper(
-    IN  CHAR    Character
+    _In_ CHAR   Character
     )
 {
     if (Character < 'a' || Character > 'z')
@@ -363,7 +363,7 @@ __toupper(
 
 static FORCEINLINE CHAR
 __tolower(
-    IN  CHAR    Character
+    _In_ CHAR   Character
     )
 {
     if (Character < 'A' || Character > 'Z')
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index dd5fc13..532436d 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -93,8 +93,8 @@ MONITOR_CONTEXT MonitorContext;
 static VOID
 #pragma prefast(suppress:6262) // Function uses '1036' bytes of stack: exceeds 
/analyze:stacksize'1024'
 __Log(
-    IN  const CHAR      *Format,
-    IN  ...
+    _In_ const CHAR     *Format,
+    ...
     )
 {
 #if DBG
@@ -148,11 +148,11 @@ __Log(
 
 static PTCHAR
 GetErrorMessage(
-    IN  HRESULT Error
+    _In_  HRESULT   Error
     )
 {
-    PTCHAR      Message;
-    ULONG       Index;
+    PTCHAR          Message;
+    ULONG           Index;
 
     if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                        FORMAT_MESSAGE_FROM_SYSTEM |
@@ -177,7 +177,7 @@ GetErrorMessage(
 
 static const CHAR *
 ServiceStateName(
-    IN  DWORD   State
+    _In_ DWORD  State
     )
 {
 #define _STATE_NAME(_State) \
@@ -200,9 +200,9 @@ ServiceStateName(
 
 static VOID
 ReportStatus(
-    IN  DWORD           CurrentState,
-    IN  DWORD           Win32ExitCode,
-    IN  DWORD           WaitHint)
+    _In_ DWORD          CurrentState,
+    _In_ DWORD          Win32ExitCode,
+    _In_ DWORD          WaitHint)
 {
     PMONITOR_CONTEXT    Context = &MonitorContext;
     static DWORD        CheckPoint = 1;
@@ -250,10 +250,10 @@ fail1:
 
 DWORD WINAPI
 MonitorCtrlHandlerEx(
-    IN  DWORD           Ctrl,
-    IN  DWORD           EventType,
-    IN  LPVOID          EventData,
-    IN  LPVOID          Argument
+    _In_ DWORD          Ctrl,
+    _In_ DWORD          EventType,
+    _In_ LPVOID         EventData,
+    _In_ LPVOID         Argument
     )
 {
     PMONITOR_CONTEXT    Context = &MonitorContext;
@@ -287,7 +287,7 @@ MonitorCtrlHandlerEx(
 
 static const CHAR *
 WTSStateName(
-    IN  DWORD   State
+    _In_ DWORD  State
     )
 {
 #define _STATE_NAME(_State) \
@@ -316,8 +316,8 @@ WTSStateName(
 
 static VOID
 DoReboot(
-    IN PTCHAR   Message,
-    IN DWORD    Timeout
+    _In_ PTCHAR Message,
+    _In_ DWORD  Timeout
     )
 {
     Log("waiting for pending install events...");
@@ -367,7 +367,7 @@ GetPromptTimeout(
 
 static PTCHAR
 GetDisplayName(
-    IN PTCHAR           DriverName
+    _In_ PTCHAR         DriverName
     )
 {
     HRESULT             Result;
@@ -570,7 +570,7 @@ fail1:
 
 static VOID
 PromptForReboot(
-    IN PTCHAR           DriverName
+    _In_ PTCHAR         DriverName
     )
 {
     PMONITOR_CONTEXT    Context = &MonitorContext;
@@ -681,7 +681,7 @@ fail1:
 
 static VOID
 TryAutoReboot(
-    IN PTCHAR           DriverName
+    _In_ PTCHAR         DriverName
     )
 {
     PMONITOR_CONTEXT    Context = &MonitorContext;
@@ -1086,9 +1086,10 @@ fail1:
     return FALSE;
 }
 
+_Success_(return)
 static BOOL
 GetRequestKeyName(
-    OUT PTCHAR          *RequestKeyName
+    _Out_ PTCHAR        *RequestKeyName
     )
 {
     PMONITOR_CONTEXT    Context = &MonitorContext;
@@ -1310,7 +1311,7 @@ fail1:
 
 static BOOL
 RemoveStartOverride(
-    IN PTCHAR           DriverName
+    _In_ PTCHAR         DriverName
     )
 {
     TCHAR               KeyName[MAX_PATH];
diff --git a/src/xen/acpi.c b/src/xen/acpi.c
index 418f8ae..a73e822 100644
--- a/src/xen/acpi.c
+++ b/src/xen/acpi.c
@@ -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.
  */
 
@@ -46,7 +46,7 @@ static PACPI_XSDT   AcpiXsdt;
 
 static FORCEINLINE PVOID
 __AcpiAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_ACPI_TAG);
@@ -54,7 +54,7 @@ __AcpiAllocate(
 
 static FORCEINLINE VOID
 __AcpiFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_ACPI_TAG);
@@ -62,8 +62,8 @@ __AcpiFree(
 
 static BOOLEAN
 AcpiVerifyChecksum(
-    IN  PVOID   Table,
-    IN  ULONG   Length
+    _In_ PVOID  Table,
+    _In_ ULONG  Length
     )
 {
     UCHAR       Sum;
@@ -212,9 +212,9 @@ fail1:
 
 NTSTATUS
 AcpiGetTable(
-    IN      const CHAR  *Signature,
-    OUT     PVOID       Buffer OPTIONAL,
-    IN OUT  PULONG      Length
+    _In_ const CHAR     *Signature,
+    _Out_opt_ PVOID     Buffer,
+    _Inout_ PULONG      Length
     )
 {
     ULONG               Count;
diff --git a/src/xen/acpi.h b/src/xen/acpi.h
index f188905..f6a9f99 100644
--- a/src/xen/acpi.h
+++ b/src/xen/acpi.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.
  */
 
@@ -95,9 +95,9 @@ AcpiInitialize(
 
 extern NTSTATUS
 AcpiGetTable(
-    IN      const CHAR  *Signature,
-    OUT     PVOID       Buffer OPTIONAL,
-    IN OUT  PULONG      Length
+    _In_ const CHAR *Signature,
+    _Out_opt_ PVOID Buffer,
+    _Inout_ PULONG  Length
     );
 
 extern VOID
diff --git a/src/xen/bug_check.c b/src/xen/bug_check.c
index 41b5f73..85f9f70 100644
--- a/src/xen/bug_check.c
+++ b/src/xen/bug_check.c
@@ -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.
  */
 
@@ -61,7 +61,7 @@ BugCheckTeardown(
 
 static VOID
 BugCheckDumpExceptionRecord(
-    IN  PEXCEPTION_RECORD   Exception
+    _In_ PEXCEPTION_RECORD  Exception
     )
 {
     __try {
@@ -108,7 +108,7 @@ BugCheckDumpExceptionRecord(
 #if defined(__i386__)
 static VOID
 BugCheckDumpContext(
-    IN  PCONTEXT    Context
+    _In_ PCONTEXT   Context
     )
 {
     __try {
@@ -190,7 +190,7 @@ BugCheckDumpContext(
 
 static VOID
 BugCheckStackDump(
-    IN  PCONTEXT    Context
+    _In_ PCONTEXT   Context
     )
 {
 #define PARAMETER_COUNT     3
@@ -269,7 +269,7 @@ BugCheckStackDump(
 #elif defined(__x86_64__)
 static VOID
 BugCheckDumpContext(
-    IN  PCONTEXT    Context
+    _In_ PCONTEXT   Context
     )
 {
     __try {
@@ -493,7 +493,7 @@ RtlVirtualUnwind(
 
 static VOID
 BugCheckStackDump(
-    IN  PCONTEXT    Context
+    _In_ PCONTEXT   Context
     )
 {
 #define PARAMETER_COUNT     4
@@ -506,7 +506,7 @@ BugCheckStackDump(
 
         LogPrintf(LOG_LEVEL_CRITICAL,
                   "%s|BUGCHECK: STACK:\n",
-                  __MODULE__); 
+                  __MODULE__);
 
         for (Iteration = 0; Iteration < MAXIMUM_ITERATIONS; Iteration++) {
             PRUNTIME_FUNCTION   FunctionEntry;
@@ -607,10 +607,10 @@ RtlCaptureContext(
 
 static VOID
 BugCheckIrqlNotLessOrEqual(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -658,10 +658,10 @@ BugCheckIrqlNotLessOrEqual(
 
 static VOID
 BugCheckDriverIrqlNotLessOrEqual(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -709,10 +709,10 @@ BugCheckDriverIrqlNotLessOrEqual(
 
 static VOID
 BugCheckSystemServiceException(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -732,10 +732,10 @@ BugCheckSystemServiceException(
 
 static VOID
 BugCheckSystemThreadExceptionNotHandled(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -773,10 +773,10 @@ BugCheckSystemThreadExceptionNotHandled(
 
 static VOID
 BugCheckKernelModeExceptionNotHandled(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -820,10 +820,10 @@ BugCheckKernelModeExceptionNotHandled(
 
 static VOID
 BugCheckCriticalObjectTermination(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -859,10 +859,10 @@ BugCheckCriticalObjectTermination(
 
 static VOID
 BugCheckInaccessibleBootDevice(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -887,10 +887,10 @@ BugCheckInaccessibleBootDevice(
 
 static VOID
 BugCheckDriverPowerStateFailure(
-    IN  ULONG_PTR       Parameter1,
-    IN  ULONG_PTR       Parameter2,
-    IN  ULONG_PTR       Parameter3,
-    IN  ULONG_PTR       Parameter4
+    _In_ ULONG_PTR      Parameter1,
+    _In_ ULONG_PTR      Parameter2,
+    _In_ ULONG_PTR      Parameter3,
+    _In_ ULONG_PTR      Parameter4
     )
 {
     __try {
@@ -930,7 +930,7 @@ BugCheckDriverPowerStateFailure(
 
             LogPrintf(LOG_LEVEL_CRITICAL,
                       "%s|BUGCHECK: IRP STACK:\n",
-                      __MODULE__);     
+                      __MODULE__);
 
             for (Index = 0; Index <= Irp->StackCount; Index++) {
                 PCHAR       Name;
@@ -972,7 +972,7 @@ BugCheckDriverPowerStateFailure(
                           StackLocation->Context);
 
                 StackLocation++;
-            } 
+            }
 
             break;
         }
@@ -986,10 +986,10 @@ BugCheckDriverPowerStateFailure(
 
 static VOID
 BugCheckAssertionFailure(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -1025,10 +1025,10 @@ BugCheckAssertionFailure(
 /// <param name="Parameter4">reserved.</param>
 static VOID
 BugCheckBugEFCriticalProcessDied(
-    IN  ULONG_PTR   Parameter1,
-    IN  ULONG_PTR   Parameter2,
-    IN  ULONG_PTR   Parameter3,
-    IN  ULONG_PTR   Parameter4
+    _In_ ULONG_PTR  Parameter1,
+    _In_ ULONG_PTR  Parameter2,
+    _In_ ULONG_PTR  Parameter3,
+    _In_ ULONG_PTR  Parameter4
     )
 {
     __try {
@@ -1121,10 +1121,11 @@ BugCheckDefaultHandler(
 
 KBUGCHECK_CALLBACK_ROUTINE BugCheckBugCheckCallback;
 
-VOID                     
+_Use_decl_annotations_
+VOID
 BugCheckBugCheckCallback(
-    IN  PVOID               Argument,
-    IN  ULONG               Length
+    _In_ PVOID              Argument,
+    _In_ ULONG              Length
     )
 {
     extern PULONG_PTR       KiBugCheckData;
diff --git a/src/xen/config.c b/src/xen/config.c
index e600732..45d66c6 100644
--- a/src/xen/config.c
+++ b/src/xen/config.c
@@ -56,8 +56,8 @@
 XEN_API
 NTSTATUS
 ConfigGetActive(
-    IN  const CHAR  *Key,
-    OUT PCHAR       *Value
+    _In_ const CHAR *Key,
+    _Out_ PCHAR     *Value
     )
 {
     HANDLE          ActiveKey;
@@ -126,7 +126,7 @@ fail1:
 
 static FORCEINLINE BOOLEAN
 __ConfigIsDeviceLegacy(
-    IN  PCHAR   DeviceID
+    _In_ PCHAR  DeviceID
     )
 {
     UNREFERENCED_PARAMETER(DeviceID);
@@ -188,9 +188,9 @@ fail1:
 XEN_API
 NTSTATUS
 ConfigSetActive(
-    IN  PCHAR   DeviceID,
-    IN  PCHAR   InstanceID,
-    IN  PCHAR   LocationInformation
+    _In_ PCHAR  DeviceID,
+    _In_ PCHAR  InstanceID,
+    _In_ PCHAR  LocationInformation
     )
 {
     HANDLE      ActiveKey;
@@ -273,9 +273,9 @@ fail1:
 XEN_API
 NTSTATUS
 ConfigUpdateActive(
-    IN  PCHAR   DeviceID,
-    IN  PCHAR   InstanceID,
-    IN  PCHAR   LocationInformation
+    _In_ PCHAR  DeviceID,
+    _In_ PCHAR  InstanceID,
+    _In_ PCHAR  LocationInformation
     )
 {
     HANDLE      ActiveKey;
@@ -410,8 +410,8 @@ fail1:
 XEN_API
 NTSTATUS
 ConfigRequestReboot(
-    IN  HANDLE      ParametersKey,
-    IN  PCHAR       Module
+    _In_ HANDLE     ParametersKey,
+    _In_ PCHAR      Module
     )
 {
     PANSI_STRING    Ansi;
@@ -489,8 +489,8 @@ fail1:
 XEN_API
 NTSTATUS
 ConfigQuerySystemStartOption(
-    IN  PCHAR           Key,
-    OUT PANSI_STRING    *Option
+    _In_ PCHAR          Key,
+    _Out_ PANSI_STRING  *Option
     )
 {
     return RegistryQuerySystemStartOption(Key, Option);
diff --git a/src/xen/driver.c b/src/xen/driver.c
index e04a772..107dc65 100644
--- a/src/xen/driver.c
+++ b/src/xen/driver.c
@@ -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.
  */
 
@@ -74,7 +74,7 @@ extern PULONG   InitSafeBootMode;
 
 static FORCEINLINE PVOID
 __DriverAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XEN_DRIVER_TAG);
@@ -82,7 +82,7 @@ __DriverAllocate(
 
 static FORCEINLINE VOID
 __DriverFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XEN_DRIVER_TAG);
@@ -98,7 +98,7 @@ __DriverSafeMode(
 
 static FORCEINLINE VOID
 __DriverSetParametersKey(
-    IN  HANDLE  Key
+    _In_opt_ HANDLE Key
     )
 {
     Driver.ParametersKey = Key;
@@ -122,7 +122,7 @@ DriverGetParametersKey(
 
 static FORCEINLINE VOID
 __DriverSetUnplugKey(
-    IN  HANDLE  Key
+    _In_opt_ HANDLE Key
     )
 {
     Driver.UnplugKey = Key;
@@ -146,7 +146,7 @@ DriverGetUnplugKey(
 
 static FORCEINLINE VOID
 __DriverSetMemoryKey(
-    IN  HANDLE  Key
+    _In_opt_ HANDLE Key
     )
 {
     Driver.MemoryKey = Key;
@@ -164,9 +164,9 @@ __DriverGetMemoryKey(
 
 static FORCEINLINE NTSTATUS
 __DriverSetPfnArray(
-    IN  PCHAR       Name,
-    IN  ULONG       Count,
-    IN  PFN_NUMBER  PfnArray[]
+    _In_ PCHAR      Name,
+    _In_ ULONG      Count,
+    _In_ PFN_NUMBER PfnArray[]
     )
 {
     HANDLE          Key = __DriverGetMemoryKey();
@@ -224,9 +224,9 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __DriverAllocatePfnArray(
-    IN  PCHAR           Name,
-    IN  ULONG           Count,
-    OUT PFN_NUMBER      PfnArray[]
+    _In_ PCHAR          Name,
+    _In_ ULONG          Count,
+    _Out_ PFN_NUMBER    PfnArray[]
     )
 {
     PHYSICAL_ADDRESS    LowAddress;
@@ -289,14 +289,14 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __DriverGetPfnArray(
-    IN  PCHAR       Name,
-    IN  ULONG       Count,
-    OUT PFN_NUMBER  PfnArray[]
+    _In_ PCHAR                      Name,
+    _In_ ULONG                      Count,
+    _Out_writes_(Count) PFN_NUMBER  PfnArray[]
     )
 {
-    HANDLE          Key = __DriverGetMemoryKey();
-    ULONG           Index;
-    NTSTATUS        status;
+    HANDLE                          Key = __DriverGetMemoryKey();
+    ULONG                           Index;
+    NTSTATUS                        status;
 
     for (Index = 0; Index < Count; Index++) {
         CHAR    ValueName[MAXNAMELEN];
@@ -341,8 +341,8 @@ fail1:
 
 PMDL
 DriverGetNamedPages(
-    IN  PCHAR   Name,
-    IN  ULONG   Count
+    _In_ PCHAR  Name,
+    _In_ ULONG  Count
     )
 {
     ULONG       Size;
@@ -407,7 +407,7 @@ fail1:
 
 VOID
 DriverPutNamedPages(
-    IN  PMDL    Mdl
+    _In_ PMDL   Mdl
     )
 {
     PUCHAR         MdlMappedSystemVa;
@@ -425,11 +425,11 @@ DriverPutNamedPages(
 XEN_API
 NTSTATUS
 XenTouch(
-    IN  const CHAR  *Name,
-    IN  ULONG       MajorVersion,
-    IN  ULONG       MinorVersion,
-    IN  ULONG       MicroVersion,
-    IN  ULONG       BuildNumber
+    _In_ const CHAR *Name,
+    _In_ ULONG      MajorVersion,
+    _In_ ULONG      MinorVersion,
+    _In_ ULONG      MicroVersion,
+    _In_ ULONG      BuildNumber
    )
 {
     static ULONG    Reference;
@@ -479,9 +479,9 @@ fail1:
 
 static VOID
 DriverOutputBuffer(
-    IN  PVOID   Argument,
-    IN  PCHAR   Buffer,
-    IN  ULONG   Length
+    _In_ PVOID  Argument,
+    _In_ PCHAR  Buffer,
+    _In_ ULONG  Length
     )
 {
     ULONG_PTR   Port = (ULONG_PTR)Argument;
@@ -494,15 +494,15 @@ DriverOutputBuffer(
 
 NTSTATUS
 DllInitialize(
-    IN  PUNICODE_STRING RegistryPath
+    _In_ PUNICODE_STRING    RegistryPath
     )
 {
-    HANDLE              ServiceKey;
-    HANDLE              ParametersKey;
-    HANDLE              UnplugKey;
-    HANDLE              MemoryKey;
-    LOG_LEVEL           LogLevel;
-    NTSTATUS            status;
+    HANDLE                  ServiceKey;
+    HANDLE                  ParametersKey;
+    HANDLE                  UnplugKey;
+    HANDLE                  MemoryKey;
+    LOG_LEVEL               LogLevel;
+    NTSTATUS                status;
 
     ExInitializeDriverRuntime(DrvRtPoolNxOptIn);
     WdmlibProcgrpInitialize();
@@ -762,8 +762,8 @@ DRIVER_INITIALIZE   DriverEntry;
 
 NTSTATUS
 DriverEntry(
-    IN  PDRIVER_OBJECT  DriverObject,
-    IN  PUNICODE_STRING RegistryPath
+    _In_ PDRIVER_OBJECT     DriverObject,
+    _In_ PUNICODE_STRING    RegistryPath
     )
 {
     UNREFERENCED_PARAMETER(DriverObject);
diff --git a/src/xen/driver.h b/src/xen/driver.h
index 210b561..6806886 100644
--- a/src/xen/driver.h
+++ b/src/xen/driver.h
@@ -45,13 +45,13 @@ DriverGetUnplugKey(
 
 extern PMDL
 DriverGetNamedPages(
-    IN  PCHAR   Name,
-    IN  ULONG   Count
+    _In_ PCHAR  Name,
+    _In_ ULONG  Count
     );
 
 extern VOID
 DriverPutNamedPages(
-    IN  PMDL    Mdl
+    _In_ PMDL   Mdl
     );
 
 #endif  // _XEN_DRIVER_H
diff --git a/src/xen/event_channel.c b/src/xen/event_channel.c
index 2344169..1e91882 100644
--- a/src/xen/event_channel.c
+++ b/src/xen/event_channel.c
@@ -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.
  */
 
@@ -41,18 +41,18 @@
 
 static LONG_PTR
 EventChannelOp(
-    IN  ULONG   Command,
-    IN  PVOID   Argument
+    _In_ ULONG  Command,
+    _In_ PVOID  Argument
     )
 {
     return HYPERCALL(LONG_PTR, event_channel_op, 2, Command, Argument);
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelSend(
-    IN  ULONG           LocalPort
+    _In_ ULONG          LocalPort
     )
 {
     struct evtchn_send  op;
@@ -76,12 +76,12 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelAllocateUnbound(
-    IN  USHORT                  Domain,
-    OUT ULONG                   *LocalPort
+    _In_ USHORT                 Domain,
+    _Out_ ULONG                 *LocalPort
     )
 {
     struct evtchn_alloc_unbound op;
@@ -99,7 +99,7 @@ EventChannelAllocateUnbound(
     }
 
     *LocalPort = op.port;
-    
+
     return STATUS_SUCCESS;
 
 fail1:
@@ -108,13 +108,13 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelBindInterDomain(
-    IN  USHORT                      RemoteDomain,
-    IN  ULONG                       RemotePort,
-    OUT ULONG                       *LocalPort
+    _In_ USHORT                     RemoteDomain,
+    _In_ ULONG                      RemotePort,
+    _Out_ ULONG                     *LocalPort
     )
 {
     struct evtchn_bind_interdomain  op;
@@ -132,7 +132,7 @@ EventChannelBindInterDomain(
     }
 
     *LocalPort = op.local_port;
-    
+
     return STATUS_SUCCESS;
 
 fail1:
@@ -141,13 +141,13 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelBindVirq(
-    IN  ULONG               Virq,
-    IN  unsigned int        vcpu_id,
-    OUT ULONG               *LocalPort
+    _In_ ULONG              Virq,
+    _In_ unsigned int       vcpu_id,
+    _Out_ ULONG             *LocalPort
     )
 {
     struct evtchn_bind_virq op;
@@ -165,7 +165,7 @@ EventChannelBindVirq(
     }
 
     *LocalPort = op.port;
-    
+
     return STATUS_SUCCESS;
 
 fail1:
@@ -174,13 +174,13 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelQueryInterDomain(
-    IN  ULONG               LocalPort,
-    OUT USHORT              *RemoteDomain,
-    OUT ULONG               *RemotePort
+    _In_ ULONG              LocalPort,
+    _Out_ USHORT            *RemoteDomain,
+    _Out_ ULONG             *RemotePort
     )
 {
     struct evtchn_status    op;
@@ -215,11 +215,11 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelClose(
-    IN  ULONG           LocalPort
+    _In_ ULONG          LocalPort
     )
 {
     struct evtchn_close op;
@@ -243,11 +243,11 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelExpandArray(
-    IN  PFN_NUMBER              Pfn
+    _In_ PFN_NUMBER             Pfn
     )
 {
     struct evtchn_expand_array  op;
@@ -271,12 +271,12 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelInitControl(
-    IN  PFN_NUMBER              Pfn,
-    IN  unsigned int            vcpu_id
+    _In_ PFN_NUMBER             Pfn,
+    _In_ unsigned int           vcpu_id
     )
 {
     struct evtchn_init_control  op;
@@ -302,7 +302,7 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelReset(
@@ -330,12 +330,12 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelBindVirtualCpu(
-    IN  ULONG               LocalPort,
-    IN  unsigned int        vcpu_id
+    _In_ ULONG              LocalPort,
+    _In_ unsigned int       vcpu_id
     )
 {
     struct evtchn_bind_vcpu op;
@@ -360,11 +360,11 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 EventChannelUnmask(
-    IN  ULONG               LocalPort
+    _In_ ULONG              LocalPort
     )
 {
     struct evtchn_unmask    op;
diff --git a/src/xen/filters.c b/src/xen/filters.c
index 36a266f..b643404 100644
--- a/src/xen/filters.c
+++ b/src/xen/filters.c
@@ -49,7 +49,7 @@
 
 static FORCEINLINE PVOID
 __FiltersAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_FILTERS_TAG);
@@ -57,7 +57,7 @@ __FiltersAllocate(
 
 static FORCEINLINE VOID
 __FiltersFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_FILTERS_TAG);
@@ -67,9 +67,9 @@ __FiltersFree(
 
 static NTSTATUS
 FiltersInstallClass(
-    IN  const CHAR  *ClassName,
-    IN  const GUID  *ClassGuid,
-    IN  const CHAR  *DriverName
+    _In_ const CHAR *ClassName,
+    _In_ const GUID *ClassGuid,
+    _In_ const CHAR *DriverName
     )
 {
     HANDLE          ClassKey;
@@ -196,9 +196,9 @@ fail1:
 
 static NTSTATUS
 FiltersUninstallClass(
-    IN  const CHAR  *ClassName,
-    IN  const GUID  *ClassGuid,
-    IN  const CHAR  *DriverName
+    _In_ const CHAR *ClassName,
+    _In_ const GUID *ClassGuid,
+    _In_ const CHAR *DriverName
     )
 {
     HANDLE          ClassKey;
diff --git a/src/xen/grant_table.c b/src/xen/grant_table.c
index 65c7d13..96a5a26 100644
--- a/src/xen/grant_table.c
+++ b/src/xen/grant_table.c
@@ -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.
  */
 
@@ -73,19 +73,19 @@
 
 static LONG_PTR
 GrantTableOp(
-    IN  ULONG   Command,
-    IN  PVOID   Argument,
-    IN  ULONG   Count
+    _In_ ULONG  Command,
+    _In_ PVOID  Argument,
+    _In_ ULONG  Count
     )
 {
     return HYPERCALL(LONG_PTR, grant_table_op, 3, Command, Argument, Count);
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableSetVersion(
-    IN  uint32_t                Version
+    _In_ uint32_t               Version
     )
 {
     struct gnttab_set_version   op;
@@ -109,11 +109,11 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableGetVersion(
-    OUT uint32_t                *Version
+    _Out_ uint32_t              *Version
     )
 {
     struct gnttab_get_version   op;
@@ -139,12 +139,12 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableCopy(
-    IN  struct gnttab_copy  op[],
-    IN  ULONG               Count
+    _In_ struct gnttab_copy op[],
+    _In_ ULONG              Count
     )
 {
     LONG_PTR                rc;
@@ -165,15 +165,15 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableMapForeignPage(
-    IN  USHORT                  Domain,
-    IN  ULONG                   GrantRef,
-    IN  PHYSICAL_ADDRESS        Address,
-    IN  BOOLEAN                 ReadOnly,
-    OUT ULONG                   *Handle
+    _In_ USHORT                 Domain,
+    _In_ ULONG                  GrantRef,
+    _In_ PHYSICAL_ADDRESS       Address,
+    _In_ BOOLEAN                ReadOnly,
+    _Out_ ULONG                 *Handle
     )
 {
     struct gnttab_map_grant_ref op;
@@ -220,12 +220,12 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableUnmapForeignPage(
-    IN  ULONG                     Handle,
-    IN  PHYSICAL_ADDRESS          Address
+    _In_ ULONG                    Handle,
+    _In_ PHYSICAL_ADDRESS         Address
     )
 {
     struct gnttab_unmap_grant_ref op;
@@ -264,12 +264,12 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 GrantTableQuerySize(
-    OUT uint32_t                *Current OPTIONAL,
-    OUT uint32_t                *Maximum OPTIONAL
+    _Out_opt_ uint32_t          *Current,
+    _Out_opt_ uint32_t          *Maximum
     )
 {
     struct gnttab_query_size    op;
diff --git a/src/xen/hvm.c b/src/xen/hvm.c
index 9887681..6dea2ab 100644
--- a/src/xen/hvm.c
+++ b/src/xen/hvm.c
@@ -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.
  */
 
@@ -41,19 +41,19 @@
 
 static LONG_PTR
 HvmOp(
-    IN  ULONG   Command,
-    IN  PVOID   Argument
+    _In_ ULONG  Command,
+    _In_ PVOID  Argument
     )
 {
     return HYPERCALL(LONG_PTR, hvm_op, 2, Command, Argument);
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 HvmSetParam(
-    IN  ULONG               Parameter,
-    IN  ULONGLONG           Value
+    _In_ ULONG              Parameter,
+    _In_ ULONGLONG          Value
     )
 {
     struct xen_hvm_param    op;
@@ -65,7 +65,7 @@ HvmSetParam(
     op.value = Value;
 
     rc = HvmOp(HVMOP_set_param, &op);
-    
+
     if (rc < 0) {
         ERRNO_TO_STATUS(-rc, status);
         goto fail1;
@@ -78,13 +78,13 @@ fail1:
 
     return status;
 }
-    
-__checkReturn
+
+_Check_return_
 XEN_API
 NTSTATUS
 HvmGetParam(
-    IN  ULONG               Parameter,
-    OUT PULONGLONG          Value
+    _In_ ULONG              Parameter,
+    _Out_ PULONGLONG        Value
     )
 {
     struct xen_hvm_param    op;
@@ -96,7 +96,7 @@ HvmGetParam(
     op.value = 0xFEEDFACE;
 
     rc = HvmOp(HVMOP_get_param, &op);
-    
+
     if (rc < 0) {
         ERRNO_TO_STATUS(-rc, status);
         goto fail1;
@@ -113,11 +113,11 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 HvmPagetableDying(
-    IN  PHYSICAL_ADDRESS            Address
+    _In_ PHYSICAL_ADDRESS           Address
     )
 {
     struct xen_hvm_pagetable_dying  op;
@@ -128,7 +128,7 @@ HvmPagetableDying(
     op.gpa = Address.QuadPart;
 
     rc = HvmOp(HVMOP_pagetable_dying, &op);
-    
+
     if (rc < 0) {
         ERRNO_TO_STATUS(-rc, status);
         goto fail1;
@@ -140,12 +140,12 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 HvmSetEvtchnUpcallVector(
-    IN  unsigned int                    vcpu_id,
-    IN  UCHAR                           Vector
+    _In_ unsigned int                   vcpu_id,
+    _In_ UCHAR                          Vector
     )
 {
     struct xen_hvm_evtchn_upcall_vector op;
diff --git a/src/xen/log.c b/src/xen/log.c
index 20c9a4a..c81c834 100644
--- a/src/xen/log.c
+++ b/src/xen/log.c
@@ -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.
  */
 
@@ -73,8 +73,8 @@ static LOG_CONTEXT  LogContext;
 
 static FORCEINLINE VOID
 __LogFlushSlot(
-    IN  PLOG_CONTEXT    Context,
-    IN  PLOG_SLOT       Slot
+    _In_ PLOG_CONTEXT   Context,
+    _In_ PLOG_SLOT      Slot
     )
 {
     ULONG               Index;
@@ -94,7 +94,7 @@ __LogFlushSlot(
 
 static VOID
 LogFlush(
-    IN  PLOG_CONTEXT    Context
+    _In_ PLOG_CONTEXT   Context
     )
 {
     ULONG               Index;
@@ -111,8 +111,8 @@ LogFlush(
 
 static FORCEINLINE VOID
 __LogPut(
-    IN  PLOG_SLOT   Slot,
-    IN  CHAR        Character
+    _In_ PLOG_SLOT  Slot,
+    _In_ CHAR       Character
     )
 {
     if (Slot->Offset >= LOG_BUFFER_SIZE)
@@ -123,10 +123,10 @@ __LogPut(
 
 static PCHAR
 LogFormatNumber(
-    IN  PCHAR       Buffer,
-    IN  ULONGLONG   Value,
-    IN  UCHAR       Base,
-    IN  BOOLEAN     UpperCase
+    _In_ PCHAR      Buffer,
+    _In_ ULONGLONG  Value,
+    _In_ UCHAR      Base,
+    _In_ BOOLEAN    UpperCase
     )
 {
     ULONGLONG       Next = Value / Base;
@@ -183,10 +183,10 @@ LogFormatNumber(
 
 static VOID
 LogWriteSlot(
-    IN  PLOG_SLOT   Slot,
-    IN  LONG        Count,
-    IN  const CHAR  *Format,
-    IN  va_list     Arguments
+    _In_ PLOG_SLOT  Slot,
+    _In_ LONG       Count,
+    _In_ const CHAR *Format,
+    _In_ va_list    Arguments
     )
 {
     CHAR            Character;
@@ -197,7 +197,7 @@ LogWriteSlot(
         BOOLEAN Wide = FALSE;
         BOOLEAN ZeroPrefix = FALSE;
         BOOLEAN OppositeJustification = FALSE;
-        
+
         if (Character != '%') {
             __LogPut(Slot, Character);
             goto loop;
@@ -249,7 +249,7 @@ LogWriteSlot(
                 Value = va_arg(Arguments, WCHAR);
 
                 __LogPut(Slot, (CHAR)Value);
-            } else { 
+            } else {
                 CHAR    Value;
 
                 Value = va_arg(Arguments, CHAR);
@@ -432,10 +432,10 @@ loop:
 XEN_API
 VOID
 LogCchVPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  ULONG       Count,
-    IN  const CHAR  *Format,
-    IN  va_list     Arguments
+    _In_ LOG_LEVEL  Level,
+    _In_ ULONG      Count,
+    _In_ const CHAR *Format,
+    _In_ va_list    Arguments
     )
 {
     PLOG_CONTEXT    Context = &LogContext;
@@ -463,9 +463,9 @@ LogCchVPrintf(
 XEN_API
 VOID
 LogVPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  const CHAR  *Format,
-    IN  va_list     Arguments
+    _In_ LOG_LEVEL  Level,
+    _In_ const CHAR *Format,
+    _In_ va_list    Arguments
     )
 {
     LogCchVPrintf(Level, LOG_BUFFER_SIZE, Format, Arguments);
@@ -474,9 +474,9 @@ LogVPrintf(
 XEN_API
 VOID
 LogCchPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  ULONG       Count,
-    IN  const CHAR  *Format,
+    _In_ LOG_LEVEL  Level,
+    _In_ ULONG      Count,
+    _In_ const CHAR *Format,
     ...
     )
 {
@@ -490,8 +490,8 @@ LogCchPrintf(
 XEN_API
 VOID
 LogPrintf(
-    IN  LOG_LEVEL   Level,
-    IN  const CHAR  *Format,
+    _In_ LOG_LEVEL  Level,
+    _In_ const CHAR *Format,
     ...
     )
 {
@@ -517,10 +517,10 @@ _IRQL_requires_(DISPATCH_LEVEL)
 _IRQL_requires_same_
 VOID
 LogDpc(
-    IN  PKDPC       Dpc,
-    IN  PVOID       _Context,
-    IN  PVOID       Argument1,
-    IN  PVOID       Argument2
+    _In_ PKDPC      Dpc,
+    _In_ PVOID      _Context,
+    _In_ PVOID      Argument1,
+    _In_ PVOID      Argument2
     )
 {
     PLOG_CONTEXT    Context = &LogContext;
@@ -538,9 +538,9 @@ LogDpc(
 
 static VOID
 LogDebugPrint(
-    IN  PANSI_STRING    Ansi,
-    IN  ULONG           ComponentId,
-    IN  ULONG           Level
+    _In_ PANSI_STRING   Ansi,
+    _In_ ULONG          ComponentId,
+    _In_ ULONG          Level
     )
 {
     PLOG_CONTEXT        Context = &LogContext;
@@ -588,7 +588,7 @@ LogTeardown(
     PLOG_CONTEXT    Context = &LogContext;
 
     if (Context->Enabled) {
-        (VOID) DbgSetDebugPrintCallback(LogDebugPrint, FALSE); 
+        (VOID) DbgSetDebugPrintCallback(LogDebugPrint, FALSE);
         Context->Enabled = FALSE;
     }
 
@@ -602,10 +602,10 @@ LogTeardown(
 
 NTSTATUS
 LogAddDisposition(
-    IN  LOG_LEVEL           Mask,
-    IN  VOID                (*Function)(PVOID, PCHAR, ULONG),
-    IN  PVOID               Argument OPTIONAL,
-    OUT PLOG_DISPOSITION    *Disposition
+    _In_ LOG_LEVEL          Mask,
+    _In_ VOID               (*Function)(PVOID, PCHAR, ULONG),
+    _In_opt_ PVOID          Argument,
+    _Out_ PLOG_DISPOSITION  *Disposition
     )
 {
     PLOG_CONTEXT            Context = &LogContext;
@@ -653,7 +653,7 @@ fail1:
 
 extern VOID
 LogRemoveDisposition(
-    IN  PLOG_DISPOSITION    Disposition
+    _In_ PLOG_DISPOSITION   Disposition
     )
 {
     PLOG_CONTEXT            Context = &LogContext;
@@ -736,15 +736,15 @@ static const XEN_LOG_LEVEL_NAME XenLogLevelNames[] = {
 XEN_API
 NTSTATUS
 LogReadLogLevel(
-    IN  HANDLE      Key,
-    IN  PCHAR       Name,
-    OUT PLOG_LEVEL  LogLevel
+    _In_ HANDLE         Key,
+    _In_ PCHAR          Name,
+    _Out_ PLOG_LEVEL    LogLevel
     )
 {
-    PANSI_STRING    Values;
-    ULONG           Type;
-    ULONG           Index;
-    NTSTATUS        status;
+    PANSI_STRING        Values;
+    ULONG               Type;
+    ULONG               Index;
+    NTSTATUS            status;
 
     status = RegistryQuerySzValue(Key,
                                   Name,
diff --git a/src/xen/memory.c b/src/xen/memory.c
index bc12140..6a3a3d0 100644
--- a/src/xen/memory.c
+++ b/src/xen/memory.c
@@ -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.
  */
 
@@ -41,20 +41,20 @@
 
 static FORCEINLINE LONG_PTR
 MemoryOp(
-    IN  ULONG   Command,
-    IN  PVOID   Argument
+    _In_ ULONG  Command,
+    _In_ PVOID  Argument
     )
 {
     return HYPERCALL(LONG_PTR, memory_op, 2, Command, Argument);
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 MemoryAddToPhysmap(
-    IN  PFN_NUMBER              Pfn,
-    IN  ULONG                   Space,
-    IN  ULONG_PTR               Offset
+    _In_ PFN_NUMBER             Pfn,
+    _In_ ULONG                  Space,
+    _In_ ULONG_PTR              Offset
     )
 {
     struct xen_add_to_physmap   op;
@@ -81,11 +81,11 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 MemoryRemoveFromPhysmap(
-    IN  PFN_NUMBER                  Pfn
+    _In_ PFN_NUMBER                 Pfn
     )
 {
     struct xen_remove_from_physmap  op;
@@ -110,13 +110,13 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 ULONG
 MemoryDecreaseReservation(
-    IN  ULONG                       Order,
-    IN  ULONG                       Count,
-    IN  PPFN_NUMBER                 PfnArray
+    _In_ ULONG                      Order,
+    _In_ ULONG                      Count,
+    _In_ PPFN_NUMBER                PfnArray
     )
 {
     struct xen_memory_reservation   op;
@@ -133,13 +133,13 @@ MemoryDecreaseReservation(
     return (ULONG)rc;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 ULONG
 MemoryPopulatePhysmap(
-    IN  ULONG                       Order,
-    IN  ULONG                       Count,
-    IN  PPFN_NUMBER                 PfnArray
+    _In_ ULONG                      Order,
+    _In_ ULONG                      Count,
+    _In_ PPFN_NUMBER                PfnArray
     )
 {
     struct xen_memory_reservation   op;
diff --git a/src/xen/module.c b/src/xen/module.c
index 1f0212f..6c804bc 100644
--- a/src/xen/module.c
+++ b/src/xen/module.c
@@ -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.
  */
 
@@ -62,7 +62,7 @@ static MODULE_CONTEXT   ModuleContext;
 
 static FORCEINLINE PVOID
 __ModuleAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, MODULE_TAG);
@@ -70,7 +70,7 @@ __ModuleAllocate(
 
 static FORCEINLINE VOID
 __ModuleFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, MODULE_TAG);
@@ -78,8 +78,8 @@ __ModuleFree(
 
 static VOID
 ModuleSearchForwards(
-    IN  PMODULE_CONTEXT Context,
-    IN  ULONG_PTR       Address
+    _In_ PMODULE_CONTEXT    Context,
+    _In_ ULONG_PTR          Address
     )
 {
     while (Context->Cursor != &Context->List) {
@@ -96,8 +96,8 @@ ModuleSearchForwards(
 
 static VOID
 ModuleSearchBackwards(
-    IN  PMODULE_CONTEXT Context,
-    IN  ULONG_PTR       Address
+    _In_ PMODULE_CONTEXT    Context,
+    _In_ ULONG_PTR          Address
     )
 {
     while (Context->Cursor != &Context->List) {
@@ -114,10 +114,10 @@ ModuleSearchBackwards(
 
 static NTSTATUS
 ModuleAdd(
-    IN  PMODULE_CONTEXT Context,
-    IN  PCHAR           Name,
-    IN  ULONG_PTR       Start,
-    IN  ULONG_PTR       Size
+    _In_ PMODULE_CONTEXT    Context,
+    _In_ PCHAR              Name,
+    _In_ ULONG_PTR          Start,
+    _In_ ULONG_PTR          Size
     )
 {
 #define INSERT_AFTER(_Cursor, _New)             \
@@ -221,7 +221,7 @@ again:
         }
     } else {
         PLIST_ENTRY Cursor;
-        
+
         Cursor = (Context->Cursor->Flink != &Context->List) ?
                  Context->Cursor->Flink :
                  Context->Cursor->Blink;
@@ -264,12 +264,12 @@ fail1:
 #undef  INSERT_BEFORE
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static VOID
 ModuleLoad(
-    IN  PUNICODE_STRING FullImageName,
-    IN  HANDLE          ProcessId,
-    IN  PIMAGE_INFO     ImageInfo
+    _In_ PUNICODE_STRING    FullImageName,
+    _In_ HANDLE             ProcessId,
+    _In_ PIMAGE_INFO        ImageInfo
     )
 {
     PMODULE_CONTEXT     Context = &ModuleContext;
@@ -330,9 +330,9 @@ fail1:
 XEN_API
 VOID
 ModuleLookup(
-    IN  ULONG_PTR   Address,
-    OUT PCHAR       *Name,
-    OUT PULONG_PTR  Offset
+    _In_ ULONG_PTR  Address,
+    _Out_ PCHAR     *Name,
+    _Out_ PULONG_PTR Offset
     )
 {
     PMODULE_CONTEXT Context = &ModuleContext;
@@ -507,7 +507,7 @@ fail1:
 
     (VOID) InterlockedDecrement(&Context->References);
 
-    ASSERT(IsZeroMemory(Context, sizeof (MODULE_CONTEXT)));    
+    ASSERT(IsZeroMemory(Context, sizeof (MODULE_CONTEXT)));
 
     return status;
 }
diff --git a/src/xen/process.c b/src/xen/process.c
index 2ba6599..8e83188 100644
--- a/src/xen/process.c
+++ b/src/xen/process.c
@@ -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,9 +51,9 @@ static PROCESS_CONTEXT  ProcessContext;
 
 static VOID
 ProcessNotify(
-    IN  HANDLE                      ParentId,
-    IN  HANDLE                      ProcessId,
-    IN  BOOLEAN                     Create
+    _In_ HANDLE                     ParentId,
+    _In_ HANDLE                     ProcessId,
+    _In_ BOOLEAN                    Create
     )
 {
     KIRQL                           Irql;
@@ -71,7 +71,7 @@ ProcessNotify(
 
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
 
-    Address.QuadPart = __readcr3();   
+    Address.QuadPart = __readcr3();
     (VOID)HvmPagetableDying(Address);
 
     KeLowerIrql(Irql);
@@ -79,7 +79,7 @@ ProcessNotify(
 
 PCHAR
 ProcessGetImageFileName(
-    IN  PEPROCESS   Process
+    _In_ PEPROCESS  Process
     )
 {
     PPROCESS_CONTEXT    Context = &ProcessContext;
diff --git a/src/xen/process.h b/src/xen/process.h
index d25c8f0..9ae2ec9 100644
--- a/src/xen/process.h
+++ b/src/xen/process.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.
  */
 
@@ -46,7 +46,7 @@ ProcessTeardown(
 
 extern PCHAR
 ProcessGetImageFileName(
-    IN  PEPROCESS   Process
+    _In_ PEPROCESS  Process
     );
 
 #endif  // _XEN_PROCESS_H
diff --git a/src/xen/sched.c b/src/xen/sched.c
index a6e2a27..a9cac58 100644
--- a/src/xen/sched.c
+++ b/src/xen/sched.c
@@ -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.
  */
 
@@ -41,18 +41,18 @@
 
 static LONG_PTR
 SchedOp(
-    IN  ULONG   Command,
-    IN  PVOID   Argument
+    _In_ ULONG      Command,
+    _In_opt_ PVOID  Argument
     )
 {
     return HYPERCALL(LONG_PTR, sched_op, 2, Command, Argument);
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 SchedShutdownCode(
-    IN  ULONG               Reason
+    _In_ ULONG              Reason
     )
 {
     struct sched_shutdown   op;
@@ -62,7 +62,7 @@ SchedShutdownCode(
     op.reason = Reason;
 
     rc = SchedOp(SCHEDOP_shutdown_code, &op);
-    
+
     if (rc < 0) {
         ERRNO_TO_STATUS(-rc, status);
         goto fail1;
@@ -76,11 +76,11 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 SchedShutdown(
-    IN  ULONG               Reason
+    _In_ ULONG              Reason
     )
 {
     struct sched_shutdown   op;
@@ -124,8 +124,8 @@ SchedYield(
 XEN_API
 NTSTATUS
 SchedWatchdog(
-    IN OUT  PULONG          Id,
-    IN      ULONG           Seconds
+    _Inout_ PULONG          Id,
+    _In_ ULONG              Seconds
     )
 {
     struct sched_watchdog   op;
diff --git a/src/xen/system.c b/src/xen/system.c
index 844deea..b813326 100644
--- a/src/xen/system.c
+++ b/src/xen/system.c
@@ -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.
  */
 
@@ -85,7 +85,7 @@ static SYSTEM_CONTEXT   SystemContext;
 
 static FORCEINLINE PVOID
 __SystemAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XEN_SYSTEM_TAG);
@@ -93,7 +93,7 @@ __SystemAllocate(
 
 static FORCEINLINE VOID
 __SystemFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XEN_SYSTEM_TAG);
@@ -101,7 +101,7 @@ __SystemFree(
 
 static FORCEINLINE const CHAR *
 __PlatformIdName(
-    IN  ULONG   PlatformId
+    _In_ ULONG  PlatformId
     )
 {
 #define PLATFORM_ID_NAME(_PlatformId)       \
@@ -122,7 +122,7 @@ __PlatformIdName(
 
 static FORCEINLINE const CHAR *
 __SuiteName(
-    IN  ULONG  SuiteBit
+    _In_ ULONG SuiteBit
     )
 {
 #define SUITE_NAME(_Suite)          \
@@ -155,7 +155,7 @@ __SuiteName(
 
 static FORCEINLINE const CHAR *
 __ProductTypeName(
-    IN  UCHAR   ProductType
+    _In_ UCHAR  ProductType
     )
 {
 #define PRODUCT_TYPE_NAME(_ProductType) \
@@ -174,7 +174,7 @@ __ProductTypeName(
 #undef  PRODUCT_TYPE_NAME
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 SystemGetVersionInformation(
     VOID
@@ -207,7 +207,7 @@ SystemGetVersionInformation(
          __PlatformIdName(VersionInformation.dwPlatformId));
 #else
 #error 'Unrecognised architecture'
-#endif    
+#endif
 
     if (VersionInformation.wServicePackMajor != 0 ||
         VersionInformation.wServicePackMinor != 0)
@@ -326,7 +326,7 @@ fail1:
 
 static UCHAR
 SystemApicIDToProcessorID(
-    IN  UCHAR   ApicID
+    _In_ UCHAR  ApicID
     )
 {
     PSYSTEM_CONTEXT Context = &SystemContext;
@@ -357,7 +357,7 @@ SystemApicIDToProcessorID(
 
 static VOID
 SystemViridianInformation(
-    IN  ULONG   Count
+    _In_ ULONG  Count
     )
 {
     ULONG       EAX;
@@ -573,7 +573,7 @@ done:
 
 static VOID
 SystemProcessorInitialize(
-    IN  ULONG           Cpu
+    _In_ ULONG          Cpu
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
@@ -617,7 +617,7 @@ SystemProcessorInitialize(
 
 static VOID
 SystemProcessorTeardown(
-    IN  ULONG           Cpu
+    _In_ ULONG          Cpu
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
@@ -633,8 +633,8 @@ SystemProcessorTeardown(
 XEN_API
 NTSTATUS
 SystemProcessorVcpuId(
-    IN  ULONG           Cpu,
-    OUT unsigned int    *vcpu_id
+    _In_ ULONG          Cpu,
+    _Out_ unsigned int  *vcpu_id
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
@@ -660,8 +660,8 @@ fail1:
 XEN_API
 NTSTATUS
 SystemProcessorVcpuInfo(
-    IN  ULONG           Cpu,
-    OUT vcpu_info_t     **Vcpu
+    _In_ ULONG          Cpu,
+    _Out_ vcpu_info_t   **Vcpu
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
@@ -693,8 +693,8 @@ fail1:
 XEN_API
 NTSTATUS
 SystemProcessorRegisterVcpuInfo(
-    IN  ULONG           Cpu,
-    IN  BOOLEAN         Force
+    _In_ ULONG          Cpu,
+    _In_ BOOLEAN        Force
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
@@ -773,7 +773,7 @@ fail1:
 
 static VOID
 SystemProcessorDeregisterVcpuInfo(
-    IN  ULONG           Cpu
+    _In_ ULONG          Cpu
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
@@ -794,10 +794,10 @@ _IRQL_requires_(DISPATCH_LEVEL)
 _IRQL_requires_same_
 VOID
 SystemProcessorDpc(
-    IN  PKDPC           Dpc,
-    IN  PVOID           _Context,
-    IN  PVOID           Argument1,
-    IN  PVOID           Argument2
+    _In_ PKDPC          Dpc,
+    _In_ PVOID          _Context,
+    _In_ PVOID          Argument1,
+    _In_ PVOID          Argument2
     )
 {
     PSYSTEM_CONTEXT     Context = &SystemContext;
@@ -843,9 +843,9 @@ static
 _Function_class_(PROCESSOR_CALLBACK_FUNCTION)
 VOID
 SystemProcessorChangeCallback(
-    IN      PVOID                               Argument,
-    IN      PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT Change,
-    IN OUT  PNTSTATUS                           Status
+    _In_ PVOID                                  Argument,
+    _In_ PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT    Change,
+    _Inout_ PNTSTATUS                           Status
     )
 {
     PSYSTEM_CONTEXT                             Context = &SystemContext;
@@ -1033,7 +1033,7 @@ SystemGetStartOptions(
     NTSTATUS        status;
 
     RtlInitUnicodeString(&Unicode, 
L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control");
-    
+
     status = RegistryOpenKey(NULL, &Unicode, KEY_READ, &Key);
     if (!NT_SUCCESS(status))
         goto fail1;
@@ -1071,17 +1071,17 @@ fail1:
 
 static NTSTATUS
 SystemRegisterCallback(
-    IN  PWCHAR              Name,
-    IN  PCALLBACK_FUNCTION  Function,
-    IN  PVOID               Argument,
-    OUT PVOID               *Handle
+    _In_ PWCHAR             Name,
+    _In_ PCALLBACK_FUNCTION Function,
+    _In_opt_ PVOID          Argument,
+    _Out_ PVOID             *Handle
     )
 {
     UNICODE_STRING          Unicode;
     OBJECT_ATTRIBUTES       Attributes;
     PCALLBACK_OBJECT        Object;
     NTSTATUS                status;
-    
+
     RtlInitUnicodeString(&Unicode, Name);
 
     InitializeObjectAttributes(&Attributes,
@@ -1122,7 +1122,7 @@ fail1:
 
 static VOID
 SystemDeregisterCallback(
-    IN  PVOID   Handle
+    _In_ PVOID  Handle
     )
 {
     ExUnregisterCallback(Handle);
@@ -1130,11 +1130,12 @@ SystemDeregisterCallback(
 
 CALLBACK_FUNCTION   SystemPowerStateCallback;
 
+_Use_decl_annotations_
 VOID
 SystemPowerStateCallback(
-    IN  PVOID   _Context,
-    IN  PVOID   Argument1,
-    IN  PVOID   Argument2
+    PVOID       _Context,
+    PVOID       Argument1,
+    PVOID       Argument2
     )
 {
     ULONG_PTR   Type = (ULONG_PTR)Argument1;
@@ -1401,7 +1402,7 @@ SystemRealTimeIsUniversal(
 XEN_API
 NTSTATUS
 SystemSetWatchdog(
-    IN  ULONG       Seconds
+    _In_ ULONG      Seconds
     )
 {
     PSYSTEM_CONTEXT Context = &SystemContext;
diff --git a/src/xen/unplug.c b/src/xen/unplug.c
index 3121005..bdf5843 100644
--- a/src/xen/unplug.c
+++ b/src/xen/unplug.c
@@ -66,7 +66,7 @@ static UNPLUG_CONTEXT   UnplugContext;
 
 static FORCEINLINE PVOID
 __UnplugAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, UNPLUG_TAG);
@@ -74,7 +74,7 @@ __UnplugAllocate(
 
 static FORCEINLINE VOID
 __UnplugFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, UNPLUG_TAG);
@@ -107,7 +107,7 @@ UnplugSetBootEmulated(
 
 static VOID
 UnplugDeviceType(
-    IN  UNPLUG_TYPE Type
+    _In_ UNPLUG_TYPE    Type
     )
 {
     PUNPLUG_CONTEXT Context = &UnplugContext;
@@ -193,9 +193,9 @@ fail1:
 
 static NTSTATUS
 UnplugCheckEnumKeyCallback(
-    IN  PVOID           Context,
-    IN  HANDLE          Key,
-    IN  PANSI_STRING    Name
+    _In_ PVOID          Context,
+    _In_ HANDLE         Key,
+    _In_ PANSI_STRING   Name
     )
 {
     PUNPLUG_DATA        Data = Context;
@@ -210,8 +210,8 @@ UnplugCheckEnumKeyCallback(
 
 static NTSTATUS
 UnplugCheckEnumKey(
-    IN  PCHAR           EnumName,
-    OUT PULONG          Value
+    _In_ PCHAR          EnumName,
+    _Out_ PULONG        Value
     )
 {
     UNICODE_STRING      Unicode;
@@ -261,7 +261,7 @@ fail1:
 
 static VOID
 UnplugSetRequest(
-    IN  UNPLUG_TYPE     Type
+    _In_ UNPLUG_TYPE    Type
     )
 {
     PUNPLUG_CONTEXT     Context = &UnplugContext;
@@ -317,7 +317,7 @@ done:
 XEN_API
 NTSTATUS
 UnplugIncrementValue(
-    IN  UNPLUG_TYPE     Type
+    _In_ UNPLUG_TYPE    Type
     )
 {
     HANDLE              UnplugKey;
@@ -368,7 +368,7 @@ fail1:
 XEN_API
 NTSTATUS
 UnplugDecrementValue(
-    IN  UNPLUG_TYPE     Type
+    _In_ UNPLUG_TYPE    Type
     )
 {
     HANDLE              UnplugKey;
@@ -427,12 +427,12 @@ fail1:
 XEN_API
 BOOLEAN
 UnplugGetRequest(
-    IN  UNPLUG_TYPE Type
+    _In_ UNPLUG_TYPE    Type
     )
 {
-    PUNPLUG_CONTEXT Context = &UnplugContext;
-    KIRQL           Irql;
-    BOOLEAN         Request;
+    PUNPLUG_CONTEXT     Context = &UnplugContext;
+    KIRQL               Irql;
+    BOOLEAN             Request;
 
     AcquireHighLock(&Context->Lock, &Irql);
     Request = Context->Request[Type];
diff --git a/src/xen/vcpu.c b/src/xen/vcpu.c
index 552b3b3..12ec8a4 100644
--- a/src/xen/vcpu.c
+++ b/src/xen/vcpu.c
@@ -39,20 +39,20 @@
 
 static LONG_PTR
 VcpuOp(
-    IN  ULONG           Command,
-    IN  unsigned int    vcpu_id,
-    IN  PVOID           Argument
+    _In_ ULONG          Command,
+    _In_ unsigned int   vcpu_id,
+    _In_opt_ PVOID      Argument
     )
 {
     return HYPERCALL(LONG_PTR, vcpu_op, 3, Command, vcpu_id, Argument);
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 VcpuSetPeriodicTimer(
-    IN  unsigned int                vcpu_id,
-    IN  PLARGE_INTEGER              Period
+    _In_ unsigned int               vcpu_id,
+    _In_opt_ PLARGE_INTEGER         Period
     )
 {
     LONG_PTR                        rc;
@@ -81,13 +81,13 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 VcpuRegisterVcpuInfo(
-    IN  unsigned int                vcpu_id,
-    IN  PFN_NUMBER                  Pfn,
-    IN  ULONG                       Offset
+    _In_ unsigned int               vcpu_id,
+    _In_ PFN_NUMBER                 Pfn,
+    _In_ ULONG                      Offset
     )
 {
     struct vcpu_register_vcpu_info  op;
diff --git a/src/xen/xen_version.c b/src/xen/xen_version.c
index 3fa20b7..4cff07f 100644
--- a/src/xen/xen_version.c
+++ b/src/xen/xen_version.c
@@ -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.
  */
 
@@ -41,19 +41,19 @@
 
 static FORCEINLINE LONG_PTR
 XenVersionOp(
-    IN  ULONG   Command,
-    IN  PVOID   Argument
+    _In_ ULONG      Command,
+    _In_opt_ PVOID  Argument
     )
 {
     return HYPERCALL(LONG_PTR, xen_version, 2, Command, Argument);
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 XenVersion(
-    OUT PULONG  Major,
-    OUT PULONG  Minor
+    _Out_ PULONG    Major,
+    _Out_ PULONG    Minor
     )
 {
     LONG_PTR                    rc;
@@ -77,16 +77,16 @@ fail1:
     return status;
 }
 
-__checkReturn
+_Check_return_
 XEN_API
 NTSTATUS
 XenVersionExtra(
-    OUT PCHAR           Extra
+    _Out_writes_(XEN_EXTRAVERSION_LEN) PCHAR    Extra
     )
 {
-    xen_extraversion_t  op;
-    LONG_PTR            rc;
-    NTSTATUS            status;
+    xen_extraversion_t                          op;
+    LONG_PTR                                    rc;
+    NTSTATUS                                    status;
 
     RtlZeroMemory(&op, sizeof (op));
 
diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
index 0e2ef05..98c2f79 100644
--- a/src/xenbus/balloon.c
+++ b/src/xenbus/balloon.c
@@ -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.
  */
 
@@ -70,7 +70,7 @@ struct _XENBUS_BALLOON_CONTEXT {
 
 static FORCEINLINE PVOID
 __BalloonAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_BALLOON_TAG);
@@ -78,7 +78,7 @@ __BalloonAllocate(
 
 static FORCEINLINE VOID
 __BalloonFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_BALLOON_TAG);
@@ -94,13 +94,13 @@ __BalloonFree(
 
 static VOID
 BalloonHeapPushDown(
-    IN  PPFN_NUMBER Heap,
-    IN  ULONG       Start,
-    IN  ULONG       Count
+    _In_ PPFN_NUMBER    Heap,
+    _In_ ULONG          Start,
+    _In_ ULONG          Count
     )
 {
-    ULONG           LeftChild;
-    ULONG           RightChild;
+    ULONG               LeftChild;
+    ULONG               RightChild;
 
 again:
     LeftChild = Start * 2 + 1;
@@ -160,11 +160,11 @@ again:
 // Turn an array of PFNs into a max heap (largest node at root)
 static VOID
 BalloonCreateHeap(
-    IN  PPFN_NUMBER PfnArray,
-    IN  ULONG       Count
+    _In_ PPFN_NUMBER    PfnArray,
+    _In_ ULONG          Count
     )
 {
-    LONG            Index = (LONG)Count;
+    LONG                Index = (LONG)Count;
 
     while (--Index >= 0)
         BalloonHeapPushDown(PfnArray, (ULONG)Index, Count);
@@ -172,13 +172,13 @@ BalloonCreateHeap(
 
 static VOID
 BalloonSort(
-    IN  PXENBUS_BALLOON_CONTEXT Context,
-    IN  ULONG                   Count
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONG                      Count
     )
 {
-    PPFN_NUMBER                 PfnArray;
-    ULONG                       Unsorted;
-    ULONG                       Index;
+    PPFN_NUMBER                     PfnArray;
+    ULONG                           Unsorted;
+    ULONG                           Index;
 
     PfnArray = Context->PfnArray;
 
@@ -194,10 +194,10 @@ BalloonSort(
         ASSERT3U(PfnArray[Index], <, PfnArray[Index + 1]);
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static PMDL
 BalloonAllocatePagesForMdl(
-    IN  ULONG       Count
+    _In_ ULONG      Count
     )
 {
     LARGE_INTEGER   LowAddress;
@@ -212,7 +212,7 @@ BalloonAllocatePagesForMdl(
     HighAddress.QuadPart = ~0ull;
     SkipBytes.QuadPart = 0ull;
     TotalBytes = (SIZE_T)Count << PAGE_SHIFT;
-    
+
     Mdl = MmAllocatePagesForMdlEx(LowAddress,
                                   HighAddress,
                                   SkipBytes,
@@ -236,8 +236,8 @@ done:
 
 static VOID
 BalloonFreePagesFromMdl(
-    IN  PMDL        Mdl,
-    IN  BOOLEAN     Check
+    _In_ PMDL       Mdl,
+    _In_ BOOLEAN    Check
     )
 {
     volatile UCHAR  *Mapping;
@@ -251,7 +251,7 @@ BalloonFreePagesFromMdl(
 
     // Sanity check:
     //
-    // Make sure that things written to the page really do stick. 
+    // Make sure that things written to the page really do stick.
     // If the page is still ballooned out at the hypervisor level
     // then writes will be discarded and reads will give back
     // all 1s.
@@ -321,9 +321,9 @@ done:
 
 static ULONG
 BalloonAllocatePfnArray(
-    IN      PXENBUS_BALLOON_CONTEXT Context,
-    IN      ULONG                   Requested,
-    IN OUT  PBOOLEAN                Slow
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONG                      Requested,
+    _Inout_ PBOOLEAN                Slow
     )
 {
     LARGE_INTEGER                   Start;
@@ -371,15 +371,15 @@ done:
 
 static ULONG
 BalloonPopulatePhysmap(
-    IN  ULONG       Requested,
-    IN  PPFN_NUMBER PfnArray
+    _In_ ULONG          Requested,
+    _In_ PPFN_NUMBER    PfnArray
     )
 {
-    LARGE_INTEGER   Start;
-    LARGE_INTEGER   End;
-    ULONGLONG       TimeDelta;
-    ULONGLONG       Rate;
-    ULONG           Count;
+    LARGE_INTEGER       Start;
+    LARGE_INTEGER       End;
+    ULONGLONG           TimeDelta;
+    ULONGLONG           Rate;
+    ULONG               Count;
 
     ASSERT(Requested != 0);
 
@@ -398,8 +398,8 @@ BalloonPopulatePhysmap(
 
 static ULONG
 BalloonPopulatePfnArray(
-    IN      PXENBUS_BALLOON_CONTEXT Context,
-    IN      ULONG                   Requested
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONG                      Requested
     )
 {
     LARGE_INTEGER                   Start;
@@ -458,15 +458,15 @@ BalloonPopulatePfnArray(
 
 static ULONG
 BalloonDecreaseReservation(
-    IN  ULONG       Requested,
-    IN  PPFN_NUMBER PfnArray
+    _In_ ULONG          Requested,
+    _In_ PPFN_NUMBER    PfnArray
     )
 {
-    LARGE_INTEGER   Start;
-    LARGE_INTEGER   End;
-    ULONGLONG       TimeDelta;
-    ULONGLONG       Rate;
-    ULONG           Count;
+    LARGE_INTEGER       Start;
+    LARGE_INTEGER       End;
+    ULONGLONG           TimeDelta;
+    ULONGLONG           Rate;
+    ULONG               Count;
 
     ASSERT(Requested != 0);
 
@@ -485,8 +485,8 @@ BalloonDecreaseReservation(
 
 static ULONG
 BalloonReleasePfnArray(
-    IN      PXENBUS_BALLOON_CONTEXT Context,
-    IN      ULONG                   Requested
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONG                      Requested
     )
 {
     LARGE_INTEGER                   Start;
@@ -549,9 +549,9 @@ done:
 
 static ULONG
 BalloonFreePfnArray(
-    IN      PXENBUS_BALLOON_CONTEXT Context,
-    IN      ULONG                   Requested,
-    IN      BOOLEAN                 Check
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONG                      Requested,
+    _In_ BOOLEAN                    Check
     )
 {
     LARGE_INTEGER                   Start;
@@ -612,11 +612,11 @@ done:
 
 static BOOLEAN
 BalloonLowMemory(
-    IN  PXENBUS_BALLOON_CONTEXT Context
+    _In_ PXENBUS_BALLOON_CONTEXT    Context
     )
 {
-    LARGE_INTEGER               Timeout;
-    NTSTATUS                    status;
+    LARGE_INTEGER                   Timeout;
+    NTSTATUS                        status;
 
     Timeout.QuadPart = 0;
 
@@ -631,15 +631,15 @@ BalloonLowMemory(
 
 static NTSTATUS
 BalloonDeflate(
-    IN  PXENBUS_BALLOON_CONTEXT Context,
-    IN  ULONGLONG               Requested
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONGLONG                  Requested
     )
 {
-    LARGE_INTEGER               Start;
-    LARGE_INTEGER               End;
-    ULONGLONG                   Count;
-    ULONGLONG                   TimeDelta;
-    NTSTATUS                    status;
+    LARGE_INTEGER                   Start;
+    LARGE_INTEGER                   End;
+    ULONGLONG                       Count;
+    ULONGLONG                       TimeDelta;
+    NTSTATUS                        status;
 
     status = STATUS_UNSUCCESSFUL;
     if (Context->FIST.Deflation)
@@ -680,15 +680,15 @@ done:
 
 static NTSTATUS
 BalloonInflate(
-    IN  PXENBUS_BALLOON_CONTEXT Context,
-    IN  ULONGLONG               Requested
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONGLONG                  Requested
     )
 {
-    LARGE_INTEGER               Start;
-    LARGE_INTEGER               End;
-    ULONGLONG                   Count;
-    ULONGLONG                   TimeDelta;
-    NTSTATUS                    status;
+    LARGE_INTEGER                   Start;
+    LARGE_INTEGER                   End;
+    ULONGLONG                       Count;
+    ULONGLONG                       TimeDelta;
+    NTSTATUS                        status;
 
     status = STATUS_UNSUCCESSFUL;
     if (Context->FIST.Inflation)
@@ -747,11 +747,11 @@ done:
 
 static VOID
 BalloonGetFISTEntries(
-    IN  PXENBUS_BALLOON_CONTEXT Context
+    _In_ PXENBUS_BALLOON_CONTEXT    Context
     )
 {
-    PCHAR                       Buffer;
-    NTSTATUS                    status;
+    PCHAR                           Buffer;
+    NTSTATUS                        status;
 
     status = XENBUS_STORE(Read,
                           &Context->StoreInterface,
@@ -787,14 +787,14 @@ BalloonGetFISTEntries(
 
     if (Context->FIST.Inflation)
         Warning("inflation disallowed\n");
-        
+
     if (Context->FIST.Deflation)
         Warning("deflation disallowed\n");
 }
 
 static FORCEINLINE PCHAR
 __BalloonStatus(
-    IN  NTSTATUS    status
+    _In_ NTSTATUS   status
     )
 {
     switch (status) {
@@ -815,8 +815,8 @@ __BalloonStatus(
 
 NTSTATUS
 BalloonAdjust(
-    IN  PINTERFACE          Interface,
-    IN  ULONGLONG           Size
+    _In_ PINTERFACE         Interface,
+    _In_ ULONGLONG          Size
     )
 {
     PXENBUS_BALLOON_CONTEXT Context = Interface->Context;
@@ -846,7 +846,7 @@ BalloonAdjust(
 
 ULONGLONG
 BalloonGetSize(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_BALLOON_CONTEXT Context = Interface->Context;
@@ -856,7 +856,7 @@ BalloonGetSize(
 
 static NTSTATUS
 BalloonAcquire(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_BALLOON_CONTEXT Context = Interface->Context;
@@ -917,7 +917,7 @@ fail1:
 
 static VOID
 BalloonRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_BALLOON_CONTEXT Context = Interface->Context;
@@ -957,15 +957,15 @@ static struct _XENBUS_BALLOON_INTERFACE_V1 
BalloonInterfaceVersion1 = {
     BalloonAdjust,
     BalloonGetSize
 };
-                     
+
 NTSTATUS
 BalloonInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_BALLOON_CONTEXT *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_BALLOON_CONTEXT   *Context
     )
 {
-    UNICODE_STRING              Unicode;
-    NTSTATUS                    status;
+    UNICODE_STRING                  Unicode;
+    NTSTATUS                        status;
 
     Trace("====>\n");
 
@@ -1022,10 +1022,10 @@ fail1:
 
 NTSTATUS
 BalloonGetInterface(
-    IN      PXENBUS_BALLOON_CONTEXT Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     )
 {
     NTSTATUS                        status;
@@ -1056,11 +1056,11 @@ BalloonGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 BalloonGetReferences(
-    IN  PXENBUS_BALLOON_CONTEXT Context
+    _In_ PXENBUS_BALLOON_CONTEXT    Context
     )
 {
     return Context->References;
@@ -1068,7 +1068,7 @@ BalloonGetReferences(
 
 VOID
 BalloonTeardown(
-    IN  PXENBUS_BALLOON_CONTEXT Context
+    _In_ PXENBUS_BALLOON_CONTEXT    Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/balloon.h b/src/xenbus/balloon.h
index fd20b47..8a45d3c 100644
--- a/src/xenbus/balloon.h
+++ b/src/xenbus/balloon.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_BALLOON_CONTEXT  
XENBUS_BALLOON_CONTEXT, *PXENBUS_BALLOON
 
 extern NTSTATUS
 BalloonInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_BALLOON_CONTEXT *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_BALLOON_CONTEXT   *Context
     );
 
 extern NTSTATUS
 BalloonGetInterface(
-    IN      PXENBUS_BALLOON_CONTEXT Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_BALLOON_CONTEXT    Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     );
 
 extern ULONG
 BalloonGetReferences(
-    IN  PXENBUS_BALLOON_CONTEXT Context
+    _In_ PXENBUS_BALLOON_CONTEXT    Context
     );
 
 extern VOID
 BalloonTeardown(
-    IN  PXENBUS_BALLOON_CONTEXT Context
+    _In_ PXENBUS_BALLOON_CONTEXT    Context
     );
 
 #endif  // _XENBUS_BALLOON_H
diff --git a/src/xenbus/bus.c b/src/xenbus/bus.c
index 2f20a39..c97759c 100644
--- a/src/xenbus/bus.c
+++ b/src/xenbus/bus.c
@@ -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,7 +54,7 @@ typedef struct _XENBUS_BUS_CONTEXT {
 
 static FORCEINLINE PVOID
 __BusAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, BUS_TAG);
@@ -62,7 +62,7 @@ __BusAllocate(
 
 static FORCEINLINE VOID
 __BusFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, BUS_TAG);
@@ -70,7 +70,7 @@ __BusFree(
 
 static VOID
 BusReference(
-    IN  PVOID           _Context
+    _In_ PVOID          _Context
     )
 {
     PXENBUS_BUS_CONTEXT Context = _Context;
@@ -80,7 +80,7 @@ BusReference(
 
 static VOID
 BusDereference(
-    IN  PVOID           _Context
+    _In_ PVOID          _Context
     )
 {
     PXENBUS_BUS_CONTEXT Context = _Context;
@@ -89,15 +89,16 @@ BusDereference(
     InterlockedDecrement(&Context->References);
 }
 
-static
-__drv_functionClass(TRANSLATE_BUS_ADDRESS)
-BOOLEAN
+static TRANSLATE_BUS_ADDRESS BusTranslateAddress;
+
+_Use_decl_annotations_
+static BOOLEAN
 BusTranslateAddress(
-    IN      PVOID               _Context,
-    IN      PHYSICAL_ADDRESS    BusAddress,
-    IN      ULONG               Length,
-    IN OUT  PULONG              AddressSpace,
-    OUT     PPHYSICAL_ADDRESS   TranslatedAddress
+    PVOID                       _Context,
+    PHYSICAL_ADDRESS            BusAddress,
+    ULONG                       Length,
+    PULONG                      AddressSpace,
+    PPHYSICAL_ADDRESS           TranslatedAddress
     )
 {
     PXENBUS_BUS_CONTEXT         Context = _Context;
@@ -109,17 +110,18 @@ BusTranslateAddress(
                                   TranslatedAddress);
 }
 
-static
-__drv_functionClass(GET_DMA_ADAPTER)
-PDMA_ADAPTER
+static GET_DMA_ADAPTER BusGetDmaAdapter;
+
+_Use_decl_annotations_
+static PDMA_ADAPTER
 BusGetDmaAdapter(
-    IN  PVOID               _Context,
-    IN  PDEVICE_DESCRIPTION DeviceDescriptor,
-    OUT PULONG              NumberOfMapRegisters
+    PVOID                       _Context,
+    PDEVICE_DESCRIPTION         DeviceDescriptor,
+    PULONG                      NumberOfMapRegisters
     )
 {
-    PXENBUS_BUS_CONTEXT     Context = _Context;
-    XENBUS_DMA_ADAPTER_TYPE Type;
+    PXENBUS_BUS_CONTEXT         Context = _Context;
+    XENBUS_DMA_ADAPTER_TYPE     Type;
 
     if (Context->InterceptDmaAdapter != 0) {
         RTL_OSVERSIONINFOEXW    VersionInformation;
@@ -138,22 +140,23 @@ BusGetDmaAdapter(
     } else {
         Type = XENBUS_DMA_ADAPTER_NO_INTERCEPT;
     }
-    
+
     return DmaGetAdapter(Context->Pdo,
                          Type,
                          DeviceDescriptor,
                          NumberOfMapRegisters);
 }
 
-static
-__drv_functionClass(GET_SET_DEVICE_DATA)
-ULONG
+static GET_SET_DEVICE_DATA BusSetData;
+
+_Use_decl_annotations_
+static ULONG
 BusSetData(
-    IN  PVOID           _Context,
-    IN  ULONG           DataType,
-    IN  PVOID           Buffer,
-    IN  ULONG           Offset,
-    IN  ULONG           Length
+    PVOID               _Context,
+    ULONG               DataType,
+    PVOID               Buffer,
+    ULONG               Offset,
+    ULONG               Length
     )
 {
     PXENBUS_BUS_CONTEXT Context = _Context;
@@ -165,15 +168,16 @@ BusSetData(
                          Length);
 }
 
-static
-__drv_functionClass(GET_SET_DEVICE_DATA)
-ULONG
+static GET_SET_DEVICE_DATA BusGetData;
+
+_Use_decl_annotations_
+static ULONG
 BusGetData(
-    IN  PVOID           _Context,
-    IN  ULONG           DataType,
-    IN  PVOID           Buffer,
-    IN  ULONG           Offset,
-    IN  ULONG           Length
+    PVOID               _Context,
+    ULONG               DataType,
+    PVOID               Buffer,
+    ULONG               Offset,
+    ULONG               Length
     )
 {
     PXENBUS_BUS_CONTEXT Context = _Context;
@@ -187,14 +191,14 @@ BusGetData(
 
 NTSTATUS
 BusInitialize(
-    IN  PXENBUS_PDO             Pdo,
-    OUT PBUS_INTERFACE_STANDARD Interface
+    _In_ PXENBUS_PDO                Pdo,
+    _Out_ PBUS_INTERFACE_STANDARD   Interface
     )
 {
-    PXENBUS_BUS_CONTEXT         Context;
-    HANDLE                      ParametersKey;
-    ULONG                       InterceptDmaAdapter;
-    NTSTATUS                    status;
+    PXENBUS_BUS_CONTEXT             Context;
+    HANDLE                          ParametersKey;
+    ULONG                           InterceptDmaAdapter;
+    NTSTATUS                        status;
 
     Trace("====>\n");
 
@@ -238,7 +242,7 @@ fail1:
 
 VOID
 BusTeardown(
-    IN OUT  PBUS_INTERFACE_STANDARD Interface
+    _Inout_ PBUS_INTERFACE_STANDARD Interface
     )
 {
     PXENBUS_BUS_CONTEXT             Context = Interface->Context;
diff --git a/src/xenbus/bus.h b/src/xenbus/bus.h
index 9671bfa..caec040 100644
--- a/src/xenbus/bus.h
+++ b/src/xenbus/bus.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.
  */
 
@@ -40,13 +40,13 @@
 
 extern NTSTATUS
 BusInitialize(
-    IN  PXENBUS_PDO             Pdo,
-    OUT PBUS_INTERFACE_STANDARD Interface
+    _In_ PXENBUS_PDO                Pdo,
+    _Out_ PBUS_INTERFACE_STANDARD   Interface
     );
 
 extern VOID
 BusTeardown(
-    IN OUT  PBUS_INTERFACE_STANDARD Interface
+    _Inout_ PBUS_INTERFACE_STANDARD Interface
     );
 
 #endif  // _XENBUS_BUS_H
diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index b67c5dd..1af0ea8 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -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.
  */
 
@@ -110,7 +110,7 @@ struct _XENBUS_CACHE_CONTEXT {
 
 static FORCEINLINE PVOID
 __CacheAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, CACHE_TAG);
@@ -118,45 +118,45 @@ __CacheAllocate(
 
 static FORCEINLINE VOID
 __CacheFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, CACHE_TAG);
 }
 
 static FORCEINLINE VOID
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 __CacheAcquireLock(
-    IN  PXENBUS_CACHE   Cache
+    _In_ PXENBUS_CACHE  Cache
     )
 {
     Cache->AcquireLock(Cache->Argument);
 }
 
 static FORCEINLINE VOID
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 __CacheReleaseLock(
-    IN  PXENBUS_CACHE   Cache
+    _In_ PXENBUS_CACHE  Cache
     )
 {
     Cache->ReleaseLock(Cache->Argument);
 }
 
 static FORCEINLINE NTSTATUS
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 __CacheCtor(
-    IN  PXENBUS_CACHE   Cache,
-    IN  PVOID           Object
+    _In_ PXENBUS_CACHE  Cache,
+    _In_ PVOID          Object
     )
 {
     return Cache->Ctor(Cache->Argument, Object);
 }
 
 static FORCEINLINE VOID
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 __CacheDtor(
-    IN  PXENBUS_CACHE   Cache,
-    IN  PVOID           Object
+    _In_ PXENBUS_CACHE  Cache,
+    _In_ PVOID          Object
     )
 {
     Cache->Dtor(Cache->Argument, Object);
@@ -164,7 +164,7 @@ __CacheDtor(
 
 static PVOID
 CacheGetObjectFromMagazine(
-    IN  PXENBUS_CACHE_MAGAZINE  Magazine
+    _In_ PXENBUS_CACHE_MAGAZINE Magazine
     )
 {
     ULONG                       Index;
@@ -185,8 +185,8 @@ CacheGetObjectFromMagazine(
 
 static NTSTATUS
 CachePutObjectToMagazine(
-    IN  PXENBUS_CACHE_MAGAZINE  Magazine,
-    IN  PVOID                   Object
+    _In_ PXENBUS_CACHE_MAGAZINE Magazine,
+    _In_ PVOID                  Object
     )
 {
     ULONG                       Index;
@@ -203,7 +203,7 @@ CachePutObjectToMagazine(
 
 static PXENBUS_CACHE_MASK
 CacheMaskCreate(
-    IN  ULONG           Size
+    _In_ ULONG          Size
     )
 {
     ULONG               NumberOfBytes;
@@ -226,7 +226,7 @@ fail1:
 
 static VOID
 CacheMaskDestroy(
-    IN  PXENBUS_CACHE_MASK  Mask
+    _In_ PXENBUS_CACHE_MASK Mask
     )
 {
     ASSERT(Mask->Count == 0);
@@ -235,8 +235,8 @@ CacheMaskDestroy(
 
 static FORCEINLINE VOID
 __CacheMaskSet(
-    IN  PXENBUS_CACHE_MASK  Mask,
-    IN  ULONG               Bit
+    _In_ PXENBUS_CACHE_MASK Mask,
+    _In_ ULONG              Bit
     )
 {
     ULONG                   Index = Bit / BITS_PER_ULONG;
@@ -252,8 +252,8 @@ __CacheMaskSet(
 
 static FORCEINLINE BOOLEAN
 __CacheMaskTest(
-    IN  PXENBUS_CACHE_MASK  Mask,
-    IN  ULONG               Bit
+    _In_ PXENBUS_CACHE_MASK Mask,
+    _In_ ULONG              Bit
     )
 {
     ULONG                   Index = Bit / BITS_PER_ULONG;
@@ -266,8 +266,8 @@ __CacheMaskTest(
 
 static FORCEINLINE VOID
 __CacheMaskClear(
-    IN  PXENBUS_CACHE_MASK  Mask,
-    IN  ULONG               Bit
+    _In_ PXENBUS_CACHE_MASK Mask,
+    _In_ ULONG              Bit
     )
 {
     ULONG                   Index = Bit / BITS_PER_ULONG;
@@ -283,7 +283,7 @@ __CacheMaskClear(
 
 static ULONG
 CacheMaskSize(
-    IN  PXENBUS_CACHE_MASK  Mask
+    _In_ PXENBUS_CACHE_MASK Mask
     )
 {
     return Mask->Size;
@@ -291,7 +291,7 @@ CacheMaskSize(
 
 static ULONG
 CacheMaskCount(
-    IN  PXENBUS_CACHE_MASK  Mask
+    _In_ PXENBUS_CACHE_MASK Mask
     )
 {
     return Mask->Count;
@@ -299,8 +299,8 @@ CacheMaskCount(
 
 static VOID
 CacheInsertSlab(
-    IN  PXENBUS_CACHE       Cache,
-    IN  PXENBUS_CACHE_SLAB  New
+    _In_ PXENBUS_CACHE      Cache,
+    _In_ PXENBUS_CACHE_SLAB New
     )
 {
 #define INSERT_BEFORE(_ListEntry, _New)             \
@@ -353,7 +353,7 @@ done:
 #if DBG
 static VOID
 CacheAudit(
-    IN  PXENBUS_CACHE   Cache
+    _In_ PXENBUS_CACHE  Cache
     )
 {
     ULONG               Count = ULONG_MAX;
@@ -396,7 +396,7 @@ CacheAudit(
 // Must be called with lock held
 static NTSTATUS
 CacheCreateSlab(
-    IN  PXENBUS_CACHE   Cache
+    _In_ PXENBUS_CACHE  Cache
     )
 {
     PXENBUS_CACHE_SLAB  Slab;
@@ -468,8 +468,8 @@ fail1:
 // Must be called with lock held
 static VOID
 CacheDestroySlab(
-    IN  PXENBUS_CACHE       Cache,
-    IN  PXENBUS_CACHE_SLAB  Slab
+    _In_ PXENBUS_CACHE      Cache,
+    _In_ PXENBUS_CACHE_SLAB Slab
     )
 {
     LONG                    Index;
@@ -511,7 +511,7 @@ CacheDestroySlab(
 // Must be called with lock held
 static PVOID
 CacheGetObjectFromSlab(
-    IN  PXENBUS_CACHE_SLAB  Slab
+    _In_ PXENBUS_CACHE_SLAB Slab
     )
 {
     PXENBUS_CACHE           Cache;
@@ -570,8 +570,8 @@ fail1:
 // Must be called with lock held
 static VOID
 CachePutObjectToSlab(
-    IN  PXENBUS_CACHE_SLAB  Slab,
-    IN  PVOID               Object
+    _In_ PXENBUS_CACHE_SLAB Slab,
+    _In_ PVOID              Object
     )
 {
     PXENBUS_CACHE           Cache;
@@ -587,9 +587,9 @@ CachePutObjectToSlab(
 
 static PVOID
 CacheGet(
-    IN  PINTERFACE          Interface,
-    IN  PXENBUS_CACHE       Cache,
-    IN  BOOLEAN             Locked
+    _In_ PINTERFACE         Interface,
+    _In_ PXENBUS_CACHE      Cache,
+    _In_ BOOLEAN            Locked
     )
 {
     KIRQL                   Irql;
@@ -664,10 +664,10 @@ done:
 
 static VOID
 CachePut(
-    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
     )
 {
     KIRQL                   Irql;
@@ -722,8 +722,8 @@ done:
 
 static NTSTATUS
 CacheFill(
-    IN  PXENBUS_CACHE   Cache,
-    IN  ULONG           Count
+    _In_ PXENBUS_CACHE  Cache,
+    _In_ ULONG          Count
     )
 {
     KIRQL               Irql;
@@ -749,8 +749,8 @@ CacheFill(
 
 static VOID
 CacheSpill(
-    IN  PXENBUS_CACHE   Cache,
-    IN  ULONG           Count
+    _In_ PXENBUS_CACHE  Cache,
+    _In_ ULONG          Count
     )
 {
     KIRQL               Irql;
@@ -794,7 +794,7 @@ done:
 
 static FORCEINLINE VOID
 __CacheFlushMagazines(
-    IN  PXENBUS_CACHE   Cache
+    _In_ PXENBUS_CACHE  Cache
     )
 {
     KIRQL               Irql;
@@ -823,17 +823,17 @@ __CacheFlushMagazines(
 
 static NTSTATUS
 CacheCreate(
-    IN  PINTERFACE          Interface,
-    IN  const CHAR          *Name,
-    IN  ULONG               Size,
-    IN  ULONG               Reservation,
-    IN  ULONG               Cap,
-    IN  NTSTATUS            (*Ctor)(PVOID, PVOID),
-    IN  VOID                (*Dtor)(PVOID, PVOID),
-    IN  VOID                (*AcquireLock)(PVOID),
-    IN  VOID                (*ReleaseLock)(PVOID),
-    IN  PVOID               Argument,
-    OUT PXENBUS_CACHE       *Cache
+    _In_ PINTERFACE         Interface,
+    _In_ const CHAR         *Name,
+    _In_ ULONG              Size,
+    _In_ ULONG              Reservation,
+    _In_ ULONG              Cap,
+    _In_ NTSTATUS           (*Ctor)(PVOID, PVOID),
+    _In_ VOID               (*Dtor)(PVOID, PVOID),
+    _In_ VOID               (*AcquireLock)(PVOID),
+    _In_ VOID               (*ReleaseLock)(PVOID),
+    _In_ PVOID              Argument,
+    _Out_ PXENBUS_CACHE     *Cache
     )
 {
     PXENBUS_CACHE_CONTEXT   Context = Interface->Context;
@@ -933,28 +933,28 @@ fail2:
     Error("fail2\n");
 
     RtlZeroMemory((*Cache)->Name, sizeof ((*Cache)->Name));
-    
+
     ASSERT(IsZeroMemory(*Cache, sizeof (XENBUS_CACHE)));
     __CacheFree(*Cache);
 
 fail1:
     Error("fail1 (%08x)\n", status);
 
-    return status;    
+    return status;
 }
 
 static NTSTATUS
 CacheCreateVersion1(
-    IN  PINTERFACE          Interface,
-    IN  const CHAR          *Name,
-    IN  ULONG               Size,
-    IN  ULONG               Reservation,
-    IN  NTSTATUS            (*Ctor)(PVOID, PVOID),
-    IN  VOID                (*Dtor)(PVOID, PVOID),
-    IN  VOID                (*AcquireLock)(PVOID),
-    IN  VOID                (*ReleaseLock)(PVOID),
-    IN  PVOID               Argument,
-    OUT PXENBUS_CACHE       *Cache
+    _In_ PINTERFACE         Interface,
+    _In_ const CHAR         *Name,
+    _In_ ULONG              Size,
+    _In_ ULONG              Reservation,
+    _In_ NTSTATUS           (*Ctor)(PVOID, PVOID),
+    _In_ VOID               (*Dtor)(PVOID, PVOID),
+    _In_ VOID               (*AcquireLock)(PVOID),
+    _In_ VOID               (*ReleaseLock)(PVOID),
+    _In_ PVOID              Argument,
+    _Out_ PXENBUS_CACHE     *Cache
     )
 {
     return CacheCreate(Interface,
@@ -972,8 +972,8 @@ CacheCreateVersion1(
 
 static VOID
 CacheDestroy(
-    IN  PINTERFACE          Interface,
-    IN  PXENBUS_CACHE       Cache
+    _In_ PINTERFACE         Interface,
+    _In_ PXENBUS_CACHE      Cache
     )
 {
     PXENBUS_CACHE_CONTEXT   Context = Interface->Context;
@@ -1027,8 +1027,8 @@ CacheDestroy(
 
 static VOID
 CacheDebugCallback(
-    IN  PVOID               Argument,
-    IN  BOOLEAN             Crashing
+    _In_ PVOID              Argument,
+    _In_ BOOLEAN            Crashing
     )
 {
     PXENBUS_CACHE_CONTEXT   Context = Argument;
@@ -1072,8 +1072,8 @@ CacheDebugCallback(
 
 static NTSTATUS
 CacheMonitor(
-    IN  PXENBUS_THREAD      Self,
-    IN  PVOID               _Context
+    _In_ PXENBUS_THREAD     Self,
+    _In_ PVOID              _Context
     )
 {
     PXENBUS_CACHE_CONTEXT   Context = _Context;
@@ -1181,7 +1181,7 @@ fail1:
 
 VOID
 CacheRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_CACHE_CONTEXT   Context = Interface->Context;
@@ -1229,11 +1229,11 @@ static struct _XENBUS_CACHE_INTERFACE_V2 
CacheInterfaceVersion2 = {
     CachePut,
     CacheDestroy
 };
-                     
+
 NTSTATUS
 CacheInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_CACHE_CONTEXT   *Context
+    _In_ PXENBUS_FDO            Fdo,
+    _Out_ PXENBUS_CACHE_CONTEXT *Context
     )
 {
     NTSTATUS                    status;
@@ -1283,10 +1283,10 @@ fail1:
 
 NTSTATUS
 CacheGetInterface(
-    IN      PXENBUS_CACHE_CONTEXT   Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_CACHE_CONTEXT      Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     )
 {
     NTSTATUS                        status;
@@ -1334,11 +1334,11 @@ CacheGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 CacheGetReferences(
-    IN  PXENBUS_CACHE_CONTEXT   Context
+    _In_ PXENBUS_CACHE_CONTEXT  Context
     )
 {
     return Context->References;
@@ -1346,7 +1346,7 @@ CacheGetReferences(
 
 VOID
 CacheTeardown(
-    IN  PXENBUS_CACHE_CONTEXT   Context
+    _In_ PXENBUS_CACHE_CONTEXT  Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/cache.h b/src/xenbus/cache.h
index 2dc3821..8714bc7 100644
--- a/src/xenbus/cache.h
+++ b/src/xenbus/cache.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_CACHE_CONTEXT  XENBUS_CACHE_CONTEXT, 
*PXENBUS_CACHE_CONTE
 
 extern NTSTATUS
 CacheInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_CACHE_CONTEXT   *Context
+    _In_ PXENBUS_FDO            Fdo,
+    _Out_ PXENBUS_CACHE_CONTEXT *Context
     );
 
 extern NTSTATUS
 CacheGetInterface(
-    IN      PXENBUS_CACHE_CONTEXT   Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_CACHE_CONTEXT  Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     );
 
 extern ULONG
 CacheGetReferences(
-    IN  PXENBUS_CACHE_CONTEXT   Context
+    _In_ PXENBUS_CACHE_CONTEXT  Context
     );
 
 extern VOID
 CacheTeardown(
-    IN  PXENBUS_CACHE_CONTEXT   Context
+    _In_ PXENBUS_CACHE_CONTEXT  Context
     );
 
 #endif  // _XENBUS_CACHE_H
diff --git a/src/xenbus/console.c b/src/xenbus/console.c
index b94b00b..1c2af75 100644
--- a/src/xenbus/console.c
+++ b/src/xenbus/console.c
@@ -80,7 +80,7 @@ C_ASSERT(sizeof (struct xencons_interface) <= PAGE_SIZE);
 
 static FORCEINLINE PVOID
 __ConsoleAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_CONSOLE_TAG);
@@ -88,7 +88,7 @@ __ConsoleAllocate(
 
 static FORCEINLINE VOID
 __ConsoleFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_CONSOLE_TAG);
@@ -96,7 +96,7 @@ __ConsoleFree(
 
 static ULONG
 ConsoleOutAvailable(
-    IN  PXENBUS_CONSOLE_CONTEXT Context
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context
     )
 {
     struct xencons_interface    *Shared;
@@ -117,15 +117,15 @@ ConsoleOutAvailable(
 
 static ULONG
 ConsoleCopyToOut(
-    IN  PXENBUS_CONSOLE_CONTEXT Context,
-    IN  PCHAR                   Data,
-    IN  ULONG                   Length
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context,
+    _In_ PCHAR                      Data,
+    _In_ ULONG                      Length
     )
 {
-    struct xencons_interface    *Shared;
-    XENCONS_RING_IDX            cons;
-    XENCONS_RING_IDX            prod;
-    ULONG                       Offset;
+    struct xencons_interface        *Shared;
+    XENCONS_RING_IDX                cons;
+    XENCONS_RING_IDX                prod;
+    ULONG                           Offset;
 
     Shared = Context->Shared;
 
@@ -171,12 +171,12 @@ ConsoleCopyToOut(
 
 static ULONG
 ConsoleInAvailable(
-    IN  PXENBUS_CONSOLE_CONTEXT Context
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context
     )
 {
-    struct xencons_interface    *Shared;
-    XENCONS_RING_IDX            cons;
-    XENCONS_RING_IDX            prod;
+    struct xencons_interface        *Shared;
+    XENCONS_RING_IDX                cons;
+    XENCONS_RING_IDX                prod;
 
     Shared = Context->Shared;
 
@@ -192,15 +192,15 @@ ConsoleInAvailable(
 
 static ULONG
 ConsoleCopyFromIn(
-    IN  PXENBUS_CONSOLE_CONTEXT Context,
-    IN  PCHAR                   Data,
-    IN  ULONG                   Length
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context,
+    _In_ PCHAR                      Data,
+    _In_ ULONG                      Length
     )
 {
-    struct xencons_interface    *Shared;
-    XENCONS_RING_IDX            cons;
-    XENCONS_RING_IDX            prod;
-    ULONG                       Offset;
+    struct xencons_interface        *Shared;
+    XENCONS_RING_IDX                cons;
+    XENCONS_RING_IDX                prod;
+    ULONG                           Offset;
 
     Shared = Context->Shared;
 
@@ -246,10 +246,10 @@ ConsoleCopyFromIn(
 
 static VOID
 ConsolePoll(
-    IN  PXENBUS_CONSOLE_CONTEXT Context
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context
     )
 {
-    PLIST_ENTRY                 ListEntry;
+    PLIST_ENTRY                     ListEntry;
 
     for (ListEntry = Context->WakeupList.Flink;
          ListEntry != &Context->WakeupList;
@@ -272,10 +272,10 @@ _IRQL_requires_(DISPATCH_LEVEL)
 _IRQL_requires_same_
 VOID
 ConsoleDpc(
-    IN  PKDPC               Dpc,
-    IN  PVOID               _Context,
-    IN  PVOID               Argument1,
-    IN  PVOID               Argument2
+    _In_ PKDPC              Dpc,
+    _In_ PVOID              _Context,
+    _In_ PVOID              Argument1,
+    _In_ PVOID              Argument2
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = _Context;
@@ -298,8 +298,8 @@ _IRQL_requires_(HIGH_LEVEL)
 _IRQL_requires_same_
 BOOLEAN
 ConsoleEvtchnCallback(
-    IN  PKINTERRUPT         InterruptObject,
-    IN  PVOID               Argument
+    _In_ PKINTERRUPT        InterruptObject,
+    _In_ PVOID              Argument
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Argument;
@@ -318,7 +318,7 @@ ConsoleEvtchnCallback(
 
 static VOID
 ConsoleDisable(
-    IN PXENBUS_CONSOLE_CONTEXT  Context
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context
     )
 {
     LogPrintf(LOG_LEVEL_INFO,
@@ -334,12 +334,12 @@ ConsoleDisable(
 
 static NTSTATUS
 ConsoleEnable(
-    IN PXENBUS_CONSOLE_CONTEXT  Context
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context
     )
 {
-    ULONGLONG                   Value;
-    ULONG                       Port;
-    NTSTATUS                    status;
+    ULONGLONG                       Value;
+    ULONG                           Port;
+    NTSTATUS                        status;
 
     /* In some Xen deployments the tool-stack may not set up the console */
     status = HvmGetParam(HVM_PARAM_CONSOLE_EVTCHN, &Value);
@@ -383,12 +383,12 @@ fail1:
 
 static
 ConsoleGetAddress(
-    IN  PXENBUS_CONSOLE_CONTEXT Context,
-    OUT PPHYSICAL_ADDRESS       Address
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context,
+    _Out_ PPHYSICAL_ADDRESS         Address
     )
 {
-    PFN_NUMBER                  Pfn;
-    NTSTATUS                    status;
+    PFN_NUMBER                      Pfn;
+    NTSTATUS                        status;
 
     status = XENBUS_GNTTAB(QueryReference,
                            &Context->GnttabInterface,
@@ -415,7 +415,7 @@ fail1:
 
 static VOID
 ConsoleSuspendCallbackLate(
-    IN  PVOID                   Argument
+    _In_ PVOID                  Argument
     )
 {
     PXENBUS_CONSOLE_CONTEXT     Context = Argument;
@@ -439,8 +439,8 @@ ConsoleSuspendCallbackLate(
 
 static VOID
 ConsoleDebugCallback(
-    IN  PVOID               Argument,
-    IN  BOOLEAN             Crashing
+    _In_ PVOID              Argument,
+    _In_ BOOLEAN            Crashing
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Argument;
@@ -513,7 +513,7 @@ ConsoleDebugCallback(
 
 static BOOLEAN
 ConsoleCanRead(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Interface->Context;
@@ -529,9 +529,9 @@ ConsoleCanRead(
 
 static ULONG
 ConsoleRead(
-    IN  PINTERFACE          Interface,
-    IN  PCHAR               Data,
-    IN  ULONG               Length
+    _In_ PINTERFACE         Interface,
+    _In_ PCHAR              Data,
+    _In_ ULONG              Length
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Interface->Context;
@@ -562,7 +562,7 @@ done:
 
 static BOOLEAN
 ConsoleCanWrite(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Interface->Context;
@@ -578,9 +578,9 @@ ConsoleCanWrite(
 
 static ULONG
 ConsoleWrite(
-    IN  PINTERFACE          Interface,
-    IN  PCHAR               Data,
-    IN  ULONG               Length
+    _In_ PINTERFACE         Interface,
+    _In_ PCHAR              Data,
+    _In_ ULONG              Length
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Interface->Context;
@@ -619,14 +619,14 @@ RtlCaptureStackBackTrace(
 
 static NTSTATUS
 ConsoleWakeupAdd(
-    IN  PINTERFACE             Interface,
-    IN  PKEVENT                Event,
-    OUT PXENBUS_CONSOLE_WAKEUP *Wakeup
+    _In_ PINTERFACE                 Interface,
+    _In_ PKEVENT                    Event,
+    _Out_ PXENBUS_CONSOLE_WAKEUP    *Wakeup
     )
 {
-    PXENBUS_CONSOLE_CONTEXT     Context = Interface->Context;
-    KIRQL                       Irql;
-    NTSTATUS                    status;
+    PXENBUS_CONSOLE_CONTEXT         Context = Interface->Context;
+    KIRQL                           Irql;
+    NTSTATUS                        status;
 
     *Wakeup = __ConsoleAllocate(sizeof (XENBUS_CONSOLE_WAKEUP));
 
@@ -653,8 +653,8 @@ fail1:
 
 static VOID
 ConsoleWakeupRemove(
-    IN  PINTERFACE             Interface,
-    IN  PXENBUS_CONSOLE_WAKEUP Wakeup
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_CONSOLE_WAKEUP Wakeup
     )
 {
     PXENBUS_CONSOLE_CONTEXT     Context = Interface->Context;
@@ -677,7 +677,7 @@ ConsoleWakeupRemove(
 
 static NTSTATUS
 ConsoleAcquire(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Interface->Context;
@@ -807,7 +807,7 @@ fail1:
 
 static VOID
 ConsoleRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_CONSOLE_CONTEXT Context = Interface->Context;
@@ -868,11 +868,11 @@ static struct _XENBUS_CONSOLE_INTERFACE_V1 
ConsoleInterfaceVersion1 = {
 
 NTSTATUS
 ConsoleInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_CONSOLE_CONTEXT *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_CONSOLE_CONTEXT   *Context
     )
 {
-    NTSTATUS                    status;
+    NTSTATUS                        status;
 
     Trace("====>\n");
 
@@ -931,10 +931,10 @@ fail1:
 
 NTSTATUS
 ConsoleGetInterface(
-    IN      PXENBUS_CONSOLE_CONTEXT   Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     )
 {
     NTSTATUS                        status;
@@ -969,7 +969,7 @@ ConsoleGetInterface(
 
 ULONG
 ConsoleGetReferences(
-    IN  PXENBUS_CONSOLE_CONTEXT   Context
+    _In_ PXENBUS_CONSOLE_CONTEXT  Context
     )
 {
     return Context->References;
@@ -977,7 +977,7 @@ ConsoleGetReferences(
 
 VOID
 ConsoleTeardown(
-    IN  PXENBUS_CONSOLE_CONTEXT   Context
+    _In_ PXENBUS_CONSOLE_CONTEXT  Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/console.h b/src/xenbus/console.h
index 8c8f0ad..f4fb3d5 100644
--- a/src/xenbus/console.h
+++ b/src/xenbus/console.h
@@ -43,26 +43,26 @@ typedef struct _XENBUS_CONSOLE_CONTEXT  
XENBUS_CONSOLE_CONTEXT, *PXENBUS_CONSOLE
 
 extern NTSTATUS
 ConsoleInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_CONSOLE_CONTEXT *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_CONSOLE_CONTEXT   *Context
     );
 
 extern NTSTATUS
 ConsoleGetInterface(
-    IN      PXENBUS_CONSOLE_CONTEXT Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     );
 
 extern ULONG
 ConsoleGetReferences(
-    IN  PXENBUS_CONSOLE_CONTEXT Context
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context
     );
 
 extern VOID
 ConsoleTeardown(
-    IN  PXENBUS_CONSOLE_CONTEXT Context
+    _In_ PXENBUS_CONSOLE_CONTEXT    Context
     );
 
 #endif  // _XENBUS_CONSOLE_H
diff --git a/src/xenbus/debug.c b/src/xenbus/debug.c
index 937547f..2440afc 100644
--- a/src/xenbus/debug.c
+++ b/src/xenbus/debug.c
@@ -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.
  */
 
@@ -67,7 +67,7 @@ struct _XENBUS_DEBUG_CONTEXT {
 
 static FORCEINLINE PVOID
 __DebugAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_DEBUG_TAG);
@@ -75,7 +75,7 @@ __DebugAllocate(
 
 static FORCEINLINE VOID
 __DebugFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_DEBUG_TAG);
@@ -91,17 +91,17 @@ RtlCaptureStackBackTrace(
 
 static NTSTATUS
 DebugRegister(
-    IN  PINTERFACE              Interface,
-    IN  PCHAR                   Prefix,
-    IN  XENBUS_DEBUG_FUNCTION   Function,
-    IN  PVOID                   Argument OPTIONAL,
-    OUT PXENBUS_DEBUG_CALLBACK  *Callback
+    _In_ PINTERFACE                     Interface,
+    _In_ PCHAR                          Prefix,
+    _In_ XENBUS_DEBUG_FUNCTION          Function,
+    _In_opt_ PVOID                      Argument,
+    _Out_opt_ PXENBUS_DEBUG_CALLBACK    *Callback
     )
 {
-    PXENBUS_DEBUG_CONTEXT       Context = Interface->Context;
-    ULONG                       Length;
-    KIRQL                       Irql;
-    NTSTATUS                    status;
+    PXENBUS_DEBUG_CONTEXT               Context = Interface->Context;
+    ULONG                               Length;
+    KIRQL                               Irql;
+    NTSTATUS                            status;
 
     *Callback = __DebugAllocate(sizeof (XENBUS_DEBUG_CALLBACK));
 
@@ -109,7 +109,7 @@ DebugRegister(
     if (*Callback == NULL)
         goto fail1;
 
-    (VOID) RtlCaptureStackBackTrace(1, 1, &(*Callback)->Caller, NULL);    
+    (VOID) RtlCaptureStackBackTrace(1, 1, &(*Callback)->Caller, NULL);
 
     Length = (ULONG)__min(strlen(Prefix), MAXIMUM_PREFIX_LENGTH - 1);
     RtlCopyMemory((*Callback)->Prefix, Prefix, Length);
@@ -131,8 +131,8 @@ fail1:
 
 static VOID
 DebugPrintf(
-    IN  PINTERFACE              Interface,
-    IN  const CHAR              *Format,
+    _In_ PINTERFACE             Interface,
+    _In_ const CHAR             *Format,
     ...
     )
 {
@@ -154,8 +154,8 @@ DebugPrintf(
 
 static VOID
 DebugDeregister(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_DEBUG_CALLBACK  Callback
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_DEBUG_CALLBACK Callback
     )
 {
     PXENBUS_DEBUG_CONTEXT       Context = Interface->Context;
@@ -170,9 +170,9 @@ DebugDeregister(
 
 static VOID
 DebugCallback(
-    IN  PXENBUS_DEBUG_CONTEXT   Context,
-    IN  PXENBUS_DEBUG_CALLBACK  Callback,
-    IN  BOOLEAN                 Crashing
+    _In_ PXENBUS_DEBUG_CONTEXT  Context,
+    _In_ PXENBUS_DEBUG_CALLBACK Callback,
+    _In_ BOOLEAN                Crashing
     )
 {
     PCHAR                       Name;
@@ -216,9 +216,9 @@ DebugCallback(
 
 static VOID
 DebugTriggerLocked(
-    IN  PXENBUS_DEBUG_CONTEXT   Context,
-    IN  PXENBUS_DEBUG_CALLBACK  Callback OPTIONAL,
-    IN  BOOLEAN                 Crashing
+    _In_ PXENBUS_DEBUG_CONTEXT      Context,
+    _In_opt_ PXENBUS_DEBUG_CALLBACK Callback,
+    _In_ BOOLEAN                    Crashing
     )
 {
     if (Callback == NULL) {
@@ -238,15 +238,15 @@ DebugTriggerLocked(
         DebugCallback(Context, Callback, Crashing);
     }
 }
-    
+
 static VOID
 DebugTrigger(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_DEBUG_CALLBACK  Callback OPTIONAL
+    _In_ PINTERFACE                 Interface,
+    _In_opt_ PXENBUS_DEBUG_CALLBACK Callback
     )
 {
-    PXENBUS_DEBUG_CONTEXT       Context = Interface->Context;
-    KIRQL                       Irql;
+    PXENBUS_DEBUG_CONTEXT           Context = Interface->Context;
+    KIRQL                           Irql;
 
     Trace("====>\n");
 
@@ -257,13 +257,13 @@ DebugTrigger(
     Trace("<====\n");
 }
 
-static 
+static
 _Function_class_(KBUGCHECK_CALLBACK_ROUTINE)
 _IRQL_requires_same_
-VOID                     
+VOID
 DebugBugCheckCallback(
-    IN  PVOID               Argument,
-    IN  ULONG               Length
+    _In_ PVOID              Argument,
+    _In_ ULONG              Length
     )
 {
     PXENBUS_DEBUG_CONTEXT   Context = Argument;
@@ -319,7 +319,7 @@ fail1:
 
 static VOID
 DebugRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_DEBUG_CONTEXT   Context = Interface->Context;
@@ -358,11 +358,11 @@ static struct _XENBUS_DEBUG_INTERFACE_V1 
DebugInterfaceVersion1 = {
     DebugTrigger,
     DebugDeregister
 };
-                     
+
 NTSTATUS
 DebugInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_DEBUG_CONTEXT   *Context
+    _In_ PXENBUS_FDO            Fdo,
+    _Out_ PXENBUS_DEBUG_CONTEXT *Context
     )
 {
     NTSTATUS                    status;
@@ -392,16 +392,16 @@ fail1:
 
 NTSTATUS
 DebugGetInterface(
-    IN      PXENBUS_DEBUG_CONTEXT   Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_DEBUG_CONTEXT  Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     )
 {
-    NTSTATUS                        status;
+    NTSTATUS                    status;
 
     ASSERT(Context != NULL);
-        
+
     switch (Version) {
     case 1: {
         struct _XENBUS_DEBUG_INTERFACE_V1   *DebugInterface;
@@ -426,11 +426,11 @@ DebugGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 DebugGetReferences(
-    IN  PXENBUS_DEBUG_CONTEXT   Context
+    _In_ PXENBUS_DEBUG_CONTEXT  Context
     )
 {
     return Context->References;
@@ -438,7 +438,7 @@ DebugGetReferences(
 
 VOID
 DebugTeardown(
-    IN  PXENBUS_DEBUG_CONTEXT   Context
+    _In_ PXENBUS_DEBUG_CONTEXT  Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/debug.h b/src/xenbus/debug.h
index f5a1fda..18230e5 100644
--- a/src/xenbus/debug.h
+++ b/src/xenbus/debug.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_DEBUG_CONTEXT  XENBUS_DEBUG_CONTEXT, 
*PXENBUS_DEBUG_CONTE
 
 extern NTSTATUS
 DebugInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_DEBUG_CONTEXT   *Context
+    _In_ PXENBUS_FDO            Fdo,
+    _Out_ PXENBUS_DEBUG_CONTEXT *Context
     );
 
 extern NTSTATUS
 DebugGetInterface(
-    IN      PXENBUS_DEBUG_CONTEXT   Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_DEBUG_CONTEXT  Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     );
 
 extern ULONG
 DebugGetReferences(
-    IN  PXENBUS_DEBUG_CONTEXT   Context
+    _In_ PXENBUS_DEBUG_CONTEXT  Context
     );
 
 extern VOID
 DebugTeardown(
-    IN  PXENBUS_DEBUG_CONTEXT   Context
+    _In_ PXENBUS_DEBUG_CONTEXT  Context
     );
 
 #endif  // _XENBUS_DEBUG_H
diff --git a/src/xenbus/dma.c b/src/xenbus/dma.c
index a166dbb..206143e 100644
--- a/src/xenbus/dma.c
+++ b/src/xenbus/dma.c
@@ -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.
  */
 
@@ -198,7 +198,7 @@ struct _XENBUS_DMA_LIST_CONTROL {
 
 static FORCEINLINE PVOID
 __DmaAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, DMA_TAG);
@@ -206,7 +206,7 @@ __DmaAllocate(
 
 static FORCEINLINE VOID
 __DmaFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, DMA_TAG);
@@ -214,7 +214,7 @@ __DmaFree(
 
 static VOID
 DmaDumpDeviceDescription(
-    IN  PDEVICE_DESCRIPTION DeviceDescription
+    _In_ PDEVICE_DESCRIPTION    DeviceDescription
     )
 {
     Trace("Version = %u\n", DeviceDescription->Version);
@@ -263,7 +263,7 @@ fail1:
 
 static VOID
 DmaDestroyContext(
-    IN  PXENBUS_DMA_CONTEXT Context
+    _In_ PXENBUS_DMA_CONTEXT    Context
     )
 {
     Info("%p\n", Context);
@@ -289,11 +289,11 @@ static PXENBUS_DMA_CONTEXT  
DmaContext[NR_CONTEXT_BUCKETS];
 #pragma warning(suppress: 28167) // changes the IRQL and does not restore the 
IRQL before it exits
 static KIRQL
 DmaAcquireLock(
-    IN  PKSPIN_LOCK         Lock
+    _In_ PKSPIN_LOCK        Lock
     )
 {
     KIRQL       Irql;
-    
+
     Irql = KeGetCurrentIrql();
     if (Irql > DISPATCH_LEVEL)
         return Irql;
@@ -305,8 +305,8 @@ DmaAcquireLock(
 #pragma warning(suppress: 28167) // changes the IRQL and does not restore the 
IRQL before it exits
 static VOID
 DmaReleaseLock(
-    IN  PKSPIN_LOCK         Lock,
-    IN  KIRQL               Irql
+    _In_ PKSPIN_LOCK        Lock,
+    _In_ KIRQL              Irql
     )
 {
     if (Irql > DISPATCH_LEVEL)
@@ -318,12 +318,12 @@ DmaReleaseLock(
 
 static VOID
 DmaAddContext(
-    IN  PVOID               Key,
-    IN  PXENBUS_DMA_CONTEXT Context
+    _In_ PVOID                  Key,
+    _In_ PXENBUS_DMA_CONTEXT    Context
     )
 {
-    KIRQL                   Irql;
-    ULONG_PTR               Bucket;
+    KIRQL                       Irql;
+    ULONG_PTR                   Bucket;
 
     Context->Key = Key;
 
@@ -336,13 +336,13 @@ DmaAddContext(
 
 static VOID
 DmaRemoveContext(
-    IN  PXENBUS_DMA_CONTEXT Context
+    _In_ PXENBUS_DMA_CONTEXT    Context
     )
 {
-    PVOID                   Key;
-    KIRQL                   Irql;
-    ULONG_PTR               Bucket;
-    PXENBUS_DMA_CONTEXT     *Entry;
+    PVOID                       Key;
+    KIRQL                       Irql;
+    ULONG_PTR                   Bucket;
+    PXENBUS_DMA_CONTEXT         *Entry;
 
     ASSERT(Context != NULL);
     Key = Context->Key;
@@ -365,7 +365,7 @@ DmaRemoveContext(
 
 static PXENBUS_DMA_CONTEXT
 DmaFindContext(
-    IN  PVOID           Key
+    _In_ PVOID          Key
     )
 {
     KIRQL               Irql;
@@ -387,7 +387,7 @@ DmaFindContext(
 
 static VOID
 DmaPutAdapter(
-    IN  PDMA_ADAPTER    Adapter
+    _In_ PDMA_ADAPTER   Adapter
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -404,10 +404,10 @@ DmaPutAdapter(
 
 static PVOID
 DmaAllocateCommonBuffer(
-    IN  PDMA_ADAPTER        Adapter,
-    IN  ULONG               Length,
-    OUT PPHYSICAL_ADDRESS   LogicalAddress,
-    IN  BOOLEAN             CacheEnabled
+    _In_ PDMA_ADAPTER       Adapter,
+    _In_ ULONG              Length,
+    _Out_ PPHYSICAL_ADDRESS LogicalAddress,
+    _In_ BOOLEAN            CacheEnabled
     )
 {
     PXENBUS_DMA_CONTEXT     Context;
@@ -429,11 +429,11 @@ DmaAllocateCommonBuffer(
 
 static VOID
 DmaFreeCommonBuffer(
-    IN  PDMA_ADAPTER        Adapter,
-    IN  ULONG               Length,
-    IN  PHYSICAL_ADDRESS    LogicalAddress,
-    IN  PVOID               VirtualAddress,
-    IN  BOOLEAN             CacheEnabled
+    _In_ PDMA_ADAPTER       Adapter,
+    _In_ ULONG              Length,
+    _In_ PHYSICAL_ADDRESS   LogicalAddress,
+    _In_ PVOID              VirtualAddress,
+    _In_ BOOLEAN            CacheEnabled
     )
 {
     PXENBUS_DMA_CONTEXT     Context;
@@ -453,16 +453,16 @@ DmaFreeCommonBuffer(
 
 static PXENBUS_DMA_CONTROL
 DmaAddControl(
-    IN  PXENBUS_DMA_CONTEXT Context,
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  PVOID               TransferContext OPTIONAL,
-    IN  PDRIVER_CONTROL     Function,
-    IN  PVOID               Argument
+    _In_ PXENBUS_DMA_CONTEXT    Context,
+    _In_ PDEVICE_OBJECT         DeviceObject,
+    _In_opt_ PVOID              TransferContext,
+    _In_opt_ PDRIVER_CONTROL    Function,
+    _In_opt_ PVOID              Argument
     )
 {
-    PXENBUS_DMA_CONTROL     Control;
-    KIRQL                   Irql;
-    NTSTATUS                status;
+    PXENBUS_DMA_CONTROL         Control;
+    KIRQL                       Irql;
+    NTSTATUS                    status;
 
     ASSERT3U(KeGetCurrentIrql(), <=, DISPATCH_LEVEL);
     Control = __DmaAllocate(sizeof (XENBUS_DMA_CONTROL));
@@ -491,11 +491,11 @@ fail1:
 
 static VOID
 DmaRemoveControl(
-    IN  PXENBUS_DMA_CONTROL Control
+    _In_ PXENBUS_DMA_CONTROL    Control
     )
 {
-    PXENBUS_DMA_CONTEXT     Context = Control->Context;
-    KIRQL                   Irql;
+    PXENBUS_DMA_CONTEXT         Context = Control->Context;
+    KIRQL                       Irql;
 
     ASSERT3U(KeGetCurrentIrql(), <=, DISPATCH_LEVEL);
     KeAcquireSpinLock(&Context->Lock, &Irql);
@@ -509,10 +509,10 @@ DRIVER_CONTROL DmaAdapterControl;
 
 IO_ALLOCATION_ACTION
 DmaAdapterControl(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  PIRP                Irp,
-    IN  PVOID               MapRegisterBase,
-    IN  PVOID               _Context
+    PDEVICE_OBJECT          DeviceObject,
+    PIRP                    Irp,
+    PVOID                   MapRegisterBase,
+    PVOID                   _Context
     )
 {
     PXENBUS_DMA_CONTROL     Control = _Context;
@@ -537,17 +537,17 @@ DmaAdapterControl(
 
 static NTSTATUS
 DmaAllocateAdapterChannel(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  ULONG           NumberOfMapRegisters,
-    IN  PDRIVER_CONTROL Function,
-    IN  PVOID           Argument
+    _In_ PDMA_ADAPTER       Adapter,
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ ULONG              NumberOfMapRegisters,
+    _In_ PDRIVER_CONTROL    Function,
+    _In_ PVOID              Argument
     )
 {
-    PXENBUS_DMA_CONTEXT Context;
-    PXENBUS_DMA_CONTROL Control;
-    PDMA_OPERATIONS     Operations;
-    NTSTATUS            status;
+    PXENBUS_DMA_CONTEXT     Context;
+    PXENBUS_DMA_CONTROL     Control;
+    PDMA_OPERATIONS         Operations;
+    NTSTATUS                status;
 
     UNREFERENCED_PARAMETER(DeviceObject);
 
@@ -566,10 +566,10 @@ DmaAllocateAdapterChannel(
     }
 
     Control = DmaAddControl(Context,
-                              DeviceObject,
-                              NULL,
-                              Function,
-                              Argument);
+                            DeviceObject,
+                            NULL,
+                            Function,
+                            Argument);
 
     status = STATUS_NO_MEMORY;
     if (Control == NULL)
@@ -595,20 +595,20 @@ fail1:
 
 static NTSTATUS
 DmaAllocateAdapterChannelEx(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           TransferContext,
-    IN  ULONG           NumberOfMapRegisters,
-    IN  ULONG           Flags,
-    IN  PDRIVER_CONTROL Function OPTIONAL,
-    IN  PVOID           Argument OPTIONAL,
-    OUT PVOID           *MapRegisterBase OPTIONAL
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_ PDEVICE_OBJECT         DeviceObject,
+    _In_ PVOID                  TransferContext,
+    _In_ ULONG                  NumberOfMapRegisters,
+    _In_ ULONG                  Flags,
+    _In_opt_ PDRIVER_CONTROL    Function,
+    _In_opt_ PVOID              Argument,
+    _Out_opt_ PVOID             *MapRegisterBase
     )
 {
-    PXENBUS_DMA_CONTEXT Context;
-    PXENBUS_DMA_CONTROL Control;
-    PDMA_OPERATIONS     Operations;
-    NTSTATUS            status;
+    PXENBUS_DMA_CONTEXT         Context;
+    PXENBUS_DMA_CONTROL         Control;
+    PDMA_OPERATIONS             Operations;
+    NTSTATUS                    status;
 
     UNREFERENCED_PARAMETER(DeviceObject);
 
@@ -631,10 +631,10 @@ DmaAllocateAdapterChannelEx(
     }
 
     Control = DmaAddControl(Context,
-                              DeviceObject,
-                              TransferContext,
-                              Function,
-                              Argument);
+                            DeviceObject,
+                            TransferContext,
+                            Function,
+                            Argument);
 
     status = STATUS_NO_MEMORY;
     if (Control == NULL)
@@ -663,12 +663,12 @@ fail1:
 
 static BOOLEAN
 DmaFlushAdapterBuffers(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PMDL            Mdl,
-    IN  PVOID           MapRegisterBase,
-    IN  PVOID           CurrentVa,
-    IN  ULONG           Length,
-    IN  BOOLEAN         WriteToDevice
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_ PMDL           Mdl,
+    _In_ PVOID          MapRegisterBase,
+    _In_ PVOID          CurrentVa,
+    _In_ ULONG          Length,
+    _In_ BOOLEAN        WriteToDevice
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -690,7 +690,7 @@ DmaFlushAdapterBuffers(
 
 static VOID
 DmaFreeAdapterChannel(
-    IN  PDMA_ADAPTER    Adapter
+    _In_ PDMA_ADAPTER   Adapter
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -706,9 +706,9 @@ DmaFreeAdapterChannel(
 
 static VOID
 DmaFreeMapRegisters(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PVOID           MapRegisterBase,
-    IN  ULONG           NumberOfMapRegisters
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_ PVOID          MapRegisterBase,
+    _In_ ULONG          NumberOfMapRegisters
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -731,17 +731,17 @@ DmaFreeMapRegisters(
 
 static PHYSICAL_ADDRESS
 DmaMapTransfer(
-    IN      PDMA_ADAPTER    Adapter,
-    IN      PMDL            Mdl,
-    IN      PVOID           MapRegisterBase,
-    IN      PVOID           CurrentVa,
-    IN OUT  PULONG          Length,
-    IN      BOOLEAN         WriteToDevice
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_ PMDL           Mdl,
+    _In_ PVOID          MapRegisterBase,
+    _In_ PVOID          CurrentVa,
+    _Inout_ PULONG      Length,
+    _In_ BOOLEAN        WriteToDevice
     )
 {
-    PXENBUS_DMA_CONTEXT     Context;
-    PDMA_OPERATIONS         Operations;
-    PHYSICAL_ADDRESS        LogicalAddress;
+    PXENBUS_DMA_CONTEXT Context;
+    PDMA_OPERATIONS     Operations;
+    PHYSICAL_ADDRESS    LogicalAddress;
 
     Context = DmaFindContext(Adapter);
 
@@ -752,13 +752,13 @@ DmaMapTransfer(
                                              CurrentVa,
                                              Length,
                                              WriteToDevice);
-    
+
     return LogicalAddress;
 }
 
 static ULONG
 DmaGetAlignment(
-    IN  PDMA_ADAPTER    Adapter
+    _In_ PDMA_ADAPTER   Adapter
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -777,7 +777,7 @@ DmaGetAlignment(
 
 static ULONG
 DmaReadCounter(
-    IN  PDMA_ADAPTER    Adapter
+    _In_ PDMA_ADAPTER   Adapter
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -788,22 +788,22 @@ DmaReadCounter(
 
     Operations = Context->LowerOperations;
     Counter = Operations->ReadDmaCounter(Context->LowerAdapter);
-    
+
     return Counter;
 }
 
 static PXENBUS_DMA_LIST_CONTROL
 DmaAddListControl(
-    IN  PXENBUS_DMA_CONTEXT     Context,
-    IN  PDEVICE_OBJECT          DeviceObject,
-    IN  PVOID                   TransferContext OPTIONAL,
-    IN  PDRIVER_LIST_CONTROL    Function,
-    IN  PVOID                   Argument
+    _In_ PXENBUS_DMA_CONTEXT        Context,
+    _In_ PDEVICE_OBJECT             DeviceObject,
+    _In_opt_ PVOID                  TransferContext,
+    _In_opt_ PDRIVER_LIST_CONTROL   Function,
+    _In_opt_ PVOID                  Argument
     )
 {
-    PXENBUS_DMA_LIST_CONTROL    ListControl;
-    KIRQL                       Irql;
-    NTSTATUS                    status;
+    PXENBUS_DMA_LIST_CONTROL        ListControl;
+    KIRQL                           Irql;
+    NTSTATUS                        status;
 
     ASSERT3U(KeGetCurrentIrql(), <=, DISPATCH_LEVEL);
     ListControl = __DmaAllocate(sizeof (XENBUS_DMA_LIST_CONTROL));
@@ -832,7 +832,7 @@ fail1:
 
 static VOID
 DmaRemoveListControl(
-    IN  PXENBUS_DMA_LIST_CONTROL    ListControl
+    _In_ PXENBUS_DMA_LIST_CONTROL   ListControl
     )
 {
     PXENBUS_DMA_CONTEXT             Context = ListControl->Context;
@@ -850,10 +850,10 @@ DRIVER_LIST_CONTROL DmaAdapterListControl;
 
 VOID
 DmaAdapterListControl(
-    IN  PDEVICE_OBJECT          DeviceObject,
-    IN  PIRP                    Irp,
-    IN  PSCATTER_GATHER_LIST    ScatterGather,
-    IN  PVOID                   _Context
+    _In_ PDEVICE_OBJECT         DeviceObject,
+    _In_ PIRP                   Irp,
+    _In_ PSCATTER_GATHER_LIST   ScatterGather,
+    _In_ PVOID                  _Context
     )
 {
     PXENBUS_DMA_LIST_CONTROL    ListControl = _Context;
@@ -871,14 +871,14 @@ DmaAdapterListControl(
 
 static NTSTATUS
 DmaGetScatterGatherList(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  PDEVICE_OBJECT          DeviceObject,
-    IN  PMDL                    Mdl,
-    IN  PVOID                   CurrentVa,
-    IN  ULONG                   Length,
-    IN  PDRIVER_LIST_CONTROL    Function,
-    IN  PVOID                   Argument,
-    IN  BOOLEAN                 WriteToDevice
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_ PDEVICE_OBJECT         DeviceObject,
+    _In_ PMDL                   Mdl,
+    _In_ PVOID                  CurrentVa,
+    _In_ ULONG                  Length,
+    _In_ PDRIVER_LIST_CONTROL   Function,
+    _In_ PVOID                  Argument,
+    _In_ BOOLEAN                WriteToDevice
     )
 {
     PXENBUS_DMA_CONTEXT         Context;
@@ -937,25 +937,25 @@ fail1:
 
 static NTSTATUS
 DmaGetScatterGatherListEx(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  PDEVICE_OBJECT          DeviceObject,
-    IN  PVOID                   TransferContext,
-    IN  PMDL                    Mdl,
-    IN  ULONGLONG               Offset,
-    IN  ULONG                   Length,
-    IN  ULONG                   Flags,
-    IN  PDRIVER_LIST_CONTROL    Function,
-    IN  PVOID                   Argument OPTIONAL,
-    IN  BOOLEAN                 WriteToDevice,
-    IN  PDMA_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
-    IN  PVOID                   CompletionContext OPTIONAL,
-    OUT PSCATTER_GATHER_LIST    *ScatterGatherList OPTIONAL
+    _In_ PDMA_ADAPTER                   Adapter,
+    _In_ PDEVICE_OBJECT                 DeviceObject,
+    _In_ PVOID                          TransferContext,
+    _In_ PMDL                           Mdl,
+    _In_ ULONGLONG                      Offset,
+    _In_ ULONG                          Length,
+    _In_ ULONG                          Flags,
+    _In_ PDRIVER_LIST_CONTROL           Function,
+    _In_opt_ PVOID                      Argument,
+    _In_ BOOLEAN                        WriteToDevice,
+    _In_opt_ PDMA_COMPLETION_ROUTINE    CompletionRoutine,
+    _In_opt_ PVOID                      CompletionContext,
+    _Out_opt_ PSCATTER_GATHER_LIST      *ScatterGatherList
     )
 {
-    PXENBUS_DMA_CONTEXT         Context;
-    PXENBUS_DMA_LIST_CONTROL    ListControl;
-    PDMA_OPERATIONS             Operations;
-    NTSTATUS                    status;
+    PXENBUS_DMA_CONTEXT                 Context;
+    PXENBUS_DMA_LIST_CONTROL            ListControl;
+    PDMA_OPERATIONS                     Operations;
+    NTSTATUS                            status;
 
     UNREFERENCED_PARAMETER(DeviceObject);
 
@@ -1017,12 +1017,12 @@ fail1:
 
 static NTSTATUS
 DmaCalculateScatterGatherList(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PMDL            Mdl OPTIONAL,
-    IN  PVOID           CurrentVa,
-    IN  ULONG           Length,
-    OUT PULONG          ScatterGatherListSize,
-    OUT PULONG          NumberOfMapRegisters OPTIONAL
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_opt_ PMDL       Mdl,
+    _In_ PVOID          CurrentVa,
+    _In_ ULONG          Length,
+    _Out_ PULONG        ScatterGatherListSize,
+    _Out_opt_ PULONG    NumberOfMapRegisters
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -1033,6 +1033,7 @@ DmaCalculateScatterGatherList(
     ASSERT3U(Context->Version, >=, 2);
 
     Operations = Context->LowerOperations;
+#pragma prefast(suppress:6387) // bad CalculateScatterGatherList signature
     status = Operations->CalculateScatterGatherList(Context->LowerAdapter,
                                                     Mdl,
                                                     CurrentVa,
@@ -1045,16 +1046,16 @@ DmaCalculateScatterGatherList(
 
 static NTSTATUS
 DmaBuildScatterGatherList(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  PDEVICE_OBJECT          DeviceObject,
-    IN  PMDL                    Mdl,
-    IN  PVOID                   CurrentVa,
-    IN  ULONG                   Length,
-    IN  PDRIVER_LIST_CONTROL    Function,
-    IN  PVOID                   Argument,
-    IN  BOOLEAN                 WriteToDevice,
-    IN  PVOID                   ScatterGatherBuffer,
-    IN  ULONG                   ScatterGatherBufferLength
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_ PDEVICE_OBJECT         DeviceObject,
+    _In_ PMDL                   Mdl,
+    _In_ PVOID                  CurrentVa,
+    _In_ ULONG                  Length,
+    _In_ PDRIVER_LIST_CONTROL   Function,
+    _In_ PVOID                  Argument,
+    _In_ BOOLEAN                WriteToDevice,
+    _In_ PVOID                  ScatterGatherBuffer,
+    _In_ ULONG                  ScatterGatherBufferLength
     )
 {
     PXENBUS_DMA_CONTEXT         Context;
@@ -1119,27 +1120,27 @@ fail1:
 
 static NTSTATUS
 DmaBuildScatterGatherListEx(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  PDEVICE_OBJECT          DeviceObject,
-    IN  PVOID                   TransferContext,
-    IN  PMDL                    Mdl,
-    IN  ULONGLONG               Offset,
-    IN  ULONG                   Length,
-    IN  ULONG                   Flags,
-    IN  PDRIVER_LIST_CONTROL    Function OPTIONAL,
-    IN  PVOID                   Argument OPTIONAL,
-    IN  BOOLEAN                 WriteToDevice,
-    IN  PVOID                   ScatterGatherBuffer,
-    IN  ULONG                   ScatterGatherBufferLength,
-    IN  PDMA_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
-    IN  PVOID                   CompletionContext OPTIONAL,
-    OUT PSCATTER_GATHER_LIST    *ScatterGatherList OPTIONAL
+    _In_ PDMA_ADAPTER                   Adapter,
+    _In_ PDEVICE_OBJECT                 DeviceObject,
+    _In_ PVOID                          TransferContext,
+    _In_ PMDL                           Mdl,
+    _In_ ULONGLONG                      Offset,
+    _In_ ULONG                          Length,
+    _In_ ULONG                          Flags,
+    _In_opt_ PDRIVER_LIST_CONTROL       Function,
+    _In_opt_ PVOID                      Argument,
+    _In_ BOOLEAN                        WriteToDevice,
+    _In_ PVOID                          ScatterGatherBuffer,
+    _In_ ULONG                          ScatterGatherBufferLength,
+    _In_opt_ PDMA_COMPLETION_ROUTINE    CompletionRoutine,
+    _In_opt_ PVOID                      CompletionContext,
+    _Out_opt_ PSCATTER_GATHER_LIST      *ScatterGatherList
     )
 {
-    PXENBUS_DMA_CONTEXT         Context;
-    PXENBUS_DMA_LIST_CONTROL    ListControl;
-    PDMA_OPERATIONS             Operations;
-    NTSTATUS                    status;
+    PXENBUS_DMA_CONTEXT                 Context;
+    PXENBUS_DMA_LIST_CONTROL            ListControl;
+    PDMA_OPERATIONS                     Operations;
+    NTSTATUS                            status;
 
     UNREFERENCED_PARAMETER(DeviceObject);
 
@@ -1207,9 +1208,9 @@ fail1:
 
 static VOID
 DmaPutScatterGatherList(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  PSCATTER_GATHER_LIST    ScatterGather,
-    IN  BOOLEAN                 WriteToDevice
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_ PSCATTER_GATHER_LIST   ScatterGather,
+    _In_ BOOLEAN                WriteToDevice
     )
 
 {
@@ -1217,7 +1218,7 @@ DmaPutScatterGatherList(
     PDMA_OPERATIONS             Operations;
 
     ASSERT3U(KeGetCurrentIrql(), >=, DISPATCH_LEVEL);
- 
+
     Context = DmaFindContext(Adapter);
 
     Operations = Context->LowerOperations;
@@ -1228,10 +1229,10 @@ DmaPutScatterGatherList(
 
 static NTSTATUS
 DmaBuildMdlFromScatterGatherList(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  PSCATTER_GATHER_LIST    ScatterGather,
-    IN  PMDL                    OriginalMdl,
-    IN  PMDL                    *TargetMdl
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_ PSCATTER_GATHER_LIST   ScatterGather,
+    _In_ PMDL                   OriginalMdl,
+    _In_ PMDL                   *TargetMdl
     )
 {
     PXENBUS_DMA_CONTEXT         Context;
@@ -1245,16 +1246,16 @@ DmaBuildMdlFromScatterGatherList(
     status = Operations->BuildMdlFromScatterGatherList(Context->LowerAdapter,
                                                        ScatterGather,
                                                        OriginalMdl,
-                                                       TargetMdl);  
+                                                       TargetMdl);
 
     return status;
 }
 
 static BOOLEAN
 DmaCancelAdapterChannel(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           TransferContext
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_ PVOID          TransferContext
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -1310,8 +1311,8 @@ DmaCancelAdapterChannel(
 
 static NTSTATUS
 DmaGetAdapterInfo(
-    IN      PDMA_ADAPTER        Adapter,
-    IN OUT  PDMA_ADAPTER_INFO   AdapterInfo
+    _In_ PDMA_ADAPTER           Adapter,
+    _Inout_ PDMA_ADAPTER_INFO   AdapterInfo
     )
 {
     PXENBUS_DMA_CONTEXT         Context;
@@ -1330,12 +1331,12 @@ DmaGetAdapterInfo(
 
 static NTSTATUS
 DmaGetTransferInfo(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  PMDL                    Mdl,
-    IN  ULONGLONG               Offset,
-    IN  ULONG                   Length,
-    IN  BOOLEAN                 WriteOnly,
-    IN OUT  PDMA_TRANSFER_INFO  TransferInfo
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_ PMDL                   Mdl,
+    _In_ ULONGLONG              Offset,
+    _In_ ULONG                  Length,
+    _In_ BOOLEAN                WriteOnly,
+    _Inout_ PDMA_TRANSFER_INFO  TransferInfo
     )
 {
     PXENBUS_DMA_CONTEXT         Context;
@@ -1358,8 +1359,8 @@ DmaGetTransferInfo(
 
 static NTSTATUS
 DmaInitializeTransferContext(
-    IN  PDMA_ADAPTER    Adapter,
-    OUT PVOID           TransferContext
+    _In_ PDMA_ADAPTER   Adapter,
+    _Out_ PVOID         TransferContext
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -1378,17 +1379,17 @@ DmaInitializeTransferContext(
 
 static PVOID
 DmaAllocateCommonBufferEx(
-    IN  PDMA_ADAPTER        Adapter,
-    IN  PPHYSICAL_ADDRESS   MaximumAddress OPTIONAL,
-    IN  ULONG               Length,
-    OUT PPHYSICAL_ADDRESS   LogicalAddress,
-    IN  BOOLEAN             CacheEnabled,
-    IN  NODE_REQUIREMENT    PreferredNode
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_opt_ PPHYSICAL_ADDRESS  MaximumAddress,
+    _In_ ULONG                  Length,
+    _Out_ PPHYSICAL_ADDRESS     LogicalAddress,
+    _In_ BOOLEAN                CacheEnabled,
+    _In_ NODE_REQUIREMENT       PreferredNode
     )
 {
-    PXENBUS_DMA_CONTEXT     Context;
-    PDMA_OPERATIONS         Operations;
-    PVOID                   Buffer;
+    PXENBUS_DMA_CONTEXT         Context;
+    PDMA_OPERATIONS             Operations;
+    PVOID                       Buffer;
 
     ASSERTIRQL(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
@@ -1408,9 +1409,9 @@ DmaAllocateCommonBufferEx(
 
 static NTSTATUS
 DmaConfigureAdapterChannel(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  ULONG           FunctionNumber,
-    IN  PVOID           Argument
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_ ULONG          FunctionNumber,
+    _In_ PVOID          Argument
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -1430,22 +1431,22 @@ DmaConfigureAdapterChannel(
 
 static NTSTATUS
 DmaMapTransferEx(
-    IN      PDMA_ADAPTER            Adapter,
-    IN      PMDL                    Mdl,
-    IN      PVOID                   MapRegisterBase,
-    IN      ULONGLONG               Offset,
-    IN      ULONG                   DeviceOffset,
-    IN OUT  PULONG                  Length,
-    IN      BOOLEAN                 WriteToDevice,
-    OUT     PSCATTER_GATHER_LIST    ScatterGatherBuffer OPTIONAL,
-    IN      ULONG                   ScatterGatherBufferLength,
-    IN      PDMA_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
-    IN      PVOID                   CompletionContext OPTIONAL
+    _In_ PDMA_ADAPTER                   Adapter,
+    _In_ PMDL                           Mdl,
+    _In_ PVOID                          MapRegisterBase,
+    _In_ ULONGLONG                      Offset,
+    _In_ ULONG                          DeviceOffset,
+    _Inout_ PULONG                      Length,
+    _In_ BOOLEAN                        WriteToDevice,
+    _Out_opt_ PSCATTER_GATHER_LIST      ScatterGatherBuffer,
+    _In_ ULONG                          ScatterGatherBufferLength,
+    _In_opt_ PDMA_COMPLETION_ROUTINE    CompletionRoutine,
+    _In_opt_ PVOID                      CompletionContext
     )
 {
-    PXENBUS_DMA_CONTEXT             Context;
-    PDMA_OPERATIONS                 Operations;
-    NTSTATUS                        status;
+    PXENBUS_DMA_CONTEXT                 Context;
+    PDMA_OPERATIONS                     Operations;
+    NTSTATUS                            status;
 
     Context = DmaFindContext(Adapter);
     ASSERT3U(Context->Version, >=, 3);
@@ -1468,12 +1469,12 @@ DmaMapTransferEx(
 
 static NTSTATUS
 DmaFlushAdapterBuffersEx(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PMDL            Mdl,
-    IN  PVOID           MapRegisterBase,
-    IN  ULONGLONG       Offset,
-    IN  ULONG           Length,
-    IN  BOOLEAN         WriteToDevice
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_ PMDL           Mdl,
+    _In_ PVOID          MapRegisterBase,
+    _In_ ULONGLONG      Offset,
+    _In_ ULONG          Length,
+    _In_ BOOLEAN        WriteToDevice
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -1496,8 +1497,8 @@ DmaFlushAdapterBuffersEx(
 
 static VOID
 DmaFreeAdapterObject(
-    IN  PDMA_ADAPTER            Adapter,
-    IN  IO_ALLOCATION_ACTION    AllocationAction
+    _In_ PDMA_ADAPTER           Adapter,
+    _In_ IO_ALLOCATION_ACTION   AllocationAction
     )
 {
     PXENBUS_DMA_CONTEXT         Context;
@@ -1531,8 +1532,8 @@ DmaFreeAdapterObject(
 
 static NTSTATUS
 DmaCancelMappedTransfer(
-    IN  PDMA_ADAPTER    Adapter,
-    IN  PVOID           TransferContext
+    _In_ PDMA_ADAPTER   Adapter,
+    _In_ PVOID          TransferContext
     )
 {
     PXENBUS_DMA_CONTEXT Context;
@@ -1593,17 +1594,17 @@ static DMA_OPERATIONS   DmaOperations = {
 
 PDMA_ADAPTER
 DmaGetAdapter(
-    IN  PXENBUS_PDO             Pdo,
-    IN  XENBUS_DMA_ADAPTER_TYPE Type,
-    IN  PDEVICE_DESCRIPTION     DeviceDescription,
-    OUT PULONG                  NumberOfMapRegisters
+    _In_ PXENBUS_PDO                Pdo,
+    _In_ XENBUS_DMA_ADAPTER_TYPE    Type,
+    _In_ PDEVICE_DESCRIPTION        DeviceDescription,
+    _Out_ PULONG                    NumberOfMapRegisters
     )
 {
-    PDMA_ADAPTER                LowerAdapter;
-    PDEVICE_OBJECT              LowerDeviceObject;
-    PXENBUS_DMA_CONTEXT         Context;
-    PDMA_ADAPTER                Adapter;
-    NTSTATUS                    status;
+    PDMA_ADAPTER                    LowerAdapter;
+    PDEVICE_OBJECT                  LowerDeviceObject;
+    PXENBUS_DMA_CONTEXT             Context;
+    PDMA_ADAPTER                    Adapter;
+    NTSTATUS                        status;
 
     DmaDumpDeviceDescription(DeviceDescription);
 
@@ -1635,7 +1636,7 @@ DmaGetAdapter(
         goto fail2;
 
     Context->LowerAdapter = LowerAdapter;
-    Context->LowerOperations = LowerAdapter->DmaOperations; 
+    Context->LowerOperations = LowerAdapter->DmaOperations;
     Context->LowerDeviceObject = LowerDeviceObject;
 
     switch (Context->LowerOperations->Size) {
@@ -1661,7 +1662,7 @@ DmaGetAdapter(
 
     // Copy in the requisite number of operations
     RtlCopyMemory(&Context->Operations,
-                  &DmaOperations, 
+                  &DmaOperations,
                   Context->LowerOperations->Size);
     Context->Operations.Size = Context->LowerOperations->Size;
 
diff --git a/src/xenbus/dma.h b/src/xenbus/dma.h
index 6953385..49fd40d 100644
--- a/src/xenbus/dma.h
+++ b/src/xenbus/dma.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.
  */
 
@@ -46,10 +46,10 @@ typedef enum {
 
 PDMA_ADAPTER
 DmaGetAdapter(
-    IN  PXENBUS_PDO             Pdo,
-    IN  XENBUS_DMA_ADAPTER_TYPE Type,
-    IN  PDEVICE_DESCRIPTION     DeviceDescriptor,
-    OUT PULONG                  NumberOfMapRegisters
+    _In_ PXENBUS_PDO                Pdo,
+    _In_ XENBUS_DMA_ADAPTER_TYPE    Type,
+    _In_ PDEVICE_DESCRIPTION        DeviceDescriptor,
+    _Out_ PULONG                    NumberOfMapRegisters
     );
 
 #endif  // _XENBUS_DMA_H
diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c
index 4aae2cc..8ae662d 100644
--- a/src/xenbus/driver.c
+++ b/src/xenbus/driver.c
@@ -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.
  */
 
@@ -63,7 +63,7 @@ static XENBUS_DRIVER    Driver;
 
 static FORCEINLINE PVOID
 __DriverAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_DRIVER_TAG);
@@ -71,7 +71,7 @@ __DriverAllocate(
 
 static FORCEINLINE VOID
 __DriverFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_DRIVER_TAG);
@@ -79,7 +79,7 @@ __DriverFree(
 
 static FORCEINLINE VOID
 __DriverSetDriverObject(
-    IN  PDRIVER_OBJECT  DriverObject
+    _In_opt_ PDRIVER_OBJECT DriverObject
     )
 {
     Driver.DriverObject = DriverObject;
@@ -103,7 +103,7 @@ DriverGetDriverObject(
 
 static FORCEINLINE VOID
 __DriverSetParametersKey(
-    IN  HANDLE  Key
+    _In_opt_ HANDLE Key
     )
 {
     Driver.ParametersKey = Key;
@@ -127,7 +127,7 @@ DriverGetParametersKey(
 
 static FORCEINLINE VOID
 __DriverSetConsoleLogLevel(
-    IN  LOG_LEVEL   LogLevel
+    _In_ LOG_LEVEL  LogLevel
     )
 {
     Driver.ConsoleLogLevel = LogLevel;
@@ -183,12 +183,12 @@ DriverReleaseMutex(
 
 VOID
 DriverAddFunctionDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PDEVICE_OBJECT  DeviceObject;
-    PXENBUS_DX      Dx;
-    ULONG           References;
+    PDEVICE_OBJECT      DeviceObject;
+    PXENBUS_DX          Dx;
+    ULONG               References;
 
     DeviceObject = FdoGetDeviceObject(Fdo);
     Dx = (PXENBUS_DX)DeviceObject->DeviceExtension;
@@ -203,12 +203,12 @@ DriverAddFunctionDeviceObject(
 
 VOID
 DriverRemoveFunctionDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PDEVICE_OBJECT  DeviceObject;
-    PXENBUS_DX      Dx;
-    ULONG           References;
+    PDEVICE_OBJECT      DeviceObject;
+    PXENBUS_DX          Dx;
+    ULONG               References;
 
     DeviceObject = FdoGetDeviceObject(Fdo);
     Dx = (PXENBUS_DX)DeviceObject->DeviceExtension;
@@ -226,7 +226,7 @@ DRIVER_UNLOAD       DriverUnload;
 
 VOID
 DriverUnload(
-    IN  PDRIVER_OBJECT  DriverObject
+    _In_ PDRIVER_OBJECT DriverObject
     )
 {
     HANDLE              ParametersKey;
@@ -272,8 +272,8 @@ DRIVER_ADD_DEVICE   DriverAddDevice;
 NTSTATUS
 #pragma prefast(suppress:28152) // Does not clear DO_DEVICE_INITIALIZING
 DriverAddDevice(
-    IN  PDRIVER_OBJECT  DriverObject,
-    IN  PDEVICE_OBJECT  DeviceObject
+    _In_ PDRIVER_OBJECT DriverObject,
+    _In_ PDEVICE_OBJECT DeviceObject
     )
 {
     NTSTATUS            status;
@@ -302,10 +302,11 @@ fail1:
 
 DRIVER_DISPATCH DriverDispatch;
 
-NTSTATUS 
+_Use_decl_annotations_
+NTSTATUS
 DriverDispatch(
-    IN PDEVICE_OBJECT   DeviceObject,
-    IN PIRP             Irp
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp
     )
 {
     PXENBUS_DX          Dx;
@@ -361,14 +362,14 @@ DRIVER_INITIALIZE   DriverEntry;
 
 NTSTATUS
 DriverEntry(
-    IN  PDRIVER_OBJECT  DriverObject,
-    IN  PUNICODE_STRING RegistryPath
+    _In_ PDRIVER_OBJECT     DriverObject,
+    _In_ PUNICODE_STRING    RegistryPath
     )
 {
-    HANDLE              ParametersKey;
-    ULONG               Index;
-    LOG_LEVEL           LogLevel;
-    NTSTATUS            status;
+    HANDLE                  ParametersKey;
+    ULONG                   Index;
+    LOG_LEVEL               LogLevel;
+    NTSTATUS                status;
 
     ASSERT3P(__DriverGetDriverObject(), ==, NULL);
 
diff --git a/src/xenbus/driver.h b/src/xenbus/driver.h
index 99290e0..5f43379 100644
--- a/src/xenbus/driver.h
+++ b/src/xenbus/driver.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.
  */
 
@@ -70,12 +70,12 @@ typedef struct _XENBUS_PDO      XENBUS_PDO, *PXENBUS_PDO;
 
 extern VOID
 DriverAddFunctionDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern VOID
 DriverRemoveFunctionDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #pragma warning(push)
diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c
index 123f4a3..bb071d4 100644
--- a/src/xenbus/evtchn.c
+++ b/src/xenbus/evtchn.c
@@ -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.
  */
 
@@ -127,7 +127,7 @@ struct _XENBUS_EVTCHN_CONTEXT {
 
 static FORCEINLINE PVOID
 __EvtchnAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_EVTCHN_TAG);
@@ -135,7 +135,7 @@ __EvtchnAllocate(
 
 static FORCEINLINE VOID
 __EvtchnFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_EVTCHN_TAG);
@@ -143,10 +143,10 @@ __EvtchnFree(
 
 static NTSTATUS
 EvtchnOpenFixed(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  ULONG                   Count,
-    IN  va_list                 Arguments
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ ULONG                  Count,
+    _In_ va_list                Arguments
     )
 {
     ULONG                       LocalPort;
@@ -166,10 +166,10 @@ EvtchnOpenFixed(
 
 static NTSTATUS
 EvtchnOpenUnbound(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  ULONG                   Count,
-    IN  va_list                 Arguments
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ ULONG                  Count,
+    _In_ va_list                Arguments
     )
 {
     USHORT                      RemoteDomain;
@@ -202,10 +202,10 @@ fail1:
 
 static NTSTATUS
 EvtchnOpenInterDomain(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  ULONG                   Count,
-    IN  va_list                 Arguments
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ ULONG                  Count,
+    _In_ va_list                Arguments
     )
 {
     USHORT                      RemoteDomain;
@@ -243,10 +243,10 @@ fail1:
 
 static NTSTATUS
 EvtchnOpenVirq(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  ULONG                   Count,
-    IN  va_list                 Arguments
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ ULONG                  Count,
+    _In_ va_list                Arguments
     )
 {
     ULONG                       Index;
@@ -320,10 +320,10 @@ RtlCaptureStackBackTrace(
 
 static PXENBUS_EVTCHN_CHANNEL
 EvtchnOpen(
-    IN  PINTERFACE          Interface,
-    IN  XENBUS_EVTCHN_TYPE  Type,
-    IN  PKSERVICE_ROUTINE   Callback,
-    IN  PVOID               Argument OPTIONAL,
+    _In_ PINTERFACE         Interface,
+    _In_ XENBUS_EVTCHN_TYPE Type,
+    _In_ PKSERVICE_ROUTINE  Callback,
+    _In_opt_ PVOID          Argument,
     ...
     )
 {
@@ -344,7 +344,7 @@ EvtchnOpen(
 
     Channel->Magic = XENBUS_EVTCHN_CHANNEL_MAGIC;
 
-    (VOID) RtlCaptureStackBackTrace(1, 1, &Channel->Caller, NULL);    
+    (VOID) RtlCaptureStackBackTrace(1, 1, &Channel->Caller, NULL);
 
     Channel->Type = Type;
     Channel->Callback = Callback;
@@ -449,9 +449,9 @@ fail1:
 
 static VOID
 EvtchnReap(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  BOOLEAN                 Close
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ BOOLEAN                Close
     )
 {
     ULONG                       LocalPort = Channel->LocalPort;
@@ -493,8 +493,8 @@ EvtchnReap(
 
 static BOOLEAN
 EvtchnPollCallback(
-    IN  PVOID                   Argument,
-    IN  ULONG                   LocalPort
+    _In_ PVOID                  Argument,
+    _In_ ULONG                  LocalPort
     )
 {
     PXENBUS_EVTCHN_PROCESSOR    Processor = Argument;
@@ -527,9 +527,9 @@ done:
 
 static BOOLEAN
 EvtchnPoll(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context,
-    IN  ULONG                   Cpu,
-    IN  PLIST_ENTRY             List
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ ULONG                  Cpu,
+    _In_opt_ PLIST_ENTRY        List
     )
 {
     PXENBUS_EVTCHN_PROCESSOR    Processor;
@@ -609,8 +609,8 @@ EvtchnPoll(
 
 static VOID
 EvtchnFlush(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context,
-    IN  ULONG                   Cpu
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ ULONG                  Cpu
     )
 {
     PXENBUS_EVTCHN_PROCESSOR    Processor;
@@ -663,10 +663,10 @@ _IRQL_requires_(DISPATCH_LEVEL)
 _IRQL_requires_same_
 VOID
 EvtchnDpc(
-    IN  PKDPC                   Dpc,
-    IN  PVOID                   _Context,
-    IN  PVOID                   Argument1,
-    IN  PVOID                   Argument2
+    _In_ PKDPC                  Dpc,
+    _In_ PVOID                  _Context,
+    _In_ PVOID                  Argument1,
+    _In_ PVOID                  Argument2
     )
 {
     PXENBUS_EVTCHN_PROCESSOR    Processor = _Context;
@@ -690,8 +690,8 @@ done:
 
 static VOID
 EvtchnTrigger(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     )
 {
     PXENBUS_EVTCHN_CONTEXT      Context = Interface->Context;
@@ -733,10 +733,10 @@ EvtchnTrigger(
 
 static NTSTATUS
 EvtchnBind(
-    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
     )
 {
     PXENBUS_EVTCHN_CONTEXT      Context = Interface->Context;
@@ -806,10 +806,10 @@ fail1:
 
 static BOOLEAN
 EvtchnUnmask(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  BOOLEAN                 InUpcall,
-    IN  BOOLEAN                 Force
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ BOOLEAN                InUpcall,
+    _In_ BOOLEAN                Force
     )
 {
     PXENBUS_EVTCHN_CONTEXT      Context = Interface->Context;
@@ -888,9 +888,9 @@ done:
 
 static VOID
 EvtchnUnmaskVersion4(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  BOOLEAN                 InUpcall
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ BOOLEAN                InUpcall
     )
 {
     EvtchnUnmask(Interface, Channel, InUpcall, TRUE);
@@ -898,8 +898,8 @@ EvtchnUnmaskVersion4(
 
 static VOID
 EvtchnSend(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     )
 {
     UNREFERENCED_PARAMETER(Interface);
@@ -914,8 +914,8 @@ EvtchnSend(
 
 static VOID
 EvtchnSendVersion1(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     )
 {
     KIRQL                       Irql;
@@ -927,8 +927,8 @@ EvtchnSendVersion1(
 
 static VOID
 EvtchnClose(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     )
 {
     PXENBUS_EVTCHN_CONTEXT      Context = Interface->Context;
@@ -979,8 +979,8 @@ done:
 
 static ULONG
 EvtchnGetPort(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     )
 {
     UNREFERENCED_PARAMETER(Interface);
@@ -993,8 +993,8 @@ EvtchnGetPort(
 
 static ULONG
 EvtchnGetCount(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel
     )
 {
     UNREFERENCED_PARAMETER(Interface);
@@ -1006,10 +1006,10 @@ EvtchnGetCount(
 
 static NTSTATUS
 EvtchnWait(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  ULONG                   Count,
-    IN  PLARGE_INTEGER          Timeout
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ ULONG                  Count,
+    _In_ PLARGE_INTEGER         Timeout
     )
 {
     KIRQL                       Irql;
@@ -1069,9 +1069,9 @@ EvtchnWait(
 
 static NTSTATUS
 EvtchnWaitVersion5(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  PLARGE_INTEGER          Timeout
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_EVTCHN_CHANNEL Channel,
+    _In_ PLARGE_INTEGER         Timeout
     )
 {
     ULONG                       Count;
@@ -1084,13 +1084,13 @@ EvtchnWaitVersion5(
                       Timeout);
 }
 
-static
-_Function_class_(KSERVICE_ROUTINE)
-__drv_requiresIRQL(HIGH_LEVEL)
-BOOLEAN
+static KSERVICE_ROUTINE EvtchnInterruptCallback;
+
+_Use_decl_annotations_
+static BOOLEAN
 EvtchnInterruptCallback(
-    IN  PKINTERRUPT             InterruptObject,
-    IN  PVOID                   Argument
+    PKINTERRUPT                 InterruptObject,
+    PVOID                       Argument
     )
 {
     PXENBUS_EVTCHN_PROCESSOR    Processor = Argument;
@@ -1223,7 +1223,7 @@ EvtchnReset(
 
 static NTSTATUS
 EvtchnAbiAcquire(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     )
 {
     NTSTATUS                    status;
@@ -1263,7 +1263,7 @@ fail1:
 
 static VOID
 EvtchnAbiRelease(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     )
 {
     XENBUS_EVTCHN_ABI(Release, &Context->EvtchnAbi);
@@ -1273,8 +1273,8 @@ EvtchnAbiRelease(
 
 static BOOLEAN
 EvtchnIsProcessorEnabled(
-    IN  PXENBUS_EVTCHN_CONTEXT      Context,
-    IN  ULONG                       Cpu
+    _In_ PXENBUS_EVTCHN_CONTEXT     Context,
+    _In_ ULONG                      Cpu
     )
 {
     if (!XENBUS_SHARED_INFO(UpcallSupported,
@@ -1289,7 +1289,7 @@ EvtchnIsProcessorEnabled(
 
 static VOID
 EvtchnInterruptEnable(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     )
 {
     ULONG                       Cpu;
@@ -1362,7 +1362,7 @@ line:
 
 static VOID
 EvtchnInterruptDisable(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     )
 {
     ULONG                       Cpu;
@@ -1398,7 +1398,7 @@ EvtchnInterruptDisable(
 
 static VOID
 EvtchnSuspendCallbackEarly(
-    IN  PVOID               Argument
+    _In_ PVOID              Argument
     )
 {
     PXENBUS_EVTCHN_CONTEXT  Context = Argument;
@@ -1429,7 +1429,7 @@ EvtchnSuspendCallbackEarly(
 
 static VOID
 EvtchnSuspendCallbackLate(
-    IN  PVOID               Argument
+    _In_ PVOID              Argument
     )
 {
     PXENBUS_EVTCHN_CONTEXT  Context = Argument;
@@ -1446,8 +1446,8 @@ EvtchnSuspendCallbackLate(
 
 static VOID
 EvtchnDebugCallback(
-    IN  PVOID               Argument,
-    IN  BOOLEAN             Crashing
+    _In_ PVOID              Argument,
+    _In_ BOOLEAN            Crashing
     )
 {
     PXENBUS_EVTCHN_CONTEXT  Context = Argument;
@@ -1536,7 +1536,7 @@ EvtchnDebugCallback(
 
 static NTSTATUS
 EvtchnAcquire(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_EVTCHN_CONTEXT  Context = Interface->Context;
@@ -1736,7 +1736,7 @@ fail1:
 
 VOID
 EvtchnRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_EVTCHN_CONTEXT  Context = Interface->Context;
@@ -1891,14 +1891,14 @@ static struct _XENBUS_EVTCHN_INTERFACE_V9 
EvtchnInterfaceVersion9 = {
 
 NTSTATUS
 EvtchnInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_EVTCHN_CONTEXT  *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_EVTCHN_CONTEXT    *Context
     )
 {
-    HANDLE                      ParametersKey;
-    ULONG                       UseEvtchnFifoAbi;
-    ULONG                       UseEvtchnUpcall;
-    NTSTATUS                    status;
+    HANDLE                          ParametersKey;
+    ULONG                           UseEvtchnFifoAbi;
+    ULONG                           UseEvtchnUpcall;
+    NTSTATUS                        status;
 
     Trace("====>\n");
 
@@ -1995,13 +1995,13 @@ fail1:
 
 NTSTATUS
 EvtchnGetInterface(
-    IN      PXENBUS_EVTCHN_CONTEXT  Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     )
 {
-    NTSTATUS                        status;
+    NTSTATUS                    status;
 
     ASSERT(Context != NULL);
 
@@ -2097,11 +2097,11 @@ EvtchnGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 EvtchnGetReferences(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     )
 {
     return Context->References;
@@ -2109,7 +2109,7 @@ EvtchnGetReferences(
 
 VOID
 EvtchnTeardown(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/evtchn.h b/src/xenbus/evtchn.h
index 3a85d45..d3ddd89 100644
--- a/src/xenbus/evtchn.h
+++ b/src/xenbus/evtchn.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_EVTCHN_CONTEXT  
XENBUS_EVTCHN_CONTEXT, *PXENBUS_EVTCHN_CO
 
 extern NTSTATUS
 EvtchnInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_EVTCHN_CONTEXT  *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_EVTCHN_CONTEXT    *Context
     );
 
 extern NTSTATUS
 EvtchnGetInterface(
-    IN      PXENBUS_EVTCHN_CONTEXT  Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_EVTCHN_CONTEXT Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     );
 
 extern ULONG
 EvtchnGetReferences(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     );
 
 extern VOID
 EvtchnTeardown(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     );
 
 VOID
@@ -72,7 +72,7 @@ EvtchnReset(
 
 extern BOOLEAN
 EvtchnInterrupt(
-    IN  PXENBUS_EVTCHN_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_CONTEXT Context
     );
 
 #endif  // _XENBUS_EVTCHN_H
diff --git a/src/xenbus/evtchn_2l.c b/src/xenbus/evtchn_2l.c
index 6585f73..b2abead 100644
--- a/src/xenbus/evtchn_2l.c
+++ b/src/xenbus/evtchn_2l.c
@@ -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,7 +52,7 @@ typedef struct _XENBUS_EVTCHN_TWO_LEVEL_CONTEXT {
 
 static FORCEINLINE PVOID
 __EvtchnTwoLevelAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, 
XENBUS_EVTCHN_TWO_LEVEL_TAG);
@@ -60,7 +60,7 @@ __EvtchnTwoLevelAllocate(
 
 static FORCEINLINE VOID
 __EvtchnTwoLevelFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_EVTCHN_TWO_LEVEL_TAG);
@@ -68,8 +68,8 @@ __EvtchnTwoLevelFree(
 
 static BOOLEAN
 EvtchnTwoLevelIsProcessorEnabled(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Index
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Index
     )
 {
     unsigned int                    vcpu_id;
@@ -85,10 +85,10 @@ EvtchnTwoLevelIsProcessorEnabled(
 
 static BOOLEAN
 EvtchnTwoLevelPoll(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    IN  ULONG                           Index,
-    IN  XENBUS_EVTCHN_ABI_EVENT         Event,
-    IN  PVOID                           Argument
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _In_ ULONG                          Index,
+    _In_ XENBUS_EVTCHN_ABI_EVENT        Event,
+    _In_ PVOID                          Argument
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
@@ -102,8 +102,8 @@ EvtchnTwoLevelPoll(
 
 static NTSTATUS
 EvtchnTwoLevelPortEnable(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    IN  ULONG                           Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _In_ ULONG                          Port
     )
 {
     UNREFERENCED_PARAMETER(_Context);
@@ -114,8 +114,8 @@ EvtchnTwoLevelPortEnable(
 
 static VOID
 EvtchnTwoLevelPortDisable(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    IN  ULONG                           Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _In_ ULONG                          Port
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
@@ -127,8 +127,8 @@ EvtchnTwoLevelPortDisable(
 
 static VOID
 EvtchnTwoLevelPortAck(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    IN  ULONG                           Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _In_ ULONG                          Port
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
@@ -140,8 +140,8 @@ EvtchnTwoLevelPortAck(
 
 static VOID
 EvtchnTwoLevelPortMask(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    IN  ULONG                           Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _In_ ULONG                          Port
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
@@ -153,8 +153,8 @@ EvtchnTwoLevelPortMask(
 
 static BOOLEAN
 EvtchnTwoLevelPortUnmask(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    IN  ULONG                           Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _In_ ULONG                          Port
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
@@ -166,7 +166,7 @@ EvtchnTwoLevelPortUnmask(
 
 static NTSTATUS
 EvtchnTwoLevelAcquire(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
@@ -205,7 +205,7 @@ fail1:
 
 VOID
 EvtchnTwoLevelRelease(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
@@ -241,8 +241,8 @@ static XENBUS_EVTCHN_ABI EvtchnAbiTwoLevel = {
 
 NTSTATUS
 EvtchnTwoLevelInitialize(
-    IN  PXENBUS_FDO                     Fdo,
-    OUT PXENBUS_EVTCHN_ABI_CONTEXT      *_Context
+    _In_ PXENBUS_FDO                    Fdo,
+    _Out_ PXENBUS_EVTCHN_ABI_CONTEXT    *_Context
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context;
@@ -281,8 +281,8 @@ fail1:
 
 VOID
 EvtchnTwoLevelGetAbi(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    OUT PXENBUS_EVTCHN_ABI              Abi)
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _Out_ PXENBUS_EVTCHN_ABI            Abi)
 {
     *Abi = EvtchnAbiTwoLevel;
 
@@ -291,7 +291,7 @@ EvtchnTwoLevelGetAbi(
 
 VOID
 EvtchnTwoLevelTeardown(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context
     )
 {
     PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT    Context = (PVOID)_Context;
diff --git a/src/xenbus/evtchn_2l.h b/src/xenbus/evtchn_2l.h
index 9974385..41ed65c 100644
--- a/src/xenbus/evtchn_2l.h
+++ b/src/xenbus/evtchn_2l.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.
  */
 
@@ -41,19 +41,19 @@
 
 extern NTSTATUS
 EvtchnTwoLevelInitialize(
-    IN  PXENBUS_FDO                 Fdo,
-    OUT PXENBUS_EVTCHN_ABI_CONTEXT  *Context
+    _In_ PXENBUS_FDO                    Fdo,
+    _Out_ PXENBUS_EVTCHN_ABI_CONTEXT    *Context
     );
 
 extern VOID
 EvtchnTwoLevelGetAbi(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    OUT PXENBUS_EVTCHN_ABI          Abi
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _Out_ PXENBUS_EVTCHN_ABI        Abi
     );
 
 extern VOID
 EvtchnTwoLevelTeardown(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context
     );
 
 #endif  // _XENBUS_EVTCHN_H
diff --git a/src/xenbus/evtchn_abi.h b/src/xenbus/evtchn_abi.h
index 85480df..a1bc06b 100644
--- a/src/xenbus/evtchn_abi.h
+++ b/src/xenbus/evtchn_abi.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 WARRAN4TIES, 
- * 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 WARRAN4TIES,
+ * 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.
  */
 
@@ -40,62 +40,62 @@ typedef PVOID *PXENBUS_EVTCHN_ABI_CONTEXT;
 
 typedef NTSTATUS
 (*XENBUS_EVTCHN_ABI_ACQUIRE)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context
     );
 
 typedef VOID
 (*XENBUS_EVTCHN_ABI_RELEASE)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context
     );
 
 typedef BOOLEAN
 (*XENBUS_EVTCHN_ABI_IS_PROCESSOR_ENABLED)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    IN  ULONG                       Index
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _In_ ULONG                      Index
     );
 
 typedef BOOLEAN
 (*XENBUS_EVTCHN_ABI_EVENT)(
-    IN  PVOID   Argument,
-    IN  ULONG   Port
+    _In_ PVOID  Argument,
+    _In_ ULONG  Port
     );
 
 typedef BOOLEAN
 (*XENBUS_EVTCHN_ABI_POLL)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    IN  ULONG                       Index,
-    IN  XENBUS_EVTCHN_ABI_EVENT     Event,
-    IN  PVOID                       Argument
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _In_ ULONG                      Index,
+    _In_ XENBUS_EVTCHN_ABI_EVENT    Event,
+    _In_ PVOID                      Argument
     );
 
 typedef NTSTATUS
 (*XENBUS_EVTCHN_ABI_PORT_ENABLE)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _In_ ULONG                      Port
     );
 
 typedef VOID
 (*XENBUS_EVTCHN_ABI_PORT_DISABLE)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _In_ ULONG                      Port
     );
 
 typedef VOID
 (*XENBUS_EVTCHN_ABI_PORT_ACK)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _In_ ULONG                      Port
     );
 
 typedef VOID
 (*XENBUS_EVTCHN_ABI_PORT_MASK)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _In_ ULONG                      Port
     );
 
 typedef BOOLEAN
 (*XENBUS_EVTCHN_ABI_PORT_UNMASK)(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _In_ ULONG                      Port
     );
 
 typedef struct _XENBUS_EVTCHN_ABI {
diff --git a/src/xenbus/evtchn_fifo.c b/src/xenbus/evtchn_fifo.c
index a9e8591..0f4b44e 100644
--- a/src/xenbus/evtchn_fifo.c
+++ b/src/xenbus/evtchn_fifo.c
@@ -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.
  */
 
@@ -58,7 +58,7 @@ typedef struct _XENBUS_EVTCHN_FIFO_CONTEXT {
 
 static FORCEINLINE PVOID
 __EvtchnFifoAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_EVTCHN_FIFO_TAG);
@@ -66,7 +66,7 @@ __EvtchnFifoAllocate(
 
 static FORCEINLINE VOID
 __EvtchnFifoFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_EVTCHN_FIFO_TAG);
@@ -74,13 +74,13 @@ __EvtchnFifoFree(
 
 static event_word_t *
 EvtchnFifoEventWord(
-    IN  PXENBUS_EVTCHN_FIFO_CONTEXT Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_FIFO_CONTEXT    Context,
+    _In_ ULONG                          Port
     )
 {
-    ULONG                           Index;
-    PMDL                            Mdl;
-    event_word_t                    *EventWord;
+    ULONG                               Index;
+    PMDL                                Mdl;
+    event_word_t                        *EventWord;
 
     Index = Port / EVENT_WORDS_PER_PAGE;
     ASSERT3U(Index, <, Context->EventPageCount);
@@ -98,8 +98,8 @@ EvtchnFifoEventWord(
 
 static FORCEINLINE BOOLEAN
 __EvtchnFifoTestFlag(
-    IN  event_word_t    *EventWord,
-    IN  ULONG           Flag
+    _In_ event_word_t   *EventWord,
+    _In_ ULONG          Flag
     )
 {
     KeMemoryBarrier();
@@ -108,8 +108,8 @@ __EvtchnFifoTestFlag(
 
 static FORCEINLINE BOOLEAN
 __EvtchnFifoTestAndSetFlag(
-    IN  event_word_t    *EventWord,
-    IN  ULONG           Flag
+    _In_ event_word_t   *EventWord,
+    _In_ ULONG          Flag
     )
 {
     return (InterlockedBitTestAndSet((LONG *)EventWord, Flag) != 0) ? TRUE : 
FALSE;
@@ -117,8 +117,8 @@ __EvtchnFifoTestAndSetFlag(
 
 static FORCEINLINE BOOLEAN
 __EvtchnFifoTestAndClearFlag(
-    IN  event_word_t    *EventWord,
-    IN  ULONG           Flag
+    _In_ event_word_t   *EventWord,
+    _In_ ULONG          Flag
     )
 {
     return (InterlockedBitTestAndReset((LONG *)EventWord, Flag) != 0) ? TRUE : 
FALSE;
@@ -126,8 +126,8 @@ __EvtchnFifoTestAndClearFlag(
 
 static FORCEINLINE VOID
 __EvtchnFifoSetFlag(
-    IN  event_word_t    *EventWord,
-    IN  ULONG           Flag
+    _In_ event_word_t   *EventWord,
+    _In_ ULONG          Flag
     )
 {
     (VOID) InterlockedBitTestAndSet((LONG *)EventWord, Flag);
@@ -135,8 +135,8 @@ __EvtchnFifoSetFlag(
 
 static FORCEINLINE VOID
 __EvtchnFifoClearFlag(
-    IN  event_word_t    *EventWord,
-    IN  ULONG           Flag
+    _In_ event_word_t   *EventWord,
+    _In_ ULONG          Flag
     )
 {
     (VOID) InterlockedBitTestAndReset((LONG *)EventWord, Flag);
@@ -144,7 +144,7 @@ __EvtchnFifoClearFlag(
 
 static FORCEINLINE ULONG
 __EvtchnFifoUnlink(
-    IN  event_word_t    *EventWord
+    _In_ event_word_t   *EventWord
     )
 {
     LONG                Old;
@@ -162,17 +162,17 @@ __EvtchnFifoUnlink(
 
 static NTSTATUS
 EvtchnFifoExpand(
-    IN  PXENBUS_EVTCHN_FIFO_CONTEXT Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_FIFO_CONTEXT    Context,
+    _In_ ULONG                          Port
     )
 {
-    LONG                            Index;
-    ULONG                           EventPageCount;
-    PMDL                            *EventPageMdl;
-    PMDL                            Mdl;
-    ULONG                           Start;
-    ULONG                           End;
-    NTSTATUS                        status;
+    LONG                                Index;
+    ULONG                               EventPageCount;
+    PMDL                                *EventPageMdl;
+    PMDL                                Mdl;
+    ULONG                               Start;
+    ULONG                               End;
+    NTSTATUS                            status;
 
     Index = Port / EVENT_WORDS_PER_PAGE;
     ASSERT3U(Index, >=, (LONG)Context->EventPageCount);
@@ -259,10 +259,10 @@ fail1:
 
 static VOID
 EvtchnFifoContract(
-    IN  PXENBUS_EVTCHN_FIFO_CONTEXT Context
+    _In_ PXENBUS_EVTCHN_FIFO_CONTEXT    Context
     )
 {
-    LONG                            Index;
+    LONG                                Index;
 
     Index = Context->EventPageCount;
     while (--Index >= 0) {
@@ -282,14 +282,14 @@ EvtchnFifoContract(
 
 static BOOLEAN
 EvtchnFifoIsProcessorEnabled(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Index
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Index
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
     unsigned int                    vcpu_id;
     NTSTATUS                        status;
-    
+
     status = SystemProcessorVcpuId(Index, &vcpu_id);
     if (!NT_SUCCESS(status))
         return FALSE;
@@ -299,18 +299,18 @@ EvtchnFifoIsProcessorEnabled(
 
 static BOOLEAN
 EvtchnFifoPollPriority(
-    IN  PXENBUS_EVTCHN_FIFO_CONTEXT Context,
-    IN  unsigned int                vcpu_id,
-    IN  ULONG                       Priority,
-    IN  PULONG                      Ready,
-    IN  XENBUS_EVTCHN_ABI_EVENT     Event,
-    IN  PVOID                       Argument
+    _In_ PXENBUS_EVTCHN_FIFO_CONTEXT    Context,
+    _In_ unsigned int                   vcpu_id,
+    _In_ ULONG                          Priority,
+    _In_ PULONG                         Ready,
+    _In_ XENBUS_EVTCHN_ABI_EVENT        Event,
+    _In_ PVOID                          Argument
     )
 {
-    ULONG                           Head;
-    ULONG                           Port;
-    event_word_t                    *EventWord;
-    BOOLEAN                         DoneSomething;
+    ULONG                               Head;
+    ULONG                               Port;
+    event_word_t                        *EventWord;
+    BOOLEAN                             DoneSomething;
 
     Head = Context->Head[vcpu_id][Priority];
 
@@ -348,10 +348,10 @@ EvtchnFifoPollPriority(
 
 static BOOLEAN
 EvtchnFifoPoll(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Index,
-    IN  XENBUS_EVTCHN_ABI_EVENT     Event,
-    IN  PVOID                       Argument
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Index,
+    _In_ XENBUS_EVTCHN_ABI_EVENT    Event,
+    _In_ PVOID                      Argument
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
@@ -394,8 +394,8 @@ done:
 
 static NTSTATUS
 EvtchnFifoPortEnable(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Port
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
@@ -425,8 +425,8 @@ fail1:
 
 static VOID
 EvtchnFifoPortAck(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Port
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
@@ -438,8 +438,8 @@ EvtchnFifoPortAck(
 
 static VOID
 EvtchnFifoPortMask(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Port
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
@@ -451,8 +451,8 @@ EvtchnFifoPortMask(
 
 static BOOLEAN
 EvtchnFifoPortUnmask(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Port
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
@@ -474,8 +474,8 @@ EvtchnFifoPortUnmask(
 
 static VOID
 EvtchnFifoPortDisable(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context,
-    IN  ULONG                       Port
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context,
+    _In_ ULONG                      Port
     )
 {
     EvtchnFifoPortMask(_Context, Port);
@@ -483,7 +483,7 @@ EvtchnFifoPortDisable(
 
 static NTSTATUS
 EvtchnFifoAcquire(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
@@ -585,7 +585,7 @@ fail1:
 
 VOID
 EvtchnFifoRelease(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  _Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT _Context
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT     Context = (PVOID)_Context;
@@ -637,8 +637,8 @@ static XENBUS_EVTCHN_ABI EvtchnAbiFifo = {
 
 NTSTATUS
 EvtchnFifoInitialize(
-    IN  PXENBUS_FDO                     Fdo,
-    OUT PXENBUS_EVTCHN_ABI_CONTEXT      *_Context
+    _In_ PXENBUS_FDO                    Fdo,
+    _Out_ PXENBUS_EVTCHN_ABI_CONTEXT    *_Context
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT    Context;
@@ -670,8 +670,8 @@ fail1:
 
 VOID
 EvtchnFifoGetAbi(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context,
-    OUT PXENBUS_EVTCHN_ABI              Abi)
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context,
+    _Out_ PXENBUS_EVTCHN_ABI            Abi)
 {
     *Abi = EvtchnAbiFifo;
 
@@ -680,7 +680,7 @@ EvtchnFifoGetAbi(
 
 VOID
 EvtchnFifoTeardown(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT      _Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT     _Context
     )
 {
     PXENBUS_EVTCHN_FIFO_CONTEXT    Context = (PVOID)_Context;
diff --git a/src/xenbus/evtchn_fifo.h b/src/xenbus/evtchn_fifo.h
index 03d3edf..c8a8fdf 100644
--- a/src/xenbus/evtchn_fifo.h
+++ b/src/xenbus/evtchn_fifo.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.
  */
 
@@ -41,19 +41,19 @@
 
 extern NTSTATUS
 EvtchnFifoInitialize(
-    IN  PXENBUS_FDO                 Fdo,
-    OUT PXENBUS_EVTCHN_ABI_CONTEXT  *Context
+    _In_ PXENBUS_FDO                    Fdo,
+    _Out_ PXENBUS_EVTCHN_ABI_CONTEXT    *Context
     );
 
 extern VOID
 EvtchnFifoGetAbi(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context,
-    OUT PXENBUS_EVTCHN_ABI          Abi
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context,
+    _Out_ PXENBUS_EVTCHN_ABI        Abi
     );
 
 extern VOID
 EvtchnFifoTeardown(
-    IN  PXENBUS_EVTCHN_ABI_CONTEXT  Context
+    _In_ PXENBUS_EVTCHN_ABI_CONTEXT Context
     );
 
 #endif  // _XENBUS_EVTCHN_FIFO_H
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 3a4a1a2..d2a8869 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -1,32 +1,32 @@
 /* Copyright (c) Xen Project.
  * Copyright (c) Cloud Software Group, Inc.
  * All rights reserved.
- * 
- * Redistribution and use in source 1and binary forms, 
- * with or without modification, are permitted provided 
+ *
+ * Redistribution and use in source 1and 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 the23 
+ *
+ * *   Redistributions of source code must retain the above
+ *     copyright notice, this list of conditions and the23
  *     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.
  */
 
@@ -173,7 +173,7 @@ struct _XENBUS_FDO {
 
 static FORCEINLINE PVOID
 __FdoAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_FDO_TAG);
@@ -181,7 +181,7 @@ __FdoAllocate(
 
 static FORCEINLINE VOID
 __FdoFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_FDO_TAG);
@@ -189,8 +189,8 @@ __FdoFree(
 
 static FORCEINLINE VOID
 __FdoSetDevicePnpState(
-    IN  PXENBUS_FDO         Fdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENBUS_DX              Dx = Fdo->Dx;
@@ -204,8 +204,8 @@ __FdoSetDevicePnpState(
 
 static FORCEINLINE VOID
 __FdoRestoreDevicePnpState(
-    IN  PXENBUS_FDO         Fdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENBUS_DX              Dx = Fdo->Dx;
@@ -216,28 +216,28 @@ __FdoRestoreDevicePnpState(
 
 static FORCEINLINE DEVICE_PNP_STATE
 __FdoGetDevicePnpState(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_DX      Dx = Fdo->Dx;
+    PXENBUS_DX          Dx = Fdo->Dx;
 
     return Dx->DevicePnpState;
 }
 
 static FORCEINLINE DEVICE_PNP_STATE
 __FdoGetPreviousDevicePnpState(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_DX      Dx = Fdo->Dx;
+    PXENBUS_DX          Dx = Fdo->Dx;
 
     return Dx->PreviousDevicePnpState;
 }
 
 static FORCEINLINE VOID
 __FdoSetDevicePowerState(
-    IN  PXENBUS_FDO         Fdo,
-    IN  DEVICE_POWER_STATE  State
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ DEVICE_POWER_STATE State
     )
 {
     PXENBUS_DX              Dx = Fdo->Dx;
@@ -247,18 +247,18 @@ __FdoSetDevicePowerState(
 
 static FORCEINLINE DEVICE_POWER_STATE
 __FdoGetDevicePowerState(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_DX      Dx = Fdo->Dx;
+    PXENBUS_DX          Dx = Fdo->Dx;
 
     return Dx->DevicePowerState;
 }
 
 static FORCEINLINE VOID
 __FdoSetSystemPowerState(
-    IN  PXENBUS_FDO         Fdo,
-    IN  SYSTEM_POWER_STATE  State
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ SYSTEM_POWER_STATE State
     )
 {
     PXENBUS_DX              Dx = Fdo->Dx;
@@ -268,27 +268,27 @@ __FdoSetSystemPowerState(
 
 static FORCEINLINE SYSTEM_POWER_STATE
 __FdoGetSystemPowerState(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_DX      Dx = Fdo->Dx;
+    PXENBUS_DX          Dx = Fdo->Dx;
 
     return Dx->SystemPowerState;
 }
 
 static FORCEINLINE PDEVICE_OBJECT
 __FdoGetDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_DX      Dx = Fdo->Dx;
+    PXENBUS_DX          Dx = Fdo->Dx;
 
     return Dx->DeviceObject;
 }
 
 PDEVICE_OBJECT
 FdoGetDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     return __FdoGetDeviceObject(Fdo);
@@ -296,7 +296,7 @@ FdoGetDeviceObject(
 
 static FORCEINLINE PDEVICE_OBJECT
 __FdoGetPhysicalDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     return Fdo->PhysicalDeviceObject;
@@ -304,16 +304,16 @@ __FdoGetPhysicalDeviceObject(
 
 PDEVICE_OBJECT
 FdoGetPhysicalDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     return __FdoGetPhysicalDeviceObject(Fdo);
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 FdoAcquireLowerBusInterface(
-    IN  PXENBUS_FDO         Fdo
+    _In_ PXENBUS_FDO        Fdo
     )
 {
     PBUS_INTERFACE_STANDARD BusInterface;
@@ -396,7 +396,7 @@ fail1:
 
 static VOID
 FdoReleaseLowerBusInterface(
-    IN  PXENBUS_FDO         Fdo
+    _In_ PXENBUS_FDO        Fdo
     )
 {
     PBUS_INTERFACE_STANDARD BusInterface;
@@ -415,12 +415,12 @@ FdoReleaseLowerBusInterface(
 
 PDMA_ADAPTER
 FdoGetDmaAdapter(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PDEVICE_DESCRIPTION DeviceDescriptor,
-    OUT PULONG              NumberOfMapRegisters
+    _In_ PXENBUS_FDO            Fdo,
+    _In_ PDEVICE_DESCRIPTION    DeviceDescriptor,
+    _Out_ PULONG                NumberOfMapRegisters
     )
 {
-    PBUS_INTERFACE_STANDARD BusInterface;
+    PBUS_INTERFACE_STANDARD     BusInterface;
 
     BusInterface = Fdo->LowerBusInterface;
     ASSERT(BusInterface != NULL);
@@ -432,14 +432,14 @@ FdoGetDmaAdapter(
 
 BOOLEAN
 FdoTranslateBusAddress(
-    IN      PXENBUS_FDO         Fdo,
-    IN      PHYSICAL_ADDRESS    BusAddress,
-    IN      ULONG               Length,
-    IN OUT  PULONG              AddressSpace,
-    OUT     PPHYSICAL_ADDRESS   TranslatedAddress
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PHYSICAL_ADDRESS   BusAddress,
+    _In_ ULONG              Length,
+    _Inout_ PULONG          AddressSpace,
+    _Out_ PPHYSICAL_ADDRESS TranslatedAddress
     )
 {
-    PBUS_INTERFACE_STANDARD     BusInterface;
+    PBUS_INTERFACE_STANDARD BusInterface;
 
     BusInterface = Fdo->LowerBusInterface;
     ASSERT(BusInterface != NULL);
@@ -453,11 +453,11 @@ FdoTranslateBusAddress(
 
 ULONG
 FdoSetBusData(
-    IN  PXENBUS_FDO         Fdo,
-    IN  ULONG               DataType,
-    IN  PVOID               Buffer,
-    IN  ULONG               Offset,
-    IN  ULONG               Length
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ ULONG              DataType,
+    _In_ PVOID              Buffer,
+    _In_ ULONG              Offset,
+    _In_ ULONG              Length
     )
 {
     PBUS_INTERFACE_STANDARD BusInterface;
@@ -474,11 +474,11 @@ FdoSetBusData(
 
 ULONG
 FdoGetBusData(
-    IN  PXENBUS_FDO         Fdo,
-    IN  ULONG               DataType,
-    IN  PVOID               Buffer,
-    IN  ULONG               Offset,
-    IN  ULONG               Length
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ ULONG              DataType,
+    _In_ PVOID              Buffer,
+    _In_ ULONG              Offset,
+    _In_ ULONG              Length
     )
 {
     PBUS_INTERFACE_STANDARD BusInterface;
@@ -495,12 +495,12 @@ FdoGetBusData(
 
 static FORCEINLINE NTSTATUS
 __FdoSetVendorName(
-    IN  PXENBUS_FDO Fdo,
-    IN  USHORT      VendorID,
-    IN  USHORT      DeviceID
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ USHORT         VendorID,
+    _In_ USHORT         DeviceID
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     status = STATUS_NOT_SUPPORTED;
     if (VendorID != 'XS')
@@ -523,7 +523,7 @@ fail1:
 
 static FORCEINLINE PCHAR
 __FdoGetVendorName(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     return Fdo->VendorName;
@@ -531,7 +531,7 @@ __FdoGetVendorName(
 
 PCHAR
 FdoGetVendorName(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     return __FdoGetVendorName(Fdo);
@@ -539,11 +539,11 @@ FdoGetVendorName(
 
 static FORCEINLINE VOID
 __FdoSetName(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_DX      Dx = Fdo->Dx;
-    NTSTATUS        status;
+    PXENBUS_DX          Dx = Fdo->Dx;
+    NTSTATUS            status;
 
     status = RtlStringCbPrintfA(Dx->Name,
                                 MAXNAMELEN,
@@ -554,7 +554,7 @@ __FdoSetName(
 
 static FORCEINLINE PCHAR
 __FdoGetName(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     PXENBUS_DX      Dx = Fdo->Dx;
@@ -564,18 +564,18 @@ __FdoGetName(
 
 PCHAR
 FdoGetName(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     return __FdoGetName(Fdo);
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 FdoQueryId(
-    IN  PXENBUS_FDO         Fdo,
-    IN  BUS_QUERY_ID_TYPE   Type,
-    OUT PCHAR               *Id
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ BUS_QUERY_ID_TYPE  Type,
+    _Out_ PCHAR             *Id
     )
 {
     KEVENT                  Event;
@@ -653,12 +653,12 @@ fail1:
     return status;
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 FdoQueryDeviceText(
-    IN  PXENBUS_FDO         Fdo,
-    IN  DEVICE_TEXT_TYPE    Type,
-    OUT PCHAR               *Text
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ DEVICE_TEXT_TYPE   Type,
+    _Out_ PCHAR             *Text
     )
 {
     KEVENT                  Event;
@@ -738,14 +738,14 @@ fail1:
 
 static NTSTATUS
 FdoSetActive(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PCHAR           DeviceID;
-    PCHAR           InstanceID;
-    PCHAR           ActiveDeviceID;
-    PCHAR           LocationInformation;
-    NTSTATUS        status;
+    PCHAR               DeviceID;
+    PCHAR               InstanceID;
+    PCHAR               ActiveDeviceID;
+    PCHAR               LocationInformation;
+    NTSTATUS            status;
 
     status = FdoQueryId(Fdo,
                         BusQueryDeviceID,
@@ -803,7 +803,7 @@ fail1:
 
 static VOID
 FdoClearActive(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     (VOID) ConfigClearActive();
@@ -813,7 +813,7 @@ FdoClearActive(
 
 static FORCEINLINE BOOLEAN
 __FdoIsActive(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     return Fdo->Active;
@@ -822,7 +822,7 @@ __FdoIsActive(
 #define DEFINE_FDO_GET_CONTEXT(_Interface, _Type)               \
 static FORCEINLINE _Type                                        \
 __FdoGet ## _Interface ## Context(                              \
-    IN  PXENBUS_FDO Fdo                                         \
+    _In_ PXENBUS_FDO    Fdo                                     \
     )                                                           \
 {                                                               \
     return Fdo-> ## _Interface ## Context;                      \
@@ -830,7 +830,7 @@ __FdoGet ## _Interface ## Context(                          
    \
                                                                 \
 _Type                                                           \
 FdoGet ## _Interface ## Context(                                \
-    IN  PXENBUS_FDO Fdo                                         \
+    _In_ PXENBUS_FDO    Fdo                                     \
     )                                                           \
 {                                                               \
     return __FdoGet ## _Interface ## Context(Fdo);              \
@@ -848,13 +848,14 @@ DEFINE_FDO_GET_CONTEXT(Gnttab, PXENBUS_GNTTAB_CONTEXT)
 DEFINE_FDO_GET_CONTEXT(Unplug, PXENBUS_UNPLUG_CONTEXT)
 DEFINE_FDO_GET_CONTEXT(Balloon, PXENBUS_BALLOON_CONTEXT)
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoDelegateIrpCompletion;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoDelegateIrpCompletion(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PKEVENT             Event = Context;
@@ -869,8 +870,8 @@ FdoDelegateIrpCompletion(
 
 NTSTATUS
 FdoDelegateIrp(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PDEVICE_OBJECT      DeviceObject;
@@ -933,13 +934,14 @@ done:
     return status;
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoForwardIrpSynchronouslyCompletion;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoForwardIrpSynchronouslyCompletion(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PKEVENT             Event = Context;
@@ -954,12 +956,12 @@ FdoForwardIrpSynchronouslyCompletion(
 
 static NTSTATUS
 FdoForwardIrpSynchronously(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
-    KEVENT          Event;
-    NTSTATUS        status;
+    KEVENT              Event;
+    NTSTATUS            status;
 
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
@@ -990,8 +992,8 @@ FdoForwardIrpSynchronously(
 
 VOID
 FdoAddPhysicalDeviceObject(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     PDEVICE_OBJECT      DeviceObject;
@@ -1011,8 +1013,8 @@ FdoAddPhysicalDeviceObject(
 
 VOID
 FdoRemovePhysicalDeviceObject(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     PDEVICE_OBJECT      DeviceObject;
@@ -1035,7 +1037,7 @@ FdoRemovePhysicalDeviceObject(
 
 static FORCEINLINE VOID
 __FdoAcquireMutex(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     AcquireMutex(&Fdo->Mutex);
@@ -1043,7 +1045,7 @@ __FdoAcquireMutex(
 
 VOID
 FdoAcquireMutex(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     __FdoAcquireMutex(Fdo);
@@ -1051,7 +1053,7 @@ FdoAcquireMutex(
 
 static FORCEINLINE VOID
 __FdoReleaseMutex(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     ReleaseMutex(&Fdo->Mutex);
@@ -1059,7 +1061,7 @@ __FdoReleaseMutex(
 
 VOID
 FdoReleaseMutex(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     __FdoReleaseMutex(Fdo);
@@ -1073,8 +1075,8 @@ FdoReleaseMutex(
 
 static BOOLEAN
 FdoEnumerate(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PANSI_STRING    Classes
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PANSI_STRING   Classes
     )
 {
     BOOLEAN             NeedInvalidate;
@@ -1169,7 +1171,7 @@ done:
 
 static PANSI_STRING
 FdoMultiSzToUpcaseAnsi(
-    IN  PCHAR       Buffer
+    _In_ PCHAR      Buffer
     )
 {
     PANSI_STRING    Ansi;
@@ -1234,37 +1236,37 @@ fail1:
 
 static VOID
 FdoFreeAnsi(
-    IN  PANSI_STRING    Ansi
+    _In_ PANSI_STRING   Ansi
     )
 {
     ULONG               Index;
 
     for (Index = 0; Ansi[Index].Buffer != NULL; Index++)
         __FdoFree(Ansi[Index].Buffer);
-        
+
     __FdoFree(Ansi);
 }
 
 static PANSI_STRING
 FdoCombineAnsi(
-    IN  PANSI_STRING    AnsiA,
-    IN  PANSI_STRING    AnsiB
+    _In_opt_ PANSI_STRING   AnsiA,
+    _In_opt_ PANSI_STRING   AnsiB
     )
 {
-    LONG                Count;
-    ULONG               Index;
-    PANSI_STRING        Ansi;
-    NTSTATUS            status;
+    LONG                    Count;
+    ULONG                   Index;
+    PANSI_STRING            Ansi;
+    NTSTATUS                status;
 
     Count = 0;
 
     for (Index = 0;
-         AnsiA != NULL && AnsiA[Index].Buffer != NULL; 
+         AnsiA != NULL && AnsiA[Index].Buffer != NULL;
          Index++)
         Count++;
 
     for (Index = 0;
-         AnsiB != NULL && AnsiB[Index].Buffer != NULL; 
+         AnsiB != NULL && AnsiB[Index].Buffer != NULL;
          Index++)
         Count++;
 
@@ -1277,7 +1279,7 @@ FdoCombineAnsi(
     Count = 0;
 
     for (Index = 0;
-         AnsiA != NULL && AnsiA[Index].Buffer != NULL; 
+         AnsiA != NULL && AnsiA[Index].Buffer != NULL;
          Index++) {
         USHORT  Length;
 
@@ -1297,7 +1299,7 @@ FdoCombineAnsi(
     }
 
     for (Index = 0;
-         AnsiB != NULL && AnsiB[Index].Buffer != NULL; 
+         AnsiB != NULL && AnsiB[Index].Buffer != NULL;
          Index++) {
         USHORT  Length;
 
@@ -1324,7 +1326,7 @@ fail3:
 fail2:
     Error("fail2\n");
 
-    while (--Count >= 0) 
+    while (--Count >= 0)
         __FdoFree(Ansi[Count].Buffer);
 
     __FdoFree(Ansi);
@@ -1337,8 +1339,8 @@ fail1:
 
 static NTSTATUS
 FdoScan(
-    IN  PXENBUS_THREAD  Self,
-    IN  PVOID           Context
+    _In_ PXENBUS_THREAD Self,
+    _In_ PVOID          Context
     )
 {
     PXENBUS_FDO         Fdo = Context;
@@ -1425,7 +1427,7 @@ FdoScan(
         }
 
         // NULL out anything in the Classes list that not in the
-        // SupportedClasses list    
+        // SupportedClasses list
         for (Index = 0; Classes[Index].Buffer != NULL; Index++) {
             PANSI_STRING    Class = &Classes[Index];
             ULONG           Entry;
@@ -1457,7 +1459,7 @@ FdoScan(
 
         if (NeedInvalidate) {
             NeedInvalidate = FALSE;
-            IoInvalidateDeviceRelations(__FdoGetPhysicalDeviceObject(Fdo), 
+            IoInvalidateDeviceRelations(__FdoGetPhysicalDeviceObject(Fdo),
                                         BusRelations);
         }
 
@@ -1473,7 +1475,7 @@ loop:
 
 static FORCEINLINE NTSTATUS
 __FdoSuspendSetActive(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     if (!TryAcquireMutex(&Fdo->BalloonSuspendMutex))
@@ -1489,7 +1491,7 @@ fail1:
 
 static FORCEINLINE VOID
 __FdoSuspendClearActive(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     ReleaseMutex(&Fdo->BalloonSuspendMutex);
@@ -1506,8 +1508,8 @@ __FdoSuspendClearActive(
 
 static NTSTATUS
 FdoSuspend(
-    IN  PXENBUS_THREAD  Self,
-    IN  PVOID           Context
+    _In_ PXENBUS_THREAD Self,
+    _In_ PVOID          Context
     )
 {
     PXENBUS_FDO         Fdo = Context;
@@ -1557,7 +1559,7 @@ FdoSuspend(
                               &Buffer);
         if (NT_SUCCESS(status)) {
             Suspend = (strcmp(Buffer, "suspend") == 0) ? TRUE : FALSE;
-                
+
             XENBUS_STORE(Free,
                          &Fdo->StoreInterface,
                          Buffer);
@@ -1604,7 +1606,7 @@ loop:
 
 static FORCEINLINE NTSTATUS
 __FdoBalloonSetActive(
-    IN  PXENBUS_FDO         Fdo
+    _In_ PXENBUS_FDO        Fdo
     )
 {
     if (!TryAcquireMutex(&Fdo->BalloonSuspendMutex))
@@ -1628,7 +1630,7 @@ fail1:
 
 static FORCEINLINE VOID
 __FdoBalloonClearActive(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     (VOID) XENBUS_STORE(Printf,
@@ -1654,8 +1656,8 @@ __FdoBalloonClearActive(
 
 static NTSTATUS
 FdoBalloon(
-    IN  PXENBUS_THREAD  Self,
-    IN  PVOID           Context
+    _In_ PXENBUS_THREAD Self,
+    _In_ PVOID          Context
     )
 {
     PXENBUS_FDO         Fdo = Context;
@@ -1691,7 +1693,7 @@ FdoBalloon(
                                      &Timeout :
                                      NULL);
         KeClearEvent(Event);
-        
+
         Trace("awake\n");
 
         if (ThreadIsAlerted(Self))
@@ -1819,8 +1821,8 @@ loop:
 
 static VOID
 FdoDumpIoResourceDescriptor(
-    IN  PXENBUS_FDO             Fdo,
-    IN  PIO_RESOURCE_DESCRIPTOR Descriptor
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ PIO_RESOURCE_DESCRIPTOR    Descriptor
     )
 {
     Trace("%s: %s\n",
@@ -1868,8 +1870,8 @@ FdoDumpIoResourceDescriptor(
 
 static VOID
 FdoDumpIoResourceList(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PIO_RESOURCE_LIST   List
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PIO_RESOURCE_LIST  List
     )
 {
     ULONG                   Index;
@@ -1887,8 +1889,8 @@ FdoDumpIoResourceList(
 
 static NTSTATUS
 FdoFilterResourceRequirements(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  PIRP                        Irp
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ PIRP                       Irp
     )
 {
     PIO_RESOURCE_REQUIREMENTS_LIST  Old;
@@ -1991,9 +1993,9 @@ fail1:
 
 static VOID
 FdoDumpCmPartialResourceDescriptor(
-    IN  PXENBUS_FDO                     Fdo,
-    IN  BOOLEAN                         Translated,
-    IN  PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
+    _In_ PXENBUS_FDO                        Fdo,
+    _In_ BOOLEAN                            Translated,
+    _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR    Descriptor
     )
 {
     Trace("%s: %s: %s SharedDisposition=%s Flags=%04x\n",
@@ -2002,7 +2004,7 @@ FdoDumpCmPartialResourceDescriptor(
           ResourceDescriptorTypeName(Descriptor->Type),
           ResourceDescriptorShareDispositionName(Descriptor->ShareDisposition),
           Descriptor->Flags);
-    
+
     switch (Descriptor->Type) {
     case CmResourceTypeMemory:
         Trace("%s: %s: Start = %08x.%08x Length = %08x\n",
@@ -2043,9 +2045,9 @@ FdoDumpCmPartialResourceDescriptor(
 
 static VOID
 FdoDumpCmPartialResourceList(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  BOOLEAN                     Translated,
-    IN  PCM_PARTIAL_RESOURCE_LIST   List
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ BOOLEAN                    Translated,
+    _In_ PCM_PARTIAL_RESOURCE_LIST  List
     )
 {
     ULONG                           Index;
@@ -2071,9 +2073,9 @@ FdoDumpCmPartialResourceList(
 
 static VOID
 FdoDumpCmFullResourceDescriptor(
-    IN  PXENBUS_FDO                     Fdo,
-    IN  BOOLEAN                         Translated,
-    IN  PCM_FULL_RESOURCE_DESCRIPTOR    Descriptor
+    _In_ PXENBUS_FDO                    Fdo,
+    _In_ BOOLEAN                        Translated,
+    _In_ PCM_FULL_RESOURCE_DESCRIPTOR   Descriptor
     )
 {
     Trace("%s: %s: InterfaceType = %s BusNumber = %d\n",
@@ -2087,9 +2089,9 @@ FdoDumpCmFullResourceDescriptor(
 
 static VOID
 FdoDumpCmResourceList(
-    IN  PXENBUS_FDO         Fdo,
-    IN  BOOLEAN             Translated,
-    IN  PCM_RESOURCE_LIST   List
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ BOOLEAN            Translated,
+    _In_ PCM_RESOURCE_LIST  List
     )
 {
     FdoDumpCmFullResourceDescriptor(Fdo, Translated, &List->List[0]);
@@ -2100,8 +2102,8 @@ _IRQL_saves_
 _IRQL_raises_(HIGH_LEVEL)
 KIRQL
 FdoAcquireInterruptLock(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     )
 {
     UNREFERENCED_PARAMETER(Fdo);
@@ -2112,9 +2114,9 @@ FdoAcquireInterruptLock(
 _IRQL_requires_(HIGH_LEVEL)
 VOID
 FdoReleaseInterruptLock(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  PXENBUS_INTERRUPT           Interrupt,
-    IN  __drv_restoresIRQL KIRQL    Irql
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ PXENBUS_INTERRUPT          Interrupt,
+    _In_ _IRQL_restores_ KIRQL      Irql
     )
 {
     UNREFERENCED_PARAMETER(Fdo);
@@ -2124,11 +2126,11 @@ FdoReleaseInterruptLock(
 
 static
 _Function_class_(KSERVICE_ROUTINE)
-__drv_requiresIRQL(HIGH_LEVEL)
+_IRQL_requires_(HIGH_LEVEL)
 BOOLEAN
 FdoInterruptCallback(
-    IN  PKINTERRUPT             InterruptObject,
-    IN  PVOID                   Context
+    _In_ PKINTERRUPT            InterruptObject,
+    _In_ PVOID                  Context
     )
 {
     PXENBUS_INTERRUPT           Interrupt = Context;
@@ -2148,16 +2150,16 @@ FdoInterruptCallback(
 
 static NTSTATUS
 FdoConnectInterrupt(
-    IN  PXENBUS_FDO                     Fdo,
-    IN  PCM_PARTIAL_RESOURCE_DESCRIPTOR Raw,
-    IN  PCM_PARTIAL_RESOURCE_DESCRIPTOR Translated,
-    OUT PXENBUS_INTERRUPT               *Interrupt
+    _In_ PXENBUS_FDO                        Fdo,
+    _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR    Raw,
+    _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR    Translated,
+    _Out_ PXENBUS_INTERRUPT                 *Interrupt
     )
 {
-    IO_CONNECT_INTERRUPT_PARAMETERS     Connect;
-    BOOLEAN                             Found;
-    ULONG                               Number;
-    NTSTATUS                            status;
+    IO_CONNECT_INTERRUPT_PARAMETERS         Connect;
+    BOOLEAN                                 Found;
+    ULONG                                   Number;
+    NTSTATUS                                status;
 
     Trace("====>\n");
 
@@ -2246,8 +2248,8 @@ fail1:
 
 static VOID
 FdoDisconnectInterrupt(
-    IN  PXENBUS_FDO                     Fdo,
-    IN  PXENBUS_INTERRUPT               Interrupt
+    _In_ PXENBUS_FDO                    Fdo,
+    _In_ PXENBUS_INTERRUPT              Interrupt
     )
 {
     IO_DISCONNECT_INTERRUPT_PARAMETERS  Disconnect;
@@ -2286,7 +2288,7 @@ FdoDisconnectInterrupt(
 
 static NTSTATUS
 FdoCreateInterrupt(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     ULONG               Index;
@@ -2334,12 +2336,12 @@ fail1:
 
 PXENBUS_INTERRUPT
 FdoAllocateInterrupt(
-    IN  PXENBUS_FDO         Fdo,
-    IN  KINTERRUPT_MODE     InterruptMode,
-    IN  USHORT              Group,
-    IN  UCHAR               Number,
-    IN  KSERVICE_ROUTINE    Callback,
-    IN  PVOID               Argument OPTIONAL
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ KINTERRUPT_MODE    InterruptMode,
+    _In_ USHORT             Group,
+    _In_ UCHAR              Number,
+    _In_ KSERVICE_ROUTINE   Callback,
+    _In_opt_ PVOID          Argument
     )
 {
     PLIST_ENTRY             ListEntry;
@@ -2374,8 +2376,8 @@ fail1:
 
 UCHAR
 FdoGetInterruptVector(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     )
 {
     UNREFERENCED_PARAMETER(Fdo);
@@ -2385,8 +2387,8 @@ FdoGetInterruptVector(
 
 ULONG
 FdoGetInterruptLine(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     )
 {
     UNREFERENCED_PARAMETER(Fdo);
@@ -2396,8 +2398,8 @@ FdoGetInterruptLine(
 
 VOID
 FdoFreeInterrupt(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     )
 {
     KIRQL                   Irql;
@@ -2410,7 +2412,7 @@ FdoFreeInterrupt(
 
 static VOID
 FdoDestroyInterrupt(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     while (!IsListEmpty(&Fdo->InterruptList)) {
@@ -2439,17 +2441,17 @@ FdoDestroyInterrupt(
 
 static FORCEINLINE BOOLEAN
 __FdoMatchDistribution(
-    IN  PXENBUS_FDO Fdo,
-    IN  PCHAR       Buffer
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PCHAR          Buffer
     )
 {
-    PCHAR           Vendor;
-    PCHAR           Product;
-    PCHAR           Context;
-    const CHAR      *Text;
-    BOOLEAN         Match;
-    ULONG           Index;
-    NTSTATUS        status;
+    PCHAR               Vendor;
+    PCHAR               Product;
+    PCHAR               Context;
+    const CHAR          *Text;
+    BOOLEAN             Match;
+    ULONG               Index;
+    NTSTATUS            status;
 
     UNREFERENCED_PARAMETER(Fdo);
 
@@ -2499,13 +2501,13 @@ fail1:
 
 static VOID
 FdoClearDistribution(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PCHAR           Buffer;
-    PANSI_STRING    Distributions;
-    ULONG           Index;
-    NTSTATUS        status;
+    PCHAR               Buffer;
+    PANSI_STRING        Distributions;
+    ULONG               Index;
+    NTSTATUS            status;
 
     Trace("====>\n");
 
@@ -2562,14 +2564,14 @@ done:
 
 static NTSTATUS
 FdoSetDistribution(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    ULONG           Index;
-    CHAR            Distribution[MAXNAMELEN];
-    CHAR            Vendor[MAXNAMELEN];
-    const CHAR      *Product;
-    NTSTATUS        status;
+    ULONG               Index;
+    CHAR                Distribution[MAXNAMELEN];
+    CHAR                Vendor[MAXNAMELEN];
+    const CHAR          *Product;
+    NTSTATUS            status;
 
     Trace("====>\n");
 
@@ -2660,9 +2662,9 @@ CHAR FdoOutBuffer[FDO_OUT_BUFFER_SIZE];
 
 static VOID
 FdoOutputBuffer(
-    IN  PVOID   Argument,
-    IN  PCHAR   Buffer,
-    IN  ULONG   Length
+    _In_ PVOID  Argument,
+    _In_ PCHAR  Buffer,
+    _In_ ULONG  Length
     )
 {
     PXENBUS_FDO Fdo = Argument;
@@ -2694,7 +2696,7 @@ FdoOutputBuffer(
 
 static FORCEINLINE BOOLEAN
 __FdoVirqPatWatchdog(
-    IN  PXENBUS_VIRQ    Virq
+    _In_ PXENBUS_VIRQ   Virq
     )
 {
     PXENBUS_FDO         Fdo = Virq->Fdo;
@@ -2731,18 +2733,17 @@ out:
     return Pat;
 }
 
-static
-_Function_class_(KSERVICE_ROUTINE)
-_IRQL_requires_(HIGH_LEVEL)
-_IRQL_requires_same_
-BOOLEAN
+static KSERVICE_ROUTINE FdoVirqCallback;
+
+_Use_decl_annotations_
+static BOOLEAN
 FdoVirqCallback(
-    IN  PKINTERRUPT InterruptObject,
-    IN  PVOID       Argument
+    PKINTERRUPT         InterruptObject,
+    PVOID               Argument
     )
 {
-    PXENBUS_VIRQ    Virq = Argument;
-    PXENBUS_FDO     Fdo;
+    PXENBUS_VIRQ        Virq = Argument;
+    PXENBUS_FDO         Fdo;
 
     UNREFERENCED_PARAMETER(InterruptObject);
 
@@ -2771,7 +2772,7 @@ FdoVirqCallback(
 
 static FORCEINLINE VOID
 __FdoVirqDestroy(
-    IN  PXENBUS_VIRQ    Virq
+    _In_ PXENBUS_VIRQ   Virq
     )
 {
     PXENBUS_FDO         Fdo = Virq->Fdo;
@@ -2797,10 +2798,10 @@ __FdoVirqDestroy(
 
 static FORCEINLINE NTSTATUS
 __FdoVirqCreate(
-    IN  PXENBUS_FDO     Fdo,
-    IN  ULONG           Type,
-    IN  ULONG           Cpu,
-    OUT PXENBUS_VIRQ    *Virq
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ ULONG          Type,
+    _In_ ULONG          Cpu,
+    _Out_ PXENBUS_VIRQ  *Virq
     )
 {
     PROCESSOR_NUMBER    ProcNumber;
@@ -2878,7 +2879,7 @@ fail1:
 
 static VOID
 FdoVirqTeardown(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     if (Fdo->Watchdog != 0)
@@ -2904,14 +2905,14 @@ FdoVirqTeardown(
 
 static NTSTATUS
 FdoVirqInitialize(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_VIRQ    Virq;
-    ULONG           Count;
-    ULONG           Index;
-    ULONG           Timer;
-    NTSTATUS        status;
+    PXENBUS_VIRQ        Virq;
+    ULONG               Count;
+    ULONG               Index;
+    ULONG               Timer;
+    NTSTATUS            status;
 
     InitializeListHead(&Fdo->VirqList);
     InitializeHighLock(&Fdo->VirqLock);
@@ -2959,10 +2960,10 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __FdoD3ToD0(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     Trace("====>\n");
 
@@ -3071,7 +3072,7 @@ fail1:
 
 static FORCEINLINE VOID
 __FdoD0ToD3(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     Trace("====>\n");
@@ -3121,7 +3122,7 @@ __FdoD0ToD3(
 
 static VOID
 FdoSuspendCallbackLate(
-    IN  PVOID   Argument
+    _In_ PVOID  Argument
     )
 {
     PXENBUS_FDO Fdo = Argument;
@@ -3135,7 +3136,7 @@ FdoSuspendCallbackLate(
 
 static NTSTATUS
 FdoPciHoleCreate(
-    IN  PXENBUS_FDO                 Fdo
+    _In_ PXENBUS_FDO                Fdo
     )
 {
     PXENBUS_PCI_HOLE                Hole = &Fdo->PciHole;
@@ -3216,7 +3217,7 @@ fail1:
 
 static VOID
 FdoPciHoleDestroy(
-    IN  PXENBUS_FDO     Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     PXENBUS_PCI_HOLE    Hole = &Fdo->PciHole;
@@ -3245,8 +3246,8 @@ FdoPciHoleDestroy(
 
 static PMDL
 FdoPciHoleAllocate(
-    IN  PXENBUS_FDO         Fdo,
-    IN  ULONG               Count
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ ULONG              Count
     )
 {
     PXENBUS_PCI_HOLE        Hole = &Fdo->PciHole;
@@ -3309,8 +3310,8 @@ fail1:
 
 static VOID
 FdoPciHoleFree(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PMDL            Mdl
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PMDL           Mdl
     )
 {
     PXENBUS_PCI_HOLE    Hole = &Fdo->PciHole;
@@ -3350,8 +3351,8 @@ FdoPciHoleFree(
 
 static PMDL
 FdoMemoryHoleAllocate(
-    IN  PXENBUS_FDO     Fdo,
-    IN  ULONG           Count
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ ULONG          Count
     )
 {
     PMDL                Mdl;
@@ -3387,8 +3388,8 @@ fail1:
 
 static VOID
 FdoMemoryHoleFree(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PMDL            Mdl
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PMDL           Mdl
     )
 {
     ULONG               Count;
@@ -3407,8 +3408,8 @@ FdoMemoryHoleFree(
 
 PMDL
 FdoHoleAllocate(
-    IN  PXENBUS_FDO Fdo,
-    IN  ULONG       Count
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ ULONG      Count
     )
 {
     return (Fdo->UseMemoryHole != 0) ?
@@ -3418,8 +3419,8 @@ FdoHoleAllocate(
 
 VOID
 FdoHoleFree(
-    IN  PXENBUS_FDO Fdo,
-    IN  PMDL        Mdl
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PMDL       Mdl
     )
 {
     if (Fdo->UseMemoryHole != 0)
@@ -3431,11 +3432,11 @@ FdoHoleFree(
 
 static VOID
 FdoDebugCallback(
-    IN  PVOID   Argument,
-    IN  BOOLEAN Crashing
+    _In_ PVOID      Argument,
+    _In_ BOOLEAN    Crashing
     )
 {
-    PXENBUS_FDO Fdo = Argument;
+    PXENBUS_FDO     Fdo = Argument;
 
     UNREFERENCED_PARAMETER(Crashing);
 
@@ -3472,7 +3473,7 @@ FdoDebugCallback(
 // This function must not touch pageable code or data
 static NTSTATUS
 FdoD3ToD0(
-    IN  PXENBUS_FDO             Fdo
+    _In_ PXENBUS_FDO            Fdo
     )
 {
     POWER_STATE                 PowerState;
@@ -3643,12 +3644,12 @@ fail1:
 // This function must not touch pageable code or data
 static VOID
 FdoD0ToD3(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    POWER_STATE     PowerState;
-    PLIST_ENTRY     ListEntry;
-    KIRQL           Irql;
+    POWER_STATE         PowerState;
+    PLIST_ENTRY         ListEntry;
+    KIRQL               Irql;
 
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
     ASSERT3U(__FdoGetDevicePowerState(Fdo), ==, PowerDeviceD0);
@@ -3756,10 +3757,10 @@ not_active:
 // This function must not touch pageable code or data
 static VOID
 FdoS4ToS3(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    KIRQL           Irql;
+    KIRQL               Irql;
 
     Trace("====>\n");
 
@@ -3788,7 +3789,7 @@ not_active:
 // This function must not touch pageable code or data
 static VOID
 FdoS3ToS4(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     Trace("====>\n");
@@ -3815,8 +3816,8 @@ not_active:
 
 static VOID
 FdoFilterCmPartialResourceList(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  PCM_PARTIAL_RESOURCE_LIST   List
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ PCM_PARTIAL_RESOURCE_LIST  List
     )
 {
     ULONG                           Index;
@@ -3841,11 +3842,11 @@ FdoFilterCmPartialResourceList(
 #define BALLOON_WARN_TIMEOUT        10
 #define BALLOON_BUGCHECK_TIMEOUT    1200
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 FdoStartDevice(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  PIRP                        Irp
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ PIRP                       Irp
     )
 {
     PIO_STACK_LOCATION              StackLocation;
@@ -3995,7 +3996,7 @@ fail8:
 
     if (!__FdoIsActive(Fdo))
         goto fail4;
-    
+
     if (Fdo->BalloonInterface.Interface.Context != NULL) {
         ThreadAlert(Fdo->BalloonThread);
         ThreadJoin(Fdo->BalloonThread);
@@ -4056,8 +4057,8 @@ fail1:
 
 static NTSTATUS
 FdoQueryStopDevice(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP       Irp
     )
 {
     NTSTATUS        status;
@@ -4087,11 +4088,11 @@ fail1:
 
 static NTSTATUS
 FdoCancelStopDevice(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     Irp->IoStatus.Status = STATUS_SUCCESS;
 
@@ -4105,11 +4106,11 @@ FdoCancelStopDevice(
 
 static NTSTATUS
 FdoStopDevice(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     if (__FdoGetDevicePowerState(Fdo) == PowerDeviceD0)
         FdoD0ToD3(Fdo);
@@ -4159,11 +4160,11 @@ not_active:
 
 static NTSTATUS
 FdoQueryRemoveDevice(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     status = STATUS_UNSUCCESSFUL;
     if (Fdo->BalloonInterface.Interface.Context != NULL &&
@@ -4190,11 +4191,11 @@ fail1:
 
 static NTSTATUS
 FdoCancelRemoveDevice(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     __FdoRestoreDevicePnpState(Fdo, RemovePending);
 
@@ -4208,12 +4209,12 @@ FdoCancelRemoveDevice(
 
 static NTSTATUS
 FdoSurpriseRemoval(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
-    PLIST_ENTRY     ListEntry;
-    NTSTATUS        status;
+    PLIST_ENTRY         ListEntry;
+    NTSTATUS            status;
 
     __FdoSetDevicePnpState(Fdo, SurpriseRemovePending);
 
@@ -4241,11 +4242,11 @@ FdoSurpriseRemoval(
     return status;
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 FdoRemoveDevice(
-    IN  PXENBUS_FDO                     Fdo,
-    IN  PIRP                            Irp
+    _In_ PXENBUS_FDO                    Fdo,
+    _In_ PIRP                           Irp
     )
 {
     PLIST_ENTRY                         ListEntry;
@@ -4359,11 +4360,11 @@ done:
 
 #define SCAN_PAUSE  10
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 FdoQueryDeviceRelations(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -4500,8 +4501,8 @@ fail1:
 
 static NTSTATUS
 FdoQueryCapabilities(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PIRP                Irp
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PIRP               Irp
     )
 {
     PIO_STACK_LOCATION      StackLocation;
@@ -4542,8 +4543,8 @@ fail1:
 
 static NTSTATUS
 FdoDeviceUsageNotification(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  PIRP                        Irp
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ PIRP                       Irp
     )
 {
     PIO_STACK_LOCATION              StackLocation;
@@ -4574,7 +4575,7 @@ FdoDeviceUsageNotification(
     if (!NT_SUCCESS(status))
         goto fail1;
 
-    NotDisableable = FALSE;    
+    NotDisableable = FALSE;
     for (Type = 0; Type <= DeviceUsageTypeDumpFile; Type++) {
         if (Fdo->Usage[Type] != 0) {
             NotDisableable = TRUE;
@@ -4586,7 +4587,7 @@ FdoDeviceUsageNotification(
 
     if (Fdo->NotDisableable != NotDisableable) {
         Fdo->NotDisableable = NotDisableable;
-    
+
         IoInvalidateDeviceState(__FdoGetPhysicalDeviceObject(Fdo));
     }
 
@@ -4602,8 +4603,8 @@ fail1:
 
 static NTSTATUS
 FdoQueryPnpDeviceState(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  PIRP                        Irp
+    _In_ PXENBUS_FDO                Fdo,
+    _In_ PIRP                       Irp
     )
 {
     ULONG_PTR                       State;
@@ -4633,8 +4634,8 @@ done:
 
 static NTSTATUS
 FdoDispatchPnp(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -4645,8 +4646,8 @@ FdoDispatchPnp(
     MinorFunction = StackLocation->MinorFunction;
 
     Trace("====> (%02x:%s)\n",
-          MinorFunction, 
-          PnpMinorFunctionName(MinorFunction)); 
+          MinorFunction,
+          PnpMinorFunctionName(MinorFunction));
 
     switch (StackLocation->MinorFunction) {
     case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
@@ -4708,19 +4709,20 @@ FdoDispatchPnp(
     }
 
     Trace("<==== (%02x:%s)(%08x)\n",
-          MinorFunction, 
+          MinorFunction,
           PnpMinorFunctionName(MinorFunction),
-          status); 
+          status);
 
     return status;
 }
 
-__drv_functionClass(IO_WORKITEM_ROUTINE)
-__drv_sameIRQL
+static IO_WORKITEM_ROUTINE FdoSetDevcePowerUpWorker;
+
+_Use_decl_annotations_
 static VOID
 FdoSetDevcePowerUpWorker(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           Context
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_opt_ PVOID      Context
     )
 {
     PXENBUS_FDO         Fdo = (PXENBUS_FDO) Context;
@@ -4737,13 +4739,14 @@ FdoSetDevcePowerUpWorker(
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoSetDevicePowerUpComplete;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoSetDevicePowerUpComplete(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PXENBUS_FDO         Fdo = (PXENBUS_FDO) Context;
@@ -4773,8 +4776,8 @@ FdoSetDevicePowerUpComplete(
 
 static NTSTATUS
 FdoSetDevicePowerUp(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     IoMarkIrpPending(Irp);
@@ -4789,12 +4792,13 @@ FdoSetDevicePowerUp(
     return STATUS_PENDING;
 }
 
-__drv_functionClass(IO_WORKITEM_ROUTINE)
-__drv_sameIRQL
+static IO_WORKITEM_ROUTINE FdoSetDevicePowerDownWorker;
+
+_Use_decl_annotations_
 static VOID
 FdoSetDevicePowerDownWorker(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           Context
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_opt_ PVOID      Context
     )
 {
     PXENBUS_FDO         Fdo = (PXENBUS_FDO)Context;
@@ -4813,8 +4817,8 @@ FdoSetDevicePowerDownWorker(
 
 static NTSTATUS
 FdoSetDevicePowerDown(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -4856,8 +4860,8 @@ done:
 
 static NTSTATUS
 FdoSetDevicePower(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -4870,7 +4874,7 @@ FdoSetDevicePower(
     PowerAction = StackLocation->Parameters.Power.ShutdownType;
 
     Trace("====> (%s:%s)\n",
-          DevicePowerStateName(DeviceState), 
+          DevicePowerStateName(DeviceState),
           PowerActionName(PowerAction));
 
     if (DeviceState == __FdoGetDevicePowerState(Fdo)) {
@@ -4886,21 +4890,22 @@ FdoSetDevicePower(
 
 done:
     Trace("<==== (%s:%s)(%08x)\n",
-          DevicePowerStateName(DeviceState), 
+          DevicePowerStateName(DeviceState),
           PowerActionName(PowerAction),
           status);
     return status;
 }
 
-__drv_functionClass(REQUEST_POWER_COMPLETE)
-__drv_sameIRQL
+static REQUEST_POWER_COMPLETE FdoRequestDevicePowerUpComplete;
+
+_Use_decl_annotations_
 static VOID
 FdoRequestDevicePowerUpComplete(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  UCHAR               MinorFunction,
-    IN  POWER_STATE         PowerState,
-    IN  PVOID               Context,
-    IN  PIO_STATUS_BLOCK    IoStatus
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ UCHAR              MinorFunction,
+    _In_ POWER_STATE        PowerState,
+    _In_opt_ PVOID          Context,
+    _In_ PIO_STATUS_BLOCK   IoStatus
     )
 {
     PIRP                    Irp = (PIRP) Context;
@@ -4913,12 +4918,13 @@ FdoRequestDevicePowerUpComplete(
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
 }
 
-__drv_functionClass(IO_WORKITEM_ROUTINE)
-__drv_sameIRQL
+static IO_WORKITEM_ROUTINE FdoSetSystemPowerUpWorker;
+
+_Use_decl_annotations_
 static VOID
 FdoSetSystemPowerUpWorker(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           Context
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_opt_ PVOID      Context
     )
 {
     PXENBUS_FDO         Fdo = (PXENBUS_FDO)Context;
@@ -4964,13 +4970,14 @@ fail1:
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoSetSystemPowerUpComplete;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoSetSystemPowerUpComplete(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PXENBUS_FDO         Fdo = (PXENBUS_FDO) Context;
@@ -5024,8 +5031,8 @@ fail1:
 
 static NTSTATUS
 FdoSetSystemPowerUp(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     IoCopyCurrentIrpStackLocationToNext(Irp);
@@ -5038,12 +5045,13 @@ FdoSetSystemPowerUp(
     return IoCallDriver(Fdo->LowerDeviceObject, Irp);
 }
 
-__drv_functionClass(IO_WORKITEM_ROUTINE)
-__drv_sameIRQL
+static IO_WORKITEM_ROUTINE FdoSetSystemPowerDownWorker;
+
+_Use_decl_annotations_
 static VOID
 FdoSetSystemPowerDownWorker(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           Context
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_opt_ PVOID      Context
     )
 {
     PXENBUS_FDO         Fdo = (PXENBUS_FDO)Context;
@@ -5067,15 +5075,16 @@ FdoSetSystemPowerDownWorker(
     IoCallDriver(Fdo->LowerDeviceObject, Irp);
 }
 
-__drv_functionClass(REQUEST_POWER_COMPLETE)
-__drv_sameIRQL
+static REQUEST_POWER_COMPLETE FdoRequestDevicePowerDownComplete;
+
+_Use_decl_annotations_
 static VOID
 FdoRequestDevicePowerDownComplete(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  UCHAR               MinorFunction,
-    IN  POWER_STATE         PowerState,
-    IN  PVOID               Context,
-    IN  PIO_STATUS_BLOCK    IoStatus
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ UCHAR              MinorFunction,
+    _In_ POWER_STATE        PowerState,
+    _In_opt_ PVOID          Context,
+    _In_ PIO_STATUS_BLOCK   IoStatus
     )
 {
     PIRP                    Irp = (PIRP) Context;
@@ -5124,8 +5133,8 @@ fail1:
 
 static NTSTATUS
 FdoSetSystemPowerDown(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5166,8 +5175,8 @@ fail1:
 
 static NTSTATUS
 FdoSetSystemPower(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5205,15 +5214,16 @@ done:
     return status;
 }
 
-__drv_functionClass(REQUEST_POWER_COMPLETE)
-__drv_sameIRQL
+static REQUEST_POWER_COMPLETE FdoRequestQuerySystemPowerUpComplete;
+
+_Use_decl_annotations_
 static VOID
 FdoRequestQuerySystemPowerUpComplete(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  UCHAR               MinorFunction,
-    IN  POWER_STATE         PowerState,
-    IN  PVOID               Context,
-    IN  PIO_STATUS_BLOCK    IoStatus
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ UCHAR              MinorFunction,
+    _In_ POWER_STATE        PowerState,
+    _In_opt_ PVOID          Context,
+    _In_ PIO_STATUS_BLOCK   IoStatus
     )
 {
     PIRP                    Irp = (PIRP) Context;
@@ -5227,13 +5237,14 @@ FdoRequestQuerySystemPowerUpComplete(
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoQuerySystemPowerUpComplete;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoQuerySystemPowerUpComplete(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PXENBUS_FDO         Fdo = (PXENBUS_FDO) Context;
@@ -5268,8 +5279,8 @@ fail1:
 
 static NTSTATUS
 FdoQuerySystemPowerUp(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     IoMarkIrpPending(Irp);
@@ -5283,15 +5294,16 @@ FdoQuerySystemPowerUp(
     return IoCallDriver(Fdo->LowerDeviceObject, Irp);
 }
 
-__drv_functionClass(REQUEST_POWER_COMPLETE)
-__drv_sameIRQL
+static REQUEST_POWER_COMPLETE FdoRequestQuerySystemPowerDownComplete;
+
+_Use_decl_annotations_
 static VOID
 FdoRequestQuerySystemPowerDownComplete(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  UCHAR               MinorFunction,
-    IN  POWER_STATE         PowerState,
-    IN  PVOID               Context,
-    IN  PIO_STATUS_BLOCK    IoStatus
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ UCHAR              MinorFunction,
+    _In_ POWER_STATE        PowerState,
+    _In_opt_ PVOID          Context,
+    _In_ PIO_STATUS_BLOCK   IoStatus
     )
 {
     PIRP                    Irp = (PIRP) Context;
@@ -5320,8 +5332,8 @@ fail1:
 
 static NTSTATUS
 FdoQuerySystemPowerDown(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5359,8 +5371,8 @@ fail1:
 
 static NTSTATUS
 FdoQuerySystemPower(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5373,7 +5385,7 @@ FdoQuerySystemPower(
     PowerAction = StackLocation->Parameters.Power.ShutdownType;
 
     Trace("====> (%s:%s)\n",
-          SystemPowerStateName(SystemState), 
+          SystemPowerStateName(SystemState),
           PowerActionName(PowerAction));
 
     if (SystemState == __FdoGetSystemPowerState(Fdo)) {
@@ -5389,7 +5401,7 @@ FdoQuerySystemPower(
 
 done:
     Trace("<==== (%s:%s)(%08x)\n",
-          SystemPowerStateName(SystemState), 
+          SystemPowerStateName(SystemState),
           PowerActionName(PowerAction),
           status);
 
@@ -5398,8 +5410,8 @@ done:
 
 static NTSTATUS
 FdoDispatchDevicePower(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5423,8 +5435,8 @@ FdoDispatchDevicePower(
 
 static NTSTATUS
 FdoDispatchSystemPower(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5452,8 +5464,8 @@ FdoDispatchSystemPower(
 
 static NTSTATUS
 FdoDispatchPower(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5486,11 +5498,11 @@ FdoDispatchPower(
 
 static NTSTATUS
 FdoDispatchDefault(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     IoSkipCurrentIrpStackLocation(Irp);
     status = IoCallDriver(Fdo->LowerDeviceObject, Irp);
@@ -5500,8 +5512,8 @@ FdoDispatchDefault(
 
 NTSTATUS
 FdoDispatch(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -5526,15 +5538,15 @@ FdoDispatch(
     return status;
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static NTSTATUS
 FdoQueryInterface(
-    IN  PXENBUS_FDO     Fdo,
-    IN  const GUID      *Guid,
-    IN  ULONG           Version,
-    OUT PINTERFACE      Interface,
-    IN  ULONG           Size,
-    IN  BOOLEAN         Optional
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ const GUID     *Guid,
+    _In_ ULONG          Version,
+    _Out_ PINTERFACE    Interface,
+    _In_ ULONG          Size,
+    _In_ BOOLEAN        Optional
     )
 {
     KEVENT              Event;
@@ -5567,7 +5579,7 @@ FdoQueryInterface(
     StackLocation->Parameters.QueryInterface.Size = (USHORT)Size;
     StackLocation->Parameters.QueryInterface.Version = (USHORT)Version;
     StackLocation->Parameters.QueryInterface.Interface = Interface;
-    
+
     Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
 
     status = IoCallDriver(Fdo->LowerDeviceObject, Irp);
@@ -5615,14 +5627,14 @@ fail1:
 
 static NTSTATUS
 FdoBalloonInitialize(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    CHAR            Key[] = "XEN:BALLOON=";
-    PANSI_STRING    Option;
-    PCHAR           Value;
-    BOOLEAN         Enabled;
-    NTSTATUS        status;
+    CHAR                Key[] = "XEN:BALLOON=";
+    PANSI_STRING        Option;
+    PCHAR               Value;
+    BOOLEAN             Enabled;
+    NTSTATUS            status;
 
     Enabled = TRUE;
 
@@ -5647,7 +5659,7 @@ done:
 
 static VOID
 FdoBalloonTeardown(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
     if (Fdo->BalloonContext == NULL)
@@ -5659,13 +5671,13 @@ FdoBalloonTeardown(
 
 static VOID
 FdoSetWatchdog(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    CHAR            Key[] = "XEN:WATCHDOG=";
-    PANSI_STRING    Option;
-    ULONG           Value;
-    NTSTATUS        status;
+    CHAR                Key[] = "XEN:WATCHDOG=";
+    PANSI_STRING        Option;
+    ULONG               Value;
+    NTSTATUS            status;
 
     status = ConfigQuerySystemStartOption(Key, &Option);
     if (!NT_SUCCESS(status))
@@ -5690,7 +5702,7 @@ FdoSetWatchdog(
 
 NTSTATUS
 FdoCreate(
-    IN  PDEVICE_OBJECT          PhysicalDeviceObject
+    _In_ PDEVICE_OBJECT         PhysicalDeviceObject
     )
 {
     PDEVICE_OBJECT              FunctionDeviceObject;
@@ -6009,11 +6021,11 @@ fail1:
 
 VOID
 FdoDestroy(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     )
 {
-    PXENBUS_DX      Dx = Fdo->Dx;
-    PDEVICE_OBJECT  FunctionDeviceObject = Dx->DeviceObject;
+    PXENBUS_DX          Dx = Fdo->Dx;
+    PDEVICE_OBJECT      FunctionDeviceObject = Dx->DeviceObject;
 
     ASSERT(IsListEmpty(&Fdo->List));
     ASSERT3U(Fdo->References, ==, 0);
diff --git a/src/xenbus/fdo.h b/src/xenbus/fdo.h
index f2ec88c..ae4b86d 100644
--- a/src/xenbus/fdo.h
+++ b/src/xenbus/fdo.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.
  */
 
@@ -42,106 +42,106 @@ typedef struct _XENBUS_INTERRUPT XENBUS_INTERRUPT, 
*PXENBUS_INTERRUPT;
 
 extern NTSTATUS
 FdoCreate(
-    IN  PDEVICE_OBJECT  PhysicalDeviceObject
+    _In_ PDEVICE_OBJECT PhysicalDeviceObject
     );
 
 extern VOID
 FdoDestroy(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern NTSTATUS
 FdoDelegateIrp(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     );
 
 extern VOID
 FdoAddPhysicalDeviceObject(
-    IN  PXENBUS_FDO Fdo,
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern VOID
 FdoRemovePhysicalDeviceObject(
-    IN  PXENBUS_FDO Fdo,
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern VOID
 FdoAcquireMutex(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern VOID
 FdoReleaseMutex(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern PDEVICE_OBJECT
 FdoGetDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern PDEVICE_OBJECT
 FdoGetPhysicalDeviceObject(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern PDMA_ADAPTER
 FdoGetDmaAdapter(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PDEVICE_DESCRIPTION DeviceDescriptor,
-    OUT PULONG              NumberOfMapRegisters
+    _In_ PXENBUS_FDO            Fdo,
+    _In_ PDEVICE_DESCRIPTION    DeviceDescriptor,
+    _Out_ PULONG                NumberOfMapRegisters
     );
 
 extern BOOLEAN
 FdoTranslateBusAddress(
-    IN      PXENBUS_FDO         Fdo,
-    IN      PHYSICAL_ADDRESS    BusAddress,
-    IN      ULONG               Length,
-    IN OUT  PULONG              AddressSpace,
-    OUT     PPHYSICAL_ADDRESS   TranslatedAddress
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PHYSICAL_ADDRESS   BusAddress,
+    _In_ ULONG              Length,
+    _Inout_ PULONG          AddressSpace,
+    _Out_ PPHYSICAL_ADDRESS TranslatedAddress
     );
 
 extern ULONG
 FdoSetBusData(
-    IN  PXENBUS_FDO     Fdo,
-    IN  ULONG           DataType,
-    IN  PVOID           Buffer,
-    IN  ULONG           Offset,
-    IN  ULONG           Length
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ ULONG          DataType,
+    _In_ PVOID          Buffer,
+    _In_ ULONG          Offset,
+    _In_ ULONG          Length
     );
 
 extern ULONG
 FdoGetBusData(
-    IN  PXENBUS_FDO     Fdo,
-    IN  ULONG           DataType,
-    IN  PVOID           Buffer,
-    IN  ULONG           Offset,
-    IN  ULONG           Length
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ ULONG          DataType,
+    _In_ PVOID          Buffer,
+    _In_ ULONG          Offset,
+    _In_ ULONG          Length
     );
 
 extern PCHAR
 FdoGetVendorName(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern PCHAR
 FdoGetName(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern PMDL
 FdoHoleAllocate(
-    IN  PXENBUS_FDO Fdo,
-    IN  ULONG       Count
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ ULONG          Count
     );
 
 extern VOID
 FdoHoleFree(
-    IN  PXENBUS_FDO Fdo,
-    IN  PMDL        Mdl
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PMDL           Mdl
     );
 
 // Disable erroneous SAL warnings around use of interrupt locks
@@ -154,121 +154,121 @@ _IRQL_saves_
 _IRQL_raises_(HIGH_LEVEL)
 KIRQL
 FdoAcquireInterruptLock(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     );
 
 extern
 _IRQL_requires_(HIGH_LEVEL)
 VOID
 FdoReleaseInterruptLock(
-    IN  PXENBUS_FDO                 Fdo,
-    IN  PXENBUS_INTERRUPT           Interrupt,
-    IN  __drv_restoresIRQL KIRQL    Irql
+    _In_ PXENBUS_FDO            Fdo,
+    _In_ PXENBUS_INTERRUPT      Interrupt,
+    _In_ _IRQL_restores_ KIRQL  Irql
     );
 
 extern PXENBUS_INTERRUPT
 FdoAllocateInterrupt(
-    IN  PXENBUS_FDO         Fdo,
-    IN  KINTERRUPT_MODE     InterruptMode,
-    IN  USHORT              Group,
-    IN  UCHAR               Number,
-    IN  KSERVICE_ROUTINE    Callback,
-    IN  PVOID               Argument OPTIONAL
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ KINTERRUPT_MODE    InterruptMode,
+    _In_ USHORT             Group,
+    _In_ UCHAR              Number,
+    _In_ KSERVICE_ROUTINE   Callback,
+    _In_opt_ PVOID          Argument
     );
 
 extern UCHAR
 FdoGetInterruptVector(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     );
 
 extern ULONG
 FdoGetInterruptLine(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     );
 
 extern VOID
 FdoFreeInterrupt(
-    IN  PXENBUS_FDO         Fdo,
-    IN  PXENBUS_INTERRUPT   Interrupt
+    _In_ PXENBUS_FDO        Fdo,
+    _In_ PXENBUS_INTERRUPT  Interrupt
     );
 
 #include "suspend.h"
 
 extern PXENBUS_SUSPEND_CONTEXT
 FdoGetSuspendContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "shared_info.h"
 
 extern PXENBUS_SHARED_INFO_CONTEXT
 FdoGetSharedInfoContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "evtchn.h"
 
 extern PXENBUS_EVTCHN_CONTEXT
 FdoGetEvtchnContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "debug.h"
 
 extern PXENBUS_DEBUG_CONTEXT
 FdoGetDebugContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "store.h"
 
 extern PXENBUS_STORE_CONTEXT
 FdoGetStoreContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "range_set.h"
 
 extern PXENBUS_RANGE_SET_CONTEXT
 FdoGetRangeSetContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "cache.h"
 
 extern PXENBUS_CACHE_CONTEXT
 FdoGetCacheContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "gnttab.h"
 
 extern PXENBUS_GNTTAB_CONTEXT
 FdoGetGnttabContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "unplug.h"
 
 extern PXENBUS_UNPLUG_CONTEXT
 FdoGetUnplugContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 #include "console.h"
 
 extern PXENBUS_CONSOLE_CONTEXT
 FdoGetConsoleContext(
-    IN  PXENBUS_FDO Fdo
+    _In_ PXENBUS_FDO    Fdo
     );
 
 extern NTSTATUS
 FdoDispatch(
-    IN  PXENBUS_FDO Fdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PIRP           Irp
     );
 
 #endif  // _XENBUS_FDO_H
diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c
index 57c36df..550b8e0 100644
--- a/src/xenbus/gnttab.c
+++ b/src/xenbus/gnttab.c
@@ -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.
  */
 
@@ -101,7 +101,7 @@ struct _XENBUS_GNTTAB_CONTEXT {
 
 static FORCEINLINE PVOID
 __GnttabAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_GNTTAB_TAG);
@@ -109,7 +109,7 @@ __GnttabAllocate(
 
 static FORCEINLINE VOID
 __GnttabFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_GNTTAB_TAG);
@@ -117,7 +117,7 @@ __GnttabFree(
 
 static NTSTATUS
 GnttabExpand(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     )
 {
     ULONG                       Index;
@@ -200,7 +200,7 @@ fail1:
 
 static VOID
 GnttabMap(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     )
 {
     LONG                        Index;
@@ -228,7 +228,7 @@ GnttabMap(
 
 static VOID
 GnttabUnmap(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     )
 {
     LONG                        Index;
@@ -249,7 +249,7 @@ GnttabUnmap(
 
 static VOID
 GnttabContract(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     )
 {
     LONG                        Index;
@@ -290,8 +290,8 @@ GnttabContract(
 
 static NTSTATUS
 GnttabEntryCtor(
-    IN  PVOID               Argument,
-    IN  PVOID               Object
+    _In_ PVOID              Argument,
+    _In_ PVOID              Object
     )
 {
     PXENBUS_GNTTAB_CACHE    Cache = Argument;
@@ -327,8 +327,8 @@ fail1:
 
 static VOID
 GnttabEntryDtor(
-    IN  PVOID               Argument,
-    IN  PVOID               Object
+    _In_ PVOID              Argument,
+    _In_ PVOID              Object
     )
 {
     PXENBUS_GNTTAB_CACHE    Cache = Argument;
@@ -346,7 +346,7 @@ GnttabEntryDtor(
 
 static VOID
 GnttabAcquireLock(
-    IN  PVOID               Argument
+    _In_ PVOID              Argument
     )
 {
     PXENBUS_GNTTAB_CACHE    Cache = Argument;
@@ -356,7 +356,7 @@ GnttabAcquireLock(
 
 static VOID
 GnttabReleaseLock(
-    IN  PVOID               Argument
+    _In_ PVOID              Argument
     )
 {
     PXENBUS_GNTTAB_CACHE    Cache = Argument;
@@ -366,14 +366,14 @@ GnttabReleaseLock(
 
 static NTSTATUS
 GnttabCreateCache(
-    IN  PINTERFACE              Interface,
-    IN  const CHAR              *Name,
-    IN  ULONG                   Reservation,
-    IN  ULONG                   Cap,
-    IN  VOID                    (*AcquireLock)(PVOID),
-    IN  VOID                    (*ReleaseLock)(PVOID),
-    IN  PVOID                   Argument,
-    OUT PXENBUS_GNTTAB_CACHE    *Cache
+    _In_ PINTERFACE             Interface,
+    _In_ const CHAR             *Name,
+    _In_ ULONG                  Reservation,
+    _In_ ULONG                  Cap,
+    _In_ VOID                   (*AcquireLock)(PVOID),
+    _In_ VOID                   (*ReleaseLock)(PVOID),
+    _In_ PVOID                  Argument,
+    _Out_ PXENBUS_GNTTAB_CACHE  *Cache
     )
 {
     PXENBUS_GNTTAB_CONTEXT      Context = Interface->Context;
@@ -428,7 +428,7 @@ fail3:
     (*Cache)->AcquireLock = NULL;
 
     RtlZeroMemory((*Cache)->Name, sizeof ((*Cache)->Name));
-    
+
 fail2:
     Error("fail2\n");
 
@@ -445,13 +445,13 @@ fail1:
 
 static NTSTATUS
 GnttabCreateCacheVersion1(
-    IN  PINTERFACE              Interface,
-    IN  const CHAR              *Name,
-    IN  ULONG                   Reservation,
-    IN  VOID                    (*AcquireLock)(PVOID),
-    IN  VOID                    (*ReleaseLock)(PVOID),
-    IN  PVOID                   Argument,
-    OUT PXENBUS_GNTTAB_CACHE    *Cache
+    _In_ PINTERFACE             Interface,
+    _In_ const CHAR             *Name,
+    _In_ ULONG                  Reservation,
+    _In_ VOID                   (*AcquireLock)(PVOID),
+    _In_ VOID                   (*ReleaseLock)(PVOID),
+    _In_ PVOID                  Argument,
+    _Out_ PXENBUS_GNTTAB_CACHE  *Cache
     )
 {
     return GnttabCreateCache(Interface,
@@ -466,8 +466,8 @@ GnttabCreateCacheVersion1(
 
 static VOID
 GnttabDestroyCache(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_GNTTAB_CACHE    Cache
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_GNTTAB_CACHE   Cache
     )
 {
     PXENBUS_GNTTAB_CONTEXT      Context = Interface->Context;
@@ -489,7 +489,7 @@ GnttabDestroyCache(
     Cache->AcquireLock = NULL;
 
     RtlZeroMemory(Cache->Name, sizeof (Cache->Name));
-    
+
     Cache->Context = NULL;
 
     ASSERT(IsZeroMemory(Cache, sizeof (XENBUS_GNTTAB_CACHE)));
@@ -497,14 +497,14 @@ GnttabDestroyCache(
 }
 
 static NTSTATUS
-GnttabPermitForeignAccess( 
-    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
+GnttabPermitForeignAccess(
+    _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
     )
 {
     PXENBUS_GNTTAB_CONTEXT      Context = Interface->Context;
@@ -549,10 +549,10 @@ fail1:
 
 static NTSTATUS
 GnttabRevokeForeignAccess(
-    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
     )
 {
     PXENBUS_GNTTAB_CONTEXT      Context = Interface->Context;
@@ -610,8 +610,8 @@ fail1:
 
 static ULONG
 GnttabGetReference(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_GNTTAB_ENTRY    Entry
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_GNTTAB_ENTRY   Entry
     )
 {
     UNREFERENCED_PARAMETER(Interface);
@@ -623,10 +623,10 @@ GnttabGetReference(
 
 static NTSTATUS
 GnttabQueryReference(
-    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
     )
 {
     PXENBUS_GNTTAB_CONTEXT  Context = Interface->Context;
@@ -657,12 +657,12 @@ fail1:
 
 static NTSTATUS
 GnttabMapForeignPages(
-    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
     )
 {
     PXENBUS_GNTTAB_CONTEXT      Context = Interface->Context;
@@ -740,8 +740,8 @@ fail1:
 
 static NTSTATUS
 GnttabUnmapForeignPages(
-    IN  PINTERFACE              Interface,
-    IN  PHYSICAL_ADDRESS        Address
+    _In_ PINTERFACE             Interface,
+    _In_ PHYSICAL_ADDRESS       Address
     )
 {
     PXENBUS_GNTTAB_CONTEXT      Context = Interface->Context;
@@ -793,18 +793,18 @@ fail1:
 
 static VOID
 GnttabSuspendCallbackEarly(
-    IN  PVOID               Argument
+    _In_ PVOID              Argument
     )
 {
     PXENBUS_GNTTAB_CONTEXT  Context = Argument;
 
     GnttabMap(Context);
 }
-                     
+
 static VOID
 GnttabDebugCallback(
-    IN  PVOID               Argument,
-    IN  BOOLEAN             Crashing
+    _In_ PVOID              Argument,
+    _In_ BOOLEAN            Crashing
     )
 {
     PXENBUS_GNTTAB_CONTEXT  Context = Argument;
@@ -817,7 +817,7 @@ GnttabDebugCallback(
         PHYSICAL_ADDRESS        Address;
 
         Address.QuadPart = MmGetMdlPfnArray(Frame->Mdl)[0] << PAGE_SHIFT;
-    
+
         XENBUS_DEBUG(Printf,
                     &Context->DebugInterface,
                      "[%u] Address = %08x.%08x\n",
@@ -825,10 +825,10 @@ GnttabDebugCallback(
                      Address.LowPart);
     }
 }
-                     
+
 NTSTATUS
 GnttabAcquire(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_GNTTAB_CONTEXT  Context = Interface->Context;
@@ -872,7 +872,7 @@ GnttabAcquire(
     status = XENBUS_CACHE(Acquire, &Context->CacheInterface);
     if (!NT_SUCCESS(status))
         goto fail5;
-    
+
     status = XENBUS_SUSPEND(Acquire, &Context->SuspendInterface);
     if (!NT_SUCCESS(status))
         goto fail6;
@@ -983,7 +983,7 @@ fail1:
 
 VOID
 GnttabRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_GNTTAB_CONTEXT  Context = Interface->Context;
@@ -1081,11 +1081,11 @@ static struct _XENBUS_GNTTAB_INTERFACE_V4   
GnttabInterfaceVersion4 = {
 
 NTSTATUS
 GnttabInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_GNTTAB_CONTEXT  *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_GNTTAB_CONTEXT    *Context
     )
 {
-    NTSTATUS                    status;
+    NTSTATUS                        status;
 
     Trace("====>\n");
 
@@ -1147,13 +1147,13 @@ fail1:
 
 NTSTATUS
 GnttabGetInterface(
-    IN      PXENBUS_GNTTAB_CONTEXT  Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_GNTTAB_CONTEXT Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     )
 {
-    NTSTATUS                        status;
+    NTSTATUS                    status;
 
     ASSERT(Context != NULL);
 
@@ -1215,11 +1215,11 @@ GnttabGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 GnttabGetReferences(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     )
 {
     return Context->References;
@@ -1227,7 +1227,7 @@ GnttabGetReferences(
 
 VOID
 GnttabTeardown(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/gnttab.h b/src/xenbus/gnttab.h
index df74e39..ecd41f7 100644
--- a/src/xenbus/gnttab.h
+++ b/src/xenbus/gnttab.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_GNTTAB_CONTEXT  
XENBUS_GNTTAB_CONTEXT, *PXENBUS_GNTTAB_CO
 
 extern NTSTATUS
 GnttabInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_GNTTAB_CONTEXT  *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_GNTTAB_CONTEXT    *Context
     );
 
 extern NTSTATUS
 GnttabGetInterface(
-    IN      PXENBUS_GNTTAB_CONTEXT  Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_GNTTAB_CONTEXT Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     );
 
 extern ULONG
 GnttabGetReferences(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     );
 
 extern VOID
 GnttabTeardown(
-    IN  PXENBUS_GNTTAB_CONTEXT  Context
+    _In_ PXENBUS_GNTTAB_CONTEXT Context
     );
 
 #endif  // _XENBUS_GNTTAB_H
diff --git a/src/xenbus/hash_table.c b/src/xenbus/hash_table.c
index 66d5ddd..061db08 100644
--- a/src/xenbus/hash_table.c
+++ b/src/xenbus/hash_table.c
@@ -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.
  */
 
@@ -63,7 +63,7 @@ struct _XENBUS_HASH_TABLE {
 
 static FORCEINLINE PVOID
 __HashTableAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_HASH_TABLE_TAG);
@@ -71,7 +71,7 @@ __HashTableAllocate(
 
 static FORCEINLINE VOID
 __HashTableFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_HASH_TABLE_TAG);
@@ -79,7 +79,7 @@ __HashTableFree(
 
 static ULONG
 HashTableHash(
-    IN  ULONG_PTR   Key
+    _In_ ULONG_PTR  Key
     )
 {
     PUCHAR          Array = (PUCHAR)&Key;
@@ -111,8 +111,8 @@ _IRQL_saves_
 _IRQL_raises_(HIGH_LEVEL)
 KIRQL
 __HashTableBucketLock(
-    IN  PXENBUS_HASH_TABLE_BUCKET   Bucket,
-    IN  BOOLEAN                     Writer
+    _In_ PXENBUS_HASH_TABLE_BUCKET  Bucket,
+    _In_ BOOLEAN                    Writer
     )
 {
     KIRQL                           Irql;
@@ -135,7 +135,7 @@ __HashTableBucketLock(
         // There must be no existing writer
         Old = Readers << 1;
 
-        if (Writer) 
+        if (Writer)
             Writers++;
         else
             Readers++;
@@ -162,12 +162,12 @@ __HashTableBucketLock(
     } while (FALSE)
 
 static
-__drv_requiresIRQL(HIGH_LEVEL)
+_IRQL_requires_(HIGH_LEVEL)
 VOID
 HashTableBucketUnlock(
-    IN  PXENBUS_HASH_TABLE_BUCKET   Bucket,
-    IN  BOOLEAN                     Writer,
-    IN  __drv_restoresIRQL KIRQL    Irql
+    _In_ PXENBUS_HASH_TABLE_BUCKET  Bucket,
+    _In_ BOOLEAN                    Writer,
+    _In_ _IRQL_restores_ KIRQL      Irql
     )
 {
     for (;;) {
@@ -203,9 +203,9 @@ HashTableBucketUnlock(
 
 NTSTATUS
 HashTableAdd(
-    IN  PXENBUS_HASH_TABLE      Table,
-    IN  ULONG_PTR               Key,
-    IN  ULONG_PTR               Value
+    _In_ PXENBUS_HASH_TABLE     Table,
+    _In_ ULONG_PTR              Key,
+    _In_ ULONG_PTR              Value
     )
 {
     PXENBUS_HASH_TABLE_NODE     Node;
@@ -223,7 +223,7 @@ HashTableAdd(
     Node->Value = Value;
 
     Bucket = &Table->Bucket[HashTableHash(Key)];
-    
+
     HashTableBucketLock(Bucket, TRUE, &Irql);
     InsertTailList(&Bucket->List, &Node->ListEntry);
     HashTableBucketUnlock(Bucket, TRUE, Irql);
@@ -238,8 +238,8 @@ fail1:
 
 NTSTATUS
 HashTableRemove(
-    IN  PXENBUS_HASH_TABLE      Table,
-    IN  ULONG_PTR               Key
+    _In_ PXENBUS_HASH_TABLE     Table,
+    _In_ ULONG_PTR              Key
     )
 {
     PXENBUS_HASH_TABLE_BUCKET   Bucket;
@@ -251,7 +251,7 @@ HashTableRemove(
 
     Bucket = &Table->Bucket[HashTableHash(Key)];
     Hidden = &Table->Hidden;
-    
+
     HashTableBucketLock(Bucket, TRUE, &Irql);
 
     for (ListEntry = Bucket->List.Flink;
@@ -289,9 +289,9 @@ fail1:
 
 NTSTATUS
 HashTableLookup(
-    IN  PXENBUS_HASH_TABLE      Table,
-    IN  ULONG_PTR               Key,
-    OUT PULONG_PTR              Value
+    _In_ PXENBUS_HASH_TABLE     Table,
+    _In_ ULONG_PTR              Key,
+    _Out_ PULONG_PTR            Value
     )
 {
     PXENBUS_HASH_TABLE_BUCKET   Bucket;
@@ -301,7 +301,7 @@ HashTableLookup(
     NTSTATUS                    status;
 
     Bucket = &Table->Bucket[HashTableHash(Key)];
-    
+
     HashTableBucketLock(Bucket, FALSE, &Irql);
 
     for (ListEntry = Bucket->List.Flink;
@@ -339,10 +339,10 @@ _IRQL_requires_(DISPATCH_LEVEL)
 _IRQL_requires_same_
 VOID
 HashTableDpc(
-    IN  PKDPC                   Dpc,
-    IN  PVOID                   Context,
-    IN  PVOID                   Argument1,
-    IN  PVOID                   Argument2
+    _In_ PKDPC                  Dpc,
+    _In_ PVOID                  Context,
+    _In_ PVOID                  Argument1,
+    _In_ PVOID                  Argument2
     )
 {
     PXENBUS_HASH_TABLE          Table = Context;
@@ -383,7 +383,7 @@ HashTableDpc(
 
 NTSTATUS
 HashTableCreate(
-    OUT PXENBUS_HASH_TABLE      *Table
+    _Out_ PXENBUS_HASH_TABLE    *Table
     )
 {
     ULONG                       Index;
@@ -418,7 +418,7 @@ fail1:
 
 VOID
 HashTableDestroy(
-    IN  PXENBUS_HASH_TABLE      Table
+    _In_ PXENBUS_HASH_TABLE     Table
     )
 {
     ULONG                       Index;
diff --git a/src/xenbus/hash_table.h b/src/xenbus/hash_table.h
index ef1abe5..033b7c1 100644
--- a/src/xenbus/hash_table.h
+++ b/src/xenbus/hash_table.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.
  */
 
@@ -35,36 +35,36 @@
 
 #include <ntddk.h>
 
-typedef struct _XENBUS_HASH_TABLE XENBUS_HASH_TABLE, *PXENBUS_HASH_TABLE; 
+typedef struct _XENBUS_HASH_TABLE XENBUS_HASH_TABLE, *PXENBUS_HASH_TABLE;
 
 extern NTSTATUS
 HashTableAdd(
-    IN  PXENBUS_HASH_TABLE  Table,
-    IN  ULONG_PTR           Key,
-    IN  ULONG_PTR           Value
+    _In_ PXENBUS_HASH_TABLE Table,
+    _In_ ULONG_PTR          Key,
+    _In_ ULONG_PTR          Value
     );
 
 extern NTSTATUS
 HashTableRemove(
-    IN  PXENBUS_HASH_TABLE  Table,
-    IN  ULONG_PTR           Key
+    _In_ PXENBUS_HASH_TABLE Table,
+    _In_ ULONG_PTR          Key
     );
 
 extern NTSTATUS
 HashTableLookup(
-    IN  PXENBUS_HASH_TABLE  Table,
-    IN  ULONG_PTR           Key,
-    OUT PULONG_PTR          Value
+    _In_ PXENBUS_HASH_TABLE Table,
+    _In_ ULONG_PTR          Key,
+    _Out_ PULONG_PTR        Value
     );
 
 extern NTSTATUS
 HashTableCreate(
-    OUT PXENBUS_HASH_TABLE  *Table
+    _Out_ PXENBUS_HASH_TABLE    *Table
     );
 
 extern VOID
 HashTableDestroy(
-    IN  PXENBUS_HASH_TABLE  Table
+    _In_ PXENBUS_HASH_TABLE Table
     );
 
 #endif  // _XENBUS_HASH_TABLE_H
diff --git a/src/xenbus/pdo.c b/src/xenbus/pdo.c
index 9163923..a504652 100644
--- a/src/xenbus/pdo.c
+++ b/src/xenbus/pdo.c
@@ -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.
  */
 
@@ -78,7 +78,7 @@ struct _XENBUS_PDO {
 
 static FORCEINLINE PVOID
 __PdoAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, PDO_TAG);
@@ -86,7 +86,7 @@ __PdoAllocate(
 
 static FORCEINLINE VOID
 __PdoFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, PDO_TAG);
@@ -94,8 +94,8 @@ __PdoFree(
 
 static FORCEINLINE VOID
 __PdoSetDevicePnpState(
-    IN  PXENBUS_PDO         Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENBUS_DX              Dx = Pdo->Dx;
@@ -109,8 +109,8 @@ __PdoSetDevicePnpState(
 
 VOID
 PdoSetDevicePnpState(
-    IN  PXENBUS_PDO         Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     __PdoSetDevicePnpState(Pdo, State);
@@ -118,8 +118,8 @@ PdoSetDevicePnpState(
 
 static FORCEINLINE VOID
 __PdoRestoreDevicePnpState(
-    IN  PXENBUS_PDO         Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENBUS_DX              Dx = Pdo->Dx;
@@ -130,7 +130,7 @@ __PdoRestoreDevicePnpState(
 
 static FORCEINLINE DEVICE_PNP_STATE
 __PdoGetDevicePnpState(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     PXENBUS_DX      Dx = Pdo->Dx;
@@ -140,7 +140,7 @@ __PdoGetDevicePnpState(
 
 DEVICE_PNP_STATE
 PdoGetDevicePnpState(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return __PdoGetDevicePnpState(Pdo);
@@ -148,8 +148,8 @@ PdoGetDevicePnpState(
 
 static FORCEINLINE VOID
 __PdoSetDevicePowerState(
-    IN  PXENBUS_PDO         Pdo,
-    IN  DEVICE_POWER_STATE  State
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ DEVICE_POWER_STATE State
     )
 {
     PXENBUS_DX              Dx = Pdo->Dx;
@@ -159,18 +159,18 @@ __PdoSetDevicePowerState(
 
 static FORCEINLINE DEVICE_POWER_STATE
 __PdoGetDevicePowerState(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    PXENBUS_DX      Dx = Pdo->Dx;
+    PXENBUS_DX          Dx = Pdo->Dx;
 
     return Dx->DevicePowerState;
 }
 
 static FORCEINLINE VOID
 __PdoSetSystemPowerState(
-    IN  PXENBUS_PDO         Pdo,
-    IN  SYSTEM_POWER_STATE  State
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ SYSTEM_POWER_STATE State
     )
 {
     PXENBUS_DX              Dx = Pdo->Dx;
@@ -180,18 +180,18 @@ __PdoSetSystemPowerState(
 
 static FORCEINLINE SYSTEM_POWER_STATE
 __PdoGetSystemPowerState(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    PXENBUS_DX      Dx = Pdo->Dx;
+    PXENBUS_DX          Dx = Pdo->Dx;
 
     return Dx->SystemPowerState;
 }
 
 static FORCEINLINE VOID
 __PdoSetMissing(
-    IN  PXENBUS_PDO Pdo,
-    IN  const CHAR  *Reason
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ const CHAR     *Reason
     )
 {
     Pdo->Reason = Reason;
@@ -200,8 +200,8 @@ __PdoSetMissing(
 
 VOID
 PdoSetMissing(
-    IN  PXENBUS_PDO Pdo,
-    IN  const CHAR  *Reason
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ const CHAR     *Reason
     )
 {
     __PdoSetMissing(Pdo, Reason);
@@ -209,7 +209,7 @@ PdoSetMissing(
 
 static FORCEINLINE BOOLEAN
 __PdoIsMissing(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return Pdo->Missing;
@@ -217,7 +217,7 @@ __PdoIsMissing(
 
 BOOLEAN
 PdoIsMissing(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return __PdoIsMissing(Pdo);
@@ -225,8 +225,8 @@ PdoIsMissing(
 
 static FORCEINLINE VOID
 __PdoSetName(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PANSI_STRING    Name
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PANSI_STRING   Name
     )
 {
     PXENBUS_DX          Dx = Pdo->Dx;
@@ -241,17 +241,17 @@ __PdoSetName(
 
 static FORCEINLINE PCHAR
 __PdoGetName(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    PXENBUS_DX      Dx = Pdo->Dx;
+    PXENBUS_DX          Dx = Pdo->Dx;
 
     return Dx->Name;
 }
 
 PCHAR
 PdoGetName(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return __PdoGetName(Pdo);
@@ -259,7 +259,7 @@ PdoGetName(
 
 static FORCEINLINE VOID
 __PdoSetRemovable(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     HANDLE              ParametersKey;
@@ -290,7 +290,7 @@ done:
 
 static FORCEINLINE BOOLEAN
 __PdoIsRemovable(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return Pdo->Removable;
@@ -298,7 +298,7 @@ __PdoIsRemovable(
 
 static FORCEINLINE VOID
 __PdoSetEjectable(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     HANDLE              ParametersKey;
@@ -329,7 +329,7 @@ done:
 
 static FORCEINLINE BOOLEAN
 __PdoIsEjectable(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return Pdo->Ejectable;
@@ -339,7 +339,7 @@ __PdoIsEjectable(
 
 static FORCEINLINE PXENBUS_FDO
 __PdoGetFdo(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return Pdo->Fdo;
@@ -347,7 +347,7 @@ __PdoGetFdo(
 
 PXENBUS_FDO
 PdoGetFdo(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return __PdoGetFdo(Pdo);
@@ -379,10 +379,10 @@ static XENBUS_PDO_REVISION PdoRevision[] = {
 
 static VOID
 PdoDumpRevisions(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    ULONG           Index;
+    ULONG               Index;
 
     UNREFERENCED_PARAMETER(Pdo);
 
@@ -475,17 +475,17 @@ PdoDumpRevisions(
 
 static FORCEINLINE PDEVICE_OBJECT
 __PdoGetDeviceObject(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    PXENBUS_DX      Dx = Pdo->Dx;
+    PXENBUS_DX          Dx = Pdo->Dx;
 
     return (Dx->DeviceObject);
 }
-    
+
 PDEVICE_OBJECT
 PdoGetDeviceObject(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return __PdoGetDeviceObject(Pdo);
@@ -493,7 +493,7 @@ PdoGetDeviceObject(
 
 static FORCEINLINE PCHAR
 __PdoGetVendorName(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     return FdoGetVendorName(__PdoGetFdo(Pdo));
@@ -501,9 +501,9 @@ __PdoGetVendorName(
 
 PDMA_ADAPTER
 PdoGetDmaAdapter(
-    IN  PXENBUS_PDO         Pdo,
-    IN  PDEVICE_DESCRIPTION DeviceDescriptor,
-    OUT PULONG              NumberOfMapRegisters
+    _In_ PXENBUS_PDO            Pdo,
+    _In_ PDEVICE_DESCRIPTION    DeviceDescriptor,
+    _Out_ PULONG                NumberOfMapRegisters
     )
 {
     Trace("<===>\n");
@@ -515,11 +515,11 @@ PdoGetDmaAdapter(
 
 BOOLEAN
 PdoTranslateBusAddress(
-    IN      PXENBUS_PDO         Pdo,
-    IN      PHYSICAL_ADDRESS    BusAddress,
-    IN      ULONG               Length,
-    IN OUT  PULONG              AddressSpace,
-    OUT     PPHYSICAL_ADDRESS   TranslatedAddress
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ PHYSICAL_ADDRESS   BusAddress,
+    _In_ ULONG              Length,
+    _Inout_ PULONG          AddressSpace,
+    _Out_ PPHYSICAL_ADDRESS TranslatedAddress
     )
 {
     Trace("<===>\n");
@@ -533,11 +533,11 @@ PdoTranslateBusAddress(
 
 ULONG
 PdoSetBusData(
-    IN  PXENBUS_PDO     Pdo,
-    IN  ULONG           DataType,
-    IN  PVOID           Buffer,
-    IN  ULONG           Offset,
-    IN  ULONG           Length
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ ULONG          DataType,
+    _In_ PVOID          Buffer,
+    _In_ ULONG          Offset,
+    _In_ ULONG          Length
     )
 {
     Trace("<===>\n");
@@ -551,11 +551,11 @@ PdoSetBusData(
 
 ULONG
 PdoGetBusData(
-    IN  PXENBUS_PDO     Pdo,
-    IN  ULONG           DataType,
-    IN  PVOID           Buffer,
-    IN  ULONG           Offset,
-    IN  ULONG           Length
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ ULONG          DataType,
+    _In_ PVOID          Buffer,
+    _In_ ULONG          Offset,
+    _In_ ULONG          Length
     )
 {
     Trace("<===>\n");
@@ -569,7 +569,7 @@ PdoGetBusData(
 
 static FORCEINLINE VOID
 __PdoD3ToD0(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     POWER_STATE         PowerState;
@@ -591,7 +591,7 @@ __PdoD3ToD0(
 
 static FORCEINLINE VOID
 __PdoD0ToD3(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     POWER_STATE         PowerState;
@@ -613,7 +613,7 @@ __PdoD0ToD3(
 
 static VOID
 PdoSuspendCallbackLate(
-    IN  PVOID   Argument
+    _In_ PVOID  Argument
     )
 {
     PXENBUS_PDO Pdo = Argument;
@@ -625,11 +625,11 @@ PdoSuspendCallbackLate(
 // This function must not touch pageable code or data
 static NTSTATUS
 PdoD3ToD0(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    KIRQL           Irql;
-    NTSTATUS        status;
+    KIRQL               Irql;
+    NTSTATUS            status;
 
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
@@ -672,10 +672,10 @@ fail1:
 // This function must not touch pageable code or data
 static VOID
 PdoD0ToD3(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    KIRQL           Irql;
+    KIRQL               Irql;
 
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
@@ -696,7 +696,7 @@ PdoD0ToD3(
 // This function must not touch pageable code or data
 static VOID
 PdoS4ToS3(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     Trace("(%s) ====>\n", __PdoGetName(Pdo));
@@ -712,7 +712,7 @@ PdoS4ToS3(
 // This function must not touch pageable code or data
 static VOID
 PdoS3ToS4(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     Trace("(%s) ====>\n", __PdoGetName(Pdo));
@@ -727,8 +727,8 @@ PdoS3ToS4(
 
 static NTSTATUS
 PdoStartDevice(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -746,11 +746,11 @@ PdoStartDevice(
 
 static NTSTATUS
 PdoQueryStopDevice(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     __PdoSetDevicePnpState(Pdo, StopPending);
     status = STATUS_SUCCESS;
@@ -763,8 +763,8 @@ PdoQueryStopDevice(
 
 static NTSTATUS
 PdoCancelStopDevice(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP       Irp
     )
 {
     NTSTATUS        status;
@@ -780,11 +780,11 @@ PdoCancelStopDevice(
 
 static NTSTATUS
 PdoStopDevice(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     PdoD0ToD3(Pdo);
 
@@ -799,11 +799,11 @@ PdoStopDevice(
 
 static NTSTATUS
 PdoQueryRemoveDevice(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     __PdoSetDevicePnpState(Pdo, RemovePending);
     status = STATUS_SUCCESS;
@@ -816,11 +816,11 @@ PdoQueryRemoveDevice(
 
 static NTSTATUS
 PdoCancelRemoveDevice(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     __PdoRestoreDevicePnpState(Pdo, RemovePending);
     status = STATUS_SUCCESS;
@@ -833,11 +833,11 @@ PdoCancelRemoveDevice(
 
 static NTSTATUS
 PdoSurpriseRemoval(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     Warning("%s\n", __PdoGetName(Pdo));
 
@@ -852,13 +852,13 @@ PdoSurpriseRemoval(
 
 static NTSTATUS
 PdoRemoveDevice(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    PXENBUS_FDO     Fdo = __PdoGetFdo(Pdo);
-    BOOLEAN         NeedInvalidate;
-    NTSTATUS        status;
+    PXENBUS_FDO         Fdo = __PdoGetFdo(Pdo);
+    BOOLEAN             NeedInvalidate;
+    NTSTATUS            status;
 
     if (__PdoGetDevicePowerState(Pdo) != PowerDeviceD0)
         goto done;
@@ -899,8 +899,8 @@ done:
 
 static NTSTATUS
 PdoQueryDeviceRelations(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -936,8 +936,8 @@ done:
 
 static FORCEINLINE NTSTATUS
 __PdoDelegateIrp(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     return FdoDelegateIrp(__PdoGetFdo(Pdo), Irp);
@@ -945,8 +945,8 @@ __PdoDelegateIrp(
 
 static NTSTATUS
 PdoDelegateIrp(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     return __PdoDelegateIrp(Pdo, Irp);
@@ -954,8 +954,8 @@ PdoDelegateIrp(
 
 static NTSTATUS
 PdoQueryBusInterface(
-    IN  PXENBUS_PDO         Pdo,
-    IN  PIRP                Irp
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ PIRP               Irp
     )
 {
     PIO_STACK_LOCATION      StackLocation;
@@ -964,7 +964,7 @@ PdoQueryBusInterface(
     PBUS_INTERFACE_STANDARD BusInterface;
     NTSTATUS                status;
 
-    status = Irp->IoStatus.Status;        
+    status = Irp->IoStatus.Status;
 
     StackLocation = IoGetCurrentIrpStackLocation(Irp);
     Size = StackLocation->Parameters.QueryInterface.Size;
@@ -974,7 +974,7 @@ PdoQueryBusInterface(
     if (Version != 1)
         goto done;
 
-    status = STATUS_BUFFER_TOO_SMALL;        
+    status = STATUS_BUFFER_TOO_SMALL;
     if (Size < sizeof (BUS_INTERFACE_STANDARD))
         goto done;
 
@@ -991,8 +991,8 @@ done:
 #define DEFINE_PDO_QUERY_INTERFACE(_Interface)                      \
 static NTSTATUS                                                     \
 PdoQuery ## _Interface ## Interface(                                \
-    IN  PXENBUS_PDO     Pdo,                                        \
-    IN  PIRP            Irp                                         \
+    _In_ PXENBUS_PDO    Pdo,                                        \
+    _In_ PIRP           Irp                                         \
     )                                                               \
 {                                                                   \
     PIO_STACK_LOCATION  StackLocation;                              \
@@ -1060,8 +1060,8 @@ static struct _INTERFACE_ENTRY PdoInterfaceTable[] = {
 
 static NTSTATUS
 PdoQueryInterface(
-    IN  PXENBUS_PDO         Pdo,
-    IN  PIRP                Irp
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ PIRP               Irp
     )
 {
     PIO_STACK_LOCATION      StackLocation;
@@ -1099,8 +1099,8 @@ done:
 
 static NTSTATUS
 PdoQueryCapabilities(
-    IN  PXENBUS_PDO         Pdo,
-    IN  PIRP                Irp
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ PIRP               Irp
     )
 {
     PIO_STACK_LOCATION      StackLocation;
@@ -1168,8 +1168,8 @@ done:
 
 static NTSTATUS
 PdoQueryResourceRequirements(
-    IN  PXENBUS_PDO                 Pdo,
-    IN  PIRP                        Irp
+    _In_ PXENBUS_PDO                Pdo,
+    _In_ PIRP                       Irp
     )
 {
     IO_RESOURCE_DESCRIPTOR          Memory;
@@ -1245,8 +1245,8 @@ fail1:
 
 static NTSTATUS
 PdoQueryDeviceText(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1326,8 +1326,8 @@ done:
 
 static NTSTATUS
 PdoReadConfig(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     UNREFERENCED_PARAMETER(Pdo);
@@ -1340,8 +1340,8 @@ PdoReadConfig(
 
 static NTSTATUS
 PdoWriteConfig(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     UNREFERENCED_PARAMETER(Pdo);
@@ -1356,8 +1356,8 @@ PdoWriteConfig(
 
 static NTSTATUS
 PdoQueryId(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1513,8 +1513,8 @@ done:
 
 static NTSTATUS
 PdoQueryBusInformation(
-    IN  PXENBUS_PDO         Pdo,
-    IN  PIRP                Irp
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ PIRP               Irp
     )
 {
     PPNP_BUS_INFORMATION    Info;
@@ -1544,11 +1544,11 @@ done:
 
 static NTSTATUS
 PdoDeviceUsageNotification(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     status = __PdoDelegateIrp(Pdo, Irp);
 
@@ -1560,8 +1560,8 @@ PdoDeviceUsageNotification(
 
 static NTSTATUS
 PdoEject(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PXENBUS_FDO     Fdo = __PdoGetFdo(Pdo);
@@ -1589,8 +1589,8 @@ PdoEject(
 
 static NTSTATUS
 PdoDispatchPnp(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1601,7 +1601,7 @@ PdoDispatchPnp(
     MinorFunction = StackLocation->MinorFunction;
 
     Trace("====> (%02x:%s)\n",
-          MinorFunction, 
+          MinorFunction,
           PnpMinorFunctionName(MinorFunction));
 
     switch (StackLocation->MinorFunction) {
@@ -1688,19 +1688,20 @@ PdoDispatchPnp(
     }
 
     Trace("<==== (%02x:%s)(%08x)\n",
-          MinorFunction, 
+          MinorFunction,
           PnpMinorFunctionName(MinorFunction),
           status);
 
     return status;
 }
 
-__drv_functionClass(IO_WORKITEM_ROUTINE)
-__drv_sameIRQL
+static IO_WORKITEM_ROUTINE PdoSetDevicePowerWorker;
+
+_Use_decl_annotations_
 static VOID
 PdoSetDevicePowerWorker(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           Context
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_opt_ PVOID      Context
     )
 {
     PXENBUS_PDO         Pdo = (PXENBUS_PDO) Context;
@@ -1751,14 +1752,14 @@ done:
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
     Trace("<==== (%s:%s)\n",
-          DevicePowerStateName(DeviceState), 
+          DevicePowerStateName(DeviceState),
           PowerActionName(PowerAction));
 }
 
 static NTSTATUS
 PdoSetDevicePower(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1785,12 +1786,13 @@ PdoSetDevicePower(
     return STATUS_PENDING;
 }
 
-__drv_functionClass(IO_WORKITEM_ROUTINE)
-__drv_sameIRQL
+static IO_WORKITEM_ROUTINE PdoSetSystemPowerWorker;
+
+_Use_decl_annotations_
 static VOID
 PdoSetSystemPowerWorker(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PVOID           Context
+    _In_ PDEVICE_OBJECT DeviceObject,
+    _In_opt_ PVOID      Context
     )
 {
     PXENBUS_PDO         Pdo = (PXENBUS_PDO) Context;
@@ -1839,14 +1841,14 @@ PdoSetSystemPowerWorker(
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
     Trace("<==== (%s:%s)\n",
-          SystemPowerStateName(SystemState), 
+          SystemPowerStateName(SystemState),
           PowerActionName(PowerAction));
 }
 
 static NTSTATUS
 PdoSetSystemPower(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1875,15 +1877,15 @@ PdoSetSystemPower(
 
 static NTSTATUS
 PdoDispatchSetPower(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
     POWER_STATE_TYPE    PowerType;
     POWER_ACTION        PowerAction;
     NTSTATUS            status;
-    
+
     StackLocation = IoGetCurrentIrpStackLocation(Irp);
     PowerType = StackLocation->Parameters.Power.Type;
     PowerAction = StackLocation->Parameters.Power.ShutdownType;
@@ -1908,8 +1910,8 @@ PdoDispatchSetPower(
 
 static NTSTATUS
 PdoDispatchPower(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1936,11 +1938,11 @@ PdoDispatchPower(
 
 static NTSTATUS
 PdoDispatchDefault(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
-    NTSTATUS        status;
+    NTSTATUS            status;
 
     UNREFERENCED_PARAMETER(Pdo);
 
@@ -1952,8 +1954,8 @@ PdoDispatchDefault(
 
 NTSTATUS
 PdoDispatch(
-    IN  PXENBUS_PDO     Pdo,
-    IN  PIRP            Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1980,7 +1982,7 @@ PdoDispatch(
 
 VOID
 PdoResume(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     UNREFERENCED_PARAMETER(Pdo);
@@ -1990,7 +1992,7 @@ PdoResume(
 
 VOID
 PdoSuspend(
-    IN  PXENBUS_PDO     Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
     UNREFERENCED_PARAMETER(Pdo);
@@ -2000,8 +2002,8 @@ PdoSuspend(
 
 NTSTATUS
 PdoCreate(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PANSI_STRING    Name
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PANSI_STRING   Name
     )
 {
     PDEVICE_OBJECT      PhysicalDeviceObject;
@@ -2112,12 +2114,12 @@ fail1:
 
 VOID
 PdoDestroy(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     )
 {
-    PXENBUS_DX      Dx = Pdo->Dx;
-    PDEVICE_OBJECT  PhysicalDeviceObject = Dx->DeviceObject;
-    PXENBUS_FDO     Fdo = __PdoGetFdo(Pdo);
+    PXENBUS_DX          Dx = Pdo->Dx;
+    PDEVICE_OBJECT      PhysicalDeviceObject = Dx->DeviceObject;
+    PXENBUS_FDO         Fdo = __PdoGetFdo(Pdo);
 
     ASSERT3U(__PdoGetDevicePnpState(Pdo), ==, Deleted);
 
diff --git a/src/xenbus/pdo.h b/src/xenbus/pdo.h
index 22bd506..1de01f8 100644
--- a/src/xenbus/pdo.h
+++ b/src/xenbus/pdo.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.
  */
 
@@ -40,100 +40,100 @@
 
 extern VOID
 PdoSetDevicePnpState(
-    IN  PXENBUS_PDO         Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ DEVICE_PNP_STATE   State
     );
 
 extern DEVICE_PNP_STATE
 PdoGetDevicePnpState(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern BOOLEAN
 PdoIsMissing(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern VOID
 PdoSetMissing(
-    IN  PXENBUS_PDO Pdo,
-    IN  const CHAR  *Reason
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ const CHAR     *Reason
     );
 
 extern PCHAR
 PdoGetName(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern PDEVICE_OBJECT
 PdoGetDeviceObject(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern PXENBUS_FDO
 PdoGetFdo(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern PDMA_ADAPTER
 PdoGetDmaAdapter(
-    IN  PXENBUS_PDO         Pdo,
-    IN  PDEVICE_DESCRIPTION DeviceDescriptor,
-    OUT PULONG              NumberOfMapRegisters
+    _In_ PXENBUS_PDO            Pdo,
+    _In_ PDEVICE_DESCRIPTION    DeviceDescriptor,
+    _Out_ PULONG                NumberOfMapRegisters
     );
 
 extern BOOLEAN
 PdoTranslateBusAddress(
-    IN      PXENBUS_PDO         Pdo,
-    IN      PHYSICAL_ADDRESS    BusAddress,
-    IN      ULONG               Length,
-    IN OUT  PULONG              AddressSpace,
-    OUT     PPHYSICAL_ADDRESS   TranslatedAddress
+    _In_ PXENBUS_PDO        Pdo,
+    _In_ PHYSICAL_ADDRESS   BusAddress,
+    _In_ ULONG              Length,
+    _Inout_ PULONG          AddressSpace,
+    _Out_ PPHYSICAL_ADDRESS TranslatedAddress
     );
 
 extern ULONG
 PdoSetBusData(
-    IN  PXENBUS_PDO Pdo,
-    IN  ULONG       DataType,
-    IN  PVOID       Buffer,
-    IN  ULONG       Offset,
-    IN  ULONG       Length
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ ULONG      DataType,
+    _In_ PVOID      Buffer,
+    _In_ ULONG      Offset,
+    _In_ ULONG      Length
     );
 
 extern ULONG
 PdoGetBusData(
-    IN  PXENBUS_PDO Pdo,
-    IN  ULONG       DataType,
-    IN  PVOID       Buffer,
-    IN  ULONG       Offset,
-    IN  ULONG       Length
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ ULONG      DataType,
+    _In_ PVOID      Buffer,
+    _In_ ULONG      Offset,
+    _In_ ULONG      Length
     );
 
 extern NTSTATUS
 PdoCreate(
-    IN  PXENBUS_FDO     Fdo,
-    IN  PANSI_STRING    Name
+    _In_ PXENBUS_FDO    Fdo,
+    _In_ PANSI_STRING   Name
     );
 
 extern VOID
 PdoResume(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern VOID
 PdoSuspend(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern VOID
 PdoDestroy(
-    IN  PXENBUS_PDO Pdo
+    _In_ PXENBUS_PDO    Pdo
     );
 
 extern NTSTATUS
 PdoDispatch(
-    IN  PXENBUS_PDO Pdo,
-    IN  PIRP        Irp
+    _In_ PXENBUS_PDO    Pdo,
+    _In_ PIRP       Irp
     );
 
 #endif  // _XENBUS_PDO_H
diff --git a/src/xenbus/range_set.c b/src/xenbus/range_set.c
index 08af0db..13df2e5 100644
--- a/src/xenbus/range_set.c
+++ b/src/xenbus/range_set.c
@@ -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.
  */
 
@@ -71,7 +71,7 @@ struct _XENBUS_RANGE_SET_CONTEXT {
 
 static FORCEINLINE PVOID
 __RangeSetAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, RANGE_SET_TAG);
@@ -79,7 +79,7 @@ __RangeSetAllocate(
 
 static FORCEINLINE VOID
 __RangeSetFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, RANGE_SET_TAG);
@@ -87,7 +87,7 @@ __RangeSetFree(
 
 static FORCEINLINE BOOLEAN
 __RangeSetIsEmpty(
-    IN  PXENBUS_RANGE_SET   RangeSet
+    _In_ PXENBUS_RANGE_SET  RangeSet
     )
 {
     return IsListEmpty(&RangeSet->List);
@@ -95,8 +95,8 @@ __RangeSetIsEmpty(
 
 static VOID
 RangeSetRemove(
-    IN  PXENBUS_RANGE_SET   RangeSet,
-    IN  BOOLEAN             After
+    _In_ PXENBUS_RANGE_SET  RangeSet,
+    _In_ BOOLEAN            After
     )
 {
     PLIST_ENTRY             Cursor;
@@ -130,7 +130,7 @@ RangeSetRemove(
 
 static VOID
 RangeSetMergeBackwards(
-    IN  PXENBUS_RANGE_SET   RangeSet
+    _In_ PXENBUS_RANGE_SET  RangeSet
     )
 {
     PLIST_ENTRY             Cursor;
@@ -156,7 +156,7 @@ RangeSetMergeBackwards(
 
 static VOID
 RangeSetMergeForwards(
-    IN  PXENBUS_RANGE_SET   RangeSet
+    _In_ PXENBUS_RANGE_SET  RangeSet
     )
 {
     PLIST_ENTRY             Cursor;
@@ -182,10 +182,10 @@ RangeSetMergeForwards(
 
 static NTSTATUS
 RangeSetPop(
-    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
     )
 {
     PLIST_ENTRY             Cursor;
@@ -252,10 +252,10 @@ fail1:
 
 static NTSTATUS
 RangeSetAdd(
-    IN  PXENBUS_RANGE_SET   RangeSet,
-    IN  LONGLONG            Start,
-    IN  LONGLONG            End,
-    IN  BOOLEAN             After
+    _In_ PXENBUS_RANGE_SET  RangeSet,
+    _In_ LONGLONG           Start,
+    _In_ LONGLONG           End,
+    _In_ BOOLEAN            After
     )
 {
 #define INSERT_AFTER(_Cursor, _New)             \
@@ -323,10 +323,10 @@ fail1:
 
 static NTSTATUS
 RangeSetGet(
-    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
     )
 {
     LONGLONG                End = Start + Count - 1;
@@ -417,14 +417,14 @@ fail2:
 fail1:
     Error("fail1 (%08x)\n", status);
 
-    return status;    
+    return status;
 }
 
 static NTSTATUS
 RangeSetAddAfter(
-    IN  PXENBUS_RANGE_SET   RangeSet,
-    IN  LONGLONG            Start,
-    IN  LONGLONG            End
+    _In_ PXENBUS_RANGE_SET  RangeSet,
+    _In_ LONGLONG           Start,
+    _In_ LONGLONG           End
     )
 {
     PLIST_ENTRY             Cursor;
@@ -450,7 +450,7 @@ RangeSetAddAfter(
     }
 
     RangeSet->Cursor = Cursor;
-    status = RangeSetAdd(RangeSet, Start, End, FALSE);    
+    status = RangeSetAdd(RangeSet, Start, End, FALSE);
     if (!NT_SUCCESS(status))
         goto fail1;
 
@@ -459,14 +459,14 @@ RangeSetAddAfter(
 fail1:
     Error("fail1 (%08x)\n", status);
 
-    return status;    
+    return status;
 }
 
 static NTSTATUS
 RangeSetAddBefore(
-    IN  PXENBUS_RANGE_SET   RangeSet,
-    IN  LONGLONG            Start,
-    IN  LONGLONG            End
+    _In_ PXENBUS_RANGE_SET  RangeSet,
+    _In_ LONGLONG           Start,
+    _In_ LONGLONG           End
     )
 {
     PLIST_ENTRY             Cursor;
@@ -492,7 +492,7 @@ RangeSetAddBefore(
     }
 
     RangeSet->Cursor = Cursor;
-    status = RangeSetAdd(RangeSet, Start, End, TRUE);    
+    status = RangeSetAdd(RangeSet, Start, End, TRUE);
     if (!NT_SUCCESS(status))
         goto fail1;
 
@@ -501,15 +501,15 @@ RangeSetAddBefore(
 fail1:
     Error("fail1 (%08x)\n", status);
 
-    return status;    
+    return status;
 }
 
 static NTSTATUS
 RangeSetPut(
-    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
     )
 {
     LONGLONG                    End = Start + Count - 1;
@@ -567,9 +567,9 @@ fail1:
 
 NTSTATUS
 RangeSetCreate(
-    IN  PINTERFACE              Interface,
-    IN  const CHAR              *Name,
-    OUT PXENBUS_RANGE_SET       *RangeSet
+    _In_ PINTERFACE             Interface,
+    _In_ const CHAR             *Name,
+    _Out_ PXENBUS_RANGE_SET     *RangeSet
     )
 {
     PXENBUS_RANGE_SET_CONTEXT   Context = Interface->Context;
@@ -619,8 +619,8 @@ fail1:
 
 VOID
 RangeSetDestroy(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_RANGE_SET       RangeSet
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_RANGE_SET      RangeSet
     )
 {
     PXENBUS_RANGE_SET_CONTEXT   Context = Interface->Context;
@@ -638,7 +638,7 @@ RangeSetDestroy(
         __RangeSetFree(RangeSet->Spare);
         RangeSet->Spare = NULL;
     }
-        
+
     ASSERT(__RangeSetIsEmpty(RangeSet));
     RtlZeroMemory(&RangeSet->List, sizeof (LIST_ENTRY));
     RtlZeroMemory(&RangeSet->Lock, sizeof (KSPIN_LOCK));
@@ -655,8 +655,8 @@ RangeSetDestroy(
 
 static VOID
 RangeSetDump(
-    IN  PXENBUS_RANGE_SET_CONTEXT   Context,
-    IN  PXENBUS_RANGE_SET           RangeSet
+    _In_ PXENBUS_RANGE_SET_CONTEXT  Context,
+    _In_ PXENBUS_RANGE_SET          RangeSet
     )
 {
     XENBUS_DEBUG(Printf,
@@ -700,8 +700,8 @@ RangeSetDump(
 
 static VOID
 RangeSetDebugCallback(
-    IN  PVOID                   Argument,
-    IN  BOOLEAN                 Crashing
+    _In_ PVOID                  Argument,
+    _In_ BOOLEAN                Crashing
     )
 {
     PXENBUS_RANGE_SET_CONTEXT   Context = Argument;
@@ -729,7 +729,7 @@ RangeSetDebugCallback(
 
 static NTSTATUS
 RangeSetAcquire(
-    IN  PINTERFACE              Interface
+    _In_ PINTERFACE             Interface
     )
 {
     PXENBUS_RANGE_SET_CONTEXT   Context = Interface->Context;
@@ -780,7 +780,7 @@ fail1:
 
 static VOID
 RangeSetRelease(
-    IN  PINTERFACE              Interface
+    _In_ PINTERFACE             Interface
     )
 {
     PXENBUS_RANGE_SET_CONTEXT   Context = Interface->Context;
@@ -819,11 +819,11 @@ static struct _XENBUS_RANGE_SET_INTERFACE_V1 
RangeSetInterfaceVersion1 = {
     RangeSetGet,
     RangeSetDestroy
 };
-                     
+
 NTSTATUS
 RangeSetInitialize(
-    IN  PXENBUS_FDO                 Fdo,
-    OUT PXENBUS_RANGE_SET_CONTEXT   *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_RANGE_SET_CONTEXT *Context
     )
 {
     NTSTATUS                        status;
@@ -860,13 +860,13 @@ fail1:
 
 NTSTATUS
 RangeSetGetInterface(
-    IN      PXENBUS_RANGE_SET_CONTEXT   Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
+    _In_ PXENBUS_RANGE_SET_CONTEXT  Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     )
 {
-    NTSTATUS                            status;
+    NTSTATUS                        status;
 
     ASSERT(Context != NULL);
 
@@ -894,11 +894,11 @@ RangeSetGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 RangeSetGetReferences(
-    IN  PXENBUS_RANGE_SET_CONTEXT   Context
+    _In_ PXENBUS_RANGE_SET_CONTEXT  Context
     )
 {
     return Context->References;
@@ -906,7 +906,7 @@ RangeSetGetReferences(
 
 VOID
 RangeSetTeardown(
-    IN  PXENBUS_RANGE_SET_CONTEXT   Context
+    _In_ PXENBUS_RANGE_SET_CONTEXT  Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/range_set.h b/src/xenbus/range_set.h
index cce7a2b..678afd7 100644
--- a/src/xenbus/range_set.h
+++ b/src/xenbus/range_set.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_RANGE_SET_CONTEXT  
XENBUS_RANGE_SET_CONTEXT, *PXENBUS_RAN
 
 extern NTSTATUS
 RangeSetInitialize(
-    IN  PXENBUS_FDO                 Fdo,
-    OUT PXENBUS_RANGE_SET_CONTEXT   *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_RANGE_SET_CONTEXT *Context
     );
 
 extern NTSTATUS
 RangeSetGetInterface(
-    IN      PXENBUS_RANGE_SET_CONTEXT   Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
+    _In_ PXENBUS_RANGE_SET_CONTEXT  Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     );
 
 extern ULONG
 RangeSetGetReferences(
-    IN  PXENBUS_RANGE_SET_CONTEXT   Context
+    _In_ PXENBUS_RANGE_SET_CONTEXT  Context
     );
 
 extern VOID
 RangeSetTeardown(
-    IN  PXENBUS_RANGE_SET_CONTEXT   Context
+    _In_ PXENBUS_RANGE_SET_CONTEXT  Context
     );
 
 #endif  // _XENBUS_RANGE_SET_H
diff --git a/src/xenbus/shared_info.c b/src/xenbus/shared_info.c
index dc456eb..84056b7 100644
--- a/src/xenbus/shared_info.c
+++ b/src/xenbus/shared_info.c
@@ -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.
  */
 
@@ -67,7 +67,7 @@ struct _XENBUS_SHARED_INFO_CONTEXT {
 
 static FORCEINLINE PVOID
 __SharedInfoAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_SHARED_INFO_TAG);
@@ -75,7 +75,7 @@ __SharedInfoAllocate(
 
 static FORCEINLINE VOID
 __SharedInfoFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_SHARED_INFO_TAG);
@@ -83,8 +83,8 @@ __SharedInfoFree(
 
 static BOOLEAN
 SharedInfoSetBit(
-    IN  ULONG_PTR volatile  *Mask,
-    IN  ULONG               Bit
+    _In_ ULONG_PTR volatile *Mask,
+    _In_ ULONG              Bit
     )
 {
     ASSERT3U(Bit, <, sizeof (ULONG_PTR) * 8);
@@ -97,8 +97,8 @@ SharedInfoSetBit(
 
 static BOOLEAN
 SharedInfoClearBit(
-    IN  ULONG_PTR volatile  *Mask,
-    IN  ULONG               Bit
+    _In_ ULONG_PTR volatile *Mask,
+    _In_ ULONG              Bit
     )
 {
     ASSERT3U(Bit, <, sizeof (ULONG_PTR) * 8);
@@ -111,8 +111,8 @@ SharedInfoClearBit(
 
 static BOOLEAN
 SharedInfoClearBitUnlocked(
-    IN  ULONG_PTR   *Mask,
-    IN  ULONG       Bit
+    _In_ ULONG_PTR  *Mask,
+    _In_ ULONG      Bit
     )
 {
     ULONG_PTR       Old;
@@ -129,8 +129,8 @@ SharedInfoClearBitUnlocked(
 
 static BOOLEAN
 SharedInfoTestBit(
-    IN  ULONG_PTR   *Mask,
-    IN  ULONG       Bit
+    _In_ ULONG_PTR  *Mask,
+    _In_ ULONG      Bit
     )
 {
     ASSERT3U(Bit, <, sizeof (ULONG_PTR) * 8);
@@ -142,11 +142,11 @@ SharedInfoTestBit(
 
 static VOID
 SharedInfoEvtchnMaskAll(
-    IN  PXENBUS_SHARED_INFO_CONTEXT Context
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
     )
 {
-    shared_info_t                   *Shared;
-    ULONG                           Port;
+    shared_info_t                       *Shared;
+    ULONG                               Port;
 
     Shared = Context->Shared;
 
@@ -163,8 +163,8 @@ SharedInfoEvtchnMaskAll(
 
 static BOOLEAN
 SharedInfoUpcallSupported(
-    IN  PINTERFACE                  Interface,
-    IN  ULONG                       Index
+    _In_ PINTERFACE                 Interface,
+    _In_ ULONG                      Index
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT     Context = Interface->Context;
@@ -177,8 +177,8 @@ SharedInfoUpcallSupported(
 
 static BOOLEAN
 SharedInfoUpcallPending(
-    IN  PINTERFACE                  Interface,
-    IN  ULONG                       Index
+    _In_ PINTERFACE                 Interface,
+    _In_ ULONG                      Index
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT     Context = Interface->Context;
@@ -202,10 +202,10 @@ SharedInfoUpcallPending(
 
 static BOOLEAN
 SharedInfoEvtchnPoll(
-    IN  PINTERFACE                  Interface,
-    IN  ULONG                       Index,
-    IN  XENBUS_SHARED_INFO_EVENT    Event,
-    IN  PVOID                       Argument OPTIONAL
+    _In_ PINTERFACE                 Interface,
+    _In_ ULONG                      Index,
+    _In_ XENBUS_SHARED_INFO_EVENT   Event,
+    _In_opt_ PVOID                  Argument
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT     Context = Interface->Context;
@@ -277,8 +277,8 @@ done:
 
 static VOID
 SharedInfoEvtchnAck(
-    IN  PINTERFACE              Interface,
-    IN  ULONG                   Port
+    _In_ PINTERFACE             Interface,
+    _In_ ULONG                  Port
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT Context = Interface->Context;
@@ -296,8 +296,8 @@ SharedInfoEvtchnAck(
 
 static VOID
 SharedInfoEvtchnMask(
-    IN  PINTERFACE              Interface,
-    IN  ULONG                   Port
+    _In_ PINTERFACE             Interface,
+    _In_ ULONG                  Port
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT Context = Interface->Context;
@@ -315,8 +315,8 @@ SharedInfoEvtchnMask(
 
 static BOOLEAN
 SharedInfoEvtchnUnmask(
-    IN  PINTERFACE              Interface,
-    IN  ULONG                   Port
+    _In_ PINTERFACE             Interface,
+    _In_ ULONG                  Port
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT Context = Interface->Context;
@@ -339,9 +339,9 @@ SharedInfoEvtchnUnmask(
 
 static VOID
 SharedInfoGetTime(
-    IN  PINTERFACE                  Interface,
-    OUT PLARGE_INTEGER              Time,
-    OUT PBOOLEAN                    Local
+    _In_ PINTERFACE                 Interface,
+    _Out_ PLARGE_INTEGER            Time,
+    _Out_opt_ PBOOLEAN              Local
     )
 {
 #define NS_PER_S 1000000000ull
@@ -444,7 +444,7 @@ SharedInfoGetTime(
 
 static LARGE_INTEGER
 SharedInfoGetTimeVersion2(
-    IN  PINTERFACE  Interface
+    _In_ PINTERFACE Interface
     )
 {
     LARGE_INTEGER   Time;
@@ -456,12 +456,12 @@ SharedInfoGetTimeVersion2(
 
 static VOID
 SharedInfoMap(
-    IN  PXENBUS_SHARED_INFO_CONTEXT Context
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
     )
 {
-    PFN_NUMBER                      Pfn;
-    PHYSICAL_ADDRESS                Address;
-    NTSTATUS                        status;
+    PFN_NUMBER                          Pfn;
+    PHYSICAL_ADDRESS                    Address;
+    NTSTATUS                            status;
 
     Pfn = MmGetMdlPfnArray(Context->Mdl)[0];
 
@@ -478,10 +478,10 @@ SharedInfoMap(
 
 static VOID
 SharedInfoUnmap(
-    IN  PXENBUS_SHARED_INFO_CONTEXT Context
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
     )
 {
-    PFN_NUMBER                      Pfn;
+    PFN_NUMBER                          Pfn;
 
     LogPrintf(LOG_LEVEL_INFO,
               "SHARED_INFO: UNMAP XENMAPSPACE_shared_info\n");
@@ -493,7 +493,7 @@ SharedInfoUnmap(
 
 static VOID
 SharedInfoSuspendCallbackEarly(
-    IN  PVOID                   Argument
+    _In_ PVOID                  Argument
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT Context = Argument;
@@ -504,8 +504,8 @@ SharedInfoSuspendCallbackEarly(
 
 static VOID
 SharedInfoDebugCallback(
-    IN  PVOID                   Argument,
-    IN  BOOLEAN                 Crashing
+    _In_ PVOID                  Argument,
+    _In_ BOOLEAN                Crashing
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT Context = Argument;
@@ -587,7 +587,7 @@ SharedInfoDebugCallback(
 
 static NTSTATUS
 SharedInfoAcquire(
-    IN  PINTERFACE                  Interface
+    _In_ PINTERFACE                 Interface
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT     Context = Interface->Context;
@@ -748,7 +748,7 @@ fail1:
 
 static VOID
 SharedInfoRelease (
-    IN  PINTERFACE                  Interface
+    _In_ PINTERFACE                 Interface
     )
 {
     PXENBUS_SHARED_INFO_CONTEXT     Context = Interface->Context;
@@ -828,7 +828,7 @@ static struct _XENBUS_SHARED_INFO_INTERFACE_V3 
SharedInfoInterfaceVersion3 = {
     SharedInfoEvtchnUnmask,
     SharedInfoGetTime
 };
-                     
+
 static struct _XENBUS_SHARED_INFO_INTERFACE_V4 SharedInfoInterfaceVersion4 = {
     { sizeof (struct _XENBUS_SHARED_INFO_INTERFACE_V4), 4, NULL, NULL, NULL },
     SharedInfoAcquire,
@@ -844,11 +844,11 @@ static struct _XENBUS_SHARED_INFO_INTERFACE_V4 
SharedInfoInterfaceVersion4 = {
 
 NTSTATUS
 SharedInfoInitialize(
-    IN  PXENBUS_FDO                 Fdo,
-    OUT PXENBUS_SHARED_INFO_CONTEXT *Context
+    _In_ PXENBUS_FDO                    Fdo,
+    _Out_ PXENBUS_SHARED_INFO_CONTEXT   *Context
     )
 {
-    NTSTATUS                        status;
+    NTSTATUS                            status;
 
     Trace("====>\n");
 
@@ -888,10 +888,10 @@ fail1:
 
 NTSTATUS
 SharedInfoGetInterface(
-    IN      PXENBUS_SHARED_INFO_CONTEXT Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context,
+    _In_ ULONG                          Version,
+    _Inout_ PINTERFACE                  Interface,
+    _In_ ULONG                          Size
     )
 {
     NTSTATUS                            status;
@@ -956,11 +956,11 @@ SharedInfoGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 SharedInfoGetReferences(
-    IN  PXENBUS_SHARED_INFO_CONTEXT Context
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
     )
 {
     return Context->References;
@@ -968,7 +968,7 @@ SharedInfoGetReferences(
 
 VOID
 SharedInfoTeardown(
-    IN  PXENBUS_SHARED_INFO_CONTEXT Context
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/shared_info.h b/src/xenbus/shared_info.h
index 9b88288..af4221c 100644
--- a/src/xenbus/shared_info.h
+++ b/src/xenbus/shared_info.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_SHARED_INFO_CONTEXT  
XENBUS_SHARED_INFO_CONTEXT, *PXENBUS
 
 extern NTSTATUS
 SharedInfoInitialize(
-    IN  PXENBUS_FDO                 Fdo,
-    OUT PXENBUS_SHARED_INFO_CONTEXT *Context
+    _In_ PXENBUS_FDO                    Fdo,
+    _Out_ PXENBUS_SHARED_INFO_CONTEXT   *Context
     );
 
 extern NTSTATUS
 SharedInfoGetInterface(
-    IN      PXENBUS_SHARED_INFO_CONTEXT Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context,
+    _In_ ULONG                          Version,
+    _Inout_ PINTERFACE                  Interface,
+    _In_ ULONG                          Size
     );
 
 extern ULONG
 SharedInfoGetReferences(
-    IN  PXENBUS_SHARED_INFO_CONTEXT Context
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
     );
 
 extern VOID
 SharedInfoTeardown(
-    IN  PXENBUS_SHARED_INFO_CONTEXT Context
+    _In_ PXENBUS_SHARED_INFO_CONTEXT    Context
     );
 
 #endif  // _XENBUS_SHARED_INFO_H
diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index 02cdd17..0a0ee94 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -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.
  */
 
@@ -158,7 +158,7 @@ C_ASSERT(sizeof (struct xenstore_domain_interface) <= 
PAGE_SIZE);
 
 static FORCEINLINE PVOID
 __StoreAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_STORE_TAG);
@@ -166,7 +166,7 @@ __StoreAllocate(
 
 static FORCEINLINE VOID
 __StoreFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_STORE_TAG);
@@ -174,17 +174,17 @@ __StoreFree(
 
 static NTSTATUS
 StorePrepareRequest(
-    IN  PXENBUS_STORE_CONTEXT       Context,
-    OUT PXENBUS_STORE_REQUEST       Request,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  enum xsd_sockmsg_type       Type,
-    IN  ...
+    _In_ PXENBUS_STORE_CONTEXT          Context,
+    _Out_ PXENBUS_STORE_REQUEST         Request,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_ enum xsd_sockmsg_type          Type,
+    ...
     )
 {
-    ULONG                           Id;
-    PXENBUS_STORE_SEGMENT           Segment;
-    va_list                         Arguments;
-    NTSTATUS                        status;
+    ULONG                               Id;
+    PXENBUS_STORE_SEGMENT               Segment;
+    va_list                             Arguments;
+    NTSTATUS                            status;
 
     ASSERT(IsZeroMemory(Request, sizeof (XENBUS_STORE_REQUEST)));
 
@@ -218,7 +218,7 @@ StorePrepareRequest(
 
         Data = va_arg(Arguments, PCHAR);
         Length = va_arg(Arguments, ULONG);
-        
+
         if (Data == NULL) {
             ASSERT3U(Length, ==, 0);
             break;
@@ -254,9 +254,9 @@ fail1:
 
 static ULONG
 StoreCopyToRing(
-    IN  PXENBUS_STORE_CONTEXT           Context,
-    IN  PCHAR                           Data,
-    IN  ULONG                           Length
+    _In_ PXENBUS_STORE_CONTEXT          Context,
+    _In_ PCHAR                          Data,
+    _In_ ULONG                          Length
     )
 {
     struct xenstore_domain_interface    *Shared;
@@ -303,14 +303,14 @@ StoreCopyToRing(
 
     KeMemoryBarrier();
 
-    return Offset;    
+    return Offset;
 }
 
 static NTSTATUS
 StoreSendSegment(
-    IN      PXENBUS_STORE_CONTEXT   Context,
-    IN OUT  PXENBUS_STORE_SEGMENT   Segment,
-    IN OUT  PULONG                  Written
+    _In_ PXENBUS_STORE_CONTEXT      Context,
+    _Inout_ PXENBUS_STORE_SEGMENT   Segment,
+    _Inout_ PULONG                  Written
     )
 {
     ULONG                           Copied;
@@ -328,8 +328,8 @@ StoreSendSegment(
 
 static VOID
 StoreSendRequests(
-    IN      PXENBUS_STORE_CONTEXT   Context,
-    IN OUT  PULONG                  Written
+    _In_ PXENBUS_STORE_CONTEXT      Context,
+    _Inout_ PULONG                  Written
     )
 {
     if (IsListEmpty(&Context->SubmittedList))
@@ -371,9 +371,9 @@ StoreSendRequests(
 
 static ULONG
 StoreCopyFromRing(
-    IN  PXENBUS_STORE_CONTEXT           Context,
-    IN  PCHAR                           Data,
-    IN  ULONG                           Length
+    _In_ PXENBUS_STORE_CONTEXT          Context,
+    _In_ PCHAR                          Data,
+    _In_ ULONG                          Length
     )
 {
     struct xenstore_domain_interface    *Shared;
@@ -420,14 +420,14 @@ StoreCopyFromRing(
 
     KeMemoryBarrier();
 
-    return Offset;    
+    return Offset;
 }
 
 static NTSTATUS
 StoreReceiveSegment(
-    IN      PXENBUS_STORE_CONTEXT   Context,
-    IN OUT  PXENBUS_STORE_SEGMENT   Segment,
-    IN OUT  PULONG                  Read
+    _In_ PXENBUS_STORE_CONTEXT      Context,
+    _Inout_ PXENBUS_STORE_SEGMENT   Segment,
+    _Inout_ PULONG                  Read
     )
 {
     ULONG                           Copied;
@@ -445,7 +445,7 @@ StoreReceiveSegment(
 
 static BOOLEAN
 StoreIgnoreHeaderType(
-    IN  ULONG   Type
+    _In_ ULONG  Type
     )
 {
     switch (Type) {
@@ -495,13 +495,13 @@ StoreVerifyHeader(
         Valid = FALSE;
     }
 
-    return Valid;    
+    return Valid;
 }
 
 static NTSTATUS
 StoreReceiveResponse(
-    IN      PXENBUS_STORE_CONTEXT   Context,
-    IN OUT  PULONG                  Read
+    _In_ PXENBUS_STORE_CONTEXT      Context,
+    _Inout_ PULONG                  Read
     )
 {
     PXENBUS_STORE_RESPONSE          Response = &Context->Response;
@@ -530,13 +530,13 @@ payload:
                                  Read);
 
 done:
-    return status;    
+    return status;
 }
 
 static PXENBUS_STORE_REQUEST
 StoreFindRequest(
-    IN  PXENBUS_STORE_CONTEXT   Context,
-    IN  uint32_t                req_id
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _In_ uint32_t               req_id
     )
 {
     PLIST_ENTRY                 ListEntry;
@@ -560,8 +560,8 @@ StoreFindRequest(
 
 static PXENBUS_STORE_WATCH
 StoreFindWatch(
-    IN  PXENBUS_STORE_CONTEXT   Context,
-    IN  USHORT                  Id
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _In_ USHORT                 Id
     )
 {
     PLIST_ENTRY                 ListEntry;
@@ -585,7 +585,7 @@ StoreFindWatch(
 
 static USHORT
 StoreNextWatchId(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     USHORT                      Id;
@@ -609,14 +609,14 @@ StoreNextWatchId(
 
 static NTSTATUS
 StoreParseWatchEvent(
-    IN  PCHAR   Data,
-    IN  ULONG   Length,
-    OUT PCHAR   *Path,
-    OUT PVOID   *Caller,
-    OUT PUSHORT Id
+    _In_ PCHAR      Data,
+    _In_ ULONG      Length,
+    _Out_ PCHAR     *Path,
+    _Out_ PVOID     *Caller,
+    _Out_ PUSHORT   Id
     )
 {
-    PCHAR       End;
+    PCHAR           End;
 
     *Path = Data;
     while (*Data != '\0' && Length != 0) {
@@ -678,7 +678,7 @@ fail1:
 
 static VOID
 StoreProcessWatchEvent(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     PXENBUS_STORE_RESPONSE      Response;
@@ -730,7 +730,7 @@ StoreProcessWatchEvent(
 
 static VOID
 StoreResetResponse(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     PXENBUS_STORE_RESPONSE      Response;
@@ -749,11 +749,11 @@ StoreResetResponse(
 
 static VOID
 StoreCopyResponse(
-    IN  PXENBUS_STORE_CONTEXT   Context,
-    OUT PXENBUS_STORE_RESPONSE  Response
+    _In_ PXENBUS_STORE_CONTEXT      Context,
+    _Out_ PXENBUS_STORE_RESPONSE    Response
     )
 {
-    PXENBUS_STORE_SEGMENT       Segment;
+    PXENBUS_STORE_SEGMENT           Segment;
 
     ASSERT(Response != NULL);
     *Response = Context->Response;
@@ -773,15 +773,15 @@ StoreCopyResponse(
 
 static VOID
 StoreFreeResponse(
-    IN  PXENBUS_STORE_RESPONSE  Response
+    _In_ PXENBUS_STORE_RESPONSE Response
     )
 {
-    __StoreFree(Response);    
+    __StoreFree(Response);
 }
 
 static VOID
 StoreProcessResponse(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     PXENBUS_STORE_RESPONSE      Response;
@@ -822,7 +822,7 @@ StoreProcessResponse(
 
 static ULONG
 StorePollLocked(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     ULONG                       Count;
@@ -865,7 +865,7 @@ StorePollLocked(
 
 static FORCEINLINE VOID
 __StorePoll(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     KeAcquireSpinLockAtDpcLevel(&Context->Lock);
@@ -882,10 +882,10 @@ _IRQL_requires_(DISPATCH_LEVEL)
 _IRQL_requires_same_
 VOID
 StoreDpc(
-    IN  PKDPC               Dpc,
-    IN  PVOID               _Context,
-    IN  PVOID               Argument1,
-    IN  PVOID               Argument2
+    _In_ PKDPC              Dpc,
+    _In_ PVOID              _Context,
+    _In_ PVOID              Argument1,
+    _In_ PVOID              Argument2
     )
 {
     PXENBUS_STORE_CONTEXT   Context = _Context;
@@ -907,8 +907,8 @@ StoreDpc(
 
 static PXENBUS_STORE_RESPONSE
 StoreSubmitRequest(
-    IN  PXENBUS_STORE_CONTEXT   Context,
-    IN  PXENBUS_STORE_REQUEST   Request
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _In_ PXENBUS_STORE_REQUEST  Request
     )
 {
     PXENBUS_STORE_RESPONSE      Response;
@@ -979,7 +979,7 @@ fail1:
 
 static NTSTATUS
 StoreCheckResponse(
-    IN  PXENBUS_STORE_RESPONSE  Response
+    _In_ PXENBUS_STORE_RESPONSE Response
     )
 {
     NTSTATUS                    status;
@@ -1003,7 +1003,7 @@ StoreCheckResponse(
              Index < sizeof (xsd_errors) / sizeof (xsd_errors[0]);
              Index++) {
             struct xsd_errors   *Entry = &xsd_errors[Index];
-            
+
             if (strncmp(Error, Entry->errstring, Length) == 0) {
                 ERRNO_TO_STATUS(Entry->errnum, status);
                 goto done;
@@ -1019,9 +1019,9 @@ done:
 
 static PXENBUS_STORE_BUFFER
 StoreCopyPayload(
-    IN  PXENBUS_STORE_CONTEXT   Context,
-    IN  PXENBUS_STORE_RESPONSE  Response,
-    IN  PVOID                   Caller
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _In_ PXENBUS_STORE_RESPONSE Response,
+    _In_ PVOID                  Caller
     )
 {
     PCHAR                       Data;
@@ -1061,8 +1061,8 @@ fail1:
 
 static VOID
 StoreFreePayload(
-    IN  PXENBUS_STORE_CONTEXT   Context,
-    IN  PXENBUS_STORE_BUFFER    Buffer
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _In_ PXENBUS_STORE_BUFFER   Buffer
     )
 {
     KIRQL                       Irql;
@@ -1078,8 +1078,8 @@ StoreFreePayload(
 
 static VOID
 StoreFree(
-    IN  PINTERFACE          Interface,
-    IN  PCHAR               Value
+    _In_ PINTERFACE         Interface,
+    _In_ PCHAR              Value
     )
 {
     PXENBUS_STORE_CONTEXT   Context = Interface->Context;
@@ -1100,22 +1100,22 @@ RtlCaptureStackBackTrace(
 
 static NTSTATUS
 StoreRead(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    OUT PCHAR                       *Value
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _Out_ PCHAR                         *Value
     )
 {
-    PXENBUS_STORE_CONTEXT           Context = Interface->Context;
-    PVOID                           Caller;
-    XENBUS_STORE_REQUEST            Request;
-    KIRQL                           Irql;
-    PXENBUS_STORE_RESPONSE          Response;
-    PXENBUS_STORE_BUFFER            Buffer;
-    NTSTATUS                        status;
+    PXENBUS_STORE_CONTEXT               Context = Interface->Context;
+    PVOID                               Caller;
+    XENBUS_STORE_REQUEST                Request;
+    KIRQL                               Irql;
+    PXENBUS_STORE_RESPONSE              Response;
+    PXENBUS_STORE_BUFFER                Buffer;
+    NTSTATUS                            status;
 
-    (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);    
+    (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
@@ -1182,17 +1182,17 @@ fail1:
 
 static NTSTATUS
 StoreWrite(
-    IN  PXENBUS_STORE_CONTEXT       Context,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    IN  PCHAR                       Value
+    _In_ PXENBUS_STORE_CONTEXT          Context,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _In_ PCHAR                          Value
     )
 {
-    XENBUS_STORE_REQUEST            Request;
-    KIRQL                           Irql;
-    PXENBUS_STORE_RESPONSE          Response;
-    NTSTATUS                        status;
+    XENBUS_STORE_REQUEST                Request;
+    KIRQL                               Irql;
+    PXENBUS_STORE_RESPONSE              Response;
+    NTSTATUS                            status;
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
@@ -1252,18 +1252,18 @@ fail1:
 
 static NTSTATUS
 StoreVPrintf(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    IN  const CHAR                  *Format,
-    IN  va_list                     Arguments
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _In_ const CHAR                     *Format,
+    _In_ va_list                        Arguments
     )
 {
-    PXENBUS_STORE_CONTEXT           Context = Interface->Context;
-    PCHAR                           Buffer;
-    ULONG                           Length;
-    NTSTATUS                        status;
+    PXENBUS_STORE_CONTEXT               Context = Interface->Context;
+    PCHAR                               Buffer;
+    ULONG                               Length;
+    NTSTATUS                            status;
 
     Length = 32;
     for (;;) {
@@ -1314,16 +1314,16 @@ fail1:
 
 static NTSTATUS
 StorePrintf(
-    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_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _In_ const CHAR                     *Format,
     ...
     )
 {
-    va_list                         Arguments;
-    NTSTATUS                        status;
+    va_list                             Arguments;
+    NTSTATUS                            status;
 
     va_start(Arguments, Format);
     status = StoreVPrintf(Interface,
@@ -1339,17 +1339,17 @@ StorePrintf(
 
 static NTSTATUS
 StoreRemove(
-    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_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node
     )
 {
-    PXENBUS_STORE_CONTEXT           Context = Interface->Context;
-    XENBUS_STORE_REQUEST            Request;
-    KIRQL                           Irql;
-    PXENBUS_STORE_RESPONSE          Response;
-    NTSTATUS                        status;
+    PXENBUS_STORE_CONTEXT               Context = Interface->Context;
+    XENBUS_STORE_REQUEST                Request;
+    KIRQL                               Irql;
+    PXENBUS_STORE_RESPONSE              Response;
+    NTSTATUS                            status;
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
@@ -1407,22 +1407,22 @@ fail1:
 
 static NTSTATUS
 StoreDirectory(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
-    IN  PCHAR                       Prefix OPTIONAL,
-    IN  PCHAR                       Node,
-    OUT PCHAR                       *Value
+    _In_ PINTERFACE                     Interface,
+    _In_opt_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_opt_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _Out_ PCHAR                         *Value
     )
 {
-    PXENBUS_STORE_CONTEXT           Context = Interface->Context;
-    PVOID                           Caller;
-    XENBUS_STORE_REQUEST            Request;
-    KIRQL                           Irql;
-    PXENBUS_STORE_RESPONSE          Response;
-    PXENBUS_STORE_BUFFER            Buffer;
-    NTSTATUS                        status;
+    PXENBUS_STORE_CONTEXT               Context = Interface->Context;
+    PVOID                               Caller;
+    XENBUS_STORE_REQUEST                Request;
+    KIRQL                               Irql;
+    PXENBUS_STORE_RESPONSE              Response;
+    PXENBUS_STORE_BUFFER                Buffer;
+    NTSTATUS                            status;
 
-    (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);    
+    (VOID) RtlCaptureStackBackTrace(1, 1, &Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
@@ -1496,8 +1496,8 @@ fail1:
 
 static NTSTATUS
 StoreTransactionStart(
-    IN  PINTERFACE                  Interface,
-    OUT PXENBUS_STORE_TRANSACTION   *Transaction
+    _In_ PINTERFACE                 Interface,
+    _Out_ PXENBUS_STORE_TRANSACTION *Transaction
     )
 {
     PXENBUS_STORE_CONTEXT           Context = Interface->Context;
@@ -1513,7 +1513,7 @@ StoreTransactionStart(
         goto fail1;
 
     (*Transaction)->Magic = STORE_TRANSACTION_MAGIC;
-    (VOID) RtlCaptureStackBackTrace(1, 1, &(*Transaction)->Caller, NULL);    
+    (VOID) RtlCaptureStackBackTrace(1, 1, &(*Transaction)->Caller, NULL);
 
     RtlZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST));
 
@@ -1578,9 +1578,9 @@ fail1:
 
 static NTSTATUS
 StoreTransactionEnd(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_STORE_TRANSACTION   Transaction,
-    IN  BOOLEAN                     Commit
+    _In_ PINTERFACE                 Interface,
+    _In_ PXENBUS_STORE_TRANSACTION  Transaction,
+    _In_ BOOLEAN                    Commit
     )
 {
     PXENBUS_STORE_CONTEXT           Context = Interface->Context;
@@ -1655,11 +1655,11 @@ fail1:
 
 static NTSTATUS
 StoreWatchAdd(
-    IN  PINTERFACE              Interface,
-    IN  PCHAR                   Prefix OPTIONAL,
-    IN  PCHAR                   Node,
-    IN  PKEVENT                 Event,
-    OUT PXENBUS_STORE_WATCH     *Watch
+    _In_ PINTERFACE             Interface,
+    _In_opt_ PCHAR              Prefix,
+    _In_ PCHAR                  Node,
+    _In_ PKEVENT                Event,
+    _Out_ PXENBUS_STORE_WATCH   *Watch
     )
 {
     PXENBUS_STORE_CONTEXT       Context = Interface->Context;
@@ -1678,7 +1678,7 @@ StoreWatchAdd(
         goto fail1;
 
     (*Watch)->Magic = STORE_WATCH_MAGIC;
-    (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);    
+    (VOID) RtlCaptureStackBackTrace(1, 1, &(*Watch)->Caller, NULL);
 
     if (Prefix == NULL)
         Length = (ULONG)strlen(Node) + sizeof (CHAR);
@@ -1695,7 +1695,7 @@ StoreWatchAdd(
              RtlStringCbPrintfA(Path, Length, "%s", Node) :
              RtlStringCbPrintfA(Path, Length, "%s/%s", Prefix, Node);
     ASSERT(NT_SUCCESS(status));
-    
+
     (*Watch)->Path = Path;
     (*Watch)->Event = Event;
 
@@ -1723,7 +1723,7 @@ StoreWatchAdd(
                                  XS_WATCH,
                                  Path, strlen(Path),
                                  "", 1,
-                                 Token, strlen(Token), 
+                                 Token, strlen(Token),
                                  "", 1,
                                  NULL, 0);
 
@@ -1786,8 +1786,8 @@ fail1:
 
 static NTSTATUS
 StoreWatchRemove(
-    IN  PINTERFACE              Interface,
-    IN  PXENBUS_STORE_WATCH     Watch
+    _In_ PINTERFACE             Interface,
+    _In_ PXENBUS_STORE_WATCH    Watch
     )
 {
     PXENBUS_STORE_CONTEXT       Context = Interface->Context;
@@ -1823,7 +1823,7 @@ StoreWatchRemove(
                                  XS_UNWATCH,
                                  Path, strlen(Path),
                                  "", 1,
-                                 Token, strlen(Token), 
+                                 Token, strlen(Token),
                                  "", 1,
                                  NULL, 0);
 
@@ -1882,7 +1882,7 @@ fail1:
 
 static VOID
 StorePoll(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     __StorePoll(Interface->Context);
@@ -1897,8 +1897,8 @@ StorePoll(
 
 static NTSTATUS
 StoreWatchdog(
-    IN  PXENBUS_THREAD                  Self,
-    IN  PVOID                           _Context
+    _In_ PXENBUS_THREAD                 Self,
+    _In_ PVOID                          _Context
     )
 {
     PXENBUS_STORE_CONTEXT               Context = _Context;
@@ -1977,10 +1977,10 @@ StoreWatchdog(
 
 static NTSTATUS
 StorePermissionToString(
-    IN  PXENBUS_STORE_PERMISSION    Permission,
-    OUT PCHAR                       Buffer,
-    IN  ULONG                       BufferSize,
-    OUT PULONG                      UsedSize
+    _In_ PXENBUS_STORE_PERMISSION   Permission,
+    _Out_ PCHAR                     Buffer,
+    _In_ ULONG                      BufferSize,
+    _Out_ PULONG                    UsedSize
     )
 {
     size_t                          Remaining;
@@ -2035,25 +2035,25 @@ fail1:
 
 static NTSTATUS
 StorePermissionsSet(
-    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_ PCHAR                      Prefix,
+    _In_ PCHAR                          Node,
+    _In_ PXENBUS_STORE_PERMISSION       Permissions,
+    _In_ ULONG                          NumberPermissions
     )
 {
-    PXENBUS_STORE_CONTEXT           Context = Interface->Context;
-    XENBUS_STORE_REQUEST            Request;
-    KIRQL                           Irql;
-    PXENBUS_STORE_RESPONSE          Response;
-    NTSTATUS                        status;
-    ULONG                           Index;
-    ULONG                           Length;
-    ULONG                           Used;
-    PCHAR                           Path;
-    PCHAR                           PermissionString;
-    PCHAR                           Segment;
+    PXENBUS_STORE_CONTEXT               Context = Interface->Context;
+    XENBUS_STORE_REQUEST                Request;
+    KIRQL                               Irql;
+    PXENBUS_STORE_RESPONSE              Response;
+    NTSTATUS                            status;
+    ULONG                               Index;
+    ULONG                               Length;
+    ULONG                               Used;
+    PCHAR                               Path;
+    PCHAR                               PermissionString;
+    PCHAR                               Segment;
 
     PermissionString = __StoreAllocate(XENSTORE_PAYLOAD_MAX);
 
@@ -2159,11 +2159,11 @@ _IRQL_requires_(HIGH_LEVEL)
 _IRQL_requires_same_
 BOOLEAN
 StoreEvtchnCallback(
-    IN  PKINTERRUPT InterruptObject,
-    IN  PVOID       Argument
+    _In_ PKINTERRUPT        InterruptObject,
+    _In_ PVOID              Argument
     )
 {
-    PXENBUS_STORE_CONTEXT  Context = Argument;
+    PXENBUS_STORE_CONTEXT   Context = Argument;
 
     UNREFERENCED_PARAMETER(InterruptObject);
 
@@ -2179,7 +2179,7 @@ StoreEvtchnCallback(
 
 static VOID
 StoreDisable(
-    IN PXENBUS_STORE_CONTEXT    Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     LogPrintf(LOG_LEVEL_INFO,
@@ -2195,7 +2195,7 @@ StoreDisable(
 
 static VOID
 StoreEnable(
-    IN PXENBUS_STORE_CONTEXT    Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     ULONGLONG                   Value;
@@ -2235,8 +2235,8 @@ StoreEnable(
 
 static
 StoreGetAddress(
-    IN  PXENBUS_STORE_CONTEXT   Context,
-    OUT PPHYSICAL_ADDRESS       Address
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _Out_ PPHYSICAL_ADDRESS     Address
     )
 {
     PFN_NUMBER                  Pfn;
@@ -2267,7 +2267,7 @@ fail1:
 
 static VOID
 StoreSuspendCallbackEarly(
-    IN  PVOID               Argument
+    _In_ PVOID              Argument
     )
 {
     PXENBUS_STORE_CONTEXT   Context = Argument;
@@ -2296,7 +2296,7 @@ StoreSuspendCallbackEarly(
 
 static VOID
 StoreSuspendCallbackLate(
-    IN  PVOID                           Argument
+    _In_ PVOID                          Argument
     )
 {
     PXENBUS_STORE_CONTEXT               Context = Argument;
@@ -2330,8 +2330,8 @@ StoreSuspendCallbackLate(
 
 static VOID
 StoreDebugCallback(
-    IN  PVOID               Argument,
-    IN  BOOLEAN             Crashing
+    _In_ PVOID              Argument,
+    _In_ BOOLEAN            Crashing
     )
 {
     PXENBUS_STORE_CONTEXT   Context = Argument;
@@ -2481,7 +2481,7 @@ StoreDebugCallback(
 
 static NTSTATUS
 StoreAcquire(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_STORE_CONTEXT   Context = Interface->Context;
@@ -2625,11 +2625,11 @@ fail1:
 
 static VOID
 StoreRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_STORE_CONTEXT   Context = Interface->Context;
-    KIRQL                   Irql;    
+    KIRQL                   Irql;
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
 
@@ -2704,8 +2704,8 @@ static struct _XENBUS_STORE_INTERFACE_V2 
StoreInterfaceVersion2 = {
 
 NTSTATUS
 StoreInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_STORE_CONTEXT   *Context
+    _In_ PXENBUS_FDO            Fdo,
+    _Out_ PXENBUS_STORE_CONTEXT *Context
     )
 {
     LARGE_INTEGER               Now;
@@ -2819,13 +2819,13 @@ fail1:
 
 NTSTATUS
 StoreGetInterface(
-    IN      PXENBUS_STORE_CONTEXT   Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     )
 {
-    NTSTATUS                        status;
+    NTSTATUS                    status;
 
     ASSERT(Context != NULL);
 
@@ -2853,11 +2853,11 @@ StoreGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 StoreGetReferences(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     return Context->References;
@@ -2865,7 +2865,7 @@ StoreGetReferences(
 
 VOID
 StoreTeardown(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/store.h b/src/xenbus/store.h
index bf7d692..7f75d1e 100644
--- a/src/xenbus/store.h
+++ b/src/xenbus/store.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_STORE_CONTEXT  XENBUS_STORE_CONTEXT, 
*PXENBUS_STORE_CONTE
 
 extern NTSTATUS
 StoreInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_STORE_CONTEXT   *Context
+    _In_ PXENBUS_FDO            Fdo,
+    _Out_ PXENBUS_STORE_CONTEXT *Context
     );
 
 extern NTSTATUS
 StoreGetInterface(
-    IN      PXENBUS_STORE_CONTEXT   Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_STORE_CONTEXT  Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     );
 
 extern ULONG
 StoreGetReferences(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     );
 
 extern VOID
 StoreTeardown(
-    IN  PXENBUS_STORE_CONTEXT   Context
+    _In_ PXENBUS_STORE_CONTEXT  Context
     );
 
 #endif  // _XENBUS_STORE_H
diff --git a/src/xenbus/suspend.c b/src/xenbus/suspend.c
index ffae491..ab403bf 100644
--- a/src/xenbus/suspend.c
+++ b/src/xenbus/suspend.c
@@ -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.
  */
 
@@ -63,7 +63,7 @@ struct _XENBUS_SUSPEND_CONTEXT {
 
 static FORCEINLINE PVOID
 __SuspendAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_SUSPEND_TAG);
@@ -71,7 +71,7 @@ __SuspendAllocate(
 
 static FORCEINLINE VOID
 __SuspendFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_SUSPEND_TAG);
@@ -79,11 +79,11 @@ __SuspendFree(
 
 static NTSTATUS
 SuspendRegister(
-    IN  PINTERFACE                      Interface,
-    IN  XENBUS_SUSPEND_CALLBACK_TYPE    Type,
-    IN  VOID                            (*Function)(PVOID),
-    IN  PVOID                           Argument OPTIONAL,
-    OUT PXENBUS_SUSPEND_CALLBACK        *Callback
+    _In_ PINTERFACE                     Interface,
+    _In_ XENBUS_SUSPEND_CALLBACK_TYPE   Type,
+    _In_ VOID                           (*Function)(PVOID),
+    _In_opt_ PVOID                      Argument,
+    _Out_ PXENBUS_SUSPEND_CALLBACK      *Callback
     )
 {
     PXENBUS_SUSPEND_CONTEXT             Context = Interface->Context;
@@ -127,8 +127,8 @@ fail1:
 
 static VOID
 SuspendDeregister(
-    IN  PINTERFACE                  Interface,
-    IN  PXENBUS_SUSPEND_CALLBACK    Callback
+    _In_ PINTERFACE                 Interface,
+    _In_ PXENBUS_SUSPEND_CALLBACK   Callback
     )
 {
     PXENBUS_SUSPEND_CONTEXT         Context = Interface->Context;
@@ -143,7 +143,7 @@ SuspendDeregister(
 
 static FORCEINLINE VOID
 __SuspendLogTimers(
-    IN  const CHAR  *Prefix
+    _In_ const CHAR *Prefix
     )
 {
     LARGE_INTEGER   SystemTime;
@@ -183,8 +183,8 @@ __SuspendLogTimers(
 
 static VOID
 SuspendEarly(
-    IN  PVOID               Argument,
-    IN  ULONG               Cpu
+    _In_ PVOID              Argument,
+    _In_ ULONG              Cpu
     )
 {
     PXENBUS_SUSPEND_CONTEXT Context = Argument;
@@ -223,8 +223,8 @@ SuspendEarly(
 
 static VOID
 SuspendLate(
-    IN  PVOID               Argument,
-    IN  ULONG               Cpu
+    _In_ PVOID              Argument,
+    _In_ ULONG              Cpu
     )
 {
     PXENBUS_SUSPEND_CONTEXT Context = Argument;
@@ -253,7 +253,7 @@ SuspendLate(
 NTSTATUS
 #pragma prefast(suppress:28167) // Function changes IRQL
 SuspendTrigger(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_SUSPEND_CONTEXT Context = Interface->Context;
@@ -298,7 +298,7 @@ SuspendTrigger(
 
 static ULONG
 SuspendGetCount(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_SUSPEND_CONTEXT Context = Interface->Context;
@@ -313,8 +313,8 @@ SuspendGetCount(
 
 static VOID
 SuspendDebugCallback(
-    IN  PVOID               Argument,
-    IN  BOOLEAN             Crashing
+    _In_ PVOID              Argument,
+    _In_ BOOLEAN            Crashing
     )
 {
     PXENBUS_SUSPEND_CONTEXT Context = Argument;
@@ -384,7 +384,7 @@ SuspendDebugCallback(
 
 static NTSTATUS
 SuspendAcquire(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_SUSPEND_CONTEXT Context = Interface->Context;
@@ -435,7 +435,7 @@ fail1:
 
 static VOID
 SuspendRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_SUSPEND_CONTEXT Context = Interface->Context;
@@ -476,14 +476,14 @@ static struct _XENBUS_SUSPEND_INTERFACE_V1 
SuspendInterfaceVersion1 = {
     SuspendTrigger,
     SuspendGetCount
 };
-                     
+
 NTSTATUS
 SuspendInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_SUSPEND_CONTEXT *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_SUSPEND_CONTEXT   *Context
     )
 {
-    NTSTATUS                    status;
+    NTSTATUS                        status;
 
     Trace("====>\n");
 
@@ -517,10 +517,10 @@ fail1:
 
 NTSTATUS
 SuspendGetInterface(
-    IN      PXENBUS_SUSPEND_CONTEXT Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_SUSPEND_CONTEXT    Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     )
 {
     NTSTATUS                        status;
@@ -551,11 +551,11 @@ SuspendGetInterface(
     }
 
     return status;
-}   
+}
 
 ULONG
 SuspendGetReferences(
-    IN  PXENBUS_SUSPEND_CONTEXT Context
+    _In_ PXENBUS_SUSPEND_CONTEXT    Context
     )
 {
     return Context->References;
@@ -563,7 +563,7 @@ SuspendGetReferences(
 
 VOID
 SuspendTeardown(
-    IN  PXENBUS_SUSPEND_CONTEXT Context
+    _In_ PXENBUS_SUSPEND_CONTEXT    Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/suspend.h b/src/xenbus/suspend.h
index ced30e4..4cfd107 100644
--- a/src/xenbus/suspend.h
+++ b/src/xenbus/suspend.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.
  */
 
@@ -43,26 +43,26 @@ typedef struct _XENBUS_SUSPEND_CONTEXT  
XENBUS_SUSPEND_CONTEXT, *PXENBUS_SUSPEND
 
 extern NTSTATUS
 SuspendInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_SUSPEND_CONTEXT *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_SUSPEND_CONTEXT   *Context
     );
 
 extern NTSTATUS
 SuspendGetInterface(
-    IN      PXENBUS_SUSPEND_CONTEXT Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_SUSPEND_CONTEXT    Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     );
 
 extern ULONG
 SuspendGetReferences(
-    IN  PXENBUS_SUSPEND_CONTEXT Context
+    _In_ PXENBUS_SUSPEND_CONTEXT    Context
     );
 
 extern VOID
 SuspendTeardown(
-    IN  PXENBUS_SUSPEND_CONTEXT Context
+    _In_ PXENBUS_SUSPEND_CONTEXT    Context
     );
 
 #endif  // _XENBUS_SUSPEND_H
diff --git a/src/xenbus/sync.c b/src/xenbus/sync.c
index 4296003..bf7ad0f 100644
--- a/src/xenbus/sync.c
+++ b/src/xenbus/sync.c
@@ -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.
  */
 
@@ -102,7 +102,7 @@ static LONG             SyncOwner = -1;
 
 static FORCEINLINE PVOID
 __SyncAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_SYNC_TAG);
@@ -110,7 +110,7 @@ __SyncAllocate(
 
 static FORCEINLINE VOID
 __SyncFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_SYNC_TAG);
@@ -118,7 +118,7 @@ __SyncFree(
 
 static FORCEINLINE VOID
 __SyncAcquire(
-    IN  LONG    Index
+    _In_ LONG   Index
     )
 {
     LONG        Old;
@@ -198,7 +198,7 @@ __SyncProcessorDisableInterrupts(
 
 static FORCEINLINE VOID
 __SyncProcessorRunEarly(
-    IN  ULONG       Index
+    _In_ ULONG      Index
     )
 {
     PSYNC_CONTEXT   Context = &SyncContext;
@@ -226,7 +226,7 @@ __SyncProcessorEnableInterrupts(
 
 static FORCEINLINE VOID
 __SyncProcessorRunLate(
-    IN  ULONG       Index
+    _In_ ULONG      Index
     )
 {
     PSYNC_CONTEXT   Context = &SyncContext;
@@ -257,10 +257,10 @@ __SyncWait(
 VOID
 #pragma prefast(suppress:28166) // Function does not restore IRQL
 SyncWorker(
-    IN  PKDPC           Dpc,
-    IN  PVOID           _Context,
-    IN  PVOID           Argument1,
-    IN  PVOID           Argument2
+    PKDPC               Dpc,
+    PVOID               _Context,
+    PVOID               Argument1,
+    PVOID               Argument2
     )
 {
     PSYNC_CONTEXT       Context = &SyncContext;
@@ -325,20 +325,20 @@ SyncWorker(
     InterlockedIncrement(&Context->CompletionCount);
 }
 
-__drv_maxIRQL(DISPATCH_LEVEL)
-__drv_raisesIRQL(DISPATCH_LEVEL)
+_IRQL_requires_max_(DISPATCH_LEVEL)
+_IRQL_raises_(DISPATCH_LEVEL)
 VOID
 SyncCapture(
-    IN  PVOID           Argument OPTIONAL,
-    IN  SYNC_CALLBACK   Early OPTIONAL,
-    IN  SYNC_CALLBACK   Late OPTIONAL
+    _In_opt_ PVOID          Argument,
+    _In_opt_ SYNC_CALLBACK  Early,
+    _In_opt_ SYNC_CALLBACK  Late
     )
 {
-    PSYNC_CONTEXT       Context = &SyncContext;
-    LONG                Index;
-    PROCESSOR_NUMBER    ProcNumber;
-    USHORT              Group;
-    UCHAR               Number;
+    PSYNC_CONTEXT           Context = &SyncContext;
+    LONG                    Index;
+    PROCESSOR_NUMBER        ProcNumber;
+    USHORT                  Group;
+    UCHAR                   Number;
 
     ASSERT3U(KeGetCurrentIrql(), ==, DISPATCH_LEVEL);
 
@@ -387,8 +387,8 @@ SyncCapture(
     Trace("<==== (%u:%u)\n", Group, Number);
 }
 
-__drv_requiresIRQL(DISPATCH_LEVEL)
-__drv_setsIRQL(HIGH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
+_IRQL_raises_(HIGH_LEVEL)
 VOID
 SyncDisableInterrupts(
     VOID
@@ -416,7 +416,7 @@ SyncDisableInterrupts(
     }
 }
 
-__drv_requiresIRQL(HIGH_LEVEL)
+_IRQL_requires_(HIGH_LEVEL)
 VOID
 SyncRunEarly(
     )
@@ -436,8 +436,8 @@ SyncRunEarly(
     __SyncWait();
 }
 
-__drv_requiresIRQL(HIGH_LEVEL)
-__drv_setsIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(HIGH_LEVEL)
+_IRQL_raises_(DISPATCH_LEVEL)
 VOID
 SyncEnableInterrupts(
     )
@@ -459,7 +459,7 @@ SyncEnableInterrupts(
     Trace("<====\n");
 }
 
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 VOID
 SyncRunLate(
     )
@@ -480,7 +480,7 @@ SyncRunLate(
 }
 
 
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 VOID
 #pragma prefast(suppress:28167) // Function changes IRQL
 SyncRelease(
diff --git a/src/xenbus/sync.h b/src/xenbus/sync.h
index 7170946..9707548 100644
--- a/src/xenbus/sync.h
+++ b/src/xenbus/sync.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.
  */
 
@@ -37,52 +37,52 @@
 
 typedef VOID
 (*SYNC_CALLBACK)(
-    IN  PVOID   Arguement,
-    IN  ULONG   Cpu
+    _In_ PVOID  Arguement,
+    _In_ ULONG  Cpu
     );
 
 extern
-__drv_maxIRQL(DISPATCH_LEVEL)
-__drv_raisesIRQL(DISPATCH_LEVEL)
+_IRQL_requires_max_(DISPATCH_LEVEL)
+_IRQL_raises_(DISPATCH_LEVEL)
 VOID
 SyncCapture(
-    IN  PVOID           Argument OPTIONAL,
-    IN  SYNC_CALLBACK   Early OPTIONAL,
-    IN  SYNC_CALLBACK   Late OPTIONAL
+    _In_opt_ PVOID          Argument,
+    _In_opt_ SYNC_CALLBACK  Early,
+    _In_opt_ SYNC_CALLBACK  Late
     );
 
 extern
-__drv_requiresIRQL(DISPATCH_LEVEL)
-__drv_setsIRQL(HIGH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
+_IRQL_raises_(HIGH_LEVEL)
 VOID
 SyncDisableInterrupts(
     VOID
     );
 
 extern
-__drv_requiresIRQL(HIGH_LEVEL)
+_IRQL_requires_(HIGH_LEVEL)
 VOID
 SyncRunEarly(
     VOID
     );
 
 extern
-__drv_requiresIRQL(HIGH_LEVEL)
-__drv_setsIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(HIGH_LEVEL)
+_IRQL_raises_(DISPATCH_LEVEL)
 VOID
 SyncEnableInterrupts(
     VOID
     );
 
 extern
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 VOID
 SyncRunLate(
     VOID
     );
 
 extern
-__drv_requiresIRQL(DISPATCH_LEVEL)
+_IRQL_requires_(DISPATCH_LEVEL)
 VOID
 SyncRelease(
     VOID
diff --git a/src/xenbus/thread.c b/src/xenbus/thread.c
index 03f022d..91b4057 100644
--- a/src/xenbus/thread.c
+++ b/src/xenbus/thread.c
@@ -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,7 +50,7 @@ struct _XENBUS_THREAD {
 
 static FORCEINLINE PVOID
 __ThreadAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, THREAD_TAG);
@@ -58,7 +58,7 @@ __ThreadAllocate(
 
 static FORCEINLINE VOID
 __ThreadFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, THREAD_TAG);
@@ -66,7 +66,7 @@ __ThreadFree(
 
 static FORCEINLINE VOID
 __ThreadWake(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     )
 {
     KeSetEvent(&Thread->Event, IO_NO_INCREMENT, FALSE);
@@ -74,7 +74,7 @@ __ThreadWake(
 
 VOID
 ThreadWake(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     )
 {
     __ThreadWake(Thread);
@@ -82,7 +82,7 @@ ThreadWake(
 
 static FORCEINLINE VOID
 __ThreadAlert(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     )
 {
     Thread->Alerted = TRUE;
@@ -91,7 +91,7 @@ __ThreadAlert(
 
 VOID
 ThreadAlert(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     )
 {
     __ThreadAlert(Thread);
@@ -101,7 +101,7 @@ KSTART_ROUTINE  ThreadFunction;
 
 VOID
 ThreadFunction(
-    IN  PVOID       Argument
+    _In_ PVOID      Argument
     )
 {
     PXENBUS_THREAD  Self = Argument;
@@ -116,12 +116,12 @@ ThreadFunction(
     // NOT REACHED
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 NTSTATUS
 ThreadCreate(
-    IN  XENBUS_THREAD_FUNCTION  Function,
-    IN  PVOID                   Context,
-    OUT PXENBUS_THREAD          *Thread
+    _In_ XENBUS_THREAD_FUNCTION Function,
+    _In_ PVOID                  Context,
+    _Out_ PXENBUS_THREAD        *Thread
     )
 {
     HANDLE                      Handle;
@@ -189,7 +189,7 @@ fail1:
 
 PKEVENT
 ThreadGetEvent(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     )
 {
     return &Thread->Event;
@@ -197,7 +197,7 @@ ThreadGetEvent(
 
 BOOLEAN
 ThreadIsAlerted(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     )
 {
     return Thread->Alerted;
@@ -205,7 +205,7 @@ ThreadIsAlerted(
 
 VOID
 ThreadJoin(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     )
 {
     LONG                References;
diff --git a/src/xenbus/thread.h b/src/xenbus/thread.h
index 633b3dd..9e24f65 100644
--- a/src/xenbus/thread.h
+++ b/src/xenbus/thread.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,37 +39,37 @@ typedef struct _XENBUS_THREAD XENBUS_THREAD, 
*PXENBUS_THREAD;
 
 typedef NTSTATUS (*XENBUS_THREAD_FUNCTION)(PXENBUS_THREAD, PVOID);
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 extern NTSTATUS
 ThreadCreate(
-    IN  XENBUS_THREAD_FUNCTION  Function,
-    IN  PVOID                   Context,
-    OUT PXENBUS_THREAD          *Thread
+    _In_ XENBUS_THREAD_FUNCTION Function,
+    _In_ PVOID                  Context,
+    _Out_ PXENBUS_THREAD        *Thread
     );
 
 extern PKEVENT
 ThreadGetEvent(
-    IN  PXENBUS_THREAD  Self
+    _In_ PXENBUS_THREAD Self
     );
 
 extern BOOLEAN
 ThreadIsAlerted(
-    IN  PXENBUS_THREAD  Self
+    _In_ PXENBUS_THREAD Self
     );
 
 extern VOID
 ThreadWake(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     );
 
 extern VOID
 ThreadAlert(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     );
 
 extern VOID
 ThreadJoin(
-    IN  PXENBUS_THREAD  Thread
+    _In_ PXENBUS_THREAD Thread
     );
 
 #endif  // _XENBUS_THREAD_H
diff --git a/src/xenbus/unplug.c b/src/xenbus/unplug.c
index a3f9b71..a21df30 100644
--- a/src/xenbus/unplug.c
+++ b/src/xenbus/unplug.c
@@ -54,7 +54,7 @@ struct _XENBUS_UNPLUG_CONTEXT {
 
 static FORCEINLINE PVOID
 __UnplugAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_UNPLUG_TAG);
@@ -62,18 +62,18 @@ __UnplugAllocate(
 
 static FORCEINLINE VOID
 __UnplugFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENBUS_UNPLUG_TAG);
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static VOID
 UnplugRequest(
-    IN  PINTERFACE                  Interface,
-    IN  XENBUS_UNPLUG_DEVICE_TYPE   Type,
-    IN  BOOLEAN                     Make
+    _In_ PINTERFACE                 Interface,
+    _In_ XENBUS_UNPLUG_DEVICE_TYPE  Type,
+    _In_ BOOLEAN                    Make
     )
 {
     PXENBUS_UNPLUG_CONTEXT          Context = Interface->Context;
@@ -111,11 +111,11 @@ UnplugRequest(
     ReleaseMutex(&Context->Mutex);
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static BOOLEAN
 UnplugIsRequested(
-    IN  PINTERFACE                  Interface,
-    IN  XENBUS_UNPLUG_DEVICE_TYPE   Type
+    _In_ PINTERFACE                 Interface,
+    _In_ XENBUS_UNPLUG_DEVICE_TYPE  Type
     )
 {
     PXENBUS_UNPLUG_CONTEXT          Context = Interface->Context;
@@ -145,10 +145,10 @@ UnplugIsRequested(
     return Requested;
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static BOOLEAN
 UnplugBootEmulated(
-    IN  PINTERFACE                  Interface
+    _In_ PINTERFACE                 Interface
     )
 {
     PXENBUS_UNPLUG_CONTEXT          Context = Interface->Context;
@@ -183,11 +183,11 @@ done:
     return BootEmulated;
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 static VOID
 UnplugReboot(
-    IN  PINTERFACE                  Interface,
-    IN  PCHAR                       Module
+    _In_ PINTERFACE                 Interface,
+    _In_ PCHAR                      Module
     )
 {
     PXENBUS_UNPLUG_CONTEXT          Context = Interface->Context;
@@ -205,7 +205,7 @@ UnplugReboot(
 
 static NTSTATUS
 UnplugAcquire(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_UNPLUG_CONTEXT  Context = Interface->Context;
@@ -226,7 +226,7 @@ done:
 
 static VOID
 UnplugRelease(
-    IN  PINTERFACE          Interface
+    _In_ PINTERFACE         Interface
     )
 {
     PXENBUS_UNPLUG_CONTEXT  Context = Interface->Context;
@@ -270,11 +270,11 @@ static struct _XENBUS_UNPLUG_INTERFACE_V3 
UnplugInterfaceVersion3 = {
 
 NTSTATUS
 UnplugInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_UNPLUG_CONTEXT  *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_UNPLUG_CONTEXT    *Context
     )
 {
-    NTSTATUS                    status;
+    NTSTATUS                        status;
 
     UNREFERENCED_PARAMETER(Fdo);
 
@@ -301,13 +301,13 @@ fail1:
 
 NTSTATUS
 UnplugGetInterface(
-    IN      PXENBUS_UNPLUG_CONTEXT  Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_UNPLUG_CONTEXT Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     )
 {
-    NTSTATUS                        status;
+    NTSTATUS                    status;
 
     ASSERT(Context != NULL);
 
@@ -373,7 +373,7 @@ UnplugGetInterface(
 
 ULONG
 UnplugGetReferences(
-    IN  PXENBUS_UNPLUG_CONTEXT  Context
+    _In_ PXENBUS_UNPLUG_CONTEXT Context
     )
 {
     return Context->References;
@@ -381,7 +381,7 @@ UnplugGetReferences(
 
 VOID
 UnplugTeardown(
-    IN  PXENBUS_UNPLUG_CONTEXT  Context
+    _In_ PXENBUS_UNPLUG_CONTEXT Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenbus/unplug.h b/src/xenbus/unplug.h
index c1417db..1cc6251 100644
--- a/src/xenbus/unplug.h
+++ b/src/xenbus/unplug.h
@@ -43,26 +43,26 @@ typedef struct _XENBUS_UNPLUG_CONTEXT  
XENBUS_UNPLUG_CONTEXT, *PXENBUS_UNPLUG_CO
 
 extern NTSTATUS
 UnplugInitialize(
-    IN  PXENBUS_FDO             Fdo,
-    OUT PXENBUS_UNPLUG_CONTEXT  *Context
+    _In_ PXENBUS_FDO                Fdo,
+    _Out_ PXENBUS_UNPLUG_CONTEXT    *Context
     );
 
 extern NTSTATUS
 UnplugGetInterface(
-    IN      PXENBUS_UNPLUG_CONTEXT  Context,
-    IN      ULONG                   Version,
-    IN OUT  PINTERFACE              Interface,
-    IN      ULONG                   Size
+    _In_ PXENBUS_UNPLUG_CONTEXT Context,
+    _In_ ULONG                  Version,
+    _Inout_ PINTERFACE          Interface,
+    _In_ ULONG                  Size
     );
 
 extern ULONG
 UnplugGetReferences(
-    IN  PXENBUS_UNPLUG_CONTEXT   Context
+    _In_ PXENBUS_UNPLUG_CONTEXT Context
     );
 
 extern VOID
 UnplugTeardown(
-    IN  PXENBUS_UNPLUG_CONTEXT   Context
+    _In_ PXENBUS_UNPLUG_CONTEXT Context
     );
 
 #endif  // _XENBUS_UNPLUG_H
diff --git a/src/xenfilt/driver.c b/src/xenfilt/driver.c
index aee663a..fd1ed22 100644
--- a/src/xenfilt/driver.c
+++ b/src/xenfilt/driver.c
@@ -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.
  */
 
@@ -65,7 +65,7 @@ static XENFILT_DRIVER   Driver;
 
 static FORCEINLINE PVOID
 __DriverAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENFILT_DRIVER_TAG);
@@ -73,7 +73,7 @@ __DriverAllocate(
 
 static FORCEINLINE VOID
 __DriverFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENFILT_DRIVER_TAG);
@@ -91,7 +91,7 @@ __DriverSafeMode(
 
 static FORCEINLINE VOID
 __DriverSetDriverObject(
-    IN  PDRIVER_OBJECT  DriverObject
+    _In_opt_ PDRIVER_OBJECT DriverObject
     )
 {
     Driver.DriverObject = DriverObject;
@@ -115,7 +115,7 @@ DriverGetDriverObject(
 
 static FORCEINLINE VOID
 __DriverSetEmulatedContext(
-    IN  PXENFILT_EMULATED_CONTEXT   Context
+    _In_ PXENFILT_EMULATED_CONTEXT  Context
     )
 {
     Driver.EmulatedContext = Context;
@@ -171,7 +171,7 @@ DriverReleaseMutex(
 
 VOID
 DriverAddFunctionDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PDEVICE_OBJECT      DeviceObject;
@@ -187,7 +187,7 @@ DriverAddFunctionDeviceObject(
 
 VOID
 DriverRemoveFunctionDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PDEVICE_OBJECT      DeviceObject;
@@ -206,8 +206,8 @@ DriverRemoveFunctionDeviceObject(
 
 static FORCEINLINE NTSTATUS
 __DriverGetActive(
-    IN  const CHAR  *Key,
-    OUT PCHAR       *Value
+    _In_ const CHAR *Key,
+    _Out_ PCHAR     *Value
     )
 {
     HANDLE          ParametersKey;
@@ -272,8 +272,8 @@ fail1:
 
 NTSTATUS
 DriverGetActive(
-    IN  const CHAR  *Key,
-    OUT PCHAR       *Value
+    _In_ const CHAR *Key,
+    _Out_ PCHAR     *Value
     )
 {
     return __DriverGetActive(Key, Value);
@@ -391,7 +391,7 @@ DRIVER_UNLOAD   DriverUnload;
 
 VOID
 DriverUnload(
-    IN  PDRIVER_OBJECT  DriverObject
+    _In_ PDRIVER_OBJECT DriverObject
     )
 {
     ASSERT3P(DriverObject, ==, __DriverGetDriverObject());
@@ -429,13 +429,14 @@ DriverUnload(
     Trace("<====\n");
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE DriverQueryCompletion;
+
+_Use_decl_annotations_
 static NTSTATUS
 DriverQueryCompletion(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PKEVENT             Event = Context;
@@ -450,9 +451,9 @@ DriverQueryCompletion(
 
 NTSTATUS
 DriverQueryId(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  BUS_QUERY_ID_TYPE   Type,
-    OUT PCHAR               *Id
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ BUS_QUERY_ID_TYPE  Type,
+    _Out_ PCHAR             *Id
     )
 {
     PIRP                    Irp;
@@ -614,9 +615,9 @@ fail1:
 
 NTSTATUS
 DriverQueryDeviceText(
-    IN  PDEVICE_OBJECT      DeviceObject,
-    IN  DEVICE_TEXT_TYPE    Type,
-    OUT PCHAR               *Text
+    _In_ PDEVICE_OBJECT     DeviceObject,
+    _In_ DEVICE_TEXT_TYPE   Type,
+    _Out_ PCHAR             *Text
     )
 {
     PIRP                    Irp;
@@ -704,7 +705,7 @@ fail1:
 
 static FORCEINLINE PCHAR
 __EmulatedTypeName(
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
     )
 {
     switch (Type) {
@@ -717,7 +718,7 @@ __EmulatedTypeName(
 
 static XENFILT_EMULATED_OBJECT_TYPE
 DriverGetEmulatedType(
-    IN  PCHAR                       Id
+    _In_ PCHAR                      Id
     )
 {
     HANDLE                          ParametersKey;
@@ -775,8 +776,8 @@ DRIVER_ADD_DEVICE   DriverAddDevice;
 NTSTATUS
 #pragma prefast(suppress:28152) // Does not clear DO_DEVICE_INITIALIZING
 DriverAddDevice(
-    IN  PDRIVER_OBJECT              DriverObject,
-    IN  PDEVICE_OBJECT              PhysicalDeviceObject
+    _In_ PDRIVER_OBJECT             DriverObject,
+    _In_ PDEVICE_OBJECT             PhysicalDeviceObject
     )
 {
     PCHAR                           Id;
@@ -823,10 +824,11 @@ done:
 
 DRIVER_DISPATCH DriverDispatch;
 
-NTSTATUS 
+_Use_decl_annotations_
+NTSTATUS
 DriverDispatch(
-    IN PDEVICE_OBJECT   DeviceObject,
-    IN PIRP             Irp
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp
     )
 {
     PXENFILT_DX         Dx;
@@ -882,8 +884,8 @@ DRIVER_INITIALIZE   DriverEntry;
 
 NTSTATUS
 DriverEntry(
-    IN  PDRIVER_OBJECT          DriverObject,
-    IN  PUNICODE_STRING         RegistryPath
+    _In_ PDRIVER_OBJECT         DriverObject,
+    _In_ PUNICODE_STRING        RegistryPath
     )
 {
     PXENFILT_EMULATED_CONTEXT   EmulatedContext;
diff --git a/src/xenfilt/driver.h b/src/xenfilt/driver.h
index e7bd468..ab36936 100644
--- a/src/xenfilt/driver.h
+++ b/src/xenfilt/driver.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,8 +50,8 @@ DriverReleaseMutex(
 
 extern NTSTATUS
 DriverGetActive(
-    IN  const CHAR  *Key,
-    OUT PCHAR       *Value
+    _In_ const CHAR *Key,
+    _Out_ PCHAR     *Value
     );
 
 typedef enum _XENFILT_FILTER_STATE {
@@ -72,16 +72,16 @@ DriverGetFilterState(
 
 extern NTSTATUS
 DriverQueryId(
-    IN  PDEVICE_OBJECT      PhysicalDeviceObject,
-    IN  BUS_QUERY_ID_TYPE   Type,
-    OUT PCHAR               *Id
+    _In_ PDEVICE_OBJECT     PhysicalDeviceObject,
+    _In_ BUS_QUERY_ID_TYPE  Type,
+    _Out_ PCHAR             *Id
     );
 
 extern NTSTATUS
 DriverQueryDeviceText(
-    IN  PDEVICE_OBJECT      LowerDeviceObject,
-    IN  DEVICE_TEXT_TYPE    Type,
-    OUT PCHAR               *Text
+    _In_ PDEVICE_OBJECT     LowerDeviceObject,
+    _In_ DEVICE_TEXT_TYPE   Type,
+    _Out_ PCHAR             *Text
     );
 
 #include "emulated.h"
@@ -99,12 +99,12 @@ typedef struct _XENFILT_PDO XENFILT_PDO, *PXENFILT_PDO;
 
 extern VOID
 DriverAddFunctionDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern VOID
 DriverRemoveFunctionDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 #pragma warning(push)
diff --git a/src/xenfilt/emulated.c b/src/xenfilt/emulated.c
index 177cde3..76bb3c0 100644
--- a/src/xenfilt/emulated.c
+++ b/src/xenfilt/emulated.c
@@ -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.
  */
 
@@ -75,7 +75,7 @@ struct _XENFILT_EMULATED_CONTEXT {
 
 static FORCEINLINE PVOID
 __EmulatedAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, XENFILT_EMULATED_TAG);
@@ -83,7 +83,7 @@ __EmulatedAllocate(
 
 static FORCEINLINE VOID
 __EmulatedFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, XENFILT_EMULATED_TAG);
@@ -91,11 +91,11 @@ __EmulatedFree(
 
 static NTSTATUS
 EmulatedSetObjectDeviceData(
-    IN  PXENFILT_EMULATED_OBJECT        EmulatedObject,
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type,
-    IN  PCHAR                           DeviceID,
-    IN  PCHAR                           InstanceID,
-    IN  PCHAR                           CompatibleIDs OPTIONAL
+    _In_ PXENFILT_EMULATED_OBJECT       EmulatedObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _In_ PCHAR                          DeviceID,
+    _In_ PCHAR                          InstanceID,
+    _In_opt_ PCHAR                      CompatibleIDs
     )
 {
     ULONG                               Index;
@@ -152,11 +152,11 @@ fail1:
 
 static NTSTATUS
 EmulatedSetObjectDiskData(
-    IN  PXENFILT_EMULATED_OBJECT        EmulatedObject,
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type,
-    IN  PCHAR                           DeviceID,
-    IN  PCHAR                           InstanceID,
-    IN  PCHAR                           CompatibleIDs OPTIONAL
+    _In_ PXENFILT_EMULATED_OBJECT       EmulatedObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _In_ PCHAR                          DeviceID,
+    _In_ PCHAR                          InstanceID,
+    _In_opt_ PCHAR                      CompatibleIDs
     )
 {
     PCHAR                               End;
@@ -222,12 +222,12 @@ fail1:
 
 NTSTATUS
 EmulatedAddObject(
-    IN  PXENFILT_EMULATED_CONTEXT       Context,
-    IN  PCHAR                           DeviceID,
-    IN  PCHAR                           InstanceID,
-    IN  PCHAR                           CompatibleIDs OPTIONAL,
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type,
-    OUT PXENFILT_EMULATED_OBJECT        *EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT      Context,
+    _In_ PCHAR                          DeviceID,
+    _In_ PCHAR                          InstanceID,
+    _In_opt_ PCHAR                      CompatibleIDs,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _Out_ PXENFILT_EMULATED_OBJECT      *EmulatedObject
     )
 {
     KIRQL                               Irql;
@@ -289,8 +289,8 @@ fail1:
 
 VOID
 EmulatedRemoveObject(
-    IN  PXENFILT_EMULATED_CONTEXT   Context,
-    IN  PXENFILT_EMULATED_OBJECT    EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT  Context,
+    _In_ PXENFILT_EMULATED_OBJECT   EmulatedObject
     )
 {
     KIRQL                           Irql;
@@ -304,9 +304,9 @@ EmulatedRemoveObject(
 
 static BOOLEAN
 EmulatedIsDevicePresent(
-    IN  PINTERFACE              Interface,
-    IN  PCHAR                   DeviceID,
-    IN  PCHAR                   InstanceID OPTIONAL
+    _In_ PINTERFACE             Interface,
+    _In_ PCHAR                  DeviceID,
+    _In_opt_ PCHAR              InstanceID
     )
 {
     PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
@@ -347,8 +347,8 @@ EmulatedIsDevicePresent(
 
 static BOOLEAN
 EmulatedIsDiskPresent(
-    IN  PINTERFACE              Interface,
-    IN  ULONG                   Index
+    _In_ PINTERFACE             Interface,
+    _In_ ULONG                  Index
     )
 {
     PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
@@ -392,10 +392,10 @@ EmulatedIsDiskPresent(
 
 static BOOLEAN
 EmulatedIsDiskPresentVersion1(
-    IN  PINTERFACE              Interface,
-    IN  ULONG                   Controller,
-    IN  ULONG                   Target,
-    IN  ULONG                   Lun
+    _In_ PINTERFACE             Interface,
+    _In_ ULONG                  Controller,
+    _In_ ULONG                  Target,
+    _In_ ULONG                  Lun
     )
 {
     UNREFERENCED_PARAMETER(Controller);
@@ -412,7 +412,7 @@ EmulatedIsDiskPresentVersion1(
 
 NTSTATUS
 EmulatedAcquire(
-    IN  PINTERFACE              Interface
+    _In_ PINTERFACE             Interface
     )
 {
     PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
@@ -433,7 +433,7 @@ done:
 
 VOID
 EmulatedRelease(
-    IN  PINTERFACE              Interface
+    _In_ PINTERFACE             Interface
     )
 {
     PXENFILT_EMULATED_CONTEXT   Context = Interface->Context;
@@ -457,7 +457,7 @@ static struct _XENFILT_EMULATED_INTERFACE_V1 
EmulatedInterfaceVersion1 = {
     EmulatedIsDevicePresent,
     EmulatedIsDiskPresentVersion1
 };
-                     
+
 static struct _XENFILT_EMULATED_INTERFACE_V2 EmulatedInterfaceVersion2 = {
     { sizeof (struct _XENFILT_EMULATED_INTERFACE_V2), 2, NULL, NULL, NULL },
     EmulatedAcquire,
@@ -468,7 +468,7 @@ static struct _XENFILT_EMULATED_INTERFACE_V2 
EmulatedInterfaceVersion2 = {
 
 NTSTATUS
 EmulatedInitialize(
-    OUT PXENFILT_EMULATED_CONTEXT   *Context
+    _Out_ PXENFILT_EMULATED_CONTEXT *Context
     )
 {
     NTSTATUS                        status;
@@ -496,13 +496,13 @@ fail1:
 
 NTSTATUS
 EmulatedGetInterface(
-    IN      PXENFILT_EMULATED_CONTEXT   Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
+    _In_ PXENFILT_EMULATED_CONTEXT  Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     )
 {
-    NTSTATUS                            status;
+    NTSTATUS                        status;
 
     ASSERT(Context != NULL);
 
@@ -547,11 +547,11 @@ EmulatedGetInterface(
     }
 
     return status;
-}   
+}
 
 VOID
 EmulatedTeardown(
-    IN  PXENFILT_EMULATED_CONTEXT   Context
+    _In_ PXENFILT_EMULATED_CONTEXT  Context
     )
 {
     Trace("====>\n");
diff --git a/src/xenfilt/emulated.h b/src/xenfilt/emulated.h
index 0986ded..5cb6ece 100644
--- a/src/xenfilt/emulated.h
+++ b/src/xenfilt/emulated.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.
  */
 
@@ -49,36 +49,36 @@ typedef struct _XENFILT_EMULATED_OBJECT 
XENFILT_EMULATED_OBJECT, *PXENFILT_EMULA
 
 extern NTSTATUS
 EmulatedInitialize(
-    OUT PXENFILT_EMULATED_CONTEXT   *Context
+    _Out_ PXENFILT_EMULATED_CONTEXT *Context
     );
 
 extern NTSTATUS
 EmulatedGetInterface(
-    IN      PXENFILT_EMULATED_CONTEXT   Context,
-    IN      ULONG                       Version,
-    IN OUT  PINTERFACE                  Interface,
-    IN      ULONG                       Size
+    _In_ PXENFILT_EMULATED_CONTEXT  Context,
+    _In_ ULONG                      Version,
+    _Inout_ PINTERFACE              Interface,
+    _In_ ULONG                      Size
     );
 
 extern VOID
 EmulatedTeardown(
-    IN  PXENFILT_EMULATED_CONTEXT   Context
+    _In_ PXENFILT_EMULATED_CONTEXT  Context
     );
 
 extern NTSTATUS
 EmulatedAddObject(
-    IN  PXENFILT_EMULATED_CONTEXT       Context,
-    IN  PCHAR                           DeviceID,
-    IN  PCHAR                           InstanceID,
-    IN  PCHAR                           CompatibleIDs OPTIONAL,
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type,
-    OUT PXENFILT_EMULATED_OBJECT        *EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT      Context,
+    _In_ PCHAR                          DeviceID,
+    _In_ PCHAR                          InstanceID,
+    _In_opt_ PCHAR                      CompatibleIDs,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type,
+    _Out_ PXENFILT_EMULATED_OBJECT      *EmulatedObject
     );
 
 extern VOID
 EmulatedRemoveObject(
-    IN  PXENFILT_EMULATED_CONTEXT   Context,
-    IN  PXENFILT_EMULATED_OBJECT    EmulatedObject
+    _In_ PXENFILT_EMULATED_CONTEXT  Context,
+    _In_ PXENFILT_EMULATED_OBJECT   EmulatedObject
     );
 
 #endif  // _XENFILT_EMULATED_H
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 08cf5a7..94578f6 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -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.
  */
 
@@ -71,7 +71,7 @@ struct _XENFILT_FDO {
 
 static FORCEINLINE PVOID
 __FdoAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, FDO_TAG);
@@ -79,7 +79,7 @@ __FdoAllocate(
 
 static FORCEINLINE VOID
 __FdoFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, FDO_TAG);
@@ -87,8 +87,8 @@ __FdoFree(
 
 static FORCEINLINE VOID
 __FdoSetDevicePnpState(
-    IN  PXENFILT_FDO        Fdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENFILT_FDO       Fdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENFILT_DX             Dx = Fdo->Dx;
@@ -102,8 +102,8 @@ __FdoSetDevicePnpState(
 
 static FORCEINLINE VOID
 __FdoRestoreDevicePnpState(
-    IN  PXENFILT_FDO        Fdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENFILT_FDO       Fdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENFILT_DX             Dx = Fdo->Dx;
@@ -114,7 +114,7 @@ __FdoRestoreDevicePnpState(
 
 static FORCEINLINE DEVICE_PNP_STATE
 __FdoGetDevicePnpState(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -124,7 +124,7 @@ __FdoGetDevicePnpState(
 
 static FORCEINLINE DEVICE_PNP_STATE
 __FdoGetPreviousDevicePnpState(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -134,8 +134,8 @@ __FdoGetPreviousDevicePnpState(
 
 static FORCEINLINE VOID
 __FdoSetDevicePowerState(
-    IN  PXENFILT_FDO        Fdo,
-    IN  DEVICE_POWER_STATE  State
+    _In_ PXENFILT_FDO       Fdo,
+    _In_ DEVICE_POWER_STATE State
     )
 {
     PXENFILT_DX             Dx = Fdo->Dx;
@@ -145,7 +145,7 @@ __FdoSetDevicePowerState(
 
 static FORCEINLINE DEVICE_POWER_STATE
 __FdoGetDevicePowerState(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -155,8 +155,8 @@ __FdoGetDevicePowerState(
 
 static FORCEINLINE VOID
 __FdoSetSystemPowerState(
-    IN  PXENFILT_FDO        Fdo,
-    IN  SYSTEM_POWER_STATE  State
+    _In_ PXENFILT_FDO       Fdo,
+    _In_ SYSTEM_POWER_STATE State
     )
 {
     PXENFILT_DX              Dx = Fdo->Dx;
@@ -166,7 +166,7 @@ __FdoSetSystemPowerState(
 
 static FORCEINLINE SYSTEM_POWER_STATE
 __FdoGetSystemPowerState(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -176,17 +176,17 @@ __FdoGetSystemPowerState(
 
 static FORCEINLINE PDEVICE_OBJECT
 __FdoGetDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
 
     return Dx->DeviceObject;
 }
-    
+
 PDEVICE_OBJECT
 FdoGetDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     return __FdoGetDeviceObject(Fdo);
@@ -194,7 +194,7 @@ FdoGetDeviceObject(
 
 static FORCEINLINE PDEVICE_OBJECT
 __FdoGetPhysicalDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     return Fdo->PhysicalDeviceObject;
@@ -202,7 +202,7 @@ __FdoGetPhysicalDeviceObject(
 
 PDEVICE_OBJECT
 FdoGetPhysicalDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     return __FdoGetPhysicalDeviceObject(Fdo);
@@ -210,7 +210,7 @@ FdoGetPhysicalDeviceObject(
 
 static FORCEINLINE NTSTATUS
 __FdoSetDeviceID(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -223,7 +223,7 @@ __FdoSetDeviceID(
 
 static FORCEINLINE PCHAR
 __FdoGetDeviceID(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -233,7 +233,7 @@ __FdoGetDeviceID(
 
 static FORCEINLINE VOID
 __FdoClearDeviceID(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -244,7 +244,7 @@ __FdoClearDeviceID(
 
 static FORCEINLINE NTSTATUS
 __FdoSetInstanceID(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -256,7 +256,7 @@ __FdoSetInstanceID(
 
 static FORCEINLINE PCHAR
 __FdoGetInstanceID(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -266,7 +266,7 @@ __FdoGetInstanceID(
 
 static FORCEINLINE VOID
 __FdoClearInstanceID(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PXENFILT_DX         Dx = Fdo->Dx;
@@ -277,7 +277,7 @@ __FdoClearInstanceID(
 
 static FORCEINLINE VOID
 __FdoSetName(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     NTSTATUS            status;
@@ -292,7 +292,7 @@ __FdoSetName(
 
 static FORCEINLINE PCHAR
 __FdoGetName(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     return Fdo->Name;
@@ -300,8 +300,8 @@ __FdoGetName(
 
 VOID
 FdoAddPhysicalDeviceObject(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PDEVICE_OBJECT      DeviceObject;
@@ -320,8 +320,8 @@ FdoAddPhysicalDeviceObject(
 
 VOID
 FdoRemovePhysicalDeviceObject(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PDEVICE_OBJECT      DeviceObject;
@@ -340,7 +340,7 @@ FdoRemovePhysicalDeviceObject(
 
 static FORCEINLINE VOID
 __FdoAcquireMutex(
-    IN  PXENFILT_FDO     Fdo
+    _In_ PXENFILT_FDO    Fdo
     )
 {
     AcquireMutex(&Fdo->Mutex);
@@ -348,7 +348,7 @@ __FdoAcquireMutex(
 
 VOID
 FdoAcquireMutex(
-    IN  PXENFILT_FDO     Fdo
+    _In_ PXENFILT_FDO    Fdo
     )
 {
     __FdoAcquireMutex(Fdo);
@@ -356,7 +356,7 @@ FdoAcquireMutex(
 
 static FORCEINLINE VOID
 __FdoReleaseMutex(
-    IN  PXENFILT_FDO     Fdo
+    _In_ PXENFILT_FDO    Fdo
     )
 {
     ReleaseMutex(&Fdo->Mutex);
@@ -364,7 +364,7 @@ __FdoReleaseMutex(
 
 VOID
 FdoReleaseMutex(
-    IN  PXENFILT_FDO     Fdo
+    _In_ PXENFILT_FDO    Fdo
     )
 {
     __FdoReleaseMutex(Fdo);
@@ -378,7 +378,7 @@ FdoReleaseMutex(
 
 static FORCEINLINE VOID
 __FdoSetEnumerated(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     Fdo->Enumerated = TRUE;
@@ -388,7 +388,7 @@ __FdoSetEnumerated(
 
 BOOLEAN
 FdoHasEnumerated(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     return Fdo->Enumerated;
@@ -396,8 +396,8 @@ FdoHasEnumerated(
 
 static VOID
 FdoEnumerate(
-    IN  PXENFILT_FDO        Fdo,
-    IN  PDEVICE_RELATIONS   Relations
+    _In_ PXENFILT_FDO       Fdo,
+    _In_ PDEVICE_RELATIONS  Relations
     )
 {
     PDEVICE_OBJECT          *PhysicalDeviceObject;
@@ -466,7 +466,7 @@ FdoEnumerate(
             ObDereferenceObject(PhysicalDeviceObject[Index]);
         }
     }
-    
+
     __FdoSetEnumerated(Fdo);
 
     __FdoFree(PhysicalDeviceObject);
@@ -476,13 +476,14 @@ fail1:
     Error("fail1 (%08x)\n", status);
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoForwardIrpSynchronouslyCompletion;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoForwardIrpSynchronouslyCompletion(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PKEVENT             Event = Context;
@@ -497,8 +498,8 @@ FdoForwardIrpSynchronouslyCompletion(
 
 static NTSTATUS
 FdoForwardIrpSynchronously(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     KEVENT              Event;
@@ -533,8 +534,8 @@ FdoForwardIrpSynchronously(
 
 static NTSTATUS
 FdoStartDevice(
-    IN  PXENFILT_FDO            Fdo,
-    IN  PIRP                    Irp
+    _In_ PXENFILT_FDO           Fdo,
+    _In_ PIRP                   Irp
     )
 {
     POWER_STATE                 PowerState;
@@ -579,8 +580,8 @@ fail1:
 
 static NTSTATUS
 FdoQueryStopDevice(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -608,8 +609,8 @@ fail1:
 
 static NTSTATUS
 FdoCancelStopDevice(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -638,8 +639,8 @@ fail1:
 
 static NTSTATUS
 FdoStopDevice(
-    IN  PXENFILT_FDO            Fdo,
-    IN  PIRP                    Irp
+    _In_ PXENFILT_FDO           Fdo,
+    _In_ PIRP                   Irp
     )
 {
     NTSTATUS                    status;
@@ -678,8 +679,8 @@ fail1:
 
 static NTSTATUS
 FdoQueryRemoveDevice(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -707,8 +708,8 @@ fail1:
 
 static NTSTATUS
 FdoCancelRemoveDevice(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -736,8 +737,8 @@ fail1:
 
 static NTSTATUS
 FdoSurpriseRemoval(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -765,8 +766,8 @@ fail1:
 
 static NTSTATUS
 FdoRemoveDevice(
-    IN  PXENFILT_FDO            Fdo,
-    IN  PIRP                    Irp
+    _In_ PXENFILT_FDO           Fdo,
+    _In_ PIRP                   Irp
     )
 {
     PLIST_ENTRY                 ListEntry;
@@ -840,13 +841,14 @@ fail1:
     return status;
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoQueryDeviceRelationsCompletion;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoQueryDeviceRelationsCompletion(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PKEVENT             Event = Context;
@@ -861,8 +863,8 @@ FdoQueryDeviceRelationsCompletion(
 
 static NTSTATUS
 FdoQueryDeviceRelations(
-    IN  PXENFILT_FDO        Fdo,
-    IN  PIRP                Irp
+    _In_ PXENFILT_FDO       Fdo,
+    _In_ PIRP               Irp
     )
 {
     KEVENT                  Event;
@@ -1002,8 +1004,8 @@ fail1:
 
 static NTSTATUS
 FdoDispatchPnp(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1073,13 +1075,14 @@ fail1:
     return status;
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoSetDevicePowerUpComplete;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoSetDevicePowerUpComplete(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PXENFILT_FDO        Fdo = (PXENFILT_FDO)Context;
@@ -1112,8 +1115,8 @@ FdoSetDevicePowerUpComplete(
 
 static FORCEINLINE NTSTATUS
 __FdoSetDevicePowerUp(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     IoCopyCurrentIrpStackLocationToNext(Irp);
@@ -1129,8 +1132,8 @@ __FdoSetDevicePowerUp(
 
 static NTSTATUS
 __FdoSetDevicePowerDown(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1158,8 +1161,8 @@ __FdoSetDevicePowerDown(
 
 static NTSTATUS
 FdoSetDevicePower(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1173,7 +1176,7 @@ FdoSetDevicePower(
 
     Trace("%s: ====> (%s:%s)\n",
           __FdoGetName(Fdo),
-          DevicePowerStateName(DeviceState), 
+          DevicePowerStateName(DeviceState),
           PowerActionName(PowerAction));
 
     if (DeviceState == __FdoGetDevicePowerState(Fdo)) {
@@ -1190,7 +1193,7 @@ FdoSetDevicePower(
 done:
     Trace("%s: <==== (%s:%s)(%08x)\n",
           __FdoGetName(Fdo),
-          DevicePowerStateName(DeviceState), 
+          DevicePowerStateName(DeviceState),
           PowerActionName(PowerAction),
           status);
     return status;
@@ -1198,8 +1201,8 @@ done:
 
 static FORCEINLINE NTSTATUS
 __FdoDispatchDevicePower(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1223,13 +1226,14 @@ __FdoDispatchDevicePower(
     return status;
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE FdoSetSystemPowerUpComplete;
+
+_Use_decl_annotations_
 static NTSTATUS
 FdoSetSystemPowerUpComplete(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PXENFILT_FDO        Fdo = (PXENFILT_FDO)Context;
@@ -1258,8 +1262,8 @@ FdoSetSystemPowerUpComplete(
 
 static FORCEINLINE NTSTATUS
 __FdoSetSystemPowerUp(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     IoCopyCurrentIrpStackLocationToNext(Irp);
@@ -1274,8 +1278,8 @@ __FdoSetSystemPowerUp(
 
 static FORCEINLINE NTSTATUS
 __FdoSetSystemPowerDown(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1299,8 +1303,8 @@ __FdoSetSystemPowerDown(
 
 static NTSTATUS
 FdoSetSystemPower(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1314,7 +1318,7 @@ FdoSetSystemPower(
 
     Trace("%s: ====> (%s:%s)\n",
           __FdoGetName(Fdo),
-          SystemPowerStateName(SystemState), 
+          SystemPowerStateName(SystemState),
           PowerActionName(PowerAction));
 
     if (SystemState == __FdoGetSystemPowerState(Fdo)) {
@@ -1331,7 +1335,7 @@ FdoSetSystemPower(
 done:
     Trace("%s: <==== (%s:%s)(%08x)\n",
           __FdoGetName(Fdo),
-          SystemPowerStateName(SystemState), 
+          SystemPowerStateName(SystemState),
           PowerActionName(PowerAction),
           status);
     return status;
@@ -1339,8 +1343,8 @@ done:
 
 static FORCEINLINE NTSTATUS
 __FdoDispatchSystemPower(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1366,8 +1370,8 @@ __FdoDispatchSystemPower(
 
 static NTSTATUS
 FdoDispatchPower(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1395,8 +1399,8 @@ FdoDispatchPower(
 
     Trace("%s: ====> (%02x:%s)\n",
           __FdoGetName(Fdo),
-          MinorFunction, 
-          PowerMinorFunctionName(MinorFunction)); 
+          MinorFunction,
+          PowerMinorFunctionName(MinorFunction));
 
     switch (PowerType) {
     case DevicePowerState:
@@ -1419,7 +1423,7 @@ FdoDispatchPower(
 
     Trace("%s: <==== (%02x:%s) (%08x)\n",
           __FdoGetName(Fdo),
-          MinorFunction, 
+          MinorFunction,
           PowerMinorFunctionName(MinorFunction),
           status);
 
@@ -1437,8 +1441,8 @@ fail1:
 
 static NTSTATUS
 FdoDispatchDefault(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -1465,8 +1469,8 @@ fail1:
 
 NTSTATUS
 FdoDispatch(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1493,8 +1497,8 @@ FdoDispatch(
 
 NTSTATUS
 FdoCreate(
-    IN  PDEVICE_OBJECT                  PhysicalDeviceObject,
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type
+    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
     )
 {
     PDEVICE_OBJECT                      LowerDeviceObject;
@@ -1615,7 +1619,7 @@ fail1:
 
 VOID
 FdoDestroy(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     )
 {
     PDEVICE_OBJECT      LowerDeviceObject = Fdo->LowerDeviceObject;
diff --git a/src/xenfilt/fdo.h b/src/xenfilt/fdo.h
index a2ee386..bd1d347 100644
--- a/src/xenfilt/fdo.h
+++ b/src/xenfilt/fdo.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.
  */
 
@@ -43,61 +43,61 @@ typedef struct _XENFILT_FDO XENFILT_FDO, *PXENFILT_FDO;
 
 extern NTSTATUS
 FdoCreate(
-    IN  PDEVICE_OBJECT                  PhysicalDeviceObject,
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type
+    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
     );
 
 extern VOID
 FdoDestroy(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern PCHAR
 FdoGetPrefix(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern VOID
 FdoAddPhysicalDeviceObject(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern VOID
 FdoRemovePhysicalDeviceObject(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern VOID
 FdoAcquireMutex(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern VOID
 FdoReleaseMutex(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern PDEVICE_OBJECT
 FdoGetDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern PDEVICE_OBJECT
 FdoGetPhysicalDeviceObject(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern BOOLEAN
 FdoHasEnumerated(
-    IN  PXENFILT_FDO    Fdo
+    _In_ PXENFILT_FDO   Fdo
     );
 
 extern NTSTATUS
 FdoDispatch(
-    IN  PXENFILT_FDO    Fdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_FDO   Fdo,
+    _In_ PIRP           Irp
     );
 
 #endif  // _XENFILT_FDO_H
diff --git a/src/xenfilt/pdo.c b/src/xenfilt/pdo.c
index 3ce30a8..9c6ba99 100644
--- a/src/xenfilt/pdo.c
+++ b/src/xenfilt/pdo.c
@@ -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.
  */
 
@@ -68,7 +68,7 @@ struct _XENFILT_PDO {
 
 static FORCEINLINE PVOID
 __PdoAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, PDO_TAG);
@@ -76,7 +76,7 @@ __PdoAllocate(
 
 static FORCEINLINE VOID
 __PdoFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, PDO_TAG);
@@ -84,8 +84,8 @@ __PdoFree(
 
 static FORCEINLINE VOID
 __PdoSetDevicePnpState(
-    IN  PXENFILT_PDO        Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENFILT_PDO       Pdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENFILT_DX             Dx = Pdo->Dx;
@@ -99,8 +99,8 @@ __PdoSetDevicePnpState(
 
 VOID
 PdoSetDevicePnpState(
-    IN  PXENFILT_PDO        Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENFILT_PDO       Pdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     __PdoSetDevicePnpState(Pdo, State);
@@ -108,8 +108,8 @@ PdoSetDevicePnpState(
 
 static FORCEINLINE VOID
 __PdoRestoreDevicePnpState(
-    IN  PXENFILT_PDO        Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENFILT_PDO       Pdo,
+    _In_ DEVICE_PNP_STATE   State
     )
 {
     PXENFILT_DX             Dx = Pdo->Dx;
@@ -120,7 +120,7 @@ __PdoRestoreDevicePnpState(
 
 static FORCEINLINE DEVICE_PNP_STATE
 __PdoGetDevicePnpState(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -130,7 +130,7 @@ __PdoGetDevicePnpState(
 
 DEVICE_PNP_STATE
 PdoGetDevicePnpState(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return __PdoGetDevicePnpState(Pdo);
@@ -138,8 +138,8 @@ PdoGetDevicePnpState(
 
 static FORCEINLINE VOID
 __PdoSetDevicePowerState(
-    IN  PXENFILT_PDO        Pdo,
-    IN  DEVICE_POWER_STATE  State
+    _In_ PXENFILT_PDO       Pdo,
+    _In_ DEVICE_POWER_STATE State
     )
 {
     PXENFILT_DX             Dx = Pdo->Dx;
@@ -149,7 +149,7 @@ __PdoSetDevicePowerState(
 
 static FORCEINLINE DEVICE_POWER_STATE
 __PdoGetDevicePowerState(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -159,8 +159,8 @@ __PdoGetDevicePowerState(
 
 static FORCEINLINE VOID
 __PdoSetSystemPowerState(
-    IN  PXENFILT_PDO        Pdo,
-    IN  SYSTEM_POWER_STATE  State
+    _In_ PXENFILT_PDO       Pdo,
+    _In_ SYSTEM_POWER_STATE State
     )
 {
     PXENFILT_DX             Dx = Pdo->Dx;
@@ -170,7 +170,7 @@ __PdoSetSystemPowerState(
 
 static FORCEINLINE SYSTEM_POWER_STATE
 __PdoGetSystemPowerState(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -180,7 +180,7 @@ __PdoGetSystemPowerState(
 
 PDEVICE_OBJECT
 PdoGetPhysicalDeviceObject(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return Pdo->PhysicalDeviceObject;
@@ -188,8 +188,8 @@ PdoGetPhysicalDeviceObject(
 
 static FORCEINLINE VOID
 __PdoSetMissing(
-    IN  PXENFILT_PDO    Pdo,
-    IN  const CHAR      *Reason
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ const CHAR     *Reason
     )
 {
     Pdo->Reason = Reason;
@@ -198,8 +198,8 @@ __PdoSetMissing(
 
 VOID
 PdoSetMissing(
-    IN  PXENFILT_PDO    Pdo,
-    IN  const CHAR      *Reason
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ const CHAR     *Reason
     )
 {
     __PdoSetMissing(Pdo, Reason);
@@ -207,7 +207,7 @@ PdoSetMissing(
 
 static FORCEINLINE BOOLEAN
 __PdoIsMissing(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return Pdo->Missing;
@@ -215,7 +215,7 @@ __PdoIsMissing(
 
 BOOLEAN
 PdoIsMissing(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return __PdoIsMissing(Pdo);
@@ -223,17 +223,17 @@ PdoIsMissing(
 
 static FORCEINLINE PDEVICE_OBJECT
 __PdoGetDeviceObject(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
 
     return Dx->DeviceObject;
 }
-    
+
 PDEVICE_OBJECT
 PdoGetDeviceObject(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return __PdoGetDeviceObject(Pdo);
@@ -241,7 +241,7 @@ PdoGetDeviceObject(
 
 static FORCEINLINE PXENFILT_FDO
 __PdoGetFdo(
-    IN  PXENFILT_PDO Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return Pdo->Fdo;
@@ -249,7 +249,7 @@ __PdoGetFdo(
 
 static NTSTATUS
 PdoSetDeviceInformation(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -328,7 +328,7 @@ fail1:
 
 static VOID
 PdoClearDeviceInformation(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -352,7 +352,7 @@ PdoClearDeviceInformation(
 
 static FORCEINLINE PCHAR
 __PdoGetDeviceID(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -363,7 +363,7 @@ __PdoGetDeviceID(
 
 static FORCEINLINE PCHAR
 __PdoGetInstanceID(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -374,7 +374,7 @@ __PdoGetInstanceID(
 
 static FORCEINLINE XENFILT_EMULATED_OBJECT_TYPE
 __PdoGetType(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return Pdo->Type;
@@ -382,7 +382,7 @@ __PdoGetType(
 
 static FORCEINLINE PCHAR
 __PdoGetLocationInformation(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     PXENFILT_DX         Dx = Pdo->Dx;
@@ -393,7 +393,7 @@ __PdoGetLocationInformation(
 
 static FORCEINLINE VOID
 __PdoSetName(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     NTSTATUS            status;
@@ -415,19 +415,20 @@ __PdoSetName(
 
 static FORCEINLINE PCHAR
 __PdoGetName(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     return Pdo->Name;
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE PdoForwardIrpSynchronouslyCompletion;
+
+_Use_decl_annotations_
 static NTSTATUS
 PdoForwardIrpSynchronouslyCompletion(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PKEVENT             Event = Context;
@@ -442,8 +443,8 @@ PdoForwardIrpSynchronouslyCompletion(
 
 static NTSTATUS
 PdoForwardIrpSynchronously(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     KEVENT              Event;
@@ -478,8 +479,8 @@ PdoForwardIrpSynchronously(
 
 static NTSTATUS
 PdoStartDevice(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     POWER_STATE         PowerState;
@@ -521,8 +522,8 @@ fail1:
 
 static NTSTATUS
 PdoQueryStopDevice(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -550,8 +551,8 @@ fail1:
 
 static NTSTATUS
 PdoCancelStopDevice(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -580,8 +581,8 @@ fail1:
 
 static NTSTATUS
 PdoStopDevice(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     POWER_STATE         PowerState;
@@ -621,8 +622,8 @@ fail1:
 
 static NTSTATUS
 PdoQueryRemoveDevice(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -650,8 +651,8 @@ fail1:
 
 static NTSTATUS
 PdoCancelRemoveDevice(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -679,8 +680,8 @@ fail1:
 
 static NTSTATUS
 PdoSurpriseRemoval(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -708,8 +709,8 @@ fail1:
 
 static NTSTATUS
 PdoRemoveDevice(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PXENFILT_FDO        Fdo = __PdoGetFdo(Pdo);
@@ -773,8 +774,8 @@ fail1:
 #define DEFINE_PDO_QUERY_INTERFACE(_Interface)                      \
 static NTSTATUS                                                     \
 PdoQuery ## _Interface ## Interface(                                \
-    IN  PXENFILT_PDO    Pdo,                                        \
-    IN  PIRP            Irp                                         \
+    _In_ PXENFILT_PDO   Pdo,                                        \
+    _In_ PIRP           Irp                                         \
     )                                                               \
 {                                                                   \
     PIO_STACK_LOCATION  StackLocation;                              \
@@ -827,8 +828,8 @@ struct _INTERFACE_ENTRY PdoInterfaceTable[] = {
 
 static NTSTATUS
 PdoQueryInterface(
-    IN  PXENFILT_PDO        Pdo,
-    IN  PIRP                Irp
+    _In_ PXENFILT_PDO       Pdo,
+    _In_ PIRP               Irp
     )
 {
     PIO_STACK_LOCATION      StackLocation;
@@ -878,8 +879,8 @@ fail1:
 
 static NTSTATUS
 PdoQueryDeviceText(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -970,8 +971,8 @@ fail1:
 
 static NTSTATUS
 PdoQueryId(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1075,8 +1076,8 @@ fail1:
 
 static NTSTATUS
 PdoEject(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PXENFILT_FDO        Fdo = __PdoGetFdo(Pdo);
@@ -1099,8 +1100,8 @@ PdoEject(
 
 static NTSTATUS
 PdoDispatchPnp(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1182,13 +1183,14 @@ fail1:
     return status;
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE PdoSetDevicePowerUpComplete;
+
+_Use_decl_annotations_
 static NTSTATUS
 PdoSetDevicePowerUpComplete(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PXENFILT_PDO        Pdo = (PXENFILT_PDO)Context;
@@ -1221,8 +1223,8 @@ PdoSetDevicePowerUpComplete(
 
 static FORCEINLINE NTSTATUS
 __PdoSetDevicePowerUp(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     IoCopyCurrentIrpStackLocationToNext(Irp);
@@ -1237,8 +1239,8 @@ __PdoSetDevicePowerUp(
 
 static NTSTATUS
 __PdoSetDevicePowerDown(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1266,8 +1268,8 @@ __PdoSetDevicePowerDown(
 
 static NTSTATUS
 PdoSetDevicePower(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1281,7 +1283,7 @@ PdoSetDevicePower(
 
     Trace("%s: ====> (%s:%s)\n",
           __PdoGetName(Pdo),
-          DevicePowerStateName(DeviceState), 
+          DevicePowerStateName(DeviceState),
           PowerActionName(PowerAction));
 
     if (DeviceState == __PdoGetDevicePowerState(Pdo)) {
@@ -1298,7 +1300,7 @@ PdoSetDevicePower(
 done:
     Trace("%s: <==== (%s:%s)(%08x)\n",
           __PdoGetName(Pdo),
-          DevicePowerStateName(DeviceState), 
+          DevicePowerStateName(DeviceState),
           PowerActionName(PowerAction),
           status);
     return status;
@@ -1306,8 +1308,8 @@ done:
 
 static FORCEINLINE NTSTATUS
 __PdoDispatchDevicePower(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1331,13 +1333,14 @@ __PdoDispatchDevicePower(
     return status;
 }
 
-__drv_functionClass(IO_COMPLETION_ROUTINE)
-__drv_sameIRQL
+static IO_COMPLETION_ROUTINE PdoSetSystemPowerUpComplete;
+
+_Use_decl_annotations_
 static NTSTATUS
 PdoSetSystemPowerUpComplete(
-    IN  PDEVICE_OBJECT  DeviceObject,
-    IN  PIRP            Irp,
-    IN  PVOID           Context
+    PDEVICE_OBJECT      DeviceObject,
+    PIRP                Irp,
+    PVOID               Context
     )
 {
     PXENFILT_PDO        Pdo = (PXENFILT_PDO)Context;
@@ -1366,8 +1369,8 @@ PdoSetSystemPowerUpComplete(
 
 static FORCEINLINE NTSTATUS
 __PdoSetSystemPowerUp(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     IoCopyCurrentIrpStackLocationToNext(Irp);
@@ -1382,8 +1385,8 @@ __PdoSetSystemPowerUp(
 
 static FORCEINLINE NTSTATUS
 __PdoSetSystemPowerDown(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1407,8 +1410,8 @@ __PdoSetSystemPowerDown(
 
 static NTSTATUS
 PdoSetSystemPower(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1422,7 +1425,7 @@ PdoSetSystemPower(
 
     Trace("%s: ====> (%s:%s)\n",
           __PdoGetName(Pdo),
-          SystemPowerStateName(SystemState), 
+          SystemPowerStateName(SystemState),
           PowerActionName(PowerAction));
 
     if (SystemState == __PdoGetSystemPowerState(Pdo)) {
@@ -1439,7 +1442,7 @@ PdoSetSystemPower(
 done:
     Trace("%s: <==== (%s:%s)(%08x)\n",
           __PdoGetName(Pdo),
-          SystemPowerStateName(SystemState), 
+          SystemPowerStateName(SystemState),
           PowerActionName(PowerAction),
           status);
     return status;
@@ -1447,8 +1450,8 @@ done:
 
 static FORCEINLINE NTSTATUS
 __PdoDispatchSystemPower(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1474,8 +1477,8 @@ __PdoDispatchSystemPower(
 
 static NTSTATUS
 PdoDispatchPower(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1503,8 +1506,8 @@ PdoDispatchPower(
 
     Trace("%s: ====> (%02x:%s)\n",
           __PdoGetName(Pdo),
-          MinorFunction, 
-          PowerMinorFunctionName(MinorFunction)); 
+          MinorFunction,
+          PowerMinorFunctionName(MinorFunction));
 
     switch (PowerType) {
     case DevicePowerState:
@@ -1527,7 +1530,7 @@ PdoDispatchPower(
 
     Trace("%s: <==== (%02x:%s) (%08x)\n",
           __PdoGetName(Pdo),
-          MinorFunction, 
+          MinorFunction,
           PowerMinorFunctionName(MinorFunction),
           status);
 
@@ -1545,8 +1548,8 @@ fail1:
 
 static NTSTATUS
 PdoDispatchDefault(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     NTSTATUS            status;
@@ -1573,8 +1576,8 @@ fail1:
 
 NTSTATUS
 PdoDispatch(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     )
 {
     PIO_STACK_LOCATION  StackLocation;
@@ -1601,7 +1604,7 @@ PdoDispatch(
 
 VOID
 PdoResume(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     UNREFERENCED_PARAMETER(Pdo);
@@ -1609,7 +1612,7 @@ PdoResume(
 
 VOID
 PdoSuspend(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     )
 {
     UNREFERENCED_PARAMETER(Pdo);
@@ -1617,18 +1620,18 @@ PdoSuspend(
 
 NTSTATUS
 PdoCreate(
-    PXENFILT_FDO                    Fdo,
-    PDEVICE_OBJECT                  PhysicalDeviceObject,
-    XENFILT_EMULATED_OBJECT_TYPE    Type
+    _In_ PXENFILT_FDO                   Fdo,
+    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
     )
 {
-    PDEVICE_OBJECT                  LowerDeviceObject;
-    ULONG                           DeviceType;
-    PDEVICE_OBJECT                  FilterDeviceObject;
-    PXENFILT_DX                     Dx;
-    PXENFILT_PDO                    Pdo;
-    PCHAR                           CompatibleIDs;
-    NTSTATUS                        status;
+    PDEVICE_OBJECT                      LowerDeviceObject;
+    ULONG                               DeviceType;
+    PDEVICE_OBJECT                      FilterDeviceObject;
+    PXENFILT_DX                         Dx;
+    PXENFILT_PDO                        Pdo;
+    PCHAR                               CompatibleIDs;
+    NTSTATUS                            status;
 
     ASSERT(Type != XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN);
 
@@ -1757,7 +1760,7 @@ fail1:
 
 VOID
 PdoDestroy(
-    IN  PXENFILT_PDO            Pdo
+    _In_ PXENFILT_PDO           Pdo
     )
 {
     PDEVICE_OBJECT              LowerDeviceObject = Pdo->LowerDeviceObject;
diff --git a/src/xenfilt/pdo.h b/src/xenfilt/pdo.h
index 5b8d920..fbce164 100644
--- a/src/xenfilt/pdo.h
+++ b/src/xenfilt/pdo.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.
  */
 
@@ -43,67 +43,67 @@ typedef struct _XENFILT_PDO XENFILT_PDO, *PXENFILT_PDO;
 
 extern VOID
 PdoSetDevicePnpState(
-    IN  PXENFILT_PDO        Pdo,
-    IN  DEVICE_PNP_STATE    State
+    _In_ PXENFILT_PDO       Pdo,
+    _In_ DEVICE_PNP_STATE   State
     );
 
 extern DEVICE_PNP_STATE
 PdoGetDevicePnpState(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern PDEVICE_OBJECT
 PdoGetPhysicalDeviceObject(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern BOOLEAN
 PdoIsMissing(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern VOID
 PdoSetMissing(
-    IN  PXENFILT_PDO    Pdo,
-    IN  const CHAR      *Reason
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ const CHAR     *Reason
     );
 
 extern BOOLEAN
 PdoIsMasked(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern PDEVICE_OBJECT
 PdoGetDeviceObject(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern NTSTATUS
 PdoCreate(
-    IN  PXENFILT_FDO                    Fdo,
-    IN  PDEVICE_OBJECT                  PhysicalDeviceObject,
-    IN  XENFILT_EMULATED_OBJECT_TYPE    Type
+    _In_ PXENFILT_FDO                   Fdo,
+    _In_ PDEVICE_OBJECT                 PhysicalDeviceObject,
+    _In_ XENFILT_EMULATED_OBJECT_TYPE   Type
     );
 
 extern VOID
 PdoResume(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern VOID
 PdoSuspend(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern VOID
 PdoDestroy(
-    IN  PXENFILT_PDO    Pdo
+    _In_ PXENFILT_PDO   Pdo
     );
 
 extern NTSTATUS
 PdoDispatch(
-    IN  PXENFILT_PDO    Pdo,
-    IN  PIRP            Irp
+    _In_ PXENFILT_PDO   Pdo,
+    _In_ PIRP           Irp
     );
 
 #endif  // _XENFILT_PDO_H
diff --git a/src/xenfilt/thread.c b/src/xenfilt/thread.c
index fe8639b..34bac05 100644
--- a/src/xenfilt/thread.c
+++ b/src/xenfilt/thread.c
@@ -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,7 +50,7 @@ struct _XENFILT_THREAD {
 
 static FORCEINLINE PVOID
 __ThreadAllocate(
-    IN  ULONG   Length
+    _In_ ULONG  Length
     )
 {
     return __AllocatePoolWithTag(NonPagedPool, Length, THREAD_TAG);
@@ -58,7 +58,7 @@ __ThreadAllocate(
 
 static FORCEINLINE VOID
 __ThreadFree(
-    IN  PVOID   Buffer
+    _In_ PVOID  Buffer
     )
 {
     __FreePoolWithTag(Buffer, THREAD_TAG);
@@ -66,7 +66,7 @@ __ThreadFree(
 
 static FORCEINLINE VOID
 __ThreadWake(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     )
 {
     KeSetEvent(&Thread->Event, IO_NO_INCREMENT, FALSE);
@@ -74,7 +74,7 @@ __ThreadWake(
 
 VOID
 ThreadWake(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     )
 {
     __ThreadWake(Thread);
@@ -82,7 +82,7 @@ ThreadWake(
 
 static FORCEINLINE VOID
 __ThreadAlert(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     )
 {
     Thread->Alerted = TRUE;
@@ -91,7 +91,7 @@ __ThreadAlert(
 
 VOID
 ThreadAlert(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     )
 {
     __ThreadAlert(Thread);
@@ -101,7 +101,7 @@ KSTART_ROUTINE  ThreadFunction;
 
 VOID
 ThreadFunction(
-    IN  PVOID       Argument
+    _In_ PVOID      Argument
     )
 {
     PXENFILT_THREAD Self = Argument;
@@ -116,16 +116,16 @@ ThreadFunction(
     // NOT REACHED
 }
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 NTSTATUS
 ThreadCreate(
-    IN  XENFILT_THREAD_FUNCTION Function,
-    IN  PVOID                   Context,
-    OUT PXENFILT_THREAD         *Thread
+    _In_ XENFILT_THREAD_FUNCTION    Function,
+    _In_ PVOID                      Context,
+    _Out_ PXENFILT_THREAD           *Thread
     )
 {
-    HANDLE                      Handle;
-    NTSTATUS                    status;
+    HANDLE                          Handle;
+    NTSTATUS                        status;
 
     ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
 
@@ -189,7 +189,7 @@ fail1:
 
 PKEVENT
 ThreadGetEvent(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     )
 {
     return &Thread->Event;
@@ -197,7 +197,7 @@ ThreadGetEvent(
 
 BOOLEAN
 ThreadIsAlerted(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     )
 {
     return Thread->Alerted;
@@ -205,7 +205,7 @@ ThreadIsAlerted(
 
 VOID
 ThreadJoin(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     )
 {
     LONG                References;
diff --git a/src/xenfilt/thread.h b/src/xenfilt/thread.h
index d3c4975..2d6d784 100644
--- a/src/xenfilt/thread.h
+++ b/src/xenfilt/thread.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,37 +39,37 @@ typedef struct _XENFILT_THREAD XENFILT_THREAD, 
*PXENFILT_THREAD;
 
 typedef NTSTATUS (*XENFILT_THREAD_FUNCTION)(PXENFILT_THREAD, PVOID);
 
-__drv_requiresIRQL(PASSIVE_LEVEL)
+_IRQL_requires_(PASSIVE_LEVEL)
 extern NTSTATUS
 ThreadCreate(
-    IN  XENFILT_THREAD_FUNCTION Function,
-    IN  PVOID                   Context,
-    OUT PXENFILT_THREAD         *Thread
+    _In_ XENFILT_THREAD_FUNCTION    Function,
+    _In_ PVOID                      Context,
+    _Out_ PXENFILT_THREAD           *Thread
     );
 
 extern PKEVENT
 ThreadGetEvent(
-    IN  PXENFILT_THREAD Self
+    _In_ PXENFILT_THREAD    Self
     );
 
 extern BOOLEAN
 ThreadIsAlerted(
-    IN  PXENFILT_THREAD Self
+    _In_ PXENFILT_THREAD    Self
     );
 
 extern VOID
 ThreadWake(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     );
 
 extern VOID
 ThreadAlert(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     );
 
 extern VOID
 ThreadJoin(
-    IN  PXENFILT_THREAD Thread
+    _In_ PXENFILT_THREAD    Thread
     );
 
 #endif  // _XENFILT_THREAD_H
-- 
2.50.0.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

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®.