Just a guess, but from the error message (Cannot be run in DOS mode), it sounds like by inserting data into the binary, you are changing the offsets of the subsequent PE format sections, but failing to adjust the appropriate offsets within the PE header.

Hence, when NTLDR attempts to load the executable image by following the now mis-sized offsets, it fails to locate the appropriate sections, and so rejects it with a generic error message indicating that it does not recognise, or cannot make sense of the format of the file.

To correct this would require you to parse the header, figure out which section offsets come after the position where you are inserting your xml, and adjust them by the amount you insert. There is the additional complication that the offsets have to be aligned to certain boundaries. I'm not sure whether these would be 4-byte, 8-byte or conceivably even page-sized boundaries under Vista. Conceivably it could be processor size (32-bit -v- 60-bit dependant. You would need to find a document describing the latest (Vista compatible) definition of the PE executable format. I have previously found these to be available on-line, but depending where you get it, it may or may not be complete description.

Like I say, just a semi-informed guess.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: How can I integrate within the PDK perlapp the manifest assembly workaround for Vista UAC? by BrowserUk
in thread How can I integrate within the PDK perlapp the manifest assembly workaround for Vista UAC? by ddn123456

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.