For Programmers: Free Programming Magazines  


Home > Archive > Tcl > January 2006 > How to find if on WIN64 or WIN32









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to find if on WIN64 or WIN32
Mona

2006-01-19, 7:07 pm

Hi all,

How can I find if my application is running on WIN32 or WIN64?

On both, "set ::tcl_platform(platform)" returns windows.

Thanks in advance.
Mona.

Glenn Jackman

2006-01-19, 7:07 pm

At 2006-01-19 03:30PM, Mona <impm01@yahoo.com> wrote:
> Hi all,
>
> How can I find if my application is running on WIN32 or WIN64?
>
> On both, "set ::tcl_platform(platform)" returns windows.
>
> Thanks in advance.
> Mona.


In Tcl 8.4.11, [parray tcl_platform] shows me:
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine) = intel
tcl_platform(os) = Windows NT
tcl_platform(osVersion) = 5.1
tcl_platform(platform) = windows
tcl_platform(threaded) = 1
tcl_platform(user) = glennj
tcl_platform(wordSize) = 4

So perhaps "tcl_platform(wordSize)" is what you're after.
Although I don't see anything relevant on http://wiki.tcl.tk/tcl_platform

--
Glenn Jackman
Ulterior Designer
Jeff Hobbs

2006-01-20, 3:58 am

Mona wrote:
> How can I find if my application is running on WIN32 or WIN64?
>
> On both, "set ::tcl_platform(platform)" returns windows.


Are you trying to determine if you are running on a 64-bit
Windows variant, or actually using a 64-bit Tcl build on
Windows 64-bit?

I can't access my Win64 machine right now, but the two above
are different. 32-bit Tcl runs just fine on 64-bit Windows
(whether ia64 or x64). It may be that wordSize in the
tcl_platform array will be 8, but Windows 64-bit is IL32P64,
whereas most unix 64-bit variants are I32LP64.

--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
Ralf Fassel

2006-01-25, 7:57 am

* "Mona" <impm01@yahoo.com>
| tcl_platform(osVersion) = 5.2 / 5.1

Is different too, but I don't think this would be a good indicator.

| Is there any other way. or am I doing something wrong?

Depends on what you're trying to achieve. Why do you need this
information? Maybe it would be better to code a short package DLL
which provides the information...

R'
Robert Hicks

2006-01-25, 7:15 pm

You can look at the ENV variables to see if something works:

puts $::env(PROCESSOR_IDENTIFIER)
puts $::env(PROCESSOR_LEVEL)
puts $::env(PROCESSOR_REVISION)

Robert Hicks

2006-01-25, 7:15 pm

You could also use tcom to drive the Windows WMI. Look at the
"Win32_Processor" and "AddressWidth". Gives you something to go by...

TWAPI might be able to help as well: http://twapi.sf.net

Here is how it is done using Perl:

use strict;
use Win32::OLE('in');

use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;

my @computers = ("OSCMW-D-DPWR-01");
foreach my $computer (@computers) {
print "\n";
print " ========================================
==\n";
print "Computer: $computer\n";
print " ========================================
==\n";

my $objWMIService =
Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die
"WMI connection failed.\n";
my $colItems = $objWMIService->ExecQuery("SELECT * FROM
Win32_Processor", "WQL",
wbemFlagReturnImmediately | wbemFlagForwardOnly);

foreach my $objItem (in $colItems) {
print "AddressWidth: $objItem->{AddressWidth}\n";
print "Architecture: $objItem->{Architecture}\n";
print "Availability: $objItem->{Availability}\n";
print "Caption: $objItem->{Caption}\n";
print "ConfigManagerErrorCode:
$objItem->{ConfigManagerErrorCode}\n";
print "ConfigManagerUserConfig:
$objItem->{ConfigManagerUserConfig}\n";
print "CpuStatus: $objItem->{CpuStatus}\n";
print "CreationClassName: $objItem->{CreationClassName}\n";
print "CurrentClockSpeed: $objItem->{CurrentClockSpeed}\n";
print "CurrentVoltage: $objItem->{CurrentVoltage}\n";
print "DataWidth: $objItem->{DataWidth}\n";
print "Description: $objItem->{Description}\n";
print "DeviceID: $objItem->{DeviceID}\n";
print "ErrorCleared: $objItem->{ErrorCleared}\n";
print "ErrorDescription: $objItem->{ErrorDescription}\n";
print "ExtClock: $objItem->{ExtClock}\n";
print "Family: $objItem->{Family}\n";
print "InstallDate: $objItem->{InstallDate}\n";
print "L2CacheSize: $objItem->{L2CacheSize}\n";
print "L2CacheSpeed: $objItem->{L2CacheSpeed}\n";
print "LastErrorCode: $objItem->{LastErrorCode}\n";
print "Level: $objItem->{Level}\n";
print "LoadPercentage: $objItem->{LoadPercentage}\n";
print "Manufacturer: $objItem->{Manufacturer}\n";
print "MaxClockSpeed: $objItem->{MaxClockSpeed}\n";
print "Name: $objItem->{Name}\n";
print "OtherFamilyDescription:
$objItem->{OtherFamilyDescription}\n";
print "PNPDeviceID: $objItem->{PNPDeviceID}\n";
print "PowerManagementCapabilities: " . join(",", (in
$objItem->{PowerManagementCapabilities})) . "\n";
print "PowerManagementSupported:
$objItem->{PowerManagementSupported}\n";
print "ProcessorId: $objItem->{ProcessorId}\n";
print "ProcessorType: $objItem->{ProcessorType}\n";
print "Revision: $objItem->{Revision}\n";
print "Role: $objItem->{Role}\n";
print "SocketDesignation: $objItem->{SocketDesignation}\n";
print "Status: $objItem->{Status}\n";
print "StatusInfo: $objItem->{StatusInfo}\n";
print "Stepping: $objItem->{Stepping}\n";
print "SystemCreationClassName:
$objItem->{SystemCreationClassName}\n";
print "SystemName: $objItem->{SystemName}\n";
print "UniqueId: $objItem->{UniqueId}\n";
print "UpgradeMethod: $objItem->{UpgradeMethod}\n";
print "Version: $objItem->{Version}\n";
print "VoltageCaps: $objItem->{VoltageCaps}\n";
print "\n";
}
}

==== RESULT ====

========================================
==
Computer: OSCMW-D-DPWR-01
========================================
==
AddressWidth: 32
Architecture: 0
Availability: 3
Caption: x86 Family 15 Model 2 Stepping 7
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage:
DataWidth: 32
Description: x86 Family 15 Model 2 Stepping 7
DeviceID: CPU0
ErrorCleared:
ErrorDescription:
ExtClock: 133
Family: 2
InstallDate:
L2CacheSize: 0
L2CacheSpeed:
LastErrorCode:
Level: 15
LoadPercentage: 100
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Pentium(R) 4 CPU 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: 0
ProcessorId: BFEBFBFF00000F27
ProcessorType: 3
Revision: 519
Role: CPU
SocketDesignation: J2E1
Status: OK
StatusInfo: 3
Stepping: 7
SystemCreationClassName: Win32_ComputerSystem
SystemName: OSCMW-D-DPWR-01
UniqueId:
UpgradeMethod: 15
Version: Model 2, Stepping 7
VoltageCaps: 6

Mona

2006-01-29, 7:00 pm

Hi,

Your reply is aprreciated.

But,
Instead of getting a new package, isn't there a way Tcl can tell if the
application is using a 64-bit Tcl build on Windows 64-bit?

Thanks,
Mona.

Mona

2006-01-29, 7:00 pm

Hi,

Your reply is appreciated.

But,
Instead of getting a new package, isn't there a way Tcl can tell if the
application is using a 64-bit Tcl build on Windows 64-bit?

Thanks,
Mona.

Robert Hicks

2006-01-29, 7:00 pm

That isn't what you asked...? You asked about telling the platform not
the Tcl build type. I am not sure how to do that.

Robert

Jeff Hobbs

2006-01-31, 4:09 am

Mona wrote:
> Instead of getting a new package, isn't there a way Tcl can tell if the
> application is using a 64-bit Tcl build on Windows 64-bit?


That answer was already posted, but what are you really trying to do?

--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com