Example #1
0
void configDialog::init()
{
    std::vector<RtAudio::Api> apis;
    try
    {
        RtAudio::getCompiledApi(apis);
    }
    catch(const RtAudioError &e)
    {
        e.printMessage();
        return;
    }

    for (std::vector<RtAudio::Api>::iterator it=apis.begin(); it!=apis.end(); ++it)
    {
        ApiBox->addItem(getApiName(*it), QVariant::fromValue(*it));
    }

    fillSoundcardBox();
}
Example #2
0
AudioOutput::AudioOutput()
{
    try
    {
        if (getNumberOfDevices())
        {
            id_ = audio_.getDefaultOutputDevice();
            
            open(id_);
        }
        
        api_ = audio_.getCurrentApi();
    }
    
    catch(RtAudioError& error)
    {
        error.printMessage();
    }
    
    apiName_ = getApiName(api_);
}
Example #3
0
int _tmain(int argc, _TCHAR* argv[])
{
	BOOL bMode = SetKMode(TRUE);
    DWORD dwPerm = SetProcPermissions(0xFFFFFFFF);

	CINFO **SystemAPISets= (CINFO **)KData.aInfo[KINX_APISETS];
	for(int i=0; i<NUM_SYSTEM_SETS; i++)
	{
		DEBUGMSG(1, (L"SystemAPISets[%d]:\n",i));
		DEBUGMSG(1, (L"API set: %s\n", getApiName(i)));
		if(SystemAPISets[i]==0)
		{
			DEBUGMSG(1, (L"  NULL\n"));
			continue;
		}
		DEBUGMSG(1, (L"  acName:      %S\n",SystemAPISets[i]->acName));	//use %S (capital S) as acName is char*
		DEBUGMSG(1, (L"  cMethods:    %d\n",SystemAPISets[i]->cMethods));
		DEBUGMSG(1, (L"  handle type: %i\n",SystemAPISets[i]->type));
		DEBUGMSG(1, (L"  disp type:   %s\n",getDispType(SystemAPISets[i]->disp)));
		
		DEBUGMSG(1, (L"\n"));
	}

	DWORD Tmp= (FIRST_METHOD-FAULT_ADDR)/APICALL_SCALE;  
	DWORD ApiSet=(Tmp>>HANDLE_SHIFT)&HANDLE_MASK;
    DWORD Method=Tmp&METHOD_MASK;

	// validate
	if(ApiSet>NUM_SYSTEM_SETS)
	{
		DEBUGMSG(1, (L"Invalid ApiSet\n"));
		return 0;
	}
	if(SystemAPISets[ApiSet]==0)
	{
		DEBUGMSG(1, (L"Invalid ApiSet\n"));
		return 0;
	}
	if(SystemAPISets[ApiSet]->cMethods<=Method)
	{
		DEBUGMSG(1, (L"Invalid method number\n"));
		return 0;
	}

	// I support only filesystem and similar hooks that are processed inside filesys.exe
	if(SystemAPISets[ApiSet]->pServer==0)
	{
		DEBUGMSG(1, (L"Calls with pServer==0 are not supported\n"));
		return 0;
	}

	// get server process and inject DLL there
	HANDLE Proc=SystemAPISets[ApiSet]->pServer->hProc;

	void *Ptr=MapPtrToProcess(L"TestApiSetHookDll.dll",GetCurrentProcess());
    CALLBACKINFO ci;
	ci.hProc=Proc;
	void *t=GetProcAddress(GetModuleHandle(L"coredll.dll"),L"LoadLibraryW");
	ci.pfn=(FARPROC)MapPtrToProcess(t,Proc);
	ci.pvArg0=Ptr;
	PerformCallBack4(&ci);
	Sleep(1000);	// allow PerformCallBack4 to finish before exit. Better enum loaded DLLs or use events

	// bug in VS2005b1 causes DllMain not to be called in DLLs
	HMODULE Hm=LoadLibrary(L"TestApiSetHookDll.dll");
	void *Fn=GetProcAddress(Hm,L"PerformHook");
	if(Hm==0 || Fn==0)
	{
		DEBUGMSG(1, (L"Unable to load library\n"));
		return 0;
	}
	ci.hProc=Proc;
	ci.pfn=(FARPROC)MapPtrToProcess(Fn,Proc);
	ci.pvArg0=Proc;			// pass the hooked process ID as parameter to be sure that we are called from the context of hooked process
	PerformCallBack4(&ci);	// so we call function ourselves, fortunately DLLs are loaded at the same address in all processes
	Sleep(3000);	

	DEBUGMSG(1, (L"exit\n"));
	MessageBox(GetForegroundWindow(),L"CreateFileW hooked!",L"Done",0);
	FreeLibrary(Hm);
	return 0;
}