-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 151d073
Showing
15 changed files
with
358 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Release/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "fasmg"] | ||
path = fasmg | ||
url = https://github.com/tgrysztar/fasmg | ||
[submodule "fasmgP"] | ||
path = fasmgP | ||
url = https://github.com/ScriptTiger/fasmgP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@echo off | ||
set include=include;fasmgP;fasmg\packages\x86\include; | ||
if not exist Release md Release | ||
set app=TinyWinDL | ||
|
||
set variant=386 | ||
call :Build | ||
|
||
set variant=386_micro | ||
call :Build | ||
|
||
set variant=amd64 | ||
call :Build | ||
|
||
set variant=amd64_micro | ||
call :Build | ||
|
||
pause | ||
exit /b | ||
|
||
:Build | ||
call fasmg\core\fasmg.exe -e65535 %app%_%variant%.asm Release\%app%_%variant%.exe | ||
exit /b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 ScriptTiger | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/thescripttiger%40gmail.com) | ||
|
||
# TinyWinDL | ||
This is a trivial downloader for Windows which is basically just a wrapper for `URLDownloadToFileA`. Being a trivial downloader, it does not attempt to recover from an error nor does it follow dynamic links, so all links should be static. Use cases for TinyWinDL are trivial files, such as small files storing non-critical settings or configurations, which are synchronized regularly and missing a synchronization here or there is not important. | ||
|
||
Usage: `TinyWinDL <url> <file>` | ||
|
||
If no arguments, case-sensitive environmental variables used: | ||
|
||
twdl_url | ||
twdl_file | ||
|
||
If environmental variables not set, input will be prompted interactively. | ||
|
||
**Dependencies** | ||
If you are trying to build TinyWinDL yourself, the fasmg and fasmgP submodules may not be cloned as default behavior, depending on what git software you are using. | ||
|
||
fasmg: | ||
https://github.com/tgrysztar/fasmg | ||
|
||
fasmgP: | ||
https://github.com/ScriptTiger/fasmgP | ||
|
||
**TinyWinDL_386** | ||
32-bit TinyWinDL. | ||
|
||
**TinyWinDL_386_micro** | ||
32-bit TinyWinDL condensed into a single code section. | ||
|
||
**TinyWinDL_amd64** | ||
64-bit TinyWinDL. | ||
|
||
**TinyWinDL_amd64_micro** | ||
64-bit TinyWinDL condensed into a single code section. | ||
|
||
# More About ScriptTiger | ||
|
||
For more ScriptTiger scripts and goodies, check out ScriptTiger's GitHub Pages website: | ||
https://scripttiger.github.io/ | ||
|
||
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MZ4FH4G5XHGZ4) | ||
|
||
Donate Monero (XMR): 441LBeQpcSbC1kgangHYkW8Tzo8cunWvtVK4M6QYMcAjdkMmfwe8XzDJr1c4kbLLn3NuZKxzpLTVsgFd7Jh28qipR5rXAjx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
format pe console | ||
entry main | ||
|
||
OFN equ "TinyWinDL_386.exe" | ||
VERSION equ "1.0.0.0" | ||
|
||
include "win32axp.inc" | ||
include "gP_win32.inc" | ||
|
||
section ".idata"import\ | ||
data\ | ||
readable | ||
|
||
include ".idata.inc" | ||
|
||
section ".text" code\ | ||
executable | ||
|
||
include ".text.inc" | ||
|
||
section ".data."writeable | ||
|
||
include ".data.inc" | ||
|
||
section ".rsrc" data\ | ||
resource\ | ||
readable | ||
|
||
include ".rsrc.inc" | ||
|
||
section ".bss" writeable | ||
|
||
include ".bss.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
format pe console | ||
entry main | ||
|
||
include "win32axp.inc" | ||
include "gP_win32.inc" | ||
|
||
section "" data\ | ||
readable\ | ||
writeable\ | ||
import\ | ||
code\ | ||
executable | ||
|
||
include ".idata.inc" | ||
include ".text.inc" | ||
include ".data.inc" | ||
include ".bss.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
format pe64 console | ||
entry main | ||
|
||
OFN equ "TinyWinDL_amd64.exe" | ||
VERSION equ "1.0.0.0" | ||
|
||
include "win64axp.inc" | ||
include "gP_win64.inc" | ||
|
||
section ".idata"import\ | ||
data\ | ||
readable | ||
|
||
include ".idata.inc" | ||
|
||
section ".text" code\ | ||
executable | ||
|
||
include ".text.inc" | ||
|
||
section ".data."writeable | ||
|
||
include ".data.inc" | ||
|
||
section ".rsrc" data\ | ||
resource\ | ||
readable | ||
|
||
include ".rsrc.inc" | ||
|
||
section ".bss" writeable | ||
|
||
include ".bss.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
format pe64 console | ||
entry main | ||
|
||
include "win64axp.inc" | ||
include "gP_win64.inc" | ||
|
||
section "" data\ | ||
readable\ | ||
writeable\ | ||
import\ | ||
code\ | ||
executable | ||
|
||
include ".idata.inc" | ||
include ".text.inc" | ||
include ".data.inc" | ||
include ".bss.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
srcURL RH 1 | ||
dstFile RH 1 | ||
|
||
common_reservations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
hlpStrs db "/?",0,\ | ||
"-?",0,\ | ||
"/help",0,\ | ||
"-help",0,\ | ||
"--help",0,\ | ||
0 | ||
usage db "Usage: TinyWinDL <url> <file>",13,10,\ | ||
" If no arguments, case-sensitive environmental variables used:",13,10,13,10,\ | ||
" twdl_url",13,10,\ | ||
" twdl_file",13,10,13,10,\ | ||
" If environmental variables not set, input will be prompted interactively.",13,10,\ | ||
0 | ||
urlenv db "twdl_url",0 | ||
fileenv db "twdl_file",0 | ||
askURL db "URL:",13,10,0 | ||
askFile db "File:",13,10,0 | ||
dl1 db "Downloading ",0 | ||
dl2 db " to ",0 | ||
dl3 db "...",13,10,0 | ||
done db "Download complete",13,10,0 | ||
|
||
common_definitions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
directory RT_VERSION,versions | ||
|
||
resource versions,\ | ||
1,1033,version | ||
|
||
versioninfo version,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,\ | ||
"FileDescription","TinyWinDL",\ | ||
"ProductName","TinyWinDL",\ | ||
"LegalCopyright",<"Copyright ",0A9h," 2022 ScriptTiger">,\ | ||
"FileVersion",VERSION,\ | ||
"ProductVersion",VERSION,\ | ||
"OriginalFilename",OFN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
main: | ||
|
||
os.Entry | ||
|
||
;Clear HBX and use to determine interactive or unattended mode | ||
xor HBX,HBX | ||
|
||
cmp [os.Argc],2 | ||
jl .geturlenv | ||
mov HDI,[os.Argv] | ||
xor al,al | ||
call strings.NxtB | ||
mov HSI,hlpStrs | ||
mov HDX,HAX | ||
mov HDI,HAX | ||
xor cl,cl | ||
.helpStr: | ||
call strings.CmpB | ||
cmp HAX,0 | ||
je .help | ||
xor al,al | ||
mov HDI,HSI | ||
call strings.NxtB | ||
cmp byte[HAX],0 | ||
je .geturl | ||
mov HSI,HAX | ||
mov HDI,HDX | ||
jmp .helpStr | ||
|
||
.help: | ||
mov HSI,usage | ||
call os.Cout | ||
jmp .exit | ||
|
||
.geturl: | ||
mov [srcURL],HDI | ||
inc HBX | ||
jmp .getfile | ||
|
||
.geturlenv: | ||
mov HSI,urlenv | ||
call os.GetEnv | ||
cmp HAX,0 | ||
je .prompturl | ||
mov [srcURL],HAX | ||
inc HBX | ||
jmp .getfile | ||
|
||
.prompturl: | ||
mov HSI,askURL | ||
call os.Cout | ||
mov HDI,srcURL | ||
mov HCX,1 | ||
mov HDX,BUFCAP | ||
call os.Cin | ||
|
||
.getfile: | ||
cmp [os.Argc],3 | ||
jl .getfileenv | ||
mov HDI,[os.Argv] | ||
xor al,al | ||
mov HCX,2 | ||
call strings.NB | ||
mov [dstFile],HAX | ||
inc HBX | ||
jmp .download | ||
|
||
.getfileenv: | ||
mov HSI,fileenv | ||
call os.GetEnv | ||
cmp HAX,0 | ||
je .promptfile | ||
mov [dstFile],HAX | ||
inc HBX | ||
jmp .download | ||
|
||
.promptfile: | ||
mov HSI,askFile | ||
call os.Cout | ||
mov HDI,dstFile | ||
mov HCX,1 | ||
mov HDX,BUFCAP | ||
call os.Cin | ||
|
||
.download: | ||
|
||
;Prompt that the download is in progress | ||
mov HSI,dl1 | ||
call os.Cout | ||
mov HSI,[srcURL] | ||
call os.Cout | ||
mov HSI,dl2 | ||
call os.Cout | ||
mov HSI,[dstFile] | ||
call os.Cout | ||
mov HSI,dl3 | ||
call os.Cout | ||
|
||
;Download URL to file | ||
push 0 | ||
invoke URLDownloadToFile,\ | ||
0,\ | ||
[srcURL],\ | ||
[dstFile],\ | ||
0 | ||
|
||
;Free heap allocations now, rather than waiting for os.Exit to do it automatically | ||
call asto.Flush | ||
|
||
;Prompt that download complete | ||
mov HSI,done | ||
call os.Cout | ||
|
||
;Pause before exiting if in interactive mode | ||
cmp HBX,2 | ||
je .exit | ||
call libc.Pause | ||
|
||
;Standard exit without errors, setting exit code to 0 | ||
.exit: | ||
xor HCX,HCX | ||
;If errors, set exit code and jmp os.Exit | ||
os.Exit |