2010/11/1 Mark Thomas <ma...@apache.org>:
> On 01/11/2010 06:43, Konstantin Kolinko wrote:
>>
>> Some thoughts:
>>
>> 1. We do not need this check at all on a 32-bit OS.
>
> Yep. Should be possible to avoid this check on a 32-bit OS.
>

2010/11/1 William A. Rowe Jr. <wr...@rowe-clan.net>:
>
> I wouldn't, some people will pre-stage things on a 32 bit machine to prepare
> for mass copy to 64 bits.  Odd edge case but one to consider.

Installing something that they cannot run?  I would not consider that.

Anyway, 1) it never worked before, 2) one can use a zip distributive


>> 2. If the JRE is installed to its default location, there are
>> different locations for 32 bit and 64 bit programs.
>
> True, but not something we can depend on. We can't even be sure that the
> 64-bit JVM hasn't been installed to the default 32-bit location.
>
>> 3. I found the following:
>> [1] http://msdn.microsoft.com/en-us/library/ms973190.aspx
>> mentions System.Reflection.Module.GetPEKind
>
> That requires .NET and not every machine has installed the .NET runtime.
> I don't want to make having .NET a pre-requisite for a correctly
> operating installer.
>

I think it boils down to reading a PE header.

The Wikipedia article has links to the specifications.
http://en.wikipedia.org/wiki/Portable_Executable

I can summarize them as the following:
1. Jump to offset 0x3c and read there the location of PE header.
2. Jump to the specified location. The header starts with 4 bytes
'P''E'\0\0'  (50 45 00 00)
3. The next word of two bytes gives the machine type. It is
0x014c  (4C 01)  for Intel i386
0x8664  (64 86)  for AMD 64
0x0200  for Intel Itanium


>> 4. We can write a Java class and execute it with javaw.exe
>> System.getProperty("os.arch");
>> [4] 
>> http://stackoverflow.com/questions/807263/how-do-i-detect-which-kind-of-jre-is-installed-32bit-vs-64bit
>
> That could work. I quite like the look of the ExeDetect code. *If* we
> can get that working in NSIS then we can avoid starting up another process.
>
> Something else for me to work on at ApacheCon :)
>
> Mark
>

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to