viernes, 27 de mayo de 2022

FirmSAT (funciones)

 //OBTENER RFC

///*******************************************************************************************
nOpcion             is int         = 0
nResultado             is int
sPbuf                 is string     = Charact(0)
hInst                 is int
nLongitud             is int         = 4096
sConsulta           is string   = "rfc"
sNombreCertificado     is string   = EDT_Certificado

IF fFileExist(sNombreCertificado ) = False THEN
    Error("Error al verificar existencia del certificado")   
    ReturnToCapture(EDT_Certificado)
END



//hInst = LoadDLL("diFirmaSAT2.DLL")
hInst = LoadDLL(fDataDir() + ["\"] + "diFirmaSAT2.DLL")
IF hInst = 0 THEN
    Error("Error al cargar dll")
ELSE
    nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud , sNombreCertificado, sConsulta,nOpcion)
    IF nResultado < 0 THEN
        Info("ERROR", "SAT_QueryCert regresa el valor: " + nResultado + " fallidamente")
    ELSE
        //nLongitud = Length(sPbuf)
        nLongitud = nResultado
        nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud, sNombreCertificado, sConsulta, nOpcion)
        IF nResultado < 0 THEN
            Info("ERROR AL EXTRAER EL NOMBRE DEL RFC","RESULTADO :" + nResultado)
        ELSE
            Info(nLongitud, sPbuf)
           
           
        END
    END
    FreeDLL(hInst)
END


///COMPAÑIA

///*******************************************************************************************
nOpcion             is int         = 0
nResultado             is int
sPbuf                 is string     = Charact(0)
hInst                 is int
nLongitud             is int         = 4096
sConsulta           is string   = "companyName"
sNombreCertificado     is string   = EDT_Certificado

IF fFileExist(sNombreCertificado ) = False THEN
    Error("Error al verificar existencia del certificado")   
    ReturnToCapture(EDT_Certificado)
END



//hInst = LoadDLL("diFirmaSAT2.DLL")
hInst = LoadDLL(fDataDir() + ["\"] + "diFirmaSAT2.DLL")
IF hInst = 0 THEN
    Error("Error al cargar dll")
ELSE
    nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud , sNombreCertificado, sConsulta,nOpcion)
    IF nResultado < 0 THEN
        Info("ERROR", "SAT_QueryCert regresa el valor: " + nResultado + " fallidamente")
    ELSE
        //nLongitud = Length(sPbuf)
        nLongitud = nResultado
        nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud, sNombreCertificado, sConsulta, nOpcion)
        IF nResultado < 0 THEN
            Info("ERROR AL EXTRAER EL NOMBRE DEL RFC","RESULTADO :" + nResultado)
        ELSE
            Info(nLongitud, sPbuf)
           
           
        END
    END
    FreeDLL(hInst)
END


/// VIGENTE DESDE

///*******************************************************************************************
nOpcion             is int         = 0
nResultado             is int
sPbuf                 is string     = Charact(0)
hInst                 is int
nLongitud             is int         = 4096
sConsulta           is string   = "notBefore"
sNombreCertificado     is string   = EDT_Certificado

IF fFileExist(sNombreCertificado ) = False THEN
    Error("Error al verificar existencia del certificado")   
    ReturnToCapture(EDT_Certificado)
END



//hInst = LoadDLL("diFirmaSAT2.DLL")
hInst = LoadDLL(fDataDir() + ["\"] + "diFirmaSAT2.DLL")
IF hInst = 0 THEN
    Error("Error al cargar dll")
ELSE
    nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud , sNombreCertificado, sConsulta,nOpcion)
    IF nResultado < 0 THEN
        Info("ERROR", "SAT_QueryCert regresa el valor: " + nResultado + " fallidamente")
    ELSE
        //nLongitud = Length(sPbuf)
        nLongitud = nResultado
        nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud, sNombreCertificado, sConsulta, nOpcion)
        IF nResultado < 0 THEN
            Info("ERROR AL EXTRAER EL NOMBRE DEL RFC","RESULTADO :" + nResultado)
        ELSE
            Info(nLongitud, sPbuf)
           
           
        END
    END
    FreeDLL(hInst)
END
/// VIGENCIA TERMINA

///*******************************************************************************************
nOpcion             is int         = 0
nResultado             is int
sPbuf                 is string     = Charact(0)
hInst                 is int
nLongitud             is int         = 4096
sConsulta           is string   = "notAfter"
sNombreCertificado     is string   = EDT_Certificado

IF fFileExist(sNombreCertificado ) = False THEN
    Error("Error al verificar existencia del certificado")   
    ReturnToCapture(EDT_Certificado)
END



//hInst = LoadDLL("diFirmaSAT2.DLL")
hInst = LoadDLL(fDataDir() + ["\"] + "diFirmaSAT2.DLL")
IF hInst = 0 THEN
    Error("Error al cargar dll")
ELSE
    nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud , sNombreCertificado, sConsulta,nOpcion)
    IF nResultado < 0 THEN
        Info("ERROR", "SAT_QueryCert regresa el valor: " + nResultado + " fallidamente")
    ELSE
        //nLongitud = Length(sPbuf)
        nLongitud = nResultado
        nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud, sNombreCertificado, sConsulta, nOpcion)
        IF nResultado < 0 THEN
            Info("ERROR AL EXTRAER EL NOMBRE DEL RFC","RESULTADO :" + nResultado)
        ELSE
            Info(nLongitud, sPbuf)
           
           
        END
    END
    FreeDLL(hInst)
END

//NUMERO DE SERIE

///*******************************************************************************************
nOpcion             is int         = 0
nResultado             is int
sPbuf                 is string     = Charact(0)
hInst                 is int
nLongitud             is int         = 4096
sConsulta           is string   = "serialNumber"
sNombreCertificado     is string   = EDT_Certificado

IF fFileExist(sNombreCertificado ) = False THEN
    Error("Error al verificar existencia del certificado")   
    ReturnToCapture(EDT_Certificado)
END



//hInst = LoadDLL("diFirmaSAT2.DLL")
hInst = LoadDLL(fDataDir() + ["\"] + "diFirmaSAT2.DLL")
IF hInst = 0 THEN
    Error("Error al cargar dll")
ELSE
    nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud , sNombreCertificado, sConsulta,nOpcion)
    IF nResultado < 0 THEN
        Info("ERROR", "SAT_QueryCert regresa el valor: " + nResultado + " fallidamente")
    ELSE
        //nLongitud = Length(sPbuf)
        nLongitud = nResultado
        nResultado = CallDLL32("diFirmaSAT2", "SAT_QueryCert", sPbuf, nLongitud, sNombreCertificado, sConsulta, nOpcion)
        IF nResultado < 0 THEN
            Info("ERROR AL EXTRAER EL NOMBRE DEL RFC","RESULTADO :" + nResultado)
        ELSE
            Info(nLongitud, sPbuf)
           
           
        END
    END
    FreeDLL(hInst)
END


No hay comentarios.:

Publicar un comentario

Try catch end

 // -------------------------------------------------- // Procedure principal que executa uma query com tratamento de exceção // -----------...