Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9143873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:07:52+00:00 2026-06-17T10:07:52+00:00

I have to start by saying that I am very much a programming noob.

  • 0

I have to start by saying that I am very much a programming noob. I do not understand all the compiler options or nuances of the IDE, not by a longshot. But I am trying to teach myself more about native programming languages. (I’m decent with C#, but that is much easier than C as I am discovering.)

Today, I wrote this small program in C. It is a console/command line program. I used Visual Studio 2012 and my development machine alternates between Windows 7 and 8, 64 bit. To start, what I did was create a new VC++ project, and I chose a Blank Project. Then I created a new app.c file. I also created a *.rc file to give the executable some extra properties like “File Version” and “Company Name” when you browse the file properties in Windows Explorer. Then I went to the properties of the project, chose Configuration Properties -> C/C++ -> Code Generation and I changed Runtime Library to “Multi-threaded (/MT) so that I wouldn’t have to distribute the msvcr100.dll file along with my executable.

In the app.c file, I placed the following code:

#include <stdio.h>
#include <string.h>
#include <Windows.h>
#include <WtsApi32.h>
#pragma comment(lib, "WtsApi32.lib")

void main(int argc, char *argv[])
{
    char *helpMsg = "blah";
    char *hostName, *connState = "";
    char *addrFamily = "";
    HANDLE hHost = NULL;

    ...stuff and so forth and so on...
}

Then I built/compiled the program, and the executable works just fine on Windows 7, 8, Server 2008R2, Server 2012, all 64 bit. But when I try to run the program on Server 2003 (and I am guessing WinXP, etc., as well,) I am greeted with the Windows dialog box:

“Foo.exe is not a valid Win32 application.”

So my question is, is there something obvious/simple that I am missing that will allow this executable to also work on earlier XP/2003/32bit platforms that I am missing? I do not believe that I am using any 64-bit exclusive features in my program. But I figured that since I did choose “Blank Project” instead of “Win32 Console Application” that I may be missing some setting.

Edit: Here is the dumpbin.exe /headers output when run against my exe:

Microsoft (R) COFF/PE Dumper Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\users\me\Release\foo.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
         14C machine (x86)
           5 number of sections
    50F604BC time date stamp Tue Jan 15 19:39:08 2013
           0 file pointer to symbol table
           0 number of symbols
          E0 size of optional header
         102 characteristics
               Executable
               32 bit word machine

OPTIONAL HEADER VALUES
         10B magic # (PE32)
       11.00 linker version
        7800 size of code
        A200 size of initialized data
           0 size of uninitialized data
        16A7 entry point (004016A7) _mainCRTStartup
        1000 base of code
        9000 base of data
      400000 image base (00400000 to 00414FFF)
        1000 section alignment
         200 file alignment
        6.00 operating system version
        0.00 image version
        6.00 subsystem version
           0 Win32 version
       15000 size of image
         400 size of headers
           0 checksum
           3 subsystem (Windows CUI)
        8140 DLL characteristics
               Dynamic base
               NX compatible
               Terminal Server Aware
      100000 size of stack reserve
        1000 size of stack commit
      100000 size of heap reserve
        1000 size of heap commit
           0 loader flags
          10 number of directories
           0 [       0] RVA [size] of Export Directory
        D374 [      3C] RVA [size] of Import Directory
       11000 [     538] RVA [size] of Resource Directory
           0 [       0] RVA [size] of Exception Directory
           0 [       0] RVA [size] of Certificates Directory
       12000 [     C04] RVA [size] of Base Relocation Directory
        9160 [      38] RVA [size] of Debug Directory
           0 [       0] RVA [size] of Architecture Directory
           0 [       0] RVA [size] of Global Pointer Directory
           0 [       0] RVA [size] of Thread Storage Directory
        CF98 [      40] RVA [size] of Load Configuration Directory
           0 [       0] RVA [size] of Bound Import Directory
        9000 [     118] RVA [size] of Import Address Table Directory
           0 [       0] RVA [size] of Delay Import Directory
           0 [       0] RVA [size] of COM Descriptor Directory
           0 [       0] RVA [size] of Reserved Directory


SECTION HEADER #1
.text name
7670 virtual size
1000 virtual address (00401000 to 0040866F)
7800 size of raw data
 400 file pointer to raw data (00000400 to 00007BFF)
   0 file pointer to relocation table
   0 file pointer to line numbers
   0 number of relocations
   0 number of line numbers
60000020 flags
     Code
     Execute Read

SECTION HEADER #2
.rdata name
49E2 virtual size
9000 virtual address (00409000 to 0040D9E1)
4A00 size of raw data
7C00 file pointer to raw data (00007C00 to 0000C5FF)
   0 file pointer to relocation table
   0 file pointer to line numbers
   0 number of relocations
   0 number of line numbers
40000040 flags
     Initialized Data
     Read Only

Debug Directories

    Time Type       Size      RVA  Pointer
-------- ------ -------- -------- --------
50F604BC cv           61 0000CFE0     BBE0    Format: RSDS, {582D0FF2-59C1-4633-AF2A-E4A4AD6BFA2C}, 1, C:\Users\me\Release\users.pdb
50F604BC feat         10 0000D044     BC44    Counts: Pre-VC++ 11.00=0, C/C++=116, /GS=116, /sdl=0

SECTION HEADER #3
.data name
2C04 virtual size
E000 virtual address (0040E000 to 00410C03)
 E00 size of raw data
C600 file pointer to raw data (0000C600 to 0000D3FF)
   0 file pointer to relocation table
   0 file pointer to line numbers
   0 number of relocations
   0 number of line numbers
C0000040 flags
     Initialized Data
     Read Write

SECTION HEADER #4
.rsrc name
 538 virtual size
11000 virtual address (00411000 to 00411537)
 600 size of raw data
D400 file pointer to raw data (0000D400 to 0000D9FF)
   0 file pointer to relocation table
   0 file pointer to line numbers
   0 number of relocations
   0 number of line numbers
 40000040 flags
     Initialized Data
     Read Only

 SECTION HEADER #5
.reloc name
235C virtual size
12000 virtual address (00412000 to 0041435B)
2400 size of raw data
DA00 file pointer to raw data (0000DA00 to 0000FDFF)
   0 file pointer to relocation table
   0 file pointer to line numbers
   0 number of relocations
   0 number of line numbers
 42000040 flags
     Initialized Data
     Discardable
     Read Only

Summary

    3000 .data
    5000 .rdata
    3000 .reloc
    1000 .rsrc
    8000 .text

I have also tried going to Project Properties -> Linker -> System: Minimum Required Version and changing that to 5.00 and 1.00 or whatever, but it has no effect. dumpbin.exe still reports the OS version as 6.00. I have even used editbin.exe /version 5.00 on the exe and no errors were reported… and yet dumpbin.exe still reports 6.00 for the OS version.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:07:53+00:00Added an answer on June 17, 2026 at 10:07 am

    I figured it out myself. (But thank you Hans for steering me in the right direction.) For some reason, even with Update 1 and even after setting my toolset to v110_xp, and setting the minimum required version to 5.01 in the Linker options, the resulting dumpbin app.exe /headers still reports a minimum operating system version of 6.0.

    So I simply ran

    editbin.exe app.exe /SUBSYSTEM:CONSOLE,5.01 /OSVERSION:5.1
    

    And the executable now runs just fine on older operating systems. I’m thinking there still might be a little bit of a bug somewhere in Visual Studio.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll start by saying that I have searched SO and not found an answer
First, I'll start off by saying that I do not have control over the
I should start by saying that I am very much a noobie with interfaces
I'll start off by saying I'm a noob with all of this, I have
Let me start by saying that I'm not a power-JavaScript/jQuery programmer, I do very
So I'll start of by saying I'm not very familiar with Perl. I have
Let me start off by saying that I am very new to WPF and
Let me start by saying, I am new to Java programming. I have coded
Let me start by saying Javascript is not my strong point, and all of
I'm going to start by saying that i am very new to flash and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.