Click to See Complete Forum and Search --> : MSSCCI Integration into an app


acidsEcho
July 29th, 2010, 02:18 PM
Ive been tasked with implementing Visual Studio's SCCI interface into one of our inhouse tools. Currently we manually check out a file from source control (Surround SCM in this case), open the application, make adjustments through the tools GUI and save the file locally. My lead wants to eliminate that first step and have the tool automatically check-out the file when its opened. Just like visual studio does if you modify an unchecked-out (locked) file.

I haven't been able to find anything on the internet that can put me in the right direction on this. The MSDN documentation regarding MSSCCI isn't very clear. I did manage to build the example from the Feb 2005 VS SDK, but that only gave me enough information to confuse me more. It creates a DLL. How does that DLL link with Surround SCM? Once it is, where do these parameters come from to call the DLL functions?

For example:

SCCEXTERNC SCCRTN EXTFUN __cdecl SccInitialize(
LPVOID * ppContext,
HWND hWnd,
LPCSTR lpCallerName,
LPSTR lpSccName,
LPLONG lpSccCaps,
LPSTR lpAuxPathLabel,
LPLONG pnCheckoutCommentLen,
LPLONG pnCommentLen
)

In the test program I am using the sample in, I declare all those variables. But if I don't initialize the ones MSDN says are "out" parameters then I get:

Run-Time Check Failure #3 - The variable 'otherComLen' is being used without being initialized.

If I do initialize them then I get a handful of other errors that probably have something to do with me initializing them incorrectly since I have no idea what they are supposed to be.

Has anyone else tried this? Is it even possible? Does anyone have any kind of documentation, example, resource or information that will point me in the right direction? Ive been pulling my hair out over this one for a week now.

VictorN
July 29th, 2010, 03:30 PM
I don't see any otherComLen variable in the "code snippet" you posted. :confused:

acidsEcho
July 29th, 2010, 03:43 PM
Sorry, the code for scc.h and the sample is pretty large.

Im declaring my locals in _tmain:


typedef LONG (*scVersion)();
typedef SCCRTN (*scInitialize)(LPVOID* ppvContext, HWND hWnd, LPCSTR lpCallerName, LPSTR lpSccName,
LPLONG lpSccCaps, LPSTR lpAuxPathLabel, LPLONG pnCheckoutCommentLen,
LPLONG pnCommentLen);

int _tmain(int argc, _TCHAR* argv[])
{
LPVOID* scContentPointer = NULL;
HWND windowHandle;
LPCSTR callerName = "temp";
LPSTR sccName = "temp";
LPSTR auxPath = "temp";
LPLONG capFlags;
LPLONG checkoutComLen;
LPLONG otherComLen;


windowHandle = GetConsoleWindow();
scVersion _scVersion;
scInitialize _scInitialize;
HMODULE hMod = LoadLibraryA("C:\\Users\\aaaaaaa\\Desktop\\files\\SCCItest\\SampleMSSCCI.dll");


I have some output to verify the .dll loaded correctly and it does. so I attach some functions from the .dll to my typedefs.


_scVersion = (scVersion)GetProcAddress(hMod,"SccGetVersion");
_scInitialize = (scInitialize)GetProcAddress(hMod, "SccInitialize");


I call and output SccGetVersion (or _scVersion) which returns fine.
Then I try to call SccInitialize as such...


_scInitialize(scContentPointer, windowHandle, callerName, sccName, capFlags, auxPath, checkoutComLen, otherComLen);


The function signature for SccInitialize is in my first post.

and here is the only existing documentation for that class:
http://msdn.microsoft.com/en-us/library/bb165660.aspx

acidsEcho
August 4th, 2010, 02:15 PM
Over 100 views and no one has any useful information at all?

VictorN
August 4th, 2010, 02:39 PM
typedef LONG (*scVersion)();
typedef SCCRTN (*scInitialize)(LPVOID* ppvContext, HWND hWnd, LPCSTR lpCallerName, LPSTR lpSccName,
LPLONG lpSccCaps, LPSTR lpAuxPathLabel, LPLONG pnCheckoutCommentLen,
LPLONG pnCommentLen);

int _tmain(int argc, _TCHAR* argv[])
{
...
LPLONG otherComLen;


_scInitialize(scContentPointer, windowHandle, callerName, sccName, capFlags, auxPath, checkoutComLen, otherComLen);
Well, the message you saw was right:The variable 'otherComLen' is being used without being initialized.
But is it what you want? :confused:
Your 'otherComLen' is just a pointer and it points to nothing (or, that could be worth, it points to some garbage or some memory it must not point to)! :thumbd:
What is the meaning of this parameter?

acidsEcho
August 4th, 2010, 03:13 PM
This is what MSDN says about that parameter:

pnCommentLen
[out] Returns the maximum permissible length for other comments.

It is described as an output parameter that is supposed to be sent to the function un-initialized and something inside the function (which I don't have access to since scc.h communicates directly with the source control libraries) initializes the output parameters.

If I initialize the output parameters I get a "failure to convert error". So I cant initialize it and I cant send it uninitialized. The only option left is to malloc the variable so it points to an empty block of memory that can be written to?

VictorN
August 4th, 2010, 03:17 PM
You have to define a LONG variable, not a pointer.
And then pass in the pointer to this variable.

mani3355
August 12th, 2010, 01:02 AM
hi,

described as an output parameter that is supposed to be sent to the function un-initialized and something inside the function (which I don't have access to since scc.h communicates directly with the source control libraries) initializes the output parameters.


regards,
phe9oxis,
http://www.guidebuddha.com