Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3360098
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:57:08+00:00 2026-05-18T02:57:08+00:00

I would like to implement a MSSCCI provider, however if at all possible I

  • 0

I would like to implement a MSSCCI provider, however if at all possible I would like to implement it in .Net (so my MSSCCI provider is in fact a thin wrapper around a .Net implementation)

  • Is this possible?
  • Is this a good idea?

I know that implementing it in .Net would mean that anyone using my MSSCCI provider would be forced to host the .Net framework inside their process – is this an unreasonable request? Also what other limitations would I need to consider if I were to implement it in .Net?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:57:08+00:00Added an answer on May 18, 2026 at 2:57 am

    It’s possible, and relatively easy. I developed one some time ago and it works fine. I used COM interoperability from C++ to C#.

    So, you will create two dlls. The C++ one is only a wrapper that implements the API pass the calls to a COM in C#. The C# one must be registered as a COM component with regasm /codebase mycomlibrary.dll

    Here are some guidelines to implement it. In the code sample I only implement the SccInitialize function as an example. Hope it helps.

    This is the C++ component:

    #include <comutil.h>
    
    /**********************************************************************************************************/
    // Imports the COM object that implements the SCC API in .NET
    /**********************************************************************************************************/
    #import "SccCOMServer.tlb" no_namespace named_guids
    
    static int s_nInitializedCount = 0;
    
    /**********************************************************************************************************/
    // Starting point of the dll
    /**********************************************************************************************************/
    BOOL APIENTRY DllMain( 
                          HANDLE hModule, 
                          DWORD  ul_reason_for_call, 
                          LPVOID lpReserved
                          )
    {
        switch (ul_reason_for_call)
        {
            case DLL_PROCESS_ATTACH:
            case DLL_THREAD_ATTACH:
            case DLL_THREAD_DETACH:
            case DLL_PROCESS_DETACH:
            break;
        }
        return TRUE;
    }
    
    /**********************************************************************************************************/
    // Variable with a instance of the COM object
    /**********************************************************************************************************/
    
    ISccCOMServer *mCpi = NULL;
    
    
    /**********************************************************************************************************/
    // Utility functions
    /**********************************************************************************************************/
    
    void BSTR2T(BSTR s1, LPSTR s2)
    {
        _bstr_t s(s1, false);
        strcpy(s2, s);
    }
    
    char* ConvertBSTRToLPSTR (BSTR bstrIn)
    {
        LPSTR pszOut = NULL;
        if (bstrIn != NULL)
        {
            int nInputStrLen = SysStringLen (bstrIn);
    
            // Double NULL Termination
            int nOutputStrLen = WideCharToMultiByte(CP_ACP, 0, bstrIn, nInputStrLen, NULL, 0, 0, 0) + 2; 
            pszOut = new char [nOutputStrLen];
    
            if (pszOut)
            {
                memset (pszOut, 0x00, sizeof (char)*nOutputStrLen);
                WideCharToMultiByte (CP_ACP, 0, bstrIn, nInputStrLen, pszOut, nOutputStrLen, 0, 0);
            }
        }
        return pszOut;
    }
    
     /**********************************************************************************************************/
    //                                      IMPLEMENTATION OF THE FUNCTIONS
    /**********************************************************************************************************/
    
    
    /**********************************************************************************************************/
    // Initialization and Housekeepeng Functions
    /**********************************************************************************************************/
    
    SCCEXTERNC SCCRTN EXTFUN __cdecl SccInitialize(
        LPVOID * ppContext, 
        HWND hWnd, 
        LPCSTR lpCallerName,
        LPSTR lpSccName, // [In, out]
        LPLONG lpSccCaps, // [Out]
        LPSTR lpAuxPathLabel, // [In, out]
        LPLONG pnCheckoutCommentLen, // [Out]
        LPLONG pnCommentLen //[Out]
        )
    {
    
        // Initialize COM the first time the function is called
        CoInitialize(0);
        s_nInitializedCount++;
        HRESULT hr = CoCreateInstance(CLSID_ISccCOMServerImpl,
            NULL, CLSCTX_INPROC_SERVER,
            IID_ISccCOMServer, reinterpret_cast<void**>(&mCpi));
    
        long response;
    
        // We need auxiliar strings because out string in COM are BSTR *  
        BSTR bstrSccName;
        BSTR bstrAuxPathLabel;
    
        bstrSccName = T2BSTR(lpSccName);
        bstrAuxPathLabel = T2BSTR(lpAuxPathLabel);
    
        Context *CC = new Context;
        // Calling to the COM equivalent Function
    
        response = mCpi->Initialize(CC, (long) hWnd, lpCallerName, &bstrSccName, lpSccCaps, &bstrAuxPathLabel, 
            pnCheckoutCommentLen, pnCommentLen);
    
        *ppContext = (void *)CC;
    
        // Converting the strings
        BSTR2T(bstrSccName, lpSccName);
        BSTR2T(bstrAuxPathLabel, lpAuxPathLabel);
        return response;
    
    }
    

    And then the C# part is simpler:

    [Guid("C6659361-1625-4746-931C-36014B146679")]
    public class ISccCOMServerImpl : ISccCOMServer
    {
        public int Initialize(
            out Context ppContext,
            IntPtr hWnd,
            string lpCallerName,
            ref string lpSccName, // out
            out int lpSccCaps, // out
            ref string lpAuxPathLabel, // out
            out int pnCheckoutCommentLen, // out
            out int pnCommentLen //out
            )
        {
           //your manage code here!
        }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to implement a command line interface for a Java application. This
I would like to implement something similar to a c# delegate method in PHP.
I would like to implement a data access object pattern in C++, but preferably
I would like to implement an interactive evolutionary algorithm for generating music (probably just
I would like to implement a producer/consumer scenario that obeys interfaces that are roughly:
I would like to implement a post build event that performs the following actions
I would like to implement the method User.calculate_hashed_password . I'm trying to use the
I'm trying to improve performance under high load and would like to implement opcode
I am developing an application for video capture and I would like to implement
I've been working with the SpiderMonkey C API and would like to implement a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.