~ubuntu-branches/ubuntu/precise/virtualbox/precise-updates

« back to all changes in this revision

Viewing changes to src/VBox/Installer/win/InstallHelper/VBoxCommon.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-10-17 23:23:09 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20111017232309-kzm6841lzk61ranj
Tags: 4.1.4-dfsg-1
* New upstream release.
  - Fixes missing icons when using pt_BR locale. (Closes: #507188)
  - Fixes guest additions download url. (Closes: #637349; LP: #840668)
* Refresh patches.
* Drop the vboxmouse x11 driver. The mouse integration is now completely
  handled by the kernel module.
* Restrict dh_pycentral to the virtualbox binary package.
* Merge changes from the Ubuntu package but use them only when built
  on Ubuntu:
  - Add an Apport hook.
  - Add vboxguest modalias to the package control field.
* Pass KBUILD_VERBOSE=2 to kmk.
* Add 36-fix-text-mode.patch to fix text mode when using the vboxvideo driver.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: VBoxCommon.cpp 37289 2011-06-01 11:59:23Z vboxsync $ */
 
1
/* $Id: VBoxCommon.cpp $ */
2
2
/** @file
3
3
 * VBoxCommon - Misc helper routines for install helper.
4
4
 */
5
5
 
6
6
/*
7
 
 * Copyright (C) 2008-2010 Oracle Corporation
 
7
 * Copyright (C) 2008-2011 Oracle Corporation
8
8
 *
9
9
 * This file is part of VirtualBox Open Source Edition (OSE), as
10
10
 * available from http://www.virtualbox.org. This file is free software;
15
15
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16
16
 */
17
17
 
 
18
 
 
19
/*******************************************************************************
 
20
*   Header Files                                                               *
 
21
*******************************************************************************/
18
22
#include <windows.h>
19
23
#include <tchar.h>
20
24
#include <stdio.h>
23
27
#include <msiquery.h>
24
28
 
25
29
 
26
 
#if (_MSC_VER < 1400) /* Provide _stprintf_s to VC < 8.0. */
27
 
int _stprintf_s(TCHAR *buffer, size_t cbBuffer, const TCHAR *format, ...)
 
30
#if (_MSC_VER < 1400) /* Provide swprintf_s to VC < 8.0. */
 
31
int swprintf_s(WCHAR *buffer, size_t cbBuffer, const WCHAR *format, ...)
28
32
{
29
33
    int ret;
30
 
    va_list args;
31
 
    va_start(args, format);
32
 
    ret = _vsntprintf(buffer, cbBuffer, format, args);
33
 
    va_end(args);
 
34
    va_list va;
 
35
    va_start(va, format);
 
36
    ret = _vsnwprintf(buffer, cbBuffer, format, va);
 
37
    va_end(va);
34
38
    return ret;
35
39
}
36
40
#endif
37
41
 
38
 
UINT VBoxGetProperty(MSIHANDLE a_hModule, TCHAR* a_pszName, TCHAR* a_pValue, DWORD a_dwSize)
 
42
UINT VBoxGetProperty(MSIHANDLE a_hModule, WCHAR *a_pwszName, WCHAR *a_pwszValue, DWORD a_dwSize)
39
43
{
40
 
    UINT uiRet = ERROR_SUCCESS;
41
44
    DWORD dwBuffer = 0;
42
 
 
43
 
    uiRet = MsiGetProperty(a_hModule, a_pszName, TEXT(""), &dwBuffer);
44
 
    if (ERROR_MORE_DATA == uiRet)
 
45
    UINT uiRet = MsiGetPropertyW(a_hModule, a_pwszName, L"", &dwBuffer);
 
46
    if (uiRet == ERROR_MORE_DATA)
45
47
    {
46
48
        ++dwBuffer;     /* On output does not include terminating null, so add 1. */
47
49
 
48
50
        if (dwBuffer > a_dwSize)
49
51
            return ERROR_MORE_DATA;
50
52
 
51
 
        ZeroMemory(a_pValue, a_dwSize);
52
 
        uiRet = MsiGetProperty(a_hModule, a_pszName, a_pValue, &dwBuffer);
 
53
        ZeroMemory(a_pwszValue, a_dwSize);
 
54
        uiRet = MsiGetPropertyW(a_hModule, a_pwszName, a_pwszValue, &dwBuffer);
53
55
    }
54
56
    return uiRet;
55
57
}
56
58
 
57
 
UINT VBoxSetProperty(MSIHANDLE a_hModule, TCHAR* a_pszName, TCHAR* a_pValue)
 
59
UINT VBoxSetProperty(MSIHANDLE a_hModule, WCHAR *a_pwszName, WCHAR *a_pwszValue)
58
60
{
59
 
    return MsiSetProperty(a_hModule, a_pszName, a_pValue);
 
61
    return MsiSetPropertyW(a_hModule, a_pwszName, a_pwszValue);
60
62
}
61
63