webrodex 0 Denunciar post Postado Fevereiro 13, 2007 Gostaria de saber com passar essa função para dll ! eu irei usar 1 exe para chamar essa dll e executa-la ! seria para eu proteger o meu sistema atravez com o serial do hd que iria da certo , ele pegara o valor do serial do hd e verefica num textbox se e o mesmo que programei ! e isso ai esperao que possão me ajuda !usesRegistryvarRegistro:TRegistry;serial:dword;result:string;dirlen,flags:dword;dlabel:array[0..11] of char;begingetvolumeinformation(pchar('C:\'),dlabel,12,@serial,dirlen,flags,nil,0);result:=inttohex(serial,8);edit1.text:=result;registro:=tregistry.create;registro.RootKey:=HKEY_CURRENT_USER;registro.OpenKey('\Software\projeto\',false);edit2.text := Registro.ReadString('serial');If Edit1.Text <> pchar(Edit2.text) ThenbeginShowMessage('Este computador não está disponível para acessar este programa.'+#13+'Entre em contato com seu programador para ter acesso');Application.Terminateendelse Compartilhar este post Link para o post Compartilhar em outros sites
marcio.theis 3 Denunciar post Postado Fevereiro 13, 2007 Uma das formas seria: library Valida;{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. }uses Windows, SysUtils, Dialogs, Registry;{$R *.res}function ValidaPC: boolean; stdcallvar versaoOK: boolean; Registro:TRegistry; dirlen, flags, serial:dword; dlabel:array[0..11] of char; aux, aux2: string;beginversaoOK:=True;GetVolumeInformation(PChar('C:\'),dlabel,12,@serial,dirlen,flags,nil,0);aux:=IntToHex(serial,8);Registro:=TRegistry.create;Registro.RootKey:=HKEY_CURRENT_USER;Registro.OpenKey('\Software\projeto\',False);aux2:=Registro.ReadString('serial');if aux <> PChar(aux2) Then begin versaoOK:=False; ShowMessage('Este computador não está disponível para acessar este programa.'+#13+'Entre em contato com seu programador para ter acesso'); end;ValidaPC:=versaoOK;end;exports ValidaPC;beginend. Compartilhar este post Link para o post Compartilhar em outros sites