From d9577c0ffe1048c0a3320bfb0f94cf242a72bda2 Mon Sep 17 00:00:00 2001 From: joostverburg Date: Wed, 19 Feb 2003 21:09:05 +0000 Subject: [PATCH] Dialer plugin git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2185 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Dialer/Dialer.txt | 81 ++++++++++++++++++++++++++++ Contrib/Dialer/dialer.c | 93 ++++++++++++++++++++++++++++++++ Contrib/Dialer/dialer.dsp | 108 ++++++++++++++++++++++++++++++++++++++ Contrib/Dialer/dialer.dsw | 29 ++++++++++ Plugins/Dialer.dll | Bin 0 -> 2560 bytes 5 files changed, 311 insertions(+) create mode 100644 Contrib/Dialer/Dialer.txt create mode 100644 Contrib/Dialer/dialer.c create mode 100644 Contrib/Dialer/dialer.dsp create mode 100644 Contrib/Dialer/dialer.dsw create mode 100644 Plugins/Dialer.dll diff --git a/Contrib/Dialer/Dialer.txt b/Contrib/Dialer/Dialer.txt new file mode 100644 index 00000000..35baca03 --- /dev/null +++ b/Contrib/Dialer/Dialer.txt @@ -0,0 +1,81 @@ +DIALER PLUGIN +------------- + +Written by Amir Szekely aka KiCHiK +Readme by Joost Verburg + +USAGE +----- + +The DialerDLL plugin for NSIS provides five functions related to internet connections. + +Example of usage: + +ClearErrors ;Clear the error flag +Dialer::FunctionName ;Call Dialer function +IfErrors "" +3 ;Check for errors + MessageBox "Function not available" + Quit +Pop $R0 ;Get the return value from the stack +MessageBox MB_OK $R0 ;Display the return value + +FUNCTIONS +--------- + +If a function is not available on the system, the error flag will be set. + +* AttemptConnect + + Attempts to make a connection to the Internet if the system is not connected. + + online - already connected / connection successful + offline - connection failed + + Requires Internet Explorer 3 or later + +* AutodialOnline + + Causes the modem to automatically dial the default Internet connection if the system + is not connected to the internet. If the system is not set up to automatically + connect, it will prompt the user. + + Return values: + + online - already connected / connection successful + offline - connection failed + + Requires Internet Explorer 4 or later + +* AutodialUnattended + + Causes the modem to automatically dial the default Internet connection if the system + is not connected to the internet. The user will not be prompted. + + Return values: + + online - already connected / connection successful + offline - connection failed + + Requires Internet Explorer 4 or later + +* AutodialHangup + + Disconnects an automatic dial-up connection. + + Return values: + + success - disconnection successful + failure - disconnection failed + + Requires Internet Explorer 4 or later + +* GetConnectedState + + Checks whether the system is connected to the internet. + + Return values: + + online - system is online + offline - system is offline + + Requires Internet Explorer 4 or later \ No newline at end of file diff --git a/Contrib/Dialer/dialer.c b/Contrib/Dialer/dialer.c new file mode 100644 index 00000000..36abdda8 --- /dev/null +++ b/Contrib/Dialer/dialer.c @@ -0,0 +1,93 @@ +#define WIN32_LEAN_AND_MEAN +#include +#include + +typedef struct _stack_t { + struct _stack_t *next; + char text[1]; // this should be the length of string_size +} stack_t; + +int popstring(char *str); // 0 on success, 1 on empty stack +void pushstring(char *str); + +HWND g_hwndParent; +int g_stringsize; +stack_t **g_stacktop; +char *g_variables; + +#define NSISFunction(funcname) void __declspec(dllexport) funcname(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) +#define NSISGetVars g_hwndParent=hwndParent;g_stringsize=string_size;g_stacktop=stacktop;g_variables=variables + +/****************\ + * LOOK HERE * +\****************/ + +NSISFunction(AutodialOnline) { + NSISGetVars; + if (InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE, 0)) + pushstring("online"); + else + pushstring("offline"); +} + +NSISFunction(AutodialUnattended) { + NSISGetVars; + if (InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED , 0)) + pushstring("online"); + else + pushstring("offline"); +} + +NSISFunction(AttemptConnect) { + NSISGetVars; + if (InternetAttemptConnect(0) == ERROR_SUCCESS) + pushstring("online"); + else + pushstring("offline"); +} + +NSISFunction(GetConnectedState) { + DWORD dwState; + NSISGetVars; + + if (InternetGetConnectedState(&dwState, 0)) + pushstring("online"); + else + pushstring("offline"); +} + +NSISFunction(AutodialHangup) { + NSISGetVars; + if (InternetAutodialHangup(0)) + pushstring("success"); + else + pushstring("failure"); + +} + +/****************\ + * STOP LOOKING * +\****************/ + +BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { + return TRUE; +} + +int popstring(char *str) { + stack_t *th; + if (!g_stacktop || !*g_stacktop) return 1; + th=(*g_stacktop); + lstrcpy(str,th->text); + *g_stacktop = th->next; + GlobalFree((HGLOBAL)th); + return 0; +} + +void pushstring(char *str) { + stack_t *th; + if (!g_stacktop) return; + th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize); + lstrcpyn(th->text,str,g_stringsize); + th->next=*g_stacktop; + *g_stacktop=th; +} \ No newline at end of file diff --git a/Contrib/Dialer/dialer.dsp b/Contrib/Dialer/dialer.dsp new file mode 100644 index 00000000..24e298bd --- /dev/null +++ b/Contrib/Dialer/dialer.dsp @@ -0,0 +1,108 @@ +# Microsoft Developer Studio Project File - Name="dialer" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=dialer - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "dialer.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dialer.mak" CFG="dialer - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dialer - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "dialer - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dialer - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "dialer_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "dialer_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wininet.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"..\..\Plugins\Dialer.dll" /opt:nowin98 +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "dialer - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "dialer_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "dialer_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "dialer - Win32 Release" +# Name "dialer - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\dialer.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/Contrib/Dialer/dialer.dsw b/Contrib/Dialer/dialer.dsw new file mode 100644 index 00000000..dad04214 --- /dev/null +++ b/Contrib/Dialer/dialer.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "dialer"=.\dialer.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Plugins/Dialer.dll b/Plugins/Dialer.dll new file mode 100644 index 0000000000000000000000000000000000000000..7656b3655fb7056acdae4e595ea5096e1a495ec1 GIT binary patch literal 2560 zcmeHIT}TvB6h5n~Zneq=8U|UjwM7IicM`!MW4CrP%hXb{Lc?))bl1iinY{}YLV*a` zq6Co-;X@+QOAir3*3(u55eQK)Jw*|PR73>PL(p{Yot<6(^CjrP!<>80`OeQh=gx5F z*qLjP3jj`J(*&48$tb|r<(C)eF52?22qxD|d#4<=)83|NEH3mKdY2*h2w_>%bSiWx zf|1aKm?nhk8-*S{qWB97*ZR_>Hy*5i+P2j@V)L6_eIuv1EsQjyyq#Y)(#qxLwA{qy ziC8$wa^`o~AOX}moZxuhxZn1@g(B}dM*%<%BKc|5gOahpZ4cMc&(497EukT6uymfp z@>l|wmI!zO?jsry0QNEWQWOAaUCOr{F4(Ou9^|LWd5W%E4qRAYtl7*Es3Qpg?S3O7 zQyJhVi$h?}nV`uifREn_vqmHwUa(+X%5NyD9tOC|ya@1mE@osY0B|5{t!n?%36!S- zkKNE;1q5F;-8<$)d9pv{YUmD_CHR4O%nAl2znRqM9y;V~FiV_>j%Wt zSc%8sionCHh1Ej4Zx*(L)t+Uem7%}wEklh)6+=^KFhTW5Ojhv%%VLx&J-zgxu4zgb zufEF}PqkvBN~Dp>RDp2DXIDBbYh8(6fR>uNnmVb;A5m3!kgLY25$?U91>visTGcyb zHK?-d?WlC3PO2^6!^1ND+lu|Kxrwtn5X?(+6zx9bYsjzgPHtNdP=j(9c?0Sbh)*Iv zL4Jw+0hv|E!9TJSLO8Et@EwD5N1Zo=ZPr__$Tpib8Pl|g5`l#W!Zxx9dtv`07x9oX zvW=9JN)jY>q=mGT9ug;gq@P?Tqhx~IBU9uNc}8B7cjOcKL4FaZxK1n+w~M>Q3Na`i b5s!-<;yICum&5^aSiB+HTdd0e_XPd`W6nyu literal 0 HcmV?d00001