These days, in time of trying different methods of Inter-Process communication i found one very interesting issue concerning usage of MmSecureVirtualMemory , and that on Michael Howard’s blog, so that give me some reasons for code review and for sure using Prefast over some classes. It is true that the amount of code for Windows NT kernel-mode applications is not comparable with that used in day by day applications but the implications of that code is at least twice heavy.
Here comes the issue :
If you run PREfast on code using this function and it’s not in a try/except block, you may get this warning:
253 – MmSecureVirtualMemory locks VADs not pages.
Additional Information: Dereferences must still be protected by try-except.
The advice for this warning at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcepbguide5/html/wce50grfPREfastWarning253.asp is simple:
MmSecureVirtualMemory(NULL, 0, 0);
; // use something else
So than, have fun by low-level development.