this...looks promising :DDDDD

pull/36/head
despair 6 years ago
parent 186e2ea989
commit 45f46fbece

@ -484,16 +484,18 @@ struct llarp_win32_loop : public llarp_ev_loop
bool bool
add_ev(llarp::ev_io* ev, bool write) add_ev(llarp::ev_io* ev, bool write)
{ {
uint8_t buf[1024];
llarp::tun* t = nullptr;
ev->listener_id = reinterpret_cast< ULONG_PTR >(ev); ev->listener_id = reinterpret_cast< ULONG_PTR >(ev);
memset(&buf, 0, 1024);
// if the write flag was set earlier, // if the write flag was set earlier,
// clear it on demand // clear it on demand
if(ev->write && !write) if(ev->write && !write)
ev->write = false; ev->write = false;
if(write)
ev->write = true;
// now write a blank packet containing nothing but the address of
// the event listener
if(ev->isTCP) if(ev->isTCP)
{ {
if(!::CreateIoCompletionPort((HANDLE)std::get< SOCKET >(ev->fd), iocpfd, if(!::CreateIoCompletionPort((HANDLE)std::get< SOCKET >(ev->fd), iocpfd,
@ -502,56 +504,31 @@ struct llarp_win32_loop : public llarp_ev_loop
delete ev; delete ev;
return false; return false;
} }
if(write)
{
::WriteFile((HANDLE)std::get< SOCKET >(ev->fd), &buf, 1024, nullptr,
&ev->portfd[1]);
ev->write = true;
}
else else
::ReadFile((HANDLE)std::get< SOCKET >(ev->fd), &buf, 1024, nullptr, goto start_loop;
&ev->portfd[0]);
handlers.emplace_back(ev);
return true;
} }
if(std::holds_alternative< SOCKET >(ev->fd)) if(std::holds_alternative< SOCKET >(ev->fd))
{ {
if(!::CreateIoCompletionPort((HANDLE)std::get< 0 >(ev->fd), iocpfd, if(!::CreateIoCompletionPort((HANDLE)std::get< SOCKET >(ev->fd), iocpfd,
ev->listener_id, 0)) ev->listener_id, 0))
{ {
delete ev; delete ev;
return false; return false;
} }
if(write)
{
::WriteFile((HANDLE)std::get< 0 >(ev->fd), &buf, 1024, nullptr,
&ev->portfd[1]);
ev->write = true;
}
else
::ReadFile((HANDLE)std::get< 0 >(ev->fd), &buf, 1024, nullptr,
&ev->portfd[0]);
} }
else else
{ {
t = dynamic_cast< llarp::tun* >(ev); if(!::CreateIoCompletionPort(std::get< HANDLE >(ev->fd), iocpfd,
if(!::CreateIoCompletionPort(std::get< 1 >(ev->fd), iocpfd,
ev->listener_id, 0)) ev->listener_id, 0))
{ {
delete ev; delete ev;
return false; return false;
} }
if(write)
{
::WriteFile(std::get< 1 >(ev->fd), &buf, 1024, nullptr,
t->tun_async[1]);
ev->write = true;
}
else
::ReadFile(std::get< 1 >(ev->fd), &buf, 1024, nullptr, t->tun_async[0]);
} }
start_loop:
PostQueuedCompletionStatus(iocpfd, 0, ev->listener_id, nullptr);
handlers.emplace_back(ev); handlers.emplace_back(ev);
return true; return true;
} }

@ -7,14 +7,10 @@
#define MyAppURL "https://loki.network" #define MyAppURL "https://loki.network"
#define MyAppExeName "lokinet.exe" #define MyAppExeName "lokinet.exe"
; change this to avoid compiler errors -despair ; change this to avoid compiler errors -despair
#define DevPath "D:\dev\external\llarpd-builder\" #define DevPath "D:\dev\external\llarp\"
#include <idp.iss> #include <idp.iss>
; inno setup script ©2018 rick v for loki project ; see ../LICENSE
; all rights reserved? not sure which licence we're
; under. lokinet appears to be under the zlib licence
; unless we've pivoted to the GPL for whatever reason.
; -despair
[Setup] [Setup]
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
@ -31,22 +27,21 @@ AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName} DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName} DefaultGroupName={#MyAppName}
AllowNoIcons=yes AllowNoIcons=yes
LicenseFile={#DevPath}deps\llarp\LICENSE LicenseFile={#DevPath}LICENSE
OutputDir={#DevPath}win32-setup OutputDir={#DevPath}win32-setup
OutputBaseFilename=lokinet-win32 OutputBaseFilename=lokinet-win32
Compression=lzma Compression=lzma
SolidCompression=yes SolidCompression=yes
VersionInfoVersion=0.0.3 VersionInfoVersion=0.3.0
VersionInfoCompany=Loki Project VersionInfoCompany=Loki Project
VersionInfoDescription=lokinet installer for win32 VersionInfoDescription=lokinet installer for win32
VersionInfoTextVersion=0.0.3 VersionInfoTextVersion=0.3.0
VersionInfoProductName=loki-network VersionInfoProductName=loki-network
VersionInfoProductVersion=0.0.3 VersionInfoProductVersion=0.3.0
VersionInfoProductTextVersion=0.0.3 VersionInfoProductTextVersion=0.3.0
InternalCompressLevel=ultra64 InternalCompressLevel=ultra64
MinVersion=0,5.0 MinVersion=0,5.0
; uncomment if you are shipping the 64-bit build ArchitecturesInstallIn64BitMode=x64
;ArchitecturesInstallIn64BitMode=x64
VersionInfoCopyright=Copyright ©2018 Loki Project VersionInfoCopyright=Copyright ©2018 Loki Project
[Languages] [Languages]
@ -55,54 +50,56 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks] [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1 Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files] [Files]
; we're grabbing the builds from jenkins-ci now, which are fully linked ; we're grabbing the builds from jenkins-ci now, which are fully linked
Source: "{#DevPath}build\lokinet.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#DevPath}build\lokinet.exe"; DestDir: "{app}"; Flags: ignoreversion 32bit
Source: "{#DevPath}build\dns.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#DevPath}build\lokinet64.exe"; DestDir: "{app}"; Flags: ignoreversion 64bit
Source: "{#DevPath}build\llarpc.exe"; DestDir: "{app}"; Flags: ignoreversion ; eh, might as well ship the 32-bit port of everything else
Source: "{#DevPath}build\rcutil.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#DevPath}build\dns.exe"; DestDir: "{app}"; Flags: ignoreversion
; delet this after finishing setup, we only need it to extract the drivers Source: "{#DevPath}build\llarpc.exe"; DestDir: "{app}"; Flags: ignoreversion
; and download an initial RC Source: "{#DevPath}build\rcutil.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#DevPath}lokinet-bootstrap.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall ; delet this after finishing setup, we only need it to extract the drivers
Source: "{#DevPath}win32-setup\7z.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall ; and download an initial RC
; Copy the correct tuntap driver for the selected platform Source: "{#DevPath}lokinet-bootstrap.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "{tmp}\tuntapv9.7z"; DestDir: "{app}"; Flags: ignoreversion external; OnlyBelowVersion: 0, 6.0 Source: "{#DevPath}win32-setup\7z.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "{tmp}\tuntapv9_n6.7z"; DestDir: "{app}"; Flags: ignoreversion external; MinVersion: 0,6.0 Source: "{tmp}\inet6.7z"; DestDir: "{app}"; Flags: ignoreversion external deleteafterinstall; MinVersion: 0,5.0; OnlyBelowVersion: 0, 6.0
; Copy the correct tuntap driver for the selected platform
; NOTE: Don't use "Flags: ignoreversion" on any shared system files Source: "{tmp}\tuntapv9.7z"; DestDir: "{app}"; Flags: ignoreversion external; OnlyBelowVersion: 0, 6.0
Source: "{tmp}\tuntapv9_n6.7z"; DestDir: "{app}"; Flags: ignoreversion external; MinVersion: 0,6.0
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[UninstallDelete] [UninstallDelete]
Type: filesandordirs; Name: "{app}\tap-windows*" Type: filesandordirs; Name: "{app}\tap-windows*"
[UninstallRun] [UninstallRun]
Filename: "{app}\tap-windows-9.21.2\remove.bat"; WorkingDir: "{app}\tap-windows-9.21.2"; MinVersion: 0,6.0; Flags: runascurrentuser Filename: "{app}\tap-windows-9.21.2\remove.bat"; WorkingDir: "{app}\tap-windows-9.21.2"; MinVersion: 0,6.0; Flags: runascurrentuser
Filename: "{app}\tap-windows-9.9.2\remove.bat"; WorkingDir: "{app}\tap-windows-9.9.2"; OnlyBelowVersion: 0,6.0; Flags: runascurrentuser Filename: "{app}\tap-windows-9.9.2\remove.bat"; WorkingDir: "{app}\tap-windows-9.9.2"; OnlyBelowVersion: 0,6.0; Flags: runascurrentuser
[Code] [Code]
procedure InitializeWizard(); procedure InitializeWizard();
var var
Version: TWindowsVersion; Version: TWindowsVersion;
S: String; S: String;
begin begin
GetWindowsVersionEx(Version); GetWindowsVersionEx(Version);
if Version.NTPlatform and if Version.NTPlatform and
(Version.Major < 6) and (Version.Major < 6) then
(Version.Minor = 0) then begin
begin // Windows 2000, XP, .NET Svr 2003
// Windows 2000, XP, .NET Svr 2003 // these have a horribly crippled WinInet that issues Triple-DES as its most secure
// these have a horribly crippled WinInet that issues Triple-DES as its most secure // cipher suite
// cipher suite idpAddFile('http://www.rvx86.net/files/tuntapv9.7z', ExpandConstant('{tmp}\tuntapv9.7z'));
idpAddFile('http://www.rvx86.net/files/tuntapv9.7z', ExpandConstant('{tmp}\tuntapv9.7z')); end
end else
else begin
begin // current versions of windows :-)
// current versions of windows :-) idpAddFile('https://github.com/despair86/loki-network/raw/master/contrib/tuntapv9-ndis/tap-windows-9.21.2.7z', ExpandConstant('{tmp}\tuntapv9_n6.7z'));
idpAddFile('https://github.com/despair86/lokinet-builder/raw/master/contrib/tuntapv9-ndis/tap-windows-9.21.2.7z', ExpandConstant('{tmp}\tuntapv9_n6.7z')); end;
end; idpDownloadAfter(wpReady);
idpDownloadAfter(wpReady); end;
end;
[Icons] [Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"

Loading…
Cancel
Save