-
September 26th, 2016, 05:15 PM
#1
how to check which systems runs x64 or x32
This is my processor = AMD Athlon II , I considire it as AMD64, am I wrong?
have installed Win10 on my lap, have excpect Is64bit givs me a 'true', but it doesnt.
I ask, cause this is the way I like to proof, f it has 64bit or 32bit system.
Code:
bool Is64bit = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"));
to come finally to this point
Code:
if (Is64bit)
{
searcher = new ManagementObjectSearcher("select * from Win64_Processor");
foreach (ManagementObject share in searcher.Get())
{
// first of all, the processorid
strProcId += share.GetPropertyValue("ProcessorId").ToString();
}
}
-
September 26th, 2016, 09:16 PM
#2
Re: how to check which systems runs x64 or x32
In .Net 4.0 or higher call, Environment.Is64BitOperatingSystem or Environment.Is64BitProcess.
-
September 27th, 2016, 07:05 PM
#3
Re: how to check which systems runs x64 or x32
well, that works, thank you
But why I still get the IDs on a Win64 system (ProzessorID or baseboardId) using "select * from Win32_Processor", but using "select * from Win64_Processor" throw an error?
-
September 28th, 2016, 01:02 AM
#4
Re: how to check which systems runs x64 or x32
Originally Posted by pschulz
well, that works, thank you
But why I still get the IDs on a Win64 system (ProzessorID or baseboardId) using "select * from Win32_Processor", but using "select * from Win64_Processor" throw an error?
Catch the exception to find out the error. WMI is great, but it is slow and has a lot of initial startup overhead. If you are usind .Net 4.0 or better, prefer to use the Environment class methods I suggested previously.
-
September 28th, 2016, 07:13 PM
#5
Re: how to check which systems runs x64 or x32
well, it say no validate class, does it tell you something?
I changed the project to "AnyCpu" , so the app is shown as a 64 within the taskmanger, but its the same
-
September 28th, 2016, 11:35 PM
#6
Re: how to check which systems runs x64 or x32
some to add
mabe I dont know whta you ment "prefer to use the Environment class methods I suggested previously. " Enviroment just givs me the maschinname, some other things but nothing like procId or Harddrive ID, or Basboard
-
September 29th, 2016, 12:52 AM
#7
Re: how to check which systems runs x64 or x32
Originally Posted by pschulz
some to add
mabe I dont know whta you ment "prefer to use the Environment class methods I suggested previously. " Enviroment just givs me the maschinname, some other things but nothing like procId or Harddrive ID, or Basboard
You didn't ask for that - you originally asked for detecting 64bit.
-
September 29th, 2016, 12:56 AM
#8
Re: how to check which systems runs x64 or x32
Originally Posted by pschulz
well, it say no validate class, does it tell you something?
I changed the project to "AnyCpu" , so the app is shown as a 64 within the taskmanger, but its the same
Is Win64_Processor a valid WMI class? I'm asking because I haven't looked it up in msdn. Even if it is valid, it make not be supported on the system you are trying the code on.
-
September 29th, 2016, 03:00 AM
#9
Re: how to check which systems runs x64 or x32
it says no, but neither could find "Win32_Processor",
this is the page where I lookd:
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
this is to me the page where it has to be, big letters "WMI Classes"
-
September 29th, 2016, 11:38 AM
#10
Re: how to check which systems runs x64 or x32
Originally Posted by pschulz
It isn't on that page directly (actually there is a link on that page that points you to the Win32 Classes). At any rate, search by Win32_Processor and you'll find https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
There are no Win64_xxx WMI classes so that is why you get an invalid error when attempting to use that class.
-
September 30th, 2016, 01:55 AM
#11
Re: how to check which systems runs x64 or x32
thanks man,
but I went through all of those links, within that page "https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx", but there wasnt any Win32 Classes.
Can you tell which link it is.
-
September 30th, 2016, 07:35 AM
#12
Re: how to check which systems runs x64 or x32
Originally Posted by pschulz
thanks man,
but I went through all of those links, within that page "https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx", but there wasnt any Win32 Classes.
Can you tell which link it is.
Click on the link I gave you in post #10.
-
September 30th, 2016, 03:30 PM
#13
Re: how to check which systems runs x64 or x32
I watch that link, of course, saw it is as you said.
Also watchd this "It isn't on that page directly (actually there is a link on that page that points you to the Win32 Classes)."
Just have like to see what did I miss, why you found, on the same route, some I couldnt.
-
September 30th, 2016, 06:27 PM
#14
Re: how to check which systems runs x64 or x32
Originally Posted by pschulz
I watch that link, of course, saw it is as you said.
Also watchd this "It isn't on that page directly (actually there is a link on that page that points you to the Win32 Classes)."
Just have like to see what did I miss, why you found, on the same route, some I couldnt.
It's in the table of WMI Classes - the one with the Section and Description at the top of the page and the row with CIM Classes. Link highlighted in blue below.
Section Description
CIM Classes Common Information Model (CIM) schema classes. If you want to write your own WMI classes then you can inherit from one or more of these classes.
The WMI Win32 Classes inherit from the CIM classes.
-
September 30th, 2016, 10:12 PM
#15
Re: how to check which systems runs x64 or x32
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|