Discussion:
RPC Service Interface Registration in target Session Space
(too old to reply)
Mark H.
2010-06-24 21:46:49 UTC
Permalink
Hi,

I have a Service that accesses the interactive desktop. The service can
successfully create processes on any existing desktop in the specified
session. I know that to create a new desktop or perform any other actions in
the user's session that I need a proxy(transient) process running in the
specified session space. I have my service all coded to do exactly what I
need. What I need is to know how to make it work! Here is what my thoughts
are:

1. I want to keep things as simple as possible. So, instead of creating a
new proxy executable I want to Re-Use the service itself by instantiating a
copy of the service running in the target session space. I want to use the
SAME RPC interface and set it to local communications only. Security should
be applied so that only the service process can communicate with the session
specific instances.

2. When a request is made where access is needed to a session specific
desktop a new instance is created. The service uses a local rpc end point
such as "endpoint_session%d" (where %d is the session number). The Session 0
instance then makes sure an instance is running in the session space and then
connects to it via the endpoint "endpoint_session%d". The net affect is that
this keeps thigs REAL simple in that I don't have to create a new IPC
mechanism nor do I have to create any new processes or interfaces.

3. This keeps 99% of my existing code and clients exactly the same.

The problem:

I can not get a Session Specific version to answer an RPC request. The 1st
instance (Session 0) answers ALL requests even those on the session specific
end point ("endpoint_session%d"). I have tried MANY things:

UUID UuidMyInstance; // UUID know to Session 0 Process and Passed to the
Session Specific Process to Use.
UUID ClientUuid;

sprintf_s(szEndpoint, 50, "endpoint_session%d", dwMySessionId);
RpcServerUseProtseqEp("ncalrpc",
cMaxCalls,
szEndpoint,
&sd);
RpcServerRegisterAuthInfo(
princname,
RPC_C_AUTHN_WINNT,
NULL,
NULL );
UuidCreate(&ClientUuid);
RpcObjectSetType(&ClientUuid, &UuidMyInstance);
RpcServerRegisterIfEx(
MyRpcService_v1_0_s_ifspec,
&UuidMyInstance,
&NEW_EPV,
RPC_IF_ALLOW_LOCAL_ONLY,
RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
NULL );
RpcServerInqBindings(&pbindingVector);
RpcEpRegister(MyRpcService_v1_0_s_ifspec, // from rpcsvc.h
pbindingVector,
0,
0);

I have also tried ...

puuidVector.Count = 1;
puuidVector.Uuid[0] = &ClientUuid;
RpcEpRegister(MyRpcService_v1_0_s_ifspec, // from rpcsvc.h
pbindingVector,
&puuidVector,
0);

Client side (actually from with the same service in Session 0) ...

strcpy_s(szUuid, 50, "--- Some UUID ----"); //
strcpy_s(szProtocolSequence, 50, "ncalrpc");
sprintf_s(szEndpoint, 50, "endpoint_session%d", dwSessionId);
status = RpcStringBindingCompose(szUuid,
szProtocolSequence,
NULL,
szEndpoint,
pszOptions,
pszStringBinding);
RpcBindingFromStringBinding(*pszStringBinding, Binding);
RpcBindingSetAuthInfo(
*Binding,
pszPrincname,
SecurityLevel,
RPC_C_AUTHN_WINNT,
NULL,
0);

First, is more information needed?
Second, Can this be done?
Third, Can anyone provide suggestions?

Thanks,
--
Mark
Mark H.
2010-06-30 20:15:55 UTC
Permalink
So much for 2 day response from a MS Engineer ....


"Priority Subscriber Support in MSDN Forums
MSDN subscribers now benefit from priority support in MSDN Forums. We will
be finishing our transition from supporting newsgroups in early 2010 (we will
replace the remaining newsgroup links below with Forums links at that time)
so that you can get answers to your technical questions in a variety of
subject areas. A Microsoft engineer will respond within 2 business days to
your posting if the community hasn't already gotten you the answer. MSDN
Forums are very active community and a great place to both get help and help
others."


And yes, I am logged in with my Live ID I use with MSDN.
--
Mark
Post by Mark H.
Hi,
I have a Service that accesses the interactive desktop. The service can
successfully create processes on any existing desktop in the specified
session. I know that to create a new desktop or perform any other actions in
the user's session that I need a proxy(transient) process running in the
specified session space. I have my service all coded to do exactly what I
need. What I need is to know how to make it work! Here is what my thoughts
1. I want to keep things as simple as possible. So, instead of creating a
new proxy executable I want to Re-Use the service itself by instantiating a
copy of the service running in the target session space. I want to use the
SAME RPC interface and set it to local communications only. Security should
be applied so that only the service process can communicate with the session
specific instances.
2. When a request is made where access is needed to a session specific
desktop a new instance is created. The service uses a local rpc end point
such as "endpoint_session%d" (where %d is the session number). The Session 0
instance then makes sure an instance is running in the session space and then
connects to it via the endpoint "endpoint_session%d". The net affect is that
this keeps thigs REAL simple in that I don't have to create a new IPC
mechanism nor do I have to create any new processes or interfaces.
3. This keeps 99% of my existing code and clients exactly the same.
I can not get a Session Specific version to answer an RPC request. The 1st
instance (Session 0) answers ALL requests even those on the session specific
UUID UuidMyInstance; // UUID know to Session 0 Process and Passed to the
Session Specific Process to Use.
UUID ClientUuid;
sprintf_s(szEndpoint, 50, "endpoint_session%d", dwMySessionId);
RpcServerUseProtseqEp("ncalrpc",
cMaxCalls,
szEndpoint,
&sd);
RpcServerRegisterAuthInfo(
princname,
RPC_C_AUTHN_WINNT,
NULL,
NULL );
UuidCreate(&ClientUuid);
RpcObjectSetType(&ClientUuid, &UuidMyInstance);
RpcServerRegisterIfEx(
MyRpcService_v1_0_s_ifspec,
&UuidMyInstance,
&NEW_EPV,
RPC_IF_ALLOW_LOCAL_ONLY,
RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
NULL );
RpcServerInqBindings(&pbindingVector);
RpcEpRegister(MyRpcService_v1_0_s_ifspec, // from rpcsvc.h
pbindingVector,
0,
0);
I have also tried ...
puuidVector.Count = 1;
puuidVector.Uuid[0] = &ClientUuid;
RpcEpRegister(MyRpcService_v1_0_s_ifspec, // from rpcsvc.h
pbindingVector,
&puuidVector,
0);
Client side (actually from with the same service in Session 0) ...
strcpy_s(szUuid, 50, "--- Some UUID ----"); //
strcpy_s(szProtocolSequence, 50, "ncalrpc");
sprintf_s(szEndpoint, 50, "endpoint_session%d", dwSessionId);
status = RpcStringBindingCompose(szUuid,
szProtocolSequence,
NULL,
szEndpoint,
pszOptions,
pszStringBinding);
RpcBindingFromStringBinding(*pszStringBinding, Binding);
RpcBindingSetAuthInfo(
*Binding,
pszPrincname,
SecurityLevel,
RPC_C_AUTHN_WINNT,
NULL,
0);
First, is more information needed?
Second, Can this be done?
Third, Can anyone provide suggestions?
Thanks,
--
Mark
Continue reading on narkive:
Loading...