VirtualBox

Changeset 18639 in vbox


Ignore:
Timestamp:
Apr 2, 2009 2:06:22 PM (15 years ago)
Author:
vboxsync
Message:

Guest Additions/common: Added basic Windows SCM handling for (un)installation.

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk

    r18341 r18639  
    3636        VBoxService.cpp \
    3737        VBoxServiceTimeSync.cpp
     38VBoxService_SOURCES.win   = \
     39        VBoxService-win.cpp
    3840VBoxService_SOURCES.os2   = \
    3941        VBoxService-os2.def \
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp

    r18634 r18639  
    3838#include <VBox/VBoxGuest.h>
    3939#include "VBoxServiceInternal.h"
    40 
    4140
    4241/*******************************************************************************
     
    9089static int VBoxServiceUsage(void)
    9190{
    92     RTPrintf("usage: %s [-f|--foreground] [-v|--verbose] [-i|--interval <seconds>]\n"
    93              "           [--disable-<service>] [--enable-<service>] [-h|-?|--help]\n", g_pszProgName);
    94     for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++)
    95         RTPrintf("           %s\n", g_aServices[j].pDesc->pszUsage);
     91    RTPrintf("usage: %s [-f|--foreground] [-i|--interval <seconds>]"
     92             " [--disable-<service>] [--enable-<service>] [-h|-?|--help] [-v|--verbose]", g_pszProgName);
     93
     94#if defined(RT_OS_WINDOWS)
     95    RTPrintf(" [-r|--register] [-u|--unregister]");
     96#endif
     97
     98    for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++)
     99        RTPrintf(" %s\n", g_aServices[j].pDesc->pszUsage);
     100
    96101    RTPrintf("\n"
    97102             "Options:\n"
    98103#if !defined(RT_OS_WINDOWS)
    99              "    -f | --foreground   Don't daemonzie the program. For debugging.\n"
    100 #endif
    101              "    -v | --verbose      Increment the verbosity level. For debugging.\n"
    102              "    -i | --interval     The default interval.\n"
    103              "    -h | -? | --help    Show this message and exit with status 1.\n");
     104             "    -h | -? | --help         Show this message and exit with status 1.\n"
     105#else
     106             "    -h | -? | /? | --help    Show this message and exit with status 1.\n"
     107#endif
     108             "    -i | --interval          The default interval.\n"
     109#if !defined(RT_OS_WINDOWS)
     110             "    -f | --foreground        Don't daemonzie the program. For debugging.\n"
     111#else
     112             "    -r | --register          Installs the service.\n"
     113             "    -u | --unregister        Uninstall service.\n"
     114#endif
     115             "    -v | --verbose           Increment the verbosity level. For debugging.\n");
     116
     117    RTPrintf("\n"
     118             "Service specific options:\n");
    104119    for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++)
    105120    {
     
    249264    {
    250265        const char *psz = argv[i];
    251         if (*psz != '-')
     266        if(    (*psz != '-')
     267#if defined(RT_OS_WINDOWS)
     268            && (*psz != '/'))
     269#endif
    252270            return VBoxServiceSyntax("Unknown argument '%s'\n", psz);
    253271        psz++;
     
    268286            else if (MATCHES("interval"))
    269287                psz = "i";
     288#if defined(RT_OS_WINDOWS)
     289            else if (MATCHES("register"))
     290                psz = "r";
     291            else if (MATCHES("unregister"))
     292                psz = "u";
     293#endif
    270294            else if (MATCHES("daemonized"))
    271295            {
     
    325349                    break;
    326350
     351#if defined(RT_OS_WINDOWS)
     352                case 'r':
     353                    return VBoxServiceWinInstall();
     354
     355                case 'u':
     356                    return VBoxServiceWinUninstall();
     357#endif
     358
    327359                case 'h':
     360#if defined(RT_OS_WINDOWS)
     361                case '?':
     362#endif
    328363                    return VBoxServiceUsage();
    329364
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h

    r8155 r18639  
    55
    66/*
    7  * Copyright (C) 2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2222#ifndef ___VBoxServiceInternal_h
    2323#define ___VBoxServiceInternal_h
     24
     25/** Name of this program. */
     26#if !defined(RT_OS_WINDOWS)
     27    #define VBOXSERVICE_NAME "VBoxService"
     28    #define VBOXSERVICE_FRIENDLY_NAME "VBoxService"
     29#else
     30    #define VBOXSERVICE_NAME _T("VBoxService")
     31    #define VBOXSERVICE_FRIENDLY_NAME _T("VBoxService")
     32#endif
    2433
    2534/**
     
    97106extern int VBoxServiceArgUInt32(int argc, char **argv, const char *psz, int *pi, uint32_t *pu32, uint32_t u32Min, uint32_t u32Max);
    98107
     108#if defined(RT_OS_WINDOWS)
     109    extern int VBoxServiceWinInstall ();
     110    extern int VBoxServiceWinUninstall ();
     111#endif
     112
    99113extern VBOXSERVICE g_TimeSync;
    100114extern VBOXSERVICE g_Clipboard;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette