Mikolaj Zalewski wrote:
I don't want this patch to get committed but to maybe get some comments. If the patch will be considered to be ok I can send it as three smaller patches. It implements the basic infrastructure for services.exe - a process that maintains the services database and states. I think this can be useful in the long run.
Absolutely.
This patch currently doesn't implement anything useful - it connects to services.exe in OpenSCManager and disconnect in CloseServiceHandle and validating the database name is now done in services.exe but if this approach is good I will add more functionality.
It looks good to me, but I'm a bit worried that you'll come across bugs/unimplemented features in widl when you start adding more calls.
Is there a way to check if a RPC connection over a named pipe was closed by the client (probably we should close all it's handles in such a case)?
Yes, you can do this using context handles, but unfortunately we're lacking support for these on the RPC server side and in widl.
Also this program show a bug in our rpcrt4 - if we pass NULL as a [in,unique,string] parameter rpcrt4 will crash because of a strlen on it in NdrConformantStringBufferSize. To see it one can remove the workaround in OpenSCManager and do a `make test`.
That sounds like a bug in widl to me, and I'll take a look.
Macros like RET_IF_ERROR should be removed from the final version or can they stay?
Definitely should be removed.
diff --git a/include/wine/svcctl_shared.h b/include/wine/svcctl_shared.h new file mode 100644 index 0000000..5687ddc --- /dev/null +++ b/include/wine/svcctl_shared.h @@ -0,0 +1,35 @@ +/*
- SVCCTL (services.exe RPC interface) shared constants
- Copyright (C) 2007 Google (Mikolaj Zalewski)
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#ifndef __WINE_SVCCTL_SHARED_H +#define __WINE_SVCCTL_SHARED_H
+#include <stdarg.h> +#include <windef.h> +#include <winbase.h>
+#define SVCCTL_TRANSPORT {'n','c','a','c','n','_','n','p',0} +#define SVCCTL_ENDPOINT {'\','p','i','p','e','\','s','v','c','c','t','l',0}
+/* Not the Windows event name - if needed the true one can be found in Inside Windows */ +#define SVCCTL_STARTED_EVENT (const WCHAR[]){'S','v','c','c','t','l','S','t','a','r','t','e','d',0}
+#endif /* __WINE_RPCSS_SHARED_H */
We shouldn't need another file for this. You can put this same stuff in svcctl.idl using cpp_quote.
+DWORD RPC_MainLoop()
Make sure to fully specify the parameters for functions with no parameters by declaring them as "(void)".