VBoxGuestInstallHelper.cpp revision 2530534a7736fece44adf052b4fc0902a2a7d7ea
/* $Id$ */
/** @file
* VBoxGuestInstallHelper - Various helper routines for Windows guest installer.
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <windows.h>
#include <stdlib.h>
#include <Strsafe.h>
#include "exdll.h"
/* Required structures/defines of VBoxTray. */
#include "../../VBoxTray/VBoxTrayMsg.h"
/**
* Pops (gets) a value from the internal NSIS stack.
* Since the supplied popstring() method easily can cause buffer
* overflows, use VBoxPopString() instead!
*
* @return HRESULT
* @param pszDest Pointer to pre-allocated string to store result.
* @param cchDest Size (in characters) of pre-allocated string.
*/
{
if (!g_stacktop || !*g_stacktop)
hr = ERROR_EMPTY;
else
{
if (pStack)
{
{
}
}
}
return hr;
}
{
if (!g_stacktop || !*g_stacktop)
hr = ERROR_EMPTY;
else
{
if (pStack)
{
}
}
return hr;
}
{
while (1)
{
GENERIC_READ | /* Read and write access. */
0, /* No sharing. */
NULL, /* Default security attributes. */
OPEN_EXISTING, /* Opens existing pipe. */
0, /* Default attributes. */
NULL); /* No template file. */
/* Break if the pipe handle is valid. */
if (hPipe != INVALID_HANDLE_VALUE)
break;
/* Exit if an error other than ERROR_PIPE_BUSY occurs. */
if (GetLastError() != ERROR_PIPE_BUSY)
return NULL;
/* All pipe instances are busy, so wait for 20 seconds. */
return NULL;
}
/* The pipe connected; change to message-read mode. */
&dwMode, /* New pipe mode. */
NULL, /* Don't set maximum bytes. */
NULL); /* Don't set maximum time. */
if (!fSuccess)
return NULL;
return hPipe;
}
{
}
{
return hr;
}
/**
* Shows a balloon message using VBoxTray's notification area in the
* Windows task bar.
*
* @param hwndParent Window handle of parent.
* @param string_size Size of variable string.
* @param variables The actual variable string.
* @param stacktop Pointer to a pointer to the current stack.
*/
{
EXDLL_INIT();
{
if (hPipe)
{
}
}
/* Push simple return value on stack. */
}
{
return TRUE;
}
/**
* Disables the Windows File Protection for a specified file
* using an undocumented SFC API call. Don't try this at home!
*
* @param hwndParent Window handle of parent.
* @param string_size Size of variable string.
* @param variables The actual variable string.
* @param stacktop Pointer to a pointer to the current stack.
*/
{
EXDLL_INIT();
{
{
if (g_pfnSfcFileException == NULL)
{
/* If we didn't get the proc address with the call above, try it harder with
* the (zero based) index of the function list. */
if (g_pfnSfcFileException == NULL)
}
}
else
{
}
if (hSFC)
}
/* Push simple return value on stack. */
}