From: Alex Clark on
"mayayana" <mayaXXyana(a)rcXXn.com> wrote in message
news:uJNgEs%23iKHA.5524(a)TK2MSFTNGP06.phx.gbl...
> That's all I was getting at -- that it's for
> network admin and not very useful in most cases
> for software. I don't even find it very useful in
> scripting.

Well, I know I've used it for retrieving the CPU-ID in two different
projects (the first of which was VB6 based) and also needed it for some
distributed processing work (it was useful to query machines in a network,
their hardware capabilities, and their current workload). I'm not sure of
any existing API's that could've acheived the same result. I do agree
however that it's most often used for administration in a scripting
capacity, I'm just pointing out that it has other uses :-)


From: Mike B on

"Alex Clark" <quanta(a)noemail.noemail> wrote in message
news:uxhdK2EjKHA.5520(a)TK2MSFTNGP06.phx.gbl...
> "mayayana" <mayaXXyana(a)rcXXn.com> wrote in message
> news:uJNgEs%23iKHA.5524(a)TK2MSFTNGP06.phx.gbl...
>> That's all I was getting at -- that it's for
>> network admin and not very useful in most cases
>> for software. I don't even find it very useful in
>> scripting.
>
> Well, I know I've used it for retrieving the CPU-ID in two different
> projects (the first of which was VB6 based) and also needed it for some
> distributed processing work (it was useful to query machines in a network,
> their hardware capabilities, and their current workload). I'm not sure of
> any existing API's that could've acheived the same result. I do agree
> however that it's most often used for administration in a scripting
> capacity, I'm just pointing out that it has other uses :-)

This C++ code purports to get the CPU_ID:

UINT64 get_cpuid(void)
{
DWORD dwStandard = 0;
DWORD dwFeature = 0;

_asm {
mov eax, 1
cpuid
mov dwStandard, eax
mov dwFeature, edx
}
return( ((UINT64)(dwFeature) << 32) | ((UINT64)(dwStandard)));
}

Delphi Pascal (I don't have C++ compiler to check if the results of Delphi
is the same as C++):

function GetCPU_ID() : UINT64; StdCall;
var
dwStandard : DWORD;
dwFeature : DWORD;
begin
asm
mov eax, 1
cpuid
mov dwStandard, eax
mov dwFeature, edx
end;
Result := ( (UINT64(dwFeature) SHL 32) OR ( UINT64(dwStandard)) );
end;


From: Mike B on
There is a caveat though. Apparently if the CPU doesn't support the cpuid
instruction, it will generate exception.

"Alex Clark" <quanta(a)noemail.noemail> wrote in message
news:uxhdK2EjKHA.5520(a)TK2MSFTNGP06.phx.gbl...
> "mayayana" <mayaXXyana(a)rcXXn.com> wrote in message
> news:uJNgEs%23iKHA.5524(a)TK2MSFTNGP06.phx.gbl...
>> That's all I was getting at -- that it's for
>> network admin and not very useful in most cases
>> for software. I don't even find it very useful in
>> scripting.
>
> Well, I know I've used it for retrieving the CPU-ID in two different
> projects (the first of which was VB6 based) and also needed it for some
> distributed processing work (it was useful to query machines in a network,
> their hardware capabilities, and their current workload). I'm not sure of
> any existing API's that could've acheived the same result. I do agree
> however that it's most often used for administration in a scripting
> capacity, I'm just pointing out that it has other uses :-)
>


From: Mike B on
Shoulda checked the result of WMI first. The ASM code doesn't return the
same as WMI.

"Alex Clark" <quanta(a)noemail.noemail> wrote in message
news:uxhdK2EjKHA.5520(a)TK2MSFTNGP06.phx.gbl...
> "mayayana" <mayaXXyana(a)rcXXn.com> wrote in message
> news:uJNgEs%23iKHA.5524(a)TK2MSFTNGP06.phx.gbl...
>> That's all I was getting at -- that it's for
>> network admin and not very useful in most cases
>> for software. I don't even find it very useful in
>> scripting.
>
> Well, I know I've used it for retrieving the CPU-ID in two different
> projects (the first of which was VB6 based) and also needed it for some
> distributed processing work (it was useful to query machines in a network,
> their hardware capabilities, and their current workload). I'm not sure of
> any existing API's that could've acheived the same result. I do agree
> however that it's most often used for administration in a scripting
> capacity, I'm just pointing out that it has other uses :-)
>


From: Alex Clark on
"Mike B" <mDotByerley(a)VerizonDottieNettie> wrote in message
news:e84G0dIjKHA.1652(a)TK2MSFTNGP05.phx.gbl...
>
> This C++ code purports to get the CPU_ID:

But AFAIK there is no API in Windows that will return that value - your
example is a pinch of inline ASM in C++. Also, for the distrib-proc app I
was working on, I had to query machines' hardware capabilities from across
the network, and having a single unified API (WMI) on hand to do all of that
was extremely useful. For querying obscure hardware properties, there are
some things the Windows API can do - for everything else, there's WMI ;-)


First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6
Prev: MSDN((VB6) won't install
Next: DLL Wrapper (I Think?)