VirtualBox

Changeset 37421 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jun 12, 2011 6:24:34 PM (13 years ago)
Author:
vboxsync
Message:

VBoxGuestInstallHelper.cpp: static, static, static. Use lower case prefix on internal functions to make it absolutely clear what's what.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp

    r36570 r37421  
    1616 */
    1717
     18/*******************************************************************************
     19*   Header Files                                                               *
     20*******************************************************************************/
    1821#include <windows.h>
    1922#include <atlconv.h>
     
    2528#include "../../VBoxTray/VBoxTrayMsg.h"
    2629
    27 HINSTANCE g_hInstance;
    28 HWND g_hwndParent;
    29 
    30 typedef DWORD (WINAPI *fnSfcFileException) (DWORD param1, PWCHAR param2, DWORD param3);
    31 fnSfcFileException g_pfnSfcFileException = NULL;
    32 
     30
     31/*******************************************************************************
     32*   Defined Constants And Macros                                               *
     33*******************************************************************************/
    3334#define VBOXINSTALLHELPER_EXPORT extern "C" void __declspec(dllexport)
     35
     36
     37/*******************************************************************************
     38*   Structures and Typedefs                                                    *
     39*******************************************************************************/
     40typedef DWORD (WINAPI *PFNSFCFILEEXCEPTION)(DWORD param1, PWCHAR param2, DWORD param3);
     41
     42
     43/*******************************************************************************
     44*   Global Variables                                                           *
     45*******************************************************************************/
     46HINSTANCE               g_hInstance;
     47HWND                    g_hwndParent;
     48PFNSFCFILEEXCEPTION     g_pfnSfcFileException = NULL;
     49
    3450
    3551/**
    3652 * Pops (gets) a value from the internal NSIS stack.
    3753 * Since the supplied popstring() method easily can cause buffer
    38  * overflows, use VBoxPopString() instead!
     54 * overflows, use vboxPopString() instead!
    3955 *
    4056 * @return  HRESULT
     
    4258 * @param   cchDest     Size (in characters) of pre-allocated string.
    4359 */
    44 static HRESULT VBoxPopString(TCHAR *pszDest, size_t cchDest)
     60static HRESULT vboxPopString(TCHAR *pszDest, size_t cchDest)
    4561{
    4662    HRESULT hr = S_OK;
     
    6379}
    6480
    65 static HRESULT VBoxPopULong(ULONG *pulValue)
     81static HRESULT vboxPopULong(PULONG pulValue)
    6682{
    6783    HRESULT hr = S_OK;
     
    8298}
    8399
    84 void Char2WCharFree(PWCHAR pwString)
     100static void vboxChar2WCharFree(PWCHAR pwString)
    85101{
    86102    if (pwString)
     
    88104}
    89105
    90 HRESULT Char2WCharAlloc(const char *pszString, PWCHAR *ppwString)
     106static HRESULT vboxChar2WCharAlloc(const char *pszString, PWCHAR *ppwString)
    91107{
    92108    HRESULT hr;
    93109    int iLen = strlen(pszString) + 2;
    94         WCHAR *pwString = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, iLen * sizeof(WCHAR));
     110    WCHAR *pwString = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, iLen * sizeof(WCHAR));
    95111    if (!pwString)
    96112        hr = ERROR_NOT_ENOUGH_MEMORY;
     
    111127}
    112128
    113 HANDLE VBoIPCConnect()
     129static HANDLE vboxIPCConnect(void)
    114130{
    115131    HANDLE hPipe = NULL;
     
    149165}
    150166
    151 void VBoxIPCDisconnect(HANDLE hPipe)
     167static void vboxIPCDisconnect(HANDLE hPipe)
    152168{
    153169    CloseHandle(hPipe);
    154170}
    155171
    156 HRESULT VBoxIPCWriteMessage(HANDLE hPipe, BYTE *pMessage, DWORD cbMessage)
     172static HRESULT vboxIPCWriteMessage(HANDLE hPipe, BYTE *pMessage, DWORD cbMessage)
    157173{
    158174    HRESULT hr = S_OK;
     
    182198
    183199    VBOXTRAYIPCMSG_SHOWBALLOONMSG msg;
    184     HRESULT hr = VBoxPopString(msg.szContent, sizeof(msg.szContent) / sizeof(TCHAR));
    185     if (SUCCEEDED(hr))
    186         hr = VBoxPopString(msg.szTitle, sizeof(msg.szTitle) / sizeof(TCHAR));
    187     if (SUCCEEDED(hr))
    188         hr = VBoxPopULong(&msg.ulType);
    189     if (SUCCEEDED(hr))
    190         hr = VBoxPopULong(&msg.ulShowMS);
     200    HRESULT hr = vboxPopString(msg.szContent, sizeof(msg.szContent) / sizeof(TCHAR));
     201    if (SUCCEEDED(hr))
     202        hr = vboxPopString(msg.szTitle, sizeof(msg.szTitle) / sizeof(TCHAR));
     203    if (SUCCEEDED(hr))
     204        hr = vboxPopULong(&msg.ulType);
     205    if (SUCCEEDED(hr))
     206        hr = vboxPopULong(&msg.ulShowMS);
    191207
    192208    if (SUCCEEDED(hr))
     
    194210        msg.ulFlags = 0;
    195211
    196         HANDLE hPipe = VBoIPCConnect();
     212        HANDLE hPipe = vboxIPCConnect();
    197213        if (hPipe)
    198214        {
    199             hr = VBoxIPCWriteMessage(hPipe, (BYTE*)&hdr, sizeof(VBOXTRAYIPCHEADER));
     215            hr = vboxIPCWriteMessage(hPipe, (BYTE*)&hdr, sizeof(VBOXTRAYIPCHEADER));
    200216            if (SUCCEEDED(hr))
    201                 hr = VBoxIPCWriteMessage(hPipe, (BYTE*)&msg, sizeof(VBOXTRAYIPCMSG_SHOWBALLOONMSG));
    202             VBoxIPCDisconnect(hPipe);
     217                hr = vboxIPCWriteMessage(hPipe, (BYTE*)&msg, sizeof(VBOXTRAYIPCMSG_SHOWBALLOONMSG));
     218            vboxIPCDisconnect(hPipe);
    203219        }
    204220    }
     
    229245
    230246    TCHAR szFile[MAX_PATH + 1];
    231     HRESULT hr = VBoxPopString(szFile, sizeof(szFile) / sizeof(TCHAR));
     247    HRESULT hr = vboxPopString(szFile, sizeof(szFile) / sizeof(TCHAR));
    232248    if (SUCCEEDED(hr))
    233249    {
     
    235251        if (NULL != hSFC)
    236252        {
    237             g_pfnSfcFileException = (fnSfcFileException)GetProcAddress(hSFC, "SfcFileException");
     253            g_pfnSfcFileException = (PFNSFCFILEEXCEPTION)GetProcAddress(hSFC, "SfcFileException");
    238254            if (g_pfnSfcFileException == NULL)
    239255            {
    240256                /* If we didn't get the proc address with the call above, try it harder with
    241257                 * the (zero based) index of the function list. */
    242                 g_pfnSfcFileException = (fnSfcFileException)GetProcAddress(hSFC, (LPCSTR)5);
     258                g_pfnSfcFileException = (PFNSFCFILEEXCEPTION)GetProcAddress(hSFC, (LPCSTR)5);
    243259                if (g_pfnSfcFileException == NULL)
    244260                    hr = HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND);
     
    251267        {
    252268            WCHAR *pwszFile;
    253             hr = Char2WCharAlloc(szFile, &pwszFile);
     269            hr = vboxChar2WCharAlloc(szFile, &pwszFile);
    254270            if (SUCCEEDED(hr))
    255271            {
    256272                if (g_pfnSfcFileException(0, pwszFile, -1) != 0)
    257273                    hr = HRESULT_FROM_WIN32(GetLastError());
    258                 Char2WCharFree(pwszFile);
     274                vboxChar2WCharFree(pwszFile);
    259275            }
    260276        }
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