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


C++ GetCurrentTask函数代码示例

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


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

示例1: WaitEvent16

/***********************************************************************
 *           WaitEvent  (KERNEL.30)
 */
BOOL16 WINAPI WaitEvent16( HTASK16 hTask )
{
    TDB *pTask;

    if (!hTask) hTask = GetCurrentTask();
    pTask = TASK_GetPtr( hTask );

    if (pTask->flags & TDBF_WIN32)
    {
        FIXME("called for Win32 thread (%04x)!\n", GetCurrentThreadId());
        return TRUE;
    }

    if (pTask->nEvents > 0)
    {
        pTask->nEvents--;
        return FALSE;
    }

    if (pTask->teb == NtCurrentTeb())
    {
        DWORD lockCount;

        NtResetEvent( pTask->hEvent, NULL );
        ReleaseThunkLock( &lockCount );
        SYSLEVEL_CheckNotLevel( 1 );
        WaitForSingleObject( pTask->hEvent, INFINITE );
        RestoreThunkLock( lockCount );
        if (pTask->nEvents > 0) pTask->nEvents--;
    }
    else FIXME("for other task %04x cur=%04x\n",pTask->hSelf,GetCurrentTask());

    return TRUE;
}
开发者ID:Barrell,项目名称:wine,代码行数:37,代码来源:task.c

示例2: GetWindowsDirectoryA

/* get the search path for the current module; helper for OpenFile16 */
static char *get_search_path(void)
{
    UINT len;
    char *ret, *p, module[OFS_MAXPATHNAME];

    module[0] = 0;
    if (GetCurrentTask() && GetModuleFileName16( GetCurrentTask(), module, sizeof(module) ))
    {
        if (!(p = strrchr( module, '\\' ))) p = module;
        *p = 0;
    }

    len = (2 +                                              /* search order: first current dir */
           GetSystemDirectory16( NULL, 0 ) + 1 +            /* then system dir */
           GetWindowsDirectoryA( NULL, 0 ) + 1 +            /* then windows dir */
           strlen( module ) + 1 +                           /* then module path */
           GetEnvironmentVariableA( "PATH", NULL, 0 ) + 1); /* then look in PATH */
    if (!(ret = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL;
    strcpy( ret, ".;" );
    p = ret + 2;
    GetSystemDirectory16( p, ret + len - p );
    p += strlen( p );
    *p++ = ';';
    GetWindowsDirectoryA( p, ret + len - p );
    p += strlen( p );
    *p++ = ';';
    if (module[0])
    {
        strcpy( p, module );
        p += strlen( p );
        *p++ = ';';
    }
    GetEnvironmentVariableA( "PATH", p, ret + len - p );
    return ret;
}
开发者ID:bilboed,项目名称:wine,代码行数:36,代码来源:file.c

示例3: NotifyHandler

/*
 * NotifyHandler - call back routine for notifications
 */
BOOL __export FAR PASCAL NotifyHandler( WORD id, DWORD data )
{
    notify      *ptr;

    if( id == NFY_TASKIN || id == NFY_TASKOUT ) {
        if( GetCurrentTask() == ourTask ) {
            if( id == NFY_TASKIN ) {
                UnPauseSampler();
            } else {
                PauseSampler();
            }
        }
        return( FALSE );
    }
    PauseSampler();

    ptr = getNotifyData( data );

    switch( id ) {
    case NFY_STARTDLL:
        _fmemcpy( &ptr->startdll, (LPVOID) data, sizeof( NFYSTARTDLL ) );
        MyModuleFindHandle( &ptr->me, ptr->startdll.hModule );
        HandleLibLoad( SAMP_CODE_LOAD, ptr->startdll.hModule );
        break;
    case NFY_STARTTASK:
        if( ourTask == NULL ) { // handle spawned tasks
            ourTask = GetCurrentTask();
            MyTaskFindHandle( &ptr->te, ptr->task );
            MyModuleFindHandle( &ptr->me, ptr->te.hModule );
            HandleLibLoad( SAMP_MAIN_LOAD, ptr->te.hModule );
            StartSampler();
        } else {
            MyTaskFindHandle( &ptr->te, ptr->task );
            MyModuleFindHandle( &ptr->me, ptr->te.hModule );
            HandleLibLoad( SAMP_CODE_LOAD, ptr->te.hModule );
        }
        break;
    case NFY_EXITTASK:
        if( GetCurrentTask() == ourTask ) { // handle spawned tasks
            QuitSampler( &TotalTime );
            SharedMemory->TaskEnded = TRUE;
        }
        break;
    }
    UnPauseSampler();
    return( FALSE );

} /* NotifyHandler */
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:51,代码来源:notify.c

示例4: MZ_Launch

static void MZ_Launch( LPCSTR cmdtail, int length )
{
  TDB *pTask = GlobalLock16( GetCurrentTask() );
  BYTE *psp_start = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
  DWORD rv;
  SYSLEVEL *lock;

  MZ_FillPSP(psp_start, cmdtail, length);
  pTask->flags |= TDBF_WINOLDAP;

  /* DTA is set to PSP:0080h when a program is started. */
  pTask->dta = MAKESEGPTR( DOSVM_psp, 0x80 );

  GetpWin16Lock( &lock );
  _LeaveSysLevel( lock );

  ResumeThread(dosvm_thread);
  rv = DOSVM_Loop(dosvm_thread);

  CloseHandle(dosvm_thread);
  dosvm_thread = 0; dosvm_tid = 0;
  CloseHandle(loop_thread);
  loop_thread = 0; loop_tid = 0;

  VGA_Clean();
  ExitProcess(rv);
}
开发者ID:howard5888,项目名称:wineT,代码行数:27,代码来源:module.c

示例5: GetCurrentTask

void TAppDictionary::Add(PTApplication pApplication)
{
    HANDLE hTask = GetCurrentTask();
    TAppDictionaryEntry *pFreeEntry = NULL;  // no free entry yet

    // First see if table already.  If so, replace entry

    for (TAppDictionaryEntry * pEntry = Table; pEntry < &Table[NumEntries];
         pEntry++)
    {
        if (pEntry->hTask == hTask) // already in table?
        {
            pEntry->pApplication = pApplication;
            return;
        }
        else                    // see if entry is free
        {
            if (!pFreeEntry && pEntry->hTask == 0)  // remember this entry
                pFreeEntry = pEntry;
        }
    }

    // Not in table.  See if we encountered a free entry in table.  If
    // so, use it.  Otherwise grow table.

    if ((pEntry = (pFreeEntry ? pFreeEntry : GrowTable())) != 0)
    {
        pEntry->hTask = hTask;
        pEntry->pApplication = pApplication;
        return;
    }
}
开发者ID:nicolaemariuta,项目名称:bachelorHomeworkAndStudy,代码行数:32,代码来源:APPDICT.CPP

示例6: NotifyRegister16

/***********************************************************************
 *		NotifyRegister (TOOLHELP.73)
 */
BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback,
                              WORD wFlags )
{
    int	i;

    FIXME("(%x,%x,%x), semi-stub.\n",
                      htask, (DWORD)lpfnCallback, wFlags );
    if (!htask) htask = GetCurrentTask();
    for (i=0;i<nrofnotifys;i++)
        if (notifys[i].htask==htask)
            break;
    if (i==nrofnotifys) {
        if (notifys==NULL)
            notifys=HeapAlloc( GetProcessHeap(), 0,
                                               sizeof(struct notify) );
        else
            notifys=HeapReAlloc( GetProcessHeap(), 0, notifys,
                                        sizeof(struct notify)*(nrofnotifys+1));
        if (!notifys) return FALSE;
        nrofnotifys++;
    }
    notifys[i].htask=htask;
    notifys[i].lpfnCallback=lpfnCallback;
    notifys[i].wFlags=wFlags;
    return TRUE;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:29,代码来源:toolhelp16.c

示例7: RUASSERT

void CRUTopologicalDGIterator::Next()
{
	RUASSERT(FALSE == allTasksLinkMap_.IsEmpty());

	CRUTask *pTask = GetCurrentTask();
	if (NULL == pTask)
	{
		return; // all the tasks have been already traversed
	}

	// The tasks that need to be traversed after me
	CRUTaskList &refTaskList = 
		(DIRECT == dir_) ? 
			pTask->GetTasksThatDependOnMe() :
			pTask->GetTasksThatIDependOn();

	// For all of these tasks, decrecase the reference count
	// Update the "ready" list, if any of the tasks have become ready.
	UpdateIterator(refTaskList);

	// Select a new current task
	if (TRUE == readyTasksList_.IsEmpty())
	{
		SetCurrentTask(NULL); // The last task has just been traversed
	}
	else
	{
		// Retrieve a new task from the "ready" list
		SetCurrentTask(readyTasksList_.RemoveHead());
	}
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:31,代码来源:RuDgIterator.cpp

示例8: TerminateApp16

/***********************************************************************
 *           TerminateApp   (TOOLHELP.77)
 *
 * See "Undocumented Windows".
 */
void WINAPI TerminateApp16(HTASK16 hTask, WORD wFlags)
{
    if (hTask && hTask != GetCurrentTask())
    {
        FIXME("cannot terminate task %x\n", hTask);
        return;
    }

    if (wFlags & NO_UAE_BOX)
    {
        UINT16 old_mode;
        old_mode = SetErrorMode16(0);
        SetErrorMode16(old_mode|SEM_NOGPFAULTERRORBOX);
    }
    FatalAppExit16( 0, NULL );

    /* hmm, we're still alive ?? */

    /* check undocumented flag */
    if (!(wFlags & 0x8000))
        TASK_CallTaskSignalProc( USIG16_TERMINATION, hTask );

    /* UndocWin says to call int 0x21/0x4c exit=0xff here,
       but let's just call ExitThread */
    ExitThread(0xff);
}
开发者ID:howard5888,项目名称:wineT,代码行数:31,代码来源:task.c

示例9: TRSCOPE

void qPBReaderPlatform::ReaderApplicationStarted(const QString & isBookFile)
{
   TRSCOPE(pb, "qPBReaderPlatform::ReaderApplicationStarted");
#ifdef Q_OS_POCKETBOOK

   TRACE << "Declaring " << ENC(isBookFile) << endl;

   // set application icon
   // taskmgr looks for app_%s_icon.bmp file in theme, %s being the
   // task name. Since I have not found another way to provide an icon at
   // runtime, setting task name to "reader" does the job.

   int task = ::GetCurrentTask();
   taskinfo * pTask = ::GetTaskInfo(GetCurrentTask());

   if (pTask)
   {
      int rc = ::SetTaskParameters(task, "reader", 0, 0, pTask->flags);
      TRACE << "SetTaskParameters " << VAR(rc) << endl;
   }

   // switch to reading mode, seems to change panel appearance

   SetReadingMode(true);

   // and register book as read by this program

   ::BookReady(isBookFile.toUtf8().data());
#else

   Q_UNUSED(isBookFile);
#endif
}
开发者ID:m4mmon,项目名称:qPBReader,代码行数:33,代码来源:qPBReaderPlatform.cpp

示例10: PostQuitMessage

void WINAPI
PostQuitMessage(int nExitCode)
{
    APISTR((LF_APICALL,"PostQuitMessage(int %x)\n", nExitCode));
    (void) AddAppMsgQueue(GetCurrentTask(),0,0,WM_QUIT,nExitCode,0);
    APISTR((LF_APIRET,"PostQuitMessage: returns void\n"));
}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:7,代码来源:Messages.c

示例11: IT_GLOBALALLOC

void
IT_GLOBALALLOC (ENV *envp,LONGPROC f)	/* GlobalAlloc */
{
	UINT uSel,flags;
	DWORD dwSize;
	DWORD dwMemSize;
	HGLOBAL hGlobal;

	dwSize = GETDWORD(SP+4);
	flags = GETWORD(SP+8);
	dwMemSize=dwSize;
	dwSize = max(32,(dwSize + 31) & 0xffffffe0);

	uSel = TWIN_AllocSelector(dwSize,flags);

	if (uSel) {
	    hGlobal = GetSelectorHandle(uSel);
	    CreateDataInstance((HINSTANCE)hGlobal,(HMODULE)0,
			GetCurrentTask());

	    if (flags & GMEM_MOVEABLE) {
		GlobalUnlock(hGlobal);
		uSel &= 0xfffe;
	    }
	}
	envp->reg.sp += UINT_86 + DWORD_86 + RET_86;
	envp->reg.ax = LOWORD(uSel);
	envp->reg.dx = 0;
}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:29,代码来源:MemoryIF.c

示例12: GUIHookF1

void GUIHookF1( void )
{
    if( F1Hooked == 0 ) {
        F1ProcInst = _wpi_makeprocinstance( (WPI_PROC)F1Proc, GUIMainHInst );
#ifndef __OS2_PM__
        // we use a hook to trap F1 in dialogs that were not
        // created using this instance yet on our behalf. IE COMMDLG stuff

        // we cant use a system wide hook because they only can be
        // used in DLL's
        #if defined(__NT__)
            F1HookHandle = SetWindowsHookEx( WH_MSGFILTER,
                                             (HOOKPROC)F1ProcInst,
                                             GUIMainHInst,
                                             (DWORD)GetCurrentThreadId() );
        #else
            F1HookHandle = SetWindowsHookEx( WH_MSGFILTER, 
                                             (HOOKPROC)F1ProcInst,
                                             GUIMainHInst,
                                             GetCurrentTask() );
        #endif
#else
        // in OS/2, it has to be an app. specific input filter (OS/2 has
        // bad problems, occassionally, with system input hooks)
        WinSetHook( GUIMainHInst.hab, HMQ_CURRENT, HK_INPUT, (PFN) F1ProcInst,
                    GUIMainHInst.mod_handle );
#endif
    }
    F1Hooked++;
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:30,代码来源:guif1hk.c

示例13: SetCurrentDirectory16

/***********************************************************************
 *           SetCurrentDirectory   (KERNEL.412)
 */
BOOL16 WINAPI SetCurrentDirectory16( LPCSTR dir )
{
    char fulldir[MAX_PATH];

    if (!GetFullPathNameA( dir, MAX_PATH, fulldir, NULL )) return FALSE;

    if (!SetCurrentDirectoryA( dir )) return FALSE;

    if (fulldir[0] && fulldir[1] == ':')
    {
        TDB *pTask = GlobalLock16( GetCurrentTask() );
        char env_var[4] = "=A:";

        env_var[1] = fulldir[0];
        SetEnvironmentVariableA( env_var, fulldir );

        /* update the directory in the TDB */
        if (pTask)
        {
            pTask->curdrive = 0x80 | (fulldir[0] - 'A');
            GetShortPathNameA( fulldir + 2, pTask->curdir, sizeof(pTask->curdir) );
        }
    }
    return TRUE;
}
开发者ID:bilboed,项目名称:wine,代码行数:28,代码来源:file.c

示例14: MZ_Launch

static DWORD MZ_Launch( LPCSTR cmdtail, int length )
{
  TDB *pTask = GlobalLock16( GetCurrentTask() );
  BYTE *psp_start = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
  DWORD rv;
  SYSLEVEL *lock;
  MSG msg;

  MZ_FillPSP(psp_start, cmdtail, length);
  pTask->flags |= TDBF_WINOLDAP;

  /* DTA is set to PSP:0080h when a program is started. */
  pTask->dta = MAKESEGPTR( DOSVM_psp, 0x80 );

  GetpWin16Lock( &lock );
  _LeaveSysLevel( lock );

  /* force the message queue to be created */
  PeekMessageW(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);

  ResumeThread(dosvm_thread);
  rv = DOSVM_Loop(dosvm_thread);

  CloseHandle(dosvm_thread);
  dosvm_thread = 0; dosvm_tid = 0;
  CloseHandle(loop_thread);
  loop_thread = 0; loop_tid = 0;
  if (rv) return rv;

  VGA_Clean();
  ExitProcess(0);
}
开发者ID:bpowers,项目名称:wine,代码行数:32,代码来源:dosexe.c

示例15: LookupETask16

/***********************************************************************
 *           LookupETask (COMPOBJ.94)
 */
HRESULT WINAPI LookupETask16(HTASK16 *hTask,LPVOID p) {
	FIXME("(%p,%p),stub!\n",hTask,p);
	if ((*hTask = GetCurrentTask()) == hETask) {
		memcpy(p, Table_ETask, sizeof(Table_ETask));
	}
	return 0;
}
开发者ID:Jactry,项目名称:wine,代码行数:10,代码来源:compobj.c


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