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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#define FALSE 0
#define TRUE !FALSE
#define ADRESSEBASE 0x378 // addresse de base
typedef short _stdcall (*inpfuncPtr)(short portaddr);
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);
void encryptionmenu(char *encryptionchoice)
{
//system("cls");
printf("**********************\n");
printf("* cryptage menu *\n");
printf("**********************\n\n");
printf("1. enter clear message\n");
printf("2. read clear message \n");
printf("3. read encrypted message \n");
printf("your choice : \n");
scanf("%c", encryptionchoice);
fflush(stdin);
}
char choicemenu;
char* encryptionchoice = &choicemenu;
int main()
{
int msg;
int cryptmsg;
HINSTANCE hLib;
inpfuncPtr inp32;
oupfuncPtr oup32;
hLib = LoadLibrary("inpout32.dll");
inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");
fflush(stdin);
encryptionmenu(encryptionchoice);
switch (choicemenu)
{
case '1':
printf("enter message to crypt <= 16 \n");
scanf("%d", &msg);
break;
case '2':
printf("lclear msg: %d \n", msg);
break;
case '3':
/*ici je dois envoyer msg vers le port parallele dans le broches 2 à 5 et recuperer des données qui viennent du circuit imprimé dans les broches 6 à 9*/
printf("encrypted msg : %d\n", cryptmsg);
break;
default:
printf("bad choice or illegal operation\n");
getch();
system("cls");
}
getch();
return 0;
} |
Partager