Board index » cppbuilder » Re: Automated Object - MultiThreaded

Re: Automated Object - MultiThreaded


2005-03-12 08:44:30 AM
cppbuilder31
"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
Quote
it seems that the "Sysutils::GUIDToString(CLSID_MailServerCOM)"
returns another string (0C00900-2800-4073-0054-504D534D6169)
than is shown in the "P_MailServer_TLB.h", which states:
<snip>
What you describe is not possible. The output is guaranteed to be
"{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}" if you use the declaration that you
showed. There is no way it can produce
"{0C00900-2800-4073-0054-504D534D6169}". The only way to get that is if you
did not pass in the correct CLSID to begin with.
Quote
Strangely it seemed that the COM-function from the MailServerCOMImpl.cpp
was still executed before the ServiceStart...
Which function are you referring to?
Gambit
 
 

Re:Re: Automated Object - MultiThreaded

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
news:42322f83$ XXXX@XXXXX.COM ...

>it seems that the "Sysutils::GUIDToString(CLSID_MailServerCOM)"
>returns another string (0C00900-2800-4073-0054-504D534D6169)
>than is shown in the "P_MailServer_TLB.h", which states:
<snip>

What you describe is not possible. The output is guaranteed to be
"{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}" if you use the declaration that you
showed. There is no way it can produce
"{0C00900-2800-4073-0054-504D534D6169}". The only way to get that is if you
did not pass in the correct CLSID to begin with.
I know... How or why it happened is a big question to me. All is normal again..
but it's still a big Q why it happened though..
Quote

>Strangely it seemed that the COM-function from the MailServerCOMImpl.cpp
>was still executed before the ServiceStart...

Which function are you referring to?
It's the functon where you told me to use try-catch-blocks:
STDMETHODIMP TMailServerCOMImpl::ConfigUpdated()
{
try
{
// Check if all parts are loaded and execute:
if( (PMSMain) && (PMSMain->MailServer) )
PMSMain->MailServer->SignalConfigListener();
else
return Error("The MailServer is not available",
IID_IMailServerCOM, S_FALSE);
}
catch(Exception &e)
{
// Return Error:
return Error(e.Message.c_str(), IID_IMailServerCOM,
E_UNEXPECTED);
}
// Default return:
return S_OK;
}
Is still seems that this COM-function is run before the ServiceStart was
finished. I've checked this by writing the GetTickCount() at the start of both
functions (ConfigUpdated and ServiceStart).
About the registry-part, whenever this is not implemented as in the document you
referred to, the NT-service wont start at all, so the registry part should be OK
now.
Zoetjuh
 

Re:Re: Automated Object - MultiThreaded

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
Quote
Is still seems that this COM-function is run before the
ServiceStart was finished.
In my own COM services, ServiceStart() is always completed before COM
methods can be called. So I have to think that something else in your
configuration is not set up properly yet.
Quote
About the registry-part, whenever this is not implemented as in
the document you referred to, the NT-service wont start at all,
so the registry part should be OK now.
Since you never explained exactly what settings you actually configured,
there is no way to know whether you set them up properly in the first place.
Gambit
 

{smallsort}

Re:Re: Automated Object - MultiThreaded

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>Is still seems that this COM-function is run before the
>ServiceStart was finished.

In my own COM services, ServiceStart() is always completed before COM
methods can be called. So I have to think that something else in your
configuration is not set up properly yet.
I wish I knew what :(
You're seen all my code and below, all the reg-keys.
Might it be some weird Windows XP Pro SP2-something?
Quote

>About the registry-part, whenever this is not implemented as in
>the document you referred to, the NT-service wont start at all,
>so the registry part should be OK now.

Since you never explained exactly what settings you actually configured,
there is no way to know whether you set them up properly in the first place.


Gambit


--------------
True, there we go:
[ HKEY_CLASSES_ROOT\AppID\{8FC528A4-5C96-41D2-A6AD-EBB9340D656D} ]
"LocalService" (of type String) = "PMSMain" (which is the 'this->Name' of my
TService)
[ HKEY_CLASSES_ROOT\AppID\P_MailServer.exe ] (which is the services executable
name)
"AppID" (of type String) = "{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}"
[ HKEY_CLASSES_ROOT\CLSID\{8FC528A4-5C96-41D2-A6AD-EBB9340D656D} ]
"AppID" (of type String) = "{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}"
--------------
The CLSID-key has a couple of subkeys which have been placed there be a BCBs
"P_Mailserver.exe /install"-handler:
[ HKEY_CLASSES_ROOT\CLSID\{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}\LocalServer32 ]
"(default)" (of type String) = "C:\INONTW~1\P-MAIL~1\P_MAIL~1.EXE /Automation"
"ThreadingModal" (of type String) = Free
[ HKEY_CLASSES_ROOT\CLSID\{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}\ProgID ]
"(default)" (of type String) = "P_MailServer.MailServerCOM"
[ HKEY_CLASSES_ROOT\CLSID\{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}\TypeLib ]
"(default)" (of type String) = "{6255D13A-04EA-48F0-A162-015CC53AE559}"
[ HKEY_CLASSES_ROOT\CLSID\{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}\Version ]
"(default)" (of type String) = "1.0"
--------------
Another key that has been placed in the registry by the "/install" is:
[ HKEY_CLASSES_ROOT\P_MailServer.MailServerCOM\CLSID ]
"(default)" (of type String) = "{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}"
 

Re:Re: Automated Object - MultiThreaded

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
news:42322f83$ XXXX@XXXXX.COM ...

>it seems that the "Sysutils::GUIDToString(CLSID_MailServerCOM)"
>returns another string (0C00900-2800-4073-0054-504D534D6169)
>than is shown in the "P_MailServer_TLB.h", which states:
<snip>

What you describe is not possible. The output is guaranteed to be
"{8FC528A4-5C96-41D2-A6AD-EBB9340D656D}" if you use the declaration that you
showed. There is no way it can produce
"{0C00900-2800-4073-0054-504D534D6169}". The only way to get that is if you
did not pass in the correct CLSID to begin with.

It's happening again?!
{0C009000-0400-4073-0054-504D534D6169} as a result of
"Sysutils::GUIDToString(CLSID_MailServerCOM)"
 

Re:Re: Automated Object - MultiThreaded

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
Quote
It's happening again?!
Again, what you describe is technically impossible. The generated string is
directly based on the numeric values contained inside the GUID you pass in.
Unless the GUID in question is actually declared as follows:
GUID SomeName = {0x0C009000, 0x0400, 0x4073, {0x00, 0x54, 0x50, 0x4D,
0x53, 0x4D, 0x61, 0x69}};
There is no possible way GUIDToString() can be producing the string values
you claim.
I would suggest, however, that you use the StringFromGUID2() function from
the Win32 API rather than the GUIDToString() function from the VCL:
wchar_t buf[64] = {0};
StringFromGUID2(CLSID_MailServerCOM, buf, 64);
Gambit
 

Re:Re: Automated Object - MultiThreaded

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>It's happening again?!

Again, what you describe is technically impossible. The generated string is
directly based on the numeric values contained inside the GUID you pass in.
Unless the GUID in question is actually declared as follows:

GUID SomeName = {0x0C009000, 0x0400, 0x4073, {0x00, 0x54, 0x50, 0x4D,
0x53, 0x4D, 0x61, 0x69}};

There is no possible way GUIDToString() can be producing the string values
you claim.

I would suggest, however, that you use the StringFromGUID2() function from
the Win32 API rather than the GUIDToString() function from the VCL:

wchar_t buf[64] = {0};
StringFromGUID2(CLSID_MailServerCOM, buf, 64);


Gambit


Could it be possible that GUIDToString() can create a new GUID-string?
With StringFromGUID2() all seems OK again... just hope it will stay this way.
Zoetjuh
 

Re:Re: Automated Object - MultiThreaded

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
Quote
(Big change, I've put the subthread-creating in the MailServer constructor,
rather than the execute-code)

OK Strange, I've just retested this, but when I place the subthread-creating in
the MailServers execution Code, the COM-function returns the eror as it did in
the beginning. So I'm curious how threads are accessed by COM. Could it be that
the cause is also responsible for the problem that the ServiceStart is executed
*after* the COM-function is being run?
It must be somewhat frustrating to be bombed by these questions .. but i'm still
not sure what i'm doing wrong :(
Zoetjuh
 

Re:Re: Automated Object - MultiThreaded

"Zoetjuh" < XXXX@XXXXX.COM >wrote in message
Quote
Could it be possible that GUIDToString() can create a new GUID-string?
No. As I mentioned earlier, the generated string value is directly based on
the GUID's numeric values. Pass in the same GUID multiple times, and you
get the same string value back each time.
Gambit