VBoxServiceInternal.h revision 1bf88a54387e004678654cf5158075f59e3be168
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * VBoxService - Guest Additions Services.
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2007-2009 Sun Microsystems, Inc.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * available from http://www.virtualbox.org. This file is free software;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * you can redistribute it and/or modify it under the terms of the GNU
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * General Public License (GPL) as published by the Free Software
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * additional information or have any questions.
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync# include <process.h> /* Needed for file version information. */
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * A service descriptor.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsynctypedef struct
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync /** The short service name. */
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync const char *pszName;
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync /** The longer service name. */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync /** The usage options stuff for the --help screen. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync const char *pszUsage;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /** The option descriptions for the --help screen. */
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * Called before parsing arguments.
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * @returns VBox status code.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Tries to parse the given command line option.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param ppszShort If not NULL it points to the short option iterator. a short argument.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * If NULL examine argv[*pi].
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param argc The argument count.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param argv The argument vector.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param pi The argument vector index. Update if any value(s) are eaten.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync DECLCALLBACKMEMBER(int, pfnOption)(const char **ppszShort, int argc, char **argv, int *pi);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Called before parsing arguments.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @returns VBox status code.
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync /** Called from the worker thread.
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync * @returns VBox status code.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @retval VINF_SUCCESS if exitting because *pfTerminate was set.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param pfTerminate Pointer to a per service termination flag to check
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * before and after blocking.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync DECLCALLBACKMEMBER(int, pfnWorker)(bool volatile *pfTerminate);
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync * Stop an service.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Does termination cleanups.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @remarks This may be called even if pfnInit hasn't been called!
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/** Pointer to a VBOXSERVICE. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/** Pointer to a const VBOXSERVICE. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** The service name (needed for mutex creation on Windows). */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/** The friendly service name. */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync/** The following constant may be defined by including NtStatus.h. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** Structure for storing the looked up user information. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsynctypedef struct
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** Structure for the file information lookup. */
7c1f498692cd2393f8ba68cb62be482495106f93vboxsynctypedef struct
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** Function prototypes for dynamic loading. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsynctypedef DWORD (WINAPI* fnWTSGetActiveConsoleSessionId)();
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsyncextern int VBoxServiceSyntax(const char *pszFormat, ...);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncextern int VBoxServiceError(const char *pszFormat, ...);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncextern void VBoxServiceVerbose(int iLevel, const char *pszFormat, ...);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsyncextern int VBoxServiceArgUInt32(int argc, char **argv, const char *psz, int *pi, uint32_t *pu32, uint32_t u32Min, uint32_t u32Max);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsyncextern unsigned VBoxServiceGetStartedServices(void);
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsyncextern int VBoxServiceStartServices(unsigned iMain);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncextern int VBoxServiceStopServices(void);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsyncextern SERVICE_TABLE_ENTRY const g_aServiceTable[]; /** @todo generate on the fly, see comment in main() from the enabled sub services. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/** Installs the service into the registry. */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsyncextern int VBoxServiceWinInstall(void);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** Uninstalls the service from the registry. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncextern int VBoxServiceWinUninstall(void);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** Detects wheter a user is logged on based on the enumerated processes. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncextern BOOL VboxServiceVMInfoWinIsLoggedIn(VBOXSERVICEVMINFOUSER* a_pUserInfo,
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** Gets logon user IDs from enumerated processes. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncextern DWORD VboxServiceVMInfoWinGetLUIDsFromProcesses(PLUID *ppLuid);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync#endif /* VBOX_WITH_GUEST_PROPS */
85bc82f92f4d7a7b95e96d133c4847b2847703dfvboxsync#endif /* RT_OS_WINDOWS */