Advertisement

Visual Basic question (HARD)

Started by September 13, 2000 08:17 AM
3 comments, last by Dire.Wolf 24 years, 3 months ago
Let me start by apologizing for asking this kind of question here but unfortunately I have looked everywhere for an answer but to no avail. Here is the problem: I''m creating a DCOM component for work which consists of a ActiveX EXE (out of process server). The problem I''m having is that I need to get the security context of the client that is calling my component. One of the only ways I know how to do this is to call the CoGetCallContext to get a IServerSecurity pointer. From there you can use QueryBlanket or the Win32 API calls. Unfortunately you cannot seem to make COM API calls in Visual Basic. I declared my GUID: Public Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data3(8) As Byte End Type I''ve tried to make calls to StringFromIID and IIDFromString but no luck. I can''t even seem to call CoInitializeEx properly. Does anyone have any links or examples to help me out here? Thanks in advance, - Dire Wolf direwolf@digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com


This is kind of off the cuff, but have you tried declaring the functions you are calling?

e.g.

Public Declare Function CoGetCallContext Lib "Ole32" (ByVal id As IID, ByRef requestedInterface As Object) As Long

FYI- don''t know if this will work, or if above declaration is even correct.


Also, could you not implement an inproc dll using C++ to handle the check for you?

Just throwing out an idea or two...


Advertisement
Well, I could write the code using ATL but my company wants it written in VB. I''ve declared the functions I want to call but I''m only getting errors in return, specifically E_INVALARGS.

It looks like I might have to convince them that ATL is the way to go (which I think it is).

Maybe using an inproc DLL, written in C++ as you suggested might work. I''d have to look into it.

- Dire Wolf
direwolf@.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
quote: Original post by Dire.Wolf

Well, I could write the code using ATL but my company wants it written in VB. I''ve declared the functions I want to call but I''m only getting errors in return, specifically E_INVALARGS.

It looks like I might have to convince them that ATL is the way to go (which I think it is).

Maybe using an inproc DLL, written in C++ as you suggested might work. I''d have to look into it.

- Dire Wolf
direwolf@.digitalfiends.com


Maybe you are returning the wrong variables for those API calls? That''s a common problem with API in VB. Not sure if that''s your problem or how much API stuff you even know. (probably more than me really).


BeS
It's Da BOMB Baby!!!
BeSIt's Da BOMB Baby!!!. o O ~ A little nonsense now and then,is relished by the wisest men~ O o .-- Willy Wonka
quote: Original post by wrenhal

Original post by Anonymous Poster



This is kind of off the cuff, but have you tried declaring the functions you are calling?

e.g.

Public Declare Function CoGetCallContext Lib "Ole32" (ByVal id As IID, ByRef requestedInterface As Object) As Long

FYI- don''t know if this will work, or if above declaration is even correct.


Also, could you not implement an inproc dll using C++ to handle the check for you?

Just throwing out an idea or two…




Are you calling your functions with the "ByRef" like above??
If so then try changing to ByVal. Check the API''s documentation for the proper passing. If you are passing ByRef and the function requires ByVal then it could get an error similar to what you described. Just a thought, but it may help with that.


B e S
It''s Da BOMB Baby!!!



BeS
It's Da BOMB Baby!!!
BeSIt's Da BOMB Baby!!!. o O ~ A little nonsense now and then,is relished by the wisest men~ O o .-- Willy Wonka

This topic is closed to new replies.

Advertisement