|
Hi!
I designed COM+ Service with .NET. (Window2003)
I deployed My COM+ Service to ClientPC. (WinXP)
(deployed type is Application proxy)
I installed deployed proxy( .MSI file) at Client PC. (installation success)
I confirmed that proxy is running.
but, when i called proxy method, error occurred.
Msg is "access is denied".
Event log is that
"aceess is denied at DCOM", while server computer is activating, this error is occurred".
i changed my COM Properties(Permission, Security ...) according to other DCOM Access Tips.
but, it didn't work.
Please, give me an answer.
Thanks for regards.
|
|
|
|
|
I made a COM (dll) server, i hope it will work in the local
network as a DCOM , because i haven't tried it yet. So it
is three tier Database Architecture, the client programm
sends a query to the server programm ant it sends a CSV
formated data.
The first question - i tried to use ADO (_Recordset) - as
return parameter, but had error in the IDL file, i didn't
know how to avoid it, and i changed it to IUnknow, but in
the client programm i couldn't dispatch it: i did this:
In The Client:
_Recordset* pRecordset = pDatabase->GetMaterials();
ANd it ruturns 0 = WHY???
In The Server:
GetMaterials(IUnknown* pRecordset)
{
_RecordsetPtr p(__uuidof(_Recorset))
//Some Query Procedure
//And in the finish
_RecordsetPtr->QueryInterface(__uuidof(_Recordset),(void**)
&pRecordset);
return S_OK;
}
And Another Question.
Server Should be able to change the address of Database.
For example now = the addres is C:\econ.mdb;
but if the database in other place?
I tried to use GetModulFileName() - but it returned -
C:\Windows\System32\Svchost.dll.
The Main question is - how to find out where my dll
placed...
Thanks.
|
|
|
|
|
I have this strange bug witih safearrays. I was hoping you understood what is going on, so I could learn something from my mistake.
The interface I’ve designed has a method Foo
[id(7)] HRESULT Foo([in] SAFEARRAY(double)* pSA);
The function goes like this:
Foo(SAFEARRAY** pSA)
{
//destroy the incoming array
SafeArrayDestroy (pSA);
//create a new one of desired size
*pSA = SafeArrayCreateVector(VT_R8,0,10);
return S_OK;
}
In VB, I am calling the function:
Public Sub Func()
Dim arr1() as double
Dim arr2(1) as double
Obj.Foo(arr1)
MsgBox UBound (arr1)
//messagebox reports UBound is 9
Obj.Foo(arr2)
MsgBox UBound (arr2)
//messagebox reports UBound 1
End Sub
|
|
|
|
|
Change the [in] to [in,out].
The marshaller doesn't know it's supposed to send it out, otherwise.
Steve S
Developer for hire
|
|
|
|
|
Hello,
SteveS has a strong point on his reply but accidentally,
What you get is correct behavior.
the arr2 parameter in VB is a static declaration of an array with only 1 item in it, so the call to "SafeArrayDestroy(arr2)" probably fails with a meaningful error code and does not destroy the array.
On the other hand the arr1 parameter is a dynamic safe array and is allowed to be destroyed inside your C++ method.
You might also have a look at
http://www.codeproject.com/atl/udtdemo.asp
Hope This helped
Ioannis
|
|
|
|
|
Hi all,
I'm trying to write a program that can use the facilities added to XP SP2 to determine whether a given file was downloaded from the internet or not.
SP2 uses NTFS streams to attach this information to the file. Here's what I came up with:
I've used the streams.exe utility from SysInternals[^] to determine the stream name. streams.exe outputs the following for a given file:
:Zone.Identifier:$DATA 26
I can view the content of the stream like this:
more < blah.exe:Zone.Identifier
...which outputs this:
[ZoneTransfer]
ZoneId=3
According to the URLZONE definition in urlmon.h, 3 is URLZONE_INTERNET...perfect. Other files (not downloaded) simply don't have the Zone.Identifier stream.
I'm quite new to streams and I'm probably lucky to have made it thus far. Problem is, this looks like a kludge to me. I'd like to go through the "proper" interfaces to retrieve this information.
Further research on MSDN lead me here[^]. IZoneIdentifier's GetId() function seems to be exactly what I'm looking for.
I'm new to streams, but I'm even more of a newbie when it comes to interfaces, COM, ATL and all that lovely, er, stuff.
I have the February 2003 Platform SDK installed. Obviously, the corresponding urlmon.h/urlmon.idl don't contain the definitions I need. Even if I had the file(s), I'm not sure I'd be able to use midl to generate the interface, or use midl's output properly. See where I'm going with this?
I'm guessing a functioning sample for this shouldn't be terribly long...can anyone offer help, starting with "how do I get the proper declarations"? The only hit on Google re: IZoneIdentifier brings me back to MSDN...looks like this is still very new, and I can't find any more references to this...
|
|
|
|
|
You replied yourself at the beginning of the question - you're using the new facilities added in XP SP2. But you're still using the old February 2003 SDK. I think, that downloading new Platform SDK for Windows XP SP 2 would help you to find the proper definitions of interfaces and all that stuff.
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/[^]
Anyway thank you for describing how the mechanism worked, I just had some thinking about how they did it and I do forgot completelly about the streams in NTFS. Thank you.
|
|
|
|
|
> You replied yourself at the beginning of the question - you're using the new facilities added
> in XP SP2. But you're still using the old February 2003 SDK.
Right...which I why I inquired about getting updated headers.
To be honest, I only install the Platform SDK whenever it's updated on the MSDN CDs I get. I never looked into getting "live" updates...so thanks for that link.
> Anyway thank you for describing how the mechanism worked, I just had some thinking about how
> they did it and I do forgot completelly about the streams in NTFS. Thank you.
No problem--I read about how it used streams a while back, but never "really" looked any deeper into it until now. What I've found and posted about seems to be rather consistent, but I still think using streams is relying on an "undocumented dirty hack", so if the stream name changes, my code might stop working (who knows if those type of implementation details will remain the same in 2003 SP1 and beyond)...which is why I wanna try using that interface.
|
|
|
|
|
Well...I got slightly farther. Now I'm really gonna show my lack of COM experience.
This is what I currently have, slightly tweaked from some old sample. So far, this is just a simple console application:
#include <windows.h>
#include <tchar.h>
#include <urlmon.h>
int main( void )
{
HRESULT h = CoInitialize( NULL );
if( (S_OK != h) && (S_FALSE != h) )
return -1;
IZoneIdentifier* pZI = NULL;
h = CoCreateInstance(
CLSID_PersistentZoneIdentifier,
NULL,
CLSCTX_INPROC_SERVER,
IID_IZoneIdentifier,
(LPVOID*)&pZI );
if( FAILED( h ) )
return -1;
[...]
CoUninitialize();
return 0;
}
The code compiles fine, however the linker is complaining it can't find _CLSID_PersistentZoneIdentifier and _IID_IZoneIdentifier.
The updated Platform SDK's urlmon.h defines the CLSID as:
EXTERN_C const IID CLSID_PersistentZoneIdentifier;
That's the only reference I can find on my entire hard drive. The variable is declared as extern, but not defined elsewhere...likewise, _IID_IZoneIdentifier is defined in the same file as:
EXTERN_C const IID IID_IZoneIdentifier;
Where am I supposed to find those definitions?
|
|
|
|
|
Sorry for delay, but I wasn't notified by the CP, because you replied to your reply, hence I fond it by pure coincidence )
Anyway I would expect, that from what you described, there's some .lib file required to be added to the project. I don't have the newest SDK (and as until end of week I can connect only through GPRS, I'll not have it soon) I can't tell you which one it should be, but I suspect that Urlmon.lib should do the work.
|
|
|
|
|
Thanks for following up.
I already tried linking to urlmon.lib to no avail. Lots of "unresolved externals" messages re: CLSIDs being posted on Google's Usenet archive suggest to #define INITGUID, #include <initguid.h>, add uuid.lib to the project, etc. None of these help.
I'm quickly running out of ideas...
|
|
|
|
|
I'm just downloading the new SDK, I hope I will be able to help you later today evening.
|
|
|
|
|
aghrr, once more, today's CP problems vanished my effort in writing the final response
Anyway, managed it to compile! Hooray!
I hadn't too much time for that research, but I found following:
In new updated urlmon.h the IZoneIdentifier uses the macro MIDL_INTERFACE that allows to use the brand new special microsoft __uuidof .
Problem remains with the CLSID_PersistentZoneIdentifier . Although his fellows CLSID_InternetSecurityManager and CLSID_InternetZoneManager are known and will compile, this one is obviously missing.
As I don't have too much time for the research, I just hotfixed it by adding the definition of the CLSID_PersistentZoneIdentifier by hand, before the main function in your example:
static const GUID CLSID_PersistentZoneIdentifier =
{ 0x0968E258, 0x16C7, 0x4DBA, { 0xAA, 0x86, 0x46, 0x2D, 0xD6, 0x1E, 0x31, 0xA3 } };
and the final result is then:
h = CoCreateInstance(
CLSID_PersistentZoneIdentifier,
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IZoneIdentifier),
(LPVOID*)&pZI
);
Compiles and also creates some object in return.
Hope that helps.
|
|
|
|
|
geo_m, you're my new hero.
I thought about manually adding the definition myself, but I wasn't too sure about how to proceed (again, my COM experience is limited). May I ask how you came up with that GUID?
I'll give this a shot. Thanks a million!
|
|
|
|
|
Hi,
glad that it helped. To get any GUID already registered in the system you can use the OLE/COM object view utility. This utility is a part of the VS.NET distribution and can be found also in the tools in SDK.
Here you can list all registered interfaces, objects and typelibs, with a bit of patience you can find here whatever needed )
|
|
|
|
|
> with a bit of patience you can find here whatever needed
I had everything but not that.
The OLE/COM object viewer really needs a search function...
|
|
|
|
|
Hello all,
I'm now wrting an IDL file for COM. if I want to return a vector of string, what can I do?
The method that I want is following in c++
vector<string> Function();
As far as I know, a string can be BSTR in IDL, so what in IDL corresponds to a vector or an array in C++?
Thank you very much!
|
|
|
|
|
Try SAFEARRAY.
But I think it is not recognized by MIDL compiler. Let me know if you find some other way of using arrays in IDL that MIDL recognizes.
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
SAFEARRAY(BSTR) should be recognised and understood perfectly well by MIDL. I've worked on projects that made heavy use of these things, and stuff like SAFEARRAYs of user defined types
Steve S
Developer for hire
|
|
|
|
|
Hi Steve,
the MIDL compiler doesn't understand SAFEARRAY (I read it in some article). Can you lead me to some good resource/URL where more on this is shown?
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Good resource would be "Essential IDL" written by Martin Gudgin, or "Essential COM" by Don Box.
If you write
HRESULT getList([out]SAFEARRAY(BSTR)*ppsa);
in your IDL for the interface method, in your C++ you have
STDMETHOD(getList)(SAFEARRAY**ppsa);
as a definition, and
STDMETHODIMP class::getList(SAFEARRAY**ppsa)
{
...
}
as your implementation. In IDL, the array type is known (and can be a simple type, like 'long' or 'DATE', or even a user defined type (structure)).
One issue is that if you're using the MIDL that came with VC++6, you might want to upgrade by downloading the Platform SDK.
In your implementation, you need to create a SAFEARRAY, and fill in the pointer properly. There must be loads of code out there, google for "SAFEARRAY IDL SOURCE" or look here[^] for some examples of more complicated stuff...
Steve S
Developer for hire
|
|
|
|
|
Hi Steve, I am in very much need of Safearray related concepts and methodologies and its use in MIDL file.because I need much use of it too pass large values from COM Dll to VB in meterological projects and M/c related projects.Plz send me some codes and some URL where I can get get proper conceptual knowledge of SAFEARRAY with code.I'm currently facing difficulty in Passing SAFEARRAY from ATL/COM DLL to VB in an Event.So please help me.I am a memeber of this group by name Akshay Dave.My mail id is avd9683@rediffmail.com,
akshayd@eqqu.com.
Awaiting eagerly 4 ur reply.
Akshay Dave
Akshay Dave
|
|
|
|
|
|
You need to read either (or both) Essential IDL and Essential COM, or at a minimum, look for examples on MSDN and other sites (like this one) which use SAFEARRAYs. Google for SAFEARRAY SAMPLE or SAFEARRAY SOURCE which should help you get started.
Alternatively, my rates for training (if you're UK based) are quite competitive
Steve S
Developer for hire
|
|
|
|
|
hi
I would like to remote control Word. As I can insert a new tabellenzeile thank you
|
|
|
|
|