home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / test.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  3KB  |  103 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. __declspec(dllimport) unsigned long _stdcall
  5. validate_serial_no(char * serialno) ;
  6.  
  7. __declspec(dllexport) unsigned long _stdcall
  8. init_printer_list(void);
  9.  
  10. __declspec(dllexport) long _stdcall
  11. get_printer_display_string(int index, char * str, int len);
  12.  
  13. __declspec(dllexport) long _stdcall
  14. get_printer_config_string(int index, char * str, int len);
  15.  
  16. __declspec(dllexport) unsigned long _stdcall
  17. init_serial_port_list(void);
  18.  
  19. __declspec(dllexport) long _stdcall
  20. get_serial_port_display_string(int index, char * str, int len);
  21.  
  22. __declspec(dllexport) long _stdcall
  23. get_serial_port_config_string(int index, char * str, int len);
  24.  
  25. __declspec(dllexport) unsigned long _stdcall
  26. init_tapi_list(void);
  27.  
  28. __declspec(dllexport) long _stdcall
  29. get_tapi_display_string(int index, char * str, int len);
  30.  
  31. __declspec(dllexport) long _stdcall
  32. get_tapi_config_string(int index, char * str, int len);
  33.  
  34. __declspec(dllexport) long _stdcall
  35. register_k95(char * instdir, char * serial, char * name, char * corp, int license );
  36.  
  37. __declspec(dllexport) long _stdcall
  38. get_reg_info(char * instdir, 
  39.              char * serial, int serial_len,
  40.              char * name, int name_len,
  41.              char * corp, int corp_len );
  42.  
  43.  
  44.  
  45. int 
  46. main(void)
  47. {
  48.     char str[256], s1[64], s2[64], s3[64];
  49.     int  n;
  50.  
  51.     printf("Testing validate serial number ....\n");
  52.  
  53.     if ( validate_serial_no("K95-00010038454-1.1") )
  54.         printf("valid serial number test passed\n");
  55.     else
  56.         printf("valid serial number test failed\n");
  57.  
  58.     if ( !validate_serial_no("K95-00010038450-1.1") )
  59.         printf("invalid serial number test passed\n");
  60.     else
  61.         printf("invalid serial number test failed\n");
  62.  
  63.     printf("\nTesting Printers\n");
  64.     n = init_printer_list();
  65.     printf("%d printers\n");
  66.     while ( n-- > 0 ) {
  67.         get_printer_display_string(n,str,sizeof(str));
  68.         printf("%s\n",str);
  69.         get_printer_config_string(n,str,sizeof(str));
  70.         printf("%s\n",str);
  71.     }
  72.  
  73.     printf("\nTesting Serial Devices\n");
  74.     n = init_serial_port_list();
  75.     printf("%d serials\n");
  76.     while ( n-- > 0 ) {
  77.         get_serial_port_display_string(n,str,sizeof(str));
  78.         printf("%s\n",str);
  79.         get_serial_port_config_string(n,str,sizeof(str));
  80.         printf("%s\n",str);
  81.     }
  82.  
  83.     printf("\nTesting TAPI devices\n");
  84.     n = init_tapi_list();
  85.     printf("%d tapi devices\n");
  86.     while ( n-- > 0 ) {
  87.         get_tapi_display_string(n,str,sizeof(str));
  88.         printf("%s\n",str);
  89.         get_tapi_config_string(n,str,sizeof(str));
  90.         printf("%s\n",str);
  91.     }
  92.  
  93.     n = register_k95("d:/kermit","K95-00010038454-1.1","Deborah Lerman","Girlfriend",5);
  94.     printf("register test = %d\n",n);
  95.  
  96.     n = get_reg_info("d:/kermit",s1,sizeof(s1),s2,sizeof(s2),s3,sizeof(s3));
  97.     printf("get reg info = %d\n",n);
  98.     if ( !n ) {
  99.         printf("\n%s\n%s\n%s\n",s1,s2,s3);
  100.     }
  101.     return(0);
  102. }
  103.