본문 바로가기

전체 글

(20)
[추천사이트] HotExamples https://csharp.hotexamples.com/ C# (CSharp) Code Examples - HotExamples Hot Examples - Source Code Usage Examples Aggregator This service was created to help programmers find real examples of using classes and methods as well as documentation. Our system automatically searches, retrieves and ranks examples of source code from csharp.hotexamples.com git에 올라와있는 코드들 중에서 실사용 예제를 긁어서 보여주는 홈페이지이다. API..
[C#] Pipe 통신 PipeBase.cs using System; using System.Collections.Generic; using System.IO.Pipes; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Common.Pipe { public abstract class PipeBase { // protected protected PipeStream pipeStream; protected Action asyncReaderStart; protected void StartByteReaderAsync(Action packetReceived) { int count = 4; byte[] bDataLength = new byte[cou..
[C#] 응용프로그램 실행 시 관리자권한 요청하게 하기 Visual Studio에서 빌드되는 응용프로그램에는 실행 시 관리자 권한을 요청하도록 빌드할 수 있다. 읽는이분들도 프로그램을 실행시켰을때 관리자 권한으로 실행할 것이냐는 사용자 계정 컨트롤 창을 본 기억이 있을 것이다. 프로젝트를 생성하고 프로젝트 우클릭 - 추가 - 응용 프로그램 매니페스트 파일 선택 .manifest 란 확장자를 가지고 있는 파일이 생성된 것이 보일 것이다. 파일을 열어보자. 처음 열어보면 이렇게 default로 작성되어 있을 것이다. 사진의 19번째 라인인 를 위에 주석처리 되어져 있는 로 교체하여 주면 끝난다.
[C#] Windows Service에서 현재 유저의 관리자 권한으로 프로세스 실행 internal class ApplicationLauncher { public enum TOKEN_INFORMATION_CLASS { TokenUser = 1, TokenGroups, TokenPrivileges, TokenOwner, TokenPrimaryGroup, TokenDefaultDacl, TokenSource, TokenType, TokenImpersonationLevel, TokenStatistics, TokenRestrictedSids, TokenSessionId, TokenGroupsAndPrivileges, TokenSessionReference, TokenSandBoxInert, TokenAuditPolicy, TokenOrigin, MaxTokenInfoClass // MaxTok..