Ver Mensaje Individual
  #14  
Antiguo 23-04-2013
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Reputación: 21
gluglu Va por buen camino
Crear la DLL en Delphi :

Código Delphi [-]
library MyUDF;

uses
  System.SysUtils,
  System.Classes,
  Windows, SysUtils;

{$R *.res}

function ib_util_malloc(l: integer): pointer; cdecl; external 'ib_util.dll';
function FindVolumeSerial(const p: PAnsiChar): PAnsiChar; cdecl;

implementation

function FindVolumeSerial(const p: PAnsiChar): PAnsiChar; cdecl;
var
  VSN : DWORD;
  MCL : DWORD;
  FSF : DWORD;
  SN  : string;
begin
  GetVolumeInformation('C:\', nil, 0, @VSN, MCL, FSF, nil, 0);
  SN := IntToHex(HiWord(VSN), 4) + ' - ' + IntToHex(LoWord(VSN), 4);
  Result := ib_util_malloc(Length(SN) + 6);
  StrPCopy(Result, SN);
end;

exports
  FindVolumeSerial;

begin
end.

... y después en Firebird :

Código SQL [-]
declare external function Find_VolumeSerial
  CSTRING(20)
returns
  CSTRING(20) FREE_IT
entry_point 'FindVolumeSerial' module_name 'MyUDF';

Por último, para pedir los datos del número de serie mediante la consulta SQL :

Código SQL [-]
Select Find_VolumeSerial('C') from RDB$Database

Saludos a todos y de nuevo gracias por vuestra ayuda !
__________________
Piensa siempre en positivo !
Responder Con Cita