From 19138f3f62914d321cc1bff9a2f1910ca9ac6ee0 Mon Sep 17 00:00:00 2001 From: Mike Richmond Date: Mon, 1 Aug 2016 14:50:22 -0700 Subject: [PATCH] Fixing reverse PInvoke worker callback pointer structure layout to synchronize it between managed and unmanaged code. --- .../engine/remoting/fanin/WSManPluginFacade.cs | 2 +- src/powershell-native/nativemsh/pwrshplugin/pwrshplugindefs.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs index b2143f8f6..56fef4394 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs @@ -360,7 +360,7 @@ namespace System.Management.Automation.Remoting /// /// Structure definition to match the native one. - /// NOTE: The layout of this structure must be IDENTICAL between here and WSManPluginEntryDelegates in pwrshplugin.h! + /// NOTE: The layout of this structure must be IDENTICAL between here and PwrshPluginWkr_Ptrs in pwrshplugindefs.h! /// [StructLayout(LayoutKind.Sequential)] internal class WSManPluginEntryDelegatesInternal diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugindefs.h b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugindefs.h index b34f6a6ee..aaea69d91 100644 --- a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugindefs.h +++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugindefs.h @@ -115,6 +115,9 @@ typedef void (WINAPI *WSManPluginSignalFuncPtr)( __in_opt PVOID commandContext, __in PCWSTR code); +typedef void (WINAPI *WSManPluginOperationShutdownFuncPtr)( + __in PVOID pluginContext); + typedef struct _PwrshPluginWkr_Ptrs { ShutdownPluginFuncPtr shutdownPluginFuncPtr; @@ -126,6 +129,7 @@ typedef struct _PwrshPluginWkr_Ptrs WSManPluginReceiveFuncPtr wsManPluginReceiveFuncPtr; WSManPluginSignalFuncPtr wsManPluginSignalFuncPtr; WSManPluginConnectFuncPtr wsManPluginConnectFuncPtr; + WSManPluginOperationShutdownFuncPtr wsmanPluingOperationShutdownFuncPtr; // This ptr is not used in this environment, but is required to keep the memory layout identical between unmanaged and managed code. } PwrshPluginWkr_Ptrs; class PlugInException