locked
"RpcNsBinding...()" Functions Obsoleted with Vista/Windows 7

    Dotaz

  • HELP!! 

    I am dire need for a solution to update XP targetted legacy code being ported to Windows 7.   The legacy code uses Remote Procedure Call (RPC) name service series of functions (e.g. RpcNsBindImport(), RpcNsBinding Export()) which are noted in documentation as "function is not supported on Windows Vista and later operating systems."    

    With me being new with RPC,  what in the heck do I use in their replacements instead?   I have not found a solution yet.

    ***ANY HELP OR DIRECTION WOULD BE GREATLY APPRECIATED.***

    XP targetted Code sample of incompatiable code for Windows 7 (Bold text denotes problem functions):

    RPC_STATUS DbNameServiceLogin(

    const char

    * remoteDomain)

    {

    RPC_STATUS iStatus = (-1);

    RPC_NS_HANDLE nsHandle;

     

    unsigned char

    nsEntry[60];

     

    if

    (remoteDomain != NULL)

    {

     

    char ucRemote[60];

    // Make sure the remote domain name is upper case

    strcpy(ucRemote, remoteDomain);

    _strupr(ucRemote);

    strcpy((

    char

    *)nsEntry, PIP_DBI_RMT);

    strcat((

    char

    *)nsEntry, ucRemote);

    }

     

    else

    strcpy((

    char

    *)nsEntry, PIP_DBI_LOC);

    strcat((

    char

    *)nsEntry, PIP_DBI_NAME);

    RpcTryExcept

    {

    iStatus = RpcNsBindingImportBegin(RPC_C_NS_SYNTAX_DEFAULT,

    nsEntry, PIP_DATABASE_v1_0_c_ifspec,

    NULL, &nsHandle);

    }

    RpcExcept(1)

    {

    iStatus = RpcExceptionCode();

    }

    RpcEndExcept

     

    /* The loop is present because the name service may contain "stale" */

     

    /* and unusable binding handlers. This is part of the DCE design. */

     

    if

    (iStatus == RPC_S_OK)

    {

     

    do

    {

    iStatus = RpcNsBindingImportNext(nsHandle, &dHandle);

     

    if (iStatus == RPC_S_NO_MORE_BINDINGS) break

    ;

     

    if (iStatus != RPC_S_OK) continue

    ;

    RpcBindingSetAuthInfo(dHandle, 0, RPC_C_AUTHN_LEVEL_NONE,

    RPC_C_AUTHN_WINNT, 0, 0);

    DBPing();

    }

    while

    (!connected);

    RpcNsBindingImportDone(&nsHandle);

    }

     

    if

    (iStatus == RPC_S_OK) iStatus = 0;

     

    return

    iStatus;

    }

    void

     

    DBSetBindingInfo(const char

    *servAddr,

     

    const char

    *protocol,

     

    const char

    *endpoint)

    {

    useBinding = TRUE;

    strcpy((

    char

    *)RPC_SERVADDR, servAddr);

    strcpy((

    char

    *)RPC_ENDPOINT, endpoint);

    strcpy((

    char

    *)RPC_PROTOCOL, protocol);

    }

     

    30. listopadu 2011 0:06

Všechny reakce