Creating A MASM Project Wizard For Visual Studio 2010

In my post Setting Up Visual Studio 10 For MASM32 Programming, we saw how to configure Visual Studio 2010 for masm programming. In this article I will show you the process of creating a project wizard for a masm console application. A project wizard is similar to a regular project template; however, the export to template does not allow for exporting and use of a C++ application. Since a C++ template was the basis for masm_demo we will be using a C++ Custom Wizard template to create our new masm wizard.  Let’s see how this is done.

  1. Create a new C++ Custom Wizard
  2. Uncheck user interface check box since we will not be displaying any screens.
  3. This step will require that you complete  Setting Up Visual Studio 10 For MASM32 Programming successfully. If you have then, open the masm_demo project in your favourite editor. Copy the contents of that file and use it to replace the contents of the default.vcproj in your wizard.
  4. Copy the source.asm from masm_demo project and paste it into Templates\1033\ folder of your wizard project.
  5. Delete the .txt from your wizard project and add the source.asm file from Templates\1033\.
  6. Replace contents of  Templates.inf and add source.asm
  7. Navigate to “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\VCWizards” then add a folder named “Macro Assembler”
  8. Replace all references to to the .txt file in default.js with “source.asm”
  9. Replace contents of Macro Assembler.vsz file with
                VSWIZARD 7.0
                Wizard=VsWizard.VsWizardEngine.10.0
    
                Param="WIZARD_NAME = Macro Assembler"
                Param="ABSOLUTE_PATH = C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\VCWizards\Macro Assembler"
                Param="FALLBACK_LCID = 1033"
                Param="WIZARD_UI = FALSE"
                Param="SOURCE_FILTER = asm"
                Param="PROJECT_TEMPLATE_PATH = C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\VCWizards\Macro Assembler"
              
  10. Replace .vsdir and .vsz files in C:\Users\[username]\Documents\Visual Studio 2010\Wizards with the ones from Macro Assembler project directory.
  11. Copy contents of Macro Assembler project directory and paste it into directory created at step 7
  12. Done :-) now when you run visual studio  you should see a new entry under Wizards thats says Macro Assembler. If you double click on that you will get a default masm project already set up for coding. Enjoy!

Setting Up Visual Studio 10 for MASM32 Programming

If you are like me and want the comfort and support that Microsoft’s Visual Studio 10 provides, then you will defiantly want that support in your MASM programming tasks. Visual studio makes this quite easy, with a couple of project property changes you will be on your way to MASM programming bliss.

Steps

  1. Create new Visual C++ Empty Project
  2. Right click on the newly created project and select Build Customizations; select masm option, press ok then save the project.
  3. Go to project properties and select linker->system then change subsystem to Windows (/SUBSYSTEM:CONSOLE)
  4. Download and install masm32 libraries then add them to your linker settings.
  5. Go to linker->Advanced and change Entry Point to main [this is what the linker will look for when mapping the entry point for your app.]
  6. Go to Linker->Input  and add masm32.lib to Additional Dependencies.
  7. Go to Microsoft Macro Assembler->General and add the masm32 libraries.
  8. Download and paste usertype.dat into C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
  9. Go to Visual Studio Options->Text Editor->File Extensions: Type asm in the extension box then select Microsoft Visual  C++ from the list.
  10. Right click on project and select Add->New Item: Select Text File and save with *.asm
  11. Create, run and enjoy your code :-)

In a future post I will show how to turn this project into a Visual Studio project template.