Easy CPUID

Share your advanced PureBasic knowledge/code with the community.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Easy CPUID

Post by Dreglor »

Code updated For 5.20+

this code started as somthing small and just a tool for my self to tell if some one had HTT and how many CPU's they had but I turned it into somthing slightly bigger.

it is designed to give you the basic but very useful information on your cpu via the CPUID command.

Please Make sure that the Inline ASM is enabled
and use examineCPU() before calling anything else becasue it will give false readings

Code: Select all

;////////////////////////////////////////////////////////////////
;//
;// Project Name: N\A 
;// File Name: EasyCPUID.pbi
;// Author: Steven (Dreglor) Garcia
;// Version: 1.0.0.0
;// Notes: This hold procedures that are used to easily gain  
;// CPU information on the users computer 
;//
;////////////////////////////////////////////////////////////////
EnableASM
#Bit_0 = 1
#Bit_1 = 2
#Bit_2 = 4
#Bit_3 = 8
#Bit_4 = 16
#Bit_5 = 32
#Bit_6 = 64
#Bit_7 = 128
#Bit_8 = 256
#Bit_9 = 512
#Bit_10 = 1024
#Bit_11 = 2048
#Bit_12 = 4096
#Bit_13 = 8192
#Bit_14 = 16384
#Bit_15 = 32768
#Bit_16 = 65536
#Bit_17 = 131072
#Bit_18 = 262144
#Bit_19 = 524288
#Bit_20 = 1048576
#Bit_21 = 2097152
#Bit_22 = 4194304
#Bit_23 = 8388608
#Bit_24 = 16777216
#Bit_25 = 33554432
#Bit_26 = 67108864
#Bit_27 = 134217728
#Bit_28 = 268435456
#Bit_29 = 536870912
#Bit_30 = 1073741824
#Bit_31 = 2147483648
#Bit_32 = 4294967296
#Bit_33 = 8589934592
#Bit_34 = 17179869184
#Bit_35 = 34359738368
#Bit_36 = 68719476736
#Bit_37 = 137438953472
#Bit_38 = 274877906944
#Bit_39 = 549755813888
#Bit_40 = 1099511627776
#Bit_41 = 2199023255552
#Bit_42 = 4398046511104
#Bit_43 = 8796093022208
#Bit_44 = 17592186044416
#Bit_45 = 35184372088832
#Bit_46 = 70368744177664
#Bit_47 = 140737488355328
#Bit_48 = 281474976710656
#Bit_49 = 562949953421312
#Bit_50 = 1125899906842624
#Bit_51 = 2251799813685248
#Bit_52 = 4503599627370496
#Bit_53 = 9007199254740992
#Bit_54 = 18014398509481984
#Bit_55 = 36028797018963968
#Bit_56 = 72057594037927936
#Bit_57 = 144115188075855872
#Bit_58 = 288230376151711744
#Bit_59 = 576460752303423488
#Bit_60 = 1152921504606846976
#Bit_61 = 2305843009213693952
#Bit_62 = 4611686018427387904
#Bit_63 = -9223372036854775808

#bit_Byte = $FF
#Bit_LowByte = $0F
#Bit_HighByte = $F0
#Bit_Word = $FFFF
#Bit_LowWord = $00FF
#Bit_HighWord = $FF00
#bit_Long = $FFFFFFFF
#bit_LowLong = $0000FFFF
#bit_HighLong = $FFFF0000
#bit_Quad = $FFFFFFFFFFFFFFFF
#bit_LowQuad =  $FFFFFFFF00000000
#bit_HighQuad = $00000000FFFFFFFF

#VendorID_Intel = "GenuineIntel"
#VendorID_UMC = "UMC UMC UMC"
#VendorID_AMD = "AuthenticAMD"
#VendorID_Cyrix = "CyrixInstead"
#VendorID_NexGen = "NexGenDriven"
#VendorID_Centaur = "CentaurHauls"
#VendorID_Rise_Technology = "RiseRiseRise"
#VendorID_SiS = "SiS SiS SiS"
#VendorID_Transmeta = "GenuineTMx86"
#VendorID_National_Semiconductor = "Geode by NSC"

#EasyCPUID_ExtendedFamily_IntelP4_AMDK8 = 0
#EasyCPUID_ExtendedFamily_IntelItanium2 = 1
#EasyCPUID_ExtendedFamily_IntelItanium2DC = 2

#EasyCPUID_Type_Reserved = %11
#EasyCPUID_Type_secondaryprocessor = %10
#EasyCPUID_Type_OverdriveProcessor = %01
#EasyCPUID_Type_PrimaryProcessor = %00

#EasyCPUID_Model_Null = $F
#EasyCPUID_Model_Intel80486_DX_25_33 = $0
#EasyCPUID_Model_Intel80486_DX_50 = $1
#EasyCPUID_Model_Intel80486_SX = $2
#EasyCPUID_Model_Intel80486_DX2 = $3
#EasyCPUID_Model_Intel80486_SL = $4
#EasyCPUID_Model_Intel80486_SX2 = $5
#EasyCPUID_Model_Intel80486_DX2WB = $7
#EasyCPUID_Model_Intel80486_DX4 = $8
#EasyCPUID_Model_Intel80486_DX4WB = $9

#EasyCPUID_Model_UMC80486_U5D = $1
#EasyCPUID_Model_UMC80486_U5S = $2

#EasyCPUID_Model_AMD80486_DX2 = $3
#EasyCPUID_Model_AMD80486_DX2WB = $7
#EasyCPUID_Model_AMD80486_DX4 = $8
#EasyCPUID_Model_AMD80486_DX4WB = $9
#EasyCPUID_Model_AMD80486_Elan_SC400 = $A
#EasyCPUID_Model_AMD80486_5x86 = $E
#EasyCPUID_Model_AMD80486_5x86WB = $F

#EasyCPUID_Model_Cyrix5x86_5x86 = $9

#EasyCPUID_Model_MediaGX_GX_GXm = $4

#EasyCPUID_Model_IntelP5_P5_A_Step = $0
#EasyCPUID_Model_IntelP5_P5 = $1
#EasyCPUID_Model_IntelP5_P54C = $2
#EasyCPUID_Model_IntelP5_P24T_Overdrive = $3
#EasyCPUID_Model_IntelP5_P55C_1 = $4
#EasyCPUID_Model_IntelP5_P54C_2 = $7
#EasyCPUID_Model_IntelP5_P54C_25mirco = $8

#EasyCPUID_Model_NexGen_Nx586_Nx586FPU = $0

#EasyCPUID_Model_CyrixM1_6x86 = $2
#EasyCPUID_Model_CyrixM2_6x86MX = $0

#EasyCPUID_Model_Geode_GX1_GXLV_GXm = $4
#EasyCPUID_Model_Geode_GX2 = $5
#EasyCPUID_Model_Geode_lx = $A

#EasyCPUID_Model_AMDK5_SSA5_PR75_PR90_PR100 = $0
#EasyCPUID_Model_AMDK5_5k86_PR120_PR133 = $1
#EasyCPUID_Model_AMDK5_5k86_PR166 = $2
#EasyCPUID_Model_AMDK5_5k86_PR200 = $3

#EasyCPUID_Model_AMD_K6_30micro = $6
#EasyCPUID_Model_AMD_K6_25micro = $7
#EasyCPUID_Model_AMD_K6_2 = $8
#EasyCPUID_Model_AMD_K6_III = $9
#EasyCPUID_Model_AMD_K6_2Plus_K6_IIIPlus_18mirco = $D

#EasyCPUID_Model_Centaur_C6 = $4
#EasyCPUID_Model_Centaur_C2 = $8
#EasyCPUID_Model_Centaur_C3 = $9

#EasyCPUID_Model_VIAC3_CyrixM2 = $5
#EasyCPUID_Model_VIAC3_WinChipC5A = $6
#EasyCPUID_Model_VIAC3_WinChipC5B = $7
#EasyCPUID_Model_VIAC3_WinChipC5C = $7
#EasyCPUID_Model_VIAC3_WinChipC5N = $8
#EasyCPUID_Model_VIAC3_WinChipC5XL = $9
#EasyCPUID_Model_VIAC3_WinChipC5P = $9
#EasyCPUID_Model_VIAC3_WinChipC5J = $10

#EasyCPUID_Model_Rise_mP6_25mirco = $0
#EasyCPUID_Model_Rise_mP6_18mirco = $2

#EasyCPUID_Model_SiS_55x = $0

#EasyCPUID_Model_Transmeta_Crusoe_TM3x00_TM5x00 = $4

#EasyCPUID_Model_IntelP6_A_Step = $0
#EasyCPUID_Model_IntelP6_P6 = $1
#EasyCPUID_Model_IntelP6_P2_28micro = $3
#EasyCPUID_Model_IntelP6_P2_25micro = $5
#EasyCPUID_Model_IntelP6_P2_L2 = $6
#EasyCPUID_Model_IntelP6_P3_25micro = $7
#EasyCPUID_Model_IntelP6_P3_18microl2 = $8
#EasyCPUID_Model_IntelP6_PM_13mirco = $9
#EasyCPUID_Model_IntelP6_P3_18mirco = $A
#EasyCPUID_Model_IntelP6_P3_13mirco = $B
#EasyCPUID_Model_IntelP6_PM_9mirco = $D
#EasyCPUID_Model_IntelP6_PMDC_65nano = $E

#EasyCPUID_Model_AMDK7_Athlon_25micro = $1
#EasyCPUID_Model_AMDK7_Athlon_18mirco = $2
#EasyCPUID_Model_AMDK7_Duron_SF = $3
#EasyCPUID_Model_AMDK7_Athlon_TB = $4
#EasyCPUID_Model_AMDK7_Athlon_PM = $6
#EasyCPUID_Model_AMDK7_Duron_MG = $7
#EasyCPUID_Model_AMDK7_Athlon_TH_AP = $8
#EasyCPUID_Model_AMDK7_Athlon_BT = $A

#EasyCPUID_Model_AMDK8_Athlon64FX_Opteron = $5
#EasyCPUID_Model_AMDK8_Athlon64_1_754 = $4
#EasyCPUID_Model_AMDK8_Athlon64_1_939 = $7
#EasyCPUID_Model_AMDK8_Athlon64_2_754 = $8
#EasyCPUID_Model_AMDK8_Athlon64_2_939 = $B
#EasyCPUID_Model_AMDK8_Athlon64_3_754 = $C
#EasyCPUID_Model_AMDK8_Athlon64_3_939 = $F
#EasyCPUID_Model_AMDK8_Athlon64_3_754_ERR = $E

#EasyCPUID_Model_IntelP4_1_18mirco = $0
#EasyCPUID_Model_IntelP4_2_18mirco = $1
#EasyCPUID_Model_IntelP4_13mirco = $2
#EasyCPUID_Model_IntelP4_1_90nano = $3
#EasyCPUID_Model_IntelP4_2_90nano = $4
#EasyCPUID_Model_IntelP4_65nano = $6

#EasyCPUID_Model_IntelItanium_Merced = $0

#EasyCPUID_Model_IntelItanium2_McKinley = $0
#EasyCPUID_Model_IntelItanium2_Madison_Deerfield = $1
#EasyCPUID_Model_IntelItanium2_Madison9M = $2

#EasyCPUID_Model_IntelItanium2_DC_Montecito = $0

#EasyCPUID_BrandID_Notsupported = $00
#EasyCPUID_BrandID_18MircoIntelCeleron = $01
#EasyCPUID_BrandID_18MicroIntelPentiumIII = $02
#EasyCPUID_BrandID_18MicroIntelPentiumIIIXeon = $03
#EasyCPUID_BrandID_13MicroIntelCeleron = $03
#EasyCPUID_BrandID_13MicroIntelPentiumIII = $04
#EasyCPUID_BrandID_13MicroIntelCeleronmobile = $07
#EasyCPUID_BrandID_13MicroIntelPentiumIIImobile = $06
#EasyCPUID_BrandID_18MicroIntelCeleron4 = $0A
#EasyCPUID_BrandID_18MicroIntelPentium4 = $08
#EasyCPUID_BrandID_13MicroIntelPentium4 = $09
#EasyCPUID_BrandID_18MicroIntelPentium4Xeon = $0E
#EasyCPUID_BrandID_18MicroIntelPentium4XeonMP = $0B
#EasyCPUID_BrandID_13MicroIntelPentium4Xeon = $0B
#EasyCPUID_BrandID_13MicroIntelPentium4XeonMP = $0C
#EasyCPUID_BrandID_13MicroIntelCeleron4mobile0F24h = $08
#EasyCPUID_BrandID_13MicroIntelCeleron4mobile0F27h = $0F
#EasyCPUID_BrandID_13MicroIntelPentium4mobileProduction = $0E
#EasyCPUID_BrandID_13MicroIntelPentium4mobileSample = $0F
#EasyCPUID_BrandID_MobileIntelProcessor1 = $11
#EasyCPUID_BrandID_13MicroIntelCeleronM = $12
#EasyCPUID_BrandID_09MicroIntelCeleronM = $12
#EasyCPUID_BrandID_MobileIntelCeleronprocessor = $13
#EasyCPUID_BrandID_IntelCeleronProcessor = $14
#EasyCPUID_BrandID_MobileIntelProcessor2 = $15
#EasyCPUID_BrandID_13MicroIntelPentiumM = $16
#EasyCPUID_BrandID_9NanoIntelPentiumM = $16
#EasyCPUID_BrandID_MobileIntelCeleronProcessr = $17

#EasyCPUID_FeatureFlag_ETPRD = 46
#EasyCPUID_FeatureFlag_CX16 = 45
#EasyCPUID_FeatureFlag_CID = 42
#EasyCPUID_FeatureFlag_TM2 = 40
#EasyCPUID_FeatureFlag_EST = 39
#EasyCPUID_FeatureFlag_VMX = 37
#EasyCPUID_FeatureFlag_DSCPL = 36
#EasyCPUID_FeatureFlag_MON = 35
#EasyCPUID_FeatureFlag_SSE3 = 32
#EasyCPUID_FeatureFlag_PBE = 31
#EasyCPUID_FeatureFlag_IA64 = 30
#EasyCPUID_FeatureFlag_TM1 = 29
#EasyCPUID_FeatureFlag_HTT = 28
#EasyCPUID_FeatureFlag_SS = 27
#EasyCPUID_FeatureFlag_SSE2 = 26
#EasyCPUID_FeatureFlag_SSE = 25
#EasyCPUID_FeatureFlag_FXSR = 24
#EasyCPUID_FeatureFlag_MMX = 23
#EasyCPUID_FeatureFlag_ACPI = 22
#EasyCPUID_FeatureFlag_DTES = 21
#EasyCPUID_FeatureFlag_CLFL = 19
#EasyCPUID_FeatureFlag_PSN = 18
#EasyCPUID_FeatureFlag_PSE36 = 17
#EasyCPUID_FeatureFlag_PAT = 16
#EasyCPUID_FeatureFlag_CMOV = 15
#EasyCPUID_FeatureFlag_MCA = 14
#EasyCPUID_FeatureFlag_PGE = 13
#EasyCPUID_FeatureFlag_MTRR = 12
#EasyCPUID_FeatureFlag_SEP = 11
#EasyCPUID_FeatureFlag_APIC = 9
#EasyCPUID_FeatureFlag_CX8 = 8
#EasyCPUID_FeatureFlag_MCE = 7
#EasyCPUID_FeatureFlag_PAE = 6
#EasyCPUID_FeatureFlag_MSR = 5
#EasyCPUID_FeatureFlag_TSC = 4
#EasyCPUID_FeatureFlag_PSE = 3
#EasyCPUID_FeatureFlag_DE = 2
#EasyCPUID_FeatureFlag_VME = 1
#EasyCPUID_FeatureFlag_FPU = 0

Enumeration
  #EasyCPUID_Vendor_Unknown
  #EasyCPUID_Vendor_Intel
  #EasyCPUID_Vendor_UMC
  #EasyCPUID_Vendor_AMD
  #EasyCPUID_Vendor_Cyrix
  #EasyCPUID_Vendor_NexGen
  #EasyCPUID_Vendor_Centaur
  #EasyCPUID_Vendor_RiseTechnology
  #EasyCPUID_Vendor_SiS
  #EasyCPUID_Vendor_Transmeta
  #EasyCPUID_Vendor_NationalSemiconductor
EndEnumeration

Structure EasyCPU
  Tested.b
  MaximumSupportedStandardLevel.b
  VendorIDString.s
  Stepping.b
  model.b
  Family.b
  Type.b
  ExtendedModel.b
  ExtendedFamily.b
  BrandID.b
  CLFLUSH.b
  CPUCount.b
  APICID.b
  FeatureFlags.q
EndStructure

Global ExaminedCPU.EasyCPU

Procedure ExamineCPU()
  If ExaminedCPU\Tested = 0
    MaxStandard.l = 0 ;8 bit
    VendorIDH.l = 0 ;128 bit
    VendorIDM.l = 0
    VendorIDL.l = 0
    ExtendedFamily.l = 0 ;8 bit
    ExtendedModel.l = 0 ;4 bit
    Type.l = 0 ;2 bit
    Family.l = 0 ;4 bit
    model.l = 0 ;4 bit
    Stepping.l = 0 ;4 bit
    BrandID.l = 0 ;8 bit
    CLFLUSH.l ;8 bit
    CPUCount.l = 0 ;8 bit
    APICID.l ;8 bit
    FeatureFlagsH.l = 0 ;64 bit
    FeatureFlagsL.l = 0
    ProcessorConfiguration.l = 0 ;8 bit
    temp.b = 0 ;al
    tempa.l = 0 ;eax
    tempb.l = 0 ;ebx
    tempc.l = 0 ;ecx
    tempd.l = 0 ;edx
    ;Standard Level 0
    
    MOV Eax, 0
    !CPUID
    MOV MaxStandard, Eax
    MOV VendorIDH, Ebx
    MOV VendorIDM, Edx
    MOV VendorIDL, Ecx
    ExaminedCPU\MaximumSupportedStandardLevel = MaxStandard
    ExaminedCPU\VendorIDString = PeekS(@VendorIDH, 4) + PeekS(@VendorIDM, 4) + PeekS(@VendorIDL, 4)
    
    ;Standard Level 1
    If MaxStandard > 0
      MOV Eax, 1
      !CPUID
      MOV tempa, Eax
      MOV tempb, Ebx
      MOV tempc, Ecx
      MOV tempd, Edx
      
      Stepping = tempa & (#Bit_0 | #Bit_1 | #Bit_2 | #Bit_3)
      model = (tempa & (#Bit_4 | #Bit_5 | #Bit_6 | #Bit_7)) >> 4
      Family = (tempa & (#Bit_8 | #Bit_9 | #Bit_10 | #Bit_11)) >> 8
      Type = (tempa & (#Bit_12 | #Bit_13)) >> 12
      ExtendedModel = (tempa & (#Bit_16 | #Bit_17 | #Bit_18 | #Bit_19)) >> 14
      ExtendedFamily = (tempa & (#Bit_20 | #Bit_21 | #Bit_22 | #Bit_23 | #Bit_24 | #Bit_25 | #Bit_26 | #Bit_27)) >> 18
      
      BrandID = tempb & (#Bit_0 | #Bit_1 | #Bit_2 | #Bit_3 | #Bit_4 | #Bit_5 | #Bit_6 | #Bit_7)
      CLFLUSH = (tempb & (#Bit_8 | #Bit_9 | #Bit_10 | #Bit_11 | #Bit_12 | #Bit_13 | #Bit_14 | #Bit_15)) >> 8
      CPUCount = (tempb & (#Bit_16 | #Bit_17 | #Bit_18 | #Bit_19 | #Bit_20 | #Bit_21 | #Bit_22 | #Bit_23)) >> 16
      APICID = (tempb & (#Bit_24 | #Bit_25 | #Bit_26 | #Bit_27 | #Bit_28 | #Bit_29 | #Bit_30 | #Bit_31)) >> 24
      
      FeatureFlagsH = tempc
      FeatureFlagsL = tempd
      
      ExaminedCPU\Stepping = Stepping
      ExaminedCPU\model = model
      ExaminedCPU\Family = Family
      ExaminedCPU\Type = Type
      ExaminedCPU\ExtendedModel = ExtendedModel
      ExaminedCPU\ExtendedFamily = ExtendedFamily
      ExaminedCPU\BrandID = BrandID
      ExaminedCPU\CLFLUSH = CLFLUSH
      ExaminedCPU\CPUCount = CPUCount
      ExaminedCPU\APICID = APICID
      ExaminedCPU\FeatureFlags = (FeatureFlagsH << 32) | (FeatureFlagsL)
      
    EndIf
  EndIf
  
  ExaminedCPU\Tested = 1
EndProcedure

Procedure.b CPUVendorID(Vendor.s)
  Select Vendor
    Case #VendorID_Intel
      ProcedureReturn #EasyCPUID_Vendor_Intel
    Case #VendorID_UMC
      ProcedureReturn #EasyCPUID_Vendor_UMC
    Case #VendorID_AMD
      ProcedureReturn #EasyCPUID_Vendor_AMD
    Case #VendorID_Cyrix
      ProcedureReturn #EasyCPUID_Vendor_Cyrix
    Case #VendorID_NexGen
      ProcedureReturn #EasyCPUID_Vendor_NexGen
    Case #VendorID_Centaur
      ProcedureReturn #EasyCPUID_Vendor_Centaur
    Case #VendorID_Rise_Technology
      ProcedureReturn #EasyCPUID_Vendor_RiseTechnology
    Case #VendorID_SiS
      ProcedureReturn #EasyCPUID_Vendor_SiS
    Case #VendorID_Transmeta
      ProcedureReturn #EasyCPUID_Vendor_Transmeta
    Case #VendorID_National_Semiconductor
      ProcedureReturn #EasyCPUID_Vendor_NationalSemiconductor
    Default
      ProcedureReturn #EasyCPUID_Vendor_Unknown
  EndSelect
EndProcedure

Procedure.l CPUStepping()
  ProcedureReturn ExaminedCPU\Stepping
EndProcedure

Procedure.l CPUModel()
  ProcedureReturn ExaminedCPU\model
EndProcedure

Procedure.l CPUFamily()
  ProcedureReturn ExaminedCPU\Family
EndProcedure

Procedure.l CPUType()
  ProcedureReturn ExaminedCPU\Type
EndProcedure

Procedure.l CPUExtendedModel()
  ProcedureReturn ExaminedCPU\ExtendedModel
EndProcedure

Procedure.l CPUExtendedFamily()
  ProcedureReturn ExaminedCPU\ExtendedFamily
EndProcedure

Procedure.l CPUBrandID()
  ProcedureReturn ExaminedCPU\BrandID
EndProcedure

Procedure.l CPUCLFlush()
  ProcedureReturn ExaminedCPU\CLFLUSH
EndProcedure

Procedure.l CPUCoreCount()
  ProcedureReturn ExaminedCPU\CPUCount
EndProcedure

Procedure.l CPUAPICID()
  ProcedureReturn ExaminedCPU\APICID
EndProcedure

Procedure.l CPUFeatureFlag(FeatureFlag.q)
  ProcedureReturn (ExaminedCPU\FeatureFlags >> FeatureFlag) & 1
EndProcedure


;testing
ExamineCPU()

Debug CPUFeatureFlag(#EasyCPUID_FeatureFlag_SSE2)
Debug CPUAPICID()
Debug CPUCoreCount()
Debug CPUCLFlush()
Debug CPUBrandID()
Debug CPUExtendedFamily()
Debug CPUExtendedModel()
Debug CPUType()
Debug CPUFamily()
Debug CPUModel()
Debug CPUStepping()
Debug CPUVendorID(#VendorID_Intel)
~Dreglor
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

Post by bingo »

:D great !

pb can more than "openGAMEwindow" ...
["1:0>1"]
Fred
Administrator
Administrator
Posts: 18252
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Nice code !
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Why does this crash with the debugger enabled?
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

I have no crashes with the debugger open at least in the test code above

is there some code thats you could show, thats crashing for you?
~Dreglor
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Well, I just copy and paste the code above and run it. Then the program crashes with a message from Windows (sorry blah blah) when the debugger is enabled. When the debugger is not enabled it does not crash but obviously nothing is shown.

Edit: It just stopped crashing right in front of my eyes! :shock: :shock:
Edit: Now it crashes again!
Edit: It seems to be related to CPUExtendedFamily(), although it just crashed with it commented.

Edit: It crashes with Debug CPUExtendedFamily() and Debug CPUVendorID(#VendorID_Intel) but not when one of them is commented out. Debug CPUFeatureFlag(#EasyCPUID_FeatureFlag_SSE2) also seems to be unrest.
However, sometimes when I comment/uncomment something it behaves differently each time. Like, first, it crashed with ONLY Debug CPUVendorID(#VendorID_Intel). Now it doesn't.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Ack Trond.

Sorry mate, but it sounds like you have the "horse" trojan. It is not very prevalent but it can get past any protection (AV, FireWall, etc) know to humanity.

:?

Recently you or someone with access to your premises will have found a small wooden horse in the mailbox or outside the door. It is purported to be a "promotional present" from a local computer consultancy or PC business. It will have been taken inside.

When everyone was asleep tiny Gremlin I.T. Specialists (GITS) emerge from inside the horse. They lever the CPUs from your computers and replace them with TROY VIII chips. They then leave on the horse they rode in on (or in).

Moral: Beware of Geeks bearing Gits.
Dare2 cut down to size
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

dreglor,

Now that PB has macros, you can use my favorite trick (used in all my C programming)
to avoid having to enter all those "#Bit_xx" constants:

Code: Select all

Macro Bit(BitNum)
  (1 << BitNum)
EndMacro
Now you can just say "Bit(62)".

Sorry if this is old news!

Regards,
Eric
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Awesome tip Eric - thanks alot!
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

Awe shucks... I got a line 358 error: MOV Eax, 0 (that code).

I copied and pasted to PB, new window and F5'ed away and got that error.

Ideas?

TIA
Intrigued - Registered PureBasic, lifetime updates user
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

Intrigued wrote:Awe shucks... I got a line 358 error: MOV Eax, 0 (that code).

I copied and pasted to PB, new window and F5'ed away and got that error.

Ideas?

TIA
Turn inline asm on in the compiler options menu
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

Thanks Bonne_den_kule. That worked!

I forgot about that option being off by default.
Intrigued - Registered PureBasic, lifetime updates user
Post Reply