1 | /* $Id: */
|
---|
2 | /** @file
|
---|
3 | * VBoxCommon - Misc helper routines for install helper.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include <windows.h>
|
---|
19 | #include <tchar.h>
|
---|
20 | #include <stdio.h>
|
---|
21 |
|
---|
22 | #include <msi.h>
|
---|
23 | #include <msiquery.h>
|
---|
24 |
|
---|
25 | UINT VBoxGetProperty(MSIHANDLE a_hModule, TCHAR* a_pszName, TCHAR* a_pValue, DWORD a_dwSize)
|
---|
26 | {
|
---|
27 | UINT uiRet = ERROR_SUCCESS;
|
---|
28 | DWORD dwBuffer = 0;
|
---|
29 |
|
---|
30 | uiRet = MsiGetProperty(a_hModule, a_pszName, TEXT(""), &dwBuffer);
|
---|
31 | if (ERROR_MORE_DATA == uiRet)
|
---|
32 | {
|
---|
33 | ++dwBuffer; /* On output does not include terminating null, so add 1. */
|
---|
34 |
|
---|
35 | if (dwBuffer > a_dwSize)
|
---|
36 | return ERROR_MORE_DATA;
|
---|
37 |
|
---|
38 | ZeroMemory(a_pValue, a_dwSize);
|
---|
39 | uiRet = MsiGetProperty(a_hModule, a_pszName, a_pValue, &dwBuffer);
|
---|
40 | }
|
---|
41 |
|
---|
42 | return uiRet;
|
---|
43 | }
|
---|
44 |
|
---|
45 | UINT VBoxSetProperty(MSIHANDLE a_hModule, TCHAR* a_pszName, TCHAR* a_pValue)
|
---|
46 | {
|
---|
47 | return MsiSetProperty(a_hModule, a_pszName, a_pValue);
|
---|
48 | }
|
---|
49 |
|
---|