~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Additions/common/VBoxService/VBoxService-win.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-10-13 23:06:00 UTC
  • mfrom: (0.3.2 upstream) (0.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20091013230600-xhu2pwizq0wo63l9
Tags: 3.0.8-dfsg-1ubuntu1
* Merge from debian unstable (LP: #444812), remaining changes:
  - Enable DKMS support on virtualbox host and guest modules (LP: #267097)
    - Drop virtualbox-ose{-guest,}-modules-* package templates
    - Recommend *-source instead of *-modules packages
    - Replace error messages related to missing/mismatched
      kernel module accordingly
  - Autoload kernel module
    - LOAD_VBOXDRV_MODULE=1 in virtualbox-ose.default
  - Disable update action
    - patches/u01-disable-update-action.dpatch
  - Virtualbox should go in Accessories, not in System tools (LP: #288590)
    - virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add apport hook
    - virtualbox-ose.files/source_virtualbox-ose.py
    - virtualbox-ose.install
  - Add launchpad integration
    - control
    - lpi-bug.xpm
    - patches/u02-lp-integration.dpatch
* Try to remove existing dkms modules before adding the new modules
  (LP: #434503)
  - debian/virtualbox-ose-source.postinst
  - debian/virtualbox-ose-guest-source.postinst
* Don't fail if dkms modules have already been removed
  - debian/virtualbox-ose-source.prerm
  - debian/virtualbox-ose-guest-source.prerm

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 
66
66
    /* Get a pointer to the existing DACL. */
67
67
    dwRes = GetNamedSecurityInfo(pszObjName, ObjectType,
68
 
          DACL_SECURITY_INFORMATION,
69
 
          NULL, NULL, &pOldDACL, NULL, &pSD);
70
 
    if (ERROR_SUCCESS != dwRes) {
71
 
        VBoxServiceError("GetNamedSecurityInfo: Error %u\n", dwRes);
 
68
                                 DACL_SECURITY_INFORMATION,
 
69
                                 NULL, NULL, &pOldDACL, NULL, &pSD);
 
70
    if (ERROR_SUCCESS != dwRes) 
 
71
    {
 
72
        if (dwRes == ERROR_FILE_NOT_FOUND)
 
73
            VBoxServiceError("AddAceToObjectsSecurityDescriptor: Object not found/installed: %s\n", pszObjName);
 
74
        else
 
75
            VBoxServiceError("AddAceToObjectsSecurityDescriptor: GetNamedSecurityInfo: Error %u\n", dwRes);
72
76
        goto Cleanup;
73
77
    }
74
78
 
82
86
 
83
87
    /* Create a new ACL that merges the new ACE into the existing DACL. */
84
88
    dwRes = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL);
85
 
    if (ERROR_SUCCESS != dwRes)  {
86
 
        VBoxServiceError("SetEntriesInAcl: Error %u\n", dwRes);
 
89
    if (ERROR_SUCCESS != dwRes)  
 
90
    {
 
91
        VBoxServiceError("AddAceToObjectsSecurityDescriptor: SetEntriesInAcl: Error %u\n", dwRes);
87
92
        goto Cleanup;
88
93
    }
89
94
 
90
95
    /* Attach the new ACL as the object's DACL. */
91
96
    dwRes = SetNamedSecurityInfo(pszObjName, ObjectType,
92
 
          DACL_SECURITY_INFORMATION,
93
 
          NULL, NULL, pNewDACL, NULL);
94
 
    if (ERROR_SUCCESS != dwRes)  {
95
 
        VBoxServiceError("SetNamedSecurityInfo: Error %u\n", dwRes);
 
97
                                 DACL_SECURITY_INFORMATION,
 
98
                                 NULL, NULL, pNewDACL, NULL);
 
99
    if (ERROR_SUCCESS != dwRes)  
 
100
    {
 
101
        VBoxServiceError("AddAceToObjectsSecurityDescriptor: SetNamedSecurityInfo: Error %u\n", dwRes);
96
102
        goto Cleanup;
97
103
    }
98
104
 
 
105
    /** @todo get rid of that spaghetti jump ... */
99
106
Cleanup:
100
107
 
101
108
    if(pSD != NULL)
232
239
                                                                       FILE_GENERIC_READ | FILE_GENERIC_WRITE,
233
240
                                                                       SET_ACCESS,
234
241
                                                                       NO_INHERITANCE);
235
 
        if (dwRes != 0)
 
242
        if (dwRes != ERROR_SUCCESS)
236
243
        {
237
 
            rc = VERR_ACCESS_DENIED; /* Need to add some better code later. */
 
244
            if (dwRes == ERROR_FILE_NOT_FOUND)
 
245
            {
 
246
                /* If we don't find our "VBoxMiniRdrDN" (for Shared Folders) object above,
 
247
                   don't report an error; it just might be not installed. Otherwise this
 
248
                   would cause the SCM to hang on starting up the service. */
 
249
                rc = VINF_SUCCESS;
 
250
            }
 
251
            else rc = RTErrConvertFromWin32(dwRes);
238
252
        }
239
253
    }
240
254
#endif