Installing .Net 3.5.1 on Windows 2008 R2



Attack Surface Analyzer


My team here at Microsoft Security Engineering Center just released our latest tool for the SDL, Attack Surface Analyzer.  Dave has already blogged about the tool: https://blogs.msdn.com/b/sdl/archive/2011/01/17/announcing-attack-surface-analyzer.aspx.

In the new few weeks, the team and I will be blogging a little bit more about what the tool does and how the tool's functionality can be extended.


Attack Surface Analyzer x86 and x64 Download Link


Our original download link for the tool only had x64 msi.  We had since fixed it with a new download link.  However, most of the search engines have the original link as the top result.  If you need the x86 version of the tool, please use this go link: https://go.microsoft.com/?linkid=9758398.


Automated Runs on Start Up


Note: this is for a non domain joined computer. 

This is the scenario that I want.  Once windows boot up, it logs onto a specific account automatically and then runs a program automatically.  Once that finishes, the operating system shuts down.

First step is to run "control userpasswords2" on xp or "netplwiz" on vista.  Do this via start->run or the windows+R key combo.  This app allows you to set up auto logon with a specific user.  When the top checkbox is checked, select a user, and then uncheck that checkbox.  Now enter the password and click ok.  Now, when the computer boots up, it will always automatically log on to the selected user.

To run a program on logon, there are actually a couple of options.  The easiest one is to just add a shortcut/batch file into the startup folder inside the start menu.  You can see a list of locations by running the autorun program from sysinternals at https://technet.microsoft.com/en-us/sysinternals/default.aspx.

To shut down the os once the designated program is done running, we want to have a batch file inside the startup folder.  That batch file will start the designated program and shutdown the os.  We can perform the shutdown portion by running the shutdown command.  For a full list of options, simply run "shutdown /?" inside the commandline.


Best Codeplex Project Ever?


Have you ever wanted an open source library that implemented hello world?  Neither have I, but someone went ahead and did it anyway:https://simplehelloworld.codeplex.com/.  Note one of the reviews came from the author himself.


Best Tech Ad of 2009?


Possibility the best tech Ad I've ever seen: https://www.everythingusb.com/intel-usb-rock-star-16620.html.  Good job, intel!


Bouncing Circle with HTML5 Canvas


 

This should work in ie9 and chrome.  However, if you use ie9, make sure you set the browser and document mode to IE9 standards.  There could be some refactor done on this code, but I wrote this in a few hours without any prior javascript or html5 experience:

test.html:

 

<html>

<head>

    <style type="text/css">  

      canvas { border: 1px solid black; }  

    </style>  

</head>

<body>

<script type="text/javascript" src="test.js"></script>

<button onclick="StartCircle()">startit!</button><br />

</body>

</html>

 

 

test.js:

var circle;

var path;

var canvas

var context

var keepgoing = true;

var maxwidth;

var maxheight;

var radius = 50;

var interval;

 

function StartCircle() {

    if (canvas == null) {

        canvas = document.createElement('canvas');

        document.getElementsByTagName('body')[0].appendChild(canvas);

    }

    maxwidth = Math.floor(Math.random() * 700 + 100);

    maxheight = Math.floor(Math.random() * 700 + 100);

 

    canvas.setAttribute("width", maxwidth);

    canvas.setAttribute("height", maxheight);

 

    context = canvas.getContext('2d');

 

    startwidth = Math.floor(Math.random() * (maxwidth - radius*2)) + radius;

    startheight = Math.floor(Math.random() * (maxheight - radius*2)) + radius;

 

    path = new Path(startwidth, startheight);

    circle = new Circle(startwidth, startheight, radius);

    if (interval != null)

        clearInterval(interval);

    interval  = setInterval(Draw, 1);

 

}

 

function BorderSwitch(x, y)

{

    var flipx = false;

    var flipy = false;

    if ((x+radius) == maxwidth || (x-radius) == 0)

        flipx = true;

    if ((y+radius) == maxheight || (y-radius) == 0)

        flipy = true;

 

    return new Flip(flipx, flipy);

}

 

function Flip(flipx, flipy)

{

    this.flipx = flipx;

    this.flipy = flipy;

}

 

function Path(x, y) {

    this.x = x;

    this.y = y;

    deltax = Math.floor(Math.random() * 2) == 0? -1: 1;

    deltay = Math.floor(Math.random() * 2) == 0 ? -1 : 1;

 

    this.GetNext = function () {

        var directionswitch = BorderSwitch(this.x, this.y);

        if (directionswitch.flipx == true)

            deltax *= -1;

        if (directionswitch.flipy == true)

            deltay *= -1;

 

        this.x += deltax;

        this.y += deltay;

 

    };

}

 

function Circle(x, y, radius) {

    this.x = x;

    this.y = y;

    this.radius = radius;

 

}

 

function Draw() {

    path.GetNext();

    circle.x = path.x;

    circle.y = path.y;

    context.clearRect(0, 0, maxwidth, maxheight);

    context.strokeStyle = "#000000";

    context.fillStyle = "#FFFF00";

    context.beginPath();

    context.arc(circle.x, circle.y, circle.radius, 0, Math.PI * 2, true);

    context.closePath();

    context.stroke();

    context.fill();

}


Building Both VS2008 and VS2010 on the Same TFS 2008 Server Using MSBuild


My team recently upgraded some of our Visual Studio solutions to be 2010 based in order to take advantage some of the new features in the IDE.  However, we quickly found out that the upgrade broke our build system.  In order to build both vs2010 projects and vs2008 projects on one machine, you want to have a side by side build system.  Here are some brief instructions that I used to get the whole thing working.

 

1. On your TFS 2008 build agent/controller/server, the one running tfsbuildservices.exe as the service "Visual Studio Team Foundation Build", install Visual Studio 2010 and the latest .NET 4.0.

2. Inside C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies, created a copy of tfsbuildservice.exe and the config file.

3. Inside the new config file, changed the ports to 9193 and
9194 and added msbuild to point to msbuild 4.0 binary under
windows\microsoft.net\framework\v4xxx\:

<add key="MSBuildPath" value="c:\windows\microsoft.net\Framework\v4.0.21006\" />

4. We need to reserve the port to be used by the user that will run our new service, in most cases, that is going to be Network Service:

wcfhttpconfig.exe reserve "NT AUTHORITY\NETWORK
SERVICE" 9193

5. Run the following to create the service

sc create "Visual Studio Team Foundation Build
VS2010" binpath= "C:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\PrivateAssemblies\tfsbuildservce2.exe"

6. Change the startup to automatic and logon account to NETWORK
SERVICE

7. Manually start service the first time around.

8. In windows(or whatever custom app) firewall, create a rule that allows tfsbuildservice2.exe
and port 9193

9. Create a new build agent that points to the build server but using port 9193 instead of the default 9191.

10. Now try to build a vs2010 solution using the new build agent.

 

If you get any error during the build, try some of the following.

Back up and make these changes to C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\*target file:

1. Not getting the reason property -> deleted the reason node in xml

2. Rolled back the WorkspaceName to the TFS Build 2008 version:

After VS 2010 installation:

$(COMPUTERNAME)_$(BuildDefinitionId)_$(BuildAgentId)

TFS Build 2008:

$(COMPUTERNAME)_$(BuildDefinitionId)