5

When running a standard Windows 7 Installation Disk in recovery mode, if you open up the command line and run a custom-built application you will receive the error 'subsystem not supported'. I have tried linking with /SUBSYSTEM:CONSOLE, WINDOWS and NATIVE, none of these work.

I had a little difficulty with a partition table (and may have found a bug, or at least 'stupid' behaviour from the partition manager included in windows) and so wrote a utility to fix it. My program uses 'Windows.h' to import CreateFile, however if need be I can use only standard C++ (Or even standard C) with no windows specific headers.

What do I need to do to get an application running?

James
  • 1,569
  • 10
  • 18
  • 1
    What compiler are you using? Is this reproducible with a simple "Hello World" program, or do you get the problem when you start using CreateFile? What is the output of `objdump -p` on your program w.r.t. "Subsystem"? http://old.nabble.com/Finding-an-executable's-Windows-subsystem-td22897545.html – HostileFork says dont trust SE Jun 17 '12 at 06:33
  • Using visual studio 2010, C++ (Using static runtime), when I get a chance in an hour I will try using an empty project and then with just a printf. – James Jun 17 '12 at 06:39

2 Answers2

5

The Windows Recovery Environment is a superset of the Windows Preinstallation Environment.

Windows PE is a stripped down version of windows, lacking many subsystems including WoW (Windows on Windows).

This means that 32bit executables (or anything with a 32bit component) WILL NOT RUN on a 64-bit Windows PE disk. (Note that WinPE 32 cannot install/repair 64 bit systems and vice-versa).

The solution to my problem was to compile to 64 bit code -- a descriptive error message would have been nice Microsoft :|

Found after much searching: http://technet.microsoft.com/en-us/library/cc766093(v=ws.10).aspx

James
  • 1,569
  • 10
  • 18
0

Are you using the C++ CRT in any way? I don't think that's supported. I'd even doubt that CreateFile is appropriate; and look into NtCreateFile instead.

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • Well there _must_ be a runtime... There are a wide range of tools that run on the recovery console, does anyone know of a page where I can find the requirements? I couldn't turn up anything through google, but may have been typing the wrong thing. – James Jun 17 '12 at 09:22
  • 1
    You're thinking of the native runtime (http://technet.microsoft.com/en-us/sysinternals/bb897447.aspx). Fortunately recovery mode and Windows PE run in Win32, just with some components removed. – BCran Feb 12 '13 at 23:09