FUNÇÃO PARA DESCOBRIR SE É Windows 32 OU 64BITS
Pessoal, achei em um fórum na net uma função que promete indentificar se um sistema é 32 ou 64Bits, entretanto o Avast tá pegando como vírus.
Gostaria de saber se alguém já usou esta função, e que pudesse me informar se é confiável ou não?
Segue o link para a mesma >>
http://scriptbrasil.com.br/forum/index.php?showtopic=158389
Em caso de a função referida acima não servir, queria saber se existe algum outro código que possibilite saber de quantos bits é o Windows, pois até então só achei função que me informa apenas o Sistema Operacional e sua Versão.
Brigadão!!
Gostaria de saber se alguém já usou esta função, e que pudesse me informar se é confiável ou não?
Segue o link para a mesma >>
http://scriptbrasil.com.br/forum/index.php?showtopic=158389
Em caso de a função referida acima não servir, queria saber se existe algum outro código que possibilite saber de quantos bits é o Windows, pois até então só achei função que me informa apenas o Sistema Operacional e sua Versão.
Brigadão!!
Luiz Eduardo
Curtidas 0
Melhor post
Gilvanio Gonçalves
23/10/2012
var
Form1: TForm1;
implementation
{$R *.dfm}
function IsWindows64: Boolean;
type
TIsWow64Process = function(AHandle:THandle; var AIsWow64: BOOL): BOOL; stdcall;
var
vKernel32Handle: DWORD;
vIsWow64Process: TIsWow64Process;
vIsWow64: BOOL;
begin
Result := False;
vKernel32Handle := LoadLibrary('kernel32.dll');
if (vKernel32Handle = 0) then Exit;
try
@vIsWow64Process := GetProcAddress(vKernel32Handle, 'IsWow64Process');
if not Assigned(vIsWow64Process) then Exit;
vIsWow64 := False;
if (vIsWow64Process(GetCurrentProcess, vIsWow64)) then
Result := vIsWow64;
finally
FreeLibrary(vKernel32Handle);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if IsWindows64 = true then
showmessage('O sistema windows é 64 Bits')
else
showmessage('O sistema windows é 32 Bits')
end;agora é só vc adaptar ao seu uso.
at+
GOSTEI 2
Mais Respostas
Alisson Santos
23/10/2012
Amigo ele vai entender como virus pois dependendo a area que vai acessar os o arquivo que vai ser acessado ou o jeito que vai ser manipulado está sendo igual a ação de um malware.
GOSTEI 0
Luiz Eduardo
23/10/2012
VALEU PESSOAL!!
GOSTEI 0
Gilvanio Gonçalves
23/10/2012
amigo ao contrário de que o Allison diz, no meu codigo não será visto como virus, o script pode até ser, mas não é, o codigo que te passei é para uso no delphi uma função ok.
abs.
abs.
GOSTEI 0
Alisson Santos
23/10/2012
amigo ao contrário de que o Allison diz, no meu codigo não será visto como virus, o script pode até ser, mas não é, o codigo que te passei é para uso no delphi uma função ok.
abs.
abs.
Giovane me desculpa se passou essa impressão eu estava explicando para ele o porque ocorreu de falar que era virus o que ele tinha.
Gostaria de saber de consegui fazer funcionar??
GOSTEI 0
Luiz Eduardo
23/10/2012
Agradeço a ajuda dos 2.
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
GOSTEI 0
Claudia Nogueira
23/10/2012
Você só vai conseguir fazer dessa forma se o retorno da função for do tipo String.
Exemplo:
Exemplo:
function IsWindows64: String;
type
TIsWow64Process = function(AHandle:THandle; var AIsWow64: BOOL): BOOL; stdcall;
var
vKernel32Handle: DWORD;
vIsWow64Process: TIsWow64Process;
vIsWow64: BOOL;
begin
vKernel32Handle := LoadLibrary('kernel32.dll');
if (vKernel32Handle = 0) then Exit;
try
@vIsWow64Process := GetProcAddress(vKernel32Handle, 'IsWow64Process');
if not Assigned(vIsWow64Process) then Exit;
vIsWow64Process(GetCurrentProcess, vIsWow64);
if vIsWow64 then
Result := 'O sistema windows é 64 Bits'
else
Result := 'O sistema windows é 32 Bits';
finally
FreeLibrary(vKernel32Handle);
end;
end;
Agradeço a ajuda dos 2.
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
GOSTEI 0
Luiz Eduardo
23/10/2012
Você só vai conseguir fazer dessa forma se o retorno da função for do tipo String.
Exemplo:
Exemplo:
function IsWindows64: String;
type
TIsWow64Process = function(AHandle:THandle; var AIsWow64: BOOL): BOOL; stdcall;
var
vKernel32Handle: DWORD;
vIsWow64Process: TIsWow64Process;
vIsWow64: BOOL;
begin
vKernel32Handle := LoadLibrary('kernel32.dll');
if (vKernel32Handle = 0) then Exit;
try
@vIsWow64Process := GetProcAddress(vKernel32Handle, 'IsWow64Process');
if not Assigned(vIsWow64Process) then Exit;
vIsWow64Process(GetCurrentProcess, vIsWow64);
if vIsWow64 then
Result := 'O sistema windows é 64 Bits'
else
Result := 'O sistema windows é 32 Bits';
finally
FreeLibrary(vKernel32Handle);
end;
end;
Agradeço a ajuda dos 2.
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
MUITÍSSIMO OBRIGADO CLAUDIA! DEU CERTO.
GOSTEI 0
Gilvanio Gonçalves
23/10/2012
Você só vai conseguir fazer dessa forma se o retorno da função for do tipo String.
Exemplo:
Exemplo:
function IsWindows64: String;
type
TIsWow64Process = function(AHandle:THandle; var AIsWow64: BOOL): BOOL; stdcall;
var
vKernel32Handle: DWORD;
vIsWow64Process: TIsWow64Process;
vIsWow64: BOOL;
begin
vKernel32Handle := LoadLibrary('kernel32.dll');
if (vKernel32Handle = 0) then Exit;
try
@vIsWow64Process := GetProcAddress(vKernel32Handle, 'IsWow64Process');
if not Assigned(vIsWow64Process) then Exit;
vIsWow64Process(GetCurrentProcess, vIsWow64);
if vIsWow64 then
Result := 'O sistema windows é 64 Bits'
else
Result := 'O sistema windows é 32 Bits';
finally
FreeLibrary(vKernel32Handle);
end;
end;
Agradeço a ajuda dos 2.
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
Mas Gilvanio aqui eu to querendo botar num IdMessage.Body.Add(IsWindows64);
mas tá dando esse erro >>
[Error] Unit1.pas(411): Incompatible types: 'String' and 'Boolean'
HÁ SOLUÇÃO PARA ISSO?
Valeu!!
MUITÍSSIMO OBRIGADO CLAUDIA! DEU CERTO.
Desculpe, Não te responder antes, estive fora, mas lhe foi respondido na integra pela Claudia, e a vc Allison tudo bém, mas cuidado ao responder algo que possa ser interpretado como duplo sentido.
GOSTEI 0
Josimar
23/10/2012
if IsWindows64 then IdMessage.Body.Add('O sistema windows é 64 Bits')
else IdMessage.Body.Add('O sistema windows é 32 Bits');
else IdMessage.Body.Add('O sistema windows é 32 Bits');
GOSTEI 0