├── Extra ├── Home.htm ├── default1.css ├── ifame.htm └── tetris.htm ├── HelpFileCreator.au3 ├── Images ├── WinHttp.jpg ├── back0.png ├── back1.png ├── back2.png ├── ex.png ├── fwd0.png ├── fwd1.png ├── fwd2.png ├── home0.png ├── home1.png ├── print0.png ├── print1.png └── search.png ├── JS ├── Script.js └── Script_Right.js ├── WinHttp.au3 ├── WinHttpConstants.au3 └── WinHttp_Examples ├── _WinHttpAddRequestHeaders.au3 ├── _WinHttpCheckPlatform.au3 ├── _WinHttpCloseHandle.au3 ├── _WinHttpConnect.au3 ├── _WinHttpCrackUrl.au3 ├── _WinHttpCreateUrl.au3 ├── _WinHttpDetectAutoProxyConfigUrl.au3 ├── _WinHttpGetDefaultProxyConfiguration.au3 ├── _WinHttpGetIEProxyConfigForCurrentUser.au3 ├── _WinHttpOpen.au3 ├── _WinHttpOpenRequest.au3 ├── _WinHttpQueryAuthSchemes.au3 ├── _WinHttpQueryDataAvailable.au3 ├── _WinHttpQueryHeaders.au3 ├── _WinHttpQueryOption.au3 ├── _WinHttpReadData.au3 ├── _WinHttpReceiveResponse.au3 ├── _WinHttpSendRequest.au3 ├── _WinHttpSetCredentials.au3 ├── _WinHttpSetDefaultProxyConfiguration.au3 ├── _WinHttpSetOption.au3 ├── _WinHttpSetStatusCallback.au3 ├── _WinHttpSetTimeouts.au3 ├── _WinHttpSimpleBinaryConcat.au3 ├── _WinHttpSimpleFormFill.au3 ├── _WinHttpSimpleFormFill_1.au3 ├── _WinHttpSimpleFormFill_2.au3 ├── _WinHttpSimpleFormFill_3.au3 ├── _WinHttpSimpleFormFill_4.au3 ├── _WinHttpSimpleFormFill_5.au3 ├── _WinHttpSimpleFormFill_6.au3 ├── _WinHttpSimpleFormFill_SetUploadCallback.au3 ├── _WinHttpSimpleReadData.au3 ├── _WinHttpSimpleReadDataAsync.au3 ├── _WinHttpSimpleRequest.au3 ├── _WinHttpSimpleSSLRequest.au3 ├── _WinHttpSimpleSendRequest.au3 ├── _WinHttpSimpleSendSSLRequest.au3 ├── _WinHttpTimeFromSystemTime.au3 ├── _WinHttpTimeToSystemTime.au3 └── _WinHttpWriteData.au3 /Extra/Home.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Intro 5 | 6 | 7 | 8 |

WinHttp-UDFs for AutoIt and this helpfile are created by trancexx and ProgAndy. Current version is 0.0.0.0.

9 |

About WinHTTP (MSDN)

10 |

Microsoft Windows HTTP Services (WinHTTP) provides developers with a server-supported, high-level interface to the HTTP/1.1 Internet protocol. WinHTTP is designed to be used primarily in server-based scenarios by server applications that communicate with HTTP servers.

11 |

WinHTTP is also designed for use in system services and HTTP-based client applications. WinHTTP is more secure and robust than WinINet. However, single-user applications that require FTP or Gopher protocol functionality, cookie persistence, caching, automatic credential dialog handling, Internet Explorer compatibility, or downlevel platform support should consider using WinInet.

12 |

Caution  WinHTTP is not reentrant except during asynchronous completion callback. That is, while a thread has a call pending to one of the WinHTTP functions such as WinHttpSendRequest, WinHttpReceiveResponse, WinHttpQueryDataAvailable, WinHttpSendData, or WinHttpWriteData, it must never call WinHTTP a second time until the first call has completed. One scenario under which a second call could occur is as follows: If an application queues an Asynchronous Procedure Call (APC) to the thread that calls into WinHTTP, and if WinHTTP performs an alertable wait internally, the APC can run. If the APC routine happens also to call WinHTTP, it reenters the WinHTTP API, and the internal state of WinHTTP can be corrupted.

13 |

WinHTTP 5.1 Features

14 |

The following features have been added in version 5.1 of WinHTTP:

15 | 27 |

A number of WinINet features are not supported in WinHTTP, including URL caching and persistent cookies, autoproxy, autodialing, offline support, File Transfer Protocol (FTP), and the Gopher protocol.

28 |

For more information about changes introduced in version 5.1, see What's New in WinHTTP 5.1.

29 |

 

30 |

 

31 |

 

32 |

 

33 | 34 | 35 | -------------------------------------------------------------------------------- /Extra/default1.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | background-color:#fff; 4 | color:#333; 5 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 6 | font-size:14px; 7 | font-weight:400; 8 | } 9 | 10 | form 11 | { 12 | padding-top:13px; 13 | border:0; 14 | } 15 | 16 | input 17 | { 18 | line-height:21px; 19 | color:gray; 20 | width:200px; 21 | height:27px; 22 | vertical-align:top; 23 | border:1px solid silver; 24 | } 25 | 26 | table 27 | { 28 | border-collapse:collapse; 29 | border-color:silver; 30 | border-style:solid; 31 | border-width:1px; 32 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 33 | font-size:14px; 34 | width:100%; 35 | } 36 | 37 | table.main 38 | { 39 | border:0; 40 | } 41 | 42 | th 43 | { 44 | background-color:#eee; 45 | border-collapse:collapse; 46 | border-color:silver; 47 | border-style:solid; 48 | border-width:1px; 49 | color:#666; 50 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 51 | padding:4px; 52 | text-align:left; 53 | } 54 | 55 | th a 56 | { 57 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 58 | text-decoration:none; 59 | } 60 | 61 | th a:link 62 | { 63 | color:#03697A; 64 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 65 | text-decoration:none; 66 | } 67 | 68 | th a:visited 69 | { 70 | color:#03697A; 71 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 72 | text-decoration:none; 73 | } 74 | 75 | th a:active 76 | { 77 | color:#00709F; 78 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 79 | text-decoration:none; 80 | } 81 | 82 | th a:hover 83 | { 84 | color:#00709F; 85 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 86 | text-decoration:underline; 87 | } 88 | 89 | tr.main 90 | { 91 | border:0; 92 | } 93 | 94 | th.left 95 | { 96 | width:25%; 97 | } 98 | 99 | th.right 100 | { 101 | width:75%; 102 | } 103 | 104 | td.leftpane 105 | { 106 | width:20%; 107 | } 108 | 109 | td.left 110 | { 111 | border:0; 112 | } 113 | 114 | td.rightpane 115 | { 116 | width:80%; 117 | } 118 | 119 | td.right 120 | { 121 | border:0; 122 | } 123 | 124 | td.search 125 | { 126 | border:0; 127 | text-align: center; 128 | padding-top:0px; 129 | padding-bottom:0px; 130 | } 131 | 132 | td.nav 133 | { 134 | border:0; 135 | text-align: left; 136 | padding-top:0px; 137 | padding-bottom:0px; 138 | } 139 | 140 | td.resize 141 | { 142 | background:white; 143 | border-left:0; 144 | border-right:0; 145 | border-top:0; 146 | border-bottom:0; 147 | width:0px; 148 | cursor:w-resize; 149 | padding:0px; 150 | } 151 | 152 | iframe 153 | { 154 | border:0px; 155 | } 156 | 157 | th.new 158 | { 159 | width:224px; 160 | } 161 | 162 | th.old 163 | { 164 | width:226px; 165 | } 166 | 167 | tr 168 | { 169 | border-collapse:collapse; 170 | border-color:silver; 171 | border-style:solid; 172 | border-width:1px; 173 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 174 | font-size:14px; 175 | padding:4px; 176 | } 177 | 178 | tr.yellow 179 | { 180 | background-color:#ffff9C; 181 | } 182 | 183 | tr.yellowbold 184 | { 185 | background-color:#ffff9C; 186 | font-weight:700; 187 | } 188 | 189 | td 190 | { 191 | border-collapse:collapse; 192 | border-color:silver; 193 | border-style:solid; 194 | border-width:1px; 195 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 196 | font-size:14px; 197 | padding:4px; 198 | } 199 | 200 | td.center 201 | { 202 | text-align:center; 203 | } 204 | 205 | td.right 206 | { 207 | text-align:right; 208 | } 209 | 210 | td.sep 211 | { 212 | border-color:white silver; 213 | } 214 | 215 | td.tooltip 216 | { 217 | border-width: 0px; 218 | font-size : 16px; 219 | font-style : italic; 220 | text-align: center; 221 | width: 120px; 222 | } 223 | 224 | b 225 | { 226 | font-weight:700; 227 | } 228 | 229 | p 230 | { 231 | color:#333; 232 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 233 | font-size:14px; 234 | font-weight:400; 235 | margin:0; 236 | padding-bottom:5px; 237 | padding-top:5px; 238 | } 239 | 240 | p.center 241 | { 242 | text-align:center; 243 | } 244 | 245 | .funcdesc 246 | { 247 | font-size:16px; 248 | } 249 | 250 | ol 251 | { 252 | font-size:13px; 253 | } 254 | 255 | ul 256 | { 257 | color:#333; 258 | font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif; 259 | font-size:13px; 260 | padding-left:5px; 261 | margin:0; 262 | } 263 | 264 | ul.cell 265 | { 266 | margin:0 0 0 25px; 267 | } 268 | 269 | .copyright 270 | { 271 | font-size:11px; 272 | border-left: 1px solid #c1c1c1; 273 | margin:10px 0 0 15px; 274 | float:left; 275 | padding:0; 276 | } 277 | 278 | .name 279 | { 280 | font-size:11px; 281 | margin:10px 0 0 15px; 282 | float:left; 283 | padding:0; 284 | } 285 | 286 | .cr 287 | { 288 | display:inline; 289 | padding:0 15px; 290 | } 291 | 292 | .footer 293 | { 294 | border-top: 1px solid #c1c1c1; 295 | float:left; 296 | margin-top:10px; 297 | width:100%; 298 | } 299 | 300 | div 301 | { 302 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 303 | } 304 | 305 | div.indent 306 | { 307 | margin-left:2em; 308 | } 309 | 310 | div.tip 311 | { 312 | background-color: #ffffff; 313 | border: 1px solid #103060; 314 | font-size : large; 315 | width: 120px; 316 | position: absolute; 317 | top: 0px; 318 | left: 0px; 319 | visibility: hidden; 320 | } 321 | 322 | div.result 323 | { 324 | padding-top:3px; 325 | padding-left:3px; 326 | } 327 | 328 | div.result-title 329 | { 330 | font-size:14px; 331 | padding-top:12px; 332 | } 333 | 334 | li 335 | { 336 | list-style-type:none; 337 | padding-left:4px; 338 | } 339 | 340 | li.parent 341 | { 342 | list-style-image:url('../images/bullet.bmp'); 343 | padding-left:0; 344 | } 345 | 346 | li.single 347 | { 348 | list-style-type:none; 349 | padding-left:0; 350 | } 351 | 352 | a 353 | { 354 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 355 | text-decoration:none; 356 | } 357 | 358 | a.nowrap 359 | { 360 | white-space:nowrap; 361 | font-weight:600; 362 | } 363 | 364 | a:link 365 | { 366 | color:#00709f; 367 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 368 | text-decoration:none; 369 | } 370 | 371 | a:visited 372 | { 373 | color:#03697a; 374 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 375 | text-decoration:none; 376 | } 377 | 378 | a:active 379 | { 380 | color:#2a2a2a; 381 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 382 | text-decoration:none; 383 | } 384 | 385 | a:hover 386 | { 387 | color:#3390b1; 388 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 389 | text-decoration:none; 390 | } 391 | 392 | a.ext:link 393 | { 394 | color:#00709f; 395 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 396 | text-decoration:underline; 397 | } 398 | 399 | a.ext:visited 400 | { 401 | color:#03697a; 402 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 403 | text-decoration:underline; 404 | } 405 | 406 | a.ext:active 407 | { 408 | color:#2a2a2a; 409 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 410 | text-decoration:underline; 411 | } 412 | 413 | a.ext:hover 414 | { 415 | color:#3390b1; 416 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 417 | text-decoration:underline; 418 | } 419 | 420 | a.button 421 | { 422 | padding:4px; 423 | margin-left:5px; 424 | background:#E9E9E9; 425 | border:1px solid #999999; 426 | text-decoration:none; 427 | font-size:12px; 428 | line-height:16px; 429 | text-align:center; 430 | color:#444; 431 | cursor:pointer; 432 | } 433 | 434 | h1 435 | { 436 | color:#707070; 437 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 438 | font-size:36px; 439 | font-weight:400; 440 | margin:0; 441 | padding-bottom:33px; 442 | padding-top:15px; 443 | } 444 | 445 | .left_behind 446 | { 447 | color:#A0A0A0; 448 | } 449 | 450 | .small 451 | { 452 | font-size:12px; 453 | margin:-9px 0 -4px; 454 | padding-bottom:0; 455 | padding-top:5px; 456 | } 457 | 458 | h2 459 | { 460 | color:#888; 461 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 462 | font-size:18px; 463 | font-weight:400; 464 | line-height:normal; 465 | padding-bottom:0; 466 | padding-top:20px; 467 | } 468 | 469 | h3 470 | { 471 | color:navy; 472 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 473 | font-size:12px; 474 | font-weight:700; 475 | line-height:normal; 476 | } 477 | 478 | .code 479 | { 480 | font-family:Consolas, "Courier New", Courier, mono; 481 | font-size:12px; 482 | white-space:nowrap; 483 | } 484 | 485 | .codeheader 486 | { 487 | background-color:#eee; 488 | border:1px solid #aaa; 489 | color:#48484c; 490 | font-family:Consolas, "Courier New", Courier, Verdana, Arial; 491 | font-size:12px; 492 | padding:16px; 493 | white-space:normal; 494 | width:90%; 495 | } 496 | 497 | .codelike 498 | { 499 | background-color:#eee; 500 | border:1px solid #aaa; 501 | border-radius:3px; 502 | padding-right:5px; 503 | padding-left:5px; 504 | color:#48484c; 505 | font-family:Consolas, "Courier New", Courier, Verdana, Arial; 506 | font-size:12px; 507 | } 508 | 509 | .codebox 510 | { 511 | background: url('../images/hk.jpg') no-repeat 100% 100%; 512 | background-color:#fff; 513 | border-bottom:1px solid #aaa; 514 | border-left:1px solid #aaa; 515 | border-right:1px solid #aaa; 516 | border-top:1px solid #aaa; 517 | color:#465584; 518 | font-family:Consolas, "Courier New", Courier, Verdana, Arial; 519 | font-size:12px; 520 | overflow-x:auto; 521 | padding:8px 8px 24px; 522 | white-space:nowrap; 523 | width:97%; 524 | } 525 | 526 | .S0 527 | { 528 | color:#2a2a2a; 529 | } 530 | 531 | .S1 532 | { 533 | color:green; 534 | font-style:italic; 535 | } 536 | 537 | .S2 538 | { 539 | color:green; 540 | font-style:italic; 541 | } 542 | 543 | .S3 544 | { 545 | color:#00F; 546 | } 547 | 548 | .S4 549 | { 550 | color:#000090; 551 | } 552 | 553 | .S5 554 | { 555 | color:#00F; 556 | } 557 | 558 | .S6 559 | { 560 | color:olive; 561 | } 562 | 563 | .S7 564 | { 565 | color:red; 566 | } 567 | 568 | .S8 569 | { 570 | color:#FF8000; 571 | } 572 | 573 | .S9 574 | { 575 | color:#2a2a2a; 576 | } 577 | 578 | .S10 579 | { 580 | color:gray; 581 | } 582 | 583 | .S11 584 | { 585 | color:olive; 586 | } 587 | 588 | .S12 589 | { 590 | color:#dc143c; 591 | } 592 | 593 | .S13 594 | { 595 | color:red; 596 | } 597 | 598 | .S14 599 | { 600 | color:#939; 601 | } 602 | 603 | .S15 604 | { 605 | color:#0080ff; 606 | } 607 | 608 | span 609 | { 610 | background:transparent; 611 | color:#000; 612 | font-family:Consolas, "Courier New"; 613 | } 614 | 615 | span.emphasis 616 | { 617 | text-decoration:underline; 618 | } 619 | 620 | .experimental 621 | { 622 | background:#ffffe0; 623 | border:solid; 624 | border-color:red; 625 | font-size:large; 626 | font-weight:700; 627 | padding:4px; 628 | } 629 | 630 | .specialnote 631 | { 632 | background:#fffffa; 633 | border:solid; 634 | border-color:blue; 635 | font-size:large; 636 | font-weight:500; 637 | padding:4px; 638 | } 639 | 640 | span.mark_v 641 | { 642 | color:#fff; 643 | font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; 644 | font-size:16px; 645 | font-weight:600; 646 | margin:0; 647 | padding-left:2px; 648 | padding-right:2px; 649 | padding-bottom:1px; 650 | background-color:#0979A8; 651 | box-shadow: 5px 5px 9px #888; 652 | } 653 | img.logo 654 | { 655 | box-shadow: 5px 5px 20px #aaa; 656 | border:0; 657 | display:block; 658 | margin-left:auto; 659 | margin-right:auto; 660 | } 661 | 662 | img.main 663 | { 664 | border:0; 665 | margin-left:-1px; 666 | } 667 | 668 | img.search 669 | { 670 | margin-left:-5px; 671 | height:28px; 672 | } 673 | 674 | a.back 675 | { 676 | position:absolute; 677 | top:7px; 678 | left:5px; 679 | padding-left:25px; 680 | padding-top:3px; 681 | background: url('../images/back0.png') no-repeat; 682 | } 683 | 684 | a.back:hover 685 | { 686 | background: url('../images/back1.png') no-repeat; 687 | } 688 | 689 | a.fwd 690 | { 691 | position:absolute; 692 | top:7px; 693 | left:35px; 694 | padding-left:32px; 695 | padding-top:3px; 696 | background: url('../images/fwd0.png') no-repeat; 697 | } 698 | 699 | a.fwd:hover 700 | { 701 | background: url('../images/fwd1.png') no-repeat; 702 | } 703 | 704 | 705 | a.print 706 | { 707 | position:absolute; 708 | right:0px; 709 | top:7px; 710 | padding-left:32px; 711 | padding-top:2px; 712 | background: url('../images/print0.png') no-repeat; 713 | } 714 | 715 | a.print:hover 716 | { 717 | background: url('../images/print1.png') no-repeat; 718 | } 719 | 720 | a.home 721 | { 722 | position:absolute; 723 | right:22px; 724 | top:6px; 725 | padding-left:32px; 726 | padding-top:2px; 727 | background: url('../images/home0.png') no-repeat; 728 | } 729 | 730 | a.home:hover 731 | { 732 | background: url('../images/home1.png') no-repeat; 733 | } 734 | 735 | #in 736 | { 737 | height:28px; 738 | margin-right:-5px; 739 | } 740 | 741 | #click 742 | { 743 | background: url('../images/search.png') no-repeat; 744 | height:28px; 745 | width:28px; 746 | margin-left:-5px; 747 | border:0; 748 | cursor:arrow; 749 | font-size:0; 750 | } 751 | 752 | @media print 753 | { 754 | a.button 755 | { 756 | display: none !important; 757 | } 758 | } -------------------------------------------------------------------------------- /Extra/ifame.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WinHttp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 25 | 26 | 36 | 37 | 38 | 39 | 40 | 43 | 44 | 50 | 51 | 54 | 55 | 56 | 57 |
24 |
41 | 42 | 48 | 49 | 52 | 53 |
58 | 59 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Extra/tetris.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Tetris 8 | 536 | 835 | 836 | 837 |
838 |
839 |
840 | Click to rotate (R) 841 |
842 |
843 |
844 |
845 | Level: 846 | 847 |
848 |
849 | Lines: 850 | 851 |
852 |
853 | Points: 854 | 855 |
856 |
857 | 858 |
859 |
860 | by Charles Tio 861 |
862 |
863 | 864 | 865 | 866 |
867 | 868 | 869 | -------------------------------------------------------------------------------- /HelpFileCreator.au3: -------------------------------------------------------------------------------- 1 | 2 | #pragma compile(Console, true) 3 | #pragma compile(x64, false) 4 | 5 | 6 | 7 | If @AutoItX64 Then 8 | ConsoleWriteError("!!!!!Unable to proceed!!!!!" & @CRLF) 9 | MsgBox(64, "32-bit script!", "Wrong interpreter! Use 32bit AutoIt.") 10 | Exit -1 11 | EndIf 12 | 13 | Global Const $CHM_FOLDERSUFFIX = "_Help" 14 | 15 | #XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 16 | ; These global variables define the help file 17 | Global $sChangeLogFile = "" 18 | Global $sHomeLink = "https://github.com/dragana-r/autoit-winhttp/releases" 19 | Global $sHomePage = @ScriptDir & "\Extra\Home.htm" 20 | Global $sLogoPic = @ScriptDir & "\Images\WinHttp.jpg" 21 | Global $sCssFile = @ScriptDir & "\Extra\default1.css" 22 | Global $sJSFile = @ScriptDir & "\JS\Script.js" 23 | Global $sJSRFile = @ScriptDir & "\JS\Script_Right.js" 24 | Global $sFile = @ScriptDir & "\WinHttp.au3" 25 | Global $sExamplesFolder = @ScriptDir & "\WinHttp_Examples" 26 | Global Const $sCurrentVersionNumber = _GetVersionNumber($sFile) 27 | #XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 28 | 29 | ConsoleWrite(@CRLF & "> Generating pages... " & @CRLF) 30 | 31 | Global $aFunctions 32 | Global $sWorkingFolder = _CHM_UDFToHTMPages($sFile, $aFunctions) 33 | _CHM_WriteJScript($sWorkingFolder, $sFile, $sHomeLink) 34 | _CHM_WriteDefaultCSS($sWorkingFolder) 35 | _CHM_WriteTOC($sWorkingFolder, $aFunctions) 36 | _CHM_WriteFUNC($sFile, $sWorkingFolder) 37 | Global $sHHPFile = _WriteHHP($sWorkingFolder, $aFunctions) 38 | _CHM_WriteHomePage($sHomePage, $sLogoPic, $sWorkingFolder) 39 | 40 | Global Const $hCHMDLL__HHADLL = _CHM_HHAdll() 41 | If $hCHMDLL__HHADLL = -1 Then 42 | ConsoleWriteError("!!!!!Unable to proceed with compilation!!!!!" & @CRLF) 43 | MsgBox(64, "End", "Compilation can't proceed. hha.dll is missing!") 44 | Exit -2 45 | EndIf 46 | 47 | ConsoleWrite("> All pages created. Compiling now..." & @CRLF & @CRLF) 48 | 49 | Global $sOutputFile = _CHM_Compile($hCHMDLL__HHADLL, $sHHPFile) 50 | If $sOutputFile Then 51 | ConsoleWrite(@CRLF & "> All done!. Over and out." & @CRLF & @CRLF) 52 | If MsgBox(68, "All done!", "Help file successfully cteated" & @CRLF & "Run it?" & @CRLF) = 6 Then ShellExecute($sOutputFile) 53 | Else 54 | MsgBox(48, "Failure", "Compilation failed!") 55 | EndIf 56 | 57 | 58 | Func _GetVersionNumber($sFile) 59 | Local $sVer = FileRead($sFile, 2048) 60 | Local $aArray = StringRegExp($sVer, "(?s).*?\Q; File Version.........:\E\s*(.*?)\v+", 3) 61 | If @error Then Return SetError(1, 0, "") 62 | Return $aArray[0] 63 | EndFunc ;==>_GetVersionNumber 64 | 65 | 66 | Func _CHM_WriteJScript($sWorkingFolder, $sFileUDF, $sHomeLink) 67 | Local $sData = FileRead($sFileUDF) 68 | ; Locate Function headers 69 | Local $aHeaders = StringRegExp($sData, "(?si); #FUNCTION# ;*.*?;\h*=", 3) 70 | If @error Then Return SetError(1, 0, 0) 71 | 72 | Local $sNewContent, $sFunctionName, $sDesc, $sSearchTerms 73 | ; Build-up search terms based on functions names and descriptions 74 | For $j = 0 To UBound($aHeaders) - 1 75 | $sFunctionName = _CHM_GetHeaderData($aHeaders[$j], "Name") 76 | $sSearchTerms = StringRegExpReplace(StringReplace(StringReplace(StringRegExpReplace(StringReplace(_CHM_GetHeaderData($aHeaders[$j], "Parameters") & " " & _CHM_GetHeaderData($aHeaders[$j], "Remarks"), @CRLF, " "), "\s{2,}", ""), "[out]", ""), "[optional]", ""), '[\;\-\"\[\]\(\)]', "") 77 | $sDesc = _CHM_GetHeaderData($aHeaders[$j], "Description") 78 | $sNewContent &= 'searchDB.push(new searchOption("' & $sFunctionName & '", "' & $sSearchTerms & '", "' & $sDesc & '"));' & @CRLF 79 | Next 80 | 81 | Local $sJS = StringReplace(FileRead($sJSFile), "//--PLACEHOLDER-I-DO-NOT-REMOVE-ME--//", $sNewContent) 82 | $sJS = StringReplace($sJS, "//--PLACEHOLDER-II-DO-NOT-REMOVE-ME--//", $sHomeLink) 83 | 84 | Local $hJS = FileOpen($sWorkingFolder & "\HTML\JScript\Script.js", 10) 85 | FileWrite($hJS, $sJS) 86 | FileClose($hJS) 87 | 88 | FileCopy($sJSRFile, $sWorkingFolder & "\HTML\JScript\Script_Right.js", 9) 89 | EndFunc ;==>_CHM_WriteJScript 90 | 91 | 92 | Func _CHM_UDFToHTMPages($sFileUDF, ByRef $aFunctions, $sFolder = Default) 93 | If StringRight($sFolder, 1) = "\" Then $sFolder = StringTrimRight($sFolder, 1) 94 | ; Read the file 95 | Local $sData = FileRead($sFileUDF) 96 | ; Locate Function headers 97 | Local $aHeaders = StringRegExp($sData, "(?si); #FUNCTION# ;*.*?;\h*=", 3) 98 | If @error Then Return SetError(1, 0, 0) 99 | 100 | Local $aFuncs[UBound($aHeaders)] 101 | 102 | Local $sFileHTM, $hFileHTM 103 | Local $sInclude = StringRegExpReplace($sFileUDF, ".*\\", "") 104 | Local $sName = StringReplace($sInclude, ".au3", "") 105 | If $sFolder = Default Then $sFolder = StringReplace($sFileUDF, $sInclude, "") & $sName & $CHM_FOLDERSUFFIX 106 | 107 | Local $sFunctionName, $sHTM 108 | Local $sParams, $aParams, $iParamsUBound, $sRemarks, $sRelated, $aRelated, $sLink, $sAu3File, $sAu3Code, $sInnerCode 109 | 110 | For $j = 0 To UBound($aHeaders) - 1 111 | $sFunctionName = _CHM_GetHeaderData($aHeaders[$j], "Name") 112 | $aFuncs[$j] = $sFunctionName 113 | $sHTM = '' & @CRLF & _ 114 | "" & @CRLF & _ 115 | " " & @CRLF & _ 116 | " " & $sFunctionName & "" & @CRLF & _ 117 | ' ' & @CRLF & _ 118 | ' ' & @CRLF & _ 119 | ' ' & @CRLF & _ 120 | ' ' & @CRLF & _ 121 | " " & @CRLF & @CRLF & _ 122 | " " & @CRLF & @CRLF 123 | $sHTM &= "" & @CRLF 124 | $sHTM &= '

Function Reference

' & @CRLF & _ 125 | '
' & @CRLF 126 | If $sFunctionName = "_WinHttpSimpleReadDataAsync" Then 127 | $sHTM &= '

' & $sFunctionName & '

' & @CRLF 128 | Else 129 | $sHTM &= '

' & $sFunctionName & '

' & @CRLF 130 | EndIf 131 | $sHTM &= '

' & _CHM_GetHeaderData($aHeaders[$j], "Description") & "

" & @CRLF & @CRLF 132 | 133 | $sHTM &= "" & @CRLF 134 | $sHTM &= "

Syntax

" & @CRLF & "

" 135 | $sHTM &= '

' & @CRLF & _ 136 | ' #include "' & $sInclude & '"
' & @CRLF & _ 137 | " " & _CHM_GetHeaderData($aHeaders[$j], "Syntax") & "
" & @CRLF & _ 138 | "

" & @CRLF & @CRLF 139 | 140 | $sHTM &= "" & @CRLF 141 | $sHTM &= "

Parameters

" & @CRLF 142 | $sParams = _CHM_GetHeaderData($aHeaders[$j], "Parameters") 143 | If StringLeft(StringStripWS($sParams, 8), 4) = "none" Or Not $sParams Then 144 | $sHTM &= "

 None.


" & @CRLF & @CRLF 145 | Else 146 | $sHTM &= ' ' & @CRLF & _ 147 | " " & @CRLF 148 | $aParams = StringRegExp($sParams, "\h*(\$\w+|\Q(...)\E)\h*\-\h*(.+?)(?:\r\n|\Z)", 3) 149 | $iParamsUBound = UBound($aParams) - 1 150 | For $i = 0 To $iParamsUBound 151 | If Mod($i, 2) Then 152 | $sHTM &= ' " & @CRLF 153 | $sHTM &= " " & @CRLF 154 | If $i < $iParamsUBound Then $sHTM &= " " & @CRLF 155 | Else 156 | $sHTM &= ' " & @CRLF 157 | 158 | EndIf 159 | Next 160 | $sHTM &= "
' & StringRegExpReplace($aParams[$i], "(\[.*\])", "$1") & "
' & $aParams[$i] & "
" & @CRLF & @CRLF 161 | EndIf 162 | 163 | $sHTM &= "" & @CRLF 164 | $sHTM &= "

Return Value

" & @CRLF & "

" 165 | $sHTM &= StringReplace(StringStripCR(StringReplace(StringRegExpReplace(StringRegExpReplace(_CHM_GetHeaderData($aHeaders[$j], "Return values"), ";\h*", "             "), "(\Q \E)+\QFailure\E", "Failure"), "|", "       ")), @LF, "
" & @CRLF & " ") & "

" 166 | $sHTM &= @CRLF & @CRLF 167 | 168 | $sHTM &= "" & @CRLF 169 | $sRemarks = _CHM_GetHeaderData($aHeaders[$j], "Remarks") 170 | If $sRemarks Then 171 | $sHTM &= "

Remarks

" & @CRLF & _ 172 | "

" & StringRegExpReplace(StringReplace(StringRegExpReplace(StringRegExpReplace($sRemarks, ";\h*\+", "
"), ";\h*", " "), " |", "
       "), "\[{2}(.*?\]?)\]{2}", '$1') & "

" & @CRLF & _ 173 | "
" & @CRLF & @CRLF 174 | EndIf 175 | 176 | $sHTM &= "" & @CRLF 177 | $sRelated = _CHM_GetHeaderData($aHeaders[$j], "Related") 178 | If $sRelated Then 179 | $sHTM &= "

Related

" 180 | $aRelated = StringRegExp($sRelated, "\h*(\w+)\h*(?:\,|\Z)", 3) 181 | For $i = 0 To UBound($aRelated) - 1 182 | $sHTM &= StringRegExpReplace($aRelated[$i], "(\w+)", '$1') 183 | If $i = UBound($aRelated) - 1 Then 184 | $sHTM &= @CRLF 185 | Else 186 | $sHTM &= ", " 187 | EndIf 188 | Next 189 | $sHTM &= "
" & @CRLF & @CRLF 190 | EndIf 191 | 192 | $sHTM &= "" & @CRLF 193 | $sLink = _CHM_GetHeaderData($aHeaders[$j], "Link") 194 | If $sLink Then 195 | $sHTM &= "

See Also

" & @CRLF 196 | $sHTM &= ' MSDN' & @CRLF & @CRLF ; MSDN as visible text 197 | $sHTM &= "
" & @CRLF & @CRLF 198 | EndIf 199 | 200 | $sHTM &= "" & @CRLF 201 | $sHTM &= "

Example

" & @CRLF 202 | 203 | Local $sSuffix = "", $fHasExample = False 204 | For $i = 0 To 10 205 | If $i > 0 Then $sSuffix = "_" & $i 206 | $sAu3File = $sExamplesFolder & "\" & $sFunctionName & $sSuffix & ".au3" 207 | If FileExists($sAu3File) Then 208 | $fHasExample = True 209 | $sAu3Code = FileRead($sAu3File) 210 | If StringStripWS($sAu3Code, 8) Then 211 | $sHTM &= 'Copy to clipboard' 212 | $sHTM &= '


' & @CRLF & _CHM_SyntaxHighlight($sAu3Code) & "


" & @CRLF 213 | EndIf 214 | EndIf 215 | Next 216 | If $fHasExample Then $sHTM &= '
' & @CRLF 217 | 218 | $sHTM &= @CRLF 219 | 220 | $sHTM &= " " & @CRLF & _ 221 | "" & @CRLF 222 | 223 | $sFileHTM = $sFolder & "\HTML\Functions\" & $sFunctionName & ".htm" 224 | $hFileHTM = FileOpen($sFileHTM, 10) 225 | FileWrite($sFileHTM, $sHTM) 226 | FileClose($hFileHTM) 227 | ;ConsoleWrite($sHTM) 228 | Next 229 | $aFunctions = $aFuncs 230 | Return $sFolder 231 | EndFunc ;==>_CHM_UDFToHTMPages 232 | 233 | 234 | Func _CHM_GetHeaderData($sString, $sTag) 235 | Local $aName = StringRegExp($sString, "(?s).*?;\h*\Q" & $sTag & "\E\h*\.*\h*:\h*(.*?)\r\n\h*;\h*(\w+\h*\w*\h*\.*\h*:\h*|\=+)", 3) 236 | If @error Then Return "" 237 | Return $aName[0] 238 | EndFunc ;==>_CHM_GetHeaderData 239 | 240 | 241 | Func _CHM_WriteDefaultCSS($sWorkingFolder) 242 | FileCopy($sCssFile, $sWorkingFolder & "\HTML\CSS\Default1.css", 9) 243 | EndFunc ;==>_CHM_WriteDefaultCSS 244 | 245 | 246 | Func _CHM_WriteTOC($sWorkingFolder, $aFunctions) 247 | Local $sHTML = '' & @CRLF & _ 248 | "" & @CRLF & _ 249 | "" & @CRLF & _ 250 | "TOC" & @CRLF & _ 251 | '' & @CRLF & _ 252 | '' & @CRLF & _ 253 | '' & @CRLF & _ 254 | '' & @CRLF & _ 255 | "" & @CRLF & _ 256 | '' & @CRLF & _ 257 | "' & @CRLF & _ 272 | "" & @CRLF & _ 273 | "" & @CRLF 274 | 275 | Local $sFileHTM = $sWorkingFolder & "\HTML\Functions\TOC.htm" 276 | Local $hFileHTML = FileOpen($sFileHTM, 10) 277 | FileWrite($hFileHTML, $sHTML) 278 | FileClose($hFileHTML) 279 | Return $sFileHTM 280 | EndFunc ;==>_CHM_WriteTOC 281 | 282 | 283 | Func _WriteHHP($sWorkingFolder, $aFunctions) 284 | Local $sName = StringReplace(StringRegExpReplace($sWorkingFolder, ".*\\", ""), $CHM_FOLDERSUFFIX, "") 285 | Local $sData = "[OPTIONS]" & @CRLF & _ 286 | "Compatibility=1.0" & @CRLF & _ 287 | "Compiled File=" & $sName & " .chm" & @CRLF & _ 288 | "Title=" & $sName & " Help" & @CRLF & _ 289 | "Default Window=NewWindow" & @CRLF & _ 290 | "Display compile progress=Yes" & @CRLF & _ 291 | "Display compile notes=Yes" & @CRLF & _ 292 | "Default Font=Segoe UI, 9" & @CRLF & _ 293 | "Default topic=html\Functions\IFame.htm" & @CRLF & _ 294 | "Language=0x409" & @CRLF & _ 295 | "Full-text search=No" & @CRLF & @CRLF 296 | 297 | $sData &= "[WINDOWS]" & @CRLF & _ 298 | 'NewWindow="' & $sName & ' ' & $sCurrentVersionNumber & ' Help",' & _ 299 | '"","","html\Functions\IFame.htm","",,,,,0x20420,0,0x0,,0x10030000,,,1,,,0' & @CRLF & @CRLF 300 | 301 | $sData &= "[FILES]" & @CRLF 302 | 303 | For $i = 0 To UBound($aFunctions) - 1 304 | $sData &= "html\Functions\" & $aFunctions[$i] & ".htm" & @CRLF 305 | Next 306 | 307 | DirCopy(@ScriptDir & "\Images", $sWorkingFolder & "\HTML\Images", 1) 308 | FileCopy(@ScriptDir & "\Extra\*", $sWorkingFolder & "\HTML\Functions", 1) 309 | 310 | $sData &= "html\CHM_HomePage.htm" & @CRLF 311 | $sData &= "html\Functions\TOC.htm" & @CRLF 312 | $sData &= "html\Functions\Functions.htm" & @CRLF 313 | $sData &= "html\Functions\tetris.htm" & @CRLF 314 | 315 | Local $sFileName, $sExt, $hSearch = FileFindFirstFile($sWorkingFolder & "\HTML\Images\*") 316 | While 1 317 | $sFileName = FileFindNextFile($hSearch) 318 | If @error Then ExitLoop 319 | $sExt = StringRegExpReplace($sFileName, ".*\.", ".") 320 | If $sExt = ".png" Or $sExt = ".jpg" Then $sData &= "html\Images\" & $sFileName & @CRLF 321 | WEnd 322 | FileClose($hSearch) 323 | 324 | Local $sFileHHP = $sWorkingFolder & "\" & $sName & ".hhp" 325 | Local $hFileHHP = FileOpen($sFileHHP, 10) 326 | FileWrite($hFileHHP, $sData) 327 | FileClose($hFileHHP) 328 | Return $sFileHHP 329 | EndFunc ;==>_WriteHHP 330 | 331 | 332 | Func _CHM_WriteFUNC($sFileUDF, $sWorkingFolder) 333 | Local $sName = StringReplace(StringRegExpReplace($sWorkingFolder, ".*\\", ""), $CHM_FOLDERSUFFIX, "") 334 | Local $sHTM = '' & @CRLF & _ 335 | "" & @CRLF & _ 336 | " " & "Functions" & @CRLF & _ 337 | ' ' & @CRLF & _ 338 | ' ' & @CRLF & _ 339 | ' ' & @CRLF & _ 340 | "" & @CRLF & _ 341 | "" & @CRLF & _ 342 | "

" & "Function Reference

" & @CRLF & _ 343 | "

Below is a complete list of the Functions available in " & $sName & ".
" & @CRLF & _ 344 | "Click on a function name for a detailed description.

" & @CRLF & _ 345 | "

 

" & @CRLF & _ 346 | '' & @CRLF & _ 347 | "" & @CRLF & _ 348 | ' ' & @CRLF & _ 349 | ' ' & @CRLF & _ 350 | "" & @CRLF 351 | 352 | Local $sData = FileRead($sFileUDF) 353 | Local $aHeaders = StringRegExp($sData, "(?si); #FUNCTION# ;*.*?;\h*=", 3) 354 | If @error Then Return SetError(1, 0, "") 355 | Local $sFunctionName 356 | 357 | For $j = 0 To UBound($aHeaders) - 1 358 | $sFunctionName = _CHM_GetHeaderData($aHeaders[$j], "Name") 359 | $sHTM &= "" & @CRLF & _ 360 | ' ' & @CRLF & _ 361 | " " & @CRLF & _ 362 | "" & @CRLF 363 | Next 364 | 365 | $sHTM &= "
' & ' FunctionDescription
' & $sFunctionName & '" & _CHM_GetHeaderData($aHeaders[$j], "Description") & "
" & @CRLF 366 | 367 | $sHTM &= "
" & @CRLF & _ 368 | "

 

" & @CRLF & @CRLF 369 | 370 | $sHTM &= "" & @CRLF & _ 371 | "" & @CRLF 372 | 373 | Local $sFileHTM = $sWorkingFolder & "\HTML\Functions\Functions.htm" 374 | Local $hFileHTM = FileOpen($sFileHTM, 10) 375 | FileWrite($hFileHTM, $sHTM) 376 | FileClose($hFileHTM) 377 | Return $sFileHTM 378 | EndFunc ;==>_CHM_WriteFUNC 379 | 380 | 381 | Func _CHM_WriteHomePage($sHomePage, $sLogoPic, $sWorkingFolder) 382 | Local $sName = StringReplace(StringRegExpReplace($sWorkingFolder, ".*\\", ""), $CHM_FOLDERSUFFIX, "") 383 | If FileExists($sHomePage) Then 384 | $sHomePage = FileRead($sHomePage) 385 | $sHomePage = StringRegExpReplace($sHomePage, "\QCurrent version is \E\d+\.\d+\.(\d+\.)?(\d+?\.)?", 'Current version is ' & $sCurrentVersionNumber & "") 386 | $sHomePage = StringRegExpReplace($sHomePage, "(?si)(<\s*/*\Qbody\E.*?>|<\s*/*\Qhtml\E.*?>|<\s*head\s*>.*?<\s*/head\s*>|<\s*\Q!DOCTYPE\E.*?>)", "") 387 | $sHomePage = StringRegExpReplace($sHomePage, '(\Qhref=\E(".*"))', '$1 onclick=''window.open($2);return false;''') 388 | Else 389 | $sHomePage = "" 390 | EndIf 391 | If FileExists($sLogoPic) Then FileCopy($sLogoPic, $sWorkingFolder & "\HTML\Images\" & StringRegExpReplace($sLogoPic, ".*\\", ""), 9) 392 | Local $sHTM = '' & @CRLF & _ 393 | "" & @CRLF & _ 394 | " " & @CRLF & _ 395 | " " & $sName & " Function Notes" & "" & @CRLF & _ 396 | ' ' & @CRLF & _ 397 | ' ' & @CRLF & _ 398 | ' ' & @CRLF & _ 399 | " " & @CRLF & @CRLF & _ 400 | " " & @CRLF & _ 401 | "

" & $sName & "

" & @CRLF & _ 402 | '
' & @CRLF & _ 403 | "

Welcome to the helpfile of " & $sName & "!
" & @CRLF & _ 404 | "" & @CRLF & _ 405 | $sHomePage & @CRLF & _ 406 | "" & @CRLF & _ 407 | " " & @CRLF & _ 408 | "" & @CRLF 409 | 410 | Local $sFileHTM = $sWorkingFolder & "\HTML\CHM_HomePage.htm" 411 | Local $hFileHTM = FileOpen($sFileHTM, 10) 412 | FileWrite($hFileHTM, $sHTM) 413 | FileClose($hFileHTM) 414 | Return $sFileHTM 415 | EndFunc ;==>_CHM_WriteHomePage 416 | 417 | 418 | Func _CHM_HHAdll() 419 | ; This is strictly 32-bit function because of such dlls 420 | If @AutoItX64 Then Return SetError(1, 0, -1) 421 | ; Check if dlls are in place 422 | Local $sHHADll = "hha.dll" 423 | Local $sITCCDLL = "itcc.dll" 424 | Local $hHHADll = DllOpen($sHHADll) 425 | Local $hITCCDLL = DllOpen($sITCCDLL) 426 | ; Preset control flags 427 | Local $fHHANotInstalled = False 428 | Local $fITCCNotInstalled = False 429 | ; Deal wit issues 430 | If $hHHADll = -1 Then 431 | $sHHADll = @SystemDir & "\" & $sHHADll 432 | If FileInstall("C:\Users\trancexx\Desktop\HHA_DLL\hha.dll", $sHHADll) Then 433 | $hHHADll = DllOpen($sHHADll) 434 | Else 435 | $fHHANotInstalled = True 436 | EndIf 437 | EndIf 438 | If $hITCCDLL = -1 Then 439 | $sITCCDLL = @SystemDir & "\" & $sITCCDLL 440 | If FileInstall("C:\Users\trancexx\Desktop\HHA_DLL\itcc.dll", $sITCCDLL) Then 441 | _CHM_RegisterServer($sITCCDLL) 442 | Else 443 | $fITCCNotInstalled = True 444 | EndIf 445 | Else 446 | DllClose($hITCCDLL) 447 | _CHM_RegisterServer($sITCCDLL) 448 | EndIf 449 | If @Compiled Then 450 | ; Construct the string for other instance to execute with admin privileges 451 | Local $sShellExecuteString 452 | If $fHHANotInstalled And $fITCCNotInstalled Then 453 | $sShellExecuteString = ' /AutoIt3ExecuteLine ' & _ 454 | '"Exit (' & _ 455 | 'FileInstall(''C:\Users\trancexx\Desktop\HHA_DLL\hha.dll'', ''' & $sHHADll & ''') & ' & _ 456 | 'FileInstall(''C:\Users\trancexx\Desktop\HHA_DLL\itcc.dll'', ''' & $sITCCDLL & ''') & ' & _ 457 | 'DllCall(''ole32.dll'', ''long'', ''OleInitialize'', ''ptr'', 0) & ' & _ 458 | 'DllCall(''' & $sITCCDLL & ''', ''long'', ''DllRegisterServer'')' & _ 459 | ')"' 460 | Else 461 | If $fHHANotInstalled Then 462 | $sShellExecuteString = ' /AutoIt3ExecuteLine ' & _ 463 | '"Exit Not ' & _ 464 | 'FileInstall(''C:\Users\trancexx\Desktop\HHA_DLL\hha.dll'', ''' & $sHHADll & ''')' 465 | EndIf 466 | If $fITCCNotInstalled Then 467 | $sShellExecuteString = ' /AutoIt3ExecuteLine ' & _ 468 | '"Exit (' & _ 469 | 'FileInstall(''C:\Users\trancexx\Desktop\HHA_DLL\itcc.dll'', ''' & $sITCCDLL & ''') & ' & _ 470 | 'DllCall(''ole32.dll'', ''long'', ''OleInitialize'', ''ptr'', 0) & ' & _ 471 | 'DllCall(''' & $sITCCDLL & ''', ''long'', ''DllRegisterServer'')' & _ 472 | ')"' 473 | EndIf 474 | EndIf 475 | ConsoleWrite($fHHANotInstalled & " " & $fITCCNotInstalled & @CRLF) 476 | If $fHHANotInstalled Or $fITCCNotInstalled Then ShellExecuteWait('"' & @AutoItExe & '"', $sShellExecuteString, "", "runas", @SW_HIDE) 477 | EndIf 478 | ; Check now 479 | If $fHHANotInstalled Then $hHHADll = DllOpen($sHHADll) 480 | If $hHHADll = -1 Then Return SetError(2, 0, -1) 481 | ; Return pseudo-handle 482 | Return $hHHADll 483 | EndFunc ;==>_CHM_HHAdll 484 | 485 | 486 | Func _CHM_RegisterServer($sDll) 487 | Local $fInit, $fError 488 | Local $aCall = DllCall("ole32.dll", "long", "OleInitialize", "ptr", 0) 489 | If Not @error Then $fInit = $aCall[0] <> 1 ; The COM library is already initialized 490 | $aCall = DllCall($sDll, "long", "DllRegisterServer") 491 | If @error Then $fError = True 492 | If $fInit Then DllCall("ole32.dll", "none", "OleUninitialize") 493 | If $fError Then Return SetError(2, 0, False) 494 | Return SetError($aCall[0] <> 0, $aCall[0], $aCall[0] = 0) 495 | EndFunc ;==>_CHM_RegisterServer 496 | 497 | 498 | Func _CHM_Compile($hHHADll, $sHHPFile) 499 | Local $fInit 500 | Local $aCall = DllCall("ole32.dll", "long", "OleInitialize", "ptr", 0) 501 | If Not @error Then $fInit = $aCall[0] <> 1 ; The COM library is already initialized 502 | ; Callbacks 503 | Local Static $pFuncLog = DllCallbackGetPtr(DllCallbackRegister("_CHM_Log", "bool", "str")) 504 | Local Static $pFuncProc = DllCallbackGetPtr(DllCallbackRegister("_CHM_Proc", "bool", "str")) 505 | Local $tHHAData = DllStructCreate("dword[12];char[256]") 506 | DllStructSetData($tHHAData, 1, DllStructGetSize($tHHAData), 1) 507 | ; Compile 508 | DllCall($hHHADll, "bool", "HHA_CompileHHP", _ ;<- it's more likely "none" instead of "bool" 509 | "str", $sHHPFile, _ 510 | "ptr", $pFuncLog, _ 511 | "ptr", $pFuncProc, _ 512 | "ptr", DllStructGetPtr($tHHAData)) 513 | If @error Or Not DllStructGetData($tHHAData, 2) Then ; checking if the help file is created or error occurred 514 | If $fInit Then DllCall("ole32.dll", "none", "OleUninitialize") 515 | Return SetError(1, 0, "") 516 | EndIf 517 | If $fInit Then DllCall("ole32.dll", "none", "OleUninitialize") 518 | Return DllStructGetData($tHHAData, 2) 519 | EndFunc ;==>_CHM_Compile 520 | 521 | 522 | Func _CHM_Log($sString) 523 | $sString = StringReplace($sString, @CRLF, "") 524 | If $sString Then ConsoleWrite("+....." & $sString & @CRLF) 525 | Return True 526 | EndFunc ;==>_CHM_Log 527 | 528 | 529 | Func _CHM_Proc($sString) 530 | Return True ; not interested 531 | If $sString Then ConsoleWrite("> Processing....." & $sString & @CRLF) 532 | Return True 533 | EndFunc ;==>_CHM_Proc 534 | 535 | 536 | Func _CHM_SyntaxHighlight($sAu3Code) ; MrCreator's modified 537 | $sAu3Code = StringReplace($sAu3Code & @CRLF, @TAB, " ") 538 | Local $sPattern1, $sPattern2 539 | Local $sReplace1, $sReplace2 540 | Local $sUnique_Str_Quote = '%@~@%' 541 | Local $sUnique_Str_Include = '!~@%@~!' ; "!" must be the first character 542 | While StringInStr($sAu3Code, $sUnique_Str_Quote) 543 | $sUnique_Str_Quote &= Random(10000, 99999) 544 | WEnd 545 | While StringInStr($sAu3Code, $sUnique_Str_Include) 546 | $sUnique_Str_Include &= Random(10000, 99999) 547 | WEnd 548 | ; Get all strings to array 549 | $sPattern1 = '(?m)(("|'')[^\2\r\n]*?\2)' ;'(?s).*?(("|'')[^\2]*\2).*?' 550 | $sPattern2 = "(?si)#include\s+?(<[^\>]*>).*?" 551 | Local $aQuote_Strings = StringRegExp($sAu3Code, $sPattern1, 3) 552 | Local $aInclude_Strings = StringRegExp($sAu3Code, $sPattern2, 3) 553 | ; Replace all the strings with unique marks 554 | $sPattern1 = '(?s)("|'')([^\1\r\n])*?(\1)' 555 | $sPattern2 = "(?si)(#include\s+?)<[^\>]*>(.*?)" 556 | $sReplace1 = $sUnique_Str_Quote 557 | $sReplace2 = '\1' & $sUnique_Str_Include & '\2' 558 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 559 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern2, $sReplace2) 560 | $sPattern1 = '([\(\)\[\]\<\>\.\*\+\-\=\&\^\,\/])' 561 | $sReplace1 = '\1' 562 | ; Highlight the operators, brakets, commas (must be done before all other parsers) 563 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 564 | $sPattern1 = '(\W+)(_)(\W+)' 565 | $sReplace1 = '\1\2\3' 566 | ; Highlight the line braking character, wich is the underscore (must be done before all other parsers) 567 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 568 | $sPattern1 = '((?:\s+)?\.|(?:\s+)?\.)([^\d\$]\w+)' 569 | $sReplace1 = '\1\2' 570 | ; Highlight the COM Objects 571 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 572 | $sPattern1 = '([^\w#@])(\d+)([^\w])' 573 | $sReplace1 = '\1\2\3' 574 | ; Highlight the number 575 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 576 | ; Highlight the keyword 577 | $sAu3Code = _CHM_ParseKeywords($sAu3Code) 578 | ; Highlight the macros 579 | $sAu3Code = _CHM_ParseMacros($sAu3Code) 580 | ; Highlight special keywords 581 | $sAu3Code = _CHM_ParseSpecial($sAu3Code) 582 | ; Highlight the PreProcessor 583 | $sAu3Code = _CHM_ParsePreProcessor($sAu3Code) 584 | 585 | $sPattern1 = '([^\w#@])((?i)0x[abcdef\d]+)([^abcdef\d])' 586 | $sReplace1 = '\1\2\3' 587 | ; Highlight the hexadecimal number 588 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 589 | 590 | $sPattern1 = '\$(\w+)?' 591 | $sReplace1 = '$\1' 592 | ; Highlight variables (also can be just the dollar sign) 593 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 594 | 595 | $sPattern1 = '(\w+)(\h*\()' 596 | $sReplace1 = '\1\2' 597 | ; Highlight finaly the '#White space' (only user defined functions) 598 | $sAu3Code = StringRegExpReplace($sAu3Code, $sPattern1, $sReplace1) 599 | 600 | ; Highlight commented lines / comment block (plus extra parsers due to need of the loop, see the function's body) 601 | $sAu3Code = _CHM_ParseComments($sAu3Code) 602 | 603 | ; Replace back the unique marks with the original one and wrap them with "string" tags 604 | For $i = 0 To UBound($aQuote_Strings) - 1 Step 2 605 | $aQuote_Strings[$i] = StringReplace($aQuote_Strings[$i], "&", "&") 606 | $aQuote_Strings[$i] = StringReplace($aQuote_Strings[$i], '<', '<') 607 | $aQuote_Strings[$i] = StringReplace($aQuote_Strings[$i], '>', '>') 608 | $sAu3Code = StringReplace($sAu3Code, $sUnique_Str_Quote, '' & $aQuote_Strings[$i] & '', 1) 609 | Next 610 | For $i = 0 To UBound($aInclude_Strings) - 1 611 | $aInclude_Strings[$i] = StringReplace($aInclude_Strings[$i], '<', '<') 612 | $aInclude_Strings[$i] = StringReplace($aInclude_Strings[$i], '>', '>') 613 | $sAu3Code = StringReplace($sAu3Code, $sUnique_Str_Include, '' & $aInclude_Strings[$i] & '', 1) 614 | Next 615 | ; Strip tags from "string" inside commented lines 616 | Do 617 | $sAu3Code = StringRegExpReplace($sAu3Code, _ 618 | '(.*?;.*?)' & _ 619 | '(?:|)(.*?)(.*?)', _ 620 | '\1\2\3') 621 | Until Not @extended 622 | $sAu3Code = _CHM_ParseUDFs($sAu3Code) 623 | Do 624 | $sAu3Code = StringRegExpReplace($sAu3Code, "\h{2,4}(\Q)", "$1    ") 625 | Until Not @extended 626 | $sAu3Code = StringRegExpReplace($sAu3Code, "\h(\Q)", "$1 ") 627 | $sAu3Code = StringRegExpReplace($sAu3Code, "(\Q)\v", "$1
") 628 | Do 629 | $sAu3Code = StringRegExpReplace($sAu3Code, "(\Q
\E)\v{2}", "$1
") 630 | Until Not @extended 631 | $sAu3Code = StringRegExpReplace($sAu3Code, ">\h+<", "> <") 632 | $sAu3Code = StringReplace($sAu3Code, "<>", "") 633 | $sAu3Code = StringReplace($sAu3Code, "&<", "&<") 634 | $sAu3Code = StringReplace($sAu3Code, @CRLF, "
") 635 | Return $sAu3Code 636 | EndFunc ;==>_CHM_SyntaxHighlight 637 | 638 | 639 | Func _CHM_ParseUDFs($sAu3Code) 640 | $sAu3Code = StringRegExpReplace($sAu3Code, '\Q_\E([[:alpha:]])', '_$1') 641 | Return $sAu3Code 642 | EndFunc ;==>_CHM_ParseUDFs 643 | 644 | 645 | Func _CHM_ParseKeywords($sAu3Code) 646 | Local $aKeywords = _CHM_AutoIt_Keywords() 647 | For $i = 0 To UBound($aKeywords) - 1 648 | $sAu3Code = StringRegExpReplace($sAu3Code, '([^a-zA-Z_\$@])((?i)' & $aKeywords[$i] & ')(\W)', '\1\2\3') 649 | Next 650 | Return $sAu3Code 651 | EndFunc ;==>_CHM_ParseKeywords 652 | 653 | 654 | Func _CHM_ParseMacros($sAu3Code) 655 | Local $aMacros = _CHM_AutoIt_Macros() 656 | For $i = 0 To UBound($aMacros) - 1 657 | $sAu3Code = StringRegExpReplace($sAu3Code, '(\W+|\A)((?i)' & $aMacros[$i] & ')(\W+|$)', '\1\2\3') 658 | Next 659 | Return $sAu3Code 660 | EndFunc ;==>_CHM_ParseMacros 661 | 662 | 663 | Func _CHM_ParsePreProcessor($sAu3Code) 664 | Local $aPreProcessor = _CHM_AutoIt_Preprocessor() 665 | For $i = 0 To UBound($aPreProcessor) - 1 666 | $sAu3Code = StringRegExpReplace($sAu3Code, '(?i)\Q\E(\Q' & $aPreProcessor[$i] & '\E)', '$1') 667 | Next 668 | Return $sAu3Code 669 | EndFunc ;==>_CHM_ParsePreProcessor 670 | 671 | 672 | Func _CHM_ParseSpecial($sAu3Code) 673 | Do 674 | $sAu3Code = StringRegExpReplace($sAu3Code, '(\W+|\A)((?i)#.*)<(?:span|a href=).*?>(.*)', '\1\2\3') 675 | Until Not @extended 676 | $sAu3Code = StringRegExpReplace($sAu3Code, '(\W+|\A)((?i)#.*)', '\1\2') 677 | Return $sAu3Code 678 | EndFunc ;==>_CHM_ParseSpecial 679 | 680 | 681 | Func _CHM_ParseComments($sAu3Code) 682 | Local $aCode = StringSplit(StringStripCR($sAu3Code), @LF, 2) 683 | Local $aComments, $iSubStart = 0 684 | Local $sCode 685 | ; Go thru the code and check each line... 686 | For $i = 0 To UBound($aCode) - 1 687 | ; Commented line 688 | If StringRegExp($aCode[$i], '(\s+)?([^(<|>)]|\h+?|^);') Then 689 | ; Remove all tags 690 | $aComments = StringRegExp($aCode[$i], '([^;]*);(.*?)$', 3) 691 | $aComments[1] = StringReplace($aComments[1], "&", "&") 692 | If UBound($aComments) > 1 Then 693 | Do 694 | $aComments[1] = StringRegExpReplace($aComments[1], '<\w+\h?[^>]*?>(.*?)', '\1') 695 | Until Not @extended 696 | $aCode[$i] = $aComments[0] & ';' & $aComments[1] & '' 697 | EndIf 698 | $sCode &= $aCode[$i] & @CRLF 699 | ; Comment block 700 | ElseIf StringRegExp($aCode[$i], '(?i)(\s+)?#(cs|comments.*?start)(.*)') Then 701 | ; Remove all tags 702 | $aCode[$i] = StringReplace($aCode[$i], "&", "&") 703 | Do 704 | $aCode[$i] = StringRegExpReplace($aCode[$i], '<\w+\h?[^>]*?>(.*?)', '\1') 705 | Until Not @extended 706 | ; Add the comment *open* tag 707 | $sCode &= StringRegExpReplace($aCode[$i], '(?i)(\s+)?#(cs|comments.*?start)(.*)', '\1#\2\3') & @CRLF 708 | $sCode &= "
" 709 | $iSubStart += 1 710 | ; Now check each line for ending of the comment block 711 | For $j = $i + 1 To UBound($aCode) - 1 712 | $i = $j 713 | ; Remove all tags 714 | Do 715 | $aCode[$j] = StringRegExpReplace($aCode[$j], '<\w+\h?[^>]*?>(.*?)', '\1') 716 | Until Not @extended 717 | $sCode &= $aCode[$j] & "
" 718 | $sCode = StringRegExpReplace($sCode, ">\h", "> ") 719 | Do 720 | $sCode = StringRegExpReplace($sCode, "\Q \E\h", " ") 721 | Until Not @extended 722 | ; Check if current line of code is the (sub)start of comment block. If so, make a "note" for it (inrease the comments-start counter by one) 723 | If StringRegExp($aCode[$j], '(?i)(\s+)?#(cs|comments.*?start)(.*)') Then $iSubStart += 1 724 | ; Check if current line of code is the end of sub comment block. If so, decrease the comments-start counter by one (to allow the ending of all comments) 725 | If $iSubStart > 0 And StringRegExp($aCode[$j], '(?i)(\s+)?#(ce|comments.*?end)(.*)') Then $iSubStart -= 1 726 | ; Check if current line of code is the end of (all) comment block(s). If so, exit this current loop 727 | If $iSubStart = 0 And StringRegExp($aCode[$j], '(?i)(\s+)?#(ce|comments.*?end)(.*)') Then 728 | $sCode &= '

' 729 | ExitLoop 730 | EndIf 731 | Next 732 | Else 733 | $sCode &= $aCode[$i] & @CRLF 734 | EndIf 735 | Next 736 | Return $sCode 737 | EndFunc ;==>_CHM_ParseComments 738 | 739 | 740 | Func _CHM_AutoIt_Keywords() 741 | Local $sWords = "and byref case const continuecase continueloop default dim " & _ 742 | "do else elseif endfunc endif endselect endswitch endwith enum exit exitloop false " & _ 743 | "for func global if in local next not or redim return select static step switch then " & _ 744 | "to true until wend while with" 745 | Return StringSplit($sWords, " ", 2) 746 | EndFunc ;==>_CHM_AutoIt_Keywords 747 | 748 | 749 | Func _CHM_AutoIt_Macros() 750 | Local $sWords = "@appdatacommondir @appdatadir @autoitexe @autoitpid @autoitversion " & _ 751 | "@autoitx64 @com_eventobj @commonfilesdir @compiled @computername @comspec @cpuarch " & _ 752 | "@cr @crlf @desktopcommondir @desktopdepth @desktopdir @desktopheight @desktoprefresh " & _ 753 | "@desktopwidth @documentscommondir @error @exitcode @exitmethod @extended @favoritescommondir " & _ 754 | "@favoritesdir @gui_ctrlhandle @gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid @gui_winhandle " & _ 755 | "@homedrive @homepath @homeshare @hotkeypressed @hour @ipaddress1 @ipaddress2 @ipaddress3 " & _ 756 | "@ipaddress4 @kblayout @lf @logondnsdomain @logondomain @logonserver @mday @min @mon " & _ 757 | "@msec @muilang @mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack " & _ 758 | "@ostype @osversion @programfilesdir @programscommondir @programsdir @scriptdir @scriptfullpath " & _ 759 | "@scriptlinenumber @scriptname @sec @startmenucommondir @startmenudir @startupcommondir " & _ 760 | "@startupdir @sw_disable @sw_enable @sw_hide @sw_lock @sw_maximize @sw_minimize @sw_restore " & _ 761 | "@sw_show @sw_showdefault @sw_showmaximized @sw_showminimized @sw_showminnoactive " & _ 762 | "@sw_showna @sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir " & _ 763 | "@tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday @windowsdir " & _ 764 | "@workingdir @yday @year" 765 | Return StringSplit($sWords, " ", 2) 766 | EndFunc ;==>_CHM_AutoIt_Macros 767 | 768 | 769 | Func _CHM_AutoIt_Preprocessor() 770 | Local $sWords = "#ce #comments-end #comments-start #cs #include #include-once " & _ 771 | "#noautoit3execute #notrayicon #onautoitstartregister #requireadmin" 772 | Return StringSplit($sWords, " ", 2) 773 | EndFunc ;==>_CHM_AutoIt_Preprocessor 774 | -------------------------------------------------------------------------------- /Images/WinHttp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/WinHttp.jpg -------------------------------------------------------------------------------- /Images/back0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/back0.png -------------------------------------------------------------------------------- /Images/back1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/back1.png -------------------------------------------------------------------------------- /Images/back2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/back2.png -------------------------------------------------------------------------------- /Images/ex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/ex.png -------------------------------------------------------------------------------- /Images/fwd0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/fwd0.png -------------------------------------------------------------------------------- /Images/fwd1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/fwd1.png -------------------------------------------------------------------------------- /Images/fwd2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/fwd2.png -------------------------------------------------------------------------------- /Images/home0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/home0.png -------------------------------------------------------------------------------- /Images/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/home1.png -------------------------------------------------------------------------------- /Images/print0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/print0.png -------------------------------------------------------------------------------- /Images/print1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/print1.png -------------------------------------------------------------------------------- /Images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragana-r/autoit-winhttp/e82bc44096101a27b77f0c03421e82f0d4741a59/Images/search.png -------------------------------------------------------------------------------- /JS/Script.js: -------------------------------------------------------------------------------- 1 | var iDBindex = -1; 2 | var bFirstRun = true; 3 | 4 | window.onload = init; 5 | window.onresize = init 6 | 7 | var iStartX = 0; 8 | var iStartW = 0; 9 | 10 | var searchDB = new Array(); 11 | // DEFINE NEW SEARCHABLE ITEMS HERE, FOLLOWING THE FORMAT AS BELOW; 12 | // searchDB[nextnumber] = new searchOption("TitleOfResult", "Description", "ShortDescription", "AltLink"); 13 | searchDB[0] = new searchOption("WinHttp Function Notes", "", "WinHttp-UDFs for AutoIt and this helpfile are...", "../CHM_HomePage"); 14 | //--PLACEHOLDER-I-DO-NOT-REMOVE-ME--// 15 | 16 | function init() 17 | { 18 | var window_height; 19 | var window_width 20 | 21 | if (document.documentElement) 22 | { 23 | window_height = document.documentElement.offsetHeight; 24 | window_width = document.documentElement.offsetWidth; 25 | } 26 | else if (window.innerHeight) 27 | { 28 | window_height = window.innerHeight; 29 | window_width = window.innerWidth; 30 | } 31 | 32 | var iFrame = document.getElementById('idFrame') 33 | var iFramex = document.getElementById('idFramex') 34 | 35 | if (iFrame && iFramex) 36 | { 37 | if (window_height > 120) 38 | { 39 | iFrame.height = window_height - 120; 40 | iFramex.height = window_height - 120; 41 | } 42 | if (bFirstRun) 43 | { 44 | iFrame.width = window_width * 0.2; 45 | iFramex.width = window_width * 0.8; 46 | } 47 | } 48 | 49 | // bFirstRun = false; 50 | 51 | var iInput = document.getElementById('in') 52 | if (iInput) 53 | { 54 | iInput.style.color = "gray"; 55 | iInput.value = "Search"; 56 | iInput.disabled = false; 57 | } 58 | 59 | setTimeout(LoadSearchKeywords, 100); // give it time to load 60 | 61 | } 62 | 63 | function ResizeX(oItem, oItem2) 64 | { 65 | 66 | if (iStartX == 0) return; 67 | 68 | var iWidth = iStartW + (event.x - iStartX); 69 | 70 | if (iWidth > 0) 71 | { 72 | var window_width; 73 | if (document.documentElement) 74 | { 75 | window_width = document.documentElement.offsetWidth; 76 | } 77 | else if (window.innerWidth) 78 | { 79 | window_width = window.innerWidth; 80 | } 81 | 82 | var iDelta = iWidth + oItem.width 83 | if (oItem) 84 | { 85 | oItem.width = iWidth; 86 | } 87 | if (oItem2 && window_width > iWidth) 88 | { 89 | oItem2.width = window_width - iWidth; 90 | } 91 | 92 | } 93 | } 94 | 95 | function ExitResizeX(oItem) 96 | { 97 | if (oItem == null) 98 | { 99 | oItem = document.getElementById('rsz'); 100 | } 101 | oItem.releaseCapture(); 102 | iStartX = 0; 103 | } 104 | 105 | function EnterResizeX(oItem, oItem2) 106 | { 107 | oItem.setCapture(); 108 | iStartX = event.x; 109 | iStartW = oItem2.offsetWidth; 110 | if (document.getElementById('rightframe').src.substring(0, 4) == "http") // external page loaded into the frame 111 | { 112 | setTimeout(ExitResizeX, 500); 113 | } 114 | } 115 | 116 | function SetIFrameSource(url, elem) 117 | { 118 | var myframe = parent.document.getElementsByTagName('iframe')[1]; 119 | if (myframe !== null) 120 | { 121 | if (myframe.src) 122 | { 123 | myframe.src = url 124 | } 125 | else if (myframe.contentWindow !== null && myframe.contentWindow.location !== null) 126 | { 127 | myframe.contentWindow.location = url 128 | } 129 | else 130 | { 131 | myframe.setAttribute('src', url) 132 | } 133 | } 134 | 135 | { 136 | var elems = document.getElementsByTagName("a"); 137 | for (var i = elems.length; i--;) 138 | { 139 | elems[i].style.color = "#00709f"; 140 | elems[i].style.fontWeight = 400; 141 | } 142 | if (elem != null) 143 | { 144 | elem.style.color = "black"; 145 | elem.style.fontWeight = 600 146 | } 147 | } 148 | 149 | return false; 150 | } 151 | 152 | 153 | function UpdateLocation(sTheURL) 154 | { 155 | var myframeL = document.getElementById('leftframe') 156 | if (myframeL !== null) 157 | { 158 | 159 | var docL = myframeL.contentWindow.document; 160 | if (docL !== null) 161 | { 162 | 163 | var elems = docL.getElementsByTagName("a"); 164 | for (var i = elems.length; i--;) 165 | { 166 | if (elems[i].innerHTML == sTheURL) 167 | { 168 | if (elems[i].style.color != "black") 169 | { 170 | elems[i].style.color = "black"; 171 | } 172 | if (elems[i].style.fontWeight != 600) 173 | { 174 | elems[i].style.fontWeight = 600; 175 | } 176 | } 177 | else 178 | { 179 | if (elems[i].style.color != "#00709f") 180 | { 181 | elems[i].style.color = "#00709f"; 182 | } 183 | if (elems[i].style.fontWeight != 400) 184 | { 185 | elems[i].style.fontWeight = 400; 186 | } 187 | } 188 | 189 | } 190 | } 191 | } 192 | return false; 193 | } 194 | 195 | 196 | function UpdateLocationByRightTitle() 197 | { 198 | var myframeL = document.getElementById('leftframe') 199 | if (myframeL !== null) 200 | { 201 | 202 | var myframeR = document.getElementById('rightframe') 203 | if (myframeR !== null) 204 | { 205 | try // access may be denied 206 | { 207 | var windowR = myframeR.contentWindow 208 | var docR = windowR.document; 209 | } 210 | catch (e) 211 | { 212 | return false; 213 | } 214 | 215 | if (docR !== null) 216 | { 217 | var sTheURL = docR.title 218 | 219 | var docL = myframeL.contentWindow.document; 220 | if (docL !== null) 221 | { 222 | 223 | var elems = docL.getElementsByTagName("a"); 224 | for (var i = elems.length; i--;) 225 | { 226 | if (elems[i].innerHTML == sTheURL) 227 | { 228 | if (elems[i].style.color != "black") 229 | { 230 | elems[i].style.color = "black"; 231 | } 232 | if (elems[i].style.fontWeight != 600) 233 | { 234 | elems[i].style.fontWeight = 600; 235 | } 236 | } 237 | else 238 | { 239 | if (elems[i].style.color != "#00709f") 240 | { 241 | elems[i].style.color = "#00709f"; 242 | } 243 | if (elems[i].style.fontWeight != 400) 244 | { 245 | elems[i].style.fontWeight = 400; 246 | } 247 | } 248 | } 249 | } 250 | } 251 | } 252 | } 253 | return false; 254 | } 255 | 256 | 257 | function GoBack() 258 | { 259 | history.back(); 260 | setTimeout(UpdateLocationByRightTitle, 100); // give it time to load 261 | return false; 262 | } 263 | 264 | 265 | function GoForward() 266 | { 267 | history.forward(); 268 | setTimeout(UpdateLocationByRightTitle, 100); // give it time to load 269 | return false; 270 | } 271 | 272 | function GoHome() 273 | { 274 | window.open("//--PLACEHOLDER-II-DO-NOT-REMOVE-ME--//"); 275 | } 276 | 277 | 278 | function LoadSearchKeywords(index) 279 | { 280 | if (index == null) 281 | { 282 | index = 0; 283 | } 284 | 285 | var myframe = document.getElementById('rightframe') 286 | 287 | if (myframe !== null) 288 | { 289 | 290 | var doc = myframe.contentWindow.document; 291 | if (doc) 292 | { 293 | bodytext = "" + doc.body.innerText 294 | bodytext = bodytext.replace(/\t/g, " ") 295 | bodytext = bodytext.replace(/\n/g, " ") 296 | bodytext = bodytext.replace(/\r/g, " ") 297 | bodytext = bodytext.replace(/ +/g, " ") 298 | searchDB[index].description = bodytext 299 | } 300 | } 301 | } 302 | 303 | 304 | function DoSearch() 305 | { 306 | var myframe = document.getElementsByTagName('iframe')[1]; 307 | if (myframe) 308 | { 309 | try // access may be denied 310 | { 311 | var windowX = myframe.contentWindow 312 | var doc = windowX.document; 313 | } 314 | catch (e) 315 | { 316 | document.getElementById("in").disabled = true; 317 | return false; 318 | } 319 | 320 | if (doc) 321 | { 322 | // Do the search 323 | var sTerm = document.getElementById("in").value; 324 | 325 | if (sTerm.toLowerCase() == "tetris") 326 | { 327 | SetIFrameSource("tetris.htm"); 328 | setTimeout(UpdateLocationByRightTitle, 50); // give it time to load 329 | return false; 330 | } 331 | else if (doc.title == "Tetris") 332 | { 333 | history.back(); 334 | setTimeout(DoSearch, 100); 335 | return false; 336 | } 337 | 338 | results = performSearch(sTerm); 339 | var regex = new RegExp(sTerm, "ig"); 340 | var sResult = ""; 341 | 342 | if (results) 343 | { 344 | // This means that there are search results to be displayed. 345 | // Loop through them and make it pretty! :) 346 | if (is_array(results)) 347 | { 348 | sResult += "

Search Results for \"" + sTerm + "\" (" + results.length + ")

"; 349 | sResult += "
    "; 350 | for (r = 0; r < results.length; r++) 351 | { 352 | result = searchDB[results[r]]; 353 | 354 | ///////////////////////////////////////////////////////////// 355 | // This is where you modify the formatting of the results 356 | sResult += "
  1. "; 357 | sResult += "
    " + (result.shortdesc ? result.shortdesc : result.description).replace(regex, "$&") + "
  2. "; 358 | ///////////////////////////////////////////////////////////// 359 | } 360 | sResult += "
"; 361 | } 362 | // If it's not an array, then we got an error message, so display that 363 | // rather than results 364 | else 365 | { 366 | sResult += "" + results + ""; 367 | } 368 | 369 | } 370 | doc.body.innerHTML = sResult; 371 | } 372 | } 373 | return false; 374 | } 375 | 376 | // These are the available "error strings" you can change them to affect the output 377 | // of the search engine. 378 | ERR_NoOptions = "You didn't specify where to search for your keywords, please try again."; 379 | ERR_NoSearchTerms = "You didn't enter any words to search for, please enter some words to search for and try again."; 380 | ERR_NoResults = "Your search found no results, try less specific terms."; 381 | 382 | // Performs an actual search and then returns the index number(s) in the db array 383 | // where it found this element. 384 | // keywords = the string they searched for (each space-separated word 385 | // is searched for separately) 386 | // options can be 387 | // 1 = search keywords, not description, not heading 388 | // 2 = search keywords, search description, not heading 389 | // 3 = search all 390 | function performSearch(keywords) 391 | { 392 | // Check to make sure they entered some search terms 393 | if (!keywords || keywords.length == 0) 394 | { 395 | return ERR_NoSearchTerms; 396 | } 397 | 398 | searchDescription = true; 399 | searchHeading = true 400 | 401 | // Setting up the keywords array for searching 402 | // Remove common punctuation 403 | keywords = keywords.replace("\.,'", ""); 404 | 405 | // get them all into an array so we can loop thru them 406 | // we assume a space was used to separate the terms 407 | searchFor = keywords.split(" "); 408 | 409 | // This is where we will be putting the results. 410 | results = new Array(); 411 | 412 | // Loop through the db for potential results 413 | // For every entry in the "database" 414 | for (sDB = 0; sDB < searchDB.length; sDB++) 415 | { 416 | 417 | // For every search term we are working with 418 | for (t = 0; t < searchFor.length; t++) 419 | { 420 | // Check in the heading for the term if required 421 | if (searchHeading) 422 | { 423 | if (searchDB[sDB].heading.toLowerCase().indexOf(searchFor[t].toLowerCase()) != -1) 424 | { 425 | if (!in_array(String(sDB), results)) 426 | { 427 | results[results.length] = String(sDB); 428 | } 429 | } 430 | } 431 | 432 | // Check in the description for the term if required 433 | if (searchDescription) 434 | { 435 | if (searchDB[sDB].description.toLowerCase().indexOf(searchFor[t].toLowerCase()) != -1) 436 | { 437 | if (!in_array(String(sDB), results)) 438 | { 439 | results[results.length] = String(sDB); 440 | } 441 | } 442 | } 443 | } 444 | } 445 | 446 | if (results.length > 0) 447 | { 448 | return results; 449 | } 450 | else 451 | { 452 | return ERR_NoResults; 453 | } 454 | } 455 | 456 | // Constructor for each search engine item. 457 | // Used to create a record in the searchable "database" 458 | function searchOption(heading, description, shortdesc, altlink) 459 | { 460 | this.heading = heading; 461 | this.description = description; 462 | this.shortdesc = ""; 463 | if (shortdesc != null) 464 | { 465 | this.shortdesc = shortdesc; 466 | } 467 | this.altlink = ""; 468 | if (altlink != null) 469 | { 470 | this.altlink = altlink; 471 | } 472 | return this; 473 | } 474 | 475 | // Returns true or false based on whether the specified string is found 476 | // in the array. 477 | // This is based on the PHP function of the same name. 478 | // stringToSearch = the string to look for 479 | // arrayToSearch = the array to look for the string in. 480 | function in_array(stringToSearch, arrayToSearch) 481 | { 482 | for (s = 0; s < arrayToSearch.length; s++) 483 | { 484 | if (arrayToSearch[s].indexOf(stringToSearch) != -1) 485 | { 486 | return true; 487 | exit; 488 | } 489 | } 490 | return false; 491 | } 492 | 493 | // Code from http://www.optimalworks.net/blog/2007/web-development/javascript/array-detection 494 | function is_array(array) { return !(!array || (!array.length || array.length == 0) || typeof array !== 'object' || !array.constructor || array.nodeType || array.item); } 495 | 496 | 497 | -------------------------------------------------------------------------------- /JS/Script_Right.js: -------------------------------------------------------------------------------- 1 | function UpdateLocation(sTheURL) { 2 | var myframeL = parent.document.getElementsByTagName('iframe')[0]; 3 | 4 | if (myframeL !== null) 5 | { 6 | 7 | var docL = myframeL.contentWindow.document; 8 | if (docL !== null) 9 | { 10 | 11 | var elems = docL.getElementsByTagName("a"); 12 | for (var i = elems.length; i--;) 13 | { 14 | if (elems[i].innerHTML == sTheURL) 15 | { 16 | if (elems[i].style.color != "black") 17 | { 18 | elems[i].style.color = "black"; 19 | } 20 | if (elems[i].style.fontWeight != 600) 21 | { 22 | elems[i].style.fontWeight = 600; 23 | } 24 | } 25 | else 26 | { 27 | if (elems[i].style.color != "#00709f") 28 | { 29 | elems[i].style.color = "#00709f"; 30 | } 31 | if (elems[i].style.fontWeight != 400) 32 | { 33 | elems[i].style.fontWeight = 400; 34 | } 35 | } 36 | 37 | } 38 | } 39 | } 40 | return false; 41 | } 42 | 43 | function BTN_OnClick(sIdCode, sTooltip) 44 | { 45 | if (clipboardData && clipboardData.setData) 46 | { 47 | clipboardData.setData("Text", document.getElementById(sIdCode).innerText); 48 | 49 | var oToolTip = document.getElementById(sTooltip); 50 | if (oToolTip != null) 51 | { 52 | oToolTip.innerHTML = "
Copied
"; 53 | oToolTip.style.pixelLeft = (event.x+20+document.documentElement.scrollLeft); 54 | oToolTip.style.pixelTop = (event.y+15+document.documentElement.scrollTop); 55 | oToolTip.style.visibility = "visible"; 56 | setTimeout(function(){oToolTip.style.visibility="hidden";}, 1200) 57 | } 58 | } 59 | } 60 | 61 | function Btn_OnMouseOver(oItem) 62 | { 63 | oItem.style.color="#fff"; 64 | oItem.style.background="#999"; 65 | 66 | } 67 | 68 | function Btn_OnMouseOut(oItem, sTooltip) 69 | { 70 | oItem.style.color = "#444"; 71 | oItem.style.background = "#E9E9E9"; 72 | 73 | var oToolTip = document.getElementById(sTooltip); 74 | if (oToolTip != null) 75 | { 76 | oToolTip.style.visibility = "hidden"; 77 | } 78 | } 79 | 80 | function MSDN_Nav(sTheURL, sFunc) 81 | { 82 | if (window.XMLHttpRequest) 83 | { 84 | var xmlhttp = new XMLHttpRequest(); 85 | } 86 | else 87 | { 88 | var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 89 | } 90 | 91 | if (sFunc.charAt(0) == "_") sFunc = sFunc.slice(1) 92 | sTheURL_Search = "http://social.msdn.microsoft.com/search/en-US?query=" 93 | 94 | xmlhttp.open("GET", sTheURL, true); 95 | 96 | xmlhttp.onreadystatechange = function() 97 | { 98 | if (xmlhttp.readyState == 4) 99 | { 100 | var regex = new RegExp("]*>([^<]+)<\/title>", "i"); 101 | var arr = xmlhttp.responseText.match(regex) 102 | var title = ""; 103 | try 104 | { 105 | title = arr[1]; 106 | } 107 | catch(e) 108 | { 109 | } 110 | 111 | regex = new RegExp(sFunc, "ig"); 112 | 113 | if (title.search(regex) == -1) 114 | { 115 | window.open(sTheURL_Search + sFunc) 116 | } 117 | else 118 | { 119 | window.open(sTheURL) 120 | } 121 | } 122 | } 123 | 124 | xmlhttp.send() 125 | } 126 | -------------------------------------------------------------------------------- /WinHttpConstants.au3: -------------------------------------------------------------------------------- 1 | 2 | ; For those who would fear the license - don't. I tried to license it as liberal as possible. 3 | ; It really means you can do what ever you want with this. 4 | ; Donations are wellcome and will be accepted via PayPal address: trancexx at yahoo dot com 5 | ; Thank you for the shiny stuff :kiss: 6 | 7 | #comments-start 8 | Copyright 2020 Dragana R. 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | #comments-end 22 | 23 | #include-once 24 | 25 | Global Const $INTERNET_DEFAULT_PORT = 0 26 | Global Const $INTERNET_DEFAULT_HTTP_PORT = 80 27 | Global Const $INTERNET_DEFAULT_HTTPS_PORT = 443 28 | 29 | Global Const $INTERNET_SCHEME_HTTP = 1 30 | Global Const $INTERNET_SCHEME_HTTPS = 2 31 | Global Const $INTERNET_SCHEME_FTP = 3 32 | 33 | Global Const $ICU_ESCAPE = 0x80000000 34 | 35 | ; For WinHttpOpen 36 | Global Const $WINHTTP_FLAG_ASYNC = 0x10000000 37 | 38 | ; For WinHttpOpenRequest ; 39 | Global Const $WINHTTP_FLAG_ESCAPE_PERCENT = 0x00000004 40 | Global Const $WINHTTP_FLAG_NULL_CODEPAGE = 0x00000008 41 | Global Const $WINHTTP_FLAG_ESCAPE_DISABLE = 0x00000040 42 | Global Const $WINHTTP_FLAG_ESCAPE_DISABLE_QUERY = 0x00000080 43 | Global Const $WINHTTP_FLAG_BYPASS_PROXY_CACHE = 0x00000100 44 | Global Const $WINHTTP_FLAG_REFRESH = $WINHTTP_FLAG_BYPASS_PROXY_CACHE 45 | Global Const $WINHTTP_FLAG_SECURE = 0x00800000 46 | 47 | Global Const $WINHTTP_ACCESS_TYPE_DEFAULT_PROXY = 0 48 | Global Const $WINHTTP_ACCESS_TYPE_NO_PROXY = 1 49 | Global Const $WINHTTP_ACCESS_TYPE_NAMED_PROXY = 3 50 | 51 | Global Const $WINHTTP_NO_PROXY_NAME = "" 52 | Global Const $WINHTTP_NO_PROXY_BYPASS = "" 53 | 54 | Global Const $WINHTTP_NO_REFERER = "" 55 | Global Const $WINHTTP_DEFAULT_ACCEPT_TYPES = 0 56 | 57 | Global Const $WINHTTP_NO_ADDITIONAL_HEADERS = "" 58 | Global Const $WINHTTP_NO_REQUEST_DATA = "" 59 | 60 | Global Const $WINHTTP_HEADER_NAME_BY_INDEX = "" 61 | Global Const $WINHTTP_NO_OUTPUT_BUFFER = 0 62 | Global Const $WINHTTP_NO_HEADER_INDEX = 0 63 | 64 | Global Const $WINHTTP_ADDREQ_INDEX_MASK = 0x0000FFFF 65 | Global Const $WINHTTP_ADDREQ_FLAGS_MASK = 0xFFFF0000 66 | Global Const $WINHTTP_ADDREQ_FLAG_ADD_IF_NEW = 0x10000000 67 | Global Const $WINHTTP_ADDREQ_FLAG_ADD = 0x20000000 68 | Global Const $WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA = 0x40000000 69 | Global Const $WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON = 0x01000000 70 | Global Const $WINHTTP_ADDREQ_FLAG_COALESCE = $WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA 71 | Global Const $WINHTTP_ADDREQ_FLAG_REPLACE = 0x80000000 72 | 73 | Global Const $WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH = 0 74 | 75 | ; For WinHttp{Set and Query} Options ; 76 | Global Const $WINHTTP_OPTION_CALLBACK = 1 77 | Global Const $WINHTTP_FIRST_OPTION = $WINHTTP_OPTION_CALLBACK 78 | Global Const $WINHTTP_OPTION_RESOLVE_TIMEOUT = 2 79 | Global Const $WINHTTP_OPTION_CONNECT_TIMEOUT = 3 80 | Global Const $WINHTTP_OPTION_CONNECT_RETRIES = 4 81 | Global Const $WINHTTP_OPTION_SEND_TIMEOUT = 5 82 | Global Const $WINHTTP_OPTION_RECEIVE_TIMEOUT = 6 83 | Global Const $WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT = 7 84 | Global Const $WINHTTP_OPTION_HANDLE_TYPE = 9 85 | Global Const $WINHTTP_OPTION_READ_BUFFER_SIZE = 12 86 | Global Const $WINHTTP_OPTION_WRITE_BUFFER_SIZE = 13 87 | Global Const $WINHTTP_OPTION_PARENT_HANDLE = 21 88 | Global Const $WINHTTP_OPTION_EXTENDED_ERROR = 24 89 | Global Const $WINHTTP_OPTION_SECURITY_FLAGS = 31 90 | Global Const $WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT = 32 91 | Global Const $WINHTTP_OPTION_URL = 34 92 | Global Const $WINHTTP_OPTION_SECURITY_KEY_BITNESS = 36 93 | Global Const $WINHTTP_OPTION_PROXY = 38 94 | Global Const $WINHTTP_OPTION_USER_AGENT = 41 95 | Global Const $WINHTTP_OPTION_CONTEXT_VALUE = 45 96 | Global Const $WINHTTP_OPTION_CLIENT_CERT_CONTEXT = 47 97 | Global Const $WINHTTP_OPTION_REQUEST_PRIORITY = 58 98 | Global Const $WINHTTP_OPTION_HTTP_VERSION = 59 99 | Global Const $WINHTTP_OPTION_DISABLE_FEATURE = 63 100 | Global Const $WINHTTP_OPTION_CODEPAGE = 68 101 | Global Const $WINHTTP_OPTION_MAX_CONNS_PER_SERVER = 73 102 | Global Const $WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER = 74 103 | Global Const $WINHTTP_OPTION_AUTOLOGON_POLICY = 77 104 | Global Const $WINHTTP_OPTION_SERVER_CERT_CONTEXT = 78 105 | Global Const $WINHTTP_OPTION_ENABLE_FEATURE = 79 106 | Global Const $WINHTTP_OPTION_WORKER_THREAD_COUNT = 80 107 | Global Const $WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT = 81 108 | Global Const $WINHTTP_OPTION_PASSPORT_COBRANDING_URL = 82 109 | Global Const $WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH = 83 110 | Global Const $WINHTTP_OPTION_SECURE_PROTOCOLS = 84 111 | Global Const $WINHTTP_OPTION_ENABLETRACING = 85 112 | Global Const $WINHTTP_OPTION_PASSPORT_SIGN_OUT = 86 113 | Global Const $WINHTTP_OPTION_PASSPORT_RETURN_URL = 87 114 | Global Const $WINHTTP_OPTION_REDIRECT_POLICY = 88 115 | Global Const $WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS = 89 116 | Global Const $WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE = 90 117 | Global Const $WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE = 91 118 | Global Const $WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE = 92 119 | Global Const $WINHTTP_OPTION_CONNECTION_INFO = 93 120 | Global Const $WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST = 94 121 | Global Const $WINHTTP_OPTION_SPN = 96 122 | Global Const $WINHTTP_OPTION_GLOBAL_PROXY_CREDS = 97 123 | Global Const $WINHTTP_OPTION_GLOBAL_SERVER_CREDS = 98 124 | Global Const $WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT = 99 125 | Global Const $WINHTTP_OPTION_REJECT_USERPWD_IN_URL = 100 126 | Global Const $WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS = 101 127 | Global Const $WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE = 103 128 | Global Const $WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE = 104 129 | Global Const $WINHTTP_OPTION_SERVER_SPN_USED = 106 130 | Global Const $WINHTTP_OPTION_PROXY_SPN_USED = 107 131 | Global Const $WINHTTP_OPTION_SERVER_CBT = 108 132 | Global Const $WINHTTP_OPTION_UNSAFE_HEADER_PARSING = 110 133 | Global Const $WINHTTP_OPTION_DECOMPRESSION = 118 134 | Global Const $WINHTTP_LAST_OPTION = $WINHTTP_OPTION_DECOMPRESSION 135 | 136 | Global Const $WINHTTP_OPTION_USERNAME = 0x1000 137 | Global Const $WINHTTP_OPTION_PASSWORD = 0x1001 138 | Global Const $WINHTTP_OPTION_PROXY_USERNAME = 0x1002 139 | Global Const $WINHTTP_OPTION_PROXY_PASSWORD = 0x1003 140 | 141 | Global Const $WINHTTP_CONNS_PER_SERVER_UNLIMITED = 0xFFFFFFFF 142 | 143 | ; For WINHTTP_OPTION_DECOMPRESSION 144 | Global Const $WINHTTP_DECOMPRESSION_FLAG_GZIP = 0x00000001 145 | Global Const $WINHTTP_DECOMPRESSION_FLAG_DEFLATE = 0x00000002 146 | Global Const $WINHTTP_DECOMPRESSION_FLAG_ALL = 0x00000003 147 | 148 | Global Const $WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM = 0 149 | Global Const $WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW = 1 150 | Global Const $WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH = 2 151 | Global Const $WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT = $WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM 152 | 153 | Global Const $WINHTTP_OPTION_REDIRECT_POLICY_NEVER = 0 154 | Global Const $WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP = 1 155 | Global Const $WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS = 2 156 | Global Const $WINHTTP_OPTION_REDIRECT_POLICY_LAST = $WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS 157 | Global Const $WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT = $WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP 158 | 159 | Global Const $WINHTTP_DISABLE_PASSPORT_AUTH = 0x00000000 160 | Global Const $WINHTTP_ENABLE_PASSPORT_AUTH = 0x10000000 161 | Global Const $WINHTTP_DISABLE_PASSPORT_KEYRING = 0x20000000 162 | Global Const $WINHTTP_ENABLE_PASSPORT_KEYRING = 0x40000000 163 | 164 | Global Const $WINHTTP_DISABLE_COOKIES = 0x00000001 165 | Global Const $WINHTTP_DISABLE_REDIRECTS = 0x00000002 166 | Global Const $WINHTTP_DISABLE_AUTHENTICATION = 0x00000004 167 | Global Const $WINHTTP_DISABLE_KEEP_ALIVE = 0x00000008 168 | Global Const $WINHTTP_ENABLE_SSL_REVOCATION = 0x00000001 169 | Global Const $WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION = 0x00000002 170 | Global Const $WINHTTP_DISABLE_SPN_SERVER_PORT = 0x00000000 171 | Global Const $WINHTTP_ENABLE_SPN_SERVER_PORT = 0x00000001 172 | Global Const $WINHTTP_OPTION_SPN_MASK = $WINHTTP_ENABLE_SPN_SERVER_PORT 173 | 174 | ; WinHTTP error codes ; 175 | Global Const $WINHTTP_ERROR_BASE = 12000 176 | Global Const $ERROR_WINHTTP_OUT_OF_HANDLES = 12001 177 | Global Const $ERROR_WINHTTP_TIMEOUT = 12002 178 | Global Const $ERROR_WINHTTP_INTERNAL_ERROR = 12004 179 | Global Const $ERROR_WINHTTP_INVALID_URL = 12005 180 | Global Const $ERROR_WINHTTP_UNRECOGNIZED_SCHEME = 12006 181 | Global Const $ERROR_WINHTTP_NAME_NOT_RESOLVED = 12007 182 | Global Const $ERROR_WINHTTP_INVALID_OPTION = 12009 183 | Global Const $ERROR_WINHTTP_OPTION_NOT_SETTABLE = 12011 184 | Global Const $ERROR_WINHTTP_SHUTDOWN = 12012 185 | Global Const $ERROR_WINHTTP_LOGIN_FAILURE = 12015 186 | Global Const $ERROR_WINHTTP_OPERATION_CANCELLED = 12017 187 | Global Const $ERROR_WINHTTP_INCORRECT_HANDLE_TYPE = 12018 188 | Global Const $ERROR_WINHTTP_INCORRECT_HANDLE_STATE = 12019 189 | Global Const $ERROR_WINHTTP_CANNOT_CONNECT = 12029 190 | Global Const $ERROR_WINHTTP_CONNECTION_ERROR = 12030 191 | Global Const $ERROR_WINHTTP_RESEND_REQUEST = 12032 192 | Global Const $ERROR_WINHTTP_SECURE_CERT_DATE_INVALID = 12037 193 | Global Const $ERROR_WINHTTP_SECURE_CERT_CN_INVALID = 12038 194 | Global Const $ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED = 12044 195 | Global Const $ERROR_WINHTTP_SECURE_INVALID_CA = 12045 196 | Global Const $ERROR_WINHTTP_SECURE_CERT_REV_FAILED = 12057 197 | Global Const $ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN = 12100 198 | Global Const $ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND = 12101 199 | Global Const $ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND = 12102 200 | Global Const $ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN = 12103 201 | Global Const $ERROR_WINHTTP_HEADER_NOT_FOUND = 12150 202 | Global Const $ERROR_WINHTTP_INVALID_SERVER_RESPONSE = 12152 203 | Global Const $ERROR_WINHTTP_INVALID_HEADER = 12153 204 | Global Const $ERROR_WINHTTP_INVALID_QUERY_REQUEST = 12154 205 | Global Const $ERROR_WINHTTP_HEADER_ALREADY_EXISTS = 12155 206 | Global Const $ERROR_WINHTTP_REDIRECT_FAILED = 12156 207 | Global Const $ERROR_WINHTTP_SECURE_CHANNEL_ERROR = 12157 208 | Global Const $ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT = 12166 209 | Global Const $ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT = 12167 210 | Global Const $ERROR_WINHTTP_SECURE_INVALID_CERT = 12169 211 | Global Const $ERROR_WINHTTP_SECURE_CERT_REVOKED = 12170 212 | Global Const $ERROR_WINHTTP_NOT_INITIALIZED = 12172 213 | Global Const $ERROR_WINHTTP_SECURE_FAILURE = 12175 214 | Global Const $ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR = 12178 215 | Global Const $ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE = 12179 216 | Global Const $ERROR_WINHTTP_AUTODETECTION_FAILED = 12180 217 | Global Const $ERROR_WINHTTP_HEADER_COUNT_EXCEEDED = 12181 218 | Global Const $ERROR_WINHTTP_HEADER_SIZE_OVERFLOW = 12182 219 | Global Const $ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW = 12183 220 | Global Const $ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW = 12184 221 | Global Const $ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY = 12185 222 | Global Const $ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY = 12186 223 | Global Const $WINHTTP_ERROR_LAST = 12186 224 | 225 | ; WinHttp status codes ; 226 | Global Const $HTTP_STATUS_CONTINUE = 100 227 | Global Const $HTTP_STATUS_SWITCH_PROTOCOLS = 101 228 | Global Const $HTTP_STATUS_OK = 200 229 | Global Const $HTTP_STATUS_CREATED = 201 230 | Global Const $HTTP_STATUS_ACCEPTED = 202 231 | Global Const $HTTP_STATUS_PARTIAL = 203 232 | Global Const $HTTP_STATUS_NO_CONTENT = 204 233 | Global Const $HTTP_STATUS_RESET_CONTENT = 205 234 | Global Const $HTTP_STATUS_PARTIAL_CONTENT = 206 235 | Global Const $HTTP_STATUS_WEBDAV_MULTI_STATUS = 207 236 | Global Const $HTTP_STATUS_AMBIGUOUS = 300 237 | Global Const $HTTP_STATUS_MOVED = 301 238 | Global Const $HTTP_STATUS_REDIRECT = 302 239 | Global Const $HTTP_STATUS_REDIRECT_METHOD = 303 240 | Global Const $HTTP_STATUS_NOT_MODIFIED = 304 241 | Global Const $HTTP_STATUS_USE_PROXY = 305 242 | Global Const $HTTP_STATUS_REDIRECT_KEEP_VERB = 307 243 | Global Const $HTTP_STATUS_BAD_REQUEST = 400 244 | Global Const $HTTP_STATUS_DENIED = 401 245 | Global Const $HTTP_STATUS_PAYMENT_REQ = 402 246 | Global Const $HTTP_STATUS_FORBIDDEN = 403 247 | Global Const $HTTP_STATUS_NOT_FOUND = 404 248 | Global Const $HTTP_STATUS_BAD_METHOD = 405 249 | Global Const $HTTP_STATUS_NONE_ACCEPTABLE = 406 250 | Global Const $HTTP_STATUS_PROXY_AUTH_REQ = 407 251 | Global Const $HTTP_STATUS_REQUEST_TIMEOUT = 408 252 | Global Const $HTTP_STATUS_CONFLICT = 409 253 | Global Const $HTTP_STATUS_GONE = 410 254 | Global Const $HTTP_STATUS_LENGTH_REQUIRED = 411 255 | Global Const $HTTP_STATUS_PRECOND_FAILED = 412 256 | Global Const $HTTP_STATUS_REQUEST_TOO_LARGE = 413 257 | Global Const $HTTP_STATUS_URI_TOO_LONG = 414 258 | Global Const $HTTP_STATUS_UNSUPPORTED_MEDIA = 415 259 | Global Const $HTTP_STATUS_RETRY_WITH = 449 260 | Global Const $HTTP_STATUS_SERVER_ERROR = 500 261 | Global Const $HTTP_STATUS_NOT_SUPPORTED = 501 262 | Global Const $HTTP_STATUS_BAD_GATEWAY = 502 263 | Global Const $HTTP_STATUS_SERVICE_UNAVAIL = 503 264 | Global Const $HTTP_STATUS_GATEWAY_TIMEOUT = 504 265 | Global Const $HTTP_STATUS_VERSION_NOT_SUP = 505 266 | Global Const $HTTP_STATUS_FIRST = $HTTP_STATUS_CONTINUE 267 | Global Const $HTTP_STATUS_LAST = $HTTP_STATUS_VERSION_NOT_SUP 268 | 269 | Global Const $SECURITY_FLAG_IGNORE_UNKNOWN_CA = 0x00000100 270 | Global Const $SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000 271 | Global Const $SECURITY_FLAG_IGNORE_CERT_CN_INVALID = 0x00001000 272 | Global Const $SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE = 0x00000200 273 | Global Const $SECURITY_FLAG_SECURE = 0x00000001 274 | Global Const $SECURITY_FLAG_STRENGTH_WEAK = 0x10000000 275 | Global Const $SECURITY_FLAG_STRENGTH_MEDIUM = 0x40000000 276 | Global Const $SECURITY_FLAG_STRENGTH_STRONG = 0x20000000 277 | 278 | Global Const $ICU_NO_ENCODE = 0x20000000 279 | Global Const $ICU_DECODE = 0x10000000 280 | Global Const $ICU_NO_META = 0x08000000 281 | Global Const $ICU_ENCODE_SPACES_ONLY = 0x04000000 282 | Global Const $ICU_BROWSER_MODE = 0x02000000 283 | Global Const $ICU_ENCODE_PERCENT = 0x00001000 284 | 285 | ; Query flags ; 286 | Global Const $WINHTTP_QUERY_MIME_VERSION = 0 287 | Global Const $WINHTTP_QUERY_CONTENT_TYPE = 1 288 | Global Const $WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2 289 | Global Const $WINHTTP_QUERY_CONTENT_ID = 3 290 | Global Const $WINHTTP_QUERY_CONTENT_DESCRIPTION = 4 291 | Global Const $WINHTTP_QUERY_CONTENT_LENGTH = 5 292 | Global Const $WINHTTP_QUERY_CONTENT_LANGUAGE = 6 293 | Global Const $WINHTTP_QUERY_ALLOW = 7 294 | Global Const $WINHTTP_QUERY_PUBLIC = 8 295 | Global Const $WINHTTP_QUERY_DATE = 9 296 | Global Const $WINHTTP_QUERY_EXPIRES = 10 297 | Global Const $WINHTTP_QUERY_LAST_MODIFIED = 11 298 | Global Const $WINHTTP_QUERY_MESSAGE_ID = 12 299 | Global Const $WINHTTP_QUERY_URI = 13 300 | Global Const $WINHTTP_QUERY_DERIVED_FROM = 14 301 | Global Const $WINHTTP_QUERY_COST = 15 302 | Global Const $WINHTTP_QUERY_LINK = 16 303 | Global Const $WINHTTP_QUERY_PRAGMA = 17 304 | Global Const $WINHTTP_QUERY_VERSION = 18 305 | Global Const $WINHTTP_QUERY_STATUS_CODE = 19 306 | Global Const $WINHTTP_QUERY_STATUS_TEXT = 20 307 | Global Const $WINHTTP_QUERY_RAW_HEADERS = 21 308 | Global Const $WINHTTP_QUERY_RAW_HEADERS_CRLF = 22 309 | Global Const $WINHTTP_QUERY_CONNECTION = 23 310 | Global Const $WINHTTP_QUERY_ACCEPT = 24 311 | Global Const $WINHTTP_QUERY_ACCEPT_CHARSET = 25 312 | Global Const $WINHTTP_QUERY_ACCEPT_ENCODING = 26 313 | Global Const $WINHTTP_QUERY_ACCEPT_LANGUAGE = 27 314 | Global Const $WINHTTP_QUERY_AUTHORIZATION = 28 315 | Global Const $WINHTTP_QUERY_CONTENT_ENCODING = 29 316 | Global Const $WINHTTP_QUERY_FORWARDED = 30 317 | Global Const $WINHTTP_QUERY_FROM = 31 318 | Global Const $WINHTTP_QUERY_IF_MODIFIED_SINCE = 32 319 | Global Const $WINHTTP_QUERY_LOCATION = 33 320 | Global Const $WINHTTP_QUERY_ORIG_URI = 34 321 | Global Const $WINHTTP_QUERY_REFERER = 35 322 | Global Const $WINHTTP_QUERY_RETRY_AFTER = 36 323 | Global Const $WINHTTP_QUERY_SERVER = 37 324 | Global Const $WINHTTP_QUERY_TITLE = 38 325 | Global Const $WINHTTP_QUERY_USER_AGENT = 39 326 | Global Const $WINHTTP_QUERY_WWW_AUTHENTICATE = 40 327 | Global Const $WINHTTP_QUERY_PROXY_AUTHENTICATE = 41 328 | Global Const $WINHTTP_QUERY_ACCEPT_RANGES = 42 329 | Global Const $WINHTTP_QUERY_SET_COOKIE = 43 330 | Global Const $WINHTTP_QUERY_COOKIE = 44 331 | Global Const $WINHTTP_QUERY_REQUEST_METHOD = 45 332 | Global Const $WINHTTP_QUERY_REFRESH = 46 333 | Global Const $WINHTTP_QUERY_CONTENT_DISPOSITION = 47 334 | Global Const $WINHTTP_QUERY_AGE = 48 335 | Global Const $WINHTTP_QUERY_CACHE_CONTROL = 49 336 | Global Const $WINHTTP_QUERY_CONTENT_BASE = 50 337 | Global Const $WINHTTP_QUERY_CONTENT_LOCATION = 51 338 | Global Const $WINHTTP_QUERY_CONTENT_MD5 = 52 339 | Global Const $WINHTTP_QUERY_CONTENT_RANGE = 53 340 | Global Const $WINHTTP_QUERY_ETAG = 54 341 | Global Const $WINHTTP_QUERY_HOST = 55 342 | Global Const $WINHTTP_QUERY_IF_MATCH = 56 343 | Global Const $WINHTTP_QUERY_IF_NONE_MATCH = 57 344 | Global Const $WINHTTP_QUERY_IF_RANGE = 58 345 | Global Const $WINHTTP_QUERY_IF_UNMODIFIED_SINCE = 59 346 | Global Const $WINHTTP_QUERY_MAX_FORWARDS = 60 347 | Global Const $WINHTTP_QUERY_PROXY_AUTHORIZATION = 61 348 | Global Const $WINHTTP_QUERY_RANGE = 62 349 | Global Const $WINHTTP_QUERY_TRANSFER_ENCODING = 63 350 | Global Const $WINHTTP_QUERY_UPGRADE = 64 351 | Global Const $WINHTTP_QUERY_VARY = 65 352 | Global Const $WINHTTP_QUERY_VIA = 66 353 | Global Const $WINHTTP_QUERY_WARNING = 67 354 | Global Const $WINHTTP_QUERY_EXPECT = 68 355 | Global Const $WINHTTP_QUERY_PROXY_CONNECTION = 69 356 | Global Const $WINHTTP_QUERY_UNLESS_MODIFIED_SINCE = 70 357 | Global Const $WINHTTP_QUERY_PROXY_SUPPORT = 75 358 | Global Const $WINHTTP_QUERY_AUTHENTICATION_INFO = 76 359 | Global Const $WINHTTP_QUERY_PASSPORT_URLS = 77 360 | Global Const $WINHTTP_QUERY_PASSPORT_CONFIG = 78 361 | Global Const $WINHTTP_QUERY_MAX = 78 362 | Global Const $WINHTTP_QUERY_CUSTOM = 65535 363 | Global Const $WINHTTP_QUERY_FLAG_REQUEST_HEADERS = 0x80000000 364 | Global Const $WINHTTP_QUERY_FLAG_SYSTEMTIME = 0x40000000 365 | Global Const $WINHTTP_QUERY_FLAG_NUMBER = 0x20000000 366 | 367 | ; Callback options ; 368 | Global Const $WINHTTP_CALLBACK_STATUS_RESOLVING_NAME = 0x00000001 369 | Global Const $WINHTTP_CALLBACK_STATUS_NAME_RESOLVED = 0x00000002 370 | Global Const $WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER = 0x00000004 371 | Global Const $WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER = 0x00000008 372 | Global Const $WINHTTP_CALLBACK_STATUS_SENDING_REQUEST = 0x00000010 373 | Global Const $WINHTTP_CALLBACK_STATUS_REQUEST_SENT = 0x00000020 374 | Global Const $WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE = 0x00000040 375 | Global Const $WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED = 0x00000080 376 | Global Const $WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION = 0x00000100 377 | Global Const $WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED = 0x00000200 378 | Global Const $WINHTTP_CALLBACK_STATUS_HANDLE_CREATED = 0x00000400 379 | Global Const $WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING = 0x00000800 380 | Global Const $WINHTTP_CALLBACK_STATUS_DETECTING_PROXY = 0x00001000 381 | Global Const $WINHTTP_CALLBACK_STATUS_REDIRECT = 0x00004000 382 | Global Const $WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE = 0x00008000 383 | Global Const $WINHTTP_CALLBACK_STATUS_SECURE_FAILURE = 0x00010000 384 | Global Const $WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE = 0x00020000 385 | Global Const $WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE = 0x00040000 386 | Global Const $WINHTTP_CALLBACK_STATUS_READ_COMPLETE = 0x00080000 387 | Global Const $WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE = 0x00100000 388 | Global Const $WINHTTP_CALLBACK_STATUS_REQUEST_ERROR = 0x00200000 389 | Global Const $WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE = 0x00400000 390 | Global Const $WINHTTP_CALLBACK_FLAG_RESOLVE_NAME = 0x00000003 391 | Global Const $WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER = 0x0000000C 392 | Global Const $WINHTTP_CALLBACK_FLAG_SEND_REQUEST = 0x00000030 393 | Global Const $WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE = 0x000000C0 394 | Global Const $WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION = 0x00000300 395 | Global Const $WINHTTP_CALLBACK_FLAG_HANDLES = 0x00000C00 396 | Global Const $WINHTTP_CALLBACK_FLAG_DETECTING_PROXY = $WINHTTP_CALLBACK_STATUS_DETECTING_PROXY 397 | Global Const $WINHTTP_CALLBACK_FLAG_REDIRECT = $WINHTTP_CALLBACK_STATUS_REDIRECT 398 | Global Const $WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE = $WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE 399 | Global Const $WINHTTP_CALLBACK_FLAG_SECURE_FAILURE = $WINHTTP_CALLBACK_STATUS_SECURE_FAILURE 400 | Global Const $WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE = $WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE 401 | Global Const $WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE = $WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE 402 | Global Const $WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE = $WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE 403 | Global Const $WINHTTP_CALLBACK_FLAG_READ_COMPLETE = $WINHTTP_CALLBACK_STATUS_READ_COMPLETE 404 | Global Const $WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE = $WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE 405 | Global Const $WINHTTP_CALLBACK_FLAG_REQUEST_ERROR = $WINHTTP_CALLBACK_STATUS_REQUEST_ERROR 406 | Global Const $WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS = 0x007E0000 407 | Global Const $WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS = 0xFFFFFFFF 408 | 409 | Global Const $API_RECEIVE_RESPONSE = 1 410 | Global Const $API_QUERY_DATA_AVAILABLE = 2 411 | Global Const $API_READ_DATA = 3 412 | Global Const $API_WRITE_DATA = 4 413 | Global Const $API_SEND_REQUEST = 5 414 | 415 | Global Const $WINHTTP_HANDLE_TYPE_SESSION = 1 416 | Global Const $WINHTTP_HANDLE_TYPE_CONNECT = 2 417 | Global Const $WINHTTP_HANDLE_TYPE_REQUEST = 3 418 | 419 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED = 0x00000001 420 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT = 0x00000002 421 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED = 0x00000004 422 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA = 0x00000008 423 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID = 0x00000010 424 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID = 0x00000020 425 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE = 0x00000040 426 | Global Const $WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR = 0x80000000 427 | 428 | Global Const $WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 = 0x00000008 429 | Global Const $WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 = 0x00000020 430 | Global Const $WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 = 0x00000080 431 | Global Const $WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 = 0x00000200 432 | Global Const $WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 = 0x00000800 433 | Global Const $WINHTTP_FLAG_SECURE_PROTOCOL_ALL = 0x000000A8 434 | 435 | Global Const $WINHTTP_AUTH_SCHEME_BASIC = 0x00000001 436 | Global Const $WINHTTP_AUTH_SCHEME_NTLM = 0x00000002 437 | Global Const $WINHTTP_AUTH_SCHEME_PASSPORT = 0x00000004 438 | Global Const $WINHTTP_AUTH_SCHEME_DIGEST = 0x00000008 439 | Global Const $WINHTTP_AUTH_SCHEME_NEGOTIATE = 0x00000010 440 | 441 | Global Const $WINHTTP_AUTH_TARGET_SERVER = 0x00000000 442 | Global Const $WINHTTP_AUTH_TARGET_PROXY = 0x00000001 443 | 444 | 445 | Global Const $WINHTTP_AUTOPROXY_AUTO_DETECT = 0x00000001 446 | Global Const $WINHTTP_AUTOPROXY_CONFIG_URL = 0x00000002 447 | Global Const $WINHTTP_AUTOPROXY_RUN_INPROCESS = 0x00010000 448 | Global Const $WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY = 0x00020000 449 | Global Const $WINHTTP_AUTO_DETECT_TYPE_DHCP = 0x00000001 450 | Global Const $WINHTTP_AUTO_DETECT_TYPE_DNS_A = 0x00000002 -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpAddRequestHeaders.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; !!!Note that this example will fail because of invalid username and password!!! 8 | 9 | Global $sAddress = "secure.imdb.com" 10 | Global $sUserName = "SomeUserName" 11 | Global $sPassword = "SomePassword" 12 | ; Post data: 13 | Global $sPostData = "login=" & $sUserName & "&password=" & $sPassword & "&u=https%3A%2F%2Fsecure.imdb.com%2Fregister-imdb%2Flogin" 14 | 15 | ; Initialize and get session handle 16 | Global $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5") 17 | 18 | ; Get connection handle 19 | Global $hConnect = _WinHttpConnect($hOpen, $sAddress, $INTERNET_DEFAULT_HTTPS_PORT) 20 | 21 | ; Make a request 22 | Global $hRequest = _WinHttpOpenRequest($hConnect, _ 23 | "POST", _ 24 | "register-imdb/login", _ 25 | Default, _ 26 | Default, _ 27 | "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", _ 28 | $WINHTTP_FLAG_SECURE) 29 | 30 | ; Add header fields to the request 31 | _WinHttpAddRequestHeaders($hRequest, "Accept-Language: en-us,en;q=0.5") 32 | _WinHttpAddRequestHeaders($hRequest, "Content-Type: application/x-www-form-urlencoded") 33 | _WinHttpAddRequestHeaders($hRequest, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7") 34 | _WinHttpAddRequestHeaders($hRequest, "Keep-Alive: 300") 35 | _WinHttpAddRequestHeaders($hRequest, "Connection: keep-alive") 36 | 37 | ; Send it 38 | _WinHttpSendRequest($hRequest, -1, $sPostData) 39 | ; Wait for the response 40 | _WinHttpReceiveResponse($hRequest) 41 | ; Check if there is a response 42 | Global $sHeader, $sReturned 43 | If _WinHttpQueryDataAvailable($hRequest) Then 44 | $sHeader = _WinHttpQueryHeaders($hRequest) 45 | MsgBox(64, "Header", $sHeader) 46 | Do 47 | $sReturned &= _WinHttpReadData($hRequest) 48 | Until @error 49 | ; Print returned 50 | ConsoleWrite($sReturned) 51 | Else 52 | ConsoleWriteError("!No data available." & @CRLF) 53 | MsgBox(48, "Failure", "No data available.") 54 | EndIf 55 | 56 | ; Close handles 57 | _WinHttpCloseHandle($hRequest) 58 | _WinHttpCloseHandle($hConnect) 59 | _WinHttpCloseHandle($hOpen) 60 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpCheckPlatform.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | If Not _WinHttpCheckPlatform() Then 8 | MsgBox(48, "Caution", "WinHTTP not available on your system!") 9 | Exit 1 10 | EndIf 11 | 12 | ;... The rest of the code 13 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpCloseHandle.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | If @error Then 10 | MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.") 11 | Exit 1 12 | EndIf 13 | 14 | ; Close it 15 | _WinHttpCloseHandle($hOpen) 16 | If @error Then 17 | ConsoleWriteError("!Error closing the handle. @error = " & @error & @CRLF) 18 | MsgBox(48, "Error", "Error closing the handle." & @CRLF & "Error number is " & @error) 19 | Else 20 | ConsoleWrite("+ Handle is succesfully closed." & @CRLF) 21 | MsgBox(64, "Closed", "Handle is succesfully closed.") 22 | EndIf -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpConnect.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | 10 | ; Get connection handle 11 | Global $hConnect = _WinHttpConnect($hOpen, "http://www.pravda.ru") 12 | If @error Then 13 | MsgBox(48, "Error", "Error getting connection handle." & @CRLF & "Error number is " & @error) 14 | Else 15 | ConsoleWrite("+ Connection handle $hConnect = " & $hConnect & @CRLF) 16 | MsgBox(64, "Yes!", "Handle is get! $hConnect = " & $hConnect) 17 | EndIf 18 | 19 | ; Close handles 20 | _WinHttpCloseHandle($hConnect) 21 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpCrackUrl.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | #include 5 | 6 | Opt("MustDeclareVars", 1) 7 | 8 | ; Cracking URL 9 | Global $aUrl = _WinHttpCrackUrl("http://www.autoitscript.com/forum/index.php?showforum=9") 10 | _ArrayDisplay($aUrl, "_WinHttpCrackUrl()") 11 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpCreateUrl.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Creating URL out of array of components: 8 | Global $aURL[8] = ["http", 1, "www.autoitscript.com", 80, "Jon", "deadPiXels", "admin.php"] 9 | MsgBox(0, "Created URL", _WinHttpCreateUrl($aURL)) 10 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpDetectAutoProxyConfigUrl.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; This could take some time 8 | Global $sPACurl = _WinHttpDetectAutoProxyConfigUrl(BitOR($WINHTTP_AUTO_DETECT_TYPE_DHCP, $WINHTTP_AUTO_DETECT_TYPE_DNS_A)) 9 | 10 | MsgBox(64, "_WinHttpDetectAutoProxyConfigUrl", "The URL for the Proxy Auto-Configuration (PAC) file is: " & $sPACurl) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpGetDefaultProxyConfiguration.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | #include 5 | 6 | Opt("MustDeclareVars", 1) 7 | 8 | ; Current WinHTTP proxy configuration: 9 | Global $aProxy = _WinHttpGetDefaultProxyConfiguration() 10 | _ArrayDisplay($aProxy, "Current WinHTTP proxy configuration") -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpGetIEProxyConfigForCurrentUser.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | #include 5 | 6 | Opt("MustDeclareVars", 1) 7 | 8 | ; Internet Explorer proxy configuration for the current user: 9 | Global $aIEproxy = _WinHttpGetIEProxyConfigForCurrentUser() 10 | _ArrayDisplay($aIEproxy, "Internet Explorer proxy configuration") -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpOpen.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | If @error Then 10 | MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.") 11 | Exit 1 12 | EndIf 13 | 14 | ; Close it 15 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpOpenRequest.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; !!!Note that this example will fail because of invalid username and password!!! 8 | 9 | ; Authentication data 10 | Global $sUsername = "UserName" 11 | Global $sPassword = "Password" 12 | 13 | ; Address 14 | Global $sAddress = "space.livevn.com" 15 | 16 | ; Initialize and get session handle 17 | Global $hOpen = _WinHttpOpen() 18 | 19 | ; Get connection handle 20 | Global $hConnect = _WinHttpConnect($hOpen, $sAddress) 21 | 22 | ; Request 23 | Global $hRequest = _WinHttpOpenRequest($hConnect, _ 24 | "POST", _ ; verb 25 | "/do.php?ac=71ee30ae117cddace55bd01714904227&&ref", _ ; target 26 | Default, _ ; version 27 | "http://space.livevn.com/index.php", _ ; referer 28 | "*/*") ; accept 29 | 30 | ; Send it 31 | _WinHttpSendRequest($hRequest, _ 32 | "Content-Type: application/x-www-form-urlencoded" & @CRLF, _ 33 | "username=" & $sUsername & "&password=" & $sPassword & "&loginsubmit=&loginsubmit=loginnnnnnnnnnn&refer=network.html&formhash=c51a94db") 34 | 35 | ; Wait for the response 36 | _WinHttpReceiveResponse($hRequest) 37 | 38 | ; See what's returned 39 | If _WinHttpQueryDataAvailable($hRequest) Then 40 | Global $sHeader = _WinHttpQueryHeaders($hRequest) 41 | ConsoleWrite($sHeader & @CRLF) 42 | ; Check if proper cookie is given 43 | If StringInStr($sHeader, 'Set-Cookie: uchome_loginuser=' & $sUsername) Then 44 | MsgBox(0, "", "Login success") 45 | Else 46 | MsgBox(0, "", "Login failed") 47 | EndIf 48 | Else 49 | MsgBox(48, "Error", "Site is experiencing problems.") 50 | EndIf 51 | 52 | 53 | ; Close open handles and exit 54 | _WinHttpCloseHandle($hRequest) 55 | _WinHttpCloseHandle($hConnect) 56 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpQueryAuthSchemes.au3: -------------------------------------------------------------------------------- 1 | 2 | #include "WinHttp.au3" 3 | 4 | Opt("MustDeclareVars", 1) 5 | 6 | Global Const $sAddress = "192.168.1.1" ; some address that requires authorization 7 | 8 | ; Credentials (incorrect values here - the example will fail therefore!) 9 | Global Const $sUserName = "user", $sPassword = "password" 10 | 11 | ; Login and print the result to the console 12 | ConsoleWrite(_LoginExample($sAddress, $sUserName, $sPassword) & @CRLF) 13 | 14 | 15 | ; The function 16 | Func _LoginExample($sAddress, $sUserName, $sPassword) 17 | Local $sOut ; this variable data will be returned 18 | 19 | ; Initialize and get session handle 20 | Local $hOpen = _WinHttpOpen() 21 | If $hOpen Then 22 | ; Get connection handle 23 | Local $hConnect = _WinHttpConnect($hOpen, $sAddress) 24 | If $hConnect Then 25 | ; Specify the reguest 26 | Local $hRequest = _WinHttpOpenRequest($hConnect) 27 | If $hRequest Then 28 | ; Send the request 29 | _WinHttpSendRequest($hRequest) 30 | 31 | ; Wait for the response 32 | _WinHttpReceiveResponse($hRequest) 33 | 34 | ; Query status code 35 | Local $iStatusCode = _WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_STATUS_CODE) 36 | ; Check status code 37 | If $iStatusCode = $HTTP_STATUS_DENIED Or $iStatusCode = $HTTP_STATUS_PROXY_AUTH_REQ Then 38 | ; Query Authorization scheme 39 | Local $iSupportedSchemes, $iFirstScheme, $iAuthTarget 40 | If _WinHttpQueryAuthSchemes($hRequest, $iSupportedSchemes, $iFirstScheme, $iAuthTarget) Then 41 | ; Set passed credentials 42 | _WinHttpSetCredentials($hRequest, $iAuthTarget, $iFirstScheme, $sUserName, $sPassword) 43 | ; Send request again now 44 | _WinHttpSendRequest($hRequest) 45 | ; And wait for the response again 46 | _WinHttpReceiveResponse($hRequest) 47 | EndIf 48 | EndIf 49 | 50 | ; Check if there is any data available and read if yes 51 | Local $sChunk 52 | If _WinHttpQueryDataAvailable($hRequest) Then 53 | While 1 54 | $sChunk = _WinHttpReadData($hRequest) 55 | If @error Then ExitLoop 56 | $sOut &= $sChunk 57 | WEnd 58 | EndIf 59 | 60 | ; Close handles when they are not needed any more 61 | _WinHttpCloseHandle($hRequest) 62 | EndIf 63 | _WinHttpCloseHandle($hConnect) 64 | EndIf 65 | _WinHttpCloseHandle($hOpen) 66 | EndIf 67 | 68 | ; Return whatever is read 69 | Return $sOut 70 | EndFunc 71 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpQueryDataAvailable.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | ; Get connection handle 10 | Global $hConnect = _WinHttpConnect($hOpen, "google.com") 11 | ; Specify the reguest 12 | Global $hRequest = _WinHttpOpenRequest($hConnect) 13 | ; Send request 14 | _WinHttpSendRequest($hRequest) 15 | 16 | ; Wait for the response 17 | _WinHttpReceiveResponse($hRequest) 18 | 19 | ; Check there is data available... 20 | If _WinHttpQueryDataAvailable($hRequest) Then 21 | MsgBox(64, "OK", "Data from google.com is available!") 22 | Else 23 | MsgBox(48, "Error", "Site is experiencing problems (or you).") 24 | EndIf 25 | 26 | ; Clean 27 | _WinHttpCloseHandle($hRequest) 28 | _WinHttpCloseHandle($hConnect) 29 | _WinHttpCloseHandle($hOpen) 30 | 31 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpQueryHeaders.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Open needed handles 8 | Global $hOpen = _WinHttpOpen() 9 | Global $hConnect = _WinHttpConnect($hOpen, "msdn.microsoft.com") 10 | ; Specify the reguest: 11 | Global $hRequest = _WinHttpOpenRequest($hConnect, Default, "en-us/library/aa384101(VS.85).aspx") 12 | 13 | ; Send request 14 | _WinHttpSendRequest($hRequest) 15 | 16 | ; Wait for the response 17 | _WinHttpReceiveResponse($hRequest) 18 | 19 | ; Get full header 20 | Global $sHeader = _WinHttpQueryHeaders($hRequest) 21 | 22 | ; Close handles 23 | _WinHttpCloseHandle($hRequest) 24 | _WinHttpCloseHandle($hConnect) 25 | _WinHttpCloseHandle($hOpen) 26 | 27 | ; Display retrieved header 28 | MsgBox(0, "Header", $sHeader) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpQueryOption.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | 10 | ; Set User-Agent string 11 | _WinHttpSetOption($hOpen, $WINHTTP_OPTION_USER_AGENT, "Who the fuc*k is Alice???") 12 | 13 | ; Get connection handle 14 | Global $hConnect = _WinHttpConnect($hOpen, "google.com") 15 | 16 | ; Specify the reguest 17 | Global $hRequest = _WinHttpOpenRequest($hConnect) 18 | 19 | ; Send request 20 | _WinHttpSendRequest($hRequest) 21 | 22 | ; Check what User-Agent string was used 23 | ConsoleWrite("! Custom agent: " & _WinHttpQueryOption($hOpen, $WINHTTP_OPTION_USER_AGENT) & @CRLF & @CRLF) 24 | 25 | ; Wait for the response 26 | _WinHttpReceiveResponse($hRequest) 27 | 28 | Global $sHeader 29 | ; If there is data available... 30 | If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header 31 | 32 | ; Clean 33 | _WinHttpCloseHandle($hRequest) 34 | _WinHttpCloseHandle($hConnect) 35 | _WinHttpCloseHandle($hOpen) 36 | 37 | ; Display retrieved header 38 | ConsoleWrite($sHeader & @CRLF) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpReadData.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize 8 | Global $hOpen = _WinHttpOpen() 9 | 10 | If @error Then 11 | MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.") 12 | Exit 1 13 | EndIf 14 | 15 | ; Specify what to connect to 16 | Global $hConnect = _WinHttpConnect($hOpen, "yahoo.com") ; <- yours here 17 | If @error Then 18 | MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.") 19 | _WinHttpCloseHandle($hOpen) 20 | Exit 2 21 | EndIf 22 | 23 | ; Create request 24 | Global $hRequest = _WinHttpOpenRequest($hConnect) 25 | If @error Then 26 | MsgBox(48, "Error", "Error creating an HTTP request handle.") 27 | _WinHttpCloseHandle($hConnect) 28 | _WinHttpCloseHandle($hOpen) 29 | Exit 3 30 | EndIf 31 | 32 | ; Send it 33 | _WinHttpSendRequest($hRequest) 34 | If @error Then 35 | MsgBox(48, "Error", "Error sending specified request.") 36 | _WinHttpCloseHandle($hRequest) 37 | _WinHttpCloseHandle($hConnect) 38 | _WinHttpCloseHandle($hOpen) 39 | Exit 4 40 | EndIf 41 | 42 | ; Wait for the response 43 | _WinHttpReceiveResponse($hRequest) 44 | If @error Then 45 | MsgBox(48, "Error", "Error waiting for the response from the server.") 46 | _WinHttpCloseHandle($hRequest) 47 | _WinHttpCloseHandle($hConnect) 48 | _WinHttpCloseHandle($hOpen) 49 | Exit 5 50 | EndIf 51 | 52 | ; See if there is data to read 53 | Global $sChunk, $sData 54 | If _WinHttpQueryDataAvailable($hRequest) Then 55 | ; Read 56 | While 1 57 | $sChunk = _WinHttpReadData($hRequest) 58 | If @error Then ExitLoop 59 | $sData &= $sChunk 60 | WEnd 61 | ConsoleWrite($sData & @CRLF) ; print to console 62 | Else 63 | MsgBox(48, "Error", "Site is experiencing problems.") 64 | EndIf 65 | 66 | ; Close handles when they are not needed any more 67 | _WinHttpCloseHandle($hRequest) 68 | _WinHttpCloseHandle($hConnect) 69 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpReceiveResponse.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize 8 | Global $hOpen = _WinHttpOpen() 9 | ; Specify what to connect to 10 | Global $hConnect = _WinHttpConnect($hOpen, "en.wikipedia.org") 11 | ; Create request 12 | Global $hRequest = _WinHttpOpenRequest($hConnect, -1, "wiki/Manchester_United_F.C.") 13 | ; Send it 14 | _WinHttpSendRequest($hRequest) 15 | 16 | ; Wait for the response 17 | _WinHttpReceiveResponse($hRequest) 18 | If @error Then 19 | MsgBox(48, "Error", "Error ocurred for WinHttpReceiveResponse, Error number is " & @error) 20 | Else 21 | MsgBox(64, "All right!", "Server at 'en.wikipedia.org' processed the request.") 22 | EndIf 23 | 24 | ; Close handles 25 | _WinHttpCloseHandle($hRequest) 26 | _WinHttpCloseHandle($hConnect) 27 | _WinHttpCloseHandle($hOpen) 28 | 29 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSendRequest.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | ; http://www.w3schools.com/php/demo_form_validation_escapechar.php 6 | 7 | $sUserName = "SomeUserName" 8 | $sEmail = "some.email@something.com" 9 | 10 | $sDomain = "www.w3schools.com" 11 | $sPage = "/php/demo_form_validation_escapechar.php" 12 | 13 | ; Data to send 14 | $sAdditionalData = "name=" & $sUserName & "&email=" & $sEmail 15 | 16 | ; Initialize and get session handle 17 | $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0") 18 | 19 | ; Get connection handle 20 | $hConnect = _WinHttpConnect($hOpen, $sDomain) 21 | 22 | ; Make a request 23 | $hRequest = _WinHttpOpenRequest($hConnect, "POST", $sPage) 24 | 25 | ; Send it. Specify additional data to send too. This is required by the Google API: 26 | _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $sAdditionalData) 27 | 28 | ; Wait for the response 29 | _WinHttpReceiveResponse($hRequest) 30 | 31 | ; See what's returned 32 | Dim $sReturned 33 | If _WinHttpQueryDataAvailable($hRequest) Then ; if there is data 34 | Do 35 | $sReturned &= _WinHttpReadData($hRequest) 36 | Until @error 37 | EndIf 38 | 39 | ; Close handles 40 | _WinHttpCloseHandle($hRequest) 41 | _WinHttpCloseHandle($hConnect) 42 | _WinHttpCloseHandle($hOpen) 43 | 44 | ; See what's returned 45 | MsgBox(4096, "Returned", $sReturned) 46 | ConsoleWrite($sReturned & @CRLF) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSetCredentials.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; !!! The result of this script will be this sent to the server: 8 | #cs 9 | POST /admin.php HTTP/1.1 10 | Connection: Keep-Alive 11 | Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8 12 | User-Agent: AutoIt/3.3 13 | Content-Length: 0 14 | Host: 127.0.0.1 15 | Authorization: Basic YWRtaW46YWRtaW4= 16 | #ce 17 | 18 | ; My server 19 | Global $sLocalIP = "127.0.0.1" 20 | ; Initialize and get session handle 21 | Global $hOpen = _WinHttpOpen() 22 | ; Get connection handle 23 | Global $hConnect = _WinHttpConnect($hOpen, $sLocalIP) 24 | ; Specify the reguest 25 | Global $hRequest = _WinHttpOpenRequest($hConnect, _ 26 | "POST", _ ; verb 27 | "admin.php", _ ; object 28 | Default, _ ; version 29 | Default, _ ; referrer 30 | "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") ; accept types 31 | 32 | ; Set credentials 33 | _WinHttpSetCredentials($hRequest, $WINHTTP_AUTH_TARGET_SERVER, $WINHTTP_AUTH_SCHEME_BASIC, "admin", "admin") 34 | 35 | ; Send request 36 | _WinHttpSendRequest($hRequest) 37 | ; Wait for the response 38 | _WinHttpReceiveResponse($hRequest) 39 | 40 | ; .... The rest of the code here... 41 | 42 | ; Close handles 43 | _WinHttpCloseHandle($hRequest) 44 | _WinHttpCloseHandle($hConnect) 45 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSetDefaultProxyConfiguration.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Set No-proxy: 8 | _WinHttpSetDefaultProxyConfiguration($WINHTTP_ACCESS_TYPE_NO_PROXY) 9 | 10 | ; ... the rest of the code here... -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSetOption.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | 10 | ; Set User-Agent string 11 | _WinHttpSetOption($hOpen, $WINHTTP_OPTION_USER_AGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)") 12 | 13 | ; Get connection handle 14 | Global $hConnect = _WinHttpConnect($hOpen, "google.com") 15 | 16 | ; Specify the reguest: 17 | Global $hRequest = _WinHttpOpenRequest($hConnect) 18 | 19 | ; Send request 20 | _WinHttpSendRequest($hRequest) 21 | 22 | ; Wait for the response 23 | _WinHttpReceiveResponse($hRequest) 24 | 25 | Global $sHeader 26 | ; If there is data available... 27 | If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header 28 | 29 | ; Clean 30 | _WinHttpCloseHandle($hRequest) 31 | _WinHttpCloseHandle($hConnect) 32 | _WinHttpCloseHandle($hOpen) 33 | 34 | ; Display retrieved header 35 | ConsoleWrite($sHeader & @CRLF) 36 | 37 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSetStatusCallback.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Register Callback function 8 | Global $hWINHTTP_STATUS_CALLBACK = DllCallbackRegister("__WINHTTP_STATUS_CALLBACK", "none", "handle;dword_ptr;dword;ptr;dword") 9 | ; Initialize and get session handle 10 | Global $hOpen = _WinHttpOpen() 11 | ; Associate callback function with this handle 12 | _WinHttpSetStatusCallback($hOpen, $hWINHTTP_STATUS_CALLBACK) 13 | 14 | ; Get connection handle 15 | Global $hConnect = _WinHttpConnect($hOpen, "google.com") 16 | ; Specify the reguest: 17 | Global $hRequest = _WinHttpOpenRequest($hConnect) 18 | ; Send request 19 | _WinHttpSendRequest($hRequest) 20 | ; Wait for the response 21 | _WinHttpReceiveResponse($hRequest) 22 | 23 | Global $sHeader 24 | ; If there is data available... 25 | If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header 26 | 27 | ; Clean 28 | _WinHttpCloseHandle($hRequest) 29 | _WinHttpCloseHandle($hConnect) 30 | _WinHttpCloseHandle($hOpen) 31 | 32 | ; Display retrieved header 33 | ConsoleWrite(@CRLF & $sHeader & @CRLF) 34 | 35 | ; Sleep few seconds to see if there are more events 36 | Sleep(2000) 37 | 38 | ; Free the callback when no longer needed (can be omitted in this case) 39 | DllCallbackFree($hWINHTTP_STATUS_CALLBACK) 40 | 41 | 42 | ; Define callback function 43 | Func __WINHTTP_STATUS_CALLBACK($hInternet, $iContext, $iInternetStatus, $pStatusInformation, $iStatusInformationLength) 44 | #forceref $hInternet, $iContext, $pStatusInformation, $iStatusInformationLength 45 | ConsoleWrite("!->Current status of the connection: " & $iInternetStatus & " " & @TAB & " ") 46 | ; Interpret the status 47 | Local $sStatus 48 | Switch $iInternetStatus 49 | Case $WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION 50 | $sStatus = "Closing the connection to the server" 51 | Case $WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER 52 | $sStatus = "Successfully connected to the server." 53 | Case $WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER 54 | $sStatus = "Connecting to the server." 55 | Case $WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED 56 | $sStatus = "Successfully closed the connection to the server." 57 | Case $WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE 58 | $sStatus = "Data is available to be retrieved with WinHttpReadData." 59 | Case $WINHTTP_CALLBACK_STATUS_HANDLE_CREATED 60 | $sStatus = "An HINTERNET handle has been created." 61 | Case $WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING 62 | $sStatus = "This handle value has been terminated." 63 | Case $WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE 64 | $sStatus = "The response header has been received and is available with WinHttpQueryHeaders." 65 | Case $WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE 66 | $sStatus = "Received an intermediate (100 level) status code message from the server." 67 | Case $WINHTTP_CALLBACK_STATUS_NAME_RESOLVED 68 | $sStatus = "Successfully found the IP address of the server." 69 | Case $WINHTTP_CALLBACK_STATUS_READ_COMPLETE 70 | $sStatus = "Data was successfully read from the server." 71 | Case $WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE 72 | $sStatus = "Waiting for the server to respond to a request." 73 | Case $WINHTTP_CALLBACK_STATUS_REDIRECT 74 | $sStatus = "An HTTP request is about to automatically redirect the request." 75 | Case $WINHTTP_CALLBACK_STATUS_REQUEST_ERROR 76 | $sStatus = "An error occurred while sending an HTTP request." 77 | Case $WINHTTP_CALLBACK_STATUS_REQUEST_SENT 78 | $sStatus = "Successfully sent the information request to the server." 79 | Case $WINHTTP_CALLBACK_STATUS_RESOLVING_NAME 80 | $sStatus = "Looking up the IP address of a server name." 81 | Case $WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED 82 | $sStatus = "Successfully received a response from the server." 83 | Case $WINHTTP_CALLBACK_STATUS_SECURE_FAILURE 84 | $sStatus = "One or more errors were encountered while retrieving a Secure Sockets Layer (SSL) certificate from the server." 85 | Case $WINHTTP_CALLBACK_STATUS_SENDING_REQUEST 86 | $sStatus = "Sending the information request to the server." 87 | Case $WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE 88 | $sStatus = "The request completed successfully." 89 | Case $WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE 90 | $sStatus = "Data was successfully written to the server." 91 | EndSwitch 92 | ; Print it 93 | ConsoleWrite($sStatus & @CRLF) 94 | EndFunc ;==>__WINHTTP_STATUS_CALLBACK -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSetTimeouts.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Open needed handles 8 | Global $hOpen = _WinHttpOpen() 9 | 10 | ; Set timeouts 11 | _WinHttpSetTimeouts($hOpen, 10, 10, 10, 10) 12 | 13 | ; Get connection handle 14 | Global $hConnect = _WinHttpConnect($hOpen, "msdn.microsoft.com") 15 | ; Specify the reguest: 16 | Global $hRequest = _WinHttpOpenRequest($hConnect, Default, "en-us/library/aa384101(VS.85).aspx") 17 | 18 | ; Send request 19 | _WinHttpSendRequest($hRequest) 20 | 21 | ; Wait for the response 22 | _WinHttpReceiveResponse($hRequest) 23 | 24 | Global $sHeader 25 | ; If there is data available... 26 | If _WinHttpQueryDataAvailable($hRequest) Then 27 | $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header 28 | ; Display retrieved header 29 | MsgBox(0, "Header", $sHeader) 30 | Else 31 | ; Display retrieved header 32 | MsgBox(48, "Failure", "Maybe the new timeouts are unrealistic ;)") 33 | EndIf 34 | 35 | ; Clean 36 | _WinHttpCloseHandle($hRequest) 37 | _WinHttpCloseHandle($hConnect) 38 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleBinaryConcat.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | Global $sHost = "images.fanpop.com" 8 | Global $sTarget = "images/image_uploads/Hello-Kitty-hello-kitty-181509_1024_768.jpg" 9 | Global $sDestination = @ScriptDir & "\HelloKitty.jpg" 10 | 11 | ; Initialize and get session handle 12 | Global $hHttpOpen = _WinHttpOpen() 13 | If @error Then 14 | MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.") 15 | Exit 1 16 | EndIf 17 | ; Get connection handle 18 | Global $hHttpConnect = _WinHttpConnect($hHttpOpen, $sHost) 19 | If @error Then 20 | MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.") 21 | _WinHttpCloseHandle($hHttpOpen) 22 | Exit 2 23 | EndIf 24 | ; Specify the reguest 25 | Global $hHttpRequest = _WinHttpOpenRequest($hHttpConnect, Default, $sTarget) 26 | If @error Then 27 | MsgBox(48, "Error", "Error creating an HTTP request handle.") 28 | _WinHttpCloseHandle($hHttpConnect) 29 | _WinHttpCloseHandle($hHttpOpen) 30 | Exit 3 31 | EndIf 32 | ; Send request 33 | _WinHttpSendRequest($hHttpRequest) 34 | If @error Then 35 | MsgBox(48, "Error", "Error sending specified request.") 36 | _WinHttpCloseHandle($hHttpConnect) 37 | _WinHttpCloseHandle($hHttpOpen) 38 | Exit 4 39 | EndIf 40 | 41 | ; Wait for the response 42 | _WinHttpReceiveResponse($hHttpRequest) 43 | ; Read if available 44 | Global $bChunk, $bData, $hFile 45 | If _WinHttpQueryDataAvailable($hHttpRequest) Then 46 | While 1 47 | $bChunk = _WinHttpReadData($hHttpRequest, 2) ; read binary 48 | If @error Then ExitLoop 49 | $bData = _WinHttpSimpleBinaryConcat($bData, $bChunk) ; concat two binary data 50 | WEnd 51 | ; Save it to the file 52 | $hFile = FileOpen($sDestination, 26) 53 | FileWrite($hFile, $bData) 54 | FileClose($hFile) 55 | Else 56 | MsgBox(48, "Error occurred", "No data available. " & @CRLF) 57 | EndIf 58 | 59 | ; Close handles 60 | _WinHttpCloseHandle($hHttpRequest) 61 | _WinHttpCloseHandle($hHttpConnect) 62 | _WinHttpCloseHandle($hHttpOpen) 63 | 64 | ; See what's downloaded 65 | ShellExecute($sDestination) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill.au3: -------------------------------------------------------------------------------- 1 | 2 | #include "WinHttp.au3" 3 | 4 | Opt("MustDeclareVars", 1) 5 | 6 | Global $hOpen, $hConnect 7 | Global $sRead, $hFileHTM, $sFileHTM = @ScriptDir & "\Form.htm" 8 | 9 | ; Example1: 10 | ; 1. Open APNIC whois page (http://wq.apnic.net/apnic-bin/whois.pl) 11 | ; 2. Fill form on that page with these values/conditins: 12 | ; - fill default form 13 | ; - set ip address 4.2.2.2 to input box. Use name propery to locate input 14 | ; - send form (click button) 15 | ; - gather returned data 16 | 17 | ; Initialize and get session handle 18 | $hOpen = _WinHttpOpen() 19 | ; Get connection handle 20 | $hConnect = _WinHttpConnect($hOpen, "wq.apnic.net") 21 | ; Fill form on this page 22 | $sRead = _WinHttpSimpleFormFill($hConnect, "apnic-bin/whois.pl", Default, "name:searchtext", "4.2.2.2", "name:object_type", "All") 23 | ; Close connection handle 24 | _WinHttpCloseHandle($hConnect) 25 | ; Close session handle 26 | _WinHttpCloseHandle($hOpen) 27 | 28 | ; See what's returned (in default browser or whatever) 29 | If $sRead Then 30 | MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now.") 31 | $hFileHTM = FileOpen($sFileHTM, 2) 32 | FileWrite($hFileHTM, $sRead) 33 | FileClose($hFileHTM) 34 | ShellExecuteWait($sFileHTM) 35 | EndIf 36 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill_1.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | Global $hOpen, $hConnect 8 | Global $sRead, $hFileHTM, $sFileHTM = @ScriptDir & "\Form.htm" 9 | 10 | ; Example 2: 11 | ; 1. Open w3schools forms page (http://www.w3schools.com/html/html_forms.asp) 12 | ; 2. Fill form on that page with these values/conditins: 13 | ; - form is to be identified by its index -0- 14 | ; - set -Miyake- and -Issey- data to input boxes. Locate input boxes by their names -firstname- and -lastname- 15 | 16 | ; Initialize and get session handle 17 | $hOpen = _WinHttpOpen() 18 | ; Get connection handle 19 | $hConnect = _WinHttpConnect($hOpen, "w3schools.com") 20 | ; Fill form on this page 21 | $sRead = _WinHttpSimpleFormFill($hConnect, "html/html_forms.asp", "index:0", "name:fname", "Miyake", "name:lname", "Issey") 22 | ; Close connection handle 23 | _WinHttpCloseHandle($hConnect) 24 | ; Close session handle 25 | _WinHttpCloseHandle($hOpen) 26 | 27 | If $sRead Then 28 | MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now." & @CRLF & _ 29 | "You should see 'Miyake Issey' somewhere on that page.") 30 | $hFileHTM = FileOpen($sFileHTM, 2) 31 | FileWrite($hFileHTM, $sRead) 32 | FileClose($hFileHTM) 33 | ShellExecuteWait($sFileHTM) 34 | EndIf -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill_2.au3: -------------------------------------------------------------------------------- 1 | 2 | #include "WinHttp.au3" 3 | 4 | Opt("MustDeclareVars", 1) 5 | 6 | Dim $hOpen, $hConnect 7 | Dim $sRead 8 | 9 | ; Example 3: 10 | ; 1. Open cs.tut.fi forms page (http://www.cs.tut.fi/~jkorpela/forms/testing.html) 11 | ; 2. Fill form on that page with these values/conditins: 12 | ; - form is to be identified by its index, It's first form on the page, i.e. index is 0 13 | ; - set -Johnny B. Goode- data to textarea. Locate it by its name -Comments-. 14 | ; - check the checkbox. Locate it by name -box-. Checked value is -yes-. 15 | ; - set -This is hidden, so what?- data to input field identified by name -hidden field-. 16 | ; - gather data 17 | 18 | ; Initialize and get session handle 19 | $hOpen = _WinHttpOpen() 20 | ; Get connection handle 21 | $hConnect = _WinHttpConnect($hOpen, "www.cs.tut.fi") 22 | ; Fill form on this page 23 | $sRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle 24 | "~jkorpela/forms/testing.html", _ ; target page 25 | "index:0", _ ; form identifier 26 | "name:Comments", "Johnny B. Goode", _ ; first field identifier paired with field data 27 | "name:box", "yes", _ ; second field identifier paired with data 28 | "name:hidden field", "This is hidden, so what?") ; third field identifier paired with data 29 | ; Close connection handle 30 | _WinHttpCloseHandle($hConnect) 31 | ; Close session handle now that's no longer needed 32 | _WinHttpCloseHandle($hOpen) 33 | 34 | If $sRead Then 35 | ConsoleWrite($sRead & @CRLF) 36 | MsgBox(64 + 262144, "Web Page says", $sRead) 37 | EndIf 38 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill_3.au3: -------------------------------------------------------------------------------- 1 | 2 | #include "WinHttp.au3" 3 | 4 | $sAddress = "https://paratus.hr/software/testing/fileupload/" ; the address of the target 5 | 6 | $sFileToUpload = @ScriptFullPath ; upload itself 7 | 8 | $sForm = _ 9 | '
' & _ 10 | ' ' & _ ; 11 | ' ' & _ 12 | '
' 13 | 14 | ; Initialize and get session handle 15 | $hOpen = _WinHttpOpen() 16 | 17 | $hConnect = $sForm ; will pass form as string so this is for coding correctness because $hConnect goes in byref 18 | 19 | ; Fill form 20 | $sHTML = _WinHttpSimpleFormFill($hConnect, $hOpen, _ 21 | Default, _ 22 | "name:upload", $sFileToUpload, _ 23 | "name:someparam", "Candy") 24 | 25 | If @error Then 26 | MsgBox(4096, "Error", "Error number = " & @error) 27 | Else 28 | ConsoleWrite($sHTML & @CRLF) 29 | EndIf 30 | 31 | ; Close handles 32 | _WinHttpCloseHandle($hConnect) 33 | _WinHttpCloseHandle($hOpen) 34 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill_4.au3: -------------------------------------------------------------------------------- 1 | #include 2 | #include "WinHttp.au3" 3 | 4 | ; Example 5: 5 | ; 1. Open www.cs.tut.fi forms page (https://www.cs.tut.fi/~jkorpela/forms/testing.html) 6 | ; 2. Fill form on that page with these values/conditins: 7 | ; - form is to be identified by its index -1- 8 | ; - set -Something- and -this script- data to input boxes. Locate input boxes by their names -textfield- and -filefield- 9 | ; 2. Return array 10 | 11 | ; Initialize and get session handle 12 | $hOpen = _WinHttpOpen() 13 | ; Get connection handle 14 | $hConnect = _WinHttpConnect($hOpen, "https://www.cs.tut.fi") 15 | ; Fill form on this page 16 | $aRead = _WinHttpSimpleFormFill($hConnect, "~jkorpela/forms/testing.html", _ 17 | "index:1", _ 18 | "name:textfield", "Testing file upload", _ 19 | "name:filefield", @ScriptFullPath, _ 20 | "[RETURN_ARRAY]") 21 | 22 | ; Close connection handle 23 | _WinHttpCloseHandle($hConnect) 24 | ; Close session handle 25 | _WinHttpCloseHandle($hOpen) 26 | 27 | _ArrayDisplay($aRead) 28 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill_5.au3: -------------------------------------------------------------------------------- 1 | #include "WinHttp.au3" 2 | 3 | ; Example 5: 4 | ; 1. Open paratus.hr form-action page (https://paratus.hr/software/testing/html5form/) 5 | ; 2. Fill form on that page with these values/conditins: 6 | ; - form is default one 7 | ; - set -User- and -Password- data to input boxes. Locate input boxes by their names -loginName- and -loginPass- 8 | ; - click third button (register action) 9 | 10 | ; Initialize and get session handle 11 | $hOpen = _WinHttpOpen() 12 | ; Get connection handle 13 | $hConnect = _WinHttpConnect($hOpen, "https://paratus.hr") 14 | ; Fill form on this page 15 | $aRead = _WinHttpSimpleFormFill($hConnect, "/software/testing/html5form/", _ 16 | Default, _ 17 | "name:loginName", "User", _ 18 | "name:loginPass", "Password", _ 19 | "type:submit", 2 _ ; third button (zero-based counting scheme) 20 | ) 21 | ; Close connection handle 22 | _WinHttpCloseHandle($hConnect) 23 | ; Close session handle 24 | _WinHttpCloseHandle($hOpen) 25 | 26 | MsgBox(4096, "Returned", $aRead) 27 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill_6.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | Global $hOpen, $hConnect 8 | Global $sRead, $hFileHTM, $sFileHTM = @ScriptDir & "\Form.htm" 9 | 10 | ; Example 2: 11 | ; 1. Open w3schools forms page (https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_form) 12 | ; 2. Fill form on that page with these values/conditins: 13 | ; - form is to be identified by its index -0- 14 | ; - set -Miyake- and -Issey- data to input boxes. Locate input boxes by their names -fname- and -lname- (lname is outside the form element, but still part of the form) 15 | 16 | ; Initialize and get session handle 17 | $hOpen = _WinHttpOpen() 18 | ; Get connection handle 19 | $hConnect = _WinHttpConnect($hOpen, "https://www.w3schools.com") 20 | ; Fill form on this page 21 | $sRead = _WinHttpSimpleFormFill($hConnect, "tags/tryit.asp?filename=tryhtml5_input_form", "index:0", "name:fname", "Miyake", "name:lname", "Issey") 22 | ; Close connection handle 23 | _WinHttpCloseHandle($hConnect) 24 | ; Close session handle 25 | _WinHttpCloseHandle($hOpen) 26 | 27 | If $sRead Then 28 | MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now." & @CRLF & _ 29 | "You should see 'Miyake Issey' somewhere on that page.") 30 | $hFileHTM = FileOpen($sFileHTM, 2) 31 | FileWrite($hFileHTM, $sRead) 32 | FileClose($hFileHTM) 33 | ShellExecuteWait($sFileHTM) 34 | EndIf -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleFormFill_SetUploadCallback.au3: -------------------------------------------------------------------------------- 1 | 2 | #include "WinHTTP.au3" 3 | 4 | $sAddress = "https://paratus.hr/software/testing/fileupload/" ; the address of the target 5 | 6 | ; Select some file 7 | $sFileToUpload = FileOpenDialog("Select file to upload...", "", "All Files (*)") 8 | If Not $sFileToUpload Then Exit 5 ; check if the file is selected and exit if not 9 | 10 | $sForm = _ 11 | '
' & _ 12 | ' ' & _ 13 | '
' 14 | 15 | ; Initialize and get session handle 16 | $hOpen = _WinHttpOpen() 17 | 18 | $hConnect = $sForm ; will pass form as string so this is for coding correctness because $hConnect goes in byref 19 | 20 | ; Creates progress bar window 21 | ProgressOn("UPLOADING", $sFileToUpload, "0%") 22 | 23 | ; Register callback function 24 | _WinHttpSimpleFormFill_SetUploadCallback(UploadCallback) 25 | 26 | ; Fill form 27 | $sHTML = _WinHttpSimpleFormFill($hConnect, $hOpen, _ 28 | Default, _ 29 | "name:upload", $sFileToUpload) 30 | ; Collect error number 31 | $iErr = @error 32 | 33 | ; Unregister callback function 34 | _WinHttpSimpleFormFill_SetUploadCallback(0) 35 | 36 | ; Kill progress bar window 37 | ProgressOff() 38 | 39 | ; Close handles 40 | _WinHttpCloseHandle($hConnect) 41 | _WinHttpCloseHandle($hOpen) 42 | 43 | If $iErr Then 44 | MsgBox(4096, "Error", "Error number = " & $iErr) 45 | Else 46 | ConsoleWrite($sHTML & @CRLF) 47 | MsgBox(4096, "Success", $sHTML) 48 | EndIf 49 | 50 | 51 | 52 | ; Callback function. For example, update progress control 53 | Func UploadCallback($iPrecent) 54 | If $iPrecent = 100 Then 55 | ProgressSet(100, "Done", "Complete") 56 | Sleep(800) ; give some time for the progress bar to fill-in completely 57 | Else 58 | ProgressSet($iPrecent, $iPrecent & "%") 59 | EndIf 60 | EndFunc 61 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleReadData.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | ; Get connection handle 10 | Global $hConnect = _WinHttpConnect($hOpen, "thetimes.co.uk") 11 | ; Request 12 | Global $hRequest = _WinHttpSimpleSendRequest($hConnect) 13 | 14 | ; Simple-read... 15 | Global $sRead = _WinHttpSimpleReadData($hRequest) 16 | MsgBox(64, "Returned (first 1100 characters)", StringLeft($sRead, 1100) & "...") 17 | 18 | ; Close handles 19 | _WinHttpCloseHandle($hRequest) 20 | _WinHttpCloseHandle($hConnect) 21 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleReadDataAsync.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 8 | ; Reserve memory space for asynchronous work 9 | ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 10 | ; The size 11 | Global Const $iSizeBufferAsync = 1048576 ; 1MB for example, should be enough 12 | ; The buffer 13 | Global Static $tBufferAsync = DllStructCreate("byte[" & $iSizeBufferAsync & "]") 14 | ; Get pointer to this memory space 15 | Global $pBufferAsync = DllStructGetPtr($tBufferAsync) 16 | 17 | 18 | 19 | ; Register Callback function 20 | Global $hWINHTTP_STATUS_CALLBACK = DllCallbackRegister("__WINHTTP_STATUS_CALLBACK", "none", "handle;dword_ptr;dword;ptr;dword") 21 | 22 | ; Initialize and get session handle. Asynchronous flag. 23 | Global $hOpen = _WinHttpOpen(Default, Default, Default, Default, $WINHTTP_FLAG_ASYNC) 24 | 25 | ; Assign callback function 26 | _WinHttpSetStatusCallback($hOpen, $hWINHTTP_STATUS_CALLBACK) 27 | 28 | ; Get connection handle 29 | Global $hConnect = _WinHttpConnect($hOpen, "msdn.microsoft.com") 30 | 31 | ; Make request 32 | Global $hRequest = _WinHttpOpenRequest($hConnect, Default, "en-us/library/aa383917(v=vs.85).aspx") 33 | 34 | ; Send it 35 | _WinHttpSendRequest($hRequest) 36 | 37 | ; Some dummy code for waiting 38 | MsgBox(64 + 262144, "Wait...", "Wait for the results if they are not shown already.") 39 | 40 | 41 | ; Close handles 42 | _WinHttpCloseHandle($hRequest) 43 | _WinHttpCloseHandle($hConnect) 44 | _WinHttpCloseHandle($hOpen) 45 | ; Free callback. Redundant here 46 | DllCallbackFree($hWINHTTP_STATUS_CALLBACK) 47 | 48 | 49 | 50 | ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 51 | ; Define callback function 52 | ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 53 | Func __WINHTTP_STATUS_CALLBACK($hInternet, $iContext, $iInternetStatus, $pStatusInformation, $iStatusInformationLength) 54 | #forceref $hInternet, $iContext, $pStatusInformation, $iStatusInformationLength 55 | ConsoleWrite(">> ") 56 | ; Interpret the status 57 | Local $sStatus 58 | Switch $iInternetStatus 59 | Case $WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION 60 | $sStatus = "Closing the connection to the server" 61 | Case $WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER 62 | $sStatus = "Successfully connected to the server." 63 | Case $WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER 64 | $sStatus = "Connecting to the server." 65 | Case $WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED 66 | $sStatus = "Successfully closed the connection to the server." 67 | Case $WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE 68 | $sStatus = "Data is available to be retrieved with WinHttpReadData." 69 | ConsoleWrite($sStatus & @CRLF) 70 | 71 | ;************************************* 72 | ; Read asynchronously 73 | ;************************************* 74 | _WinHttpSimpleReadDataAsync($hInternet, $pBufferAsync, $iSizeBufferAsync) 75 | Return 76 | 77 | Case $WINHTTP_CALLBACK_STATUS_HANDLE_CREATED 78 | $sStatus = "An HINTERNET handle has been created: " & $hInternet 79 | Case $WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING 80 | $sStatus = "This handle value has been terminated: " & $hInternet 81 | Case $WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE 82 | $sStatus = "The response header has been received and is available with WinHttpQueryHeaders." 83 | ConsoleWrite($sStatus & @CRLF) 84 | 85 | ;************************************* 86 | ; Print header 87 | ;************************************* 88 | ConsoleWrite(_WinHttpQueryHeaders($hInternet) & @CRLF) 89 | 90 | ;************************************* 91 | ; Check if there is any data available 92 | ;************************************* 93 | _WinHttpQueryDataAvailable($hInternet) 94 | 95 | Return 96 | 97 | Case $WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE 98 | $sStatus = "Received an intermediate (100 level) status code message from the server." 99 | Case $WINHTTP_CALLBACK_STATUS_NAME_RESOLVED 100 | $sStatus = "Successfully found the IP address of the server." 101 | Case $WINHTTP_CALLBACK_STATUS_READ_COMPLETE 102 | $sStatus = "Data was successfully read from the server." 103 | ConsoleWrite($sStatus & @CRLF) 104 | 105 | ;************************************* 106 | ; Print read data 107 | ;************************************* 108 | Local $sRead = DllStructGetData(DllStructCreate("char[" & $iStatusInformationLength & "]", $pStatusInformation), 1) 109 | ConsoleWrite($sRead & @CRLF) 110 | 111 | Return 112 | 113 | Case $WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE 114 | $sStatus = "Waiting for the server to respond to a request." 115 | Case $WINHTTP_CALLBACK_STATUS_REDIRECT 116 | $sStatus = "An HTTP request is about to automatically redirect the request." 117 | Case $WINHTTP_CALLBACK_STATUS_REQUEST_ERROR 118 | $sStatus = "An error occurred while sending an HTTP request." 119 | Case $WINHTTP_CALLBACK_STATUS_REQUEST_SENT 120 | $sStatus = "Successfully sent the information request to the server." 121 | Case $WINHTTP_CALLBACK_STATUS_RESOLVING_NAME 122 | $sStatus = "Looking up the IP address of a server name." 123 | Case $WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED 124 | $sStatus = "Successfully received a response from the server." 125 | Case $WINHTTP_CALLBACK_STATUS_SECURE_FAILURE 126 | $sStatus = "One or more errors were encountered while retrieving a Secure Sockets Layer (SSL) certificate from the server." 127 | Case $WINHTTP_CALLBACK_STATUS_SENDING_REQUEST 128 | $sStatus = "Sending the information request to the server." 129 | Case $WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE 130 | $sStatus = "The request completed successfully." 131 | ConsoleWrite($sStatus & @CRLF) 132 | 133 | ;************************************* 134 | ; Receive Response 135 | ;************************************* 136 | _WinHttpReceiveResponse($hInternet) 137 | Return 138 | 139 | Case $WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE 140 | $sStatus = "Data was successfully written to the server." 141 | EndSwitch 142 | ; Print it 143 | ConsoleWrite($sStatus & @CRLF) 144 | EndFunc ;==>__WINHTTP_STATUS_CALLBACK -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleRequest.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.3; .NET CLR 2.0.50727; ffco7) Gecko/2008092417 Firefox/3.0.3") 9 | ; Get connection handle 10 | Global $hConnect = _WinHttpConnect($hOpen, "autoit.de") 11 | 12 | ; Simple-request it... 13 | MsgBox(64, "Returned (first 1400 characters)", StringLeft(_WinHttpSimpleRequest($hConnect), 1400) & "...") 14 | 15 | ; Close handles 16 | _WinHttpCloseHandle($hConnect) 17 | _WinHttpCloseHandle($hOpen) 18 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleSSLRequest.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; !!!Note that this example will fail because of invalid username and password!!! 8 | 9 | ; Use real data for authentication 10 | Global $sUserName = "SomeUserName" 11 | Global $sPassword = "SomePassword" 12 | Global $sDomain = "www.google.com" 13 | Global $sPage = "accounts/ClientLogin" 14 | ; Visit http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html for more informations 15 | Global $sAdditionalData = "accountType=HOSTED_OR_GOOGLE&Email=" & $sUserName & "&Passwd=" & $sPassword & "&service=mail&source=Gulp-CalGulp-1.05" 16 | 17 | ; Initialize and get session handle 18 | Global $hOpen = _WinHttpOpen() 19 | ; Get connection handle 20 | Global $hConnect = _WinHttpConnect($hOpen, $sDomain) 21 | 22 | ; SimpleSSL-request it... 23 | Global $sReturned = _WinHttpSimpleSSLRequest($hConnect, "POST", $sPage, Default, $sAdditionalData) 24 | 25 | ; Close handles 26 | _WinHttpCloseHandle($hConnect) 27 | _WinHttpCloseHandle($hOpen) 28 | 29 | ; See what's returned 30 | MsgBox(0, "Returned", $sReturned) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleSendRequest.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | ; Get connection handle 10 | Global $hConnect = _WinHttpConnect($hOpen, "w3schools.com") 11 | ; Make a request 12 | Global $hRequest = _WinHttpSimpleSendRequest($hConnect, Default, "tags/tag_input.asp") 13 | 14 | If $hRequest Then 15 | ; Simple-read... 16 | ConsoleWrite(_WinHttpSimpleReadData($hRequest) & @CRLF) 17 | MsgBox(64, "Okey do!", "Returned source is print to concole. Check it.") 18 | Else 19 | MsgBox(48, "Error", "Error ocurred for _WinHttpSimpleSendRequest, Error number is " & @error) 20 | EndIf 21 | 22 | ; Close handles 23 | _WinHttpCloseHandle($hRequest) 24 | _WinHttpCloseHandle($hConnect) 25 | _WinHttpCloseHandle($hOpen) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpSimpleSendSSLRequest.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | Global $sDomain = "github.com" 8 | Global $sPage = "dragana-r/autoit-winhttp" 9 | 10 | ; Initialize and get session handle 11 | Global $hOpen = _WinHttpOpen() 12 | ; Get connection handle 13 | Global $hConnect = _WinHttpConnect($hOpen, $sDomain) 14 | 15 | ; Make a SimpleSSL request 16 | Global $hRequestSSL = _WinHttpSimpleSendSSLRequest($hConnect, Default, $sPage) 17 | 18 | ; Read... 19 | Global $sReturned = _WinHttpSimpleReadData($hRequestSSL) 20 | ; Close handles 21 | _WinHttpCloseHandle($hRequestSSL) 22 | _WinHttpCloseHandle($hConnect) 23 | _WinHttpCloseHandle($hOpen) 24 | 25 | ; See what's returned 26 | ConsoleWrite($sReturned & @CRLF) 27 | MsgBox(64 + 262144, "Done", "Page source is printed to console") -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpTimeFromSystemTime.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | MsgBox(64, "WinHttp time", _WinHttpTimeFromSystemTime()) -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpTimeToSystemTime.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | #include 5 | 6 | Opt("MustDeclareVars", 1) 7 | 8 | ; Time 9 | Global $aTime = _WinHttpTimeToSystemTime("Sat, 21 Aug 2010 22:04:43 GMT") 10 | _ArrayDisplay($aTime, "_WinHttpTimeToSystemTime()") 11 | 12 | -------------------------------------------------------------------------------- /WinHttp_Examples/_WinHttpWriteData.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "WinHttp.au3" 4 | 5 | Opt("MustDeclareVars", 1) 6 | 7 | ; Initialize and get session handle 8 | Global $hOpen = _WinHttpOpen() 9 | ; Get connection handle 10 | Global $hConnect = _WinHttpConnect($hOpen, "httpbin.org") 11 | ; Specify the reguest 12 | Global $hRequest = _WinHttpOpenRequest($hConnect, "POST", "/post") 13 | 14 | Global $sPostData = "Additional data to send" 15 | ; Send request 16 | _WinHttpSendRequest($hRequest, Default, Default, StringLen($sPostData)) 17 | 18 | ; Write additional data to send 19 | _WinHttpWriteData($hRequest, $sPostData) 20 | 21 | ; Wait for the response 22 | _WinHttpReceiveResponse($hRequest) 23 | 24 | ; Check if there is data available... 25 | If _WinHttpQueryDataAvailable($hRequest) Then 26 | MsgBox(64, "OK", _WinHttpReadData($hRequest)) 27 | Else 28 | MsgBox(48, "Error", "Site is experiencing problems (or you).") 29 | EndIf 30 | 31 | ; Close handles 32 | _WinHttpCloseHandle($hRequest) 33 | _WinHttpCloseHandle($hConnect) 34 | _WinHttpCloseHandle($hOpen) 35 | --------------------------------------------------------------------------------