Páginas

quinta-feira, 14 de julho de 2016

Windev - Obter Numreo Serial hd

http://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/1516-como-obter-numero-serial-macaddress-placa-rede-outras/read.awp


Para obter o Número serial do HD, IP, Macaddress da placa de rede e outras informações da maquina cliente, segue exemplo:




//SERIAL
IF EDT_Company <> "" AND EDT_CNPJ_CPF_ID <> "" AND EDT_E_mail <> "" THEN

EDT_Hard_Drive = ""
EDT_Serial_Webdev = ""
EDT_Serial_Windev = ""
EDT_Serial_WindevMobile = ""

SERIAL_DOUNGLE_WEBDEV, SERIAL_DOUNGLE_WINDEV, SERIAL_DOUNGLE_WINDEVMOBILE, Windows, SerialWindows isstring = ""

//FUNCAO GET SERIAL DOUNGLE
SERIAL_DOUNGLE_WEBDEV = 10
SERIAL_DOUNGLE_WINDEV = 20
SERIAL_DOUNGLE_WINDEVMOBILE = 30

EDT_Doungle_Webdev = "WEBDEV_" + SERIAL_DOUNGLE_WEBDEV
EDT_Doungle_Webdev_PcSoft = EDT_Doungle_Webdev 

EDT_Doungle_Windev = "WINDEV_" + SERIAL_DOUNGLE_WINDEV
EDT_Doungle_Windev_PcSoft = EDT_Doungle_Windev 

EDT_Doungle_WindevMobile = "WINDEVMOBILE_" + SERIAL_DOUNGLE_WINDEVMOBILE
EDT_Doungle_WindevMobile_PcSoft = EDT_Doungle_WindevMobile 

sBaseBoardManufacturer, sBaseBoardProduct, sBaseBoardVersion, sBIOSReleaseDate, sBIOSVendor,sBIOSVersion, sSystemFamily, sSystemManufacturer is string = ""

ResExist1 is boolean = RegistryExist("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS")

ResExist2 is boolean =RegistryExist("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")

IF ResExist1 = True AND ResExist2 = True

sBaseBoardManufacturer =RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS", "BaseBoardManufacturer",True)
sBaseBoardProduct = RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS","BaseBoardProduct", True)
sBaseBoardVersion = RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS","BaseBoardVersion", True)
sBIOSReleaseDate = RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS","BIOSReleaseDate", True)
sBIOSVendor = RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS","BIOSVendor", True)
sBIOSVersion = RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS","BIOSVersion", True)
sSystemFamily = RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS","SystemFamily", True)
sSystemManufacturer =RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS", "SystemManufacturer", True)

EDT_Pais = RegistryQueryValue("HKEY_CURRENT_USER\Control Panel\International", "sCountry", True)

EDT_Processador =RegistryQueryValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","ProcessorNameString", True) 

EDT_Placa_Mae = sBaseBoardManufacturer +" - "+ sBaseBoardProduct +" - "+ sBaseBoardVersion +" - "+sBIOSReleaseDate +" - "+ sBIOSVendor +" - "+ sBIOSVersion +" - "+ sSystemFamily +" - "+ sSystemManufacturer 

Windows = RegistryQueryValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName", True)

SerialWindows = RegistryQueryValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","BuildGUID", True)

EDT_Version_Windows = Windows +" - "+ SerialWindows +" - "+ SysWindowsVersion(sysProcessor) +" bits - "+SysWindowsVersion(sysVersionBuild) +" - "+ SysWindowsVersion(sysVersionInfo) +" - "+SysWindowsVersion(sysVersionNumber) +" - "+ SysWindowsVersion(sysVersionPlatform)

END

//EDT_Hard_Drive
EDT_Hard_Drive = fDisqueInfo(Middle(SysDir(srWindows),1,2),fdSerialNumber) 

EDT_Hard_Drive_PcSoft = EDT_Hard_Drive 

EDT_IP_4 = NetIPAddress()

EDT_Placa_de_Rede_Mac = Upper(NetMACAddress())

EDT_Name_PC = Upper(NetMachineName())

//Marca_Modelo_Placa_de_Rede
ResExist3 is boolean = RegistryExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards")
IF ResExist3 = True THEN

Key is string = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\"
Achou is string = ""
x is int = 0
WHILE Key <> ""
x+= 1
Achou = RegistryQueryValue(Key+x, "Description", True)
IF Achou <> ""
EDT_Placa_de_Rede_Marca_Modelo = Achou
EDT_Placa_de_Rede_ServiceName = RegistryQueryValue(Key+x, "ServiceName", True)
BREAK
END
IF x > 30 THEN
BREAK
END
END
END


//Crypto
EDT_Serial_Webdev = EDT_Doungle_Webdev +"; "+ EDT_Company +"; "+ EDT_Pais +"; "+ EDT_CNPJ_CPF_ID +"; "+EDT_E_mail +"; "+ EDT_Processador +"; "+ EDT_Placa_Mae +"; "+ EDT_Hard_Drive +"; "+ EDT_IP_4 +"; "+EDT_Placa_de_Rede_Mac +"; "+ EDT_Version_Windows +"; "+ EDT_Name_PC +"; "+ EDT_Placa_de_Rede_Marca_Modelo+"; "+ EDT_Placa_de_Rede_ServiceName
EDT_Serial_Webdev =Crypt(EDT_Serial_Webdev,EDT_Doungle_Webdev,cryptAnsi+compressShortString,encodeBASE64) 


//Crypto
EDT_Serial_Windev = EDT_Doungle_Windev +"; "+ EDT_Company +"; "+ EDT_Pais +"; "+ EDT_CNPJ_CPF_ID +"; "+EDT_E_mail +"; "+ EDT_Processador +"; "+ EDT_Placa_Mae +"; "+ EDT_Hard_Drive +"; "+ EDT_IP_4 +"; "+EDT_Placa_de_Rede_Mac +"; "+ EDT_Version_Windows +"; "+ EDT_Name_PC +"; "+ EDT_Placa_de_Rede_Marca_Modelo+"; "+ EDT_Placa_de_Rede_ServiceName
EDT_Serial_Windev =Crypt(EDT_Serial_Windev,EDT_Doungle_Windev,cryptAnsi+compressShortString,encodeBASE64)


//Crypto
EDT_Serial_WindevMobile = EDT_Doungle_WindevMobile +"; "+ EDT_Company +"; "+ EDT_Pais +"; "+EDT_CNPJ_CPF_ID +"; "+ EDT_E_mail +"; "+ EDT_Processador +"; "+ EDT_Placa_Mae +"; "+ EDT_Hard_Drive +"; "+EDT_IP_4 +"; "+ EDT_Placa_de_Rede_Mac +"; "+ EDT_Version_Windows +"; "+ EDT_Name_PC +"; "+EDT_Placa_de_Rede_Marca_Modelo +"; "+ EDT_Placa_de_Rede_ServiceName
EDT_Serial_WindevMobile =Crypt(EDT_Serial_WindevMobile,EDT_Doungle_WindevMobile,cryptAnsi+compressShortString,encodeBASE64)

ELSE

IF EDT_Company = "" THEN
EDT_Company..BrushColor = DarkRed
END
IF EDT_CNPJ_CPF_ID = "" THEN
EDT_CNPJ_CPF_ID..BrushColor = DarkRed 
END
IF EDT_E_mail = "" THEN
EDT_E_mail..BrushColor = DarkRed
END

END 
//Marca_Modelo_Placa_de_Rede
ResExist1 is boolean = RegistryExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards")
IF ResExist1 = True THEN

Key is string = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\"
Achou is string = ""
x is int = 0
WHILE Key <> ""
x+= 1
Achou = RegistryQueryValue(Key+x, "Description", True)
IF Achou <> ""
EDT_Placa_de_Rede_Marca_Modelo01 = Achou
EDT_Placa_de_Rede_ServiceName01 = RegistryQueryValue(Key+x, "ServiceName", True)
BREAK
END
IF x > 30 THEN
BREAK
END
END
Achou = ""
WHILE Key <> ""
x+= 1
Achou = RegistryQueryValue(Key+x, "Description", True)
IF Achou <> ""
EDT_Placa_de_Rede_Marca_Modelo02 = Achou
EDT_Placa_de_Rede_ServiceName02 = RegistryQueryValue(Key+x, "ServiceName", True)
BREAK
END
IF x > 30 THEN
BREAK
END
END
END





Bons estudos

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/