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

[PATCH 03/21] Update string typedefs


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

Mechanical pass, no functional change.

Types:
  const CHAR */CHAR *  -> PCSTR/PSTR
  const WCHAR */WCHAR* -> PCWSTR
  const PCHAR          -> PCSTR
  PCHAR                -> PSTR

PCSTR/PCWSTR are _Null_terminated_ in ntdef.h, so the type gives the
analyser the buffer extent; PCHAR does not.  "const PCHAR" qualified
the pointer rather than the characters and so asserted nothing.
Buffers that are not single strings keep PCHAR.

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 include/debug_interface.h     |  4 ++--
 include/range_set_interface.h |  2 +-
 include/unplug_interface.h    |  2 +-
 src/xenvif/fdo.c              |  4 ++--
 src/xenvif/frontend.c         |  2 +-
 src/xenvif/frontend.h         |  2 +-
 src/xenvif/link.c             |  6 +++---
 src/xenvif/link.h             |  4 ++--
 src/xenvif/pdo.c              | 10 ++++-----
 src/xenvif/pdo.h              |  4 ++--
 src/xenvif/registry.c         | 20 +++++++++---------
 src/xenvif/registry.h         | 38 +++++++++++++++++------------------
 src/xenvif/settings.c         | 18 ++++++++---------
 src/xenvif/settings.h         | 12 +++++------
 14 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/include/debug_interface.h b/include/debug_interface.h
index 251902c..25cf58c 100644
--- a/include/debug_interface.h
+++ b/include/debug_interface.h
@@ -111,8 +111,8 @@ typedef NTSTATUS
 */
 typedef VOID
 (*XENBUS_DEBUG_PRINTF)(
-    _In_ PINTERFACE             Interface,
-    _In_ PCSTR                  Format,
+    _In_ PINTERFACE Interface,
+    _In_ PCSTR      Format,
     ...
     );
 
diff --git a/include/range_set_interface.h b/include/range_set_interface.h
index dde916b..14df7cf 100644
--- a/include/range_set_interface.h
+++ b/include/range_set_interface.h
@@ -77,7 +77,7 @@ typedef VOID
 typedef NTSTATUS
 (*XENBUS_RANGE_SET_CREATE)(
     _In_ PINTERFACE             Interface,
-    _In_ const CHAR             *Name,
+    _In_ PCSTR                  Name,
     _Outptr_ PXENBUS_RANGE_SET  *RangeSet
     );
 
diff --git a/include/unplug_interface.h b/include/unplug_interface.h
index 5881ab6..131496d 100644
--- a/include/unplug_interface.h
+++ b/include/unplug_interface.h
@@ -118,7 +118,7 @@ typedef BOOLEAN
 typedef VOID
 (*XENBUS_UNPLUG_REBOOT)(
     _In_ PINTERFACE Interface,
-    _In_ PCHAR      Module
+    _In_ PSTR       Module
     );
 
 // {73db6517-3d06-4937-989f-199b7501e229}
diff --git a/src/xenvif/fdo.c b/src/xenvif/fdo.c
index 8d20c86..0a0e44f 100644
--- a/src/xenvif/fdo.c
+++ b/src/xenvif/fdo.c
@@ -848,7 +848,7 @@ done:
 
 static FORCEINLINE PANSI_STRING
 __FdoMultiSzToUpcaseAnsi(
-    _In_ PCHAR      Buffer
+    _In_ PSTR       Buffer
     )
 {
     PANSI_STRING    Ansi;
@@ -1103,7 +1103,7 @@ FdoParseResources(
 static FORCEINLINE BOOLEAN
 __FdoMatchDistribution(
     _In_ PXENVIF_FDO    Fdo,
-    _In_ PCHAR          Buffer
+    _In_ PSTR           Buffer
     )
 {
     PCHAR               Vendor;
diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index 675e419..c11f85c 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -318,7 +318,7 @@ fail1:
 VOID
 FrontendFreePath(
     _In_ PXENVIF_FRONTEND   Frontend,
-    _In_ PCHAR              Path
+    _In_ PSTR               Path
     )
 {
     UNREFERENCED_PARAMETER(Frontend);
diff --git a/src/xenvif/frontend.h b/src/xenvif/frontend.h
index caa84f9..e2ddac6 100644
--- a/src/xenvif/frontend.h
+++ b/src/xenvif/frontend.h
@@ -150,7 +150,7 @@ FrontendFormatPath(
 extern VOID
 FrontendFreePath(
     _In_ PXENVIF_FRONTEND   Frontend,
-    _In_ PCHAR              Path
+    _In_ PSTR               Path
     );
 
 #include "mac.h"
diff --git a/src/xenvif/link.c b/src/xenvif/link.c
index 1f95000..72c1766 100644
--- a/src/xenvif/link.c
+++ b/src/xenvif/link.c
@@ -59,7 +59,7 @@ __LinkFree(
 
 static FORCEINLINE NTSTATUS
 __LinkGetImageBase(
-    _In_ const CHAR             *ModuleName,
+    _In_ PCSTR                  ModuleName,
     _Outptr_ PVOID              *ImageBase
     )
 {
@@ -151,8 +151,8 @@ fail1:
 
 NTSTATUS
 LinkGetRoutineAddress(
-    _In_ const CHAR *ModuleName,
-    _In_ const CHAR *FunctionName,
+    _In_ PCSTR      ModuleName,
+    _In_ PCSTR      FunctionName,
     _Outptr_ PVOID  *Address
     )
 {
diff --git a/src/xenvif/link.h b/src/xenvif/link.h
index 570414c..5a35eee 100644
--- a/src/xenvif/link.h
+++ b/src/xenvif/link.h
@@ -35,8 +35,8 @@
 
 extern NTSTATUS
 LinkGetRoutineAddress(
-    _In_ const CHAR *ModuleName,
-    _In_ const CHAR *FunctionName,
+    _In_ PCSTR      ModuleName,
+    _In_ PCSTR      FunctionName,
     _Outptr_ PVOID  *Address
      );
 
diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index 66d3a32..09f6d9d 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -212,7 +212,7 @@ __PdoGetDevicePowerState(
 static FORCEINLINE VOID
 __PdoSetMissing(
     _In_ PXENVIF_PDO    Pdo,
-    _In_ const CHAR     *Reason
+    _In_ PCSTR          Reason
     )
 {
     Pdo->Reason = Reason;
@@ -222,7 +222,7 @@ __PdoSetMissing(
 VOID
 PdoSetMissing(
     _In_ PXENVIF_PDO    Pdo,
-    _In_ const CHAR     *Reason
+    _In_ PCSTR          Reason
     )
 {
     __PdoSetMissing(Pdo, Reason);
@@ -662,7 +662,7 @@ PdoGetVifContext(
 
 static FORCEINLINE NTSTATUS
 __PdoParseAddress(
-    _In_ PCHAR              Buffer,
+    _In_ PSTR               Buffer,
     _Out_ PETHERNET_ADDRESS Address
     )
 {
@@ -731,7 +731,7 @@ fail1:
 static FORCEINLINE NTSTATUS
 __PdoSetPermanentAddress(
     _In_ PXENVIF_PDO    Pdo,
-    _In_ PCHAR          Buffer
+    _In_ PSTR           Buffer
     )
 {
     ANSI_STRING         Ansi[2];
@@ -2705,7 +2705,7 @@ NTSTATUS
 PdoCreate(
     _In_ PXENVIF_FDO    Fdo,
     _In_ ULONG          Number,
-    _In_ PCHAR          Address
+    _In_ PSTR           Address
     )
 {
     PDEVICE_OBJECT      PhysicalDeviceObject;
diff --git a/src/xenvif/pdo.h b/src/xenvif/pdo.h
index cb8e29b..086edef 100644
--- a/src/xenvif/pdo.h
+++ b/src/xenvif/pdo.h
@@ -54,7 +54,7 @@ PdoGetDevicePnpState(
 extern VOID
 PdoSetMissing(
     _In_ PXENVIF_PDO    Pdo,
-    _In_ const CHAR     *Reason
+    _In_ PCSTR          Reason
     );
 
 extern BOOLEAN
@@ -142,7 +142,7 @@ extern NTSTATUS
 PdoCreate(
     _In_ PXENVIF_FDO    Fdo,
     _In_ ULONG          Number,
-    _In_ PCHAR          Address
+    _In_ PSTR           Address
     );
 
 extern NTSTATUS
diff --git a/src/xenvif/registry.c b/src/xenvif/registry.c
index 09b61cd..119c697 100644
--- a/src/xenvif/registry.c
+++ b/src/xenvif/registry.c
@@ -152,8 +152,8 @@ RegistryOpenKey(
     _Out_ PHANDLE           Key
     )
 {
-    OBJECT_ATTRIBUTES   Attributes;
-    NTSTATUS            status;
+    OBJECT_ATTRIBUTES       Attributes;
+    NTSTATUS                status;
 
     InitializeObjectAttributes(&Attributes,
                                Path,
@@ -214,13 +214,13 @@ RegistryCreateKey(
     _Out_ PHANDLE           Key
     )
 {
-    PWSTR               Buffer;
-    HANDLE              Root;
-    PWSTR               ChildPath;
-    PWSTR               ChildName;
-    PWSTR               Context;
-    HANDLE              Child;
-    NTSTATUS            status;
+    PWSTR                   Buffer;
+    HANDLE                  Root;
+    PWSTR                   ChildPath;
+    PWSTR                   ChildName;
+    PWSTR                   Context;
+    HANDLE                  Child;
+    NTSTATUS                status;
 
     //
     // UNICODE_STRINGs are not guaranteed to have NUL terminated
@@ -317,7 +317,7 @@ RegistryOpenServiceKey(
 
 NTSTATUS
 RegistryCreateServiceKey(
-    _Out_ PHANDLE       Key
+    _Out_ PHANDLE   Key
     )
 {
     return RegistryCreateKey(NULL, &RegistryPath, REG_OPTION_NON_VOLATILE, 
Key);
diff --git a/src/xenvif/registry.h b/src/xenvif/registry.h
index 8fa10b7..b77e4fb 100644
--- a/src/xenvif/registry.h
+++ b/src/xenvif/registry.h
@@ -110,8 +110,8 @@ RegistryCreateSubKey(
 
 extern NTSTATUS
 RegistryDeleteSubKey(
-    _In_ HANDLE     Key,
-    _In_ PSTR       Name
+    _In_ HANDLE Key,
+    _In_ PSTR   Name
     );
 
 extern NTSTATUS
@@ -130,15 +130,15 @@ RegistryEnumerateValues(
 
 extern NTSTATUS
 RegistryDeleteValue(
-    _In_ HANDLE     Key,
-    _In_ PSTR       Name
+    _In_ HANDLE Key,
+    _In_ PSTR   Name
     );
 
 extern NTSTATUS
 RegistryQueryDwordValue(
-    _In_ HANDLE         Key,
-    _In_ PSTR           Name,
-    _Out_ PULONG        Value
+    _In_ HANDLE     Key,
+    _In_ PSTR       Name,
+    _Out_ PULONG    Value
     );
 
 extern NTSTATUS
@@ -150,9 +150,9 @@ RegistryQueryQwordValue(
 
 extern NTSTATUS
 RegistryUpdateDwordValue(
-    _In_ HANDLE         Key,
-    _In_ PSTR           Name,
-    _In_ ULONG          Value
+    _In_ HANDLE Key,
+    _In_ PSTR   Name,
+    _In_ ULONG  Value
     );
 
 extern NTSTATUS
@@ -165,18 +165,18 @@ RegistryQuerySzValue(
 
 extern NTSTATUS
 RegistryQueryBinaryValue(
-    _In_ HANDLE         Key,
-    _In_ PSTR           Name,
-    _Outptr_ PVOID      *Buffer,
-    _Out_ PULONG        Length
+    _In_ HANDLE     Key,
+    _In_ PSTR       Name,
+    _Outptr_ PVOID  *Buffer,
+    _Out_ PULONG    Length
     );
 
 extern NTSTATUS
 RegistryUpdateBinaryValue(
-    _In_ HANDLE         Key,
-    _In_ PSTR           Name,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Length
+    _In_ HANDLE Key,
+    _In_ PSTR   Name,
+    _In_ PVOID  Buffer,
+    _In_ ULONG  Length
     );
 
 extern NTSTATUS
@@ -198,7 +198,7 @@ RegistryFreeSzValue(
 
 extern VOID
 RegistryFreeBinaryValue(
-    _In_ PVOID          Buffer
+    _In_ PVOID  Buffer
     );
 
 extern NTSTATUS
diff --git a/src/xenvif/settings.c b/src/xenvif/settings.c
index 1bf1dd8..b619da4 100644
--- a/src/xenvif/settings.c
+++ b/src/xenvif/settings.c
@@ -309,8 +309,8 @@ SettingsCopyInterfaceValue(
 
 static NTSTATUS
 SettingsCopyInterface(
-    _In_ PCHAR          InterfacePath,
-    _In_ PCHAR          InterfacePrefix,
+    _In_ PSTR           InterfacePath,
+    _In_ PSTR           InterfacePrefix,
     _In_ PANSI_STRING   OldGuid,
     _In_ PANSI_STRING   NewGuid
     )
@@ -458,7 +458,7 @@ fail1:
 
 static NTSTATUS
 SettingsCopy(
-    _In_ PCHAR          SubKeyName,
+    _In_ PSTR           SubKeyName,
     _In_ PANSI_STRING   OldGuid,
     _In_ PNET_LUID      OldLuid,
     _In_ PANSI_STRING   NewGuid,
@@ -530,9 +530,9 @@ fail1:
 
 NTSTATUS
 SettingsSave(
-    _In_ PCHAR      SubKeyName,
-    _In_ PWCHAR     Alias,
-    _In_ PWCHAR     Description,
+    _In_ PSTR       SubKeyName,
+    _In_ PWSTR      Alias,
+    _In_ PWSTR      Description,
     _In_ LPGUID     InterfaceGuid,
     _In_ PNET_LUID  InterfaceLuid
     )
@@ -601,9 +601,9 @@ fail1:
 
 NTSTATUS
 SettingsRestore(
-    _In_ PCHAR      SubKeyName,
-    _In_ PWCHAR     Alias,
-    _In_ PWCHAR     Description,
+    _In_ PSTR       SubKeyName,
+    _In_ PWSTR      Alias,
+    _In_ PWSTR      Description,
     _In_ LPGUID     InterfaceGuid,
     _In_ PNET_LUID  InterfaceLuid
     )
diff --git a/src/xenvif/settings.h b/src/xenvif/settings.h
index 4d88235..e3a340c 100644
--- a/src/xenvif/settings.h
+++ b/src/xenvif/settings.h
@@ -35,18 +35,18 @@
 
 extern NTSTATUS
 SettingsSave(
-    _In_ PCHAR      SubKeyName,
-    _In_ PWCHAR     Alias,
-    _In_ PWCHAR     Description,
+    _In_ PSTR       SubKeyName,
+    _In_ PWSTR      Alias,
+    _In_ PWSTR      Description,
     _In_ LPGUID     InterfaceGuid,
     _In_ PNET_LUID  InterfaceLuid
     );
 
 extern NTSTATUS
 SettingsRestore(
-    _In_ PCHAR      SubKeyName,
-    _In_ PWCHAR     Alias,
-    _In_ PWCHAR     Description,
+    _In_ PSTR       SubKeyName,
+    _In_ PWSTR      Alias,
+    _In_ PWSTR      Description,
     _In_ LPGUID     InterfaceGuid,
     _In_ PNET_LUID  InterfaceLuid
     );
-- 
2.55.0.windows.5



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

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

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