other-licenses/nsis/Contrib/ExDLL/exdll.c

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 // Unicode support by Jim Park -- 08/02/2007
     3 #include <windows.h>
     4 #include "tchar.h"
     5 #include "exdll.h"
     7 HINSTANCE g_hInstance;
     9 HWND g_hwndParent;
    11 // To work with Unicode version of NSIS, please use TCHAR-type
    12 // functions for accessing the variables and the stack.
    14 void __declspec(dllexport) myFunction(HWND hwndParent, int string_size, 
    15                                       TCHAR *variables, stack_t **stacktop,
    16                                       extra_parameters *extra)
    17 {
    18   g_hwndParent=hwndParent;
    20   EXDLL_INIT();
    23   // note if you want parameters from the stack, pop them off in order.
    24   // i.e. if you are called via exdll::myFunction file.dat poop.dat
    25   // calling popstring() the first time would give you file.dat,
    26   // and the second time would give you poop.dat. 
    27   // you should empty the stack of your parameters, and ONLY your
    28   // parameters.
    30   // do your stuff here
    31   {
    32     TCHAR buf[1024];
    33     wsprintf(buf,_T("$0=%s\n"),getuservariable(INST_0));
    34     MessageBox(g_hwndParent,buf,0,MB_OK);
    35   }
    36 }
    40 BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
    41 {
    42   g_hInstance=hInst;
    43 	return TRUE;
    44 }

mercurial