Update: There is a new post on this subject regarding the Surface SDK SP1, and itβs also verified working on Win7 x64 too π
If you are lucky enough to have access to a Surface and/or it’s corresponding SDK, you may have tried to install that SDK on a 64bit Vista installation. If you did you will have been greeted by the following delightful error message:
"Your system does not have the correct version of Windows Vista. You must install Microsoft Surface SDK 1.0 on a 32-bit version of Windows Vista Business, Windows Vista Enterprise, or Windows Vista Ultimate with Service Pack 1 (SP1)."
Rather than grab a different machine with a 32bit install, I thought I’d see whether it was possible to get it up and running on x64. Although it turned out to be quite simple to get working, with no registry hackery required, there may be good reasons why this configuration isn’t supported, so use these instructions at your own risk!
To get things up and running you will need the following:
- Orca – An MSI editor that is part of the Windows SDK. You can grab from the Microsoft download page, or wherever your search engine of choice takes you.
- Visual Studio 2008 – You might be able to use C# Express, but I haven’t tried it.
There is nothing particularly nasty in these instructions, but it does involve using the command line.
Step 1 – The MSI
Firstly we need to use Orca to tweak the launch conditions of the MSI. Make sure you’ve installed all of the SDK pre-requisites first, then walk through the following:
- Install Orca (link above, or just search for it).
- Copy the SurfaceSDK.msi to somewhere on your hard disk, and make sure that it’s not Read Only.
- Right click on the MSI and choose Edit with Orca. This will trigger a UAC, but it’s software from Microsoft, so you should be ok to trust it π
- Select "LaunchCondition" in the left hand list, then select "Install OR NOT VersionNT64" in the right hand list (see below).
- Press delete and click OK when asked to confirm the row delete.
- Click Save on the toolbar.
Now if you launch are freshly edited MSI you should be able to install it just fine – hurrah! If you try and launch the simulator though then it will crash almost immediately – boo!
We will fix that though in Step 2…
Step 2 – The Simulator
The reason for the almost immediate crash is due to the assemblies being built for "Any CPU", while relying on a library than only exists for x86. When the simulator starts up it launches in 64bit mode and, because you can’t mix x86 and x64 assemblies, it tries to load the x64 version of XNA (which doesn’t exist) and promptly falls over in a giggling heap.
If this was an app we had written, we could simply change the configuration in Visual Studio to x86 and everything would be rosy (more on this later). Unfortunately I don’t happen to have the source code for the SDK knocking around, so we have to resort to a utility that comes with Visual Studio called CorFlags to force everything to load in 32Bit mode. The following instructions assume you have everything installed in default locations, but they should be easily adaptable if you don’t:
- Go and find the "Visual Studio 2008 Command Prompt" from your start menu (All Programs, Visual Studio 2008, Visual Studio Tools) right click on it and choose "Run as administrator" (accepting the resulting UAC prompt).
- Change to "C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\Simulator".
- Enter "corflags SurfaceSimulator.exe /32bit+ /force" (without the quotes). We need to use /force because the assemblies are strong named signed, and altering them this way will invalidate that signature. This is unfortunately unavoidable, but I haven’t found any problems from doing so. You will receive a CF011 warning informing you of this π
- Change to "C:\Program Files (x86)\Microsoft Surface\v1.0".
- Use the same corflags syntax from step 3 on the following files, one by one: Attract.exe, AttractConfig.exe, SurfaceInput.exe, SurfaceOutOfOrder.exe, SurfaceShell.exe.
- Close the command prompt and launch the simulator!
Now we’re at this point we need to make sure our Surface applications are set to run in 32Bit mode, or they will just crash when we launch them. This is very simple to do in Visual Studio, and changing this is usually the first step in troubleshooting any weird and wonderful x64 development glitches.
Step 3 – Our Applications
Setting our applications to 32Bit is extremely easy. You may think this is crippling our applications a bit, but all of the Surface units are running Vista 32 so it really doesn’t make a difference (other than making them work on x64!)
- Launch Visual Studio 2008, and either open a solution or create a new one.
- Enter Configuration Manager (if you drop down the "Any CPU" box, there’s an option in there).
- Under "Active solution platform", select
- Select x86 as the Type, Copy settings from Any CPU and make sure "Create new project platforms" is selected:
- Click OK
The Platform column for each of your projects should now read "x86", and you should be able to launch your Surface applications in the simulator.
Job done! π
As I said earlier, there may be good reasons why x64 isn’t a supported platform, so this method falls strictly in the "it works on my machine" camp.
I’m going to have to see if that works on Windows 7, which also says no…
It does indeed.. although the sim runs like a dog on every machine I’ve installed it on so far π
Nice work man, i applied this to Windows Server 2008 64 bit and all is good. Thanks for the homework.
I tried this on x64 vista but the Simulator crashed after step 2. here is what i did:
open VS 2008 command prompt:
cd C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\Simulator
corflags SurfaceSimulator.exe /32bit+ /force
cd C:\Program Files (x86)\Microsoft Surface\v1.0
corflags Attract.exe /32bit+ /force
corflags AttractConfig.exe /32bit+ /force
corflags SurfaceInput.exe /32bit+ /force
corflags SurfaceOutOfOrder.exe /32bit+ /force
corflags SurfaceShell.exe /32bit+ /force
closed command prompt and launc Simulator causes this error:
Description:
Stopped working
Problem signature:
Problem Event Name: APPCRASH
Application Name: SurfaceSimulator.exe
Application Version: 1.0.31001.0
Application Timestamp: 48e3b443
Fault Module Name: KERNEL32.dll
Fault Module Version: 6.0.6001.18000
Fault Module Timestamp: 4791a81d
Exception Code: e0434f4d
Exception Offset: 0002f35f
OS Version: 6.0.6001.2.1.0.256.6
Locale ID: 1033
did i miss something?
Looks fine to me, I assume you have all the prerequisites installed? Does SurfaceInput crash or just the sim?
Steven, thanks for the reply. Yes, for the pre-reqs I have Visual C# 2005 w/SP 1 installed for the XNA Studio 2 pre-req and VS 2008 w/SP 1 for the Surface SDK 1.0 pre-req. Windows Update shows no outstanding updates after checking for updates.
The SurfaceInput.exe crashes, all of the exe’s that we’re forced to 32 bit mode on are crashing – All of the exe’s in this folder “C:\Program Files (x86)\Microsoft Surface\v1.0” crash except “setupcustomaction.exe”. Do you think something is awry with my vista install?
Certainly sounds a bit wierd, is the crash the same crash that happens before CorFlags, or something else?
I would suggest uninstalling the SDK and trying again, but it sounds like you’ve followed the steps correctly so I’m not sure that would help.
Steven, turns out my new dell E6400 was a lemon. They sent a new one and everything now works fine. thanks again for the post.
Excellent! It would be interesting to know what the problem actually was, but as long as it’s working now π Do you have an actual Surface to play around with?
When I tried to run the simulator I got an error and after this I realized that some of the files are missing.
I dont have the files listed in Step 2.5. I dont have any executables in the v.1.0 folder.
Tried to reinstall but there was no change.
Any suggestions?
Not sure, are you sure you’re looking in the “correct” Program Files? I’m guessing the installer went wrong if it hasn’t copied all the files across.. no idea why though.
I tried to kind of brute force it by extracting the Surface MSI and putting the EXE files in the v1.0 directory but I still getting the same error.
It says: “Error occured in SurfaceInput. SurfaceInput is terminating…
System.BadImageFormatException: is not a valid Win32 application” and some hex..
I manage to fix it.
Btw, if you are lefty and have switched mouse buttons the Surface simulator doesnt like this π
Good news! What was the fix in the end?
I had the same problem as Vasco. It looks like the version of the simulator we have installs the simulator in not one but two directories. Make sure you run the corflags fix in both
C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0 and
C:\Program Files (x86)\Microsoft Surface\v1.0
Thank you, this article saved my bacon. I had just upgraded to a new Dell XPS Studio with quad Core i7, 6gigs of RAM and Vista Ultimate 64. Came as a shock when I tried to install the SDK.
I think MS is not doing themselves a favor making it such a pain for surface development on 64bit. So what if the unit runs 32, more and more MS devs are using 64bit machines. VS takes up way too much memory some days to be limited to only 4gigs of RAM.
What was the solution to:
System.BadImageFormatException: is not a valid Win32 application
Some of the files were in the wrong directory apparently.. user error π
@Vasco and @srobbins – Any chance you could point out the file location oddities that caused the System.BadIMageFormatException error? I haven’t brute forced anything just installed and followed the steps above. A quick “this file should be in this directory”, etc should help me out.
For the record: I only had to remove a launchcondition or two more and all works fine in Win7. What a relieve. That removes me from needing to have the actual unit in my office. The sound and temperature changes were getting to me a bit π Now, let’s start developing on my nice HP Touchsmart… Great post.
Yeah, I’ve had it running on Win7, just haven’t got around to updating the post.. It’s an “exercise for the reader” π
Now, I try to do the trick again for SP1 of the SDK. Unfortunately there are some other tweaks needed. There’s probably something else in the MSI that conflicts. The install rollsback when it’s almost at the end. I had a look at the MSI script, but can’t figure out what’s the offending part.
Btw: I’m running Windows 7 RC 64 bits.
Bart, did you get this running? I have exactly the same problem. Nothing in the event log or anywhere I can find to tell what is happening?
Ok, just got SP1 working on Vista Ultimate x64. I’m way behind in my work so maybe someone else can put together a tutorial. Basically follow the x64 tutorial from above, but while in MSIEdi or Orca find the InstallExecuteSequence table. Look for the two SQM steps (SetupCreateSQMMachineGuid and CreateSQMMachineGuid) and remove them. Install as usual. Then when you do the 32-bit force on all the executables, remember to do the same to Attract.exe. Other than that is seems to work. Hope it helps some people.
Thanks for the comment.. I am putting together a new post for SP1, but I’ve only just reinstalled my x64 box so it’s taking a while! Glad you got it going.
this page is a godsend for us that demand to have modern development rigs but still need to develop for surface. I can understand they want the requirements to be the same or as close to what the real unit is but this is getting ridiculous.
Thanks for the CreateSqmMachineGuid update. I had just tracked it down that it was failing at that point. good ole msiexec /i SurfaceSDKWE.msi /L*v log.txt
To make it a little easier on people, you can copy and paste this into your command prompt to do the 32bit updates
cd “C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\Simulator”
corflags SurfaceSimulator.exe /32bit+ /force
cd “C:\Program Files (x86)\Microsoft Surface\v1.0”
corflags Attract.exe /32bit+ /force
corflags AttractConfig.exe /32bit+ /force
corflags SurfaceInput.exe /32bit+ /force
corflags SurfaceOutOfOrder.exe /32bit+ /force
corflags SurfaceShell.exe /32bit+ /force
Thanks for that, I’m looking at putting a script together that will do the whole lot (or that’s the plan anyway), just haven’t had chance yet π
For those of us doing the web install of the SDK to get Orca, which of the install options do we need to get *just* Orca? (save on 1.5GB of bandwidth!)
For Windows 7 removing the 64bit check is not enough – you also have to remove the OS version & Service pack check, or else you will get the error “Your system does not have the correct service pack.”
Yep, although that’s not the case with SP1 (see the updated link). Is there a specific reason why you are using the original SDK rather than SP1 now?
hi, when i try to install the new sdk modified via orca, at the finish of the install process it says that there is a problem and then it rollback unistalling the sdk π
thank you
David
Is it the SP1 version you’re installing? Take a look at the updated article if it is, there’s an additional step required.
After removing the sqm bit from the msi file, it worked like a sharm.
Thanks!
hi,
i’m at step 2.5
corflags Attract.exe /32bit+ /force
corflags AttractConfig.exe /32bit+ /force
corflags SurfaceInput.exe /32bit+ /force
corflags SurfaceOutOfOrder.exe /32bit+ /force
corflags SurfaceShell.exe /32bit+ /force
And i get a error:
corflags : error CF001 : Could not open file for writing
Thanks, Iria
It sounds like a permission issue, are you sure you’re running it from an elevated VS command prompt?
Hi,
I run it as administrator and now i get this:
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.21022.8
Copyright (c) Microsoft Corporation. All rights reserved.
corflags : warning CF011 : The specified file is strong name signed. Using /For
ce will invalidate the signature of this image and will require the assembly to
be resigned.
But i can’t run the simulator, i get a error the simulator is not working anymore.
Thanks,
Iria
Did you patch all of the assemblies? Is the crash giving you any more information in the event log?
Hi,
Tried installing the surface sdk, but kept getting an error about not meeting the minimum resolution required. How can this be fixed?
I don’t think there’s anything you can do about this. The Simulator runs at the native Surface resolution (1024×768), but also adds the Simulator “chrome” around the outside, so you really need 1024 high to be able to use it.
Your only option is probably an external monitor (if you’re using a laptop) or cranking your resolution up if you are using a monitor.
any way to run this at 1280 x800 removing the check in surface simulator.exe?
thanks
\
I don’t think so, it’s very annoying when working on a portable laptop. If it was any smaller though you’d lose the top toolbar so wouldn’t be able to change input mode, orientation etc.
To get the samples to build and install correctly do the following:
– Edit the configuration properties for the sample solution and create an x86 platform for all projects.
– Edit InstallSamples.bat
– Comment out the lines on either side of the set as follows:
::FOR /F “eol=H tokens=2*” %%A IN (‘REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Surface\v1.0 /v IsLogicalSurfaceUnit’) DO SET LogicalTableValue=%%B
SET InstallingOnTable=false
::IF %LogicalTableValue%==0x1 SET InstallingOnTable=true
– Change the MSBuildParameters to reference the x86 PlatformName as follows:
SET MSBuildParameters=/p:Configuration=Release;PlatformName=x86 /noconsolelogger /fl /fileLoggerParameters:LogFile=%LogFile%;Append /nologo
Thanks Robin, very useful.
[…] is a follow up post to Surface SDK on Vista x64 where we got the original Surface SDK working on the unsupported Vista X64. Last week Microsoft […]
Sorry but i have a problem with surface + windows 7:
I follow all the instruction but when I start the Simulator the Shell stop its execution and i can’t interact with the simulator, i can only close the application……
thanks for help
ok fix it:
go into cd c:\Program files (x86)\Microsoft Surface\v1.0
then copy and paste this command:
for %i in (*.exe) do corflags %i /32bit+ /force
so you are sure that all files forced to work in 32bit.
Bye
Worked for only one test…..now the error return……
can anyone help me?
Awesome, thank you so much for this workaround. I have tried to get that simulator working on 4 different machines, all of which for one reason or another did not like the install.
But thanks to you I now have it running on Win764bit on an i5 laptop and it and the samples runs like a dream…I was getting desperate since I needed it for my MA presentation; you literally saved my MA!