Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Need help with cash drawer pop routine!  Sample code in c++

Posted on 2009-07-09
17
2,222 Views
Last Modified: 2013-12-04
Hi, I'm needing to implement an routine on my NCR 7402 to pop the cash drawer.  Reading the manual for the 7402 they provide the code below as an example.  I'm not real familiar in c++ as I use c# mostly.  I know it probably needs some header files that it didn't tell me about.

I would really like if possible for an c# example on how to do this.  But don't mind it if have to stay in c++ as I can just call the executable from my c# app if needed.

I'm getting lots of errors when trying to compile (117 errors).  I'm using visual studio 2008 professional if its relevant.

Please help!

I've attached the manual for the POS terminal as well.  In the code section there are two files DrawerPop.cpp and DrawerPop.h.  In the manual the code example is on page 250 (12-10 in the book pages)
// DrawerPop.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include "DrawerPop.h"
 
 
int _tmain(int argc, _TCHAR* argv[])
{
	return 0;
}
 
long Initialize( ) 
{ 
 
    // Init -- I/O Port -- Standard Configuration Register Address for PCI Devices 
    m_nIOConf = 0x0CF8; 
 
    // Read -- I/O Port -- If these defaults are left unchanged, errors will be reported 
   m_nIOPort  = 0;  // R/W port for solenoid bits and status 
   m_nIOPort_select = 0;  //R/W port for selecting GPIO Input/Output config 
 
 m_nDrawerNumber = 1;  //Default 
 
 
      m_bPortDrvr = FALSE; 
 
      // determine if OS is WIN95 or WINNT 
      if (GetVersion() < 0x80000000) 
      { 
    m_nOSVersion = OS_WINDOWS_NT; 
    // Lock Mutex when accessing shared memory TAR 95236 
    WaitForSingleObject( g_hSharedMemoryMutex, INFINITE ); 
 
    if ( g_hPortDrvr == NULL )
   { 
        // -rtf- Create a security attribute allowing global access 
        GetGlobalSA( _T("CreateFile"), _T("NCRKPDev"), &m_Attributes, &m_SD 
); 
 
        g_hPortDrvr = CreateFile( 
             "\\\\.\\NCRKPDev",             // Open the Device "file" 
             GENERIC_WRITE | GENERIC_READ, 
             FILE_SHARE_READ | FILE_SHARE_WRITE, 
             (LPSECURITY_ATTRIBUTES) &m_Attributes,  // no security 
        OPEN_EXISTING, 
             0,                             // flags 
        NULL); 
 
        if (g_hPortDrvr == INVALID_HANDLE_VALUE)  // Was the device opened? 
     { 
          DWORD hr = GetLastError(); 
 
          m_bPortDrvr = FALSE; 
 
          InitError = TRUE; 
     } 
 
     else 
     { 
    m_bPortDrvr = TRUE; 
     } 
 
    }  // end if (g_hPortDrvr==0) 
 
  
    ReleaseMutex( g_hSharedMemoryMutex ); 
 
    }  // WINNT OS 
 
      else 
      { 
        m_nOSVersion = OS_WINDOWS_95; 
      } 
 
 
    } // end if (!InitError) 
 
 
    // if the (OS is WINNT AND the port driver was opened ) 
    if ( !InitError ) 
    { 
 
      // Create a security attribute allowing global access 
      GetGlobalSA( _T("mutex"), sData, &m_Attributes, &m_SD ); 
 
    // Lock Mutex when accessing shared memory 
    WaitForSingleObject( g_hSharedMemoryMutex, INFINITE ); 
 
    g_hHWPortMutex = CreateMutex( &m_Attributes, FALSE, (LPCTSTR) sData ); 
 
          if ( g_hHWPortMutex != NULL ) 
          { 
 
          m_pDC->DCPrintf( 
                         DCM_APIHIGH, 
                         _T(" ..create m_hPowerMutex") ); 
      // Create a security attribute allowing global access 
      GetGlobalSA( _T("mutex"), _T("NCRPowerSharingMutex"), &m_Attributes, 
&m_SD ); 
 
            // create named mutex that prevents the cash drawer from firing 
            // when the printer is printing 
            // "NCRPowerSharingMutex" 
            m_hPowerMutex = CreateMutex( &m_Attributes, FALSE, 
_T("NCRPowerSharingMutex") ); 
 
          }  // HWPortMutex created 
 
   } 
 
    ReleaseMutex( g_hSharedMemoryMutex );  // TAR 95236 
 
      }  // OS is WIN95 or WINNT and NCRKPDev driver present 
 
 
    return RetStatus; 
} 
 
 
/////////////////////////////////////////////////////////////// 
void Terminate() 
{ 
 
  if ( m_bInitialized ) 
  { 
    // Lock Mutex when accessing shared memory 
    WaitForSingleObject( g_hSharedMemoryMutex, INFINITE );  
 
    CloseHandle( m_hPowerMutex ); 
    CloseHandle( g_hHWPortMutex );    // TAR 95236 
 
    // if the NT port driver was opened... 
        if (m_bPortDrvr ) 
   {     
        // close the file handle 
    m_bPortDrvr = FALSE; 
        g_nPortDrvr=0;  // Dec to zero using and close handle 
    CloseHandle(g_hPortDrvr); 
    g_hPortDrvr = NULL; 
 
   } 
    m_bInitialized = FALSE; 
 
  ReleaseMutex( g_hSharedMemoryMutex ); 
  } 
} 
 
///////////////////////////////////////////////////////// 
long OpenPort() 
{ 
  CString sData; 
  long RetStatus; 
  CString Result; 
  static TCHAR szIOPort[] = _T("Port"); 
 
  // Get the IO H/W Configuration to set IOPORT addresses 
 
  // If other of same type exists then use same IOPort addresses 
    QueryConf();  // Sets IOPORT addresses based on H/W configuration 
 
    // initialize state 
   DWORD sBytes=0; 
    DWORD bMask = ~(CD7402DRWR1SOLENOID | CD7402DRWR2SOLENOID); // Set 
Solenoid bits LOW 
    bMask = bMask | CD7402ARM_OFF; // set solenoid bits low and arm bit high 
 
    // **program solenoid bits as inputs to start 
    if ( !ReadIOPort(&sBytes, m_nIOPort_select) ) 
    { 
    // Error logged in ReadIOPort 
    RetStatus = CDD_E_IOFAILURE; 
    Result = _T("I/O read operation failed"); 
    } 
    else if ( !WriteIOPort( sBytes | CD7402SELECT_GPI, 
                             m_nIOPort_select))  // Darlington 1 = select input 
    { 
    // Error logged in WriteIOPort 
    RetStatus = CDD_E_IOFAILURE; 
    Result = _T("I/O write operation failed"); 
    } 
 
    //** set solenoid bits de-activated, even though they are supposed to be inputs now 
    if ( !ReadIOPort(&sBytes, m_nIOPort) )
    { 
    // Error logged in ReadIOPort 
    RetStatus = CDD_E_IOFAILURE; 
    Result = _T("I/O read operation failed"); 
    } 
    // Darlington 0 = solenoid de-activated, 1 = ARM de-activated 
    else if ( !WriteIOPort( sBytes & bMask, 
                             m_nIOPort)) 
    { 
    // Error logged in WriteIOPort 
    RetStatus = CDD_E_IOFAILURE; 
    Result = _T("I/O write operation failed"); 
    } 
    else 
    { 
    RetStatus = CDD_SUCCESS; 
    Result = _T("Success"); 
 
    m_bIFOpened = TRUE;   //InterFace is OPENed 
 
    // initialize Position variable in aCDData array element 
   GetDrawerStatusLIO(); 
 
    } 
 
  return RetStatus; 
 
} 
 
/////////////////////////////////////////////////////////////////////// 
void ClosePort() 
{ 
 
  if ( m_bIFOpened ) 
  { 
    m_bIFOpened = FALSE; 
  } 
 
} 
 
 
////////////////////////////////////////////////////////////////////////////// 
// CDevice7402::OpenDrawer [called from polling thread] 
 
long OpenDrawer() 
{ 
  long RetStatus; 
  CString RetString; 
 
  WaitForSingleObject( g_hHWPortMutex, INFINITE );  // TAR 95236 
 
  if ( m_bIFOpened ) 
  { 
    WaitForSingleObject( m_hPowerMutex, INFINITE ); 
 
    // Set Device in RELEASE State 
    if ( SetState( STATE_RELEASE ) ) 
    { 
      // Give time for Drawer to see the RELEASE state change, then 
      // check the drawer position. 
      Sleep( CD7402_OPEN_WAIT ); 
 
      // Set Device in IDLE State 
      if ( SetState( STATE_IDLE ) ) 
      { 
        if (( GetDrawerStatusLIO() == DRAWER_OPENED ) || 
      ( m_pCashDrawer->m_bCapStatus == FALSE))  // no drawer status available return success 
        { 
          RetStatus = OPOS_SUCCESS; 
        } 
        else 
        { 
          RetStatus = OPOS_E_TIMEOUT; 
        } 
      }//SetState( STATE_IDLE ) 
      else 
      { 
        RetStatus = OPOS_E_NOEXIST; 
      } 
    }//SetState( STATE_RELEASE ) 
    else 
    { 
      RetStatus = OPOS_E_NOEXIST; 
    } 
 
    ReleaseMutex( m_hPowerMutex ); 
  } 
 
  ReleaseMutex( g_hHWPortMutex ); 
 
  return RetStatus; 
} 
 
 
////////////////////////////////////////////////////////////////////////////// 
// CDevice7402::GetDrawerStatus [called from polling thread] 
// 
// Return Value:
//         DRAWER_OPENED 
//         DRAWER_CLOSED 
// 
DWORD GetDrawerStatus() 
{ 
  int Result; 
  CString ResString; 
  DWORD bMask; 
 
  Result = DRAWER_INVALID; 
  ResString = _T("INVALID"); 
 
  if ( m_bIFOpened && ( m_pCashDrawer->m_bCapStatus) )  // Opened and Drawer status is available 
  { 
    switch( m_nDrawerNumber ) 
    { 
      case 1: 
        bMask = CD7402DRWR1CLOSED; 
        break; 
 
      case 2: 
        bMask = CD7402DRWR2CLOSED; 
        break; 
    } 
 
    DWORD sBytes; 
 
    // if the status clear was successful, we will read a closed drawer 
    BOOL sResult = ReadIOPort(&sBytes, m_nIOPort); 
 
    if ( sResult ) 
    { 
      if ( sBytes & bMask )  // bit = 1 means drawer CLOSED for DARLINGTON 
      { 
        ResString = _T("CLOSED"); 
        Result = DRAWER_CLOSED; 
      } 
      else 
      { 
        ResString = _T("OPENED"); 
        Result = DRAWER_OPENED; 
      } 
    }//sResult 
  } 
 
  return Result; 
 
} 
////////////////////////////////////////////////////////////////////////////// 
// CDevice7402::SetState 
 
BOOL SetState( DWORD dwState ) 
{ 
    // Fire cashdrawer mechanism by setting drawer to the RELEASE State. 
 
    // Can't open both cash drawers at the same time. Must set H/W mutex 
    // in OpenDrawerLIO() around SetState(RELEASE) and SetState(IDLE) to 
    // insure this. 
 
  // To engage solenoid, we must set the solenoid bit HIGH and the ARM bit 
  // LOW.  The ARM bit controls the external arming circuit to drive the 
 // solenoid. 
 
    CString sState; 
 
    DWORD bMask; 
    DWORD sBytes = 0; 
    DWORD oBytes = 0; 
    BOOL  result = TRUE; 
  // Read select register 
  // Solenoid GPIO bits and ARM bit have been set to input when not using. 
  if ( ReadIOPort(&sBytes, m_nIOPort_select) ) 
 { 
 
    // solenoid bits  and ARM bit as outputs, Low enables output 
    sBytes = sBytes & CD7402SELECT_GPO; 
    result = WriteIOPort( sBytes, m_nIOPort_select ); 
 } 
 
  else     // Error logged in ReadIOPort 
    result = FALSE; 
 if(result) 
 { 
    switch( m_nDrawerNumber ) 
   { 
      case 1: 
        // set solenoid bit high, arm bit low 
   bMask = CD7402DRWR1SOLENOID; 
   break; 
 
      case 2: 
   bMask = CD7402DRWR2SOLENOID; 
   break; 
   } 
    // Read solenoid bit 
    if ( ReadIOPort(&oBytes, m_nIOPort) ) 
   { 
   switch (dwState)
   { 
        case ( STATE_RELEASE ): 
        // activate solenoid (open cash drawer) 
        // bit = 1 activates solenoid, = 0 de-activates 
        // Set the solenoid bit ON to energize, leave other bits alone 
        oBytes = oBytes | bMask; 
          // driving circuit arming bit,LOW for arming 
        oBytes = oBytes & CD7402ARM_ON; 
 
        result = WriteIOPort( oBytes, m_nIOPort ); 
    sState = _T("STATE_RELEASE"); 
    break; 
 
        case ( STATE_IDLE ): 
    // deactivate solenoid 
        oBytes = oBytes & (~bMask);  // Set the solenoid bit OFF to de-
energize, leave other bits alone 
        oBytes = oBytes | CD7402ARM_OFF; 
    sState = _T("STATE_IDLE"); 
        // write new solenoid bit 
        result = WriteIOPort( oBytes, m_nIOPort ); 
        sBytes = sBytes | CD7402SELECT_GPI;  // set solenoid bits and status 
bit as inputs 
        // write new select with solenoid bits enabled as Inputs. 
    WriteIOPort( sBytes, m_nIOPort_select ); 
    break; 
 
     default: 
        // Set the INVALID state configuration. 
    return FALSE; 
   } 
 
   } 
 
    else     // Error logged in ReadIOPort 
   result = FALSE; 
 
 } //result 
 
 
    return result; 
} 
 
 
////////////////////////////////////////////////////////////////////////////// 
// CDeviceDarlington::QueryConf - 
 
/*Configuration mechanism one utilizes two 32bit I/O ports located at addresses 
0x0CF8 and 0x0CFC. 
These two ports are:    
· 32-bit configuration address port, occupying I/O addresses 0x0CF8 through 
0x0CFB. 
· 32-bit configuration data port, occupying I/O addresses 0x0CFC through 
0x0CFF. 
Accessing a PCI function's configuration port is a two step process: 
· Write the target bus number, physical device number, function number 
and doubleword number to the configuration address port 
· Perform and I/O read from or a write to the configuration data port. 
 
The ICH4 Configuration Address Register(CONFIG_ADDRESS) should be defined as 
follows: 
· Configuration Space Mapping enabled 
· Bus number 0x0 
· Device number 0x31 
· Function number 0x00 
· GPIO BASE Port offset address 0x58 
The configuration address register at 0x0CF8 value for DWORD access: 
  - for GPI/O GPIO_BASE register 80007858 
  - for GPI/O GPIO_CNTL register 8000785C 
 
Within the ICH4, the General Purpose I/O ports are addressed using an offset 
from 
the base address assigned by the BIOS.  The offset to GP I/O ports is as 
follows: 
· GPIO_USE_SEL2: DWORD offset GPIO_BASE contents + 0x30 
· GPIO_IO_SEL2: DWORD offset GPIO_BASE contents + 0x34 
· GPIO_LVL2: DWORD offset GPIO_BASE contents + 0x38 
 
Two GPO ports one GPI port of South Bridge VT686B are used to control cash 
drawer. They are defined as below: 
 
· GPIO 33 CD_SOL_A     output 0, low turn off solenoid A.  Output 1, high 
Activates Solenoid A. 
· GPIO 34 CD_SOL_B    output 0, low turn off solenoid B.  Output 1, high  
Activates Solenoid B. 
· GPIO  32 CD_SW_AB      input 1, high Drawer(s) open.    Input 0, low 
Drawer(s) closed. 
· GPIO  35 CD_ARM      output 0, low Drawer(s) solenoid signals enabled. Output 
1, high disabled. 
There is only one cash drawer status signal CD_SW_AB. It is the status of 
either cash drawer or 
both cash drawers. 
 
*/ 
 
//In the PCI device configuration space, query the 
// GPIO Base Address Register (GPIOBASE) to determine the address for reading 
// the GPI port assigned to the select register (m_nIOPort_select) and the address 
// we can read/write the solenoid bits and read the status bit (m_nIOPort). 
// The BIOS assigns these addresses dynamically. We obtain the addresses as 
// follows: 
// 
// A. Write to m_nIOConf, then read GPIOBASE from m_nIOConf+4 and add the respective 
//    offset to the result to obtain m_nIOPort and m_nIOPort_select. 
// B. We can now control the solenoid bits and read the status bit via m_nIOPort 
//    and Input/Output select via m_nIOPort_select. 
//   (see ReadInPort() and WriteOutPort() for details) 
// 
// REFERENCES: Shanley/Anderson, "PCI System Architecture" 3rd. ed. (Chapter 15-17) 
//             "INTEL ICH4 I/O Controller Hub" Datasheet 
 
BOOL QueryConf() 
{ 
  BOOL  result = TRUE; 
  DWORD FileOffset=0x40; 
  DWORD DataRead=0; 
  // Configuration Address Register at 0x0CF8 
  // bit 31 = 1  ; Enable Configuration Space Mapping 
  // bits 30 - 24 = 0 ; Reserved 
  // bits 23 - 16 = 0 ; Bus number 
  // bits 15 - 11 = 31  ; Device 
  // bits 10 - 8  = 0 ; Function 
  // bits 7 - 0  = 58; Register bits 1 - 0 Always zero (See NOTE 1) 
  // NOTE 1:  GPIO base Address is read from General Purpose I/O Register Base Address at a fixed Offset = 0x58 
  // The GPIO Register Base Address value provides a base address in bits 15:6.  Therefore mask is 0x0FFC0. 
  DWORD n_configGPIOReqData = 0x8000F858;  // Dev. 31, Func. 0, Reg. 0x58 
 
  DWORD gpioport=0; 
 
  UCHAR uc_gp_offset = 0x38; //DWORD IOoffset for the GPIO solenoid and status bits 
  // GPI[34:32] are bits 2:0 
  UCHAR uc_gpsel_offset   = 0x34;  //DWORD IOoffset for the GPIO select register 
  // GPO[34:32] are bits 2:0 
  UCHAR uc_gpuse_offset = 0x30; // IOoffset for GPIO Use select reg, 1 = GPIO 
  int CD7402USE_GPIO    = 0x0000000F; 
  WORD nUsePort =0; 
 
  UCHAR status_mask = 0x01;  // GPI[32] 
  UCHAR solenoidA_mask = 0x02;  // GPO[33] 
  UCHAR solenoidB_mask = 0x04;  // GPO[34] 
 
  DWORD DataWritten=0;
  WaitForSingleObject( g_hHWPortMutex, INFINITE ); 
 
  if ((m_nOSVersion == OS_WINDOWS_95) || (m_nOSVersion == OS_WINDOWS_CE)) 
 
  { // WIN 95 I/O config 
     //********************************PART A ************************************* 
     _outpd(m_nIOConf, n_configGPIOReqData);       // request communication 
with GPIO_BASE 
     gpioport = (LOWORD(_inpd(m_nIOConf+4))) 
                                  & 0x0FFC0;        // get GPIO base address 
(only 10 bits) 
     m_nIOPort_select = (WORD)gpioport+uc_gpsel_offset;    // GP Sel Base 
address from GPIO Base Register 
     m_nIOPort = (WORD)gpioport+uc_gp_offset;    // GPO Base address from GPIO 
Base Register 
     nUsePort = (WORD)gpioport+uc_gpuse_offset; 
 
  } //Win95 
 
  else // WIN NT I/O Config 
  { 
    if (m_bPortDrvr == TRUE) // if Wedge NT driver opened successfully 
    { 
     //********************************PART A ************************************* 
 
      SetFilePointer( g_hPortDrvr, m_nIOConf, (PLONG)&FileOffset, FILE_BEGIN); 
 
      // request communication with GPIOBASE 
      if ( WriteFile( 
             g_hPortDrvr,            // Handle to device 
             (LPSTR) &n_configGPIOReqData, 
             (DWORD) 4,              // Length of buffer in bytes 
             &DataWritten,           // bytes written 
             NULL ) == FALSE )       // NULL means wait till I/O completes. 
      { 
        DWORD hr = GetLastError(); 
        result = FALSE; 
   return result; 
      } 
 
      else 
      { 
        SetFilePointer( g_hPortDrvr, (m_nIOConf+4), (PLONG)&FileOffset, 
FILE_BEGIN);  //TIGER +4 
 
        // get GPIO base address 
        if ( result && 
   ( ReadFile( 
               g_hPortDrvr,            // Handle to device 
               (LPSTR) &gpioport, 
               (DWORD) 4,              // Length of buffer in bytes 
               &DataRead,              // bytes read 
               NULL ) == FALSE ) )     // NULL means wait till I/O completes. 
        { 
        gpioport = 0;    //Read failed 
          DWORD hr = GetLastError(); 
          result = FALSE; 
      return result; 
        } 
      }  // end if WriteFile(...) 
 
      gpioport &= 0x0FFC0;  // strip resource indicator 
     m_nIOPort_select = (WORD)gpioport+uc_gpsel_offset;    // GP Sel Base address from GPIO Base Register 
     m_nIOPort = (WORD)gpioport+uc_gp_offset;    // GPO Base address from GPIO Base Register 
     nUsePort = (WORD)gpioport+uc_gpuse_offset; 
 
  } // m_bPortDrvr 
  }  //NT 
 
  // End Read Configuration Register 
 
  if ( result ) 
  { 
    if ( (m_nIOPort == 0) || (m_nIOPort_select == 0) ) 
    { 
     result = FALSE; 
     } 
    else 
    { 
 
      DWORD sBytes =0; 
    // Read USE select register 
    if ( ReadIOPort(&sBytes, nUsePort) ) 
   { 
 
      sBytes = sBytes | CD7402USE_GPIO;  //35:32 bits as GPIO 
      // write new USE 
      result = WriteIOPort( sBytes, nUsePort ); 
   } 
   else 
   result = FALSE; 
 
      // Read select register 
    if (( ReadIOPort(&sBytes, m_nIOPort_select) ) && result) 
   { 
      sBytes = sBytes | CD7402SELECT_GPI;  //solenoid bits as inputs 
      // write new select with solenoid bits enabled as Outputs. 
      result = WriteIOPort( sBytes, m_nIOPort_select ); 
   } 
   else 
   result = FALSE; 
    } 
  } 
 
  ReleaseMutex( g_hHWPortMutex ); 
  return result; 
} 
 
 
////////////////////////////////////////////////////////////////////////////// 
// CDevice7402::WriteIOPort 
//We use the port address obtained from QueryConf(). 
 
BOOL WriteIOPort( DWORD databytes, WORD ioport ) 
{ 
  BOOL  result = TRUE; 
  DWORD FileOffset=0x40; 
  DWORD DataWritten; 
 
  WaitForSingleObject( g_hHWPortMutex, INFINITE );  // TAR 95236 
 
  if ((m_nOSVersion == OS_WINDOWS_95) || (m_nOSVersion == OS_WINDOWS_CE)) 
 
  { // WIN 95 I/O write 
       _outpd( ioport, databytes ); 
  } //Win95 
 
  else 
  { // WIN NT I/O write 
    if (m_bPortDrvr == TRUE)     // if Wedge NT driver opened successfully 
    { 
 
        //*********TIGER Write Register address dword to IOPort*************** 
         SetFilePointer( g_hPortDrvr, ioport, (PLONG)&FileOffset, FILE_BEGIN); 
 
       m_pDC->DCPrintf( DCM_APILOW, 
       _T("*CDeviceNCR7402:WriteIO: databytes= %X; IOPort= %X"), databytes, 
                                                                   ioport ); 
 
         if ( WriteFile( 
                g_hPortDrvr,            // Handle to device 
                (LPSTR) &databytes, 
                (DWORD) 4,              // Length of buffer in bytes 
                &DataWritten,           // bytes written 
                NULL ) == FALSE )       // NULL means wait till I/O completes. 
         { 
            DWORD hr = GetLastError(); 
            result = FALSE; 
         } 
    }  //m_bPortDrvr 
  } //NT 
  ReleaseMutex( g_hHWPortMutex );  // TAR 95236 
 
  return result; 
} 
 
////////////////////////////////////////////////////////////////////////////// 
// CDevice7402::ReadIOPort 
// We use the port addresses obtained from QueryConf(). 
 
BOOL ReadIOPort( DWORD *databytes, WORD ioport ) 
{ 
  BOOL  result = TRUE; 
  DWORD FileOffset=0x40; 
  DWORD DataRead; 
 
  WaitForSingleObject( g_hHWPortMutex, INFINITE ); 
 
  if ((m_nOSVersion == OS_WINDOWS_95) || (m_nOSVersion == OS_WINDOWS_CE)) 
 
  { // WIN 95 I/O write 
       *databytes = _inpd( ioport );  //Read 32-bits from ioport 
  } //Win95 
 
  else 
 
  {   // WIN NT I/O read 
    if (m_bPortDrvr == TRUE) // if Wedge NT driver opened successfully 
    { 
          SetFilePointer( g_hPortDrvr, ioport, (PLONG)&FileOffset, FILE_BEGIN); 
 
          if ( ReadFile( 
               g_hPortDrvr,            // Handle to device 
               (LPSTR) databytes,      // address of data buffer 
               (DWORD) 4,              // Length of buffer in bytes 
               &DataRead,              // bytes read 
               NULL ) == FALSE )       // NULL means wait till I/O completes. 
       { 
 
          DWORD hr = GetLastError(); 
          result = FALSE; 
       } 
    }  // m_bPortDrvr 
  }  // NT 
  ReleaseMutex( g_hHWPortMutex ); 
 
  return result; 
} 
 
// 7402 Modifications End Here! 
///////////////////////////////////////////////////////////////////////////////
//////// 
 
//..end.. 
 
 
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
 
// DrawerPop.h
///////////////////////////////////////////////////////////////////////////// 
// NCR7402 (Darlington Motherboard) Modifications start here //////////// 
// - 7402 cash drawer port definitions 
/*INTEL ICH4 South Bridge used to control cash drawer. 
They are defined as below: 
 
· GPI 32    CD_SW_AB      input 1, high Drawer(s) CLOSED.              Input 0, 
low Drawer(s) OPEN. 
· GPO 33   CD_SOL_A       output 0, low turn off solenoid A.      Output 1, 
high Activates Solenoid A. 
· GPO 34   CD_SOL_B        output 0, low turn off solenoid B.      Output 1, 
high  Activates Solenoid B. 
. GPO 35 CD_ARM    output 0, low activates driving circuit.      Output 1, high  
De-activates driving circuit. 
*/ 
const int CD7402DRWR1SOLENOID       = 0x000002;  //Darlington: GPIO bit 33 high actuates solenoid 
const int CD7402DRWR2SOLENOID       = 0x000004;  //Darlington: GPIO bit 34 high actuates solenoid 
 
const int CD7402SELECT_GPO       = 0xFFFFF1;  //Darlington: GPIO bit 32 high selects bit as INPUT, low GPIO[35:33] output 
const int CD7402SELECT_GPI       = 0x00000F;  //Darlington: GPIO bit [35:32] high selects bit as INPUT, 
 
 
const int CD7402DRWR1CLOSED           = 0x00000001; //Darlington: GPIO bit 32 high means drawer closed 
const int CD7402DRWR2CLOSED           = 0x00000001; // This definition assumes shared status bit 
 
const int CD7402ARM_OFF               = 0x00000008;  // Disable Active low ARM driving circuit, high is off. 
const int CD7402ARM_ON               = 0xFFFFFFF7;  // Enable Active low ARM driving circuit, high is off. 
 
///////////////////////////////////////////////////////////////////////////// 
// NCR7402 Modifications End here //////////// 
HANDLE    g_hSharedMemoryMutex;   // mutex used to protect shared memory area 
HANDLE    g_hHWPortMutex;            // protects access to h/w I/O port 
 
long Initialize( ); 
void Terminate(); 
long OpenPort(); 
void ClosePort(); 
long OpenDrawer(); 
DWORD GetDrawerStatus(); 
BOOL SetState( DWORD dwState ); 
BOOL QueryConf(); 
BOOL WriteIOPort( DWORD databytes, WORD ioport ); 
BOOL ReadIOPort( DWORD *databytes, WORD ioport ); 
 
 
//..end..

Open in new window

1463n.pdf
0
Comment
Question by:microbolt
  • 6
  • 6
  • 5
17 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 24816445
>> I'm getting lots of errors when trying to compile (117 errors).
Which are?
0
 
LVL 6

Author Comment

by:microbolt
ID: 24818520
Well I figured it was because of not having the right headers is why i didn't post the errors,  here they are below:
Error	1	error C2146: syntax error : missing ';' before identifier 'g_hSharedMemoryMutex'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	32	DrawerPop
Error	2	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	32	DrawerPop
Error	3	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	32	DrawerPop
Error	4	error C2146: syntax error : missing ';' before identifier 'g_hHWPortMutex'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	5	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	6	error C2086: 'int HANDLE' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	7	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	8	error C2146: syntax error : missing ';' before identifier 'GetDrawerStatus'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	40	DrawerPop
Error	9	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	40	DrawerPop
Error	10	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	40	DrawerPop
Error	11	error C2146: syntax error : missing ';' before identifier 'SetState'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	12	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	13	error C2146: syntax error : missing ')' before identifier 'dwState'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	14	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	15	error C2059: syntax error : ')'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	16	error C2146: syntax error : missing ';' before identifier 'QueryConf'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	17	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	18	error C2086: 'int BOOL' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	19	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	20	error C2146: syntax error : missing ';' before identifier 'WriteIOPort'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	21	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	22	error C2086: 'int BOOL' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	23	error C2146: syntax error : missing ')' before identifier 'databytes'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	24	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	25	error C2059: syntax error : ')'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	26	error C2146: syntax error : missing ';' before identifier 'ReadIOPort'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	27	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	28	error C2086: 'int BOOL' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	29	error C2065: 'databytes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	30	error C2065: 'WORD' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	31	error C2146: syntax error : missing ')' before identifier 'ioport'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	32	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	33	error C2078: too many initializers	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	34	error C2059: syntax error : ')'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	35	error C2065: 'm_nIOConf' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	17	DrawerPop
Error	36	error C2065: 'm_nIOPort' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	20	DrawerPop
Error	37	error C2065: 'm_nIOPort_select' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	21	DrawerPop
Error	38	error C2065: 'm_nDrawerNumber' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	23	DrawerPop
Error	39	error C2065: 'm_bPortDrvr' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	26	DrawerPop
Error	40	error C2065: 'FALSE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	26	DrawerPop
Error	41	error C3861: 'GetVersion': identifier not found	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	29	DrawerPop
Error	42	error C2065: 'm_nOSVersion' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	31	DrawerPop
Error	43	error C2065: 'OS_WINDOWS_NT' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	31	DrawerPop
Error	44	error C2065: 'INFINITE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	33	DrawerPop
Error	45	error C3861: 'WaitForSingleObject': identifier not found	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	33	DrawerPop
Error	46	error C2065: 'g_hPortDrvr' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	35	DrawerPop
Error	47	error C2065: 'm_Attributes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	38	DrawerPop
Error	48	error C2065: 'm_SD' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	39	DrawerPop
Error	49	error C3861: 'GetGlobalSA': identifier not found	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	38	DrawerPop
Error	50	error C2065: 'g_hPortDrvr' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	41	DrawerPop
Error	51	error C2065: 'GENERIC_WRITE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	43	DrawerPop
Error	52	error C2065: 'GENERIC_READ' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	43	DrawerPop
Error	53	error C2065: 'FILE_SHARE_READ' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	44	DrawerPop
Error	54	error C2065: 'FILE_SHARE_WRITE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	44	DrawerPop
Error	55	error C2065: 'LPSECURITY_ATTRIBUTES' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	45	DrawerPop
Error	56	error C2065: 'm_Attributes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	45	DrawerPop
Error	57	error C2065: 'OPEN_EXISTING' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	46	DrawerPop
Error	58	error C3861: 'CreateFile': identifier not found	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	41	DrawerPop
Error	59	error C2065: 'g_hPortDrvr' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	50	DrawerPop
Error	60	error C2065: 'INVALID_HANDLE_VALUE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	50	DrawerPop
Error	61	error C2146: syntax error : missing ';' before identifier 'hr'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	52	DrawerPop
Error	62	error C2065: 'hr' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	52	DrawerPop
Error	63	error C3861: 'GetLastError': identifier not found	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	52	DrawerPop
Error	64	error C2065: 'm_bPortDrvr' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	54	DrawerPop
Error	65	error C2065: 'FALSE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	54	DrawerPop
Error	66	error C2065: 'InitError' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	56	DrawerPop
Error	67	error C2065: 'TRUE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	56	DrawerPop
Error	68	error C2065: 'm_bPortDrvr' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	61	DrawerPop
Error	69	error C2065: 'TRUE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	61	DrawerPop
Error	70	error C3861: 'ReleaseMutex': identifier not found	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	67	DrawerPop
Error	71	error C2065: 'm_nOSVersion' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	73	DrawerPop
Error	72	error C2065: 'OS_WINDOWS_95' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	73	DrawerPop
Error	73	error C2059: syntax error : 'if'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	81	DrawerPop
Error	74	error C2143: syntax error : missing ';' before '{'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	82	DrawerPop
Error	75	error C2447: '{' : missing function header (old-style formal list?)	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	82	DrawerPop
Error	76	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	112	DrawerPop
Error	77	error C2059: syntax error : '}'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	114	DrawerPop
Error	78	error C2143: syntax error : missing ';' before '}'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	114	DrawerPop
Error	79	error C2059: syntax error : '}'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	114	DrawerPop
Error	80	error C2059: syntax error : '}'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	118	DrawerPop
Error	81	error C2143: syntax error : missing ';' before '}'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	118	DrawerPop
Error	82	error C2059: syntax error : '}'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	118	DrawerPop
Error	83	error C2143: syntax error : missing ';' before '{'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	123	DrawerPop
Error	84	error C2447: '{' : missing function header (old-style formal list?)	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	123	DrawerPop
Error	85	error C2065: 'CString' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	152	DrawerPop
Error	86	error C2146: syntax error : missing ';' before identifier 'sData'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	152	DrawerPop
Error	87	error C2065: 'sData' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	152	DrawerPop
Error	88	error C2065: 'CString' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	154	DrawerPop
Error	89	error C2146: syntax error : missing ';' before identifier 'Result'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	154	DrawerPop
Error	90	error C2065: 'Result' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	154	DrawerPop
Error	91	error C2146: syntax error : missing ';' before identifier 'sBytes'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	163	DrawerPop
Error	92	error C2065: 'sBytes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	163	DrawerPop
Error	93	error C2146: syntax error : missing ';' before identifier 'bMask'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	164	DrawerPop
Error	94	error C2065: 'bMask' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	164	DrawerPop
Error	95	error C2065: 'Solenoid' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	165	DrawerPop
Error	96	error C2146: syntax error : missing ';' before identifier 'bits'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	165	DrawerPop
Error	97	error C2065: 'bits' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	166	DrawerPop
Error	98	error C2146: syntax error : missing ';' before identifier 'LOW'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	166	DrawerPop
Error	99	error C2065: 'LOW' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	166	DrawerPop
Error	100	error C2146: syntax error : missing ';' before identifier 'bMask'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	166	DrawerPop
Error	101	error C2065: 'bMask' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	166	DrawerPop
Error	102	error C2065: 'bMask' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	166	DrawerPop
Error	103	error C2065: 'sBytes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	169	DrawerPop
Error	104	error C2065: 'm_nIOPort_select' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	169	DrawerPop
Error	105	error C2065: 'CDD_E_IOFAILURE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	172	DrawerPop
Error	106	error C2065: 'Result' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	173	DrawerPop
Error	107	error C2065: 'sBytes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	175	DrawerPop
Error	108	error C2065: 'm_nIOPort_select' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	176	DrawerPop
Error	109	error C2065: 'CDD_E_IOFAILURE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	179	DrawerPop
Error	110	error C2065: 'Result' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	180	DrawerPop
Error	111	error C2065: 'sBytes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	184	DrawerPop
Error	112	error C2065: 'm_nIOPort' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	184	DrawerPop
Error	113	error C2065: 'CDD_E_IOFAILURE' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	187	DrawerPop
Error	114	error C2065: 'Result' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	188	DrawerPop
Error	115	error C2065: 'sBytes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	191	DrawerPop
Error	116	error C2065: 'bMask' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	191	DrawerPop
Error	117	fatal error C1003: error count exceeds 100; stopping compilation	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.cpp	191	DrawerPop

Open in new window

0
 
LVL 40

Expert Comment

by:evilrix
ID: 24820726
Ok, well I think a lot of these errors will be dealt with by the inclusion of windows.h since a lot of them are to do with using WIN32 data types that are not defined (such as HANDLE or BOOL). There also seems to the the usage of types that I don't recognise but I suspect are assumed to be enum or int types (such as CDD_E_IOFAILURE) that either you need to define or are defined elsewhere in another header maybe?

How about fixing up the errors that can be resolved with the inclusion of windows.h and then reposting the errors that are left and we can then try and come up with solutions to what's left?

-Rx.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24821412
>>>> a lot of these errors will be dealt with by the inclusion of windows.h

The windows.h normally was included in stdafx.h (which was missing in the post).

Could you post stdafx.h?
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24821441
>> The windows.h normally was included in stdafx.h (which was missing in the post).
Not everyone uses precompiled headers -- I certainly don't :)
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24821483
>>>> Not everyone uses precompiled headers -- I certainly don't :)
I don't either. But the wizard generated projects always have a stdafx.h regardless whethere they have PCH switched on or off.


@microbolt

I tried to compile your code but there are still header files missing (beside of the windows.h which I included in stdafx.h), e. g. at the begin of _tmain

>>>>    m_nIOConf = 0x0CF8;
 
    // Read -- I/O Port -- If these defaults are left unchanged, errors will be reported
>>>>   m_nIOPort  = 0;  // R/W port for solenoid bits and status
>>>>   m_nIOPort_select = 0;  //R/W port for selecting GPIO Input/Output config


all the m_nIOConf,  m_nIOPort,    m_nIOPort_select were not defined.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24821502
>> But the wizard generated projects
You know what I'm gonna say next right? :)

Although since the entry-point is _tmain() I'll concede that on this occasion I'm sure you're right.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24821643
>>>> You know what I'm gonna say next right? :)
Maybe, but you probably are wrong. Even for a new and empty project it is highly recommended (or I don't see a practicable alternative) to using the wizard. The project and solution files are complex xml files where it is highly error-prone - hence unprofessional - if you would create them manually.

>>>> since the entry-point is _tmain()
Yeah, the T-switch is even more annyoying than the PCH (and both cover a good deal of the questions we were answering here ...)
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24821691
>> Maybe, but you probably are wrong
Muhahahaha --- this is a nice discussion and I'd like to continue it but not at the cost of polluting this thread so I've started a private discussion thread for us to continue. You should have an invite from me. :)
0
 
LVL 6

Author Comment

by:microbolt
ID: 24823784
Here is the contents of the stdafx.h:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
 
#pragma once
#include "targetver.h"
 
#include <stdio.h>
#include <tchar.h>
 
 
 
// TODO: reference additional headers your program requires here

Open in new window

0
 
LVL 6

Author Comment

by:microbolt
ID: 24823791
and when I add #include <windows.h> to the top I get more errors now: (154 errors)

Error	1	error C2146: syntax error : missing ';' before identifier 'g_hSharedMemoryMutex'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	32	DrawerPop
Error	2	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	32	DrawerPop
Error	3	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	32	DrawerPop
Error	4	error C2146: syntax error : missing ';' before identifier 'g_hHWPortMutex'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	5	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	6	error C2086: 'int HANDLE' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	7	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	33	DrawerPop
Error	8	error C2146: syntax error : missing ';' before identifier 'GetDrawerStatus'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	40	DrawerPop
Error	9	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	40	DrawerPop
Error	10	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	40	DrawerPop
Error	11	error C2146: syntax error : missing ';' before identifier 'SetState'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	12	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	13	error C2146: syntax error : missing ')' before identifier 'dwState'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	14	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	15	error C2059: syntax error : ')'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	41	DrawerPop
Error	16	error C2146: syntax error : missing ';' before identifier 'QueryConf'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	17	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	18	error C2086: 'int BOOL' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	19	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	42	DrawerPop
Error	20	error C2146: syntax error : missing ';' before identifier 'WriteIOPort'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	21	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	22	error C2086: 'int BOOL' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	23	error C2146: syntax error : missing ')' before identifier 'databytes'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	24	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	25	error C2059: syntax error : ')'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	43	DrawerPop
Error	26	error C2146: syntax error : missing ';' before identifier 'ReadIOPort'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	27	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	28	error C2086: 'int BOOL' : redefinition	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	29	error C2065: 'databytes' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	30	error C2065: 'WORD' : undeclared identifier	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	31	error C2146: syntax error : missing ')' before identifier 'ioport'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	32	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	33	error C2078: too many initializers	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	34	error C2059: syntax error : ')'	c:\users\brandon\documents\visual studio 2008\projects\drawerpop\drawerpop\drawerpop.h	44	DrawerPop
Error	35	error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	152	DrawerPop
Error	36	error C2378: 'BOOL' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	153	DrawerPop
Error	37	error C2143: syntax error : missing ';' before '*'	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	158	DrawerPop
Error	38	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	158	DrawerPop
Error	39	error C2378: 'BOOL' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	158	DrawerPop
Error	40	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	158	DrawerPop
Error	41	error C2143: syntax error : missing ';' before '*'	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	159	DrawerPop
Error	42	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	159	DrawerPop
Error	43	error C2378: 'BOOL' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	159	DrawerPop
Error	44	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	159	DrawerPop
Error	45	error C2143: syntax error : missing ';' before '*'	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	167	DrawerPop
Error	46	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	167	DrawerPop
Error	47	error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	167	DrawerPop
Error	48	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	167	DrawerPop
Error	49	error C2143: syntax error : missing ';' before '*'	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	168	DrawerPop
Error	50	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	168	DrawerPop
Error	51	error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	168	DrawerPop
Error	52	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\windef.h	168	DrawerPop
Error	53	error C2378: 'HANDLE' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	402	DrawerPop
Error	54	error C2143: syntax error : missing ';' before '*'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	408	DrawerPop
Error	55	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	408	DrawerPop
Error	56	error C2378: 'HANDLE' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	408	DrawerPop
Error	57	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	408	DrawerPop
Error	58	error C2146: syntax error : missing ';' before identifier 'FLONG'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	416	DrawerPop
Error	59	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	416	DrawerPop
Error	60	error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	416	DrawerPop
Error	61	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	416	DrawerPop
Error	62	error C2146: syntax error : missing ';' before identifier 'LCID'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	487	DrawerPop
Error	63	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	487	DrawerPop
Error	64	error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	487	DrawerPop
Error	65	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	487	DrawerPop
Error	66	error C2146: syntax error : missing ';' before identifier 'PLCID'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	488	DrawerPop
Error	67	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	488	DrawerPop
Error	68	error C2378: 'PDWORD' : redefinition; symbol cannot be overloaded with a typedef	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	488	DrawerPop
Error	69	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	488	DrawerPop
Error	70	error C2146: syntax error : missing ';' before identifier 'LowPart'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	562	DrawerPop
Error	71	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	562	DrawerPop
Error	72	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	562	DrawerPop
Error	73	error C2146: syntax error : missing ';' before identifier 'LowPart'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	566	DrawerPop
Error	74	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	566	DrawerPop
Error	75	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	566	DrawerPop
Error	76	error C2146: syntax error : missing ';' before identifier 'LowPart'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	580	DrawerPop
Error	77	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	580	DrawerPop
Error	78	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	580	DrawerPop
Error	79	error C2146: syntax error : missing ';' before identifier 'HighPart'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	581	DrawerPop
Error	80	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	581	DrawerPop
Error	81	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	581	DrawerPop
Error	82	error C2146: syntax error : missing ';' before identifier 'LowPart'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	584	DrawerPop
Error	83	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	584	DrawerPop
Error	84	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	584	DrawerPop
Error	85	error C2146: syntax error : missing ';' before identifier 'HighPart'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	585	DrawerPop
Error	86	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	585	DrawerPop
Error	87	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	585	DrawerPop
Error	88	error C2146: syntax error : missing ';' before identifier 'LowPart'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	601	DrawerPop
Error	89	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	601	DrawerPop
Error	90	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	601	DrawerPop
Error	91	error C2061: syntax error : identifier 'DWORD'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	656	DrawerPop
Error	92	error C2061: syntax error : identifier 'DWORD'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	663	DrawerPop
Error	93	error C2061: syntax error : identifier 'DWORD'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	670	DrawerPop
Error	94	error C2061: syntax error : identifier 'DWORD'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	682	DrawerPop
Error	95	error C2061: syntax error : identifier 'DWORD'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	698	DrawerPop
Error	96	error C2061: syntax error : identifier 'DWORD'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	714	DrawerPop
Error	97	error C2146: syntax error : missing ';' before identifier 'Flink'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	866	DrawerPop
Error	98	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	866	DrawerPop
Error	99	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	866	DrawerPop
Error	100	error C2146: syntax error : missing ';' before identifier 'Blink'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	867	DrawerPop
Error	101	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	867	DrawerPop
Error	102	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	867	DrawerPop
Error	103	error C2146: syntax error : missing ';' before identifier 'Uniquifier'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	885	DrawerPop
Error	104	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	885	DrawerPop
Error	105	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	885	DrawerPop
Error	106	error C2065: 'Index' : undeclared identifier	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3136	DrawerPop
Error	107	error C2146: syntax error : missing ')' before identifier 'Mask'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3138	DrawerPop
Error	108	error C2078: too many initializers	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3138	DrawerPop
Error	109	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3138	DrawerPop
Error	110	error C2065: 'Index' : undeclared identifier	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3142	DrawerPop
Error	111	error C2146: syntax error : missing ')' before identifier 'Mask'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3144	DrawerPop
Error	112	error C2078: too many initializers	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3144	DrawerPop
Error	113	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3144	DrawerPop
Warning	114	warning C4162: '_BitScanForward' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3146	DrawerPop
Warning	115	warning C4162: '_BitScanReverse' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3147	DrawerPop
Error	116	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3240	DrawerPop
Error	117	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3240	DrawerPop
Error	118	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3245	DrawerPop
Error	119	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3245	DrawerPop
Error	120	error C2146: syntax error : missing ';' before identifier '__readfsdword'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3248	DrawerPop
Error	121	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3248	DrawerPop
Error	122	error C2086: 'int DWORD' : redefinition	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3248	DrawerPop
Error	123	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3250	DrawerPop
Error	124	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3250	DrawerPop
Error	125	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3250	DrawerPop
Error	126	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3254	DrawerPop
Error	127	error C2182: '__writefsbyte' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3254	DrawerPop
Error	128	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3256	DrawerPop
Error	129	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3260	DrawerPop
Error	130	error C2182: '__writefsword' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3260	DrawerPop
Error	131	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3262	DrawerPop
Error	132	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3266	DrawerPop
Error	133	error C2182: '__writefsdword' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3266	DrawerPop
Error	134	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3268	DrawerPop
Warning	135	warning C4162: '__readfsbyte' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3270	DrawerPop
Warning	136	warning C4162: '__readfsword' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3271	DrawerPop
Warning	137	warning C4162: '__readfsdword' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3272	DrawerPop
Warning	138	warning C4162: '__writefsbyte' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3273	DrawerPop
Warning	139	warning C4162: '__writefsword' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3274	DrawerPop
Warning	140	warning C4162: '__writefsdword' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3275	DrawerPop
Error	141	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3286	DrawerPop
Error	142	error C2182: '__incfsbyte' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3286	DrawerPop
Error	143	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3286	DrawerPop
Error	144	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3290	DrawerPop
Error	145	error C2182: '__addfsbyte' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3290	DrawerPop
Error	146	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3292	DrawerPop
Error	147	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3297	DrawerPop
Error	148	error C2182: '__incfsword' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3297	DrawerPop
Error	149	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3297	DrawerPop
Error	150	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3301	DrawerPop
Error	151	error C2182: '__addfsword' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3301	DrawerPop
Error	152	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3303	DrawerPop
Error	153	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3308	DrawerPop
Error	154	error C2182: '__incfsdword' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3308	DrawerPop
Error	155	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3308	DrawerPop
Error	156	error C2146: syntax error : missing ')' before identifier 'Offset'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3312	DrawerPop
Error	157	error C2182: '__addfsdword' : illegal use of type 'void'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3312	DrawerPop
Error	158	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3314	DrawerPop
Error	159	error C2146: syntax error : missing ')' before identifier 'Counter'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3399	DrawerPop
Error	160	error C2059: syntax error : ')'	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3399	DrawerPop
Warning	161	warning C4162: '__readpmc' : no function with C linkage found	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3401	DrawerPop
Error	162	error C2064: term does not evaluate to a function taking 1 arguments	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3490	DrawerPop
Error	163	fatal error C1003: error count exceeds 100; stopping compilation	c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h	3490	DrawerPop

Open in new window

0
 
LVL 6

Author Comment

by:microbolt
ID: 24823829
>>I tried to compile your code but there are still header files missing (beside of the >>windows.h which I included in stdafx.h), e. g. at the begin of _tmain
>>
>>>>>>    m_nIOConf = 0x0CF8;
>>
>>// Read -- I/O Port -- If these defaults are left unchanged, errors will be reported
>>>>>>   m_nIOPort  = 0;  // R/W port for solenoid bits and status
>>>>>>   m_nIOPort_select = 0;  //R/W port for selecting GPIO Input/Output config
>>
>>all the m_nIOConf,  m_nIOPort,    m_nIOPort_select were not defined.

I thought there was another header missing as well.  I got all this code from that PDF I attached in the first post.  I don't remember seeing an extra header with those defined.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24824918
Yes, I got same 153 errors.

But if you would find the header it may reduce to only a few errors.

Could you search all your computer for a header which contains these members? The m_ convention probably means it is some MFC project. But it also could come from a 3rd party library.
0
 
LVL 6

Author Comment

by:microbolt
ID: 24824930
This project was never on my computer.  I had to copy and paste code out of the PDF that I attached in the original post.  It is the manual for the NCR 7402 Point of Sale computer I'm trying to get this to work on.
0
 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 125 total points
ID: 24825235
Well, it's unlikely we can guess what's missing so I think your best bet is to contact the supplier and see if they have an SDK for you to use.
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 125 total points
ID: 24827338
>>>> Well, it's unlikely we can guess what's missing

I tried for some of the variables but there are functions like GetGlobalSA missing as well.

So, it isn't the headers only which were missing but some libraries as well ...

>>>> I had to copy and paste code out of the PDF

A zip would have been better ;-)

0
 
LVL 6

Accepted Solution

by:
microbolt earned 0 total points
ID: 24833218
>> A zip would have been better ;-)

Would of LOVED to have it in that format too =D.

I ended up getting an solution that worked for me.   Instead of using the "cash drawer" port on my NCR Point of Sale computer I connected the drawer to my receipt printer and send and ESC sequence to it to pop the drawer.

I appreciate you two trying to help me on this.  I'll split the points between you two for the effort ;)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question