1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <jni.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include "SecuTEST.h"
typedef jstring (__stdcall *MYDLLFUNC)(JNIEnv *, jclass, jstring, jlong , jlong );
JNIEXPORT jstring JNICALL Java_crypto_Main_nativeCrypt(JNIEnv * env, jclass decl, jstring message, jlong e, jlong n){
HINSTANCE dll;
MYDLLFUNC methode;
jstring t;
if ((dll=LoadLibrary("SecuNative.dll"))) {//chargement de la dll
methode = (MYDLLFUNC)GetProcAddress(dll, "Java_secu_Main_nativeDecrypt");//chargement de la méthode
if (methode) {
t=methode(env,decl,message,e,n);//appel de la méthode
printf("Le resultat est : %",t);//traitement
}else{
printf("Fonction introuvable");
}
FreeLibrary(dll);//libération de l'autre dll
}
return t;
} |
Partager