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.

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

mercurial