Infos Bios et CPU

cs_Lille59 Messages postés 1 Date d'inscription vendredi 8 novembre 2002 Statut Membre Dernière intervention 5 février 2003 - 5 févr. 2003 à 15:02
stephga Messages postés 7 Date d'inscription jeudi 21 août 2003 Statut Membre Dernière intervention 16 novembre 2003 - 16 nov. 2003 à 18:36
:question) Question pour un champion... :question)

Comment faire pour récupérer les infos du Bios et du processeur dans une API ???

Un grand merci à celui qui pourra me répondre ;)

Lille59

3 réponses

MorpionMx Messages postés 3466 Date d'inscription lundi 16 octobre 2000 Statut Membre Dernière intervention 30 octobre 2008 57
5 févr. 2003 à 19:43
Je serais pas champion cette fois, je crois :big)
0
xarier Messages postés 688 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 19 mai 2005
28 août 2003 à 17:47
c facile
now j'ai pas le c#mais je me rapele qu'il faut utilisé une classe c envirenement la tu va tout trouvé Ok c ta rien trouvé envoie moi un message puis je vais chercher
see you
0
stephga Messages postés 7 Date d'inscription jeudi 21 août 2003 Statut Membre Dernière intervention 16 novembre 2003
16 nov. 2003 à 18:36
Voici une classe qui pourra vous aider pour le CPU. Il existe la même chose pour le BIOS..... A vous de jouer

using System;
using System.Runtime.InteropServices;

namespace ClassInfoPc
{
/// <summary>
/// Fournis des information sur le proceseur
/// Type de processeur, Nombre de processeur...
/// ...
/// </summary>
public class CInfoProcesseur
{

/// <summary>
/// Public structure contenant les élément du processeur
/// L'accès à ces membres se fait par la classe CInfoMemoire
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct ProcesseurStatus
{
public uint dwOemId;
public uint dwPageSize;
public uint lpMinimumApplicationAddress;
public uint lpMaximumApplicationAddress;
public uint dwActiveProcessorMask;
public uint dwNumberOfProcessors;
public uint dwProcessorType;
public uint dwAllocationGranularity;
public uint dwProcessorLevel;
public uint dwProcessorRevision;
public string strProcesseur;
}

/// <summary>
/// Public structure contenant les élément du processeur
/// Nécessaires pour la lecture via la DLL
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEM_INFO
{
public uint dwOemId;
public uint dwPageSize;
public uint lpMinimumApplicationAddress;
public uint lpMaximumApplicationAddress;
public uint dwActiveProcessorMask;
public uint dwNumberOfProcessors;
public uint dwProcessorType;
public uint dwAllocationGranularity;
public uint dwProcessorLevel;
public uint dwProcessorRevision;
}

/// <summary>
/// Public constantes des types de processeurs
/// </summary>
public const int PROCESSOR_INTEL_386 = 386;
public const int PROCESSOR_INTEL_486 = 486;
public const int PROCESSOR_INTEL_PENTIUM = 586;
public const int PROCESSOR_MIPS_R4000 = 4000;
public const int PROCESSOR_ALPHA_21064 = 21064;

/// <summary>
/// privé contenant les informations lu grace à la methode "Get"
/// </summary>
public ProcesseurStatus m_StatusProc;

/// <summary>
/// Constructeur Lecture des infos processeur
/// </summary>
public CInfoProcesseur()
{
// Lecture des information sur la memoire
m_StatusProc = Get();
}

/// <summary>
/// privé Accès DLL "kernel32.dll"
/// </summary>
[DllImport("kernel32.dll")]
static extern void GetSystemInfo(ref SYSTEM_INFO pSI);

/// <summary>
/// privé pour la lecture des informations du processeur
/// </summary>
/// <returns>Retourne un objet de type SystemInfo avec tous les membres initialisés</returns>
public static ProcesseurStatus Get()
{
ProcesseurStatus SysInfo = new ProcesseurStatus();
SYSTEM_INFO pSI = new SYSTEM_INFO();
GetSystemInfo(ref pSI);

SysInfo.strProcesseur = "(unknown)";
if (pSI.dwProcessorType == PROCESSOR_INTEL_386)
{
SysInfo.strProcesseur = "Intel 386";
}
if (pSI.dwProcessorType == PROCESSOR_INTEL_486)
{
SysInfo.strProcesseur = "Intel 486" ;
}
if (pSI.dwProcessorType == PROCESSOR_INTEL_PENTIUM)
{
SysInfo.strProcesseur = "Intel Pentium";
}
if (pSI.dwProcessorType == PROCESSOR_MIPS_R4000)
{
SysInfo.strProcesseur = "MIPS R4000";
}
if (pSI.dwProcessorType == PROCESSOR_ALPHA_21064)
{
SysInfo.strProcesseur = "DEC Alpha 21064";
}
SysInfo.dwActiveProcessorMask = pSI.dwActiveProcessorMask;
SysInfo.dwAllocationGranularity = pSI.dwAllocationGranularity;
SysInfo.dwNumberOfProcessors = pSI.dwNumberOfProcessors;
SysInfo.dwOemId = pSI.dwOemId;
SysInfo.dwPageSize = pSI.dwPageSize;
SysInfo.dwProcessorLevel = pSI.dwProcessorLevel;
SysInfo.dwProcessorRevision = pSI.dwProcessorRevision;
SysInfo.dwProcessorType = pSI.dwProcessorType;

return SysInfo;
}

/// <summary>
/// Public renvoi le type de processeur
/// PROCESSOR_INTEL_386
/// PROCESSOR_INTEL_486
/// PROCESSOR_INTEL_PENTIUM
/// PROCESSOR_MIPS_R4000
/// PROCESSOR_ALPHA_21064
/// </summary>
/// <returns>Retourne la mémoire physique totale en octets.</returns>
public string GetTypeProcesseur()
{
return m_StatusProc.strProcesseur;
}
}
}
0
Rejoignez-nous