VirtualBox

Changeset 71150 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
Feb 28, 2018 10:44:38 AM (7 years ago)
Author:
vboxsync
Message:

IPRT: Added a RTThreadPoke implementation for windows that uses NtAlertThread.

Location:
trunk/src/VBox/Runtime/r3/win
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/init-win.cpp

    r70361 r71150  
    8484/** NtDuplicateToken (NT 3.51). */
    8585DECLHIDDEN(PFNNTDUPLICATETOKEN)             g_pfnNtDuplicateToken = NULL;
     86/** NtAlertThread (NT 3.51). */
     87decltype(NtAlertThread)                    *g_pfnNtAlertThread = NULL;
    8688
    8789/** Either ws2_32.dll (NT4+) or wsock32.dll (NT3.x). */
     
    513515    g_pfnNtQueryFullAttributesFile = (PFNNTQUERYFULLATTRIBUTESFILE)GetProcAddress(g_hModNtDll, "NtQueryFullAttributesFile");
    514516    g_pfnNtDuplicateToken          = (PFNNTDUPLICATETOKEN)GetProcAddress(         g_hModNtDll, "NtDuplicateToken");
    515 
     517    g_pfnNtAlertThread             = (decltype(NtAlertThread) *)GetProcAddress(   g_hModNtDll, "NtAlertThread");
    516518
    517519    /*
  • trunk/src/VBox/Runtime/r3/win/internal-r3-win.h

    r70345 r71150  
    109109typedef NTSTATUS (NTAPI *PFNNTDUPLICATETOKEN)(HANDLE, ACCESS_MASK, struct _OBJECT_ATTRIBUTES *, BOOLEAN, TOKEN_TYPE, PHANDLE);
    110110extern DECLHIDDEN(PFNNTDUPLICATETOKEN)             g_pfnNtDuplicateToken;
     111#ifdef ___iprt_nt_nt_h___
     112extern decltype(NtAlertThread)                    *g_pfnNtAlertThread;
     113#endif
    111114
    112115extern DECLHIDDEN(HMODULE)                         g_hModWinSock;
  • trunk/src/VBox/Runtime/r3/win/thread-win.cpp

    r71127 r71150  
    4545#include <iprt/mem.h>
    4646#include "internal/thread.h"
     47#include "internal-r3-win.h"
    4748
    4849
     
    400401RT_EXPORT_SYMBOL(RTThreadGetNativeHandle);
    401402
     403
     404RTDECL(int) RTThreadPoke(RTTHREAD hThread)
     405{
     406    AssertReturn(hThread != RTThreadSelf(), VERR_INVALID_PARAMETER);
     407    if (g_pfnNtAlertThread)
     408    {
     409        PRTTHREADINT pThread = rtThreadGet(hThread);
     410        AssertReturn(pThread, VERR_INVALID_HANDLE);
     411
     412        NTSTATUS rcNt = g_pfnNtAlertThread((HANDLE)pThread->hThread);
     413
     414        rtThreadRelease(pThread);
     415        if (NT_SUCCESS(rcNt))
     416            return VINF_SUCCESS;
     417        return RTErrConvertFromErrno(rcNt);
     418    }
     419    return VERR_NOT_IMPLEMENTED;
     420}
     421
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette