当前位置: 首页>>代码示例>>C++>>正文


C++ ErrorHandler函数代码示例

本文整理汇总了C++中ErrorHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ ErrorHandler函数的具体用法?C++ ErrorHandler怎么用?C++ ErrorHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ErrorHandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ServiceControl

BOOL ServiceControl(int ctrl)
{
    SC_HANDLE service;
    SC_HANDLE scm;
    BOOL res;
    SERVICE_STATUS status;

    scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
    if (!scm) {
        ErrorHandler("OpenSCManager", GetLastError());
    }

    service = OpenService(scm, ServiceName, SERVICE_ALL_ACCESS);
    if (!service) {
        ErrorHandler("OpenService", GetLastError());
    }

    if (ctrl == SERVICE_CONTROL_STOP) {
        printf("Service is stopping...\n");
        res = ControlService(service, SERVICE_CONTROL_STOP, &status);
    } else if (ctrl == SERVICE_CONTROL_PAUSE) {
        printf("Service is pausing...\n");
        res = ControlService(service, SERVICE_CONTROL_PAUSE, &status);
    } else if (ctrl == SERVICE_CONTROL_CONTINUE) {
        printf("Service is resuming...\n");
        res = ControlService(service, SERVICE_CONTROL_CONTINUE, &status);
    }

    if (!res) {
        ErrorHandler("ControlService", GetLastError());
    } else {
        srvc.GetStatus(service);
    }

    CloseServiceHandle(service);
    CloseServiceHandle(scm);

    return TRUE;
}
开发者ID:asadpanda,项目名称:kvm-guest-drivers-windows,代码行数:39,代码来源:utils.cpp

示例2: CreateEvent

void CService::PreInit()
{
    // set up the system context
    

   // Initialize Events
   for(int i = 0 ; i < NUMEVENTS ; i++)
   {
      m_hEvents[i] = CreateEvent(NULL, FALSE, FALSE, NULL);
      if(!m_hEvents[i])
         ErrorHandler(NTEXT("CreateEvent"));
   }
}
开发者ID:CSanchezAustin,项目名称:cslib,代码行数:13,代码来源:CService.cpp

示例3: CreateBootSector

void CFat32FileSystem::Execute(Long64 aPartitionSize,EntryList aNodeList,
							   ofstream& aOutPutStream,ConfigurableFatAttributes* aConfigurableFatAttributes)
{
	CDirRegion* dirRegionPtr = NULL;
	try
	{
		CreateBootSector(aPartitionSize,aConfigurableFatAttributes);
		ComputeTotalClusters(aPartitionSize);
		WriteBootSector(aOutPutStream);
		dirRegionPtr = new CDirRegion(aNodeList,this);
		dirRegionPtr->Execute();
		iClustersPerEntry = dirRegionPtr->GetClustersPerEntryMap();
		CreateFSinfoSector(aOutPutStream);
		RestReservedSectors(aOutPutStream);
		CreateFatTable(aOutPutStream);
		dirRegionPtr->WriteClustersIntoFile(aOutPutStream);
		delete dirRegionPtr;
		dirRegionPtr = NULL;
	}
	catch(ErrorHandler &aError)
	{
		delete dirRegionPtr;
		dirRegionPtr = NULL;
		throw ErrorHandler(aError.iMessageIndex,(char*)aError.iSubMessage.c_str(),(char*)aError.iFileName.c_str(),aError.iLineNumber);
	}
	/**
	Irrespective of successful or unsuccessful data drive image generation ROFSBUILD
	may try to generate images for successive ".oby" file input.
	During this course unhandled exceptions may cause leaving some memory on heap 
	unused. so the unhandled exceptions handling is used to free the memory allocated 
	on heap. 
	*/
	catch(...)
	{
		delete dirRegionPtr;
		dirRegionPtr = NULL;
		throw ErrorHandler(UNKNOWNERROR,__FILE__,__LINE__);
	}
}
开发者ID:fedor4ever,项目名称:linux_build,代码行数:39,代码来源:fat32filesystem.cpp

示例4: SystemClock_Config

/**
  * @brief  System Clock Configuration
  *         The system Clock is configured as follow : 
  *            System Clock source            = MSI
  *            SYSCLK(Hz)                     = 2000000
  *            HCLK(Hz)                       = 2000000
  *            AHB Prescaler                  = 1
  *            APB1 Prescaler                 = 1
  *            APB2 Prescaler                 = 1
  *            Flash Latency(WS)              = 0
  *            Main regulator output voltage  = Scale3 mode
  * @param  None
  * @retval None
  */
static void SystemClock_Config(void)
{
  RCC_ClkInitTypeDef RCC_ClkInitStruct;
  RCC_OscInitTypeDef RCC_OscInitStruct;
  
  /* Enable Power Control clock */
  __PWR_CLK_ENABLE();
  
  /* The voltage scaling allows optimizing the power consumption when the device is 
     clocked below the maximum system frequency, to update the voltage scaling value 
     regarding system frequency refer to product datasheet.  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
  
  /* Enable MSI Oscillator */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
  RCC_OscInitStruct.MSIState = RCC_MSI_ON;
  RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
  RCC_OscInitStruct.MSICalibrationValue = 0x00;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    /* Error */
    ErrorHandler();
  }
  
  /* Select MSI as system clock source and configure the HCLK, PCLK1 and PCLK2 
     clocks dividers */
  RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;  
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;  
  if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
  {
    /* Error */
    ErrorHandler();
  }
}
开发者ID:shjere,项目名称:common,代码行数:52,代码来源:main.c

示例5: criarThread

Calculadora criarThread(Calculadora calc, int opt, int integer)
{
    PMYDATA pDataArray[MAX_THREADS];
    DWORD   dwThreadIdArray[MAX_THREADS];
    HANDLE  hThreadArray[MAX_THREADS]; 

	for( int i=0; i<MAX_THREADS; i++ )
	{
        pDataArray[i] = (PMYDATA) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                sizeof(MYDATA));

        if( pDataArray[i] == NULL )
        {
            ExitProcess(2);
        }

		pDataArray[i]->opt = opt;
		pDataArray[i]->n = i;
		pDataArray[i]->c1 = &calc;
		pDataArray[i]->val = integer;


        hThreadArray[i] = CreateThread( 
            NULL,                   // default security attributes
            0,                      // use default stack size  
            conversaoThread,       // thread function name
            pDataArray[i],          // argument to thread function 
            0,                      // use default creation flags 
            &dwThreadIdArray[i]);   // returns the thread identifier 

        if (hThreadArray[i] == NULL) 
        {
           ErrorHandler(TEXT("CreateThread"));
           ExitProcess(3);
        }
    }

    WaitForMultipleObjects(MAX_THREADS, hThreadArray, TRUE, INFINITE);

    for(int i=0; i<MAX_THREADS; i++)
    {
        CloseHandle(hThreadArray[i]);
        if(pDataArray[i] != NULL)
        {
            HeapFree(GetProcessHeap(), 0, pDataArray[i]);
            pDataArray[i] = NULL;    // Ensure address is not reused.
        }
    }
	return calc;
}
开发者ID:cassianogf,项目名称:research-center,代码行数:50,代码来源:conversor.cpp

示例6: sprintf

/******************************************************************************

MODULE:  GetSpectralSubset

PURPOSE:  read a list of spectral subset values and store them for actual
    use in the read parameter file routine

RETURN VALUE:
Type = int
Value           Description
-----           -----------
n               number of things found
	
HISTORY:
Version  Date   Programmer       Code  Reason
-------  -----  ---------------  ----  -------------------------------------
         05/00  John Weiss             Original Development
         01/01  John Rishea            Standardized formatting

NOTES:

******************************************************************************/
int GetSpectralSubset
(
    ModisDescriptor *P,		/* O:  session info */
    char *str			/* I:  string to be parsed */
)

{
    int i, count = 0;
    char errmsg[SMALL_STRING];

    /* check for valid values */
    for ( i = 0; i < (int) strlen( str ); i++ )
    {
        if ( str[i] != '0' && str[i] != '1' && str[i] != ' ' )
        {
            sprintf( errmsg, "Error processing spectral subset (%s) for "
                "resampler. Only '0's and '1's are allowed.", optarg );
            ErrorHandler( FALSE, "GetSpectralSubset", ERROR_GENERAL,
                errmsg );
            return 0;
        }
        else if ( str[i] == '0' || str[i] == '1' )
            count++;
    }

    /* Copy the spectral subset string to the tmpspectralsubset string in
       the ModisDescriptor */
    P->tmpspectralsubset = strdup (str);
    if (P->tmpspectralsubset == NULL)
    {
        ErrorHandler( FALSE, "GetSpectralSubset", ERROR_GENERAL,
           "Error copying the spectral subset string to the MODIS descriptor");
        return 0;
    }

    return count;
}
开发者ID:Kylia669,项目名称:DiplomWork,代码行数:59,代码来源:proc_arg.c

示例7: scanf_m

errno_t
scanf_m(const string_m format, int *count, ...){
  va_list ap;
  errno_t rv;

  if(!format){
    ErrorHandler("scanf_m: 1st Argument NULL Pointer", format, EINVAL);
    ERROR(EINVAL);
  }

  va_start(ap, count);
  rv = vfscanf_m(stdin, format, count, ap);
  va_end(ap);
  return rv;
}
开发者ID:hpc,项目名称:give,代码行数:15,代码来源:fscanf_m.c

示例8: printf_m

errno_t
printf_m(const string_m fmt, int *count, ...){
  errno_t rv;

  if (!fmt){
    ErrorHandler("printf_m: 1st Argument NULL pointer", fmt, EINVAL);
    ERROR(EINVAL);
  }
  VA_OPEN(ap, count);
  VA_FIXEDARG(ap, const string_m, fmt);
  VA_FIXEDARG(ap, int *, count);
  rv = vprintf_m(fmt, count, ap);
  VA_CLOSE(ap);
  return rv;
}
开发者ID:hpc,项目名称:give,代码行数:15,代码来源:printf_m.c

示例9: GetConfiguration

BOOL GetConfiguration()
{
    SC_HANDLE service;
    SC_HANDLE scm;
    BOOL res;
    LPQUERY_SERVICE_CONFIG buffer;
    DWORD sizeNeeded;

    scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
    if (!scm) {
        ErrorHandler("OpenSCManager", GetLastError());
    }

    service = OpenService(scm, ServiceName, SERVICE_QUERY_CONFIG);
    if (!service) {
        ErrorHandler("OpenService", GetLastError());
    }

    buffer = (LPQUERY_SERVICE_CONFIG)LocalAlloc(LPTR, 4096);
    res = QueryServiceConfig(service, buffer, 4096, &sizeNeeded);
    if (!res) {
        ErrorHandler("QueryServiceConfig", GetLastError());
    }

    printf("Service name:\t%s\n", buffer->lpDisplayName);
    printf("Service type:\t%d\n", buffer->dwServiceType);
    printf("Start type:\t%d\n",buffer->dwStartType);
    printf("Start name:\t%s\n",buffer->lpServiceStartName);
    printf("Path:\t\t%s\n",buffer->lpBinaryPathName);

    LocalFree(buffer);

    CloseServiceHandle(service);
    CloseServiceHandle(scm);
    return TRUE;
}
开发者ID:HitMann1,项目名称:kvm-guest-drivers-windows,代码行数:36,代码来源:utils.cpp

示例10: fscanf_m

errno_t
fscanf_m(FILE *file, const string_m format, int *count, ...){
  va_list ap;
  errno_t rv;

  if(!format){
    ErrorHandler("fscanf_m: 2nd Argument NULL Pointer", format, EINVAL);
    ERROR(EINVAL);
  }

  va_start(ap, count);
  rv = vfscanf_m(file, format, count, ap);
  va_end(ap);
  return rv;
}
开发者ID:hpc,项目名称:give,代码行数:15,代码来源:fscanf_m.c

示例11: DoRegisterDeviceInterfaceToHwnd

//
// DoRegisterDeviceInterfaceToHwnd
//
BOOL DoRegisterDeviceInterfaceToHwnd(
	IN GUID InterfaceClassGuid,
	IN HWND hWnd,
	OUT HDEVNOTIFY *hDeviceNotify
	)
	// Routine Description:
	//     Registers an HWND for notification of changes in the device interfaces
	//     for the specified interface class GUID. 

	// Parameters:
	//     InterfaceClassGuid - The interface class GUID for the device 
	//         interfaces. 

	//     hWnd - Window handle to receive notifications.

	//     hDeviceNotify - Receives the device notification handle. On failure, 
	//         this value is NULL.

	// Return Value:
	//     If the function succeeds, the return value is TRUE.
	//     If the function fails, the return value is FALSE.

	// Note:
	//     RegisterDeviceNotification also allows a service handle be used,
	//     so a similar wrapper function to this one supporting that scenario
	//     could be made from this template.
{
	DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;

	ZeroMemory(&NotificationFilter, sizeof(NotificationFilter));
	NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
	NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
	NotificationFilter.dbcc_classguid = InterfaceClassGuid;

	*hDeviceNotify = RegisterDeviceNotification(
		hWnd,                       // events recipient
		&NotificationFilter,        // type of device
		DEVICE_NOTIFY_WINDOW_HANDLE // type of recipient handle
		);

	if (NULL == *hDeviceNotify)
	{
		ErrorHandler(TEXT("RegisterDeviceNotification"));
		return FALSE;
	}

	return TRUE;
}
开发者ID:tqtam,项目名称:LUANVAN,代码行数:51,代码来源:USBDetect.cpp

示例12: SUMeshHelperCreate

int SkpModel::LoadVertices(){
	SUResult res;
	int out = 0;

	for (int f=0; f<faces_.size(); f++){
		//Form the mesh
		SUMeshHelperRef mesh = SU_INVALID;
		res = SUMeshHelperCreate(&mesh, faces_[f]);
		ErrorHandler(res);
		
		// Get number of vertices. 
		size_t num_vertices;
		res = SUMeshHelperGetNumVertices(mesh, &num_vertices);
		ErrorHandler(res);

		//Get vertices.
		std::vector<SUPoint3D>   vertices(num_vertices);
		res = SUMeshHelperGetVertices(mesh, num_vertices, &vertices[0], &num_vertices);
		ErrorHandler(res);
		vertices_.add(vertices);
		
		//Get Normals
		std::vector<SUVector3D>  normals(num_vertices);
		res = SUMeshHelperGetNormals (mesh, num_vertices, &normals[0], &num_vertices);
		ErrorHandler(res);
		normals_.add(normals);

		//Front Texture Coordinates
		std::vector<SUPoint3D> texture_coords(num_vertices);
		size_t num_coords;
		res = SUMeshHelperGetFrontSTQCoords(mesh, num_vertices, &texture_coords[0], &num_coords);
		ErrorHandler(res);
		assert(num_coords == num_vertices);
		stqcoords_front_.add(texture_coords);

		//Back Texture Coordinates
		std::vector<SUPoint3D> texture_coords_back(num_vertices);
		res = SUMeshHelperGetFrontSTQCoords(mesh, num_vertices, &texture_coords_back[0], &num_coords);
		ErrorHandler(res);
		assert(num_coords == num_vertices);
		stqcoords_back_.add(texture_coords_back);

		SUMeshHelperRelease(&mesh);
		//*/
		/*
		size_t num_vertices;
		SUFaceGetNumVertices(faces_[f], &num_vertices);
		std::vector<SUVertexRef> vertices(num_vertices);
		SUFaceGetVertices(faces_[f], num_vertices, &vertices[0], &num_vertices);
		vertices_.add(vertices);
		*/

	}
	return out;
}
开发者ID:pulkitag,项目名称:skp2obj,代码行数:55,代码来源:skpmodel.cpp

示例13: Senddde

void Senddde(char* tempstr)
{
  try
  {
    //Connect to the service and request the topic
    if ((hcnv = DdeConnect(idInst, hszService, hszTopic, NULL)) == 0)
    {
      ColorStop();
      return;
    }

    //Start a DDE transaction
    if (DdeClientTransaction((LPBYTE)tempstr, strlen(tempstr)+1,
          hcnv, hszItem, CF_TEXT, XTYP_POKE, 5000, &dwResult) == 0)
    {
      UINT result = DdeGetLastError(idInst);
      switch (result)
      {
        case DMLERR_ADVACKTIMEOUT:
        case DMLERR_BUSY:
        case DMLERR_DATAACKTIMEOUT:
        case DMLERR_DLL_NOT_INITIALIZED:
        case DMLERR_EXECACKTIMEOUT:
        case DMLERR_INVALIDPARAMETER:
        case DMLERR_MEMORY_ERROR:
        case DMLERR_NO_CONV_ESTABLISHED:
        case DMLERR_NO_ERROR:
        case DMLERR_NOTPROCESSED:
        case DMLERR_POKEACKTIMEOUT:
        case DMLERR_POSTMSG_FAILED:
        case DMLERR_REENTRANCY:
        case DMLERR_SERVER_DIED:
        case DMLERR_UNADVACKTIMEOUT:
        default:
          ColorStop();
      }
    }

    //Free DDE
    DdeDisconnect(hcnv);
  }
  catch(...)
  {
    ErrorHandler("Exception thrown in Senddde()!");
  }
}
开发者ID:dxzl,项目名称:xircon-yahcolorize-dll,代码行数:46,代码来源:Colorize.cpp

示例14: SaveLaunch

void ButtonLaunch::Launch()
{
    // If Description mode is on, Save the application launch, launch a description if one is 
    // available, otherwise run the application as normal
    if(m_pMControl->getDescMode() == "On" && m_pAppDescription != "" && m_showTestMenu )
    {
        SaveLaunch();
        MenuPage * pMenuPage = new MenuPage(m_pMdiArea, m_pAppDescription, false , m_pParentWindow, m_pMControl);
        pMenuPage->Launch();
    }
    else
    {
        m_showTestMenu = true;

       // Create a process to run the app.
       m_pProcess = new QProcess(this);
       m_pProcess->setProcessChannelMode(QProcess::MergedChannels);
       // Disable parent menu while this process is running to prevent false button triggering.
       m_pParentWindow->Disable();

       connect(m_pProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(ErrorHandler()));
       if (m_appTextFlag)
       {
           // Hook signals for apps that generate stdout text.
           connect(m_pProcess, SIGNAL(readyRead()), this, SLOT(TextOutput()));
       }
       else    // For apps that do not need a window to display stdout text.
       {
           connect(m_pProcess, SIGNAL(finished(int, QProcess::ExitStatus)), m_pParentWindow, SLOT(Enable()));
       }
       // Launch the app by its stored name.
       QStringList appParameters;
       appParameters << m_appParameter;

       if (!m_terminateMatrix) {
           m_pProcess->start(m_appName, appParameters, QIODevice::ReadOnly | 
               QIODevice::Text);
       }
       else {
           // If we need to terminate the matrix we must start the application as 
           // a detached process.
           m_pProcess->startDetached(m_appName, appParameters);
       } 
    }
    //qDebug() << "Launched App: " << m_appName << " " << m_appParameter;
}
开发者ID:black1tulip,项目名称:DVSDK,代码行数:46,代码来源:buttonlaunch.cpp

示例15: mail

Mailbox::Mailbox(char* name, unsigned numSubjects):
	mail()
{
	// Copy args
	strcpy(sName, name);
	iSubjects = numSubjects;
	
	// Copy the rest of the args derived from the mailbox name
	strcpy(sSetting, name);
	strcat(sSetting, "server");
	if(GetRCString(sSetting, sServer, NULL, MAX_LINE_LENGTH))
	{
		strcpy(sSetting, name);
		strcat(sSetting, "type");
		GetRCString(sSetting, sType, "pop3", MAX_LINE_LENGTH);
		strcpy(sSetting, name);
		strcat(sSetting, "user");
		GetRCString(sSetting, sUser, "anonymous", MAX_LINE_LENGTH);
		strcpy(sSetting, name);
		strcat(sSetting, "port");
		if (!strcmp("imap", sType)) GetRCString(sSetting, sPort, "143", MAX_LINE_LENGTH);
		else GetRCString(sSetting, sPort, "110", MAX_LINE_LENGTH);
		strcpy(sSetting, name);
		strcat(sSetting, "password");
		GetRCString(sSetting, sPass, "", MAX_LINE_LENGTH);
		strcpy(sSetting, name);
		strcat(sSetting, "folder");
		GetRCString(sSetting, sFolder, "inbox", MAX_LINE_LENGTH);

		// If no password was found in config, get it from database/dialog
		if (!(*sPass)) GetPass();

		// Set evars
		strcpy(sEvar, "AcidMail");
		strcat(sEvar, name);
		LSSetVariable(sEvar, "0");
		strcpy(sErrorVar, sEvar);
		strcat(sErrorVar, "Error");
		LSSetVariable(sErrorVar, "none");		
	}
	else
	{
		ErrorHandler(Error(false, LOG_ERROR, "No host found in config files", NULL));
		mail.bError = true;		
	}
}
开发者ID:Acidfire,项目名称:AcidMail,代码行数:46,代码来源:mailbox.cpp


注:本文中的ErrorHandler函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。