[jcifs] policy_handle, SCManager, and SVCCTL.idl

michaelm michaelm at managesoft.com
Fri Sep 17 15:25:29 GMT 2004


Hi Mike, and jcifs mailing list gang,

Following on from our previous discussion, I think the the IDL
interaface for OpenServiceW is as follows

    [op(0x10)]
    int OpenServiceW([in] policy_handle *scmanager_handle,
                     [in,string] wchat_t *ServiceName,
                     [in] uint32_t access_mask,
                     [out] policy_handle *service_handle);

Note that I added the an extra [out] argument for the service handle.
The windows API has a SC_HANDLE return value instead:

SC_HANDLE OpenService(
        SC_HANDLE hSCManager,  
        LPCTSTR lpServiceName,  
        DWORD dwDesiredAccess);

Im using jaraoac-0.3.4 (the cvs version seems to have a complie problem
in ncacn_np). Im using idlc-0.3.6 and libmbs-0.8.10.

As stated earlier, I would like to access the windows SCManager from
Linux (via DCE RPC) so that i can remotely start,stop, install services,
given the correct credentials.The same way that you can do this from
windows to windows.

The plan is to install a service, available on a samba file share with
via following:

scmanager = openSCManagerW(..)
service = createServiceW(scmanager,..,pathToServiceBinary_onFileShare,.)
or service = openService(scmanager,..)
StartServiceW(service,..)

But, there seems to be a general problem with passing in a
"policy_handle" (in this case the handle to the scmanager) to an API as
an [in] argument. None of the examples do this, and I cant seem to get
it to work. I aways get a rpc.FaultException (unknowm) seemingly
returned from the remote machine.

Im not sure if this problem is due to the idlc compiler generating
incorrect code, an incorrect IDL, problems with the jarapac libraries,
or my test code.

I have attached my test code, idl, and generated code to this email.
Perhaps someone can see an abvious mistake...

Many thanks,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svcctl.java
Type: text/x-java
Size: 12682 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20040917/c90b1027/svcctl.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestCntrl.java
Type: text/x-java
Size: 1902 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20040917/c90b1027/TestCntrl.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svcctl.idl
Type: text/x-idl
Size: 2258 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20040917/c90b1027/svcctl-0001.bin


More information about the jcifs mailing list