从TAPI服务提供商访问HKCU [英] Access HKCU from TAPI Service Provider

查看:99
本文介绍了从TAPI服务提供商访问HKCU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为电话系统编写适配器TSP.该系统具有TAPI API,但与我试图启用TAPI的应用程序不兼容.为了从正确的线路拨打电话,我需要了解一些信息(来自HKCU),有关信息是由谁发出的.由于TSP在Telephony服务的上下文中运行,因此我无法直接访问.我的计划是使用LINE_CREATEDIALOGINSTANCE的功能来读取此信息.

I am writing an adapter TSP for a phone system. This system has a TAPI API but it is incompatible with the application I am trying to TAPI-enable. In order to place a call from the correct line, I need to know some information (from HKCU) about who is making the request. Since the TSP runs in the context of the Telephony service, I cannot access is directly. My plan was to use the functionality of LINE_CREATEDIALOGINSTANCE to read this information.

我遇到的问题是,从TUISPI_providerGenericDialog返回带有以下堆栈跟踪信息后,电话服务立即崩溃:

The problem I'm having is that the Telephony service is crashing immediately after returning from TUISPI_providerGenericDialog with the following stack trace:

72004400() 
tapisrv.dll!_FreeDialogInstance@20()  + 0xa93 bytes 
tapisrv.dll!_ClientRequest@16()  + 0x8f bytes 
rpcrt4.dll!_Invoke@12()  + 0x30 bytes 
rpcrt4.dll!_NdrStubCall2@16()  + 0x217 bytes 
rpcrt4.dll!_NdrServerCall2@4()  + 0x19 bytes 
rpcrt4.dll!_DispatchToStubInCNoAvrf@12()  + 0x17 bytes 
rpcrt4.dll!RPC_INTERFACE::DispatchToStubWorker()  + 0xae bytes 
rpcrt4.dll!RPC_INTERFACE::DispatchToStub()  + 0x4b bytes 
rpcrt4.dll!LRPC_SCALL::DealWithRequestMessage()  + 0x1d5 bytes 
rpcrt4.dll!LRPC_ADDRESS::DealWithLRPCRequest()  + 0x90 bytes 
rpcrt4.dll!LRPC_ADDRESS::ReceiveLotsaCalls()  + 0x20c bytes 
rpcrt4.dll!RecvLotsaCallsWrapper()  + 0xd bytes 
rpcrt4.dll!BaseCachedThreadRoutine()  + 0x92 bytes 
rpcrt4.dll!ThreadStartRoutine()  + 0x1b bytes 
kernel32.dll!_BaseThreadStart@8()  + 0x34 bytes

按照

As per this book, the Telephony service will crash if TSPI_providerFreeDialogInstance is not implemented. I have implemented this function and DepWalker shows it as being properly exported. ApiSpy32 shows that its address is correctly returned via GetProcAddress when my TSP is loaded. Why is it still crashing?

相关代码:

LONG TSPIAPI TSPI_lineMakeCall(DRV_REQUESTID dwRequestID, HDRVLINE hdLine, HTAPICALL htCall,
    LPHDRVCALL lphdCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode, LPLINECALLPARAMS const lpCallParams)
{
    OutputDebugString("TSPI_lineMakeCall\n");
    PDRVLINE pLine = (PDRVLINE) hdLine;

    *lphdCall = (HDRVCALL)hdLine;

    typedef TUISPICREATEDIALOGINSTANCEPARAMS PARAMS;

    pLine->htCall = htCall;
    DWORD lLength = (lstrlenW(lpszDestAddress) + 1) * sizeof(WCHAR);

    PARAMS* lParams = (PARAMS*)DrvAlloc(sizeof(PARAMS) + lLength);
    RtlZeroMemory(lParams, sizeof(PARAMS) + lLength);

    lParams->dwRequestID = dwRequestID;
    lParams->hdDlgInst = (HDRVDIALOGINSTANCE)1000;
    lParams->lpszUIDLLName = L"TapiAdapter.tsp";
    lParams->lpParams = lParams + 1;
    lParams->dwSize = lLength;

    lstrcpyW((LPWSTR)(lParams + 1), lpszDestAddress);
    (*pLine->pfnEventProc)(pLine->htLine, 0, LINE_CREATEDIALOGINSTANCE, (DWORD)lParams, 0, 0);

    return dwRequestID;
}


LONG TSPIAPI TSPI_providerGenericDialogData(DWORD_PTR dwObjectID, DWORD dwObjectType, LPVOID lpParams, DWORD dwSize)
{
    OutputDebugString("TSPI_providerGenericDialogData\n");
    return 0;
}

LONG TSPIAPI TSPI_providerFreeDialogInstance(HDRVDIALOGINSTANCE hdDlgInst)
{
    OutputDebugString("TSPI_providerFreeDialogInstance\n");
    return 0;
}

LONG TSPIAPI TUISPI_providerGenericDialog(TUISPIDLLCALLBACK lpfnUIDLLCallback, HTAPIDIALOGINSTANCE htDlgInst, LPVOID lpParams, DWORD dwSize, HANDLE hEvent)
{
    SetEvent(hEvent);

    LPCWSTR lNumber = (LPCWSTR)lpParams;
    MessageBoxW(0, lNumber, L"Dial Number", MB_OK);

    return 0;
}

推荐答案

我找到了解决方案:根据

I have found the solution: As per MSDN, the first parameter of the LINEEVENT call for this event only needs to be an HPROVIDER, not an HTAPILINE. Since the first parameter of LINEEVENT is of type HTAPILINE, the HPROVIDER will need to be cast.

这篇关于从TAPI服务提供商访问HKCU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆