├── .gitattributes
├── .github
├── FUNDING.yml
└── workflows
│ └── build.yml
├── .gitignore
├── LICENSE
├── README.md
├── docs
├── _config.yml
└── index.md
├── sample
├── Web.config
├── crossdomain.lua
├── html.lua
└── redirect.lua
├── schema
└── iislua_schema.xml
├── setup
├── iislua-setup.sln
├── iislua-x64.vdproj
├── iislua-x86.vdproj
├── install.js
└── uninstall.js
└── src
├── iislua.sln
└── iislua
├── cluahttpmodule.cpp
├── cluahttpmodule.hpp
├── cluahttpmodulefactory.cpp
├── cluahttpmodulefactory.hpp
├── cluahttpstoredcontext.cpp
├── cluahttpstoredcontext.hpp
├── cluastatepool.cpp
├── cluastatepool.hpp
├── cmoduleconfiguration.cpp
├── cmoduleconfiguration.hpp
├── iislua.def
├── iislua.rc
├── iislua.vcxproj
├── iislua.vcxproj.filters
├── iislua_api.cpp
├── iislua_api.hpp
├── iislua_core.cpp
├── iislua_core.hpp
├── iislua_log.cpp
├── iislua_log.hpp
├── iislua_req.cpp
├── iislua_req.hpp
├── iislua_resp.cpp
├── iislua_resp.hpp
├── iislua_socket_tcp.cpp
├── iislua_socket_tcp.hpp
├── iislua_srv.cpp
├── iislua_srv.hpp
├── iislua_user.cpp
├── iislua_user.hpp
├── iislua_util.cpp
├── iislua_util.hpp
├── main.cpp
├── packages.config
├── resource.h
├── stdafx.cpp
├── stdafx.h
└── targetver.h
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: shibayan
4 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | env:
10 | NUGET_CLI_VERSION: 6.x
11 |
12 | jobs:
13 | build:
14 | runs-on: windows-latest
15 |
16 | strategy:
17 | matrix:
18 | platform: [x86, x64]
19 |
20 | steps:
21 | - uses: actions/checkout@v3
22 |
23 | - name: Use NuGet CLI ${{ env.NUGET_CLI_VERSION }}
24 | uses: nuget/setup-nuget@v1
25 | with:
26 | nuget-version: ${{ env.NUGET_CLI_VERSION }}
27 |
28 | - name: Use MSBuild
29 | uses: microsoft/setup-msbuild@v1.1
30 |
31 | - name: Restore NuGet packages
32 | run: nuget restore .\src\iislua.sln
33 |
34 | - name: Build application
35 | run: msbuild .\src\iislua.sln /p:Platform=${{ matrix.platform }} /p:Configuration=Release /verbosity:minimal
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | *.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.pfx
193 | *.publishsettings
194 | node_modules/
195 | orleans.codegen.cs
196 |
197 | # Since there are multiple workflows, uncomment next line to ignore bower_components
198 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
199 | #bower_components/
200 |
201 | # RIA/Silverlight projects
202 | Generated_Code/
203 |
204 | # Backup & report files from converting an old project file
205 | # to a newer Visual Studio version. Backup files are not needed,
206 | # because we have git ;-)
207 | _UpgradeReport_Files/
208 | Backup*/
209 | UpgradeLog*.XML
210 | UpgradeLog*.htm
211 |
212 | # SQL Server files
213 | *.mdf
214 | *.ldf
215 |
216 | # Business Intelligence projects
217 | *.rdl.data
218 | *.bim.layout
219 | *.bim_*.settings
220 |
221 | # Microsoft Fakes
222 | FakesAssemblies/
223 |
224 | # GhostDoc plugin setting file
225 | *.GhostDoc.xml
226 |
227 | # Node.js Tools for Visual Studio
228 | .ntvs_analysis.dat
229 |
230 | # Visual Studio 6 build log
231 | *.plg
232 |
233 | # Visual Studio 6 workspace options file
234 | *.opt
235 |
236 | # Visual Studio LightSwitch build output
237 | **/*.HTMLClient/GeneratedArtifacts
238 | **/*.DesktopClient/GeneratedArtifacts
239 | **/*.DesktopClient/ModelManifest.xml
240 | **/*.Server/GeneratedArtifacts
241 | **/*.Server/ModelManifest.xml
242 | _Pvt_Extensions
243 |
244 | # Paket dependency manager
245 | .paket/paket.exe
246 | paket-files/
247 |
248 | # FAKE - F# Make
249 | .fake/
250 |
251 | # JetBrains Rider
252 | .idea/
253 | *.sln.iml
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2015 Tatsuro Shibamura
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | iislua
2 | ================
3 |
4 | 
5 | [](https://github.com/shibayan/iislua/releases/latest)
6 | [](https://github.com/shibayan/iislua/releases/latest)
7 | [](https://github.com/shibayan/iislua/blob/master/LICENSE)
8 |
9 | It brings the power of Lua scripting in your IIS.
10 |
11 | ## Install
12 |
13 | Download MSI file from following page. (x64 version)
14 |
15 | https://github.com/shibayan/iislua/releases
16 |
17 | ## Configuration
18 |
19 | ### Web.config
20 |
21 | ```xml
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | ```
32 |
33 | ## Usage
34 |
35 | ### Return status code
36 |
37 | ```lua
38 | iis.exit(404)
39 | ```
40 |
41 | ### Redirect
42 |
43 | ```lua
44 | iis.redirect("http://buchizo.wordpress.com/")
45 | ```
46 |
47 | ### Refuse http method
48 |
49 | ```lua
50 | if iis.req.http_method() ~= "POST" then
51 | iis.exit(405)
52 | end
53 | ```
54 |
55 | ### Cross domain access control
56 |
57 | ```lua
58 | req_headers = iis.req.get_headers()
59 |
60 | if req_headers["Origin"] ~= nil then
61 | iis.resp.set_header("Access-Control-Allow-Origin", req_headers["Origin"])
62 | end
63 | ```
64 |
65 | ### Rewrite to other url
66 |
67 | ```lua
68 | if iis.req.get_url() == "/" then
69 | iis.exec("/iisstart.htm")
70 | end
71 | ```
72 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | iislua
2 | ================
3 |
4 | 
5 | [](https://github.com/shibayan/iislua/releases/latest)
6 | [](https://github.com/shibayan/iislua/releases/latest)
7 | [](https://github.com/shibayan/iislua/blob/master/LICENSE)
8 |
9 | It brings the power of Lua scripting in your IIS.
10 |
11 | ## Install
12 |
13 | Download MSI file from following page. (x64 version)
14 |
15 | https://github.com/shibayan/iislua/releases
16 |
17 | ## Configuration
18 |
19 | ### Web.config
20 |
21 | ```xml
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | ```
32 |
33 | ## Usage
34 |
35 | ### Return status code
36 |
37 | ```lua
38 | iis.exit(404)
39 | ```
40 |
41 | ### Redirect
42 |
43 | ```lua
44 | iis.redirect("http://buchizo.wordpress.com/")
45 | ```
46 |
47 | ### Refuse http method
48 |
49 | ```lua
50 | if iis.req.http_method() ~= "POST" then
51 | iis.exit(405)
52 | end
53 | ```
54 |
55 | ### Cross domain access control
56 |
57 | ```lua
58 | req_headers = iis.req.get_headers()
59 |
60 | if req_headers["Origin"] ~= nil then
61 | iis.resp.set_header("Access-Control-Allow-Origin", req_headers["Origin"])
62 | end
63 | ```
64 |
65 | ### Rewrite to other url
66 |
67 | ```lua
68 | if iis.req.get_url() == "/" then
69 | iis.exec("/iisstart.htm")
70 | end
71 | ```
72 |
--------------------------------------------------------------------------------
/sample/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sample/crossdomain.lua:
--------------------------------------------------------------------------------
1 | req_headers = iis.req.get_headers()
2 |
3 | if req_headers["Origin"] ~= nil then
4 | iis.resp.set_header("Access-Control-Allow-Origin", req_headers["Origin"])
5 | end
--------------------------------------------------------------------------------
/sample/html.lua:
--------------------------------------------------------------------------------
1 | iis.resp.set_header("Content-Type", "text/html")
2 | iis.print("
Hello, World ")
--------------------------------------------------------------------------------
/sample/redirect.lua:
--------------------------------------------------------------------------------
1 | if math.random() > 0.5 then
2 | iis.redirect("http://buchizo.wordpress.com/")
3 | else
4 | iis.redirect("http://blog.engineer-memo.com/")
5 | end
--------------------------------------------------------------------------------
/schema/iislua_schema.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/setup/iislua-setup.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "iislua-x64", "iislua-x64.vdproj", "{C4A23D1E-0F53-41B7-A159-3B7E003DCA82}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iislua", "..\src\iislua.vcxproj", "{28A38A86-5E73-4252-9CE0-EFD34490E8B4}"
9 | EndProject
10 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "iislua-x86", "iislua-x86.vdproj", "{8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Win32 = Debug|Win32
15 | Debug|x64 = Debug|x64
16 | Release|Win32 = Release|Win32
17 | Release|x64 = Release|x64
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Debug|Win32.ActiveCfg = Debug
21 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Debug|Win32.Build.0 = Debug
22 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Debug|x64.ActiveCfg = Debug
23 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Debug|x64.Build.0 = Debug
24 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Release|Win32.ActiveCfg = Release
25 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Release|Win32.Build.0 = Release
26 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Release|x64.ActiveCfg = Release
27 | {C4A23D1E-0F53-41B7-A159-3B7E003DCA82}.Release|x64.Build.0 = Release
28 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Debug|Win32.ActiveCfg = Debug|Win32
29 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Debug|Win32.Build.0 = Debug|Win32
30 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Debug|x64.ActiveCfg = Debug|x64
31 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Debug|x64.Build.0 = Debug|x64
32 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Release|Win32.ActiveCfg = Release|Win32
33 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Release|Win32.Build.0 = Release|Win32
34 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Release|x64.ActiveCfg = Release|x64
35 | {28A38A86-5E73-4252-9CE0-EFD34490E8B4}.Release|x64.Build.0 = Release|x64
36 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Debug|Win32.ActiveCfg = Debug
37 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Debug|Win32.Build.0 = Debug
38 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Debug|x64.ActiveCfg = Debug
39 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Debug|x64.Build.0 = Debug
40 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Release|Win32.ActiveCfg = Release
41 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Release|Win32.Build.0 = Release
42 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Release|x64.ActiveCfg = Release
43 | {8828F9C7-974F-456F-AB0F-7E4B6A0B2E65}.Release|x64.Build.0 = Release
44 | EndGlobalSection
45 | GlobalSection(SolutionProperties) = preSolution
46 | HideSolutionNode = FALSE
47 | EndGlobalSection
48 | EndGlobal
49 |
--------------------------------------------------------------------------------
/setup/iislua-x64.vdproj:
--------------------------------------------------------------------------------
1 | "DeployProject"
2 | {
3 | "VSVersion" = "3:800"
4 | "ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}"
5 | "IsWebType" = "8:FALSE"
6 | "ProjectName" = "8:iislua-x64"
7 | "LanguageId" = "3:1033"
8 | "CodePage" = "3:1252"
9 | "UILanguageId" = "3:1033"
10 | "SccProjectName" = "8:"
11 | "SccLocalPath" = "8:"
12 | "SccAuxPath" = "8:"
13 | "SccProvider" = "8:"
14 | "Hierarchy"
15 | {
16 | "Entry"
17 | {
18 | "MsmKey" = "8:_13A6CC5387234F6F8687D0C7E1B1EDFC"
19 | "OwnerKey" = "8:_UNDEFINED"
20 | "MsmSig" = "8:_UNDEFINED"
21 | }
22 | "Entry"
23 | {
24 | "MsmKey" = "8:_6B4F75EE5D154549864BE1C3862FF05F"
25 | "OwnerKey" = "8:_UNDEFINED"
26 | "MsmSig" = "8:_UNDEFINED"
27 | }
28 | "Entry"
29 | {
30 | "MsmKey" = "8:_C7E1091D96E7479594EDEEB434819BE6"
31 | "OwnerKey" = "8:_UNDEFINED"
32 | "MsmSig" = "8:_UNDEFINED"
33 | }
34 | }
35 | "Configurations"
36 | {
37 | "Debug"
38 | {
39 | "DisplayName" = "8:Debug"
40 | "IsDebugOnly" = "11:TRUE"
41 | "IsReleaseOnly" = "11:FALSE"
42 | "OutputFilename" = "8:Debug\\x64\\iislua_debug_x64.msi"
43 | "PackageFilesAs" = "3:2"
44 | "PackageFileSize" = "3:-2147483648"
45 | "CabType" = "3:1"
46 | "Compression" = "3:2"
47 | "SignOutput" = "11:FALSE"
48 | "CertificateFile" = "8:"
49 | "PrivateKeyFile" = "8:"
50 | "TimeStampServer" = "8:"
51 | "InstallerBootstrapper" = "3:2"
52 | "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
53 | {
54 | "Enabled" = "11:TRUE"
55 | "PromptEnabled" = "11:TRUE"
56 | "PrerequisitesLocation" = "2:1"
57 | "Url" = "8:"
58 | "ComponentsUrl" = "8:"
59 | "Items"
60 | {
61 | "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.5"
62 | {
63 | "Name" = "8:Microsoft .NET Framework 4.5 (x86 and x64)"
64 | "ProductCode" = "8:.NETFramework,Version=v4.5"
65 | }
66 | }
67 | }
68 | }
69 | "Release"
70 | {
71 | "DisplayName" = "8:Release"
72 | "IsDebugOnly" = "11:FALSE"
73 | "IsReleaseOnly" = "11:TRUE"
74 | "OutputFilename" = "8:Release\\x64\\iislua_x64.msi"
75 | "PackageFilesAs" = "3:2"
76 | "PackageFileSize" = "3:-2147483648"
77 | "CabType" = "3:1"
78 | "Compression" = "3:2"
79 | "SignOutput" = "11:FALSE"
80 | "CertificateFile" = "8:"
81 | "PrivateKeyFile" = "8:"
82 | "TimeStampServer" = "8:"
83 | "InstallerBootstrapper" = "3:2"
84 | "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
85 | {
86 | "Enabled" = "11:TRUE"
87 | "PromptEnabled" = "11:TRUE"
88 | "PrerequisitesLocation" = "2:1"
89 | "Url" = "8:"
90 | "ComponentsUrl" = "8:"
91 | "Items"
92 | {
93 | "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.5"
94 | {
95 | "Name" = "8:Microsoft .NET Framework 4.5 (x86 and x64)"
96 | "ProductCode" = "8:.NETFramework,Version=v4.5"
97 | }
98 | }
99 | }
100 | }
101 | }
102 | "Deployable"
103 | {
104 | "CustomAction"
105 | {
106 | "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_194218D6F8E14BA29C6AA23917C73299"
107 | {
108 | "Name" = "8:install.js"
109 | "Condition" = "8:"
110 | "Object" = "8:_C7E1091D96E7479594EDEEB434819BE6"
111 | "FileType" = "3:3"
112 | "InstallAction" = "3:2"
113 | "Arguments" = "8:"
114 | "EntryPoint" = "8:"
115 | "Sequence" = "3:1"
116 | "Identifier" = "8:_27505BB9_C3B0_4BA0_B384_A3323302C667"
117 | "InstallerClass" = "11:FALSE"
118 | "CustomActionData" = "8:"
119 | }
120 | "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_3DAF07B2E7F6400D98AD825F64A97B70"
121 | {
122 | "Name" = "8:uninstall.js"
123 | "Condition" = "8:"
124 | "Object" = "8:_6B4F75EE5D154549864BE1C3862FF05F"
125 | "FileType" = "3:3"
126 | "InstallAction" = "3:4"
127 | "Arguments" = "8:"
128 | "EntryPoint" = "8:"
129 | "Sequence" = "3:1"
130 | "Identifier" = "8:_B5D8C64C_EB0E_41B0_BCAF_56EF4811156A"
131 | "InstallerClass" = "11:FALSE"
132 | "CustomActionData" = "8:"
133 | }
134 | "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_D0FF6B0A720E4E5F81B8D92928137471"
135 | {
136 | "Name" = "8:uninstall.js"
137 | "Condition" = "8:"
138 | "Object" = "8:_6B4F75EE5D154549864BE1C3862FF05F"
139 | "FileType" = "3:3"
140 | "InstallAction" = "3:3"
141 | "Arguments" = "8:"
142 | "EntryPoint" = "8:"
143 | "Sequence" = "3:1"
144 | "Identifier" = "8:_699299F0_25AD_4E4D_BDF0_A196BB4D3D63"
145 | "InstallerClass" = "11:FALSE"
146 | "CustomActionData" = "8:"
147 | }
148 | }
149 | "DefaultFeature"
150 | {
151 | "Name" = "8:DefaultFeature"
152 | "Title" = "8:"
153 | "Description" = "8:"
154 | }
155 | "ExternalPersistence"
156 | {
157 | "LaunchCondition"
158 | {
159 | }
160 | }
161 | "File"
162 | {
163 | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_13A6CC5387234F6F8687D0C7E1B1EDFC"
164 | {
165 | "SourcePath" = "8:..\\schema\\iislua_schema.xml"
166 | "TargetName" = "8:iislua_schema.xml"
167 | "Tag" = "8:"
168 | "Folder" = "8:_00A00073EFEE4F0E8736A97EFFA6780F"
169 | "Condition" = "8:"
170 | "Transitive" = "11:FALSE"
171 | "Vital" = "11:TRUE"
172 | "ReadOnly" = "11:FALSE"
173 | "Hidden" = "11:FALSE"
174 | "System" = "11:FALSE"
175 | "Permanent" = "11:FALSE"
176 | "SharedLegacy" = "11:FALSE"
177 | "PackageAs" = "3:1"
178 | "Register" = "3:1"
179 | "Exclude" = "11:FALSE"
180 | "IsDependency" = "11:FALSE"
181 | "IsolateTo" = "8:"
182 | }
183 | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6B4F75EE5D154549864BE1C3862FF05F"
184 | {
185 | "SourcePath" = "8:uninstall.js"
186 | "TargetName" = "8:uninstall.js"
187 | "Tag" = "8:"
188 | "Folder" = "8:_068BCEF92D56425B8464D2F051F74660"
189 | "Condition" = "8:"
190 | "Transitive" = "11:FALSE"
191 | "Vital" = "11:TRUE"
192 | "ReadOnly" = "11:FALSE"
193 | "Hidden" = "11:FALSE"
194 | "System" = "11:FALSE"
195 | "Permanent" = "11:FALSE"
196 | "SharedLegacy" = "11:FALSE"
197 | "PackageAs" = "3:1"
198 | "Register" = "3:1"
199 | "Exclude" = "11:TRUE"
200 | "IsDependency" = "11:FALSE"
201 | "IsolateTo" = "8:"
202 | }
203 | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C7E1091D96E7479594EDEEB434819BE6"
204 | {
205 | "SourcePath" = "8:install.js"
206 | "TargetName" = "8:install.js"
207 | "Tag" = "8:"
208 | "Folder" = "8:_068BCEF92D56425B8464D2F051F74660"
209 | "Condition" = "8:"
210 | "Transitive" = "11:FALSE"
211 | "Vital" = "11:TRUE"
212 | "ReadOnly" = "11:FALSE"
213 | "Hidden" = "11:FALSE"
214 | "System" = "11:FALSE"
215 | "Permanent" = "11:FALSE"
216 | "SharedLegacy" = "11:FALSE"
217 | "PackageAs" = "3:1"
218 | "Register" = "3:1"
219 | "Exclude" = "11:TRUE"
220 | "IsDependency" = "11:FALSE"
221 | "IsolateTo" = "8:"
222 | }
223 | }
224 | "FileType"
225 | {
226 | }
227 | "Folder"
228 | {
229 | "{3C67513D-01DD-4637-8A68-80971EB9504F}:_068BCEF92D56425B8464D2F051F74660"
230 | {
231 | "DefaultLocation" = "8:[ProgramFiles64Folder][ProductName]"
232 | "Name" = "8:#1925"
233 | "AlwaysCreate" = "11:FALSE"
234 | "Condition" = "8:"
235 | "Transitive" = "11:FALSE"
236 | "Property" = "8:TARGETDIR"
237 | "Folders"
238 | {
239 | }
240 | }
241 | "{1525181F-901A-416C-8A58-119130FE478E}:_18D08878B1D640848F48A83FF910703E"
242 | {
243 | "Name" = "8:#1936"
244 | "AlwaysCreate" = "11:FALSE"
245 | "Condition" = "8:"
246 | "Transitive" = "11:FALSE"
247 | "Property" = "8:System64Folder"
248 | "Folders"
249 | {
250 | "{9EF0B969-E518-4E46-987F-47570745A589}:_7D084727D5644575B5A63F86D8045F0A"
251 | {
252 | "Name" = "8:inetsrv"
253 | "AlwaysCreate" = "11:FALSE"
254 | "Condition" = "8:"
255 | "Transitive" = "11:FALSE"
256 | "Property" = "8:_9FF7F098659C46D88FDBB0F632CD3652"
257 | "Folders"
258 | {
259 | "{9EF0B969-E518-4E46-987F-47570745A589}:_1E49F051568F491E9BF9D08FF6DEE37F"
260 | {
261 | "Name" = "8:config"
262 | "AlwaysCreate" = "11:FALSE"
263 | "Condition" = "8:"
264 | "Transitive" = "11:FALSE"
265 | "Property" = "8:_2D9F1D48B4C64DC28A4EA42AAE9864AB"
266 | "Folders"
267 | {
268 | "{9EF0B969-E518-4E46-987F-47570745A589}:_00A00073EFEE4F0E8736A97EFFA6780F"
269 | {
270 | "Name" = "8:schema"
271 | "AlwaysCreate" = "11:FALSE"
272 | "Condition" = "8:"
273 | "Transitive" = "11:FALSE"
274 | "Property" = "8:_2FFF9919F90B4D51B9A1FBD2665A462F"
275 | "Folders"
276 | {
277 | }
278 | }
279 | }
280 | }
281 | }
282 | }
283 | }
284 | }
285 | }
286 | "LaunchCondition"
287 | {
288 | "{836E08B8-0285-4809-BA42-01DB6754A45D}:_957B6084C34F4D89A0910B97279296D3"
289 | {
290 | "Name" = "8:Exist IIS"
291 | "Condition" = "8:IISMAJORVERSION >= \"#7\" OR IISMAJORVERSION = \"#10\""
292 | "Message" = "8:iislua required for iis 7.x to up"
293 | "InstallUrl" = "8:"
294 | }
295 | }
296 | "Locator"
297 | {
298 | "{CF66B7F7-B7DA-4B08-A67A-233430638C9C}:_E57C197BF4D848398468F3A1D1ED0E6F"
299 | {
300 | "Name" = "8:Search IIS"
301 | "Root" = "2:1"
302 | "RegKey" = "8:SOFTWARE\\Microsoft\\InetStp"
303 | "Value" = "8:MajorVersion"
304 | "Property" = "8:IISMAJORVERSION"
305 | }
306 | }
307 | "MsiBootstrapper"
308 | {
309 | "LangId" = "3:1033"
310 | "RequiresElevation" = "11:FALSE"
311 | }
312 | "Product"
313 | {
314 | "Name" = "8:Microsoft Visual Studio"
315 | "ProductName" = "8:iislua"
316 | "ProductCode" = "8:{3F531427-F184-456F-B463-EB74EEAAF794}"
317 | "PackageCode" = "8:{87F5DA38-8D2F-47EE-896B-346C2920AE5A}"
318 | "UpgradeCode" = "8:{1A16A4EB-F3C5-4C41-B2E0-21727DF396C9}"
319 | "AspNetVersion" = "8:4.0.30319.0"
320 | "RestartWWWService" = "11:FALSE"
321 | "RemovePreviousVersions" = "11:TRUE"
322 | "DetectNewerInstalledVersion" = "11:TRUE"
323 | "InstallAllUsers" = "11:TRUE"
324 | "ProductVersion" = "8:0.6.1"
325 | "Manufacturer" = "8:shibayan"
326 | "ARPHELPTELEPHONE" = "8:"
327 | "ARPHELPLINK" = "8:"
328 | "Title" = "8:iislua"
329 | "Subject" = "8:"
330 | "ARPCONTACT" = "8:shibayan"
331 | "Keywords" = "8:"
332 | "ARPCOMMENTS" = "8:"
333 | "ARPURLINFOABOUT" = "8:"
334 | "ARPPRODUCTICON" = "8:"
335 | "ARPIconIndex" = "3:0"
336 | "SearchPath" = "8:"
337 | "UseSystemSearchPath" = "11:TRUE"
338 | "TargetPlatform" = "3:1"
339 | "PreBuildEvent" = "8:"
340 | "PostBuildEvent" = "8:"
341 | "RunPostBuildEvent" = "3:0"
342 | }
343 | "Registry"
344 | {
345 | "HKLM"
346 | {
347 | "Keys"
348 | {
349 | }
350 | }
351 | "HKCU"
352 | {
353 | "Keys"
354 | {
355 | }
356 | }
357 | "HKCR"
358 | {
359 | "Keys"
360 | {
361 | }
362 | }
363 | "HKU"
364 | {
365 | "Keys"
366 | {
367 | }
368 | }
369 | "HKPU"
370 | {
371 | "Keys"
372 | {
373 | }
374 | }
375 | }
376 | "Sequences"
377 | {
378 | }
379 | "Shortcut"
380 | {
381 | }
382 | "UserInterface"
383 | {
384 | "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_13E58DF272CD48948EEC60B6889F6939"
385 | {
386 | "UseDynamicProperties" = "11:FALSE"
387 | "IsDependency" = "11:FALSE"
388 | "SourcePath" = "8:\\VsdUserInterface.wim"
389 | }
390 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_7C1A1E9D00FF4ED986576980B48E7BE2"
391 | {
392 | "Name" = "8:#1900"
393 | "Sequence" = "3:1"
394 | "Attributes" = "3:1"
395 | "Dialogs"
396 | {
397 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_14222D35D689454292C9B0EC095ED24F"
398 | {
399 | "Sequence" = "3:100"
400 | "DisplayName" = "8:ようこそ"
401 | "UseDynamicProperties" = "11:TRUE"
402 | "IsDependency" = "11:FALSE"
403 | "SourcePath" = "8:\\VsdWelcomeDlg.wid"
404 | "Properties"
405 | {
406 | "BannerBitmap"
407 | {
408 | "Name" = "8:BannerBitmap"
409 | "DisplayName" = "8:#1001"
410 | "Description" = "8:#1101"
411 | "Type" = "3:8"
412 | "ContextData" = "8:Bitmap"
413 | "Attributes" = "3:4"
414 | "Setting" = "3:1"
415 | "UsePlugInResources" = "11:TRUE"
416 | }
417 | "CopyrightWarning"
418 | {
419 | "Name" = "8:CopyrightWarning"
420 | "DisplayName" = "8:#1002"
421 | "Description" = "8:#1102"
422 | "Type" = "3:3"
423 | "ContextData" = "8:"
424 | "Attributes" = "3:0"
425 | "Setting" = "3:1"
426 | "Value" = "8:#1202"
427 | "DefaultValue" = "8:#1202"
428 | "UsePlugInResources" = "11:TRUE"
429 | }
430 | "Welcome"
431 | {
432 | "Name" = "8:Welcome"
433 | "DisplayName" = "8:#1003"
434 | "Description" = "8:#1103"
435 | "Type" = "3:3"
436 | "ContextData" = "8:"
437 | "Attributes" = "3:0"
438 | "Setting" = "3:2"
439 | "Value" = "8:The installer will guide you through the steps required to install [ProductName] on your computer."
440 | "DefaultValue" = "8:#1203"
441 | "UsePlugInResources" = "11:TRUE"
442 | }
443 | }
444 | }
445 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A5C48B31707F4D27BF7823B3D448A3FF"
446 | {
447 | "Sequence" = "3:300"
448 | "DisplayName" = "8:インストールの確認"
449 | "UseDynamicProperties" = "11:TRUE"
450 | "IsDependency" = "11:FALSE"
451 | "SourcePath" = "8:\\VsdConfirmDlg.wid"
452 | "Properties"
453 | {
454 | "BannerBitmap"
455 | {
456 | "Name" = "8:BannerBitmap"
457 | "DisplayName" = "8:#1001"
458 | "Description" = "8:#1101"
459 | "Type" = "3:8"
460 | "ContextData" = "8:Bitmap"
461 | "Attributes" = "3:4"
462 | "Setting" = "3:1"
463 | "UsePlugInResources" = "11:TRUE"
464 | }
465 | }
466 | }
467 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_FBCA1CE9EED4477AA91A6EF32F11904D"
468 | {
469 | "Sequence" = "3:200"
470 | "DisplayName" = "8:インストール フォルダー"
471 | "UseDynamicProperties" = "11:TRUE"
472 | "IsDependency" = "11:FALSE"
473 | "SourcePath" = "8:\\VsdFolderDlg.wid"
474 | "Properties"
475 | {
476 | "BannerBitmap"
477 | {
478 | "Name" = "8:BannerBitmap"
479 | "DisplayName" = "8:#1001"
480 | "Description" = "8:#1101"
481 | "Type" = "3:8"
482 | "ContextData" = "8:Bitmap"
483 | "Attributes" = "3:4"
484 | "Setting" = "3:1"
485 | "UsePlugInResources" = "11:TRUE"
486 | }
487 | "InstallAllUsersVisible"
488 | {
489 | "Name" = "8:InstallAllUsersVisible"
490 | "DisplayName" = "8:#1059"
491 | "Description" = "8:#1159"
492 | "Type" = "3:5"
493 | "ContextData" = "8:1;True=1;False=0"
494 | "Attributes" = "3:0"
495 | "Setting" = "3:0"
496 | "Value" = "3:1"
497 | "DefaultValue" = "3:1"
498 | "UsePlugInResources" = "11:TRUE"
499 | }
500 | }
501 | }
502 | }
503 | }
504 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_82467D5717EB44508F79B762DAEBC0D3"
505 | {
506 | "Name" = "8:#1900"
507 | "Sequence" = "3:2"
508 | "Attributes" = "3:1"
509 | "Dialogs"
510 | {
511 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_3921007F0A32454B88CBB5E3764F2379"
512 | {
513 | "Sequence" = "3:200"
514 | "DisplayName" = "8:インストール フォルダー"
515 | "UseDynamicProperties" = "11:TRUE"
516 | "IsDependency" = "11:FALSE"
517 | "SourcePath" = "8:\\VsdAdminFolderDlg.wid"
518 | "Properties"
519 | {
520 | "BannerBitmap"
521 | {
522 | "Name" = "8:BannerBitmap"
523 | "DisplayName" = "8:#1001"
524 | "Description" = "8:#1101"
525 | "Type" = "3:8"
526 | "ContextData" = "8:Bitmap"
527 | "Attributes" = "3:4"
528 | "Setting" = "3:1"
529 | "UsePlugInResources" = "11:TRUE"
530 | }
531 | }
532 | }
533 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_C310FCBFD3604FCBA18E5AA975D7D5E1"
534 | {
535 | "Sequence" = "3:100"
536 | "DisplayName" = "8:ようこそ"
537 | "UseDynamicProperties" = "11:TRUE"
538 | "IsDependency" = "11:FALSE"
539 | "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid"
540 | "Properties"
541 | {
542 | "BannerBitmap"
543 | {
544 | "Name" = "8:BannerBitmap"
545 | "DisplayName" = "8:#1001"
546 | "Description" = "8:#1101"
547 | "Type" = "3:8"
548 | "ContextData" = "8:Bitmap"
549 | "Attributes" = "3:4"
550 | "Setting" = "3:1"
551 | "UsePlugInResources" = "11:TRUE"
552 | }
553 | "CopyrightWarning"
554 | {
555 | "Name" = "8:CopyrightWarning"
556 | "DisplayName" = "8:#1002"
557 | "Description" = "8:#1102"
558 | "Type" = "3:3"
559 | "ContextData" = "8:"
560 | "Attributes" = "3:0"
561 | "Setting" = "3:1"
562 | "Value" = "8:#1202"
563 | "DefaultValue" = "8:#1202"
564 | "UsePlugInResources" = "11:TRUE"
565 | }
566 | "Welcome"
567 | {
568 | "Name" = "8:Welcome"
569 | "DisplayName" = "8:#1003"
570 | "Description" = "8:#1103"
571 | "Type" = "3:3"
572 | "ContextData" = "8:"
573 | "Attributes" = "3:0"
574 | "Setting" = "3:1"
575 | "Value" = "8:#1203"
576 | "DefaultValue" = "8:#1203"
577 | "UsePlugInResources" = "11:TRUE"
578 | }
579 | }
580 | }
581 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F4A8F4C15C534356A81FC9284B22C29C"
582 | {
583 | "Sequence" = "3:300"
584 | "DisplayName" = "8:インストールの確認"
585 | "UseDynamicProperties" = "11:TRUE"
586 | "IsDependency" = "11:FALSE"
587 | "SourcePath" = "8:\\VsdAdminConfirmDlg.wid"
588 | "Properties"
589 | {
590 | "BannerBitmap"
591 | {
592 | "Name" = "8:BannerBitmap"
593 | "DisplayName" = "8:#1001"
594 | "Description" = "8:#1101"
595 | "Type" = "3:8"
596 | "ContextData" = "8:Bitmap"
597 | "Attributes" = "3:4"
598 | "Setting" = "3:1"
599 | "UsePlugInResources" = "11:TRUE"
600 | }
601 | }
602 | }
603 | }
604 | }
605 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_94CA27F17DBA478D893CC4EB08321333"
606 | {
607 | "Name" = "8:#1901"
608 | "Sequence" = "3:1"
609 | "Attributes" = "3:2"
610 | "Dialogs"
611 | {
612 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_AA7F056F387B4932A39195472C2601A5"
613 | {
614 | "Sequence" = "3:100"
615 | "DisplayName" = "8:進行状況"
616 | "UseDynamicProperties" = "11:TRUE"
617 | "IsDependency" = "11:FALSE"
618 | "SourcePath" = "8:\\VsdProgressDlg.wid"
619 | "Properties"
620 | {
621 | "BannerBitmap"
622 | {
623 | "Name" = "8:BannerBitmap"
624 | "DisplayName" = "8:#1001"
625 | "Description" = "8:#1101"
626 | "Type" = "3:8"
627 | "ContextData" = "8:Bitmap"
628 | "Attributes" = "3:4"
629 | "Setting" = "3:1"
630 | "UsePlugInResources" = "11:TRUE"
631 | }
632 | "ShowProgress"
633 | {
634 | "Name" = "8:ShowProgress"
635 | "DisplayName" = "8:#1009"
636 | "Description" = "8:#1109"
637 | "Type" = "3:5"
638 | "ContextData" = "8:1;True=1;False=0"
639 | "Attributes" = "3:0"
640 | "Setting" = "3:0"
641 | "Value" = "3:1"
642 | "DefaultValue" = "3:1"
643 | "UsePlugInResources" = "11:TRUE"
644 | }
645 | }
646 | }
647 | }
648 | }
649 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_A893C1FFABB44723A60574E71E26104F"
650 | {
651 | "Name" = "8:#1902"
652 | "Sequence" = "3:1"
653 | "Attributes" = "3:3"
654 | "Dialogs"
655 | {
656 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_5782C3BAE4E646AE84BD401EFF0833D5"
657 | {
658 | "Sequence" = "3:100"
659 | "DisplayName" = "8:完了"
660 | "UseDynamicProperties" = "11:TRUE"
661 | "IsDependency" = "11:FALSE"
662 | "SourcePath" = "8:\\VsdFinishedDlg.wid"
663 | "Properties"
664 | {
665 | "BannerBitmap"
666 | {
667 | "Name" = "8:BannerBitmap"
668 | "DisplayName" = "8:#1001"
669 | "Description" = "8:#1101"
670 | "Type" = "3:8"
671 | "ContextData" = "8:Bitmap"
672 | "Attributes" = "3:4"
673 | "Setting" = "3:1"
674 | "UsePlugInResources" = "11:TRUE"
675 | }
676 | "UpdateText"
677 | {
678 | "Name" = "8:UpdateText"
679 | "DisplayName" = "8:#1058"
680 | "Description" = "8:#1158"
681 | "Type" = "3:15"
682 | "ContextData" = "8:"
683 | "Attributes" = "3:0"
684 | "Setting" = "3:1"
685 | "Value" = "8:#1258"
686 | "DefaultValue" = "8:#1258"
687 | "UsePlugInResources" = "11:TRUE"
688 | }
689 | }
690 | }
691 | }
692 | }
693 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_D04228B5D2A84C5E850B04CE0B9827C9"
694 | {
695 | "Name" = "8:#1901"
696 | "Sequence" = "3:2"
697 | "Attributes" = "3:2"
698 | "Dialogs"
699 | {
700 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_5A50B953E1BD4AB89026801FD3B58D4D"
701 | {
702 | "Sequence" = "3:100"
703 | "DisplayName" = "8:進行状況"
704 | "UseDynamicProperties" = "11:TRUE"
705 | "IsDependency" = "11:FALSE"
706 | "SourcePath" = "8:\\VsdAdminProgressDlg.wid"
707 | "Properties"
708 | {
709 | "BannerBitmap"
710 | {
711 | "Name" = "8:BannerBitmap"
712 | "DisplayName" = "8:#1001"
713 | "Description" = "8:#1101"
714 | "Type" = "3:8"
715 | "ContextData" = "8:Bitmap"
716 | "Attributes" = "3:4"
717 | "Setting" = "3:1"
718 | "UsePlugInResources" = "11:TRUE"
719 | }
720 | "ShowProgress"
721 | {
722 | "Name" = "8:ShowProgress"
723 | "DisplayName" = "8:#1009"
724 | "Description" = "8:#1109"
725 | "Type" = "3:5"
726 | "ContextData" = "8:1;True=1;False=0"
727 | "Attributes" = "3:0"
728 | "Setting" = "3:0"
729 | "Value" = "3:1"
730 | "DefaultValue" = "3:1"
731 | "UsePlugInResources" = "11:TRUE"
732 | }
733 | }
734 | }
735 | }
736 | }
737 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_F8FAAAE8C6294F2FAAFFCB6137078EC2"
738 | {
739 | "Name" = "8:#1902"
740 | "Sequence" = "3:2"
741 | "Attributes" = "3:3"
742 | "Dialogs"
743 | {
744 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_C51DA4309FF4447B888030BEA67977B8"
745 | {
746 | "Sequence" = "3:100"
747 | "DisplayName" = "8:完了"
748 | "UseDynamicProperties" = "11:TRUE"
749 | "IsDependency" = "11:FALSE"
750 | "SourcePath" = "8:\\VsdAdminFinishedDlg.wid"
751 | "Properties"
752 | {
753 | "BannerBitmap"
754 | {
755 | "Name" = "8:BannerBitmap"
756 | "DisplayName" = "8:#1001"
757 | "Description" = "8:#1101"
758 | "Type" = "3:8"
759 | "ContextData" = "8:Bitmap"
760 | "Attributes" = "3:4"
761 | "Setting" = "3:1"
762 | "UsePlugInResources" = "11:TRUE"
763 | }
764 | }
765 | }
766 | }
767 | }
768 | "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_FC3257C470D04B14BCF8D06119C499DF"
769 | {
770 | "UseDynamicProperties" = "11:FALSE"
771 | "IsDependency" = "11:FALSE"
772 | "SourcePath" = "8:\\VsdBasicDialogs.wim"
773 | }
774 | }
775 | "MergeModule"
776 | {
777 | }
778 | "ProjectOutput"
779 | {
780 | "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_CEB6309859654657B44877A9F7D496C2"
781 | {
782 | "SourcePath" = "8:x64\\Release\\iislua.dll"
783 | "TargetName" = "8:"
784 | "Tag" = "8:"
785 | "Folder" = "8:_068BCEF92D56425B8464D2F051F74660"
786 | "Condition" = "8:"
787 | "Transitive" = "11:FALSE"
788 | "Vital" = "11:TRUE"
789 | "ReadOnly" = "11:FALSE"
790 | "Hidden" = "11:FALSE"
791 | "System" = "11:FALSE"
792 | "Permanent" = "11:FALSE"
793 | "SharedLegacy" = "11:FALSE"
794 | "PackageAs" = "3:1"
795 | "Register" = "3:1"
796 | "Exclude" = "11:FALSE"
797 | "IsDependency" = "11:FALSE"
798 | "IsolateTo" = "8:"
799 | "ProjectOutputGroupRegister" = "3:1"
800 | "OutputConfiguration" = "8:Release|x64"
801 | "OutputGroupCanonicalName" = "8:Built"
802 | "OutputProjectGuid" = "8:{28A38A86-5E73-4252-9CE0-EFD34490E8B4}"
803 | "ShowKeyOutput" = "11:TRUE"
804 | "ExcludeFilters"
805 | {
806 | }
807 | }
808 | }
809 | }
810 | }
811 |
--------------------------------------------------------------------------------
/setup/iislua-x86.vdproj:
--------------------------------------------------------------------------------
1 | "DeployProject"
2 | {
3 | "VSVersion" = "3:800"
4 | "ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}"
5 | "IsWebType" = "8:FALSE"
6 | "ProjectName" = "8:iislua-x86"
7 | "LanguageId" = "3:1033"
8 | "CodePage" = "3:1252"
9 | "UILanguageId" = "3:1033"
10 | "SccProjectName" = "8:"
11 | "SccLocalPath" = "8:"
12 | "SccAuxPath" = "8:"
13 | "SccProvider" = "8:"
14 | "Hierarchy"
15 | {
16 | "Entry"
17 | {
18 | "MsmKey" = "8:_2617F9C5B3014C38AC086E6535965FE7"
19 | "OwnerKey" = "8:_UNDEFINED"
20 | "MsmSig" = "8:_UNDEFINED"
21 | }
22 | "Entry"
23 | {
24 | "MsmKey" = "8:_3787E9F9E22B4C42A6FBD4CEA6B51567"
25 | "OwnerKey" = "8:_UNDEFINED"
26 | "MsmSig" = "8:_UNDEFINED"
27 | }
28 | "Entry"
29 | {
30 | "MsmKey" = "8:_86A8F3835ABD463894043FBEAEC28EB9"
31 | "OwnerKey" = "8:_UNDEFINED"
32 | "MsmSig" = "8:_UNDEFINED"
33 | }
34 | }
35 | "Configurations"
36 | {
37 | "Debug"
38 | {
39 | "DisplayName" = "8:Debug"
40 | "IsDebugOnly" = "11:TRUE"
41 | "IsReleaseOnly" = "11:FALSE"
42 | "OutputFilename" = "8:Debug\\x86\\iislua_debug_x86.msi"
43 | "PackageFilesAs" = "3:2"
44 | "PackageFileSize" = "3:-2147483648"
45 | "CabType" = "3:1"
46 | "Compression" = "3:2"
47 | "SignOutput" = "11:FALSE"
48 | "CertificateFile" = "8:"
49 | "PrivateKeyFile" = "8:"
50 | "TimeStampServer" = "8:"
51 | "InstallerBootstrapper" = "3:2"
52 | "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
53 | {
54 | "Enabled" = "11:TRUE"
55 | "PromptEnabled" = "11:TRUE"
56 | "PrerequisitesLocation" = "2:1"
57 | "Url" = "8:"
58 | "ComponentsUrl" = "8:"
59 | "Items"
60 | {
61 | "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.5"
62 | {
63 | "Name" = "8:Microsoft .NET Framework 4.5 (x86 and x64)"
64 | "ProductCode" = "8:.NETFramework,Version=v4.5"
65 | }
66 | }
67 | }
68 | }
69 | "Release"
70 | {
71 | "DisplayName" = "8:Release"
72 | "IsDebugOnly" = "11:FALSE"
73 | "IsReleaseOnly" = "11:TRUE"
74 | "OutputFilename" = "8:Release\\x86\\iislua_x86.msi"
75 | "PackageFilesAs" = "3:2"
76 | "PackageFileSize" = "3:-2147483648"
77 | "CabType" = "3:1"
78 | "Compression" = "3:2"
79 | "SignOutput" = "11:FALSE"
80 | "CertificateFile" = "8:"
81 | "PrivateKeyFile" = "8:"
82 | "TimeStampServer" = "8:"
83 | "InstallerBootstrapper" = "3:2"
84 | "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
85 | {
86 | "Enabled" = "11:TRUE"
87 | "PromptEnabled" = "11:TRUE"
88 | "PrerequisitesLocation" = "2:1"
89 | "Url" = "8:"
90 | "ComponentsUrl" = "8:"
91 | "Items"
92 | {
93 | "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.5"
94 | {
95 | "Name" = "8:Microsoft .NET Framework 4.5 (x86 and x64)"
96 | "ProductCode" = "8:.NETFramework,Version=v4.5"
97 | }
98 | }
99 | }
100 | }
101 | }
102 | "Deployable"
103 | {
104 | "CustomAction"
105 | {
106 | "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_28D3ECDDC36147B8B8E84D6A525050C0"
107 | {
108 | "Name" = "8:uninstall.js"
109 | "Condition" = "8:"
110 | "Object" = "8:_3787E9F9E22B4C42A6FBD4CEA6B51567"
111 | "FileType" = "3:3"
112 | "InstallAction" = "3:4"
113 | "Arguments" = "8:"
114 | "EntryPoint" = "8:"
115 | "Sequence" = "3:1"
116 | "Identifier" = "8:_E1796D53_579D_4CC1_9A65_BCEF6B76FE93"
117 | "InstallerClass" = "11:FALSE"
118 | "CustomActionData" = "8:"
119 | }
120 | "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_9BE8E879BF614C04A8174E18182DAED2"
121 | {
122 | "Name" = "8:uninstall.js"
123 | "Condition" = "8:"
124 | "Object" = "8:_3787E9F9E22B4C42A6FBD4CEA6B51567"
125 | "FileType" = "3:3"
126 | "InstallAction" = "3:3"
127 | "Arguments" = "8:"
128 | "EntryPoint" = "8:"
129 | "Sequence" = "3:1"
130 | "Identifier" = "8:_9CB25349_D16D_4B16_9940_234F25CBF7B2"
131 | "InstallerClass" = "11:FALSE"
132 | "CustomActionData" = "8:"
133 | }
134 | "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_F4A8F4E2BEA243089DCE5CA729635F37"
135 | {
136 | "Name" = "8:install.js"
137 | "Condition" = "8:"
138 | "Object" = "8:_86A8F3835ABD463894043FBEAEC28EB9"
139 | "FileType" = "3:3"
140 | "InstallAction" = "3:2"
141 | "Arguments" = "8:"
142 | "EntryPoint" = "8:"
143 | "Sequence" = "3:1"
144 | "Identifier" = "8:_9581A641_F4D7_46FB_AB41_78076A38B39E"
145 | "InstallerClass" = "11:FALSE"
146 | "CustomActionData" = "8:"
147 | }
148 | }
149 | "DefaultFeature"
150 | {
151 | "Name" = "8:DefaultFeature"
152 | "Title" = "8:"
153 | "Description" = "8:"
154 | }
155 | "ExternalPersistence"
156 | {
157 | "LaunchCondition"
158 | {
159 | }
160 | }
161 | "File"
162 | {
163 | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2617F9C5B3014C38AC086E6535965FE7"
164 | {
165 | "SourcePath" = "8:..\\schema\\iislua_schema.xml"
166 | "TargetName" = "8:iislua_schema.xml"
167 | "Tag" = "8:"
168 | "Folder" = "8:_02AB39436980458AB345A26D95A15653"
169 | "Condition" = "8:"
170 | "Transitive" = "11:FALSE"
171 | "Vital" = "11:TRUE"
172 | "ReadOnly" = "11:FALSE"
173 | "Hidden" = "11:FALSE"
174 | "System" = "11:FALSE"
175 | "Permanent" = "11:FALSE"
176 | "SharedLegacy" = "11:FALSE"
177 | "PackageAs" = "3:1"
178 | "Register" = "3:1"
179 | "Exclude" = "11:FALSE"
180 | "IsDependency" = "11:FALSE"
181 | "IsolateTo" = "8:"
182 | }
183 | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3787E9F9E22B4C42A6FBD4CEA6B51567"
184 | {
185 | "SourcePath" = "8:uninstall.js"
186 | "TargetName" = "8:uninstall.js"
187 | "Tag" = "8:"
188 | "Folder" = "8:_C940B3A855AD4C3DA8DF36E475CD001A"
189 | "Condition" = "8:"
190 | "Transitive" = "11:FALSE"
191 | "Vital" = "11:TRUE"
192 | "ReadOnly" = "11:FALSE"
193 | "Hidden" = "11:FALSE"
194 | "System" = "11:FALSE"
195 | "Permanent" = "11:FALSE"
196 | "SharedLegacy" = "11:FALSE"
197 | "PackageAs" = "3:1"
198 | "Register" = "3:1"
199 | "Exclude" = "11:TRUE"
200 | "IsDependency" = "11:FALSE"
201 | "IsolateTo" = "8:"
202 | }
203 | "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_86A8F3835ABD463894043FBEAEC28EB9"
204 | {
205 | "SourcePath" = "8:install.js"
206 | "TargetName" = "8:install.js"
207 | "Tag" = "8:"
208 | "Folder" = "8:_C940B3A855AD4C3DA8DF36E475CD001A"
209 | "Condition" = "8:"
210 | "Transitive" = "11:FALSE"
211 | "Vital" = "11:TRUE"
212 | "ReadOnly" = "11:FALSE"
213 | "Hidden" = "11:FALSE"
214 | "System" = "11:FALSE"
215 | "Permanent" = "11:FALSE"
216 | "SharedLegacy" = "11:FALSE"
217 | "PackageAs" = "3:1"
218 | "Register" = "3:1"
219 | "Exclude" = "11:TRUE"
220 | "IsDependency" = "11:FALSE"
221 | "IsolateTo" = "8:"
222 | }
223 | }
224 | "FileType"
225 | {
226 | }
227 | "Folder"
228 | {
229 | "{1525181F-901A-416C-8A58-119130FE478E}:_BB9400A180AA4FFABFA6F219819E5098"
230 | {
231 | "Name" = "8:#1914"
232 | "AlwaysCreate" = "11:FALSE"
233 | "Condition" = "8:"
234 | "Transitive" = "11:FALSE"
235 | "Property" = "8:SystemFolder"
236 | "Folders"
237 | {
238 | "{9EF0B969-E518-4E46-987F-47570745A589}:_34210E432CEC4F70B29D3E7AE46BBDA3"
239 | {
240 | "Name" = "8:inetsrv"
241 | "AlwaysCreate" = "11:FALSE"
242 | "Condition" = "8:"
243 | "Transitive" = "11:FALSE"
244 | "Property" = "8:_FDCE59BA49E242CE89EF6A5E102E76C2"
245 | "Folders"
246 | {
247 | "{9EF0B969-E518-4E46-987F-47570745A589}:_AE4C0B8F164E458690DDA0DB6063F052"
248 | {
249 | "Name" = "8:config"
250 | "AlwaysCreate" = "11:FALSE"
251 | "Condition" = "8:"
252 | "Transitive" = "11:FALSE"
253 | "Property" = "8:_B9B01D103B8A4ADB8095F9CFB33D7E59"
254 | "Folders"
255 | {
256 | "{9EF0B969-E518-4E46-987F-47570745A589}:_02AB39436980458AB345A26D95A15653"
257 | {
258 | "Name" = "8:schema"
259 | "AlwaysCreate" = "11:FALSE"
260 | "Condition" = "8:"
261 | "Transitive" = "11:FALSE"
262 | "Property" = "8:_D3C9EE3A3A8A4C679AA302E8010FBDE2"
263 | "Folders"
264 | {
265 | }
266 | }
267 | }
268 | }
269 | }
270 | }
271 | }
272 | }
273 | "{3C67513D-01DD-4637-8A68-80971EB9504F}:_C940B3A855AD4C3DA8DF36E475CD001A"
274 | {
275 | "DefaultLocation" = "8:[ProgramFilesFolder][ProductName]"
276 | "Name" = "8:#1925"
277 | "AlwaysCreate" = "11:FALSE"
278 | "Condition" = "8:"
279 | "Transitive" = "11:FALSE"
280 | "Property" = "8:TARGETDIR"
281 | "Folders"
282 | {
283 | }
284 | }
285 | }
286 | "LaunchCondition"
287 | {
288 | "{836E08B8-0285-4809-BA42-01DB6754A45D}:_149062076D484645A421DD934AC0603F"
289 | {
290 | "Name" = "8:Exist IIS"
291 | "Condition" = "8:IISMAJORVERSION >= \"#7\" OR IISMAJORVERSION = \"#10\""
292 | "Message" = "8:iislua required for iis 7.x to up"
293 | "InstallUrl" = "8:"
294 | }
295 | }
296 | "Locator"
297 | {
298 | "{CF66B7F7-B7DA-4B08-A67A-233430638C9C}:_C5557B4AE5C04507ABF37C9BDE163184"
299 | {
300 | "Name" = "8:Search IIS"
301 | "Root" = "2:1"
302 | "RegKey" = "8:SOFTWARE\\Microsoft\\InetStp"
303 | "Value" = "8:MajorVersion"
304 | "Property" = "8:IISMAJORVERSION"
305 | }
306 | }
307 | "MsiBootstrapper"
308 | {
309 | "LangId" = "3:1033"
310 | "RequiresElevation" = "11:FALSE"
311 | }
312 | "Product"
313 | {
314 | "Name" = "8:Microsoft Visual Studio"
315 | "ProductName" = "8:iislua"
316 | "ProductCode" = "8:{A995F602-B907-4A99-877A-AAC5210F4081}"
317 | "PackageCode" = "8:{DB0C4026-5428-4FD4-92FD-EA3E5C765626}"
318 | "UpgradeCode" = "8:{5BA36CC3-3585-445F-BCF1-F93130D51135}"
319 | "AspNetVersion" = "8:4.0.30319.0"
320 | "RestartWWWService" = "11:FALSE"
321 | "RemovePreviousVersions" = "11:TRUE"
322 | "DetectNewerInstalledVersion" = "11:TRUE"
323 | "InstallAllUsers" = "11:TRUE"
324 | "ProductVersion" = "8:0.5.0"
325 | "Manufacturer" = "8:shibayan"
326 | "ARPHELPTELEPHONE" = "8:"
327 | "ARPHELPLINK" = "8:"
328 | "Title" = "8:iislua"
329 | "Subject" = "8:"
330 | "ARPCONTACT" = "8:shibayan"
331 | "Keywords" = "8:"
332 | "ARPCOMMENTS" = "8:"
333 | "ARPURLINFOABOUT" = "8:"
334 | "ARPPRODUCTICON" = "8:"
335 | "ARPIconIndex" = "3:0"
336 | "SearchPath" = "8:"
337 | "UseSystemSearchPath" = "11:TRUE"
338 | "TargetPlatform" = "3:0"
339 | "PreBuildEvent" = "8:"
340 | "PostBuildEvent" = "8:"
341 | "RunPostBuildEvent" = "3:0"
342 | }
343 | "Registry"
344 | {
345 | "HKLM"
346 | {
347 | "Keys"
348 | {
349 | }
350 | }
351 | "HKCU"
352 | {
353 | "Keys"
354 | {
355 | }
356 | }
357 | "HKCR"
358 | {
359 | "Keys"
360 | {
361 | }
362 | }
363 | "HKU"
364 | {
365 | "Keys"
366 | {
367 | }
368 | }
369 | "HKPU"
370 | {
371 | "Keys"
372 | {
373 | }
374 | }
375 | }
376 | "Sequences"
377 | {
378 | }
379 | "Shortcut"
380 | {
381 | }
382 | "UserInterface"
383 | {
384 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_05B0ADEBB94A463AB113AE16CC95CF70"
385 | {
386 | "Name" = "8:#1901"
387 | "Sequence" = "3:2"
388 | "Attributes" = "3:2"
389 | "Dialogs"
390 | {
391 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_AA9A8D040F394F9B97A78E3309679632"
392 | {
393 | "Sequence" = "3:100"
394 | "DisplayName" = "8:進行状況"
395 | "UseDynamicProperties" = "11:TRUE"
396 | "IsDependency" = "11:FALSE"
397 | "SourcePath" = "8:\\VsdAdminProgressDlg.wid"
398 | "Properties"
399 | {
400 | "BannerBitmap"
401 | {
402 | "Name" = "8:BannerBitmap"
403 | "DisplayName" = "8:#1001"
404 | "Description" = "8:#1101"
405 | "Type" = "3:8"
406 | "ContextData" = "8:Bitmap"
407 | "Attributes" = "3:4"
408 | "Setting" = "3:1"
409 | "UsePlugInResources" = "11:TRUE"
410 | }
411 | "ShowProgress"
412 | {
413 | "Name" = "8:ShowProgress"
414 | "DisplayName" = "8:#1009"
415 | "Description" = "8:#1109"
416 | "Type" = "3:5"
417 | "ContextData" = "8:1;True=1;False=0"
418 | "Attributes" = "3:0"
419 | "Setting" = "3:0"
420 | "Value" = "3:1"
421 | "DefaultValue" = "3:1"
422 | "UsePlugInResources" = "11:TRUE"
423 | }
424 | }
425 | }
426 | }
427 | }
428 | "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_17C23AC51341478E97DECFE63E1F24C1"
429 | {
430 | "UseDynamicProperties" = "11:FALSE"
431 | "IsDependency" = "11:FALSE"
432 | "SourcePath" = "8:\\VsdBasicDialogs.wim"
433 | }
434 | "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_21C3E26AAB8440EBBBF8730CB45DF9EB"
435 | {
436 | "UseDynamicProperties" = "11:FALSE"
437 | "IsDependency" = "11:FALSE"
438 | "SourcePath" = "8:\\VsdUserInterface.wim"
439 | }
440 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_D292A765631940AABFA15097C4CF40FB"
441 | {
442 | "Name" = "8:#1900"
443 | "Sequence" = "3:1"
444 | "Attributes" = "3:1"
445 | "Dialogs"
446 | {
447 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_3EB7B9185C6D4304A49E6923013FAFB0"
448 | {
449 | "Sequence" = "3:300"
450 | "DisplayName" = "8:インストールの確認"
451 | "UseDynamicProperties" = "11:TRUE"
452 | "IsDependency" = "11:FALSE"
453 | "SourcePath" = "8:\\VsdConfirmDlg.wid"
454 | "Properties"
455 | {
456 | "BannerBitmap"
457 | {
458 | "Name" = "8:BannerBitmap"
459 | "DisplayName" = "8:#1001"
460 | "Description" = "8:#1101"
461 | "Type" = "3:8"
462 | "ContextData" = "8:Bitmap"
463 | "Attributes" = "3:4"
464 | "Setting" = "3:1"
465 | "UsePlugInResources" = "11:TRUE"
466 | }
467 | }
468 | }
469 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_44063AAF2BAE4A609330CCB483F38F63"
470 | {
471 | "Sequence" = "3:200"
472 | "DisplayName" = "8:インストール フォルダー"
473 | "UseDynamicProperties" = "11:TRUE"
474 | "IsDependency" = "11:FALSE"
475 | "SourcePath" = "8:\\VsdFolderDlg.wid"
476 | "Properties"
477 | {
478 | "BannerBitmap"
479 | {
480 | "Name" = "8:BannerBitmap"
481 | "DisplayName" = "8:#1001"
482 | "Description" = "8:#1101"
483 | "Type" = "3:8"
484 | "ContextData" = "8:Bitmap"
485 | "Attributes" = "3:4"
486 | "Setting" = "3:1"
487 | "UsePlugInResources" = "11:TRUE"
488 | }
489 | "InstallAllUsersVisible"
490 | {
491 | "Name" = "8:InstallAllUsersVisible"
492 | "DisplayName" = "8:#1059"
493 | "Description" = "8:#1159"
494 | "Type" = "3:5"
495 | "ContextData" = "8:1;True=1;False=0"
496 | "Attributes" = "3:0"
497 | "Setting" = "3:0"
498 | "Value" = "3:1"
499 | "DefaultValue" = "3:1"
500 | "UsePlugInResources" = "11:TRUE"
501 | }
502 | }
503 | }
504 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_52D540896E744D58B0DD7D6CC0CA0E4F"
505 | {
506 | "Sequence" = "3:100"
507 | "DisplayName" = "8:ようこそ"
508 | "UseDynamicProperties" = "11:TRUE"
509 | "IsDependency" = "11:FALSE"
510 | "SourcePath" = "8:\\VsdWelcomeDlg.wid"
511 | "Properties"
512 | {
513 | "BannerBitmap"
514 | {
515 | "Name" = "8:BannerBitmap"
516 | "DisplayName" = "8:#1001"
517 | "Description" = "8:#1101"
518 | "Type" = "3:8"
519 | "ContextData" = "8:Bitmap"
520 | "Attributes" = "3:4"
521 | "Setting" = "3:1"
522 | "UsePlugInResources" = "11:TRUE"
523 | }
524 | "CopyrightWarning"
525 | {
526 | "Name" = "8:CopyrightWarning"
527 | "DisplayName" = "8:#1002"
528 | "Description" = "8:#1102"
529 | "Type" = "3:3"
530 | "ContextData" = "8:"
531 | "Attributes" = "3:0"
532 | "Setting" = "3:1"
533 | "Value" = "8:#1202"
534 | "DefaultValue" = "8:#1202"
535 | "UsePlugInResources" = "11:TRUE"
536 | }
537 | "Welcome"
538 | {
539 | "Name" = "8:Welcome"
540 | "DisplayName" = "8:#1003"
541 | "Description" = "8:#1103"
542 | "Type" = "3:3"
543 | "ContextData" = "8:"
544 | "Attributes" = "3:0"
545 | "Setting" = "3:1"
546 | "Value" = "8:#1203"
547 | "DefaultValue" = "8:#1203"
548 | "UsePlugInResources" = "11:TRUE"
549 | }
550 | }
551 | }
552 | }
553 | }
554 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_EC9DE1514C9C484F82802859FFFDC557"
555 | {
556 | "Name" = "8:#1901"
557 | "Sequence" = "3:1"
558 | "Attributes" = "3:2"
559 | "Dialogs"
560 | {
561 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_6F27E7DCA39C4AF6AFB553E6CB5B74CF"
562 | {
563 | "Sequence" = "3:100"
564 | "DisplayName" = "8:進行状況"
565 | "UseDynamicProperties" = "11:TRUE"
566 | "IsDependency" = "11:FALSE"
567 | "SourcePath" = "8:\\VsdProgressDlg.wid"
568 | "Properties"
569 | {
570 | "BannerBitmap"
571 | {
572 | "Name" = "8:BannerBitmap"
573 | "DisplayName" = "8:#1001"
574 | "Description" = "8:#1101"
575 | "Type" = "3:8"
576 | "ContextData" = "8:Bitmap"
577 | "Attributes" = "3:4"
578 | "Setting" = "3:1"
579 | "UsePlugInResources" = "11:TRUE"
580 | }
581 | "ShowProgress"
582 | {
583 | "Name" = "8:ShowProgress"
584 | "DisplayName" = "8:#1009"
585 | "Description" = "8:#1109"
586 | "Type" = "3:5"
587 | "ContextData" = "8:1;True=1;False=0"
588 | "Attributes" = "3:0"
589 | "Setting" = "3:0"
590 | "Value" = "3:1"
591 | "DefaultValue" = "3:1"
592 | "UsePlugInResources" = "11:TRUE"
593 | }
594 | }
595 | }
596 | }
597 | }
598 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_F18C699F30A847DA97DEBF01DECE9F44"
599 | {
600 | "Name" = "8:#1900"
601 | "Sequence" = "3:2"
602 | "Attributes" = "3:1"
603 | "Dialogs"
604 | {
605 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_784E8A560C8E44C2A0BCCC81E59C3F9D"
606 | {
607 | "Sequence" = "3:100"
608 | "DisplayName" = "8:ようこそ"
609 | "UseDynamicProperties" = "11:TRUE"
610 | "IsDependency" = "11:FALSE"
611 | "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid"
612 | "Properties"
613 | {
614 | "BannerBitmap"
615 | {
616 | "Name" = "8:BannerBitmap"
617 | "DisplayName" = "8:#1001"
618 | "Description" = "8:#1101"
619 | "Type" = "3:8"
620 | "ContextData" = "8:Bitmap"
621 | "Attributes" = "3:4"
622 | "Setting" = "3:1"
623 | "UsePlugInResources" = "11:TRUE"
624 | }
625 | "CopyrightWarning"
626 | {
627 | "Name" = "8:CopyrightWarning"
628 | "DisplayName" = "8:#1002"
629 | "Description" = "8:#1102"
630 | "Type" = "3:3"
631 | "ContextData" = "8:"
632 | "Attributes" = "3:0"
633 | "Setting" = "3:1"
634 | "Value" = "8:#1202"
635 | "DefaultValue" = "8:#1202"
636 | "UsePlugInResources" = "11:TRUE"
637 | }
638 | "Welcome"
639 | {
640 | "Name" = "8:Welcome"
641 | "DisplayName" = "8:#1003"
642 | "Description" = "8:#1103"
643 | "Type" = "3:3"
644 | "ContextData" = "8:"
645 | "Attributes" = "3:0"
646 | "Setting" = "3:1"
647 | "Value" = "8:#1203"
648 | "DefaultValue" = "8:#1203"
649 | "UsePlugInResources" = "11:TRUE"
650 | }
651 | }
652 | }
653 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_AC80AEF254194B7FBC218B85918C4592"
654 | {
655 | "Sequence" = "3:300"
656 | "DisplayName" = "8:インストールの確認"
657 | "UseDynamicProperties" = "11:TRUE"
658 | "IsDependency" = "11:FALSE"
659 | "SourcePath" = "8:\\VsdAdminConfirmDlg.wid"
660 | "Properties"
661 | {
662 | "BannerBitmap"
663 | {
664 | "Name" = "8:BannerBitmap"
665 | "DisplayName" = "8:#1001"
666 | "Description" = "8:#1101"
667 | "Type" = "3:8"
668 | "ContextData" = "8:Bitmap"
669 | "Attributes" = "3:4"
670 | "Setting" = "3:1"
671 | "UsePlugInResources" = "11:TRUE"
672 | }
673 | }
674 | }
675 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_CE6967AD010F4BCDBCCB16A3AB2B8EF1"
676 | {
677 | "Sequence" = "3:200"
678 | "DisplayName" = "8:インストール フォルダー"
679 | "UseDynamicProperties" = "11:TRUE"
680 | "IsDependency" = "11:FALSE"
681 | "SourcePath" = "8:\\VsdAdminFolderDlg.wid"
682 | "Properties"
683 | {
684 | "BannerBitmap"
685 | {
686 | "Name" = "8:BannerBitmap"
687 | "DisplayName" = "8:#1001"
688 | "Description" = "8:#1101"
689 | "Type" = "3:8"
690 | "ContextData" = "8:Bitmap"
691 | "Attributes" = "3:4"
692 | "Setting" = "3:1"
693 | "UsePlugInResources" = "11:TRUE"
694 | }
695 | }
696 | }
697 | }
698 | }
699 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_F3A5589A45B441599AE55FC0E29365F7"
700 | {
701 | "Name" = "8:#1902"
702 | "Sequence" = "3:2"
703 | "Attributes" = "3:3"
704 | "Dialogs"
705 | {
706 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_9F1A001AD192409E9E2EAEF8D0D2580B"
707 | {
708 | "Sequence" = "3:100"
709 | "DisplayName" = "8:完了"
710 | "UseDynamicProperties" = "11:TRUE"
711 | "IsDependency" = "11:FALSE"
712 | "SourcePath" = "8:\\VsdAdminFinishedDlg.wid"
713 | "Properties"
714 | {
715 | "BannerBitmap"
716 | {
717 | "Name" = "8:BannerBitmap"
718 | "DisplayName" = "8:#1001"
719 | "Description" = "8:#1101"
720 | "Type" = "3:8"
721 | "ContextData" = "8:Bitmap"
722 | "Attributes" = "3:4"
723 | "Setting" = "3:1"
724 | "UsePlugInResources" = "11:TRUE"
725 | }
726 | }
727 | }
728 | }
729 | }
730 | "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_FA7F83DEF699425BBD5E3F2EF7FE633D"
731 | {
732 | "Name" = "8:#1902"
733 | "Sequence" = "3:1"
734 | "Attributes" = "3:3"
735 | "Dialogs"
736 | {
737 | "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1BA18B8578BA4677A4909776086790E5"
738 | {
739 | "Sequence" = "3:100"
740 | "DisplayName" = "8:完了"
741 | "UseDynamicProperties" = "11:TRUE"
742 | "IsDependency" = "11:FALSE"
743 | "SourcePath" = "8:\\VsdFinishedDlg.wid"
744 | "Properties"
745 | {
746 | "BannerBitmap"
747 | {
748 | "Name" = "8:BannerBitmap"
749 | "DisplayName" = "8:#1001"
750 | "Description" = "8:#1101"
751 | "Type" = "3:8"
752 | "ContextData" = "8:Bitmap"
753 | "Attributes" = "3:4"
754 | "Setting" = "3:1"
755 | "UsePlugInResources" = "11:TRUE"
756 | }
757 | "UpdateText"
758 | {
759 | "Name" = "8:UpdateText"
760 | "DisplayName" = "8:#1058"
761 | "Description" = "8:#1158"
762 | "Type" = "3:15"
763 | "ContextData" = "8:"
764 | "Attributes" = "3:0"
765 | "Setting" = "3:1"
766 | "Value" = "8:#1258"
767 | "DefaultValue" = "8:#1258"
768 | "UsePlugInResources" = "11:TRUE"
769 | }
770 | }
771 | }
772 | }
773 | }
774 | }
775 | "MergeModule"
776 | {
777 | }
778 | "ProjectOutput"
779 | {
780 | "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_155760793A9B4E9C88EB162506ACDC06"
781 | {
782 | "SourcePath" = "8:"
783 | "TargetName" = "8:"
784 | "Tag" = "8:"
785 | "Folder" = "8:_C940B3A855AD4C3DA8DF36E475CD001A"
786 | "Condition" = "8:"
787 | "Transitive" = "11:FALSE"
788 | "Vital" = "11:TRUE"
789 | "ReadOnly" = "11:FALSE"
790 | "Hidden" = "11:FALSE"
791 | "System" = "11:FALSE"
792 | "Permanent" = "11:FALSE"
793 | "SharedLegacy" = "11:FALSE"
794 | "PackageAs" = "3:1"
795 | "Register" = "3:1"
796 | "Exclude" = "11:FALSE"
797 | "IsDependency" = "11:FALSE"
798 | "IsolateTo" = "8:"
799 | "ProjectOutputGroupRegister" = "3:1"
800 | "OutputConfiguration" = "8:Release|Win32"
801 | "OutputGroupCanonicalName" = "8:Built"
802 | "OutputProjectGuid" = "8:{28A38A86-5E73-4252-9CE0-EFD34490E8B4}"
803 | "ShowKeyOutput" = "11:TRUE"
804 | "ExcludeFilters"
805 | {
806 | }
807 | }
808 | }
809 | }
810 | }
811 |
--------------------------------------------------------------------------------
/setup/install.js:
--------------------------------------------------------------------------------
1 |
2 | // exec appcmd
3 | var shell = new ActiveXObject("Shell.Application");
4 | var wshell = new ActiveXObject("WScript.Shell");
5 |
6 | var appcmd = wshell.ExpandEnvironmentStrings("%windir%\\system32\\inetsrv\\appcmd.exe");
7 |
8 | shell.ShellExecute(appcmd, "install module /name:iislua /image:\"%programfiles%\\iislua\\iislua.dll\" /commit:apphost");
9 |
10 | // modify apphost.config
11 | var adminManager = new ActiveXObject("Microsoft.ApplicationHost.WritableAdminManager");
12 | var configManager = adminManager.ConfigManager;
13 |
14 | var appHostConfig = configManager.GetConfigFile("MACHINE/WEBROOT/APPHOST");
15 | var systemWebServer = appHostConfig.RootSectionGroup.Item("system.webServer");
16 |
17 | try {
18 | systemWebServer.Sections.DeleteSection("iislua");
19 | }
20 | catch (e) {
21 | }
22 |
23 | systemWebServer.Sections.AddSection("iislua");
24 |
25 | adminManager.CommitChanges();
--------------------------------------------------------------------------------
/setup/uninstall.js:
--------------------------------------------------------------------------------
1 |
2 | // exec appcmd
3 | var shell = new ActiveXObject("Shell.Application");
4 | var wshell = new ActiveXObject("WScript.Shell");
5 |
6 | var appcmd = wshell.ExpandEnvironmentStrings("%windir%\\system32\\inetsrv\\appcmd.exe");
7 |
8 | shell.ShellExecute(appcmd, "uninstall module iislua /commit:apphost");
9 |
10 | // modify apphost.config
11 | try {
12 | var adminManager = new ActiveXObject("Microsoft.ApplicationHost.WritableAdminManager");
13 | var configManager = adminManager.ConfigManager;
14 |
15 | var appHostConfig = configManager.GetConfigFile("MACHINE/WEBROOT/APPHOST");
16 | var systemWebServer = appHostConfig.RootSectionGroup.Item("system.webServer");
17 |
18 | systemWebServer.Sections.DeleteSection("iislua");
19 |
20 | adminManager.CommitChanges();
21 | }
22 | catch (e) {
23 | }
--------------------------------------------------------------------------------
/src/iislua.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iislua", "iislua\iislua.vcxproj", "{4324E09E-009A-4CB6-8548-7AD886F9623E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Debug|x64.ActiveCfg = Debug|x64
17 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Debug|x64.Build.0 = Debug|x64
18 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Debug|x86.ActiveCfg = Debug|Win32
19 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Debug|x86.Build.0 = Debug|Win32
20 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Release|x64.ActiveCfg = Release|x64
21 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Release|x64.Build.0 = Release|x64
22 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Release|x86.ActiveCfg = Release|Win32
23 | {4324E09E-009A-4CB6-8548-7AD886F9623E}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {B047F1A7-C1FB-480F-9481-4007EB9E75D1}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/iislua/cluahttpmodule.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | CLuaHttpModule::CLuaHttpModule(CLuaStatePool* pLuaStatePool)
5 | : L(nullptr), pLuaStatePool(pLuaStatePool)
6 | {
7 | }
8 |
9 | CLuaHttpModule::~CLuaHttpModule()
10 | {
11 | if (L != nullptr)
12 | {
13 | pLuaStatePool->Release(L);
14 | L = nullptr;
15 | }
16 | }
17 |
18 | REQUEST_NOTIFICATION_STATUS CLuaHttpModule::OnExecuteCore(IN IHttpContext* pHttpContext, IN IHttpEventProvider* pProvider, IN const char* name)
19 | {
20 | if (L == nullptr)
21 | {
22 | L = pLuaStatePool->Acquire(pHttpContext, pProvider);
23 | }
24 |
25 | lua_getglobal(L, name);
26 |
27 | if (!lua_isfunction(L, -1))
28 | {
29 | lua_pop(L, 1);
30 |
31 | return RQ_NOTIFICATION_CONTINUE;
32 | }
33 |
34 | if (lua_pcall(L, 0, 1, 0))
35 | {
36 | auto error = lua_tostring(L, -1);
37 |
38 | pHttpContext->GetResponse()->SetStatus(500, "Internal Server Error");
39 |
40 | return RQ_NOTIFICATION_FINISH_REQUEST;
41 | }
42 |
43 | return iislua_finish_request(L);
44 | }
45 |
46 | REQUEST_NOTIFICATION_STATUS CLuaHttpModule::OnAsyncCompletion(IN IHttpContext* pHttpContext, IN DWORD dwNotification, IN BOOL fPostNotification, IN IHttpEventProvider* pProvider, IN IHttpCompletionInfo* pCompletionInfo)
47 | {
48 | UNREFERENCED_PARAMETER(pHttpContext);
49 | UNREFERENCED_PARAMETER(dwNotification);
50 | UNREFERENCED_PARAMETER(fPostNotification);
51 | UNREFERENCED_PARAMETER(pProvider);
52 | UNREFERENCED_PARAMETER(pCompletionInfo);
53 |
54 | auto storedContext = CLuaHttpStoredContext::GetContext(pHttpContext);
55 |
56 | storedContext->GetChildContext()->ReleaseClonedContext();
57 | storedContext->SetChildContext(nullptr);
58 |
59 | return RQ_NOTIFICATION_CONTINUE;
60 | }
--------------------------------------------------------------------------------
/src/iislua/cluahttpmodule.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | struct lua_State;
4 |
5 | class CLuaStatePool;
6 |
7 | class CLuaHttpModule : public CHttpModule
8 | {
9 | lua_State* L;
10 | CLuaStatePool* pLuaStatePool;
11 |
12 | REQUEST_NOTIFICATION_STATUS OnExecuteCore(IN IHttpContext* pHttpContext, IN IHttpEventProvider* pProvider, IN const char* name);
13 | public:
14 | CLuaHttpModule(CLuaStatePool* pLuaStatePool);
15 | ~CLuaHttpModule();
16 |
17 | REQUEST_NOTIFICATION_STATUS OnBeginRequest(IN IHttpContext* pHttpContext, IN IHttpEventProvider* pProvider)
18 | {
19 | return OnExecuteCore(pHttpContext, pProvider, "BeginRequest");
20 | }
21 |
22 | REQUEST_NOTIFICATION_STATUS OnAuthenticateRequest(IN IHttpContext* pHttpContext, IN IAuthenticationProvider* pProvider)
23 | {
24 | return OnExecuteCore(pHttpContext, pProvider, "AuthenticateRequest");
25 | }
26 |
27 | REQUEST_NOTIFICATION_STATUS OnAuthorizeRequest(IN IHttpContext* pHttpContext, IN IHttpEventProvider* pProvider)
28 | {
29 | return OnExecuteCore(pHttpContext, pProvider, "AuthorizeRequest");
30 | }
31 |
32 | REQUEST_NOTIFICATION_STATUS OnExecuteRequestHandler(IN IHttpContext* pHttpContext, IN IHttpEventProvider* pProvider)
33 | {
34 | return OnExecuteCore(pHttpContext, pProvider, "ExecuteRequest");
35 | }
36 |
37 | REQUEST_NOTIFICATION_STATUS OnEndRequest(IN IHttpContext* pHttpContext, IN IHttpEventProvider* pProvider)
38 | {
39 | return OnExecuteCore(pHttpContext, pProvider, "EndRequest");
40 | }
41 |
42 | REQUEST_NOTIFICATION_STATUS OnSendResponse(IN IHttpContext* pHttpContext, IN ISendResponseProvider* pProvider)
43 | {
44 | return OnExecuteCore(pHttpContext, pProvider, "SendResponse");
45 | }
46 |
47 | REQUEST_NOTIFICATION_STATUS OnMapPath(IN IHttpContext* pHttpContext, IN IMapPathProvider* pProvider)
48 | {
49 | return OnExecuteCore(pHttpContext, pProvider, "MapPath");
50 | }
51 |
52 | REQUEST_NOTIFICATION_STATUS OnAsyncCompletion(IN IHttpContext* pHttpContext, IN DWORD dwNotification, IN BOOL fPostNotification, IN IHttpEventProvider* pProvider, IN IHttpCompletionInfo* pCompletionInfo);
53 | };
--------------------------------------------------------------------------------
/src/iislua/cluahttpmodulefactory.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | CLuaHttpModuleFactory::CLuaHttpModuleFactory()
5 | : pLuaStatePool(new CLuaStatePool())
6 | {
7 | WSADATA wsaData;
8 |
9 | WSAStartup(MAKEWORD(2, 2), &wsaData);
10 | }
11 |
12 | CLuaHttpModuleFactory::~CLuaHttpModuleFactory()
13 | {
14 | if (pLuaStatePool != nullptr)
15 | {
16 | delete pLuaStatePool;
17 | pLuaStatePool = nullptr;
18 | }
19 |
20 | WSACleanup();
21 | }
22 |
23 | HRESULT CLuaHttpModuleFactory::GetHttpModule(OUT CHttpModule** ppModule, IN IModuleAllocator* pAllocator)
24 | {
25 | UNREFERENCED_PARAMETER(pAllocator);
26 |
27 | auto pModule = new CLuaHttpModule(pLuaStatePool);
28 |
29 | if (!pModule)
30 | {
31 | return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
32 | }
33 |
34 | *ppModule = pModule;
35 |
36 | return S_OK;
37 | }
38 |
39 | void CLuaHttpModuleFactory::Terminate()
40 | {
41 | delete this;
42 | }
--------------------------------------------------------------------------------
/src/iislua/cluahttpmodulefactory.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class CLuaStatePool;
4 |
5 | class CLuaHttpModuleFactory : public IHttpModuleFactory
6 | {
7 | CLuaStatePool* pLuaStatePool;
8 | public:
9 | CLuaHttpModuleFactory();
10 | ~CLuaHttpModuleFactory();
11 |
12 | HRESULT GetHttpModule(OUT CHttpModule** ppModule, IN IModuleAllocator* pAllocator);
13 | void Terminate();
14 | };
--------------------------------------------------------------------------------
/src/iislua/cluahttpstoredcontext.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | extern HTTP_MODULE_ID g_pModuleContext;
5 |
6 | CLuaHttpStoredContext::CLuaHttpStoredContext()
7 | : pHttpChildContext(nullptr)
8 | {
9 | }
10 |
11 | IHttpContext* CLuaHttpStoredContext::GetChildContext() const
12 | {
13 | return pHttpChildContext;
14 | }
15 |
16 | void CLuaHttpStoredContext::SetChildContext(IN IHttpContext* pHttpChildContext)
17 | {
18 | this->pHttpChildContext = pHttpChildContext;
19 | }
20 |
21 | void CLuaHttpStoredContext::CleanupStoredContext()
22 | {
23 | delete this;
24 | }
25 |
26 | CLuaHttpStoredContext* CLuaHttpStoredContext::GetContext(IN IHttpContext* pHttpContext)
27 | {
28 | auto pModuleContextContainer = pHttpContext->GetModuleContextContainer();
29 | auto pHttpStoredContext = reinterpret_cast(pModuleContextContainer->GetModuleContext(g_pModuleContext));
30 |
31 | if (pHttpStoredContext)
32 | {
33 | return pHttpStoredContext;
34 | }
35 |
36 | pHttpStoredContext = new CLuaHttpStoredContext();
37 |
38 | if (FAILED(pModuleContextContainer->SetModuleContext(pHttpStoredContext, g_pModuleContext)))
39 | {
40 | pHttpStoredContext->CleanupStoredContext();
41 |
42 | return nullptr;
43 | }
44 |
45 | return pHttpStoredContext;
46 | }
47 |
--------------------------------------------------------------------------------
/src/iislua/cluahttpstoredcontext.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class CLuaHttpStoredContext : public IHttpStoredContext
4 | {
5 | private:
6 | IHttpContext* pHttpChildContext;
7 | public:
8 | CLuaHttpStoredContext();
9 |
10 | IHttpContext* GetChildContext() const;
11 | void SetChildContext(IN IHttpContext* pHttpChildContext);
12 |
13 | void CleanupStoredContext();
14 |
15 | static CLuaHttpStoredContext* GetContext(IN IHttpContext* pHttpContext);
16 | };
--------------------------------------------------------------------------------
/src/iislua/cluastatepool.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | CLuaStatePool::CLuaStatePool()
5 | : count(0), maxPoolSize(64), pListHead(nullptr)
6 | {
7 | pListHead = reinterpret_cast(_aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT));
8 |
9 | InitializeSListHead(pListHead);
10 | }
11 |
12 | CLuaStatePool::~CLuaStatePool()
13 | {
14 | while (true)
15 | {
16 | auto pListEntry = InterlockedPopEntrySList(pListHead);
17 |
18 | if (pListEntry == nullptr)
19 | {
20 | break;
21 | }
22 |
23 | auto pLuaStateEntry = reinterpret_cast(pListEntry);
24 |
25 | iislua_close(pLuaStateEntry->L);
26 |
27 | _aligned_free(pListEntry);
28 | }
29 |
30 | _aligned_free(pListHead);
31 | }
32 |
33 | lua_State* CLuaStatePool::Acquire(IHttpContext* pHttpContext, IHttpEventProvider* pProvider)
34 | {
35 | lua_State* L;
36 |
37 | auto pListEntry = InterlockedPopEntrySList(pListHead);
38 |
39 | if (pListEntry == nullptr)
40 | {
41 | L = iislua_newstate();
42 |
43 | // load from file
44 | auto config = CModuleConfiguration::GetConfig(pHttpContext);
45 |
46 | iislua_load_file(L, "BeginRequest", config->GetBeginRequest().c_str());
47 | iislua_load_file(L, "AuthenticateRequest", config->GetAuthenticateRequest().c_str());
48 | iislua_load_file(L, "AuthorizeRequest", config->GetAuthorizeRequest().c_str());
49 | iislua_load_file(L, "ExecuteRequest", config->GetExecuteRequest().c_str());
50 | iislua_load_file(L, "LogRequest", config->GetLogRequest().c_str());
51 | iislua_load_file(L, "EndRequest", config->GetEndRequest().c_str());
52 | iislua_load_file(L, "MapPath", config->GetMapPath().c_str());
53 |
54 | this->codeCacheEnabled = config->IsCodeCacheEnabled();
55 | }
56 | else
57 | {
58 | auto pLuaStateEntry = reinterpret_cast(pListEntry);
59 |
60 | L = pLuaStateEntry->L;
61 |
62 | InterlockedDecrement(&count);
63 |
64 | _aligned_free(pListEntry);
65 | }
66 |
67 | iislua_init(L, pHttpContext, pProvider);
68 |
69 | return L;
70 | }
71 |
72 | void CLuaStatePool::Release(lua_State* L)
73 | {
74 | if (count >= maxPoolSize || !this->codeCacheEnabled)
75 | {
76 | iislua_close(L);
77 |
78 | return;
79 | }
80 |
81 | auto pLuaStateEntry = reinterpret_cast(_aligned_malloc(sizeof(LUA_STATE_ENTRY), MEMORY_ALLOCATION_ALIGNMENT));
82 |
83 | pLuaStateEntry->L = L;
84 |
85 | InterlockedPushEntrySList(pListHead, &pLuaStateEntry->listEntry);
86 |
87 | InterlockedIncrement(&count);
88 | }
--------------------------------------------------------------------------------
/src/iislua/cluastatepool.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | struct lua_State;
4 |
5 | class CLuaStatePool
6 | {
7 | typedef struct _LUA_STATE_ENTRY
8 | {
9 | SLIST_ENTRY listEntry;
10 | lua_State* L;
11 | } LUA_STATE_ENTRY, * PLUA_STATE_ENTRY;
12 |
13 | PSLIST_HEADER pListHead;
14 | unsigned int count;
15 | unsigned int maxPoolSize;
16 | bool codeCacheEnabled;
17 | public:
18 | CLuaStatePool();
19 | ~CLuaStatePool();
20 |
21 | lua_State* Acquire(IHttpContext* pHttpContext, IHttpEventProvider* pProvider);
22 | void Release(lua_State* L);
23 | };
--------------------------------------------------------------------------------
/src/iislua/cmoduleconfiguration.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | extern HTTP_MODULE_ID g_pModuleContext;
5 | extern IHttpServer* g_pHttpServer;
6 |
7 | static const _bstr_t sectionPath = L"system.webServer/iislua";
8 |
9 | HRESULT CModuleConfiguration::Initialize(IN IHttpContext* pHttpContext, IN IHttpServer* pHttpServer)
10 | {
11 | IAppHostElementPtr section;
12 |
13 | _bstr_t path = pHttpContext->GetMetadata()->GetMetaPath();
14 |
15 | pHttpServer->GetAdminManager()->GetAdminSection(sectionPath, path, §ion);
16 |
17 | if (!section)
18 | {
19 | return S_OK;
20 | }
21 |
22 | // lua element
23 | this->codeCacheEnabled = GetBoolean(section, L"codeCacheEnabled");
24 |
25 | // socket element
26 | auto socketElement = GetElement(section, L"socket");
27 | this->connectTimeout = GetInteger(socketElement, L"connectTimeout") / 1000;
28 | this->sendTimeout = GetInteger(socketElement, L"sendTimeout") / 1000;
29 | this->readTimeout = GetInteger(socketElement, L"readTimeout") / 1000;
30 |
31 | // beginRequest element
32 | auto beginRequestElement = GetElement(section, L"beginRequest");
33 | this->beginRequest = GetString(beginRequestElement, L"scriptPath");
34 |
35 | // authenticateRequest element
36 | auto authenticateRequestElement = GetElement(section, L"authenticateRequest");
37 | this->authenticateRequest = GetString(authenticateRequestElement, L"scriptPath");
38 |
39 | // authorizeRequest element
40 | auto authorizeRequestElement = GetElement(section, L"authorizeRequest");
41 | this->authorizeRequest = GetString(authorizeRequestElement, L"scriptPath");
42 |
43 | // executeRequest element
44 | auto executeRequestElement = GetElement(section, L"executeRequest");
45 | this->executeRequest = GetString(executeRequestElement, L"scriptPath");
46 |
47 | // logRequest element
48 | auto logRequestElement = GetElement(section, L"logRequest");
49 | this->logRequest = GetString(logRequestElement, L"scriptPath");
50 |
51 | // endRequest element
52 | auto endRequestElement = GetElement(section, L"endRequest");
53 | this->endRequest = GetString(endRequestElement, L"scriptPath");
54 |
55 | // mapPath element
56 | auto mapPathElement = GetElement(section, L"mapPath");
57 | this->mapPath = GetString(mapPathElement, L"scriptPath");
58 |
59 | return S_OK;
60 | }
61 |
62 | void CModuleConfiguration::CleanupStoredContext()
63 | {
64 | delete this;
65 | }
66 |
67 | CModuleConfiguration* CModuleConfiguration::GetConfig(IN IHttpContext* pHttpContext)
68 | {
69 | auto pModuleContextContainer = pHttpContext->GetMetadata()->GetModuleContextContainer();
70 | auto pModuleConfig = reinterpret_cast(pModuleContextContainer->GetModuleContext(g_pModuleContext));
71 |
72 | if (pModuleConfig)
73 | {
74 | return pModuleConfig;
75 | }
76 |
77 | pModuleConfig = new CModuleConfiguration();
78 |
79 | if (FAILED(pModuleConfig->Initialize(pHttpContext, g_pHttpServer)))
80 | {
81 | pModuleConfig->CleanupStoredContext();
82 |
83 | return nullptr;
84 | }
85 |
86 | if (FAILED(pModuleContextContainer->SetModuleContext(pModuleConfig, g_pModuleContext)))
87 | {
88 | pModuleConfig->CleanupStoredContext();
89 |
90 | return nullptr;
91 | }
92 |
93 | return pModuleConfig;
94 | }
95 |
96 | IAppHostElementPtr CModuleConfiguration::GetElement(IAppHostElementPtr& section, _bstr_t elementName)
97 | {
98 | IAppHostElementPtr element;
99 |
100 | section->GetElementByName(elementName, &element);
101 |
102 | return element;
103 | }
104 |
105 | std::string CModuleConfiguration::GetString(IAppHostElementPtr& section, _bstr_t propertyName)
106 | {
107 | IAppHostPropertyPtr property;
108 |
109 | section->GetPropertyByName(propertyName, &property);
110 |
111 | _bstr_t propertyValue;
112 |
113 | property->get_StringValue(&propertyValue.GetBSTR());
114 |
115 | return iislua_to_str(propertyValue);
116 | }
117 |
118 | bool CModuleConfiguration::GetBoolean(IAppHostElementPtr& section, _bstr_t propertyName)
119 | {
120 | IAppHostPropertyPtr property;
121 |
122 | section->GetPropertyByName(propertyName, &property);
123 |
124 | _variant_t propertyValue;
125 |
126 | property->get_Value(&propertyValue.GetVARIANT());
127 |
128 | return propertyValue;
129 | }
130 |
131 | int CModuleConfiguration::GetInteger(IAppHostElementPtr& section, _bstr_t propertyName)
132 | {
133 | IAppHostPropertyPtr property;
134 |
135 | section->GetPropertyByName(propertyName, &property);
136 |
137 | _variant_t propertyValue;
138 |
139 | property->get_Value(&propertyValue.GetVARIANT());
140 |
141 | return propertyValue;
142 | }
--------------------------------------------------------------------------------
/src/iislua/cmoduleconfiguration.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | _COM_SMARTPTR_TYPEDEF(IAppHostElement, __uuidof(IAppHostElement));
4 | _COM_SMARTPTR_TYPEDEF(IAppHostProperty, __uuidof(IAppHostProperty));
5 |
6 | class CModuleConfiguration : public IHttpStoredContext
7 | {
8 | private:
9 | bool codeCacheEnabled;
10 |
11 | int connectTimeout;
12 | int sendTimeout;
13 | int readTimeout;
14 |
15 | std::string beginRequest;
16 | std::string authenticateRequest;
17 | std::string authorizeRequest;
18 | std::string executeRequest;
19 | std::string logRequest;
20 | std::string endRequest;
21 | std::string mapPath;
22 |
23 | IAppHostElementPtr GetElement(IAppHostElementPtr& section, _bstr_t elementName);
24 | std::string GetString(IAppHostElementPtr& section, _bstr_t propertyName);
25 | bool GetBoolean(IAppHostElementPtr& section, _bstr_t propertyName);
26 | int GetInteger(IAppHostElementPtr& section, _bstr_t propertyName);
27 | public:
28 | HRESULT Initialize(IN IHttpContext* pHttpContext, IN IHttpServer* pHttpServer);
29 |
30 | void CleanupStoredContext();
31 |
32 | static CModuleConfiguration* GetConfig(IN IHttpContext* pHttpContext);
33 |
34 | inline bool IsCodeCacheEnabled() const
35 | {
36 | return codeCacheEnabled;
37 | }
38 |
39 | inline const std::string& GetBeginRequest() const
40 | {
41 | return beginRequest;
42 | };
43 | inline const std::string& GetAuthenticateRequest() const
44 | {
45 | return authenticateRequest;
46 | };
47 | inline const std::string& GetAuthorizeRequest() const
48 | {
49 | return authorizeRequest;
50 | };
51 | inline const std::string& GetExecuteRequest() const
52 | {
53 | return executeRequest;
54 | };
55 | inline const std::string& GetLogRequest() const
56 | {
57 | return logRequest;
58 | };
59 | inline const std::string& GetEndRequest() const
60 | {
61 | return endRequest;
62 | };
63 | inline const std::string& GetMapPath() const
64 | {
65 | return mapPath;
66 | };
67 |
68 | inline int GetConnectTimeout() const
69 | {
70 | return connectTimeout;
71 | };
72 | inline int GetSendTimeout() const
73 | {
74 | return sendTimeout;
75 | };
76 | inline int GetReadTimeout() const
77 | {
78 | return readTimeout;
79 | };
80 | };
--------------------------------------------------------------------------------
/src/iislua/iislua.def:
--------------------------------------------------------------------------------
1 | LIBRARY "iislua"
2 |
3 | EXPORTS
4 | RegisterModule
--------------------------------------------------------------------------------
/src/iislua/iislua.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shibayan/iislua/4e5dbb95c1412566a6635f778f134ba5e8415e8b/src/iislua/iislua.rc
--------------------------------------------------------------------------------
/src/iislua/iislua.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 15.0
23 | {4324E09E-009A-4CB6-8548-7AD886F9623E}
24 | Win32Proj
25 | iislua
26 | 10.0
27 |
28 |
29 | $(SolutionDir)$(Platform)\$(Configuration)\
30 | $(Platform)\$(Configuration)\
31 |
32 |
33 |
34 | DynamicLibrary
35 | true
36 | v142
37 | Unicode
38 |
39 |
40 | DynamicLibrary
41 | false
42 | v142
43 | true
44 | Unicode
45 |
46 |
47 | DynamicLibrary
48 | true
49 | v142
50 | Unicode
51 |
52 |
53 | DynamicLibrary
54 | false
55 | v142
56 | true
57 | Unicode
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | true
79 |
80 |
81 | true
82 |
83 |
84 | false
85 |
86 |
87 | false
88 |
89 |
90 |
91 | Use
92 | Level3
93 | Disabled
94 | true
95 | WIN32;_DEBUG;IISLUA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
96 | true
97 |
98 |
99 | Windows
100 | true
101 | ws2_32.lib;%(AdditionalDependencies)
102 |
103 |
104 |
105 |
106 | Use
107 | Level3
108 | Disabled
109 | true
110 | _DEBUG;IISLUA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
111 | true
112 |
113 |
114 | Windows
115 | true
116 | ws2_32.lib;%(AdditionalDependencies)
117 |
118 |
119 |
120 |
121 | Use
122 | Level3
123 | MaxSpeed
124 | true
125 | true
126 | true
127 | WIN32;NDEBUG;IISLUA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
128 | true
129 |
130 |
131 | Windows
132 | true
133 | true
134 | true
135 | ws2_32.lib;%(AdditionalDependencies)
136 |
137 |
138 |
139 |
140 | Use
141 | Level3
142 | MaxSpeed
143 | true
144 | true
145 | true
146 | NDEBUG;IISLUA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
147 | true
148 |
149 |
150 | Windows
151 | true
152 | true
153 | true
154 | ws2_32.lib;%(AdditionalDependencies)
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 | Create
194 | Create
195 | Create
196 | Create
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 | このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/src/iislua/iislua.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | ヘッダー ファイル
20 |
21 |
22 | ヘッダー ファイル
23 |
24 |
25 | ヘッダー ファイル
26 |
27 |
28 | ヘッダー ファイル
29 |
30 |
31 | ヘッダー ファイル
32 |
33 |
34 | ヘッダー ファイル
35 |
36 |
37 | ヘッダー ファイル
38 |
39 |
40 | ヘッダー ファイル
41 |
42 |
43 | ヘッダー ファイル
44 |
45 |
46 | ヘッダー ファイル
47 |
48 |
49 | ヘッダー ファイル
50 |
51 |
52 | ヘッダー ファイル
53 |
54 |
55 | ヘッダー ファイル
56 |
57 |
58 | ヘッダー ファイル
59 |
60 |
61 | ヘッダー ファイル
62 |
63 |
64 | ヘッダー ファイル
65 |
66 |
67 | ヘッダー ファイル
68 |
69 |
70 |
71 |
72 | ソース ファイル
73 |
74 |
75 | ソース ファイル
76 |
77 |
78 | ソース ファイル
79 |
80 |
81 | ソース ファイル
82 |
83 |
84 | ソース ファイル
85 |
86 |
87 | ソース ファイル
88 |
89 |
90 | ソース ファイル
91 |
92 |
93 | ソース ファイル
94 |
95 |
96 | ソース ファイル
97 |
98 |
99 | ソース ファイル
100 |
101 |
102 | ソース ファイル
103 |
104 |
105 | ソース ファイル
106 |
107 |
108 | ソース ファイル
109 |
110 |
111 | ソース ファイル
112 |
113 |
114 | ソース ファイル
115 |
116 |
117 | ソース ファイル
118 |
119 |
120 |
121 |
122 | ソース ファイル
123 |
124 |
125 |
126 |
127 |
128 | リソース ファイル
129 |
130 |
131 |
--------------------------------------------------------------------------------
/src/iislua/iislua_api.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | int iislua_debug(lua_State* L)
5 | {
6 | auto message = luaL_checkstring(L, 1);
7 |
8 | return 0;
9 | }
10 |
11 | int iislua_exec(lua_State* L)
12 | {
13 | CHECK_ARGUMENT(L, 1);
14 |
15 | auto ctx = iislua_get_http_ctx(L);
16 |
17 | if (ctx == NULL)
18 | {
19 | return luaL_error(L, "context is null");
20 | }
21 |
22 | auto url = luaL_checkstring(L, 1);
23 |
24 | IHttpContext* childContext;
25 | BOOL completionExpected;
26 |
27 | ctx->CloneContext(CLONE_FLAG_BASICS | CLONE_FLAG_ENTITY | CLONE_FLAG_HEADERS, &childContext);
28 |
29 | childContext->GetRequest()->SetUrl(url, static_cast(strlen(url)), FALSE);
30 |
31 | ctx->ExecuteRequest(TRUE, childContext, 0, ctx->GetUser(), &completionExpected);
32 |
33 | if (completionExpected)
34 | {
35 | // for async operation
36 | auto storedContext = CLuaHttpStoredContext::GetContext(ctx);
37 |
38 | storedContext->SetChildContext(childContext);
39 |
40 | iislua_set_result(L, RQ_NOTIFICATION_PENDING);
41 |
42 | return 0;
43 | }
44 |
45 | childContext->ReleaseClonedContext();
46 |
47 | return 0;
48 | }
49 |
50 | int iislua_exit(lua_State* L)
51 | {
52 | CHECK_ARGUMENT(L, 1);
53 |
54 | auto ctx = iislua_get_http_ctx(L);
55 |
56 | if (ctx == NULL)
57 | {
58 | return luaL_error(L, "context is null");
59 | }
60 |
61 | auto status = static_cast(luaL_checkinteger(L, 1));
62 |
63 | ctx->GetResponse()->SetStatus(status, iislua_util_get_status_reason(status));
64 |
65 | iislua_set_result(L);
66 |
67 | return 0;
68 | }
69 |
70 | int iislua_flush(lua_State* L)
71 | {
72 | auto ctx = iislua_get_http_ctx(L);
73 |
74 | if (ctx == NULL)
75 | {
76 | return luaL_error(L, "context is null");
77 | }
78 |
79 | DWORD sent;
80 |
81 | ctx->GetResponse()->Flush(FALSE, TRUE, &sent);
82 |
83 | return 0;
84 | }
85 |
86 | int iislua_headers_sent(lua_State* L)
87 | {
88 | auto ctx = iislua_get_http_ctx(L);
89 |
90 | if (ctx == NULL)
91 | {
92 | return luaL_error(L, "context is null");
93 | }
94 |
95 | lua_pushboolean(L, ctx->GetResponseHeadersSent());
96 |
97 | return 1;
98 | }
99 |
100 | int iislua_map_path(lua_State* L)
101 | {
102 | CHECK_ARGUMENT(L, 1);
103 |
104 | auto ctx = iislua_get_http_ctx(L);
105 |
106 | if (ctx == NULL)
107 | {
108 | return luaL_error(L, "context is null");
109 | }
110 |
111 | auto url = iislua_to_wstr(luaL_checkstring(L, 1));
112 |
113 | DWORD length = 0;
114 |
115 | // calculate size
116 | ctx->MapPath(url.c_str(), NULL, &length);
117 |
118 | auto physicalPath = std::vector(length + 1);
119 |
120 | // convert path
121 | ctx->MapPath(url.c_str(), &physicalPath[0], &length);
122 |
123 | auto path = iislua_to_str(&physicalPath[0]);
124 |
125 | lua_pushstring(L, path.c_str());
126 |
127 | return 1;
128 | }
129 |
130 | int iislua_print(lua_State* L)
131 | {
132 | CHECK_ARGUMENT(L, 1);
133 |
134 | auto* ctx = iislua_get_http_ctx(L);
135 |
136 | if (ctx == NULL)
137 | {
138 | return luaL_error(L, "context is null");
139 | }
140 |
141 | auto message = luaL_checkstring(L, 1);
142 |
143 | DWORD sent;
144 | HTTP_DATA_CHUNK dataChunk;
145 |
146 | dataChunk.DataChunkType = HttpDataChunkFromMemory;
147 | dataChunk.FromMemory.pBuffer = const_cast(message);
148 | dataChunk.FromMemory.BufferLength = static_cast(strlen(message));
149 |
150 | ctx->GetResponse()->WriteEntityChunks(&dataChunk, 1, FALSE, TRUE, &sent);
151 |
152 | return 0;
153 | }
154 |
155 | int iislua_redirect(lua_State* L)
156 | {
157 | if (lua_gettop(L) != 1 && lua_gettop(L) != 2)
158 | {
159 | return luaL_error(L, "argument error");
160 | }
161 |
162 | auto ctx = iislua_get_http_ctx(L);
163 |
164 | if (ctx == NULL)
165 | {
166 | return luaL_error(L, "context is null");
167 | }
168 |
169 | auto url = luaL_checkstring(L, 1);
170 |
171 | ctx->GetResponse()->Redirect(url);
172 |
173 | if (lua_gettop(L) == 2)
174 | {
175 | auto status = static_cast(luaL_checkinteger(L, 2));
176 |
177 | ctx->GetResponse()->SetStatus(status, iislua_util_get_status_reason(status));
178 | }
179 |
180 | iislua_set_result(L);
181 |
182 | return 0;
183 | }
184 |
185 | int iislua_say(lua_State* L)
186 | {
187 | CHECK_ARGUMENT(L, 1);
188 |
189 | auto* ctx = iislua_get_http_ctx(L);
190 |
191 | if (ctx == NULL)
192 | {
193 | return luaL_error(L, "context is null");
194 | }
195 |
196 | auto message = luaL_checkstring(L, 1);
197 | auto newLine = "\r\n";
198 |
199 | DWORD sent;
200 | HTTP_DATA_CHUNK dataChunk[2];
201 |
202 | dataChunk[0].DataChunkType = HttpDataChunkFromMemory;
203 | dataChunk[0].FromMemory.pBuffer = const_cast(message);
204 | dataChunk[0].FromMemory.BufferLength = static_cast(strlen(message));
205 |
206 | dataChunk[1].DataChunkType = HttpDataChunkFromMemory;
207 | dataChunk[1].FromMemory.pBuffer = const_cast(newLine);
208 | dataChunk[1].FromMemory.BufferLength = 2;
209 |
210 | ctx->GetResponse()->WriteEntityChunks(dataChunk, 2, FALSE, TRUE, &sent);
211 |
212 | return 0;
213 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_api.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | IISLUA_API int iislua_debug(lua_State* L);
4 | IISLUA_API int iislua_exec(lua_State* L);
5 | IISLUA_API int iislua_exit(lua_State* L);
6 | IISLUA_API int iislua_flush(lua_State* L);
7 | IISLUA_API int iislua_headers_sent(lua_State* L);
8 | IISLUA_API int iislua_map_path(lua_State* L);
9 | IISLUA_API int iislua_print(lua_State* L);
10 | IISLUA_API int iislua_redirect(lua_State* L);
11 | IISLUA_API int iislua_say(lua_State* L);
--------------------------------------------------------------------------------
/src/iislua/iislua_core.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | static const char* iislua_ctx_key = "__iislua_ctx";
5 | static const char* iialua_provider_key = "__iislua_provider";
6 | static const char* iislua_result_key = "__iislua_result";
7 |
8 | extern char iislua_socket_tcp_metatable;
9 |
10 | static const luaL_Reg iis[] =
11 | {
12 | { "debug", iislua_debug },
13 | { "exec", iislua_exec },
14 | { "exit", iislua_exit },
15 | { "flush", iislua_flush },
16 | { "headers_sent", iislua_headers_sent },
17 | { "map_path", iislua_map_path },
18 | { "print", iislua_print },
19 | { "redirect", iislua_redirect },
20 | { "say", iislua_say },
21 | { NULL, NULL }
22 | };
23 |
24 | static const luaL_Reg iis_log[] =
25 | {
26 | { "read_entry", iislua_log_read_entry },
27 | { "write_entry", iislua_log_write_entry }
28 | };
29 |
30 | static const luaL_Reg iis_req[] =
31 | {
32 | { "get_headers", iislua_req_get_headers },
33 | { "get_method", iislua_req_get_method },
34 | { "get_remote_addr", iislua_req_get_remote_addr },
35 | { "get_url", iislua_req_get_url },
36 | { "get_url_args", iislua_req_get_url_args },
37 | { "http_version", iislua_req_http_version },
38 | { "set_header", iislua_req_set_header },
39 | { "set_method", iislua_req_set_method },
40 | { "set_url", iislua_req_set_url },
41 | { NULL, NULL }
42 | };
43 |
44 | static const luaL_Reg iis_resp[] =
45 | {
46 | { "clear", iislua_resp_clear },
47 | { "clear_headers", iislua_resp_clear_headers },
48 | { "get_headers", iislua_resp_get_headers },
49 | { "get_status", iislua_resp_get_status },
50 | { "set_header", iislua_resp_set_header },
51 | { "set_status", iislua_resp_set_status },
52 | { NULL, NULL }
53 | };
54 |
55 | static const luaL_Reg iis_srv[] =
56 | {
57 | { "get_variable", iislua_srv_get_variable },
58 | { "set_variable", iislua_srv_set_variable },
59 | { NULL, NULL }
60 | };
61 |
62 | static const luaL_Reg iis_user[] =
63 | {
64 | { "get_name", iislua_user_get_name },
65 | { "get_type", iislua_user_get_type },
66 | { NULL, NULL }
67 | };
68 |
69 | static const luaL_Reg iis_socket[] =
70 | {
71 | { "tcp", iislua_socket_tcp },
72 | { NULL, NULL }
73 | };
74 |
75 | lua_State* iislua_newstate()
76 | {
77 | auto L = luaL_newstate();
78 |
79 | luaL_openlibs(L);
80 |
81 | // create iis
82 | luaL_newlib(L, iis);
83 |
84 | // create iis.log
85 | luaL_newlib(L, iis_log);
86 | lua_setfield(L, -2, "log");
87 |
88 | // create iis.req
89 | luaL_newlib(L, iis_req);
90 | lua_setfield(L, -2, "req");
91 |
92 | // create iis.resp
93 | luaL_newlib(L, iis_resp);
94 | lua_setfield(L, -2, "resp");
95 |
96 | // create iis.srv
97 | luaL_newlib(L, iis_srv);
98 | lua_setfield(L, -2, "srv");
99 |
100 | // create iis.user
101 | luaL_newlib(L, iis_user);
102 | lua_setfield(L, -2, "user");
103 |
104 | // create iis.socket
105 | luaL_newlib(L, iis_socket);
106 | lua_setfield(L, -2, "socket");
107 |
108 | // register iis
109 | lua_setglobal(L, "iis");
110 |
111 | // create iis.socket.tcp
112 | lua_pushlightuserdata(L, &iislua_socket_tcp_metatable);
113 | lua_createtable(L, 0, 0);
114 |
115 | lua_pushcfunction(L, iislua_socket_tcp_connect);
116 | lua_setfield(L, -2, "connect");
117 |
118 | lua_pushcfunction(L, iislua_socket_tcp_send);
119 | lua_setfield(L, -2, "send");
120 |
121 | lua_pushcfunction(L, iislua_socket_tcp_receive);
122 | lua_setfield(L, -2, "receive");
123 |
124 | lua_pushcfunction(L, iislua_socket_tcp_close);
125 | lua_setfield(L, -2, "close");
126 |
127 | lua_pushvalue(L, -1);
128 | lua_setfield(L, -2, "__index");
129 |
130 | // save metatable
131 | lua_rawset(L, LUA_REGISTRYINDEX);
132 |
133 | return L;
134 | }
135 |
136 | void iislua_close(lua_State* L)
137 | {
138 | lua_close(L);
139 | }
140 |
141 | void iislua_load_file(lua_State* L, const char* name, const char* file)
142 | {
143 | if (strlen(file) == 0)
144 | {
145 | return;
146 | }
147 |
148 | luaL_loadfile(L, file);
149 | lua_setglobal(L, name);
150 | }
151 |
152 | void iislua_init(lua_State* L, IHttpContext* ctx, IHttpEventProvider* provider)
153 | {
154 | iislua_set_http_ctx(L, ctx);
155 | iislua_set_http_provider(L, provider);
156 |
157 | iislua_set_result(L, RQ_NOTIFICATION_CONTINUE);
158 | }
159 |
160 | IHttpContext* iislua_get_http_ctx(lua_State* L)
161 | {
162 | lua_getglobal(L, iislua_ctx_key);
163 |
164 | auto ctx = reinterpret_cast(lua_touserdata(L, -1));
165 |
166 | lua_pop(L, 1);
167 |
168 | return ctx;
169 | }
170 |
171 | void iislua_set_http_ctx(lua_State* L, IHttpContext* ctx)
172 | {
173 | lua_pushlightuserdata(L, ctx);
174 | lua_setglobal(L, iislua_ctx_key);
175 | }
176 |
177 | IHttpEventProvider* iislua_get_http_provider(lua_State* L)
178 | {
179 | lua_getglobal(L, iialua_provider_key);
180 |
181 | auto provider = reinterpret_cast(lua_touserdata(L, -1));
182 |
183 | lua_pop(L, 1);
184 |
185 | return provider;
186 | }
187 |
188 | void iislua_set_http_provider(lua_State* L, IHttpEventProvider* provider)
189 | {
190 | lua_pushlightuserdata(L, provider);
191 | lua_setglobal(L, iialua_provider_key);
192 | }
193 |
194 | REQUEST_NOTIFICATION_STATUS iislua_finish_request(lua_State* L)
195 | {
196 | lua_getglobal(L, iislua_result_key);
197 |
198 | auto result = static_cast(lua_tointeger(L, -1));
199 |
200 | lua_pop(L, 1);
201 |
202 | return result;
203 | }
204 |
205 | void iislua_set_result(lua_State* L, REQUEST_NOTIFICATION_STATUS result)
206 | {
207 | lua_pushinteger(L, result);
208 | lua_setglobal(L, iislua_result_key);
209 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_core.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class CLuaHttpStoredContext;
4 | class CModuleConfiguration;
5 |
6 | lua_State* iislua_newstate();
7 | void iislua_close(lua_State* L);
8 |
9 | void iislua_load_file(lua_State* L, const char* name, const char* file);
10 |
11 | void iislua_init(lua_State* L, IHttpContext* ctx, IHttpEventProvider* provider);
12 | REQUEST_NOTIFICATION_STATUS iislua_finish_request(lua_State* L);
13 |
14 | IHttpContext* iislua_get_http_ctx(lua_State* L);
15 | void iislua_set_http_ctx(lua_State* L, IHttpContext* ctx);
16 |
17 | IHttpEventProvider* iislua_get_http_provider(lua_State* L);
18 | void iislua_set_http_provider(lua_State* L, IHttpEventProvider* provider);
19 |
20 | void iislua_set_result(lua_State* L, REQUEST_NOTIFICATION_STATUS result = RQ_NOTIFICATION_FINISH_REQUEST);
--------------------------------------------------------------------------------
/src/iislua/iislua_log.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | int iislua_log_read_entry(lua_State* L)
5 | {
6 | auto provider = reinterpret_cast(iislua_get_http_provider(L));
7 |
8 | if (!provider->GetReadyToLogData())
9 | {
10 | return 0;
11 | }
12 |
13 | auto pLogData = reinterpret_cast(provider->GetLogData());
14 |
15 | auto name = luaL_checkstring(L, 1);
16 |
17 | lua_pushstring(L, pLogData->ClientIp);
18 |
19 | return 0;
20 | }
21 |
22 | int iislua_log_write_entry(lua_State* L)
23 | {
24 | auto ctx = iislua_get_http_ctx(L);
25 | auto provider = reinterpret_cast(iislua_get_http_provider(L));
26 |
27 | if (!provider->GetReadyToLogData())
28 | {
29 | return 0;
30 | }
31 |
32 | auto pLogData = reinterpret_cast(provider->GetLogData());
33 |
34 | auto name = luaL_checkstring(L, 1);
35 | auto value = luaL_checkstring(L, 2);
36 |
37 | auto size = strlen(value);
38 | auto newValue = reinterpret_cast(ctx->AllocateRequestMemory(size + 1));
39 |
40 | strcpy_s(newValue, size + 1, value);
41 |
42 | pLogData->ClientIp = newValue;
43 | pLogData->ClientIpLength = size;
44 |
45 | provider->SetLogData(reinterpret_cast(pLogData));
46 |
47 | return 0;
48 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_log.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | IISLUA_API int iislua_log_read_entry(lua_State* L);
4 | IISLUA_API int iislua_log_write_entry(lua_State* L);
--------------------------------------------------------------------------------
/src/iislua/iislua_req.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | int iislua_req_get_headers(lua_State* L)
5 | {
6 | auto ctx = iislua_get_http_ctx(L);
7 |
8 | if (ctx == NULL)
9 | {
10 | return luaL_error(L, "context is null");
11 | }
12 |
13 | auto headers = ctx->GetRequest()->GetRawHttpRequest()->Headers;
14 |
15 | lua_createtable(L, 0, headers.UnknownHeaderCount);
16 |
17 | for (USHORT i = 0; i < HttpHeaderRequestMaximum; i++)
18 | {
19 | if (headers.KnownHeaders[i].pRawValue != NULL)
20 | {
21 | lua_pushstring(L, iislua_util_get_http_req_header(i));
22 | lua_pushlstring(L, headers.KnownHeaders[i].pRawValue, headers.KnownHeaders[i].RawValueLength);
23 | lua_settable(L, -3);
24 | }
25 | }
26 |
27 | for (USHORT i = 0; i < headers.UnknownHeaderCount; i++)
28 | {
29 | lua_pushlstring(L, headers.pUnknownHeaders[i].pName, headers.pUnknownHeaders[i].NameLength);
30 | lua_pushlstring(L, headers.pUnknownHeaders[i].pRawValue, headers.pUnknownHeaders[i].RawValueLength);
31 | lua_settable(L, -3);
32 | }
33 |
34 | return 1;
35 | }
36 |
37 | int iislua_req_get_method(lua_State* L)
38 | {
39 | auto ctx = iislua_get_http_ctx(L);
40 |
41 | if (ctx == NULL)
42 | {
43 | return luaL_error(L, "context is null");
44 | }
45 |
46 | lua_pushstring(L, ctx->GetRequest()->GetHttpMethod());
47 |
48 | return 1;
49 | }
50 |
51 | int iislua_req_get_post_args(lua_State* L)
52 | {
53 | auto ctx = iislua_get_http_ctx(L);
54 |
55 | if (ctx == NULL)
56 | {
57 | return luaL_error(L, "context is null");
58 | }
59 |
60 | lua_createtable(L, 0, 0);
61 |
62 | return 1;
63 | }
64 |
65 | int iislua_req_get_remote_addr(lua_State* L)
66 | {
67 | auto ctx = iislua_get_http_ctx(L);
68 |
69 | if (ctx == NULL)
70 | {
71 | return luaL_error(L, "context is null");
72 | }
73 |
74 | auto remoteAddr = ctx->GetRequest()->GetRemoteAddress();
75 |
76 | char ipAddress[INET6_ADDRSTRLEN];
77 |
78 | if (remoteAddr->sa_family == AF_INET)
79 | {
80 | inet_ntop(AF_INET, &reinterpret_cast(remoteAddr)->sin_addr, ipAddress, sizeof(ipAddress));
81 | }
82 | else
83 | {
84 | inet_ntop(AF_INET6, &reinterpret_cast(remoteAddr)->sin6_addr, ipAddress, sizeof(ipAddress));
85 | }
86 |
87 | lua_pushstring(L, ipAddress);
88 |
89 | return 1;
90 | }
91 |
92 | int iislua_req_get_url(lua_State* L)
93 | {
94 | auto ctx = iislua_get_http_ctx(L);
95 |
96 | if (ctx == NULL)
97 | {
98 | return luaL_error(L, "context is null");
99 | }
100 |
101 | auto url = iislua_to_str(ctx->GetRequest()->GetRawHttpRequest()->CookedUrl.pAbsPath);
102 |
103 | lua_pushstring(L, url.c_str());
104 |
105 | return 1;
106 | }
107 |
108 | int iislua_req_get_url_args(lua_State* L)
109 | {
110 | auto ctx = iislua_get_http_ctx(L);
111 |
112 | if (ctx == NULL)
113 | {
114 | return luaL_error(L, "context is null");
115 | }
116 |
117 | lua_createtable(L, 0, 0);
118 |
119 | if (ctx->GetRequest()->GetRawHttpRequest()->CookedUrl.pQueryString != NULL)
120 | {
121 | auto queryString = iislua_to_str(ctx->GetRequest()->GetRawHttpRequest()->CookedUrl.pQueryString);
122 | }
123 |
124 | return 1;
125 | }
126 |
127 | int iislua_req_http_version(lua_State* L)
128 | {
129 | auto ctx = iislua_get_http_ctx(L);
130 |
131 | if (ctx == NULL)
132 | {
133 | return luaL_error(L, "context is null");
134 | }
135 |
136 | USHORT major, minor;
137 | char version[4];
138 |
139 | ctx->GetRequest()->GetHttpVersion(&major, &minor);
140 |
141 | sprintf_s(version, "%d.%d", major, minor);
142 |
143 | lua_pushstring(L, version);
144 |
145 | return 1;
146 | }
147 |
148 | int iislua_req_set_header(lua_State* L)
149 | {
150 | CHECK_ARGUMENT(L, 2);
151 |
152 | auto ctx = iislua_get_http_ctx(L);
153 |
154 | if (ctx == NULL)
155 | {
156 | return luaL_error(L, "context is null");
157 | }
158 |
159 | auto name = luaL_checkstring(L, 1);
160 | auto value = luaL_checkstring(L, 2);
161 |
162 | ctx->GetRequest()->SetHeader(name, value, static_cast(strlen(value)), TRUE);
163 |
164 | return 0;
165 | }
166 |
167 | int iislua_req_set_method(lua_State* L)
168 | {
169 | CHECK_ARGUMENT(L, 1);
170 |
171 | auto ctx = iislua_get_http_ctx(L);
172 |
173 | if (ctx == NULL)
174 | {
175 | return luaL_error(L, "context is null");
176 | }
177 |
178 | auto method = luaL_checkstring(L, 1);
179 |
180 | ctx->GetRequest()->SetHttpMethod(method);
181 |
182 | return 0;
183 | }
184 |
185 | int iislua_req_set_url(lua_State* L)
186 | {
187 | CHECK_ARGUMENT(L, 1);
188 |
189 | auto ctx = iislua_get_http_ctx(L);
190 |
191 | if (ctx == NULL)
192 | {
193 | return luaL_error(L, "context is null");
194 | }
195 |
196 | auto url = luaL_checkstring(L, 1);
197 |
198 | ctx->GetRequest()->SetUrl(url, static_cast(strlen(url)), TRUE);
199 |
200 | return 0;
201 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_req.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | IISLUA_API int iislua_req_get_headers(lua_State* L);
4 | IISLUA_API int iislua_req_get_method(lua_State* L);
5 | IISLUA_API int iislua_req_get_post_args(lua_State* L);
6 | IISLUA_API int iislua_req_get_remote_addr(lua_State* L);
7 | IISLUA_API int iislua_req_get_url(lua_State* L);
8 | IISLUA_API int iislua_req_get_url_args(lua_State* L);
9 | IISLUA_API int iislua_req_http_version(lua_State* L);
10 | IISLUA_API int iislua_req_set_header(lua_State* L);
11 | IISLUA_API int iislua_req_set_method(lua_State* L);
12 | IISLUA_API int iislua_req_set_url(lua_State* L);
--------------------------------------------------------------------------------
/src/iislua/iislua_resp.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | int iislua_resp_clear(lua_State* L)
5 | {
6 | auto ctx = iislua_get_http_ctx(L);
7 |
8 | if (ctx == NULL)
9 | {
10 | return luaL_error(L, "context is null");
11 | }
12 |
13 | ctx->GetResponse()->Clear();
14 |
15 | return 0;
16 | }
17 |
18 | int iislua_resp_clear_headers(lua_State* L)
19 | {
20 | auto ctx = iislua_get_http_ctx(L);
21 |
22 | if (ctx == NULL)
23 | {
24 | return luaL_error(L, "context is null");
25 | }
26 |
27 | ctx->GetResponse()->ClearHeaders();
28 |
29 | return 0;
30 | }
31 |
32 | int iislua_resp_get_headers(lua_State* L)
33 | {
34 | auto ctx = iislua_get_http_ctx(L);
35 |
36 | if (ctx == NULL)
37 | {
38 | return luaL_error(L, "context is null");
39 | }
40 |
41 | auto headers = ctx->GetResponse()->GetRawHttpResponse()->Headers;
42 |
43 | lua_createtable(L, 0, headers.UnknownHeaderCount);
44 |
45 | for (USHORT i = 0; i < HttpHeaderResponseMaximum; i++)
46 | {
47 | if (headers.KnownHeaders[i].pRawValue != NULL)
48 | {
49 | lua_pushstring(L, iislua_util_get_http_resp_header(i));
50 | lua_pushlstring(L, headers.KnownHeaders[i].pRawValue, headers.KnownHeaders[i].RawValueLength);
51 | lua_settable(L, -3);
52 | }
53 | }
54 |
55 | for (USHORT i = 0; i < headers.UnknownHeaderCount; i++)
56 | {
57 | lua_pushlstring(L, headers.pUnknownHeaders[i].pName, headers.pUnknownHeaders[i].NameLength);
58 | lua_pushlstring(L, headers.pUnknownHeaders[i].pRawValue, headers.pUnknownHeaders[i].RawValueLength);
59 | lua_settable(L, -3);
60 | }
61 |
62 | return 1;
63 | }
64 |
65 | int iislua_resp_get_status(lua_State* L)
66 | {
67 | auto ctx = iislua_get_http_ctx(L);
68 |
69 | if (ctx == NULL)
70 | {
71 | return luaL_error(L, "context is null");
72 | }
73 |
74 | USHORT status;
75 | ctx->GetResponse()->GetStatus(&status);
76 |
77 | lua_pushinteger(L, status);
78 |
79 | return 1;
80 | }
81 |
82 | int iislua_resp_set_header(lua_State* L)
83 | {
84 | CHECK_ARGUMENT(L, 2);
85 |
86 | auto ctx = iislua_get_http_ctx(L);
87 |
88 | if (ctx == NULL)
89 | {
90 | return luaL_error(L, "context is null");
91 | }
92 |
93 | auto name = luaL_checkstring(L, 1);
94 | auto value = luaL_checkstring(L, 2);
95 |
96 | ctx->GetResponse()->SetHeader(name, value, static_cast(strlen(value)), TRUE);
97 |
98 | return 0;
99 | }
100 |
101 | int iislua_resp_set_status(lua_State* L)
102 | {
103 | CHECK_ARGUMENT(L, 1);
104 |
105 | auto ctx = iislua_get_http_ctx(L);
106 |
107 | if (ctx == NULL)
108 | {
109 | return luaL_error(L, "context is null");
110 | }
111 |
112 | auto status = static_cast(luaL_checkinteger(L, 1));
113 |
114 | ctx->GetResponse()->SetStatus(status, iislua_util_get_status_reason(status));
115 |
116 | return 0;
117 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_resp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | IISLUA_API int iislua_resp_clear(lua_State* L);
4 | IISLUA_API int iislua_resp_clear_headers(lua_State* L);
5 | IISLUA_API int iislua_resp_get_headers(lua_State* L);
6 | IISLUA_API int iislua_resp_get_status(lua_State* L);
7 | IISLUA_API int iislua_resp_set_header(lua_State* L);
8 | IISLUA_API int iislua_resp_set_status(lua_State* L);
--------------------------------------------------------------------------------
/src/iislua/iislua_socket_tcp.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | struct socket_data
5 | {
6 | SOCKET sock;
7 | bool connected;
8 | bool closed;
9 | };
10 |
11 | char iislua_socket_tcp_metatable;
12 |
13 | int iislua_socket_tcp_release(lua_State* L)
14 | {
15 | auto data = reinterpret_cast(lua_touserdata(L, -1));
16 |
17 | if (!data->closed)
18 | {
19 | closesocket(data->sock);
20 | }
21 |
22 | return 0;
23 | }
24 |
25 | int iislua_socket_tcp(lua_State* L)
26 | {
27 | // create new object
28 | lua_createtable(L, 0, 0);
29 | lua_pushlightuserdata(L, &iislua_socket_tcp_metatable);
30 | lua_rawget(L, LUA_REGISTRYINDEX);
31 | lua_setmetatable(L, -2);
32 |
33 | return 1;
34 | }
35 |
36 | int iislua_socket_tcp_connect(lua_State* L)
37 | {
38 | if (lua_gettop(L) != 3)
39 | {
40 | return luaL_error(L, "argument error");
41 | }
42 |
43 | auto ctx = iislua_get_http_ctx(L);
44 |
45 | if (ctx == NULL)
46 | {
47 | return luaL_error(L, "context is null");
48 | }
49 |
50 | auto config = CModuleConfiguration::GetConfig(ctx);
51 |
52 | luaL_checktype(L, 1, LUA_TTABLE);
53 |
54 | auto host = luaL_checkstring(L, 2);
55 | auto port = luaL_checkinteger(L, 3);
56 |
57 | auto sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
58 |
59 | // create socket_data
60 | auto data = reinterpret_cast(lua_newuserdata(L, sizeof(socket_data)));
61 |
62 | data->sock = sock;
63 | data->connected = false;
64 | data->closed = false;
65 |
66 | lua_createtable(L, 0, 1);
67 |
68 | lua_pushcfunction(L, iislua_socket_tcp_release);
69 | lua_setfield(L, -2, "__gc");
70 |
71 | lua_setmetatable(L, -2);
72 |
73 | lua_rawseti(L, 1, 1);
74 |
75 | // winsock2 connect
76 | auto h = WSACreateEvent();
77 |
78 | WSAEventSelect(sock, h, FD_CONNECT);
79 |
80 | ADDRINFO hints;
81 | LPADDRINFO list;
82 |
83 | ZeroMemory(&hints, sizeof(hints));
84 | hints.ai_socktype = SOCK_STREAM;
85 | hints.ai_family = AF_INET;
86 |
87 | char service[6];
88 | sprintf_s(service, "%d", (int)port);
89 |
90 | if (getaddrinfo(host, service, &hints, &list) != 0)
91 | {
92 | return 0;
93 | }
94 |
95 | connect(sock, list->ai_addr, (int)list->ai_addrlen);
96 |
97 | if (WSAWaitForMultipleEvents(1, &h, FALSE, config->GetConnectTimeout(), FALSE) == WSA_WAIT_EVENT_0)
98 | {
99 | WSANETWORKEVENTS events;
100 |
101 | WSAEnumNetworkEvents(sock, h, &events);
102 |
103 | if ((events.lNetworkEvents & FD_CONNECT) && events.iErrorCode[FD_CONNECT_BIT] == 0)
104 | {
105 | data->connected = true;
106 | }
107 | }
108 |
109 | WSAEventSelect(sock, NULL, 0);
110 | WSACloseEvent(h);
111 |
112 | return 0;
113 | }
114 |
115 | int iislua_socket_tcp_send(lua_State* L)
116 | {
117 | if (lua_gettop(L) != 2)
118 | {
119 | return luaL_error(L, "argument error");
120 | }
121 |
122 | auto ctx = iislua_get_http_ctx(L);
123 |
124 | if (ctx == NULL)
125 | {
126 | return luaL_error(L, "context is null");
127 | }
128 |
129 | auto config = CModuleConfiguration::GetConfig(ctx);
130 |
131 | luaL_checktype(L, 1, LUA_TTABLE);
132 |
133 | auto sendData = luaL_checkstring(L, 2);
134 |
135 | lua_rawgeti(L, 1, 1);
136 | auto data = reinterpret_cast(lua_touserdata(L, -1));
137 | lua_pop(L, 1);
138 |
139 | auto h = WSACreateEvent();
140 |
141 | WSAEventSelect(data->sock, h, FD_WRITE | FD_CLOSE);
142 |
143 | if (WSAWaitForMultipleEvents(1, &h, FALSE, config->GetSendTimeout(), FALSE) != WSA_WAIT_FAILED)
144 | {
145 | WSANETWORKEVENTS events;
146 |
147 | WSAEnumNetworkEvents(data->sock, h, &events);
148 |
149 | if (events.lNetworkEvents & FD_CLOSE)
150 | {
151 | closesocket(data->sock);
152 | data->closed = true;
153 | }
154 | else if (events.lNetworkEvents & FD_WRITE)
155 | {
156 | send(data->sock, sendData, (int)strlen(sendData), 0);
157 | }
158 | }
159 |
160 | WSAEventSelect(data->sock, NULL, 0);
161 | WSACloseEvent(h);
162 |
163 | return 0;
164 | }
165 |
166 | int iislua_socket_tcp_receive(lua_State* L)
167 | {
168 | if (lua_gettop(L) != 2)
169 | {
170 | return luaL_error(L, "argument error");
171 | }
172 |
173 | auto ctx = iislua_get_http_ctx(L);
174 |
175 | if (ctx == NULL)
176 | {
177 | return luaL_error(L, "context is null");
178 | }
179 |
180 | auto config = CModuleConfiguration::GetConfig(ctx);
181 |
182 | luaL_checktype(L, 1, LUA_TTABLE);
183 |
184 | auto size = luaL_checkinteger(L, 2);
185 |
186 | lua_rawgeti(L, 1, 1);
187 | auto data = reinterpret_cast(lua_touserdata(L, -1));
188 | lua_pop(L, 1);
189 |
190 | auto h = WSACreateEvent();
191 |
192 | WSAEventSelect(data->sock, h, FD_READ | FD_CLOSE);
193 |
194 | if (WSAWaitForMultipleEvents(1, &h, FALSE, config->GetReadTimeout(), FALSE) != WSA_WAIT_FAILED)
195 | {
196 | WSANETWORKEVENTS events;
197 |
198 | WSAEnumNetworkEvents(data->sock, h, &events);
199 |
200 | if (events.lNetworkEvents & FD_CLOSE)
201 | {
202 | closesocket(data->sock);
203 | data->closed = true;
204 |
205 | lua_pushnil(L);
206 | }
207 | else if (events.lNetworkEvents & FD_READ)
208 | {
209 | std::vector buffer(size);
210 |
211 | int len = recv(data->sock, &buffer[0], (int)size, 0);
212 |
213 | lua_pushlstring(L, &buffer[0], len);
214 | }
215 | }
216 | else
217 | {
218 | lua_pushnil(L);
219 | }
220 |
221 | WSAEventSelect(data->sock, NULL, 0);
222 | WSACloseEvent(h);
223 |
224 | return 1;
225 | }
226 |
227 | int iislua_socket_tcp_close(lua_State* L)
228 | {
229 | luaL_checktype(L, 1, LUA_TTABLE);
230 |
231 | lua_rawgeti(L, 1, 1);
232 |
233 | auto data = reinterpret_cast(lua_touserdata(L, -1));
234 |
235 | lua_pop(L, 1);
236 |
237 | if (!data->closed)
238 | {
239 | closesocket(data->sock);
240 | }
241 |
242 | return 0;
243 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_socket_tcp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | IISLUA_API int iislua_socket_tcp(lua_State* L);
4 | IISLUA_API int iislua_socket_tcp_connect(lua_State* L);
5 | IISLUA_API int iislua_socket_tcp_send(lua_State* L);
6 | IISLUA_API int iislua_socket_tcp_receive(lua_State* L);
7 | IISLUA_API int iislua_socket_tcp_close(lua_State* L);
--------------------------------------------------------------------------------
/src/iislua/iislua_srv.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | int iislua_srv_get_variable(lua_State* L)
5 | {
6 | CHECK_ARGUMENT(L, 1);
7 |
8 | auto ctx = iislua_get_http_ctx(L);
9 |
10 | if (ctx == NULL)
11 | {
12 | return luaL_error(L, "context is null");
13 | }
14 |
15 | auto name = luaL_checkstring(L, 1);
16 |
17 | PCSTR value;
18 | DWORD length;
19 |
20 | ctx->GetServerVariable(name, &value, &length);
21 |
22 | lua_pushlstring(L, value, length);
23 |
24 | return 1;
25 | }
26 |
27 | int iislua_srv_set_variable(lua_State* L)
28 | {
29 | CHECK_ARGUMENT(L, 2);
30 |
31 | auto ctx = iislua_get_http_ctx(L);
32 |
33 | if (ctx == NULL)
34 | {
35 | return luaL_error(L, "context is null");
36 | }
37 |
38 | auto name = luaL_checkstring(L, 1);
39 | auto value = iislua_to_wstr(luaL_checkstring(L, 2));
40 |
41 | ctx->SetServerVariable(name, value.c_str());
42 |
43 | return 0;
44 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_srv.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | IISLUA_API int iislua_srv_get_variable(lua_State* L);
4 | IISLUA_API int iislua_srv_set_variable(lua_State* L);
--------------------------------------------------------------------------------
/src/iislua/iislua_user.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | int iislua_user_get_name(lua_State* L)
5 | {
6 | auto ctx = iislua_get_http_ctx(L);
7 |
8 | if (ctx == NULL)
9 | {
10 | return luaL_error(L, "context is null");
11 | }
12 |
13 | auto name = iislua_to_str(ctx->GetUser()->GetUserName());
14 |
15 | lua_pushstring(L, name.c_str());
16 |
17 | return 1;
18 | }
19 |
20 | int iislua_user_get_type(lua_State* L)
21 | {
22 | auto ctx = iislua_get_http_ctx(L);
23 |
24 | if (ctx == NULL)
25 | {
26 | return luaL_error(L, "context is null");
27 | }
28 |
29 | auto name = iislua_to_str(ctx->GetUser()->GetAuthenticationType());
30 |
31 | lua_pushstring(L, name.c_str());
32 |
33 | return 1;
34 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_user.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | IISLUA_API int iislua_user_get_name(lua_State* L);
4 | IISLUA_API int iislua_user_get_type(lua_State* L);
--------------------------------------------------------------------------------
/src/iislua/iislua_util.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | static PCSTR iislua_http_header_id_to_req_name[] =
5 | {
6 | "Cache-Control",
7 | "Connection",
8 | "Date",
9 | "Keep-Alive",
10 | "Pragma",
11 | "Trailer",
12 | "Transfer-Encoding",
13 | "Upgrade",
14 | "Via",
15 | "Warning",
16 | "Allow",
17 | "Content-Length",
18 | "Content-Type",
19 | "Content-Encoding",
20 | "Content-Language",
21 | "Content-Location",
22 | "Content-MD5",
23 | "Content-Range",
24 | "Expires",
25 | "Last-Modified",
26 | "Accept",
27 | "Accept-Charset",
28 | "Accept-Encoding",
29 | "Accept-Language",
30 | "Authorization",
31 | "Cookie",
32 | "Expect",
33 | "From",
34 | "Host",
35 | "If-Match",
36 | "If-Modified-Since",
37 | "If-None-Match",
38 | "If-Range",
39 | "If-Unmodified-Since",
40 | "Max-Forwards",
41 | "Proxy-Authorization",
42 | "Referer",
43 | "Range",
44 | "Te",
45 | "Translate",
46 | "User-Agent"
47 | };
48 |
49 | static PCSTR iislua_http_header_id_to_resp_name[] =
50 | {
51 | "Cache-Control",
52 | "Connection",
53 | "Date",
54 | "Keep-Alive",
55 | "Pragma",
56 | "Trailer",
57 | "Transfer-Encoding",
58 | "Upgrade",
59 | "Via",
60 | "Warning",
61 | "Allow",
62 | "Content-Length",
63 | "Content-Type",
64 | "Content-Encoding",
65 | "Content-Language",
66 | "Content-Location",
67 | "Content-MD5",
68 | "Content-Range",
69 | "Expires",
70 | "Last-Modified",
71 | "Accept-Ranges",
72 | "Age",
73 | "ETag",
74 | "Location",
75 | "Proxy-Authenticate",
76 | "Retry-After",
77 | "Server",
78 | "Set-Cookie",
79 | "Vary",
80 | "WWW-Authenticate"
81 | };
82 |
83 | PCSTR iislua_util_get_http_req_header(USHORT id)
84 | {
85 | return iislua_http_header_id_to_req_name[id];
86 | }
87 |
88 | PCSTR iislua_util_get_http_resp_header(USHORT id)
89 | {
90 | return iislua_http_header_id_to_resp_name[id];
91 | }
92 |
93 | PCSTR iislua_util_get_status_reason(USHORT status)
94 | {
95 | switch (status)
96 | {
97 | case 100:
98 | return "Continue";
99 | case 101:
100 | return "Switching Protocols";
101 | case 200:
102 | return "OK";
103 | case 201:
104 | return "Created";
105 | case 202:
106 | return "Accepted";
107 | case 204:
108 | return "No Content";
109 | case 205:
110 | return "Reset Content";
111 | case 206:
112 | return "Partial Content";
113 | case 301:
114 | return "Moved Permanently";
115 | case 302:
116 | return "Found";
117 | case 303:
118 | return "See Other";
119 | case 304:
120 | return "Not Modified";
121 | case 307:
122 | return "Temporary Redirect";
123 | case 400:
124 | return "Bad Request";
125 | case 401:
126 | return "Unauthorized";
127 | case 403:
128 | return "Forbidden";
129 | case 404:
130 | return "Not Found";
131 | case 405:
132 | return "Method Not Allowed";
133 | case 406:
134 | return "Not Acceptable";
135 | case 407:
136 | return "Proxy Authentication Required";
137 | case 408:
138 | return "Request Timeout";
139 | case 409:
140 | return "Conflict";
141 | case 410:
142 | return "Gone";
143 | case 415:
144 | return "Unsupported Media Type";
145 | case 500:
146 | return "Internal Server Error";
147 | case 501:
148 | return "Not Implemented";
149 | case 502:
150 | return "Bad Gateway";
151 | case 503:
152 | return "Service Unavailable";
153 | case 504:
154 | return "Gateway Timeout";
155 | default:
156 | return "Unknown Reason";
157 | }
158 | }
159 |
160 | std::string iislua_to_str(PCWSTR wstr)
161 | {
162 | auto len = wcslen(wstr);
163 |
164 | if (len == 0)
165 | {
166 | return std::string();
167 | }
168 |
169 | size_t i;
170 | std::vector buffer(len * 2 + 1);
171 |
172 | wcstombs_s(&i, &buffer[0], len * 2 + 1, wstr, len);
173 |
174 | return std::string(buffer.begin(), buffer.begin() + i);
175 | }
176 |
177 | std::wstring iislua_to_wstr(PCSTR str)
178 | {
179 | auto len = strlen(str);
180 |
181 | if (len == 0)
182 | {
183 | return std::wstring();
184 | }
185 |
186 | size_t i;
187 | std::vector buffer(len + 1);
188 |
189 | mbstowcs_s(&i, &buffer[0], len + 1, str, len);
190 |
191 | return std::wstring(buffer.begin(), buffer.begin() + i);
192 | }
--------------------------------------------------------------------------------
/src/iislua/iislua_util.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | PCSTR iislua_util_get_http_req_header(USHORT id);
4 | PCSTR iislua_util_get_http_resp_header(USHORT id);
5 |
6 | PCSTR iislua_util_get_status_reason(USHORT status);
7 |
8 | std::string iislua_to_str(PCWSTR wstr);
9 | std::wstring iislua_to_wstr(PCSTR str);
--------------------------------------------------------------------------------
/src/iislua/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "stdafx.h"
3 |
4 | HTTP_MODULE_ID g_pModuleContext;
5 | IHttpServer* g_pHttpServer;
6 |
7 | HRESULT APIENTRY RegisterModule(DWORD dwServerVersion, IHttpModuleRegistrationInfo* pModuleInfo, IHttpServer* pHttpServer)
8 | {
9 | UNREFERENCED_PARAMETER(dwServerVersion);
10 |
11 | g_pModuleContext = pModuleInfo->GetId();
12 | g_pHttpServer = pHttpServer;
13 |
14 | auto hr = pModuleInfo->SetRequestNotifications(new CLuaHttpModuleFactory(), RQ_BEGIN_REQUEST | RQ_AUTHENTICATE_REQUEST | RQ_AUTHORIZE_REQUEST | RQ_EXECUTE_REQUEST_HANDLER | RQ_END_REQUEST | RQ_SEND_RESPONSE | RQ_MAP_PATH, 0);
15 |
16 | if (FAILED(hr))
17 | {
18 | return hr;
19 | }
20 |
21 | return pModuleInfo->SetPriorityForRequestNotification(RQ_SEND_RESPONSE, PRIORITY_ALIAS_HIGH);
22 | }
--------------------------------------------------------------------------------
/src/iislua/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/iislua/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shibayan/iislua/4e5dbb95c1412566a6635f778f134ba5e8415e8b/src/iislua/resource.h
--------------------------------------------------------------------------------
/src/iislua/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shibayan/iislua/4e5dbb95c1412566a6635f778f134ba5e8415e8b/src/iislua/stdafx.cpp
--------------------------------------------------------------------------------
/src/iislua/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shibayan/iislua/4e5dbb95c1412566a6635f778f134ba5e8415e8b/src/iislua/stdafx.h
--------------------------------------------------------------------------------
/src/iislua/targetver.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shibayan/iislua/4e5dbb95c1412566a6635f778f134ba5e8415e8b/src/iislua/targetver.h
--------------------------------------------------------------------------------