docs4you commited on
Commit
27867f1
·
verified ·
1 Parent(s): 3e77b56

Upload 487 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .dockerignore +7 -0
  2. .gitattributes +19 -0
  3. .github/stale.yml +20 -0
  4. .github/workflows/docker-image.yml +62 -0
  5. .gitignore +30 -0
  6. CHANGELOG.md +100 -0
  7. CONTRIBUTING.md +33 -0
  8. Docker_entrypoint.sh +38 -0
  9. Dockerfile +14 -0
  10. Dockerfile_tvh_crypt.alpine +16 -0
  11. Dockerfile_tvh_crypt.slim-buster +32 -0
  12. LICENSE +21 -0
  13. README.md +147 -10
  14. TVHEADEND.md +32 -0
  15. build/WINDOWS/Base64.nsh +292 -0
  16. build/WINDOWS/CharToASCII.nsh +28 -0
  17. build/WINDOWS/Plugins/SimpleSC/License.txt +27 -0
  18. build/WINDOWS/Plugins/SimpleSC/Readme.txt +335 -0
  19. build/WINDOWS/Plugins/SimpleSC/SimpleSC.dll +0 -0
  20. build/WINDOWS/Plugins/inetc/Contrib/Inetc/afxres.h +2 -0
  21. build/WINDOWS/Plugins/inetc/Contrib/Inetc/api.h +83 -0
  22. build/WINDOWS/Plugins/inetc/Contrib/Inetc/crt.cpp +105 -0
  23. build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.cpp +1746 -0
  24. build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.rc +199 -0
  25. build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.sln +42 -0
  26. build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.vcxproj +441 -0
  27. build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.vcxproj.filters +52 -0
  28. build/WINDOWS/Plugins/inetc/Contrib/Inetc/nsis_tchar.h +229 -0
  29. build/WINDOWS/Plugins/inetc/Contrib/Inetc/pluginapi.c +294 -0
  30. build/WINDOWS/Plugins/inetc/Contrib/Inetc/pluginapi.h +104 -0
  31. build/WINDOWS/Plugins/inetc/Contrib/Inetc/resource.h +47 -0
  32. build/WINDOWS/Plugins/inetc/Docs/Inetc/Readme.htm +153 -0
  33. build/WINDOWS/Plugins/inetc/Docs/Inetc/wiki.txt +161 -0
  34. build/WINDOWS/Plugins/inetc/Examples/Inetc/Example.nsi +54 -0
  35. build/WINDOWS/Plugins/inetc/Examples/Inetc/auth_dlg.nsi +32 -0
  36. build/WINDOWS/Plugins/inetc/Examples/Inetc/ftp_auth.nsi +32 -0
  37. build/WINDOWS/Plugins/inetc/Examples/Inetc/head.nsi +30 -0
  38. build/WINDOWS/Plugins/inetc/Examples/Inetc/headers.nsi +32 -0
  39. build/WINDOWS/Plugins/inetc/Examples/Inetc/headers.php +7 -0
  40. build/WINDOWS/Plugins/inetc/Examples/Inetc/https.nsi +27 -0
  41. build/WINDOWS/Plugins/inetc/Examples/Inetc/inetc_local.nsi +81 -0
  42. build/WINDOWS/Plugins/inetc/Examples/Inetc/post.nsi +31 -0
  43. build/WINDOWS/Plugins/inetc/Examples/Inetc/post.php +13 -0
  44. build/WINDOWS/Plugins/inetc/Examples/Inetc/post_file.nsi +31 -0
  45. build/WINDOWS/Plugins/inetc/Examples/Inetc/post_file.php +10 -0
  46. build/WINDOWS/Plugins/inetc/Examples/Inetc/post_form.html +18 -0
  47. build/WINDOWS/Plugins/inetc/Examples/Inetc/put.nsi +31 -0
  48. build/WINDOWS/Plugins/inetc/Examples/Inetc/put.php +19 -0
  49. build/WINDOWS/Plugins/inetc/Examples/Inetc/recursive.nsi +65 -0
  50. build/WINDOWS/Plugins/inetc/Examples/Inetc/redirect.nsi +31 -0
.dockerignore ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ *
2
+ !*.py
3
+ !lib
4
+ !plugins
5
+ !requirements.txt
6
+ !Docker_entrypoint.sh
7
+ !LICENSE
.gitattributes CHANGED
@@ -33,3 +33,22 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ lib/tvheadend/service/Windows/nssm.exe filter=lfs diff=lfs merge=lfs -text
37
+ lib/web/htdocs/modules/fonts/material-icons/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 filter=lfs diff=lfs merge=lfs -text
38
+ lib/web/htdocs/modules/fonts/material-icons/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmJ_1.woff filter=lfs diff=lfs merge=lfs -text
39
+ lib/web/htdocs/modules/fonts/subfont.woff2 filter=lfs diff=lfs merge=lfs -text
40
+ lib/web/htdocs/modules/themes/appletv/atv1-1080.png filter=lfs diff=lfs merge=lfs -text
41
+ lib/web/htdocs/modules/themes/blueradiance/bg.jpg filter=lfs diff=lfs merge=lfs -text
42
+ lib/web/htdocs/modules/themes/halloween/bg.jpg filter=lfs diff=lfs merge=lfs -text
43
+ lib/web/htdocs/modules/themes/holiday/bg.jpg filter=lfs diff=lfs merge=lfs -text
44
+ lib/web/htdocs/modules/themes/holiday/bg1.jpg filter=lfs diff=lfs merge=lfs -text
45
+ lib/web/htdocs/modules/themes/holiday/bg2.jpg filter=lfs diff=lfs merge=lfs -text
46
+ lib/web/htdocs/modules/themes/holiday/bg3.jpg filter=lfs diff=lfs merge=lfs -text
47
+ lib/web/htdocs/modules/themes/holiday/bg4.jpg filter=lfs diff=lfs merge=lfs -text
48
+ lib/web/htdocs/modules/themes/holiday/drawer.jpg filter=lfs diff=lfs merge=lfs -text
49
+ lib/web/htdocs/modules/themes/spring/bg.jpg filter=lfs diff=lfs merge=lfs -text
50
+ lib/web/htdocs/modules/themes/spring/bg1.jpg filter=lfs diff=lfs merge=lfs -text
51
+ lib/web/htdocs/modules/themes/spring/bg2.jpg filter=lfs diff=lfs merge=lfs -text
52
+ lib/web/htdocs/modules/themes/spring/bg3.jpg filter=lfs diff=lfs merge=lfs -text
53
+ lib/web/htdocs/modules/themes/spring/bg4.jpg filter=lfs diff=lfs merge=lfs -text
54
+ lib/web/htdocs/modules/themes/spring/bg5.jpg filter=lfs diff=lfs merge=lfs -text
.github/stale.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 14
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - bug
8
+ - documentation
9
+ - enhancement
10
+ - pinned
11
+ - security
12
+ # Label to use when marking an issue as stale
13
+ staleLabel: inactive
14
+ # Comment to post when marking an issue as stale. Set to `false` to disable
15
+ markComment: >
16
+ This issue has been automatically marked as stale because it has not had
17
+ recent activity. It will be closed if no further activity occurs. Thank you
18
+ for your contributions.
19
+ # Comment to post when closing a stale issue. Set to `false` to disable
20
+ closeComment: false
.github/workflows/docker-image.yml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build & Push Cabernet
2
+
3
+ on:
4
+ push:
5
+ # Publish `master` as Docker `latest` image.
6
+ branches:
7
+ - master
8
+ - dev
9
+
10
+ # Publish `v1.2.3` tags as releases.
11
+ tags:
12
+ - v*
13
+
14
+ # Run tests for any PRs.
15
+ pull_request:
16
+
17
+ jobs:
18
+ # Push image to GitHub Packages.
19
+ # See also https://docs.docker.com/docker-hub/builds/
20
+ docker-image:
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ packages: write
24
+ contents: read
25
+
26
+ steps:
27
+ - name: Checkout
28
+ uses: actions/checkout@v4
29
+
30
+ - name: Set up QEMU
31
+ uses: docker/setup-qemu-action@v3
32
+
33
+ - name: Set up Docker Buildx
34
+ uses: docker/setup-buildx-action@v3
35
+
36
+ - name: Docker meta
37
+ id: meta
38
+ uses: docker/metadata-action@v5
39
+ with:
40
+ images: ghcr.io/${{ github.repository }}
41
+ tags: |
42
+ type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
43
+ type=ref,event=branch
44
+ type=semver,pattern={{version}}
45
+ type=ref,event=pr
46
+
47
+ - name: Login to GHCR
48
+ if: github.event_name != 'pull_request'
49
+ uses: docker/login-action@v1
50
+ with:
51
+ registry: ghcr.io
52
+ username: ${{ github.repository_owner }}
53
+ password: ${{ secrets.GITHUB_TOKEN }}
54
+
55
+ - name: Build and push
56
+ uses: docker/build-push-action@v5
57
+ with:
58
+ context: .
59
+ platforms: linux/amd64,linux/arm64
60
+ push: ${{ github.event_name != 'pull_request' }}
61
+ tags: ${{ steps.meta.outputs.tags }}
62
+ labels: ${{ steps.meta.outputs.labels }}
.gitignore ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ debug.bat
2
+ locastChannels.m3u8
3
+ redebug.bat
4
+ telly.exe
5
+ config_all.ini
6
+ config.ini
7
+ nbstreamreader.pyc
8
+ secret_notes.txt
9
+ SECRETS.txt
10
+ .vscode
11
+ service_uuid
12
+ TODO.md
13
+ *.pyc
14
+ config_future.ini
15
+ dev/
16
+ data/
17
+ cache/
18
+ plugins_ext/
19
+ *.ts
20
+ lib/tvheadend/development/
21
+ lib/web/htdocs/temp/*
22
+ !lib/web/htdocs/temp/__init__.py
23
+ build/*/cabernet*.exe
24
+ ffmpeg/
25
+ misc/
26
+ #IntelliJ
27
+ .idea/
28
+ cabernet.iml
29
+ test*
30
+ /lib/tvheadend/htdocs/Netbeans/nbproject/private/
CHANGELOG.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CHANGELOG
2
+
3
+ ## FUTURE (may or may not be implemented):
4
+ - Reorganize config.ini file
5
+ - Start using pip for third-party plugins
6
+ - Rename `plex_accessible_ip`/`plex_accessible_port` to `advertise_ip`/`advertise_port`. Add `bind_ip`/`bind_port` options (https://github.com/tgorgdotcom/locast2plex/pull/98)
7
+ - Hopefully phase out FCC channel checking (when locast reports proper channel numbers)
8
+ - Install script for those not using docker
9
+ - Enable multiplatform Docker image
10
+ - Wrap HTTP requests around error handling that existed in do_tuner() previously
11
+ - Documentation added for Kodi, Emby/Jellyfin
12
+ - Implement proper logging
13
+ - Some kind of web based UI to modify config
14
+ - Look into pull requests suggestions for ip addressing
15
+ - A way to daemonize the script for those running outside of docker
16
+
17
+ ## 1.0.0 (unreleased)
18
+ - Most bugs squashed
19
+
20
+ ## 0.6.3
21
+ - Add error handling for when a channel in the EPG exists that does not exist in the channel list
22
+
23
+ ## 0.6.2
24
+ - Fix an issue where logins fail when passwords with a '%' are used
25
+
26
+ ## 0.6.1
27
+ - Create dev branch, add contributing docs to mention dev branch
28
+ - rename master branch to main branch
29
+ - moved most SSDP messages to show when new config option `verbose` is set to true
30
+ - potential fix for error in getting fcc database
31
+ - fixed a bug in deleting stale cache EPG data
32
+
33
+ ## 0.6.0
34
+ - Reorganized codebase for better modularity (@deathbybandaid)
35
+ - Included all DMA codes so we don't have to update whenever locast rolls out to a new market (@deathbybandaid)
36
+ - Added automatic pulling from FCC database (@deathbybandaid)
37
+ - Added m3u/xmltv playlist endpoint (for Emby, Kodi etc.) (with help from @deathbybandaid)
38
+ - Fixes to resolve legal complaints and...
39
+ - ...uses a new way to connect to Plex
40
+ - Some fixes for SSDP, may start working for applicable systems
41
+ - Added ability to disable SSDP using config.ini
42
+ - Fixes issue with query string in GET requests to the tuner
43
+ - Made sure all errors return nonzero
44
+
45
+ ## 0.5.3-hotfix
46
+ - Switch to Python 3 (Thanks @ratherDashing! & @deathbybandaid)
47
+ - Fix to resolve Locast auth issues
48
+
49
+ ## 0.5.3
50
+ - Scripts are now fully linted (Thanks @deathbybandaid!)
51
+ - Updated Readme for spelling/clarity/credits (Thanks @tri-ler and @gogorichie!)
52
+ - Added ability to place config in /app/config folder for Kubernetes users (Thanks @dcd!)
53
+ - Added Detroit DMA support (Thanks @precision!)
54
+ - Fix tuner count comparison (Thanks @ratherDashing!)
55
+ - Refactored geolocation to mirror Locast methods (Thanks @FozzieBear!)
56
+ - Added new contributing document and added unreleased section in changelog
57
+ - Changed some var names for clarity.
58
+ - Fixed a bug where users running on bare command line/terminal could not set their ports. (Thanks @teconmoon)
59
+ - Removed some old stuff in Dockerfile that are confusing users
60
+
61
+ ## 0.5.2
62
+ - Fixed a bug that prevented the success message from showing
63
+
64
+ ## 0.5.1
65
+ - Added success message at the end to indicate successful running
66
+ - Fixed bug in docker-compose.yml
67
+ - Updated readme for better clarity
68
+
69
+ ## 0.5.0
70
+ - Migrated environment settings to ini file -- should fix issues with special
71
+ characters in username/password, security concerns (thanks for the suggestion
72
+ @jcastilloalonso), as well as allowing to tweak internal settings without
73
+ resorting to modifying code.
74
+ - Added ffmpeg.exe for Windows users
75
+ - Merge fix to end ffmpeg zombie processes (thanks @FozzieBear!)
76
+ - Add MINNEAPOLIS-ST. PAUL (thanks @steventwheeler!)
77
+ - Fix for channel detection on subchannels ending in zero.
78
+
79
+ ## 0.4.2
80
+ - Enabled Miami and West Palm Beach markets
81
+ - Fixed issue #10: renamed "docker-compose.env" to ".env"
82
+
83
+ ## 0.4.1
84
+ - Added support for Tampa market
85
+ - Updated Changelog
86
+
87
+ ## 0.4.0
88
+ - Fixed a bug in docker-compose.yml
89
+ - Fixed channels that only have one low resolution stream
90
+ - Overhauled channel detection and interpolation
91
+ - Reorganized api research notes to it's own folder
92
+
93
+ ## 0.3.1
94
+ - Fix bugs in callsign detection
95
+ - More doc changes
96
+
97
+ ## 0.3.0
98
+ - Created changelog!
99
+ - Remove telly dependency and doing the managing of streams and requests all by ourselves.
100
+ - Proper channel/subchannel applied to lineup
CONTRIBUTING.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Hello all. For those of you who wish to contribute code, here's a few things to
2
+ take note of:
3
+
4
+ ## Project Goal
5
+ To allow Locast to be used in Plex (and possibly other media servers), for the
6
+ express purpose of serving those who want another way to access broadcast TV in
7
+ their service area. We will aim to be a good steward of the Locast terms of service.
8
+
9
+ ## Coding style/linting
10
+ For the most part we lint against PEP 8 and pyflakes, with exceptions
11
+ for rules E303, E501, W504, W605. I will be pretty lenient in taking pull requests,
12
+ so don't worry if you're not already familiar with linting. A good primer
13
+ on [linting in Python is here](https://realpython.com/python-code-quality/)'
14
+
15
+ Aligning with the PEP 8, we use the following naming formats:
16
+ - Classnames: CapWords
17
+ - Methods/Properties: snake_case
18
+ - File names/Package names: snake_case
19
+ - Function/Variable Names: snake_case
20
+
21
+
22
+ ## Versioning Scheme
23
+ We use the Semantic versioning scheme, with the following naming conventions for non-stable
24
+ releases:
25
+ - The 0.x series is beta
26
+ - Releases marked `-alpha` or `-beta` at the end of the version number. An additional number,
27
+ starting from 1, is added after this postfix to separate different version numbers.
28
+ Example: `2.0.0-beta3`
29
+
30
+ ## Road Map and New feature discussion
31
+ Plans for close-at-hand future releases are typically listed in CHANGELOG. New features
32
+ discussions can be made in GitHub as a new issue. I can also look into setting up other
33
+ channels of communications to discuss road maps, etc. as well if there is a need.
Docker_entrypoint.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ # Add local user
4
+ # Either use the USER_ID if passed in at runtime or
5
+ # fallback
6
+
7
+ USER_ID=${PUID:-1000}
8
+ GROUP_ID=${PGID:-1000}
9
+ USERNAME=cabernet
10
+ echo "Starting with UID : $USER_ID"
11
+ addgroup -S -g $GROUP_ID $USERNAME
12
+ adduser -S -D -H -h /app -u $USER_ID -G $USERNAME $USERNAME
13
+
14
+ blockUpdate="/app/Do_Not_Upgrade_from_WEBUI_on_Docker"
15
+
16
+ oldKeyFile="/root/.cabernet/key.txt"
17
+ newKeyFile="/app/.cabernet/key.txt"
18
+
19
+ if [ -f "$oldKeyFile" ]; then
20
+
21
+ cat <<EOF
22
+ ----------
23
+ !!!WARNING!!!
24
+ ==> DECREPTED Volume Option
25
+ Please update your volume for 'key.txt' to new location.
26
+ $newKeyFile
27
+ ----------
28
+ EOF
29
+
30
+ cp "$oldKeyFile" "$newKeyFile"
31
+ fi
32
+
33
+ # Set permissions
34
+ chown -R $USER_ID:$GROUP_ID /app
35
+
36
+ [ ! -f "$blockUpdate" ] && touch "$blockUpdate"
37
+
38
+ su-exec $USERNAME python3 /app/tvh_main.py "$@"
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-alpine
2
+ WORKDIR /app
3
+ COPY . .
4
+ RUN apk add --no-cache --update bash tzdata ffmpeg curl su-exec && \
5
+ apk add --no-cache --virtual builddeps gcc musl-dev python3-dev libffi-dev openssl-dev cargo && \
6
+ pip3 install -r requirements.txt --no-cache-dir && \
7
+ apk del builddeps && \
8
+ touch /app/is_container && \
9
+ mv Docker_entrypoint.sh /usr/local/bin && \
10
+ rm -rf /tmp/* $HOME/.cache $HOME/.cargo
11
+
12
+ VOLUME /app/data /app/plugins_ext /app/.cabernet
13
+ EXPOSE 6077 5004
14
+ ENTRYPOINT ["Docker_entrypoint.sh"]
Dockerfile_tvh_crypt.alpine ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-alpine
2
+ #RUN apk add --no-cache --update bash tzdata ffmpeg py3-cryptography py-requests && \
3
+ RUN apk add --no-cache --update bash tzdata ffmpeg curl && \
4
+ apk add --no-cache --virtual builddeps gcc musl-dev python3-dev libffi-dev openssl-dev cargo && \
5
+ pip3 install requests && \
6
+ pip3 install streamlink && \
7
+ pip3 install cryptography --no-binary=cryptography && \
8
+ apk del builddeps
9
+
10
+ COPY requirements.txt /app/requirements.txt
11
+
12
+ COPY *.py /app/
13
+ COPY lib/ /app/lib/
14
+ COPY plugins /app/plugins
15
+ RUN touch /app/is_container
16
+ ENTRYPOINT ["python3", "/app/tvh_main.py"]
Dockerfile_tvh_crypt.slim-buster ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ARG BASE_IMAGE=python:3.12-slim-buster
2
+ FROM $BASE_IMAGE as base
3
+ WORKDIR /app
4
+ ENV PYTHONPATH "${PYTHONPATH}:/app"
5
+
6
+ ##
7
+ # Install any runtime dependencies here
8
+ ENV RUNTIME_DEPENDENCIES="ffmpeg curl"
9
+
10
+ RUN apt-get update \
11
+ && apt-get install -y $RUNTIME_DEPENDENCIES \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ #ENV BUILD_DEPENDENCIES="build-essential"
15
+ ENV BUILD_DEPENDENCIES=""
16
+
17
+ COPY requirements.txt /app/requirements.txt
18
+
19
+ # Install any build dependencies here
20
+ RUN apt-get update \
21
+ && pip install --upgrade pip \
22
+ && apt-get install -y $BUILD_DEPENDENCIES \
23
+ && pip install --no-cache-dir -r requirements.txt \
24
+ && apt-get remove -y $BUILD_DEPENDENCIES \
25
+ && apt-get auto-remove -y \
26
+ && rm -rf /var/lib/apt/lists/*
27
+
28
+ COPY *.py /app/
29
+ COPY lib/ /app/lib/
30
+ COPY plugins /app/plugins
31
+ RUN touch /app/is_container
32
+ ENTRYPOINT ["python3", "/app/tvh_main.py"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ROCKY4546 (https://github.com/rocky4546)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,10 +1,147 @@
1
- ---
2
- title: Cab
3
- emoji: 🐨
4
- colorFrom: gray
5
- colorTo: purple
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## NOTICE:
2
+ By default this app doesn't provide any video sources, only the plugins access the providers streams for personal use.
3
+
4
+ ## Installation
5
+ ### 1. Requirements
6
+ - Python 3.10.12+
7
+ - python cryptography module
8
+ - python httpx[http2] module
9
+ - (optional) streamlink module
10
+ - ffmpeg and ffprobe
11
+
12
+ ### 2. Installation
13
+ - Download source
14
+ - Unzip source in the installation folder
15
+ - Launch the app by running the command "python3 tvh_main.py". This should create a data folder and a config.ini inside that folder
16
+ - Bring up browser and go to http://ip address:6077/
17
+ - From Plugins, install PlutoTV plugin
18
+ - Restart Cabernet twice from Scheduled Tasks > Applications > Restart
19
+ - Go to settings and make changes you want.
20
+ - Logging: Change log level from warning to info if needed
21
+ - From XML/JSON Links try some of the links
22
+
23
+ ### 3. Services
24
+ - MS Windows
25
+ - Services for MS Windows is auto-created using the installer provided for each release.
26
+ - Unix/Linux
27
+ - Services for CoreELEC and Debian/Ubuntu are found here. Follow the instructions found in the files.
28
+ - https://github.com/cabernetwork/cabernet/tree/master/lib/tvheadend/service
29
+
30
+ ### 4. Docker
31
+ You can either use docker-compose or the docker cli.
32
+
33
+ | Architecture | Available |
34
+ |:----:|:----:|
35
+ | X86-64 | ✅ |
36
+ | arm64 | ✅ |
37
+ | armhf | ❌ |
38
+
39
+ **NOTES:**
40
+ - Volume for ```/app/.cabernet``` must be provided before enabling encryption.
41
+ - armhf not available due to python cryptography only supports 64bit systems.
42
+ [Cryptography supported platforms](https://cryptography.io/en/latest/installation/#supported-platforms)
43
+
44
+ #### a. Using docker-compose
45
+ To install Cabernet:
46
+ ```
47
+ 1. Grab the cabernet source and unpack into a folder
48
+ 2. Edit docker-compose.yml and set the volume folder locations
49
+ 3. docker-compose pull cabernet
50
+ 4. docker-compose up -d cabernet
51
+ ```
52
+
53
+ #### b. docker cli
54
+ ```
55
+ docker run -d \
56
+ --name=cabernet \
57
+ -e PUID=1000 `#optional` \
58
+ -e PGID=1000 `#optional` \
59
+ -e TZ=Etc/UTC `#optional` \
60
+ -p 6077:6077 \
61
+ -p 5004:5004 \
62
+ -v /path/to/cabernet/data:/app/data `#optional` \
63
+ -v /path/to/plugins_ext:/app/plugins_ext `#optional` \
64
+ -v /path/to/cabernet/secrets:/app/.cabernet `#optional` \
65
+ --restart unless-stopped \
66
+ ghcr.io/cabernetwork/cabernet:latest
67
+ ```
68
+
69
+ ##### Parameters
70
+ | Parameter | Function |
71
+ | :----: | :----: |
72
+ | -p 6077 | Cabernet WebUI |
73
+ | -p 5004 | Cabernet stream port |
74
+ | -e PUID=1000 | for UserID |
75
+ | -e PGID=1000 | for GroupID |
76
+ | -e TZ=Etc/UTC | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).|
77
+ | -v /app/data | Where Cabernet should store its database and config. |
78
+ | -v /app/plugins_ext | External Plugins |
79
+ | -v /app/.cabernet | Where encryption key is stored |
80
+
81
+ #### c. Other Docker Info
82
+ Cabernet configuration setting Clients > Web Sites > plex_docker_ip should be set to your computers IP address and not the internal IP inside the docker container. This will allow the channels.m3u file to have the correct IP address for streaming.
83
+
84
+
85
+ #### d. Updating Info
86
+ **Via Docker Compose:**
87
+
88
+ - Update the image:
89
+ ```
90
+ docker-compose rm --stop -f cabernet
91
+ docker-compose pull cabernet
92
+ docker-compose up -d cabernet
93
+ ```
94
+
95
+ **Via Docker Run:**
96
+
97
+ - Update the image:
98
+ ```docker pull ghcr.io/cabernetwork/cabernet:latest```
99
+
100
+ - Stop the running container:
101
+ ```docker stop cabernet```
102
+
103
+ - Delete the container:
104
+ ```docker rm cabernet```
105
+
106
+ - You can also remove the old dangling images:
107
+ ```docker image prune```
108
+
109
+ #### e. Via Watchtower auto-updater
110
+ ```
111
+ docker run --rm \
112
+ -v /var/run/docker.sock:/var/run/docker.sock \
113
+ containrrr/watchtower \
114
+ --run-once cabernet
115
+ ```
116
+
117
+ - For regulary updates follow Watchtower instructions
118
+ https://containrrr.dev/watchtower/
119
+
120
+
121
+ ### 5. Default Ports
122
+ - 6007 Web UI
123
+ - 5004 Stream port
124
+ - 1900 SSDP (if enabled)
125
+ - 65001 HDHomeRun (if enabled)
126
+
127
+ ### 6. Notes
128
+ - URL used can include plugin and instance levels to filter down to a specific set of data
129
+ - http://ip address:6077/channels.m3u
130
+ - http://ip address:6077/pLuToTv/channels.m3u
131
+ - http://ip address:6077/PlutoTV/Default/channels.m3u
132
+ - config.ini group tag requirements when creating an instance
133
+ - All lower case
134
+ - Underscore is a key character in section tags and separates the plugin name from the instance name
135
+ - Use a single word if possible for the instance name
136
+ - Do not change the instance name unless you go into data management and remove the instance first.
137
+ - [plutotv_mychannels]
138
+
139
+ ### 7. Guides
140
+ Beginners Setup: https://github.com/cabernetwork/cabernet/issues/78
141
+
142
+ ### 8. Forum
143
+ Latest Forum: https://tvheadend.org/d/7455-daddylive-plutotv-xumo-m3u-xmltv-samsungtv-plex-tvguide-interfaces-appliance
144
+
145
+ Archived Legacy Forum: https://web.archive.org/web/20221015111333/https://tvheadend.org/boards/5/topics/43052
146
+
147
+ Enjoy
TVHEADEND.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Cabernet
2
+ You have found the Cabernet README.
3
+ To allow for easy insertion of the locast2plex baseline, most of the top level files are directly from locast2plex including the main README.md.
4
+
5
+ Additional information is provided on the [Wiki](https://cabernetwork.github.io/) pages.
6
+
7
+ ### Purpose:
8
+ This application has two primary purposes along with many minor updates.
9
+
10
+ The first purpose is to provide a TVHeadend interface which allows for automatic population of the mux, services and EPG with a standard naming convention, so that, the channels will map the EPG to the services correctly and provide automated updates as needed.
11
+
12
+ Second, is to update the application to support the free locast account version with TVHeadend.
13
+
14
+ ### Relationship to locast2plex:
15
+ The application is setup to use most of the locast2plex software. As fixes are addressed in that project, those changes are folded into this application. Key areas, such as, managing the cached files and station lists, logging into locast, using Docker and supporting SSDP are all maintained by locast2plex.
16
+
17
+ ### Use of ffmpeg software
18
+ There are many locast interface applications popping up everywhere; many try to not use ffmpeg executables. Although python could do what ffmpeg does, it would be slower and use more CPU. Since it should be available on Linux systems and we have addressed it on Windows, use of this executable should not be an issue. One solution for subscription-based accounts is to detect if ffmpeg is not present and then to use a python-based method for streaming the data to the end device.
19
+
20
+ ### Important Legal Notice:
21
+ As stated by locast2plex. Do not use this product in an illegal way to obtain channels outside of your general market area. To have locast continue broadcasting and to have this product available is to use it legally.
22
+
23
+ ### Developers Notes:
24
+ Pull requests are welcome. If you cannot submit a PR, then write an issue/enhancement with as much detail as possible and it will be reviewed.
25
+
26
+ ### Submitting Issues/Enhancements
27
+ All issues will be triaged and labeled. Before writing an issue, check the issue list for duplicates to see if there are any fixes for similar issues. If you are not sure, write a new issue. The issue may be associated with locast2plex software. In this case, it will be determined whether we can make the fix or have you follow up with locast2plex. Initially, add as much detail as possible to reproduce the issue. Logs, hardware and OS info is not important up front, but may be requested based on the issue.
28
+
29
+ When posting logs, you can turn the locast2plex logging off by setting the [main][quiet_print] setting to True. This should remove most of the sensitive information. Always review any data you post for sensitive info before you post.
30
+
31
+ ## Credits
32
+ Thank you to all the people at [locast2plex](https://github.com/tgorgdotcom/locast2plex) for creating the initial product.
build/WINDOWS/Base64.nsh ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !ifndef BASE64_NSH
2
+ !define BASE64_NSH
3
+
4
+ !define BASE64_ENCODINGTABLE "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
5
+ !define BASE64_ENCODINGTABLEURL "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
6
+
7
+ !define BASE64_PADDING "="
8
+
9
+ VAR OCTETVALUE
10
+ VAR BASE64TEMP
11
+
12
+ !define Base64_Encode "!insertmacro Base64_Encode"
13
+ !define Base64_URLEncode "!insertmacro Base64_URLEncode"
14
+
15
+ !macro Base64_Encode _cleartext
16
+ push $R0
17
+ push $R1
18
+ push $R2
19
+ push $0
20
+ push $1
21
+ push $2
22
+ push $3
23
+ push $4
24
+ push $5
25
+ push $6
26
+ push $7
27
+ push `${_cleartext}`
28
+ push `${BASE64_ENCODINGTABLE}`
29
+ Call Base64_Encode
30
+ Pop $BASE64TEMP
31
+ Pop $7
32
+ Pop $6
33
+ Pop $5
34
+ Pop $4
35
+ Pop $3
36
+ Pop $2
37
+ Pop $1
38
+ Pop $0
39
+ pop $R2
40
+ pop $R1
41
+ pop $R0
42
+ Push $BASE64TEMP
43
+ !macroend
44
+
45
+ !macro Base64_URLEncode _cleartext
46
+ push $R0
47
+ push $R1
48
+ push $R2
49
+ push $0
50
+ push $1
51
+ push $2
52
+ push $3
53
+ push $4
54
+ push $5
55
+ push $6
56
+ push $7
57
+ push `${_cleartext}`
58
+ push `${BASE64_ENCODINGTABLEURL}`
59
+ Call Base64_Encode
60
+ Pop $BASE64TEMP
61
+ Pop $7
62
+ Pop $6
63
+ Pop $5
64
+ Pop $4
65
+ Pop $3
66
+ Pop $2
67
+ Pop $1
68
+ Pop $0
69
+ pop $R2
70
+ pop $R1
71
+ pop $R0
72
+ Push $BASE64TEMP
73
+ !macroend
74
+
75
+ Function Base64_Encode
76
+ pop $R2 ; Encoding table
77
+ pop $R0 ; Clear Text
78
+ StrCpy "$R1" "" # The result
79
+
80
+ StrLen $1 "$R0"
81
+ StrCpy $0 0
82
+
83
+ ${WHILE} $0 < $1
84
+ # Copy 3 characters, and for each character push their value.
85
+ StrCpy $OCTETVALUE 0
86
+
87
+ StrCpy $5 $0
88
+ StrCpy $4 "$R0" 1 $5
89
+ ${CharToASCII} $4 "$4"
90
+
91
+ IntOp $OCTETVALUE $4 << 16
92
+
93
+ IntOp $5 $5 + 1
94
+ ${IF} $5 < $1
95
+ StrCpy $4 "$R0" 1 $5
96
+ ${CharToASCII} $4 "$4"
97
+
98
+ IntOp $4 $4 << 8
99
+ IntOp $OCTETVALUE $OCTETVALUE + $4
100
+
101
+ IntOp $5 $5 + 1
102
+ ${IF} $5 < $1
103
+ StrCpy $4 "$R0" 1 $5
104
+ ${CharToASCII} $4 "$4"
105
+
106
+ IntOp $OCTETVALUE $OCTETVALUE + $4
107
+ ${ENDIF}
108
+ ${ENDIF}
109
+
110
+ # Now take the 4 indexes from the encoding table, based on 6bits each of the octet's value.
111
+ IntOp $4 $OCTETVALUE >> 18
112
+ IntOp $4 $4 & 63
113
+ StrCpy $5 "$R2" 1 $4
114
+ StrCpy $R1 "$R1$5"
115
+
116
+ IntOp $4 $OCTETVALUE >> 12
117
+ IntOp $4 $4 & 63
118
+ StrCpy $5 "$R2" 1 $4
119
+ StrCpy $R1 "$R1$5"
120
+
121
+ StrCpy $6 $0
122
+ StrCpy $7 2
123
+
124
+ IntOp $6 $6 + 1
125
+ ${IF} $6 < $1
126
+ IntOp $4 $OCTETVALUE >> 6
127
+ IntOp $4 $4 & 63
128
+ StrCpy $5 "$R2" 1 $4
129
+ StrCpy $R1 "$R1$5"
130
+ IntOp $7 $7 - 1
131
+ ${ENDIF}
132
+
133
+ IntOp $6 $6 + 1
134
+ ${IF} $6 < $1
135
+ IntOp $4 $OCTETVALUE & 63
136
+ StrCpy $5 "$R2" 1 $4
137
+ StrCpy $R1 "$R1$5"
138
+ IntOp $7 $7 - 1
139
+ ${ENDIF}
140
+
141
+ # If there is any padding required, we now write that here.
142
+ ${IF} $7 > 0
143
+ ${WHILE} $7 > 0
144
+ StrCpy $R1 "$R1${BASE64_PADDING}"
145
+ IntOp $7 $7 - 1
146
+ ${ENDWHILE}
147
+ ${ENDIF}
148
+
149
+ IntOp $0 $0 + 3
150
+ ${ENDWHILE}
151
+
152
+ Push "$R1"
153
+ FunctionEnd
154
+
155
+
156
+ !define Base64_Decode "!insertmacro Base64_Decode"
157
+ !define Base64_URLDecode "!insertmacro Base64_URLDecode"
158
+
159
+ !macro Base64_Decode _encodedtext
160
+ push `${_encodedtext}`
161
+ push `${BASE64_ENCODINGTABLE}`
162
+ Call Base64_Decode
163
+ !macroend
164
+
165
+ !macro Base64_URLDecode _encodedtext
166
+ push `${_encodedtext}`
167
+ push `${BASE64_ENCODINGTABLEURL}`
168
+ Call Base64_Decode
169
+ !macroend
170
+
171
+ Function base64_Decode
172
+ ; Stack: strBase64table strEncoded
173
+ Push $9 ; Stack: $9 strBase64table strEncoded ; $9 = strDecoded
174
+ Exch 2 ; Stack: strEncoded strBase64table $9
175
+ Exch ; Stack: strBase64table strEncoded $9
176
+ Exch $0 ; Stack: $0 strEncoded $9 ; $0 = strBase64table
177
+ Exch ; Stack: strEncoded $0 $9
178
+ Exch $1 ; Stack: $1 $0 $9 ; $1 = strEncoded
179
+
180
+ Push $2 ; strBase64table.length
181
+ Push $3 ; strEncoded.length
182
+ Push $4 ; strBase64table.counter
183
+ Push $5 ; strEncoded.counter
184
+ Push $6 ; strBase64table.char
185
+ Push $7 ; strEncoded.char
186
+
187
+ Push $R0 ; 6bit-group.counter
188
+ Push $R1 ; 6bit-group.a
189
+ Push $R2 ; 6bit-group.b
190
+ Push $R3 ; 6bit-group.c
191
+ Push $R4 ; 6bit-group.d
192
+
193
+ Push $R5 ; bit-group.tempVar.a
194
+ Push $R6 ; bit-group.tempVar.b
195
+
196
+ Push $R7 ; 8bit-group.A
197
+ Push $R8 ; 8bit-group.B
198
+ Push $R9 ; 8bit-group.C
199
+
200
+ StrCpy $9 "" ; Result string
201
+
202
+ StrLen $2 "$0" ; Get the length of the base64 table into $2
203
+ StrLen $3 "$1" ; Get the length of the encoded text into $3
204
+ IntOp $3 $3 - 1 ; Subtract one as the StrCpy offset is zero-based
205
+
206
+ StrCpy $R0 4 ; Initialize the 6bit-group.counter
207
+
208
+ ${ForEach} $5 0 $3 + 1 ; Loop over the encoded string
209
+ StrCpy $7 $1 1 $5 ; Grab the character at the loop counter's index
210
+
211
+ ${If} $7 == "${BASE64_PADDING}" ; If it's the padding char
212
+ Push 0 ; Push value 0 (no impact on decoded string)
213
+ ${Else} ; Otherwise
214
+ ${ForEach} $4 0 $2 + 1 ; Loop over the base64 lookup table
215
+ StrCpy $6 $0 1 $4 ; Grab the character at this loop counter's index
216
+ ${If} $6 S== $7 ; If that character matches the encoded string character
217
+ ${ExitFor} ; Exit this loop early
218
+ ${EndIf}
219
+ ${Next}
220
+ Push $4 ; Push the lookup's index to the stack
221
+ ${EndIf}
222
+
223
+ IntOp $R0 $R0 - 1 ; Decrease the 6bit-group counter
224
+
225
+ ${If} $R0 = 0 ; If that counter reaches zero
226
+ ; Pop the index values off the stack to variables
227
+ Pop $R4
228
+ Pop $R3
229
+ Pop $R2
230
+ Pop $R1
231
+
232
+ ; The way the base64 decoding works is like this...
233
+ ; Normal ASCII has 8 bits, base64 has 6 bits.
234
+ ; Those 8 bits need to be presented as 6 bits somehow
235
+ ; Turns out you can easily do that by taking their common multiple: 24
236
+ ; This results in 3 8bit characters per each 4 6bit characters:
237
+ ; AAAAAAAA BBBBBBBB CCCCCCCC
238
+ ; aaaaaabb bbbbcccc ccdddddd
239
+
240
+ ; So to go back to AAAAAAAA, you need:
241
+ ; aaaaaa shifted two bits to the left
242
+ ; the two left-most bits of bbbbbb,
243
+ ; which you can do by shifting it four bits to the right
244
+ IntOp $R5 $R1 << 2
245
+ IntOp $R6 $R2 >> 4
246
+ IntOp $R5 $R5 | $R6
247
+ IntFmt $R7 "%c" $R5 ; IntFmt turns the resulting 8bit value to a character
248
+
249
+ ; For BBBBBBBB, you need:
250
+ ; the four least significant bits of bbbbbb
251
+ ; which you can get by binary OR'ing with 2^4-1 = 15
252
+ ; the four most significant bits of cccccc
253
+ ; which you can get by just shifting it two bits to the right
254
+ IntOp $R5 $R2 & 15
255
+ InTop $R5 $R5 << 4
256
+ IntOp $R6 $R3 >> 2
257
+ IntOp $R5 $R5 | $R6
258
+ IntFmt $R8 "%c" $R5
259
+
260
+ ; For CCCCCCCC, the procedure is entirely similar.
261
+ IntOp $R5 $R3 & 3
262
+ IntOp $R5 $R5 << 6
263
+ IntOp $R5 $R5 | $R4
264
+ IntFmt $R9 "%c" $R5
265
+
266
+ StrCpy $9 "$9$R7$R8$R9" ; Tack it all onto the result
267
+ StrCpy $R0 4 ; Reset the 6bit-group counter
268
+ ${EndIf}
269
+ ${Next}
270
+
271
+ ; Done. Now let's restore the user's variables
272
+ Pop $R9
273
+ Pop $R8
274
+ Pop $R7
275
+ Pop $R6
276
+ Pop $R5
277
+ Pop $R4
278
+ Pop $R3
279
+ Pop $R2
280
+ Pop $R1
281
+ Pop $R0
282
+ Pop $7
283
+ Pop $6
284
+ Pop $5
285
+ Pop $4
286
+ Pop $3
287
+ Pop $2
288
+ Pop $1
289
+ Pop $0
290
+ Exch $9 ; Stack: strDecoded
291
+ FunctionEnd
292
+ !endif ;BASE64_NSH
build/WINDOWS/CharToASCII.nsh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !define CharToASCII "!insertmacro CharToASCII"
2
+
3
+ !macro CharToASCII AsciiCode Character
4
+ Push "${Character}"
5
+ Call CharToASCII
6
+ Pop "${AsciiCode}"
7
+ !macroend
8
+
9
+ Function CharToASCII
10
+ Exch $0 ; given character
11
+ Push $1 ; current character
12
+ Push $2 ; current Ascii Code
13
+
14
+ StrCpy $2 1 ; right from start
15
+ Loop:
16
+ IntFmt $1 %c $2 ; Get character from current ASCII code
17
+ ${If} $1 S== $0 ; case sensitive string comparison
18
+ StrCpy $0 $2
19
+ Goto Done
20
+ ${EndIf}
21
+ IntOp $2 $2 + 1
22
+ StrCmp $2 255 0 Loop ; ascii from 1 to 255
23
+ StrCpy $0 0 ; ASCII code wasn't found -> return 0
24
+ Done:
25
+ Pop $2
26
+ Pop $1
27
+ Exch $0
28
+ FunctionEnd
build/WINDOWS/Plugins/SimpleSC/License.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SimpleSC - NSIS Service Control Plugin - License Agreement
2
+
3
+ This plugin is subject to the Mozilla Public License Version 1.1 (the "License");
4
+ You may not use this plugin except in compliance with the License. You may
5
+ obtain a copy of the License at http://www.mozilla.org/MPL.
6
+
7
+ Alternatively, you may redistribute this library, use and/or modify it
8
+ under the terms of the GNU Lesser General Public License as published
9
+ by the Free Software Foundation; either version 2.1 of the License,
10
+ or (at your option) any later version. You may obtain a copy
11
+ of the LGPL at www.gnu.org/copyleft.
12
+
13
+ Software distributed under the License is distributed on an "AS IS" basis,
14
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15
+ for the specific language governing rights and limitations under the License.
16
+
17
+ Copyright
18
+
19
+ Portions of this software are Copyright (C) 2001 - Peter Windridge, 2003 by
20
+ Bernhard Mayer, Fixed and formatted by Brett Dever http://editor.nfscheats.com/
21
+
22
+ The original code is ServiceControl.pas, released April 16, 2007.
23
+
24
+ The initial developer of the original code is Rainer Budde (http://www.speed-soft.de).
25
+
26
+ SimpleSC - NSIS Service Control Plugin is written, published and maintaned by
27
+ Rainer Budde ([email protected]).
build/WINDOWS/Plugins/SimpleSC/Readme.txt ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NSIS Simple Service Plugin
2
+
3
+ This plugin contains basic service functions like start, stop the
4
+ service or checking the service status. It also contains advanced
5
+ service functions for example setting the service description, changed
6
+ the logon account, granting or removing the service logon privilege.
7
+
8
+
9
+
10
+
11
+ == Short Reference ==
12
+
13
+
14
+ SimpleSC::InstallService [name_of_service] [display_name] [service_type] [start_type] [binary_path] [dependencies] [account] [password]
15
+ SimpleSC::RemoveService [name_of_service]
16
+
17
+ SimpleSC::StartService [name_of_service] [arguments] [timeout]
18
+ SimpleSC::StopService [name_of_service] [wait_for_file_release] [timeout]
19
+ SimpleSC::PauseService [name_of_service] [timeout]
20
+ SimpleSC::ContinueService [name_of_service] [timeout]
21
+ SimpleSC::RestartService [name_of_service] [arguments] [timeout]
22
+ SimpleSC::ExistsService [name_of_service]
23
+
24
+ SimpleSC::GetServiceDisplayName [name_of_service]
25
+ SimpleSC::GetServiceName [display_name]
26
+ SimpleSC::GetServiceStatus [name_of_service]
27
+ SimpleSC::GetServiceDescription [name_of_service]
28
+ SimpleSC::GetServiceStartType [name_of_service]
29
+ SimpleSC::GetServiceBinaryPath [name_of_service]
30
+ SimpleSC::GetServiceLogon [name_of_service]
31
+ SimpleSC::GetServiceFailure [name_of_service]
32
+ SimpleSC::GetServiceFailureFlag [name_of_service]
33
+ SimpleSC::GetServiceDelayedAutoStartInfo [name_of_service]
34
+
35
+ SimpleSC::SetServiceDescription [name_of_service] [service_description]
36
+ SimpleSC::SetServiceStartType [name_of_service] [start_type]
37
+ SimpleSC::SetServiceBinaryPath [name_of_service] [binary_path]
38
+ SimpleSC::SetServiceLogon [name_of_service] [account] [password]
39
+ SimpleSC::SetServiceFailure [name_of_service] [reset_period] [reboot_message] [command] [action_type_1] [action_delay_1] [action_type_2] [action_delay_2] [action_type_3] [action_delay_3]
40
+ SimpleSC::SetServiceFailureFlag [name_of_service] [failure_actions_on_non_crash_failures]
41
+ SimpleSC::SetServiceDelayedAutoStartInfo [name_of_service] [delayed_autostart]
42
+
43
+ SimpleSC::GrantServiceLogonPrivilege [account]
44
+ SimpleSC::RemoveServiceLogonPrivilege [account]
45
+
46
+ SimpleSC::ServiceIsPaused [name_of_service]
47
+ SimpleSC::ServiceIsRunning [name_of_service]
48
+ SimpleSC::ServiceIsStopped [name_of_service]
49
+
50
+ SimpleSC::GetErrorMessage [error_code]
51
+
52
+
53
+ Parameters:
54
+
55
+ name_of_service - The name of the service used for Start/Stop commands and all further commands
56
+
57
+ display_name - The name as shown in the service control manager applet in system control
58
+
59
+ service_type - One of the following codes
60
+ 1 - SERVICE_KERNEL_DRIVER - Driver service.
61
+ 2 - SERVICE_FILE_SYSTEM_DRIVER - File system driver service.
62
+ 16 - SERVICE_WIN32_OWN_PROCESS - Service that runs in its own process. (Should be used in most cases)
63
+ 32 - SERVICE_WIN32_SHARE_PROCESS - Service that shares a process with one or more other services.
64
+ 256 - SERVICE_INTERACTIVE_PROCESS - The service can interact with the desktop.
65
+ Note: If you specify either SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS,
66
+ and the service is running in the context of the LocalSystem account,
67
+ you can also specify this value.
68
+ Example: SERVICE_WIN32_OWN_PROCESS or SERVICE_INTERACTIVE_PROCESS - (16 or 256) = 272
69
+ Note: Services cannot directly interact with a user as of Windows Vista.
70
+ Therefore, this technique should not be used in new code.
71
+ See for more information: http://msdn2.microsoft.com/en-us/library/ms683502(VS.85).aspx
72
+
73
+ start_type - one of the following codes
74
+ 0 - SERVICE_BOOT_START - Driver boot stage start
75
+ 1 - SERVICE_SYSTEM_START - Driver scm stage start
76
+ 2 - SERVICE_AUTO_START - Service auto start (Should be used in most cases)
77
+ 3 - SERVICE_DEMAND_START - Driver/service manual start
78
+ 4 - SERVICE_DISABLED - Driver/service disabled
79
+
80
+ service_status - one of the following codes
81
+ 1 - SERVICE_STOPPED
82
+ 2 - SERVICE_START_PENDING
83
+ 3 - SERVICE_STOP_PENDING
84
+ 4 - SERVICE_RUNNING
85
+ 5 - SERVICE_CONTINUE_PENDING
86
+ 6 - SERVICE_PAUSE_PENDING
87
+ 7 - SERVICE_PAUSED
88
+
89
+ binary_path - The path to the binary including all necessary parameters
90
+
91
+ dependencies - Needed services, controls which services have to be started before this one; use the forward slash "/" to add more more than one service
92
+
93
+ account - The username/account which should be used
94
+
95
+ password - Password of the aforementioned account to be able to logon as a service
96
+ Note: If you do not specify account/password, the local system account will be used to run the service
97
+
98
+ arguments - Arguments passed to the service main function.
99
+ Note: Driver services do not receive these arguments.
100
+
101
+ reset_period - The time after which to reset the failure count to zero if there are no failures, in seconds. Specify 0 (INFINITE) to indicate that this value should never be reset
102
+
103
+ reboot_message - The message to be broadcast to server users before rebooting
104
+
105
+ command - The command line of the process to execute in response to the SC_ACTION_RUN_COMMAND service controller action. This process runs under the same account as the service
106
+
107
+ timeout - Timeout in seconds of the function
108
+
109
+ action_type_x - one of the following codes for the action to be performed
110
+ 0 - SC_ACTION_NONE - No action
111
+ 1 - SC_ACTION_RESTART - Restart the service
112
+ 2 - SC_ACTION_REBOOT - Reboot the computer (Note: The service user must have the SE_SHUTDOWN_NAME privilege)
113
+ 3 - SC_ACTION_RUN_COMMAND - Run a command
114
+
115
+ action_delay_x - The time to wait before performing the specified action, in milliseconds
116
+
117
+ failure_actions_on_non_crash_failures - This setting determines when failure actions are to be executed
118
+ 0 - The failure actions executed only if the service terminates without reporting a status of SERVICE_STOPPED
119
+ 1 - The failure actions executed if the status of a service is SERVICE_STOPPED but the exit code of the service is not 0
120
+
121
+ delayed_autostart - The delayed auto-start setting of an auto-start service
122
+ 0 - The service will be started during system boot.
123
+ 1 - The service will be started after other auto-start services are started plus a short delay
124
+
125
+ error_code - Error code of a function
126
+
127
+ service_description - The description as shown in the service control manager applet in system control
128
+
129
+ wait_for_file_release - Wait for file release after the service is stopped. This is useful if the binary file will be overwritten after stopping the service.
130
+ 0 - NO_WAIT - No wait for file release
131
+ 1 - WAIT - Wait for file release
132
+ Note: If SERVICE_WIN32_OWN_PROCESS is used this option should be set to WAIT.
133
+ If SERVICE_WIN32_SHARE_PROCESS is used this option should only be set to WAIT if the last service
134
+ in the process is stopped.
135
+
136
+
137
+
138
+
139
+ == The Sample Script ==
140
+
141
+
142
+ ; Install a service - ServiceType own process - StartType automatic - NoDependencies - Logon as System Account
143
+ SimpleSC::InstallService "MyService" "My Service Display Name" "16" "2" "C:\MyPath\MyService.exe" "" "" ""
144
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
145
+
146
+ ; Install a service - ServiceType interact with desktop - StartType automatic - Dependencies on "Windows Time Service" (w32time) and "WWW Publishing Service" (w3svc) - Logon as System Account
147
+ SimpleSC::InstallService "MyService" "My Service Display Name" "272" "2" "C:\MyPath\MyService.exe" "w32time/w3svc" "" ""
148
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
149
+
150
+ ; Remove a service
151
+ SimpleSC::RemoveService "MyService"
152
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
153
+
154
+ ; Start a service
155
+ SimpleSC::StartService "MyService" "" 30
156
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
157
+
158
+ ; Start a service with two arguments "/param1=true" "/param2=1"
159
+ SimpleSC::StartService "MyService" "/param1=true /param2=1" 30
160
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
161
+
162
+ ; Start a service with two arguments "-p param1" "-param2"
163
+ SimpleSC::StartService "MyService" '"-p param1" -param2' 30
164
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
165
+
166
+ ; Stop a service and waits for file release
167
+ SimpleSC::StopService "MyService" 1 30
168
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
169
+
170
+ ; Stops two services and waits for file release after the last service is stopped
171
+ SimpleSC::StopService "MyService1" 0 30
172
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
173
+ SimpleSC::StopService "MyService2" 1 30
174
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
175
+
176
+ ; Pause a service
177
+ SimpleSC::PauseService "MyService" 30
178
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
179
+
180
+ ; Continue a service
181
+ SimpleSC::ContinueService "MyService" 30
182
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
183
+
184
+ ; Restart a service
185
+ SimpleSC::RestartService "MyService" "" 30
186
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
187
+
188
+ ; Restart a service with two arguments "/param1=true" "/param2=1"
189
+ SimpleSC::RestartService "MyService" "/param1=true /param2=1" 30
190
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
191
+
192
+ ; Start a service with two arguments "-p param1" "-param2"
193
+ SimpleSC::RestartService "MyService" '"-p param1" -param2' 30
194
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
195
+
196
+ ; Check if the service exists
197
+ SimpleSC::ExistsService "MyService"
198
+ Pop $0 ; returns an errorcode if the service doesn�t exists (<>0)/service exists (0)
199
+
200
+ ; Get the displayname of a service
201
+ SimpleSC::GetServiceDisplayName "MyService"
202
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
203
+ Pop $1 ; returns the displayname of the service
204
+
205
+ ; Get the servicename of a service by the displayname
206
+ SimpleSC::GetServiceName "MyService"
207
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
208
+ Pop $1 ; returns the servicename of the service
209
+
210
+ ; Get the current status of a service
211
+ SimpleSC::GetServiceStatus "MyService"
212
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
213
+ Pop $1 ; return the status of the service (See "service_status" in the parameters)
214
+
215
+ ; Get the description of a service
216
+ SimpleSC::GetServiceDescription "MyService"
217
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
218
+ Pop $1 ; returns the description of the service
219
+
220
+ ; Get the start type of the service
221
+ SimpleSC::GetServiceStartType "MyService"
222
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
223
+ Pop $1 ; returns the start type of the service (see "start_type" in the parameters)
224
+
225
+ ; Get the binary path of a service
226
+ SimpleSC::GetServiceBinaryPath "MyService"
227
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
228
+ Pop $1 ; returns the binary path of the service
229
+
230
+ ; Get the logon user of the service
231
+ SimpleSC::GetServiceLogon "MyService"
232
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
233
+ Pop $1 ; returns the logon username of the service
234
+
235
+ ; Get the failure configuration of a service
236
+ SimpleSC::GetServiceFailure "MyService"
237
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
238
+ Pop $1 ; returns the reset period
239
+ Pop $2 ; returns the reboot message
240
+ Pop $3 ; returns the command
241
+ Pop $4 ; returns the first action (See "action_type_x" in the parameters)
242
+ Pop $5 ; returns the first action delay
243
+ Pop $6 ; returns the second action (See "action_type_x" in the parameters)
244
+ Pop $7 ; returns the second action delay
245
+ Pop $8 ; returns the third action (See "action_type_x" in the parameters)
246
+ Pop $9 ; returns the third action delay
247
+
248
+ ; Get the failure flag configuration of a service
249
+ SimpleSC::GetServiceFailureFlag "MyService"
250
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
251
+ Pop $1 ; returns the service flag
252
+
253
+ ; Get the delayed auto-start configuration of a service
254
+ SimpleSC::GetServiceDelayedAutoStartInfo "MyService"
255
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
256
+ Pop $1 ; returns the delayed auto-start configuration
257
+
258
+ ; Set the description of a service
259
+ SimpleSC::SetServiceDescription "MyService" "Sample Description"
260
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
261
+
262
+ ; Set the starttype to automatic of a service
263
+ SimpleSC::SetServiceStartType "MyService" "2"
264
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
265
+
266
+ ; Sets the service binary path
267
+ SimpleSC::SetServiceBinaryPath "MyService" "C:\MySoftware\MyService.exe"
268
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
269
+
270
+ ; Sets the service logon to a user and grant the user the "SeServiceLogonPrivilege"
271
+ SimpleSC::SetServiceLogon "MyService" "MyServiceUser" "MyServiceUserPassword"
272
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
273
+ IntCmp $0 0 +1 Done Done ; If successful grant the service logon privilege to "MyServiceUser"
274
+ ; Note: Every serviceuser must have the ServiceLogonPrivilege to start the service
275
+ SimpleSC::GrantServiceLogonPrivilege "MyServiceUser"
276
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
277
+ Done:
278
+
279
+ ; Sets the service failure configuration - First action: Restart the service after one minute - Second action: Reboot the computer after five minutes
280
+ SimpleSC::SetServiceFailure "MyService" "0" "" "" "1" "60000" "2" "300000" "0" "0"
281
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
282
+
283
+ ; Sets the failure flag configuration of a service
284
+ SimpleSC::SetServiceFailureFlag "MyService" "1"
285
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
286
+
287
+ ; Sets the delayed auto-start configuration of a service
288
+ SimpleSC::SetServiceDelayedAutoStartInfo "MyService" "1"
289
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
290
+
291
+ ; Remove the "SeServiceLogonPrivilege" from a user
292
+ SimpleSC::RemoveServiceLogonPrivilege "MyServiceUser"
293
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
294
+
295
+ ; Check if the service is paused
296
+ SimpleSC::ServiceIsPaused "MyService"
297
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
298
+ Pop $1 ; returns 1 (service is paused) - returns 0 (service is not paused)
299
+
300
+ ; Check if the service is running
301
+ SimpleSC::ServiceIsRunning "MyService"
302
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
303
+ Pop $1 ; returns 1 (service is running) - returns 0 (service is not running)
304
+
305
+ ; Check if the service is stopped
306
+ SimpleSC::ServiceIsStopped "MyService"
307
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
308
+ Pop $1 ; returns 1 (service is stopped) - returns 0 (service is not stopped)
309
+
310
+ ; Show the error message if a function fails
311
+ SimpleSC::StopService "MyService" 1 30
312
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
313
+ IntCmp $0 0 Done +1 +1
314
+ Push $0
315
+ SimpleSC::GetErrorMessage
316
+ Pop $0
317
+ MessageBox MB_OK|MB_ICONSTOP "Stopping fails - Reason: $0"
318
+ Done:
319
+
320
+
321
+
322
+
323
+ == Important Notes ==
324
+ - The function "SetServiceLogon" only works if the servicetype is
325
+ "SERVICE_WIN32_OWN_PROCESS".
326
+ - The functions "GetServiceDescription", "SetServiceDescription", "GetServiceFailure" and
327
+ "SetServiceFailure" are only available on systems higher than Windows NT.
328
+ - The function "GetServiceFailureFlag", "SetServiceFailureFlag", "GetServiceDelayedAutoStartInfo" and
329
+ "SetServiceDelayedAutoStartInfo" are only available on systems higher than Windows 2003.
330
+ - If you change the logon of an service to a new user you have to grant him
331
+ the Service Logon Privilege. Otherwise the service cannot be started by
332
+ the user you have assigned.
333
+ - The functions StartService, StopService, PauseService and ContinueService uses
334
+ a timeout of 30 seconds. This means the function must be executed within 30 seconds,
335
+ otherwise the functions will return an error.
build/WINDOWS/Plugins/SimpleSC/SimpleSC.dll ADDED
Binary file (63 kB). View file
 
build/WINDOWS/Plugins/inetc/Contrib/Inetc/afxres.h ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #include <windows.h>
2
+ #define IDC_STATIC (-1)
build/WINDOWS/Plugins/inetc/Contrib/Inetc/api.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * apih
3
+ *
4
+ * This file is a part of NSIS.
5
+ *
6
+ * Copyright (C) 1999-2013 Nullsoft and Contributors
7
+ *
8
+ * Licensed under the zlib/libpng license (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ *
11
+ * Licence details can be found in the file COPYING.
12
+ *
13
+ * This software is provided 'as-is', without any express or implied
14
+ * warranty.
15
+ */
16
+
17
+ #ifndef _NSIS_EXEHEAD_API_H_
18
+ #define _NSIS_EXEHEAD_API_H_
19
+
20
+ // Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version
21
+ // The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x))
22
+ // When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {}
23
+
24
+ #define NSISPIAPIVER_1_0 0x00010000
25
+ #define NSISPIAPIVER_CURR NSISPIAPIVER_1_0
26
+
27
+ // NSIS Plug-In Callback Messages
28
+ enum NSPIM
29
+ {
30
+ NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
31
+ NSPIM_GUIUNLOAD, // Called after .onGUIEnd
32
+ };
33
+
34
+ // Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
35
+ // Return NULL for unknown messages
36
+ // Should always be __cdecl for future expansion possibilities
37
+ typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
38
+
39
+ // extra_parameters data structures containing other interesting stuff
40
+ // but the stack, variables and HWND passed on to plug-ins.
41
+ typedef struct
42
+ {
43
+ int autoclose;
44
+ int all_user_var;
45
+ int exec_error;
46
+ int abort;
47
+ int exec_reboot; // NSIS_SUPPORT_REBOOT
48
+ int reboot_called; // NSIS_SUPPORT_REBOOT
49
+ int XXX_cur_insttype; // depreacted
50
+ int plugin_api_version; // see NSISPIAPIVER_CURR
51
+ // used to be XXX_insttype_changed
52
+ int silent; // NSIS_CONFIG_SILENT_SUPPORT
53
+ int instdir_error;
54
+ int rtl;
55
+ int errlvl;
56
+ int alter_reg_view;
57
+ int status_update;
58
+ } exec_flags_t;
59
+
60
+ #ifndef NSISCALL
61
+ # define NSISCALL __stdcall
62
+ #endif
63
+
64
+ typedef struct {
65
+ exec_flags_t *exec_flags;
66
+ int (NSISCALL *ExecuteCodeSegment)(int, HWND);
67
+ void (NSISCALL *validate_filename)(LPTSTR);
68
+ int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
69
+ } extra_parameters;
70
+
71
+ // Definitions for page showing plug-ins
72
+ // See Ui.c to understand better how they're used
73
+
74
+ // sent to the outer window to tell it to go to the next inner window
75
+ #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
76
+
77
+ // custom pages should send this message to let NSIS know they're ready
78
+ #define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
79
+
80
+ // sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
81
+ #define NOTIFY_BYE_BYE 'x'
82
+
83
+ #endif /* _PLUGIN_H_ */
build/WINDOWS/Plugins/inetc/Contrib/Inetc/crt.cpp ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <Windows.h>
2
+
3
+ #if defined(_MSC_VER) && _MSC_VER+0 >= 1400
4
+ #if defined(_MSC_FULL_VER) && _MSC_FULL_VER+0 >= 140050727
5
+ #include <intrin.h>
6
+ #else
7
+ EXTERN_C void __stosb(BYTE*,BYTE,size_t);
8
+ #endif
9
+ #pragma intrinsic(__stosb)
10
+ #define CRTINTRINSIC_memset(p,c,s) __stosb((BYTE*)(p),(BYTE)(c),(s))
11
+ #endif
12
+
13
+ extern "C" void* __cdecl memset(void *p, int c, size_t z)
14
+ {
15
+ #ifdef CRTINTRINSIC_memset
16
+ CRTINTRINSIC_memset(p, c, z);
17
+ #else
18
+ BYTE *pb = reinterpret_cast<BYTE*>(p);
19
+ for(size_t i=0; i<z; ++i, ++pb)
20
+ (*pb) = c;
21
+ #endif
22
+ return p;
23
+ }
24
+
25
+ extern "C" const char* __cdecl strstr(const char *str, const char *target)
26
+ {
27
+ if (!*target) return (char*)str;
28
+ char *p1 = (char*)str, *p2 = (char*)target;
29
+ char *p1Adv = (char*)str;
30
+ while (*++p2)
31
+ p1Adv++;
32
+ while (*p1Adv)
33
+ {
34
+ char *p1Begin = p1;
35
+ p2 = (char*)target;
36
+ while (*p1 && *p2 && *p1 == *p2)
37
+ {
38
+ p1++;
39
+ p2++;
40
+ }
41
+ if (!*p2)
42
+ return p1Begin;
43
+ p1 = p1Begin + 1;
44
+ p1Adv++;
45
+ }
46
+ return NULL;
47
+ }
48
+
49
+ extern "C" const wchar_t* __cdecl wcsstr(const wchar_t *str, const wchar_t *target)
50
+ {
51
+ if (!*target) return (wchar_t*)str;
52
+ wchar_t *p1 = (wchar_t*)str, *p2 = (wchar_t*)target;
53
+ wchar_t *p1Adv = (wchar_t*)str;
54
+ while (*++p2)
55
+ p1Adv++;
56
+ while (*p1Adv)
57
+ {
58
+ wchar_t *p1Begin = p1;
59
+ p2 = (wchar_t*)target;
60
+ while (*p1 && *p2 && *p1 == *p2)
61
+ {
62
+ p1++;
63
+ p2++;
64
+ }
65
+ if (!*p2)
66
+ return p1Begin;
67
+ p1 = p1Begin + 1;
68
+ p1Adv++;
69
+ }
70
+ return NULL;
71
+ }
72
+
73
+ extern "C" const char* __cdecl strchr(const char* s, int ch)
74
+ {
75
+ while(*s && *s != ch)
76
+ ++s;
77
+ return s;
78
+ }
79
+
80
+ extern "C" const wchar_t* __cdecl wcschr(const wchar_t* s, wchar_t ch)
81
+ {
82
+ while(*s && *s != ch)
83
+ ++s;
84
+ return s;
85
+ }
86
+
87
+ extern "C" const char* __cdecl strrchr(const char* s, int c)
88
+ {
89
+ char *rtnval = 0;
90
+ do {
91
+ if (*s == c)
92
+ rtnval = (char*) s;
93
+ } while (*s++);
94
+ return rtnval;
95
+ }
96
+
97
+ extern "C" const wchar_t* __cdecl wcsrchr(const wchar_t* s, wchar_t c)
98
+ {
99
+ wchar_t *rtnval = 0;
100
+ do {
101
+ if (*s == c)
102
+ rtnval = (wchar_t*) s;
103
+ } while (*s++);
104
+ return rtnval;
105
+ }
build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.cpp ADDED
@@ -0,0 +1,1746 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*******************************************************
2
+ * FILE NAME: inetc.cpp
3
+ *
4
+ * Copyright (c) 2004-2015 Takhir Bedertdinov and NSIS contributors
5
+ *
6
+ * PURPOSE:
7
+ * ftp/http file download plug-in
8
+ * on the base of MS Inet API
9
+ * 4 GB limit (http support?)
10
+ *
11
+ * CHANGE HISTORY
12
+ *
13
+ * Author Date Modifications
14
+ * Takhir Bedertdinov
15
+ * Nov 11, 2004 Original
16
+ * Dec 17, 2004 Embedded edition -
17
+ * NSISdl GUI style as default
18
+ * (nsisdl.cpp code was partly used)
19
+ * Dec 17, 2004 MSI Banner style
20
+ * Feb 20, 2005 Resume download
21
+ * feature for big files and bad connections
22
+ * Mar 05, 2005 Proxy authentication
23
+ * and /POPUP caption prefix option
24
+ * Mar 25, 2005 Connect timeout option
25
+ * and FTP switched to passive mode
26
+ * Apr 18, 2005 Crack URL buffer size
27
+ * bug fixed (256->string_size)
28
+ * HTTP POST added
29
+ * Jun 06, 2005 IDOK on "Enter" key locked
30
+ * POST HTTP header added
31
+ * Jun 22, 2005 non-interaptable mode /nocancel
32
+ * and direct connect /noproxy
33
+ * Jun 29, 2005 post.php written and tested
34
+ * Jul 05, 2005 60 sec delay on WinInet detach problem
35
+ * solved (not fine, but works including
36
+ * installer exit and system reboot)
37
+ * Jul 08, 2005 'set foreground' finally removed
38
+ * Jul 26, 2005 POPUP translate option
39
+ * Aug 23, 2005 https service type in InternetConnect
40
+ * and "ignore certificate" flags
41
+ * Sep 30, 2005 https with bad certificate from old OS;
42
+ * Forbidden handling
43
+ * Dec 23, 2005 'put' entry point, new names, 12003
44
+ * ftp error handling (on ftp write permission)
45
+ * 405 http error (method not allowed)
46
+ * Mar 12, 2006 Internal authorization via InternetErrorDlg()
47
+ * and Unauthorized (401) handling.
48
+ * Jun 10, 2006 Caption text option for Resume download
49
+ * MessageBox
50
+ * Jun 24, 2006 HEAD method, silent mode clean up
51
+ * Sep 05, 2006 Center dialog code from Backland
52
+ * Sep 07, 2006 NSISdl crash fix /Backland idea/
53
+ * Sep 08, 2006 POST as dll entry point.
54
+ * Sep 21, 2006 parent dlg progr.bar style and font,
55
+ * nocancel via ws_sysmenu
56
+ * Sep 22, 2006 current lang IDCANCEL text, /canceltext
57
+ * and /useragent options
58
+ * Sep 24, 2006 .onInit improvements and defaults
59
+ * Nov 11, 2006 FTP path creation, root|current dir mgmt
60
+ * Jan 01, 2007 Global char[] cleanup, GetLastError() to
61
+ * status string on ERR_DIALOG, few MSVCRT replaces
62
+ * Jan 13, 2007 /HEADER option added
63
+ * Jan 28, 2007 _open -> CreateFile and related
64
+ * Feb 18, 2007 Speed calculating improved (pauses),
65
+ * /popup text parameter to hide URL
66
+ * Jun 07, 2007 Local file truncation added for download
67
+ * (CREATE_ALWAYS)
68
+ * Jun 11, 2007 FTP download permitted even if server rejects
69
+ * SIZE request (ProFTPD).
70
+ * Aug 11, 2007 Backland' fix for progress bar redraw/style
71
+ * issue in NSISdl display mode.
72
+ * Jan 09, 2008 {_trueparuex^}' fix - InternetSetFilePointer()
73
+ * returns -1 on error.
74
+ * /question option added for cancel question.
75
+ * Feb 15, 2008 PUT content-length file size fix
76
+ * Feb 17, 2008 char -> TCHAR replace for UNICODE option
77
+ * Feb 19, 2008 janekschwarz fix for HTTP PUT with auth
78
+ * CreateFile INVALID_HANDLE_VALUE on error fix
79
+ * Feb 20, 2008 base64 encoder update for unicode
80
+ * Feb 27, 2008 Unicode configurations added to VS 6 dsp
81
+ * Mar 20, 2008 HTTP PUT with proxy auth finally fixed
82
+ * FTP errors handling improved.
83
+ * HEAD bug fixed
84
+ * Mar 27, 2008 Details window hide/show in NSISdl mode
85
+ * Apr 10, 2008 Auth test method changed to HEAD for
86
+ * old proxy's
87
+ * Apr 30, 2008 InternetErrorDlg() ERROR_SUCESS on cancel
88
+ * click patched
89
+ * 3xx errors added to status list.
90
+ * May 20, 2008 InternetReadFile on cable disconnect patched
91
+ * May 20, 2008 Reply status "0" patch (name resolution?)
92
+ * Jul 15, 2008 HTTP 304 parsing. Incorrect size reported fix.
93
+ * Aug 21, 2009 Escape sequence convertion removed (caused
94
+ * error in signature with %2b requests)
95
+ * Marqueue progess bar style for unknown file size.
96
+ * Feb 04, 2010 Unicode POST patch - body converted to multibyte
97
+ * Jul 11, 2010 /FILE POST option added
98
+ * Nov 04, 2010 Disabled cookies and cache for cleanliness
99
+ * Feb 14, 2011 Fixed reget bug introduced in previous commit
100
+ * Feb 18, 2011 /NOCOOKIES option added
101
+ * Mar 02, 2011 User-agent buffer increased. Small memory leak fix
102
+ * Mar 23, 2011 Use caption on embedded progressbar - zenpoy
103
+ * Apr 05, 2011 reget fix - INTERNET_FLAG_RELOAD for first connect only
104
+ * Apr 27, 2011 /receivetimeout option added for big files and antivirus
105
+ * Jun 15, 2011 Stack clean up fix on cancel - zenpoy
106
+ * Oct 19, 2011 FTP PUT error parsing fix - tperquin
107
+ * Aug 19, 2013 Fix focus stealing when in silent - negativesir, JohnTHaller
108
+ * Jul 20, 2014 - 1.0.4.4 - Stuart 'Afrow UK' Welch
109
+ * /tostack & /tostackconv added
110
+ * Version information resource added
111
+ * Updated to NSIS 3.0 plugin API
112
+ * Upgraded to Visual Studio 2012
113
+ * 64-bit build added
114
+ * MSVCRT dependency removed
115
+ * Sep 04, 2015 - 1.0.5.0 - anders_k
116
+ * HTTPS connections are more secure by default
117
+ * Added /weaksecurity switch, reverts to old cert. security checks
118
+ * Sep 06, 2015 - 1.0.5.1 - anders_k
119
+ * Don't allow infinite FtpCreateDirectory tries
120
+ * Use memset intrinsic when possible to avoid VC code generation bug
121
+ * Oct 17, 2015 - 1.0.5.2 - anders_k
122
+ * Tries to set FTP mode to binary before querying the size.
123
+ * Calls FtpGetFileSize if it exists.
124
+ * Sep 24, 2018 - 1.0.5.3 - anders_k
125
+ * /tostackconv supports UTF-8 and UTF-16LE BOM sniffing and conversion.
126
+ *******************************************************/
127
+
128
+
129
+ #define _WIN32_WINNT 0x0500
130
+
131
+ #include <windows.h>
132
+ //#include <tchar.h>
133
+ #include <wininet.h>
134
+ #include <commctrl.h>
135
+ #include "pluginapi.h"
136
+ #include "resource.h"
137
+
138
+ #include <string.h> // strstr etc
139
+
140
+ #ifndef PBM_SETMARQUEE
141
+ #define PBM_SETMARQUEE (WM_USER + 10)
142
+ #define PBS_MARQUEE 0x08
143
+ #endif
144
+ #ifndef HTTP_QUERY_PROXY_AUTHORIZATION
145
+ #define HTTP_QUERY_PROXY_AUTHORIZATION 61
146
+ #endif
147
+ #ifndef SECURITY_FLAG_IGNORE_REVOCATION
148
+ #define SECURITY_FLAG_IGNORE_REVOCATION 0x00000080
149
+ #endif
150
+ #ifndef SECURITY_FLAG_IGNORE_UNKNOWN_CA
151
+ #define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100
152
+ #endif
153
+
154
+ // IE 4 safety and VS 6 compatibility
155
+ typedef BOOL (__stdcall *FTP_CMD)(HINTERNET,BOOL,DWORD,LPCTSTR,DWORD,HINTERNET *);
156
+ FTP_CMD myFtpCommand;
157
+
158
+ #define PLUGIN_NAME TEXT("Inetc plug-in")
159
+ #define INETC_USERAGENT TEXT("NSIS_Inetc (Mozilla)")
160
+ #define PB_RANGE 400 // progress bar values range
161
+ #define PAUSE1_SEC 2 // transfer error indication time, for reget only
162
+ #define PAUSE2_SEC 3 // paused state time, increase this if need (60?)
163
+ #define PAUSE3_SEC 1 // pause after resume button pressed
164
+ #define NOT_AVAILABLE 0xffffffff
165
+ #define POST_HEADER TEXT("Content-Type: application/x-www-form-urlencoded")
166
+ #define PUT_HEADER TEXT("Content-Type: octet-stream\nContent-Length: %d")
167
+ #define INTERNAL_OK 0xFFEE
168
+ #define PROGRESS_MS 1000 // screen values update interval
169
+ #define DEF_QUESTION TEXT("Are you sure that you want to stop download?")
170
+ #define HOST_AUTH_HDR TEXT("Authorization: basic %s")
171
+ #define PROXY_AUTH_HDR TEXT("Proxy-authorization: basic %s")
172
+
173
+ //#define MY_WEAKSECURITY_CERT_FLAGS SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_REVOCATION | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | SECURITY_FLAG_IGNORE_CERT_CN_INVALID
174
+ #define MY_WEAKSECURITY_CERT_FLAGS SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_REVOCATION
175
+ #define MY_REDIR_FLAGS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
176
+ #define MY_HTTPS_FLAGS (MY_REDIR_FLAGS | INTERNET_FLAG_SECURE)
177
+
178
+ enum STATUS_CODES {
179
+ ST_OK = 0,
180
+ ST_CONNECTING,
181
+ ST_DOWNLOAD,
182
+ ST_CANCELLED,
183
+ ST_URLOPEN,
184
+ // ST_OPENING,
185
+ ST_PAUSE,
186
+ ERR_TERMINATED,
187
+ ERR_DIALOG,
188
+ ERR_INETOPEN,
189
+ ERR_URLOPEN,
190
+ ERR_TRANSFER,
191
+ ERR_FILEOPEN,
192
+ ERR_FILEWRITE,
193
+ ERR_FILEREAD,
194
+ ERR_REGET,
195
+ ERR_CONNECT,
196
+ ERR_OPENREQUEST,
197
+ ERR_SENDREQUEST,
198
+ ERR_CRACKURL,
199
+ ERR_NOTFOUND,
200
+ ERR_THREAD,
201
+ ERR_PROXY,
202
+ ERR_FORBIDDEN,
203
+ ERR_NOTALLOWED,
204
+ ERR_REQUEST,
205
+ ERR_SERVER,
206
+ ERR_AUTH,
207
+ ERR_CREATEDIR,
208
+ ERR_PATH,
209
+ ERR_NOTMODIFIED,
210
+ ERR_REDIRECTION
211
+ };
212
+
213
+
214
+ static TCHAR szStatus[][32] = {
215
+ TEXT("OK"),TEXT("Connecting"),TEXT("Downloading"),TEXT("Cancelled"),TEXT("Connecting"), //TEXT("Opening URL")),
216
+ TEXT("Reconnect Pause"),TEXT("Terminated"),TEXT("Dialog Error"),TEXT("Open Internet Error"),
217
+ TEXT("Open URL Error"),TEXT("Transfer Error"),TEXT("File Open Error"),TEXT("File Write Error"),TEXT("File Read Error"),
218
+ TEXT("Reget Error"),TEXT("Connection Error"),TEXT("OpenRequest Error"),TEXT("SendRequest Error"),
219
+ TEXT("URL Parts Error"),TEXT("File Not Found (404)"),TEXT("CreateThread Error"),TEXT("Proxy Error (407)"),
220
+ TEXT("Access Forbidden (403)"),TEXT("Not Allowed (405)"),TEXT("Request Error"),TEXT("Server Error"),
221
+ TEXT("Unauthorized (401)"),TEXT("FtpCreateDir failed (550)"),TEXT("Error FTP path (550)"),TEXT("Not Modified"),
222
+ TEXT("Redirection")
223
+ };
224
+
225
+ HINSTANCE g_hInstance;
226
+ TCHAR fn[MAX_PATH]=TEXT(""),
227
+ *url = NULL,
228
+ *szAlias = NULL,
229
+ *szProxy = NULL,
230
+ *szHeader = NULL,
231
+ *szBanner = NULL,
232
+ *szQuestion = NULL,
233
+ szCancel[64]=TEXT(""),
234
+ szCaption[128]=TEXT(""),
235
+ szUserAgent[256]=TEXT(""),
236
+ szResume[256] = TEXT("Your internet connection seems to be not permitted or dropped out!\nPlease reconnect and click Retry to resume installation.");
237
+ CHAR *szPost = NULL,
238
+ post_fname[MAX_PATH] = "";
239
+ DWORD fSize = 0;
240
+ TCHAR *szToStack = NULL;
241
+
242
+ int status;
243
+ DWORD cnt = 0,
244
+ cntToStack = 0,
245
+ fs = 0,
246
+ timeout = 0,
247
+ receivetimeout = 0;
248
+ DWORD startTime, transfStart, openType;
249
+ bool silent, popup, resume, nocancel, noproxy, nocookies, convToStack, g_ignorecertissues;
250
+
251
+ HWND childwnd;
252
+ HWND hDlg;
253
+ bool fput = false, fhead = false;
254
+
255
+
256
+ #define Option_IgnoreCertIssues() ( g_ignorecertissues )
257
+
258
+ static FARPROC GetWininetProcAddress(LPCSTR Name)
259
+ {
260
+ return GetProcAddress(LoadLibraryA("WININET"), Name);
261
+ }
262
+
263
+ /*****************************************************
264
+ * FUNCTION NAME: sf(HWND)
265
+ * PURPOSE:
266
+ * moves HWND to top and activates it
267
+ * SPECIAL CONSIDERATIONS:
268
+ * commented because annoying
269
+ *****************************************************/
270
+ /*
271
+ void sf(HWND hw)
272
+ {
273
+ DWORD ctid = GetCurrentThreadId();
274
+ DWORD ftid = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
275
+ AttachThreadInput(ftid, ctid, TRUE);
276
+ SetForegroundWindow(hw);
277
+ AttachThreadInput(ftid, ctid, FALSE);
278
+ }
279
+ */
280
+
281
+ static TCHAR szUrl[64] = TEXT("");
282
+ static TCHAR szDownloading[64] = TEXT("Downloading %s");
283
+ static TCHAR szConnecting[64] = TEXT("Connecting ...");
284
+ static TCHAR szSecond[64] = TEXT("second");
285
+ static TCHAR szMinute[32] = TEXT("minute");
286
+ static TCHAR szHour[32] = TEXT("hour");
287
+ static TCHAR szPlural[32] = TEXT("s");
288
+ static TCHAR szProgress[128] = TEXT("%dkB (%d%%) of %dkB @ %d.%01dkB/s");
289
+ static TCHAR szRemaining[64] = TEXT(" (%d %s%s remaining)");
290
+ static TCHAR szBasic[128] = TEXT("");
291
+ static TCHAR szAuth[128] = TEXT("");
292
+
293
+ // is it possible to make it working with unicode strings?
294
+
295
+ /* Base64 encode one byte */
296
+ static TCHAR encode(unsigned char u) {
297
+
298
+ if(u < 26) return TEXT('A')+u;
299
+ if(u < 52) return TEXT('a')+(u-26);
300
+ if(u < 62) return TEXT('0')+(u-52);
301
+ if(u == 62) return TEXT('+');
302
+ return TEXT('/');
303
+ }
304
+
305
+ TCHAR *encode_base64(int size, TCHAR *src, TCHAR *dst) {
306
+
307
+ int i;
308
+ TCHAR *p;
309
+
310
+ if(!src)
311
+ return NULL;
312
+
313
+ if(!size)
314
+ size= lstrlen(src);
315
+
316
+ p = dst;
317
+
318
+ for(i=0; i<size; i+=3) {
319
+
320
+ unsigned char b1=0, b2=0, b3=0, b4=0, b5=0, b6=0, b7=0;
321
+
322
+ b1 = (unsigned char)src[i];
323
+
324
+ if(i+1<size)
325
+ b2 = (unsigned char)src[i+1];
326
+
327
+ if(i+2<size)
328
+ b3 = (unsigned char)src[i+2];
329
+
330
+ b4= b1>>2;
331
+ b5= ((b1&0x3)<<4)|(b2>>4);
332
+ b6= ((b2&0xf)<<2)|(b3>>6);
333
+ b7= b3&0x3f;
334
+
335
+ *p++= encode(b4);
336
+ *p++= encode(b5);
337
+
338
+ if(i+1<size) {
339
+ *p++= encode(b6);
340
+ } else {
341
+ *p++= TEXT('=');
342
+ }
343
+
344
+ if(i+2<size) {
345
+ *p++= encode(b7);
346
+ } else {
347
+ *p++= TEXT('=');
348
+ }
349
+
350
+ }
351
+
352
+ return dst;
353
+ }
354
+
355
+ /*****************************************************
356
+ * FUNCTION NAME: fileTransfer()
357
+ * PURPOSE:
358
+ * http/ftp file transfer itself
359
+ * for any protocol and both directions I guess
360
+ * SPECIAL CONSIDERATIONS:
361
+ *
362
+ *****************************************************/
363
+ void fileTransfer(HANDLE localFile,
364
+ HINTERNET hFile)
365
+ {
366
+ static BYTE data_buf[1024*8];
367
+ BYTE *dw;
368
+ DWORD rslt = 0;
369
+ DWORD bytesDone;
370
+
371
+ status = ST_DOWNLOAD;
372
+ while(status == ST_DOWNLOAD)
373
+ {
374
+ if(fput)
375
+ {
376
+ if(!ReadFile(localFile, data_buf, rslt = sizeof(data_buf), &bytesDone, NULL))
377
+ {
378
+ status = ERR_FILEREAD;
379
+ break;
380
+ }
381
+ if(bytesDone == 0) // EOF reached
382
+ {
383
+ status = ST_OK;
384
+ break;
385
+ }
386
+ while(bytesDone > 0)
387
+ {
388
+ dw = data_buf;
389
+ if(!InternetWriteFile(hFile, dw, bytesDone, &rslt) || rslt == 0)
390
+ {
391
+ status = ERR_TRANSFER;
392
+ break;
393
+ }
394
+ dw += rslt;
395
+ cnt += rslt;
396
+ bytesDone -= rslt;
397
+ }
398
+ }
399
+ else
400
+ {
401
+ if(!InternetReadFile(hFile, data_buf, sizeof(data_buf), &rslt))
402
+ {
403
+ status = ERR_TRANSFER;
404
+ break;
405
+ }
406
+ if(rslt == 0) // EOF reached or cable disconnect
407
+ {
408
+ // on cable disconnect returns TRUE and 0 bytes. is cnt == 0 OK (zero file size)?
409
+ // cannot check this if reply is chunked (no content-length, http 1.1)
410
+ status = (fs != NOT_AVAILABLE && cnt < fs) ? ERR_TRANSFER : ST_OK;
411
+ break;
412
+ }
413
+ if(szToStack)
414
+ {
415
+ for (DWORD i = 0; cntToStack < g_stringsize && i < rslt; i++, cntToStack++)
416
+ if (convToStack)
417
+ *((BYTE*)szToStack + cntToStack) = data_buf[i]; // Bytes
418
+ else
419
+ *(szToStack + cntToStack) = data_buf[i]; // ? to TCHARs
420
+ }
421
+ else if(!WriteFile(localFile, data_buf, rslt, &bytesDone, NULL) ||
422
+ rslt != bytesDone)
423
+ {
424
+ status = ERR_FILEWRITE;
425
+ break;
426
+ }
427
+ cnt += rslt;
428
+ }
429
+ }
430
+ }
431
+
432
+ /*****************************************************
433
+ * FUNCTION NAME: mySendRequest()
434
+ * PURPOSE:
435
+ * HttpSendRequestEx() sends headers only - for PUT
436
+ * We also can use InetWriteFile for POST body I guess
437
+ * SPECIAL CONSIDERATIONS:
438
+ *
439
+ *****************************************************/
440
+ int mySendRequest(HINTERNET hFile)
441
+ {
442
+ INTERNET_BUFFERS BufferIn = {0};
443
+ if(fput)
444
+ {
445
+ BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );
446
+ BufferIn.dwBufferTotal = fs;
447
+ return HttpSendRequestEx( hFile, &BufferIn, NULL, HSR_INITIATE, 0);
448
+ }
449
+ return HttpSendRequest(hFile, NULL, 0, szPost, fSize);
450
+ }
451
+
452
+ /*****************************************************
453
+ * FUNCTION NAME: queryStatus()
454
+ * PURPOSE:
455
+ * http status code comes before download (get) and
456
+ * after upload (put), so this is called from 2 places
457
+ * SPECIAL CONSIDERATIONS:
458
+ *
459
+ *****************************************************/
460
+ bool queryStatus(HINTERNET hFile)
461
+ {
462
+ TCHAR buf[256] = TEXT("");
463
+ DWORD rslt;
464
+ if(HttpQueryInfo(hFile, HTTP_QUERY_STATUS_CODE,
465
+ buf, &(rslt = sizeof(buf)), NULL))
466
+ {
467
+ buf[3] = 0;
468
+ if(lstrcmp(buf, TEXT("0")) == 0 || *buf == 0)
469
+ status = ERR_SENDREQUEST;
470
+ else if(lstrcmp(buf, TEXT("401")) == 0)
471
+ status = ERR_AUTH;
472
+ else if(lstrcmp(buf, TEXT("403")) == 0)
473
+ status = ERR_FORBIDDEN;
474
+ else if(lstrcmp(buf, TEXT("404")) == 0)
475
+ status = ERR_NOTFOUND;
476
+ else if(lstrcmp(buf, TEXT("407")) == 0)
477
+ status = ERR_PROXY;
478
+ else if(lstrcmp(buf, TEXT("405")) == 0)
479
+ status = ERR_NOTALLOWED;
480
+ else if(lstrcmp(buf, TEXT("304")) == 0)
481
+ status = ERR_NOTMODIFIED;
482
+ else if(*buf == TEXT('3'))
483
+ {
484
+ status = ERR_REDIRECTION;
485
+ wsprintf(szStatus[status] + lstrlen(szStatus[status]), TEXT(" (%s)"), buf);
486
+ }
487
+ else if(*buf == TEXT('4'))
488
+ {
489
+ status = ERR_REQUEST;
490
+ wsprintf(szStatus[status] + lstrlen(szStatus[status]), TEXT(" (%s)"), buf);
491
+ }
492
+ else if(*buf == TEXT('5'))
493
+ {
494
+ status = ERR_SERVER;
495
+ wsprintf(szStatus[status] + lstrlen(szStatus[status]), TEXT(" (%s)"), buf);
496
+ }
497
+ return true;
498
+ }
499
+ return false;
500
+ }
501
+
502
+ /*****************************************************
503
+ * FUNCTION NAME: openFtpFile()
504
+ * PURPOSE:
505
+ * control connection, size request, re-get lseek
506
+ * SPECIAL CONSIDERATIONS:
507
+ *
508
+ *****************************************************/
509
+ HINTERNET openFtpFile(HINTERNET hConn,
510
+ TCHAR *path)
511
+ {
512
+ TCHAR buf[256] = TEXT(""), *movp;
513
+ HINTERNET hFile;
514
+ DWORD rslt, err, gle;
515
+ bool https_req_ok = false;
516
+
517
+ /* reads connection / auth responce info and cleares 'control' buffer this way */
518
+ InternetGetLastResponseInfo(&err, buf, &(rslt = sizeof(buf)));
519
+ if(cnt == 0)
520
+ {
521
+ if(!fput) // we know local file size already
522
+ {
523
+ if (myFtpCommand)
524
+ {
525
+ /* Try to set the REPRESENTATION TYPE to I[mage] (Binary) because some servers
526
+ don't accept the SIZE command in ASCII mode */
527
+ myFtpCommand(hConn, false, FTP_TRANSFER_TYPE_ASCII, TEXT("TYPE I"), 0, &hFile);
528
+ }
529
+ /* too clever myFtpCommand returnes false on the valid TEXT("550 Not found/Not permitted" server answer,
530
+ to read answer I had to ignory returned false (!= 999999) :-(
531
+ GetLastError also possible, but MSDN description of codes is very limited */
532
+ wsprintf(buf, TEXT("SIZE %s"), path + 1);
533
+ if(myFtpCommand != NULL &&
534
+ myFtpCommand(hConn, false, FTP_TRANSFER_TYPE_ASCII, buf, 0, &hFile) != 9999 &&
535
+ memset(buf, 0, sizeof(buf)) != NULL &&
536
+ InternetGetLastResponseInfo(&err, buf, &(rslt = sizeof(buf))))
537
+ {
538
+ if(_tcsstr(buf, TEXT("213 ")))
539
+ {
540
+ fs = myatou(_tcschr(buf, TEXT(' ')) + 1);
541
+ }
542
+ /* stupid ProFTPD returns error on SIZE request. let's continue without size.
543
+ But IE knows some trick to get size from ProFTPD......
544
+ else if(mystrstr(buf, TEXT("550 TEXT("))
545
+ {
546
+ status = ERR_SIZE_NOT_PERMITTED;
547
+ return NULL;
548
+ }
549
+ */
550
+ }
551
+ if(fs == 0)
552
+ {
553
+ fs = NOT_AVAILABLE;
554
+ }
555
+ }
556
+ }
557
+ else
558
+ {
559
+ wsprintf(buf, TEXT("REST %d"), cnt);
560
+ if(myFtpCommand == NULL ||
561
+ !myFtpCommand(hConn, false, FTP_TRANSFER_TYPE_BINARY, buf, 0, &hFile) ||
562
+ memset(buf, 0, sizeof(buf)) == NULL ||
563
+ !InternetGetLastResponseInfo(&err, buf, &(rslt = sizeof(buf))) ||
564
+ (_tcsstr(buf, TEXT("350")) == NULL && _tcsstr(buf, TEXT("110")) == NULL))
565
+ {
566
+ status = ERR_REGET;
567
+ return NULL;
568
+ }
569
+ }
570
+ if((hFile = FtpOpenFile(hConn, path + 1, fput ? GENERIC_WRITE : GENERIC_READ,
571
+ FTP_TRANSFER_TYPE_BINARY|INTERNET_FLAG_RELOAD,0)) == NULL)
572
+ {
573
+ gle = GetLastError();
574
+ *buf = 0;
575
+ InternetGetLastResponseInfo(&err, buf, &(rslt = sizeof(buf)));
576
+ // wrong path - dir may not exist or upload may be not allowed
577
+ // we use ftp://host//path (double /) to define path from FS root
578
+ if(fput && (_tcsstr(buf, TEXT("550")) != NULL || _tcsstr(buf, TEXT("553")) != NULL))
579
+ {
580
+ movp = path + 1;
581
+ if(*movp == TEXT('/')) movp++; // don't need to create root
582
+ for (UINT8 escapehatch = 0; ++escapehatch;) // Weak workaround for http://forums.winamp.com/showpost.php?p=3031692&postcount=513 bug
583
+ {
584
+ TCHAR *pbs = _tcschr(movp, TEXT('/'));
585
+ if (!pbs) break;
586
+ *pbs = TEXT('\0');
587
+ FtpCreateDirectory(hConn, path + 1);
588
+ InternetGetLastResponseInfo(&err, buf, &(rslt = sizeof(buf)));
589
+ *(movp + lstrlen(movp)) = TEXT('/');
590
+ movp = _tcschr(movp, TEXT('/')) + 1;
591
+ }
592
+ if(status != ERR_CREATEDIR &&
593
+ (hFile = FtpOpenFile(hConn, path + 1, GENERIC_WRITE,
594
+ FTP_TRANSFER_TYPE_BINARY|INTERNET_FLAG_RELOAD,0)) == NULL)
595
+ {
596
+ status = ERR_PATH;
597
+ if(InternetGetLastResponseInfo(&err, buf, &(rslt = sizeof(buf))))
598
+ lstrcpyn(szStatus[status], _tcsstr(buf, TEXT("550")), sizeof(szStatus[0]) / sizeof(TCHAR));
599
+ }
600
+ }
601
+ // may be firewall related error, let's give user time to disable it
602
+ else if(gle == 12003) // ERROR_INTERNET_EXTENDED_ERROR
603
+ {
604
+ if(_tcsstr(buf, TEXT("550")))
605
+ {
606
+ status = ERR_NOTFOUND;
607
+ lstrcpyn(szStatus[status], _tcsstr(buf, TEXT("550")), sizeof(szStatus[0]) / sizeof(TCHAR));
608
+ }
609
+ else
610
+ {
611
+ lstrcpyn(szStatus[status], buf, sizeof(szStatus[0]) / sizeof(TCHAR));
612
+ }
613
+ }
614
+ // timeout (firewall or dropped connection problem)
615
+ else if(gle == 12002) // ERROR_INTERNET_TIMEOUT
616
+ {
617
+ if(!silent)
618
+ resume = true;
619
+ status = ERR_URLOPEN;
620
+ }
621
+ }
622
+ else
623
+ InternetGetLastResponseInfo(&err, buf, &(rslt = sizeof(buf)));
624
+ if (hFile && NOT_AVAILABLE == fs)
625
+ {
626
+ FARPROC ftpgfs = GetWininetProcAddress("FtpGetFileSize"); // IE5+
627
+ if (ftpgfs)
628
+ {
629
+ DWORD shi, slo = ((DWORD(WINAPI*)(HINTERNET,DWORD*))ftpgfs)(hFile, &shi);
630
+ if (slo != -1 && !shi) fs = slo;
631
+ }
632
+ }
633
+ return hFile;
634
+ }
635
+
636
+
637
+ /*****************************************************
638
+ * FUNCTION NAME: openHttpFile()
639
+ * PURPOSE:
640
+ * file open, size request, re-get lseek
641
+ * SPECIAL CONSIDERATIONS:
642
+ *
643
+ *****************************************************/
644
+ HINTERNET openHttpFile(HINTERNET hConn, INTERNET_SCHEME nScheme, TCHAR *path)
645
+ {
646
+ TCHAR buf[256] = TEXT("");
647
+ HINTERNET hFile;
648
+ DWORD rslt, err;
649
+ bool first_attempt = true;;
650
+
651
+ // test connection for PUT, the only way to do this before sending data
652
+ // OPTIONS fails on HttpOpenRequest step for HTTPS
653
+ // but works for HEAD I guess
654
+ if(fput)// && nScheme != INTERNET_SCHEME_HTTPS)
655
+ {
656
+ // old proxy's may not support OPTIONS request, so changed to HEAD....
657
+ if((hFile = HttpOpenRequest(hConn, TEXT("HEAD"), path, NULL, NULL, NULL,
658
+ // if((hFile = HttpOpenRequest(hConn, TEXT("OPTIONS"), path, NULL, NULL, NULL,
659
+ INTERNET_FLAG_RELOAD | INTERNET_FLAG_KEEP_CONNECTION |
660
+ (nocookies ? (INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_COOKIES) : 0), 0)) != NULL)
661
+ {
662
+ if(*szAuth)
663
+ {
664
+ wsprintf(buf, PROXY_AUTH_HDR, szAuth);
665
+ HttpAddRequestHeaders(hFile, buf, -1,
666
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
667
+ }
668
+ resend_proxy1:
669
+ if(*szBasic)
670
+ {
671
+ wsprintf(buf, HOST_AUTH_HDR, szBasic);
672
+ HttpAddRequestHeaders(hFile, buf, -1,
673
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
674
+ }
675
+ resend_auth1:
676
+ if(HttpSendRequest(hFile, NULL, 0, NULL, 0))
677
+ {
678
+ queryStatus(hFile);
679
+ // may be don't need to read all from socket, but this looks safer
680
+ while(InternetReadFile(hFile, buf, sizeof(buf), &rslt) && rslt > 0) {}
681
+ if(!silent && (status == ERR_PROXY || status == ERR_AUTH))// || status == ERR_FORBIDDEN))
682
+ {
683
+ rslt = InternetErrorDlg(hDlg, hFile,
684
+ ERROR_INTERNET_INCORRECT_PASSWORD,
685
+ FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
686
+ FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
687
+ FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
688
+ NULL);
689
+ if (rslt == ERROR_INTERNET_FORCE_RETRY)
690
+ {
691
+ status = ST_URLOPEN;
692
+ if(status == ERR_PROXY) goto resend_proxy1;
693
+ else goto resend_auth1;
694
+ }
695
+ else
696
+ {
697
+ status = ST_CANCELLED;
698
+ }
699
+
700
+ }
701
+ // no such file is OK for PUT. server first checks authentication
702
+ if(status == ERR_NOTFOUND || status == ERR_FORBIDDEN || status == ERR_NOTALLOWED)
703
+ {
704
+ // MessageBox(childwnd, TEXT("NOT_FOUND"), "", 0);
705
+ status = ST_URLOPEN;
706
+ }
707
+ // parameters might be updated during dialog popup
708
+ if(status == ST_URLOPEN)
709
+ {
710
+ *buf = 0;
711
+ if(HttpQueryInfo(hFile, HTTP_QUERY_AUTHORIZATION, buf, &(rslt = sizeof(buf)), NULL) && *buf)
712
+ lstrcpyn(szBasic, buf, rslt);
713
+ *buf = 0;
714
+ if(HttpQueryInfo(hFile, HTTP_QUERY_PROXY_AUTHORIZATION, buf, &(rslt = sizeof(buf)), NULL) && *buf)
715
+ lstrcpyn(szAuth, buf, rslt);
716
+ }
717
+ }
718
+ else status = ERR_SENDREQUEST;
719
+ InternetCloseHandle(hFile);
720
+ }
721
+ else status = ERR_OPENREQUEST;
722
+ }
723
+ // request itself
724
+ if(status == ST_URLOPEN)
725
+ {
726
+ DWORD secflags = nScheme == INTERNET_SCHEME_HTTPS ? MY_HTTPS_FLAGS : 0;
727
+ if (Option_IgnoreCertIssues()) secflags |= MY_WEAKSECURITY_CERT_FLAGS;
728
+ DWORD cokflags = nocookies ? (INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_COOKIES) : 0;
729
+ if((hFile = HttpOpenRequest(hConn, fput ? TEXT("PUT") : (fhead ? TEXT("HEAD") : (szPost ? TEXT("POST") : NULL)),
730
+ path, NULL, NULL, NULL,
731
+ // INTERNET_FLAG_RELOAD conflicts with reget - hidden re-read from beginning has place
732
+ // INTERNET_FLAG_RESYNCHRONIZE // note - sync may not work with some http servers
733
+ // reload on first connect (and any req. except GET), just continue on resume.
734
+ // HTTP Proxy still is a problem for reget
735
+ (cnt ? 0 : INTERNET_FLAG_RELOAD) | INTERNET_FLAG_KEEP_CONNECTION | cokflags | secflags, 0)) != NULL)
736
+ {
737
+ if(*szAuth)
738
+ {
739
+ wsprintf(buf, PROXY_AUTH_HDR, szAuth);
740
+ HttpAddRequestHeaders(hFile, buf, -1,
741
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
742
+ }
743
+ resend_proxy2:
744
+ if(szPost != NULL)
745
+ HttpAddRequestHeaders(hFile, POST_HEADER,
746
+ -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
747
+ if(*post_fname)
748
+ HttpAddRequestHeadersA(hFile, post_fname,
749
+ -1, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
750
+ if(szHeader != NULL)
751
+ HttpAddRequestHeaders(hFile, szHeader, -1,
752
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
753
+ if(*szBasic)
754
+ {
755
+ wsprintf(buf, HOST_AUTH_HDR, szBasic);
756
+ HttpAddRequestHeaders(hFile, buf, -1,
757
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
758
+ }
759
+ if(fput)
760
+ {
761
+ wsprintf(buf, PUT_HEADER, fs);
762
+ HttpAddRequestHeaders(hFile, buf, -1,
763
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
764
+ }
765
+ resend_auth2:
766
+ first_attempt = true;
767
+ if(nScheme == INTERNET_SCHEME_HTTPS)
768
+ {
769
+ if(!mySendRequest(hFile))
770
+ {
771
+ InternetQueryOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
772
+ (LPVOID)&rslt, &(err = sizeof(rslt)));
773
+ rslt |= Option_IgnoreCertIssues() ? MY_WEAKSECURITY_CERT_FLAGS : 0;
774
+ InternetSetOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
775
+ &rslt, sizeof(rslt) );
776
+ }
777
+ else first_attempt = false;
778
+ }
779
+ // https Request answer may be after optional second Send only on Win98
780
+ if(!first_attempt || mySendRequest(hFile))
781
+ {
782
+ // no status for PUT - headers were sent only. And not need to get size / set position
783
+ if(!fput)
784
+ {
785
+ queryStatus(hFile);
786
+ if(!silent && (status == ERR_PROXY || status == ERR_AUTH))
787
+ {
788
+ rslt = InternetErrorDlg(hDlg, hFile,
789
+ ERROR_INTERNET_INCORRECT_PASSWORD,
790
+ FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
791
+ FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
792
+ FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
793
+ NULL);
794
+ if (rslt == ERROR_INTERNET_FORCE_RETRY)
795
+ {
796
+ status = ST_URLOPEN;
797
+ if(status == ERR_PROXY) goto resend_proxy2;
798
+ else goto resend_auth2;
799
+ }
800
+ else
801
+ status = ST_CANCELLED;
802
+
803
+ }
804
+ // get size / set position
805
+ if(status == ST_URLOPEN)
806
+ {
807
+ if(cnt == 0)
808
+ {
809
+ if(HttpQueryInfo(hFile, HTTP_QUERY_CONTENT_LENGTH, buf,
810
+ &(rslt = sizeof(buf)), NULL))
811
+ fs = myatou(buf);
812
+ else
813
+ fs = NOT_AVAILABLE;
814
+ }
815
+ else
816
+ {
817
+ if((int)InternetSetFilePointer(hFile, cnt, NULL, FILE_BEGIN, 0) == -1)
818
+ status = ERR_REGET;
819
+ }
820
+ }
821
+ }
822
+ }
823
+ else
824
+ {
825
+ if(!queryStatus(hFile))
826
+ status = ERR_SENDREQUEST;
827
+ }
828
+ }
829
+ else status = ERR_OPENREQUEST;
830
+ }
831
+ return hFile;
832
+ }
833
+
834
+ /*****************************************************
835
+ * FUNCTION NAME: inetTransfer()
836
+ * PURPOSE:
837
+ * http/ftp file transfer
838
+ * SPECIAL CONSIDERATIONS:
839
+ *
840
+ *****************************************************/
841
+ DWORD __stdcall inetTransfer(void *hw)
842
+ {
843
+ HINTERNET hSes, hConn, hFile;
844
+ HANDLE localFile = NULL;
845
+ HWND hDlg = (HWND)hw;
846
+ DWORD lastCnt, rslt, err;
847
+ static TCHAR hdr[2048];
848
+ TCHAR *host = (TCHAR*)LocalAlloc(LPTR, g_stringsize * sizeof(TCHAR)),
849
+ *path = (TCHAR*)LocalAlloc(LPTR, g_stringsize * sizeof(TCHAR)),
850
+ *params = (TCHAR*)LocalAlloc(LPTR, g_stringsize * sizeof(TCHAR)),
851
+ *user = (TCHAR*)LocalAlloc(LPTR, g_stringsize * sizeof(TCHAR)),
852
+ *passwd = (TCHAR*)LocalAlloc(LPTR, g_stringsize * sizeof(TCHAR));
853
+
854
+ URL_COMPONENTS uc = {sizeof(URL_COMPONENTS), NULL, 0,
855
+ (INTERNET_SCHEME)0, host, g_stringsize, 0 , user, g_stringsize,
856
+ passwd, g_stringsize, path, g_stringsize, params, g_stringsize};
857
+
858
+ if((hSes = InternetOpen(szUserAgent, openType, szProxy, NULL, 0)) != NULL)
859
+ {
860
+ if(InternetQueryOption(hSes, INTERNET_OPTION_CONNECTED_STATE, &(rslt=0),
861
+ &(lastCnt=sizeof(DWORD))) &&
862
+ (rslt & INTERNET_STATE_DISCONNECTED_BY_USER))
863
+ {
864
+ INTERNET_CONNECTED_INFO ci = {INTERNET_STATE_CONNECTED, 0};
865
+ InternetSetOption(hSes,
866
+ INTERNET_OPTION_CONNECTED_STATE, &ci, sizeof(ci));
867
+ }
868
+ if(timeout > 0)
869
+ lastCnt = InternetSetOption(hSes, INTERNET_OPTION_CONNECT_TIMEOUT, &timeout, sizeof(timeout));
870
+ if(receivetimeout > 0)
871
+ InternetSetOption(hSes, INTERNET_OPTION_RECEIVE_TIMEOUT, &receivetimeout, sizeof(receivetimeout));
872
+ // 60 sec WinInet.dll detach delay on socket time_wait fix
873
+ myFtpCommand = (FTP_CMD) GetWininetProcAddress(
874
+ #ifdef UNICODE
875
+ "FtpCommandW"
876
+ #else
877
+ "FtpCommandA"
878
+ #endif
879
+ );
880
+ while(!popstring(url) && lstrcmpi(url, TEXT("/end")) != 0)
881
+ {
882
+ // too many customers requested not to do this
883
+ // sf(hDlg);
884
+ if(popstring(fn) != 0 || lstrcmpi(url, TEXT("/end")) == 0) break;
885
+ status = ST_CONNECTING;
886
+ cnt = fs = *host = *user = *passwd = *path = *params = 0;
887
+ PostMessage(hDlg, WM_TIMER, 1, 0); // show url & fn, do it sync
888
+ if(szToStack || (localFile = CreateFile(fn, fput ? GENERIC_READ : GENERIC_WRITE, FILE_SHARE_READ,
889
+ NULL, fput ? OPEN_EXISTING : CREATE_ALWAYS, 0, NULL)) != INVALID_HANDLE_VALUE)
890
+ {
891
+ uc.dwHostNameLength = uc.dwUserNameLength = uc.dwPasswordLength =
892
+ uc.dwUrlPathLength = uc.dwExtraInfoLength = g_stringsize;
893
+ if(fput)
894
+ {
895
+ fs = GetFileSize(localFile, NULL);
896
+ }
897
+ if(InternetCrackUrl(url, 0, 0/*ICU_ESCAPE*/ , &uc))
898
+ {
899
+ // auth headers for HTTP PUT seems to be lost, preparing encoded login:password
900
+ if(*user && *passwd)
901
+ {
902
+ wsprintf(hdr, TEXT("%s:%s"), user, passwd);
903
+ // does unicode version of encoding works correct?
904
+ // are user and passwd ascii only?
905
+ encode_base64(lstrlen(hdr), hdr, szBasic);
906
+ *hdr = 0;
907
+ }
908
+ lstrcat(path, params); // BUGBUG: Could overflow path?
909
+ transfStart = GetTickCount();
910
+ do
911
+ {
912
+ // re-PUT to already deleted tmp file on http server is not possible.
913
+ // the same with POST - must re-send data to server. for 'resume' loop
914
+ if((fput && uc.nScheme != INTERNET_SCHEME_FTP) || szPost)
915
+ {
916
+ cnt = 0;
917
+ SetFilePointer(localFile, 0, NULL, FILE_BEGIN);
918
+ }
919
+ status = ST_CONNECTING;
920
+ lastCnt = cnt;
921
+ if((hConn = InternetConnect(hSes, host, uc.nPort,
922
+ lstrlen(user) > 0 ? user : NULL,
923
+ lstrlen(passwd) > 0 ? passwd : NULL,
924
+ uc.nScheme == INTERNET_SCHEME_FTP ? INTERNET_SERVICE_FTP : INTERNET_SERVICE_HTTP,
925
+ uc.nScheme == INTERNET_SCHEME_FTP ? INTERNET_FLAG_PASSIVE : 0, 0)) != NULL)
926
+ {
927
+ status = ST_URLOPEN;
928
+ hFile = uc.nScheme == INTERNET_SCHEME_FTP ?
929
+ openFtpFile(hConn, path) : openHttpFile(hConn, uc.nScheme, path);
930
+ if(status != ST_URLOPEN && hFile != NULL)
931
+ {
932
+ InternetCloseHandle(hFile);
933
+ hFile = NULL;
934
+ }
935
+ if(hFile != NULL)
936
+ {
937
+ if(fhead)
938
+ {// repeating calls clear headers..
939
+ if(HttpQueryInfo(hFile, HTTP_QUERY_RAW_HEADERS_CRLF, hdr, &(rslt=2048), NULL))
940
+ {
941
+ if(szToStack)
942
+ {
943
+ for (DWORD i = 0; cntToStack < g_stringsize && i < rslt; i++, cntToStack++)
944
+ *(szToStack + cntToStack) = hdr[i]; // ASCII to TCHAR
945
+ }
946
+ else
947
+ {
948
+ WriteFile(localFile, hdr, rslt, &lastCnt, NULL);
949
+ }
950
+ }
951
+ status = ST_OK;
952
+ }
953
+ else
954
+ {
955
+ HWND hBar = GetDlgItem(hDlg, IDC_PROGRESS1);
956
+ SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_SETPOS, 0, 0);
957
+ SetWindowText(GetDlgItem(hDlg, IDC_STATIC5), fs == NOT_AVAILABLE ? TEXT("Not Available") : TEXT(""));
958
+ SetWindowText(GetDlgItem(hDlg, IDC_STATIC4), fs == NOT_AVAILABLE ? TEXT("Unknown") : TEXT(""));
959
+ SetWindowLong(hBar, GWL_STYLE, fs == NOT_AVAILABLE ?
960
+ (GetWindowLong(hBar, GWL_STYLE) | PBS_MARQUEE) : (GetWindowLong(hBar, GWL_STYLE) & ~PBS_MARQUEE));
961
+ SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_SETMARQUEE, (WPARAM)(fs == NOT_AVAILABLE ? 1 : 0), (LPARAM)50 );
962
+ fileTransfer(localFile, hFile);
963
+ if(fput && uc.nScheme != INTERNET_SCHEME_FTP)
964
+ {
965
+ rslt = HttpEndRequest(hFile, NULL, 0, 0);
966
+ queryStatus(hFile);
967
+ }
968
+ }
969
+ InternetCloseHandle(hFile);
970
+ }
971
+ InternetCloseHandle(hConn);
972
+ }
973
+ else
974
+ {
975
+ status = ERR_CONNECT;
976
+ if(uc.nScheme == INTERNET_SCHEME_FTP &&
977
+ InternetGetLastResponseInfo(&err, hdr, &(rslt = sizeof(hdr))) &&
978
+ _tcsstr(hdr, TEXT("530")))
979
+ {
980
+ lstrcpyn(szStatus[status], _tcsstr(hdr, TEXT("530")), sizeof(szStatus[0]) / sizeof(TCHAR));
981
+ }
982
+ else
983
+ {
984
+ rslt = GetLastError();
985
+ if((rslt == 12003 || rslt == 12002) && !silent)
986
+ resume = true;
987
+ }
988
+ }
989
+ } while(((!fput || uc.nScheme == INTERNET_SCHEME_FTP) &&
990
+ cnt > lastCnt &&
991
+ status == ERR_TRANSFER &&
992
+ SleepEx(PAUSE1_SEC * 1000, false) == 0 &&
993
+ (status = ST_PAUSE) != ST_OK &&
994
+ SleepEx(PAUSE2_SEC * 1000, false) == 0)
995
+ || (resume &&
996
+ status != ST_OK &&
997
+ status != ST_CANCELLED &&
998
+ status != ERR_NOTFOUND &&
999
+ ShowWindow(hDlg, SW_HIDE) != -1 &&
1000
+ MessageBox(GetParent(hDlg), szResume, *szCaption ? szCaption : PLUGIN_NAME, MB_RETRYCANCEL|MB_ICONWARNING) == IDRETRY &&
1001
+ (status = ST_PAUSE) != ST_OK &&
1002
+ ShowWindow(hDlg, silent ? SW_HIDE : SW_SHOW) == false &&
1003
+ SleepEx(PAUSE3_SEC * 1000, false) == 0));
1004
+ }
1005
+ else status = ERR_CRACKURL;
1006
+ CloseHandle(localFile);
1007
+ if(!fput && status != ST_OK && !szToStack)
1008
+ {
1009
+ rslt = DeleteFile(fn);
1010
+ break;
1011
+ }
1012
+ }
1013
+ else status = ERR_FILEOPEN;
1014
+ }
1015
+ InternetCloseHandle(hSes);
1016
+ if (lstrcmpi(url, TEXT("/end"))==0)
1017
+ pushstring(url);
1018
+ }
1019
+ else status = ERR_INETOPEN;
1020
+ LocalFree(host);
1021
+ LocalFree(path);
1022
+ LocalFree(user);
1023
+ LocalFree(passwd);
1024
+ LocalFree(params);
1025
+ if(IsWindow(hDlg))
1026
+ PostMessage(hDlg, WM_COMMAND, MAKELONG(IDOK, INTERNAL_OK), 0);
1027
+ return status;
1028
+ }
1029
+
1030
+ /*****************************************************
1031
+ * FUNCTION NAME: fsFormat()
1032
+ * PURPOSE:
1033
+ * formats DWORD (max 4 GB) file size for dialog, big MB
1034
+ * SPECIAL CONSIDERATIONS:
1035
+ *
1036
+ *****************************************************/
1037
+ void fsFormat(DWORD bfs, TCHAR *b)
1038
+ {
1039
+ if(bfs == NOT_AVAILABLE)
1040
+ lstrcpy(b, TEXT("???"));
1041
+ else if(bfs == 0)
1042
+ lstrcpy(b, TEXT("0"));
1043
+ else if(bfs < 10 * 1024)
1044
+ wsprintf(b, TEXT("%u bytes"), bfs);
1045
+ else if(bfs < 10 * 1024 * 1024)
1046
+ wsprintf(b, TEXT("%u kB"), bfs / 1024);
1047
+ else wsprintf(b, TEXT("%u MB"), (bfs / 1024 / 1024));
1048
+ }
1049
+
1050
+
1051
+ /*****************************************************
1052
+ * FUNCTION NAME: progress_callback
1053
+ * PURPOSE:
1054
+ * old-style progress bar text updates
1055
+ * SPECIAL CONSIDERATIONS:
1056
+ *
1057
+ *****************************************************/
1058
+
1059
+ void progress_callback(void)
1060
+ {
1061
+ static TCHAR buf[1024] = TEXT(""), b[1024] = TEXT("");
1062
+ int time_sofar = max(1, (GetTickCount() - transfStart) / 1000);
1063
+ int bps = cnt / time_sofar;
1064
+ int remain = (cnt > 0 && fs != NOT_AVAILABLE) ? (MulDiv(time_sofar, fs, cnt) - time_sofar) : 0;
1065
+ TCHAR *rtext=szSecond;
1066
+ if(remain < 0) remain = 0;
1067
+ if (remain >= 60)
1068
+ {
1069
+ remain/=60;
1070
+ rtext=szMinute;
1071
+ if (remain >= 60)
1072
+ {
1073
+ remain/=60;
1074
+ rtext=szHour;
1075
+ }
1076
+ }
1077
+ wsprintf(buf,
1078
+ szProgress,
1079
+ cnt/1024,
1080
+ fs > 0 && fs != NOT_AVAILABLE ? MulDiv(100, cnt, fs) : 0,
1081
+ fs != NOT_AVAILABLE ? fs/1024 : 0,
1082
+ bps/1024,((bps*10)/1024)%10
1083
+ );
1084
+ if (remain) wsprintf(buf + lstrlen(buf),
1085
+ szRemaining,
1086
+ remain,
1087
+ rtext,
1088
+ remain==1?TEXT(""):szPlural
1089
+ );
1090
+ SetDlgItemText(hDlg, IDC_STATIC1, (cnt == 0 || status == ST_CONNECTING) ? szConnecting : buf);
1091
+ if(fs > 0 && fs != NOT_AVAILABLE)
1092
+ SendMessage(GetDlgItem(hDlg, IDC_PROGRESS1), PBM_SETPOS, MulDiv(cnt, PB_RANGE, fs), 0);
1093
+ if (*szCaption == 0)
1094
+ wsprintf(buf, szDownloading, _tcsrchr(fn, TEXT('\\')) ? _tcsrchr(fn, TEXT('\\')) + 1 : fn);
1095
+ else
1096
+ wsprintf(buf, TEXT("%s"),szCaption);
1097
+ HWND hwndS = GetDlgItem(childwnd, 1006);
1098
+ if(!silent && hwndS != NULL && IsWindow(hwndS))
1099
+ {
1100
+ GetWindowText(hwndS, b, sizeof(b));
1101
+ if(lstrcmp(b, buf) != 0)
1102
+ SetWindowText(hwndS, buf);
1103
+ }
1104
+ }
1105
+
1106
+ /*****************************************************
1107
+ * FUNCTION NAME: onTimer()
1108
+ * PURPOSE:
1109
+ * updates text fields every second
1110
+ * SPECIAL CONSIDERATIONS:
1111
+ *
1112
+ *****************************************************/
1113
+ void onTimer(HWND hDlg)
1114
+ {
1115
+ TCHAR b[128];
1116
+ DWORD ct = (GetTickCount() - transfStart) / 1000,
1117
+ tt = (GetTickCount() - startTime) / 1000;
1118
+ // dialog window caption
1119
+ wsprintf(b, TEXT("%s - %s"), *szCaption ? szCaption : PLUGIN_NAME, szStatus[status]);
1120
+ if(fs > 0 && fs != NOT_AVAILABLE && status == ST_DOWNLOAD)
1121
+ {
1122
+ wsprintf(b + lstrlen(b), TEXT(" %d%%"), MulDiv(100, cnt, fs));
1123
+ }
1124
+ if(szBanner == NULL) SetWindowText(hDlg, b);
1125
+ // current file and url
1126
+ SetDlgItemText(hDlg, IDC_STATIC1, (szAlias && *szAlias) ? szAlias : url);
1127
+ SetDlgItemText(hDlg, IDC_STATIC2, /*_tcsrchr(fn, '\\') ? _tcsrchr(fn, '\\') + 1 : */fn);
1128
+ // bytes done and rate
1129
+ if(cnt > 0)
1130
+ {
1131
+ fsFormat(cnt, b);
1132
+ if(ct > 1 && status == ST_DOWNLOAD)
1133
+ {
1134
+ lstrcat(b, TEXT(" ( "));
1135
+ fsFormat(cnt / ct, b + lstrlen(b));
1136
+ lstrcat(b, TEXT("/sec )"));
1137
+ }
1138
+ }
1139
+ else *b = 0;
1140
+ SetDlgItemText(hDlg, IDC_STATIC3, b);
1141
+ // total download time
1142
+ wsprintf(b, TEXT("%d:%02d:%02d"), tt / 3600, (tt / 60) % 60, tt % 60);
1143
+ SetDlgItemText(hDlg, IDC_STATIC6, b);
1144
+ // file size, time remaining, progress bar
1145
+ if(fs > 0 && fs != NOT_AVAILABLE)
1146
+ {
1147
+ fsFormat(fs, b);
1148
+ SetDlgItemText(hDlg, IDC_STATIC5, b);
1149
+ SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_SETPOS, MulDiv(cnt, PB_RANGE, fs), 0);
1150
+ if(cnt > 5000)
1151
+ {
1152
+ ct = MulDiv(fs - cnt, ct, cnt);
1153
+ wsprintf(b, TEXT("%d:%02d:%02d"), ct / 3600, (ct / 60) % 60, ct % 60);
1154
+ }
1155
+ else *b = 0;
1156
+ SetWindowText(GetDlgItem(hDlg, IDC_STATIC4), b);
1157
+ }
1158
+ }
1159
+
1160
+ /*****************************************************
1161
+ * FUNCTION NAME: centerDlg()
1162
+ * PURPOSE:
1163
+ * centers dlg on NSIS parent
1164
+ * SPECIAL CONSIDERATIONS:
1165
+ *
1166
+ *****************************************************/
1167
+ void centerDlg(HWND hDlg)
1168
+ {
1169
+ HWND hwndParent = GetParent(hDlg);
1170
+ RECT nsisRect, dlgRect, waRect;
1171
+ int dlgX, dlgY, dlgWidth, dlgHeight;
1172
+
1173
+ if(hwndParent == NULL || silent)
1174
+ return;
1175
+ if(popup)
1176
+ GetWindowRect(hwndParent, &nsisRect);
1177
+ else GetClientRect(hwndParent, &nsisRect);
1178
+ GetWindowRect(hDlg, &dlgRect);
1179
+
1180
+ dlgWidth = dlgRect.right - dlgRect.left;
1181
+ dlgHeight = dlgRect.bottom - dlgRect.top;
1182
+ dlgX = (nsisRect.left + nsisRect.right - dlgWidth) / 2;
1183
+ dlgY = (nsisRect.top + nsisRect.bottom - dlgHeight) / 2;
1184
+
1185
+ if(popup)
1186
+ {
1187
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &waRect, 0);
1188
+ if(dlgX > waRect.right - dlgWidth)
1189
+ dlgX = waRect.right - dlgWidth;
1190
+ if(dlgX < waRect.left) dlgX = waRect.left;
1191
+ if(dlgY > waRect.bottom - dlgHeight)
1192
+ dlgY = waRect.bottom - dlgHeight;
1193
+ if(dlgY < waRect.top) dlgY = waRect.top;
1194
+ }
1195
+ else dlgY += 20;
1196
+
1197
+ SetWindowPos(hDlg, HWND_TOP, dlgX, dlgY, 0, 0, SWP_NOSIZE);
1198
+ }
1199
+
1200
+ /*****************************************************
1201
+ * FUNCTION NAME: onInitDlg()
1202
+ * PURPOSE:
1203
+ * dlg init
1204
+ * SPECIAL CONSIDERATIONS:
1205
+ *
1206
+ *****************************************************/
1207
+ void onInitDlg(HWND hDlg)
1208
+ {
1209
+ HFONT hFont;
1210
+ HWND hPrbNew;
1211
+ HWND hPrbOld;
1212
+ HWND hCan = GetDlgItem(hDlg, IDCANCEL);
1213
+
1214
+ if(childwnd)
1215
+ {
1216
+ hPrbNew = GetDlgItem(hDlg, IDC_PROGRESS1);
1217
+ hPrbOld = GetDlgItem(childwnd, 0x3ec);
1218
+
1219
+ // Backland' fix for progress bar redraw/style issue.
1220
+ // Original bar may be hidden because of interfernce with other plug-ins.
1221
+ LONG prbStyle = WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
1222
+ if(hPrbOld != NULL)
1223
+ {
1224
+ prbStyle |= GetWindowLong(hPrbOld, GWL_STYLE);
1225
+ }
1226
+ SetWindowLong(hPrbNew, GWL_STYLE, prbStyle);
1227
+
1228
+ if(!popup)
1229
+ {
1230
+ if((hFont = (HFONT)SendMessage(childwnd, WM_GETFONT, 0, 0)) != NULL)
1231
+ {
1232
+ SendDlgItemMessage(hDlg, IDC_STATIC1, WM_SETFONT, (WPARAM)hFont, 0);
1233
+ SendDlgItemMessage(hDlg, IDCANCEL, WM_SETFONT, (WPARAM)hFont, 0);
1234
+ }
1235
+ if(*szCancel == 0)
1236
+ GetWindowText(GetDlgItem(GetParent(childwnd), IDCANCEL), szCancel, sizeof(szCancel));
1237
+ SetWindowText(hCan, szCancel);
1238
+ SetWindowPos(hPrbNew, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
1239
+ }
1240
+ }
1241
+
1242
+ if(nocancel)
1243
+ {
1244
+ if(hCan != NULL)
1245
+ ShowWindow(hCan, SW_HIDE);
1246
+ if(popup)
1247
+ SetWindowLong(hDlg, GWL_STYLE, GetWindowLong(hDlg, GWL_STYLE) ^ WS_SYSMENU);
1248
+ }
1249
+ SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_SETRANGE,
1250
+ 0, MAKELPARAM(0, PB_RANGE));
1251
+ if(szBanner != NULL)
1252
+ {
1253
+ SendDlgItemMessage(hDlg, IDC_STATIC13, STM_SETICON,
1254
+ (WPARAM)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(103)), 0);
1255
+ SetDlgItemText(hDlg, IDC_STATIC12, szBanner);
1256
+ SetWindowText(hDlg, *szCaption ? szCaption : PLUGIN_NAME);
1257
+ }
1258
+ SetTimer(hDlg, 1, 1000, NULL);
1259
+ if(*szUrl != 0)
1260
+ {
1261
+ SetDlgItemText(hDlg, IDC_STATIC20, szUrl);
1262
+ SetDlgItemText(hDlg, IDC_STATIC21, szDownloading);
1263
+ SetDlgItemText(hDlg, IDC_STATIC22, szConnecting);
1264
+ SetDlgItemText(hDlg, IDC_STATIC23, szProgress);
1265
+ SetDlgItemText(hDlg, IDC_STATIC24, szSecond);
1266
+ SetDlgItemText(hDlg, IDC_STATIC25, szRemaining);
1267
+ }
1268
+ }
1269
+
1270
+ /*****************************************************
1271
+ * FUNCTION NAME: dlgProc()
1272
+ * PURPOSE:
1273
+ * dlg message handling procedure
1274
+ * SPECIAL CONSIDERATIONS:
1275
+ * todo: better dialog design
1276
+ *****************************************************/
1277
+ INT_PTR CALLBACK dlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
1278
+ {
1279
+ switch(message)
1280
+ {
1281
+ case WM_INITDIALOG:
1282
+ onInitDlg(hDlg);
1283
+ centerDlg(hDlg);
1284
+ return false;
1285
+ case WM_PAINT:
1286
+ // child dialog redraw problem. return false is important
1287
+ {
1288
+ HWND hS1 = GetDlgItem(hDlg, IDC_STATIC1), hC = GetDlgItem(hDlg, IDCANCEL), hP1 = GetDlgItem(hDlg, IDC_PROGRESS1);
1289
+ RedrawWindow(hS1, NULL, NULL, RDW_INVALIDATE);
1290
+ RedrawWindow(hC, NULL, NULL, RDW_INVALIDATE);
1291
+ RedrawWindow(hP1, NULL, NULL, RDW_INVALIDATE);
1292
+ UpdateWindow(hS1);
1293
+ UpdateWindow(hC);
1294
+ UpdateWindow(hP1);
1295
+ }
1296
+ return false;
1297
+ case WM_TIMER:
1298
+ if(!silent && IsWindow(hDlg))
1299
+ {
1300
+ // long connection period and paused state updates
1301
+ if(status != ST_DOWNLOAD && GetTickCount() - transfStart > PROGRESS_MS)
1302
+ transfStart += PROGRESS_MS;
1303
+ if(popup) onTimer(hDlg); else progress_callback();
1304
+ RedrawWindow(GetDlgItem(hDlg, IDC_STATIC1), NULL, NULL, RDW_INVALIDATE);
1305
+ RedrawWindow(GetDlgItem(hDlg, IDCANCEL), NULL, NULL, RDW_INVALIDATE);
1306
+ RedrawWindow(GetDlgItem(hDlg, IDC_PROGRESS1), NULL, NULL, RDW_INVALIDATE);
1307
+ }
1308
+ break;
1309
+ case WM_COMMAND:
1310
+ switch(LOWORD(wParam))
1311
+ {
1312
+ case IDCANCEL:
1313
+ if(nocancel) break;
1314
+ if(szQuestion &&
1315
+ MessageBox(hDlg, szQuestion, *szCaption ? szCaption : PLUGIN_NAME, MB_ICONWARNING|MB_YESNO) == IDNO)
1316
+ break;
1317
+ status = ST_CANCELLED;
1318
+ // FallThrough
1319
+ case IDOK:
1320
+ if(status != ST_CANCELLED && HIWORD(wParam) != INTERNAL_OK) break;
1321
+ // otherwise in the silent mode next banner windows may go to background
1322
+ // if(silent) sf(hDlg);
1323
+ KillTimer(hDlg, 1);
1324
+ DestroyWindow(hDlg);
1325
+ break;
1326
+ }
1327
+ return false;
1328
+ default:
1329
+ return false;
1330
+ }
1331
+ return true;
1332
+ }
1333
+
1334
+ /*****************************************************
1335
+ * FUNCTION NAME: get()
1336
+ * PURPOSE:
1337
+ * http/https/ftp file download entry point
1338
+ * SPECIAL CONSIDERATIONS:
1339
+ *
1340
+ *****************************************************/
1341
+ extern "C"
1342
+ void __declspec(dllexport) __cdecl get(HWND hwndParent,
1343
+ int string_size,
1344
+ TCHAR *variables,
1345
+ stack_t **stacktop,
1346
+ extra_parameters *extra
1347
+ )
1348
+ {
1349
+ HANDLE hThread;
1350
+ DWORD dwThreadId;
1351
+ MSG msg;
1352
+ TCHAR szUsername[64]=TEXT(""), // proxy params
1353
+ szPassword[64]=TEXT("");
1354
+
1355
+
1356
+ EXDLL_INIT();
1357
+
1358
+ // for repeating /nounload plug-un calls - global vars clean up
1359
+ silent = popup = resume = nocancel = noproxy = nocookies = false;
1360
+ g_ignorecertissues = false;
1361
+ myFtpCommand = NULL;
1362
+ openType = INTERNET_OPEN_TYPE_PRECONFIG;
1363
+ status = ST_CONNECTING;
1364
+ *szCaption = *szCancel = *szUserAgent = *szBasic = *szAuth = 0;
1365
+
1366
+ url = (TCHAR*)LocalAlloc(LPTR, string_size * sizeof(TCHAR));
1367
+ if(szPost)
1368
+ {
1369
+ popstring(url);
1370
+ #ifdef UNICODE
1371
+ WideCharToMultiByte(CP_ACP, 0, url, -1, szPost, string_size, NULL, NULL);
1372
+ #else
1373
+ lstrcpy(szPost, url);
1374
+ #endif
1375
+ fSize = (DWORD)lstrlenA(szPost);
1376
+ }
1377
+ // global silent option
1378
+ if(extra->exec_flags->silent != 0)
1379
+ silent = true;
1380
+ // we must take this from stack, or push url back
1381
+ while(!popstring(url) && *url == TEXT('/'))
1382
+ {
1383
+ if(lstrcmpi(url, TEXT("/silent")) == 0)
1384
+ silent = true;
1385
+ else if(lstrcmpi(url, TEXT("/weaksecurity")) == 0)
1386
+ g_ignorecertissues = true;
1387
+ else if(lstrcmpi(url, TEXT("/caption")) == 0)
1388
+ popstring(szCaption);
1389
+ else if(lstrcmpi(url, TEXT("/username")) == 0)
1390
+ popstring(szUsername);
1391
+ else if(lstrcmpi(url, TEXT("/password")) == 0)
1392
+ popstring(szPassword);
1393
+ else if(lstrcmpi(url, TEXT("/nocancel")) == 0)
1394
+ nocancel = true;
1395
+ else if(lstrcmpi(url, TEXT("/nocookies")) == 0)
1396
+ nocookies = true;
1397
+ else if(lstrcmpi(url, TEXT("/noproxy")) == 0)
1398
+ openType = INTERNET_OPEN_TYPE_DIRECT;
1399
+ else if(lstrcmpi(url, TEXT("/popup")) == 0)
1400
+ {
1401
+ popup = true;
1402
+ szAlias = (TCHAR*)LocalAlloc(LPTR, string_size * sizeof(TCHAR));
1403
+ popstring(szAlias);
1404
+ }
1405
+ else if(lstrcmpi(url, TEXT("/resume")) == 0)
1406
+ {
1407
+ popstring(url);
1408
+ if(url[0]) lstrcpy(szResume, url);
1409
+ resume = true;
1410
+ }
1411
+ else if(lstrcmpi(url, TEXT("/translate")) == 0)
1412
+ {
1413
+ if(popup)
1414
+ {
1415
+ popstring(szUrl);
1416
+ popstring(szStatus[ST_DOWNLOAD]); // Downloading
1417
+ popstring(szStatus[ST_CONNECTING]); // Connecting
1418
+ lstrcpy(szStatus[ST_URLOPEN], szStatus[ST_CONNECTING]);
1419
+ popstring(szDownloading);// file name
1420
+ popstring(szConnecting);// received
1421
+ popstring(szProgress);// file size
1422
+ popstring(szSecond);// remaining time
1423
+ popstring(szRemaining);// total time
1424
+ }
1425
+ else
1426
+ {
1427
+ popstring(szDownloading);
1428
+ popstring(szConnecting);
1429
+ popstring(szSecond);
1430
+ popstring(szMinute);
1431
+ popstring(szHour);
1432
+ popstring(szPlural);
1433
+ popstring(szProgress);
1434
+ popstring(szRemaining);
1435
+ }
1436
+ }
1437
+ else if(lstrcmpi(url, TEXT("/banner")) == 0)
1438
+ {
1439
+ popup = true;
1440
+ szBanner = (TCHAR*)LocalAlloc(LPTR, string_size * sizeof(TCHAR));
1441
+ popstring(szBanner);
1442
+ }
1443
+ else if(lstrcmpi(url, TEXT("/canceltext")) == 0)
1444
+ {
1445
+ popstring(szCancel);
1446
+ }
1447
+ else if(lstrcmpi(url, TEXT("/question")) == 0)
1448
+ {
1449
+ szQuestion = (TCHAR*)LocalAlloc(LPTR, string_size * sizeof(TCHAR));
1450
+ popstring(szQuestion);
1451
+ if(*szQuestion == 0) lstrcpy(szQuestion, DEF_QUESTION);
1452
+ }
1453
+ else if(lstrcmpi(url, TEXT("/useragent")) == 0)
1454
+ {
1455
+ popstring(szUserAgent);
1456
+ }
1457
+ else if(lstrcmpi(url, TEXT("/proxy")) == 0)
1458
+ {
1459
+ szProxy = (TCHAR*)LocalAlloc(LPTR, string_size * sizeof(TCHAR));
1460
+ popstring(szProxy);
1461
+ openType = INTERNET_OPEN_TYPE_PROXY;
1462
+ }
1463
+ else if(lstrcmpi(url, TEXT("/connecttimeout")) == 0)
1464
+ {
1465
+ popstring(url);
1466
+ timeout = myatou(url) * 1000;
1467
+ }
1468
+ else if(lstrcmpi(url, TEXT("/receivetimeout")) == 0)
1469
+ {
1470
+ popstring(url);
1471
+ receivetimeout = myatou(url) * 1000;
1472
+ }
1473
+ else if(lstrcmpi(url, TEXT("/header")) == 0)
1474
+ {
1475
+ szHeader = (TCHAR*)LocalAlloc(LPTR, string_size * sizeof(TCHAR));
1476
+ popstring(szHeader);
1477
+ }
1478
+ else if(!fput && ((convToStack = lstrcmpi(url, TEXT("/tostackconv")) == 0) || lstrcmpi(url, TEXT("/tostack")) == 0))
1479
+ {
1480
+ szToStack = (TCHAR*)LocalAlloc(LPTR, string_size * sizeof(TCHAR));
1481
+ cntToStack = 0;
1482
+ lstrcpy(fn, TEXT("file"));
1483
+ }
1484
+ else if(lstrcmpi(url, TEXT("/file")) == 0)
1485
+ {
1486
+ HANDLE hFile = CreateFileA(szPost, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
1487
+ DWORD rslt;
1488
+ if(hFile == INVALID_HANDLE_VALUE)
1489
+ {
1490
+ status = ERR_FILEOPEN;
1491
+ goto cleanup;
1492
+ }
1493
+ if((fSize = GetFileSize(hFile, NULL)) == 0)
1494
+ {
1495
+ CloseHandle(hFile);
1496
+ status = ERR_FILEREAD;
1497
+ goto cleanup;
1498
+ }
1499
+ wsprintfA(post_fname, "Filename: %s",
1500
+ strchr(szPost, '\\') ? strrchr(szPost, '\\') + 1 : szPost);
1501
+ LocalFree(szPost);
1502
+ szPost = (char*)LocalAlloc(LPTR, fSize);
1503
+ if(ReadFile(hFile, szPost, fSize, &rslt, NULL) == 0 || rslt != fSize)
1504
+ {
1505
+ CloseHandle(hFile);
1506
+ status = ERR_FILEREAD;
1507
+ goto cleanup;
1508
+ }
1509
+ CloseHandle(hFile);
1510
+ }
1511
+ }
1512
+ pushstring(url);
1513
+ // if(*szCaption == 0) lstrcpy(szCaption, PLUGIN_NAME);
1514
+ if(*szUserAgent == 0) lstrcpy(szUserAgent, INETC_USERAGENT);
1515
+ if(*szPassword && *szUsername)
1516
+ {
1517
+ wsprintf(url, TEXT("%s:%s"), szUsername, szPassword);
1518
+ encode_base64(lstrlen(url), url, szAuth);
1519
+ }
1520
+ // may be silent for plug-in, but not so for installer itself - let's try to define 'progress text'
1521
+ if(hwndParent != NULL &&
1522
+ (childwnd = FindWindowEx(hwndParent, NULL, TEXT("#32770"), NULL)) != NULL &&
1523
+ !silent)
1524
+ SetDlgItemText(childwnd, 1006, *szCaption ? szCaption : PLUGIN_NAME);
1525
+ else InitCommonControls(); // or NSIS do this before .onInit?
1526
+ // cannot embed child dialog to non-existing parent. Using 'silent' to hide it
1527
+ if(childwnd == NULL && !popup) silent = true;
1528
+ // let's use hidden popup dlg in the silent mode - works both on .onInit and Page
1529
+ if(silent) { resume = false; popup = true; }
1530
+ // google says WS_CLIPSIBLINGS helps to redraw... not in my tests...
1531
+ if(!popup)
1532
+ {
1533
+ unsigned int wstyle = GetWindowLong(childwnd, GWL_STYLE);
1534
+ wstyle |= WS_CLIPSIBLINGS;
1535
+ SetWindowLong(childwnd, GWL_STYLE, wstyle);
1536
+ }
1537
+ startTime = GetTickCount();
1538
+ if((hDlg = CreateDialog(g_hInstance,
1539
+ MAKEINTRESOURCE(szBanner ? IDD_DIALOG2 : (popup ? IDD_DIALOG1 : IDD_DIALOG3)),
1540
+ (popup ? hwndParent : childwnd), dlgProc)) != NULL)
1541
+ {
1542
+
1543
+ if((hThread = CreateThread(NULL, 0, inetTransfer, (LPVOID)hDlg, 0,
1544
+ &dwThreadId)) != NULL)
1545
+ {
1546
+ HWND hButton = GetDlgItem(childwnd, 0x403);
1547
+ HWND hList = GetDlgItem(childwnd, 0x3f8);
1548
+ DWORD dwStyleButton = 0;
1549
+ BOOL fVisibleList = false;
1550
+ if(!silent)
1551
+ {
1552
+ ShowWindow(hDlg, SW_NORMAL);
1553
+ if(childwnd && !popup)
1554
+ {
1555
+ if(hButton)
1556
+ {
1557
+ dwStyleButton = GetWindowLong(hButton, GWL_STYLE);
1558
+ EnableWindow(hButton, false);
1559
+ }
1560
+ if(hList)
1561
+ {
1562
+ fVisibleList = IsWindowVisible(hList);
1563
+ ShowWindow(hList, SW_HIDE);
1564
+ }
1565
+ }
1566
+ }
1567
+
1568
+ while(IsWindow(hDlg) &&
1569
+ GetMessage(&msg, NULL, 0, 0) > 0)
1570
+ {
1571
+ if(!IsDialogMessage(hDlg, &msg) &&
1572
+ !IsDialogMessage(hwndParent, &msg) &&
1573
+ !TranslateMessage(&msg))
1574
+ DispatchMessage(&msg);
1575
+ }
1576
+
1577
+ if(WaitForSingleObject(hThread, 3000) == WAIT_TIMEOUT)
1578
+ {
1579
+ TerminateThread(hThread, 1);
1580
+ status = ERR_TERMINATED;
1581
+ }
1582
+ CloseHandle(hThread);
1583
+ if(!silent && childwnd)
1584
+ {
1585
+ SetDlgItemText(childwnd, 1006, TEXT(""));
1586
+ if(!popup)
1587
+ {
1588
+ if(hButton)
1589
+ SetWindowLong(hButton, GWL_STYLE, dwStyleButton);
1590
+ if(hList && fVisibleList)
1591
+ ShowWindow(hList, SW_SHOW);
1592
+ }
1593
+ // RedrawWindow(childwnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
1594
+ }
1595
+ }
1596
+ else
1597
+ {
1598
+ status = ERR_THREAD;
1599
+ DestroyWindow(hDlg);
1600
+ }
1601
+ }
1602
+ else {
1603
+ status = ERR_DIALOG;
1604
+ wsprintf(szStatus[status] + lstrlen(szStatus[status]), TEXT(" (Err=%d)"), GetLastError());
1605
+ }
1606
+ cleanup:
1607
+ // we need to clean up stack from remaining url/file pairs.
1608
+ // this multiple files download head pain and may be not safe
1609
+ while(!popstring(url) && lstrcmpi(url, TEXT("/end")) != 0)
1610
+ {
1611
+ /* nothing MessageBox(NULL, url, TEXT(""), 0);*/
1612
+ }
1613
+ LocalFree(url);
1614
+ if(szAlias) LocalFree(szAlias);
1615
+ if(szBanner) LocalFree(szAlias);
1616
+ if(szQuestion) LocalFree(szQuestion);
1617
+ if(szProxy) LocalFree(szProxy);
1618
+ if(szPost) LocalFree(szPost);
1619
+ if(szHeader) LocalFree(szHeader);
1620
+
1621
+ url = szProxy = szHeader = szAlias = szQuestion = NULL;
1622
+ szPost = NULL;
1623
+ fput = fhead = false;
1624
+
1625
+ if(szToStack && status == ST_OK)
1626
+ {
1627
+ if(cntToStack > 0 && convToStack)
1628
+ {
1629
+ #ifdef UNICODE
1630
+ int cp = CP_ACP;
1631
+ if (0xef == ((BYTE*)szToStack)[0] && 0xbb == ((BYTE*)szToStack)[1] && 0xbf == ((BYTE*)szToStack)[2]) cp = 65001; // CP_UTF8
1632
+ if (0xff == ((BYTE*)szToStack)[0] && 0xfe == ((BYTE*)szToStack)[1])
1633
+ {
1634
+ cp = 1200; // UTF-16LE
1635
+ pushstring((LPWSTR)szToStack);
1636
+ }
1637
+ int required = (cp == 1200) ? 0 : MultiByteToWideChar(cp, 0, (CHAR*)szToStack, string_size * sizeof(TCHAR), NULL, 0);
1638
+ if(required > 0)
1639
+ {
1640
+ WCHAR* pszToStackNew = (WCHAR*)LocalAlloc(LPTR, sizeof(WCHAR) * (required + 1));
1641
+ if(pszToStackNew)
1642
+ {
1643
+ if(MultiByteToWideChar(cp, 0, (CHAR*)szToStack, string_size * sizeof(TCHAR), pszToStackNew, required) > 0)
1644
+ pushstring(pszToStackNew);
1645
+ LocalFree(pszToStackNew);
1646
+ }
1647
+ }
1648
+ #else
1649
+ int required = WideCharToMultiByte(CP_ACP, 0, (WCHAR*)szToStack, -1, NULL, 0, NULL, NULL);
1650
+ if(required > 0)
1651
+ {
1652
+ CHAR* pszToStackNew = (CHAR*)LocalAlloc(LPTR, required + 1);
1653
+ if(pszToStackNew)
1654
+ {
1655
+ if(WideCharToMultiByte(CP_ACP, 0, (WCHAR*)szToStack, -1, pszToStackNew, required, NULL, NULL) > 0)
1656
+ pushstring(pszToStackNew);
1657
+ LocalFree(pszToStackNew);
1658
+ }
1659
+ }
1660
+ #endif
1661
+ }
1662
+ else
1663
+ {
1664
+ pushstring(szToStack);
1665
+ }
1666
+ LocalFree(szToStack);
1667
+ szToStack = NULL;
1668
+ }
1669
+
1670
+ pushstring(szStatus[status]);
1671
+ }
1672
+
1673
+ /*****************************************************
1674
+ * FUNCTION NAME: put()
1675
+ * PURPOSE:
1676
+ * http/ftp file upload entry point
1677
+ * SPECIAL CONSIDERATIONS:
1678
+ * re-put not works with http, but ftp REST - may be.
1679
+ *****************************************************/
1680
+ extern "C"
1681
+ void __declspec(dllexport) __cdecl put(HWND hwndParent,
1682
+ int string_size,
1683
+ TCHAR *variables,
1684
+ stack_t **stacktop,
1685
+ extra_parameters *extra
1686
+ )
1687
+ {
1688
+ fput = true;
1689
+ lstrcpy(szDownloading, TEXT("Uploading %s"));
1690
+ lstrcpy(szStatus[2], TEXT("Uploading"));
1691
+ get(hwndParent, string_size, variables, stacktop, extra);
1692
+ }
1693
+
1694
+ /*****************************************************
1695
+ * FUNCTION NAME: post()
1696
+ * PURPOSE:
1697
+ * http post entry point
1698
+ * SPECIAL CONSIDERATIONS:
1699
+ *
1700
+ *****************************************************/
1701
+ extern "C"
1702
+ void __declspec(dllexport) __cdecl post(HWND hwndParent,
1703
+ int string_size,
1704
+ TCHAR *variables,
1705
+ stack_t **stacktop,
1706
+ extra_parameters *extra
1707
+ )
1708
+ {
1709
+ szPost = (CHAR*)LocalAlloc(LPTR, string_size);
1710
+ get(hwndParent, string_size, variables, stacktop, extra);
1711
+ }
1712
+
1713
+ /*****************************************************
1714
+ * FUNCTION NAME: head()
1715
+ * PURPOSE:
1716
+ * http/ftp file upload entry point
1717
+ * SPECIAL CONSIDERATIONS:
1718
+ * re-put not works with http, but ftp REST - may be.
1719
+ *****************************************************/
1720
+ extern "C"
1721
+ void __declspec(dllexport) __cdecl head(HWND hwndParent,
1722
+ int string_size,
1723
+ TCHAR *variables,
1724
+ stack_t **stacktop,
1725
+ extra_parameters *extra
1726
+ )
1727
+ {
1728
+ fhead = true;
1729
+ get(hwndParent, string_size, variables, stacktop, extra);
1730
+ }
1731
+
1732
+ /*****************************************************
1733
+ * FUNCTION NAME: DllMain()
1734
+ * PURPOSE:
1735
+ * Dll main (initialization) entry point
1736
+ * SPECIAL CONSIDERATIONS:
1737
+ *
1738
+ *****************************************************/
1739
+ #ifdef _VC_NODEFAULTLIB
1740
+ #define DllMain _DllMainCRTStartup
1741
+ #endif
1742
+ EXTERN_C BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
1743
+ {
1744
+ g_hInstance = hinstDLL;
1745
+ return TRUE;
1746
+ }
build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.rc ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Microsoft Visual C++ generated resource script.
2
+ //
3
+ #include "resource.h"
4
+
5
+ #define APSTUDIO_READONLY_SYMBOLS
6
+ /////////////////////////////////////////////////////////////////////////////
7
+ //
8
+ // Generated from the TEXTINCLUDE 2 resource.
9
+ //
10
+ #include "afxres.h"
11
+
12
+ /////////////////////////////////////////////////////////////////////////////
13
+ #undef APSTUDIO_READONLY_SYMBOLS
14
+
15
+ /////////////////////////////////////////////////////////////////////////////
16
+ // Russian (Russia) resources
17
+
18
+ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
19
+ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
20
+ #pragma code_page(1251)
21
+
22
+ #ifdef APSTUDIO_INVOKED
23
+ /////////////////////////////////////////////////////////////////////////////
24
+ //
25
+ // TEXTINCLUDE
26
+ //
27
+
28
+ 1 TEXTINCLUDE
29
+ BEGIN
30
+ "resource.h\0"
31
+ END
32
+
33
+ 2 TEXTINCLUDE
34
+ BEGIN
35
+ "#include ""afxres.h""\r\n"
36
+ "\0"
37
+ END
38
+
39
+ 3 TEXTINCLUDE
40
+ BEGIN
41
+ "\r\n"
42
+ "\0"
43
+ END
44
+
45
+ #endif // APSTUDIO_INVOKED
46
+
47
+ #endif // Russian (Russia) resources
48
+ /////////////////////////////////////////////////////////////////////////////
49
+
50
+
51
+ /////////////////////////////////////////////////////////////////////////////
52
+ // English (United States) resources
53
+
54
+ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
55
+ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
56
+ #pragma code_page(1252)
57
+
58
+ /////////////////////////////////////////////////////////////////////////////
59
+ //
60
+ // Dialog
61
+ //
62
+
63
+ IDD_DIALOG1 DIALOGEX 0, 0, 286, 71
64
+ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
65
+ CAPTION "Inetc plug-in"
66
+ FONT 8, "MS Sans Serif", 0, 0, 0x1
67
+ BEGIN
68
+ LTEXT "",IDC_STATIC1,50,4,230,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
69
+ LTEXT "",IDC_STATIC2,50,18,230,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
70
+ CTEXT "",IDC_STATIC3,50,32,102,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
71
+ CTEXT "",IDC_STATIC4,220,32,60,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
72
+ CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE,5,62,275,7
73
+ CTEXT "",IDC_STATIC5,50,46,102,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
74
+ CTEXT "",IDC_STATIC6,220,46,60,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
75
+ CONTROL "URL",IDC_STATIC20,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,5,6,44,10
76
+ CONTROL "File name",IDC_STATIC21,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,5,20,44,10
77
+ CONTROL "Transfered",IDC_STATIC22,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,5,34,44,10
78
+ CONTROL "File size",IDC_STATIC23,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,5,48,44,10
79
+ CONTROL "Remaining time",IDC_STATIC24,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,164,34,55,10
80
+ CONTROL "Total time",IDC_STATIC25,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,164,48,55,10
81
+ END
82
+
83
+ IDD_DIALOG2 DIALOG 0, 0, 226, 62
84
+ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
85
+ CAPTION "Inetc plug-in"
86
+ FONT 8, "MS Sans Serif"
87
+ BEGIN
88
+ ICON 103,IDC_STATIC13,4,4,20,20
89
+ LTEXT "Please wait",IDC_STATIC12,35,6,184,28
90
+ CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE,12,40,201,11
91
+ END
92
+
93
+ IDD_DIALOG3 DIALOG 0, 0, 266, 62
94
+ STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_VISIBLE
95
+ FONT 8, "MS Sans Serif"
96
+ BEGIN
97
+ CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",0x0,0,23,266,11
98
+ CTEXT "",IDC_STATIC1,0,8,266,11
99
+ PUSHBUTTON "Cancel",IDCANCEL,166,41,80,16
100
+ END
101
+
102
+
103
+ /////////////////////////////////////////////////////////////////////////////
104
+ //
105
+ // DESIGNINFO
106
+ //
107
+
108
+ #ifdef APSTUDIO_INVOKED
109
+ GUIDELINES DESIGNINFO
110
+ BEGIN
111
+ IDD_DIALOG1, DIALOG
112
+ BEGIN
113
+ LEFTMARGIN, 7
114
+ RIGHTMARGIN, 279
115
+ TOPMARGIN, 7
116
+ BOTTOMMARGIN, 64
117
+ END
118
+
119
+ IDD_DIALOG2, DIALOG
120
+ BEGIN
121
+ LEFTMARGIN, 7
122
+ RIGHTMARGIN, 219
123
+ TOPMARGIN, 7
124
+ BOTTOMMARGIN, 55
125
+ END
126
+
127
+ IDD_DIALOG3, DIALOG
128
+ BEGIN
129
+ LEFTMARGIN, 7
130
+ RIGHTMARGIN, 259
131
+ TOPMARGIN, 7
132
+ BOTTOMMARGIN, 55
133
+ END
134
+ END
135
+ #endif // APSTUDIO_INVOKED
136
+
137
+ #endif // English (United States) resources
138
+ /////////////////////////////////////////////////////////////////////////////
139
+
140
+
141
+ /////////////////////////////////////////////////////////////////////////////
142
+ // English (United Kingdom) resources
143
+
144
+ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
145
+ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
146
+ #pragma code_page(1252)
147
+
148
+ /////////////////////////////////////////////////////////////////////////////
149
+ //
150
+ // Version
151
+ //
152
+
153
+ VS_VERSION_INFO VERSIONINFO
154
+ FILEVERSION 1,0,5,2
155
+ PRODUCTVERSION 1,0,5,2
156
+ FILEFLAGSMASK 0x3fL
157
+ #ifdef _DEBUG
158
+ FILEFLAGS 0x1L
159
+ #else
160
+ FILEFLAGS 0x0L
161
+ #endif
162
+ FILEOS 0x40004L
163
+ FILETYPE 0x2L
164
+ FILESUBTYPE 0x0L
165
+ BEGIN
166
+ BLOCK "StringFileInfo"
167
+ BEGIN
168
+ BLOCK "040904b0"
169
+ BEGIN
170
+ VALUE "FileDescription", "inetc NSIS plug-in"
171
+ VALUE "FileVersion", "1.0.5.2"
172
+ VALUE "InternalName", "inetc.dll"
173
+ VALUE "LegalCopyright", "Copyright � Takhir Bedertdinov"
174
+ VALUE "OriginalFilename", "inetc.dll"
175
+ VALUE "ProductName", "inetc NSIS plug-in"
176
+ VALUE "ProductVersion", "1.0.5.2"
177
+ END
178
+ END
179
+ BLOCK "VarFileInfo"
180
+ BEGIN
181
+ VALUE "Translation", 0x409, 1200
182
+ END
183
+ END
184
+
185
+ #endif // English (United Kingdom) resources
186
+ /////////////////////////////////////////////////////////////////////////////
187
+
188
+
189
+
190
+ #ifndef APSTUDIO_INVOKED
191
+ /////////////////////////////////////////////////////////////////////////////
192
+ //
193
+ // Generated from the TEXTINCLUDE 3 resource.
194
+ //
195
+
196
+
197
+ /////////////////////////////////////////////////////////////////////////////
198
+ #endif // not APSTUDIO_INVOKED
199
+
build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.sln ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 12.00
3
+ # Visual Studio 2012
4
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inetc", "inetc.vcxproj", "{6B2D8C40-38A9-457A-9FA6-BED0108CAC37}"
5
+ EndProject
6
+ Global
7
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
8
+ Debug Unicode|Win32 = Debug Unicode|Win32
9
+ Debug Unicode|x64 = Debug Unicode|x64
10
+ Debug|Win32 = Debug|Win32
11
+ Debug|x64 = Debug|x64
12
+ Release Unicode|Win32 = Release Unicode|Win32
13
+ Release Unicode|x64 = Release Unicode|x64
14
+ Release|Win32 = Release|Win32
15
+ Release|x64 = Release|x64
16
+ EndGlobalSection
17
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
18
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
19
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
20
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug Unicode|Win32.Deploy.0 = Debug Unicode|Win32
21
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64
22
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug Unicode|x64.Build.0 = Debug Unicode|x64
23
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug|Win32.ActiveCfg = Debug|Win32
24
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug|Win32.Build.0 = Debug|Win32
25
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug|Win32.Deploy.0 = Debug|Win32
26
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug|x64.ActiveCfg = Debug|x64
27
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Debug|x64.Build.0 = Debug|x64
28
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
29
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
30
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release Unicode|Win32.Deploy.0 = Release Unicode|Win32
31
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release Unicode|x64.ActiveCfg = Release Unicode|x64
32
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release Unicode|x64.Build.0 = Release Unicode|x64
33
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release|Win32.ActiveCfg = Release|Win32
34
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release|Win32.Build.0 = Release|Win32
35
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release|Win32.Deploy.0 = Release|Win32
36
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release|x64.ActiveCfg = Release|x64
37
+ {6B2D8C40-38A9-457A-9FA6-BED0108CAC37}.Release|x64.Build.0 = Release|x64
38
+ EndGlobalSection
39
+ GlobalSection(SolutionProperties) = preSolution
40
+ HideSolutionNode = FALSE
41
+ EndGlobalSection
42
+ EndGlobal
build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.vcxproj ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug Unicode|Win32">
5
+ <Configuration>Debug Unicode</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Debug Unicode|x64">
9
+ <Configuration>Debug Unicode</Configuration>
10
+ <Platform>x64</Platform>
11
+ </ProjectConfiguration>
12
+ <ProjectConfiguration Include="Debug|Win32">
13
+ <Configuration>Debug</Configuration>
14
+ <Platform>Win32</Platform>
15
+ </ProjectConfiguration>
16
+ <ProjectConfiguration Include="Debug|x64">
17
+ <Configuration>Debug</Configuration>
18
+ <Platform>x64</Platform>
19
+ </ProjectConfiguration>
20
+ <ProjectConfiguration Include="Release Unicode|Win32">
21
+ <Configuration>Release Unicode</Configuration>
22
+ <Platform>Win32</Platform>
23
+ </ProjectConfiguration>
24
+ <ProjectConfiguration Include="Release Unicode|x64">
25
+ <Configuration>Release Unicode</Configuration>
26
+ <Platform>x64</Platform>
27
+ </ProjectConfiguration>
28
+ <ProjectConfiguration Include="Release|Win32">
29
+ <Configuration>Release</Configuration>
30
+ <Platform>Win32</Platform>
31
+ </ProjectConfiguration>
32
+ <ProjectConfiguration Include="Release|x64">
33
+ <Configuration>Release</Configuration>
34
+ <Platform>x64</Platform>
35
+ </ProjectConfiguration>
36
+ </ItemGroup>
37
+ <PropertyGroup Label="Globals">
38
+ <SccProjectName />
39
+ <SccLocalPath />
40
+ <ProjectGuid>{6B2D8C40-38A9-457A-9FA6-BED0108CAC37}</ProjectGuid>
41
+ </PropertyGroup>
42
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
43
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
44
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
45
+ <PlatformToolset>v110</PlatformToolset>
46
+ <CharacterSet>Unicode</CharacterSet>
47
+ </PropertyGroup>
48
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="Configuration">
49
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
50
+ <PlatformToolset>v110</PlatformToolset>
51
+ <CharacterSet>Unicode</CharacterSet>
52
+ </PropertyGroup>
53
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
54
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
55
+ <PlatformToolset>v110</PlatformToolset>
56
+ <CharacterSet>MultiByte</CharacterSet>
57
+ </PropertyGroup>
58
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
59
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
60
+ <PlatformToolset>v110</PlatformToolset>
61
+ <CharacterSet>MultiByte</CharacterSet>
62
+ </PropertyGroup>
63
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
64
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
65
+ <PlatformToolset>v110</PlatformToolset>
66
+ <CharacterSet>Unicode</CharacterSet>
67
+ </PropertyGroup>
68
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="Configuration">
69
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
70
+ <PlatformToolset>v110</PlatformToolset>
71
+ <CharacterSet>Unicode</CharacterSet>
72
+ </PropertyGroup>
73
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
74
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
75
+ <PlatformToolset>v110</PlatformToolset>
76
+ <CharacterSet>MultiByte</CharacterSet>
77
+ </PropertyGroup>
78
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
79
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
80
+ <PlatformToolset>v110</PlatformToolset>
81
+ <CharacterSet>MultiByte</CharacterSet>
82
+ </PropertyGroup>
83
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
84
+ <ImportGroup Label="ExtensionSettings">
85
+ </ImportGroup>
86
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="PropertySheets">
87
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
88
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
89
+ </ImportGroup>
90
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="PropertySheets">
91
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
92
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
93
+ </ImportGroup>
94
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
95
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
96
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
97
+ </ImportGroup>
98
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
99
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
100
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
101
+ </ImportGroup>
102
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="PropertySheets">
103
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
104
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
105
+ </ImportGroup>
106
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="PropertySheets">
107
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
108
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
109
+ </ImportGroup>
110
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
111
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
112
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
113
+ </ImportGroup>
114
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
115
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
116
+ <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
117
+ </ImportGroup>
118
+ <PropertyGroup Label="UserMacros" />
119
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
120
+ <GenerateManifest>false</GenerateManifest>
121
+ <OutDir>$(SolutionDir)..\..\Plugins\</OutDir>
122
+ </PropertyGroup>
123
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
124
+ <GenerateManifest>false</GenerateManifest>
125
+ <TargetName>$(ProjectName)64</TargetName>
126
+ <OutDir>$(SolutionDir)..\..\Plugins\</OutDir>
127
+ </PropertyGroup>
128
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
129
+ <OutDir>$(SolutionDir)..\..\Unicode\Plugins\</OutDir>
130
+ <LinkIncremental>true</LinkIncremental>
131
+ <GenerateManifest>false</GenerateManifest>
132
+ </PropertyGroup>
133
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">
134
+ <LinkIncremental>true</LinkIncremental>
135
+ <GenerateManifest>false</GenerateManifest>
136
+ <TargetName>$(ProjectName)64</TargetName>
137
+ </PropertyGroup>
138
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
139
+ <OutDir>$(SolutionDir)..\..\Plugins\</OutDir>
140
+ <GenerateManifest>false</GenerateManifest>
141
+ </PropertyGroup>
142
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
143
+ <GenerateManifest>false</GenerateManifest>
144
+ <TargetName>$(ProjectName)64</TargetName>
145
+ </PropertyGroup>
146
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
147
+ <GenerateManifest>false</GenerateManifest>
148
+ <OutDir>$(SolutionDir)..\..\Unicode\Plugins\</OutDir>
149
+ </PropertyGroup>
150
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">
151
+ <GenerateManifest>false</GenerateManifest>
152
+ <TargetName>$(ProjectName)64</TargetName>
153
+ <OutDir>$(SolutionDir)..\..\Unicode\Plugins\</OutDir>
154
+ </PropertyGroup>
155
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
156
+ <ClCompile>
157
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
158
+ <Optimization>MinSpace</Optimization>
159
+ <SuppressStartupBanner>true</SuppressStartupBanner>
160
+ <WarningLevel>Level3</WarningLevel>
161
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
162
+ <BufferSecurityCheck>false</BufferSecurityCheck>
163
+ </ClCompile>
164
+ <Midl>
165
+ <SuppressStartupBanner>true</SuppressStartupBanner>
166
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
167
+ <TypeLibraryName>.\debug\inetc.tlb</TypeLibraryName>
168
+ <MkTypLibCompatible>true</MkTypLibCompatible>
169
+ <TargetEnvironment>Win32</TargetEnvironment>
170
+ </Midl>
171
+ <ResourceCompile>
172
+ <Culture>0x0409</Culture>
173
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
174
+ </ResourceCompile>
175
+ <Bscmake>
176
+ <SuppressStartupBanner>true</SuppressStartupBanner>
177
+ <OutputFile>.\debug\inetc.bsc</OutputFile>
178
+ </Bscmake>
179
+ <Link>
180
+ <SuppressStartupBanner>true</SuppressStartupBanner>
181
+ <LinkDLL>true</LinkDLL>
182
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
183
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
184
+ <EntryPointSymbol>DllMain</EntryPointSymbol>
185
+ <IgnoreSpecificDefaultLibraries>libc.lib</IgnoreSpecificDefaultLibraries>
186
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
187
+ </Link>
188
+ </ItemDefinitionGroup>
189
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
190
+ <ClCompile>
191
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
192
+ <Optimization>MinSpace</Optimization>
193
+ <SuppressStartupBanner>true</SuppressStartupBanner>
194
+ <WarningLevel>Level3</WarningLevel>
195
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
196
+ <BufferSecurityCheck>false</BufferSecurityCheck>
197
+ </ClCompile>
198
+ <Midl>
199
+ <SuppressStartupBanner>true</SuppressStartupBanner>
200
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
201
+ <TypeLibraryName>.\debug\inetc.tlb</TypeLibraryName>
202
+ <MkTypLibCompatible>true</MkTypLibCompatible>
203
+ </Midl>
204
+ <ResourceCompile>
205
+ <Culture>0x0409</Culture>
206
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
207
+ </ResourceCompile>
208
+ <Bscmake>
209
+ <SuppressStartupBanner>true</SuppressStartupBanner>
210
+ <OutputFile>.\debug\inetc.bsc</OutputFile>
211
+ </Bscmake>
212
+ <Link>
213
+ <SuppressStartupBanner>true</SuppressStartupBanner>
214
+ <LinkDLL>true</LinkDLL>
215
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
216
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
217
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
218
+ <IgnoreSpecificDefaultLibraries>libc.lib</IgnoreSpecificDefaultLibraries>
219
+ <EntryPointSymbol>DllMain</EntryPointSymbol>
220
+ </Link>
221
+ </ItemDefinitionGroup>
222
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
223
+ <ClCompile>
224
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
225
+ <Optimization>Disabled</Optimization>
226
+ <SuppressStartupBanner>true</SuppressStartupBanner>
227
+ <WarningLevel>Level3</WarningLevel>
228
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
229
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
230
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
231
+ <BufferSecurityCheck>false</BufferSecurityCheck>
232
+ </ClCompile>
233
+ <Midl>
234
+ <SuppressStartupBanner>true</SuppressStartupBanner>
235
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
236
+ <TypeLibraryName>.\Debug_Unicode\inetc.tlb</TypeLibraryName>
237
+ <MkTypLibCompatible>true</MkTypLibCompatible>
238
+ <TargetEnvironment>Win32</TargetEnvironment>
239
+ </Midl>
240
+ <ResourceCompile>
241
+ <Culture>0x0409</Culture>
242
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
243
+ </ResourceCompile>
244
+ <Bscmake>
245
+ <SuppressStartupBanner>true</SuppressStartupBanner>
246
+ <OutputFile>.\Debug_Unicode\inetc.bsc</OutputFile>
247
+ </Bscmake>
248
+ <Link>
249
+ <LinkDLL>true</LinkDLL>
250
+ <GenerateDebugInformation>true</GenerateDebugInformation>
251
+ <ImportLibrary>.\Debug_Unicode\inetc.lib</ImportLibrary>
252
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
253
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
254
+ </Link>
255
+ </ItemDefinitionGroup>
256
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">
257
+ <ClCompile>
258
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
259
+ <Optimization>Disabled</Optimization>
260
+ <SuppressStartupBanner>true</SuppressStartupBanner>
261
+ <WarningLevel>Level3</WarningLevel>
262
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
263
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
264
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
265
+ <BufferSecurityCheck>false</BufferSecurityCheck>
266
+ </ClCompile>
267
+ <Midl>
268
+ <SuppressStartupBanner>true</SuppressStartupBanner>
269
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
270
+ <TypeLibraryName>.\Debug_Unicode\inetc.tlb</TypeLibraryName>
271
+ <MkTypLibCompatible>true</MkTypLibCompatible>
272
+ </Midl>
273
+ <ResourceCompile>
274
+ <Culture>0x0409</Culture>
275
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
276
+ </ResourceCompile>
277
+ <Bscmake>
278
+ <SuppressStartupBanner>true</SuppressStartupBanner>
279
+ <OutputFile>.\Debug_Unicode\inetc.bsc</OutputFile>
280
+ </Bscmake>
281
+ <Link>
282
+ <LinkDLL>true</LinkDLL>
283
+ <GenerateDebugInformation>true</GenerateDebugInformation>
284
+ <ImportLibrary>.\Debug_Unicode\inetc.lib</ImportLibrary>
285
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
286
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
287
+ </Link>
288
+ </ItemDefinitionGroup>
289
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
290
+ <ClCompile>
291
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
292
+ <Optimization>Disabled</Optimization>
293
+ <SuppressStartupBanner>true</SuppressStartupBanner>
294
+ <WarningLevel>Level3</WarningLevel>
295
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
296
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
297
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
298
+ </ClCompile>
299
+ <Midl>
300
+ <SuppressStartupBanner>true</SuppressStartupBanner>
301
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
302
+ <TypeLibraryName>.\Debug\inetc.tlb</TypeLibraryName>
303
+ <MkTypLibCompatible>true</MkTypLibCompatible>
304
+ <TargetEnvironment>Win32</TargetEnvironment>
305
+ </Midl>
306
+ <ResourceCompile>
307
+ <Culture>0x0409</Culture>
308
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
309
+ </ResourceCompile>
310
+ <Bscmake>
311
+ <SuppressStartupBanner>true</SuppressStartupBanner>
312
+ <OutputFile>.\Debug\inetc.bsc</OutputFile>
313
+ </Bscmake>
314
+ <Link>
315
+ <SuppressStartupBanner>true</SuppressStartupBanner>
316
+ <LinkDLL>true</LinkDLL>
317
+ <GenerateDebugInformation>true</GenerateDebugInformation>
318
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
319
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
320
+ </Link>
321
+ </ItemDefinitionGroup>
322
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
323
+ <ClCompile>
324
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
325
+ <Optimization>Disabled</Optimization>
326
+ <SuppressStartupBanner>true</SuppressStartupBanner>
327
+ <WarningLevel>Level3</WarningLevel>
328
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
329
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
330
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
331
+ </ClCompile>
332
+ <Midl>
333
+ <SuppressStartupBanner>true</SuppressStartupBanner>
334
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
335
+ <TypeLibraryName>.\Debug\inetc.tlb</TypeLibraryName>
336
+ <MkTypLibCompatible>true</MkTypLibCompatible>
337
+ </Midl>
338
+ <ResourceCompile>
339
+ <Culture>0x0409</Culture>
340
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
341
+ </ResourceCompile>
342
+ <Bscmake>
343
+ <SuppressStartupBanner>true</SuppressStartupBanner>
344
+ <OutputFile>.\Debug\inetc.bsc</OutputFile>
345
+ </Bscmake>
346
+ <Link>
347
+ <SuppressStartupBanner>true</SuppressStartupBanner>
348
+ <LinkDLL>true</LinkDLL>
349
+ <GenerateDebugInformation>true</GenerateDebugInformation>
350
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
351
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
352
+ </Link>
353
+ </ItemDefinitionGroup>
354
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
355
+ <ClCompile>
356
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
357
+ <Optimization>MinSpace</Optimization>
358
+ <SuppressStartupBanner>true</SuppressStartupBanner>
359
+ <WarningLevel>Level3</WarningLevel>
360
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;UNICODE;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
361
+ <BufferSecurityCheck>false</BufferSecurityCheck>
362
+ </ClCompile>
363
+ <Midl>
364
+ <SuppressStartupBanner>true</SuppressStartupBanner>
365
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
366
+ <TypeLibraryName>.\Debug_Unicode\inetc.tlb</TypeLibraryName>
367
+ <MkTypLibCompatible>true</MkTypLibCompatible>
368
+ <TargetEnvironment>Win32</TargetEnvironment>
369
+ </Midl>
370
+ <ResourceCompile>
371
+ <Culture>0x0409</Culture>
372
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
373
+ </ResourceCompile>
374
+ <Bscmake>
375
+ <SuppressStartupBanner>true</SuppressStartupBanner>
376
+ <OutputFile>.\Debug_Unicode\inetc.bsc</OutputFile>
377
+ </Bscmake>
378
+ <Link>
379
+ <SuppressStartupBanner>true</SuppressStartupBanner>
380
+ <LinkDLL>true</LinkDLL>
381
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
382
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
383
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
384
+ <EntryPointSymbol>DllMain</EntryPointSymbol>
385
+ <IgnoreSpecificDefaultLibraries>libc.lib</IgnoreSpecificDefaultLibraries>
386
+ </Link>
387
+ </ItemDefinitionGroup>
388
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">
389
+ <ClCompile>
390
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
391
+ <Optimization>MinSpace</Optimization>
392
+ <SuppressStartupBanner>true</SuppressStartupBanner>
393
+ <WarningLevel>Level3</WarningLevel>
394
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;UNICODE;_USRDLL;inetc_EXPORTS;_VC80_UPGRADE=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
395
+ <BufferSecurityCheck>false</BufferSecurityCheck>
396
+ </ClCompile>
397
+ <Midl>
398
+ <SuppressStartupBanner>true</SuppressStartupBanner>
399
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
400
+ <TypeLibraryName>.\Debug_Unicode\inetc.tlb</TypeLibraryName>
401
+ <MkTypLibCompatible>true</MkTypLibCompatible>
402
+ </Midl>
403
+ <ResourceCompile>
404
+ <Culture>0x0409</Culture>
405
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
406
+ </ResourceCompile>
407
+ <Bscmake>
408
+ <SuppressStartupBanner>true</SuppressStartupBanner>
409
+ <OutputFile>.\Debug_Unicode\inetc.bsc</OutputFile>
410
+ </Bscmake>
411
+ <Link>
412
+ <SuppressStartupBanner>true</SuppressStartupBanner>
413
+ <LinkDLL>true</LinkDLL>
414
+ <AdditionalDependencies>wininet.lib;comctl32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
415
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
416
+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
417
+ <IgnoreSpecificDefaultLibraries>libc.lib</IgnoreSpecificDefaultLibraries>
418
+ <EntryPointSymbol>DllMain</EntryPointSymbol>
419
+ </Link>
420
+ </ItemDefinitionGroup>
421
+ <ItemGroup>
422
+ <ClCompile Include="crt.cpp" />
423
+ <ClCompile Include="inetc.cpp" />
424
+ <ClCompile Include="pluginapi.c" />
425
+ </ItemGroup>
426
+ <ItemGroup>
427
+ <Image Include="..\Graphics\Icons\classic-install.ico" />
428
+ </ItemGroup>
429
+ <ItemGroup>
430
+ <ResourceCompile Include="inetc.rc" />
431
+ </ItemGroup>
432
+ <ItemGroup>
433
+ <ClInclude Include="api.h" />
434
+ <ClInclude Include="nsis_tchar.h" />
435
+ <ClInclude Include="pluginapi.h" />
436
+ <ClInclude Include="resource.h" />
437
+ </ItemGroup>
438
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
439
+ <ImportGroup Label="ExtensionTargets">
440
+ </ImportGroup>
441
+ </Project>
build/WINDOWS/Plugins/inetc/Contrib/Inetc/inetc.vcxproj.filters ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup>
4
+ <Filter Include="Source Files">
5
+ <UniqueIdentifier>{7803dcf0-655c-4f71-89dd-7fd695066a28}</UniqueIdentifier>
6
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
7
+ </Filter>
8
+ <Filter Include="Resource Files">
9
+ <UniqueIdentifier>{8edac42d-b9b9-469f-9864-3dbc65bf4365}</UniqueIdentifier>
10
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
11
+ </Filter>
12
+ <Filter Include="Header Files">
13
+ <UniqueIdentifier>{67a938b1-f16b-478b-81df-d0fd26de6d8a}</UniqueIdentifier>
14
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
15
+ </Filter>
16
+ </ItemGroup>
17
+ <ItemGroup>
18
+ <ClCompile Include="inetc.cpp">
19
+ <Filter>Source Files</Filter>
20
+ </ClCompile>
21
+ <ClCompile Include="pluginapi.c">
22
+ <Filter>Source Files</Filter>
23
+ </ClCompile>
24
+ <ClCompile Include="crt.cpp">
25
+ <Filter>Source Files</Filter>
26
+ </ClCompile>
27
+ </ItemGroup>
28
+ <ItemGroup>
29
+ <Image Include="..\Graphics\Icons\classic-install.ico">
30
+ <Filter>Resource Files</Filter>
31
+ </Image>
32
+ </ItemGroup>
33
+ <ItemGroup>
34
+ <ResourceCompile Include="inetc.rc">
35
+ <Filter>Resource Files</Filter>
36
+ </ResourceCompile>
37
+ </ItemGroup>
38
+ <ItemGroup>
39
+ <ClInclude Include="api.h">
40
+ <Filter>Header Files</Filter>
41
+ </ClInclude>
42
+ <ClInclude Include="nsis_tchar.h">
43
+ <Filter>Header Files</Filter>
44
+ </ClInclude>
45
+ <ClInclude Include="pluginapi.h">
46
+ <Filter>Header Files</Filter>
47
+ </ClInclude>
48
+ <ClInclude Include="resource.h">
49
+ <Filter>Header Files</Filter>
50
+ </ClInclude>
51
+ </ItemGroup>
52
+ </Project>
build/WINDOWS/Plugins/inetc/Contrib/Inetc/nsis_tchar.h ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * nsis_tchar.h
3
+ *
4
+ * This file is a part of NSIS.
5
+ *
6
+ * Copyright (C) 1999-2013 Nullsoft and Contributors
7
+ *
8
+ * This software is provided 'as-is', without any express or implied
9
+ * warranty.
10
+ *
11
+ * For Unicode support by Jim Park -- 08/30/2007
12
+ */
13
+
14
+ // Jim Park: Only those we use are listed here.
15
+
16
+ #pragma once
17
+
18
+ #ifdef _UNICODE
19
+
20
+ #ifndef _T
21
+ #define __T(x) L ## x
22
+ #define _T(x) __T(x)
23
+ #define _TEXT(x) __T(x)
24
+ #endif
25
+
26
+ #ifndef _TCHAR_DEFINED
27
+ #define _TCHAR_DEFINED
28
+ #if !defined(_NATIVE_WCHAR_T_DEFINED) && !defined(_WCHAR_T_DEFINED)
29
+ typedef unsigned short TCHAR;
30
+ #else
31
+ typedef wchar_t TCHAR;
32
+ #endif
33
+ #endif
34
+
35
+
36
+ // program
37
+ #define _tenviron _wenviron
38
+ #define __targv __wargv
39
+
40
+ // printfs
41
+ #define _ftprintf fwprintf
42
+ #define _sntprintf _snwprintf
43
+ #if (defined(_MSC_VER) && (_MSC_VER<=1310)) || defined(__MINGW32__)
44
+ # define _stprintf swprintf
45
+ #else
46
+ # define _stprintf _swprintf
47
+ #endif
48
+ #define _tprintf wprintf
49
+ #define _vftprintf vfwprintf
50
+ #define _vsntprintf _vsnwprintf
51
+ #if defined(_MSC_VER) && (_MSC_VER<=1310)
52
+ # define _vstprintf vswprintf
53
+ #else
54
+ # define _vstprintf _vswprintf
55
+ #endif
56
+
57
+ // scanfs
58
+ #define _tscanf wscanf
59
+ #define _stscanf swscanf
60
+
61
+ // string manipulations
62
+ #define _tcscat wcscat
63
+ #define _tcschr wcschr
64
+ #define _tcsclen wcslen
65
+ #define _tcscpy wcscpy
66
+ #define _tcsdup _wcsdup
67
+ #define _tcslen wcslen
68
+ #define _tcsnccpy wcsncpy
69
+ #define _tcsncpy wcsncpy
70
+ #define _tcsrchr wcsrchr
71
+ #define _tcsstr wcsstr
72
+ #define _tcstok wcstok
73
+
74
+ // string comparisons
75
+ #define _tcscmp wcscmp
76
+ #define _tcsicmp _wcsicmp
77
+ #define _tcsncicmp _wcsnicmp
78
+ #define _tcsncmp wcsncmp
79
+ #define _tcsnicmp _wcsnicmp
80
+
81
+ // upper / lower
82
+ #define _tcslwr _wcslwr
83
+ #define _tcsupr _wcsupr
84
+ #define _totlower towlower
85
+ #define _totupper towupper
86
+
87
+ // conversions to numbers
88
+ #define _tcstoi64 _wcstoi64
89
+ #define _tcstol wcstol
90
+ #define _tcstoul wcstoul
91
+ #define _tstof _wtof
92
+ #define _tstoi _wtoi
93
+ #define _tstoi64 _wtoi64
94
+ #define _ttoi _wtoi
95
+ #define _ttoi64 _wtoi64
96
+ #define _ttol _wtol
97
+
98
+ // conversion from numbers to strings
99
+ #define _itot _itow
100
+ #define _ltot _ltow
101
+ #define _i64tot _i64tow
102
+ #define _ui64tot _ui64tow
103
+
104
+ // file manipulations
105
+ #define _tfopen _wfopen
106
+ #define _topen _wopen
107
+ #define _tremove _wremove
108
+ #define _tunlink _wunlink
109
+
110
+ // reading and writing to i/o
111
+ #define _fgettc fgetwc
112
+ #define _fgetts fgetws
113
+ #define _fputts fputws
114
+ #define _gettchar getwchar
115
+
116
+ // directory
117
+ #define _tchdir _wchdir
118
+
119
+ // environment
120
+ #define _tgetenv _wgetenv
121
+ #define _tsystem _wsystem
122
+
123
+ // time
124
+ #define _tcsftime wcsftime
125
+
126
+ #else // ANSI
127
+
128
+ #ifndef _T
129
+ #define _T(x) x
130
+ #define _TEXT(x) x
131
+ #endif
132
+
133
+ #ifndef _TCHAR_DEFINED
134
+ #define _TCHAR_DEFINED
135
+ typedef char TCHAR;
136
+ #endif
137
+
138
+ // program
139
+ #define _tenviron environ
140
+ #define __targv __argv
141
+
142
+ // printfs
143
+ #define _ftprintf fprintf
144
+ #define _sntprintf _snprintf
145
+ #define _stprintf sprintf
146
+ #define _tprintf printf
147
+ #define _vftprintf vfprintf
148
+ #define _vsntprintf _vsnprintf
149
+ #define _vstprintf vsprintf
150
+
151
+ // scanfs
152
+ #define _tscanf scanf
153
+ #define _stscanf sscanf
154
+
155
+ // string manipulations
156
+ #define _tcscat strcat
157
+ #define _tcschr strchr
158
+ #define _tcsclen strlen
159
+ #define _tcscnlen strnlen
160
+ #define _tcscpy strcpy
161
+ #define _tcsdup _strdup
162
+ #define _tcslen strlen
163
+ #define _tcsnccpy strncpy
164
+ #define _tcsrchr strrchr
165
+ #define _tcsstr strstr
166
+ #define _tcstok strtok
167
+
168
+ // string comparisons
169
+ #define _tcscmp strcmp
170
+ #define _tcsicmp _stricmp
171
+ #define _tcsncmp strncmp
172
+ #define _tcsncicmp _strnicmp
173
+ #define _tcsnicmp _strnicmp
174
+
175
+ // upper / lower
176
+ #define _tcslwr _strlwr
177
+ #define _tcsupr _strupr
178
+
179
+ #define _totupper toupper
180
+ #define _totlower tolower
181
+
182
+ // conversions to numbers
183
+ #define _tcstol strtol
184
+ #define _tcstoul strtoul
185
+ #define _tstof atof
186
+ #define _tstoi atoi
187
+ #define _tstoi64 _atoi64
188
+ #define _tstoi64 _atoi64
189
+ #define _ttoi atoi
190
+ #define _ttoi64 _atoi64
191
+ #define _ttol atol
192
+
193
+ // conversion from numbers to strings
194
+ #define _i64tot _i64toa
195
+ #define _itot _itoa
196
+ #define _ltot _ltoa
197
+ #define _ui64tot _ui64toa
198
+
199
+ // file manipulations
200
+ #define _tfopen fopen
201
+ #define _topen _open
202
+ #define _tremove remove
203
+ #define _tunlink _unlink
204
+
205
+ // reading and writing to i/o
206
+ #define _fgettc fgetc
207
+ #define _fgetts fgets
208
+ #define _fputts fputs
209
+ #define _gettchar getchar
210
+
211
+ // directory
212
+ #define _tchdir _chdir
213
+
214
+ // environment
215
+ #define _tgetenv getenv
216
+ #define _tsystem system
217
+
218
+ // time
219
+ #define _tcsftime strftime
220
+
221
+ #endif
222
+
223
+ // is functions (the same in Unicode / ANSI)
224
+ #define _istgraph isgraph
225
+ #define _istascii __isascii
226
+
227
+ #define __TFILE__ _T(__FILE__)
228
+ #define __TDATE__ _T(__DATE__)
229
+ #define __TTIME__ _T(__TIME__)
build/WINDOWS/Plugins/inetc/Contrib/Inetc/pluginapi.c ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <windows.h>
2
+
3
+ #include "pluginapi.h"
4
+
5
+ #ifdef _countof
6
+ #define COUNTOF _countof
7
+ #else
8
+ #define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
9
+ #endif
10
+
11
+ unsigned int g_stringsize;
12
+ stack_t **g_stacktop;
13
+ TCHAR *g_variables;
14
+
15
+ // utility functions (not required but often useful)
16
+
17
+ int NSISCALL popstring(TCHAR *str)
18
+ {
19
+ stack_t *th;
20
+ if (!g_stacktop || !*g_stacktop) return 1;
21
+ th=(*g_stacktop);
22
+ if (str) lstrcpy(str,th->text);
23
+ *g_stacktop = th->next;
24
+ GlobalFree((HGLOBAL)th);
25
+ return 0;
26
+ }
27
+
28
+ int NSISCALL popstringn(TCHAR *str, int maxlen)
29
+ {
30
+ stack_t *th;
31
+ if (!g_stacktop || !*g_stacktop) return 1;
32
+ th=(*g_stacktop);
33
+ if (str) lstrcpyn(str,th->text,maxlen?maxlen:g_stringsize);
34
+ *g_stacktop = th->next;
35
+ GlobalFree((HGLOBAL)th);
36
+ return 0;
37
+ }
38
+
39
+ void NSISCALL pushstring(const TCHAR *str)
40
+ {
41
+ stack_t *th;
42
+ if (!g_stacktop) return;
43
+ th=(stack_t*)GlobalAlloc(GPTR,(sizeof(stack_t)+(g_stringsize)*sizeof(TCHAR)));
44
+ lstrcpyn(th->text,str,g_stringsize);
45
+ th->next=*g_stacktop;
46
+ *g_stacktop=th;
47
+ }
48
+
49
+ TCHAR* NSISCALL getuservariable(const int varnum)
50
+ {
51
+ if (varnum < 0 || varnum >= __INST_LAST) return NULL;
52
+ return g_variables+varnum*g_stringsize;
53
+ }
54
+
55
+ void NSISCALL setuservariable(const int varnum, const TCHAR *var)
56
+ {
57
+ if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
58
+ lstrcpy(g_variables + varnum*g_stringsize, var);
59
+ }
60
+
61
+ #ifdef _UNICODE
62
+ int NSISCALL PopStringA(char* ansiStr)
63
+ {
64
+ wchar_t* wideStr = (wchar_t*) GlobalAlloc(GPTR, g_stringsize*sizeof(wchar_t));
65
+ int rval = popstring(wideStr);
66
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
67
+ GlobalFree((HGLOBAL)wideStr);
68
+ return rval;
69
+ }
70
+
71
+ int NSISCALL PopStringNA(char* ansiStr, int maxlen)
72
+ {
73
+ int realLen = maxlen ? maxlen : g_stringsize;
74
+ wchar_t* wideStr = (wchar_t*) GlobalAlloc(GPTR, realLen*sizeof(wchar_t));
75
+ int rval = popstringn(wideStr, realLen);
76
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, realLen, NULL, NULL);
77
+ GlobalFree((HGLOBAL)wideStr);
78
+ return rval;
79
+ }
80
+
81
+ void NSISCALL PushStringA(const char* ansiStr)
82
+ {
83
+ wchar_t* wideStr = (wchar_t*) GlobalAlloc(GPTR, g_stringsize*sizeof(wchar_t));
84
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
85
+ pushstring(wideStr);
86
+ GlobalFree((HGLOBAL)wideStr);
87
+ return;
88
+ }
89
+
90
+ void NSISCALL GetUserVariableW(const int varnum, wchar_t* wideStr)
91
+ {
92
+ lstrcpyW(wideStr, getuservariable(varnum));
93
+ }
94
+
95
+ void NSISCALL GetUserVariableA(const int varnum, char* ansiStr)
96
+ {
97
+ wchar_t* wideStr = getuservariable(varnum);
98
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
99
+ }
100
+
101
+ void NSISCALL SetUserVariableA(const int varnum, const char* ansiStr)
102
+ {
103
+ if (ansiStr != NULL && varnum >= 0 && varnum < __INST_LAST)
104
+ {
105
+ wchar_t* wideStr = g_variables + varnum * g_stringsize;
106
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
107
+ }
108
+ }
109
+
110
+ #else
111
+ // ANSI defs
112
+ int NSISCALL PopStringW(wchar_t* wideStr)
113
+ {
114
+ char* ansiStr = (char*) GlobalAlloc(GPTR, g_stringsize);
115
+ int rval = popstring(ansiStr);
116
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
117
+ GlobalFree((HGLOBAL)ansiStr);
118
+ return rval;
119
+ }
120
+
121
+ int NSISCALL PopStringNW(wchar_t* wideStr, int maxlen)
122
+ {
123
+ int realLen = maxlen ? maxlen : g_stringsize;
124
+ char* ansiStr = (char*) GlobalAlloc(GPTR, realLen);
125
+ int rval = popstringn(ansiStr, realLen);
126
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, realLen);
127
+ GlobalFree((HGLOBAL)ansiStr);
128
+ return rval;
129
+ }
130
+
131
+ void NSISCALL PushStringW(wchar_t* wideStr)
132
+ {
133
+ char* ansiStr = (char*) GlobalAlloc(GPTR, g_stringsize);
134
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
135
+ pushstring(ansiStr);
136
+ GlobalFree((HGLOBAL)ansiStr);
137
+ }
138
+
139
+ void NSISCALL GetUserVariableW(const int varnum, wchar_t* wideStr)
140
+ {
141
+ char* ansiStr = getuservariable(varnum);
142
+ MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideStr, g_stringsize);
143
+ }
144
+
145
+ void NSISCALL GetUserVariableA(const int varnum, char* ansiStr)
146
+ {
147
+ lstrcpyA(ansiStr, getuservariable(varnum));
148
+ }
149
+
150
+ void NSISCALL SetUserVariableW(const int varnum, const wchar_t* wideStr)
151
+ {
152
+ if (wideStr != NULL && varnum >= 0 && varnum < __INST_LAST)
153
+ {
154
+ char* ansiStr = g_variables + varnum * g_stringsize;
155
+ WideCharToMultiByte(CP_ACP, 0, wideStr, -1, ansiStr, g_stringsize, NULL, NULL);
156
+ }
157
+ }
158
+ #endif
159
+
160
+ // playing with integers
161
+
162
+ INT_PTR NSISCALL nsishelper_str_to_ptr(const TCHAR *s)
163
+ {
164
+ INT_PTR v=0;
165
+ if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X')))
166
+ {
167
+ s++;
168
+ for (;;)
169
+ {
170
+ int c=*(++s);
171
+ if (c >= _T('0') && c <= _T('9')) c-=_T('0');
172
+ else if (c >= _T('a') && c <= _T('f')) c-=_T('a')-10;
173
+ else if (c >= _T('A') && c <= _T('F')) c-=_T('A')-10;
174
+ else break;
175
+ v<<=4;
176
+ v+=c;
177
+ }
178
+ }
179
+ else if (*s == _T('0') && s[1] <= _T('7') && s[1] >= _T('0'))
180
+ {
181
+ for (;;)
182
+ {
183
+ int c=*(++s);
184
+ if (c >= _T('0') && c <= _T('7')) c-=_T('0');
185
+ else break;
186
+ v<<=3;
187
+ v+=c;
188
+ }
189
+ }
190
+ else
191
+ {
192
+ int sign=0;
193
+ if (*s == _T('-')) sign++; else s--;
194
+ for (;;)
195
+ {
196
+ int c=*(++s) - _T('0');
197
+ if (c < 0 || c > 9) break;
198
+ v*=10;
199
+ v+=c;
200
+ }
201
+ if (sign) v = -v;
202
+ }
203
+
204
+ return v;
205
+ }
206
+
207
+ unsigned int NSISCALL myatou(const TCHAR *s)
208
+ {
209
+ unsigned int v=0;
210
+
211
+ for (;;)
212
+ {
213
+ unsigned int c=*s++;
214
+ if (c >= _T('0') && c <= _T('9')) c-=_T('0');
215
+ else break;
216
+ v*=10;
217
+ v+=c;
218
+ }
219
+ return v;
220
+ }
221
+
222
+ int NSISCALL myatoi_or(const TCHAR *s)
223
+ {
224
+ int v=0;
225
+ if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X')))
226
+ {
227
+ s++;
228
+ for (;;)
229
+ {
230
+ int c=*(++s);
231
+ if (c >= _T('0') && c <= _T('9')) c-=_T('0');
232
+ else if (c >= _T('a') && c <= _T('f')) c-=_T('a')-10;
233
+ else if (c >= _T('A') && c <= _T('F')) c-=_T('A')-10;
234
+ else break;
235
+ v<<=4;
236
+ v+=c;
237
+ }
238
+ }
239
+ else if (*s == _T('0') && s[1] <= _T('7') && s[1] >= _T('0'))
240
+ {
241
+ for (;;)
242
+ {
243
+ int c=*(++s);
244
+ if (c >= _T('0') && c <= _T('7')) c-=_T('0');
245
+ else break;
246
+ v<<=3;
247
+ v+=c;
248
+ }
249
+ }
250
+ else
251
+ {
252
+ int sign=0;
253
+ if (*s == _T('-')) sign++; else s--;
254
+ for (;;)
255
+ {
256
+ int c=*(++s) - _T('0');
257
+ if (c < 0 || c > 9) break;
258
+ v*=10;
259
+ v+=c;
260
+ }
261
+ if (sign) v = -v;
262
+ }
263
+
264
+ // Support for simple ORed expressions
265
+ if (*s == _T('|'))
266
+ {
267
+ v |= myatoi_or(s+1);
268
+ }
269
+
270
+ return v;
271
+ }
272
+
273
+ INT_PTR NSISCALL popintptr()
274
+ {
275
+ TCHAR buf[128];
276
+ if (popstringn(buf,COUNTOF(buf)))
277
+ return 0;
278
+ return nsishelper_str_to_ptr(buf);
279
+ }
280
+
281
+ int NSISCALL popint_or()
282
+ {
283
+ TCHAR buf[128];
284
+ if (popstringn(buf,COUNTOF(buf)))
285
+ return 0;
286
+ return myatoi_or(buf);
287
+ }
288
+
289
+ void NSISCALL pushintptr(INT_PTR value)
290
+ {
291
+ TCHAR buffer[30];
292
+ wsprintf(buffer, sizeof(void*) > 4 ? _T("%Id") : _T("%d"), value);
293
+ pushstring(buffer);
294
+ }
build/WINDOWS/Plugins/inetc/Contrib/Inetc/pluginapi.h ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef ___NSIS_PLUGIN__H___
2
+ #define ___NSIS_PLUGIN__H___
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include "api.h"
9
+ #include "nsis_tchar.h"
10
+
11
+ #ifndef NSISCALL
12
+ # define NSISCALL __stdcall
13
+ #endif
14
+
15
+ #define EXDLL_INIT() { \
16
+ g_stringsize=string_size; \
17
+ g_stacktop=stacktop; \
18
+ g_variables=variables; }
19
+
20
+ typedef struct _stack_t {
21
+ struct _stack_t *next;
22
+ TCHAR text[1]; // this should be the length of string_size
23
+ } stack_t;
24
+
25
+ enum
26
+ {
27
+ INST_0, // $0
28
+ INST_1, // $1
29
+ INST_2, // $2
30
+ INST_3, // $3
31
+ INST_4, // $4
32
+ INST_5, // $5
33
+ INST_6, // $6
34
+ INST_7, // $7
35
+ INST_8, // $8
36
+ INST_9, // $9
37
+ INST_R0, // $R0
38
+ INST_R1, // $R1
39
+ INST_R2, // $R2
40
+ INST_R3, // $R3
41
+ INST_R4, // $R4
42
+ INST_R5, // $R5
43
+ INST_R6, // $R6
44
+ INST_R7, // $R7
45
+ INST_R8, // $R8
46
+ INST_R9, // $R9
47
+ INST_CMDLINE, // $CMDLINE
48
+ INST_INSTDIR, // $INSTDIR
49
+ INST_OUTDIR, // $OUTDIR
50
+ INST_EXEDIR, // $EXEDIR
51
+ INST_LANG, // $LANGUAGE
52
+ __INST_LAST
53
+ };
54
+
55
+ extern unsigned int g_stringsize;
56
+ extern stack_t **g_stacktop;
57
+ extern TCHAR *g_variables;
58
+
59
+ void NSISCALL pushstring(const TCHAR *str);
60
+ void NSISCALL pushintptr(INT_PTR value);
61
+ #define pushint(v) pushintptr((INT_PTR)(v))
62
+ int NSISCALL popstring(TCHAR *str); // 0 on success, 1 on empty stack
63
+ int NSISCALL popstringn(TCHAR *str, int maxlen); // with length limit, pass 0 for g_stringsize
64
+ INT_PTR NSISCALL popintptr();
65
+ #define popint() ( (int) popintptr() )
66
+ int NSISCALL popint_or(); // with support for or'ing (2|4|8)
67
+ INT_PTR NSISCALL nsishelper_str_to_ptr(const TCHAR *s);
68
+ #define myatoi(s) ( (int) nsishelper_str_to_ptr(s) ) // converts a string to an integer
69
+ unsigned int NSISCALL myatou(const TCHAR *s); // converts a string to an unsigned integer, decimal only
70
+ int NSISCALL myatoi_or(const TCHAR *s); // with support for or'ing (2|4|8)
71
+ TCHAR* NSISCALL getuservariable(const int varnum);
72
+ void NSISCALL setuservariable(const int varnum, const TCHAR *var);
73
+
74
+ #ifdef _UNICODE
75
+ #define PopStringW(x) popstring(x)
76
+ #define PushStringW(x) pushstring(x)
77
+ #define SetUserVariableW(x,y) setuservariable(x,y)
78
+
79
+ int NSISCALL PopStringA(char* ansiStr);
80
+ void NSISCALL PushStringA(const char* ansiStr);
81
+ void NSISCALL GetUserVariableW(const int varnum, wchar_t* wideStr);
82
+ void NSISCALL GetUserVariableA(const int varnum, char* ansiStr);
83
+ void NSISCALL SetUserVariableA(const int varnum, const char* ansiStr);
84
+
85
+ #else
86
+ // ANSI defs
87
+
88
+ #define PopStringA(x) popstring(x)
89
+ #define PushStringA(x) pushstring(x)
90
+ #define SetUserVariableA(x,y) setuservariable(x,y)
91
+
92
+ int NSISCALL PopStringW(wchar_t* wideStr);
93
+ void NSISCALL PushStringW(wchar_t* wideStr);
94
+ void NSISCALL GetUserVariableW(const int varnum, wchar_t* wideStr);
95
+ void NSISCALL GetUserVariableA(const int varnum, char* ansiStr);
96
+ void NSISCALL SetUserVariableW(const int varnum, const wchar_t* wideStr);
97
+
98
+ #endif
99
+
100
+ #ifdef __cplusplus
101
+ }
102
+ #endif
103
+
104
+ #endif//!___NSIS_PLUGIN__H___
build/WINDOWS/Plugins/inetc/Contrib/Inetc/resource.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //{{NO_DEPENDENCIES}}
2
+ // Microsoft Developer Studio generated include file.
3
+ // Used by inetc.rc
4
+ //
5
+ #define IDC_SLOGIN 8
6
+ #define IDC_PROGRESS 10
7
+ #define IDC_SUBTEXT 11
8
+ #define IDC_SPWD 11
9
+ #define IDC_ICON1 12
10
+ #define IDD_DIALOG1 101
11
+ #define IDI_ICON1 102
12
+ #define IDI_ICON2 103
13
+ #define IDD_AUTH 104
14
+ #define IDI_ICON3 105
15
+ #define IDI_ICON4 106
16
+ #define IDI_ICON5 107
17
+ #define IDD_DIALOG2 108
18
+ #define IDI_ICON6 109
19
+ #define IDD_DIALOG3 110
20
+ #define IDC_STATIC1 1001
21
+ #define IDC_STATIC2 1002
22
+ #define IDC_STATIC3 1003
23
+ #define IDC_STATIC4 1004
24
+ #define IDC_PROGRESS1 1005
25
+ #define IDC_STATIC5 1006
26
+ #define IDC_STATIC6 1007
27
+ #define IDC_STATIC12 1008
28
+ #define IDC_STATIC13 1009
29
+ #define IDC_STATIC20 1009
30
+ #define IDC_STATIC21 1010
31
+ #define IDC_STATIC22 1011
32
+ #define IDC_STATIC23 1012
33
+ #define IDC_STATIC24 1013
34
+ #define IDC_STATIC25 1014
35
+ #define IDC_ELOGIN 1015
36
+ #define IDC_EPWD 1016
37
+
38
+ // Next default values for new objects
39
+ //
40
+ #ifdef APSTUDIO_INVOKED
41
+ #ifndef APSTUDIO_READONLY_SYMBOLS
42
+ #define _APS_NEXT_RESOURCE_VALUE 111
43
+ #define _APS_NEXT_COMMAND_VALUE 40001
44
+ #define _APS_NEXT_CONTROL_VALUE 1018
45
+ #define _APS_NEXT_SYMED_VALUE 101
46
+ #endif
47
+ #endif
build/WINDOWS/Plugins/inetc/Docs/Inetc/Readme.htm ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div style="border:solid 1px black;padding:10px;width:300px">
2
+ <h2>Contents</h2>
3
+ <UL>
4
+ <LI>1 Links
5
+ <LI>2 Description
6
+ <LI>3 Commands
7
+ <UL>
8
+ <LI>3.1 get
9
+ <LI>3.2 post
10
+ <LI>3.3 head
11
+ <LI>3.4 put
12
+ </UL>
13
+ <LI>4 Examples
14
+ <LI>5 Credits
15
+ </UL>
16
+ </div>
17
+
18
+ <h2>Links</h2>
19
+ Download: <a href="http://nsis.sourceforge.net/Inetc_plug-in">http://nsis.sourceforge.net/Inetc_plug-in</a>
20
+
21
+ <h2>Description</h2>
22
+ Internet client plug-in for files download and upload. Based on the InetLoad plug-in.
23
+ Network implementation uses MS WinInet API, supports http/https and ftp protocols.
24
+ Plugin has better proxy support compare to NSISdl plug-in. Command line may include
25
+ few URL/File pairs to be transfered. If server or proxy login/password are not setten in the script,
26
+ displays IE-style authentication dialog (except silent mode). Plug-in supports 3
27
+ "transfer in progress" display modes:
28
+ <UL>
29
+ <LI>old NSISdl style - additional embedded progress bar and text on the INSTFILES page;
30
+ <LI>POPUP dialog mode with detailed info;
31
+ <LI>BANNER mode with simple popup window.
32
+ </UL>
33
+ Plug-in recognizes Installer's Silent mode and this case hides any output (this feature
34
+ requires NSIS 2.03 or later). Program implements simple re-get functionality - host
35
+ reconnect and download from current position after short pause. While program depends on IE settings,
36
+ it changes current IE mode to online. NSISdl code fragment was used for progress bar displaying
37
+ in the "old style" mode. For ftp use "host/path" for file location relative to user's home dir and
38
+ "host//path" for absolute path.
39
+
40
+ <h2>Commands</h2>
41
+
42
+ Plug-in DLL functions (entry points): get, post, head, put
43
+
44
+ <h3>get</h3>
45
+
46
+ <i>inetc::get [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/NOCOOKIES]
47
+ [/NOPROXY] [/NOCANCEL] [/CONNECTTIMEOUT TO_SEC] [/RECEIVETIMEOUT TO_SEC] [/SILENT] [/WEAKSECURITY]
48
+ [/CAPTION TEXT] [/NOCOOKIES] [/RESUME RETRY_QUESTION] [/POPUP HOST_ALIAS | /BANNER TEXT]
49
+ [/CANCELTEXT CANCEL_TEXT] [/QUESTION CANCEL_QUESTION] [/USERAGENT USER_AGENT_TEXT]
50
+ [/HEADER HEADER_TEXT] [/TRANSLATE LANG_PARAMS] [/TOSTACK | /TOSTACKCONV]
51
+ URL1 local_file1 [URL2 local_file2 [...]] [/END]</i>
52
+ <p>This call returns "OK" string if successful, error description string if failed (see included InetLoad.cpp file for a full set of status strings). Usage and result processing samples are included to the package.
53
+ <p>/PROXY -
54
+ Overwrites current proxy settings, not required in most cases. IE settings will be used by default.
55
+ <p>/USERNAME -
56
+ Proxy username (http only).
57
+ <p>/PASSWORD -
58
+ Proxy password (http only). For server (http/ftp) authentication it is possible to use URL encoded name and password, for example http://username:[email protected].
59
+ <p>/NOPROXY -
60
+ Disables proxy settings for this connection (if any)
61
+ <p>/NOCANCEL -
62
+ Prevents download from being interrupted by user (locks Esc, Alt-F4, Cancel handling, removes sysmenu)
63
+ <p>/CONNECTTIMEOUT -
64
+ Sets INTERNET_OPTION_CONNECT_TIMEOUT, seconds, default - IE current parameter value.
65
+ <p>/RECEIVETIMEOUT -
66
+ Sets INTERNET_OPTION_RECEIVE_TIMEOUT, seconds, default - IE current parameter value.
67
+ <p>/SILENT -
68
+ Key hides plug-in' output (both popup dialog and embedded progress bar). Not required if 'SilentInstall silent' mode was defined in script (NSIS 2.03 or later).
69
+ <p>/WEAKSECURITY -
70
+ Ignore unknown and revoked certificates
71
+ <p>/RESUME -
72
+ On the permanent connection/transfer error instead of exit first displays message box with "resume download" question. Useful for dial-up connections and big files - allows user to restore connection and resume download. Default is "Your internet connection seems to have dropped out!\nPlease reconnect and click Retry to resume downloading...".
73
+ <p>/CAPTION -
74
+ Defines caption text for /BANNER mode, caption prefix (left of '-') for /POPUP mode and caption for RESUME MessageBox. Default is "InetLoad plug-in" if not set or "". 127 chars maximum.
75
+ <p>/POPUP -
76
+ This mode displays detailed download dialog instead of embedded progress bar. Also useful in .onInit function (i.e. not in Section). If HOST_ALIAS is not "", text will replace URL in the dialog - this allows to hide real URL (including password).
77
+ <p>/BANNER -
78
+ Displays simple popup dialog (MSI Banner mode) and sets dialog TEXT (up to 3 lines using $\n).
79
+ <p>/CANCELTEXT -
80
+ Text for the Cancel button in the NSISdl mode. Default is NSIS dialog Cancel button text (current lang).
81
+ <p>/QUESTION -
82
+ Text for the optional MessageBox if user tries to cancel download. If /QUESTION "" was used default
83
+ "Are you sure that you want to stop download?" will be substituted.
84
+ <p>/USERAGENT -
85
+ UserAgent http request header value. Default is "NSIS_Inetc (Mozilla)". 256 chars maximum.
86
+ <p>/HEADER -
87
+ Adds or replaces http request header. Common HEADER_TEXT format is "header: value".
88
+ <p>/NOCOOKIES -
89
+ Removes cookies from http request
90
+ <p>/TOSTACK -
91
+ Outputs the post/get/head response to the NSIS stack rather than to the file (specify an empty string for local_file1, local_file2 etc.)
92
+ <p>/TOSTACKCONV -
93
+ Outputs the post/get/head response to the NSIS stack while converting character encodings:<br>
94
+ ASCII -> Unicode for the Unicode plug-in build<br>
95
+ Unicode -> ASCII for the ASCII plug-in build
96
+ <p>/END -
97
+ Allows to limit plug-in stack reading (optional, required if you stores other vars in the stack).
98
+ <p>/TRANSLATE -
99
+ Allows translating plug-in text in the POPUP or NSISdl modes. 8 parameters both cases.<br>
100
+
101
+ NSISdl mode parameters:<br>
102
+ /TRANSLATE downloading connecting second minute hour plural progress remaining<br>
103
+ With default values:<br>
104
+ "Downloading %s" "Connecting ..." second minute hour s "%dkB (%d%%) of %dkB @ %d.%01dkB/s" "(%d %s%s remaining)"<br>
105
+
106
+ POPUP mode parameters:<br>
107
+ /TRANSLATE url downloading connecting file_name received file_size remaining_time total_time<br>
108
+ With default values:<br>
109
+ URL Downloading Connecting "File Name" Received "File Size" "Remaining Time" "Total Time"<br>
110
+
111
+ <h3>post</h3>
112
+
113
+ <i>inetc::post TEXT2POST [/FILE] [/PROXY IP:PORT] [/NOPROXY] [/NOCANCEL]
114
+ [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/TIMEOUT INT_MS] [/SILENT] [/WEAKSECURITY]
115
+ [/CAPTION TEXT] [/POPUP | /BANNER TEXT] [/CANCELTEXT CANCEL_TEXT]
116
+ [/USERAGENT USER_AGENT_TEXT] [/TRANSLATE LANG_PARAMS] [/TOSTACK | /TOSTACKCONV]
117
+ URL1 local_file1 [URL2 local_file2 [...]] [/END]</i>
118
+ <p>Sets POST http mode and defines text string to be used in the POST (http only). Disables auto re-get. No char replaces used (%20 and others).
119
+ If /FILE presents in command line, TEXT2POST is filename to be sent in POST request. Also 'Filename:' header will be added to HTTP headers.
120
+
121
+ <h3>head</h3>
122
+
123
+ The same as get, but requests http headers only. Writes raw headers to file.
124
+
125
+ <h3>put</h3>
126
+
127
+ <i>inetc::put [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/NOPROXY]
128
+ [/NOCANCEL] [/TIMEOUT INT_MS] [/SILENT] [/WEAKSECURITY] [/CAPTION TEXT] [/POPUP | /BANNER TEXT]
129
+ [/CANCELTEXT CANCEL_TEXT] [/USERAGENT USER_AGENT_TEXT]
130
+ [/TRANSLATE LANG_PARAMS] URL1 local_file1 [URL2 local_file2 [...]] [/END]</i>
131
+ <p>Return value and parameters (if applicable) are the same as for previous entry point.
132
+
133
+ <h2>Examples </h2>
134
+ <pre> inetc::put "http://dl.zvuki.ru/6306/mp3/12.mp3" "$EXEDIR\12.mp3" \
135
+ "ftp://dl.zvuki.ru/6306/mp3/11.mp3" "$EXEDIR\11.mp3"
136
+ Pop $0
137
+ inetc::put /BANNER "Cameron Diaz upload in progress..." \
138
+ "http://www.dreamgirlswallpaper.co.uk/fiveyearsonline/wallpaper/Cameron_Diaz/camerond09big.JPG" \
139
+ "$EXEDIR\cd.jpg"
140
+ Pop $0
141
+ StrCmp $0 "OK" dlok
142
+ MessageBox MB_OK|MB_ICONEXCLAMATION "http upload Error, click OK to abort installation" /SD IDOK
143
+ Abort
144
+ dlok:
145
+ ...</pre>
146
+
147
+ <h2>Credits</h2>
148
+ <p>Many thanks to Backland who offered a simple way to fix NSISdl mode crashes, added 'center parent' function, offers few nice design ideas and spent a lot of time testing the plug-in.</p>
149
+ <br>
150
+ <p>v1.0.4.4 by Stuart 'Afrow UK' Welch</p>
151
+ <p>v1.0.5.0..v1.0.5.2 by anders_k</p>
152
+ <br>
153
+ <p>See Contrib\inetc\inetc.cpp for changes.</p>
build/WINDOWS/Plugins/inetc/Docs/Inetc/wiki.txt ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{PageAuthor|Takhir}}
2
+
3
+ == Links ==
4
+
5
+ Download:<br>
6
+ <attach>Inetc.zip</attach><br>
7
+
8
+ [http://forums.winamp.com/showthread.php?threadid=198596 Forum thread]
9
+
10
+ == Description ==
11
+
12
+ Internet client plug-in for files download and upload. Based on the InetLoad plug-in. Network implementation uses MS WinInet API, supports http/https and ftp protocols. Plugin has better proxy support compared to NSISdl plug-in. Command line may include few URL/File pairs to be transfered. If server or proxy login/password are not set in the script, it displays IE-style authentication dialog (except silent mode). Plug-in supports 3 "transfer in progress" display modes:
13
+
14
+ # old NSISdl style - additional embedded progress bar and text on the INSTFILES page;
15
+ # POPUP dialog mode with detailed info;
16
+ # BANNER mode with simple popup window.
17
+
18
+ Plug-in recognizes Installer's Silent mode and this case hides any output (this feature requires NSIS 2.03 or later). Program implements simple re-get functionality - host reconnect and download from current position after short pause. While program depends on IE settings, it changes current IE mode to online. NSISdl code fragment was used for progress bar displaying in the "old style" mode.
19
+ For ftp use "host/path" for file location relative to user's home dir and
20
+ "host//path" for absolute path.
21
+
22
+ == Commands ==
23
+
24
+ Plug-in DLL functions (entry points): get, post, head, put
25
+
26
+ === get ===
27
+
28
+ <highlight-nsis>inetc::get [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD]
29
+ [/NOPROXY] [/NOCANCEL] [/CONNECTTIMEOUT TO_SEC] [/RECEIVETIMEOUT TO_SEC] [/SILENT] [/WEAKSECURITY]
30
+ [/CAPTION TEXT] [/NOCOOKIES] [/RESUME RETRY_QUESTION] [/POPUP HOST_ALIAS | /BANNER TEXT]
31
+ [/CANCELTEXT CANCEL_TEXT] [/QUESTION CANCEL_QUESTION] [/USERAGENT USER_AGENT_TEXT]
32
+ [/HEADER HEADER_TEXT] [/TRANSLATE LANG_PARAMS] [/TOSTACK | /TOSTACKCONV]
33
+ URL1 local_file1 [URL2 local_file2 [...]] [/END]</highlight-nsis>
34
+ This call returns "OK" string if successful, error description string if failed (see included InetLoad.cpp file for a full set of status strings). Usage and result processing samples are included to the package.
35
+
36
+ ; /PROXY
37
+ : Overwrites current proxy settings, not required in most cases. IE settings will be used by default.
38
+
39
+ ; /USERNAME
40
+ : Proxy username (http only).
41
+
42
+ ; /PASSWORD
43
+ : Proxy password (http only). For server (http/ftp) authentication it is possible to use URL encoded name and password, for example <nowiki>http://username:[email protected]</nowiki>.
44
+
45
+ ; /NOPROXY
46
+ : Disables proxy settings for this connection (if any)
47
+
48
+ ; /NOCANCEL
49
+ : Prevents download from being interrupted by user (locks Esc, Alt-F4, Cancel handling)
50
+
51
+ ; /CONNECTTIMEOUT -
52
+ :Sets INTERNET_OPTION_CONNECT_TIMEOUT, seconds, default - IE current parameter value.
53
+
54
+ ; /RECEIVETIMEOUT -
55
+ :Sets INTERNET_OPTION_RECEIVE_TIMEOUT, seconds, default - IE current parameter value.
56
+
57
+ ; /SILENT
58
+ : Key hides plug-in' output (both popup dialog and embedded progress bar). Not required if 'SilentInstall silent' mode was defined in script (NSIS 2.03 or later).
59
+
60
+ ; /WEAKSECURITY
61
+ : Ignore unknown and revoked certificates
62
+
63
+ ; /RESUME
64
+ : On the permanent connection/transfer error instead of exit first displays message box with "resume download" question. Useful for dial-up connections and big files - allows user to restore connection and resume download. Default is "Your internet connection seems to have dropped out!\nPlease reconnect and click Retry to resume downloading...".
65
+
66
+ ; /CAPTION
67
+ : Defines caption text for /BANNER mode, caption prefix (left of '-') for /POPUP mode and caption for RESUME MessageBox. Default is "InetLoad plug-in" if not set or "".
68
+
69
+ ; /POPUP
70
+ : This mode displays detailed download dialog instead of embedded progress bar. Also useful in .onInit function (i.e. not in Section). If HOST_ALIAS is not "", text will replace URL in the dialog - this allows to hide real URL (including password).
71
+
72
+ ; /BANNER
73
+ : Displays simple popup dialog (MSI Banner mode) and sets dialog TEXT (up to 3 lines using $\n).
74
+
75
+ ; /CANCELTEXT
76
+ : Text for the Cancel button in the NSISdl mode. Default is NSIS dialog Cancel button text (current lang).
77
+
78
+ ; /QUESTION
79
+ : Text for the optional MessageBox if user tries to cancel download. If /QUESTION "" was used default "Are you sure that you want to stop download?" will be substituted.
80
+
81
+ ; /USERAGENT
82
+ : UserAgent http request header value. Default is "NSIS_Inetc (Mozilla)".
83
+
84
+ ; /HEADER
85
+ : Adds or replaces http request header. Common HEADER_TEXT format is "header: value".
86
+
87
+ ; /NOCOOKIES
88
+ : Removes cookies from http request
89
+
90
+ ; /TOSTACK
91
+ : Outputs the post/get/head response to the NSIS stack rather than to the file (specify an empty string for local_file1, local_file2 etc.)
92
+
93
+ ; /TOSTACKCONV
94
+ : Outputs the post/get/head response to the NSIS stack while converting character encodings:
95
+ : ASCII -> Unicode for the Unicode plug-in build
96
+ : Unicode -> ASCII for the ASCII plug-in build
97
+
98
+ ; /END
99
+ : Allows to limit plug-in stack reading (optional, required if you stores other vars in the stack).
100
+
101
+ ; /TRANSLATE
102
+ : Allows translating plug-in text in the POPUP or "old style" (NSISdl) modes (see Readme for parameters). In the BANNER mode text is also customizable.
103
+
104
+ === post ===
105
+
106
+ <highlight-nsis>inetc::post TEXT2POST [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD]
107
+ [/NOPROXY] [/NOCANCEL] [/CONNECTTIMEOUT TO_SEC] [/RECEIVETIMEOUT TO_SEC] [/SILENT] [/WEAKSECURITY]
108
+ [/FILE] [/CAPTION TEXT] [/NOCOOKIES] [/POPUP HOST_ALIAS | /BANNER TEXT]
109
+ [/CANCELTEXT CANCEL_TEXT] [/USERAGENT USER_AGENT_TEXT] [/TRANSLATE LANG_PARAMS]
110
+ [/TOSTACK | /TOSTACKCONV]
111
+ URL1 local_file1 [URL2 local_file2 [...]] [/END]</highlight-nsis>
112
+ Sets POST http mode and defines text string or file name to be used in the POST (http only). Disables auto re-get. No char replaces used (%20 and others). /FILE option allows to send TEXT2POST file content to server, additional 'Filename:' header added to request this case.
113
+
114
+ === head ===
115
+
116
+ The same as get, but requests http headers only. Writes raw headers to file.
117
+
118
+ === put ===
119
+
120
+ <highlight-nsis>inetc::put [/PROXY IP:PORT] [/USERNAME PROXY_LOGIN /PASSWORD PROXY_PASSWD] [/NOPROXY]
121
+ [/NOCANCEL] [/CONNECTTIMEOUT TO_SEC] [/RECEIVETIMEOUT TO_SEC] [/SILENT] [/WEAKSECURITY] [/CAPTION TEXT]
122
+ [/POPUP HOST_ALIAS | /BANNER TEXT] [/CANCELTEXT CANCEL_TEXT] [/USERAGENT USER_AGENT_TEXT]
123
+ [/TRANSLATE LANG_PARAMS] [/NOCOOKIES]
124
+ URL1 local_file1 [URL2 local_file2 [...]] [/END]</highlight-nsis>
125
+ Return value and parameters (if applicable) are the same as for previous entry point.
126
+
127
+ == Examples ==
128
+
129
+ <highlight-nsis>
130
+ inetc::put "http://dl.zvuki.ru/6306/mp3/12.mp3" "$EXEDIR\12.mp3" \
131
+ "ftp://dl.zvuki.ru/6306/mp3/11.mp3" "$EXEDIR\11.mp3"
132
+ Pop $0
133
+ </highlight-nsis>
134
+
135
+ <highlight-nsis>
136
+ inetc::put /BANNER "Cameron Diaz upload in progress..." \
137
+ "http://www.dreamgirlswallpaper.co.uk/fiveyearsonline/wallpaper/Cameron_Diaz/camerond09big.JPG" \
138
+ "$EXEDIR\cd.jpg"
139
+ Pop $0
140
+ StrCmp $0 "OK" dlok
141
+ MessageBox MB_OK|MB_ICONEXCLAMATION "http upload Error, click OK to abort installation" /SD IDOK
142
+ Abort
143
+ dlok:
144
+ ...
145
+ </highlight-nsis>
146
+
147
+ <highlight-nsis>
148
+ ; Following attribute also can restore installer Window
149
+ ; BGGradient 000000 000080 FFFFFF
150
+ </highlight-nsis>
151
+ == Credits ==
152
+
153
+ <p>Many thanks to Backland who offered a simple way to fix NSISdl mode crashes, added 'center parent' function, offers few nice design ideas and spent a lot of time testing the plug-in.</p>
154
+ <br>
155
+ <p>v1.0.4.4 by Stuart 'Afrow UK' Welch</p>
156
+ <p>v1.0.5.0..v1.0.5.2 by anders_k</p>
157
+ <br>
158
+ <p>See Contrib\inetc\inetc.cpp for changes.</p>
159
+
160
+
161
+ [[Category:Plugins]]
build/WINDOWS/Plugins/inetc/Examples/Inetc/Example.nsi ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc plug-in Test"
6
+ OutFile "inetc.exe"
7
+ ;SilentInstall silent
8
+ RequestExecutionLevel user
9
+
10
+
11
+ ;--------------------------------
12
+ ;Interface Settings
13
+
14
+ !include "MUI2.nsh"
15
+ !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
16
+ !insertmacro MUI_PAGE_WELCOME
17
+ !insertmacro MUI_PAGE_INSTFILES
18
+ !insertmacro MUI_LANGUAGE "English"
19
+
20
+ ;SetFont 14
21
+
22
+ ;--------------------------------
23
+ ;Installer Sections
24
+
25
+ Section "Dummy Section" SecDummy
26
+
27
+ SetDetailsView hide
28
+
29
+ ; two files download, popup mode
30
+ inetc::get /caption "2003-2004 reports" /popup "" "http://ineum.narod.ru/spr_2003.htm" "$EXEDIR\spr3.htm" "http://ineum.narod.ru/spr_2004.htm" "$EXEDIR\spr4.htm" /end
31
+ Pop $0 # return value = exit code, "OK" means OK
32
+
33
+ ; single file, NSISdl-style embedded progress bar with specific cancel button text
34
+ inetc::get /caption "2005 report" /canceltext "interrupt!" "http://ineum.narod.ru/spr_2005.htm" "$EXEDIR\spr5.htm" /end
35
+ Pop $1 # return value = exit code, "OK" means OK
36
+
37
+ ; banner with 2 text lines and disabled Cancel button
38
+ inetc::get /caption "2006 report" /banner "Banner mode with /nocancel option setten$\nSecond Line" /nocancel "http://ineum.narod.ru/spr_2006.htm" "$EXEDIR\spr6.htm" /end
39
+ Pop $2 # return value = exit code, "OK" means OK
40
+
41
+ MessageBox MB_OK "Download Status: $0, $1, $2"
42
+ SectionEnd
43
+
44
+
45
+ ;--------------------------------
46
+ ;Installer Functions
47
+
48
+ Function .onInit
49
+
50
+ ; plug-in auto-recognizes 'no parent dlg' in onInit and works accordingly
51
+ ; inetc::head /RESUME "Network error. Retry?" "http://ineum.narod.ru/spr_2003.htm" "$EXEDIR\spr3.txt"
52
+ ; Pop $4
53
+
54
+ FunctionEnd
build/WINDOWS/Plugins/inetc/Examples/Inetc/auth_dlg.nsi ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc http auth Test"
6
+ OutFile "auth_dlg.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
15
+ !insertmacro MUI_PAGE_INSTFILES
16
+ !insertmacro MUI_LANGUAGE "English"
17
+
18
+
19
+ ;--------------------------------
20
+ ;Installer Sections
21
+
22
+ Section "Dummy Section" SecDummy
23
+
24
+ ; Displays IE auth dialog.
25
+ ; Both server and proxy auth.
26
+ ; Please test this with your own link.
27
+
28
+ inetc::get "http://www.cnt.ru/personal" "$EXEDIR\auth.html"
29
+ Pop $0 # return value = exit code, "OK" if OK
30
+ MessageBox MB_OK "Download Status: $0"
31
+
32
+ SectionEnd
build/WINDOWS/Plugins/inetc/Examples/Inetc/ftp_auth.nsi ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc ftp authentication Test"
6
+ OutFile "ftp_auth.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
15
+ !insertmacro MUI_PAGE_INSTFILES
16
+ !insertmacro MUI_LANGUAGE "English"
17
+
18
+
19
+ ;--------------------------------
20
+ ;Installer Sections
21
+
22
+ Section "Dummy Section" SecDummy
23
+
24
+ ; use your own URL and login@pwd. Password hidden from user with /popup "ALIAS"
25
+
26
+ inetc::get /caption "service pack download" /popup "ftp://localhost/" "ftp://login:pwd@localhost/W2Ksp3.exe" "$EXEDIR\sp3.exe"
27
+ ; inetc::put /caption "service pack upload" /popup "" "ftp://login:pwd@localhost/W2Ksp3.bu.exe" "$EXEDIR\sp3.exe"
28
+ Pop $0 # return value = exit code, "OK" if OK
29
+ MessageBox MB_OK "Download Status: $0"
30
+
31
+ SectionEnd
32
+
build/WINDOWS/Plugins/inetc/Examples/Inetc/head.nsi ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc Head Test"
6
+ OutFile "head.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !insertmacro MUI_PAGE_INSTFILES
15
+ !insertmacro MUI_LANGUAGE "English"
16
+
17
+
18
+ ;--------------------------------
19
+ ;Installer Sections
20
+
21
+ Section "Dummy Section" SecDummy
22
+
23
+ DetailPrint "New version check out (internet connection)"
24
+ inetc::head /silent "http://ineum.narod.ru/spr_2006.htm" "$EXEDIR\head.txt"
25
+ Pop $0 # return value = exit code, "OK" if OK
26
+ MessageBox MB_OK "Download Status: $0"
27
+
28
+ SectionEnd
29
+
30
+
build/WINDOWS/Plugins/inetc/Examples/Inetc/headers.nsi ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Headers Test"
6
+ OutFile "headers.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !insertmacro MUI_PAGE_INSTFILES
15
+ !insertmacro MUI_LANGUAGE "English"
16
+
17
+
18
+
19
+ ;--------------------------------
20
+ ;Installer Sections
21
+
22
+ Section "Dummy Section" SecDummy
23
+
24
+ ; additional headers. Sample php returns raw headers
25
+ inetc::get /useragent "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)" /header "SOAPAction: urn:anonOutInOpe" "http://localhost/headers.php" "$EXEDIR\headers.html"
26
+ Pop $0
27
+
28
+ MessageBox MB_OK "Download Status: $0"
29
+
30
+ SectionEnd
31
+
32
+
build/WINDOWS/Plugins/inetc/Examples/Inetc/headers.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $headers = apache_request_headers();
3
+
4
+ foreach ($headers as $header => $value) {
5
+ echo "$header: $value <br />\n";
6
+ }
7
+ ?>
build/WINDOWS/Plugins/inetc/Examples/Inetc/https.nsi ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc https Test"
6
+ OutFile "https.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !insertmacro MUI_PAGE_INSTFILES
15
+ !insertmacro MUI_LANGUAGE "English"
16
+
17
+
18
+ ;--------------------------------
19
+ ;Installer Sections
20
+
21
+ Section "Dummy Section" SecDummy
22
+
23
+ inetc::get /POPUP "" /CAPTION "bending_property_demo.zip" "https://secure.codeproject.com/cs/miscctrl/bending_property/bending_property_src.zip" "$EXEDIR\bending_property_src.zip"
24
+ Pop $0 # return value = exit code, "OK" if OK
25
+ MessageBox MB_OK "Download Status: $0"
26
+
27
+ SectionEnd
build/WINDOWS/Plugins/inetc/Examples/Inetc/inetc_local.nsi ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc Local Test"
6
+ OutFile "inetc_local.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
15
+ !insertmacro MUI_PAGE_INSTFILES
16
+ !insertmacro MUI_LANGUAGE "English"
17
+
18
+
19
+ ;--------------------------------
20
+ ;Installer Sections
21
+
22
+ Section "Dummy Section" SecDummy
23
+
24
+
25
+ ; PUT test
26
+
27
+ ; FTP requires anonymous access in sample below.
28
+ ; HTTP sample put.php included to package. Stores test.jpg as m2.bmp
29
+ ; check server files present after upload
30
+
31
+ inetc::put "http://localhost/put.php" "$EXEDIR\test.jpg"
32
+ Pop $0
33
+
34
+ inetc::put "ftp://localhost/test.jpg" "$EXEDIR\test.jpg"
35
+ ; not anonymous format
36
+ ; inetc::put "ftp://login:password@localhost/test.jpg" "$EXEDIR\test.jpg"
37
+ Pop $1
38
+
39
+ DetailPrint "PUT: HTTP $0, FTP $1 (verify server files)"
40
+
41
+
42
+ ; POST test
43
+
44
+ ; HTTP sample post.php and post_form.htm (to compare results) included
45
+
46
+ inetc::post "login=ami&passwd=333" "http://localhost/post.php?lg=iam&pw=44" "$EXEDIR\post_reply.htm"
47
+ Pop $2
48
+
49
+ DetailPrint "POST: $2 (post_reply.htm)"
50
+
51
+
52
+ ; HEAD test
53
+
54
+ ; uses uploaded earlier test.jpg
55
+
56
+ inetc::head /silent "http://localhost/m2.bmp" "$EXEDIR\head.txt"
57
+ Pop $3
58
+
59
+ DetailPrint "HEAD: $3 (head.txt)"
60
+
61
+
62
+ ; GET test
63
+
64
+ ; 2 files download in nsisdl mode
65
+ inetc::get "http://localhost/m2.bmp" "$EXEDIR\get1.jpg" "http://localhost/m2.bmp" "$EXEDIR\get2.jpg"
66
+ Pop $4
67
+
68
+ inetc::get /popup "Localhost:GET with Popup" "http://localhost/m2.bmp" "$EXEDIR\get3.jpg"
69
+ Pop $5
70
+
71
+ inetc::get /banner "Local Test GET with Banner" "http://localhost/m2.bmp" "$EXEDIR\get4.jpg"
72
+ Pop $6
73
+
74
+ inetc::get /silent "ftp://localhost/test.jpg" "$EXEDIR\get5.jpg"
75
+ Pop $7
76
+
77
+ DetailPrint "GET: NSISDL $4, POPUP $5, BANNER $6, FTP $7 (get1-5.jpg)"
78
+
79
+ SetDetailsView show
80
+
81
+ SectionEnd
build/WINDOWS/Plugins/inetc/Examples/Inetc/post.nsi ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc Post Test"
6
+ OutFile "post.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !insertmacro MUI_PAGE_INSTFILES
15
+ !insertmacro MUI_LANGUAGE "English"
16
+
17
+
18
+ ;--------------------------------
19
+ ;Installer Sections
20
+
21
+ Section "Dummy Section" SecDummy
22
+
23
+ ; this is my LAN sample, use your own URL for tests. Sample post.php included
24
+
25
+ inetc::post "login=ami&passwd=333" "http://localhost/post.php?lg=iam&pw=44" "$EXEDIR\post_reply.htm"
26
+ Pop $0 # return value = exit code, "OK" if OK
27
+ MessageBox MB_OK "Download Status: $0"
28
+
29
+ SectionEnd
30
+
31
+
build/WINDOWS/Plugins/inetc/Examples/Inetc/post.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ </head>
4
+ <body>
5
+ <?php
6
+ echo "post.login=".$_POST['login']."<br>";
7
+ echo "post.passwd=".$_POST['passwd']."<br>";
8
+ echo "get.lg=".$_GET['lg']."<br>";
9
+ echo "get.pw=".$_GET['pw']."<br>";
10
+ ?>
11
+ </body>
12
+
13
+ </html>
build/WINDOWS/Plugins/inetc/Examples/Inetc/post_file.nsi ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc Post Test"
6
+ OutFile "post_file.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !insertmacro MUI_PAGE_INSTFILES
15
+ !insertmacro MUI_LANGUAGE "English"
16
+
17
+
18
+ ;--------------------------------
19
+ ;Installer Sections
20
+
21
+ Section "Dummy Section" SecDummy
22
+
23
+ ; this is my LAN sample, use your own URL for tests. Sample post.php included
24
+
25
+ inetc::post "$EXEDIR\inetc.cpp" /file "http://localhost/post_file.php" "$EXEDIR\post_file.htm"
26
+ Pop $0 # return value = exit code, "OK" if OK
27
+ MessageBox MB_OK "Download Status: $0"
28
+
29
+ SectionEnd
30
+
31
+
build/WINDOWS/Plugins/inetc/Examples/Inetc/post_file.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $headers = apache_request_headers();
3
+
4
+ foreach ($headers as $header => $value) {
5
+ echo "$header: $value <br />\n";
6
+ }
7
+ echo "new <br />";
8
+ foreach ($_FILES as $key => $value) echo $key . "<>" . $value . "<br/>\n";
9
+ echo file_get_contents('php://input');
10
+ ?>
build/WINDOWS/Plugins/inetc/Examples/Inetc/post_form.html ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <title>Registration form for post.php test</title>
4
+ </head>
5
+ <body>
6
+ This form sends POST request to server. It was interesting to compare server echo <br>
7
+ reply (by included post.php) for this form and InetLoad plug-in - in my <br>
8
+ tests server did not see any difference between them :)<br>
9
+ <form name="MainLogin" action="/post.php?lg=ami&pw=333" method="post">
10
+
11
+ <input type="text" name="login" value="" tabindex="1"><br>
12
+ <input type="password" name="passwd" value="" tabindex="2"><br>
13
+ <input type="submit" name="In" value="Enter" tabindex="3">
14
+
15
+ </form>
16
+
17
+ </body>
18
+ </html>
build/WINDOWS/Plugins/inetc/Examples/Inetc/put.nsi ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Inetc Test"
6
+ OutFile "put.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
15
+ !insertmacro MUI_PAGE_INSTFILES
16
+ !insertmacro MUI_LANGUAGE "English"
17
+
18
+
19
+ ;--------------------------------
20
+ ;Installer Sections
21
+
22
+ Section "Dummy Section" SecDummy
23
+
24
+ ; this is my LAN sample, use your own URL for tests. Login/pwd hidden from user. Sample put.php (for http request) included
25
+
26
+ inetc::put "http://localhost/put.php" "$EXEDIR\test.jpg"
27
+ ; inetc::put /POPUP "ftp://localhost/" /CAPTION "my local ftp upload" "ftp://localhost/test.jpg" "$EXEDIR\test.jpg"
28
+ Pop $0
29
+ MessageBox MB_OK "Upload Status: $0"
30
+
31
+ SectionEnd
build/WINDOWS/Plugins/inetc/Examples/Inetc/put.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ PUT data comes in on the stdin stream, which is php://input
4
+ for PHP compiled as a module, although most documentation claim
5
+ it's php://stdin
6
+ */
7
+ $putdata = fopen("php://input", "r");
8
+ $fp = fopen("m2.bmp", "w");
9
+ $i = 0;
10
+ while ($data = fread($putdata, 1024))
11
+ {
12
+ echo "data pass: " . $i++ . "\n";
13
+ fwrite($fp, $data);
14
+ }
15
+ fflush($fp);
16
+ fclose($fp);
17
+ fclose($putdata);
18
+ copy("m2.bmp", $request_uri);
19
+ ?>
build/WINDOWS/Plugins/inetc/Examples/Inetc/recursive.nsi ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Name "Inetc Recursive Dir Upload Test"
2
+ OutFile "recursive.exe"
3
+ RequestExecutionLevel user
4
+
5
+ !include "MUI2.nsh"
6
+ !insertmacro MUI_PAGE_INSTFILES
7
+ !insertmacro MUI_LANGUAGE "English"
8
+ !include "FileFunc.nsh"
9
+ !insertmacro GetFileAttributes
10
+
11
+ var url
12
+ var path
13
+
14
+ Function dirul
15
+
16
+ Push $0 ; search handle
17
+ Push $1 ; file name
18
+ Push $2 ; attributes
19
+
20
+ FindFirst $0 $1 "$path\*"
21
+ loop:
22
+ StrCmp $1 "" done
23
+ ${GetFileAttributes} "$path\$1" DIRECTORY $2
24
+ IntCmp $2 1 isdir
25
+ retry:
26
+ Inetc::put $url/$1 "$path\$1" /end
27
+ Pop $2
28
+ DetailPrint "$2 $path\$1"
29
+ StrCmp $2 "OK" cont
30
+ MessageBox MB_YESNO "$path\$1 file upload failed. Retry?" IDYES retry
31
+ Abort "terminated by user"
32
+ Goto cont
33
+ isdir:
34
+ StrCmp $1 . cont
35
+ StrCmp $1 .. cont
36
+ Push $path
37
+ Push $url
38
+ StrCpy $path "$path\$1"
39
+ StrCpy $url "$url/$1"
40
+ Call dirul
41
+ Pop $url
42
+ Pop $path
43
+ cont:
44
+ FindNext $0 $1
45
+ Goto loop
46
+ done:
47
+ FindClose $0
48
+
49
+ Pop $2
50
+ Pop $1
51
+ Pop $0
52
+
53
+ FunctionEnd
54
+
55
+
56
+ Section "Dummy Section" SecDummy
57
+
58
+ SetDetailsView hide
59
+ StrCpy $path "$EXEDIR"
60
+ ; put is dir in the user's ftp home, use //put for root-relative path
61
+ StrCpy $url ftp://takhir:pwd@localhost/put
62
+ Call dirul
63
+ SetDetailsView show
64
+
65
+ SectionEnd
build/WINDOWS/Plugins/inetc/Examples/Inetc/redirect.nsi ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ;--------------------------------
3
+ ; General Attributes
4
+
5
+ Name "Redirect Test"
6
+ OutFile "redirect.exe"
7
+ RequestExecutionLevel user
8
+
9
+
10
+ ;--------------------------------
11
+ ;Interface Settings
12
+
13
+ !include "MUI2.nsh"
14
+ !insertmacro MUI_PAGE_INSTFILES
15
+ !insertmacro MUI_LANGUAGE "English"
16
+
17
+
18
+ ;--------------------------------
19
+ ;Installer Sections
20
+
21
+ Section "Dummy Section" SecDummy
22
+
23
+ SetDetailsView hide
24
+
25
+ inetc::get "http://localhost/redirect.php" "$EXEDIR\redirect.htm" /end
26
+ Pop $1
27
+
28
+ MessageBox MB_OK "Download Status: $1"
29
+
30
+ SectionEnd
31
+