0
我有Silverlight庫項目中有大量控件。從Silverlight調用NtQueryTimerResolution
我想在某個時間點將PC定時器分辨率降低到5ms。
我試圖用NtQueryTimerResolution但有例外:
Attempt by security transparent method SetupTimer() to call native code through method
NtQueryTimerResolution(UInt32 ByRef, UInt32 ByRef, UInt32 ByRef) failed. Methods must be
security critical or security safe-critical to call native code.
的設置定時器方法有安全attribut就可以了..所以我不明白什麼是錯......
[SecuritySafeCritical]
private void SetupTimer()
{
uint resolution = 0;
NtSetTimerResolution(50000, true, ref resolution);
}