VirtualBox

Changeset 82615 in vbox


Ignore:
Timestamp:
Dec 18, 2019 1:39:25 PM (5 years ago)
Author:
vboxsync
Message:

Windows Additions/Installer: Added a new testcase for the GuestInstallHelper DLL, to check whether the NSIS-specified API (still) works. Added more code to make the DLL compatible with NSIS v3.x, which in turn should make the file vendor / architecture detection work again.

Location:
trunk/src/VBox/Additions/WINNT/Installer/InstallHelper
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/Makefile.kmk

    r82464 r82615  
    1818SUB_DEPTH = ../../../../../..
    1919include $(KBUILD_PATH)/subheader.kmk
     20
     21# Include Sub-Makefiles.
     22include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
    2023
    2124#
  • trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp

    r76553 r82615  
    22/** @file
    33 * VBoxGuestInstallHelper - Various helper routines for Windows guest installer.
     4 *                          Works with NSIS 3.x.
    45 */
    56
     
    4647#define VBOXINSTALLHELPER_EXPORT extern "C" void __declspec(dllexport)
    4748
    48 
    4949/*********************************************************************************************************************************
    5050*   Structures and Typedefs                                                                                                      *
     
    160160{
    161161    HRESULT hr;
    162     int iLen = strlen(pszString) + 2;
     162    int iLen = (int)strlen(pszString) + 2;
    163163    WCHAR *pwString = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, iLen * sizeof(WCHAR));
    164164    if (!pwString)
     
    206206 * @param   variables           The actual variable string.
    207207 * @param   stacktop            Pointer to a pointer to the current stack.
    208  */
    209 VBOXINSTALLHELPER_EXPORT DisableWFP(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
    210 {
    211     NOREF(hwndParent);
     208 * @param   extra               Extra parameters. Currently unused.
     209 */
     210VBOXINSTALLHELPER_EXPORT DisableWFP(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop,
     211                                    extra_parameters *extra)
     212{
     213    RT_NOREF(hwndParent, extra);
     214
    212215    EXDLL_INIT();
    213216
     
    259262 * @param   variables           The actual variable string.
    260263 * @param   stacktop            Pointer to a pointer to the current stack.
    261  */
    262 VBOXINSTALLHELPER_EXPORT FileGetArchitecture(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
    263 {
    264     NOREF(hwndParent);
     264 * @param   extra               Extra parameters. Currently unused.
     265 */
     266VBOXINSTALLHELPER_EXPORT FileGetArchitecture(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop,
     267                                             extra_parameters *extra)
     268{
     269    RT_NOREF(hwndParent, extra);
     270
    265271    EXDLL_INIT();
    266272
     
    316322 * @param   variables           The actual variable string.
    317323 * @param   stacktop            Pointer to a pointer to the current stack.
    318  */
    319 VBOXINSTALLHELPER_EXPORT FileGetVendor(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
    320 {
    321     NOREF(hwndParent);
     324 * @param   extra               Extra parameters. Currently unused.
     325 */
     326VBOXINSTALLHELPER_EXPORT FileGetVendor(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop,
     327                                       extra_parameters *extra)
     328{
     329    RT_NOREF(hwndParent, extra);
     330
    322331    EXDLL_INIT();
    323332
     
    379388 * @param   variables           The actual variable string.
    380389 * @param   stacktop            Pointer to a pointer to the current stack.
    381  */
    382 VBOXINSTALLHELPER_EXPORT VBoxTrayShowBallonMsg(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
    383 {
    384     NOREF(hwndParent);
     390 * @param   extra               Extra parameters. Currently unused.
     391 */
     392VBOXINSTALLHELPER_EXPORT VBoxTrayShowBallonMsg(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop,
     393                                               extra_parameters *extra)
     394{
     395    RT_NOREF(hwndParent, extra);
     396
    385397    EXDLL_INIT();
    386398
     
    398410
    399411        uint32_t cbMsg = sizeof(VBOXTRAYIPCMSG_SHOWBALLOONMSG)
    400                        + strlen(szMsg) + 1    /* Include terminating zero */
    401                        + strlen(szTitle) + 1; /* Dito. */
     412                       + (uint32_t)strlen(szMsg)   + 1  /* Include terminating zero */
     413                       + (uint32_t)strlen(szTitle) + 1; /* Ditto. */
    402414        Assert(cbMsg);
    403415        PVBOXTRAYIPCMSG_SHOWBALLOONMSG pIpcMsg =
  • trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/exdll.h

    r76563 r82615  
    3333#endif
    3434
     35// Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version
     36// The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x))
     37// When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {}
     38
     39#define NSISPIAPIVER_1_0 0x00010000
     40#define NSISPIAPIVER_CURR NSISPIAPIVER_1_0
     41
     42// NSIS Plug-In Callback Messages
     43enum NSPIM
     44{
     45    NSPIM_UNLOAD,    // This is the last message a plugin gets, do final cleanup
     46    NSPIM_GUIUNLOAD, // Called after .onGUIEnd
     47};
     48
     49/** Defines the maximum string length NSIS can handle.
     50 *  Note: This depends on the NSIS build being used, e.g. there are different builds which can also handle larger strings.
     51 *        So to play safe go with the minimum (default) string length here. */
     52#define NSIS_MAX_STRLEN 1024
     53
     54// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
     55// Return NULL for unknown messages
     56// Should always be __cdecl for future expansion possibilities
     57typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
     58
     59#ifndef NSISCALL
     60#  define NSISCALL __stdcall
     61#endif
     62
    3563// only include this file from one place in your DLL.
    3664// (it is all static, if you use it in two places it will fail)
     
    4169        g_variables=variables; }
    4270
    43 typedef struct _stack_t {
    44   struct _stack_t *next;
    45   char text[1]; // this should be the length of string_size
     71typedef struct _stack_t
     72{
     73    struct _stack_t *next;
     74    char text[1]; // this should be the length of string_size
    4675} stack_t;
    4776
     77// extra_parameters data structures containing other interesting stuff
     78// but the stack, variables and HWND passed on to plug-ins.
     79typedef struct
     80{
     81    int autoclose;
     82    int all_user_var;
     83    int exec_error;
     84    int abort;
     85    int exec_reboot; // NSIS_SUPPORT_REBOOT
     86    int reboot_called; // NSIS_SUPPORT_REBOOT
     87    int XXX_cur_insttype; // depreacted
     88    int plugin_api_version; // see NSISPIAPIVER_CURR
     89                          // used to be XXX_insttype_changed
     90    int silent; // NSIS_CONFIG_SILENT_SUPPORT
     91    int instdir_error;
     92    int rtl;
     93    int errlvl;
     94    int alter_reg_view;
     95    int status_update;
     96} exec_flags_t;
     97
     98typedef struct
     99{
     100    exec_flags_t *exec_flags;
     101    int (NSISCALL *ExecuteCodeSegment)(int, HWND);
     102    void (NSISCALL *validate_filename)(TCHAR *);
     103    BOOL (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK);
     104} extra_parameters;
    48105
    49106static unsigned int g_stringsize;
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