Parametry komputera, procesor, karta graficzna itp.

0

Czy ktoś wie za pomocą jakiej funkcji mogę uzyskać podstawowe parametry nt. komputera (dane procesora, karty graficznej, ...) ? Za pomoc z góry dziękuję.

0

Na jaki system?

0

Chodzi o funkcje w asemblerze, konkretnie pod masm32.

0

Czy ktoś wie za pomocą jakiej funkcji mogę uzyskać podstawowe parametry nt. komputera

Google wie.

0

Oczywiście, że Windows :D

0

Z tym trochę "zabawy" jest bo chcąc to porządnie zrobić trzeba by użyć WMI znalazłem przykład pobrania biosu płyty:
http://www.movsd.com/board/index.php?PHPSESSID=9097b2290ca5b9c411238bb2aba29e01&topic=12335.msg94562#msg94562

Musiałbyś poszukać jak to jest robione w innych językach i tłumaczyć na MASM32 tu masz np. w Delphi http://www.magsys.co.uk/delphi/magwmi.asp

EDIT// Po lekkich przeróbkach przerobiłem na pobranie nazwy procesora i karty graficznej prawdopodobnie też z niewielkimi przeróbkami można by pobrać wiele więcej informacji tylko trzeba by poszukać jakie mają być zapytania.

Kod w MASM (z zakomentowanym starym kodem aby było widać tylko co zmieniałem) pobrania nazwy procesora i karty graficznej (jest to aplikacja konsolowa):

.586
.MODEL FLAT,STDCALL
OPTION CASEMAP:NONE

INCLUDE \masm32\include\windows.inc
INCLUDE \masm32\include\kernel32.inc
INCLUDE \masm32\include\ole32.inc
INCLUDE \masm32\include\msvcrt.inc
;INCLUDE \masm32\include\gel32.inc

INCLUDELIB \masm32\lib\kernel32.lib
INCLUDELIB \masm32\lib\ole32.lib
INCLUDELIB \masm32\lib\msvcrt.lib
;INCLUDELIB \masm32\lib\gel32.lib

INCLUDE f:\masm32\macros\ucmacros.asm

; located in ObjIdl.h

EOAC_NONE   EQU 0

; located in RpcDce.h

RPC_C_AUTHN_LEVEL_DEFAULT   EQU 0
RPC_C_IMP_LEVEL_DEFAULT     EQU 0

RPC_C_IMP_LEVEL_IMPERSONATE EQU 3

GUID2 STRUC
     dd1 DWORD ?
     dw1 WORD ?
     dw2 WORD ?
     db1 BYTE ?
     db2 BYTE ?
     db3 BYTE ?
     db4 BYTE ?
     db5 BYTE ?
     db6 BYTE ?
     db7 BYTE ?
     db8 BYTE ?
GUID2 ENDS

IWbemLocator STRUCT
    lpVtbl DWORD   ?
IWbemLocator ENDS

IWbemLocatorVtbl STRUCT
    QueryInterface DWORD   ?
    AddRef         DWORD   ?
    Release        DWORD   ?
    ConnectServer  DWORD   ?
IWbemLocatorVtbl ENDS

IWbemServices STRUCT
    lpVtbl DWORD   ?
IWbemServices ENDS

IWbemServicesVtbl STRUCT
    QueryInterface             DWORD   ?
    AddRef                     DWORD   ?
    Release                    DWORD   ?
    OpenNamespace              DWORD   ?
    CancelAsyncCall            DWORD   ?
    QueryObjectSink            DWORD   ?
    GetObject                  DWORD   ?
    GetObjectAsync             DWORD   ?
    PutClass                   DWORD   ?
    PutClassAsync              DWORD   ?
    DeleteClass                DWORD   ?
    DeleteClassAsync           DWORD   ?
    CreateClassEnum            DWORD   ?
    CreateClassEnumAsync       DWORD   ?
    PutInstance                DWORD   ?
    PutInstanceAsync           DWORD   ?
    DeleteInstance             DWORD   ?
    DeleteInstanceAsync        DWORD   ?
    CreateInstanceEnum         DWORD   ?
    CreateInstanceEnumAsync    DWORD   ?
    ExecQuery                  DWORD   ?
    ExecQueryAsync             DWORD   ?
    ExecNotificationQuery      DWORD   ?
    ExecNotificationQueryAsync DWORD   ?
    ExecMethod                 DWORD   ?
    ExecMethodAsync            DWORD   ?
IWbemServicesVtbl ENDS

IEnumWbemClassObject STRUCT
    lpVtbl          DWORD   ?
IEnumWbemClassObject ENDS

IEnumWbemClassObjectVtbl STRUCT
    QueryInterface DWORD   ?
    AddRef         DWORD   ?
    Release        DWORD   ?
    Reset          DWORD   ?
    Next           DWORD   ?
    NextAsync      DWORD   ?
    Clone          DWORD   ?
    Skip           DWORD   ?
IEnumWbemClassObjectVtbl ENDS

IWbemClassObject STRUCT
    lpVtbl DWORD   ?
IWbemClassObject ENDS

IWbemClassObjectVtbl STRUCT
    QueryInterface          DWORD   ?
    AddRef                  DWORD   ?
    Release                 DWORD   ?
    GetQualifierSet         DWORD   ?
    Get                     DWORD   ?
    Put                     DWORD   ?
    Delete                  DWORD   ?
    GetNames                DWORD   ?
    BeginEnumeration        DWORD   ?
    Next                    DWORD   ?
    EndEnumeration          DWORD   ?
    GetPropertyQualifierSet DWORD   ?
    GetObjectText           DWORD   ?
    SpawnDerivedClass       DWORD   ?
    SpawnInstance           DWORD   ?
    CompareTo               DWORD   ?
    GetPropertyOrigin       DWORD   ?
    InheritsFrom            DWORD   ?
    GetMethod               DWORD   ?
    PutMethod               DWORD   ?
    DeleteMethod            DWORD   ?
    BeginMethodEnumeration  DWORD   ?
    NextMethod              DWORD   ?
    EndMethodEnumeration    DWORD   ?
    GetMethodQualifierSet   DWORD   ?
    GetMethodOrigin         DWORD   ?
IWbemClassObjectVtbl ENDS

SAFEARRAYBOUND struct
cElements dd ?
lLbound dd ?
SAFEARRAYBOUND ends
   
SAFEARRAY    struct
cDims dw ?
fFeatures dw ?
cbElements dd ?
cLocks dd ?
pvData dd ?
rgsabound SAFEARRAYBOUND <>
SAFEARRAY ends

.CONST
   
    wszSelect  WORD "S","E","L","E","C","T"," ","*"," ","F","R","O","M"," ",0  ; the WSTR macro can't handle the asterisk
    wszCrLf    WORD 13,10,0


    ;WSTR        wszClass,    "Win32_BIOS"    ;<<< Set class here
    ;WSTR        wszProperty, "BIOSVersion"  ;<<< Set property here
    
    WSTR        wszClassProc,   "Win32_Processor"    ;<<< Set class here
    WSTR        wszClassVideo,    "Win32_VideoController"    ;<<< Set class here
    
    WSTR        wszProperty, "Name"  ;<<< Set property here
    wstrCPUName		dw	"P","r","o","c","e","s","o","r",":"," ","%","s",13,10,00
    wstrVideoName	dw	"G","r","a","f","i","k","a",":"," ","%","s",00
    

    WSTR        wszNameSpace, "root\cimv2"
    WSTR        wszQueryLanguage, "WQL"
   
    WSTR        wszMsg, "Serial Number %i: %s"
   
WaitKeyW proto :PTR WORD
.DATA

    ; located in WbemCli.h
   
    WBEM_FLAG_CONNECT_USE_MAX_WAIT  EQU     80h
    WBEM_FLAG_FORWARD_ONLY          EQU     20h
    WBEM_INFINITE                   EQU     -1
    WBEM_E_INVALID_QUERY            EQU     80041017h
    WBEM_E_INVALID_QUERY_TYPE       EQU     80041018h
   
    IID_IWbemLocator                GUID2   <0dc12a687h,0737fh,011cfh,088h,04dh,000h,0aah,000h,04bh,02eh,024h>
   
    IID_IEnumWbemClassObject        GUID2   <027947e1h,0d731h,011ceh,0a3h,057h,000h,000h,000h,000h,000h,001h>
   
    IID_IWbemClassObject            GUID2   <0dc12a681h,0737fh,011cfh,088h,04dh,000h,0aah,000h,04bh,02eh,024h>
   
    ; located in WbemProv.h
   
    CLSID_WbemAdministrativeLocator GUID2   <0cb8555cch,09128h,011d1h,0adh,09bh,000h,0c0h,04fh,0d8h,0fdh,0ffh>
   
    locator     IWbemLocator            <>
    service     IWbemServices           <>
    enumerator  IEnumWbemClassObject    <>
    processor   IWbemClassObject        <>
   
    retCount    DWORD   ?
   
    var_val     DWORD   ?
                DWORD   ?
                DWORD   ?
                DWORD   ?


    pwszResult  PWORD   ?             
               
    wszQuery   WORD 256 dup(?)               

.CODE

  main:
   
    INVOKE CoInitializeEx, NULL, COINIT_MULTITHREADED
   
    INVOKE CoInitializeSecurity, NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL
       
    INVOKE CoCreateInstance, ADDR CLSID_WbemAdministrativeLocator, NULL, CLSCTX_INPROC_SERVER, ADDR IID_IWbemLocator, ADDR locator

    INVOKE lstrcatW, ADDR wszQuery, ADDR wszSelect
    INVOKE lstrcatW, ADDR wszQuery, ADDR wszClassProc
   
    mov esi, locator
    lodsd
    push    OFFSET service
    push    NULL
    push    NULL
    push    WBEM_FLAG_CONNECT_USE_MAX_WAIT
    push    NULL
    push    NULL
    push    NULL
    push    OFFSET wszNameSpace
    push    DWORD PTR [locator]
    call    DWORD PTR [eax][IWbemLocatorVtbl.ConnectServer]

    mov esi, service
    lodsd
    push    OFFSET enumerator
    push    NULL
    push    WBEM_FLAG_FORWARD_ONLY
    push    OFFSET wszQuery
    push    OFFSET wszQueryLanguage
    push    DWORD PTR [service]
    call    DWORD PTR [eax][IWbemServicesVtbl.ExecQuery]

    mov esi, enumerator
    lodsd
    push    OFFSET retCount
    push    OFFSET processor
    push    TRUE
    push    WBEM_INFINITE
    push    DWORD PTR [enumerator]
    call    DWORD PTR [eax][IEnumWbemClassObjectVtbl.Next]
   
    mov esi, processor
    lodsd
    push    NULL
    push    NULL
    push    OFFSET var_val
    push    0
    push    OFFSET wszProperty
    push    DWORD PTR [processor]
    call    DWORD PTR [eax][IWbemClassObjectVtbl.Get]
   
    mov esi, [var_val]
    mov edi, [var_val + 4]
    mov ecx, [var_val + 8]
 
	invoke crt_wprintf,
		addr wstrCPUName,
		ecx
 
 
    INVOKE RtlZeroMemory, ADDR wszQuery, 256
 
    INVOKE lstrcatW, ADDR wszQuery, ADDR wszSelect
    INVOKE lstrcatW, ADDR wszQuery, ADDR wszClassVideo 
   
    mov esi, service
    lodsd
    push    OFFSET enumerator
    push    NULL
    push    WBEM_FLAG_FORWARD_ONLY
    push    OFFSET wszQuery
    push    OFFSET wszQueryLanguage
    push    DWORD PTR [service]
    call    DWORD PTR [eax][IWbemServicesVtbl.ExecQuery]

    mov esi, enumerator
    lodsd
    push    OFFSET retCount
    push    OFFSET processor
    push    TRUE
    push    WBEM_INFINITE
    push    DWORD PTR [enumerator]
    call    DWORD PTR [eax][IEnumWbemClassObjectVtbl.Next]
   
    mov esi, processor
    lodsd
    push    NULL
    push    NULL
    push    OFFSET var_val
    push    0
    push    OFFSET wszProperty
    push    DWORD PTR [processor]
    call    DWORD PTR [eax][IWbemClassObjectVtbl.Get]
   
    mov esi, [var_val]
    mov edi, [var_val + 4]
    mov ecx, [var_val + 8]
 
	invoke crt_wprintf,
		addr wstrVideoName,
		ecx   
   
   
   

;mov esi,[ecx].SAFEARRAY.pvData
;mov edi,[ecx].SAFEARRAY.rgsabound.cElements

 ;   INVOKE crt_wprintf, ADDR wszCrLf
   
   

   
;.while edi
;  mov ecx,[esi]
;  INVOKE crt_wprintf, ADDR wszMsg, edi,ecx
;  INVOKE crt_wprintf, ADDR wszCrLf
;dec edi
 ;  add esi,4
;.endw



    INVOKE crt_wprintf, ADDR wszCrLf

    INVOKE CoUninitialize
   
    INVOKE WaitKeyW, uni$("Press any key to exit ...")
   
    INVOKE ExitProcess, 0

WaitKeyW PROC pwszPrompt:PTR WORD
    .DATA
        IFNDEF wszCrLf
            wszCrLf WORD 13,10,0
        ENDIF
    .CODE   
    .IF pwszPrompt == NULL
        INVOKE crt_wprintf, ADDR wszCrLf
        INVOKE crt_wprintf, uni$("Press any key to continue ... ")
    .ELSE
        INVOKE crt_wprintf, ADDR wszCrLf
        INVOKE crt_wprintf, pwszPrompt
    .ENDIF   
    INVOKE crt__getch
    .IF (eax == 0) || (eax == 0E0h)
        INVOKE crt__getch
    .ENDIF
    INVOKE crt_wprintf, ADDR wszCrLf
    ret
WaitKeyW ENDP
;======================================================
   
END main
0

Nie da się skompoilować :/

***********
ASCII build
***********

************************************************************************
************************************************************************
************************************************************************

The file UCMACROS.ASM is no longer used, the macros that the earlier
version contained are now in the main macro file "MACROS.ASM".
Remove this file name from your include files to build your application.

************************************************************************
************************************************************************
************************************************************************
proc.asm(158) : error A2008: syntax error : WSTR
proc.asm(159) : error A2008: syntax error : WSTR
proc.asm(161) : error A2008: syntax error : WSTR
proc.asm(166) : error A2008: syntax error : WSTR
proc.asm(167) : error A2008: syntax error : WSTR
proc.asm(169) : error A2008: syntax error : WSTR
proc.asm(220) : error A2006: undefined symbol : wszClassProc
proc.asm(220) : error A2114: INVOKE argument type mismatch : argument : 2
proc.asm(276) : error A2006: undefined symbol : wszClassVideo
proc.asm(276) : error A2114: INVOKE argument type mismatch : argument : 2
proc.asm(340) : error A2006: undefined symbol : uni$
proc.asm(340) : error A2114: INVOKE argument type mismatch : argument : 1
proc.asm(352) : error A2006: undefined symbol : uni$
proc.asm(352) : error A2114: INVOKE argument type mismatch : argument : 0
proc.asm(231) : error A2006: undefined symbol : wszNameSpace
proc.asm(241) : error A2006: undefined symbol : wszQueryLanguage
proc.asm(260) : error A2006: undefined symbol : wszProperty
proc.asm(284) : error A2006: undefined symbol : wszQueryLanguage
proc.asm(303) : error A2006: undefined symbol : wszProperty
c:\masm32\macros\ucmacros.asm(13) : error A2052: forced error
0

Czytając błąd zamiast wklejać go na forum:

The file UCMACROS.ASM is no longer used, the macros that the earlier
version contained are now in the main macro file "MACROS.ASM".
Remove this file name from your include files to build your application.

1 użytkowników online, w tym zalogowanych: 0, gości: 1