diff --git a/NtApiDotNet/Win32/RpcServer.cs b/NtApiDotNet/Win32/RpcServer.cs
index c9f40f455..b86c452d7 100644
--- a/NtApiDotNet/Win32/RpcServer.cs
+++ b/NtApiDotNet/Win32/RpcServer.cs
@@ -56,8 +56,20 @@ public string FormatAsText()
/// The formatted RPC server.
public string FormatAsText(bool remove_comments)
{
- INdrFormatter formatter = DefaultNdrFormatter.Create(remove_comments
- ? DefaultNdrFormatterFlags.RemoveComments : DefaultNdrFormatterFlags.None);
+ return FormatAsText(remove_comments, false);
+ }
+
+ ///
+ /// Format the RPC server as text.
+ ///
+ /// True to remove comments from the output.
+ /// Formating using C++ pseduo syntax.
+ /// The formatted RPC server.
+ public string FormatAsText(bool remove_comments, bool cpp_format)
+ {
+ DefaultNdrFormatterFlags flags = remove_comments
+ ? DefaultNdrFormatterFlags.RemoveComments : DefaultNdrFormatterFlags.None;
+ INdrFormatter formatter = cpp_format ? CppNdrFormatter.Create(flags) : DefaultNdrFormatter.Create(flags);
StringBuilder builder = new StringBuilder();
if (!remove_comments)
{
diff --git a/NtObjectManager/NtObjectManager.psm1 b/NtObjectManager/NtObjectManager.psm1
index ffd731563..50ec0b8c7 100644
--- a/NtObjectManager/NtObjectManager.psm1
+++ b/NtObjectManager/NtObjectManager.psm1
@@ -3581,6 +3581,8 @@ This cmdlet formats a list of RPC servers as text.
The RPC servers to format.
.PARAMETER RemoveComments
When outputing as text remove comments from the output.
+.PARAMETER CppFormat
+Format output in C++ pseudo syntax rather than C++.
.INPUTS
RpcServer[] The RPC servers to format.
.OUTPUTS
@@ -3600,12 +3602,13 @@ function Format-RpcServer {
Param(
[parameter(Mandatory=$true, Position=0, ValueFromPipeline)]
[NtApiDotNet.Win32.RpcServer[]]$RpcServer,
- [switch]$RemoveComments
+ [switch]$RemoveComments,
+ [switch]$CppFormat
)
PROCESS {
foreach($server in $RpcServer) {
- $server.FormatAsText($RemoveComments) | Write-Output
+ $server.FormatAsText($RemoveComments, $CppFormat) | Write-Output
}
}
}