VS.NET 도움말에서 "Win32_NTLogEvent" 항목을 찾아보면 다음과 같은 설명이 나옵니다.
The Win32_NTLogEvent WMI class is used to translate instances from the Windows NT event log. An application must have SeSecurityPrivilege in order to receive events from the security event log, otherwise "Access Denied" is returned to the application.
즉, "SeSecurityPrivilege" 가 있어야 한다는 거죠.
확실히 장담할 수는 없지만, Windows 2003 의 경우에는 .NET WMI 클래스가 정상적으로 특권설정을 하는 것 같은 데, Windows 2000 의 경우에는 그렇지 못해서 결국 "Access Denied" 예외가 발생하게 됩니다.
따라서, 첨부된 COM 개체를 .NET 프로젝트에서 참조한 후 다음과 같이 코드를 작성하면 됩니다.
Win32LegacyLib.SecuritiesClass priv = new Win32LegacyLib.SecuritiesClass();
priv.EnablePrivilege( "SeSecurityPrivilege" );
_watcher = new ManagementEventWatcher( new EventQuery("SELECT * FROM __InstanceCreationEvent WHERE TargetInstance ISA 'Win32_NTLogEvent'"));
_watcher.EventArrived += new EventArrivedEventHandler(Arrived);
_watcher.Start();
Title |
11165 | 정성태 | 3/27/2017 | 25568 | 오류 유형: 381. Visual C++에서 min, max 함수를 사용한 경우 C2589, C2059 컴파일 오류 발생 | |
11164 | 정성태 | 3/27/2017 | 34345 | VC++: 111. C++ 클래스의 상속에 따른 메모리 구조 [2] | 1 |
11163 | 정성태 | 3/25/2017 | 23855 | VC++: 110. CreateThread Win32 API에 C++ 클래스의 멤버 함수를 전달하는 방법 | 1 |
11162 | 정성태 | 3/24/2017 | 28533 | 오류 유형: 380. Visual Studio 빌드 실패 - The OutputPath property is not set for project | |
11161 | 정성태 | 3/24/2017 | 18872 | 오류 유형: 379. ICOMAdminCatalog.GetCollection 호출 시 0x80070422 예외 발생 | |
11160 | 정성태 | 3/23/2017 | 25818 | .NET Framework: 649. ASP.NET - Server cannot append header after HTTP headers have been sent. (HTTP 헤더를 보낸 후에는 서버에서 헤더를 추가할 수 없습니다.) | 1 |
11159 | 정성태 | 3/23/2017 | 23108 | Windows: 136. Memory-mapped File은 Private Bytes 크기에 포함될까요? | 1 |
11158 | 정성태 | 3/22/2017 | 21163 | 디버깅 기술: 85. Windbg - SOS 디버깅 사례 System.NullReferenceException 예외 추적 | |
11157 | 정성태 | 3/22/2017 | 24320 | .NET Framework: 648. Dictionary<TKey, TValue>를 deep copy하는 방법 | 1 |
11156 | 정성태 | 3/21/2017 | 26510 | .NET Framework: 647. 닷넷(C#) 코드로 인증서 요청 코드 만드는 방법 | 1 |
11155 | 정성태 | 3/21/2017 | 26989 | .NET Framework: 646. SslStream의 CipherAlgorithm 선택이 가능할까요? | 1 |
11154 | 정성태 | 3/5/2017 | 32185 | VC++: 109. DLL에서 STL 객체를 인자/반환값으로 갖는 함수를 제공할 때, 그 함수를 외부에서 사용하는 경우 비정상 종료한다면? [2] | 1 |
11153 | 정성태 | 3/5/2017 | 32455 | VC++: 108. DLL에 정의된 C++ template 클래스의 복사 생성자 문제 | 1 |
11152 | 정성태 | 3/4/2017 | 27768 | VC++: 107. VirtualAlloc, HeapAlloc, GlobalAlloc, LocalAlloc, malloc, new의 차이점 [1] | 1 |
11151 | 정성태 | 3/3/2017 | 26964 | VC++: 106. DLL 개발자가 주의해야 할 Secure CRT 함수 사용 [1] | 1 |
11150 | 정성태 | 2/21/2017 | 22737 | .NET Framework: 645. Visual Studio Fakes 기능에서 Shim... 클래스가 생성되지 않는 경우 [5] | |
11149 | 정성태 | 2/21/2017 | 26710 | 오류 유형: 378. A 64-bit test cannot run in a 32-bit process. Specify platform as X64 to force test run in X64 mode on X64 machine. | |
11148 | 정성태 | 2/20/2017 | 25970 | .NET Framework: 644. AppDomain에 대한 단위 테스트 시 알아야 할 사항 | |
11147 | 정성태 | 2/19/2017 | 23326 | 오류 유형: 377. Windows 10에서 Fake 어셈블리를 생성하는 경우 빌드 시 The type or namespace name '...' does not exist in the namespace 컴파일 오류 발생 | |
11146 | 정성태 | 2/19/2017 | 23779 | 오류 유형: 376. Error VSP1033: The file '...' does not contain a recognized executable image. [2] | |
11145 | 정성태 | 2/16/2017 | 25229 | .NET Framework: 643. 작업자 프로세스(w3wp.exe)가 재시작되는 시점을 알 수 있는 방법 - 두 번째 이야기 [4] | 1 |
11144 | 정성태 | 2/6/2017 | 28576 | .NET Framework: 642. C# 개발자를 위한 Win32 DLL export 함수의 호출 규약 (부록 1) - CallingConvention.StdCall, CallingConvention.Cdecl에 상관없이 왜 호출이 잘 될까요? | 1 |
11143 | 정성태 | 2/5/2017 | 26516 | .NET Framework: 641. [Out] 형식의 int * 인자를 가진 함수에 대한 P/Invoke 호출 방법 | 1 |
11142 | 정성태 | 2/5/2017 | 33877 | .NET Framework: 640. 닷넷 - 배열 크기의 한계 [2] | 1 |
11141 | 정성태 | 1/31/2017 | 28706 | .NET Framework: 639. C# 개발자를 위한 Win32 DLL export 함수의 호출 규약 (4) - CLR JIT 컴파일러의 P/Invoke 호출 규약 [1] | 1 |
11140 | 정성태 | 1/27/2017 | 23355 | .NET Framework: 638. RSAParameters와 RSA | 1 |