Exemple #1
0
    private void CreateProcessAndExit(string FilePath)
    {
        uint           ProcessId = 0u;
        SafeFileHandle Handle    = new SafeFileHandle(IntPtr.Zero, false);

        try
        {
            Handle = NativeHelper.CreateProcessInternalWithDll(FilePath, KrkrMode.NORMAL, ref ProcessId);
        }
        catch (DllNotFoundException e)
        {
            MessageBox.Show("LoaderHelper.dll not found", "KrkrExtract", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            Environment.Exit(0);
        }

        if (Handle.IsInvalid)
        {
            MessageBox.Show("Failed to create process...\nCode :" + Marshal.GetLastWin32Error(), "KrkrExtract", MessageBoxButtons.OK, MessageBoxIcon.Error);
            Environment.Exit(-1);
        }
        Handle.Close();
        Environment.Exit(0);
    }