示例#1
0
        public static LsaAuthHandle Connect(string name)
        {
            NtStatus status;
            AnsiString nameStr;
            IntPtr handle;
            LsaOperationalMode mode;

            nameStr = new AnsiString(name);

            try
            {
                if ((status = Win32.LsaRegisterLogonProcess(
                    ref nameStr,
                    out handle,
                    out mode
                    )) >= NtStatus.Error)
                    Win32.Throw(status);
            }
            finally
            {
                nameStr.Dispose();
            }

            return new LsaAuthHandle(handle, true);
        }
        public static LsaAuthHandle Connect(string name)
        {
            IntPtr handle;
            LsaOperationalMode mode;

            AnsiString nameStr = new AnsiString(name);

            try
            {
                Win32.LsaRegisterLogonProcess(
                    ref nameStr,
                    out handle,
                    out mode
                    ).ThrowIf();
            }
            finally
            {
                nameStr.Dispose();
            }

            return new LsaAuthHandle(handle, true);
        }
 public static extern NtStatus LsaLookupAuthenticationPackage(
     [In] IntPtr LsaHandle,
     [In] ref AnsiString PackageName,
     [Out] out int AuthenticationPackage
     );
 public ConsoleCommand(int x, int y, AnsiString value)
 {
     X     = x;
     Y     = y;
     Value = value;
 }
示例#5
0
 public static extern NtStatus LsaRegisterLogonProcess(
     [In] ref AnsiString LogonProcessName,
     [Out] out IntPtr LsaHandle,
     [Out] out LsaOperationalMode SecurityMode
     );
        public TokenHandle LogonUser(
            string originName,
            SecurityLogonType logonType,
            IAuthenticationPackage package,
            TokenSource source,
            out object profileData,
            out Luid logonId,
            out NtStatus subStatus
            )
        {
            IntPtr profileBuffer;
            int profileBufferLength;
            IntPtr token;
            QuotaLimits quotas;

            AnsiString originNameStr = new AnsiString(originName);

            try
            {
                using (MemoryRegion logonData = package.GetAuthData())
                {
                    Win32.LsaLogonUser(
                        this,
                        ref originNameStr,
                        logonType,
                        this.LookupAuthenticationPackage(package.PackageName),
                        logonData,
                        logonData.Size,
                        IntPtr.Zero,
                        ref source,
                        out profileBuffer,
                        out profileBufferLength,
                        out logonId,
                        out token,
                        out quotas,
                        out subStatus
                        ).ThrowIf();

                    using (new LsaMemoryAlloc(profileBuffer, true))
                    {
                        profileData = package.GetProfileData(new MemoryRegion(profileBuffer, 0, profileBufferLength));
                    }

                    return new TokenHandle(token, true);
                }
            }
            finally
            {
                originNameStr.Dispose();
            }
        }
        public int LookupAuthenticationPackage(string packageName)
        {
            int authenticationPackage;

            AnsiString packageNameStr = new AnsiString(packageName);

            try
            {
                Win32.LsaLookupAuthenticationPackage(
                    this,
                    ref packageNameStr,
                    out authenticationPackage
                    ).ThrowIf();
            }
            finally
            {
                packageNameStr.Dispose();
            }

            return authenticationPackage;
        }
示例#8
0
 public static extern NtStatus RtlUpcaseUnicodeStringToAnsiString(
     ref AnsiString DestinationString,
     [In] ref UnicodeString SourceString,
     [In] bool AllocateDestinationString
     );
示例#9
0
 private static extern void DelayLoadedFunc(int hWnd, AnsiString text, AnsiString caption, Cardinal uType);
示例#10
0
 private static extern void MyDllFuncUninstall(int hWnd, AnsiString text, AnsiString caption, Cardinal uType);
示例#11
0
        public int LookupAuthenticationPackage(string packageName)
        {
            NtStatus status;
            AnsiString packageNameStr;
            int authenticationPackage;

            packageNameStr = new AnsiString(packageName);

            try
            {
                if ((status = Win32.LsaLookupAuthenticationPackage(
                    this,
                    ref packageNameStr,
                    out authenticationPackage
                    )) >= NtStatus.Error)
                    Win32.Throw(status);
            }
            finally
            {
                packageNameStr.Dispose();
            }

            return authenticationPackage;
        }
示例#12
0
        private static void OnTimedEvent(Object source, ElapsedEventArgs e)
        {
            switch (gameState)
            {
            case GameState.Idle:
            {
                gameState = GameState.Start;
                LoadScreen("Start.txt");
                break;
            }

            case GameState.Playing:
            {
                timerValue += 1;
                var random = new Random();

                // Spawn food items
                var foodCommand = new ConsoleCommand(random.Next(0, 79), random.Next(1, 39), AnsiString.Create(characterBrushes[4].ToString()).Blue());
                foodCommand.Execute();
                gameBuffer.Add(foodCommand);

                // Spawn lives
                if (random.Next(10) == 0)
                {
                    var liveCommand = new ConsoleCommand(random.Next(0, 79), random.Next(1, 39), AnsiString.Create(characterBrushes[5].ToString()).Red());
                    liveCommand.Execute();
                    gameBuffer.Add(liveCommand);
                }

                // Spawn enemies
                if (random.Next(3) == 0)
                {
                    AnsiString enemy;

                    if (random.Next(1) == 0)
                    {
                        enemy = AnsiString.Create(characterBrushes[random.Next(6, 8)].ToString()).Blue();
                    }
                    else
                    {
                        enemy = AnsiString.Create(characterBrushes[random.Next(6, 8)].ToString()).Red();
                    }

                    var enemyCommand = new ConsoleCommand(random.Next(0, 79), random.Next(1, 39), enemy);
                    enemyCommand.Execute();
                    gameBuffer.Add(enemyCommand);
                }

                // Remove items
                if (gameBuffer.Count > 0 && (timerValue > 5) && (timerValue % 2 == 0))
                {
                    var first = gameBuffer.First();
                    first.Clear();
                    gameBuffer.Remove(first);
                }

                // Increase game speed
                if (gameSpeed > 100)
                {
                    gameSpeed     -= 1;
                    timer.Interval = gameSpeed;
                }

                UpdateHeader();
                break;
            }

            case GameState.GameOver:
            {
                break;
            }

            default:
                break;
            }
        }
示例#13
0
        private static void ConsoleListener_MouseEvent(MOUSE_EVENT_RECORD r)
        {
            if (!updatingHeader && r.dwButtonState == 1 && (r.dwMousePosition.X != previousMousePositionX || r.dwMousePosition.Y != previousMousePositionY))
            {
                var gameObjectFound = gameBuffer.FirstOrDefault(cc => cc.X == r.dwMousePosition.X && cc.Y == r.dwMousePosition.Y);
                if (gameObjectFound != null)
                {
                    gameObjectFound.Clear();
                    gameBuffer.Remove(gameObjectFound);

                    if (gameObjectFound.Value.Text[0] == characterBrushes[4])
                    {
                        score += 1;
                    }
                    else if (gameObjectFound.Value.Text[0] == characterBrushes[5])
                    {
                        lives += 1;
                    }
                    else if (gameObjectFound.Value.Text[0] == characterBrushes[6] || gameObjectFound.Value.Text[0] == characterBrushes[7] || gameObjectFound.Value.Text[0] == characterBrushes[8])
                    {
                        lives -= 1;
                        Console.Beep();
                        if (lives == 0)
                        {
                            LoadScreen("End.txt");
                            gameState = GameState.GameOver;
                        }
                    }
                }

                var newCommand = new ConsoleCommand(r.dwMousePosition.X, r.dwMousePosition.Y, AnsiString.Create(activeBrush.ToString()).Colored(activeColor, ConsoleColor.Black));

                newCommand.Execute();
                commandBuffer.Add(newCommand);
                previousMousePositionX = r.dwMousePosition.X;
                previousMousePositionY = r.dwMousePosition.Y;
            }
        }