本文整理汇总了C++中GetCurrentTask函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentTask函数的具体用法?C++ GetCurrentTask怎么用?C++ GetCurrentTask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCurrentTask函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CRYPTO_THREADID_current
void CRYPTO_THREADID_current(CRYPTO_THREADID *id)
{
if (threadid_callback)
{
threadid_callback(id);
return;
}
#ifndef OPENSSL_NO_DEPRECATED
/* If the deprecated callback was set, fall back to that */
if (id_callback)
{
CRYPTO_THREADID_set_numeric(id, id_callback());
return;
}
#endif
/* Else pick a backup */
#ifdef OPENSSL_SYS_WIN16
CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentTask());
#elif defined(OPENSSL_SYS_WIN32)
CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId());
#elif defined(OPENSSL_SYS_BEOS)
CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
#else
/* For everything else, default to using the address of 'errno' */
CRYPTO_THREADID_set_pointer(id, (void*)&errno);
#endif
}
开发者ID:Wampamba-Nooh,项目名称:MicroFrameworkSDK-Mono,代码行数:27,代码来源:cryptlib.cpp
示例17: slowPoll
void slowPoll( void )
{
RANDOM_STATE randomState;
BYTE buffer[ RANDOM_BUFSIZE ];
MODULEENTRY moduleEntry;
GLOBALENTRY globalEntry;
TASKENTRY taskEntry;
int count;
initRandomData( randomState, buffer, RANDOM_BUFSIZE );
/* Walk the global heap getting information on each entry in it. This
retrieves the objects linear address, size, handle, lock count, owner,
object type, and segment type */
count = 0;
globalEntry.dwSize = sizeof( GLOBALENTRY );
if( GlobalFirst( &globalEntry, GLOBAL_ALL ) )
do
{
addRandomData( randomState, &globalEntry, sizeof( GLOBALENTRY ) );
count++;
}
while( count < 70 && GlobalNext( &globalEntry, GLOBAL_ALL ) );
/* Walk the module list getting information on each entry in it. This
retrieves the module name, handle, reference count, executable path,
and next module */
count = 0;
moduleEntry.dwSize = sizeof( MODULEENTRY );
if( ModuleFirst( &moduleEntry ) )
do
{
addRandomData( randomState, &moduleEntry, sizeof( MODULEENTRY ) );
count++;
}
while( count < 20 && ModuleNext( &moduleEntry ) );
/* Walk the task list getting information on each entry in it. This
retrieves the task handle, parent task handle, instance handle, stack
segment and offset, stack size, number of pending events, task queue,
and the name of module executing the task. We also call TaskGetCSIP()
for the code segment and offset of each task if it's safe to do so
(note that this call can cause odd things to happen in debuggers and
runtime code checkers because of the way TaskGetCSIP() is implemented) */
count = 0;
taskEntry.dwSize = sizeof( TASKENTRY );
if( TaskFirst( &taskEntry ) )
do
{
addRandomData( randomState, &taskEntry, sizeof( TASKENTRY ) );
if( taskEntry.hTask != GetCurrentTask() )
addRandomValue( randomState,
TaskGetCSIP( taskEntry.hTask ) );
count++;
}
while( count < 100 && TaskNext( &taskEntry ) );
/* Flush any remaining data through */
endRandomData( randomState, 100 );
}
开发者ID:VlaBst6,项目名称:cryptlib-history,代码行数:60,代码来源:win16.c
示例18: GetModuleFromInstance
HMODULE
GetModuleFromInstance(HINSTANCE hInstance)
{
MEMORYINFO *lpMemory;
HANDLE hResult;
if (hInstance == 0)
{
HTASK t;
t = GetCurrentTask();
return GetModuleFromInstance((GETTASKINFO(t))->hInst);
}
if (!(lpMemory = GETHANDLEINFO(hInstance))) {
MODULEINFO *lpModule = GETMODULEINFO(hInstance);
BOOL bGotModule = lpModule ? TRUE : FALSE;
RELEASEMODULEINFO(lpModule);
if (!bGotModule)
return (HMODULE)0;
else {
RELEASEHANDLEINFO(lpMemory);
return (HMODULE)hInstance;
}
}
hResult = lpMemory->hModule;
RELEASEHANDLEINFO(lpMemory);
return hResult;
}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:29,代码来源:Kernel.c
示例19: defined
ULONG32 CAsyncNetThread::GetSession()
{
#if defined( _WIN32 )
return (GetCurrentThreadId());
#else
return ((ULONG32)(LPSTR)GetCurrentTask());
#endif
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:8,代码来源:casynthr.cpp
示例20: SetWindowsHook16
/***********************************************************************
* SetWindowsHook (USER.121)
*/
FARPROC16 WINAPI SetWindowsHook16( INT16 id, HOOKPROC16 proc )
{
HINSTANCE16 hInst = FarGetOwner16( HIWORD(proc) );
/* WH_MSGFILTER is the only task-specific hook for SetWindowsHook() */
HTASK16 hTask = (id == WH_MSGFILTER) ? GetCurrentTask() : 0;
return (FARPROC16)SetWindowsHookEx16( id, proc, hInst, hTask );
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:12,代码来源:hook16.c
注:本文中的GetCurrentTask函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论