Why SuppressUnmanagedCodeSecurity?
Lachlan87I was browsing through some of the code that came with "Managed DirectX 9 Kick Start : Graphics and Game Programming" by Tom Miller, and I came across these lines of code: [code] ' We won't use this maliciously <System.Security.SuppressUnmanagedCodeSecurity()> Private Declare Function QueryPerformanceFrequency Lib "kernel32" (ByRef PerformanceFrequency As Long) As Boolean ' We won't use this maliciously <System.Security.SuppressUnmanagedCodeSecurity()> Private Declare Function QueryPerformanceCounter Lib "kernel32" (ByRef PerformanceCount As Long) As Boolean ' We won't use this maliciously <System.Security.SuppressUnmanagedCodeSecurity()> Public Declare Function timeGetTime Lib "winmm.dll" () As Integer [/code] Does anyone know why he supresses unmanaged code security? When I use an API I usually just type: [code]Declare Auto Function . . . . .[/code] What's better/different about his way? I thought his comments were hilarious! Rather like a school boy being made to write lines after he was bad! [:D]
Eric ColemanI'm not sure, but from what I've read it gives a performance boost. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/seccodeguide.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenetchapt05.asp
Lachlan87Interesting links Eric! Thanks!