~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Main/win/svchlp.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
int SVCHlpClient::create (const char *aName)
66
66
{
67
 
    AssertReturn (aName, VERR_INVALID_PARAMETER);
 
67
    AssertReturn(aName, VERR_INVALID_PARAMETER);
68
68
 
69
69
    if (mIsOpen)
70
70
        return VERR_WRONG_ORDER;
93
93
 
94
94
int SVCHlpClient::open (const char *aName)
95
95
{
96
 
    AssertReturn (aName, VERR_INVALID_PARAMETER);
 
96
    AssertReturn(aName, VERR_INVALID_PARAMETER);
97
97
 
98
98
    if (mIsOpen)
99
99
        return VERR_WRONG_ORDER;
160
160
 
161
161
int SVCHlpClient::write (const void *aVal, size_t aLen)
162
162
{
163
 
    AssertReturn (aVal != NULL, VERR_INVALID_PARAMETER);
164
 
    AssertReturn (aLen != 0, VERR_INVALID_PARAMETER);
 
163
    AssertReturn(aVal != NULL, VERR_INVALID_PARAMETER);
 
164
    AssertReturn(aLen != 0, VERR_INVALID_PARAMETER);
165
165
 
166
166
    if (!mIsOpen)
167
167
        return VERR_WRONG_ORDER;
168
168
 
169
169
    DWORD written = 0;
170
170
    BOOL ok = WriteFile (mWriteEnd, aVal, (ULONG)aLen, &written, NULL);
171
 
    AssertReturn (!ok || written == aLen, VERR_GENERAL_FAILURE);
 
171
    AssertReturn(!ok || written == aLen, VERR_GENERAL_FAILURE);
172
172
    return ok ? VINF_SUCCESS : rtErrConvertFromWin32OnFailure();
173
173
}
174
174
 
178
178
        return VERR_WRONG_ORDER;
179
179
 
180
180
    /* write -1 for NULL strings */
181
 
    if (aVal.isNull())
 
181
    if (aVal.isEmpty())
182
182
        return write ((size_t) ~0);
183
183
 
184
184
    size_t len = aVal.length();
185
185
 
186
186
    /* write string length */
187
187
    int vrc = write (len);
188
 
    if (RT_SUCCESS (vrc))
 
188
    if (RT_SUCCESS(vrc))
189
189
    {
190
190
        /* write string data */
191
191
        vrc = write (aVal.raw(), len);
202
202
 
203
203
int SVCHlpClient::read (void *aVal, size_t aLen)
204
204
{
205
 
    AssertReturn (aVal != NULL, VERR_INVALID_PARAMETER);
206
 
    AssertReturn (aLen != 0, VERR_INVALID_PARAMETER);
 
205
    AssertReturn(aVal != NULL, VERR_INVALID_PARAMETER);
 
206
    AssertReturn(aLen != 0, VERR_INVALID_PARAMETER);
207
207
 
208
208
    if (!mIsOpen)
209
209
        return VERR_WRONG_ORDER;
210
210
 
211
211
    DWORD read = 0;
212
212
    BOOL ok = ReadFile (mReadEnd, aVal, (ULONG)aLen, &read, NULL);
213
 
    AssertReturn (!ok || read == aLen, VERR_GENERAL_FAILURE);
 
213
    AssertReturn(!ok || read == aLen, VERR_GENERAL_FAILURE);
214
214
    return ok ? VINF_SUCCESS : rtErrConvertFromWin32OnFailure();
215
215
}
216
216
 
223
223
 
224
224
    /* read string length */
225
225
    int vrc = read (len);
226
 
    if (RT_FAILURE (vrc))
 
226
    if (RT_FAILURE(vrc))
227
227
        return vrc;
228
228
 
229
229
    /* length -1 means a NULL string */
233
233
        return VINF_SUCCESS;
234
234
    }
235
235
 
236
 
    aVal.alloc (len + 1);
 
236
    aVal.reserve(len + 1);
237
237
    aVal.mutableRaw() [len] = 0;
238
238
 
239
239
    /* read string data */
246
246
{
247
247
    Utf8Str guidStr;
248
248
    int vrc = read (guidStr);
249
 
    if (RT_SUCCESS (vrc))
 
249
    if (RT_SUCCESS(vrc))
250
250
        aGuid = Guid (guidStr.c_str());
251
251
    return vrc;
252
252
}
265
265
    do
266
266
    {
267
267
        vrc = read (msgCode);
268
 
        if (RT_FAILURE (vrc))
 
268
        if (RT_FAILURE(vrc))
269
269
            return vrc;
270
270
 
271
271
        /* terminate request received */
292
292
                    VERR_GENERAL_FAILURE);
293
293
        }
294
294
 
295
 
        if (RT_FAILURE (vrc))
 
295
        if (RT_FAILURE(vrc))
296
296
            return vrc;
297
297
    }
298
298
    while (1);