The Microsoft SDL – Developer Starter Kit offers 14 modules of content, labs, and training to help you establish a standardized approach to rolling out security development policies and industry best practices into your organization.
Download it here
Category Archives: Articles
Check if a service is installed with ServiceController using LINQ
If you want to check if a specific NT Service is installed you will need to use the ServiceController class (from System.ServiceProcess). The first problem you will encounter is that the ServiceController has no static method, that would return a Boolean, specifying if the service is installed or not (e.g. ServiceController.IsInstalled(‘MyService’);) – so, to solve this you need to fetch the list of all installed services, using the static method ServiceController.GetServices(), which returns an array of ServiceController[], and then iterate thru all the elements to see if “MyService” is on that list. Now, this is not a problem, is just too much code for such a simple task. If you use LINQ things are simple: basically you will iterate thru the list, but in a much focused and simple way.
Reading image metadata with .net 3.0
When you take a picture today your digital camera, something is stored in the JPG file other than the image itself: digital cameras store information such as camera model, date taken, metering mode, focal length shutter speed and in some cases a small thumbnail image; some news agencies, such as Reuters (see chopper.jpg image in this example) also add comments and other information. In this article we’ll show how to read this information using the new classes in WPF’s System.Windows.Media namespace.