Re: MS VC 6.0 compiles EXE differently under 2000 vs XP

Tech-Archive recommends: Speed Up your PC by fixing your registry



- There are no paths in the EXE. I made release compiles to avoid this.
(Debug
compile shows a path: c:\dev\hworld\debug\hworld.pdb).
- The two drives with Win2k & WinXp are in the same computer, and either
drive is bootable by selecting the drive in BIOS. The dominant OS of the
moment will always be drive c. The Xp drive is a clone of the Win2k which
was then
upgraded to Xp, so source paths are identical.

- The binaries are available but unless emailed directly to you, I don't
know how to send them.
- Here is a diff of the DUMPBIN.EXE output. C: is the Win2k version, E: is
the Xp version.
Using the win2k OS, running the release EXE under the debugger, I traced
into the
first call which took me to the address '7C4EE01A'. As reported by
DEPENDS.EXE, this address corresponds to KERNEL32.DLL (base 0x7C4E0000,
743,184
bytes). All differences fall outside main() which is 0x00401153 to
0x00401202.

Examining memory at 0x00406000 shows addresses: 77FCC7D3 7C518DC3 7C4FE0C8
7C4F4B16...

Comparing files C:hworld.asm and E:HWORLD.ASM
***** C:hworld.asm
004010FA: 89 3D 30 99 40 00 mov dword ptr ds:[00409930h],edi
00401100: FF 15 58 60 40 00 call dword ptr ds:[00406058h]
00401106: 5F pop edi
***** E:HWORLD.ASM
004010FA: 89 3D 30 99 40 00 mov dword ptr ds:[00409930h],edi
00401100: FF 15 00 60 40 00 call dword ptr ds:[00406000h]
00401106: 5F pop edi
*****

***** C:hworld.asm
0040126F: 68 FF 00 00 00 push 0FFh
00401274: FF 15 58 60 40 00 call dword ptr ds:[00406058h]
0040127A: C3 ret
***** E:HWORLD.ASM
0040126F: 68 FF 00 00 00 push 0FFh
00401274: FF 15 00 60 40 00 call dword ptr ds:[00406000h]
0040127A: C3 ret
*****

***** C:hworld.asm
00402EDD: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00402EE3: FF 15 00 60 40 00 call dword ptr ds:[00406000h]
00402EE9: 5E pop esi
***** E:HWORLD.ASM
00402EDD: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00402EE3: FF 15 58 60 40 00 call dword ptr ds:[00406058h]
00402EE9: 5E pop esi
*****

***** C:hworld.asm
00403E11: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00403E17: FF 15 00 60 40 00 call dword ptr ds:[00406000h]
00403E1D: A1 B0 9A 40 00 mov eax,[00409AB0]
***** E:HWORLD.ASM
00403E11: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00403E17: FF 15 58 60 40 00 call dword ptr ds:[00406058h]
00403E1D: A1 B0 9A 40 00 mov eax,[00409AB0]
*****

***** C:hworld.asm
0040420B: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00404211: FF 15 00 60 40 00 call dword ptr ds:[00406000h]
00404217: 33 C0 xor eax,eax
***** E:HWORLD.ASM
0040420B: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00404211: FF 15 58 60 40 00 call dword ptr ds:[00406058h]
00404217: 33 C0 xor eax,eax
*****

***** C:hworld.asm
00404461: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00404467: FF 15 00 60 40 00 call dword ptr ds:[00406000h]
0040446D: 33 C0 xor eax,eax
***** E:HWORLD.ASM
00404461: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
00404467: FF 15 58 60 40 00 call dword ptr ds:[00406058h]
0040446D: 33 C0 xor eax,eax
*****

***** C:hworld.asm
004044B3: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
004044B9: FF 15 00 60 40 00 call dword ptr ds:[00406000h]
004044BF: 5E pop esi
***** E:HWORLD.ASM
004044B3: FF 35 E8 9C 40 00 push dword ptr ds:[00409CE8h]
004044B9: FF 15 58 60 40 00 call dword ptr ds:[00406058h]
004044BF: 5E pop esi
*****
= = = = =
Here are the differences between hex dumps:

Comparing files C:hworld.dmp and E:HWORLD.DMP
***** C:hworld.dmp
00d0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................|
00e0 50 45 00 00 4c 01 03 00-a0 ef 3a 43 00 00 00 00 |PE..L.....:C....|
00f0 00 00 00 00 e0 00 0f 01-0b 01 06 00 00 50 00 00 |.............P..|
***** E:HWORLD.DMP
00d0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................|
00e0 50 45 00 00 4c 01 03 00-d1 ec 3a 43 00 00 00 00 |PE..L.....:C....|
00f0 00 00 00 00 e0 00 0f 01-0b 01 06 00 00 50 00 00 |.............P..|
*****

***** C:hworld.dmp
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
1100 ff 15 58 60 40 00 5f c3-56 8b 74 24 08 3b 74 24 |..X`@._.V.t$.;t$|
1110 0c 73 0d 8b 06 85 c0 74-02 ff d0 83 c6 04 eb ed |.s.....t........|
***** E:HWORLD.DMP
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
1100 ff 15 00 60 40 00 5f c3-56 8b 74 24 08 3b 74 24 |...`@._.V.t$.;t$|
1110 0c 73 0d 8b 06 85 c0 74-02 ff d0 83 c6 04 eb ed |.s.....t........|
*****

***** C:hworld.dmp
1260 e8 af 14 00 00 ff 74 24-04 e8 df 14 00 00 59 68 |......t$......Yh|
1270 ff 00 00 00 ff 15 58 60-40 00 c3 56 8b 74 24 08 |......X`@..V.t$.|

***** E:HWORLD.DMP
1260 e8 af 14 00 00 ff 74 24-04 e8 df 14 00 00 59 68 |......t$......Yh|
1270 ff 00 00 00 ff 15 00 60-40 00 c3 56 8b 74 24 08 |.......`@..V.t$.|

*****

***** C:hworld.dmp
2ed0 e8 0e 17 00 00 83 c4 0c-eb 0f 56 6a 00 ff 35 e8 |..........Vj..5.|
2ee0 9c 40 00 ff 15 00 60 40-00 5e c9 c3 cc cc cc cc |.@....`@.^......|
2ef0 57 8b 7c 24 08 eb 6a 8d-a4 24 00 00 00 00 8b ff |W.|$..j..$......|
***** E:HWORLD.DMP
2ed0 e8 0e 17 00 00 83 c4 0c-eb 0f 56 6a 00 ff 35 e8 |..........Vj..5.|
2ee0 9c 40 00 ff 15 58 60 40-00 5e c9 c3 cc cc cc cc |.@...X`@.^......|
2ef0 57 8b 7c 24 08 eb 6a 8d-a4 24 00 00 00 00 8b ff |W.|$..j..$......|
*****

***** C:hworld.dmp
3e00 6a 00 ff 70 0c ff d6 a1-ac 9a 40 00 ff 70 10 6a |j..p......@..p.j|
3e10 00 ff 35 e8 9c 40 00 ff-15 00 60 40 00 a1 b0 9a |..5..@....`@....|
3e20 40 00 8b 15 b4 9a 40 00-8d 04 80 c1 e0 02 8b c8 |@.....@.........|
***** E:HWORLD.DMP
3e00 6a 00 ff 70 0c ff d6 a1-ac 9a 40 00 ff 70 10 6a |j..p......@..p.j|
3e10 00 ff 35 e8 9c 40 00 ff-15 58 60 40 00 a1 b0 9a |..5..@...X`@....|
3e20 40 00 8b 15 b4 9a 40 00-8d 04 80 c1 e0 02 8b c8 |@.....@.........|
*****

***** C:hworld.dmp
4200 3b c7 89 46 0c 75 14 ff-76 10 57 ff 35 e8 9c 40 |;..F.u..v.W.5..@|
4210 00 ff 15 00 60 40 00 33-c0 eb 17 83 4e 08 ff 89 |....`@.3....N...|
4220 3e 89 7e 04 ff 05 b0 9a-40 00 8b 46 10 83 08 ff |>.~.....@..F....|
***** E:HWORLD.DMP
4200 3b c7 89 46 0c 75 14 ff-76 10 57 ff 35 e8 9c 40 |;..F.u..v.W.5..@|
4210 00 ff 15 58 60 40 00 33-c0 eb 17 83 4e 08 ff 89 |...X`@.3....N...|
4220 3e 89 7e 04 ff 05 b0 9a-40 00 8b 46 10 83 08 ff |>.~.....@..F....|
*****

***** C:hworld.dmp
4450 ff 15 54 60 40 00 81 fe-40 77 40 00 74 0f 56 6a |..T`@...@w@.t.Vj|
4460 00 ff 35 e8 9c 40 00 ff-15 00 60 40 00 33 c0 5f |..5..@....`@.3._|
4470 5e 5d 5b c3 56 8b 74 24-08 68 00 80 00 00 6a 00 |^][.V.t$.h....j.|
***** E:HWORLD.DMP
4450 ff 15 54 60 40 00 81 fe-40 77 40 00 74 0f 56 6a |..T`@...@w@.t.Vj|
4460 00 ff 35 e8 9c 40 00 ff-15 58 60 40 00 33 c0 5f |..5..@...X`@.3._|
4470 5e 5d 5b c3 56 8b 74 24-08 68 00 80 00 00 6a 00 |^][.V.t$.h....j.|
*****

***** C:hworld.dmp
44a0 20 8b 46 04 8b 0e 56 6a-00 89 08 8b 06 8b 4e 04 | .F...Vj......N.|
44b0 89 48 04 ff 35 e8 9c 40-00 ff 15 00 60 40 00 5e |.H..5..@....`@.^|
44c0 c3 83 0d 50 77 40 00 ff-5e c3 55 8b ec 51 53 56 |...Pw@..^.U..QSV|
***** E:HWORLD.DMP
44a0 20 8b 46 04 8b 0e 56 6a-00 89 08 8b 06 8b 4e 04 | .F...Vj......N.|
44b0 89 48 04 ff 35 e8 9c 40-00 ff 15 58 60 40 00 5e |.H..5..@...X`@.^|
44c0 c3 83 0d 50 77 40 00 ff-5e c3 55 8b ec 51 53 56 |...Pw@..^.U..QSV|
*****

***** C:hworld.dmp
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
6000 42 67 00 00 a2 65 00 00-b6 65 00 00 ca 65 00 00 |Bg...e...e...e..|
6010 dc 65 00 00 ea 65 00 00-06 66 00 00 1c 66 00 00 |.e...e...f...f..|
***** E:HWORLD.DMP
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
6000 94 65 00 00 a2 65 00 00-b6 65 00 00 ca 65 00 00 |.e...e...e...e..|
6010 dc 65 00 00 ea 65 00 00-06 66 00 00 1c 66 00 00 |.e...e...f...f..|
*****

***** C:hworld.dmp
6040 da 66 00 00 ee 66 00 00-08 67 00 00 18 67 00 00 |.f...f...g...g..|
6050 26 67 00 00 34 67 00 00-94 65 00 00 4e 67 00 00 |&g..4g...e..Ng..|
6060 5a 67 00 00 66 67 00 00-72 67 00 00 7e 67 00 00 |Zg..fg..rg..~g..|
***** E:HWORLD.DMP
6040 da 66 00 00 ee 66 00 00-08 67 00 00 18 67 00 00 |.f...f...g...g..|
6050 26 67 00 00 34 67 00 00-42 67 00 00 4e 67 00 00 |&g..4g..Bg..Ng..|
6060 5a 67 00 00 66 67 00 00-72 67 00 00 7e 67 00 00 |Zg..fg..rg..~g..|
*****

***** C:hworld.dmp
64d0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................|
64e0 00 00 00 00 42 67 00 00-a2 65 00 00 b6 65 00 00 |....Bg...e...e..|
64f0 ca 65 00 00 dc 65 00 00-ea 65 00 00 06 66 00 00 |.e...e...e...f..|
***** E:HWORLD.DMP
64d0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................|
64e0 00 00 00 00 94 65 00 00-a2 65 00 00 b6 65 00 00 |.....e...e...e..|
64f0 ca 65 00 00 dc 65 00 00-ea 65 00 00 06 66 00 00 |.e...e...e...f..|
*****

***** C:hworld.dmp
6520 c8 66 00 00 da 66 00 00-ee 66 00 00 08 67 00 00 |.f...f...f...g..|
6530 18 67 00 00 26 67 00 00-34 67 00 00 94 65 00 00 |.g..&g..4g...e..|
6540 4e 67 00 00 5a 67 00 00-66 67 00 00 72 67 00 00 |Ng..Zg..fg..rg..|
***** E:HWORLD.DMP
6520 c8 66 00 00 da 66 00 00-ee 66 00 00 08 67 00 00 |.f...f...f...g..|
6530 18 67 00 00 26 67 00 00-34 67 00 00 42 67 00 00 |.g..&g..4g..Bg..|
6540 4e 67 00 00 5a 67 00 00-66 67 00 00 72 67 00 00 |Ng..Zg..fg..rg..|
*****

==========
"Joe" <joe@xxxxxxxxxx> wrote in message
news:elBnNQ5wFHA.3556@xxxxxxxxxxxxxxxxxxxxxxx
Please post the byte-offsets and bytes that differ, as well as 16 or so
bytes around the differences.

Use "dumpbin /disasm" on each, redirected to files, then compare those
files.

At least one byte difference would be the drive-letter in the path-to-source
that is stored in the .EXE, if the drive-letter holding the source changes
between OS's.

Can make the two binaries available somewhere? Two machines with different
OS's and exactly the same development environments -- I don't have that
setup, so I can't build them, but it would be fun to try and figure out.

"dan daley" <ddaley@xxxxxxxxxxxxx> wrote in message
news:ZUYXe.538$G64.205@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> MS VC 6.0 pro compiled a simple console "hello world" program differently
> under Windows 2000 (sp4) versus Windows XP (sp2).
> I need to know why there is a difference.
> The difference is of concern since we have gambling applications that
> regulators must be able to release compile to an identical EXE -- allowing
> for the date/time of compile (4 bytes max).
>
> The compiler installation was: MS VC 6.0, vc6sp5, visual cpp processor
pack
> for sp5, and platformsdk Feb 2001.
>
> /* hworld.c "Hello world" program to test differences between windows
> 2000 and windows XP compiles.
> */
> #include <stdio.h>
> #include <stdlib.h>
> void main(void)
> {
> printf("hello world\n");
> exit(0);
> }
>
>
> To test the effect of updating from Win 2000 to XP we cloned a windows
2000
> (SP4) drive using Norton ghost 2002.
> Then updated the cloned drive to XP and booted as the primary drive on the
> same PC. After release compiling, the EXE from the 2000 and Xp compiles
> were compared. The EXE's were the same size. Aside from a 2-byte
> difference caused by the date/time of the two compiles, there were
15-bytes
> of differences, according to 'fc.exe'. The OBJ files are always
identical
> except for the embedded date/time stamp. Windows 2000 compiles always
> produced the same EXE except for the date/time stamp. XP release compiles
> are always consistent and identical across the two XP computers tested.
>
> Larger programs compile with much larger differences even allowing for
> identical blocks of code aligned differently within the EXE (identified
> using UltraCompare). So far XP and 2000 always compile to the same size.
>
> Why are the XP and 2000 compiles producing a different EXE?
>
>
>


.



Relevant Pages

  • Re: Please help - getting error when open program - "Type Mismatch"
    ... Also I can make it an exe. ... compiles ok... ... 20 b = InputBox("Enter an integer to divide by") ... You may have to compile several debug versions of your app in order to ...
    (microsoft.public.vb.general.discussion)
  • Re: Please help - getting error when open program - "Type Mismatch"
    ... Also I can make it an exe. ... compiles ok... ... 20 b = InputBox("Enter an integer to divide by") ... You may have to compile several debug versions of your app in order to ...
    (microsoft.public.vb.general.discussion)
  • Re: Protecting code
    ... > I know that when an .NET exe is run, ... > compiles them to native code then runs the code. ... method is called it is JIT compiled and the native code is cached in memory. ... > debugger and serialise the exe and assemblies ...
    (microsoft.public.dotnet.security)
  • Re: Still Loving Python
    ... >> A single click compiles, links and runs the resulting independent windows .exe in a fraction of a second ... >> for the above, and I can see the hint, kill the .exe, and go on where I was. ... Not in a fraction of a second, but that's sort of irrelevant to ... Bengt Richter ...
    (comp.lang.python)
  • Re: How to locate compiled binary code relative to source code?
    ... > I need to be able to identify in the compiled EXE a specific location ... > When it compiles, I need to be able to locate in the binary exe the offsets ... Then it should be easy to make as many unique sequences as you want. ... Load A, n ...
    (comp.programming)