本文整理汇总了C#中IntPtr.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.Equals方法的具体用法?C# IntPtr.Equals怎么用?C# IntPtr.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntPtr
的用法示例。
在下文中一共展示了IntPtr.Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindWindowWithThreadProcessId
internal static IntPtr FindWindowWithThreadProcessId(int processId)
{
var window = new IntPtr();
Win32Helpers.EnumWindows(delegate(IntPtr wnd, IntPtr param)
{
var windowProcessId = 0;
Win32Helpers.GetWindowThreadProcessId(wnd, out windowProcessId);
if (windowProcessId == processId)
{
window = wnd;
return false;
}
return true;
},
IntPtr.Zero);
if (window.Equals(IntPtr.Zero))
{
UnityEngine.Debug.LogError("Could not find any window with process id " + processId);
}
return window;
}
示例2: runTest
public virtual bool runTest()
{
Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
IntPtr ip1;
IntPtr ip2;
Int32 iValue;
try {
strLoc = "Loc_743wg";
iValue = 16;
ip1 = new IntPtr(iValue);
ip2 = new IntPtr(iValue);
iCountTestcases++;
if(!ip1.Equals(ip2)){
iCountErrors++;
Console.WriteLine("Err_865sg! Wrong value returned");
}
strLoc = "Loc_9047tdsg";
iValue = 16;
ip1 = new IntPtr(iValue);
ip2 = new IntPtr(iValue*2);
iCountTestcases++;
if(ip1.Equals(ip2)){
iCountErrors++;
Console.WriteLine("Err_9765sgf! Wrong value returned");
}
strLoc = "Loc_98736zdg";
iValue = 16;
ip1 = new IntPtr(iValue);
iCountTestcases++;
if(ip1.Equals(iValue)){
iCountErrors++;
Console.WriteLine("Err_9756gf! Wrong value returned");
}
strLoc = "Loc_98736zdg";
iValue = 16;
ip1 = new IntPtr(iValue);
iCountTestcases++;
if(ip1.Equals(null)){
iCountErrors++;
Console.WriteLine("Err_973sdg! Wrong value returned");
}
} catch (Exception exc_general ) {
++iCountErrors;
Console.WriteLine(s_strTFAbbrev +" Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general);
}
if ( iCountErrors == 0 )
{
Console.Error.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
return true;
}
else
{
Console.Error.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}
示例3: PosTest1
public bool PosTest1()
{
bool retVal = true;
try
{
System.IntPtr ip = new IntPtr(0);
if (ip.Equals(null))
{
TestLibrary.TestFramework.LogError("001", "expect new IntPtr(0).Equals(null)");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
示例4: PosTest2
unsafe public bool PosTest2()
{
bool retVal = true;
try
{
byte* mem = stackalloc byte[1024];
System.IntPtr ip1 = new IntPtr((void*)mem);
System.IntPtr ip2 = new IntPtr((void*)mem);
if (!ip1.Equals(ip2))
{
TestLibrary.TestFramework.LogError("002", "expect two IntPtr equals");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
示例5: LoadProcess
public static bool LoadProcess(string applicationPath, bool ignoreCase = false)
{
string processName = Path.GetFileNameWithoutExtension(applicationPath);
foreach (Process p in Process.GetProcessesByName(processName))
{
if (ignoreCase)
{
if (p.MainModule.FileName.ToLower().Equals(applicationPath.ToLower()))
proc = p;
}
else
{
if (p.MainModule.FileName.Equals(applicationPath))
proc = p;
}
}
if (proc == null) return false;
BaseAddress = (Int32)proc.MainModule.BaseAddress;
procHwnd = OpenProcess(PROC_RW, false, proc.Id);
if (procHwnd.Equals(IntPtr.Zero)) return false;
return true;
}
示例6: OnReconnectCmdCompleted
private static void OnReconnectCmdCompleted(IntPtr operationContext,
int flags,
IntPtr error,
IntPtr shellOperationHandle,
IntPtr commandOperationHandle,
IntPtr operationHandle,
IntPtr data)
{
long cmdContextId = 0;
WSManClientCommandTransportManager cmdTM = null;
if (!TryGetCmdTransportManager(operationContext, out cmdTM, out cmdContextId))
{
// We dont have the command TM handle..just return.
tracer.WriteLine("Unable to find a transport manager for the given command context {0}.", cmdContextId);
return;
}
if ((!shellOperationHandle.Equals(cmdTM._wsManShellOperationHandle)) ||
(!commandOperationHandle.Equals(cmdTM._wsManCmdOperationHandle)))
{
// WSMan returned data from a wrong shell..notify the caller
// about the same.
tracer.WriteLine("Cmd Signal callback: ShellOperationHandles are not the same as the signal is initiated with");
PSRemotingTransportException e = new PSRemotingTransportException(RemotingErrorIdStrings.ReconnectShellCommandExCallBackError);
TransportErrorOccuredEventArgs eventargs =
new TransportErrorOccuredEventArgs(e, TransportMethodEnum.ReconnectShellCommandEx);
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
if (IntPtr.Zero != error)
{
WSManNativeApi.WSManError errorStruct = WSManNativeApi.WSManError.UnMarshal(error);
if (errorStruct.errorCode != 0)
{
tracer.WriteLine("OnReconnectCmdCompleted callback: WSMan reported an error: {0}", errorStruct.errorDetail);
TransportErrorOccuredEventArgs eventargs = WSManTransportManagerUtils.ConstructTransportErrorEventArgs(
cmdTM._sessnTm.WSManAPIData.WSManAPIHandle,
null,
errorStruct,
TransportMethodEnum.ReconnectShellCommandEx,
RemotingErrorIdStrings.ReconnectShellCommandExCallBackError,
new object[] { WSManTransportManagerUtils.ParseEscapeWSManErrorMessage(errorStruct.errorDetail) });
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
}
// The command may have been disconnected before all input was read or
// the returned command data started to be received.
cmdTM._shouldStartReceivingData = true;
cmdTM.SendOneItem();
cmdTM.RaiseReconnectCompleted();
}
示例7: OnRemoteCmdSendCompleted
private static void OnRemoteCmdSendCompleted(IntPtr operationContext,
int flags,
IntPtr error,
IntPtr shellOperationHandle,
IntPtr commandOperationHandle,
IntPtr operationHandle,
IntPtr data)
{
tracer.WriteLine("SendComplete callback received");
long cmdContextId = 0;
WSManClientCommandTransportManager cmdTM = null;
if (!TryGetCmdTransportManager(operationContext, out cmdTM, out cmdContextId))
{
// We dont have the command TM handle..just return.
tracer.WriteLine("Unable to find a transport manager for the command context {0}.", cmdContextId);
return;
}
cmdTM._isSendingInput = false;
// do the logging for this send
PSEtwLog.LogAnalyticInformational(PSEventId.WSManSendShellInputExCallbackReceived,
PSOpcode.Connect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic,
cmdTM.RunspacePoolInstanceId.ToString(), cmdTM.powershellInstanceId.ToString());
if ((!shellOperationHandle.Equals(cmdTM._wsManShellOperationHandle)) ||
(!commandOperationHandle.Equals(cmdTM._wsManCmdOperationHandle)))
{
tracer.WriteLine("SendShellInputEx callback: ShellOperationHandles are not the same as the Send is initiated with");
// WSMan returned data from a wrong shell..notify the caller
// about the same.
PSRemotingTransportException e = new PSRemotingTransportException(RemotingErrorIdStrings.CommandSendExFailed);
TransportErrorOccuredEventArgs eventargs =
new TransportErrorOccuredEventArgs(e, TransportMethodEnum.CommandInputEx);
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
// release the resources related to send
cmdTM.ClearReceiveOrSendResources(flags, true);
// if the transport manager is already closed..ignore the errors and return
if (cmdTM.isClosed)
{
tracer.WriteLine("Client Command TM: Transport manager is closed. So returning");
if (cmdTM._isDisconnectPending)
{
cmdTM.RaiseReadyForDisconnect();
}
return;
}
if (IntPtr.Zero != error)
{
WSManNativeApi.WSManError errorStruct = WSManNativeApi.WSManError.UnMarshal(error);
// Ignore Command aborted error. Command aborted is raised by WSMan to
// notify command operation complete. PowerShell protocol has its own
// way of notifying the same using state change events.
if ((errorStruct.errorCode != 0) && (errorStruct.errorCode != 995))
{
tracer.WriteLine("CmdSend callback: WSMan reported an error: {0}", errorStruct.errorDetail);
TransportErrorOccuredEventArgs eventargs = WSManTransportManagerUtils.ConstructTransportErrorEventArgs(
cmdTM._sessnTm.WSManAPIData.WSManAPIHandle,
null,
errorStruct,
TransportMethodEnum.CommandInputEx,
RemotingErrorIdStrings.CommandSendExCallBackError,
new object[] { WSManTransportManagerUtils.ParseEscapeWSManErrorMessage(errorStruct.errorDetail) });
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
}
// Send the next item, if available
cmdTM.SendOneItem();
}
示例8: OnRemoteCmdDataReceived
private static void OnRemoteCmdDataReceived(IntPtr operationContext,
int flags,
IntPtr error,
IntPtr shellOperationHandle,
IntPtr commandOperationHandle,
IntPtr operationHandle,
IntPtr data)
{
tracer.WriteLine("Remote Command DataReceived callback.");
long cmdContextId = 0;
WSManClientCommandTransportManager cmdTM = null;
if (!TryGetCmdTransportManager(operationContext, out cmdTM, out cmdContextId))
{
// We dont have the command TM handle..just return.
tracer.WriteLine("Unable to find a transport manager for the given command context {0}.", cmdContextId);
return;
}
if ((!shellOperationHandle.Equals(cmdTM._wsManShellOperationHandle)) ||
(!commandOperationHandle.Equals(cmdTM._wsManCmdOperationHandle)))
{
// WSMan returned data from a wrong shell..notify the caller
// about the same.
tracer.WriteLine("CmdReceive callback: ShellOperationHandles are not the same as the Receive is initiated with");
PSRemotingTransportException e = new PSRemotingTransportException(RemotingErrorIdStrings.CommandReceiveExFailed);
TransportErrorOccuredEventArgs eventargs =
new TransportErrorOccuredEventArgs(e, TransportMethodEnum.ReceiveCommandOutputEx);
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
// release the resources related to receive
cmdTM.ClearReceiveOrSendResources(flags, false);
// if the transport manager is already closed..ignore the errors and return
if (cmdTM.isClosed)
{
tracer.WriteLine("Client Command TM: Transport manager is closed. So returning");
return;
}
if (IntPtr.Zero != error)
{
WSManNativeApi.WSManError errorStruct = WSManNativeApi.WSManError.UnMarshal(error);
if (errorStruct.errorCode != 0)
{
tracer.WriteLine("CmdReceive callback: WSMan reported an error: {0}", errorStruct.errorDetail);
TransportErrorOccuredEventArgs eventargs = WSManTransportManagerUtils.ConstructTransportErrorEventArgs(
cmdTM._sessnTm.WSManAPIData.WSManAPIHandle,
null,
errorStruct,
TransportMethodEnum.ReceiveCommandOutputEx,
RemotingErrorIdStrings.CommandReceiveExCallBackError,
new object[] { errorStruct.errorDetail });
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
}
if (flags == (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_RECEIVE_DELAY_STREAM_REQUEST_PROCESSED)
{
cmdTM._isDisconnectedOnInvoke = true;
cmdTM.RaiseDelayStreamProcessedEvent();
return;
}
WSManNativeApi.WSManReceiveDataResult dataReceived = WSManNativeApi.WSManReceiveDataResult.UnMarshal(data);
if (null != dataReceived.data)
{
tracer.WriteLine("Cmd Received Data : {0}", dataReceived.data.Length);
PSEtwLog.LogAnalyticInformational(
PSEventId.WSManReceiveShellOutputExCallbackReceived, PSOpcode.Receive, PSTask.None,
PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic,
cmdTM.RunspacePoolInstanceId.ToString(),
cmdTM.powershellInstanceId.ToString(),
dataReceived.data.Length.ToString(CultureInfo.InvariantCulture));
cmdTM.ProcessRawData(dataReceived.data, dataReceived.stream);
}
}
示例9: OnRemoteSessionSendCompleted
private static void OnRemoteSessionSendCompleted(IntPtr operationContext,
int flags,
IntPtr error,
IntPtr shellOperationHandle,
IntPtr commandOperationHandle,
IntPtr operationHandle,
IntPtr data)
{
tracer.WriteLine("Client Session TM: SendComplete callback received");
long sessionTMHandle = 0;
WSManClientSessionTransportManager sessionTM = null;
if (!TryGetSessionTransportManager(operationContext, out sessionTM, out sessionTMHandle))
{
// We dont have the session TM handle..just return.
tracer.WriteLine("Unable to find a transport manager for context {0}.", sessionTMHandle);
return;
}
// do the logging for this send
PSEtwLog.LogAnalyticInformational(PSEventId.WSManSendShellInputExCallbackReceived,
PSOpcode.Connect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic,
sessionTM.RunspacePoolInstanceId.ToString(), Guid.Empty.ToString());
if (!shellOperationHandle.Equals(sessionTM._wsManShellOperationHandle))
{
// WSMan returned data from a wrong shell..notify the caller
// about the same.
PSRemotingTransportException e = new PSRemotingTransportException(
PSRemotingErrorInvariants.FormatResourceString(RemotingErrorIdStrings.SendExFailed, sessionTM.ConnectionInfo.ComputerName));
TransportErrorOccuredEventArgs eventargs =
new TransportErrorOccuredEventArgs(e, TransportMethodEnum.SendShellInputEx);
sessionTM.ProcessWSManTransportError(eventargs);
return;
}
sessionTM.ClearReceiveOrSendResources(flags, true);
// if the session is already closed ignore the errors and return.
if (sessionTM.isClosed)
{
tracer.WriteLine("Client Session TM: Transport manager is closed. So returning");
return;
}
if (IntPtr.Zero != error)
{
WSManNativeApi.WSManError errorStruct = WSManNativeApi.WSManError.UnMarshal(error);
// Ignore operation aborted error. operation aborted is raised by WSMan to
// notify operation complete. PowerShell protocol has its own
// way of notifying the same using state change events.
if ((errorStruct.errorCode != 0) && (errorStruct.errorCode != 995))
{
tracer.WriteLine("Got error with error code {0}. Message {1}", errorStruct.errorCode, errorStruct.errorDetail);
TransportErrorOccuredEventArgs eventargs = WSManTransportManagerUtils.ConstructTransportErrorEventArgs(
sessionTM.WSManAPIData.WSManAPIHandle,
sessionTM,
errorStruct,
TransportMethodEnum.SendShellInputEx,
RemotingErrorIdStrings.SendExCallBackError,
new object[] { sessionTM.ConnectionInfo.ComputerName, WSManTransportManagerUtils.ParseEscapeWSManErrorMessage(errorStruct.errorDetail) });
sessionTM.ProcessWSManTransportError(eventargs);
return;
}
}
// Send the next item, if available
sessionTM.SendOneItem();
}
示例10: OnRemoteSessionDataReceived
// WSMan will make sure this callback is synchronously called ie., if 1 callback
// is active, the callback will not be called from a different thread.
private static void OnRemoteSessionDataReceived(IntPtr operationContext,
int flags,
IntPtr error,
IntPtr shellOperationHandle,
IntPtr commandOperationHandle,
IntPtr operationHandle,
IntPtr data)
{
tracer.WriteLine("Client Session TM: OnRemoteDataReceived callback.");
long sessionTMHandle = 0;
WSManClientSessionTransportManager sessionTM = null;
if (!TryGetSessionTransportManager(operationContext, out sessionTM, out sessionTMHandle))
{
// We dont have the session TM handle..just return.
tracer.WriteLine("Unable to find a transport manager for context {0}.", sessionTMHandle);
return;
}
sessionTM.ClearReceiveOrSendResources(flags, false);
if (sessionTM.isClosed)
{
tracer.WriteLine("Client Session TM: Transport manager is closed. So returning");
return;
}
if (!shellOperationHandle.Equals(sessionTM._wsManShellOperationHandle))
{
// WSMan returned data from a wrong shell..notify the caller
// about the same.
PSRemotingTransportException e = new PSRemotingTransportException(
PSRemotingErrorInvariants.FormatResourceString(RemotingErrorIdStrings.ReceiveExFailed, sessionTM.ConnectionInfo.ComputerName));
TransportErrorOccuredEventArgs eventargs =
new TransportErrorOccuredEventArgs(e, TransportMethodEnum.ReceiveShellOutputEx);
sessionTM.ProcessWSManTransportError(eventargs);
return;
}
if (IntPtr.Zero != error)
{
WSManNativeApi.WSManError errorStruct = WSManNativeApi.WSManError.UnMarshal(error);
if (errorStruct.errorCode != 0)
{
tracer.WriteLine("Got error with error code {0}. Message {1}", errorStruct.errorCode, errorStruct.errorDetail);
TransportErrorOccuredEventArgs eventargs = WSManTransportManagerUtils.ConstructTransportErrorEventArgs(
sessionTM.WSManAPIData.WSManAPIHandle,
sessionTM,
errorStruct,
TransportMethodEnum.ReceiveShellOutputEx,
RemotingErrorIdStrings.ReceiveExCallBackError,
new object[] { sessionTM.ConnectionInfo.ComputerName, WSManTransportManagerUtils.ParseEscapeWSManErrorMessage(errorStruct.errorDetail) });
sessionTM.ProcessWSManTransportError(eventargs);
return;
}
}
WSManNativeApi.WSManReceiveDataResult dataReceived = WSManNativeApi.WSManReceiveDataResult.UnMarshal(data);
if (null != dataReceived.data)
{
tracer.WriteLine("Session Received Data : {0}", dataReceived.data.Length);
PSEtwLog.LogAnalyticInformational(
PSEventId.WSManReceiveShellOutputExCallbackReceived, PSOpcode.Receive, PSTask.None,
PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic,
sessionTM.RunspacePoolInstanceId.ToString(),
Guid.Empty.ToString(),
dataReceived.data.Length.ToString(CultureInfo.InvariantCulture));
sessionTM.ProcessRawData(dataReceived.data, dataReceived.stream);
}
}
示例11: TestEquals
public static void TestEquals(IntPtr ptr1, object obj, bool expected)
{
if (obj is IntPtr)
{
IntPtr ptr2 = (IntPtr)obj;
Assert.Equal(expected, ptr1 == ptr2);
Assert.Equal(!expected, ptr1 != ptr2);
Assert.Equal(expected, ptr1.GetHashCode().Equals(ptr2.GetHashCode()));
}
Assert.Equal(expected, ptr1.Equals(obj));
Assert.Equal(ptr1.GetHashCode(), ptr1.GetHashCode());
}
示例12: NegTest2
public bool NegTest2()
{
bool retVal = true;
try
{
int anyAddr = TestLibrary.Generator.GetInt32(-55);
if (anyAddr == Int32.MaxValue)
anyAddr -= 1;
else if (anyAddr == Int32.MinValue)
anyAddr += 1;
System.IntPtr ip1 = new IntPtr(anyAddr);
System.IntPtr ip2 = new IntPtr(anyAddr + 1);
System.IntPtr ip3 = new IntPtr(anyAddr - 1);
if (ip1.Equals(ip2))
{
TestLibrary.TestFramework.LogError("002", "expect two IntPtrs NOT equals");
retVal = false;
}
if (ip1.Equals(ip3))
{
TestLibrary.TestFramework.LogError("002", "expect two IntPtrs NOT equals");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
示例13: NegTest1
unsafe public bool NegTest1()
{
bool retVal = true;
try
{
byte* mem1 = stackalloc byte[1];
byte* mem2 = stackalloc byte[1];
mem1[0] = mem1[0] = TestLibrary.Generator.GetByte(-55);
System.IntPtr ip1 = new IntPtr((void*)mem1);
System.IntPtr ip2 = new IntPtr((void*)mem2);
if (ip1.Equals(ip2))
{
TestLibrary.TestFramework.LogError("001", "expect two IntPtrs NOT equals");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
示例14: OnRemoteCmdSignalCompleted
private static void OnRemoteCmdSignalCompleted(IntPtr operationContext,
int flags,
IntPtr error,
IntPtr shellOperationHandle,
IntPtr commandOperationHandle,
IntPtr operationHandle,
IntPtr data)
{
tracer.WriteLine("Signal Completed callback received.");
long cmdContextId = 0;
WSManClientCommandTransportManager cmdTM = null;
if (!TryGetCmdTransportManager(operationContext, out cmdTM, out cmdContextId))
{
// We dont have the command TM handle..just return.
tracer.WriteLine("Unable to find a transport manager for the given command context {0}.", cmdContextId);
return;
}
// log the callback received event.
PSEtwLog.LogAnalyticInformational(PSEventId.WSManSignalCallbackReceived,
PSOpcode.Disconnect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic,
cmdTM.RunspacePoolInstanceId.ToString(), cmdTM.powershellInstanceId.ToString());
if ((!shellOperationHandle.Equals(cmdTM._wsManShellOperationHandle)) ||
(!commandOperationHandle.Equals(cmdTM._wsManCmdOperationHandle)))
{
// WSMan returned data from a wrong shell..notify the caller
// about the same.
tracer.WriteLine("Cmd Signal callback: ShellOperationHandles are not the same as the signal is initiated with");
PSRemotingTransportException e = new PSRemotingTransportException(RemotingErrorIdStrings.CommandSendExFailed);
TransportErrorOccuredEventArgs eventargs =
new TransportErrorOccuredEventArgs(e, TransportMethodEnum.CommandInputEx);
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
// release the resources related to signal
if (IntPtr.Zero != cmdTM._cmdSignalOperationHandle)
{
WSManNativeApi.WSManCloseOperation(cmdTM._cmdSignalOperationHandle, 0);
cmdTM._cmdSignalOperationHandle = IntPtr.Zero;
}
if (null != cmdTM._signalCmdCompleted)
{
cmdTM._signalCmdCompleted.Dispose();
cmdTM._signalCmdCompleted = null;
}
// if the transport manager is already closed..ignore the errors and return
if (cmdTM.isClosed)
{
tracer.WriteLine("Client Command TM: Transport manager is closed. So returning");
return;
}
if (IntPtr.Zero != error)
{
WSManNativeApi.WSManError errorStruct = WSManNativeApi.WSManError.UnMarshal(error);
if (errorStruct.errorCode != 0)
{
tracer.WriteLine("Cmd Signal callback: WSMan reported an error: {0}", errorStruct.errorDetail);
TransportErrorOccuredEventArgs eventargs = WSManTransportManagerUtils.ConstructTransportErrorEventArgs(
cmdTM._sessnTm.WSManAPIData.WSManAPIHandle,
null,
errorStruct,
TransportMethodEnum.CommandInputEx,
RemotingErrorIdStrings.CommandSendExCallBackError,
new object[] { WSManTransportManagerUtils.ParseEscapeWSManErrorMessage(errorStruct.errorDetail) });
cmdTM.ProcessWSManTransportError(eventargs);
return;
}
}
cmdTM.EnqueueAndStartProcessingThread(null, null, true);
}
示例15: LookForMalware
private bool LookForMalware(IntPtr map, ulong length)
{
if(!map.Equals(IntPtr.Zero) && length != 0)
{
int index = this._kmp.Search(map, (uint) length);
if (index != -1)
return true;
Debug.WriteLine(String.Format("length = {0} KMP returned = {1}", length, index));
}
return false;
}
开发者ID:nektra,项目名称:improving-deviare-hooking-performance-with-custom-hooks,代码行数:14,代码来源:DeviarePlugin.cs