Aller au contenu
  • Pas encore inscrit ?

    Pourquoi ne pas vous inscrire ? C'est simple, rapide et gratuit.
    Pour en savoir plus, lisez Les avantages de l'inscription... et la Charte de Zébulon.
    De plus, les messages que vous postez en tant qu'invité restent invisibles tant qu'un modérateur ne les a pas validés. Inscrivez-vous, ce sera un gain de temps pour tout le monde, vous, les helpeurs et les modérateurs ! :wink:

Comment détecter si l'on est sous Seven 64 ou 32 bits ?


Arnaud

Messages recommandés

Bonjour à tous :)

 

La question a dû être mille fois posée, mais je ne trouve pas de réponse.

 

Comment détecter, en programmation, si l'OS est 32 ou 64 bits ? C'est important, notamment pour moi, devant, encore un certain temps, utiliser W7 32 sur le Pc-1.

 

Merci :hello:

 

P.S.: même mes recherches Google ne me répondent pas. Foultitude de questions relatives à la différence entre 64 et 32 bits, mais pas comment effectuer la détection.

 

Proprement, s'entend : le répertoire C:\Program Files (x86) ne devant se trouver, en principe, que sous 64 bits. Mais ce n'est ni très sûr, ni très adroit : il doit bien exister un autre moyen...

Lien vers le commentaire
Partager sur d’autres sites

Salut,

 

Je n'ai pas de système Windows 7 sous la main, mais normalement tu verras ici quel système d'exploitation tu possèdes : Démarrer / Panneau de configuration / Système et sécurité / Système.

 

Bye

Lien vers le commentaire
Partager sur d’autres sites

  • 4 semaines après...

Salut à tous,

 

Euh qu'appelles tu par programmation ?

Depuis quel langage ?

 

Dans l'absolu tu peux par exemple vérifier la présence du dossier SysWOW64 dans C:\Windows, ceci dans le cas d'un script bat par exemple, ou encore en vérifiant l'existence de la variable d'environnement "CommonProgramW6432"

Mais ce n'est pas une vraie garantie car un utilisateur sous Win32 pourrait avoir créé ces éléments.

La variable d'environnement "PROCESSOR_ARCHITECTURE" devrait convenir je pense mais je ne suis pas certain qu'elle fasse référence à l'architecture utilisée et non à l'architecture supportée par le CPU.

 

Mais si tu dev depuis un langage de plus bas-niveau genre C/C++ tu peux faire appel à la fonction de l'API Win32 nomée GetSystemInfo et la structure SYSTEM_INFO dans laquelle tu trouveras un champ "wProcessorArchitecture" qui t'indiquera de façon certaine si tu es sous 32 ou 64 bits.

 

 

 

 

Lien vers le commentaire
Partager sur d’autres sites

bonsoir

 

peut être avec un fichier.bat (batch)

à tester

 

@echo off

cls

set vwin= &set archi= &set sp=

color 0A

title OS detect by Servabat et Alendra

ver | find /i "version 6.1." > nul

if %errorlevel%==0 set vwin=Windows 7

ver | find /i "version 6.0." > nul

if %errorlevel%==0 set vwin=Windows Vista

ver | find /i "version 5.1." > nul

if %errorlevel%==0 set vwin=Windows XP

ver | find /i "version 5.2." > nul

if %errorlevel%==0 set vwin=Windows 2003

ver | find /i "Windows 2000" > nul

if %errorlevel%==0 set vwin=Windows 2000

ver | find /i "Windows NT" > nul

if %errorlevel%==0 set vwin=Windows NT

ver | find /i ">Windows ME" > nul

if %errorlevel%==0 set vwin=Windows ME

ver | find /i "Windows 98" > nul

if %errorlevel%==0 set vwin=Windows 98

ver | find /i "Windows 95" > nul

if %errorlevel%==0 set vwin=Windows 95

if %PROCESSOR_ARCHITECTURE%==AMD64 (set archi=64bits)

if %PROCESSOR_ARCHITECTURE%==x86 (set archi=32bits)

if defined PROCESSOR_ARCHITEW6432 (set archi=Processus 32 bits sur une plateforme 64 bits)

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDversion >NUL 2>NUL || goto aftertest

for /f "delims=: tokens=*" %%X in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDversion ^| find "Service Pack 3"') do set SP=3

for /f "delims=: tokens=*" %%X in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDversion ^| find "Service Pack 2"') do set SP=2

for /f "delims=: tokens=*" %%X in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDversion ^| find "Service Pack 1"') do set SP=1

:aftertest

if "%sp%"=="" (

set typeOS=%vwin% %archi% without service pack

goto end

)

set typeOS=%vwin% Service Pack %sp% %archi%

:end

echo %typeOS%

pause

exit

Modifié par morron2
Lien vers le commentaire
Partager sur d’autres sites

Alors :

 

1/ Le fichier de commandes : super ! Le résultat est ici (à condition que l'image passe) :

 

1164716260.png

 

2/ Je voulais parler de programmation en Delphi (Pascal, donc) avec appel bien sûr aux API de Widows. La structure SYSTEM_INFO ne m'informe que sur le matériel , et pas sur la version 32 ou 64 bits. La structure en question :

typedef struct _SYSTEM_INFO { // sinf 

union { 
   	DWORD  dwOemId; 
   	struct { 
       	WORD wProcessorArchitecture; 
       	WORD wReserved; 
   	}; 
}; 
DWORD  dwPageSize; 
LPVOID lpMinimumApplicationAddress; 
LPVOID lpMaximumApplicationAddress; 
DWORD  dwActiveProcessorMask; 
DWORD  dwNumberOfProcessors; 
DWORD  dwProcessorType; 
DWORD  dwAllocationGranularity; 
WORD  wProcessorLevel; 
WORD  wProcessorRevision; 
} SYSTEM_INFO; 

 

MAIS on m'a passé un code me retournant si je suis effectivement sous 64 ou 32 bits. Le voici : un fonction retournant un string nommant l'OS. Ne comprenant pas bien ce source, j'en suis réduit à utiliser Pos() sur le string retourné, à la recherche de "64-bit" :D ! Je ne suis pas doué ? Non, je sais :D Mais le code est un peu sophistiqué :

 

function GetWindowsVersion: string;
type
 TGNSI = procedure(var lpSystemInfo: TSystemInfo); stdcall;
 TGPI = function(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion,
dwSpMinorVersion: DWORD; var pdwReturnedProductType: DWORD): BOOL; stdcall;

 _OSVERSIONINFOEX = record
dwOSVersionInfoSize: DWORD;
dwMajorVersion: DWORD;
dwMinorVersion: DWORD;
dwBuildNumber: DWORD;
dwPlatformId: DWORD;
szCSDVersion: array [0 .. 127] of AnsiChar;
wServicePackMajor: WORD;
wServicePackMinor: WORD;
wSuiteMask: WORD;
wProductType: BYTE;
wReserved: BYTE;
 end;

const
 // wSuiteMask
 VER_SUITE_SMALLBUSINESS = $1;
 VER_SUITE_ENTERPRISE = $2;
 VER_SUITE_BACKOFFICE = $4;
 VER_SUITE_COMMUNICATIONS = $8;
 VER_SUITE_TERMINAL = $10;
 VER_SUITE_SMALLBUSINESS_RESTRICTED = $20;
 VER_SUITE_EMBEDDEDNT = $40;
 VER_SUITE_DATACENTER = $80;
 VER_SUITE_SINGLEUSERTS = $100;
 VER_SUITE_PERSONAL = $200;
 VER_SUITE_BLADE = $400;
 VER_SUITE_WH_SERVER = $800;
 VER_SUITE_STORAGE_SERVER = $2000;
 VER_SUITE_COMPUTE_SERVER = $4000;
 // wProductType
 VER_NT_WORKSTATION = $1;
 VER_NT_DOMAIN_CONTROLLER = $2;
 VER_NT_SERVER = $3;

 PRODUCT_BUSINESS = $6; // Business
 PRODUCT_BUSINESS_N = $10; // Business N
 PRODUCT_CLUSTER_SERVER = $12; // HPC Edition
 PRODUCT_DATACENTER_SERVER = $8; // Server Datacenter (full installation)
 PRODUCT_DATACENTER_SERVER_CORE = $C; // Server Datacenter (core installation)
 PRODUCT_DATACENTER_SERVER_CORE_V = $27;
 // Server Datacenter without Hyper-V (core installation)
 PRODUCT_DATACENTER_SERVER_V = $25;
 // Server Datacenter without Hyper-V (full installation)
 PRODUCT_ENTERPRISE = $4; // Enterprise
 PRODUCT_ENTERPRISE_N = $1B; // Enterprise N
 PRODUCT_ENTERPRISE_SERVER = $A; // Server Enterprise (full installation)
 PRODUCT_ENTERPRISE_SERVER_CORE = $E; // Server Enterprise (core installation)
 PRODUCT_ENTERPRISE_SERVER_CORE_V = $29;
 // Server Enterprise without Hyper-V (core installation)
 PRODUCT_ENTERPRISE_SERVER_IA64 = $F;
 // Server Enterprise for Itanium-based Systems
 PRODUCT_ENTERPRISE_SERVER_V = $26;
 // Server Enterprise without Hyper-V (full installation)
 PRODUCT_HOME_BASIC = $2; // Home Basic
 PRODUCT_HOME_BASIC_N = $5; // Home Basic N
 PRODUCT_HOME_PREMIUM = $3; // Home Premium
 PRODUCT_HOME_PREMIUM_N = $1A; // Home Premium N
 PRODUCT_HYPERV = $2A; // Server Hyper-V
 PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = $1E;
 // Windows Essential Business Server Management Server
 PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = $20;
 // Windows Essential Business Server Messaging Server
 PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = $1F;
 // Windows Essential Business Server Security Server
 PRODUCT_SERVER_FOR_SMALLBUSINESS = $18;
 // Windows Server 2008 for Windows Essential Server Solutions
 PRODUCT_SERVER_FOR_SMALLBUSINESS_V = $23;
 // Windows Server 2008 without Hyper-V for Windows Essential Server Solutions
 PRODUCT_SMALLBUSINESS_SERVER = $9; // Windows Small Business Server
 PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = $19;
 PRODUCT_STANDARD_SERVER = $7; // Server Standard (full installation)
 PRODUCT_STANDARD_SERVER_CORE = $D; // Server Standard (core installation)
 PRODUCT_STANDARD_SERVER_CORE_V = $28;
 // Server Standard without Hyper-V (core installation)
 PRODUCT_STANDARD_SERVER_V = $24;
 // Server Standard without Hyper-V (full installation)
 PRODUCT_STARTER = $B; // Starter
 PRODUCT_STORAGE_ENTERPRISE_SERVER = $17; // Storage Server Enterprise
 PRODUCT_STORAGE_EXPRESS_SERVER = $14; // Storage Server Express
 PRODUCT_STORAGE_STANDARD_SERVER = $15; // Storage Server Standard
 PRODUCT_STORAGE_WORKGROUP_SERVER = $16; // Storage Server Workgroup
 PRODUCT_UNDEFINED = $0; // An unknown product
 PRODUCT_ULTIMATE = $1; // Ultimate
 PRODUCT_ULTIMATE_N = $1C; // Ultimate N
 PRODUCT_WEB_SERVER = $11; // Web Server (full installation)
 PRODUCT_WEB_SERVER_CORE = $1D; // Web Server (core installation)

 SM_SERVERR2 = 89;
 PROCESSOR_ARCHITECTURE_INTEL = 0;
 PROCESSOR_ARCHITECTURE_IA64 = 6;
 PROCESSOR_ARCHITECTURE_AMD64 = 9;

 BUFSIZE = 80;
var
 OSVERSIONINFOEX: _OSVERSIONINFOEX;
 OSVERSIONINFO: _OSVERSIONINFO absolute OSVERSIONINFOEX;
 si: SYSTEM_INFO;
 pGNSI: TGNSI;
 pGPI: TGPI;
 bOsVersionInfoEx: Boolean;
 hdlKey: HKEY;
 lRet: LONGINT;
 szProductType: array [0 .. Pred(BUFSIZE)] of Char;
 dwBufLen, dwType: DWORD;
begin
 Result := '';
 // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
 // If that fails, try using the OSVERSIONINFO structure.
 ZeroMemory(@si, sizeof(SYSTEM_INFO));
 ZeroMemory(@OSVERSIONINFO, sizeof(_OSVERSIONINFOEX));
 OSVERSIONINFO.dwOSVersionInfoSize := sizeof(_OSVERSIONINFOEX);
 bOsVersionInfoEx := GetVersionEx(OSVERSIONINFO);
 if not bOsVersionInfoEx then
 begin
OSVERSIONINFO.dwOSVersionInfoSize := sizeof(_OSVERSIONINFO);
if not GetVersionEx(OSVERSIONINFO) then
 	Exit;
 end;

 // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
 pGNSI := GetProcAddress(GetModuleHandle('kernel32.dll'),
'GetNativeSystemInfo');
 if Assigned(pGNSI) then
pGNSI(si)
 else
GetSystemInfo(si);

 case OSVERSIONINFO.dwPlatformId of
// Test for the Windows NT product family.
VER_PLATFORM_WIN32_NT:
 	begin
   	// Test for the specific product family.
   	Result := 'Unknown Windows';
   	if (OSVERSIONINFO.dwMajorVersion = 6) then
   	begin
     	case OSVERSIONINFO.dwMinorVersion of
       	0:
         	if (OSVERSIONINFOEX.wProductType = VER_NT_WORKSTATION) then
           	Result := 'Windows Vista'
         	else
           	Result := 'Windows Server 2008';
       	1:
         	begin
           	if (OSVERSIONINFOEX.wProductType = VER_NT_WORKSTATION) then
             	Result := 'Windows Seven'
           	else
             	Result := 'Windows Server 2008 R2';
         	end;
     	end;
     	pGPI := GetProcAddress(GetModuleHandle('kernel32.dll'),
       	'GetProductInfo');
     	pGPI(6, 0, 0, 0, dwType);

     	case dwType of
       	PRODUCT_ULTIMATE:
         	Result := Result + ' Ultimate Edition';
       	PRODUCT_HOME_PREMIUM:
         	Result := Result + ' Home Premium Edition';
       	PRODUCT_HOME_BASIC:
         	Result := Result + ' Home Basic Edition';
       	PRODUCT_ENTERPRISE:
         	Result := Result + ' Enterprise Edition';
       	PRODUCT_BUSINESS:
         	Result := Result + ' Business Edition';
       	PRODUCT_STARTER:
         	Result := Result + ' Starter Edition';
       	PRODUCT_CLUSTER_SERVER:
         	Result := Result + ' Cluster Server Edition';
       	PRODUCT_DATACENTER_SERVER:
         	Result := Result + ' Datacenter Edition';
       	PRODUCT_DATACENTER_SERVER_CORE:
         	Result := Result + ' Datacenter Edition (core installation)';
       	PRODUCT_ENTERPRISE_SERVER:
         	Result := Result + ' Enterprise Edition';
       	PRODUCT_ENTERPRISE_SERVER_CORE:
         	Result := Result + ' Enterprise Edition (core installation)';
       	PRODUCT_ENTERPRISE_SERVER_IA64:
         	Result := Result +
           	' Enterprise Edition for Itanium-based Systems';
       	PRODUCT_SMALLBUSINESS_SERVER:
         	Result := Result + ' Small Business Server';
       	PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
         	Result := Result + ' Small Business Server Premium Edition';
       	PRODUCT_STANDARD_SERVER:
         	Result := Result + ' Standard Edition';
       	PRODUCT_STANDARD_SERVER_CORE:
         	Result := Result + ' Standard Edition (core installation)';
       	PRODUCT_WEB_SERVER:
         	Result := Result + ' Web Server Edition';
     	end;

     	if (si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) then
       	Result := Result + ', 64-bit'
     	else if (si.wProcessorArchitecture =
       	PROCESSOR_ARCHITECTURE_INTEL) then
       	Result := Result + ', 32-bit';
   	end;
   	if (OSVERSIONINFO.dwMajorVersion = 5) and
     	(OSVERSIONINFO.dwMinorVersion = 2) then
   	begin
     	if (GetSystemMetrics(SM_SERVERR2) <> 0) then
       	Result := 'Windows Server 2003 R2, '
     	else if (OSVERSIONINFOEX.wSuiteMask = VER_SUITE_STORAGE_SERVER) then
       	Result := 'Windows Storage Server 2003'
     	else if (OSVERSIONINFOEX.wSuiteMask = VER_SUITE_WH_SERVER) then
       	Result := 'Windows Home Server'
     	else if (OSVERSIONINFOEX.wProductType = VER_NT_WORKSTATION) and
       	(si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) then
       	Result := 'Windows XP Professional x64 Edition'
     	else
       	Result := 'Windows Server 2003, ';

     	// Test for the server type.
     	if (OSVERSIONINFOEX.wProductType <> VER_NT_WORKSTATION) then
     	begin
       	if (si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64) then
       	begin
         	if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_DATACENTER) <> 0 then
           	Result := Result +
             	' Datacenter Edition for Itanium-based Systems'
         	else if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_ENTERPRISE)
           	<> 0 then
           	Result := Result +
             	' Enterprise Edition for Itanium-based Systems';
       	end
       	else if (si.wProcessorArchitecture =
         	PROCESSOR_ARCHITECTURE_AMD64) then
       	begin
         	if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_DATACENTER) <> 0 then
           	Result := Result + ' Datacenter x64 Edition'
         	else if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_ENTERPRISE)
           	<> 0 then
           	Result := Result + ' Enterprise x64 Edition'
         	else
           	Result := Result + ' Standard x64 Edition';
       	end
       	else
       	begin
         	if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_COMPUTE_SERVER)
           	<> 0 then
           	Result := Result + ' Compute Cluster Edition'
         	else if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_DATACENTER)
           	<> 0 then
           	Result := Result + ' Datacenter Edition'
         	else if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_ENTERPRISE)
           	<> 0 then
           	Result := Result + ' Enterprise Edition'
         	else if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_BLADE) <> 0 then
           	Result := Result + ' Web Edition'
         	else
           	Result := Result + ' Standard Edition';
       	end
     	end;
   	end;
   	if (OSVERSIONINFO.dwMajorVersion = 5) and
     	(OSVERSIONINFO.dwMinorVersion = 1) then
   	begin
     	Result := 'Windows XP';
     	if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_PERSONAL) <> 0 then
       	Result := Result + ' Home Edition'
     	else
       	Result := Result + ' Professional';
   	end;

   	if (OSVERSIONINFO.dwMajorVersion = 5) and
     	(OSVERSIONINFO.dwMinorVersion = 0) then
   	begin
     	Result := 'Windows 2000';

     	if (OSVERSIONINFOEX.wProductType = VER_NT_WORKSTATION) then
       	Result := Result + ' Professional'
     	else
     	begin
       	if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_DATACENTER) <> 0 then
         	Result := Result + ' Datacenter Server'
       	else if (OSVERSIONINFOEX.wSuiteMask and VER_SUITE_ENTERPRISE)
         	<> 0 then
         	Result := Result + ' Advanced Server'
       	else
         	Result := Result + ' Server';
     	end;
   	end;

   	if (OSVERSIONINFO.dwMajorVersion <= 4) then
   	begin
     	Result := 'Windows NT';
     	// Test for specific product on Windows NT 4.0 SP6 and later.
     	if bOsVersionInfoEx then
     	begin
       	// Test for the workstation type.
       	if (OSVERSIONINFOEX.wProductType = VER_NT_WORKSTATION) and
         	(si.wProcessorArchitecture <> PROCESSOR_ARCHITECTURE_AMD64) then
         	Result := Result + ' Workstation 4.0'
         	// Test for the server type.
       	else if (OSVERSIONINFOEX.wProductType = VER_NT_SERVER) or
         	(OSVERSIONINFOEX.wProductType = VER_NT_DOMAIN_CONTROLLER) then
       	begin
         	if BOOL(OSVERSIONINFOEX.wSuiteMask and VER_SUITE_ENTERPRISE) then
           	Result := Result + ' Server 4.0, Enterprise Edition'
         	else
           	Result := Result + ' Server';
       	end
     	end
     	else
     	begin // Test for specific product on Windows NT 4.0 SP5 and earlier
       	dwBufLen := BUFSIZE;
       	lRet := RegOpenKeyEx(HKEY_LOCAL_MACHINE,
         	'SYSTEM\CurrentControlSet\Control\ProductOptions', 0,
         	KEY_QUERY_VALUE, hdlKey);
       	if (lRet <> ERROR_SUCCESS) then
         	Exit;
       	lRet := RegQueryValueEx(hdlKey, 'ProductType', nil, nil,
         	@szProductType[1], @dwBufLen);
       	if ((lRet <> ERROR_SUCCESS) or (dwBufLen > BUFSIZE)) then
         	Exit;
       	RegCloseKey(hdlKey);
       	if (lstrcmpi('WINNT', szProductType) = 0) then
         	Result := Result + ' Workstation';
       	if (lstrcmpi('LANMANNT', szProductType) = 0) then
         	Result := Result + ' Server';
       	if (lstrcmpi('SERVERNT', szProductType) = 0) then
         	Result := Result + ' Advanced Server';
       	Result := Result + Format(' %d.%d', [OSVERSIONINFO.dwMajorVersion,
         	OSVERSIONINFO.dwMinorVersion]);
     	end;
   	end;
   	// Display service pack (if any) and build number.
   	if (OSVERSIONINFO.dwMajorVersion = 4) and
     	(lstrcmpi(OSVERSIONINFO.szCSDVersion, 'Service Pack 6') = 0) then
   	begin
     	// Test for SP6 versus SP6a.
     	lRet := RegOpenKeyEx(HKEY_LOCAL_MACHINE,
       	'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\Q246009', 0,
       	KEY_QUERY_VALUE, hdlKey);
     	if (lRet = ERROR_SUCCESS) then
       	Result := Result + Format(' Service Pack 6a (Build %d)',
         	[OSVERSIONINFO.dwBuildNumber and $FFFF])
     	else // Windows NT 4.0 prior to SP6a
       	Result := Result + Format(' %s (Build %d)',
         	[OSVERSIONINFO.szCSDVersion,
         	OSVERSIONINFO.dwBuildNumber and $FFFF]);
     	RegCloseKey(hdlKey);
   	end
   	else
   	begin
     	Result := Result + Format(' %s (Build %d)',
       	[OSVERSIONINFO.szCSDVersion,
       	OSVERSIONINFO.dwBuildNumber and $FFFF]);
   	end;
 	end;
// Test for the Windows 95 product family.
VER_PLATFORM_WIN32_WINDOWS:
 	begin
   	if (OSVERSIONINFO.dwMajorVersion = 4) and
     	(OSVERSIONINFO.dwMinorVersion = 0) then
   	begin
     	Result := 'Windows 95';
     	if (OSVERSIONINFO.szCSDVersion[1] = 'C') or
       	(OSVERSIONINFO.szCSDVersion[1] = 'B') then
       	Result := Result + ' OSR2';
   	end;
   	if (OSVERSIONINFO.dwMajorVersion = 4) and
     	(OSVERSIONINFO.dwMinorVersion = 10) then
   	begin
     	Result := 'Windows 98';
     	if (OSVERSIONINFO.szCSDVersion[1] = 'A') then
       	Result := Result + ' SE';
   	end;
   	if (OSVERSIONINFO.dwMajorVersion = 4) and
     	(OSVERSIONINFO.dwMinorVersion = 90) then
     	Result := 'Windows ME';
 	end;
VER_PLATFORM_WIN32s:
 	Result := 'Windows Win32s';
 end;
end;

 

Je retournerai sur cette fonction, et chercherai le point précis où s'initialise le 32 ou 64 bits.

 

Je n'écris jamais dans ce style. Très poussé, d'accord : chapeau à l'auteur :) A sa place, j'aurais décomposé en plusieurs fonctions, de façon très claire, et... un peu franchouillarde :D Et puis des noms de variables ou de types très "parlants". La notation hongroise, c'est bien, mais je lui préfère mon style Ptr_Sur_Buffer^.Nom_F; Entre moi et moi, "on" se comprend :D

Lien vers le commentaire
Partager sur d’autres sites

 

2/ Je voulais parler de programmation en Delphi (Pascal, donc) avec appel bien sûr aux API de Widows. La structure SYSTEM_INFO ne m'informe que sur le matériel , et pas sur la version 32 ou 64 bits. La structure en question :


typedef struct _SYSTEM_INFO { // sinf

 

union {

DWORD dwOemId;

struct {

WORD wProcessorArchitecture;

WORD wReserved;

};

};

DWORD dwPageSize;

LPVOID lpMinimumApplicationAddress;

LPVOID lpMaximumApplicationAddress;

DWORD dwActiveProcessorMask;

DWORD dwNumberOfProcessors;

DWORD dwProcessorType;

DWORD dwAllocationGranularity;

WORD wProcessorLevel;

WORD wProcessorRevision;

} SYSTEM_INFO;

 

 

Dans cette structure tu as bien le champ ''wProcessorArchitecture'... Il ne te dis pas l'archi du CPU mais l'archi utilisée, donc si == AMD64 (voir la constante donnée sur msdn) ça veut dire que tu es sur un OS 64 bits

C'est d'ailleurs sur ce champ qu'est basée la variable d'environnement utilisé dans le .bat plus haut ;-)

Lien vers le commentaire
Partager sur d’autres sites

Rejoindre la conversation

Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.
Remarque : votre message nécessitera l’approbation d’un modérateur avant de pouvoir être visible.

Invité
Répondre à ce sujet…

×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

  Seulement 75 émoticônes maximum sont autorisées.

×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

×   Votre contenu précédent a été rétabli.   Vider l’éditeur

×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

  • En ligne récemment   0 membre est en ligne

    • Aucun utilisateur enregistré regarde cette page.
×
×
  • Créer...