BBC BASIC for Windows
« Yahoo forum robbed code.... »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:44pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Yahoo forum robbed code....  (Read 471 times)
Yshua
New Member
Image


member is offline

Avatar




PM


Posts: 6
xx Yahoo forum robbed code....
« Thread started on: Jul 8th, 2015, 7:34pm »

Dearest Richard:

My pc got stolen. Lost my beloved BBC programs. Boils down to the Yahoo forum messages, dated Sept. 18, 2010, how to check pc unique identifiers, such as cpu clock speed, which program I found, but Yahoo raided the program that checked (non text removed) revision number, family of pc, etc. Was searching for hours under API's and WMI without finding where they are under MSDN Library. Apologize for the inconvenience.

Yshua sad
User IP Logged

rtr2
Guest
xx Re: Yahoo forum robbed code....
« Reply #1 on: Jul 8th, 2015, 8:02pm »

on Jul 8th, 2015, 7:34pm, Yshua wrote:
Was searching for hours under API's and WMI without finding where they are under MSDN Library.

Is this the WMI class you are looking for? It includes the CPU Family, Revision and Version:

https://msdn.microsoft.com/en-us/library/aa394373.aspx

Richard.
« Last Edit: Jul 8th, 2015, 8:06pm by rtr2 » User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: Yahoo forum robbed code....
« Reply #2 on: Jul 9th, 2015, 09:38am »

Hi Yshua,

I'm sorry to hear about your PC. Do you mean you couldn't download the program from Yahoo? It worked OK for me just now, so it might be worth trying again.

Best wishes,

D
User IP Logged

Yshua
New Member
Image


member is offline

Avatar




PM


Posts: 6
xx Re: Yahoo forum robbed code....
« Reply #3 on: Jul 9th, 2015, 12:48pm »

Dearest Richard and D:

Fantastic!!!!! Worked terrific the first time with the following code changes to cpuspeed.bbc:

REM Get CPU speed using WMI:

SYS `CoCreateInstance`, CLSID_WbemLocator%, 0, CLSCTX_INPROC_SERVER, \
\ IID_IWbemLocator%, ^pLoc% TO hr%
IF hr% THEN ERROR 100, "Could not create IWbemLocator interface"
!(^IWbemLocator{}+4) = !pLoc%

SYS IWbemLocator.ConnectServer%, pLoc%, FNwide("root\cimv2"), \
\ 0, 0, 0, 0, 0, 0, ^pSvc% TO hr%
IF hr% THEN ERROR 100, "Could not create IWbemServices interface"
!(^IWbemServices{}+4) = !pSvc%

SYS `CoSetProxyBlanket`, pSvc%, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, 0, \
\ RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, 0, 0 TO hr%
IF hr% THEN ERROR 100, "Could not set proxy blanket"

query$ = FNwide("SELECT * FROM Win32_Processor")
lang$ = FNwide("WQL")
SYS IWbemServices.ExecQuery%, pSvc%, lang$, query$, \
\ WBEM_FLAG_FORWARD_ONLY, 0, ^pEnum% TO hr%
IF hr% THEN ERROR 100, "Could not query Win32_Processor enumerator"
!(^IEnumWbemClassObject{}+4) = !pEnum%

SYS IEnumWbemClassObject.Next%, pEnum%, -1, 1, ^pCPU%, ^nret% TO hr%
IF hr% THEN ERROR 100, "Could not enumerate Win32_Processor object"
!(^IWbemClassObject{}+4) = !pCPU%

DIM var{vartype{l&,h&},reserved&(5),ldata%,hdata%}
SYS IWbemClassObject.Get%, pCPU%, FNwide("CurrentClockSpeed"), 0, \
\ var{}, 0, 0 TO hr%
IF hr% THEN ERROR 100, "Could not get processor clock speed"

PRINT "CPU #0 clock speed = " ; var.ldata% ; " MHz"

DIM var{vartype{l&,h&},reserved&(5),ldata%,hdata%}
SYS IWbemClassObject.Get%, pCPU%, FNwide("DataWidth"), 0, \
\ var{}, 0, 0 TO hr%
IF hr% THEN ERROR 100, "Could not get data width"

PRINT "data width = " ; var.ldata%

DIM var{vartype{l&,h&},reserved&(5),ldata%,hdata%}
SYS IWbemClassObject.Get%, pCPU%, FNwide("Description"), 0, \
\ var{}, 0, 0 TO hr%
IF hr% THEN ERROR 100, "Could not get pc description"

PRINT "Pc description: " ; var.ldata% ; "."

DIM var{vartype{l&,h&},reserved&(5),ldata%,hdata%}
SYS IWbemClassObject.Get%, pCPU%, FNwide("Manufacturer"), 0, \
\ var{}, 0, 0 TO hr%
IF hr% THEN ERROR 100, "Could not get Manufacturer"

PRINT "Manufacturer = " ; var.ldata% ; "."

DIM var{vartype{l&,h&},reserved&(5),ldata%,hdata%}
SYS IWbemClassObject.Get%, pCPU%, FNwide("Revision"), 0, \
\ var{}, 0, 0 TO hr%
IF hr% THEN ERROR 100, "Could not get revision"

PRINT "Revision number = " ; var.ldata% ; "."


PROCcleanup


Bravo! And with just one remaining question; How did we add the "&FFFF" default value into the field of some of the variables assigned above to prevent erroneous data?
Is there a reference in the BBC help file to explain?

Thanks again,
Yshua


smiley
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls