Skip to content

Check against IntPtr.Zero, not null #1

@ViRb3

Description

@ViRb3

For an example here:

// Open handle to the target process
IntPtr ProcHandle = OpenProcess(
ProcessAccessFlags.All,
false,
ProcId);
if (ProcHandle == null)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[!] Handle to target process could not be obtained!");
Console.ForegroundColor = ConsoleColor.White;
System.Environment.Exit(1);
}

The result will never be null, but it could be of type IntPtr.Zero, which is what you are trying to check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions