none
How to know .net assembly 32 or 64 without load to appdomain ? RRS feed

  • Question

  • How to know .net assembly for 32, 64 or any cpu without loading them into AppDomain ?

    It's hard to be advanced programmer

    Thursday, January 9, 2014 2:34 AM

Answers

  • According to Microsoft PE and COFF Specification,

    After the MS‑DOS stub, at the file offset specified at offset 0x3c, is a 4-byte signature that identifies the file as a PE format image file. This signature is “PE\0\0” (the letters “P” and “E” followed by two null bytes).

    After verified it's indeed PE file format, you can read the following Int16 value in the COFF File header to check for it's "machine type"

    IMAGE_FILE_MACHINE_AMD64

    0x8664

    x64

    IMAGE_FILE_MACHINE_I386

    0x14c

    Intel 386 or later processors and compatible   processors

    The currently relevent ones are these two only, for types like Itanium you can consult the referred document.

    Note that the value for "x86" is the same as "Any CPU" here.

    Thursday, January 9, 2014 3:10 AM
    Answerer
  • Btw, here's simpler method.

    Thursday, January 9, 2014 3:32 AM
    Answerer

All replies

  • According to Microsoft PE and COFF Specification,

    After the MS‑DOS stub, at the file offset specified at offset 0x3c, is a 4-byte signature that identifies the file as a PE format image file. This signature is “PE\0\0” (the letters “P” and “E” followed by two null bytes).

    After verified it's indeed PE file format, you can read the following Int16 value in the COFF File header to check for it's "machine type"

    IMAGE_FILE_MACHINE_AMD64

    0x8664

    x64

    IMAGE_FILE_MACHINE_I386

    0x14c

    Intel 386 or later processors and compatible   processors

    The currently relevent ones are these two only, for types like Itanium you can consult the referred document.

    Note that the value for "x86" is the same as "Any CPU" here.

    Thursday, January 9, 2014 3:10 AM
    Answerer
  • Btw, here's simpler method.

    Thursday, January 9, 2014 3:32 AM
    Answerer