Esempio n. 1
0
//
/// This callback is the default 'Dialog box procedure' of each page of our
/// property sheet....
//
INT_PTR CALLBACK
TPropertyPage::PropDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
  switch(msg) {
    case  WM_INITDIALOG: {
        // Attach C++ object with it's underlying handle if necessary
        //
        LPPROPSHEETPAGE pageInfo = REINTERPRET_CAST(LPPROPSHEETPAGE,lParam);
        InitHandle(hDlg, pageInfo);
      }
      break;

    case WM_NOTIFY: {
        TNotify& notifyInfo= *(REINTERPRET_CAST(TNotify*, lParam));
        if (notifyInfo.code<=(uint)PSN_FIRST && notifyInfo.code>=(uint)PSN_LAST){
          // Property sheet notifications require special handling
          // since the concept of ctlId is non-existent. We patch it
          // to the default PageID expected by the ObjectWindows
          // Property Page dispatchers
          //
          notifyInfo.idFrom = PropPageID;
          wParam = PropPageID;
        }
      }
      break;

    default:
      break;
  }
  return TDialog::StdDlgProc(hDlg, msg, wParam, lParam);
}
Esempio n. 2
0
void FileProfClearData ()
{

	register PFP_Handle phThisFile;
	void InitHandle();

    WaitForSingleObject ( hMutex, INFINITE );
    FreeMemoryOfList(phInactive);
    phInactive = (PFP_Handle) NULL;

    phThisFile = phActive;
    while ( phThisFile != (PFP_Handle) NULL )  {
	InitHandle ( phThisFile );
	phThisFile = phThisFile->phNext;
    }
    InitHandle ( phDuplicated );
    ReleaseMutex ( hMutex );

}
     CACObject :: CACObject (CS_Connection *cs_connection )
                     : CSHandle (cs_connection),
ACObject(),
  cdbhandle(NULL),
  topnode_list(new DLL(CNode))
{

  InitHandle();

}
     CACObject :: CACObject ( )
                     : CSHandle (),
ACObject(),
  cdbhandle(NULL),
  topnode_list(NULL)
{

  InitHandle();


}
Esempio n. 5
0
hkvJsonStreamReader::hkvJsonStreamReader(hkvJsonFileHandler* pFileHandler, hkvJsonStreamReadHandler* pReadHandler, int iParserFlags) :
  m_pHandle(NULL),
  m_pMemHandler(NULL),
  m_pFileHandler(pFileHandler),
  m_pReadHandler(pReadHandler)
{
  assert(m_pFileHandler);
  assert(m_pReadHandler);

  InitHandle(NULL);
  InitConfig(iParserFlags);
}
     CACObject :: CACObject (ACObject *obhandle, int32 objid, PIACC accopt, uint16 version_nr )
                     : CSHandle (obhandle->GetClientACObject()->IsValid() ? obhandle->GetClientACObject()->get_csconnection() : NULL),
ACObject(obhandle,objid,accopt,version_nr),
 cdbhandle(obhandle->GetDBHandle()->GetClientDBHandle()),
  topnode_list(new DLL(CNode))
{


#ifndef IF_Class  // client version

  CACObject  *cobhandle = obhandle->GetClientACObject();
  
  if ( !csconnection )                                 
    SDBSET(517)
  else
  {
    InitHandle();
    LockSendParms().Fill((CS_Handle *)cobhandle,objid,(int32)accopt,version_nr);
    
    if ( !CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_CACObject_ci1) )
    {
      if ( !Get_rec_result()[0].GetUChar() )
      {
        SetServerObject(Get_rec_result().GetHandle()->GetServerObject()); 
        CreateContext(); 
      }
    }
    UnlockSendParms();
  }
#else             // server version

  SC_DBObject *sc_dbo;
  CS_Handle   *handle = parms->GetHandle();
  
  sc_dbo = ((SC_DBObject *)(*parms)[0].GetHandle()->GetServerPointer())->ProvideDBObject(
                  handle->GetClientObject(),
                  (*parms)[1].GetLong(connection->get_conversion()),        // objid
                  (PIACC)(*parms)[2].GetLong(connection->get_conversion()), // accopt
                  (*parms)[3].GetUShort(connection->get_conversion()) );    // version_nr
   
  handle->SetServerPointer(sc_dbo);
  *result->GetHandle() = *handle;
  result->Fill((logical)!sc_dbo);

  return(NO);

#endif

}
Esempio n. 7
0
PFP_Handle AddHandle (HFILE hFile, LPTSTR lpwsFileName)
{

	register i;
	register PFP_Handle phNewHandle;
	register HANDLE hToMem;


	
    // Allocate space for new handle. phNewHandle points to this space

#ifdef DBGTRACE
 printf ("Start AddHandle\r\n");
 PrintLists();
 PrintCache();
#endif
    hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_Handle) );
    phNewHandle = (PFP_Handle) GlobalLock ( hToMem );
    hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_FileH) );
    phNewHandle->pfHandleData = (PFP_FileH) GlobalLock ( hToMem );
    hToMem = GlobalAlloc ( MEM_ATTR,
	(DWORD) (sizeof(TCHAR) * (lstrlen (lpwsFileName) + 1 )));
    phNewHandle->lpwsPathName = (LPTSTR) GlobalLock ( hToMem );
    lstrcpy ( phNewHandle->lpwsPathName, lpwsFileName );

    phNewHandle->hHandlef = hFile;

    phNewHandle->phNext = phActive;
    phActive = phNewHandle;
    for ( i = USEDHANDLES; --i > 0; )
	phCache[i] = phCache[i-1];
    *phCache = phNewHandle;

    InitHandle (phNewHandle);
#ifdef DBGTRACE
 PrintLists();
 PrintCache();
 printf("End AddHandle\r\n");
#endif

    return phNewHandle;

}
Esempio n. 8
0
hkvJsonStreamReader::hkvJsonStreamReader(hkvJsonMemoryHandler* pMemHandler, hkvJsonFileHandler* pFileHandler, hkvJsonStreamReadHandler* pReadHandler, int iParserFlags) :
  m_pHandle(NULL),
  m_pMemHandler(pMemHandler),
  m_pFileHandler(pFileHandler),
  m_pReadHandler(pReadHandler)
{
  assert(m_pMemHandler);
  assert(m_pFileHandler);
  assert(m_pReadHandler);

  // Allocate a structure which holds allocation routines
  yajl_alloc_funcs allocFuncs = {
    yajl_Malloc,
    yajl_Realloc,
    yajl_Free,
    m_pMemHandler
  };

  InitHandle(&allocFuncs);
  InitConfig(iParserFlags);
}
Esempio n. 9
0
void InitFileProf (void)
{

	register i;
	register HANDLE hToMem;
	UINT nChars;

    hMutex = CreateMutex ( (LPSECURITY_ATTRIBUTES) NULL, TRUE,
							  (LPTSTR)NAMEOFMUTEX );

    // Allocate space for duplicate handle. phActive points to this space.
    hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_Handle) );
    phDuplicated = (PFP_Handle) GlobalLock ( hToMem );
    hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_FileH) );
    phDuplicated->pfHandleData = (PFP_FileH) GlobalLock ( hToMem );
    hToMem = GlobalAlloc ( MEM_ATTR,
		(DWORD)(nChars = (UINT) (sizeof(TCHAR) * (DUPLICATELEN + 1))) );
    phDuplicated->lpwsPathName = (LPTSTR) GlobalLock ( hToMem );

    lstrcpy (phDuplicated->lpwsPathName, (LPCTSTR)DUPLICATE);

    phDuplicated->hHandlef = (HFILE) NULL;
    phDuplicated->phNext = (PFP_Handle) NULL;
    phActive = (PFP_Handle) NULL;
    InitHandle (phDuplicated);

    // Initialize inactive list
    phInactive = (PFP_Handle) NULL;

    // Initialize cache
    for ( i = 0; i < USEDHANDLES; )
	phCache[i++] = (PFP_Handle) NULL;

    ReleaseMutex (hMutex);

}
Esempio n. 10
0
CChannel::CChannel ( DWORD nId, BOOL bOpenHandlesOnly, DWORD dwBlocks )
{
	ASSERT( sizeof(CHANNEL_MEMORY) < sizeof(PACKET_BLOCK) );
	m_pMemory = NULL;
	if( bOpenHandlesOnly )
		m_dwBlocks = 0;
	else
		m_dwBlocks = dwBlocks;
	m_nId = nId;
	m_bOpenOnly = bOpenHandlesOnly;
	m_strKernelObjectsPrefix.Format( _T("Global\\InterprocessChannel_%s_%d_"),
		_PROGRAM_OBJECTS_UID_, nId );

	m_lReadThreadStarted = 0;
	m_pUserReadFunc = NULL;
	m_pUserReadFuncArg = NULL;

	m_hReaderThread = NULL;

#define InitHandle(x)	x = NULL

	InitHandle( m_hInitializedEvent );
	InitHandle( m_hHasReadersDataMutex );
	InitHandle( m_hHasNoReadersEvent );
	InitHandle( m_hWriteMutex );
	InitHandle( m_hReadMutex );
	InitHandle( m_hStreamStatusMutex );
	InitHandle( m_hStreamNotFullEvent );
	InitHandle( m_hStreamNotEmptyEvent );
	InitHandle( m_hStopReadThreadEvent );
	InitHandle( m_hFileMapping );
	InitHandle( m_hInitializeMutex );
	
	Initialize();
}
Esempio n. 11
0
void FileProfDumpData ( HANDLE hFile )
{

	DWORD cChar, cWChar;
	register PFP_Handle phThisFile;
	HANDLE hToMem;
	void VerboseDumpHandleData(), AccumulateAllHandleData(), InitHandle();
	void FreeMemoryOfHandle();
	PFP_Handle NextHandle();

    if ( (phActive == (PFP_Handle) NULL) && (phInactive == (PFP_Handle) NULL)
		      		      && (! (ValidDataForDuplicatedHandles) ) )
	return;

    // Initialize structure for statistics of all used files
    hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_Handle) );
    phAllFiles = (PFP_Handle) GlobalLock ( hToMem );
    hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_FileH) );
    phAllFiles->pfHandleData = (PFP_FileH) GlobalLock ( hToMem );
    ulNumOfAllCreateOps = ulNumOfAllOpenOps = ulNumOfAllCloseOps = (ULONG) 0;
    ulNumOfFiles = (ULONG) 0;
    InitHandle ( phAllFiles );

    // initialize dummy large integer
    liDummy.LowPart = (ULONG) 0;
    liDummy.HighPart = (LONG) 0;

    // print data table header
    cChar = wsprintf ( OutBuf, L"  \t\t\t FILE I/O PROFILER OUTPUT\r\n\r\n\r\n\0" );
    WriteFileAnsi(hFile, OutBuf, cChar, &cWChar, (LPOVERLAPPED) NULL);

    cChar = wsprintf ( OutBuf,
	    L" \t\t (Note: All times are in microseconds)\r\n\r\n\0");
    WriteFileAnsi(hFile, OutBuf, cChar, &cWChar, (LPOVERLAPPED) NULL);

    if ( phActive == (PFP_Handle) NULL )
	if ( phInactive != (PFP_Handle) NULL )
	    phThisFile = phInactive;
	else
	    phThisFile = (PFP_Handle) NULL;
    else
	phThisFile = phActive;

    // Dump data for normal files
    while ( phThisFile != (PFP_Handle) NULL ) {
	VerboseDumpHandleData ( hFile, phThisFile );
	AccumulateAllHandleData ( phThisFile );
	phThisFile = NextHandle ( phThisFile );
    }

    // Dump data for duplicated handles
    if ( ValidDataForDuplicatedHandles ) {
    	VerboseDumpHandleData ( hFile, phDuplicated );
    	AccumulateAllHandleData ( phDuplicated );
    }

    // Dump accumulated statistics for all files
    VerboseDumpHandleData ( hFile, phAllFiles );
    FreeMemoryOfHandle ( phAllFiles );
    phAllFiles = (PFP_Handle) NULL;

}