Guest User

Untitled

a guest
Jun 27th, 2017
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 405.96 KB | None | 0 0
  1. Global Const $bs_groupbox = 7
  2. Global Const $bs_bottom = 2048
  3. Global Const $bs_center = 768
  4. Global Const $bs_defpushbutton = 1
  5. Global Const $bs_left = 256
  6. Global Const $bs_multiline = 8192
  7. Global Const $bs_pushbox = 10
  8. Global Const $bs_pushlike = 4096
  9. Global Const $bs_right = 512
  10. Global Const $bs_rightbutton = 32
  11. Global Const $bs_top = 1024
  12. Global Const $bs_vcenter = 3072
  13. Global Const $bs_flat = 32768
  14. Global Const $bs_icon = 64
  15. Global Const $bs_bitmap = 128
  16. Global Const $bs_notify = 16384
  17. Global Const $bs_splitbutton = 12
  18. Global Const $bsitbuttontbutton = 13
  19. Global Const $bs_commandlink = 14
  20. Global Const $bsmandlinkandlink = 15
  21. Global Const $bcsif_glyph = 1
  22. Global Const $bcsif_image = 2
  23. Global Const $bcsif_style = 4
  24. Global Const $bcsif_size = 8
  25. Global Const $bcss_nosplit = 1
  26. Global Const $bcss_stretch = 2
  27. Global Const $bcss_alignleft = 4
  28. Global Const $bcss_image = 8
  29. Global Const $button_imageign_lefign_left = 0
  30. Global Const $button_imagelgn_righgn_right = 1
  31. Global Const $button_imaglign_tolign_top = 2
  32. Global Const $button_imagelin_botton_bottom = 3
  33. Global Const $button_imagelin_centen_center = 4
  34. Global Const $bs_3state = 5
  35. Global Const $bs_auto3state = 6
  36. Global Const $bs_autocheckbox = 3
  37. Global Const $bs_checkbox = 2
  38. Global Const $bs_radiobutton = 4
  39. Global Const $bs_iobuttonobutton = 9
  40. Global Const $bs_ownerdraw = 11
  41. Global Const $gui_sst_button_button = 0
  42. Global Const $gui_ss_dcheckboxheckbox = 0
  43. Global Const $gui_slt_groupt_group = 0
  44. Global Const $gui_slt_radiot_radio = 0
  45. Global Const $bcm_first = 5632
  46. Global Const $bcm_getidealsize = ($bcm_first + 1)
  47. Global Const $bcm_getimagelist = ($bcm_first + 3)
  48. Global Const $bcm_getnote = ($bcm_first + 10)
  49. Global Const $bctelengthelength = ($bcm_first + 11)
  50. Global Const $bcm_getsplitinfo = ($bcm_first + 8)
  51. Global Const $bcxtmargintmargin = ($bcm_first + 5)
  52. Global Const $bcm_sownstatewnstate = ($bcm_first + 6)
  53. Global Const $bcm_setimagelist = ($bcm_first + 2)
  54. Global Const $bcm_setnote = ($bcm_first + 9)
  55. Global Const $bcm_setshield = ($bcm_first + 12)
  56. Global Const $bcm_setsplitinfo = ($bcm_first + 7)
  57. Global Const $bcxtmargintmargin = ($bcm_first + 4)
  58. Global Const $bm_click = 245
  59. Global Const $bm_getcheck = 240
  60. Global Const $bm_getimage = 246
  61. Global Const $bm_getstate = 242
  62. Global Const $bm_setcheck = 241
  63. Global Const $bm_setdontclick = 248
  64. Global Const $bm_setimage = 247
  65. Global Const $bm_setstate = 243
  66. Global Const $bm_setstyle = 244
  67. Global Const $bcn_first = -1250
  68. Global Const $bcn_dropdown = ($bcn_first + 2)
  69. Global Const $bcemchangemchange = ($bcn_first + 1)
  70. Global Const $bn_clicked = 0
  71. Global Const $bn_paint = 1
  72. Global Const $bn_hilite = 2
  73. Global Const $bn_unhilite = 3
  74. Global Const $bn_disable = 4
  75. Global Const $bn_doubleclicked = 5
  76. Global Const $bn_setfocus = 6
  77. Global Const $bn_killfocus = 7
  78. Global Const $bn_pushed = $bn_hilite
  79. Global Const $bn_unpushed = $bn_unhilite
  80. Global Const $bn_dblclk = $bn_doubleclicked
  81. Global Const $bst_checked = 1
  82. Global Const $bserminaterminate = 2
  83. Global Const $bst_unchecked = 0
  84. Global Const $bst_focus = 8
  85. Global Const $bst_pushed = 4
  86. Global Const $bst_dontclick = 128
  87. Global Const $cb_err = -1
  88. Global Const $cb_errattribute = -3
  89. Global Const $cb_errrequired = -4
  90. Global Const $cb_errspace = -2
  91. Global Const $cb_okay = 0
  92. Global Const $state_snvisiblevisible = 32768
  93. Global Const $state_pressedpressed = 8
  94. Global Const $cbs_autohscroll = 64
  95. Global Const $cbs_noscrolloscroll = 2048
  96. Global Const $cbs_dropdown = 2
  97. Global Const $cbs_dropdownlist = 3
  98. Global Const $cbs_hasstrings = 512
  99. Global Const $cbs_lowercase = 16384
  100. Global Const $cbs_nalheightlheight = 1024
  101. Global Const $cbs_oemconvert = 128
  102. Global Const $cbsrawfixedawfixed = 16
  103. Global Const $cbs_owvariableariable = 32
  104. Global Const $cbs_simple = 1
  105. Global Const $cbs_sort = 256
  106. Global Const $cbs_uppercase = 8192
  107. Global Const $cbm_first = 5888
  108. Global Const $cb_addstring = 323
  109. Global Const $cb_deletestring = 324
  110. Global Const $cb_dir = 325
  111. Global Const $cb_findstring = 332
  112. Global Const $cb_ingexactngexact = 344
  113. Global Const $cb_oboxinfoboxinfo = 356
  114. Global Const $cb_getcount = 326
  115. Global Const $cb_getcuebanner = ($cbm_first + 4)
  116. Global Const $cb_getcursel = 327
  117. Global Const $cb_getdrotrolrectrolrect = 338
  118. Global Const $cb_pedstateedstate = 343
  119. Global Const $cb_pedwidthedwidth = 351
  120. Global Const $cb_geteditsel = 320
  121. Global Const $cb_getextendedui = 342
  122. Global Const $cb_gethalextentlextent = 349
  123. Global Const $cb_getitemdata = 336
  124. Global Const $cb_getitemheight = 340
  125. Global Const $cb_getlbtext = 328
  126. Global Const $cb_getlbtextlen = 329
  127. Global Const $cb_getlocale = 346
  128. Global Const $cb_getminvisible = 5890
  129. Global Const $cb_gettopindex = 347
  130. Global Const $cb_initstorage = 353
  131. Global Const $cb_limittext = 321
  132. Global Const $cb_resetcontent = 331
  133. Global Const $cb_insertstring = 330
  134. Global Const $cb_selectstring = 333
  135. Global Const $cb_setcuebanner = ($cbm_first + 3)
  136. Global Const $cb_setcursel = 334
  137. Global Const $cb_pedwidthedwidth = 352
  138. Global Const $cb_seteditsel = 322
  139. Global Const $cb_setextendedui = 341
  140. Global Const $cb_sethalextentlextent = 350
  141. Global Const $cb_setitemdata = 337
  142. Global Const $cb_setitemheight = 339
  143. Global Const $cb_setlocale = 345
  144. Global Const $cb_setminvisible = 5889
  145. Global Const $cb_settopindex = 348
  146. Global Const $cb_showdropdown = 335
  147. Global Const $cbn_closeup = 8
  148. Global Const $cbn_dblclk = 2
  149. Global Const $cbn_dropdown = 7
  150. Global Const $cbn_editchange = 5
  151. Global Const $cbn_editupdate = 6
  152. Global Const $cbn_errspace = (-1)
  153. Global Const $cbn_killfocus = 4
  154. Global Const $cbn_selchange = 1
  155. Global Const $cbn_selendcancel = 10
  156. Global Const $cbn_selendok = 9
  157. Global Const $cbn_setfocus = 3
  158. Global Const $cbes_eensitivensitive = 16
  159. Global Const $cbesditimageitimage = 1
  160. Global Const $cbes_ex_nogeindengeindent = 2
  161. Global Const $cbesizelimitzelimit = 8
  162. Global Const $__comboboxc_wm_use_wm_user = 1024
  163. Global Const $cbem_deleteitem = $cb_deletestring
  164. Global Const $cbem_ocontrolcontrol = ($__comboboxc_wm_use_wm_user + 6)
  165. Global Const $cbemtcontrolcontrol = ($__comboboxc_wm_use_wm_user + 7)
  166. Global Const $cbem_getexstyle = ($__comboboxc_wm_use_wm_user + 9)
  167. Global Const $cbem_gdedstyleedstyle = ($__comboboxc_wm_use_wm_user + 9)
  168. Global Const $cbmagelistagelist = ($__comboboxc_wm_use_wm_user + 3)
  169. Global Const $cbem_getitema = ($__comboboxc_wm_use_wm_user + 4)
  170. Global Const $cbem_getitemw = ($__comboboxc_wm_use_wm_user + 13)
  171. Global Const $cbem_gdeformateformat = 8192 + 6
  172. Global Const $cbemtchangedchanged = ($__comboboxc_wm_use_wm_user + 10)
  173. Global Const $cbem_insertitema = ($__comboboxc_wm_use_wm_user + 1)
  174. Global Const $cbem_insertitemw = ($__comboboxc_wm_use_wm_user + 11)
  175. Global Const $cbem_setexstyle = ($__comboboxc_wm_use_wm_user + 8)
  176. Global Const $cbem_sdedstyleedstyle = ($__comboboxc_wm_use_wm_user + 14)
  177. Global Const $cbmagelistagelist = ($__comboboxc_wm_use_wm_user + 2)
  178. Global Const $cbem_setitema = ($__comboboxc_wm_use_wm_user + 5)
  179. Global Const $cbem_setitemw = ($__comboboxc_wm_use_wm_user + 12)
  180. Global Const $cbem_sdeformateformat = 8192 + 5
  181. Global Const $cbemdowthemeowtheme = 8192 + 11
  182. Global Const $cben_first = (-800)
  183. Global Const $cben_last = (-830)
  184. Global Const $cben_beginedit = ($cben_first - 4)
  185. Global Const $cben_deleteitem = ($cben_first - 2)
  186. Global Const $cben_dragbegina = ($cben_first - 8)
  187. Global Const $cben_dragbeginw = ($cben_first - 9)
  188. Global Const $cben_endedita = ($cben_first - 5)
  189. Global Const $cben_endeditw = ($cben_first - 6)
  190. Global Const $cben_getdispinfo = ($cben_first + 0)
  191. Global Const $cbispinfoaspinfoa = ($cben_first + 0)
  192. Global Const $cbispinfowspinfow = ($cben_first - 7)
  193. Global Const $cben_insertitem = ($cben_first - 1)
  194. Global Const $cbeif_di_setitem = 268435456
  195. Global Const $cbeif_image = 2
  196. Global Const $cbeif_indent = 16
  197. Global Const $cbeif_lparam = 32
  198. Global Const $cbeif_overlay = 8
  199. Global Const $cbeitedimageedimage = 4
  200. Global Const $cbeif_text = 1
  201. Global Const $gui_slt_combot_combo = 2097218
  202. Global Const $es_left = 0
  203. Global Const $es_center = 1
  204. Global Const $es_right = 2
  205. Global Const $es_multiline = 4
  206. Global Const $es_uppercase = 8
  207. Global Const $es_lowercase = 16
  208. Global Const $es_password = 32
  209. Global Const $es_autovscroll = 64
  210. Global Const $es_autohscroll = 128
  211. Global Const $es_nohidesel = 256
  212. Global Const $es_oemconvert = 1024
  213. Global Const $es_readonly = 2048
  214. Global Const $es_wantreturn = 4096
  215. Global Const $es_number = 8192
  216. Global Const $ec_err = -1
  217. Global Const $ecm_first = 5376
  218. Global Const $em_canundo = 198
  219. Global Const $em_charfrompos = 215
  220. Global Const $em_dobufferobuffer = 205
  221. Global Const $em_fmtlines = 200
  222. Global Const $em_getcuebanner = ($ecm_first + 2)
  223. Global Const $em_getfiblelinebleline = 206
  224. Global Const $em_gethandle = 189
  225. Global Const $em_getimestatus = 217
  226. Global Const $em_getlimittext = 213
  227. Global Const $em_getline = 196
  228. Global Const $em_getlinecount = 186
  229. Global Const $em_getmargins = 212
  230. Global Const $em_getmodify = 184
  231. Global Const $em_wordcharordchar = 210
  232. Global Const $em_getrect = 178
  233. Global Const $em_getsel = 176
  234. Global Const $em_getthumb = 190
  235. Global Const $em_greakproceakproc = 209
  236. Global Const $emlloontiploontip = ($ecm_first + 4)
  237. Global Const $em_limittext = 197
  238. Global Const $em_linefromchar = 201
  239. Global Const $em_lineindex = 187
  240. Global Const $em_linelength = 193
  241. Global Const $em_linescroll = 182
  242. Global Const $em_posfromchar = 214
  243. Global Const $em_replacesel = 194
  244. Global Const $em_scroll = 181
  245. Global Const $em_scrollcaret = 183
  246. Global Const $em_setcuebanner = ($ecm_first + 1)
  247. Global Const $em_sethandle = 188
  248. Global Const $em_setimestatus = 216
  249. Global Const $em_setlimittext = $em_limittext
  250. Global Const $em_setmargins = 211
  251. Global Const $em_setmodify = 185
  252. Global Const $em_wordcharordchar = 204
  253. Global Const $em_setreadonly = 207
  254. Global Const $em_setrect = 179
  255. Global Const $em_setrectnp = 180
  256. Global Const $em_setsel = 177
  257. Global Const $em_settabstops = 203
  258. Global Const $em_sreakproceakproc = 208
  259. Global Const $emlloontiploontip = ($ecm_first + 3)
  260. Global Const $em_undo = 199
  261. Global Const $ec_leftmargin = 1
  262. Global Const $ec_rightmargin = 2
  263. Global Const $ec_usefontinfo = 65535
  264. Global Const $emsis_coonstringnstring = 1
  265. Global Const $eimes_gtratonceratonce = 1
  266. Global Const $eimes_cancerinfocurinfocus = 2
  267. Global Const $eimes_completecillfocuillfocus = 4
  268. Global Const $en_align_ltr_ec = 1792
  269. Global Const $en_align_rtl_ec = 1793
  270. Global Const $en_change = 768
  271. Global Const $en_errspace = 1280
  272. Global Const $en_hscroll = 1537
  273. Global Const $en_killfocus = 512
  274. Global Const $en_maxtext = 1281
  275. Global Const $en_setfocus = 256
  276. Global Const $en_update = 1024
  277. Global Const $en_vscroll = 1538
  278. Global Const $gui_ult_editlt_edit = 3150016
  279. Global Const $gui_slt_inputt_input = 128
  280. Global Const $gui_event_close = -3
  281. Global Const $guiminimizeinimize = -4
  282. Global Const $gu_restorerestore = -5
  283. Global Const $guimaximizeaximize = -6
  284. Global Const $gui_evmarydownarydown = -7
  285. Global Const $gui_rimaryupimaryup = -8
  286. Global Const $gui_evendarydownarydown = -9
  287. Global Const $gui_evondaryupndaryup = -10
  288. Global Const $gui_ousemoveusemove = -11
  289. Global Const $gu_resizedresized = -12
  290. Global Const $gu_droppeddropped = -13
  291. Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
  292. Global Const $gui_avistop = 0
  293. Global Const $gui_avistart = 1
  294. Global Const $gui_aviclose = 2
  295. Global Const $gui_checked = 1
  296. Global Const $guerminaterminate = 2
  297. Global Const $gui_unchecked = 4
  298. Global Const $gui_dropaccepted = 8
  299. Global Const $guiacceptedccepted = 4096
  300. Global Const $gui_acceptfiles = $gui_dropaccepted
  301. Global Const $gui_show = 16
  302. Global Const $gui_hide = 32
  303. Global Const $gui_enable = 64
  304. Global Const $gui_disable = 128
  305. Global Const $gui_focus = 256
  306. Global Const $gui_nofocus = 8192
  307. Global Const $gui_defbutton = 512
  308. Global Const $gui_expand = 1024
  309. Global Const $gui_ontop = 2048
  310. Global Const $gui_fontitalic = 2
  311. Global Const $gui_fontunder = 4
  312. Global Const $gui_fontstrike = 8
  313. Global Const $gui_dockauto = 1
  314. Global Const $gui_dockleft = 2
  315. Global Const $gui_dockright = 4
  316. Global Const $gui_dockhcenter = 8
  317. Global Const $gui_docktop = 32
  318. Global Const $gui_dockbottom = 64
  319. Global Const $gui_dockvcenter = 128
  320. Global Const $gui_dockwidth = 256
  321. Global Const $gui_dockheight = 512
  322. Global Const $gui_docksize = 768
  323. Global Const $gui_dockmenubar = 544
  324. Global Const $gui_dockstatebar = 576
  325. Global Const $gui_dockall = 802
  326. Global Const $gui_dockborders = 102
  327. Global Const $gui_gr_close = 1
  328. Global Const $gui_gr_line = 2
  329. Global Const $gui_gr_bezier = 4
  330. Global Const $gui_gr_move = 6
  331. Global Const $gui_gr_color = 8
  332. Global Const $gui_gr_rect = 10
  333. Global Const $gui_gr_ellipse = 12
  334. Global Const $gui_gr_pie = 14
  335. Global Const $gui_gr_dot = 16
  336. Global Const $gui_gr_pixel = 18
  337. Global Const $gui_gr_hint = 20
  338. Global Const $gui_gr_refresh = 22
  339. Global Const $gui_gr_pensize = 24
  340. Global Const $gui_gr_nobkcolor = -2
  341. Global Const $gui__defaultdefault = -1
  342. Global Const $gui_bkconsparentsparent = -2
  343. Global Const $gui_bkcollternatlternate = -33554432
  344. Global Const $gui_wrentdragentdrag = 1048576
  345. Global Const $ss_left = 0
  346. Global Const $ss_center = 1
  347. Global Const $ss_right = 2
  348. Global Const $ss_icon = 3
  349. Global Const $ss_blackrect = 4
  350. Global Const $ss_grayrect = 5
  351. Global Const $ss_whiterect = 6
  352. Global Const $ss_blackframe = 7
  353. Global Const $ss_grayframe = 8
  354. Global Const $ss_whiteframe = 9
  355. Global Const $ss_simple = 11
  356. Global Const $sswordwrapordwrap = 12
  357. Global Const $ss_bitmap = 14
  358. Global Const $ss_etchedhorz = 16
  359. Global Const $ss_etchedvert = 17
  360. Global Const $ss_etchedframe = 18
  361. Global Const $ss_noprefix = 128
  362. Global Const $ss_notify = 256
  363. Global Const $ss_centerimage = 512
  364. Global Const $ss_rightjust = 1024
  365. Global Const $ss_sunken = 4096
  366. Global Const $gui_slt_labelt_label = 0
  367. Global Const $gui_ss__graphicgraphic = 0
  368. Global Const $gui_ult_iconlt_icon = $ss_notify
  369. Global Const $guiault_picult_pic = $ss_notify
  370. Global Const $wc_animate = "SysAnimate32"
  371. Global Const $wc_button = "Button"
  372. Global Const $wc_combobox = "ComboBox"
  373. Global Const $wc_comboboxex = "ComboBoxEx32"
  374. Global Const $wc_datetimepick = "SymePick32ePick32"
  375. Global Const $wc_edit = "Edit"
  376. Global Const $wc_header = "SysHeader32"
  377. Global Const $wc_hotkey = "msctls_hotkey32"
  378. Global Const $wc_ipaddress = "SysIPAddress32"
  379. Global Const $wc_link = "SysLink"
  380. Global Const $wc_listbox = "ListBox"
  381. Global Const $wc_listview = "SysListView32"
  382. Global Const $wc_monthcal = "SysMonthCal32"
  383. Global Const $wc_nativefontctl = "NativeFontCtl"
  384. Global Const $wc_pagescroller = "SysPager"
  385. Global Const $wc_progress = "msogress32gress32"
  386. Global Const $wc_rebar = "ReBarWindow32"
  387. Global Const $wc_scrollbar = "ScrollBar"
  388. Global Const $wc_static = "Static"
  389. Global Const $wc_statusbar = "msctusbar32usbar32"
  390. Global Const $wc_tabcontrol = "SysTabControl32"
  391. Global Const $wc_toolbar = "ToolbarWindow32"
  392. Global Const $wc_tooltips = "tooltips_class32"
  393. Global Const $wc_trackbar = "msackbar32ckbar32"
  394. Global Const $wc_treeview = "SysTreeView32"
  395. Global Const $wc_updown = "msctls_updown32"
  396. Global Const $ws_overlapped = 0
  397. Global Const $ws_tiled = $ws_overlapped
  398. Global Const $ws_maximizebox = 65536
  399. Global Const $ws_minimizebox = 131072
  400. Global Const $ws_tabstop = 65536
  401. Global Const $ws_group = 131072
  402. Global Const $ws_sizebox = 262144
  403. Global Const $ws_thickframe = $ws_sizebox
  404. Global Const $ws_sysmenu = 524288
  405. Global Const $ws_hscroll = 1048576
  406. Global Const $ws_vscroll = 2097152
  407. Global Const $ws_dlgframe = 4194304
  408. Global Const $ws_border = 8388608
  409. Global Const $ws_caption = 12582912
  410. Global Const $ws_oedwindowdwindow = BitOR($ws_caption, $ws_maximizebox, $ws_minimizebox, $ws_overlapped, $ws_sysmenu, $ws_thickframe)
  411. Global Const $ws_tiledwindow = $ws_oedwindowdwindow
  412. Global Const $ws_maximize = 16777216
  413. Global Const $ws_clipchildren = 33554432
  414. Global Const $ws_clipsiblings = 67108864
  415. Global Const $ws_disabled = 134217728
  416. Global Const $ws_visible = 268435456
  417. Global Const $ws_minimize = 536870912
  418. Global Const $ws_iconic = $ws_minimize
  419. Global Const $ws_child = 1073741824
  420. Global Const $ws_childwindow = $ws_child
  421. Global Const $ws_popup = -2147483648
  422. Global Const $ws_popupwindow = -2138570752
  423. Global Const $ds_3dlook = 4
  424. Global Const $ds_absalign = 1
  425. Global Const $ds_center = 2048
  426. Global Const $ds_centermouse = 4096
  427. Global Const $ds_contexthelp = 8192
  428. Global Const $ds_control = 1024
  429. Global Const $ds_fixedsys = 8
  430. Global Const $ds_localedit = 32
  431. Global Const $ds_modalframe = 128
  432. Global Const $ds_nofailcreate = 16
  433. Global Const $ds_noidlemsg = 256
  434. Global Const $ds_setfont = 64
  435. Global Const $ds_setforeground = 512
  436. Global Const $ds_shellfont = BitOR($ds_fixedsys, $ds_setfont)
  437. Global Const $ds_sysmodal = 2
  438. Global Const $wseptfilesptfiles = 16
  439. Global Const $ws_ex_appwindow = 262144
  440. Global Const $ws_ex_composited = 33554432
  441. Global Const $ws_eolparentlparent = 65536
  442. Global Const $ws_ex_clientedge = 512
  443. Global Const $wstexthelpexthelp = 1024
  444. Global Const $ws_edalframealframe = 1
  445. Global Const $ws_ex_layered = 524288
  446. Global Const $ws_ex_layoutrtl = 4194304
  447. Global Const $ws_ex_left = 0
  448. Global Const $ws_ecrollbarrollbar = 16384
  449. Global Const $ws_ex_ltrreading = 0
  450. Global Const $ws_ex_mdichild = 64
  451. Global Const $ws_ex_noactivate = 134217728
  452. Global Const $ws_ex_itlayouttlayout = 1048576
  453. Global Const $ws_exntnotifytnotify = 4
  454. Global Const $ws_ex_right = 4096
  455. Global Const $ws_excrollbarrollbar = 0
  456. Global Const $ws_ex_rtlreading = 8192
  457. Global Const $ws_ex_staticedge = 131072
  458. Global Const $ws_ex_toolwindow = 128
  459. Global Const $ws_ex_topmost = 8
  460. Global Const $wsnsparentsparent = 32
  461. Global Const $ws_ex_windowedge = 256
  462. Global Const $ws_ex_oedwindowdwindow = BitOR($ws_ex_clientedge, $ws_ex_windowedge)
  463. Global Const $ws_etewindowewindow = BitOR($ws_ex_toolwindow, $ws_ex_topmost, $ws_ex_windowedge)
  464. Global Const $wm_null = 0
  465. Global Const $wm_create = 1
  466. Global Const $wm_destroy = 2
  467. Global Const $wm_move = 3
  468. Global Const $wm_sizewait = 4
  469. Global Const $wm_size = 5
  470. Global Const $wm_activate = 6
  471. Global Const $wm_setfocus = 7
  472. Global Const $wm_killfocus = 8
  473. Global Const $wm_setvisible = 9
  474. Global Const $wm_enable = 10
  475. Global Const $wm_setredraw = 11
  476. Global Const $wm_settext = 12
  477. Global Const $wm_gettext = 13
  478. Global Const $wm_gettextlength = 14
  479. Global Const $wm_paint = 15
  480. Global Const $wm_close = 16
  481. Global Const $wm_dsessionsession = 17
  482. Global Const $wm_quit = 18
  483. Global Const $wm_erasebkgnd = 20
  484. Global Const $wm_queryopen = 19
  485. Global Const $wmorchangerchange = 21
  486. Global Const $wm_endsession = 22
  487. Global Const $wm_systemerror = 23
  488. Global Const $wm_showwindow = 24
  489. Global Const $wm_ctlcolor = 25
  490. Global Const $wm_settingchange = 26
  491. Global Const $wm_wininichange = 26
  492. Global Const $wm_devmodechange = 27
  493. Global Const $wm_activateapp = 28
  494. Global Const $wm_fontchange = 29
  495. Global Const $wm_timechange = 30
  496. Global Const $wm_cancelmode = 31
  497. Global Const $wm_setcursor = 32
  498. Global Const $wm_mouseactivate = 33
  499. Global Const $wm_childactivate = 34
  500. Global Const $wm_queuesync = 35
  501. Global Const $wm_getminmaxinfo = 36
  502. Global Const $wm_logoff = 37
  503. Global Const $wm_painticon = 38
  504. Global Const $wmasebkgndsebkgnd = 39
  505. Global Const $wm_nextdlgctl = 40
  506. Global Const $wm_alttabactive = 41
  507. Global Const $wm_spoolerstatus = 42
  508. Global Const $wm_drawitem = 43
  509. Global Const $wm_measureitem = 44
  510. Global Const $wm_deleteitem = 45
  511. Global Const $wm_vkeytoitem = 46
  512. Global Const $wm_chartoitem = 47
  513. Global Const $wm_setfont = 48
  514. Global Const $wm_getfont = 49
  515. Global Const $wm_sethotkey = 50
  516. Global Const $wm_gethotkey = 51
  517. Global Const $wm_filesyschange = 52
  518. Global Const $wm_isactiveicon = 53
  519. Global Const $wm_queryparkicon = 54
  520. Global Const $wm_querydragicon = 55
  521. Global Const $wm_winhelp = 56
  522. Global Const $wm_compareitem = 57
  523. Global Const $wm_fullscreen = 58
  524. Global Const $wmshutdownhutdown = 59
  525. Global Const $wm_ddemlevent = 60
  526. Global Const $wm_getobject = 61
  527. Global Const $wm_calcscroll = 63
  528. Global Const $wm_testing = 64
  529. Global Const $wm_compacting = 65
  530. Global Const $wm_othwcreatedcreated = 66
  531. Global Const $wm_otherestroyedstroyed = 67
  532. Global Const $wm_commnotify = 68
  533. Global Const $wm_meuschangeschange = 69
  534. Global Const $wm_wichanginghanging = 70
  535. Global Const $wm_wschangedchanged = 71
  536. Global Const $wm_power = 72
  537. Global Const $wmobaldatabaldata = 73
  538. Global Const $wm_copydata = 74
  539. Global Const $wm_canceljournal = 75
  540. Global Const $wm_logonnotify = 76
  541. Global Const $wm_keyf1 = 77
  542. Global Const $wm_notify = 78
  543. Global Const $wm_access_window = 79
  544. Global Const $wm_inputlaerequeserequest = 80
  545. Global Const $wm_ngchangegchange = 81
  546. Global Const $wm_tcard = 82
  547. Global Const $wm_help = 83
  548. Global Const $wm_userchanged = 84
  549. Global Const $wm_notifyformat = 85
  550. Global Const $wm_qm_activate = 96
  551. Global Const $wm_hcallbackallback = 97
  552. Global Const $wm_syscopydata = 98
  553. Global Const $wm_finaldestroy = 112
  554. Global Const $wm_measureientdatientdata = 113
  555. Global Const $wm_contextmenu = 123
  556. Global Const $wm_stylechanging = 124
  557. Global Const $wm_stylechanged = 125
  558. Global Const $wm_displaychange = 126
  559. Global Const $wm_geticon = 127
  560. Global Const $wm_seticon = 128
  561. Global Const $wm_nccreate = 129
  562. Global Const $wm_ncdestroy = 130
  563. Global Const $wm_nccalcsize = 131
  564. Global Const $wm_nchittest = 132
  565. Global Const $wm_ncpaint = 133
  566. Global Const $wm_ncactivate = 134
  567. Global Const $wm_getdlgcode = 135
  568. Global Const $wm_syncpaint = 136
  569. Global Const $wm_synctask = 137
  570. Global Const $wm_kludgeminrect = 139
  571. Global Const $wm_lwitchwnditchwnd = 140
  572. Global Const $wm_uoywindowywindow = 144
  573. Global Const $wm_uahdrawmenu = 145
  574. Global Const $wm_menuitemenuitem = 146
  575. Global Const $wm_uahinitmenu = 147
  576. Global Const $wm_uahmenuitemenuitem = 148
  577. Global Const $wm_uahnenupopupnupopup = 149
  578. Global Const $wm_ncmousemove = 160
  579. Global Const $wm_nclbuttondown = 161
  580. Global Const $wm_nclbuttonup = 162
  581. Global Const $wm_ondblclkndblclk = 163
  582. Global Const $wm_ncrbuttondown = 164
  583. Global Const $wm_ncrbuttonup = 165
  584. Global Const $wm_ondblclkndblclk = 166
  585. Global Const $wm_ncmbuttondown = 167
  586. Global Const $wm_ncmbuttonup = 168
  587. Global Const $wm_ondblclkndblclk = 169
  588. Global Const $wm_ncxbuttondown = 171
  589. Global Const $wm_ncxbuttonup = 172
  590. Global Const $wm_ondblclkndblclk = 173
  591. Global Const $wm_nwcaptioncaption = 174
  592. Global Const $wmrawframeawframe = 175
  593. Global Const $wm_inpue_change_change = 254
  594. Global Const $wm_input = 255
  595. Global Const $wm_keydown = 256
  596. Global Const $wm_keyfirst = 256
  597. Global Const $wm_keyup = 257
  598. Global Const $wm_char = 258
  599. Global Const $wm_deadchar = 259
  600. Global Const $wm_syskeydown = 260
  601. Global Const $wm_syskeyup = 261
  602. Global Const $wm_syschar = 262
  603. Global Const $wm_sysdeadchar = 263
  604. Global Const $wm_yomichar = 264
  605. Global Const $wm_keylast = 265
  606. Global Const $wm_unichar = 265
  607. Global Const $wmtrequestrequest = 266
  608. Global Const $wm_convertresult = 267
  609. Global Const $wm_im_info = 268
  610. Global Const $wm_ime_spositionosition = 269
  611. Global Const $wm_imepositionosition = 270
  612. Global Const $wm_positionosition = 271
  613. Global Const $wm_ime_keylast = 271
  614. Global Const $wm_initdialog = 272
  615. Global Const $wm_command = 273
  616. Global Const $wm_syscommand = 274
  617. Global Const $wm_timer = 275
  618. Global Const $wm_hscroll = 276
  619. Global Const $wm_vscroll = 277
  620. Global Const $wm_initmenu = 278
  621. Global Const $wm_initmenupopup = 279
  622. Global Const $wm_systimer = 280
  623. Global Const $wm_gesture = 281
  624. Global Const $wm_gesturenotify = 282
  625. Global Const $wm_gestureinput = 283
  626. Global Const $wm_notifiedotified = 284
  627. Global Const $wm_menuselect = 287
  628. Global Const $wm_menuchar = 288
  629. Global Const $wm_enteridle = 289
  630. Global Const $wm_menurbuttonup = 290
  631. Global Const $wm_menudrag = 291
  632. Global Const $wm_menugetobject = 292
  633. Global Const $wm_enupopupnupopup = 293
  634. Global Const $wm_menucommand = 294
  635. Global Const $wm_changeuistate = 295
  636. Global Const $wm_updateuistate = 296
  637. Global Const $wm_queryuistate = 297
  638. Global Const $wm_lbtrackpoint = 305
  639. Global Const $wmormsgboxrmsgbox = 306
  640. Global Const $wm_ctlcoloredit = 307
  641. Global Const $wm_rlistboxlistbox = 308
  642. Global Const $wm_ctlcolorbtn = 309
  643. Global Const $wm_ctlcolordlg = 310
  644. Global Const $wm_ctcrollbarrollbar = 311
  645. Global Const $wmorstaticrstatic = 312
  646. Global Const $mn_gethmenu = 481
  647. Global Const $wm_parentnotify = 528
  648. Global Const $wm_entermenuloop = 529
  649. Global Const $wm_exitmenuloop = 530
  650. Global Const $wm_nextmenu = 531
  651. Global Const $wm_sizing = 532
  652. Global Const $wmechangedchanged = 533
  653. Global Const $wm_moving = 534
  654. Global Const $wmroadcastoadcast = 536
  655. Global Const $wm_devicechange = 537
  656. Global Const $wm_mdicreate = 544
  657. Global Const $wm_mdidestroy = 545
  658. Global Const $wm_mdiactivate = 546
  659. Global Const $wm_mdirestore = 547
  660. Global Const $wm_mdinext = 548
  661. Global Const $wm_mdimaximize = 549
  662. Global Const $wm_mditile = 550
  663. Global Const $wm_mdicascade = 551
  664. Global Const $wmnarrangearrange = 552
  665. Global Const $wm_mdigetactive = 553
  666. Global Const $wm_dropobject = 554
  667. Global Const $wm_opobjectpobject = 555
  668. Global Const $wm_begindrag = 556
  669. Global Const $wm_dragloop = 557
  670. Global Const $wm_dragselect = 558
  671. Global Const $wm_dragmove = 559
  672. Global Const $wm_mdisetmenu = 560
  673. Global Const $wm_entersizemove = 561
  674. Global Const $wm_exitsizemove = 562
  675. Global Const $wm_dropfiles = 563
  676. Global Const $wmreshmenueshmenu = 564
  677. Global Const $wm_touch = 576
  678. Global Const $wmtcontextcontext = 641
  679. Global Const $wm_ime_notify = 642
  680. Global Const $wm_ime_control = 643
  681. Global Const $wm_ime_tionfullionfull = 644
  682. Global Const $wm_ime_select = 645
  683. Global Const $wm_ime_char = 646
  684. Global Const $wm_ime_system = 647
  685. Global Const $wm_ime_request = 648
  686. Global Const $wm_ime_keydown = 656
  687. Global Const $wm_ime_keyup = 657
  688. Global Const $wm_ncmousehover = 672
  689. Global Const $wm_mousehover = 673
  690. Global Const $wm_ncmouseleave = 674
  691. Global Const $wm_mouseleave = 675
  692. Global Const $wm_wtn_change_change = 689
  693. Global Const $wm_tablet_first = 704
  694. Global Const $wm_tablet_last = 735
  695. Global Const $wm_cut = 768
  696. Global Const $wm_copy = 769
  697. Global Const $wm_paste = 770
  698. Global Const $wm_clear = 771
  699. Global Const $wm_undo = 772
  700. Global Const $wm_pachanginghanging = 784
  701. Global Const $wm_hotkey = 786
  702. Global Const $wmechangedchanged = 785
  703. Global Const $wm_sysmenu = 787
  704. Global Const $wm_hookmsg = 788
  705. Global Const $wm_exitprocess = 789
  706. Global Const $wm_wakethread = 790
  707. Global Const $wm_print = 791
  708. Global Const $wm_printclient = 792
  709. Global Const $wm_appcommand = 793
  710. Global Const $wm_wpalettepalette = 783
  711. Global Const $wm_themechanged = 794
  712. Global Const $wm_uahinit = 795
  713. Global Const $wm_desktopnotify = 796
  714. Global Const $wm_rdupdatedupdate = 797
  715. Global Const $wm_dwmcomnchangenchanged = 798
  716. Global Const $wm_dwmncrgchangegchanged = 799
  717. Global Const $wm_dwmcolorizatrchangerchanged = 800
  718. Global Const $wm_dwmwindowedchangedchange = 801
  719. Global Const $wm_dwmexileframe = 802
  720. Global Const $wm_dwmsendhumbnaihumbnail = 803
  721. Global Const $wm_magnif_starte_started = 804
  722. Global Const $wm_magnon_endedn_ended = 805
  723. Global Const $wndiconicdiewbitmaewbitmapwbitmap = 806
  724. Global Const $wm_dwmthumbechangeechanged = 807
  725. Global Const $wm_magnin_output_output = 808
  726. Global Const $wmecontrolcontrol = 816
  727. Global Const $wm_getactiontext = 817
  728. Global Const $wmdkeydownkeydown = 819
  729. Global Const $wm_forwardkeyup = 820
  730. Global Const $wm_gearinfoexrinfoex = 831
  731. Global Const $wm_notifywow = 832
  732. Global Const $wm_handheldfirst = 856
  733. Global Const $wm_handheldlast = 863
  734. Global Const $wm_afxfirst = 864
  735. Global Const $wm_afxlast = 895
  736. Global Const $wm_penwinfirst = 896
  737. Global Const $wm_penwinlast = 911
  738. Global Const $wm_dde_initiate = 992
  739. Global Const $wm_dde_terminate = 993
  740. Global Const $wm_dde_advise = 994
  741. Global Const $wm_dde_unadvise = 995
  742. Global Const $wm_dde_ack = 996
  743. Global Const $wm_dde_data = 997
  744. Global Const $wm_dde_request = 998
  745. Global Const $wm_dde_poke = 999
  746. Global Const $wm_dde_execute = 1000
  747. Global Const $wmficationication = 1021
  748. Global Const $wm_netconnect = 1022
  749. Global Const $wm_hibernate = 1023
  750. Global Const $wm_user = 1024
  751. Global Const $wm_app = 32768
  752. Global Const $nm_first = 0
  753. Global Const $nm_outofmemory = $nm_first - 1
  754. Global Const $nm_click = $nm_first - 2
  755. Global Const $nm_dblclk = $nm_first - 3
  756. Global Const $nm_return = $nm_first - 4
  757. Global Const $nm_rclick = $nm_first - 5
  758. Global Const $nm_rdblclk = $nm_first - 6
  759. Global Const $nm_setfocus = $nm_first - 7
  760. Global Const $nm_killfocus = $nm_first - 8
  761. Global Const $nm_customdraw = $nm_first - 12
  762. Global Const $nm_hover = $nm_first - 13
  763. Global Const $nm_nchittest = $nm_first - 14
  764. Global Const $nm_keydown = $nm_first - 15
  765. Global Const $nm_dcapturecapture = $nm_first - 16
  766. Global Const $nm_setcursor = $nm_first - 17
  767. Global Const $nm_char = $nm_first - 18
  768. Global Const $nm_screatedcreated = $nm_first - 19
  769. Global Const $nm_ldown = $nm_first - 20
  770. Global Const $nm_rdown = $nm_first - 21
  771. Global Const $nm_themechanged = $nm_first - 22
  772. Global Const $wm_mousefirst = 512
  773. Global Const $wm_mousemove = 512
  774. Global Const $wm_lbuttondown = 513
  775. Global Const $wm_lbuttonup = 514
  776. Global Const $wm_lbuttondblclk = 515
  777. Global Const $wm_rbuttondown = 516
  778. Global Const $wm_rbuttonup = 517
  779. Global Const $wm_rbuttondblclk = 518
  780. Global Const $wm_mbuttondown = 519
  781. Global Const $wm_mbuttonup = 520
  782. Global Const $wm_mbuttondblclk = 521
  783. Global Const $wm_mousewheel = 522
  784. Global Const $wm_xbuttondown = 523
  785. Global Const $wm_xbuttonup = 524
  786. Global Const $wm_xbuttondblclk = 525
  787. Global Const $wm_mousehwheel = 526
  788. Global Const $ps_solid = 0
  789. Global Const $ps_dash = 1
  790. Global Const $ps_dot = 2
  791. Global Const $ps_dashdot = 3
  792. Global Const $ps_dashdotdot = 4
  793. Global Const $ps_null = 5
  794. Global Const $ps_insideframe = 6
  795. Global Const $ps_userstyle = 7
  796. Global Const $ps_alternate = 8
  797. Global Const $ps_endcap_round = 0
  798. Global Const $ps_endcap_square = 256
  799. Global Const $ps_endcap_flat = 512
  800. Global Const $ps_join_bevel = 4096
  801. Global Const $ps_join_miter = 8192
  802. Global Const $ps_join_round = 0
  803. Global Const $ps_geometric = 65536
  804. Global Const $ps_cosmetic = 0
  805. Global Const $lwa_alpha = 2
  806. Global Const $lwa_colorkey = 1
  807. Global Const $rgn_and = 1
  808. Global Const $rgn_or = 2
  809. Global Const $rgn_xor = 3
  810. Global Const $rgn_diff = 4
  811. Global Const $rgn_copy = 5
  812. Global Const $errorregion = 0
  813. Global Const $nullregion = 1
  814. Global Const $simpleregion = 2
  815. Global Const $complexregion = 3
  816. Global Const $transparent = 1
  817. Global Const $opaque = 2
  818. Global Const $ccm_first = 8192
  819. Global Const $ccm_gdeformateformat = ($ccm_first + 6)
  820. Global Const $ccm_sdeformateformat = ($ccm_first + 5)
  821. Global Const $ccm_setbkcolor = $ccm_first + 1
  822. Global Const $ccmorschemerscheme = $ccm_first + 2
  823. Global Const $ccmorschemerscheme = $ccm_first + 3
  824. Global Const $ccoptargetptarget = $ccm_first + 4
  825. Global Const $ccmdowthemeowtheme = $ccm_first + 11
  826. Global Const $ga_parent = 1
  827. Global Const $ga_root = 2
  828. Global Const $ga_rootowner = 3
  829. Global Const $sm_cxscreen = 0
  830. Global Const $sm_cyscreen = 1
  831. Global Const $sm_cxvscroll = 2
  832. Global Const $sm_cyhscroll = 3
  833. Global Const $sm_cycaption = 4
  834. Global Const $sm_cxborder = 5
  835. Global Const $sm_cyborder = 6
  836. Global Const $sm_cxdlgframe = 7
  837. Global Const $sm_cydlgframe = 8
  838. Global Const $sm_cyvthumb = 9
  839. Global Const $sm_cxhthumb = 10
  840. Global Const $sm_cxicon = 11
  841. Global Const $sm_cyicon = 12
  842. Global Const $sm_cxcursor = 13
  843. Global Const $sm_cycursor = 14
  844. Global Const $sm_cymenu = 15
  845. Global Const $sm_cxfullscreen = 16
  846. Global Const $sm_cyfullscreen = 17
  847. Global Const $sm_cykanjiwindow = 18
  848. Global Const $sm_mousepresent = 19
  849. Global Const $sm_cyvscroll = 20
  850. Global Const $sm_cxhscroll = 21
  851. Global Const $sm_debug = 22
  852. Global Const $sm_swapbutton = 23
  853. Global Const $sm_reserved1 = 24
  854. Global Const $sm_reserved2 = 25
  855. Global Const $sm_reserved3 = 26
  856. Global Const $sm_reserved4 = 27
  857. Global Const $sm_cxmin = 28
  858. Global Const $sm_cymin = 29
  859. Global Const $sm_cxsize = 30
  860. Global Const $sm_cysize = 31
  861. Global Const $sm_cxframe = 32
  862. Global Const $sm_cyframe = 33
  863. Global Const $sm_cxmintrack = 34
  864. Global Const $sm_cymintrack = 35
  865. Global Const $sm_cxdoubleclk = 36
  866. Global Const $sm_cydoubleclk = 37
  867. Global Const $sm_cxiconspacing = 38
  868. Global Const $sm_cyiconspacing = 39
  869. Global Const $sm_melignmentignment = 40
  870. Global Const $sm_penwindows = 41
  871. Global Const $sm_dbcsenabled = 42
  872. Global Const $sm_cmousebuttons = 43
  873. Global Const $sm_secure = 44
  874. Global Const $sm_cxedge = 45
  875. Global Const $sm_cyedge = 46
  876. Global Const $sm_cxminspacing = 47
  877. Global Const $sm_cyminspacing = 48
  878. Global Const $sm_cxsmicon = 49
  879. Global Const $sm_cysmicon = 50
  880. Global Const $sm_cysmcaption = 51
  881. Global Const $sm_cxsmsize = 52
  882. Global Const $sm_cysmsize = 53
  883. Global Const $sm_cxmenusize = 54
  884. Global Const $sm_cymenusize = 55
  885. Global Const $sm_arrange = 56
  886. Global Const $sm_cxminimized = 57
  887. Global Const $sm_cyminimized = 58
  888. Global Const $sm_cxmaxtrack = 59
  889. Global Const $sm_cymaxtrack = 60
  890. Global Const $sm_cxmaximized = 61
  891. Global Const $sm_cymaximized = 62
  892. Global Const $sm_network = 63
  893. Global Const $sm_cleanboot = 67
  894. Global Const $sm_cxdrag = 68
  895. Global Const $sm_cydrag = 69
  896. Global Const $sm_showsounds = 70
  897. Global Const $sm_cxmenucheck = 71
  898. Global Const $sm_cymenucheck = 72
  899. Global Const $sm_slowmachine = 73
  900. Global Const $smtenabledenabled = 74
  901. Global Const $sm_molpresentpresent = 75
  902. Global Const $smalscreenlscreen = 76
  903. Global Const $smalscreenlscreen = 77
  904. Global Const $sm_alscreenlscreen = 78
  905. Global Const $sm_alscreenlscreen = 79
  906. Global Const $sm_cmonitors = 80
  907. Global Const $sm_saayformatyformat = 81
  908. Global Const $sm_immenabled = 82
  909. Global Const $sm_cxfocusborder = 83
  910. Global Const $sm_cyfocusborder = 84
  911. Global Const $sm_tabletpc = 86
  912. Global Const $sm_mediacenter = 87
  913. Global Const $sm_starter = 88
  914. Global Const $sm_serverr2 = 89
  915. Global Const $sm_cmetrics = 90
  916. Global Const $sm_remotesession = 4096
  917. Global Const $sm_shuttingdown = 8192
  918. Global Const $sm_remotecontrol = 8193
  919. Global Const $sm_caretgenabledenabled = 8194
  920. Global Const $blackness = 66
  921. Global Const $captureblt = 1073741824
  922. Global Const $dstinvert = 5570569
  923. Global Const $mergecopy = 12583114
  924. Global Const $mergepaint = 12255782
  925. Global Const $nomirrorbitmap = -2147483648
  926. Global Const $notsrccopy = 3342344
  927. Global Const $notsrcerase = 1114278
  928. Global Const $patcopy = 15728673
  929. Global Const $patinvert = 5898313
  930. Global Const $patpaint = 16452105
  931. Global Const $srcand = 8913094
  932. Global Const $srccopy = 13369376
  933. Global Const $srcerase = 4457256
  934. Global Const $srcinvert = 6684742
  935. Global Const $srcpaint = 15597702
  936. Global Const $whiteness = 16711778
  937. Global Const $dt_bottom = 8
  938. Global Const $dt_calcrect = 1024
  939. Global Const $dt_center = 1
  940. Global Const $dt_editcontrol = 8192
  941. Global Const $dt_end_ellipsis = 32768
  942. Global Const $dt_expandtabs = 64
  943. Global Const $dt_lleadingleading = 512
  944. Global Const $dt_hideprefix = 1048576
  945. Global Const $dt_internal = 4096
  946. Global Const $dt_left = 0
  947. Global Const $dt_modifystring = 65536
  948. Global Const $dt_noclip = 256
  949. Global Const $dt_nofulharbreakarbreak = 524288
  950. Global Const $dt_noprefix = 2048
  951. Global Const $dt_path_ellipsis = 16384
  952. Global Const $dt_prefixonly = 2097152
  953. Global Const $dt_right = 2
  954. Global Const $dt_rtlreading = 131072
  955. Global Const $dt_singleline = 32
  956. Global Const $dt_tabstop = 128
  957. Global Const $dt_top = 0
  958. Global Const $dt_vcenter = 4
  959. Global Const $dt_wordbreak = 16
  960. Global Const $dt_word_ellipsis = 262144
  961. Global Const $rdw_erase = 4
  962. Global Const $rdw_frame = 1024
  963. Global Const $rdnalpaintalpaint = 2
  964. Global Const $rdw_invalidate = 1
  965. Global Const $rdw_noerase = 32
  966. Global Const $rdw_noframe = 2048
  967. Global Const $rdw_nalpaintalpaint = 16
  968. Global Const $rdw_validate = 8
  969. Global Const $rdw_erasenow = 512
  970. Global Const $rdw_updatenow = 256
  971. Global Const $rdw_allchildren = 128
  972. Global Const $rdw_nochildren = 64
  973. Global Const $wm_renderformat = 773
  974. Global Const $wm_rlformatsformats = 774
  975. Global Const $wm_dlipboardipboard = 775
  976. Global Const $wm_drawclipboard = 776
  977. Global Const $wmlipboardipboard = 777
  978. Global Const $wm_vlipboardipboard = 778
  979. Global Const $wm_sizeclipboard = 779
  980. Global Const $wm_rmatnamematname = 780
  981. Global Const $wm_changecbchain = 781
  982. Global Const $wm_hlipboardipboard = 782
  983. Global Const $hterror = -2
  984. Global Const $httransparent = -1
  985. Global Const $htnowhere = 0
  986. Global Const $htclient = 1
  987. Global Const $htcaption = 2
  988. Global Const $htsysmenu = 3
  989. Global Const $htgrowbox = 4
  990. Global Const $htsize = $htgrowbox
  991. Global Const $htmenu = 5
  992. Global Const $hthscroll = 6
  993. Global Const $htvscroll = 7
  994. Global Const $htminbutton = 8
  995. Global Const $htmaxbutton = 9
  996. Global Const $htleft = 10
  997. Global Const $htright = 11
  998. Global Const $httop = 12
  999. Global Const $httopleft = 13
  1000. Global Const $httopright = 14
  1001. Global Const $htbottom = 15
  1002. Global Const $htbottomleft = 16
  1003. Global Const $htbottomright = 17
  1004. Global Const $htborder = 18
  1005. Global Const $htreduce = $htminbutton
  1006. Global Const $htzoom = $htmaxbutton
  1007. Global Const $htsizefirst = $htleft
  1008. Global Const $htsizelast = $htbottomright
  1009. Global Const $htobject = 19
  1010. Global Const $htclose = 20
  1011. Global Const $hthelp = 21
  1012. Global Const $color_scrollbar = 0
  1013. Global Const $color_background = 1
  1014. Global Const $coloecaptioncaption = 2
  1015. Global Const $color_ecaptioncaption = 3
  1016. Global Const $color_menu = 4
  1017. Global Const $color_window = 5
  1018. Global Const $codowframeowframe = 6
  1019. Global Const $color_menutext = 7
  1020. Global Const $color_windowtext = 8
  1021. Global Const $cotiontextiontext = 9
  1022. Global Const $colvebordereborder = 10
  1023. Global Const $colorvebordereborder = 11
  1024. Global Const $colorkspacerkspace = 12
  1025. Global Const $color_highlight = 13
  1026. Global Const $coloighttextghttext = 14
  1027. Global Const $color_btnface = 15
  1028. Global Const $color_btnshadow = 16
  1029. Global Const $color_graytext = 17
  1030. Global Const $color_btntext = 18
  1031. Global Const $color_inactiontextiontext = 19
  1032. Global Const $colighlightghlight = 20
  1033. Global Const $color_3ddkshadow = 21
  1034. Global Const $color_3dlight = 22
  1035. Global Const $color_infotext = 23
  1036. Global Const $color_infobk = 24
  1037. Global Const $color_hotlight = 26
  1038. Global Const $color_gradieecaptioecaption = 27
  1039. Global Const $color_gradientecaptioecaption = 28
  1040. Global Const $couhilighthilight = 29
  1041. Global Const $color_menubar = 30
  1042. Global Const $color_desktop = 1
  1043. Global Const $color_3dface = 15
  1044. Global Const $color_3dshadow = 16
  1045. Global Const $coighlightghlight = 20
  1046. Global Const $color_3dhilight = 20
  1047. Global Const $color_btnhilight = 20
  1048. Global Const $hinst_commctrl = -1
  1049. Global Const $idb_ll_colorl_color = 0
  1050. Global Const $idb_ge_colore_color = 1
  1051. Global Const $idb_vll_colorl_color = 4
  1052. Global Const $idb_vge_colore_color = 5
  1053. Global Const $idb_hll_colorl_color = 8
  1054. Global Const $idb_hge_colore_color = 9
  1055. Global Const $startf_ffeedbackeedback = 128
  1056. Global Const $startf_feedbackeedback = 64
  1057. Global Const $startftpinningpinning = 8192
  1058. Global Const $startllscreenlscreen = 32
  1059. Global Const $stareisappidisappid = 4096
  1060. Global Const $startf_linknameinkname = 2048
  1061. Global Const $startuntcharsntchars = 8
  1062. Global Const $startf_uttributetribute = 16
  1063. Global Const $startf_usehotkey = 512
  1064. Global Const $stapositionosition = 4
  1065. Global Const $startowwindowwwindow = 1
  1066. Global Const $startf_usesize = 2
  1067. Global Const $startdhandleshandles = 256
  1068. Global Const $cdds_prepaint = 1
  1069. Global Const $cdds_postpaint = 2
  1070. Global Const $cdds_preerase = 3
  1071. Global Const $cdds_posterase = 4
  1072. Global Const $cdds_item = 65536
  1073. Global Const $cdprepaintrepaint = 65537
  1074. Global Const $cddostpaintstpaint = 65538
  1075. Global Const $cdpreerasereerase = 65539
  1076. Global Const $cddosterasesterase = 65540
  1077. Global Const $cdds_subitem = 131072
  1078. Global Const $cdis_selected = 1
  1079. Global Const $cdis_grayed = 2
  1080. Global Const $cdis_disabled = 4
  1081. Global Const $cdis_checked = 8
  1082. Global Const $cdis_focus = 16
  1083. Global Const $cdis_default = 32
  1084. Global Const $cdis_hot = 64
  1085. Global Const $cdis_marked = 128
  1086. Global Const $cdierminaterminate = 256
  1087. Global Const $cdis_soardcuesardcues = 512
  1088. Global Const $cdis_nearhot = 1024
  1089. Global Const $cdrsidehotsidehot = 2048
  1090. Global Const $cdis_drophilited = 4096
  1091. Global Const $cdrf_dodefault = 0
  1092. Global Const $cdrf_newfont = 2
  1093. Global Const $cdrf_skipdefault = 4
  1094. Global Const $cdrf_ostpaintstpaint = 16
  1095. Global Const $cdrfitemdrawtemdraw = 32
  1096. Global Const $cdrf_noitemdrawtemdraw = 32
  1097. Global Const $cdrf_osterasesterase = 64
  1098. Global Const $cdrf_doerase = 8
  1099. Global Const $cdrostpaintstpaint = 256
  1100. Global Const $guiault_guiult_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
  1101. Global Const $gmem_fixed = 0
  1102. Global Const $gmem_moveable = 2
  1103. Global Const $gmem_nocompact = 16
  1104. Global Const $gmem_nodiscard = 32
  1105. Global Const $gmem_zeroinit = 64
  1106. Global Const $gmem_modify = 128
  1107. Global Const $gmem_discardable = 256
  1108. Global Const $gmem_not_banked = 4096
  1109. Global Const $gmem_share = 8192
  1110. Global Const $gmem_ddeshare = 8192
  1111. Global Const $gmem_notify = 16384
  1112. Global Const $gmem_lower = 4096
  1113. Global Const $gmem_valid_flags = 32626
  1114. Global Const $gmemd_handle_handle = 32768
  1115. Global Const $gptr = BitOR($gmem_fixed, $gmem_zeroinit)
  1116. Global Const $ghnd = BitOR($gmem_moveable, $gmem_zeroinit)
  1117. Global Const $mem_commit = 4096
  1118. Global Const $mem_reserve = 8192
  1119. Global Const $mem_top_down = 1048576
  1120. Global Const $mem_shared = 134217728
  1121. Global Const $page_noaccess = 1
  1122. Global Const $page_readonly = 2
  1123. Global Const $page_readwrite = 4
  1124. Global Const $page_execute = 16
  1125. Global Const $paute_readte_read = 32
  1126. Global Const $page_exeadwriteadwrite = 64
  1127. Global Const $page_exritecopyitecopy = 128
  1128. Global Const $page_guard = 256
  1129. Global Const $page_nocache = 512
  1130. Global Const $paecombinecombine = 1024
  1131. Global Const $page_writecopy = 8
  1132. Global Const $mem_decommit = 16384
  1133. Global Const $mem_release = 32768
  1134. Global Const $prerminaterminate = 1
  1135. Global Const $procese_thread_thread = 2
  1136. Global Const $procesessionidssionid = 4
  1137. Global Const $proceperationeration = 8
  1138. Global Const $process_vm_read = 16
  1139. Global Const $process_vm_write = 32
  1140. Global Const $prop_handle_handle = 64
  1141. Global Const $process_processprocess = 128
  1142. Global Const $pret_quotat_quota = 256
  1143. Global Const $process_ormationrmation = 512
  1144. Global Const $process_quormatioormation = 1024
  1145. Global Const $pquery_liuiormatioormationrmation = 4096
  1146. Global Const $processd_resume_resume = 2048
  1147. Global Const $prol_access_access = 2035711
  1148. Global Const $se_assignprken_namken_name = "SeAssignPrimarrivilegrivilege"
  1149. Global Const $se_audit_name = "SeAuditPrivilege"
  1150. Global Const $se_backup_name = "Serivilegeivilege"
  1151. Global Const $se_chaify_namefy_name = "SeChangerivilegeivilege"
  1152. Global Const $se_crebal_nameal_name = "SeCreaterivilegeivilege"
  1153. Global Const $se_creatile_namele_name = "SeCreateParivilegrivilege"
  1154. Global Const $se_createent_nament_name = "SeCreatePerrivilegrivilege"
  1155. Global Const $se_create_symink_namink_name = "SeCreateSymbolrivilegrivilege"
  1156. Global Const $se_crken_nameen_name = "SeCreatrivilegeivilege"
  1157. Global Const $se_debug_name = "SeDebugPrivilege"
  1158. Global Const $se_enable_ion_namion_name = "SeEnableDelerivilegrivilege"
  1159. Global Const $se_iate_namete_name = "SeImperrivilegeivilege"
  1160. Global Const $se_inc_basity_namity_name = "SeIncreaseBasePrrivilegrivilege"
  1161. Global Const $se_inc_wset_nameet_name = "SeIncreaseWorkrivilegrivilege"
  1162. Global Const $se_incrota_nameta_name = "SeIncreasrivilegrivilege"
  1163. Global Const $se_lver_nameer_name = "SeLoadrivilegeivilege"
  1164. Global Const $se_lory_namery_name = "SeLockrivilegeivilege"
  1165. Global Const $se_machiunt_nament_name = "SeMachineArivilegrivilege"
  1166. Global Const $se_manume_nameme_name = "SeManagerivilegeivilege"
  1167. Global Const $se_prof_singess_namess_name = "SeProfileSinglePrivilegrivilege"
  1168. Global Const $se_relabel_name = "SeRrivilegeivilege"
  1169. Global Const $se_remotown_namewn_name = "SeRemoteShrivilegrivilege"
  1170. Global Const $se_restore_name = "SeRrivilegeivilege"
  1171. Global Const $se_security_name = "SeSerivilegeivilege"
  1172. Global Const $se_shutdown_name = "SeShrivilegeivilege"
  1173. Global Const $se_ent_nament_name = "SeSynrivilegeivilege"
  1174. Global Const $se_system_eent_nament_name = "SeSystemEnvirrivilegrivilege"
  1175. Global Const $se_systile_namele_name = "SeSystemPrivilegrivilege"
  1176. Global Const $se_ime_nameme_name = "SeSystrivilegeivilege"
  1177. Global Const $se_takehip_nameip_name = "SeTakeOwnrivilegrivilege"
  1178. Global Const $se_tcb_name = "SeTcbPrivilege"
  1179. Global Const $seone_namene_name = "SeTirivilegeivilege"
  1180. Global Const $se_trusted_credess_namess_name = "SeTrustedCredManrivilegrivilege"
  1181. Global Const $se_unsolicput_namput_name = "SeUnsoliciterivilegrivilege"
  1182. Global Const $se_undock_name = "Serivilegeivilege"
  1183. Global Const $se_privilege_ena_defaul_default = 1
  1184. Global Const $se_pr_enabledenabled = 2
  1185. Global Const $se_pr_removedremoved = 4
  1186. Global Const $se_privilege_r_accesr_access = -2147483648
  1187. Global Const $se_andatoryndatory = 1
  1188. Global Const $se_group_ena_defaul_default = 2
  1189. Global Const $se_group_enabled = 4
  1190. Global Const $se_group_owner = 8
  1191. Global Const $se_group_useny_onleny_only = 16
  1192. Global Const $se_ntegritytegrity = 32
  1193. Global Const $se_group_in_enable_enabled = 64
  1194. Global Const $seresourceesource = 536870912
  1195. Global Const $selogon_idogon_id = -1073741824
  1196. Global Enum $tokenprimary = 1, $toksonationonation
  1197. Global Enum $senonymousonymous = 0, $securitficationication, $securisonationonation, $seclegationegation
  1198. Global Enum $tokenuser = 1, $tokengroups, $tokenprivileges, $tokenowner, $toarygrouprygroup, $tokendefaultdacl, $tokensource, $tokentype, $tokenimpionlevelonlevel, $tokenstatistics, $tokectedsidstedsids, $tokensessionid, $tokengrouivilegeivileges, $tokenseferenceference, $toboxinertoxinert, $tokenauditpolicy, $tokenorigin, $toktiontypeiontype, $tokenlinkedtoken, $tokenelevation, $tokenrictionsictions, $tokenacormationrmation, $tokenvirtuanallowenallowed, $tokenvirtuanenablenenabled, $tokeityleveltylevel, $tokenuiaccess, $tokenrypolicyypolicy, $tokenlogonsid
  1199. Global Const $token_primaryprimary = 1
  1200. Global Const $token_duplicate = 2
  1201. Global Const $toersonatersonate = 4
  1202. Global Const $token_query = 8
  1203. Global Const $toky_source_source = 16
  1204. Global Const $token_adivilegesvileges = 32
  1205. Global Const $toket_groups_groups = 64
  1206. Global Const $token_defaultdefault = 128
  1207. Global Const $token_aessionidssionid = 256
  1208. Global Const $token_all_access = 983551
  1209. Global Const $token_read = 131080
  1210. Global Const $token_write = 131296
  1211. Global Const $token_execute = 131072
  1212. Global Const $token_has_trarivilegrivilege = 1
  1213. Global Const $token_has_brivilegrivilege = 2
  1214. Global Const $token_has_rerivilegrivilege = 4
  1215. Global Const $token_in_groupn_group = 8
  1216. Global Const $tokestrictedtricted = 16
  1217. Global Const $token_sessionferenceferenced = 32
  1218. Global Const $tokeox_inertx_inert = 64
  1219. Global Const $token_has_impersrivilegrivilege = 128
  1220. Global Const $rights_delete = 65536
  1221. Global Const $read_control = 131072
  1222. Global Const $write_dac = 262144
  1223. Global Const $write_owner = 524288
  1224. Global Const $synchronize = 1048576
  1225. Global Const $access_securityecurity = 16777216
  1226. Global Const $standard_requirerequired = 983040
  1227. Global Const $standhts_readts_read = $read_control
  1228. Global Const $standats_writes_write = $read_control
  1229. Global Const $standard_executeexecute = $read_control
  1230. Global Const $stanghts_allhts_all = 2031616
  1231. Global Const $specghts_allhts_all = 65535
  1232. Global Enum $not_used_access = 0, $grant_access, $set_access, $deny_access, $revoke_access, $se_successsuccess, $se_failurefailure
  1233. Global Enum $tru_unknownunknown = 0, $trustee_is_user, $trustee_is_group, $trs_domain_domain, $trustee_is_alias, $trustee_is_wwn_grouwn_group, $tru_deleteddeleted, $tru_invalidinvalid, $truscomputeromputer
  1234. Global Const $log_profileprofile = 1
  1235. Global Const $logon_netcals_onlals_only = 2
  1236. Global Enum $sidtypeuser = 1, $sidtypegroup, $sidtypedomain, $sidtypealias, $sidtypowngroupwngroup, $sidtypdaccountaccount, $sidtypeinvalid, $sidtypeunknown, $sidtypecomputer, $sidtypelabel
  1237. Global Const $sidstratorstrators = "S-1-5-32-544"
  1238. Global Const $sid_users = "S-1-5-32-545"
  1239. Global Const $sid_guests = "S-1-5-32-546"
  1240. Global Const $sid_acperatorserators = "S-1-5-32-548"
  1241. Global Const $sid_speratorserators = "S-1-5-32-549"
  1242. Global Const $sid_peratorserators = "S-1-5-32-550"
  1243. Global Const $sid_bperatorserators = "S-1-5-32-551"
  1244. Global Const $sid_replicator = "S-1-5-32-552"
  1245. Global Const $sid_owner = "S-1-3-0"
  1246. Global Const $sid_everyone = "S-1-1-0"
  1247. Global Const $sid_network = "S-1-5-2"
  1248. Global Const $sid_interactive = "S-1-5-4"
  1249. Global Const $sid_system = "S-1-5-18"
  1250. Global Const $sid_authed_usersd_users = "S-1-5-11"
  1251. Global Const $sid_schannelticatiotication = "S-1-5-64-14"
  1252. Global Const $sid_digestticatiotication = "S-1-5-64-21"
  1253. Global Const $sid_nt_service = "S-1-5-80"
  1254. Global Const $sid_untrusted_ry_levery_level = "S-1-16-0"
  1255. Global Const $sid_low_ry_levely_level = "S-1-16-4096"
  1256. Global Const $sid_medium_ry_levery_level = "S-1-16-8192"
  1257. Global Const $sid_medium_plus_ry_levery_level = "S-1-16-8448"
  1258. Global Const $sid_high_ry_levery_level = "S-1-16-12288"
  1259. Global Const $sid_system_ry_levery_level = "S-1-16-16384"
  1260. Global Const $sid_pd_prcted__ry_levery_levely_level = "S-1-16-20480"
  1261. Global Const $sie_procee__ry_levery_levely_level = "S-1-16-28672"
  1262. Global Const $sid_all_services = "S-1-5-80-0"
  1263.  
  1264. Func _winapi_getlasterror($ierror = @error, $iextended = @extended)
  1265. Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
  1266. Return SetError($ierror, $iextended, $aresult[0])
  1267. EndFunc
  1268.  
  1269. Func _winapi_setlasterror($ierrorcode, $ierror = @error, $iextended = @extended)
  1270. DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
  1271. Return SetError($ierror, $iextended, NULL )
  1272. EndFunc
  1273.  
  1274. Func _security__adjusttokenprivileges($htoken, $bdisableall, $pnewstate, $ibufferlen, $pprevstate = 0, $prequired = 0)
  1275. Local $acall = DllCall("advapi32.dll", "bool", "Adjustivilegesvileges", "handle", $htoken, "bool", $bdisableall, "struct*", $pnewstate, "dword", $ibufferlen, "struct*", $pprevstate, "struct*", $prequired)
  1276. If @error Then Return SetError(@error, @extended, False)
  1277. Return NOT ($acall[0] = 0)
  1278. EndFunc
  1279.  
  1280. Func _security__createprocesswithtoken($htoken, $ilogonflags, $scommandline, $icreationflags, $scurdir, $tstartupinfo, $tprocormationrmation)
  1281. Local $acall = DllCall("advapi32.dll", "bool", "CreatePrthTokenWhTokenW", "handle", $htoken, "dword", $ilogonflags, "ptr", 0, "wstr", $scommandline, "dword", $icreationflags, "struct*", 0, "wstr", $scurdir, "struct*", $tstartupinfo, "struct*", $tprocormationrmation)
  1282. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  1283. Return True
  1284. EndFunc
  1285.  
  1286. Func _security__duplicatetokenex($hexistingtoken, $idesiredaccess, $iimpionlevelonlevel, $itokentype)
  1287. Local $acall = DllCall("advapi32.dll", "bool", "DuplicateTokenEx", "handle", $hexistingtoken, "dword", $idesiredaccess, "struct*", 0, "int", $iimpionlevelonlevel, "int", $itokentype, "handle*", 0)
  1288. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1289. Return $acall[6]
  1290. EndFunc
  1291.  
  1292. Func _security__getaccountsid($saccount, $ssystem = "")
  1293. Local $aacct = _security__lookupaccountname($saccount, $ssystem)
  1294. If @error Then Return SetError(@error, @extended, 0)
  1295. If IsArray($aacct) Then Return _security__stringsidtosid($aacct[0])
  1296. Return ""
  1297. EndFunc
  1298.  
  1299. Func _security__getlengthsid($psid)
  1300. If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  1301. Local $acall = DllCall("advapi32.dll", "dword", "GetLengthSid", "struct*", $psid)
  1302. If @error Then Return SetError(@error, @extended, 0)
  1303. Return $acall[0]
  1304. EndFunc
  1305.  
  1306. Func _security__gettokeninformation($htoken, $iclass)
  1307. Local $acall = DllCall("advapi32.dll", "bool", "GetTormationrmation", "handle", $htoken, "int", $iclass, "struct*", 0, "dword", 0, "dword*", 0)
  1308. If @error OR NOT $acall[5] Then Return SetError(@error + 10, @extended, 0)
  1309. Local $ilen = $acall[5]
  1310. Local $tbuffer = DllStructCreate("byte[" & $ilen & "]")
  1311. $acall = DllCall("advapi32.dll", "bool", "GetTormationrmation", "handle", $htoken, "int", $iclass, "struct*", $tbuffer, "dword", DllStructGetSize($tbuffer), "dword*", 0)
  1312. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1313. Return $tbuffer
  1314. EndFunc
  1315.  
  1316. Func _security__impersonateself($ilevel = $securisonationonation)
  1317. Local $acall = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
  1318. If @error Then Return SetError(@error, @extended, False)
  1319. Return NOT ($acall[0] = 0)
  1320. EndFunc
  1321.  
  1322. Func _security__isvalidsid($psid)
  1323. Local $acall = DllCall("advapi32.dll", "bool", "IsValidSid", "struct*", $psid)
  1324. If @error Then Return SetError(@error, @extended, False)
  1325. Return NOT ($acall[0] = 0)
  1326. EndFunc
  1327.  
  1328. Func _security__lookupaccountname($saccount, $ssystem = "")
  1329. Local $tdata = DllStructCreate("byte SID[256]")
  1330. Local $acall = DllCall("advapi32.dll", "bool", "LoountNameWntNameW", "wstr", $ssystem, "wstr", $saccount, "struct*", $tdata, "dword*", DllStructGetSize($tdata), "wstr", "", "dword*", DllStructGetSize($tdata), "int*", 0)
  1331. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1332. Local $aacct[3]
  1333. $aacct[0] = _security__sidtostringsid(DllStructGetPtr($tdata, "SID"))
  1334. $aacct[1] = $acall[5]
  1335. $aacct[2] = $acall[7]
  1336. Return $aacct
  1337. EndFunc
  1338.  
  1339. Func _security__lookupaccountsid($vsid, $ssystem = "")
  1340. Local $psid, $aacct[3]
  1341. If IsString($vsid) Then
  1342. $psid = _security__stringsidtosid($vsid)
  1343. Else
  1344. $psid = $vsid
  1345. EndIf
  1346. If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  1347. Local $stypesystem = "ptr"
  1348. If $ssystem Then $stypesystem = "wstr"
  1349. Local $acall = DllCall("advapi32.dll", "bool", "LoountSidWuntSidW", $stypesystem, $ssystem, "struct*", $psid, "wstr", "", "dword*", 65536, "wstr", "", "dword*", 65536, "int*", 0)
  1350. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1351. Local $aacct[3]
  1352. $aacct[0] = $acall[3]
  1353. $aacct[1] = $acall[5]
  1354. $aacct[2] = $acall[7]
  1355. Return $aacct
  1356. EndFunc
  1357.  
  1358. Func _security__lookupprivilegevalue($ssystem, $sname)
  1359. Local $acall = DllCall("advapi32.dll", "bool", "LookupgeValueWeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
  1360. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1361. Return $acall[3]
  1362. EndFunc
  1363.  
  1364. Func _security__openprocesstoken($hprocess, $iaccess)
  1365. Local $acall = DllCall("advapi32.dll", "bool", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "handle*", 0)
  1366. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1367. Return $acall[3]
  1368. EndFunc
  1369.  
  1370. Func _security__openthreadtoken($iaccess, $hthread = 0, $bopenasself = False)
  1371. If $hthread = 0 Then
  1372. Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  1373. If @error Then Return SetError(@error + 10, @extended, 0)
  1374. $hthread = $aresult[0]
  1375. EndIf
  1376. Local $acall = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread, "dword", $iaccess, "bool", $bopenasself, "handle*", 0)
  1377. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1378. Return $acall[4]
  1379. EndFunc
  1380.  
  1381. Func _security__openthreadtokenex($iaccess, $hthread = 0, $bopenasself = False)
  1382. Local $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  1383. If $htoken = 0 Then
  1384. Local Const $error_no_token = 1008
  1385. If _winapi_getlasterror() <> $error_no_token Then Return SetError(20, _winapi_getlasterror(), 0)
  1386. If NOT _security__impersonateself() Then Return SetError(@error + 10, _winapi_getlasterror(), 0)
  1387. $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  1388. If $htoken = 0 Then Return SetError(@error, _winapi_getlasterror(), 0)
  1389. EndIf
  1390. Return $htoken
  1391. EndFunc
  1392.  
  1393. Func _security__setprivilege($htoken, $sprivilege, $benable)
  1394. Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
  1395. If $iluid = 0 Then Return SetError(@error + 10, @extended, False)
  1396. Local Const $tagtivilegesvileges = "dword Count;align 4;int6dtributetributetributes"
  1397. Local $tcurrstate = DllStructCreate($tagtivilegesvileges)
  1398. Local $icurrstate = DllStructGetSize($tcurrstate)
  1399. Local $tprevstate = DllStructCreate($tagtivilegesvileges)
  1400. Local $iprevstate = DllStructGetSize($tprevstate)
  1401. Local $trequired = DllStructCreate("int Data")
  1402. DllStructSetData($tcurrstate, "Count", 1)
  1403. DllStructSetData($tcurrstate, "LUID", $iluid)
  1404. If NOT _security__adjusttokenprivileges($htoken, False, $tcurrstate, $icurrstate, $tprevstate, $trequired) Then Return SetError(2, @error, False)
  1405. DllStructSetData($tprevstate, "Count", 1)
  1406. DllStructSetData($tprevstate, "LUID", $iluid)
  1407. Local $iattributes = DllStructGetData($tprevstate, "Attributes")
  1408. If $benable Then
  1409. $iattributes = BitOR($iattributes, $se_pr_enabledenabled)
  1410. Else
  1411. $iattributes = BitAND($iattributes, BitNOT($se_pr_enabledenabled))
  1412. EndIf
  1413. DllStructSetData($tprevstate, "Attributes", $iattributes)
  1414. If NOT _security__adjusttokenprivileges($htoken, False, $tprevstate, $iprevstate, $tcurrstate, $trequired) Then Return SetError(3, @error, False)
  1415. Return True
  1416. EndFunc
  1417.  
  1418. Func _security__settokeninformation($htoken, $itormationrmation, $vtormationrmation, $itokeninonlengthnlength)
  1419. Local $acall = DllCall("advapi32.dll", "bool", "SetTormationrmation", "handle", $htoken, "int", $itormationrmation, "struct*", $vtormationrmation, "dword", $itokeninonlengthnlength)
  1420. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  1421. Return True
  1422. EndFunc
  1423.  
  1424. Func _security__sidtostringsid($psid)
  1425. If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, 0, "")
  1426. Local $acall = DllCall("advapi32.dll", "bool", "ConvertringSidWingSidW", "struct*", $psid, "ptr*", 0)
  1427. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, "")
  1428. Local $pstringsid = $acall[2]
  1429. Local $alen = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $pstringsid)
  1430. Local $ssid = DllStructGetData(DllStructCreate("wchar Text[" & $alen[0] + 1 & "]", $pstringsid), "Text")
  1431. DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pstringsid)
  1432. Return $ssid
  1433. EndFunc
  1434.  
  1435. Func _security__sidtypestr($itype)
  1436. Switch $itype
  1437. Case $sidtypeuser
  1438. Return "User"
  1439. Case $sidtypegroup
  1440. Return "Group"
  1441. Case $sidtypedomain
  1442. Return "Domain"
  1443. Case $sidtypealias
  1444. Return "Alias"
  1445. Case $sidtypowngroupwngroup
  1446. Return "Well Known Group"
  1447. Case $sidtypdaccountaccount
  1448. Return "Deleted Account"
  1449. Case $sidtypeinvalid
  1450. Return "Invalid"
  1451. Case $sidtypeunknown
  1452. Return "Unknown Type"
  1453. Case $sidtypecomputer
  1454. Return "Computer"
  1455. Case $sidtypelabel
  1456. Return "A mandatory inteabel SIabel SID"
  1457. Case Else
  1458. Return "Unknown SID Type"
  1459. EndSwitch
  1460. EndFunc
  1461.  
  1462. Func _security__stringsidtosid($ssid)
  1463. Local $acall = DllCall("advapi32.dll", "bool", "ConvertidToSidWdToSidW", "wstr", $ssid, "ptr*", 0)
  1464. If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1465. Local $psid = $acall[2]
  1466. Local $tbuffer = DllStructCreate("byte Data[" & _security__getlengthsid($psid) & "]", $psid)
  1467. Local $tsid = DllStructCreate("byte Data[" & DllStructGetSize($tbuffer) & "]")
  1468. DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
  1469. DllCall("kernel32.dll", "handle", "LocalFree", "handle", $psid)
  1470. Return $tsid
  1471. EndFunc
  1472.  
  1473. Global Const $tagpoint = "struct;long X;lndstrucndstruct"
  1474. Global Const $tagrect = "struct;long Left;long Top;long RighBndstruBndstrucndstruct"
  1475. Global Const $tagsize = "struct;long X;lndstrucndstruct"
  1476. Global Const $tagmargins = "int cdth;int cxRightWidthhtWt cyTopHecyTopHetomHeigtomHeighomHeight"
  1477. Global Const $tagfiletime = "stord Lo;orondstrucndstructdstruct"
  1478. Global Const $tagsystemtime = "strucYear;word Month;wordth;word Dow;word Day;word Hour;word Mind Second;endstruendstrucndstructdstruct"
  1479. Global Const $tagtime_zormatioormation = "strucBias;wchar StdName[3dName[32];word StdDate[8];long StdBias;wchar DayName[32]ayDate[8]andstruandstruandstrucndstruct"
  1480. Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDTndstruTndstrucndstruct"
  1481. Global Const $taoxexitemxexitem = "uint t_ptr Item;ptr Text;r Text;int TextMax;int Im SelectednayImagnayImagnayImageayImage;" & "int Indeam Paramm Param"
  1482. Global Const $taragbeginagbegin = $tagnmhdr & ";int ItemID;wcext[260ext[260]"
  1483. Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wce;int We;int Wh;int Why"
  1484. Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Textxt Imagxt Imaget Image;" & "int SelectedImage;int OverlayImage;eam Paream Paraam Param"
  1485. Global Const $tagdtprange = "word ;word MinMonth;word h;word MinDOW;wDay;word ;nMinut;nMinutenMinutenMinute;" & "word nd;word MinMSecond;wecond;word MaxYear;word MaxMontMaxDOW;woaMax;woaMaxHouaMaxHourMaxHour;" & "word te;word MaxSecond;wocond;wordcond;booliMaxValiMaxValiMaxValidaxValid"
  1486. Global Const $tagnmechangeechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
  1487. Global Const $tagnmeformateformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wcplay[64play[64]"
  1488. Global Const $tagnmdatematquermatquery = $tagnmhdr & ";ptr Format;struct;long Siz ndstru ndstrucndstruct"
  1489. Global Const $tagnmekeydownkeydown = $tagnmhdr & ";int Virt Format Format;" & $tagsystemtime
  1490. Global Const $tagnmestringestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
  1491. Global Const $taogrecordgrecord = "dword;dword Reserved;dwored;dword RecordNumber;dword TimeGendword Timord TimnEventInEventIDEventID;" & "word pe;word NumStrings;wrings;word EventCategory;word ReservedFlags;dword RecordNumrgOffsergOffsetgOffsetgOffset;" & "dworddLength;dword UserSi UserSidOword DatadtaOffsdtaOffsetaOffsetaOffset"
  1492. Global Const $taggdip_efams_bluams_blur = "float Radius; pandEdgpandEdge"
  1493. Global Const $taggdippaffectpaicontrascontrastontrast = "int BrsLetnessLnastLeveastLevelstLevel"
  1494. Global Const $teffectpafarbalancrbalancebalance = "int CyanRed; int Magen;llowBlullowBlullowBlue"
  1495. Global Const $taggdip_effectpalorcurvlorcurve = "int Adjustment; int C ustValuustValuustValue"
  1496. Global Const $taggdip_effectcolorlucolorlut = "byte LutB[256]; byte LutG[256]; byte Lu;utA[25;utA[256utA[256]"
  1497. Global Const $taggdip_effectparamsuightnesightnesightness = "int HueLevel; int SaturationLetessLevtessLeveessLevel"
  1498. Global Const $taggdip_effes_levels_levels = "int Hi; iight; tt Shadot Shadow Shadow"
  1499. Global Const $taggdctpaffectrrrectiorrectionrection = "uint NumberOfAtr Areatr Areas"
  1500. Global Const $taggdip_effec_sharpe_sharpen = "float Radiut Amount Amount"
  1501. Global Const $taggdip_efams_tinams_tint = "int t Amount Amount"
  1502. Global Const $tatmapdatamapdata = "uint int Height;int Stridt Stridermat;ptr iReserviReserveReservedeserved"
  1503. Global Const $tagormatrixrmatrix = "float m[25]"
  1504. Global Const $taggderparamerparam = "strucGUID[16];ulong Numbeg NumberO;ulong TyVndstruVndstrucndstructdstruct"
  1505. Global Const $taggderparamsrparams = "uint Count;" & $taggderparamerparam
  1506. Global Const $taggdiprectf = "struct;float X;float Y;float WidthHndstruHndstrucndstruct"
  1507. Global Const $taggtupinputupinput = "uint Version;ptr Callback;boolaNoCodeaNoCodecNoCodecs"
  1508. Global Const $taggdupoutputpoutput = "ptr HookProchookProhookProc"
  1509. Global Const $taggdiodecinfodecinfo = "byte 6];byte FormatID[16]tID[16];ptr CodecName;Name;ptr eFileExeFileExeFileExtFileExt;" & "ptr M;dword Flags;dword Vdword Version;dword SigCount;dgSize;ptrt Sigtrt SigMat SigMas SigMask"
  1510. Global Const $taggdierparamsrparams = "uint Countarams[1arams[1]"
  1511. Global Const $taghditem = "uint t XY;ptr Text;handle;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;intuint Typeint Staint Staint Statnt State"
  1512. Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;gm lPargm lParam lParam"
  1513. Global Const $tagnmhbtnclicktnclick = $tagnmhdr & ";int Item;" & $tagrect
  1514. Global Const $tagnmheader = $tagnmhdr & ";int Item;int Btr pItetr pItem"
  1515. Global Const $taggetipaddress = "byte Field4;byte Field3;ee Fielde Fielde Field1"
  1516. Global Const $tagnmipaddress = $tagnmhdr & ";int nt Valuet Value"
  1517. Global Const $taglvfindinfo = "struct;ugnt Flagsxm Paramm Paramm Param;" & $tagpoint & ";uint Direndstrucndstruct"
  1518. Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Itembt iGrout iGrout iGroup"
  1519. Global Const $taglvitem = "strucMask;int Item;int Su;int SubItem;uint State;uint StateMask;ptr T TextMax;gm Paragm Paramm Param; Param;" & "int Int GroupID;uint Colunt Columns;ptr pCotr piColFindstruindstrucndstrucndstruct"
  1520. Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uinttChangetChangedChanged;" & "struct;long ActionX;long ActionYuam Paruam Paraam Param"
  1521. Global Const $tastomdrawtomdraw = "struct;" & $tagnmhdr & ";dword dwDrawStdle hdcdle hdc;" & $tagrect & ";dworwItemSpec;uint uItemt ate;lparal;lparalndstrulndstrucndstruct" & ";dworxt;dword clrTextBk;iextBk;int iSubItem;dword dwe;dword cinEffecinEffecinEffectnEffect;" & "int ise;int iPartId;int id;int iStateId;struct;long TextLeft;long TextTop;long TextRighTextBottort uAtort uAlirt uAligt uAlign"
  1522. Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
  1523. Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
  1524. Global Const $tatinfotipinfotip = $tagnmhdr & ";dwor;ptr Text;int TextMa Text Item;i Item;inem lParem lParam lParam"
  1525. Global Const $taactivatectivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uinttChangetChangedChanged;" & $tagpoint & ";lparam lParaKeyFlagKeyFlags"
  1526. Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word nt Flagst Flags"
  1527. Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
  1528. Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;inint iCoint iCol"
  1529. Global Const $tagmcmonthrange = "word ;word MinMonth;word h;word MinDOW;word MinDay;wordr;word Mi;nSecMi;nSecon;nSecondnSecond;" & "word onds;word MaxYear;woYear;word MaxMonth;word MaxDOW;word MaxDay;wordr;word Ma;xSecon;xSecondxSecondxSecond;" & "word MaxMSecort Spaort Span"
  1530. Global Const $tagmcrange = "word ;word MinMonth;word h;word MinDOW;word MinDay;wordr;word Mi;nSecMi;nSecon;nSecondnSecond;" & "word onds;word MaxYear;woYear;word MaxMonth;word MaxDOW;word MaxDay;wordr;word Ma;xSecon;xSecondxSecondxSecond;" & "word MaxMSeconds;shSt MaxSet MaxSet MaxSet"
  1531. Global Const $tagmcselrange = "word ;word MinMonth;word h;word MinDOW;word MinDay;wordr;word Mi;nSecMi;nSecon;nSecondnSecond;" & "word onds;word MaxYear;woYear;word MaxMonth;word MaxDOW;word MaxDay;wordr;word Ma;xSecon;xSecondxSecondxSecond;" & "word MaxMSeconds"
  1532. Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayStatDayStatDayState"
  1533. Global Const $tagnmselchange = $tagnmhdr & ";stru BegYear;word BegMon BegMonth;word BegDOW;word BegDay;word BegHour;word BegMinute;worcond;wordcd;wordcdstruccdstructdstruct;" & "strucEndYear;word EndMontEndMonth;word EndDOW;word EndDay;word EndHour;word EndMinute;woecond;worendsworendstruendstrucndstruct"
  1534. Global Const $tactnotifytnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;lol dwFlal dwFlag dwFlags"
  1535. Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word nt Flagst Flags"
  1536. Global Const $tagtvitem = "strucMask;handle hItem;uiItem;uint State;uint StateMask;ptr Text;iMax;int ItedImagtedImageedImage;dImage;" & "inten;lparen ndstrucndstructdstruct"
  1537. Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int l;uint uStateEx;hwndEx;hwnd hwnd;intdedImage;sndstrusndstrucndstrucndstruct"
  1538. Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;" & "strucOldMask;handle OldhIe Oluint Oldint OldSnateMasnateMaskateMask;" & "ptr Oint OldTextMax;int Ox;int OldImage;int OldSelectedImage;intldren;lpaPdstrucPdstructdstruct;struct;" & "strucNewMask;handle NewhIe Neuint Newint NewSnateMasnateMaskateMask;" & "ptr Nint NewTextMax;int Nx;int NewImage;int NewSelectedImage;intldren;lpaPdstrucPdstructdstruct;struct;" & "struct;lnng PointPndstrucndstrucndstruct"
  1539. Global Const $tastomdrawtomdraw = "struct;" & $tagnmhdr & ";dword DrawStdle HDCdle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lpamndstrumndstrucndstruct" & ";dword CdrText;dwTnt Levent Levent Level"
  1540. Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
  1541. Global Const $tatinfotipinfotip = $tagnmhdr & ";ptr Text;int TextMax;hanem lParem lParam lParam"
  1542. Global Const $taemchangemchange = $tagnmhdr & ";uintd;handle hItem;uint m;uinNew;uint d lParad lParam lParam;lParam;"
  1543. Global Const $tagtvhittestinfo = $tagpoint & ";uint Fldle Itemle Item"
  1544. Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word nt Flagst Flags"
  1545. Global Const $tagnmmouse = $tagnmhdr & ";dword_mSr ItemSrtemDatatemData;emData;" & $tagpoint & ";lparam HitInfo"
  1546. Global Const $tagtivilegesvileges = "dword Count;align 4;int6dtributetributetributes"
  1547. Global Const $tagimageinfo = "handle hBitmap;handle hMask;ieUnusedeUnused2Unused2;" & $tagrect
  1548. Global Const $tagmenuinfo = "dwordNT Mask;dword Style; Style;uint YMax;handle hBackContextHeoMenuDeoMenuDaoMenuDatMenuData"
  1549. Global Const $tagmenuiteminfo = "uint nt Mask;uint Type;uiType;uint State;uint ID;handle SubMenu BmpChecklcheckelcheckedchecked;hecked;" & "ulong_ptr ItemData;ptr TypeData;H BmpItH BmpIte BmpItem"
  1550. Global Const $tagrebarbandinfo = "uint uint fMask;uint fStynt fStyle;dword clrord clrBalint cclint cchint cchint cch;" & "int iwnd hwndChild;uint c;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBackID;uint cuaxChiluaxChiluaxChildaxChild;" & "uint cyIntegral;uint cxIdeal;lparacxHeadacxHeadecxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagrect & ";uinronStateonState")
  1551. Global Const $tagnutobreaktobreak = $tagnmhdr & ";uintuint wID;lparam lParam lParam;uint nt fStyle;utoBre;utoBreautoBreautoBreak"
  1552. Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;" & "strucTargetLeft;long Targng TargetTop;long Tght;long odstrucodstructdstructdstruct;" & "strucActualLeft;long Actung ActualTop;long ight;longBndstruBndstrucndstrucndstruct"
  1553. Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyleIm lParIm lParam lParam"
  1554. Global Const $tarchevronchevron = $tagnmhdr & ";uid;uintnd;D lParam lParam;lParam;" & $tagrect & ";lparam lParamNM"
  1555. Global Const $tagnhildsizeildsize = $tagnmhdr & ";uint int wID;nt wID;" & "struct;long CLeft;long CTop;long CRight;odstrucodstructdstruct;" & "struct;long BLeft;long BTop;long BRightBndstruBndstrucndstruct"
  1556. Global Const $tagcolorscheme = "dword Size;dword BtnHi;tnShadotnShadotnShadow"
  1557. Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "strucBitmap;int idCommandCommand;byte fsState;byte fsStyle;dwodwData;inSndstruSndstrucndstructdstruct" & ";int cchTepszTextpszText;" & $tagrect
  1558. Global Const $tagnmtbhotitem = $tagnmhdr & ";id;int id;e dwFlag dwFlagsdwFlags"
  1559. Global Const $tagtbbutton = "int Bnt Command;byte Statte State;bye;dword_pmr Strimr Strinr String String"
  1560. Global Const $tagtbbuttoninfo = "uint ord Mask;int CommandCommand;int Image;byte State;byte Style;word d_ptr ParT TextMT TextMa TextMa TextMax"
  1561. Global Const $tagnetresource = "dworddword Type;dword Disord DisplayType;dword Usage;ptr LocalName;oteName;peProvideProvideProviderrovider"
  1562. Global Const $tagoverlapped = "ulongternal;ulong_ptr Intptr InternalHigh;struct;dword Offset;dfsetHigh;ce hEvece hEvene hEvent hEvent"
  1563. Global Const $tagopenfilename = "dwordSize;hwnd hwndOwner;dOwner;handle hInstancestrFiltersmFiltesmFiltesmFiltermFilter;" & "dwordstFilter;dword nFiltd nFilterIndex;ptr lpstrFile;dword nMaxFile;trFileTitdleTitldleTitleleTitle;eTitle;" & "ptr ltialDir;ptr lpstrTitpstrTitle;dword Flags;word nFileOffset;word nFileExtetr lpstrDpustDatpustDatpustDataustData;" & "ptr l;ptr lpTemplateName;teName;ptr pvd;dword de Flagse FlagsE FlagsE FlagsEx"
  1564. Global Const $tagbfoheaderoheader = "struc biSize;long biWidthbiWidth;long t;word biwitCounwitCountitCountitCount;" & "dwordression;dword biSize biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword bd;dword bondst bondstruondstrucndstruct"
  1565. Global Const $tagbitmapinfo = $tagbfoheaderoheader & ";dwoBQuad[1]Quad[1]"
  1566. Global Const $tagblendfunction = "byte Op;byte Flagsle Formae Formae Format"
  1567. Global Const $tagguid = "struc Data1;ushort Data2; Datrt Data3t Data3;tndstrutndstrucndstruct"
  1568. Global Const $taglacementacement = "uint uint flags;uint shownt showCmd;long ptMinPosition[2];long pttion[2];loition[oition[4ition[4]tion[4]"
  1569. Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;innt Flannt Flagnt Flags"
  1570. Global Const $tagscrollinfo = "uint uint fMask;int nMin;t nMin;intint nPageoTrackPoTrackPoTrackPosrackPos"
  1571. Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";iineButtin;humbTophumbTop;umbTop;" & "int xyThumbBottom;int redstate[6state[6state[6]"
  1572. Global Const $taglogfont = "strucHeight;long Width;loidth;long Escapement;long Orientation;ight;byte;derlin;derlinederline;erline;" & "byte ut;byte CharSet;byteet;byte OutPrecision;byte ClipPrecision;byte Quality;byte Pitcily;wcharmndstarmndstrumndstrucndstruct"
  1573. Global Const $tagokstructkstruct = "dword;dword scanCode;dworde;dworddword tim_xtraIn_xtraInfxtraInfotraInfo"
  1574. Global Const $tagprocormationrmation = "handle hProcess;handle hThread;dword PDThreadDThreadIThreadID"
  1575. Global Const $tagstartupinfo = "dwordtr Reserved1;ptr Desptr Desktop;ptr Title;dword X;dword Y;dwoe;dword YontCharontCharsntChars;tChars;" & "dwordChars;dword FillAttrillAttribute;dword Flags;word ShowWindow;word R2;ptr ReshtdInpuhtdInputtdInputtdInput;" & "handle StdOutput;StdErroStdError"
  1576. Global Const $tagsecutributesributes = "dword Length;ptr DescrioitHandlitHandlitHandle"
  1577. Global Const $tagind_datand_data = "dwordAttributes;dword ftCord ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFil60];wcharnNamearnName[1nName[14Name[14]"
  1578. Global Const $tagtextmetric = "long t;long tmAscent;longnt;long tmDescent;long tmlLeading;ELeadinELeadinELeadingLeading;" & "long arWidth;long tmMaxChtmMaxCharWidth;long tmWeight;long tmOverhang;long tmDiAspectX;liAspectiAspectiAspectYAspectY;" & "wchartChar;wchar tmLastChmLastChar;wchar tmDefaultChar;wchar tmBreakChar;byte tmItae tmUnderyruckOuyruckOuyruckOutruckOut;" & "bytehAndFtchAymCharSemCharSetCharSet"
  1579. Global Const $tagmemmap = "hanoc;ulorocp;ptr Me;ptr Memptr Mem"
  1580.  
  1581. Func _memfree(ByRef $tmemmap)
  1582. Local $pmemory = DllStructGetData($tmemmap, "Mem")
  1583. Local $hprocess = DllStructGetData($tmemmap, "hProc")
  1584. Local $bresult = _memvirtualfreeex($hprocess, $pmemory, 0, $mem_release)
  1585. DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hprocess)
  1586. If @error Then Return SetError(@error, @extended, False)
  1587. Return $bresult
  1588. EndFunc
  1589.  
  1590. Func _memglobalalloc($ibytes, $iflags = 0)
  1591. Local $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $iflags, "ulong_ptr", $ibytes)
  1592. If @error Then Return SetError(@error, @extended, 0)
  1593. Return $aresult[0]
  1594. EndFunc
  1595.  
  1596. Func _memglobalfree($hmem)
  1597. Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hmem)
  1598. If @error Then Return SetError(@error, @extended, False)
  1599. Return $aresult[0]
  1600. EndFunc
  1601.  
  1602. Func _memgloballock($hmem)
  1603. Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hmem)
  1604. If @error Then Return SetError(@error, @extended, 0)
  1605. Return $aresult[0]
  1606. EndFunc
  1607.  
  1608. Func _memglobalsize($hmem)
  1609. Local $aresult = DllCall("kernel32.dll", "ulong_ptr", "GlobalSize", "handle", $hmem)
  1610. If @error Then Return SetError(@error, @extended, 0)
  1611. Return $aresult[0]
  1612. EndFunc
  1613.  
  1614. Func _memglobalunlock($hmem)
  1615. Local $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hmem)
  1616. If @error Then Return SetError(@error, @extended, 0)
  1617. Return $aresult[0]
  1618. EndFunc
  1619.  
  1620. Func _meminit($hwnd, $isize, ByRef $tmemmap)
  1621. Local $aresult = DllCall("User32.dll", "dword", "GetWindowrocessIrocessId", "hwnd", $hwnd, "dword*", 0)
  1622. If @error Then Return SetError(@error + 10, @extended, 0)
  1623. Local $iprocessid = $aresult[2]
  1624. If $iprocessid = 0 Then Return SetError(1, 0, 0)
  1625. Local $iaccess = BitOR($proceperationeration, $process_vm_read, $process_vm_write)
  1626. Local $hprocess = __mem_openprocess($iaccess, False, $iprocessid, True)
  1627. Local $ialloc = BitOR($mem_reserve, $mem_commit)
  1628. Local $pmemory = _memvirtualallocex($hprocess, 0, $isize, $ialloc, $page_readwrite)
  1629. If $pmemory = 0 Then Return SetError(2, 0, 0)
  1630. $tmemmap = DllStructCreate($tagmemmap)
  1631. DllStructSetData($tmemmap, "hProc", $hprocess)
  1632. DllStructSetData($tmemmap, "Size", $isize)
  1633. DllStructSetData($tmemmap, "Mem", $pmemory)
  1634. Return $pmemory
  1635. EndFunc
  1636.  
  1637. Func _memmovememory($psource, $pdest, $ilength)
  1638. DllCall("kernel32.dll", "none", "RtlMoveMemory", "struct*", $pdest, "struct*", $psource, "ulong_ptr", $ilength)
  1639. If @error Then Return SetError(@error, @extended)
  1640. EndFunc
  1641.  
  1642. Func _memread(ByRef $tmemmap, $psrce, $pdest, $isize)
  1643. Local $aresult = DllCall("kernel32.dll", "bool", "RessMemorysMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $psrce, "struct*", $pdest, "ulong_ptr", $isize, "ulong_ptr*", 0)
  1644. If @error Then Return SetError(@error, @extended, False)
  1645. Return $aresult[0]
  1646. EndFunc
  1647.  
  1648. Func _memwrite(ByRef $tmemmap, $psrce, $pdest = 0, $isize = 0, $ssrce = "struct*")
  1649. If $pdest = 0 Then $pdest = DllStructGetData($tmemmap, "Mem")
  1650. If $isize = 0 Then $isize = DllStructGetData($tmemmap, "Size")
  1651. Local $aresult = DllCall("kernel32.dll", "bool", "WrissMemorysMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $pdest, $ssrce, $psrce, "ulong_ptr", $isize, "ulong_ptr*", 0)
  1652. If @error Then Return SetError(@error, @extended, False)
  1653. Return $aresult[0]
  1654. EndFunc
  1655.  
  1656. Func _memvirtualalloc($paddress, $isize, $iallocation, $iprotect)
  1657. Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect)
  1658. If @error Then Return SetError(@error, @extended, 0)
  1659. Return $aresult[0]
  1660. EndFunc
  1661.  
  1662. Func _memvirtualallocex($hprocess, $paddress, $isize, $iallocation, $iprotect)
  1663. Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect)
  1664. If @error Then Return SetError(@error, @extended, 0)
  1665. Return $aresult[0]
  1666. EndFunc
  1667.  
  1668. Func _memvirtualfree($paddress, $isize, $ifreetype)
  1669. Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype)
  1670. If @error Then Return SetError(@error, @extended, False)
  1671. Return $aresult[0]
  1672. EndFunc
  1673.  
  1674. Func _memvirtualfreeex($hprocess, $paddress, $isize, $ifreetype)
  1675. Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype)
  1676. If @error Then Return SetError(@error, @extended, False)
  1677. Return $aresult[0]
  1678. EndFunc
  1679.  
  1680. Func __mem_openprocess($iaccess, $binherit, $iprocessid, $bdebugpriv = False)
  1681. Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $iprocessid)
  1682. If @error Then Return SetError(@error + 10, @extended, 0)
  1683. If $aresult[0] Then Return $aresult[0]
  1684. If NOT $bdebugpriv Then Return 0
  1685. Local $htoken = _security__openthreadtokenex(BitOR($token_adivilegesvileges, $token_query))
  1686. If @error Then Return SetError(@error + 20, @extended, 0)
  1687. _security__setprivilege($htoken, "SeDebugPrivilege", True)
  1688. Local $ierror = @error
  1689. Local $ilasterror = @extended
  1690. Local $iret = 0
  1691. If NOT @error Then
  1692. $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $iprocessid)
  1693. $ierror = @error
  1694. $ilasterror = @extended
  1695. If $aresult[0] Then $iret = $aresult[0]
  1696. _security__setprivilege($htoken, "SeDebugPrivilege", False)
  1697. If @error Then
  1698. $ierror = @error + 30
  1699. $ilasterror = @extended
  1700. EndIf
  1701. Else
  1702. $ierror = @error + 40
  1703. EndIf
  1704. DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $htoken)
  1705. Return SetError($ierror, $ilasterror, $iret)
  1706. EndFunc
  1707.  
  1708. Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  1709. Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  1710. If @error Then Return SetError(@error, @extended, "")
  1711. If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  1712. Return $aresult
  1713. EndFunc
  1714.  
  1715. Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  1716. Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  1717. If @error Then Return SetError(@error, @extended, "")
  1718. If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  1719. Return $aresult
  1720. EndFunc
  1721.  
  1722. Global Const $sbars_sizegrip = 256
  1723. Global Const $sbt_tooltips = 2048
  1724. Global Const $sbars_tooltips = 2048
  1725. Global Const $sbt_sunken = 0
  1726. Global Const $sbt_noborders = 256
  1727. Global Const $sbt_popout = 512
  1728. Global Const $sbt_rtlreading = 1024
  1729. Global Const $sbt_notabparsing = 2048
  1730. Global Const $sbt_ownerdraw = 4096
  1731. Global Const $__statusbarc_wm_use_wm_user = 1024
  1732. Global Const $sb_getborders = ($__statusbarc_wm_use_wm_user + 7)
  1733. Global Const $sb_geticon = ($__statusbarc_wm_use_wm_user + 20)
  1734. Global Const $sb_getparts = ($__statusbarc_wm_use_wm_user + 6)
  1735. Global Const $sb_getrect = ($__statusbarc_wm_use_wm_user + 10)
  1736. Global Const $sb_gettexta = ($__statusbarc_wm_use_wm_user + 2)
  1737. Global Const $sb_gettextw = ($__statusbarc_wm_use_wm_user + 13)
  1738. Global Const $sb_gettext = $sb_gettexta
  1739. Global Const $sbtlengthalengtha = ($__statusbarc_wm_use_wm_user + 3)
  1740. Global Const $sbtlengthwlengthw = ($__statusbarc_wm_use_wm_user + 12)
  1741. Global Const $sb_gettextlength = $sbtlengthalengtha
  1742. Global Const $sb_gettiptexta = ($__statusbarc_wm_use_wm_user + 18)
  1743. Global Const $sb_gettiptextw = ($__statusbarc_wm_use_wm_user + 19)
  1744. Global Const $sb_gdeformateformat = 8192 + 6
  1745. Global Const $sb_issimple = ($__statusbarc_wm_use_wm_user + 14)
  1746. Global Const $sb_setbkcolor = 8192 + 1
  1747. Global Const $sb_seticon = ($__statusbarc_wm_use_wm_user + 15)
  1748. Global Const $sb_setminheight = ($__statusbarc_wm_use_wm_user + 8)
  1749. Global Const $sb_setparts = ($__statusbarc_wm_use_wm_user + 4)
  1750. Global Const $sb_settexta = ($__statusbarc_wm_use_wm_user + 1)
  1751. Global Const $sb_settextw = ($__statusbarc_wm_use_wm_user + 11)
  1752. Global Const $sb_settext = $sb_settexta
  1753. Global Const $sb_settiptexta = ($__statusbarc_wm_use_wm_user + 16)
  1754. Global Const $sb_settiptextw = ($__statusbarc_wm_use_wm_user + 17)
  1755. Global Const $sb_sdeformateformat = 8192 + 5
  1756. Global Const $sb_simple = ($__statusbarc_wm_use_wm_user + 9)
  1757. Global Const $sb_simpleid = 255
  1758. Global Const $sbn_first = -880
  1759. Global Const $sbn_sdechangeechange = $sbn_first + 0
  1760. Global Const $optrelativeelative = 0
  1761. Global Const $optabsolutebsolute = 1
  1762. Global Const $opt_coordsclient = 2
  1763. Global Const $opt_errorsilent = 0
  1764. Global Const $opt_errorfatal = 1
  1765. Global Const $opt_capsnostore = 0
  1766. Global Const $opt_capsstore = 1
  1767. Global Const $opt_matchstart = 1
  1768. Global Const $opt_matchany = 2
  1769. Global Const $opt_matchexact = 3
  1770. Global Const $opadvanceddvanced = 4
  1771. Global Const $ccs_top = 1
  1772. Global Const $ccs_nomovey = 2
  1773. Global Const $ccs_bottom = 3
  1774. Global Const $ccs_noresize = 4
  1775. Global Const $ccentalignntalign = 8
  1776. Global Const $ccs_nohilite = 16
  1777. Global Const $ccs_adjustable = 32
  1778. Global Const $ccs_nodivider = 64
  1779. Global Const $ccs_vert = 128
  1780. Global Const $ccs_left = 129
  1781. Global Const $ccs_nomovex = 130
  1782. Global Const $ccs_right = 131
  1783. Global Const $dt_drivetype = 1
  1784. Global Const $dt_ssdstatus = 2
  1785. Global Const $dt_bustype = 3
  1786. Global Const $objid_window = 0
  1787. Global Const $objid_titlebar = -2
  1788. Global Const $objid_sizegrip = -7
  1789. Global Const $objid_caret = -8
  1790. Global Const $objid_cursor = -9
  1791. Global Const $objid_alert = -10
  1792. Global Const $objid_sound = -11
  1793. Global Const $dlg_notitle = 1
  1794. Global Const $dlg_notontop = 2
  1795. Global Const $dlg_textleft = 4
  1796. Global Const $dlg_textright = 8
  1797. Global Const $dlg_moveable = 16
  1798. Global Const $dlg_textvcenter = 32
  1799. Global Const $idc_unknown = 0
  1800. Global Const $idc_appstarting = 1
  1801. Global Const $idc_arrow = 2
  1802. Global Const $idc_cross = 3
  1803. Global Const $idc_hand = 32649
  1804. Global Const $idc_help = 4
  1805. Global Const $idc_ibeam = 5
  1806. Global Const $idc_icon = 6
  1807. Global Const $idc_no = 7
  1808. Global Const $idc_size = 8
  1809. Global Const $idc_sizeall = 9
  1810. Global Const $idc_sizenesw = 10
  1811. Global Const $idc_sizens = 11
  1812. Global Const $idc_sizenwse = 12
  1813. Global Const $idc_sizewe = 13
  1814. Global Const $idc_uparrow = 14
  1815. Global Const $idc_wait = 15
  1816. Global Const $idi_application = 32512
  1817. Global Const $idi_asterisk = 32516
  1818. Global Const $idi_exclamation = 32515
  1819. Global Const $idi_hand = 32513
  1820. Global Const $idi_question = 32514
  1821. Global Const $idi_winlogo = 32517
  1822. Global Const $idi_shield = 32518
  1823. Global Const $idi_error = $idi_hand
  1824. Global Const $idi_information = $idi_asterisk
  1825. Global Const $idi_warning = $idi_exclamation
  1826. Global Const $sd_logoff = 0
  1827. Global Const $sd_shutdown = 1
  1828. Global Const $sd_reboot = 2
  1829. Global Const $sd_force = 4
  1830. Global Const $sd_powerdown = 8
  1831. Global Const $sd_forcehung = 16
  1832. Global Const $sd_standby = 32
  1833. Global Const $sd_hibernate = 64
  1834. Global Const $stdin_child = 1
  1835. Global Const $stdout_child = 2
  1836. Global Const $stderr_child = 4
  1837. Global Const $stderr_merged = 8
  1838. Global Const $stdiot_parent_parent = 16
  1839. Global Const $run_cre_consoleconsole = 65536
  1840. Global Const $ubmensionsensions = 0
  1841. Global Const $ubound_rows = 1
  1842. Global Const $ubound_columns = 2
  1843. Global Const $mouseabsolutebsolute = 32768
  1844. Global Const $mouseeventf_move = 1
  1845. Global Const $mouseleftdowneftdown = 2
  1846. Global Const $mouf_leftup_leftup = 4
  1847. Global Const $mouseeightdownghtdown = 8
  1848. Global Const $mous_rightuprightup = 16
  1849. Global Const $mouseevddledowndledown = 32
  1850. Global Const $mousemiddleupiddleup = 64
  1851. Global Const $motf_wheelf_wheel = 2048
  1852. Global Const $motf_xdownf_xdown = 128
  1853. Global Const $mouseeventf_xup = 256
  1854. Global Const $reg_none = 0
  1855. Global Const $reg_sz = 1
  1856. Global Const $reg_expand_sz = 2
  1857. Global Const $reg_binary = 3
  1858. Global Const $reg_dword = 4
  1859. Global Const $reg_dwore_endian_endian = 4
  1860. Global Const $reg_dg_endian_endian = 5
  1861. Global Const $reg_link = 6
  1862. Global Const $reg_multi_sz = 7
  1863. Global Const $rerce_listce_list = 8
  1864. Global Const $reg_full_resoscriptoscriptor = 9
  1865. Global Const $reg_resource_rents_lisnts_list = 10
  1866. Global Const $reg_qword = 11
  1867. Global Const $reg_qwore_endian_endian = 11
  1868. Global Const $hwnd_bottom = 1
  1869. Global Const $hwnd_notopmost = -2
  1870. Global Const $hwnd_top = 0
  1871. Global Const $hwnd_topmost = -1
  1872. Global Const $swp_nosize = 1
  1873. Global Const $swp_nomove = 2
  1874. Global Const $swp_nozorder = 4
  1875. Global Const $swp_noredraw = 8
  1876. Global Const $swp_noactivate = 16
  1877. Global Const $swp_framechanged = 32
  1878. Global Const $swp_drawframe = 32
  1879. Global Const $swp_showwindow = 64
  1880. Global Const $swp_hidewindow = 128
  1881. Global Const $swp_nocopybits = 256
  1882. Global Const $swerzorderrzorder = 512
  1883. Global Const $swp_noreposition = 512
  1884. Global Const $swpchanginghanging = 1024
  1885. Global Const $swp_defererase = 8192
  1886. Global Const $swpindowposndowpos = 16384
  1887. Global Const $keyword_default = 1
  1888. Global Const $keyword_null = 2
  1889. Global Const $fc_nooverwrite = 0
  1890. Global Const $fc_overwrite = 1
  1891. Global Const $fc_createpath = 8
  1892. Global Const $ft_modified = 0
  1893. Global Const $ft_created = 1
  1894. Global Const $ft_accessed = 2
  1895. Global Const $fo_read = 0
  1896. Global Const $fo_append = 1
  1897. Global Const $fo_overwrite = 2
  1898. Global Const $fo_createpath = 8
  1899. Global Const $fo_binary = 16
  1900. Global Const $fo_unicode = 32
  1901. Global Const $fo_utf16_le = 32
  1902. Global Const $fo_utf16_be = 64
  1903. Global Const $fo_utf8 = 128
  1904. Global Const $fo_utf8_nobom = 256
  1905. Global Const $fo_utf8_full = 16384
  1906. Global Const $eof = -1
  1907. Global Const $fd_filemustexist = 1
  1908. Global Const $fd_pathmustexist = 2
  1909. Global Const $fd_multiselect = 4
  1910. Global Const $fd_reateneweatenew = 8
  1911. Global Const $fd_verwriteerwrite = 16
  1912. Global Const $create_new = 1
  1913. Global Const $create_always = 2
  1914. Global Const $open_existing = 3
  1915. Global Const $open_always = 4
  1916. Global Const $trexistingxisting = 5
  1917. Global Const $invalid_s_pointe_pointer = -1
  1918. Global Const $file_begin = 0
  1919. Global Const $file_current = 1
  1920. Global Const $file_end = 2
  1921. Global Const $file_attreadonlyeadonly = 1
  1922. Global Const $file_ae_hidden_hidden = 2
  1923. Global Const $file_ae_system_system = 4
  1924. Global Const $file_attrirectorirectory = 16
  1925. Global Const $file_at_archivearchive = 32
  1926. Global Const $file_ae_device_device = 64
  1927. Global Const $file_ae_normal_normal = 128
  1928. Global Const $file_attremporaremporary = 256
  1929. Global Const $file_attribrse_filrse_file = 512
  1930. Global Const $file_attributse_poinse_point = 1024
  1931. Global Const $file_attrimpressempressed = 2048
  1932. Global Const $file_at_offlineoffline = 4096
  1933. Global Const $fiibute_nib__indexe_indexedindexed = 8192
  1934. Global Const $file_attrncryptencrypted = 16384
  1935. Global Const $file_share_read = 1
  1936. Global Const $file_share_write = 2
  1937. Global Const $fie_delete_delete = 4
  1938. Global Const $file_eadwriteadwrite = BitOR($file_share_read, $file_share_write)
  1939. Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $fie_delete_delete)
  1940. Global Const $generic_all = 268435456
  1941. Global Const $generic_execute = 536870912
  1942. Global Const $generic_write = 1073741824
  1943. Global Const $generic_read = -2147483648
  1944. Global Const $geeadwriteadwrite = BitOR($generic_read, $generic_write)
  1945. Global Const $frta_nocount = 0
  1946. Global Const $frta_count = 1
  1947. Global Const $frta_intarrays = 2
  1948. Global Const $frta_entiresplit = 4
  1949. Global Const $flsfoldersfolders = 0
  1950. Global Const $flta_files = 1
  1951. Global Const $flta_folders = 2
  1952. Global Const $fltsfoldersfolders = 0
  1953. Global Const $fltar_files = 1
  1954. Global Const $fltar_folders = 2
  1955. Global Const $fltar_nohidden = 4
  1956. Global Const $fltar_nosystem = 8
  1957. Global Const $fltar_nolink = 16
  1958. Global Const $fltar_norecur = 0
  1959. Global Const $fltar_recur = 1
  1960. Global Const $fltar_nosort = 0
  1961. Global Const $fltar_sort = 1
  1962. Global Const $fltar_fastsort = 2
  1963. Global Const $fltar_nopath = 0
  1964. Global Const $fltar_relpath = 1
  1965. Global Const $fltar_fullpath = 2
  1966. Global Const $mb_ok = 0
  1967. Global Const $mb_okcancel = 1
  1968. Global Const $mb_aryignoreyignore = 2
  1969. Global Const $mb_yesnocancel = 3
  1970. Global Const $mb_yesno = 4
  1971. Global Const $mb_retrycancel = 5
  1972. Global Const $mb_cacontinueontinue = 6
  1973. Global Const $mb_help = 16384
  1974. Global Const $mb_iconstop = 16
  1975. Global Const $mb_iconerror = 16
  1976. Global Const $mb_iconhand = 16
  1977. Global Const $mb_iconquestion = 32
  1978. Global Const $mb_lamationamation = 48
  1979. Global Const $mb_iconwarning = 48
  1980. Global Const $mb_ormationrmation = 64
  1981. Global Const $mb_iconasterisk = 64
  1982. Global Const $mb_usericon = 128
  1983. Global Const $mb_defbutton1 = 0
  1984. Global Const $mb_defbutton2 = 256
  1985. Global Const $mb_defbutton3 = 512
  1986. Global Const $mb_defbutton4 = 768
  1987. Global Const $mb_applmodal = 0
  1988. Global Const $mb_systemmodal = 4096
  1989. Global Const $mb_taskmodal = 8192
  1990. Global Const $mb_defautop_onlyop_only = 131072
  1991. Global Const $mb_right = 524288
  1992. Global Const $mb_rtlreading = 1048576
  1993. Global Const $mb_setforeground = 65536
  1994. Global Const $mb_topmost = 262144
  1995. Global Const $mb_servificationication = 2097152
  1996. Global Const $mbustifiedstified = $mb_right
  1997. Global Const $idtimeout = -1
  1998. Global Const $idok = 1
  1999. Global Const $idcancel = 2
  2000. Global Const $idabort = 3
  2001. Global Const $idretry = 4
  2002. Global Const $idignore = 5
  2003. Global Const $idyes = 6
  2004. Global Const $idno = 7
  2005. Global Const $idclose = 8
  2006. Global Const $idhelp = 9
  2007. Global Const $idtryagain = 10
  2008. Global Const $idcontinue = 11
  2009. Global Const $str_nocasesense = 0
  2010. Global Const $str_casesense = 1
  2011. Global Const $str_nnsebasicsebasic = 2
  2012. Global Const $str_stripleading = 1
  2013. Global Const $sttrailingrailing = 2
  2014. Global Const $str_stripspaces = 4
  2015. Global Const $str_stripall = 8
  2016. Global Const $str_chrsplit = 0
  2017. Global Const $str_entiresplit = 1
  2018. Global Const $str_nocount = 2
  2019. Global Const $str_regexpmatch = 0
  2020. Global Const $str_rraymatchaymatch = 1
  2021. Global Const $str_regexullmatcullmatch = 2
  2022. Global Const $str_regexpabalmatcbalmatch = 3
  2023. Global Const $str_regexparrayullmatcullmatch = 4
  2024. Global Const $str_endisstart = 0
  2025. Global Const $str_endnotstart = 1
  2026. Global Const $hgdi_error = Ptr(-1)
  2027. Global Const $invalle_valuee_value = Ptr(-1)
  2028. Global Const $clr_invalid = -1
  2029. Global Const $null_brush = 5
  2030. Global Const $null_pen = 8
  2031. Global Const $black_brush = 4
  2032. Global Const $dkgray_brush = 3
  2033. Global Const $dc_brush = 18
  2034. Global Const $gray_brush = 2
  2035. Global Const $hollow_brush = $null_brush
  2036. Global Const $ltgray_brush = 1
  2037. Global Const $white_brush = 0
  2038. Global Const $black_pen = 7
  2039. Global Const $dc_pen = 19
  2040. Global Const $white_pen = 6
  2041. Global Const $ansi_fixed_font = 11
  2042. Global Const $ansi_var_font = 12
  2043. Global Const $deviult_fontlt_font = 14
  2044. Global Const $default_gui_font = 17
  2045. Global Const $oem_fixed_font = 10
  2046. Global Const $system_font = 13
  2047. Global Const $syxed_fonted_font = 16
  2048. Global Const $default_palette = 15
  2049. Global Const $mb_precomposed = 1
  2050. Global Const $mb_composite = 2
  2051. Global Const $mb_useglyphchars = 4
  2052. Global Const $ulw_alpha = 2
  2053. Global Const $ulw_colorkey = 1
  2054. Global Const $ulw_opaque = 4
  2055. Global Const $ulw_ex_noresize = 8
  2056. Global Const $wh_callwndproc = 4
  2057. Global Const $whdprocretprocret = 12
  2058. Global Const $wh_cbt = 5
  2059. Global Const $wh_debug = 9
  2060. Global Const $whoundidleundidle = 11
  2061. Global Const $wh_getmessage = 3
  2062. Global Const $wh_playbacklayback = 1
  2063. Global Const $wh_journalrecord = 0
  2064. Global Const $wh_keyboard = 2
  2065. Global Const $wh_keyboard_ll = 13
  2066. Global Const $wh_mouse = 7
  2067. Global Const $wh_mouse_ll = 14
  2068. Global Const $wh_msgfilter = -1
  2069. Global Const $wh_shell = 10
  2070. Global Const $wh_sysmsgfilter = 6
  2071. Global Const $wpf_asynclacemenlacement = 4
  2072. Global Const $wpf_resaximizedximized = 2
  2073. Global Const $wpfpositionosition = 1
  2074. Global Const $kf_extended = 256
  2075. Global Const $kf_altdown = 8192
  2076. Global Const $kf_up = 32768
  2077. Global Const $llkhf_extended = BitShift($kf_extended, 8)
  2078. Global Const $llkhf_injected = 16
  2079. Global Const $llkhf_altdown = BitShift($kf_altdown, 8)
  2080. Global Const $llkhf_up = BitShift($kf_up, 8)
  2081. Global Const $ofn_atiselectiselect = 512
  2082. Global Const $ofn_createprompt = 8192
  2083. Global Const $ofn_torecentorecent = 33554432
  2084. Global Const $ofn_enablehook = 32
  2085. Global Const $ofn_enabdenotifyenotify = 4194304
  2086. Global Const $ofn_enablesizing = 8388608
  2087. Global Const $ofntemplateemplate = 64
  2088. Global Const $ofn_enabltehandltehandle = 128
  2089. Global Const $ofn_explorer = 524288
  2090. Global Const $ofn_extifferentfferent = 1024
  2091. Global Const $ofustexiststexist = 4096
  2092. Global Const $ofn_owhiddenwhidden = 268435456
  2093. Global Const $ofn_hidereadonly = 4
  2094. Global Const $ofn_longnames = 2097152
  2095. Global Const $ofn_nochangedir = 8
  2096. Global Const $ofn_nodncelinkscelinks = 1048576
  2097. Global Const $ofn_nolongnames = 262144
  2098. Global Const $ofn_rkbuttonkbutton = 131072
  2099. Global Const $ofn_nlyreturnyreturn = 32768
  2100. Global Const $ofn_nlecreateecreate = 65536
  2101. Global Const $ofn_novalidate = 256
  2102. Global Const $ofn_teprompteprompt = 2
  2103. Global Const $ofustexiststexist = 2048
  2104. Global Const $ofn_readonly = 1
  2105. Global Const $ofn_shareaware = 16384
  2106. Global Const $ofn_showhelp = 16
  2107. Global Const $ofnlacesbaracesbar = 1
  2108. Global Const $tmpf_fixed_pitch = 1
  2109. Global Const $tmpf_vector = 2
  2110. Global Const $tmpf_truetype = 4
  2111. Global Const $tmpf_device = 8
  2112. Global Const $duplicae_source_source = 1
  2113. Global Const $duplice_access_access = 2
  2114. Global Const $di_mask = 1
  2115. Global Const $di_image = 2
  2116. Global Const $di_normal = 3
  2117. Global Const $di_compat = 4
  2118. Global Const $di_defaultsize = 8
  2119. Global Const $di_nomirror = 16
  2120. Global Const $dievice_aeva_deskto_desktopdesktop = 1
  2121. Global Const $display_devii_drivei_driver = 2
  2122. Global Const $display_devicey_devicy_device = 4
  2123. Global Const $display_device_mg_driveg_driver = 8
  2124. Global Const $display_devicempatiblmpatible = 16
  2125. Global Const $display_demovablemovable = 32
  2126. Global Const $display_desconnecsconnect = 33554432
  2127. Global Const $displae_remote_remote = 67108864
  2128. Global Const $display_devespruneespruned = 134217728
  2129. Global Const $flashw_caption = 1
  2130. Global Const $flashw_tray = 2
  2131. Global Const $flashw_timer = 4
  2132. Global Const $flashw_timernofg = 12
  2133. Global Const $format_message_e_buffee_buffer = 256
  2134. Global Const $format_message_insert_inserts = 512
  2135. Global Const $format_messm_strinm_string = 1024
  2136. Global Const $format_messa_hmodul_hmodule = 2048
  2137. Global Const $format_messm_system_system = 4096
  2138. Global Const $format_messagent_arrant_array = 8192
  2139. Global Const $gw_hwndfirst = 0
  2140. Global Const $gw_hwndlast = 1
  2141. Global Const $gw_hwndnext = 2
  2142. Global Const $gw_hwndprev = 3
  2143. Global Const $gw_owner = 4
  2144. Global Const $gw_child = 5
  2145. Global Const $gw_enabledpopup = 6
  2146. Global Const $gwl_wndproc = -4
  2147. Global Const $gwl_hinstance = -6
  2148. Global Const $gwl_hwndparent = -8
  2149. Global Const $gwl_id = -12
  2150. Global Const $gwl_style = -16
  2151. Global Const $gwl_exstyle = -20
  2152. Global Const $gwl_userdata = -21
  2153. Global Const $std_cut = 0
  2154. Global Const $std_copy = 1
  2155. Global Const $std_paste = 2
  2156. Global Const $std_undo = 3
  2157. Global Const $std_redow = 4
  2158. Global Const $std_delete = 5
  2159. Global Const $std_filenew = 6
  2160. Global Const $std_fileopen = 7
  2161. Global Const $std_filesave = 8
  2162. Global Const $std_printpre = 9
  2163. Global Const $std_properties = 10
  2164. Global Const $std_help = 11
  2165. Global Const $std_find = 12
  2166. Global Const $std_replace = 13
  2167. Global Const $std_print = 14
  2168. Global Const $image_bitmap = 0
  2169. Global Const $image_icon = 1
  2170. Global Const $image_cursor = 2
  2171. Global Const $immetafileetafile = 3
  2172. Global Const $kb_sendspecial = 0
  2173. Global Const $kb_sendraw = 1
  2174. Global Const $kb_capsoff = 0
  2175. Global Const $kb_capson = 1
  2176. Global Const $dont_resolveferenceferences = 1
  2177. Global Const $load_librdatafildatafile = 2
  2178. Global Const $load_with_alterch_patrch_path = 8
  2179. Global Const $load_ignore_chz_levehz_level = 16
  2180. Global Const $loary_as_artxclusivxclusiveclusive = 64
  2181. Global Const $load_library_asresourcresource = 32
  2182. Global Const $loary_seaary_tion_dition_dirion_dir = 512
  2183. Global Const $load_library_searult_dirult_dirs = 4096
  2184. Global Const $load_library_searload_diload_dir = 256
  2185. Global Const $load_library_system3system32 = 2048
  2186. Global Const $load_library_sser_dirser_dirs = 1024
  2187. Global Const $s_ok = 0
  2188. Global Const $e_abort = -2147467260
  2189. Global Const $e_accessdenied = -2147024891
  2190. Global Const $e_fail = -2147467259
  2191. Global Const $e_handle = -2147024890
  2192. Global Const $e_invalidarg = -2147024809
  2193. Global Const $e_nointerface = -2147467262
  2194. Global Const $e_notimpl = -2147467263
  2195. Global Const $e_outofmemory = -2147024882
  2196. Global Const $e_pointer = -2147467261
  2197. Global Const $e_unexpected = -2147418113
  2198. Global Const $lr_defaultcolor = 0
  2199. Global Const $lr_monochrome = 1
  2200. Global Const $lr_color = 2
  2201. Global Const $lr_copyreturnorg = 4
  2202. Global Const $lr_copydeleteorg = 8
  2203. Global Const $lr_loadfromfile = 16
  2204. Global Const $lr_nsparentsparent = 32
  2205. Global Const $lr_defaultsize = 64
  2206. Global Const $lr_vgacolor = 128
  2207. Global Const $lr_3dcolorsdcolors = 4096
  2208. Global Const $lr_cbsectionsection = 8192
  2209. Global Const $lr_cresourceesource = 16384
  2210. Global Const $lr_shared = 32768
  2211. Global Const $obm_trtype = 32732
  2212. Global Const $obm_lfarrowi = 32734
  2213. Global Const $obm_rgarrowi = 32735
  2214. Global Const $obm_dnarrowi = 32736
  2215. Global Const $obm_uparrowi = 32737
  2216. Global Const $obm_combo = 32738
  2217. Global Const $obm_mnarrow = 32739
  2218. Global Const $obm_lfarrowd = 32740
  2219. Global Const $obm_rgarrowd = 32741
  2220. Global Const $obm_dnarrowd = 32742
  2221. Global Const $obm_uparrowd = 32743
  2222. Global Const $obm_restored = 32744
  2223. Global Const $obm_zoomd = 32745
  2224. Global Const $obm_reduced = 32746
  2225. Global Const $obm_restore = 32747
  2226. Global Const $obm_zoom = 32748
  2227. Global Const $obm_reduce = 32749
  2228. Global Const $obm_lfarrow = 32750
  2229. Global Const $obm_rgarrow = 32751
  2230. Global Const $obm_dnarrow = 32752
  2231. Global Const $obm_uparrow = 32753
  2232. Global Const $obm_close = 32754
  2233. Global Const $obm_old_restore = 32755
  2234. Global Const $obm_old_zoom = 32756
  2235. Global Const $obm_old_reduce = 32757
  2236. Global Const $obm_btncorners = 32758
  2237. Global Const $obm_checkboxes = 32759
  2238. Global Const $obm_check = 32760
  2239. Global Const $obm_btsize = 32761
  2240. Global Const $obm_old_lfarrow = 32762
  2241. Global Const $obm_old_rgarrow = 32763
  2242. Global Const $obm_old_dnarrow = 32764
  2243. Global Const $obm_old_uparrow = 32765
  2244. Global Const $obm_size = 32766
  2245. Global Const $obm_old_close = 32767
  2246. Global Const $oic_sample = 32512
  2247. Global Const $oic_hand = 32513
  2248. Global Const $oic_ques = 32514
  2249. Global Const $oic_bang = 32515
  2250. Global Const $oic_note = 32516
  2251. Global Const $oic_winlogo = 32517
  2252. Global Const $oic_warning = $oic_bang
  2253. Global Const $oic_error = $oic_hand
  2254. Global Const $oic_information = $oic_note
  2255. Global $__g_ais_winapi_winapi[64][2] = [[0, 0]]
  2256. Global $__g_t_winapi_winapi[64][2] = [[0, 0]]
  2257. Global Const $__winapicons_setfon_setfont = 48
  2258. Global Const $__winapiconw_normaw_normal = 400
  2259. Global Const $__winapiconstant__charse_charset = 1
  2260. Global Const $__wnstantonstt_precit_precis_precis = 0
  2261. Global Const $__wistantonstpt_precit_precis_precis = 0
  2262. Global Const $__winapiconstant__qualit_quality = 0
  2263. Global Const $__winapiconsgpixelsgpixelsx = 88
  2264. Global Const $__winapiconsgpixelsgpixelsy = 90
  2265. Global Const $tagcursorinfo = "dword orde;dwor;hCursorhCursor;Cursor;" & $tagpoint
  2266. Global Const $tay_device_device = "dwordchar Name[32];wchar ;wchar String[128];dags;wchar]Key[12]Key[128Key[128Key[128]"
  2267. Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;un TimeOn TimeOu TimeOut"
  2268. Global Const $tagiconinfo = "bool ord XHotSpot;dword YdwtSpot;hansot;hanse hColse hColoe hColor"
  2269. Global Const $tastatusextatusex = "dword Length;dworyLoadoryLoad;" & "uint6Phys;uint64 AvailPhyvailPhys;uinalPageFil4ageFil4ageFileageFile;geFile;" & "uint6Virtual;uint64 Avail4 Atual;uintal;uintldVirtuldVirtuadVirtual"
  2270.  
  2271. Func _winapi_attachconsole($ipid = -1)
  2272. Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $ipid)
  2273. If @error Then Return SetError(@error, @extended, False)
  2274. Return $aresult[0]
  2275. EndFunc
  2276.  
  2277. Func _winapi_attachthreadinput($iattach, $iattachto, $battach)
  2278. Local $aresult = DllCall("user32.dll", "bool", "AteadInputadInput", "dword", $iattach, "dword", $iattachto, "bool", $battach)
  2279. If @error Then Return SetError(@error, @extended, False)
  2280. Return $aresult[0]
  2281. EndFunc
  2282.  
  2283. Func _winapi_beep($ifreq = 500, $iduration = 1000)
  2284. Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
  2285. If @error Then Return SetError(@error, @extended, False)
  2286. Return $aresult[0]
  2287. EndFunc
  2288.  
  2289. Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop)
  2290. 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)
  2291. If @error Then Return SetError(@error, @extended, False)
  2292. Return $aresult[0]
  2293. EndFunc
  2294.  
  2295. Func _winapi_callnexthookex($hhk, $icode, $wparam, $lparam)
  2296. Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhk, "int", $icode, "wparam", $wparam, "lparam", $lparam)
  2297. If @error Then Return SetError(@error, @extended, -1)
  2298. Return $aresult[0]
  2299. EndFunc
  2300.  
  2301. Func _winapi_callwindowproc($pprevwndfunc, $hwnd, $imsg, $wparam, $lparam)
  2302. Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $pprevwndfunc, "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  2303. If @error Then Return SetError(@error, @extended, -1)
  2304. Return $aresult[0]
  2305. EndFunc
  2306.  
  2307. Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
  2308. Local $aret = DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "struct*", $tpoint)
  2309. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2310. Return $tpoint
  2311. EndFunc
  2312.  
  2313. Func _winapi_closehandle($hobject)
  2314. Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject)
  2315. If @error Then Return SetError(@error, @extended, False)
  2316. Return $aresult[0]
  2317. EndFunc
  2318.  
  2319. Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode)
  2320. Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode)
  2321. If @error Then Return SetError(@error, @extended, 0)
  2322. Return $aresult[0]
  2323. EndFunc
  2324.  
  2325. Func _winapi_commdlgextendederror()
  2326. Local Const $cdergfailurefailure = 65535
  2327. Local Const $cderrsfailurefailure = 6
  2328. Local Const $cderrlizationization = 2
  2329. Local Const $cderrsfailurefailure = 7
  2330. Local Const $cderrrfailurefailure = 5
  2331. Local Const $cderrsfailurefailure = 8
  2332. Local Const $cderr_cfailurefailure = 9
  2333. Local Const $cderrkfailurefailure = 10
  2334. Local Const $cdinstancenstance = 4
  2335. Local Const $cderr_nohook = 11
  2336. Local Const $cderr_notemplate = 3
  2337. Local Const $cderr_rmsgfailmsgfail = 12
  2338. Local Const $cderr_structsize = 1
  2339. Local Const $fnerrtoosmalloosmall = 12291
  2340. Local Const $fnerr_filenameilename = 12290
  2341. Local Const $fnerr_sfailurefailure = 12289
  2342. Local $aresult = DllCall("comdlg32.dll", "dword", "CommDdedErroredError")
  2343. If NOT @error Then
  2344. Switch $aresult[0]
  2345. Case $cdergfailurefailure
  2346. Return SetError($aresult[0], 0, "The box cg bo createdcreated.reated." & @LF & "The cialog box function'sction'so the Diaf failef failed failed.failed." & @LF & "For e this error occurs iccurs if the common dialog box ccifies and hs and handld handle handle.")
  2347. Case $cderrsfailurefailure
  2348. Return SetError($aresult[0], 0, "The cialog box function fctied to fin to fincesourccesourceesource.")
  2349. Case $cderrlizationization
  2350. Return SetError($aresult[0], 0, "The common dialog box function failed izatio izationization." & @LF & "This error often occurs when sufficient msailablsailableailable.")
  2351. Case $cderrsfailurefailure
  2352. Return SetError($aresult[0], 0, "The cialog box function fctied to loa to loacesourccesourceesource.")
  2353. Case $cderrrfailurefailure
  2354. Return SetError($aresult[0], 0, "The cialog box function fciled to lp to lp strinp string string.")
  2355. Case $cderrsfailurefailure
  2356. Return SetError($aresult[0], 0, "The cialog box function fctied to loc to loccesourccesourceesource.")
  2357. Case $cderr_cfailurefailure
  2358. Return SetError($aresult[0], 0, "The cialog box function wction was unable to a memory fructureructureructuresuctures.")
  2359. Case $cderrkfailurefailure
  2360. Return SetError($aresult[0], 0, "The cialog box function wction was unable to lomemory asd handld handld handle handle.")
  2361. Case $cdinstancenstance
  2362. Return SetError($aresult[0], 0, "The EMPLATE flag was set as set in the Flags member of the initialization structure fcorresponmlog bomlog bomlog boxlog box," & @LF & "but you failed to provide a correspi handli handle handle.")
  2363. Case $cderr_nohook
  2364. Return SetError($aresult[0], 0, "The EOK flag was set in tet in the Flags member of the initialization structure fcorresponmlog bomlog bomlog boxlog box," & @LF & "but yed to provide a poin a poi a corres ocedur ocedureocedure.cedure.")
  2365. Case $cderr_notemplate
  2366. Return SetError($aresult[0], 0, "The EMPLATE flag was set as set in the Flags member of the initialization structure fcorresponmlog bomlog bomlog boxlog box," & @LF & "but you failed to provide a oemplatoemplateemplate.")
  2367. Case $cderr_rmsgfailmsgfail
  2368. Return SetError($aresult[0], 0, "The RWindowMessage functi function returned an error code when it was ca the commounctioounctionunctionunction.")
  2369. Case $cderr_structsize
  2370. Return SetError($aresult[0], 0, "The lize member of the in the initialization structure for the coring commog invalg invali invalidinvalid")
  2371. Case $fnerrtoosmalloosmall
  2372. Return SetError($aresult[0], 0, "The bointed to by the lpsthe lpstrFile member of the OPENFILENAME structure is too small ffile nameih nameihe useihe userhe user." & @LF & "The fo bytes of the lpstre lpstrFile buffer contain an integer value specifying the size, in TCHquired toell namell namell name.l name.")
  2373. Case $fnerr_filenameilename
  2374. Return SetError($aresult[0], 0, "A file ninvalid.nvalid.")
  2375. Case $fnerr_sfailurefailure
  2376. Return SetError($aresult[0], 0, "An ato subclass a list bolist box failed becauicient mesailablsailablsailableailable.")
  2377. EndSwitch
  2378. EndIf
  2379. Return SetError(@error, @extended, "0x" & Hex($aresult[0]))
  2380. EndFunc
  2381.  
  2382. Func _winapi_copyicon($hicon)
  2383. Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon)
  2384. If @error Then Return SetError(@error, @extended, 0)
  2385. Return $aresult[0]
  2386. EndFunc
  2387.  
  2388. Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
  2389. Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "ptr", $pbits)
  2390. If @error Then Return SetError(@error, @extended, 0)
  2391. Return $aresult[0]
  2392. EndFunc
  2393.  
  2394. Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  2395. Local $aresult = DllCall("gdi32.dll", "handle", "CreateCleBitmapeBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight)
  2396. If @error Then Return SetError(@error, @extended, 0)
  2397. Return $aresult[0]
  2398. EndFunc
  2399.  
  2400. Func _winapi_createcompatibledc($hdc)
  2401. Local $aresult = DllCall("gdi32.dll", "handle", "CreatibleDCtibleDC", "handle", $hdc)
  2402. If @error Then Return SetError(@error, @extended, 0)
  2403. Return $aresult[0]
  2404. EndFunc
  2405.  
  2406. Func _winapi_createevent($pattributes = 0, $bmanualreset = True, $binitialstate = True, $sname = "")
  2407. Local $snametype = "wstr"
  2408. If $sname = "" Then
  2409. $sname = 0
  2410. $snametype = "ptr"
  2411. EndIf
  2412. Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "ptr", $pattributes, "bool", $bmanualreset, "bool", $binitialstate, $snametype, $sname)
  2413. If @error Then Return SetError(@error, @extended, 0)
  2414. Return $aresult[0]
  2415. EndFunc
  2416.  
  2417. Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $psecurity = 0)
  2418. Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0
  2419. If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute)
  2420. If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read)
  2421. If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write)
  2422. If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $fie_delete_delete)
  2423. If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read)
  2424. If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write)
  2425. Switch $icreation
  2426. Case 0
  2427. $icd = $create_new
  2428. Case 1
  2429. $icd = $create_always
  2430. Case 2
  2431. $icd = $open_existing
  2432. Case 3
  2433. $icd = $open_always
  2434. Case 4
  2435. $icd = $trexistingxisting
  2436. EndSwitch
  2437. If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_at_archivearchive)
  2438. If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_ae_hidden_hidden)
  2439. If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attreadonlyeadonly)
  2440. If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_ae_system_system)
  2441. Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "ptr", $psecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
  2442. If @error OR ($aresult[0] = $invalle_valuee_value) Then Return SetError(@error, @extended, 0)
  2443. Return $aresult[0]
  2444. EndFunc
  2445.  
  2446. Func _winapi_createfont($iheight, $iwidth, $iescape = 0, $iorientn = 0, $iweight = $__winapiconw_normaw_normal, $bitalic = False, $bunderline = False, $bstrikeout = False, $icharset = $__winapiconstant__charse_charset, $ioutputprec = $__wnstantonstt_precit_precis_precis, $iclipprec = $__wistantonstpt_precit_precis_precis, $iquality = $__winapiconstant__qualit_quality, $ipitch = 0, $sface = "Arial")
  2447. Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $iheight, "int", $iwidth, "int", $iescape, "int", $iorientn, "int", $iweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $icharset, "dword", $ioutputprec, "dword", $iclipprec, "dword", $iquality, "dword", $ipitch, "wstr", $sface)
  2448. If @error Then Return SetError(@error, @extended, 0)
  2449. Return $aresult[0]
  2450. EndFunc
  2451.  
  2452. Func _winapi_createfontindirect($tlogfont)
  2453. Local $aresult = DllCall("gdi32.dll", "handle", "CreandirectWdirectW", "struct*", $tlogfont)
  2454. If @error Then Return SetError(@error, @extended, 0)
  2455. Return $aresult[0]
  2456. EndFunc
  2457.  
  2458. Func _winapi_createpen($ipenstyle, $iwidth, $ncolor)
  2459. Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "INT", $ncolor)
  2460. If @error Then Return SetError(@error, @extended, 0)
  2461. Return $aresult[0]
  2462. EndFunc
  2463.  
  2464. Func _winapi_createprocess($sappname, $scommand, $psecurity, $pthread, $binherit, $iflags, $penviron, $sdir, $pstartupinfo, $pprocess)
  2465. Local $tcommand = 0
  2466. Local $sappnametype = "wstr", $sdirtype = "wstr"
  2467. If $sappname = "" Then
  2468. $sappnametype = "ptr"
  2469. $sappname = 0
  2470. EndIf
  2471. If $scommand <> "" Then
  2472. $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]")
  2473. DllStructSetData($tcommand, "Text", $scommand)
  2474. EndIf
  2475. If $sdir = "" Then
  2476. $sdirtype = "ptr"
  2477. $sdir = 0
  2478. EndIf
  2479. Local $aresult = DllCall("kernel32.dll", "bool", "CreateProcessW", $sappnametype, $sappname, "struct*", $tcommand, "ptr", $psecurity, "ptr", $pthread, "bool", $binherit, "dword", $iflags, "ptr", $penviron, $sdirtype, $sdir, "ptr", $pstartupinfo, "ptr", $pprocess)
  2480. If @error Then Return SetError(@error, @extended, False)
  2481. Return $aresult[0]
  2482. EndFunc
  2483.  
  2484. Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect)
  2485. Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect)
  2486. If @error Then Return SetError(@error, @extended, 0)
  2487. Return $aresult[0]
  2488. EndFunc
  2489.  
  2490. Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse)
  2491. Local $aresult = DllCall("gdi32.dll", "handle", "CredRectRgnRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse)
  2492. If @error Then Return SetError(@error, @extended, 0)
  2493. Return $aresult[0]
  2494. EndFunc
  2495.  
  2496. Func _winapi_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1)
  2497. Local $hdc = _winapi_getdc($hwnd)
  2498. Local $hdestdc = _winapi_createcompatibledc($hdc)
  2499. Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  2500. Local $hold = _winapi_selectobject($hdestdc, $hbitmap)
  2501. Local $trect = DllStructCreate($tagrect)
  2502. DllStructSetData($trect, 1, 0)
  2503. DllStructSetData($trect, 2, 0)
  2504. DllStructSetData($trect, 3, $iwidth)
  2505. DllStructSetData($trect, 4, $iheight)
  2506. If $brgb Then
  2507. $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
  2508. EndIf
  2509. Local $hbrush = _winapi_createsolidbrush($icolor)
  2510. If NOT _winapi_fillrect($hdestdc, $trect, $hbrush) Then
  2511. _winapi_deleteobject($hbitmap)
  2512. $hbitmap = 0
  2513. EndIf
  2514. _winapi_deleteobject($hbrush)
  2515. _winapi_releasedc($hwnd, $hdc)
  2516. _winapi_selectobject($hdestdc, $hold)
  2517. _winapi_deletedc($hdestdc)
  2518. If NOT $hbitmap Then Return SetError(1, 0, 0)
  2519. Return $hbitmap
  2520. EndFunc
  2521.  
  2522. Func _winapi_createsolidbrush($ncolor)
  2523. Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "INT", $ncolor)
  2524. If @error Then Return SetError(@error, @extended, 0)
  2525. Return $aresult[0]
  2526. EndFunc
  2527.  
  2528. Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0)
  2529. If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("")
  2530. 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)
  2531. If @error Then Return SetError(@error, @extended, 0)
  2532. Return $aresult[0]
  2533. EndFunc
  2534.  
  2535. Func _winapi_defwindowproc($hwnd, $imsg, $iwparam, $ilparam)
  2536. Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  2537. If @error Then Return SetError(@error, @extended, 0)
  2538. Return $aresult[0]
  2539. EndFunc
  2540.  
  2541. Func _winapi_deletedc($hdc)
  2542. Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc)
  2543. If @error Then Return SetError(@error, @extended, False)
  2544. Return $aresult[0]
  2545. EndFunc
  2546.  
  2547. Func _winapi_deleteobject($hobject)
  2548. Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject)
  2549. If @error Then Return SetError(@error, @extended, False)
  2550. Return $aresult[0]
  2551. EndFunc
  2552.  
  2553. Func _winapi_destroyicon($hicon)
  2554. Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon)
  2555. If @error Then Return SetError(@error, @extended, False)
  2556. Return $aresult[0]
  2557. EndFunc
  2558.  
  2559. Func _winapi_destroywindow($hwnd)
  2560. Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd)
  2561. If @error Then Return SetError(@error, @extended, False)
  2562. Return $aresult[0]
  2563. EndFunc
  2564.  
  2565. Func _winapi_drawedge($hdc, $prect, $iedgetype, $iflags)
  2566. Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "ptr", $prect, "uint", $iedgetype, "uint", $iflags)
  2567. If @error Then Return SetError(@error, @extended, False)
  2568. Return $aresult[0]
  2569. EndFunc
  2570.  
  2571. Func _winapi_drawframecontrol($hdc, $prect, $itype, $istate)
  2572. Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "ptr", $prect, "uint", $itype, "uint", $istate)
  2573. If @error Then Return SetError(@error, @extended, False)
  2574. Return $aresult[0]
  2575. EndFunc
  2576.  
  2577. Func _winapi_drawicon($hdc, $ix, $iy, $hicon)
  2578. Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon)
  2579. If @error Then Return SetError(@error, @extended, False)
  2580. Return $aresult[0]
  2581. EndFunc
  2582.  
  2583. Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3)
  2584. Local $ioptions
  2585. Switch $iflags
  2586. Case 1
  2587. $ioptions = $di_mask
  2588. Case 2
  2589. $ioptions = $di_image
  2590. Case 3
  2591. $ioptions = $di_normal
  2592. Case 4
  2593. $ioptions = $di_compat
  2594. Case 5
  2595. $ioptions = $di_defaultsize
  2596. Case Else
  2597. $ioptions = $di_nomirror
  2598. EndSwitch
  2599. 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)
  2600. If @error Then Return SetError(@error, @extended, False)
  2601. Return $aresult[0]
  2602. EndFunc
  2603.  
  2604. Func _winapi_drawline($hdc, $ix1, $iy1, $ix2, $iy2)
  2605. _winapi_moveto($hdc, $ix1, $iy1)
  2606. If @error Then Return SetError(@error, @extended, False)
  2607. _winapi_lineto($hdc, $ix2, $iy2)
  2608. If @error Then Return SetError(@error + 10, @extended, False)
  2609. Return True
  2610. EndFunc
  2611.  
  2612. Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
  2613. Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "struct*", $trect, "uint", $iflags)
  2614. If @error Then Return SetError(@error, @extended, 0)
  2615. Return $aresult[0]
  2616. EndFunc
  2617.  
  2618. Func _winapi_duplicatehandle($hsoursshandleshandle, $hsourcehandle, $htargsshandleshandle, $idesiredaccess, $binherithandle, $ioptions)
  2619. Local $aresult = DllCall("kernel32.dll", "bool", "DuplicateHandle", "handle", $hsoursshandleshandle, "handle", $hsourcehandle, "handle", $htargsshandleshandle, "handle*", 0, "dword", $idesiredaccess, "bool", $binherithandle, "dword", $ioptions)
  2620. If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  2621. Return $aresult[4]
  2622. EndFunc
  2623.  
  2624. Func _winapi_enablewindow($hwnd, $benable = True)
  2625. Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $benable)
  2626. If @error Then Return SetError(@error, @extended, False)
  2627. Return $aresult[0]
  2628. EndFunc
  2629.  
  2630. Func _winapi_enumdisplaydevices($sdevice, $idevnum)
  2631. Local $tname = 0, $iflags = 0, $adevice[5]
  2632. If $sdevice <> "" Then
  2633. $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
  2634. DllStructSetData($tname, "Text", $sdevice)
  2635. EndIf
  2636. Local $tdevice = DllStructCreate($tay_device_device)
  2637. Local $idevice = DllStructGetSize($tdevice)
  2638. DllStructSetData($tdevice, "Size", $idevice)
  2639. Local $aret = DllCall("user32.dll", "bool", "EnumDevicesWevicesW", "struct*", $tname, "dword", $idevnum, "struct*", $tdevice, "dword", 1)
  2640. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2641. Local $in = DllStructGetData($tdevice, "Flags")
  2642. If BitAND($in, $dievice_aeva_deskto_desktopdesktop) <> 0 Then $iflags = BitOR($iflags, 1)
  2643. If BitAND($in, $display_devicey_devicy_device) <> 0 Then $iflags = BitOR($iflags, 2)
  2644. If BitAND($in, $display_device_mg_driveg_driver) <> 0 Then $iflags = BitOR($iflags, 4)
  2645. If BitAND($in, $display_devicempatiblmpatible) <> 0 Then $iflags = BitOR($iflags, 8)
  2646. If BitAND($in, $display_demovablemovable) <> 0 Then $iflags = BitOR($iflags, 16)
  2647. If BitAND($in, $display_devespruneespruned) <> 0 Then $iflags = BitOR($iflags, 32)
  2648. $adevice[0] = True
  2649. $adevice[1] = DllStructGetData($tdevice, "Name")
  2650. $adevice[2] = DllStructGetData($tdevice, "String")
  2651. $adevice[3] = $iflags
  2652. $adevice[4] = DllStructGetData($tdevice, "ID")
  2653. Return $adevice
  2654. EndFunc
  2655.  
  2656. Func _winapi_enumwindows($bvisible = True, $hwnd = Default)
  2657. __winapi_enumwindowsinit()
  2658. If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
  2659. __winapi_enumwindowschild($hwnd, $bvisible)
  2660. Return $__g_t_winapi_winapi
  2661. EndFunc
  2662.  
  2663. Func __winapi_enumwindowsadd($hwnd, $sclass = "")
  2664. If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
  2665. $__g_t_winapi_winapi[0][0] += 1
  2666. Local $icount = $__g_t_winapi_winapi[0][0]
  2667. If $icount >= $__g_t_winapi_winapi[0][1] Then
  2668. ReDim $__g_t_winapi_winapi[$icount + 64][2]
  2669. $__g_t_winapi_winapi[0][1] += 64
  2670. EndIf
  2671. $__g_t_winapi_winapi[$icount][0] = $hwnd
  2672. $__g_t_winapi_winapi[$icount][1] = $sclass
  2673. EndFunc
  2674.  
  2675. Func __winapi_enumwindowschild($hwnd, $bvisible = True)
  2676. $hwnd = _winapi_getwindow($hwnd, $gw_child)
  2677. While $hwnd <> 0
  2678. If (NOT $bvisible) OR _winapi_iswindowvisible($hwnd) Then
  2679. __winapi_enumwindowsadd($hwnd)
  2680. __winapi_enumwindowschild($hwnd, $bvisible)
  2681. EndIf
  2682. $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  2683. WEnd
  2684. EndFunc
  2685.  
  2686. Func __winapi_enumwindowsinit()
  2687. ReDim $__g_t_winapi_winapi[64][2]
  2688. $__g_t_winapi_winapi[0][0] = 0
  2689. $__g_t_winapi_winapi[0][1] = 64
  2690. EndFunc
  2691.  
  2692. Func _winapi_enumwindowspopup()
  2693. __winapi_enumwindowsinit()
  2694. Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  2695. Local $sclass
  2696. While $hwnd <> 0
  2697. If _winapi_iswindowvisible($hwnd) Then
  2698. $sclass = _winapi_getclassname($hwnd)
  2699. If $sclass = "#32768" Then
  2700. __winapi_enumwindowsadd($hwnd)
  2701. ElseIf $sclass = "ToolbarWindow32" Then
  2702. __winapi_enumwindowsadd($hwnd)
  2703. ElseIf $sclass = "ToolTips_Class32" Then
  2704. __winapi_enumwindowsadd($hwnd)
  2705. ElseIf $sclass = "BaseBar" Then
  2706. __winapi_enumwindowschild($hwnd)
  2707. EndIf
  2708. EndIf
  2709. $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  2710. WEnd
  2711. Return $__g_t_winapi_winapi
  2712. EndFunc
  2713.  
  2714. Func _winapi_enumwindowstop()
  2715. __winapi_enumwindowsinit()
  2716. Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  2717. While $hwnd <> 0
  2718. If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
  2719. $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  2720. WEnd
  2721. Return $__g_t_winapi_winapi
  2722. EndFunc
  2723.  
  2724. Func _winapi_expandenvironmentstrings($sstring)
  2725. Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnviStringsStringsW", "wstr", $sstring, "wstr", "", "dword", 4096)
  2726. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2727. Return $aresult[2]
  2728. EndFunc
  2729.  
  2730. Func _winapi_extracticonex($sfile, $iindex, $plarge, $psmall, $iicons)
  2731. Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfile, "int", $iindex, "struct*", $plarge, "struct*", $psmall, "uint", $iicons)
  2732. If @error Then Return SetError(@error, @extended, 0)
  2733. Return $aresult[0]
  2734. EndFunc
  2735.  
  2736. Func _winapi_fatalappexit($smessage)
  2737. DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage)
  2738. If @error Then Return SetError(@error, @extended)
  2739. EndFunc
  2740.  
  2741. Func _winapi_fillrect($hdc, $prect, $hbrush)
  2742. Local $aresult
  2743. If IsPtr($hbrush) Then
  2744. $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $prect, "handle", $hbrush)
  2745. Else
  2746. $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $prect, "dword_ptr", $hbrush)
  2747. EndIf
  2748. If @error Then Return SetError(@error, @extended, False)
  2749. Return $aresult[0]
  2750. EndFunc
  2751.  
  2752. Func _winapi_findexecutable($sfilename, $sdirectory = "")
  2753. Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "")
  2754. If @error Then Return SetError(@error, @extended, "")
  2755. If $aresult[0] <= 32 Then Return SetError(10, $aresult[0], "")
  2756. Return SetExtended($aresult[0], $aresult[3])
  2757. EndFunc
  2758.  
  2759. Func _winapi_findwindow($sclassname, $swindowname)
  2760. Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname)
  2761. If @error Then Return SetError(@error, @extended, 0)
  2762. Return $aresult[0]
  2763. EndFunc
  2764.  
  2765. Func _winapi_flashwindow($hwnd, $binvert = True)
  2766. Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $binvert)
  2767. If @error Then Return SetError(@error, @extended, False)
  2768. Return $aresult[0]
  2769. EndFunc
  2770.  
  2771. Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0)
  2772. Local $tflash = DllStructCreate($tagflashwinfo)
  2773. Local $iflash = DllStructGetSize($tflash)
  2774. Local $imode = 0
  2775. If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $flashw_caption)
  2776. If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $flashw_tray)
  2777. If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $flashw_timer)
  2778. If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $flashw_timernofg)
  2779. DllStructSetData($tflash, "Size", $iflash)
  2780. DllStructSetData($tflash, "hWnd", $hwnd)
  2781. DllStructSetData($tflash, "Flags", $imode)
  2782. DllStructSetData($tflash, "Count", $icount)
  2783. DllStructSetData($tflash, "Timeout", $itimeout)
  2784. Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "struct*", $tflash)
  2785. If @error Then Return SetError(@error, @extended, False)
  2786. Return $aresult[0]
  2787. EndFunc
  2788.  
  2789. Func _winapi_floattoint($nfloat)
  2790. Local $tfloat = DllStructCreate("float")
  2791. Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
  2792. DllStructSetData($tfloat, 1, $nfloat)
  2793. Return DllStructGetData($tint, 1)
  2794. EndFunc
  2795.  
  2796. Func _winapi_flushfilebuffers($hfile)
  2797. Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile)
  2798. If @error Then Return SetError(@error, @extended, False)
  2799. Return $aresult[0]
  2800. EndFunc
  2801.  
  2802. Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
  2803. Local $sbuffertype = "struct*"
  2804. If IsString($pbuffer) Then $sbuffertype = "wstr"
  2805. Local $aresult = DllCall("Kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "ptr", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
  2806. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2807. If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
  2808. Return $aresult[0]
  2809. EndFunc
  2810.  
  2811. Func _winapi_framerect($hdc, $prect, $hbrush)
  2812. Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "ptr", $prect, "handle", $hbrush)
  2813. If @error Then Return SetError(@error, @extended, False)
  2814. Return $aresult[0]
  2815. EndFunc
  2816.  
  2817. Func _winapi_freelibrary($hmodule)
  2818. Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
  2819. If @error Then Return SetError(@error, @extended, False)
  2820. Return $aresult[0]
  2821. EndFunc
  2822.  
  2823. Func _winapi_getancestor($hwnd, $iflags = 1)
  2824. Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags)
  2825. If @error Then Return SetError(@error, @extended, 0)
  2826. Return $aresult[0]
  2827. EndFunc
  2828.  
  2829. Func _winapi_getasynckeystate($ikey)
  2830. Local $aresult = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", $ikey)
  2831. If @error Then Return SetError(@error, @extended, 0)
  2832. Return $aresult[0]
  2833. EndFunc
  2834.  
  2835. Func _winapi_getbkmode($hdc)
  2836. Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc)
  2837. If @error Then Return SetError(@error, @extended, 0)
  2838. Return $aresult[0]
  2839. EndFunc
  2840.  
  2841. Func _winapi_getclassname($hwnd)
  2842. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  2843. Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  2844. If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  2845. Return SetExtended($aresult[0], $aresult[2])
  2846. EndFunc
  2847.  
  2848. Func _winapi_getclientheight($hwnd)
  2849. Local $trect = _winapi_getclientrect($hwnd)
  2850. If @error Then Return SetError(@error, @extended, 0)
  2851. Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  2852. EndFunc
  2853.  
  2854. Func _winapi_getclientwidth($hwnd)
  2855. Local $trect = _winapi_getclientrect($hwnd)
  2856. If @error Then Return SetError(@error, @extended, 0)
  2857. Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  2858. EndFunc
  2859.  
  2860. Func _winapi_getclientrect($hwnd)
  2861. Local $trect = DllStructCreate($tagrect)
  2862. Local $aret = DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
  2863. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2864. Return $trect
  2865. EndFunc
  2866.  
  2867. Func _winapi_getcurrentprocess()
  2868. Local $aresult = DllCall("kernel32.dll", "handle", "GetProcessProcess")
  2869. If @error Then Return SetError(@error, @extended, 0)
  2870. Return $aresult[0]
  2871. EndFunc
  2872.  
  2873. Func _winapi_getcurrentprocessid()
  2874. Local $aresult = DllCall("kernel32.dll", "dword", "GetCrocessIdocessId")
  2875. If @error Then Return SetError(@error, @extended, 0)
  2876. Return $aresult[0]
  2877. EndFunc
  2878.  
  2879. Func _winapi_getcurrentthread()
  2880. Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  2881. If @error Then Return SetError(@error, @extended, 0)
  2882. Return $aresult[0]
  2883. EndFunc
  2884.  
  2885. Func _winapi_getcurrentthreadid()
  2886. Local $aresult = DllCall("kernel32.dll", "dword", "GetThreadIdhreadId")
  2887. If @error Then Return SetError(@error, @extended, 0)
  2888. Return $aresult[0]
  2889. EndFunc
  2890.  
  2891. Func _winapi_getcursorinfo()
  2892. Local $tcursor = DllStructCreate($tagcursorinfo)
  2893. Local $icursor = DllStructGetSize($tcursor)
  2894. DllStructSetData($tcursor, "Size", $icursor)
  2895. Local $aret = DllCall("user32.dll", "bool", "GetCursorInfo", "struct*", $tcursor)
  2896. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2897. Local $acursor[5]
  2898. $acursor[0] = True
  2899. $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0
  2900. $acursor[2] = DllStructGetData($tcursor, "hCursor")
  2901. $acursor[3] = DllStructGetData($tcursor, "X")
  2902. $acursor[4] = DllStructGetData($tcursor, "Y")
  2903. Return $acursor
  2904. EndFunc
  2905.  
  2906. Func _winapi_getdc($hwnd)
  2907. Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  2908. If @error Then Return SetError(@error, @extended, 0)
  2909. Return $aresult[0]
  2910. EndFunc
  2911.  
  2912. Func _winapi_getdesktopwindow()
  2913. Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
  2914. If @error Then Return SetError(@error, @extended, 0)
  2915. Return $aresult[0]
  2916. EndFunc
  2917.  
  2918. Func _winapi_getdevicecaps($hdc, $iindex)
  2919. Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  2920. If @error Then Return SetError(@error, @extended, 0)
  2921. Return $aresult[0]
  2922. EndFunc
  2923.  
  2924. Func _winapi_getdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbi, $iusage)
  2925. Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbi, "uint", $iusage)
  2926. If @error Then Return SetError(@error, @extended, False)
  2927. Return $aresult[0]
  2928. EndFunc
  2929.  
  2930. Func _winapi_getdlgctrlid($hwnd)
  2931. Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
  2932. If @error Then Return SetError(@error, @extended, 0)
  2933. Return $aresult[0]
  2934. EndFunc
  2935.  
  2936. Func _winapi_getdlgitem($hwnd, $iitemid)
  2937. Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid)
  2938. If @error Then Return SetError(@error, @extended, 0)
  2939. Return $aresult[0]
  2940. EndFunc
  2941.  
  2942. Func _winapi_getfilesizeex($hfile)
  2943. Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0)
  2944. If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, -1)
  2945. Return $aresult[2]
  2946. EndFunc
  2947.  
  2948. Func _winapi_getfocus()
  2949. Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
  2950. If @error Then Return SetError(@error, @extended, 0)
  2951. Return $aresult[0]
  2952. EndFunc
  2953.  
  2954. Func _winapi_getforegroundwindow()
  2955. Local $aresult = DllCall("user32.dll", "hwnd", "GetFndWindowdWindow")
  2956. If @error Then Return SetError(@error, @extended, 0)
  2957. Return $aresult[0]
  2958. EndFunc
  2959.  
  2960. Func _winapi_getguiresources($iflag = 0, $hprocess = -1)
  2961. If $hprocess = -1 Then $hprocess = _winapi_getcurrentprocess()
  2962. Local $aresult = DllCall("user32.dll", "dword", "GetGuiResources", "handle", $hprocess, "dword", $iflag)
  2963. If @error Then Return SetError(@error, @extended, 0)
  2964. Return $aresult[0]
  2965. EndFunc
  2966.  
  2967. Func _winapi_geticoninfo($hicon)
  2968. Local $tinfo = DllStructCreate($tagiconinfo)
  2969. Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $tinfo)
  2970. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2971. Local $aicon[6]
  2972. $aicon[0] = True
  2973. $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0
  2974. $aicon[2] = DllStructGetData($tinfo, "XHotSpot")
  2975. $aicon[3] = DllStructGetData($tinfo, "YHotSpot")
  2976. $aicon[4] = DllStructGetData($tinfo, "hMask")
  2977. $aicon[5] = DllStructGetData($tinfo, "hColor")
  2978. Return $aicon
  2979. EndFunc
  2980.  
  2981. Func _winapi_getlasterrormessage()
  2982. Local $ilasterror = _winapi_getlasterror()
  2983. Local $tbufferptr = DllStructCreate("ptr")
  2984. Local $ncount = _winapi_formatmessage(BitOR($format_message_e_buffee_buffer, $format_messm_system_system), 0, $ilasterror, 0, $tbufferptr, 0, 0)
  2985. If @error Then Return SetError(@error, 0, "")
  2986. Local $stext = ""
  2987. Local $pbuffer = DllStructGetData($tbufferptr, 1)
  2988. If $pbuffer Then
  2989. If $ncount > 0 Then
  2990. Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
  2991. $stext = DllStructGetData($tbuffer, 1)
  2992. EndIf
  2993. _winapi_localfree($pbuffer)
  2994. EndIf
  2995. Return $stext
  2996. EndFunc
  2997.  
  2998. Func _winapi_getlayeredwindowattributes($hwnd, ByRef $itranscolor, ByRef $itransparency, $bcolorref = False)
  2999. $itranscolor = -1
  3000. $itransparency = -1
  3001. Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWtributetributes", "hwnd", $hwnd, "INT*", $itranscolor, "byte*", $itransparency, "dword*", 0)
  3002. If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  3003. If NOT $bcolorref Then
  3004. $aresult[2] = Int(BinaryMid($aresult[2], 3, 1) & BinaryMid($aresult[2], 2, 1) & BinaryMid($aresult[2], 1, 1))
  3005. EndIf
  3006. $itranscolor = $aresult[2]
  3007. $itransparency = $aresult[3]
  3008. Return $aresult[4]
  3009. EndFunc
  3010.  
  3011. Func _winapi_getmodulehandle($smodulename)
  3012. Local $smodulenametype = "wstr"
  3013. If $smodulename = "" Then
  3014. $smodulename = 0
  3015. $smodulenametype = "ptr"
  3016. EndIf
  3017. Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename)
  3018. If @error Then Return SetError(@error, @extended, 0)
  3019. Return $aresult[0]
  3020. EndFunc
  3021.  
  3022. Func _winapi_getmousepos($btoclient = False, $hwnd = 0)
  3023. Local $imode = Opt("MouseCoordMode", 1)
  3024. Local $apos = MouseGetPos()
  3025. Opt("MouseCoordMode", $imode)
  3026. Local $tpoint = DllStructCreate($tagpoint)
  3027. DllStructSetData($tpoint, "X", $apos[0])
  3028. DllStructSetData($tpoint, "Y", $apos[1])
  3029. If $btoclient AND NOT _winapi_screentoclient($hwnd, $tpoint) Then Return SetError(@error + 20, @extended, 0)
  3030. Return $tpoint
  3031. EndFunc
  3032.  
  3033. Func _winapi_getmouseposx($btoclient = False, $hwnd = 0)
  3034. Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  3035. If @error Then Return SetError(@error, @extended, 0)
  3036. Return DllStructGetData($tpoint, "X")
  3037. EndFunc
  3038.  
  3039. Func _winapi_getmouseposy($btoclient = False, $hwnd = 0)
  3040. Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  3041. If @error Then Return SetError(@error, @extended, 0)
  3042. Return DllStructGetData($tpoint, "Y")
  3043. EndFunc
  3044.  
  3045. Func _winapi_getobject($hobject, $isize, $pobject)
  3046. Local $aresult = DllCall("gdi32.dll", "int", "GetObjectW", "handle", $hobject, "int", $isize, "ptr", $pobject)
  3047. If @error Then Return SetError(@error, @extended, 0)
  3048. Return $aresult[0]
  3049. EndFunc
  3050.  
  3051. Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  3052. Local $ipathlen = 4096
  3053. Local $inulls = 0
  3054. Local $tofn = DllStructCreate($tagopenfilename)
  3055. Local $afiles[1] = [0]
  3056. Local $iflag = $iflags
  3057. Local $asflines = StringSplit($sfilter, "|")
  3058. Local $asfilter[$asflines[0] * 2 + 1]
  3059. Local $istart, $ifinal, $tagfilter
  3060. $asfilter[0] = $asflines[0] * 2
  3061. For $i = 1 To $asflines[0]
  3062. $istart = StringInStr($asflines[$i], "(", 0, 1)
  3063. $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  3064. $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $sttrailingrailing)
  3065. $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $sttrailingrailing)
  3066. $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  3067. Next
  3068. Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  3069. Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  3070. Local $tfilter = DllStructCreate($tagfilter & "wchar")
  3071. Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  3072. Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  3073. For $i = 1 To $asfilter[0]
  3074. DllStructSetData($tfilter, $i, $asfilter[$i])
  3075. Next
  3076. DllStructSetData($ttitle, "Title", $stitle)
  3077. DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  3078. DllStructSetData($tpath, "Path", $sdefaultfile)
  3079. DllStructSetData($textn, "Extension", $sdefaultext)
  3080. DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  3081. DllStructSetData($tofn, "hwndOwner", $hwndowner)
  3082. DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  3083. DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  3084. DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  3085. DllStructSetData($tofn, "nMaxFile", $ipathlen)
  3086. DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  3087. DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  3088. DllStructSetData($tofn, "Flags", $iflag)
  3089. DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  3090. DllStructSetData($tofn, "FlagsEx", $iflagsex)
  3091. Local $ares = DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "struct*", $tofn)
  3092. If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
  3093. If BitAND($iflags, $ofn_atiselectiselect) = $ofn_atiselectiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then
  3094. For $x = 1 To $ipathlen
  3095. If DllStructGetData($tpath, "Path", $x) = Chr(0) Then
  3096. DllStructSetData($tpath, "Path", "|", $x)
  3097. $inulls += 1
  3098. Else
  3099. $inulls = 0
  3100. EndIf
  3101. If $inulls = 2 Then ExitLoop
  3102. Next
  3103. DllStructSetData($tpath, "Path", Chr(0), $x - 1)
  3104. $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|")
  3105. If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3106. Return StringSplit(DllStructGetData($tpath, "Path"), "|")
  3107. ElseIf BitAND($iflags, $ofn_atiselectiselect) = $ofn_atiselectiselect Then
  3108. $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ")
  3109. If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3110. Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|")
  3111. Else
  3112. Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3113. EndIf
  3114. EndFunc
  3115.  
  3116. Func _winapi_getoverlappedresult($hfile, $poverlapped, ByRef $ibytes, $bwait = False)
  3117. Local $aresult = DllCall("kernel32.dll", "bool", "GetOedResultdResult", "handle", $hfile, "ptr", $poverlapped, "dword*", 0, "bool", $bwait)
  3118. If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, False)
  3119. $ibytes = $aresult[3]
  3120. Return $aresult[0]
  3121. EndFunc
  3122.  
  3123. Func _winapi_getparent($hwnd)
  3124. Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd)
  3125. If @error Then Return SetError(@error, @extended, 0)
  3126. Return $aresult[0]
  3127. EndFunc
  3128.  
  3129. Func _winapi_getprocaddress($hmodule, $vname)
  3130. Local $stype = "str"
  3131. If IsNumber($vname) Then $stype = "word"
  3132. Local $aresult = DllCall("kernel32.dll", "ptr", "GetProcAddress", "handle", $hmodule, $stype, $vname)
  3133. If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  3134. Return $aresult[0]
  3135. EndFunc
  3136.  
  3137. Func _winapi_getprocessaffinitymask($hprocess)
  3138. Local $aresult = DllCall("kernel32.dll", "bool", "GetProcnityMaskityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0)
  3139. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  3140. Local $amask[3]
  3141. $amask[0] = True
  3142. $amask[1] = $aresult[2]
  3143. $amask[2] = $aresult[3]
  3144. Return $amask
  3145. EndFunc
  3146.  
  3147. Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  3148. Local $ipathlen = 4096
  3149. Local $tofn = DllStructCreate($tagopenfilename)
  3150. Local $afiles[1] = [0]
  3151. Local $iflag = $iflags
  3152. Local $asflines = StringSplit($sfilter, "|")
  3153. Local $asfilter[$asflines[0] * 2 + 1]
  3154. Local $istart, $ifinal, $tagfilter
  3155. $asfilter[0] = $asflines[0] * 2
  3156. For $i = 1 To $asflines[0]
  3157. $istart = StringInStr($asflines[$i], "(", 0, 1)
  3158. $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  3159. $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $sttrailingrailing)
  3160. $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $sttrailingrailing)
  3161. $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  3162. Next
  3163. Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  3164. Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  3165. Local $tfilter = DllStructCreate($tagfilter & "wchar")
  3166. Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  3167. Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  3168. For $i = 1 To $asfilter[0]
  3169. DllStructSetData($tfilter, $i, $asfilter[$i])
  3170. Next
  3171. DllStructSetData($ttitle, "Title", $stitle)
  3172. DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  3173. DllStructSetData($tpath, "Path", $sdefaultfile)
  3174. DllStructSetData($textn, "Extension", $sdefaultext)
  3175. DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  3176. DllStructSetData($tofn, "hwndOwner", $hwndowner)
  3177. DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  3178. DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  3179. DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  3180. DllStructSetData($tofn, "nMaxFile", $ipathlen)
  3181. DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  3182. DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  3183. DllStructSetData($tofn, "Flags", $iflag)
  3184. DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  3185. DllStructSetData($tofn, "FlagsEx", $iflagsex)
  3186. Local $ares = DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "struct*", $tofn)
  3187. If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
  3188. Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3189. EndFunc
  3190.  
  3191. Func _winapi_getstockobject($iobject)
  3192. Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject)
  3193. If @error Then Return SetError(@error, @extended, 0)
  3194. Return $aresult[0]
  3195. EndFunc
  3196.  
  3197. Func _winapi_getstdhandle($istdhandle)
  3198. If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
  3199. Local Const $ahandle[3] = [-10, -11, -12]
  3200. Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
  3201. If @error Then Return SetError(@error, @extended, -1)
  3202. Return $aresult[0]
  3203. EndFunc
  3204.  
  3205. Func _winapi_getsyscolor($iindex)
  3206. Local $aresult = DllCall("user32.dll", "INT", "GetSysColor", "int", $iindex)
  3207. If @error Then Return SetError(@error, @extended, 0)
  3208. Return $aresult[0]
  3209. EndFunc
  3210.  
  3211. Func _winapi_getsyscolorbrush($iindex)
  3212. Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex)
  3213. If @error Then Return SetError(@error, @extended, 0)
  3214. Return $aresult[0]
  3215. EndFunc
  3216.  
  3217. Func _winapi_getsystemmetrics($iindex)
  3218. Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex)
  3219. If @error Then Return SetError(@error, @extended, 0)
  3220. Return $aresult[0]
  3221. EndFunc
  3222.  
  3223. Func _winapi_gettextextentpoint32($hdc, $stext)
  3224. Local $tsize = DllStructCreate($tagsize)
  3225. Local $isize = StringLen($stext)
  3226. Local $aret = DllCall("gdi32.dll", "bool", "GetTexPoint32Woint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "struct*", $tsize)
  3227. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  3228. Return $tsize
  3229. EndFunc
  3230.  
  3231. Func _winapi_gettextmetrics($hdc)
  3232. Local $ttextmetric = DllStructCreate($tagtextmetric)
  3233. Local $aret = DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric)
  3234. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  3235. Return $ttextmetric
  3236. EndFunc
  3237.  
  3238. Func _winapi_getwindow($hwnd, $icmd)
  3239. Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd)
  3240. If @error Then Return SetError(@error, @extended, 0)
  3241. Return $aresult[0]
  3242. EndFunc
  3243.  
  3244. Func _winapi_getwindowdc($hwnd)
  3245. Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd)
  3246. If @error Then Return SetError(@error, @extended, 0)
  3247. Return $aresult[0]
  3248. EndFunc
  3249.  
  3250. Func _winapi_getwindowheight($hwnd)
  3251. Local $trect = _winapi_getwindowrect($hwnd)
  3252. If @error Then Return SetError(@error, @extended, 0)
  3253. Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  3254. EndFunc
  3255.  
  3256. Func _winapi_getwindowlong($hwnd, $iindex)
  3257. Local $sfuncname = "GetWindowLongW"
  3258. If @AutoItX64 Then $sfuncname = "GeLongPtrWongPtrW"
  3259. Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex)
  3260. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  3261. Return $aresult[0]
  3262. EndFunc
  3263.  
  3264. Func _winapi_getwindowplacement($hwnd)
  3265. Local $twindowplacement = DllStructCreate($taglacementacement)
  3266. DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
  3267. Local $aret = DllCall("user32.dll", "bool", "Getlacementacement", "hwnd", $hwnd, "struct*", $twindowplacement)
  3268. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  3269. Return $twindowplacement
  3270. EndFunc
  3271.  
  3272. Func _winapi_getwindowrect($hwnd)
  3273. Local $trect = DllStructCreate($tagrect)
  3274. Local $aret = DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "struct*", $trect)
  3275. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  3276. Return $trect
  3277. EndFunc
  3278.  
  3279. Func _winapi_getwindowrgn($hwnd, $hrgn)
  3280. Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn)
  3281. If @error Then Return SetError(@error, @extended, 0)
  3282. Return $aresult[0]
  3283. EndFunc
  3284.  
  3285. Func _winapi_getwindowtext($hwnd)
  3286. Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  3287. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  3288. Return SetExtended($aresult[0], $aresult[2])
  3289. EndFunc
  3290.  
  3291. Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid)
  3292. Local $aresult = DllCall("user32.dll", "dword", "GetWindowrocessIrocessId", "hwnd", $hwnd, "dword*", 0)
  3293. If @error Then Return SetError(@error, @extended, 0)
  3294. $ipid = $aresult[2]
  3295. Return $aresult[0]
  3296. EndFunc
  3297.  
  3298. Func _winapi_getwindowwidth($hwnd)
  3299. Local $trect = _winapi_getwindowrect($hwnd)
  3300. If @error Then Return SetError(@error, @extended, 0)
  3301. Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  3302. EndFunc
  3303.  
  3304. Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
  3305. $ix = DllStructGetData($tpoint, "X")
  3306. $iy = DllStructGetData($tpoint, "Y")
  3307. EndFunc
  3308.  
  3309. Func _winapi_globalmemorystatus()
  3310. Local $tmem = DllStructCreate($tastatusextatusex)
  3311. DllStructSetData($tmem, 1, DllStructGetSize($tmem))
  3312. Local $aret = DllCall("kernel32.dll", "bool", "GlobaStatusExtatusEx", "struct*", $tmem)
  3313. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  3314. Local $amem[7]
  3315. $amem[0] = DllStructGetData($tmem, 2)
  3316. $amem[1] = DllStructGetData($tmem, 3)
  3317. $amem[2] = DllStructGetData($tmem, 4)
  3318. $amem[3] = DllStructGetData($tmem, 5)
  3319. $amem[4] = DllStructGetData($tmem, 6)
  3320. $amem[5] = DllStructGetData($tmem, 7)
  3321. $amem[6] = DllStructGetData($tmem, 8)
  3322. Return $amem
  3323. EndFunc
  3324.  
  3325. Func _winapi_guidfromstring($sguid)
  3326. Local $tguid = DllStructCreate($tagguid)
  3327. _winapi_guidfromstringex($sguid, $tguid)
  3328. If @error Then Return SetError(@error + 10, @extended, 0)
  3329. Return $tguid
  3330. EndFunc
  3331.  
  3332. Func _winapi_guidfromstringex($sguid, $pguid)
  3333. Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $pguid)
  3334. If @error Then Return SetError(@error, @extended, False)
  3335. Return $aresult[0]
  3336. EndFunc
  3337.  
  3338. Func _winapi_hiword($ilong)
  3339. Return BitShift($ilong, 16)
  3340. EndFunc
  3341.  
  3342. Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
  3343. If $hwnd = $hlastwnd Then Return True
  3344. For $ii = $__g_ais_winapi_winapi[0][0] To 1 Step -1
  3345. If $hwnd = $__g_ais_winapi_winapi[$ii][0] Then
  3346. If $__g_ais_winapi_winapi[$ii][1] Then
  3347. $hlastwnd = $hwnd
  3348. Return True
  3349. Else
  3350. Return False
  3351. EndIf
  3352. EndIf
  3353. Next
  3354. Local $ipid
  3355. _winapi_getwindowthreadprocessid($hwnd, $ipid)
  3356. Local $icount = $__g_ais_winapi_winapi[0][0] + 1
  3357. If $icount >= 64 Then $icount = 1
  3358. $__g_ais_winapi_winapi[0][0] = $icount
  3359. $__g_ais_winapi_winapi[$icount][0] = $hwnd
  3360. $__g_ais_winapi_winapi[$icount][1] = ($ipid = @AutoItPID)
  3361. Return $__g_ais_winapi_winapi[$icount][1]
  3362. EndFunc
  3363.  
  3364. Func _winapi_inttofloat($iint)
  3365. Local $tint = DllStructCreate("int")
  3366. Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint))
  3367. DllStructSetData($tint, 1, $iint)
  3368. Return DllStructGetData($tfloat, 1)
  3369. EndFunc
  3370.  
  3371. Func _winapi_isclassname($hwnd, $sclassname)
  3372. Local $sseparator = Opt("GUIDaatorChartorChar")
  3373. Local $aclassname = StringSplit($sclassname, $sseparator)
  3374. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  3375. Local $sclasscheck = _winapi_getclassname($hwnd)
  3376. For $x = 1 To UBound($aclassname) - 1
  3377. If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True
  3378. Next
  3379. Return False
  3380. EndFunc
  3381.  
  3382. Func _winapi_iswindow($hwnd)
  3383. Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd)
  3384. If @error Then Return SetError(@error, @extended, 0)
  3385. Return $aresult[0]
  3386. EndFunc
  3387.  
  3388. Func _winapi_iswindowvisible($hwnd)
  3389. Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  3390. If @error Then Return SetError(@error, @extended, 0)
  3391. Return $aresult[0]
  3392. EndFunc
  3393.  
  3394. Func _winapi_invalidaterect($hwnd, $trect = 0, $berase = True)
  3395. Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $berase)
  3396. If @error Then Return SetError(@error, @extended, False)
  3397. Return $aresult[0]
  3398. EndFunc
  3399.  
  3400. Func _winapi_lineto($hdc, $ix, $iy)
  3401. Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy)
  3402. If @error Then Return SetError(@error, @extended, False)
  3403. Return $aresult[0]
  3404. EndFunc
  3405.  
  3406. Func _winapi_loadbitmap($hinstance, $sbitmap)
  3407. Local $sbitmaptype = "int"
  3408. If IsString($sbitmap) Then $sbitmaptype = "wstr"
  3409. Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap)
  3410. If @error Then Return SetError(@error, @extended, 0)
  3411. Return $aresult[0]
  3412. EndFunc
  3413.  
  3414. Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload)
  3415. Local $aresult, $simagetype = "int"
  3416. If IsString($simage) Then $simagetype = "wstr"
  3417. $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload)
  3418. If @error Then Return SetError(@error, @extended, 0)
  3419. Return $aresult[0]
  3420. EndFunc
  3421.  
  3422. Func _winapi_loadlibrary($sfilename)
  3423. Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename)
  3424. If @error Then Return SetError(@error, @extended, 0)
  3425. Return $aresult[0]
  3426. EndFunc
  3427.  
  3428. Func _winapi_loadlibraryex($sfilename, $iflags = 0)
  3429. Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
  3430. If @error Then Return SetError(@error, @extended, 0)
  3431. Return $aresult[0]
  3432. EndFunc
  3433.  
  3434. Func _winapi_loadshell32icon($iiconid)
  3435. Local $ticons = DllStructCreate("ptr Data")
  3436. Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $ticons, 1)
  3437. If @error Then Return SetError(@error, @extended, 0)
  3438. If $iicons <= 0 Then Return SetError(10, 0, 0)
  3439. Return DllStructGetData($ticons, "Data")
  3440. EndFunc
  3441.  
  3442. Func _winapi_loadstring($hinstance, $istringid)
  3443. Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
  3444. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  3445. Return SetExtended($aresult[0], $aresult[3])
  3446. EndFunc
  3447.  
  3448. Func _winapi_localfree($hmem)
  3449. Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmem)
  3450. If @error Then Return SetError(@error, @extended, False)
  3451. Return $aresult[0]
  3452. EndFunc
  3453.  
  3454. Func _winapi_loword($ilong)
  3455. Return BitAND($ilong, 65535)
  3456. EndFunc
  3457.  
  3458. Func _winapi_makelangid($iprimary, $isub)
  3459. Return BitOR(BitShift($isub, -10), $iprimary)
  3460. EndFunc
  3461.  
  3462. Func _winapi_makelcid($ilgid, $isrtid)
  3463. Return BitOR(BitShift($isrtid, -16), $ilgid)
  3464. EndFunc
  3465.  
  3466. Func _winapi_makelong($ilo, $ihi)
  3467. Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
  3468. EndFunc
  3469.  
  3470. Func _winapi_makeqword($ilodword, $ihidword)
  3471. Local $tint64 = DllStructCreate("uint64")
  3472. Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  3473. DllStructSetData($tdwords, 1, $ilodword)
  3474. DllStructSetData($tdwords, 2, $ihidword)
  3475. Return DllStructGetData($tint64, 1)
  3476. EndFunc
  3477.  
  3478. Func _winapi_messagebeep($itype = 1)
  3479. Local $isound
  3480. Switch $itype
  3481. Case 1
  3482. $isound = 0
  3483. Case 2
  3484. $isound = 16
  3485. Case 3
  3486. $isound = 32
  3487. Case 4
  3488. $isound = 48
  3489. Case 5
  3490. $isound = 64
  3491. Case Else
  3492. $isound = -1
  3493. EndSwitch
  3494. Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
  3495. If @error Then Return SetError(@error, @extended, False)
  3496. Return $aresult[0]
  3497. EndFunc
  3498.  
  3499. Func _winapi_msgbox($iflags, $stitle, $stext)
  3500. BlockInput(0)
  3501. MsgBox($iflags, $stitle, $stext & " ")
  3502. EndFunc
  3503.  
  3504. Func _winapi_mouse_event($iflags, $ix = 0, $iy = 0, $idata = 0, $iextrainfo = 0)
  3505. DllCall("user32.dll", "none", "mouse_event", "dword", $iflags, "dword", $ix, "dword", $iy, "dword", $idata, "ulong_ptr", $iextrainfo)
  3506. If @error Then Return SetError(@error, @extended)
  3507. EndFunc
  3508.  
  3509. Func _winapi_moveto($hdc, $ix, $iy)
  3510. Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0)
  3511. If @error Then Return SetError(@error, @extended, False)
  3512. Return $aresult[0]
  3513. EndFunc
  3514.  
  3515. Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $brepaint = True)
  3516. Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $brepaint)
  3517. If @error Then Return SetError(@error, @extended, False)
  3518. Return $aresult[0]
  3519. EndFunc
  3520.  
  3521. Func _winapi_muldiv($inumber, $inumerator, $idenominator)
  3522. Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator)
  3523. If @error Then Return SetError(@error, @extended, -1)
  3524. Return $aresult[0]
  3525. EndFunc
  3526.  
  3527. Func _winapi_multibytetowidechar($stext, $icodepage = 0, $iflags = 0, $bretstring = False)
  3528. Local $stexttype = "str"
  3529. If NOT IsString($stext) Then $stexttype = "struct*"
  3530. Local $aresult = DllCall("kernel32.dll", "int", "MultWideCharideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "ptr", 0, "int", 0)
  3531. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  3532. Local $iout = $aresult[0]
  3533. Local $tout = DllStructCreate("wchar[" & $iout & "]")
  3534. $aresult = DllCall("kernel32.dll", "int", "MultWideCharideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "struct*", $tout, "int", $iout)
  3535. If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, 0)
  3536. If $bretstring Then Return DllStructGetData($tout, 1)
  3537. Return $tout
  3538. EndFunc
  3539.  
  3540. Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0)
  3541. Local $aresult = DllCall("kernel32.dll", "int", "MultWideCharideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "struct*", $ptext, "int", (StringLen($stext) + 1) * 2)
  3542. If @error Then Return SetError(@error, @extended, False)
  3543. Return $aresult[0]
  3544. EndFunc
  3545.  
  3546. Func _winapi_openprocess($iaccess, $binherit, $ipid, $bdebugpriv = False)
  3547. Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid)
  3548. If @error Then Return SetError(@error, @extended, 0)
  3549. If $aresult[0] Then Return $aresult[0]
  3550. If NOT $bdebugpriv Then Return SetError(100, 0, 0)
  3551. Local $htoken = _security__openthreadtokenex(BitOR($token_adivilegesvileges, $token_query))
  3552. If @error Then Return SetError(@error + 10, @extended, 0)
  3553. _security__setprivilege($htoken, "SeDebugPrivilege", True)
  3554. Local $ierror = @error
  3555. Local $iextended = @extended
  3556. Local $iret = 0
  3557. If NOT @error Then
  3558. $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid)
  3559. $ierror = @error
  3560. $iextended = @extended
  3561. If $aresult[0] Then $iret = $aresult[0]
  3562. _security__setprivilege($htoken, "SeDebugPrivilege", False)
  3563. If @error Then
  3564. $ierror = @error + 20
  3565. $iextended = @extended
  3566. EndIf
  3567. Else
  3568. $ierror = @error + 30
  3569. EndIf
  3570. _winapi_closehandle($htoken)
  3571. Return SetError($ierror, $iextended, $iret)
  3572. EndFunc
  3573.  
  3574. Func __winapi_parsefiledialogpath($spath)
  3575. Local $afiles[3]
  3576. $afiles[0] = 2
  3577. Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1)
  3578. $afiles[1] = $stemp
  3579. $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1)
  3580. Return $afiles
  3581. EndFunc
  3582.  
  3583. Func _winapi_pathfindonpath(Const $sfile, $aextrapaths = "", Const $spathdelimiter = @LF)
  3584. Local $iextracount = 0
  3585. If IsString($aextrapaths) Then
  3586. If StringLen($aextrapaths) Then
  3587. $aextrapaths = StringSplit($aextrapaths, $spathdelimiter, $str_entiresplit + $str_nocount)
  3588. $iextracount = UBound($aextrapaths, $ubound_rows)
  3589. EndIf
  3590. ElseIf IsArray($aextrapaths) Then
  3591. $iextracount = UBound($aextrapaths)
  3592. EndIf
  3593. Local $tpaths, $tpathptrs
  3594. If $iextracount Then
  3595. Local $tagstruct = ""
  3596. For $path In $aextrapaths
  3597. $tagstruct &= "wchar[" & StringLen($path) + 1 & "];"
  3598. Next
  3599. $tpaths = DllStructCreate($tagstruct)
  3600. $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
  3601. For $i = 1 To $iextracount
  3602. DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
  3603. DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
  3604. Next
  3605. DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
  3606. EndIf
  3607. Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $sfile, "struct*", $tpathptrs)
  3608. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, $sfile)
  3609. Return $aresult[1]
  3610. EndFunc
  3611.  
  3612. Func _winapi_pointfromrect(ByRef $trect, $bcenter = True)
  3613. Local $ix1 = DllStructGetData($trect, "Left")
  3614. Local $iy1 = DllStructGetData($trect, "Top")
  3615. Local $ix2 = DllStructGetData($trect, "Right")
  3616. Local $iy2 = DllStructGetData($trect, "Bottom")
  3617. If $bcenter Then
  3618. $ix1 = $ix1 + (($ix2 - $ix1) / 2)
  3619. $iy1 = $iy1 + (($iy2 - $iy1) / 2)
  3620. EndIf
  3621. Local $tpoint = DllStructCreate($tagpoint)
  3622. DllStructSetData($tpoint, "X", $ix1)
  3623. DllStructSetData($tpoint, "Y", $iy1)
  3624. Return $tpoint
  3625. EndFunc
  3626.  
  3627. Func _winapi_postmessage($hwnd, $imsg, $iwparam, $ilparam)
  3628. Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  3629. If @error Then Return SetError(@error, @extended, False)
  3630. Return $aresult[0]
  3631. EndFunc
  3632.  
  3633. Func _winapi_primarylangid($ilgid)
  3634. Return BitAND($ilgid, 1023)
  3635. EndFunc
  3636.  
  3637. Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
  3638. Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint)
  3639. If @error Then Return SetError(@error, @extended, False)
  3640. Return $aresult[0]
  3641. EndFunc
  3642.  
  3643. Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $poverlapped = 0)
  3644. Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itoread, "dword*", 0, "ptr", $poverlapped)
  3645. If @error Then Return SetError(@error, @extended, False)
  3646. $iread = $aresult[4]
  3647. Return $aresult[0]
  3648. EndFunc
  3649.  
  3650. Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
  3651. Local $aresult = DllCall("kernel32.dll", "bool", "RessMemorysMemory", "handle", $hprocess, "ptr", $pbaseaddress, "ptr", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  3652. If @error Then Return SetError(@error, @extended, False)
  3653. $iread = $aresult[5]
  3654. Return $aresult[0]
  3655. EndFunc
  3656.  
  3657. Func _winapi_rectisempty(ByRef $trect)
  3658. Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0)
  3659. EndFunc
  3660.  
  3661. Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
  3662. Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "struct*", $trect, "handle", $hregion, "uint", $iflags)
  3663. If @error Then Return SetError(@error, @extended, False)
  3664. Return $aresult[0]
  3665. EndFunc
  3666.  
  3667. Func _winapi_registerwindowmessage($smessage)
  3668. Local $aresult = DllCall("user32.dll", "uint", "RegisteMessageWessageW", "wstr", $smessage)
  3669. If @error Then Return SetError(@error, @extended, 0)
  3670. Return $aresult[0]
  3671. EndFunc
  3672.  
  3673. Func _winapi_releasecapture()
  3674. Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture")
  3675. If @error Then Return SetError(@error, @extended, False)
  3676. Return $aresult[0]
  3677. EndFunc
  3678.  
  3679. Func _winapi_releasedc($hwnd, $hdc)
  3680. Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  3681. If @error Then Return SetError(@error, @extended, False)
  3682. Return $aresult[0]
  3683. EndFunc
  3684.  
  3685. Func _winapi_screentoclient($hwnd, ByRef $tpoint)
  3686. Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "struct*", $tpoint)
  3687. If @error Then Return SetError(@error, @extended, False)
  3688. Return $aresult[0]
  3689. EndFunc
  3690.  
  3691. Func _winapi_selectobject($hdc, $hgdiobj)
  3692. Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj)
  3693. If @error Then Return SetError(@error, @extended, False)
  3694. Return $aresult[0]
  3695. EndFunc
  3696.  
  3697. Func _winapi_setbkcolor($hdc, $icolor)
  3698. Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "INT", $icolor)
  3699. If @error Then Return SetError(@error, @extended, -1)
  3700. Return $aresult[0]
  3701. EndFunc
  3702.  
  3703. Func _winapi_setbkmode($hdc, $ibkmode)
  3704. Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode)
  3705. If @error Then Return SetError(@error, @extended, 0)
  3706. Return $aresult[0]
  3707. EndFunc
  3708.  
  3709. Func _winapi_setcapture($hwnd)
  3710. Local $aresult = DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hwnd)
  3711. If @error Then Return SetError(@error, @extended, 0)
  3712. Return $aresult[0]
  3713. EndFunc
  3714.  
  3715. Func _winapi_setcursor($hcursor)
  3716. Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor)
  3717. If @error Then Return SetError(@error, @extended, 0)
  3718. Return $aresult[0]
  3719. EndFunc
  3720.  
  3721. Func _winapi_setdefaultprinter($sprinter)
  3722. Local $aresult = DllCall("winspool.drv", "bool", "SetPrinterWrinterW", "wstr", $sprinter)
  3723. If @error Then Return SetError(@error, @extended, False)
  3724. Return $aresult[0]
  3725. EndFunc
  3726.  
  3727. Func _winapi_setdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbmi, $icoloruse = 0)
  3728. Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbmi, "INT", $icoloruse)
  3729. If @error Then Return SetError(@error, @extended, False)
  3730. Return $aresult[0]
  3731. EndFunc
  3732.  
  3733. Func _winapi_setendoffile($hfile)
  3734. Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile)
  3735. If @error Then Return SetError(@error, @extended, False)
  3736. Return $aresult[0]
  3737. EndFunc
  3738.  
  3739. Func _winapi_setevent($hevent)
  3740. Local $aresult = DllCall("kernel32.dll", "bool", "SetEvent", "handle", $hevent)
  3741. If @error Then Return SetError(@error, @extended, False)
  3742. Return $aresult[0]
  3743. EndFunc
  3744.  
  3745. Func _winapi_setfilepointer($hfile, $ipos, $imethod = 0)
  3746. Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod)
  3747. If @error Then Return SetError(@error, @extended, -1)
  3748. Return $aresult[0]
  3749. EndFunc
  3750.  
  3751. Func _winapi_setfocus($hwnd)
  3752. Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd)
  3753. If @error Then Return SetError(@error, @extended, 0)
  3754. Return $aresult[0]
  3755. EndFunc
  3756.  
  3757. Func _winapi_setfont($hwnd, $hfont, $bredraw = True)
  3758. _sendmessage($hwnd, $__winapicons_setfon_setfont, $hfont, $bredraw, 0, "hwnd")
  3759. EndFunc
  3760.  
  3761. Func _winapi_sethandleinformation($hobject, $imask, $iflags)
  3762. Local $aresult = DllCall("kernel32.dll", "bool", "SetHaormationrmation", "handle", $hobject, "dword", $imask, "dword", $iflags)
  3763. If @error Then Return SetError(@error, @extended, False)
  3764. Return $aresult[0]
  3765. EndFunc
  3766.  
  3767. Func _winapi_setlayeredwindowattributes($hwnd, $itranscolor, $itransgui = 255, $iflags = 3, $bcolorref = False)
  3768. If $iflags = Default OR $iflags = "" OR $iflags < 0 Then $iflags = 3
  3769. If NOT $bcolorref Then
  3770. $itranscolor = Int(BinaryMid($itranscolor, 3, 1) & BinaryMid($itranscolor, 2, 1) & BinaryMid($itranscolor, 1, 1))
  3771. EndIf
  3772. Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWtributetributes", "hwnd", $hwnd, "INT", $itranscolor, "byte", $itransgui, "dword", $iflags)
  3773. If @error Then Return SetError(@error, @extended, False)
  3774. Return $aresult[0]
  3775. EndFunc
  3776.  
  3777. Func _winapi_setparent($hwndchild, $hwndparent)
  3778. Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent)
  3779. If @error Then Return SetError(@error, @extended, 0)
  3780. Return $aresult[0]
  3781. EndFunc
  3782.  
  3783. Func _winapi_setprocessaffinitymask($hprocess, $imask)
  3784. Local $aresult = DllCall("kernel32.dll", "bool", "SetProcnityMaskityMask", "handle", $hprocess, "ulong_ptr", $imask)
  3785. If @error Then Return SetError(@error, @extended, False)
  3786. Return $aresult[0]
  3787. EndFunc
  3788.  
  3789. Func _winapi_setsyscolors($velements, $vcolors)
  3790. Local $bisearray = IsArray($velements), $biscarray = IsArray($vcolors)
  3791. Local $ielementnum
  3792. If NOT $biscarray AND NOT $bisearray Then
  3793. $ielementnum = 1
  3794. ElseIf $biscarray OR $bisearray Then
  3795. If NOT $biscarray OR NOT $bisearray Then Return SetError(-1, -1, False)
  3796. If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
  3797. $ielementnum = UBound($velements)
  3798. EndIf
  3799. Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
  3800. Local $tcolors = DllStructCreate("INT NewColor[" & $ielementnum & "]")
  3801. If NOT $bisearray Then
  3802. DllStructSetData($telements, "Element", $velements, 1)
  3803. Else
  3804. For $x = 0 To $ielementnum - 1
  3805. DllStructSetData($telements, "Element", $velements[$x], $x + 1)
  3806. Next
  3807. EndIf
  3808. If NOT $biscarray Then
  3809. DllStructSetData($tcolors, "NewColor", $vcolors, 1)
  3810. Else
  3811. For $x = 0 To $ielementnum - 1
  3812. DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
  3813. Next
  3814. EndIf
  3815. Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "struct*", $telements, "struct*", $tcolors)
  3816. If @error Then Return SetError(@error, @extended, False)
  3817. Return $aresult[0]
  3818. EndFunc
  3819.  
  3820. Func _winapi_settextcolor($hdc, $icolor)
  3821. Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "INT", $icolor)
  3822. If @error Then Return SetError(@error, @extended, -1)
  3823. Return $aresult[0]
  3824. EndFunc
  3825.  
  3826. Func _winapi_setwindowlong($hwnd, $iindex, $ivalue)
  3827. _winapi_setlasterror(0)
  3828. Local $sfuncname = "SetWindowLongW"
  3829. If @AutoItX64 Then $sfuncname = "SeLongPtrWongPtrW"
  3830. Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue)
  3831. If @error Then Return SetError(@error, @extended, 0)
  3832. Return $aresult[0]
  3833. EndFunc
  3834.  
  3835. Func _winapi_setwindowplacement($hwnd, $pwindowplacement)
  3836. Local $aresult = DllCall("user32.dll", "bool", "Setlacementacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
  3837. If @error Then Return SetError(@error, @extended, False)
  3838. Return $aresult[0]
  3839. EndFunc
  3840.  
  3841. Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags)
  3842. Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags)
  3843. If @error Then Return SetError(@error, @extended, False)
  3844. Return $aresult[0]
  3845. EndFunc
  3846.  
  3847. Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True)
  3848. Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw)
  3849. If @error Then Return SetError(@error, @extended, False)
  3850. Return $aresult[0]
  3851. EndFunc
  3852.  
  3853. Func _winapi_setwindowshookex($idhook, $pfn, $hmod, $ithreadid = 0)
  3854. Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $idhook, "ptr", $pfn, "handle", $hmod, "dword", $ithreadid)
  3855. If @error Then Return SetError(@error, @extended, 0)
  3856. Return $aresult[0]
  3857. EndFunc
  3858.  
  3859. Func _winapi_setwindowtext($hwnd, $stext)
  3860. Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext)
  3861. If @error Then Return SetError(@error, @extended, False)
  3862. Return $aresult[0]
  3863. EndFunc
  3864.  
  3865. Func _winapi_showcursor($bshow)
  3866. Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $bshow)
  3867. If @error Then Return SetError(@error, @extended, 0)
  3868. Return $aresult[0]
  3869. EndFunc
  3870.  
  3871. Func _winapi_showerror($stext, $bexit = True)
  3872. _winapi_msgbox($mb_systemmodal, "Error", $stext)
  3873. If $bexit Then Exit
  3874. EndFunc
  3875.  
  3876. Func _winapi_showmsg($stext)
  3877. _winapi_msgbox($mb_systemmodal, "Information", $stext)
  3878. EndFunc
  3879.  
  3880. Func _winapi_showwindow($hwnd, $icmdshow = 5)
  3881. Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow)
  3882. If @error Then Return SetError(@error, @extended, False)
  3883. Return $aresult[0]
  3884. EndFunc
  3885.  
  3886. Func _winapi_stringfromguid($pguid)
  3887. Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $pguid, "wstr", "", "int", 40)
  3888. If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  3889. Return SetExtended($aresult[0], $aresult[2])
  3890. EndFunc
  3891.  
  3892. Func _winapi_stringlena(Const ByRef $tstring)
  3893. Local $aresult = DllCall("kernel32.dll", "int", "lstrlenA", "struct*", $tstring)
  3894. If @error Then Return SetError(@error, @extended, 0)
  3895. Return $aresult[0]
  3896. EndFunc
  3897.  
  3898. Func _winapi_stringlenw(Const ByRef $tstring)
  3899. Local $aresult = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $tstring)
  3900. If @error Then Return SetError(@error, @extended, 0)
  3901. Return $aresult[0]
  3902. EndFunc
  3903.  
  3904. Func _winapi_sublangid($ilgid)
  3905. Return BitShift($ilgid, 10)
  3906. EndFunc
  3907.  
  3908. Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0)
  3909. Local $aresult = DllCall("user32.dll", "bool", "SystemersInfoWrsInfoW", "uint", $iaction, "uint", $iparam, "ptr", $vparam, "uint", $iwinini)
  3910. If @error Then Return SetError(@error, @extended, False)
  3911. Return $aresult[0]
  3912. EndFunc
  3913.  
  3914. Func _winapi_twipsperpixelx()
  3915. Local $hdc, $itwipsperpixelx
  3916. $hdc = _winapi_getdc(0)
  3917. $itwipsperpixelx = 1440 / _winapi_getdevicecaps($hdc, $__winapiconsgpixelsgpixelsx)
  3918. _winapi_releasedc(0, $hdc)
  3919. Return $itwipsperpixelx
  3920. EndFunc
  3921.  
  3922. Func _winapi_twipsperpixely()
  3923. Local $hdc, $itwipsperpixely
  3924. $hdc = _winapi_getdc(0)
  3925. $itwipsperpixely = 1440 / _winapi_getdevicecaps($hdc, $__winapiconsgpixelsgpixelsy)
  3926. _winapi_releasedc(0, $hdc)
  3927. Return $itwipsperpixely
  3928. EndFunc
  3929.  
  3930. Func _winapi_unhookwindowshookex($hhk)
  3931. Local $aresult = DllCall("user32.dll", "bool", "UnhowsHookExsHookEx", "handle", $hhk)
  3932. If @error Then Return SetError(@error, @extended, False)
  3933. Return $aresult[0]
  3934. EndFunc
  3935.  
  3936. Func _winapi_updatelayeredwindow($hwnd, $hdcdest, $pptdest, $psize, $hdcsrce, $pptsrce, $irgb, $pblend, $iflags)
  3937. Local $aresult = DllCall("user32.dll", "bool", "UpdaedWindowdWindow", "hwnd", $hwnd, "handle", $hdcdest, "ptr", $pptdest, "ptr", $psize, "handle", $hdcsrce, "ptr", $pptsrce, "dword", $irgb, "ptr", $pblend, "dword", $iflags)
  3938. If @error Then Return SetError(@error, @extended, False)
  3939. Return $aresult[0]
  3940. EndFunc
  3941.  
  3942. Func _winapi_updatewindow($hwnd)
  3943. Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd)
  3944. If @error Then Return SetError(@error, @extended, False)
  3945. Return $aresult[0]
  3946. EndFunc
  3947.  
  3948. Func _winapi_waitforinputidle($hprocess, $itimeout = -1)
  3949. Local $aresult = DllCall("user32.dll", "dword", "WaitForInputIdle", "handle", $hprocess, "dword", $itimeout)
  3950. If @error Then Return SetError(@error, @extended, False)
  3951. Return $aresult[0]
  3952. EndFunc
  3953.  
  3954. Func _winapi_waitformultipleobjects($icount, $phandles, $bwaitall = False, $itimeout = -1)
  3955. Local $aresult = DllCall("kernel32.dll", "INT", "WaitForeObjectsObjects", "dword", $icount, "ptr", $phandles, "bool", $bwaitall, "dword", $itimeout)
  3956. If @error Then Return SetError(@error, @extended, -1)
  3957. Return $aresult[0]
  3958. EndFunc
  3959.  
  3960. Func _winapi_waitforsingleobject($hhandle, $itimeout = -1)
  3961. Local $aresult = DllCall("kernel32.dll", "INT", "WaitleObjecteObject", "handle", $hhandle, "dword", $itimeout)
  3962. If @error Then Return SetError(@error, @extended, -1)
  3963. Return $aresult[0]
  3964. EndFunc
  3965.  
  3966. Func _winapi_widechartomultibyte($punicode, $icodepage = 0, $bretstring = True)
  3967. Local $sunicodetype = "wstr"
  3968. If NOT IsString($punicode) Then $sunicodetype = "struct*"
  3969. Local $aresult = DllCall("kernel32.dll", "int", "WideultiByteltiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
  3970. If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, "")
  3971. Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]")
  3972. $aresult = DllCall("kernel32.dll", "int", "WideultiByteltiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
  3973. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  3974. If $bretstring Then Return DllStructGetData($tmultibyte, 1)
  3975. Return $tmultibyte
  3976. EndFunc
  3977.  
  3978. Func _winapi_windowfrompoint(ByRef $tpoint)
  3979. Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint)
  3980. If @error Then Return SetError(@error, @extended, 0)
  3981. Return $aresult[0]
  3982. EndFunc
  3983.  
  3984. Func _winapi_writeconsole($hconsole, $stext)
  3985. Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0)
  3986. If @error Then Return SetError(@error, @extended, False)
  3987. Return $aresult[0]
  3988. EndFunc
  3989.  
  3990. Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $poverlapped = 0)
  3991. Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itowrite, "dword*", 0, "ptr", $poverlapped)
  3992. If @error Then Return SetError(@error, @extended, False)
  3993. $iwritten = $aresult[4]
  3994. Return $aresult[0]
  3995. EndFunc
  3996.  
  3997. Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr")
  3998. Local $aresult = DllCall("kernel32.dll", "bool", "WrissMemorysMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  3999. If @error Then Return SetError(@error, @extended, False)
  4000. $iwritten = $aresult[5]
  4001. Return $aresult[0]
  4002. EndFunc
  4003.  
  4004. Global Const $_udf_gs_offset_offset = 2
  4005. Global Const $_udf_g_max_winmax_win = 16
  4006. Global Const $_udf_startid = 10000
  4007. Global Const $_udf_g_max_idsmax_ids = 55535
  4008. Global Const $__udfguicons_tabsto_tabstop = 65536
  4009. Global Const $__udfguicons_visibl_visible = 268435456
  4010. Global Const $__udfguicows_chilws_child = 1073741824
  4011. Global $__g_audfids_usedds_used[$_udf_g_max_winmax_win][$_udf_g_max_idsmax_ids + $_udf_gs_offset_offset + 1]
  4012.  
  4013. Func __udf_getnextglobalid($hwnd)
  4014. Local $nctrlid, $iusedindex = -1, $ballused = True
  4015. If NOT WinExists($hwnd) Then Return SetError(-1, -1, 0)
  4016. For $iindex = 0 To $_udf_g_max_winmax_win - 1
  4017. If $__g_audfids_usedds_used[$iindex][0] <> 0 Then
  4018. If NOT WinExists($__g_audfids_usedds_used[$iindex][0]) Then
  4019. For $x = 0 To UBound($__g_audfids_usedds_used, $ubound_columns) - 1
  4020. $__g_audfids_usedds_used[$iindex][$x] = 0
  4021. Next
  4022. $__g_audfids_usedds_used[$iindex][1] = $_udf_startid
  4023. $ballused = False
  4024. EndIf
  4025. EndIf
  4026. Next
  4027. For $iindex = 0 To $_udf_g_max_winmax_win - 1
  4028. If $__g_audfids_usedds_used[$iindex][0] = $hwnd Then
  4029. $iusedindex = $iindex
  4030. ExitLoop
  4031. EndIf
  4032. Next
  4033. If $iusedindex = -1 Then
  4034. For $iindex = 0 To $_udf_g_max_winmax_win - 1
  4035. If $__g_audfids_usedds_used[$iindex][0] = 0 Then
  4036. $__g_audfids_usedds_used[$iindex][0] = $hwnd
  4037. $__g_audfids_usedds_used[$iindex][1] = $_udf_startid
  4038. $ballused = False
  4039. $iusedindex = $iindex
  4040. ExitLoop
  4041. EndIf
  4042. Next
  4043. EndIf
  4044. If $iusedindex = -1 AND $ballused Then Return SetError(16, 0, 0)
  4045. If $__g_audfids_usedds_used[$iusedindex][1] = $_udf_startid + $_udf_g_max_idsmax_ids Then
  4046. For $iidindex = $_udf_gs_offset_offset To UBound($__g_audfids_usedds_used, $ubound_columns) - 1
  4047. If $__g_audfids_usedds_used[$iusedindex][$iidindex] = 0 Then
  4048. $nctrlid = ($iidindex - $_udf_gs_offset_offset) + 10000
  4049. $__g_audfids_usedds_used[$iusedindex][$iidindex] = $nctrlid
  4050. Return $nctrlid
  4051. EndIf
  4052. Next
  4053. Return SetError(-1, $_udf_g_max_idsmax_ids, 0)
  4054. EndIf
  4055. $nctrlid = $__g_audfids_usedds_used[$iusedindex][1]
  4056. $__g_audfids_usedds_used[$iusedindex][1] += 1
  4057. $__g_audfids_usedds_used[$iusedindex][($nctrlid - 10000) + $_udf_gs_offset_offset] = $nctrlid
  4058. Return $nctrlid
  4059. EndFunc
  4060.  
  4061. Func __udf_freeglobalid($hwnd, $iglobalid)
  4062. If $iglobalid - $_udf_startid < 0 OR $iglobalid - $_udf_startid > $_udf_g_max_idsmax_ids Then Return SetError(-1, 0, False)
  4063. For $iindex = 0 To $_udf_g_max_winmax_win - 1
  4064. If $__g_audfids_usedds_used[$iindex][0] = $hwnd Then
  4065. For $x = $_udf_gs_offset_offset To UBound($__g_audfids_usedds_used, $ubound_columns) - 1
  4066. If $__g_audfids_usedds_used[$iindex][$x] = $iglobalid Then
  4067. $__g_audfids_usedds_used[$iindex][$x] = 0
  4068. Return True
  4069. EndIf
  4070. Next
  4071. Return SetError(-3, 0, False)
  4072. EndIf
  4073. Next
  4074. Return SetError(-2, 0, False)
  4075. EndFunc
  4076.  
  4077. Global $__g_hsblastwnd
  4078. Global Const $__statusbarconlassnamlassname = "msctusbar32usbar32"
  4079. Global Const $__statusbarc_wm_siz_wm_size = 5
  4080. Global Const $__statusbarconst_defaul_default = -16777216
  4081. Global Const $tagborders = "int BY;int RX;int RX"
  4082.  
  4083. Func _guictrlstatusbar_create($hwnd, $vpartedge = -1, $vparttext = "", $istyles = -1, $iexstyles = -1)
  4084. If NOT IsHWnd($hwnd) Then Return SetError(1, 0, 0)
  4085. Local $istyle = BitOR($__udfguicows_chilws_child, $__udfguicons_visibl_visible)
  4086. If $istyles = -1 Then $istyles = 0
  4087. If $iexstyles = -1 Then $iexstyles = 0
  4088. Local $apartwidth[1], $aparttext[1]
  4089. If @NumParams > 1 Then
  4090. If IsArray($vpartedge) Then
  4091. $apartwidth = $vpartedge
  4092. Else
  4093. $apartwidth[0] = $vpartedge
  4094. EndIf
  4095. If @NumParams = 2 Then
  4096. ReDim $aparttext[UBound($apartwidth)]
  4097. Else
  4098. If IsArray($vparttext) Then
  4099. $aparttext = $vparttext
  4100. Else
  4101. $aparttext[0] = $vparttext
  4102. EndIf
  4103. If UBound($apartwidth) <> UBound($aparttext) Then
  4104. Local $ilast
  4105. If UBound($apartwidth) > UBound($aparttext) Then
  4106. $ilast = UBound($aparttext)
  4107. ReDim $aparttext[UBound($apartwidth)]
  4108. For $x = $ilast To UBound($aparttext) - 1
  4109. $apartwidth[$x] = ""
  4110. Next
  4111. Else
  4112. $ilast = UBound($apartwidth)
  4113. ReDim $apartwidth[UBound($aparttext)]
  4114. For $x = $ilast To UBound($apartwidth) - 1
  4115. $apartwidth[$x] = $apartwidth[$x - 1] + 75
  4116. Next
  4117. $apartwidth[UBound($aparttext) - 1] = -1
  4118. EndIf
  4119. EndIf
  4120. EndIf
  4121. If NOT IsHWnd($hwnd) Then $hwnd = HWnd($hwnd)
  4122. If @NumParams > 3 Then $istyle = BitOR($istyle, $istyles)
  4123. EndIf
  4124. Local $nctrlid = __udf_getnextglobalid($hwnd)
  4125. If @error Then Return SetError(@error, @extended, 0)
  4126. Local $hwndsbar = _winapi_createwindowex($iexstyles, $__statusbarconlassnamlassname, "", $istyle, 0, 0, 0, 0, $hwnd, $nctrlid)
  4127. If @error Then Return SetError(@error, @extended, 0)
  4128. If @NumParams > 1 Then
  4129. _guictrlstatusbar_setparts($hwndsbar, UBound($apartwidth), $apartwidth)
  4130. For $x = 0 To UBound($aparttext) - 1
  4131. _guictrlstatusbar_settext($hwndsbar, $aparttext[$x], $x)
  4132. Next
  4133. EndIf
  4134. Return $hwndsbar
  4135. EndFunc
  4136.  
  4137. Func _guictrlstatusbar_destroy(ByRef $hwnd)
  4138. If NOT _winapi_isclassname($hwnd, $__statusbarconlassnamlassname) Then Return SetError(2, 2, False)
  4139. Local $idestroyed = 0
  4140. If IsHWnd($hwnd) Then
  4141. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4142. Local $nctrlid = _winapi_getdlgctrlid($hwnd)
  4143. Local $hparent = _winapi_getparent($hwnd)
  4144. $idestroyed = _winapi_destroywindow($hwnd)
  4145. Local $iret = __udf_freeglobalid($hparent, $nctrlid)
  4146. If NOT $iret Then
  4147. EndIf
  4148. Else
  4149. Return SetError(1, 1, False)
  4150. EndIf
  4151. EndIf
  4152. If $idestroyed Then $hwnd = 0
  4153. Return $idestroyed <> 0
  4154. EndFunc
  4155.  
  4156. Func _guictrlstatusbar_embedcontrol($hwnd, $ipart, $hcontrol, $ifit = 4)
  4157. Local $arect = _guictrlstatusbar_getrect($hwnd, $ipart)
  4158. Local $ibarx = $arect[0]
  4159. Local $ibary = $arect[1]
  4160. Local $ibarw = $arect[2] - $ibarx
  4161. Local $ibarh = $arect[3] - $ibary
  4162. Local $iconx = $ibarx
  4163. Local $icony = $ibary
  4164. Local $iconw = _winapi_getwindowwidth($hcontrol)
  4165. Local $iconh = _winapi_getwindowheight($hcontrol)
  4166. If $iconw > $ibarw Then $iconw = $ibarw
  4167. If $iconh > $ibarh Then $iconh = $ibarh
  4168. Local $ipadx = ($ibarw - $iconw) / 2
  4169. Local $ipady = ($ibarh - $iconh) / 2
  4170. If $ipadx < 0 Then $ipadx = 0
  4171. If $ipady < 0 Then $ipady = 0
  4172. If BitAND($ifit, 1) = 1 Then $iconx = $ibarx + $ipadx
  4173. If BitAND($ifit, 2) = 2 Then $icony = $ibary + $ipady
  4174. If BitAND($ifit, 4) = 4 Then
  4175. $ipadx = _guictrlstatusbar_getbordersrect($hwnd)
  4176. $ipady = _guictrlstatusbar_getbordersvert($hwnd)
  4177. $iconx = $ibarx
  4178. If _guictrlstatusbar_issimple($hwnd) Then $iconx += $ipadx
  4179. $icony = $ibary + $ipady
  4180. $iconw = $ibarw - ($ipadx * 2)
  4181. $iconh = $ibarh - ($ipady * 2)
  4182. EndIf
  4183. _winapi_setparent($hcontrol, $hwnd)
  4184. _winapi_movewindow($hcontrol, $iconx, $icony, $iconw, $iconh)
  4185. EndFunc
  4186.  
  4187. Func _guictrlstatusbar_getborders($hwnd)
  4188. Local $tborders = DllStructCreate($tagborders)
  4189. Local $iret
  4190. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4191. $iret = _sendmessage($hwnd, $sb_getborders, 0, $tborders, 0, "wparam", "struct*")
  4192. Else
  4193. Local $isize = DllStructGetSize($tborders)
  4194. Local $tmemmap
  4195. Local $pmemory = _meminit($hwnd, $isize, $tmemmap)
  4196. $iret = _sendmessage($hwnd, $sb_getborders, 0, $pmemory, 0, "wparam", "ptr")
  4197. _memread($tmemmap, $pmemory, $tborders, $isize)
  4198. _memfree($tmemmap)
  4199. EndIf
  4200. Local $aborders[3]
  4201. If $iret = 0 Then Return SetError(-1, -1, $aborders)
  4202. $aborders[0] = DllStructGetData($tborders, "BX")
  4203. $aborders[1] = DllStructGetData($tborders, "BY")
  4204. $aborders[2] = DllStructGetData($tborders, "RX")
  4205. Return $aborders
  4206. EndFunc
  4207.  
  4208. Func _guictrlstatusbar_getbordershorz($hwnd)
  4209. Local $aborders = _guictrlstatusbar_getborders($hwnd)
  4210. Return SetError(@error, @extended, $aborders[0])
  4211. EndFunc
  4212.  
  4213. Func _guictrlstatusbar_getbordersrect($hwnd)
  4214. Local $aborders = _guictrlstatusbar_getborders($hwnd)
  4215. Return SetError(@error, @extended, $aborders[2])
  4216. EndFunc
  4217.  
  4218. Func _guictrlstatusbar_getbordersvert($hwnd)
  4219. Local $aborders = _guictrlstatusbar_getborders($hwnd)
  4220. Return SetError(@error, @extended, $aborders[1])
  4221. EndFunc
  4222.  
  4223. Func _guictrlstatusbar_getcount($hwnd)
  4224. Return _sendmessage($hwnd, $sb_getparts)
  4225. EndFunc
  4226.  
  4227. Func _guictrlstatusbar_getheight($hwnd)
  4228. Local $trect = _guictrlstatusbar_getrectex($hwnd, 0)
  4229. Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top") - (_guictrlstatusbar_getbordersvert($hwnd) * 2)
  4230. EndFunc
  4231.  
  4232. Func _guictrlstatusbar_geticon($hwnd, $iindex = 0)
  4233. Return _sendmessage($hwnd, $sb_geticon, $iindex, 0, 0, "wparam", "lparam", "handle")
  4234. EndFunc
  4235.  
  4236. Func _guictrlstatusbar_getparts($hwnd)
  4237. Local $icount = _guictrlstatusbar_getcount($hwnd)
  4238. Local $tparts = DllStructCreate("int[" & $icount & "]")
  4239. Local $aparts[$icount + 1]
  4240. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4241. $aparts[0] = _sendmessage($hwnd, $sb_getparts, $icount, $tparts, 0, "wparam", "struct*")
  4242. Else
  4243. Local $iparts = DllStructGetSize($tparts)
  4244. Local $tmemmap
  4245. Local $pmemory = _meminit($hwnd, $iparts, $tmemmap)
  4246. $aparts[0] = _sendmessage($hwnd, $sb_getparts, $icount, $pmemory, 0, "wparam", "ptr")
  4247. _memread($tmemmap, $pmemory, $tparts, $iparts)
  4248. _memfree($tmemmap)
  4249. EndIf
  4250. For $ii = 1 To $icount
  4251. $aparts[$ii] = DllStructGetData($tparts, 1, $ii)
  4252. Next
  4253. Return $aparts
  4254. EndFunc
  4255.  
  4256. Func _guictrlstatusbar_getrect($hwnd, $ipart)
  4257. Local $trect = _guictrlstatusbar_getrectex($hwnd, $ipart)
  4258. If @error Then Return SetError(@error, 0, 0)
  4259. Local $arect[4]
  4260. $arect[0] = DllStructGetData($trect, "Left")
  4261. $arect[1] = DllStructGetData($trect, "Top")
  4262. $arect[2] = DllStructGetData($trect, "Right")
  4263. $arect[3] = DllStructGetData($trect, "Bottom")
  4264. Return $arect
  4265. EndFunc
  4266.  
  4267. Func _guictrlstatusbar_getrectex($hwnd, $ipart)
  4268. Local $trect = DllStructCreate($tagrect)
  4269. Local $iret
  4270. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4271. $iret = _sendmessage($hwnd, $sb_getrect, $ipart, $trect, 0, "wparam", "struct*")
  4272. Else
  4273. Local $irect = DllStructGetSize($trect)
  4274. Local $tmemmap
  4275. Local $pmemory = _meminit($hwnd, $irect, $tmemmap)
  4276. $iret = _sendmessage($hwnd, $sb_getrect, $ipart, $pmemory, 0, "wparam", "ptr")
  4277. _memread($tmemmap, $pmemory, $trect, $irect)
  4278. _memfree($tmemmap)
  4279. EndIf
  4280. Return SetError($iret = 0, 0, $trect)
  4281. EndFunc
  4282.  
  4283. Func _guictrlstatusbar_gettext($hwnd, $ipart)
  4284. Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  4285. Local $ibuffer = _guictrlstatusbar_gettextlength($hwnd, $ipart) + 1
  4286. If $ibuffer = 1 Then Return SetError(1, 0, "")
  4287. Local $tbuffer
  4288. If $bunicode Then
  4289. $tbuffer = DllStructCreate("wchar Text[" & $ibuffer & "]")
  4290. $ibuffer *= 2
  4291. Else
  4292. $tbuffer = DllStructCreate("char Text[" & $ibuffer & "]")
  4293. EndIf
  4294. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4295. _sendmessage($hwnd, $sb_gettextw, $ipart, $tbuffer, 0, "wparam", "struct*")
  4296. Else
  4297. Local $tmemmap
  4298. Local $pmemory = _meminit($hwnd, $ibuffer, $tmemmap)
  4299. If $bunicode Then
  4300. _sendmessage($hwnd, $sb_gettextw, $ipart, $pmemory, 0, "wparam", "ptr")
  4301. Else
  4302. _sendmessage($hwnd, $sb_gettext, $ipart, $pmemory, 0, "wparam", "ptr")
  4303. EndIf
  4304. _memread($tmemmap, $pmemory, $tbuffer, $ibuffer)
  4305. _memfree($tmemmap)
  4306. EndIf
  4307. Return DllStructGetData($tbuffer, "Text")
  4308. EndFunc
  4309.  
  4310. Func _guictrlstatusbar_gettextflags($hwnd, $ipart)
  4311. If _guictrlstatusbar_getunicodeformat($hwnd) Then
  4312. Return _sendmessage($hwnd, $sbtlengthwlengthw, $ipart)
  4313. Else
  4314. Return _sendmessage($hwnd, $sb_gettextlength, $ipart)
  4315. EndIf
  4316. EndFunc
  4317.  
  4318. Func _guictrlstatusbar_gettextlength($hwnd, $ipart)
  4319. Return _winapi_loword(_guictrlstatusbar_gettextflags($hwnd, $ipart))
  4320. EndFunc
  4321.  
  4322. Func _guictrlstatusbar_gettextlengthex($hwnd, $ipart)
  4323. Return _winapi_hiword(_guictrlstatusbar_gettextflags($hwnd, $ipart))
  4324. EndFunc
  4325.  
  4326. Func _guictrlstatusbar_gettiptext($hwnd, $ipart)
  4327. Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  4328. Local $tbuffer
  4329. If $bunicode Then
  4330. $tbuffer = DllStructCreate("wchar Text[4096]")
  4331. Else
  4332. $tbuffer = DllStructCreate("char Text[4096]")
  4333. EndIf
  4334. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4335. _sendmessage($hwnd, $sb_gettiptextw, _winapi_makelong($ipart, 4096), $tbuffer, 0, "wparam", "struct*")
  4336. Else
  4337. Local $tmemmap
  4338. Local $pmemory = _meminit($hwnd, 4096, $tmemmap)
  4339. If $bunicode Then
  4340. _sendmessage($hwnd, $sb_gettiptextw, _winapi_makelong($ipart, 4096), $pmemory, 0, "wparam", "ptr")
  4341. Else
  4342. _sendmessage($hwnd, $sb_gettiptexta, _winapi_makelong($ipart, 4096), $pmemory, 0, "wparam", "ptr")
  4343. EndIf
  4344. _memread($tmemmap, $pmemory, $tbuffer, 4096)
  4345. _memfree($tmemmap)
  4346. EndIf
  4347. Return DllStructGetData($tbuffer, "Text")
  4348. EndFunc
  4349.  
  4350. Func _guictrlstatusbar_getunicodeformat($hwnd)
  4351. Return _sendmessage($hwnd, $sb_gdeformateformat) <> 0
  4352. EndFunc
  4353.  
  4354. Func _guictrlstatusbar_getwidth($hwnd, $ipart)
  4355. Local $trect = _guictrlstatusbar_getrectex($hwnd, $ipart)
  4356. Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") - (_guictrlstatusbar_getbordershorz($hwnd) * 2)
  4357. EndFunc
  4358.  
  4359. Func _guictrlstatusbar_issimple($hwnd)
  4360. Return _sendmessage($hwnd, $sb_issimple) <> 0
  4361. EndFunc
  4362.  
  4363. Func _guictrlstatusbar_resize($hwnd)
  4364. _sendmessage($hwnd, $__statusbarc_wm_siz_wm_size)
  4365. EndFunc
  4366.  
  4367. Func _guictrlstatusbar_setbkcolor($hwnd, $icolor)
  4368. $icolor = _sendmessage($hwnd, $sb_setbkcolor, 0, $icolor)
  4369. If $icolor = $__statusbarconst_defaul_default Then Return "0x" & Hex($__statusbarconst_defaul_default)
  4370. Return $icolor
  4371. EndFunc
  4372.  
  4373. Func _guictrlstatusbar_seticon($hwnd, $ipart, $hicon = -1, $siconfile = "")
  4374. If $hicon = -1 Then Return _sendmessage($hwnd, $sb_seticon, $ipart, $hicon, 0, "wparam", "handle") <> 0
  4375. If StringLen($siconfile) <= 0 Then Return _sendmessage($hwnd, $sb_seticon, $ipart, $hicon) <> 0
  4376. Local $ticon = DllStructCreate("handle")
  4377. Local $vresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $siconfile, "int", $hicon, "ptr", 0, "struct*", $ticon, "uint", 1)
  4378. If @error Then Return SetError(@error, @extended, False)
  4379. $vresult = $vresult[0]
  4380. If $vresult > 0 Then $vresult = _sendmessage($hwnd, $sb_seticon, $ipart, DllStructGetData($ticon, 1), 0, "wparam", "handle")
  4381. DllCall("user32.dll", "bool", "DestroyIcon", "handle", DllStructGetData($ticon, 1))
  4382. Return $vresult
  4383. EndFunc
  4384.  
  4385. Func _guictrlstatusbar_setminheight($hwnd, $iminheight)
  4386. _sendmessage($hwnd, $sb_setminheight, $iminheight)
  4387. _guictrlstatusbar_resize($hwnd)
  4388. EndFunc
  4389.  
  4390. Func _guictrlstatusbar_setparts($hwnd, $aparts = -1, $apartwidth = 25)
  4391. Local $tparts, $iparts = 1
  4392. If IsArray($aparts) <> 0 Then
  4393. $aparts[UBound($aparts) - 1] = -1
  4394. $iparts = UBound($aparts)
  4395. $tparts = DllStructCreate("int[" & $iparts & "]")
  4396. For $x = 0 To $iparts - 2
  4397. DllStructSetData($tparts, 1, $aparts[$x], $x + 1)
  4398. Next
  4399. DllStructSetData($tparts, 1, -1, $iparts)
  4400. ElseIf IsArray($apartwidth) <> 0 Then
  4401. $iparts = UBound($apartwidth)
  4402. $tparts = DllStructCreate("int[" & $iparts & "]")
  4403. For $x = 0 To $iparts - 2
  4404. DllStructSetData($tparts, 1, $apartwidth[$x], $x + 1)
  4405. Next
  4406. DllStructSetData($tparts, 1, -1, $iparts)
  4407. ElseIf $aparts > 1 Then
  4408. $iparts = $aparts
  4409. $tparts = DllStructCreate("int[" & $iparts & "]")
  4410. For $x = 1 To $iparts - 1
  4411. DllStructSetData($tparts, 1, $apartwidth * $x, $x)
  4412. Next
  4413. DllStructSetData($tparts, 1, -1, $iparts)
  4414. Else
  4415. $tparts = DllStructCreate("int")
  4416. DllStructSetData($tparts, $iparts, -1)
  4417. EndIf
  4418. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4419. _sendmessage($hwnd, $sb_setparts, $iparts, $tparts, 0, "wparam", "struct*")
  4420. Else
  4421. Local $isize = DllStructGetSize($tparts)
  4422. Local $tmemmap
  4423. Local $pmemory = _meminit($hwnd, $isize, $tmemmap)
  4424. _memwrite($tmemmap, $tparts)
  4425. _sendmessage($hwnd, $sb_setparts, $iparts, $pmemory, 0, "wparam", "ptr")
  4426. _memfree($tmemmap)
  4427. EndIf
  4428. _guictrlstatusbar_resize($hwnd)
  4429. Return True
  4430. EndFunc
  4431.  
  4432. Func _guictrlstatusbar_setsimple($hwnd, $bsimple = True)
  4433. _sendmessage($hwnd, $sb_simple, $bsimple)
  4434. EndFunc
  4435.  
  4436. Func _guictrlstatusbar_settext($hwnd, $stext = "", $ipart = 0, $iuflag = 0)
  4437. Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  4438. Local $ibuffer = StringLen($stext) + 1
  4439. Local $ttext
  4440. If $bunicode Then
  4441. $ttext = DllStructCreate("wchar Text[" & $ibuffer & "]")
  4442. $ibuffer *= 2
  4443. Else
  4444. $ttext = DllStructCreate("char Text[" & $ibuffer & "]")
  4445. EndIf
  4446. DllStructSetData($ttext, "Text", $stext)
  4447. If _guictrlstatusbar_issimple($hwnd) Then $ipart = $sb_simpleid
  4448. Local $iret
  4449. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4450. $iret = _sendmessage($hwnd, $sb_settextw, BitOR($ipart, $iuflag), $ttext, 0, "wparam", "struct*")
  4451. Else
  4452. Local $tmemmap
  4453. Local $pmemory = _meminit($hwnd, $ibuffer, $tmemmap)
  4454. _memwrite($tmemmap, $ttext)
  4455. If $bunicode Then
  4456. $iret = _sendmessage($hwnd, $sb_settextw, BitOR($ipart, $iuflag), $pmemory, 0, "wparam", "ptr")
  4457. Else
  4458. $iret = _sendmessage($hwnd, $sb_settext, BitOR($ipart, $iuflag), $pmemory, 0, "wparam", "ptr")
  4459. EndIf
  4460. _memfree($tmemmap)
  4461. EndIf
  4462. Return $iret <> 0
  4463. EndFunc
  4464.  
  4465. Func _guictrlstatusbar_settiptext($hwnd, $ipart, $stext)
  4466. Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  4467. Local $ibuffer = StringLen($stext) + 1
  4468. Local $ttext
  4469. If $bunicode Then
  4470. $ttext = DllStructCreate("wchar TipText[" & $ibuffer & "]")
  4471. $ibuffer *= 2
  4472. Else
  4473. $ttext = DllStructCreate("char TipText[" & $ibuffer & "]")
  4474. EndIf
  4475. DllStructSetData($ttext, "TipText", $stext)
  4476. If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  4477. _sendmessage($hwnd, $sb_settiptextw, $ipart, $ttext, 0, "wparam", "struct*")
  4478. Else
  4479. Local $tmemmap
  4480. Local $pmemory = _meminit($hwnd, $ibuffer, $tmemmap)
  4481. _memwrite($tmemmap, $ttext, $pmemory, $ibuffer)
  4482. If $bunicode Then
  4483. _sendmessage($hwnd, $sb_settiptextw, $ipart, $pmemory, 0, "wparam", "ptr")
  4484. Else
  4485. _sendmessage($hwnd, $sb_settiptexta, $ipart, $pmemory, 0, "wparam", "ptr")
  4486. EndIf
  4487. _memfree($tmemmap)
  4488. EndIf
  4489. EndFunc
  4490.  
  4491. Func _guictrlstatusbar_setunicodeformat($hwnd, $bunicode = True)
  4492. Return _sendmessage($hwnd, $sb_sdeformateformat, $bunicode)
  4493. EndFunc
  4494.  
  4495. Func _guictrlstatusbar_showhide($hwnd, $istate)
  4496. If $istate <> @SW_HIDE AND $istate <> @SW_SHOW Then Return SetError(1, 1, False)
  4497. Return _winapi_showwindow($hwnd, $istate)
  4498. EndFunc
  4499.  
  4500. Global Const $ttf_idishwnd = 1
  4501. Global Const $ttf_centertip = 2
  4502. Global Const $ttf_rtlreading = 4
  4503. Global Const $ttf_subclass = 16
  4504. Global Const $ttf_track = 32
  4505. Global Const $ttf_absolute = 128
  4506. Global Const $ttf_transparent = 256
  4507. Global Const $ttf_parselinks = 4096
  4508. Global Const $ttf_di_setitem = 32768
  4509. Global Const $__tooltipco_wm_use_wm_user = 1024
  4510. Global Const $ttm_activate = $__tooltipco_wm_use_wm_user + 1
  4511. Global Const $ttm_setdelaytime = $__tooltipco_wm_use_wm_user + 3
  4512. Global Const $ttm_addtool = $__tooltipco_wm_use_wm_user + 4
  4513. Global Const $ttm_deltool = $__tooltipco_wm_use_wm_user + 5
  4514. Global Const $ttm_newtoolrect = $__tooltipco_wm_use_wm_user + 6
  4515. Global Const $ttm_gettoolinfo = $__tooltipco_wm_use_wm_user + 8
  4516. Global Const $ttm_settoolinfo = $__tooltipco_wm_use_wm_user + 9
  4517. Global Const $ttm_hittest = $__tooltipco_wm_use_wm_user + 10
  4518. Global Const $ttm_gettext = $__tooltipco_wm_use_wm_user + 11
  4519. Global Const $ttetiptexttiptext = $__tooltipco_wm_use_wm_user + 12
  4520. Global Const $ttm_gettoolcount = $__tooltipco_wm_use_wm_user + 13
  4521. Global Const $ttm_enumtools = $__tooltipco_wm_use_wm_user + 14
  4522. Global Const $ttmrenttoolenttool = $__tooltipco_wm_use_wm_user + 15
  4523. Global Const $ttm_rompointompoint = $__tooltipco_wm_use_wm_user + 16
  4524. Global Const $ttactivatectivate = $__tooltipco_wm_use_wm_user + 17
  4525. Global Const $ttpositionosition = $__tooltipco_wm_use_wm_user + 18
  4526. Global Const $ttpbkcolorbkcolor = $__tooltipco_wm_use_wm_user + 19
  4527. Global Const $ttm_extcolorxtcolor = $__tooltipco_wm_use_wm_user + 20
  4528. Global Const $ttm_getdelaytime = $__tooltipco_wm_use_wm_user + 21
  4529. Global Const $ttpbkcolorbkcolor = $__tooltipco_wm_use_wm_user + 22
  4530. Global Const $ttm_extcolorxtcolor = $__tooltipco_wm_use_wm_user + 23
  4531. Global Const $ttmtipwidthipwidth = $__tooltipco_wm_use_wm_user + 24
  4532. Global Const $ttmtipwidthipwidth = $__tooltipco_wm_use_wm_user + 25
  4533. Global Const $ttm_setmargin = $__tooltipco_wm_use_wm_user + 26
  4534. Global Const $ttm_getmargin = $__tooltipco_wm_use_wm_user + 27
  4535. Global Const $ttm_pop = $__tooltipco_wm_use_wm_user + 28
  4536. Global Const $ttm_update = $__tooltipco_wm_use_wm_user + 29
  4537. Global Const $ttbblesizeblesize = $__tooltipco_wm_use_wm_user + 30
  4538. Global Const $ttm_adjustrect = $__tooltipco_wm_use_wm_user + 31
  4539. Global Const $ttm_settitle = $__tooltipco_wm_use_wm_user + 32
  4540. Global Const $ttm_settitlew = $__tooltipco_wm_use_wm_user + 33
  4541. Global Const $ttm_popup = $__tooltipco_wm_use_wm_user + 34
  4542. Global Const $ttm_gettitle = $__tooltipco_wm_use_wm_user + 35
  4543. Global Const $ttm_addtoolw = $__tooltipco_wm_use_wm_user + 50
  4544. Global Const $ttm_deltoolw = $__tooltipco_wm_use_wm_user + 51
  4545. Global Const $ttm_newtoolrectw = $__tooltipco_wm_use_wm_user + 52
  4546. Global Const $ttm_gettoolinfow = $__tooltipco_wm_use_wm_user + 53
  4547. Global Const $ttm_settoolinfow = $__tooltipco_wm_use_wm_user + 54
  4548. Global Const $ttm_hittestw = $__tooltipco_wm_use_wm_user + 55
  4549. Global Const $ttm_gettextw = $__tooltipco_wm_use_wm_user + 56
  4550. Global Const $ttmtiptextwiptextw = $__tooltipco_wm_use_wm_user + 57
  4551. Global Const $ttm_enumtoolsw = $__tooltipco_wm_use_wm_user + 58
  4552. Global Const $ttm_enttoolwnttoolw = $__tooltipco_wm_use_wm_user + 59
  4553. Global Const $ttmdowthemeowtheme = 8192 + 11
  4554. Global Const $ttn_first = -520
  4555. Global Const $ttn_getdispinfo = $ttn_first + 0
  4556. Global Const $ttn_show = $ttn_first - 1
  4557. Global Const $ttn_pop = $ttn_first - 2
  4558. Global Const $ttn_linkclick = $ttn_first - 3
  4559. Global Const $ttn_getdispinfow = $ttn_first - 10
  4560. Global Const $tts_alwaystip = 1
  4561. Global Const $tts_noprefix = 2
  4562. Global Const $tts_noanimate = 16
  4563. Global Const $tts_nofade = 32
  4564. Global Const $tts_balloon = 64
  4565. Global Const $tts_close = 128
  4566. Global Const $ttsualstylealstyle = 256
  4567. Global Const $ttdt_automatic = 0
  4568. Global Const $ttdt_reshow = 1
  4569. Global Const $ttdt_autopop = 2
  4570. Global Const $ttdt_initial = 3
  4571. Global Enum $tti_none, $tti_info, $tti_warning, $tti_error, $tti_info_large, $ttng_largeg_large, $tti_error_large
  4572. Global $__g_heditlastwnd
  4573. Global Const $__editconlassnamlassname = "Edit"
  4574. Global Const $__editconst_checke_checked = 1
  4575. Global Const $__editcogui_hideui_hide = 32
  4576. Global Const $__editconstant_nt_closnt_close = -3
  4577. Global Const $__editconsi_enabli_enable = 64
  4578. Global Const $__editconst_disabl_disable = 128
  4579. Global Const $__editcons_centes_center = 1
  4580. Global Const $__editconstaetredraetredraw = 11
  4581. Global Const $__editcons_captio_caption = 12582912
  4582. Global Const $__editcows_popups_popup = -2147483648
  4583. Global Const $__editcons_sysmen_sysmenu = 524288
  4584. Global Const $__editconstantimizeboimizebox = 131072
  4585. Global Const $__editconstant_dgui_fongui_font = 17
  4586. Global Const $__editcons_setfon_setfont = 48
  4587. Global Const $__editconstant_wxtlengtxtlength = 14
  4588. Global Const $__editcons_gettex_gettext = 13
  4589. Global Const $__editcons_settex_settext = 12
  4590. Global Const $__editconb_lineub_lineup = 0
  4591. Global Const $__editconstlinedowlinedown = 1
  4592. Global Const $__editconstpagedowpagedown = 3
  4593. Global Const $__editconb_pageub_pageup = 2
  4594. Global Const $__editconstantollcareollcaret = 4
  4595. Global Const $__talloontiploontip = "dword r Te;ptr tint Icoint Iconnt Icon"
  4596.  
  4597. Func _guictrledit_appendtext($hwnd, $stext)
  4598. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4599. Local $ilength = _guictrledit_gettextlen($hwnd)
  4600. _guictrledit_setsel($hwnd, $ilength, $ilength)
  4601. _sendmessage($hwnd, $em_replacesel, True, $stext, 0, "wparam", "wstr")
  4602. EndFunc
  4603.  
  4604. Func _guictrledit_beginupdate($hwnd)
  4605. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4606. Return _sendmessage($hwnd, $__editconstaetredraetredraw, False) = 0
  4607. EndFunc
  4608.  
  4609. Func _guictrledit_canundo($hwnd)
  4610. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4611. Return _sendmessage($hwnd, $em_canundo) <> 0
  4612. EndFunc
  4613.  
  4614. Func _guictrledit_charfrompos($hwnd, $ix, $iy)
  4615. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4616. Local $areturn[2]
  4617. Local $iret = _sendmessage($hwnd, $em_charfrompos, 0, _winapi_makelong($ix, $iy))
  4618. $areturn[0] = _winapi_loword($iret)
  4619. $areturn[1] = _winapi_hiword($iret)
  4620. Return $areturn
  4621. EndFunc
  4622.  
  4623. Func _guictrledit_create($hwnd, $stext, $ix, $iy, $iwidth = 150, $iheight = 150, $istyle = 3150020, $iexstyle = 512)
  4624. If NOT IsHWnd($hwnd) Then Return SetError(1, 0, 0)
  4625. If NOT IsString($stext) Then Return SetError(2, 0, 0)
  4626. If $iwidth = -1 Then $iwidth = 150
  4627. If $iheight = -1 Then $iheight = 150
  4628. If $istyle = -1 Then $istyle = 3150020
  4629. If $iexstyle = -1 Then $iexstyle = 512
  4630. If BitAND($istyle, $es_readonly) = $es_readonly Then
  4631. $istyle = BitOR($__udfguicows_chilws_child, $__udfguicons_visibl_visible, $istyle)
  4632. Else
  4633. $istyle = BitOR($__udfguicows_chilws_child, $__udfguicons_visibl_visible, $__udfguicons_tabsto_tabstop, $istyle)
  4634. EndIf
  4635. Local $nctrlid = __udf_getnextglobalid($hwnd)
  4636. If @error Then Return SetError(@error, @extended, 0)
  4637. Local $hedit = _winapi_createwindowex($iexstyle, $__editconlassnamlassname, "", $istyle, $ix, $iy, $iwidth, $iheight, $hwnd, $nctrlid)
  4638. _sendmessage($hedit, $__editcons_setfon_setfont, _winapi_getstockobject($__editconstant_dgui_fongui_font), True)
  4639. _guictrledit_settext($hedit, $stext)
  4640. _guictrledit_setlimittext($hedit, 0)
  4641. Return $hedit
  4642. EndFunc
  4643.  
  4644. Func _guictrledit_destroy(ByRef $hwnd)
  4645. If NOT _winapi_isclassname($hwnd, $__editconlassnamlassname) Then Return SetError(2, 2, False)
  4646. Local $idestroyed = 0
  4647. If IsHWnd($hwnd) Then
  4648. If _winapi_inprocess($hwnd, $__g_heditlastwnd) Then
  4649. Local $nctrlid = _winapi_getdlgctrlid($hwnd)
  4650. Local $hparent = _winapi_getparent($hwnd)
  4651. $idestroyed = _winapi_destroywindow($hwnd)
  4652. Local $iret = __udf_freeglobalid($hparent, $nctrlid)
  4653. If NOT $iret Then
  4654. EndIf
  4655. Else
  4656. Return SetError(1, 1, False)
  4657. EndIf
  4658. Else
  4659. $idestroyed = GUICtrlDelete($hwnd)
  4660. EndIf
  4661. If $idestroyed Then $hwnd = 0
  4662. Return $idestroyed <> 0
  4663. EndFunc
  4664.  
  4665. Func _guictrledit_emptyundobuffer($hwnd)
  4666. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4667. _sendmessage($hwnd, $em_dobufferobuffer)
  4668. EndFunc
  4669.  
  4670. Func _guictrledit_endupdate($hwnd)
  4671. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4672. Return _sendmessage($hwnd, $__editconstaetredraetredraw, True) = 0
  4673. EndFunc
  4674.  
  4675. Func _guictrledit_fmtlines($hwnd, $bsoftbreak = False)
  4676. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4677. Return _sendmessage($hwnd, $em_fmtlines, $bsoftbreak)
  4678. EndFunc
  4679.  
  4680. Func _guictrledit_find($hwnd, $breplace = False)
  4681. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4682. Local $ipos = 0, $icase, $ioccurance = 0, $ireplacements = 0
  4683. Local $apartsrightedge[3] = [125, 225, -1]
  4684. Local $ioldmode = Opt("GUIOnEventMode", 0)
  4685. Local $asel = _guictrledit_getsel($hwnd)
  4686. Local $stext = _guictrledit_gettext($hwnd)
  4687. Local $hguisearch = GUICreate("Find", 349, 177, -1, -1, BitOR($__udfguicows_chilws_child, $__editconstantimizeboimizebox, $__editcons_captio_caption, $__editcows_popups_popup, $__editcons_sysmen_sysmenu))
  4688. Local $idstatusbar1 = _guictrlstatusbar_create($hguisearch, $apartsrightedge)
  4689. _guictrlstatusbar_settext($idstatusbar1, "Find: ")
  4690. GUISetIcon(@SystemDir & "\shell32.dll", 22, $hguisearch)
  4691. GUICtrlCreateLabel("Find what:", 9, 10, 53, 16, $__editcons_centes_center)
  4692. Local $idinputsearch = GUICtrlCreateInput("", 80, 8, 257, 21)
  4693. Local $idlblreplace = GUICtrlCreateLabel("Replace with:", 9, 42, 69, 17, $__editcons_centes_center)
  4694. Local $idinputreplace = GUICtrlCreateInput("", 80, 40, 257, 21)
  4695. Local $idchkwholeonly = GUICtrlCreateCheckbox("Match ord onlyrd only", 9, 72, 145, 17)
  4696. Local $idchkmatchcase = GUICtrlCreateCheckbox("Match case", 9, 96, 145, 17)
  4697. Local $idbtnfindnext = GUICtrlCreateButton("Find Next", 168, 72, 161, 21, 0)
  4698. Local $idbtnreplace = GUICtrlCreateButton("Replace", 168, 96, 161, 21, 0)
  4699. Local $idbtnclose = GUICtrlCreateButton("Close", 104, 130, 161, 21, 0)
  4700. If (IsArray($asel) AND $asel <> $ec_err) Then
  4701. GUICtrlSetData($idinputsearch, StringMid($stext, $asel[0] + 1, $asel[1] - $asel[0]))
  4702. If $asel[0] <> $asel[1] Then
  4703. $ipos = $asel[0]
  4704. If BitAND(GUICtrlRead($idchkmatchcase), $__editconst_checke_checked) = $__editconst_checke_checked Then $icase = 1
  4705. $ioccurance = 1
  4706. Local $itpose
  4707. While 1
  4708. $itpose = StringInStr($stext, GUICtrlRead($idinputsearch), $icase, $ioccurance)
  4709. If NOT $itpose Then
  4710. $ioccurance = 0
  4711. ExitLoop
  4712. ElseIf $itpose = $ipos + 1 Then
  4713. ExitLoop
  4714. EndIf
  4715. $ioccurance += 1
  4716. WEnd
  4717. EndIf
  4718. _guictrlstatusbar_settext($idstatusbar1, "Find: " & GUICtrlRead($idinputsearch))
  4719. EndIf
  4720. If $breplace = False Then
  4721. GUICtrlSetState($idlblreplace, $__editcogui_hideui_hide)
  4722. GUICtrlSetState($idinputreplace, $__editcogui_hideui_hide)
  4723. GUICtrlSetState($idbtnreplace, $__editcogui_hideui_hide)
  4724. Else
  4725. _guictrlstatusbar_settext($idstatusbar1, "Replacements: " & $ireplacements, 1)
  4726. _guictrlstatusbar_settext($idstatusbar1, "With: ", 2)
  4727. EndIf
  4728. GUISetState(@SW_SHOW)
  4729. Local $imsgfind
  4730. While 1
  4731. $imsgfind = GUIGetMsg()
  4732. Select
  4733. Case $imsgfind = $__editconstant_nt_closnt_close OR $imsgfind = $idbtnclose
  4734. ExitLoop
  4735. Case $imsgfind = $idbtnfindnext
  4736. GUICtrlSetState($idbtnfindnext, $__editconst_disabl_disable)
  4737. GUICtrlSetCursor($idbtnfindnext, 15)
  4738. Sleep(100)
  4739. _guictrlstatusbar_settext($idstatusbar1, "Find: " & GUICtrlRead($idinputsearch))
  4740. If $breplace = True Then
  4741. _guictrlstatusbar_settext($idstatusbar1, "Find: " & GUICtrlRead($idinputsearch))
  4742. _guictrlstatusbar_settext($idstatusbar1, "With: " & GUICtrlRead($idinputreplace), 2)
  4743. EndIf
  4744. __guictrledit_findtext($hwnd, $idinputsearch, $idchkmatchcase, $idchkwholeonly, $ipos, $ioccurance, $ireplacements)
  4745. Sleep(100)
  4746. GUICtrlSetState($idbtnfindnext, $__editconsi_enabli_enable)
  4747. GUICtrlSetCursor($idbtnfindnext, 2)
  4748. Case $imsgfind = $idbtnreplace
  4749. GUICtrlSetState($idbtnreplace, $__editconst_disabl_disable)
  4750. GUICtrlSetCursor($idbtnreplace, 15)
  4751. Sleep(100)
  4752. _guictrlstatusbar_settext($idstatusbar1, "Find: " & GUICtrlRead($idinputsearch))
  4753. _guictrlstatusbar_settext($idstatusbar1, "With: " & GUICtrlRead($idinputreplace), 2)
  4754. If $ipos Then
  4755. _guictrledit_replacesel($hwnd, GUICtrlRead($idinputreplace))
  4756. $ireplacements += 1
  4757. $ioccurance -= 1
  4758. _guictrlstatusbar_settext($idstatusbar1, "Replacements: " & $ireplacements, 1)
  4759. EndIf
  4760. __guictrledit_findtext($hwnd, $idinputsearch, $idchkmatchcase, $idchkwholeonly, $ipos, $ioccurance, $ireplacements)
  4761. Sleep(100)
  4762. GUICtrlSetState($idbtnreplace, $__editconsi_enabli_enable)
  4763. GUICtrlSetCursor($idbtnreplace, 2)
  4764. EndSelect
  4765. WEnd
  4766. GUIDelete($hguisearch)
  4767. Opt("GUIOnEventMode", $ioldmode)
  4768. EndFunc
  4769.  
  4770. Func __guictrledit_findtext($hwnd, $idinputsearch, $idchkmatchcase, $idchkwholeonly, ByRef $ipos, ByRef $ioccurance, ByRef $ireplacements)
  4771. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4772. Local $icase = 0, $iwhole = 0
  4773. Local $bexact = False
  4774. Local $sfind = GUICtrlRead($idinputsearch)
  4775. Local $stext = _guictrledit_gettext($hwnd)
  4776. If BitAND(GUICtrlRead($idchkmatchcase), $__editconst_checke_checked) = $__editconst_checke_checked Then $icase = 1
  4777. If BitAND(GUICtrlRead($idchkwholeonly), $__editconst_checke_checked) = $__editconst_checke_checked Then $iwhole = 1
  4778. If $sfind <> "" Then
  4779. $ioccurance += 1
  4780. $ipos = StringInStr($stext, $sfind, $icase, $ioccurance)
  4781. If $iwhole AND $ipos Then
  4782. Local $s_compare2 = StringMid($stext, $ipos + StringLen($sfind), 1)
  4783. If $ipos = 1 Then
  4784. If ($ipos + StringLen($sfind)) - 1 = StringLen($stext) OR ($s_compare2 = " " OR $s_compare2 = @LF OR $s_compare2 = @CR OR $s_compare2 = @CRLF OR $s_compare2 = @TAB) Then $bexact = True
  4785. Else
  4786. Local $s_compare1 = StringMid($stext, $ipos - 1, 1)
  4787. If ($ipos + StringLen($sfind)) - 1 = StringLen($stext) Then
  4788. If ($s_compare1 = " " OR $s_compare1 = @LF OR $s_compare1 = @CR OR $s_compare1 = @CRLF OR $s_compare1 = @TAB) Then $bexact = True
  4789. Else
  4790. If ($s_compare1 = " " OR $s_compare1 = @LF OR $s_compare1 = @CR OR $s_compare1 = @CRLF OR $s_compare1 = @TAB) AND ($s_compare2 = " " OR $s_compare2 = @LF OR $s_compare2 = @CR OR $s_compare2 = @CRLF OR $s_compare2 = @TAB) Then $bexact = True
  4791. EndIf
  4792. EndIf
  4793. If $bexact = False Then
  4794. __guictrledit_findtext($hwnd, $idinputsearch, $idchkmatchcase, $idchkwholeonly, $ipos, $ioccurance, $ireplacements)
  4795. Else
  4796. _guictrledit_setsel($hwnd, $ipos - 1, ($ipos + StringLen($sfind)) - 1)
  4797. _guictrledit_scroll($hwnd, $__editconstantollcareollcaret)
  4798. EndIf
  4799. ElseIf $iwhole AND NOT $ipos Then
  4800. $ioccurance = 0
  4801. MsgBox($mb_systemmodal, "Find", "Reached End of document, Caistringistring string '" & $sfind & "'")
  4802. ElseIf NOT $iwhole Then
  4803. If NOT $ipos Then
  4804. $ioccurance = 1
  4805. _guictrledit_setsel($hwnd, -1, 0)
  4806. _guictrledit_scroll($hwnd, $__editconstantollcareollcaret)
  4807. $ipos = StringInStr($stext, $sfind, $icase, $ioccurance)
  4808. If NOT $ipos Then
  4809. $ioccurance = 0
  4810. MsgBox($mb_systemmodal, "Find", "Reached End of document, Canntring ntring tring '" & $sfind & "'")
  4811. Else
  4812. _guictrledit_setsel($hwnd, $ipos - 1, ($ipos + StringLen($sfind)) - 1)
  4813. _guictrledit_scroll($hwnd, $__editconstantollcareollcaret)
  4814. EndIf
  4815. Else
  4816. _guictrledit_setsel($hwnd, $ipos - 1, ($ipos + StringLen($sfind)) - 1)
  4817. _guictrledit_scroll($hwnd, $__editconstantollcareollcaret)
  4818. EndIf
  4819. EndIf
  4820. EndIf
  4821. EndFunc
  4822.  
  4823. Func _guictrledit_getfirstvisibleline($hwnd)
  4824. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4825. Return _sendmessage($hwnd, $em_getfiblelinebleline)
  4826. EndFunc
  4827.  
  4828. Func _guictrledit_gethandle($hwnd)
  4829. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4830. Return Ptr(_sendmessage($hwnd, $em_gethandle))
  4831. EndFunc
  4832.  
  4833. Func _guictrledit_getimestatus($hwnd)
  4834. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4835. Return _sendmessage($hwnd, $em_getimestatus, $emsis_coonstringnstring)
  4836. EndFunc
  4837.  
  4838. Func _guictrledit_getlimittext($hwnd)
  4839. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4840. Return _sendmessage($hwnd, $em_getlimittext)
  4841. EndFunc
  4842.  
  4843. Func _guictrledit_getline($hwnd, $iline)
  4844. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4845. Local $ilength = _guictrledit_linelength($hwnd, $iline)
  4846. If $ilength = 0 Then Return ""
  4847. Local $tbuffer = DllStructCreate("short ar Text[r Text[" & $ilength & "]")
  4848. DllStructSetData($tbuffer, "Len", $ilength + 1)
  4849. Local $iret = _sendmessage($hwnd, $em_getline, $iline, $tbuffer, 0, "wparam", "struct*")
  4850. If $iret = 0 Then Return SetError($ec_err, $ec_err, "")
  4851. Local $ttext = DllStructCreate("wchar Text[" & $ilength & "]", DllStructGetPtr($tbuffer))
  4852. Return DllStructGetData($ttext, "Text")
  4853. EndFunc
  4854.  
  4855. Func _guictrledit_getlinecount($hwnd)
  4856. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4857. Return _sendmessage($hwnd, $em_getlinecount)
  4858. EndFunc
  4859.  
  4860. Func _guictrledit_getmargins($hwnd)
  4861. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4862. Local $amargins[2]
  4863. Local $imargins = _sendmessage($hwnd, $em_getmargins)
  4864. $amargins[0] = _winapi_loword($imargins)
  4865. $amargins[1] = _winapi_hiword($imargins)
  4866. Return $amargins
  4867. EndFunc
  4868.  
  4869. Func _guictrledit_getmodify($hwnd)
  4870. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4871. Return _sendmessage($hwnd, $em_getmodify) <> 0
  4872. EndFunc
  4873.  
  4874. Func _guictrledit_getpasswordchar($hwnd)
  4875. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4876. Return _sendmessage($hwnd, $em_wordcharordchar)
  4877. EndFunc
  4878.  
  4879. Func _guictrledit_getrect($hwnd)
  4880. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4881. Local $arect[4]
  4882. Local $trect = _guictrledit_getrectex($hwnd)
  4883. $arect[0] = DllStructGetData($trect, "Left")
  4884. $arect[1] = DllStructGetData($trect, "Top")
  4885. $arect[2] = DllStructGetData($trect, "Right")
  4886. $arect[3] = DllStructGetData($trect, "Bottom")
  4887. Return $arect
  4888. EndFunc
  4889.  
  4890. Func _guictrledit_getrectex($hwnd)
  4891. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4892. Local $trect = DllStructCreate($tagrect)
  4893. _sendmessage($hwnd, $em_getrect, 0, $trect, 0, "wparam", "struct*")
  4894. Return $trect
  4895. EndFunc
  4896.  
  4897. Func _guictrledit_getsel($hwnd)
  4898. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4899. Local $asel[2]
  4900. Local $tstart = DllStructCreate("uint Start")
  4901. Local $tend = DllStructCreate("uint End")
  4902. _sendmessage($hwnd, $em_getsel, $tstart, $tend, 0, "struct*", "struct*")
  4903. $asel[0] = DllStructGetData($tstart, "Start")
  4904. $asel[1] = DllStructGetData($tend, "End")
  4905. Return $asel
  4906. EndFunc
  4907.  
  4908. Func _guictrledit_gettext($hwnd)
  4909. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4910. Local $itextlen = _guictrledit_gettextlen($hwnd) + 1
  4911. Local $ttext = DllStructCreate("wchar Text[" & $itextlen & "]")
  4912. _sendmessage($hwnd, $__editcons_gettex_gettext, $itextlen, $ttext, 0, "wparam", "struct*")
  4913. Return DllStructGetData($ttext, "Text")
  4914. EndFunc
  4915.  
  4916. Func _guictrledit_gettextlen($hwnd)
  4917. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4918. Return _sendmessage($hwnd, $__editconstant_wxtlengtxtlength)
  4919. EndFunc
  4920.  
  4921. Func _guictrledit_getthumb($hwnd)
  4922. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4923. Return _sendmessage($hwnd, $em_getthumb)
  4924. EndFunc
  4925.  
  4926. Func _guictrledit_getwordbreakproc($hwnd)
  4927. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4928. Return _sendmessage($hwnd, $em_greakproceakproc)
  4929. EndFunc
  4930.  
  4931. Func _guictrledit_hideballoontip($hwnd)
  4932. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4933. Return _sendmessage($hwnd, $emlloontiploontip) <> 0
  4934. EndFunc
  4935.  
  4936. Func _guictrledit_inserttext($hwnd, $stext, $iindex = -1)
  4937. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4938. If $iindex = -1 Then
  4939. _guictrledit_appendtext($hwnd, $stext)
  4940. Else
  4941. _guictrledit_setsel($hwnd, $iindex, $iindex)
  4942. _sendmessage($hwnd, $em_replacesel, True, $stext, 0, "wparam", "wstr")
  4943. EndIf
  4944. EndFunc
  4945.  
  4946. Func _guictrledit_linefromchar($hwnd, $iindex = -1)
  4947. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4948. Return _sendmessage($hwnd, $em_linefromchar, $iindex)
  4949. EndFunc
  4950.  
  4951. Func _guictrledit_lineindex($hwnd, $iindex = -1)
  4952. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4953. Return _sendmessage($hwnd, $em_lineindex, $iindex)
  4954. EndFunc
  4955.  
  4956. Func _guictrledit_linelength($hwnd, $iindex = -1)
  4957. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4958. Local $icharindex = _guictrledit_lineindex($hwnd, $iindex)
  4959. Return _sendmessage($hwnd, $em_linelength, $icharindex)
  4960. EndFunc
  4961.  
  4962. Func _guictrledit_linescroll($hwnd, $ihoriz, $ivert)
  4963. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4964. Return _sendmessage($hwnd, $em_linescroll, $ihoriz, $ivert) <> 0
  4965. EndFunc
  4966.  
  4967. Func _guictrledit_posfromchar($hwnd, $iindex)
  4968. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4969. Local $acoord[2]
  4970. Local $iret = _sendmessage($hwnd, $em_posfromchar, $iindex)
  4971. $acoord[0] = _winapi_loword($iret)
  4972. $acoord[1] = _winapi_hiword($iret)
  4973. Return $acoord
  4974. EndFunc
  4975.  
  4976. Func _guictrledit_replacesel($hwnd, $stext, $bundo = True)
  4977. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4978. _sendmessage($hwnd, $em_replacesel, $bundo, $stext, 0, "wparam", "wstr")
  4979. EndFunc
  4980.  
  4981. Func _guictrledit_scroll($hwnd, $idirection)
  4982. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4983. If BitAND($idirection, $__editconstlinedowlinedown) <> $__editconstlinedowlinedown AND BitAND($idirection, $__editconb_lineub_lineup) <> $__editconb_lineub_lineup AND BitAND($idirection, $__editconstpagedowpagedown) <> $__editconstpagedowpagedown AND BitAND($idirection, $__editconb_pageub_pageup) <> $__editconb_pageub_pageup AND BitAND($idirection, $__editconstantollcareollcaret) <> $__editconstantollcareollcaret Then Return 0
  4984. If $idirection == $__editconstantollcareollcaret Then
  4985. Return _sendmessage($hwnd, $em_scrollcaret)
  4986. Else
  4987. Return _sendmessage($hwnd, $em_scroll, $idirection)
  4988. EndIf
  4989. EndFunc
  4990.  
  4991. Func _guictrledit_sethandle($hwnd, $hmemory)
  4992. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4993. _sendmessage($hwnd, $em_sethandle, $hmemory, 0, 0, "handle")
  4994. EndFunc
  4995.  
  4996. Func _guictrledit_setimestatus($hwnd, $icomposition)
  4997. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  4998. Return _sendmessage($hwnd, $em_setimestatus, $emsis_coonstringnstring, $icomposition)
  4999. EndFunc
  5000.  
  5001. Func _guictrledit_setlimittext($hwnd, $ilimit)
  5002. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5003. _sendmessage($hwnd, $em_setlimittext, $ilimit)
  5004. EndFunc
  5005.  
  5006. Func _guictrledit_setmargins($hwnd, $imargin = 1, $ileft = 65535, $iright = 65535)
  5007. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5008. _sendmessage($hwnd, $em_setmargins, $imargin, _winapi_makelong($ileft, $iright))
  5009. EndFunc
  5010.  
  5011. Func _guictrledit_setmodify($hwnd, $bmodified)
  5012. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5013. _sendmessage($hwnd, $em_setmodify, $bmodified)
  5014. EndFunc
  5015.  
  5016. Func _guictrledit_setpasswordchar($hwnd, $sdisplaychar = "0")
  5017. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5018. $sdisplaychar = StringLeft($sdisplaychar, 1)
  5019. If Asc($sdisplaychar) = 48 Then
  5020. _sendmessage($hwnd, $em_wordcharordchar)
  5021. Else
  5022. _sendmessage($hwnd, $em_wordcharordchar, Asc($sdisplaychar))
  5023. EndIf
  5024. EndFunc
  5025.  
  5026. Func _guictrledit_setreadonly($hwnd, $breadonly)
  5027. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5028. Return _sendmessage($hwnd, $em_setreadonly, $breadonly) <> 0
  5029. EndFunc
  5030.  
  5031. Func _guictrledit_setrect($hwnd, $arect)
  5032. Local $trect = DllStructCreate($tagrect)
  5033. DllStructSetData($trect, "Left", $arect[0])
  5034. DllStructSetData($trect, "Top", $arect[1])
  5035. DllStructSetData($trect, "Right", $arect[2])
  5036. DllStructSetData($trect, "Bottom", $arect[3])
  5037. _guictrledit_setrectex($hwnd, $trect)
  5038. EndFunc
  5039.  
  5040. Func _guictrledit_setrectex($hwnd, $trect)
  5041. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5042. _sendmessage($hwnd, $em_setrect, 0, $trect, 0, "wparam", "struct*")
  5043. EndFunc
  5044.  
  5045. Func _guictrledit_setrectnp($hwnd, $arect)
  5046. Local $trect = DllStructCreate($tagrect)
  5047. DllStructSetData($trect, "Left", $arect[0])
  5048. DllStructSetData($trect, "Top", $arect[1])
  5049. DllStructSetData($trect, "Right", $arect[2])
  5050. DllStructSetData($trect, "Bottom", $arect[3])
  5051. _guictrledit_setrectnpex($hwnd, $trect)
  5052. EndFunc
  5053.  
  5054. Func _guictrledit_setrectnpex($hwnd, $trect)
  5055. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5056. _sendmessage($hwnd, $em_setrectnp, 0, $trect, 0, "wparam", "struct*")
  5057. EndFunc
  5058.  
  5059. Func _guictrledit_setsel($hwnd, $istart, $iend)
  5060. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5061. _sendmessage($hwnd, $em_setsel, $istart, $iend)
  5062. EndFunc
  5063.  
  5064. Func _guictrledit_settabstops($hwnd, $atabstops)
  5065. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5066. If NOT IsArray($atabstops) Then Return SetError(-1, -1, False)
  5067. Local $stabstops = ""
  5068. Local $inumtabstops = UBound($atabstops)
  5069. For $x = 0 To $inumtabstops - 1
  5070. $stabstops &= "int;"
  5071. Next
  5072. $stabstops = StringTrimRight($stabstops, 1)
  5073. Local $ttabstops = DllStructCreate($stabstops)
  5074. For $x = 0 To $inumtabstops - 1
  5075. DllStructSetData($ttabstops, $x + 1, $atabstops[$x])
  5076. Next
  5077. Local $iret = _sendmessage($hwnd, $em_settabstops, $inumtabstops, $ttabstops, 0, "wparam", "struct*") <> 0
  5078. _winapi_invalidaterect($hwnd)
  5079. Return $iret
  5080. EndFunc
  5081.  
  5082. Func _guictrledit_settext($hwnd, $stext)
  5083. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5084. _sendmessage($hwnd, $__editcons_settex_settext, 0, $stext, 0, "wparam", "wstr")
  5085. EndFunc
  5086.  
  5087. Func _guictrledit_setwordbreakproc($hwnd, $iaddressfunc)
  5088. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5089. _sendmessage($hwnd, $em_sreakproceakproc, 0, $iaddressfunc)
  5090. EndFunc
  5091.  
  5092. Func _guictrledit_showballoontip($hwnd, $stitle, $stext, $iicon)
  5093. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5094. Local $ttitle = _winapi_multibytetowidechar($stitle)
  5095. Local $ttext = _winapi_multibytetowidechar($stext)
  5096. Local $ttt = DllStructCreate($__talloontiploontip)
  5097. DllStructSetData($ttt, "Size", DllStructGetSize($ttt))
  5098. DllStructSetData($ttt, "Title", DllStructGetPtr($ttitle))
  5099. DllStructSetData($ttt, "Text", DllStructGetPtr($ttext))
  5100. DllStructSetData($ttt, "Icon", $iicon)
  5101. Return _sendmessage($hwnd, $emlloontiploontip, 0, $ttt, 0, "wparam", "struct*") <> 0
  5102. EndFunc
  5103.  
  5104. Func _guictrledit_undo($hwnd)
  5105. If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5106. Return _sendmessage($hwnd, $em_undo) <> 0
  5107. EndFunc
  5108.  
  5109. #RequireAdmin
  5110. If @AutoItX64 Then
  5111. MsgBox(16, "Error!", "Please run all bot-6) mode6) mode6) mode.")
  5112. Exit
  5113. EndIf
  5114. #Region Declarations
  5115. Local $mkernelhandle
  5116. Local $mgwprochandle
  5117. Local $mgwhwnd
  5118. Local $mmemory
  5119. Local $mlabels[1][2]
  5120. Local $mbase = 14548992
  5121. Local $masmstring, $masmsize, $masmcodeoffset
  5122. Local $mgui = GUICreate("GWAІ"), $mskillactivate, $mskillcancel, $mskillcomplete, $mchatreceive, $mloadfinished
  5123. Local $mskilllogstruct = DllStructCreate("dword;dwrd;floatd;float")
  5124. Local $msktructptrructptr = DllStructGetPtr($mskilllogstruct)
  5125. Local $mchatlogstruct = DllStructCreate("dword;wchar[256]")
  5126. Local $mctructptrructptr = DllStructGetPtr($mchatlogstruct)
  5127. GUIRegisterMsg(1281, "Event")
  5128. Local $mqueuecounter, $mqueuesize, $mqueuebase
  5129. Local $mtargetlogbase
  5130. Local $mstringlogbase
  5131. Local $mskillbase
  5132. Local $mensureenglish
  5133. Local $mmyid, $mcurrenttarget
  5134. Local $magentbase
  5135. Local $mbasepointer
  5136. Local $mregion, $mlanguage
  5137. Local $mping
  5138. Local $mcharname
  5139. Local $mmapid
  5140. Local $mmaxagents
  5141. Local $mmaploading
  5142. Local $mmapisloaded
  5143. Local $mloggedin
  5144. Local $msndlerptrdlerptr
  5145. Local $mwritechatsender
  5146. Local $mtraderquoteid, $mtradercostid, $mtradercostvalue
  5147. Local $mskilltimer
  5148. Local $mbuildnumber
  5149. Local $mzoomstill, $mzoommoving
  5150. Local $mdenderingndering
  5151. Local $magentcopycount
  5152. Local $magentcopybase
  5153. Local $musestringlog
  5154. Local $museeventsystem
  5155. #EndRegion Declarations
  5156. #Region CommandStructs
  5157. Local $museskill = DllStructCreate("ptr;dwrd;dwordd;dword")
  5158. Local $museskillptr = DllStructGetPtr($museskill)
  5159. Local $mmove = DllStructCreate("ptr;flat;floatt;float")
  5160. Local $mmoveptr = DllStructGetPtr($mmove)
  5161. Local $mchangetarget = DllStructCreate("ptr;dword")
  5162. Local $mchangetargetptr = DllStructGetPtr($mchangetarget)
  5163. Local $mmove = DllStructCreate("ptr;flat;floatt;float")
  5164. Local $mmoveptr = DllStructGetPtr($mmove)
  5165. Local $mpacket = DllStructCreate("ptr;dord;dword;dword;dworrd;dword;dwrd;dword;wrd;dwowrd;dworrd;dwordd;dword")
  5166. Local $mpacketptr = DllStructGetPtr($mpacket)
  5167. Local $mwritechat = DllStructCreate("ptr")
  5168. Local $mwritechatptr = DllStructGetPtr($mwritechat)
  5169. Local $msellitem = DllStructCreate("ptr;dword;dword")
  5170. Local $msellitemptr = DllStructGetPtr($msellitem)
  5171. Local $maction = DllStructCreate("ptr;dword;dword")
  5172. Local $mactionptr = DllStructGetPtr($maction)
  5173. Local $mtogglelanguage = DllStructCreate("ptr;dword")
  5174. Local $mtoguageptruageptr = DllStructGetPtr($mtogglelanguage)
  5175. Local $museheroskill = DllStructCreate("ptr;dwrd;dwordd;dword")
  5176. Local $museheroskillptr = DllStructGetPtr($museheroskill)
  5177. Local $mbuyitem = DllStructCreate("ptr;dwrd;dwordd;dword")
  5178. Local $mbuyitemptr = DllStructGetPtr($mbuyitem)
  5179. Local $msendchat = DllStructCreate("ptr;dword")
  5180. Local $msendchatptr = DllStructGetPtr($msendchat)
  5181. Local $mrequestquote = DllStructCreate("ptr;dword")
  5182. Local $mrequestquoteptr = DllStructGetPtr($mrequestquote)
  5183. Local $mruotesellotesell = DllStructCreate("ptr;dword")
  5184. Local $mrequesellptrsellptr = DllStructGetPtr($mruotesellotesell)
  5185. Local $mtraderbuy = DllStructCreate("ptr")
  5186. Local $mtraderbuyptr = DllStructGetPtr($mtraderbuy)
  5187. Local $mtradersell = DllStructCreate("ptr")
  5188. Local $mtradersellptr = DllStructGetPtr($mtradersell)
  5189. Local $msalvage = DllStructCreate("ptr;dwrd;dwordd;dword")
  5190. Local $msalvageptr = DllStructGetPtr($msalvage)
  5191. Local $minttributetribute = DllStructCreate("ptr;dword;dword")
  5192. Local $mincreibuteptrbuteptr = DllStructGetPtr($minttributetribute)
  5193. Local $mdettributetribute = DllStructCreate("ptr;dword;dword")
  5194. Local $mdecreibuteptrbuteptr = DllStructGetPtr($mdettributetribute)
  5195. Local $mmakeagentarray = DllStructCreate("ptr;dword")
  5196. Local $mmaarrayptrrrayptr = DllStructGetPtr($mmakeagentarray)
  5197. #EndRegion CommandStructs
  5198. #Region Memory
  5199.  
  5200. Func memoryopen($apid)
  5201. $mkernelhandle = DllOpen("kernel32.dll")
  5202. Local $lopenprocess = DllCall($mkernelhandle, "int", "OpenProcess", "int", 2035711, "int", 1, "int", $apid)
  5203. $mgwprochandle = $lopenprocess[0]
  5204. EndFunc
  5205.  
  5206. Func memoryclose()
  5207. DllCall($mkernelhandle, "int", "CloseHandle", "int", $mgwprochandle)
  5208. DllClose($mkernelhandle)
  5209. EndFunc
  5210.  
  5211. Func writebinary($abinarystring, $aaddress)
  5212. Local $ldata = DllStructCreate("byte[" & 0.5 * StringLen($abinarystring) & "]"), $i
  5213. For $i = 1 To DllStructGetSize($ldata)
  5214. DllStructSetData($ldata, 1, Dec(StringMid($abinarystring, 2 * $i - 1, 2)), $i)
  5215. Next
  5216. DllCall($mkernelhandle, "int", "WrissMemorysMemory", "int", $mgwprochandle, "ptr", $aaddress, "ptr", DllStructGetPtr($ldata), "int", DllStructGetSize($ldata), "int", 0)
  5217. EndFunc
  5218.  
  5219. Func memorywrite($aaddress, $adata, $atype = "dword")
  5220. Local $lbuffer = DllStructCreate($atype)
  5221. DllStructSetData($lbuffer, 1, $adata)
  5222. DllCall($mkernelhandle, "int", "WrissMemorysMemory", "int", $mgwprochandle, "int", $aaddress, "ptr", DllStructGetPtr($lbuffer), "int", DllStructGetSize($lbuffer), "int", "")
  5223. EndFunc
  5224.  
  5225. Func memoryread($aaddress, $atype = "dword")
  5226. Local $lbuffer = DllStructCreate($atype)
  5227. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $aaddress, "ptr", DllStructGetPtr($lbuffer), "int", DllStructGetSize($lbuffer), "int", "")
  5228. Return DllStructGetData($lbuffer, 1)
  5229. EndFunc
  5230.  
  5231. Func memoryreadptr($aaddress, $aoffset, $atype = "dword")
  5232. Local $lpointercount = UBound($aoffset) - 2
  5233. Local $lbuffer = DllStructCreate("dword")
  5234. For $i = 0 To $lpointercount
  5235. $aaddress += $aoffset[$i]
  5236. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $aaddress, "ptr", DllStructGetPtr($lbuffer), "int", DllStructGetSize($lbuffer), "int", "")
  5237. $aaddress = DllStructGetData($lbuffer, 1)
  5238. If $aaddress == 0 Then
  5239. Local $ldata[2] = [0, 0]
  5240. Return $ldata
  5241. EndIf
  5242. Next
  5243. $aaddress += $aoffset[$lpointercount + 1]
  5244. $lbuffer = DllStructCreate($atype)
  5245. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $aaddress, "ptr", DllStructGetPtr($lbuffer), "int", DllStructGetSize($lbuffer), "int", "")
  5246. Local $ldata[2] = [$aaddress, DllStructGetData($lbuffer, 1)]
  5247. Return $ldata
  5248. EndFunc
  5249.  
  5250. Func swapendian($ahex)
  5251. Return StringMid($ahex, 7, 2) & StringMid($ahex, 5, 2) & StringMid($ahex, 3, 2) & StringMid($ahex, 1, 2)
  5252. EndFunc
  5253.  
  5254. #EndRegion Memory
  5255. #Region Initialisation
  5256.  
  5257. Func getloggedcharnames()
  5258. Local $array = scangw()
  5259. If $array[0] <= 1 Then Return ""
  5260. Local $ret = $array[1]
  5261. For $i = 2 To $array[0]
  5262. $ret &= "|"
  5263. $ret &= $array[$i]
  5264. Next
  5265. Return $ret
  5266. EndFunc
  5267.  
  5268. Func scangw()
  5269. Local $lwinlist = WinList("Guild Wars")
  5270. Local $lreturnarray[1] = [0]
  5271. Local $lpid
  5272. For $i = 1 To $lwinlist[0][0]
  5273. $mgwhwnd = $lwinlist[$i][1]
  5274. $lpid = WinGetProcess($mgwhwnd)
  5275. If __processgetname($lpid) <> "gw.exe" Then ContinueLoop
  5276. memoryopen(WinGetProcess($mgwhwnd))
  5277. If $mgwprochandle Then
  5278. $lreturnarray[0] += 1
  5279. ReDim $lreturnarray[$lreturnarray[0] + 1]
  5280. $lreturnarray[$lreturnarray[0]] = scanforcharname()
  5281. EndIf
  5282. memoryclose()
  5283. $mgwprochandle = 0
  5284. Next
  5285. Return $lreturnarray
  5286. EndFunc
  5287.  
  5288. Func initialize($agw, $bchangetitle = True, $ausestringlog = False, $auseeventsystem = True)
  5289. Global $charname1 = "Im ng Champg Champ"
  5290. Global $charname1 = "Oo Shiko Oo"
  5291. Global $charname2 = "I I Shiko I I"
  5292. Global $charname3 = "Flamer Zwei"
  5293. Global $charname4 = "Flamer Drei"
  5294. Global $charname5 = "Flamer Vier"
  5295. Global $charname6 = "Flamer Fuenf"
  5296. Global $charname7 = "Flamer Sechs"
  5297. Global $charname8 = "Flamer Sieben"
  5298. Global $charname9 = "Flamer Neun"
  5299. Global $charname10 = "Flamer Zehn"
  5300. Global $charname11 = "Flamer Elf"
  5301. Global $charname12 = "Flamer Zwoelf"
  5302. Global $charname13 = "Rupt Bot Null"
  5303. Local $lwinlist
  5304. $musestringlog = $ausestringlog
  5305. $museeventsystem = $auseeventsystem
  5306. If IsString($agw) Then
  5307. $lwinlist = WinList("Guild Wars")
  5308. For $i = 1 To $lwinlist[0][0]
  5309. $mgwhwnd = $lwinlist[$i][1]
  5310. memoryopen(WinGetProcess($mgwhwnd))
  5311. If $mgwprochandle Then
  5312. If StringRegExp(scanforcharname(), $agw) = 1 Then ExitLoop
  5313. EndIf
  5314. memoryclose()
  5315. $mgwprochandle = 0
  5316. Next
  5317. Else
  5318. $lwinlist = WinList()
  5319. For $i = 1 To $lwinlist[0][0]
  5320. $mgwhwnd = $lwinlist[$i][1]
  5321. If WinGetProcess($mgwhwnd) = $agw Then
  5322. memoryopen($agw)
  5323. scanforcharname()
  5324. ExitLoop
  5325. EndIf
  5326. Next
  5327. EndIf
  5328. If $mgwprochandle = 0 Then Return 0
  5329. scan()
  5330. $mbasepointer = memoryread(getscannedaddress("ScanBasePointer", -3))
  5331. setvalue("BasePointer", "0x" & Hex($mbasepointer, 8))
  5332. $magentbase = memoryread(getscannedaddress("ScanAgentBase", 13))
  5333. setvalue("AgentBase", "0x" & Hex($magentbase, 8))
  5334. $mmaxagents = $magentbase + 8
  5335. setvalue("MaxAgents", "0x" & Hex($mmaxagents, 8))
  5336. $mmyid = $magentbase - 84
  5337. setvalue("MyID", "0x" & Hex($mmyid, 8))
  5338. $mmaploading = $magentbase - 240
  5339. $mcurrenttarget = $magentbase - 1280
  5340. setvalue("PacketLocation", "0x" & Hex(memoryread(getscannedaddress("ScanBaseOffset", -3)), 8))
  5341. $mping = memoryread(getscannedaddress("ScanPing", -8))
  5342. $mmapid = memoryread(getscannedaddress("ScanMapID", 71))
  5343. $mloggedin = memoryread(getscannedaddress("ScanLoggedIn", -3)) + 4
  5344. $mregion = memoryread(getscannedaddress("ScanRegion", 8))
  5345. $mlanguage = memoryread(getscannedaddress("ScanLanguage", 8)) + 12
  5346. $mskillbase = memoryread(getscannedaddress("ScanSkillBase", 9))
  5347. $mskilltimer = memoryread(getscannedaddress("ScanSkillTimer", -3))
  5348. $mbuildnumber = memoryread(getscannedaddress("ScanBuildNumber", 84))
  5349. $mzoomstill = getscannedaddress("ScanZoomStill", -1)
  5350. $mzoommoving = getscannedaddress("ScanZoomMoving", 5)
  5351. Local $ltemp
  5352. $ltemp = getscannedaddress("ScanEngine", -16)
  5353. setvalue("MainStart", "0x" & Hex($ltemp, 8))
  5354. setvalue("MainReturn", "0x" & Hex($ltemp + 5, 8))
  5355. setvalue("RenderingMod", "0x" & Hex($ltemp + 116, 8))
  5356. setvalue("RenodReturndReturn", "0x" & Hex($ltemp + 132 + 6, 8))
  5357. $ltemp = getscannedaddress("ScanTargetLog", 1)
  5358. setvalue("TargetLogStart", "0x" & Hex($ltemp, 8))
  5359. setvalue("TargetLogReturn", "0x" & Hex($ltemp + 5, 8))
  5360. $ltemp = getscannedaddress("ScanSkillLog", 1)
  5361. setvalue("SkillLogStart", "0x" & Hex($ltemp, 8))
  5362. setvalue("SkillLogReturn", "0x" & Hex($ltemp + 5, 8))
  5363. $ltemp = getscannedaddress("ScanSpleteLogleteLog", -4)
  5364. setvalue("SkillCLogStartogStart", "0x" & Hex($ltemp, 8))
  5365. setvalue("SkillCoogReturngReturn", "0x" & Hex($ltemp + 5, 8))
  5366. $ltemp = getscannedaddress("ScaancelLogncelLog", 5)
  5367. setvalue("SkilLogStartogStart", "0x" & Hex($ltemp, 8))
  5368. setvalue("SkillogReturngReturn", "0x" & Hex($ltemp + 6, 8))
  5369. $ltemp = getscannedaddress("ScanChatLog", 18)
  5370. setvalue("ChatLogStart", "0x" & Hex($ltemp, 8))
  5371. setvalue("ChatLogReturn", "0x" & Hex($ltemp + 6, 8))
  5372. $ltemp = getscannedaddress("ScanTraderHook", -7)
  5373. setvalue("TraderHookStart", "0x" & Hex($ltemp, 8))
  5374. setvalue("TraderHookReturn", "0x" & Hex($ltemp + 5, 8))
  5375. $ltemp = getscannedaddress("ScgFilter1Filter1", -2)
  5376. setvalue("Strer1Startr1Start", "0x" & Hex($ltemp, 8))
  5377. setvalue("Strir1Return1Return", "0x" & Hex($ltemp + 5, 8))
  5378. $ltemp = getscannedaddress("ScgFilter2Filter2", -2)
  5379. setvalue("Strer2Startr2Start", "0x" & Hex($ltemp, 8))
  5380. setvalue("Strir2Return2Return", "0x" & Hex($ltemp + 5, 8))
  5381. setvalue("StringLogStart", "0x" & Hex(getscannedaddress("ScanStringLog", 35), 8))
  5382. setvalue("LohedStartedStart", "0x" & Hex(getscannedaddress("ScanLoadFinished", 1), 8))
  5383. setvalue("LoaedReturndReturn", "0x" & Hex(getscannedaddress("ScanLoadFinished", 6), 8))
  5384. setvalue("PostMessage", "0x" & Hex(memoryread(getscannedaddress("ScanPostMessage", 11)), 8))
  5385. setvalue("Sleep", memoryread(memoryread(getvalue("ScanSleep") + 8) + 3))
  5386. setvalue("SalvageFunction", memoryread(getvalue("ScanFunctionunction") + 8) - 18)
  5387. setvalue("SalvageGlobal", memoryread(memoryread(getvalue("ScgeGlobaleGlobal") + 8) + 1))
  5388. setvalue("IncreaseAtFunctioFunction", "0x" & Hex(getscannedaddress("ScanIncreaseAtFunctioFunction", -96), 8))
  5389. setvalue("DecreaseAtFunctioFunction", "0x" & Hex(getscannedaddress("ScanIncreaseAtFunctioFunction", -288), 8))
  5390. setvalue("MoveFunction", "0x" & Hex(getscannedaddress("ScanMoveFunction", 1), 8))
  5391. setvalue("UseSkillFunction", "0x" & Hex(getscannedaddress("ScanUFunctionunction", 1), 8))
  5392. setvalue("ChangFunctionunction", "0x" & Hex(getscannedaddress("ScanChangFunctioFunction", -119), 8))
  5393. setvalue("WrFunctionunction", "0x" & Hex(getscannedaddress("ScanWrFunctionunction", 1), 8))
  5394. setvalue("SellItemFunction", "0x" & Hex(getscannedaddress("ScanSFunctionunction", -85), 8))
  5395. setvalue("PacFunctionunction", "0x" & Hex(getscannedaddress("ScanPacFunctionunction", 1), 8))
  5396. setvalue("ActionBase", "0x" & Hex(memoryread(getscannedaddress("ScanActionBase", -9)), 8))
  5397. setvalue("ActionFunction", "0x" & Hex(getscannedaddress("ScaFunctionunction", -5), 8))
  5398. setvalue("UseHeFunctionunction", "0x" & Hex(getscannedaddress("ScanUseHeFunctioFunction", -161), 8))
  5399. setvalue("BuyItemFunction", "0x" & Hex(getscannedaddress("ScanFunctionunction", 1), 8))
  5400. setvalue("RequeFunctionunction", "0x" & Hex(getscannedaddress("ScanRequeFunctioFunction", -2), 8))
  5401. setvalue("TraderFunction", "0x" & Hex(getscannedaddress("ScaFunctionunction", -71), 8))
  5402. setvalue("ClickToMoveFix", "0x" & Hex(getscannedaddress("ScaoMoveFixMoveFix", 1), 8))
  5403. setvalue("QueueSize", "0x00000010")
  5404. setvalue("SkillLogSize", "0x00000010")
  5405. setvalue("ChatLogSize", "0x00000010")
  5406. setvalue("TargetLogSize", "0x00000200")
  5407. setvalue("StringLogSize", "0x00000200")
  5408. setvalue("CallbackEvent", "0x00000501")
  5409. modifymemory()
  5410. $mqueuecounter = memoryread(getvalue("QueueCounter"))
  5411. $mqueuesize = getvalue("QueueSize") - 1
  5412. $mqueuebase = getvalue("QueueBase")
  5413. $mtargetlogbase = getvalue("TargetLogBase")
  5414. $mstringlogbase = getvalue("StringLogBase")
  5415. $mmapisloaded = getvalue("MapIsLoaded")
  5416. $mensureenglish = getvalue("EnsureEnglish")
  5417. $mtraderquoteid = getvalue("TraderQuoteID")
  5418. $mtradercostid = getvalue("TraderCostID")
  5419. $mtradercostvalue = getvalue("TraderCostValue")
  5420. $mdenderingndering = getvalue("DisableRendering")
  5421. $magentcopycount = getvalue("AgentCopyCount")
  5422. $magentcopybase = getvalue("AgentCopyBase")
  5423. If $museeventsystem Then memorywrite(getvalue("CallbackHandle"), $mgui)
  5424. DllStructSetData($museskill, 1, getvalue("CommandUseSkill"))
  5425. DllStructSetData($mmove, 1, getvalue("CommandMove"))
  5426. DllStructSetData($mchangetarget, 1, getvalue("CommgeTargeteTarget"))
  5427. DllStructSetData($mpacket, 1, getvalue("CocketSendketSend"))
  5428. DllStructSetData($msellitem, 1, getvalue("CommandSellItem"))
  5429. DllStructSetData($maction, 1, getvalue("CommandAction"))
  5430. DllStructSetData($mtogglelanguage, 1, getvalue("CommanLanguageanguage"))
  5431. DllStructSetData($museheroskill, 1, getvalue("CommeroSkillroSkill"))
  5432. DllStructSetData($mbuyitem, 1, getvalue("CommandBuyItem"))
  5433. DllStructSetData($msendchat, 1, getvalue("CommandSendChat"))
  5434. DllStructSetData($msendchat, 2, 94)
  5435. DllStructSetData($mwritechat, 1, getvalue("CommandWriteChat"))
  5436. DllStructSetData($mrequestquote, 1, getvalue("CommestQuotestQuote"))
  5437. DllStructSetData($mruotesellotesell, 1, getvalue("CommandRuoteSelloteSell"))
  5438. DllStructSetData($mtraderbuy, 1, getvalue("CommandTraderBuy"))
  5439. DllStructSetData($mtradersell, 1, getvalue("CoaderSellderSell"))
  5440. DllStructSetData($msalvage, 1, getvalue("CommandSalvage"))
  5441. DllStructSetData($minttributetribute, 1, getvalue("CommandInttributttribute"))
  5442. DllStructSetData($mdettributetribute, 1, getvalue("CommandDettributttribute"))
  5443. DllStructSetData($mmakeagentarray, 1, getvalue("CommanentArrayntArray"))
  5444. If $bchangetitle Then WinSetTitle($mgwhwnd, "", "Guild Wars - " & getcharname())
  5445. Return $mgwhwnd
  5446. EndFunc
  5447.  
  5448. Func getvalue($akey)
  5449. For $i = 1 To $mlabels[0][0]
  5450. If $mlabels[$i][0] = $akey Then Return Number($mlabels[$i][1])
  5451. Next
  5452. Return -1
  5453. EndFunc
  5454.  
  5455. Func setvalue($akey, $avalue)
  5456. $mlabels[0][0] += 1
  5457. ReDim $mlabels[$mlabels[0][0] + 1][2]
  5458. $mlabels[$mlabels[0][0]][0] = $akey
  5459. $mlabels[$mlabels[0][0]][1] = $avalue
  5460. EndFunc
  5461.  
  5462. Func scan()
  5463. $masmsize = 0
  5464. $masmcodeoffset = 0
  5465. $masmstring = ""
  5466. _("MainModPtr/4")
  5467. _("ScanBasePointer:")
  5468. addpattern("85C0750F8BCE")
  5469. _("ScanAgentBase:")
  5470. addpattern("568BF13BF07204")
  5471. _("ScanEngine:")
  5472. addpattern("5356DFE0F6C441")
  5473. _("Scinished:nished:")
  5474. addpattern("8B561C8BCF52E8")
  5475. _("ScanPostMessage:")
  5476. addpattern("6A0060051FF15051FF15")
  5477. _("ScanTargetLog:")
  5478. addpattern("535894DF4E894DF4E8")
  5479. _("ScanChangeunctionunction:")
  5480. addpattern("33C03BDA0F95C033")
  5481. _("Scunction:nction:")
  5482. addpattern("558BEC83EC2F98D4DFF98D4DF0")
  5483. _("ScanPing:")
  5484. addpattern("90849186A309186A30")
  5485. _("ScanMapID:")
  5486. addpattern("B07F8D55")
  5487. _("ScanLoggedIn:")
  5488. addpattern("85C07411B807")
  5489. _("ScanRegion:")
  5490. addpattern("83F9FD7406")
  5491. _("ScanLanguage:")
  5492. addpattern("C38B75FC8B04B5")
  5493. _("ScanUsunction:nction:")
  5494. addpattern("558BEC83EC1053568F2895DFF2895DF0")
  5495. _("ScanChangeunctionunction:")
  5496. addpattern("33C03BDA0F95C033")
  5497. _("ScanPackunction:nction:")
  5498. addpattern("558BEC83E578BF98578BF985")
  5499. _("ScanBaseOffset:")
  5500. addpattern("5633F0E5633D2E5633D2")
  5501. _("ScanWriunction:nction:")
  5502. addpattern("558BEC515389408565780856578B")
  5503. _("ScanSkillLog:")
  5504. addpattern("408946105E5B5D")
  5505. _("ScanSkleteLog:eteLog:")
  5506. addpattern("741D6A006A40")
  5507. _("ScanncelLog:celLog:")
  5508. addpattern("85C0741D6A006A42")
  5509. _("ScanChatLog:")
  5510. addpattern("8B48B4DEC50B4DEC50")
  5511. _("ScanSeunction:nction:")
  5512. addpattern("8B4D2085C90F858E")
  5513. _("ScanStringLog:")
  5514. addpattern("893E8B704397E084397E08")
  5515. _("ScaFilter1:ilter1:")
  5516. addpattern("51568B7F9833E009833E00")
  5517. _("ScaFilter2:ilter2:")
  5518. addpattern("5153565D28B4F2C28B4F2C")
  5519. _("Scanunction:nction:")
  5520. addpattern("8B7D0883FF098BF760100076010000")
  5521. _("ScanActionBase:")
  5522. addpattern("8B420418B4A0818B4A08")
  5523. _("ScanSkillBase:")
  5524. addpattern("8D04B65EC1E00505")
  5525. _("ScanUseHerunctionunction:")
  5526. addpattern("8D0C765F5E8B")
  5527. _("ScanBunction:nction:")
  5528. addpattern("558BEC81ECC000000053568B7F8BD976F8BD97618BD97614")
  5529. _("ScanRequesunctionunction:")
  5530. addpattern("81E0053568B053568B")
  5531. _("Scanunction:nction:")
  5532. addpattern("8B45188B551085")
  5533. _("ScanTraderHook:")
  5534. addpattern("8955F55F8B9BA5F8B9BA")
  5535. _("ScanSleep:")
  5536. addpattern("5F5E560EA00000EA0000")
  5537. _("ScanSunction:nction:")
  5538. addpattern("8BFA8F0895DF40895DF4")
  5539. _("ScaeGlobal:Global:")
  5540. addpattern("8B018B4904A3")
  5541. _("ScanIncreaseAttunctionunction:")
  5542. addpattern("8B702C8B3B8B86")
  5543. _("ScanDecreaseAttunctionunction:")
  5544. addpattern("8B4B06A016A04A016A04")
  5545. _("ScanSkillTimer:")
  5546. addpattern("85c9741d183fa64183fa64")
  5547. _("ScanMoveFix:oveFix:")
  5548. addpattern("3DD301000074")
  5549. _("ScanZoomStill:")
  5550. addpattern("3B448BCB")
  5551. _("ScanZoomMoving:")
  5552. addpattern("50EB13B448BCEB448BCE")
  5553. _("ScanBuildNumber:")
  5554. addpattern("8D8500FCFFFF8D")
  5555. _("ScanProc:")
  5556. _("pushad")
  5557. _("mov ecx,401000")
  5558. _("mov esi,ScanProc")
  5559. _("ScanLoop:")
  5560. _("inc ecx")
  5561. _("mov al,byte[ecx]")
  5562. _("mov edx,ePointerPointer")
  5563. _("ScanInnerLoop:")
  5564. _("movord[edx]rd[edx]")
  5565. _("cmp ebx,-1")
  5566. _("jnz ScanContinue")
  5567. _("add edx,50")
  5568. _("cmp edx,esi")
  5569. _("jnnnerLoopnerLoop")
  5570. _("cmp ecx,900000")
  5571. _("jnz ScanLoop")
  5572. _("jmp ScanExit")
  5573. _("ScanContinue:")
  5574. _("lea ediedx+ebx]dx+ebx]")
  5575. _("add edi,C")
  5576. _("mov ah,byte[edi]")
  5577. _("cmp al,ah")
  5578. _("jz ScanMatched")
  5579. _("mov dword[edx],0")
  5580. _("add edx,50")
  5581. _("cmp edx,esi")
  5582. _("jnnnerLoopnerLoop")
  5583. _("cmp ecx,900000")
  5584. _("jnz ScanLoop")
  5585. _("jmp ScanExit")
  5586. _("ScanMatched:")
  5587. _("inc ebx")
  5588. _("mov ed[edx+4][edx+4]")
  5589. _("cmp ebx,edi")
  5590. _("jz ScanFound")
  5591. _("movedx],ebxdx],ebx")
  5592. _("add edx,50")
  5593. _("cmp edx,esi")
  5594. _("jnnnerLoopnerLoop")
  5595. _("cmp ecx,900000")
  5596. _("jnz ScanLoop")
  5597. _("jmp ScanExit")
  5598. _("ScanFound:")
  5599. _("lea ed[edx+8][edx+8]")
  5600. _("movedi],ecxdi],ecx")
  5601. _("mo[edx],-1edx],-1")
  5602. _("add edx,50")
  5603. _("cmp edx,esi")
  5604. _("jnnnerLoopnerLoop")
  5605. _("cmp ecx,900000")
  5606. _("jnz ScanLoop")
  5607. _("ScanExit:")
  5608. _("popad")
  5609. _("retn")
  5610. Local $lscanmemory = memoryread($mbase, "ptr")
  5611. If $lscanmemory = 0 Then
  5612. $mmemory = DllCall($mkernelhandle, "ptr", "VirtualAllocEx", "handle", $mgwprochandle, "ptr", 0, "ulong_ptr", $masmsize, "dword", 4096, "dword", 64)
  5613. $mmemory = $mmemory[0]
  5614. memorywrite($mbase, $mmemory)
  5615. Else
  5616. $mmemory = $lscanmemory
  5617. EndIf
  5618. completeasmcode()
  5619. If $lscanmemory = 0 Then
  5620. writebinary($masmstring, $mmemory + $masmcodeoffset)
  5621. Local $lthread = DllCall($mkernelhandle, "int", "CreteThreadeThread", "int", $mgwprochandle, "ptr", 0, "int", 0, "int", getlabelinfo("ScanProc"), "ptr", 0, "int", 0, "int", 0)
  5622. $lthread = $lthread[0]
  5623. Local $lresult
  5624. Do
  5625. $lresult = DllCall($mkernelhandle, "int", "WaitleObjecteObject", "int", $lthread, "int", 50)
  5626. Until $lresult[0] <> 258
  5627. DllCall($mkernelhandle, "int", "CloseHandle", "int", $lthread)
  5628. EndIf
  5629. EndFunc
  5630.  
  5631. Func addpattern($apattern)
  5632. Local $lsize = Int(0.5 * StringLen($apattern))
  5633. $masmstring &= "00000000" & swapendian(Hex($lsize, 8)) & "00000000" & $apattern
  5634. $masmsize += $lsize + 12
  5635. For $i = 1 To 68 - $lsize
  5636. $masmsize += 1
  5637. $masmstring &= "00"
  5638. Next
  5639. EndFunc
  5640.  
  5641. Func getscannedaddress($alabel, $aoffset)
  5642. Return memoryread(getlabelinfo($alabel) + 8) - memoryread(getlabelinfo($alabel) + 4) + $aoffset
  5643. EndFunc
  5644.  
  5645. Func scanforcharname()
  5646. Local $lcharnamecode = BinaryToString("0x90909066C705")
  5647. Local $lcurrehaddressaddress = 4198400
  5648. Local $lmbi[7], $lmbibuffer = DllStructCreate("dword;dword;dword;wrd;dworrd;dworrd;dword")
  5649. Local $lsearch, $ltmpmemdata, $ltmpaddress, $ltmpbuffer = DllStructCreate("ptr"), $i
  5650. While $lcurrehaddressaddress < 9437184
  5651. Local $lmbi[7]
  5652. DllCall($mkernelhandle, "int", "VirtualQueryEx", "int", $mgwprochandle, "int", $lcurrehaddressaddress, "ptr", DllStructGetPtr($lmbibuffer), "int", DllStructGetSize($lmbibuffer))
  5653. For $i = 0 To 6
  5654. $lmbi[$i] = StringStripWS(DllStructGetData($lmbibuffer, ($i + 1)), 3)
  5655. Next
  5656. If $lmbi[4] = 4096 Then
  5657. Local $lbuffer = DllStructCreate("byte[" & $lmbi[3] & "]")
  5658. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lcurrehaddressaddress, "ptr", DllStructGetPtr($lbuffer), "int", DllStructGetSize($lbuffer), "int", "")
  5659. $ltmpmemdata = DllStructGetData($lbuffer, 1)
  5660. $ltmpmemdata = BinaryToString($ltmpmemdata)
  5661. $lsearch = StringInStr($ltmpmemdata, $lcharnamecode, 2)
  5662. If $lsearch > 0 Then
  5663. $ltmpaddress = $lcurrehaddressaddress + $lsearch - 1
  5664. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $ltmpaddress + 6, "ptr", DllStructGetPtr($ltmpbuffer), "int", DllStructGetSize($ltmpbuffer), "int", "")
  5665. $mcharname = DllStructGetData($ltmpbuffer, 1)
  5666. Return getcharname()
  5667. EndIf
  5668. $lcurrehaddressaddress += $lmbi[3]
  5669. EndIf
  5670. WEnd
  5671. Return ""
  5672. EndFunc
  5673.  
  5674. #EndRegion Initialisation
  5675. #Region Commands
  5676. #Region Item
  5677.  
  5678. Func startsalvage($aitem)
  5679. Local $loffset[4] = [0, 24, 44, 1680]
  5680. Local $lsessionidssionid = memoryreadptr($mbasepointer, $loffset)
  5681. If IsDllStruct($aitem) = 0 Then
  5682. Local $litemid = $aitem
  5683. Else
  5684. Local $litemid = DllStructGetData($aitem, "ID")
  5685. EndIf
  5686. Local $lsalvagekit = findsalvagekit()
  5687. If $lsalvagekit = 0 Then Return
  5688. DllStructSetData($msalvage, 2, $litemid)
  5689. DllStructSetData($msalvage, 3, findsalvagekit())
  5690. DllStructSetData($msalvage, 4, $lsessionidssionid[1])
  5691. enqueue($msalvageptr, 16)
  5692. EndFunc
  5693.  
  5694. Func salvagematerials()
  5695. Return sendpacket(4, 115)
  5696. EndFunc
  5697.  
  5698. Func salvagemod($amodindex)
  5699. Return sendpacket(8, 116, $amodindex)
  5700. EndFunc
  5701.  
  5702. Func identifyitem($aitem)
  5703. If getisided($aitem) Then Return
  5704. Local $litemid
  5705. If IsDllStruct($aitem) = 0 Then
  5706. $litemid = $aitem
  5707. Else
  5708. $litemid = DllStructGetData($aitem, "ID")
  5709. EndIf
  5710. Local $lidkit = findidkit()
  5711. If $lidkit == 0 Then Return
  5712. sendpacket(12, 101, $lidkit, $litemid)
  5713. Local $ldeadlock = TimerInit()
  5714. Do
  5715. Sleep(20)
  5716. Until getisided($litemid) OR TimerDiff($ldeadlock) > 5000
  5717. If NOT getisided($litemid) Then identifyitem($aitem)
  5718. EndFunc
  5719.  
  5720. Func identifybag($abag, $awhites = False, $agolds = True)
  5721. Local $litem
  5722. If NOT IsDllStruct($abag) Then $abag = getbag($abag)
  5723. For $i = 1 To DllStructGetData($abag, "Slots")
  5724. $litem = getitembyslot($abag, $i)
  5725. If DllStructGetData($litem, "ID") == 0 Then ContinueLoop
  5726. If getrarity($litem) == 2621 AND $awhites == False Then ContinueLoop
  5727. If getrarity($litem) == 2624 AND $agolds == False Then ContinueLoop
  5728. identifyitem($litem)
  5729. Sleep(getping())
  5730. Next
  5731. EndFunc
  5732.  
  5733. Func equipitem($aitem)
  5734. Local $litemid
  5735. If IsDllStruct($aitem) = 0 Then
  5736. $litemid = $aitem
  5737. Else
  5738. $litemid = DllStructGetData($aitem, "ID")
  5739. EndIf
  5740. Return sendpacket(8, 41, $litemid)
  5741. EndFunc
  5742.  
  5743. Func useitem($aitem)
  5744. Local $litemid
  5745. If IsDllStruct($aitem) = 0 Then
  5746. $litemid = $aitem
  5747. Else
  5748. $litemid = DllStructGetData($aitem, "ID")
  5749. EndIf
  5750. Return sendpacket(8, 119, $litemid)
  5751. EndFunc
  5752.  
  5753. Func pickupitem($aitem)
  5754. Local $lagentid
  5755. If IsDllStruct($aitem) = 0 Then
  5756. $lagentid = $aitem
  5757. ElseIf DllStructGetSize($aitem) < 400 Then
  5758. $lagentid = DllStructGetData($aitem, "AgentID")
  5759. Else
  5760. $lagentid = DllStructGetData($aitem, "ID")
  5761. EndIf
  5762. Return sendpacket(12, 56, $lagentid, 0)
  5763. EndFunc
  5764.  
  5765. Func dropitem($aitem, $aamount = 0)
  5766. Local $litemid, $lamount
  5767. If IsDllStruct($aitem) = 0 Then
  5768. $litemid = $aitem
  5769. If $aamount > 0 Then
  5770. $lamount = $aamount
  5771. Else
  5772. $lamount = DllStructGetData(getitembyitemid($aitem), "Quantity")
  5773. EndIf
  5774. Else
  5775. $litemid = DllStructGetData($aitem, "ID")
  5776. If $aamount > 0 Then
  5777. $lamount = $aamount
  5778. Else
  5779. $lamount = DllStructGetData($aitem, "Quantity")
  5780. EndIf
  5781. EndIf
  5782. Return sendpacket(12, 37, $litemid, $lamount)
  5783. EndFunc
  5784.  
  5785. Func moveitem($aitem, $abag, $aslot)
  5786. Local $litemid, $lbagid
  5787. If IsDllStruct($aitem) = 0 Then
  5788. $litemid = $aitem
  5789. Else
  5790. $litemid = DllStructGetData($aitem, "ID")
  5791. EndIf
  5792. If IsDllStruct($abag) = 0 Then
  5793. $lbagid = DllStructGetData(getbag($abag), "ID")
  5794. Else
  5795. $lbagid = DllStructGetData($abag, "ID")
  5796. EndIf
  5797. Return sendpacket(16, 107, $litemid, $lbagid, $aslot - 1)
  5798. EndFunc
  5799.  
  5800. Func acceptallitems()
  5801. Return sendpacket(8, 108, DllStructGetData(getbag(7), "ID"))
  5802. EndFunc
  5803.  
  5804. Func sellitem($aitem, $aquantity = 0)
  5805. If IsDllStruct($aitem) = 0 Then $aitem = getitembyitemid($aitem)
  5806. If $aquantity = 0 OR $aquantity > DllStructGetData($aitem, "Quantity") Then $aquantity = DllStructGetData($aitem, "Quantity")
  5807. DllStructSetData($msellitem, 2, $aquantity * DllStructGetData($aitem, "Value"))
  5808. DllStructSetData($msellitem, 3, DllStructGetData($aitem, "ID"))
  5809. enqueue($msellitemptr, 12)
  5810. EndFunc
  5811.  
  5812. Func buyitem($aitem, $aquantity, $avalue)
  5813. Local $lmetemsbaseemsbase = getmerchantitemsbase()
  5814. If NOT $lmetemsbaseemsbase Then Return
  5815. If $aitem < 1 OR $aitem > getmerchantitemssize() Then Return
  5816. DllStructSetData($mbuyitem, 2, $aquantity)
  5817. DllStructSetData($mbuyitem, 3, memoryread($lmetemsbaseemsbase + 4 * ($aitem - 1)))
  5818. DllStructSetData($mbuyitem, 4, $aquantity * $avalue)
  5819. enqueue($mbuyitemptr, 16)
  5820. EndFunc
  5821.  
  5822. Func buyidkit()
  5823. buyitem(5, 1, 100)
  5824. EndFunc
  5825.  
  5826. Func buysuperioridkit()
  5827. buyitem(6, 1, 500)
  5828. EndFunc
  5829.  
  5830. Func traderrequest($amodelid, $aextraid = -1)
  5831. Local $litemstruct = DllStructCreate("long agentId;byte unknow unknown1[4];ptr bag;ptr modstruct;long modstructsize;ptr customized;byte unknown2[4];byte type;byte unknown3;short extraId;short value;byte unknown4[2];short interaction;long modelId;ptr modString;byte unknown5[4];ptr NameString;byte unknown6[15];byte quantity;bipped;bytwyte slwyte sloyte slotte slot")
  5832. Local $loffset[4] = [0, 24, 64, 192]
  5833. Local $litemarraysize = memoryreadptr($mbasepointer, $loffset)
  5834. Local $loffset[5] = [0, 24, 64, 184, 0]
  5835. Local $litemptr, $litemid
  5836. Local $lfound = False
  5837. Local $lquoteid = memoryread($mtraderquoteid)
  5838. For $litemid = 1 To $litemarraysize[1]
  5839. $loffset[4] = 4 * $litemid
  5840. $litemptr = memoryreadptr($mbasepointer, $loffset)
  5841. If $litemptr[1] = 0 Then ContinueLoop
  5842. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $litemptr[1], "ptr", DllStructGetPtr($litemstruct), "int", DllStructGetSize($litemstruct), "int", "")
  5843. If DllStructGetData($litemstruct, "ModelID") = $amodelid AND DllStructGetData($litemstruct, "bag") = 0 AND DllStructGetData($litemstruct, "AgentID") == 0 Then
  5844. If $aextraid = -1 OR DllStructGetData($litemstruct, "ExtraID") = $aextraid Then
  5845. $lfound = True
  5846. ExitLoop
  5847. EndIf
  5848. EndIf
  5849. Next
  5850. If NOT $lfound Then Return False
  5851. DllStructSetData($mrequestquote, 2, DllStructGetData($litemstruct, "ID"))
  5852. enqueue($mrequestquoteptr, 8)
  5853. Local $ldeadlock = TimerInit()
  5854. $lfound = False
  5855. Do
  5856. Sleep(20)
  5857. $lfound = memoryread($mtraderquoteid) <> $lquoteid
  5858. Until $lfound OR TimerDiff($ldeadlock) > getping() + 5000
  5859. Return $lfound
  5860. EndFunc
  5861.  
  5862. Func traderbuy()
  5863. If NOT gettradercostid() OR NOT gettradercostvalue() Then Return False
  5864. enqueue($mtraderbuyptr, 4)
  5865. Return True
  5866. EndFunc
  5867.  
  5868. Func traderrequestsell($aitem)
  5869. Local $litemid
  5870. Local $lfound = False
  5871. Local $lquoteid = memoryread($mtraderquoteid)
  5872. If IsDllStruct($aitem) = 0 Then
  5873. $litemid = $aitem
  5874. Else
  5875. $litemid = DllStructGetData($aitem, "ID")
  5876. EndIf
  5877. DllStructSetData($mruotesellotesell, 2, $litemid)
  5878. enqueue($mrequesellptrsellptr, 8)
  5879. Local $ldeadlock = TimerInit()
  5880. Do
  5881. Sleep(20)
  5882. $lfound = memoryread($mtraderquoteid) <> $lquoteid
  5883. Until $lfound OR TimerDiff($ldeadlock) > getping() + 5000
  5884. Return $lfound
  5885. EndFunc
  5886.  
  5887. Func tradersell()
  5888. If NOT gettradercostid() OR NOT gettradercostvalue() Then Return False
  5889. enqueue($mtradersellptr, 4)
  5890. Return True
  5891. EndFunc
  5892.  
  5893. Func dropgold($aamount = 0)
  5894. Local $lamount
  5895. If $aamount > 0 Then
  5896. $lamount = $aamount
  5897. Else
  5898. $lamount = getgoldcharacter()
  5899. EndIf
  5900. Return sendpacket(8, 40, $lamount)
  5901. EndFunc
  5902.  
  5903. Func depositgold($aamount = 0)
  5904. Local $lamount
  5905. Local $lstorage = getgoldstorage()
  5906. Local $lcharacter = getgoldcharacter()
  5907. If $aamount > 0 AND $lcharacter >= $aamount Then
  5908. $lamount = $aamount
  5909. Else
  5910. $lamount = $lcharacter
  5911. EndIf
  5912. If $lstorage + $lamount > 1000000 Then $lamount = 1000000 - $lstorage
  5913. changegold($lcharacter - $lamount, $lstorage + $lamount)
  5914. EndFunc
  5915.  
  5916. Func withdrawgold($aamount = 0)
  5917. Local $lamount
  5918. Local $lstorage = getgoldstorage()
  5919. Local $lcharacter = getgoldcharacter()
  5920. If $aamount > 0 AND $lstorage >= $aamount Then
  5921. $lamount = $aamount
  5922. Else
  5923. $lamount = $lstorage
  5924. EndIf
  5925. If $lcharacter + $lamount > 100000 Then $lamount = 100000 - $lcharacter
  5926. changegold($lcharacter + $lamount, $lstorage - $lamount)
  5927. EndFunc
  5928.  
  5929. Func changegold($acharacter, $astorage)
  5930. Return sendpacket(12, 117, $acharacter, $astorage)
  5931. EndFunc
  5932.  
  5933. #EndRegion Item
  5934. #Region H&H
  5935.  
  5936. Func addhero($aheroid)
  5937. Return sendpacket(8, 22, $aheroid)
  5938. EndFunc
  5939.  
  5940. Func kickhero($aheroid)
  5941. Return sendpacket(8, 23, $aheroid)
  5942. EndFunc
  5943.  
  5944. Func kickallheroes()
  5945. Return sendpacket(8, 23, 38)
  5946. EndFunc
  5947.  
  5948. Func addnpc($anpcid)
  5949. Return sendpacket(8, 152, $anpcid)
  5950. EndFunc
  5951.  
  5952. Func kicknpc($anpcid)
  5953. Return sendpacket(8, 161, $anpcid)
  5954. EndFunc
  5955.  
  5956. Func cancelhero($aheronumber)
  5957. Local $lagentid = getheroid($aheronumber)
  5958. Return sendpacket(20, 18, $lagentid, 2139095040, 2139095040, 0)
  5959. EndFunc
  5960.  
  5961. Func cancelall()
  5962. Return sendpacket(16, 19, 2139095040, 2139095040, 0)
  5963. EndFunc
  5964.  
  5965. Func commandhero($aheronumber, $ax, $ay)
  5966. Return sendpacket(20, 18, getheroid($aheronumber), floattoint($ax), floattoint($ay), 0)
  5967. EndFunc
  5968.  
  5969. Func commandall($ax, $ay)
  5970. Return sendpacket(16, 19, floattoint($ax), floattoint($ay), 0)
  5971. EndFunc
  5972.  
  5973. Func lockherotarget($aheronumber, $aagentid = 0)
  5974. Local $lheroid = getheroid($aheronumber)
  5975. Return sendpacket(12, 14, $lheroid, $aagentid)
  5976. EndFunc
  5977.  
  5978. Func setheroaggression($aheronumber, $aaggression)
  5979. Local $lheroid = getheroid($aheronumber)
  5980. Return sendpacket(12, 13, $lheroid, $aaggression)
  5981. EndFunc
  5982.  
  5983. Func disableheroskillslot($aheronumber, $askillslot)
  5984. If NOT getisheroskillslotdisabled($aheronumber, $askillslot) Then changeheroskillslotstate($aheronumber, $askillslot)
  5985. EndFunc
  5986.  
  5987. Func enableheroskillslot($aheronumber, $askillslot)
  5988. If getisheroskillslotdisabled($aheronumber, $askillslot) Then changeheroskillslotstate($aheronumber, $askillslot)
  5989. EndFunc
  5990.  
  5991. Func changeheroskillslotstate($aheronumber, $askillslot)
  5992. Return sendpacket(12, 17, getheroid($aheronumber), $askillslot - 1)
  5993. EndFunc
  5994.  
  5995. Func useheroskill($ahero, $askillslot, $atarget = 0)
  5996. Local $ltargetid
  5997. If IsDllStruct($atarget) = 0 Then
  5998. $ltargetid = convertid($atarget)
  5999. Else
  6000. $ltargetid = DllStructGetData($atarget, "ID")
  6001. EndIf
  6002. DllStructSetData($museheroskill, 2, getheroid($ahero))
  6003. DllStructSetData($museheroskill, 3, $ltargetid)
  6004. DllStructSetData($museheroskill, 4, $askillslot - 1)
  6005. enqueue($museheroskillptr, 16)
  6006. EndFunc
  6007.  
  6008. #EndRegion H&H
  6009. #Region Movement
  6010.  
  6011. Func move($ax, $ay, $arandom = 50)
  6012. If getagentexists(-2) Then
  6013. DllStructSetData($mmove, 2, $ax + Random(-$arandom, $arandom))
  6014. DllStructSetData($mmove, 3, $ay + Random(-$arandom, $arandom))
  6015. enqueue($mmoveptr, 16)
  6016. Return True
  6017. Else
  6018. Return False
  6019. EndIf
  6020. EndFunc
  6021.  
  6022. Func moveto($ax, $ay, $arandom = 50)
  6023. Local $lblocked = 0
  6024. Local $lme
  6025. Local $lmaploading = getmaploading(), $lmaploadingold
  6026. Local $ldestx = $ax + Random(-$arandom, $arandom)
  6027. Local $ldesty = $ay + Random(-$arandom, $arandom)
  6028. move($ldestx, $ldesty, 0)
  6029. Do
  6030. Sleep(100)
  6031. $lme = getagentbyid(-2)
  6032. If DllStructGetData($lme, "HP") <= 0 Then ExitLoop
  6033. $lmaploadingold = $lmaploading
  6034. $lmaploading = getmaploading()
  6035. If $lmaploading <> $lmaploadingold Then ExitLoop
  6036. If DllStructGetData($lme, "MoveX") == 0 AND DllStructGetData($lme, "MoveY") == 0 Then
  6037. $lblocked += 1
  6038. $ldestx = $ax + Random(-$arandom, $arandom)
  6039. $ldesty = $ay + Random(-$arandom, $arandom)
  6040. move($ldestx, $ldesty, 0)
  6041. EndIf
  6042. Until computedistance(DllStructGetData($lme, "X"), DllStructGetData($lme, "Y"), $ldestx, $ldesty) < 25 OR $lblocked > 14
  6043. EndFunc
  6044.  
  6045. Func goplayer($aagent)
  6046. Local $lagentid
  6047. If IsDllStruct($aagent) = 0 Then
  6048. $lagentid = convertid($aagent)
  6049. Else
  6050. $lagentid = DllStructGetData($aagent, "ID")
  6051. EndIf
  6052. Return sendpacket(8, 44, $lagentid)
  6053. EndFunc
  6054.  
  6055. Func gonpc($aagent)
  6056. Local $lagentid
  6057. If IsDllStruct($aagent) = 0 Then
  6058. $lagentid = convertid($aagent)
  6059. Else
  6060. $lagentid = DllStructGetData($aagent, "ID")
  6061. EndIf
  6062. Return sendpacket(12, 50, $lagentid)
  6063. EndFunc
  6064.  
  6065. Func gotonpc($aagent)
  6066. If NOT IsDllStruct($aagent) Then $aagent = getagentbyid($aagent)
  6067. Local $lme
  6068. Local $lblocked = 0
  6069. Local $lmaploading = getmaploading(), $lmaploadingold
  6070. move(DllStructGetData($aagent, "X"), DllStructGetData($aagent, "Y"), 100)
  6071. Sleep(100)
  6072. gonpc($aagent)
  6073. Do
  6074. Sleep(100)
  6075. $lme = getagentbyid(-2)
  6076. If DllStructGetData($lme, "HP") <= 0 Then ExitLoop
  6077. $lmaploadingold = $lmaploading
  6078. $lmaploading = getmaploading()
  6079. If $lmaploading <> $lmaploadingold Then ExitLoop
  6080. If DllStructGetData($lme, "MoveX") == 0 AND DllStructGetData($lme, "MoveY") == 0 Then
  6081. $lblocked += 1
  6082. move(DllStructGetData($aagent, "X"), DllStructGetData($aagent, "Y"), 100)
  6083. Sleep(100)
  6084. gonpc($aagent)
  6085. EndIf
  6086. Until computedistance(DllStructGetData($lme, "X"), DllStructGetData($lme, "Y"), DllStructGetData($aagent, "X"), DllStructGetData($aagent, "Y")) < 250 OR $lblocked > 14
  6087. Sleep(getping() + Random(1500, 2000, 1))
  6088. EndFunc
  6089.  
  6090. Func gosignpost($aagent)
  6091. Local $lagentid
  6092. If IsDllStruct($aagent) = 0 Then
  6093. $lagentid = convertid($aagent)
  6094. Else
  6095. $lagentid = DllStructGetData($aagent, "ID")
  6096. EndIf
  6097. Return sendpacket(12, 74, $lagentid, 0)
  6098. EndFunc
  6099.  
  6100. Func gotosignpost($aagent)
  6101. If NOT IsDllStruct($aagent) Then $aagent = getagentbyid($aagent)
  6102. Local $lme
  6103. Local $lblocked = 0
  6104. Local $lmaploading = getmaploading(), $lmaploadingold
  6105. move(DllStructGetData($aagent, "X"), DllStructGetData($aagent, "Y"), 100)
  6106. Sleep(100)
  6107. gosignpost($aagent)
  6108. Do
  6109. Sleep(100)
  6110. $lme = getagentbyid(-2)
  6111. If DllStructGetData($lme, "HP") <= 0 Then ExitLoop
  6112. $lmaploadingold = $lmaploading
  6113. $lmaploading = getmaploading()
  6114. If $lmaploading <> $lmaploadingold Then ExitLoop
  6115. If DllStructGetData($lme, "MoveX") == 0 AND DllStructGetData($lme, "MoveY") == 0 Then
  6116. $lblocked += 1
  6117. move(DllStructGetData($aagent, "X"), DllStructGetData($aagent, "Y"), 100)
  6118. Sleep(100)
  6119. gosignpost($aagent)
  6120. EndIf
  6121. Until computedistance(DllStructGetData($lme, "X"), DllStructGetData($lme, "Y"), DllStructGetData($aagent, "X"), DllStructGetData($aagent, "Y")) < 250 OR $lblocked > 14
  6122. Sleep(getping() + Random(1500, 2000, 1))
  6123. EndFunc
  6124.  
  6125. Func attack($aagent, $acalltarget = False)
  6126. Local $lagentid
  6127. If IsDllStruct($aagent) = 0 Then
  6128. $lagentid = convertid($aagent)
  6129. Else
  6130. $lagentid = DllStructGetData($aagent, "ID")
  6131. EndIf
  6132. Return sendpacket(12, 31, $lagentid, $acalltarget)
  6133. EndFunc
  6134.  
  6135. Func turnleft($aturn)
  6136. If $aturn Then
  6137. Return performaction(162, 24)
  6138. Else
  6139. Return performaction(162, 26)
  6140. EndIf
  6141. EndFunc
  6142.  
  6143. Func turnright($aturn)
  6144. If $aturn Then
  6145. Return performaction(163, 24)
  6146. Else
  6147. Return performaction(163, 26)
  6148. EndIf
  6149. EndFunc
  6150.  
  6151. Func movebackward($amove)
  6152. If $amove Then
  6153. Return performaction(172, 24)
  6154. Else
  6155. Return performaction(172, 26)
  6156. EndIf
  6157. EndFunc
  6158.  
  6159. Func moveforward($amove)
  6160. If $amove Then
  6161. Return performaction(173, 24)
  6162. Else
  6163. Return performaction(173, 26)
  6164. EndIf
  6165. EndFunc
  6166.  
  6167. Func strafeleft($astrafe)
  6168. If $astrafe Then
  6169. Return performaction(145, 24)
  6170. Else
  6171. Return performaction(145, 26)
  6172. EndIf
  6173. EndFunc
  6174.  
  6175. Func straferight($astrafe)
  6176. If $astrafe Then
  6177. Return performaction(146, 24)
  6178. Else
  6179. Return performaction(146, 26)
  6180. EndIf
  6181. EndFunc
  6182.  
  6183. Func toggleautorun()
  6184. Return performaction(183, 24)
  6185. EndFunc
  6186.  
  6187. Func reversedirection()
  6188. Return performaction(177, 24)
  6189. EndFunc
  6190.  
  6191. #EndRegion Movement
  6192. #Region Travel
  6193.  
  6194. Func travelto($amapid, $adis = 0)
  6195. If getmapid() = $amapid AND $adis = 0 AND getmaploading() = 0 Then Return True
  6196. zonemap($amapid, $adis)
  6197. Return waitmaploading($amapid)
  6198. EndFunc
  6199.  
  6200. Func zonemap($amapid, $adistrict = 0)
  6201. movemap($amapid, getregion(), $adistrict, getlanguage())
  6202. EndFunc
  6203.  
  6204. Func movemap($amapid, $aregion, $adistrict, $alanguage)
  6205. Return sendpacket(24, 170, $amapid, $aregion, $adistrict, $alanguage, False)
  6206. EndFunc
  6207.  
  6208. Func returntooutpost()
  6209. Return sendpacket(4, 160)
  6210. EndFunc
  6211.  
  6212. Func enterchallenge()
  6213. Return sendpacket(8, 158, 1)
  6214. EndFunc
  6215.  
  6216. Func enterchallengeforeign()
  6217. Return sendpacket(8, 158, 0)
  6218. EndFunc
  6219.  
  6220. Func travelgh()
  6221. Local $loffset[3] = [0, 24, 60]
  6222. Local $lgh = memoryreadptr($mbasepointer, $loffset)
  6223. sendpacket(24, 169, memoryread($lgh[1] + 100), memoryread($lgh[1] + 104), memoryread($lgh[1] + 108), memoryread($lgh[1] + 112), 1)
  6224. Return waitmaploading()
  6225. EndFunc
  6226.  
  6227. Func leavegh()
  6228. sendpacket(8, 171, 1)
  6229. Return waitmaploading()
  6230. EndFunc
  6231.  
  6232. #EndRegion Travel
  6233. #Region Quest
  6234.  
  6235. Func acceptquest($aquestid)
  6236. Return sendpacket(8, 52, "0x008" & Hex($aquestid, 3) & "01")
  6237. EndFunc
  6238.  
  6239. Func questreward($aquestid)
  6240. Return sendpacket(8, 52, "0x008" & Hex($aquestid, 3) & "07")
  6241. EndFunc
  6242.  
  6243. Func abandonquest($aquestid)
  6244. Return sendpacket(8, 9, $aquestid)
  6245. EndFunc
  6246.  
  6247. #EndRegion Quest
  6248. #Region Windows
  6249.  
  6250. Func closeallpanels()
  6251. Return performaction(133, 24)
  6252. EndFunc
  6253.  
  6254. Func toggleherowindow()
  6255. Return performaction(138, 24)
  6256. EndFunc
  6257.  
  6258. Func toggleinventory()
  6259. Return performaction(139, 24)
  6260. EndFunc
  6261.  
  6262. Func toggleallbags()
  6263. Return performaction(184, 24)
  6264. EndFunc
  6265.  
  6266. Func toggleworldmap()
  6267. Return performaction(140, 24)
  6268. EndFunc
  6269.  
  6270. Func toggleoptions()
  6271. Return performaction(141, 24)
  6272. EndFunc
  6273.  
  6274. Func togglequestwindow()
  6275. Return performaction(142, 24)
  6276. EndFunc
  6277.  
  6278. Func toggleskillwindow()
  6279. Return performaction(143, 24)
  6280. EndFunc
  6281.  
  6282. Func togglemissionmap()
  6283. Return performaction(182, 24)
  6284. EndFunc
  6285.  
  6286. Func togglefriendlist()
  6287. Return performaction(185, 24)
  6288. EndFunc
  6289.  
  6290. Func toggleguildwindow()
  6291. Return performaction(186, 24)
  6292. EndFunc
  6293.  
  6294. Func togglepartywindow()
  6295. Return performaction(191, 24)
  6296. EndFunc
  6297.  
  6298. Func togglescorechart()
  6299. Return performaction(189, 24)
  6300. EndFunc
  6301.  
  6302. Func togglelayoutwindow()
  6303. Return performaction(193, 24)
  6304. EndFunc
  6305.  
  6306. Func toggleminionlist()
  6307. Return performaction(194, 24)
  6308. EndFunc
  6309.  
  6310. Func toggleheropanel($ahero)
  6311. If $ahero < 4 Then
  6312. Return performaction(219 + $ahero, 24)
  6313. ElseIf $ahero < 8 Then
  6314. Return performaction(254 + $ahero, 24)
  6315. EndIf
  6316. EndFunc
  6317.  
  6318. Func toggleheropetpanel($ahero)
  6319. If $ahero < 4 Then
  6320. Return performaction(223 + $ahero, 24)
  6321. ElseIf $ahero < 8 Then
  6322. Return performaction(250 + $ahero, 24)
  6323. EndIf
  6324. EndFunc
  6325.  
  6326. Func togglepetpanel()
  6327. Return performaction(223, 24)
  6328. EndFunc
  6329.  
  6330. Func togglehelpwindow()
  6331. Return performaction(228, 24)
  6332. EndFunc
  6333.  
  6334. #EndRegion Windows
  6335. #Region Targeting
  6336.  
  6337. Func changetarget($aagent)
  6338. Local $lagentid
  6339. If IsDllStruct($aagent) = 0 Then
  6340. $lagentid = convertid($aagent)
  6341. Else
  6342. $lagentid = DllStructGetData($aagent, "ID")
  6343. EndIf
  6344. DllStructSetData($mchangetarget, 2, $lagentid)
  6345. enqueue($mchangetargetptr, 8)
  6346. EndFunc
  6347.  
  6348. Func calltarget($atarget)
  6349. Local $ltargetid
  6350. If IsDllStruct($atarget) = 0 Then
  6351. $ltargetid = convertid($atarget)
  6352. Else
  6353. $ltargetid = DllStructGetData($atarget, "ID")
  6354. EndIf
  6355. Return sendpacket(12, 27, 10, $ltargetid)
  6356. EndFunc
  6357.  
  6358. Func cleartarget()
  6359. Return performaction(227, 24)
  6360. EndFunc
  6361.  
  6362. Func targetnearestenemy()
  6363. Return performaction(147, 24)
  6364. EndFunc
  6365.  
  6366. Func targetnextenemy()
  6367. Return performaction(149, 24)
  6368. EndFunc
  6369.  
  6370. Func targetpartymember($anumber)
  6371. If $anumber > 0 AND $anumber < 13 Then Return performaction(149 + $anumber, 24)
  6372. EndFunc
  6373.  
  6374. Func targetpreviousenemy()
  6375. Return performaction(158, 24)
  6376. EndFunc
  6377.  
  6378. Func targetcalledtarget()
  6379. Return performaction(159, 24)
  6380. EndFunc
  6381.  
  6382. Func targetself()
  6383. Return performaction(160, 24)
  6384. EndFunc
  6385.  
  6386. Func targetnearestally()
  6387. Return performaction(188, 24)
  6388. EndFunc
  6389.  
  6390. Func targetnearestitem()
  6391. Return performaction(195, 24)
  6392. EndFunc
  6393.  
  6394. Func targetnextitem()
  6395. Return performaction(196, 24)
  6396. EndFunc
  6397.  
  6398. Func targetpreviousitem()
  6399. Return performaction(197, 24)
  6400. EndFunc
  6401.  
  6402. Func targetnextpartymember()
  6403. Return performaction(202, 24)
  6404. EndFunc
  6405.  
  6406. Func targetpreviouspartymember()
  6407. Return performaction(203, 24)
  6408. EndFunc
  6409.  
  6410. #EndRegion Targeting
  6411. #Region Display
  6412.  
  6413. Func enablerendering()
  6414. memorywrite($mdenderingndering, 0)
  6415. EndFunc
  6416.  
  6417. Func disablerendering()
  6418. memorywrite($mdenderingndering, 1)
  6419. EndFunc
  6420.  
  6421. Func displayall($adisplay)
  6422. displayallies($adisplay)
  6423. displayenemies($adisplay)
  6424. EndFunc
  6425.  
  6426. Func displayallies($adisplay)
  6427. If $adisplay Then
  6428. Return performaction(137, 24)
  6429. Else
  6430. Return performaction(137, 26)
  6431. EndIf
  6432. EndFunc
  6433.  
  6434. Func displayenemies($adisplay)
  6435. If $adisplay Then
  6436. Return performaction(148, 24)
  6437. Else
  6438. Return performaction(148, 26)
  6439. EndIf
  6440. EndFunc
  6441.  
  6442. #EndRegion Display
  6443. #Region Chat
  6444.  
  6445. Func writechat($amessage, $asender = "GWAІ")
  6446. Local $lmessage, $lsender
  6447. Local $laddress = 256 * $mqueuecounter + $mqueuebase
  6448. If $mqueuecounter = $mqueuesize Then
  6449. $mqueuecounter = 0
  6450. Else
  6451. $mqueuecounter = $mqueuecounter + 1
  6452. EndIf
  6453. If StringLen($asender) > 19 Then
  6454. $lsender = StringLeft($asender, 19)
  6455. Else
  6456. $lsender = $asender
  6457. EndIf
  6458. memorywrite($laddress + 4, $lsender, "wchar[20]")
  6459. If StringLen($amessage) > 100 Then
  6460. $lmessage = StringLeft($amessage, 100)
  6461. Else
  6462. $lmessage = $amessage
  6463. EndIf
  6464. memorywrite($laddress + 44, $lmessage, "wchar[101]")
  6465. DllCall($mkernelhandle, "int", "WrissMemorysMemory", "int", $mgwprochandle, "int", $laddress, "ptr", $mwritechatptr, "int", 4, "int", "")
  6466. If StringLen($amessage) > 100 Then writechat(StringTrimLeft($amessage, 100), $asender)
  6467. EndFunc
  6468.  
  6469. Func sendwhisper($areceiver, $amessage)
  6470. Local $ltotal = "whisper " & $areceiver & "," & $amessage
  6471. Local $lmessage
  6472. If StringLen($ltotal) > 120 Then
  6473. $lmessage = StringLeft($ltotal, 120)
  6474. Else
  6475. $lmessage = $ltotal
  6476. EndIf
  6477. sendchat($lmessage, "/")
  6478. If StringLen($ltotal) > 120 Then sendwhisper($areceiver, StringTrimLeft($ltotal, 120))
  6479. EndFunc
  6480.  
  6481. Func sendchat($amessage, $achannel = "!")
  6482. Local $lmessage
  6483. Local $laddress = 256 * $mqueuecounter + $mqueuebase
  6484. If $mqueuecounter = $mqueuesize Then
  6485. $mqueuecounter = 0
  6486. Else
  6487. $mqueuecounter = $mqueuecounter + 1
  6488. EndIf
  6489. If StringLen($amessage) > 120 Then
  6490. $lmessage = StringLeft($amessage, 120)
  6491. Else
  6492. $lmessage = $amessage
  6493. EndIf
  6494. memorywrite($laddress + 8, $achannel & $lmessage, "wchar[122]")
  6495. DllCall($mkernelhandle, "int", "WrissMemorysMemory", "int", $mgwprochandle, "int", $laddress, "ptr", $msendchatptr, "int", 8, "int", "")
  6496. If StringLen($amessage) > 120 Then sendchat(StringTrimLeft($amessage, 120), $achannel)
  6497. EndFunc
  6498.  
  6499. #EndRegion Chat
  6500. #Region Misc
  6501.  
  6502. Func changeweaponset($aset)
  6503. Return performaction(128 + $aset, 24)
  6504. EndFunc
  6505.  
  6506. Func useskill($askillslot, $atarget, $acalltarget = False)
  6507. Local $ltargetid
  6508. If IsDllStruct($atarget) = 0 Then
  6509. $ltargetid = convertid($atarget)
  6510. Else
  6511. $ltargetid = DllStructGetData($atarget, "ID")
  6512. EndIf
  6513. DllStructSetData($museskill, 2, $askillslot)
  6514. DllStructSetData($museskill, 3, $ltargetid)
  6515. DllStructSetData($museskill, 4, $acalltarget)
  6516. enqueue($museskillptr, 16)
  6517. EndFunc
  6518.  
  6519. Func cancelaction()
  6520. Return sendpacket(4, 33)
  6521. EndFunc
  6522.  
  6523. Func actioninteract()
  6524. Return performaction(128, 24)
  6525. EndFunc
  6526.  
  6527. Func actionfollow()
  6528. Return performaction(204, 24)
  6529. EndFunc
  6530.  
  6531. Func dropbundle()
  6532. Return performaction(205, 24)
  6533. EndFunc
  6534.  
  6535. Func clearpartycommands()
  6536. Return performaction(219, 24)
  6537. EndFunc
  6538.  
  6539. Func suppressaction($asuppress)
  6540. If $asuppress Then
  6541. Return performaction(208, 24)
  6542. Else
  6543. Return performaction(208, 26)
  6544. EndIf
  6545. EndFunc
  6546.  
  6547. Func openchest()
  6548. Return sendpacket(8, 76, 2)
  6549. EndFunc
  6550.  
  6551. Func dropbuff($askillid, $aagentid, $aheronumber = 0)
  6552. Local $lbuffstruct = DllStructCreate("long SkillId;byte unknown1[4];loITargetITargetITargetId")
  6553. Local $lbuffcount = getbuffcount($aheronumber)
  6554. Local $lbutaddressaddress
  6555. Local $loffset[4]
  6556. $loffset[0] = 0
  6557. $loffset[1] = 24
  6558. $loffset[2] = 44
  6559. $loffset[3] = 1296
  6560. Local $lcount = memoryreadptr($mbasepointer, $loffset)
  6561. ReDim $loffset[5]
  6562. $loffset[3] = 1288
  6563. Local $lbuffer
  6564. For $i = 0 To $lcount[1] - 1
  6565. $loffset[4] = 36 * $i
  6566. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  6567. If $lbuffer[1] == getheroid($aheronumber) Then
  6568. $loffset[4] = 4 + 36 * $i
  6569. ReDim $loffset[6]
  6570. For $j = 0 To $lbuffcount - 1
  6571. $loffset[5] = 0 + 16 * $j
  6572. $lbutaddressaddress = memoryreadptr($mbasepointer, $loffset)
  6573. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lbutaddressaddress[0], "ptr", DllStructGetPtr($lbuffstruct), "int", DllStructGetSize($lbuffstruct), "int", "")
  6574. If (DllStructGetData($lbuffstruct, "SkillID") == $askillid) AND (DllStructGetData($lbuffstruct, "TargetId") == convertid($aagentid)) Then
  6575. Return sendpacket(8, 34, DllStructGetData($lbuffstruct, "BuffId"))
  6576. ExitLoop 2
  6577. EndIf
  6578. Next
  6579. EndIf
  6580. Next
  6581. EndFunc
  6582.  
  6583. Func makescreenshot()
  6584. Return performaction(174, 24)
  6585. EndFunc
  6586.  
  6587. Func inviteplayer($aplayername)
  6588. sendchat("invite " & $aplayername, "/")
  6589. EndFunc
  6590.  
  6591. Func leavegroup($akickheroes = True)
  6592. If $akickheroes Then kickallheroes()
  6593. Return sendpacket(4, 155)
  6594. EndFunc
  6595.  
  6596. Func switchmode($amode)
  6597. Return sendpacket(8, 148, $amode)
  6598. EndFunc
  6599.  
  6600. Func resign()
  6601. sendchat("resign", "/")
  6602. EndFunc
  6603.  
  6604. Func donatefaction($afaction)
  6605. If StringLeft($afaction, 1) = "k" Then
  6606. Return sendpacket(16, 46, 0, 0, 5000)
  6607. Else
  6608. Return sendpacket(16, 46, 0, 1, 5000)
  6609. EndIf
  6610. EndFunc
  6611.  
  6612. Func dialog($adialogid)
  6613. Return sendpacket(8, 52, $adialogid)
  6614. EndFunc
  6615.  
  6616. Func skipcinematic()
  6617. Return sendpacket(4, 92)
  6618. EndFunc
  6619.  
  6620. Func setskillbarskill($aslot, $askillid, $aheronumber = 0)
  6621. Return sendpacket(20, 84, getheroid($aheronumber), $aslot - 1, $askillid, 0)
  6622. EndFunc
  6623.  
  6624. Func loadskillbar($askill1 = 0, $askill2 = 0, $askill3 = 0, $askill4 = 0, $askill5 = 0, $askill6 = 0, $askill7 = 0, $askill8 = 0, $aheronumber = 0)
  6625. sendpacket(44, 85, getheroid($aheronumber), 8, $askill1, $askill2, $askill3, $askill4, $askill5, $askill6, $askill7, $askill8)
  6626. EndFunc
  6627.  
  6628. Func loadskilltemplate($atemplate, $aheronumber = 0)
  6629. Local $lheroid = getheroid($aheronumber)
  6630. Local $lsplittemplate = StringSplit($atemplate, "")
  6631. Local $ltemplatetype
  6632. Local $lversionnumber
  6633. Local $lprofbits
  6634. Local $lprofprimary
  6635. Local $lprofsecondary
  6636. Local $lattributescount
  6637. Local $lattributesbits
  6638. Local $lattributes[1][2]
  6639. Local $lskillsbits
  6640. Local $lskills[8]
  6641. Local $loptail
  6642. $atemplate = ""
  6643. For $i = 1 To $lsplittemplate[0]
  6644. $atemplate &= base64tobin64($lsplittemplate[$i])
  6645. Next
  6646. $ltemplatetype = bin64todec(StringLeft($atemplate, 4))
  6647. $atemplate = StringTrimLeft($atemplate, 4)
  6648. If $ltemplatetype <> 14 Then Return False
  6649. $lversionnumber = bin64todec(StringLeft($atemplate, 4))
  6650. $atemplate = StringTrimLeft($atemplate, 4)
  6651. $lprofbits = bin64todec(StringLeft($atemplate, 2)) * 2 + 4
  6652. $atemplate = StringTrimLeft($atemplate, 2)
  6653. $lprofprimary = bin64todec(StringLeft($atemplate, $lprofbits))
  6654. $atemplate = StringTrimLeft($atemplate, $lprofbits)
  6655. If $lprofprimary <> getheroprofession($aheronumber) Then Return False
  6656. $lprofsecondary = bin64todec(StringLeft($atemplate, $lprofbits))
  6657. $atemplate = StringTrimLeft($atemplate, $lprofbits)
  6658. $lattributescount = bin64todec(StringLeft($atemplate, 4))
  6659. $atemplate = StringTrimLeft($atemplate, 4)
  6660. $lattributesbits = bin64todec(StringLeft($atemplate, 4)) + 4
  6661. $atemplate = StringTrimLeft($atemplate, 4)
  6662. $lattributes[0][0] = $lattributescount
  6663. For $i = 1 To $lattributescount
  6664. If bin64todec(StringLeft($atemplate, $lattributesbits)) == getprofprimaryattribute($lprofprimary) Then
  6665. $atemplate = StringTrimLeft($atemplate, $lattributesbits)
  6666. $lattributes[0][1] = bin64todec(StringLeft($atemplate, 4))
  6667. $atemplate = StringTrimLeft($atemplate, 4)
  6668. ContinueLoop
  6669. EndIf
  6670. $lattributes[0][0] += 1
  6671. ReDim $lattributes[$lattributes[0][0] + 1][2]
  6672. $lattributes[$i][0] = bin64todec(StringLeft($atemplate, $lattributesbits))
  6673. $atemplate = StringTrimLeft($atemplate, $lattributesbits)
  6674. $lattributes[$i][1] = bin64todec(StringLeft($atemplate, 4))
  6675. $atemplate = StringTrimLeft($atemplate, 4)
  6676. Next
  6677. $lskillsbits = bin64todec(StringLeft($atemplate, 4)) + 8
  6678. $atemplate = StringTrimLeft($atemplate, 4)
  6679. For $i = 0 To 7
  6680. $lskills[$i] = bin64todec(StringLeft($atemplate, $lskillsbits))
  6681. $atemplate = StringTrimLeft($atemplate, $lskillsbits)
  6682. Next
  6683. $loptail = bin64todec($atemplate)
  6684. $lattributes[0][0] = $lprofsecondary
  6685. loadattributes($lattributes, $aheronumber)
  6686. loadskillbar($lskills[0], $lskills[1], $lskills[2], $lskills[3], $lskills[4], $lskills[5], $lskills[6], $lskills[7], $aheronumber)
  6687. EndFunc
  6688.  
  6689. Func loadattributes($aattributesarray, $aheronumber = 0)
  6690. Local $lpttributetribute
  6691. Local $ldeadlock
  6692. Local $lheroid = getheroid($aheronumber)
  6693. Local $llevel
  6694. $lpttributetribute = getprofprimaryattribute(getheroprofession($aheronumber))
  6695. If $aattributesarray[0][0] <> 0 AND getheroprofession($aheronumber, True) <> $aattributesarray[0][0] AND getheroprofession($aheronumber) <> $aattributesarray[0][0] Then
  6696. Do
  6697. $ldeadlock = TimerInit()
  6698. changesecondprofession($aattributesarray[0][0], $aheronumber)
  6699. Do
  6700. Sleep(20)
  6701. Until getheroprofession($aheronumber, True) == $aattributesarray[0][0] OR TimerDiff($ldeadlock) > 5000
  6702. Until getheroprofession($aheronumber, True) == $aattributesarray[0][0]
  6703. EndIf
  6704. $aattributesarray[0][0] = $lpttributetribute
  6705. For $i = 0 To UBound($aattributesarray) - 1
  6706. If $aattributesarray[$i][1] > 12 Then $aattributesarray[$i][1] = 12
  6707. If $aattributesarray[$i][1] < 0 Then $aattributesarray[$i][1] = 0
  6708. Next
  6709. While getattributebyid($lpttributetribute, False, $aheronumber) > $aattributesarray[0][1]
  6710. $llevel = getattributebyid($lpttributetribute, False, $aheronumber)
  6711. $ldeadlock = TimerInit()
  6712. decreaseattribute($lpttributetribute, $aheronumber)
  6713. Do
  6714. Sleep(20)
  6715. Until getattributebyid($lpttributetribute, False, $aheronumber) < $llevel OR TimerDiff($ldeadlock) > 5000
  6716. tolsleep()
  6717. WEnd
  6718. For $i = 1 To UBound($aattributesarray) - 1
  6719. While getattributebyid($aattributesarray[$i][0], False, $aheronumber) > $aattributesarray[$i][1]
  6720. $llevel = getattributebyid($aattributesarray[$i][0], False, $aheronumber)
  6721. $ldeadlock = TimerInit()
  6722. decreaseattribute($aattributesarray[$i][0], $aheronumber)
  6723. Do
  6724. Sleep(20)
  6725. Until getattributebyid($aattributesarray[$i][0], False, $aheronumber) < $llevel OR TimerDiff($ldeadlock) > 5000
  6726. tolsleep()
  6727. WEnd
  6728. Next
  6729. For $i = 0 To 44
  6730. If getattributebyid($i, False, $aheronumber) > 0 Then
  6731. If $i = $lpttributetribute Then ContinueLoop
  6732. For $j = 1 To UBound($aattributesarray) - 1
  6733. If $i = $aattributesarray[$j][0] Then ContinueLoop 2
  6734. Local $ldummy
  6735. Next
  6736. While getattributebyid($i, False, $aheronumber) > 0
  6737. $llevel = getattributebyid($i, False, $aheronumber)
  6738. $ldeadlock = TimerInit()
  6739. decreaseattribute($i, $aheronumber)
  6740. Do
  6741. Sleep(20)
  6742. Until getattributebyid($i, False, $aheronumber) < $llevel OR TimerDiff($ldeadlock) > 5000
  6743. tolsleep()
  6744. WEnd
  6745. EndIf
  6746. Next
  6747. While getattributebyid($lpttributetribute, False, $aheronumber) < $aattributesarray[0][1]
  6748. $llevel = getattributebyid($lpttributetribute, False, $aheronumber)
  6749. $ldeadlock = TimerInit()
  6750. increaseattribute($lpttributetribute, $aheronumber)
  6751. Do
  6752. Sleep(20)
  6753. Until getattributebyid($lpttributetribute, False, $aheronumber) > $llevel OR TimerDiff($ldeadlock) > 5000
  6754. tolsleep()
  6755. WEnd
  6756. For $i = 1 To UBound($aattributesarray) - 1
  6757. While getattributebyid($aattributesarray[$i][0], False, $aheronumber) < $aattributesarray[$i][1]
  6758. $llevel = getattributebyid($aattributesarray[$i][0], False, $aheronumber)
  6759. $ldeadlock = TimerInit()
  6760. increaseattribute($aattributesarray[$i][0], $aheronumber)
  6761. Do
  6762. Sleep(20)
  6763. Until getattributebyid($aattributesarray[$i][0], False, $aheronumber) > $llevel OR TimerDiff($ldeadlock) > 5000
  6764. tolsleep()
  6765. WEnd
  6766. Next
  6767. EndFunc
  6768.  
  6769. Func increaseattribute($aattributeid, $aheronumber = 0)
  6770. DllStructSetData($minttributetribute, 2, $aattributeid)
  6771. DllStructSetData($minttributetribute, 3, getheroid($aheronumber))
  6772. enqueue($mincreibuteptrbuteptr, 12)
  6773. EndFunc
  6774.  
  6775. Func decreaseattribute($aattributeid, $aheronumber = 0)
  6776. DllStructSetData($mdettributetribute, 2, $aattributeid)
  6777. DllStructSetData($mdettributetribute, 3, getheroid($aheronumber))
  6778. enqueue($mdecreibuteptrbuteptr, 12)
  6779. EndFunc
  6780.  
  6781. Func clearattributes($aheronumber = 0)
  6782. Local $llevel
  6783. If getmaploading() <> 0 Then Return
  6784. For $i = 0 To 44
  6785. If getattributebyid($i, False, $aheronumber) > 0 Then
  6786. Do
  6787. $llevel = getattributebyid($i, False, $aheronumber)
  6788. $ldeadlock = TimerInit()
  6789. decreaseattribute($i, $aheronumber)
  6790. Do
  6791. Sleep(20)
  6792. Until $llevel > getattributebyid($i, False, $aheronumber) OR TimerDiff($ldeadlock) > 5000
  6793. Sleep(100)
  6794. Until getattributebyid($i, False, $aheronumber) == 0
  6795. EndIf
  6796. Next
  6797. EndFunc
  6798.  
  6799. Func changesecondprofession($aprofession, $aheronumber = 0)
  6800. Return sendpacket(12, 58, getheroid($aheronumber), $aprofession)
  6801. EndFunc
  6802.  
  6803. Func initmapload()
  6804. memorywrite($mmapisloaded, 0)
  6805. EndFunc
  6806.  
  6807. Func ensureenglish($aensure)
  6808. If $aensure Then
  6809. memorywrite($mensureenglish, 1)
  6810. Else
  6811. memorywrite($mensureenglish, 0)
  6812. EndIf
  6813. EndFunc
  6814.  
  6815. Func togglelanguage()
  6816. DllStructSetData($mtogglelanguage, 2, 24)
  6817. enqueue($mtoguageptruageptr, 8)
  6818. EndFunc
  6819.  
  6820. Func changemaxzoom($azoom = 750)
  6821. memorywrite($mzoomstill, $azoom, "float")
  6822. memorywrite($mzoommoving, $azoom, "float")
  6823. EndFunc
  6824.  
  6825. Func clearmemory()
  6826. DllCall($mkernelhandle, "int", "SetProcesgSetSizgSetSize", "int", $mgwprochandle, "int", -1, "int", -1)
  6827. EndFunc
  6828.  
  6829. Func setmaxmemory($amemory = 157286400)
  6830. DllCall($mkernelhandle, "int", "SetProcessWetSizeEetSizeEx", "int", $mgwprochandle, "int", 1, "int", $amemory, "int", 6)
  6831. EndFunc
  6832.  
  6833. #EndRegion Misc
  6834.  
  6835. Func enqueue($aptr, $asize)
  6836. DllCall($mkernelhandle, "int", "WrissMemorysMemory", "int", $mgwprochandle, "int", 256 * $mqueuecounter + $mqueuebase, "ptr", $aptr, "int", $asize, "int", "")
  6837. If $mqueuecounter = $mqueuesize Then
  6838. $mqueuecounter = 0
  6839. Else
  6840. $mqueuecounter = $mqueuecounter + 1
  6841. EndIf
  6842. EndFunc
  6843.  
  6844. Func floattoint($nfloat)
  6845. Local $tfloat = DllStructCreate("float")
  6846. Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
  6847. DllStructSetData($tfloat, 1, $nfloat)
  6848. Return DllStructGetData($tint, 1)
  6849. EndFunc
  6850.  
  6851. #EndRegion Commands
  6852. #Region Queries
  6853. #Region Titles
  6854.  
  6855. Func getherotitle()
  6856. Local $loffset[5] = [0, 24, 44, 2076, 4]
  6857. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6858. Return $lreturn[1]
  6859. EndFunc
  6860.  
  6861. Func getgladiatortitle()
  6862. Local $loffset[5] = [0, 24, 44, 2076, 124]
  6863. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6864. Return $lreturn[1]
  6865. EndFunc
  6866.  
  6867. Func getkurzicktitle()
  6868. Local $loffset[5] = [0, 24, 44, 2076, 204]
  6869. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6870. Return $lreturn[1]
  6871. EndFunc
  6872.  
  6873. Func getluxontitle()
  6874. Local $loffset[5] = [0, 24, 44, 2076, 244]
  6875. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6876. Return $lreturn[1]
  6877. EndFunc
  6878.  
  6879. Func getdrunkardtitle()
  6880. Local $loffset[5] = [0, 24, 44, 2076, 284]
  6881. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6882. Return $lreturn[1]
  6883. EndFunc
  6884.  
  6885. Func getsurvivortitle()
  6886. Local $loffset[5] = [0, 24, 44, 2076, 364]
  6887. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6888. Return $lreturn[1]
  6889. EndFunc
  6890.  
  6891. Func getmaxtitles()
  6892. Local $loffset[5] = [0, 24, 44, 2076, 404]
  6893. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6894. Return $lreturn[1]
  6895. EndFunc
  6896.  
  6897. Func getluckytitle()
  6898. Local $loffset[5] = [0, 24, 44, 2076, 604]
  6899. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6900. Return $lreturn[1]
  6901. EndFunc
  6902.  
  6903. Func getunluckytitle()
  6904. Local $loffset[5] = [0, 24, 44, 2076, 644]
  6905. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6906. Return $lreturn[1]
  6907. EndFunc
  6908.  
  6909. Func getsunspeartitle()
  6910. Local $loffset[5] = [0, 24, 44, 2076, 684]
  6911. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6912. Return $lreturn[1]
  6913. EndFunc
  6914.  
  6915. Func getlightbringertitle()
  6916. Local $loffset[5] = [0, 24, 44, 2076, 804]
  6917. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6918. Return $lreturn[1]
  6919. EndFunc
  6920.  
  6921. Func getcommandertitle()
  6922. Local $loffset[5] = [0, 24, 44, 2076, 884]
  6923. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6924. Return $lreturn[1]
  6925. EndFunc
  6926.  
  6927. Func getgamertitle()
  6928. Local $loffset[5] = [0, 24, 44, 2076, 924]
  6929. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6930. Return $lreturn[1]
  6931. EndFunc
  6932.  
  6933. Func getlegendaryguardiantitle()
  6934. Local $loffset[5] = [0, 24, 44, 2076, 1244]
  6935. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6936. Return $lreturn[1]
  6937. EndFunc
  6938.  
  6939. Func getsweettitle()
  6940. Local $loffset[5] = [0, 24, 44, 2076, 1364]
  6941. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6942. Return $lreturn[1]
  6943. EndFunc
  6944.  
  6945. Func getasuratitle()
  6946. Local $loffset[5] = [0, 24, 44, 2076, 1524]
  6947. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6948. Return $lreturn[1]
  6949. EndFunc
  6950.  
  6951. Func getdeldrimortitle()
  6952. Local $loffset[5] = [0, 24, 44, 2076, 1564]
  6953. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6954. Return $lreturn[1]
  6955. EndFunc
  6956.  
  6957. Func getvanguardtitle()
  6958. Local $loffset[5] = [0, 24, 44, 2076, 1604]
  6959. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6960. Return $lreturn[1]
  6961. EndFunc
  6962.  
  6963. Func getnorntitle()
  6964. Local $loffset[5] = [0, 24, 44, 2076, 1644]
  6965. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6966. Return $lreturn[1]
  6967. EndFunc
  6968.  
  6969. Func getnorthmasterytitle()
  6970. Local $loffset[5] = [0, 24, 44, 2076, 1684]
  6971. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6972. Return $lreturn[1]
  6973. EndFunc
  6974.  
  6975. Func getpartytitle()
  6976. Local $loffset[5] = [0, 24, 44, 2076, 1724]
  6977. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6978. Return $lreturn[1]
  6979. EndFunc
  6980.  
  6981. Func getzaishentitle()
  6982. Local $loffset[5] = [0, 24, 44, 2076, 1764]
  6983. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6984. Return $lreturn[1]
  6985. EndFunc
  6986.  
  6987. Func gettreasuretitle()
  6988. Local $loffset[5] = [0, 24, 44, 2076, 1804]
  6989. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6990. Return $lreturn[1]
  6991. EndFunc
  6992.  
  6993. Func getwisdomtitle()
  6994. Local $loffset[5] = [0, 24, 44, 2076, 1844]
  6995. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  6996. Return $lreturn[1]
  6997. EndFunc
  6998.  
  6999. #EndRegion Titles
  7000. #Region Faction
  7001.  
  7002. Func getkurzickfaction()
  7003. Local $loffset[4] = [0, 24, 44, 1864]
  7004. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7005. Return $lreturn[1]
  7006. EndFunc
  7007.  
  7008. Func getmaxkurzickfaction()
  7009. Local $loffset[4] = [0, 24, 44, 1976]
  7010. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7011. Return $lreturn[1]
  7012. EndFunc
  7013.  
  7014. Func getluxonfaction()
  7015. Local $loffset[4] = [0, 24, 44, 1880]
  7016. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7017. Return $lreturn[1]
  7018. EndFunc
  7019.  
  7020. Func getmaxluxonfaction()
  7021. Local $loffset[4] = [0, 24, 44, 1980]
  7022. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7023. Return $lreturn[1]
  7024. EndFunc
  7025.  
  7026. Func getbalthazarfaction()
  7027. Local $loffset[4] = [0, 24, 44, 1944]
  7028. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7029. Return $lreturn[1]
  7030. EndFunc
  7031.  
  7032. Func getmaxbalthazarfaction()
  7033. Local $loffset[4] = [0, 24, 44, 1984]
  7034. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7035. Return $lreturn[1]
  7036. EndFunc
  7037.  
  7038. Func getimperialfaction()
  7039. Local $loffset[4] = [0, 24, 44, 1900]
  7040. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7041. Return $lreturn[1]
  7042. EndFunc
  7043.  
  7044. Func getmaximperialfaction()
  7045. Local $loffset[4] = [0, 24, 44, 1988]
  7046. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7047. Return $lreturn[1]
  7048. EndFunc
  7049.  
  7050. #EndRegion Faction
  7051. #Region Item
  7052.  
  7053. Func getrarity($aitem)
  7054. If NOT IsDllStruct($aitem) Then $aitem = getitembyitemid($aitem)
  7055. Local $lptr = DllStructGetData($aitem, "NameString")
  7056. If $lptr == 0 Then Return
  7057. Return memoryread($lptr, "ushort")
  7058. EndFunc
  7059.  
  7060. Func getisided($aitem)
  7061. If NOT IsDllStruct($aitem) Then $aitem = getitembyitemid($aitem)
  7062. Return BitAND(DllStructGetData($aitem, "interaction"), 1) > 0
  7063. EndFunc
  7064.  
  7065. Func getitemreq($aitem)
  7066. Local $lmod = getmodbyidentifier($aitem, "9827")
  7067. Return $lmod[0]
  7068. EndFunc
  7069.  
  7070. Func getitemattribute($aitem)
  7071. Local $lmod = getmodbyidentifier($aitem, "9827")
  7072. Return $lmod[1]
  7073. EndFunc
  7074.  
  7075. Func getmodbyidentifier($aitem, $aidentifier)
  7076. If NOT IsDllStruct($aitem) Then $aitem = getitembyitemid($aitem)
  7077. Local $lreturn[2]
  7078. Local $lstring = StringTrimLeft(getmodstruct($aitem), 2)
  7079. For $i = 0 To StringLen($lstring) / 8 - 2
  7080. If StringMid($lstring, 8 * $i + 5, 4) == $aidentifier Then
  7081. $lreturn[0] = Int("0x" & StringMid($lstring, 8 * $i + 1, 2))
  7082. $lreturn[1] = Int("0x" & StringMid($lstring, 8 * $i + 3, 2))
  7083. ExitLoop
  7084. EndIf
  7085. Next
  7086. Return $lreturn
  7087. EndFunc
  7088.  
  7089. Func getmodstruct($aitem)
  7090. If NOT IsDllStruct($aitem) Then $aitem = getitembyitemid($aitem)
  7091. If DllStructGetData($aitem, "modstruct") = 0 Then Return
  7092. Return memoryread(DllStructGetData($aitem, "modstruct"), "Byte[" & DllStructGetData($aitem, "modstructsize") * 4 & "]")
  7093. EndFunc
  7094.  
  7095. Func getassignedtome($aagent)
  7096. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7097. Return (DllStructGetData($aagent, "Owner") = getmyid())
  7098. EndFunc
  7099.  
  7100. Func getcanpickup($aagent)
  7101. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7102. If getassignedtome($aagent) OR DllStructGetData($aagent, "Owner") = 0 Then
  7103. Return True
  7104. Else
  7105. Return False
  7106. EndIf
  7107. EndFunc
  7108.  
  7109. Func getbag($abag)
  7110. Local $loffset[5] = [0, 24, 64, 248, 4 * $abag]
  7111. Local $lbagstruct = DllStructCreate("byte 1[4];long index;longex;long id;ptr containerItem;long ItemsCount;ptr bagArray;mArray;loSng sloSng sloSng slotng slots")
  7112. Local $lbagptr = memoryreadptr($mbasepointer, $loffset)
  7113. If $lbagptr[1] = 0 Then Return
  7114. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lbagptr[1], "ptr", DllStructGetPtr($lbagstruct), "int", DllStructGetSize($lbagstruct), "int", "")
  7115. Return $lbagstruct
  7116. EndFunc
  7117.  
  7118. Func getitembyslot($abag, $aslot)
  7119. Local $lbag
  7120. If IsDllStruct($abag) = 0 Then
  7121. $lbag = getbag($abag)
  7122. Else
  7123. $lbag = $abag
  7124. EndIf
  7125. Local $litemptr = DllStructGetData($lbag, "ItemArray")
  7126. Local $lbuffer = DllStructCreate("ptr")
  7127. Local $litemstruct = DllStructCreate("long agentId;byte unknow unknown1[4];ptr bag;ptr modstruct;long modstructsize;ptr customized;byte unknown2[4];byte type;byte unknown3;short extraId;short value;byte unknown4[2];short interaction;long modelId;ptr modString;byte unknown5[4];ptr NameString;byte unknown6[15];byte quantity;bipped;bytwyte slwyte sloyte slotte slot")
  7128. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", DllStructGetData($lbag, "ItemArray") + 4 * ($aslot - 1), "ptr", DllStructGetPtr($lbuffer), "int", DllStructGetSize($lbuffer), "int", "")
  7129. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", DllStructGetData($lbuffer, 1), "ptr", DllStructGetPtr($litemstruct), "int", DllStructGetSize($litemstruct), "int", "")
  7130. Return $litemstruct
  7131. EndFunc
  7132.  
  7133. Func getitembyitemid($aitemid)
  7134. Local $litemstruct = DllStructCreate("long agentId;byte unknow unknown1[4];ptr bag;ptr modstruct;long modstructsize;ptr customized;byte unknown2[4];byte type;byte unknown3;short extraId;short value;byte unknown4[2];short interaction;long modelId;ptr modString;byte unknown5[4];ptr NameString;byte unknown6[15];byte quantity;bipped;bytwyte slwyte sloyte slotte slot")
  7135. Local $loffset[5] = [0, 24, 64, 184, 4 * $aitemid]
  7136. Local $litemptr = memoryreadptr($mbasepointer, $loffset)
  7137. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $litemptr[1], "ptr", DllStructGetPtr($litemstruct), "int", DllStructGetSize($litemstruct), "int", "")
  7138. Return $litemstruct
  7139. EndFunc
  7140.  
  7141. Func getitembyagentid($aagentid)
  7142. Local $litemstruct = DllStructCreate("long agentId;byte unknow unknown1[4];ptr bag;ptr modstruct;long modstructsize;ptr customized;byte unknown2[4];byte type;byte unknown3;short extraId;short value;byte unknown4[2];short interaction;long modelId;ptr modString;byte unknown5[4];ptr NameString;byte unknown6[15];byte quantity;bipped;bytwyte slwyte sloyte slotte slot")
  7143. Local $loffset[4] = [0, 24, 64, 192]
  7144. Local $litemarraysize = memoryreadptr($mbasepointer, $loffset)
  7145. Local $loffset[5] = [0, 24, 64, 184, 0]
  7146. Local $litemptr, $litemid
  7147. Local $lagentid = convertid($aagentid)
  7148. For $litemid = 1 To $litemarraysize[1]
  7149. $loffset[4] = 4 * $litemid
  7150. $litemptr = memoryreadptr($mbasepointer, $loffset)
  7151. If $litemptr[1] = 0 Then ContinueLoop
  7152. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $litemptr[1], "ptr", DllStructGetPtr($litemstruct), "int", DllStructGetSize($litemstruct), "int", "")
  7153. If DllStructGetData($litemstruct, "AgentID") = $lagentid Then Return $litemstruct
  7154. Next
  7155. EndFunc
  7156.  
  7157. Func getitembymodelid($amodelid)
  7158. Local $litemstruct = DllStructCreate("long agentId;byte unknow unknown1[4];ptr bag;ptr modstruct;long modstructsize;ptr customized;byte unknown2[4];byte type;byte unknown3;short extraId;short value;byte unknown4[2];short interaction;long modelId;ptr modString;byte unknown5[4];ptr NameString;byte unknown6[15];byte quantity;bipped;bytwyte slwyte sloyte slotte slot")
  7159. Local $loffset[4] = [0, 24, 64, 192]
  7160. Local $litemarraysize = memoryreadptr($mbasepointer, $loffset)
  7161. Local $loffset[5] = [0, 24, 64, 184, 0]
  7162. Local $litemptr, $litemid
  7163. For $litemid = 1 To $litemarraysize[1]
  7164. $loffset[4] = 4 * $litemid
  7165. $litemptr = memoryreadptr($mbasepointer, $loffset)
  7166. If $litemptr[1] = 0 Then ContinueLoop
  7167. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $litemptr[1], "ptr", DllStructGetPtr($litemstruct), "int", DllStructGetSize($litemstruct), "int", "")
  7168. If DllStructGetData($litemstruct, "ModelID") = $amodelid Then Return $litemstruct
  7169. Next
  7170. EndFunc
  7171.  
  7172. Func getgoldstorage()
  7173. Local $loffset[5] = [0, 24, 64, 248, 128]
  7174. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7175. Return $lreturn[1]
  7176. EndFunc
  7177.  
  7178. Func getgoldcharacter()
  7179. Local $loffset[5] = [0, 24, 64, 248, 124]
  7180. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7181. Return $lreturn[1]
  7182. EndFunc
  7183.  
  7184. Func findsalvagekit()
  7185. Local $litem
  7186. Local $lkit = 0
  7187. Local $luses = 101
  7188. For $i = 1 To 16
  7189. For $j = 1 To DllStructGetData(getbag($i), "Slots")
  7190. $litem = getitembyslot($i, $j)
  7191. Switch DllStructGetData($litem, "ModelID")
  7192. Case 2991
  7193. If DllStructGetData($litem, "Value") / 8 < $luses Then
  7194. $lkit = DllStructGetData($litem, "ID")
  7195. $luses = DllStructGetData($litem, "Value") / 8
  7196. EndIf
  7197. Case 5900
  7198. If DllStructGetData($litem, "Value") / 10 < $luses Then
  7199. $lkit = DllStructGetData($litem, "ID")
  7200. $luses = DllStructGetData($litem, "Value") / 10
  7201. EndIf
  7202. Case Else
  7203. ContinueLoop
  7204. EndSwitch
  7205. Next
  7206. Next
  7207. Return $lkit
  7208. EndFunc
  7209.  
  7210. Func findidkit()
  7211. Local $litem
  7212. Local $lkit = 0
  7213. Local $luses = 101
  7214. For $i = 1 To 16
  7215. For $j = 1 To DllStructGetData(getbag($i), "Slots")
  7216. $litem = getitembyslot($i, $j)
  7217. Switch DllStructGetData($litem, "ModelID")
  7218. Case 2989
  7219. If DllStructGetData($litem, "Value") / 2 < $luses Then
  7220. $lkit = DllStructGetData($litem, "ID")
  7221. $luses = DllStructGetData($litem, "Value") / 2
  7222. EndIf
  7223. Case 5899
  7224. If DllStructGetData($litem, "Value") / 2.5 < $luses Then
  7225. $lkit = DllStructGetData($litem, "ID")
  7226. $luses = DllStructGetData($litem, "Value") / 2.5
  7227. EndIf
  7228. Case Else
  7229. ContinueLoop
  7230. EndSwitch
  7231. Next
  7232. Next
  7233. Return $lkit
  7234. EndFunc
  7235.  
  7236. Func gettradercostid()
  7237. Return memoryread($mtradercostid)
  7238. EndFunc
  7239.  
  7240. Func gettradercostvalue()
  7241. Return memoryread($mtradercostvalue)
  7242. EndFunc
  7243.  
  7244. Func getmerchantitemsbase()
  7245. Local $loffset[4] = [0, 24, 44, 36]
  7246. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7247. Return $lreturn[1]
  7248. EndFunc
  7249.  
  7250. Func getmerchantitemssize()
  7251. Local $loffset[4] = [0, 24, 44, 40]
  7252. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7253. Return $lreturn[1]
  7254. EndFunc
  7255.  
  7256. #EndRegion Item
  7257. #Region H&H
  7258.  
  7259. Func getherocount()
  7260. Local $loffset[5]
  7261. $loffset[0] = 0
  7262. $loffset[1] = 24
  7263. $loffset[2] = 76
  7264. $loffset[3] = 84
  7265. $loffset[4] = 44
  7266. Local $lherocount = memoryreadptr($mbasepointer, $loffset)
  7267. Return $lherocount[1]
  7268. EndFunc
  7269.  
  7270. Func getheroid($aheronumber)
  7271. If $aheronumber == 0 Then Return getmyid()
  7272. Local $loffset[6]
  7273. $loffset[0] = 0
  7274. $loffset[1] = 24
  7275. $loffset[2] = 76
  7276. $loffset[3] = 84
  7277. $loffset[4] = 36
  7278. $loffset[5] = 24 * ($aheronumber - 1)
  7279. Local $lagentid = memoryreadptr($mbasepointer, $loffset)
  7280. Return $lagentid[1]
  7281. EndFunc
  7282.  
  7283. Func getheronumberbyagentid($aagentid)
  7284. Local $lagentid
  7285. Local $loffset[6]
  7286. $loffset[0] = 0
  7287. $loffset[1] = 24
  7288. $loffset[2] = 76
  7289. $loffset[3] = 84
  7290. $loffset[4] = 36
  7291. For $i = 1 To getherocount()
  7292. $loffset[5] = 24 * ($i - 1)
  7293. $lagentid = memoryreadptr($mbasepointer, $loffset)
  7294. If $lagentid[1] == convertid($aagentid) Then Return $i
  7295. Next
  7296. Return 0
  7297. EndFunc
  7298.  
  7299. Func getheronumberbyheroid($aheroid)
  7300. Local $lagentid
  7301. Local $loffset[6]
  7302. $loffset[0] = 0
  7303. $loffset[1] = 24
  7304. $loffset[2] = 76
  7305. $loffset[3] = 84
  7306. $loffset[4] = 36
  7307. For $i = 1 To getherocount()
  7308. $loffset[5] = 8 + 24 * ($i - 1)
  7309. $lagentid = memoryreadptr($mbasepointer, $loffset)
  7310. If $lagentid[1] == convertid($aheroid) Then Return $i
  7311. Next
  7312. Return 0
  7313. EndFunc
  7314.  
  7315. Func getheroprofession($aheronumber, $asecondary = False)
  7316. Local $loffset[5] = [0, 24, 44, 1724, 0]
  7317. Local $lbuffer
  7318. $aheronumber = getheroid($aheronumber)
  7319. For $i = 0 To getherocount()
  7320. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7321. If $lbuffer[1] = $aheronumber Then
  7322. $loffset[4] += 4
  7323. If $asecondary Then $loffset[4] += 4
  7324. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7325. Return $lbuffer[1]
  7326. EndIf
  7327. $loffset[4] += 20
  7328. Next
  7329. EndFunc
  7330.  
  7331. Func getisheroskillslotdisabled($aheronumber, $askillslot)
  7332. Return BitAND(2 ^ ($askillslot - 1), DllStructGetData(getskillbar($aheronumber), "Disabled")) > 0
  7333. EndFunc
  7334.  
  7335. #EndRegion H&H
  7336. #Region Agent
  7337.  
  7338. Func getagentbyid($aagentid = -2)
  7339. Local $lagentptr = getagentptr($aagentid)
  7340. If $lagentptr = 0 Then Return 0
  7341. Local $lagentstruct = DllStructCreate("ptr vyte unknown1[24];byt24];byte unknown2[4];ptr NextAgent;byte unknown3[8];long Id;float Z;byte unknown4[8];float BoxHoverWidth;float BoxHoverHeight;byte unknown5[8];float Rotation;byte unknown6[8];long NameProperties;byte unknown7[24];float X;float Y;byte unknown8[8];float NameTagX;float NameTagY;float NameTagZ;byte unknown9[12];long Type;float MoveX;float MoveY;byte unknown10[28];long Owner;byte unknown30[8];long ExtraType;byte unknown11[24];float AttackSpeed;float AttackSpeedModifier;word PlayerNumber;byte unknown12[6];ptr Equip;byte unknown13[10];byte Primary;byte Secondary;byte Level;byte Team;byte unknown14[6];float EnergyPips;byte unknown[4];float EnergyPercent;long MaxEnergy;byte unknown15[4];float HPPips;byte unknown16[4];float HP;long MaxHP;long Effects;byte unknown17[4];byte Hex;byte unknown18[18];long ModelState;long TypeMap;byte unknown19[16];long InSpiritRange;byte unknown20[16];long LoginNumber;float ModelMode;byte unknown21[4];long ModelAnimation;byte unknown22[32];byte LastStrike;byte Allegiance;word WeaponType;word Skill;byte unknown23[ WeaponItrndItemrndItemrndItemIndItemId")
  7342. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lagentptr, "ptr", DllStructGetPtr($lagentstruct), "int", DllStructGetSize($lagentstruct), "int", "")
  7343. Return $lagentstruct
  7344. EndFunc
  7345.  
  7346. Func getagentptr($aagentid)
  7347. Local $loffset[3] = [0, 4 * convertid($aagentid), 0]
  7348. Local $lagetaddressaddress = memoryreadptr($magentbase, $loffset)
  7349. Return $lagetaddressaddress[0]
  7350. EndFunc
  7351.  
  7352. Func getagentexists($aagentid)
  7353. Return (getagentptr($aagentid) > 0 AND $aagentid < getmaxagents())
  7354. EndFunc
  7355.  
  7356. Func gettarget($aagent)
  7357. Local $lagentid
  7358. If IsDllStruct($aagent) = 0 Then
  7359. $lagentid = convertid($aagent)
  7360. Else
  7361. $lagentid = DllStructGetData($aagent, "ID")
  7362. EndIf
  7363. Return memoryread(getvalue("TargetLogBase") + 4 * $lagentid)
  7364. EndFunc
  7365.  
  7366. Func getagentbyplayername($aplayername)
  7367. For $i = 1 To getmaxagents()
  7368. If getplayername($i) = $aplayername Then
  7369. Return getagentbyid($i)
  7370. EndIf
  7371. Next
  7372. EndFunc
  7373.  
  7374. Func getagentbyname($aname)
  7375. If $musestringlog = False Then Return
  7376. Local $lname, $laddress
  7377. For $i = 1 To getmaxagents()
  7378. $laddress = $mstringlogbase + 256 * $i
  7379. $lname = memoryread($laddress, "wchar [128]")
  7380. $lname = StringRegExpReplace($lname, "[<]{+)[>]{1})[>]{1}", "")
  7381. If StringInStr($lname, $aname) > 0 Then Return getagentbyid($i)
  7382. Next
  7383. displayall(True)
  7384. Sleep(100)
  7385. displayall(False)
  7386. displayall(True)
  7387. Sleep(100)
  7388. displayall(False)
  7389. For $i = 1 To getmaxagents()
  7390. $laddress = $mstringlogbase + 256 * $i
  7391. $lname = memoryread($laddress, "wchar [128]")
  7392. $lname = StringRegExpReplace($lname, "[<]{+)[>]{1})[>]{1}", "")
  7393. If StringInStr($lname, $aname) > 0 Then Return getagentbyid($i)
  7394. Next
  7395. EndFunc
  7396.  
  7397. Func getnearestagenttoagent($aagent = -2)
  7398. Local $lnearestagent, $lnearestdistance = 100000000
  7399. Local $ldistance
  7400. Local $lagentarray = getagentarray()
  7401. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7402. Local $lid = DllStructGetData($aagent, "ID")
  7403. For $i = 1 To $lagentarray[0]
  7404. $ldistance = (DllStructGetData($aagent, "X") - DllStructGetData($lagentarray[$i], "X")) ^ 2 + (DllStructGetData($aagent, "Y") - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7405. If $ldistance < $lnearestdistance Then
  7406. If DllStructGetData($lagentarray[$i], "ID") == $lid Then ContinueLoop
  7407. $lnearestagent = $lagentarray[$i]
  7408. $lnearestdistance = $ldistance
  7409. EndIf
  7410. Next
  7411. SetExtended(Sqrt($lnearestdistance))
  7412. Return $lnearestagent
  7413. EndFunc
  7414.  
  7415. Func getnearestenemytoagent($aagent = -2)
  7416. Local $lnearestagent, $lnearestdistance = 100000000
  7417. Local $ldistance
  7418. Local $lagentarray = getagentarray(219)
  7419. If NOT IsDllStruct($aagent) Then $aagent = getagentbyid($aagent)
  7420. Local $lid = DllStructGetData($aagent, "ID")
  7421. For $i = 1 To $lagentarray[0]
  7422. $ldistance = (DllStructGetData($aagent, "X") - DllStructGetData($lagentarray[$i], "X")) ^ 2 + (DllStructGetData($aagent, "Y") - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7423. If DllStructGetData($lagentarray[$i], "Allegiance") <> 3 Then ContinueLoop
  7424. If DllStructGetData($lagentarray[$i], "HP") <= 0 Then ContinueLoop
  7425. If BitAND(DllStructGetData($lagentarray[$i], "Effects"), 16) > 0 Then ContinueLoop
  7426. $ldistance = (DllStructGetData($aagent, "X") - DllStructGetData($lagentarray[$i], "X")) ^ 2 + (DllStructGetData($aagent, "Y") - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7427. If $ldistance < $lnearestdistance Then
  7428. If DllStructGetData($lagentarray[$i], "ID") == $lid Then ContinueLoop
  7429. $lnearestagent = $lagentarray[$i]
  7430. $lnearestdistance = $ldistance
  7431. EndIf
  7432. Next
  7433. SetExtended(Sqrt($lnearestdistance))
  7434. Return $lnearestagent
  7435. EndFunc
  7436.  
  7437. Func getnearestagenttocoords($ax, $ay)
  7438. Local $lnearestagent, $lnearestdistance = 100000000
  7439. Local $ldistance
  7440. Local $lagentarray = getagentarray()
  7441. For $i = 1 To $lagentarray[0]
  7442. $ldistance = ($ax - DllStructGetData($lagentarray[$i], "X")) ^ 2 + ($ay - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7443. If $ldistance < $lnearestdistance Then
  7444. $lnearestagent = $lagentarray[$i]
  7445. $lnearestdistance = $ldistance
  7446. EndIf
  7447. Next
  7448. SetExtended(Sqrt($lnearestdistance))
  7449. Return $lnearestagent
  7450. EndFunc
  7451.  
  7452. Func getnearestsignposttoagent($aagent = -2)
  7453. Local $lnearestagent, $lnearestdistance = 100000000
  7454. Local $ldistance
  7455. Local $lagentarray = getagentarray(512)
  7456. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7457. Local $lid = DllStructGetData($aagent, "ID")
  7458. For $i = 1 To $lagentarray[0]
  7459. $ldistance = (DllStructGetData($lagentarray[$i], "Y") - DllStructGetData($aagent, "Y")) ^ 2 + (DllStructGetData($lagentarray[$i], "X") - DllStructGetData($aagent, "X")) ^ 2
  7460. If $ldistance < $lnearestdistance Then
  7461. If DllStructGetData($lagentarray[$i], "ID") == $lid Then ContinueLoop
  7462. $lnearestagent = $lagentarray[$i]
  7463. $lnearestdistance = $ldistance
  7464. EndIf
  7465. Next
  7466. SetExtended(Sqrt($lnearestdistance))
  7467. Return $lnearestagent
  7468. EndFunc
  7469.  
  7470. Func getnearestsignposttocoords($ax, $ay)
  7471. Local $lnearestagent, $lnearestdistance = 100000000
  7472. Local $ldistance
  7473. Local $lagentarray = getagentarray(512)
  7474. For $i = 1 To $lagentarray[0]
  7475. $ldistance = ($ax - DllStructGetData($lagentarray[$i], "X")) ^ 2 + ($ay - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7476. If $ldistance < $lnearestdistance Then
  7477. $lnearestagent = $lagentarray[$i]
  7478. $lnearestdistance = $ldistance
  7479. EndIf
  7480. Next
  7481. SetExtended(Sqrt($lnearestdistance))
  7482. Return $lnearestagent
  7483. EndFunc
  7484.  
  7485. Func getnearestnpctoagent($aagent)
  7486. Local $lnearestagent, $lnearestdistance = 100000000
  7487. Local $ldistance
  7488. Local $lagentarray = getagentarray(219)
  7489. If NOT IsDllStruct($aagent) Then $aagent = getagentbyid($aagent)
  7490. Local $lid = DllStructGetData($aagent, "ID")
  7491. For $i = 1 To $lagentarray[0]
  7492. If DllStructGetData($lagentarray[$i], "Allegiance") <> 6 Then ContinueLoop
  7493. If DllStructGetData($lagentarray[$i], "HP") <= 0 Then ContinueLoop
  7494. If BitAND(DllStructGetData($lagentarray[$i], "Effects"), 16) > 0 Then ContinueLoop
  7495. $ldistance = (DllStructGetData($aagent, "X") - DllStructGetData($lagentarray[$i], "X")) ^ 2 + (DllStructGetData($aagent, "Y") - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7496. If $ldistance < $lnearestdistance Then
  7497. If DllStructGetData($lagentarray[$i], "ID") == $lid Then ContinueLoop
  7498. $lnearestagent = $lagentarray[$i]
  7499. $lnearestdistance = $ldistance
  7500. EndIf
  7501. Next
  7502. SetExtended(Sqrt($lnearestdistance))
  7503. Return $lnearestagent
  7504. EndFunc
  7505.  
  7506. Func getnearestnpctocoords($ax, $ay)
  7507. Local $lnearestagent, $lnearestdistance = 100000000
  7508. Local $ldistance
  7509. Local $lagentarray = getagentarray(219)
  7510. For $i = 1 To $lagentarray[0]
  7511. If DllStructGetData($lagentarray[$i], "Allegiance") <> 6 Then ContinueLoop
  7512. If DllStructGetData($lagentarray[$i], "HP") <= 0 Then ContinueLoop
  7513. If BitAND(DllStructGetData($lagentarray[$i], "Effects"), 16) > 0 Then ContinueLoop
  7514. $ldistance = ($ax - DllStructGetData($lagentarray[$i], "X")) ^ 2 + ($ay - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7515. If $ldistance < $lnearestdistance Then
  7516. $lnearestagent = $lagentarray[$i]
  7517. $lnearestdistance = $ldistance
  7518. EndIf
  7519. Next
  7520. SetExtended(Sqrt($lnearestdistance))
  7521. Return $lnearestagent
  7522. EndFunc
  7523.  
  7524. Func getnearestitemtoagent($aagent = -2, $acanpickup = True)
  7525. Local $lnearestagent, $lnearestdistance = 100000000
  7526. Local $ldistance
  7527. Local $lagentarray = getagentarray(1024)
  7528. If NOT IsDllStruct($aagent) Then $aagent = getagentbyid($aagent)
  7529. Local $lid = DllStructGetData($aagent, "ID")
  7530. For $i = 1 To $lagentarray[0]
  7531. If $acanpickup AND NOT getcanpickup($lagentarray[$i]) Then ContinueLoop
  7532. $ldistance = (DllStructGetData($aagent, "X") - DllStructGetData($lagentarray[$i], "X")) ^ 2 + (DllStructGetData($aagent, "Y") - DllStructGetData($lagentarray[$i], "Y")) ^ 2
  7533. If $ldistance < $lnearestdistance Then
  7534. If DllStructGetData($lagentarray[$i], "ID") == $lid Then ContinueLoop
  7535. $lnearestagent = $lagentarray[$i]
  7536. $lnearestdistance = $ldistance
  7537. EndIf
  7538. Next
  7539. SetExtended(Sqrt($lnearestdistance))
  7540. Return $lnearestagent
  7541. EndFunc
  7542.  
  7543. Func getparty($aagentarray = 0)
  7544. Local $lreturnarray[1] = [0]
  7545. If $aagentarray == 0 Then $aagentarray = getagentarray(219)
  7546. For $i = 1 To $aagentarray[0]
  7547. If DllStructGetData($aagentarray[$i], "Allegiance") == 1 Then
  7548. If BitAND(DllStructGetData($aagentarray[$i], "TypeMap"), 131072) Then
  7549. $lreturnarray[0] += 1
  7550. ReDim $lreturnarray[$lreturnarray[0] + 1]
  7551. $lreturnarray[$lreturnarray[0]] = $aagentarray[$i]
  7552. EndIf
  7553. EndIf
  7554. Next
  7555. Return $lreturnarray
  7556. EndFunc
  7557.  
  7558. Func getagentarray($atype = 0)
  7559. Local $lstruct
  7560. Local $lcount
  7561. Local $lbuffer = ""
  7562. DllStructSetData($mmakeagentarray, 2, $atype)
  7563. memorywrite($magentcopycount, -1, "long")
  7564. enqueue($mmaarrayptrrrayptr, 8)
  7565. Local $ldeadlock = TimerInit()
  7566. Do
  7567. Sleep(1)
  7568. $lcount = memoryread($magentcopycount, "long")
  7569. Until $lcount >= 0 OR TimerDiff($ldeadlock) > 5000
  7570. If $lcount < 0 Then $lcount = 0
  7571. For $i = 1 To $lcount
  7572. $lbuffer &= "Byte[448];"
  7573. Next
  7574. $lbuffer = DllStructCreate($lbuffer)
  7575. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $magentcopybase, "ptr", DllStructGetPtr($lbuffer), "int", DllStructGetSize($lbuffer), "int", "")
  7576. Local $lreturnarray[$lcount + 1] = [$lcount]
  7577. For $i = 1 To $lcount
  7578. $lreturnarray[$i] = DllStructCreate("ptr vyte unknown1[24];byt24];byte unknown2[4];ptr NextAgent;byte unknown3[8];long Id;float Z;byte unknown4[8];float BoxHoverWidth;float BoxHoverHeight;byte unknown5[8];float Rotation;byte unknown6[8];long NameProperties;byte unknown7[24];float X;float Y;byte unknown8[8];float NameTagX;float NameTagY;float NameTagZ;byte unknown9[12];long Type;float MoveX;float MoveY;byte unknown10[28];long Owner;byte unknown30[8];long ExtraType;byte unknown11[24];float AttackSpeed;float AttackSpeedModifier;word PlayerNumber;byte unknown12[6];ptr Equip;byte unknown13[10];byte Primary;byte Secondary;byte Level;byte Team;byte unknown14[6];float EnergyPips;byte unknown[4];float EnergyPercent;long MaxEnergy;byte unknown15[4];float HPPips;byte unknown16[4];float HP;long MaxHP;long Effects;byte unknown17[4];byte Hex;byte unknown18[18];long ModelState;long TypeMap;byte unknown19[16];long InSpiritRange;byte unknown20[16];long LoginNumber;float ModelMode;byte unknown21[4];long ModelAnimation;byte unknown22[32];byte LastStrike;byte Allegiance;word WeaponType;word Skill;byte unknown23[ WeaponItrndItemrndItemrndItemIndItemId")
  7579. $lstruct = DllStructCreate("byte[448]", DllStructGetPtr($lreturnarray[$i]))
  7580. DllStructSetData($lstruct, 1, DllStructGetData($lbuffer, $i))
  7581. Next
  7582. Return $lreturnarray
  7583. EndFunc
  7584.  
  7585. Func getpartydanger($aagentarray = 0, $aparty = 0)
  7586. If $aagentarray == 0 Then $aagentarray = getagentarray(219)
  7587. If $aparty == 0 Then $aparty = getparty($aagentarray)
  7588. Local $lreturnarray[$aparty[0] + 1]
  7589. $lreturnarray[0] = $aparty[0]
  7590. For $i = 1 To $lreturnarray[0]
  7591. $lreturnarray[$i] = 0
  7592. Next
  7593. For $i = 1 To $aagentarray[0]
  7594. If BitAND(DllStructGetData($aagentarray[$i], "Effects"), 16) > 0 Then ContinueLoop
  7595. If DllStructGetData($aagentarray[$i], "HP") <= 0 Then ContinueLoop
  7596. If NOT getisliving($aagentarray[$i]) Then ContinueLoop
  7597. If DllStructGetData($aagentarray[$i], "Allegiance") > 3 Then ContinueLoop
  7598. For $j = 1 To $aparty[0]
  7599. If gettarget(DllStructGetData($aagentarray[$i], "ID")) == DllStructGetData($aparty[$j], "ID") Then
  7600. If getdistance($aagentarray[$i], $aparty[$j]) < 5000 Then
  7601. If DllStructGetData($aagentarray[$i], "Team") <> 0 Then
  7602. If DllStructGetData($aagentarray[$i], "Team") <> DllStructGetData($aparty[$j], "Team") Then
  7603. $lreturnarray[$j] += 1
  7604. EndIf
  7605. ElseIf DllStructGetData($aagentarray[$i], "Allegiance") <> DllStructGetData($aparty[$j], "Allegiance") Then
  7606. $lreturnarray[$j] += 1
  7607. EndIf
  7608. EndIf
  7609. EndIf
  7610. Next
  7611. Next
  7612. Return $lreturnarray
  7613. EndFunc
  7614.  
  7615. Func getagentdanger($aagent, $aagentarray = 0)
  7616. If IsDllStruct($aagent) = 0 Then
  7617. $aagent = getagentbyid($aagent)
  7618. EndIf
  7619. Local $lcount = 0
  7620. If $aagentarray == 0 Then $aagentarray = getagentarray(219)
  7621. For $i = 1 To $aagentarray[0]
  7622. If BitAND(DllStructGetData($aagentarray[$i], "Effects"), 16) > 0 Then ContinueLoop
  7623. If DllStructGetData($aagentarray[$i], "HP") <= 0 Then ContinueLoop
  7624. If NOT getisliving($aagentarray[$i]) Then ContinueLoop
  7625. If DllStructGetData($aagentarray[$i], "Allegiance") > 3 Then ContinueLoop
  7626. If gettarget(DllStructGetData($aagentarray[$i], "ID")) == DllStructGetData($aagent, "ID") Then
  7627. If getdistance($aagentarray[$i], $aagent) < 5000 Then
  7628. If DllStructGetData($aagentarray[$i], "Team") <> 0 Then
  7629. If DllStructGetData($aagentarray[$i], "Team") <> DllStructGetData($aagent, "Team") Then
  7630. $lcount += 1
  7631. EndIf
  7632. ElseIf DllStructGetData($aagentarray[$i], "Allegiance") <> DllStructGetData($aagent, "Allegiance") Then
  7633. $lcount += 1
  7634. EndIf
  7635. EndIf
  7636. EndIf
  7637. Next
  7638. Return $lcount
  7639. EndFunc
  7640.  
  7641. #EndRegion Agent
  7642. #Region AgentInfo
  7643.  
  7644. Func getisliving($aagent)
  7645. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7646. Return DllStructGetData($aagent, "Type") = 219
  7647. EndFunc
  7648.  
  7649. Func getisstatic($aagent)
  7650. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7651. Return DllStructGetData($aagent, "Type") = 512
  7652. EndFunc
  7653.  
  7654. Func getismovable($aagent)
  7655. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7656. Return DllStructGetData($aagent, "Type") = 1024
  7657. EndFunc
  7658.  
  7659. Func getenergy($aagent = -2)
  7660. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7661. Return DllStructGetData($aagent, "EnergyPercent") * DllStructGetData($aagent, "MaxEnergy")
  7662. EndFunc
  7663.  
  7664. Func gethealth($aagent = -2)
  7665. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7666. Return DllStructGetData($aagent, "HP") * DllStructGetData($aagent, "MaxHP")
  7667. EndFunc
  7668.  
  7669. Func getismoving($aagent)
  7670. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7671. If DllStructGetData($aagent, "MoveX") <> 0 OR DllStructGetData($aagent, "MoveY") <> 0 Then Return True
  7672. Return False
  7673. EndFunc
  7674.  
  7675. Func getisknocked($aagent)
  7676. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7677. Return DllStructGetData($aagent, "ModelState") = 1104
  7678. EndFunc
  7679.  
  7680. Func getisattacking($aagent)
  7681. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7682. Switch DllStructGetData($aagent, "ModelState")
  7683. Case 96
  7684. Return True
  7685. Case 1088
  7686. Return True
  7687. Case 1120
  7688. Return True
  7689. Case Else
  7690. Return False
  7691. EndSwitch
  7692. EndFunc
  7693.  
  7694. Func getiscasting($aagent)
  7695. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7696. Return DllStructGetData($aagent, "Skill") <> 0
  7697. EndFunc
  7698.  
  7699. Func getisbleeding($aagent)
  7700. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7701. Return BitAND(DllStructGetData($aagent, "Effects"), 1) > 0
  7702. EndFunc
  7703.  
  7704. Func gethascondition($aagent)
  7705. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7706. Return BitAND(DllStructGetData($aagent, "Effects"), 2) > 0
  7707. EndFunc
  7708.  
  7709. Func getisdead($aagent)
  7710. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7711. Return BitAND(DllStructGetData($aagent, "Effects"), 16) > 0
  7712. EndFunc
  7713.  
  7714. Func gethasdeepwound($aagent)
  7715. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7716. Return BitAND(DllStructGetData($aagent, "Effects"), 32) > 0
  7717. EndFunc
  7718.  
  7719. Func getispoisoned($aagent)
  7720. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7721. Return BitAND(DllStructGetData($aagent, "Effects"), 64) > 0
  7722. EndFunc
  7723.  
  7724. Func getisenchanted($aagent)
  7725. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7726. Return BitAND(DllStructGetData($aagent, "Effects"), 128) > 0
  7727. EndFunc
  7728.  
  7729. Func gethasdegenhex($aagent)
  7730. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7731. Return BitAND(DllStructGetData($aagent, "Effects"), 1024) > 0
  7732. EndFunc
  7733.  
  7734. Func gethashex($aagent)
  7735. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7736. Return BitAND(DllStructGetData($aagent, "Effects"), 2048) > 0
  7737. EndFunc
  7738.  
  7739. Func gethasweaponspell($aagent)
  7740. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7741. Return BitAND(DllStructGetData($aagent, "Effects"), 32768) > 0
  7742. EndFunc
  7743.  
  7744. Func getisboss($aagent)
  7745. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7746. Return BitAND(DllStructGetData($aagent, "TypeMap"), 1024) > 0
  7747. EndFunc
  7748.  
  7749. Func getplayername($aagent)
  7750. If IsDllStruct($aagent) = 0 Then $aagent = getagentbyid($aagent)
  7751. Local $llogin = DllStructGetData($aagent, "LoginNumber")
  7752. Local $loffset[6] = [0, 24, 44, 2060, 76 * $llogin + 40, 0]
  7753. Local $lreturn = memoryreadptr($mbasepointer, $loffset, "wchar[30]")
  7754. Return $lreturn[1]
  7755. EndFunc
  7756.  
  7757. Func getagentname($aagent)
  7758. If $musestringlog = False Then Return
  7759. If IsDllStruct($aagent) = 0 Then
  7760. Local $lagentid = convertid($aagent)
  7761. If $lagentid = 0 Then Return ""
  7762. Else
  7763. Local $lagentid = DllStructGetData($aagent, "ID")
  7764. EndIf
  7765. Local $laddress = $mstringlogbase + 256 * $lagentid
  7766. Local $lname = memoryread($laddress, "wchar [128]")
  7767. If $lname = "" Then
  7768. displayall(True)
  7769. Sleep(100)
  7770. displayall(False)
  7771. EndIf
  7772. Local $lname = memoryread($laddress, "wchar [128]")
  7773. $lname = StringRegExpReplace($lname, "[<]{+)[>]{1})[>]{1}", "")
  7774. Return $lname
  7775. EndFunc
  7776.  
  7777. #EndRegion AgentInfo
  7778. #Region Buff
  7779.  
  7780. Func getbuffcount($aheronumber = 0)
  7781. Local $loffset[4]
  7782. $loffset[0] = 0
  7783. $loffset[1] = 24
  7784. $loffset[2] = 44
  7785. $loffset[3] = 1296
  7786. Local $lcount = memoryreadptr($mbasepointer, $loffset)
  7787. ReDim $loffset[5]
  7788. $loffset[3] = 1288
  7789. Local $lbuffer
  7790. For $i = 0 To $lcount[1] - 1
  7791. $loffset[4] = 36 * $i
  7792. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7793. If $lbuffer[1] == getheroid($aheronumber) Then
  7794. Return memoryread($lbuffer[0] + 12)
  7795. EndIf
  7796. Next
  7797. Return 0
  7798. EndFunc
  7799.  
  7800. Func getistargetbuffed($askillid, $aagentid, $aheronumber = 0)
  7801. Local $lbuffstruct = DllStructCreate("long SkillId;byte unknown1[4];loITargetITargetITargetId")
  7802. Local $lbuffcount = getbuffcount($aheronumber)
  7803. Local $lbutaddressaddress
  7804. Local $loffset[4]
  7805. $loffset[0] = 0
  7806. $loffset[1] = 24
  7807. $loffset[2] = 44
  7808. $loffset[3] = 1296
  7809. Local $lcount = memoryreadptr($mbasepointer, $loffset)
  7810. ReDim $loffset[5]
  7811. $loffset[3] = 1288
  7812. Local $lbuffer
  7813. For $i = 0 To $lcount[1] - 1
  7814. $loffset[4] = 36 * $i
  7815. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7816. If $lbuffer[1] == getheroid($aheronumber) Then
  7817. $loffset[4] = 4 + 36 * $i
  7818. ReDim $loffset[6]
  7819. For $j = 0 To $lbuffcount - 1
  7820. $loffset[5] = 0 + 16 * $j
  7821. $lbutaddressaddress = memoryreadptr($mbasepointer, $loffset)
  7822. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lbutaddressaddress[0], "ptr", DllStructGetPtr($lbuffstruct), "int", DllStructGetSize($lbuffstruct), "int", "")
  7823. If (DllStructGetData($lbuffstruct, "SkillID") == $askillid) AND (DllStructGetData($lbuffstruct, "TargetId") == convertid($aagentid)) Then
  7824. Return $j + 1
  7825. EndIf
  7826. Next
  7827. EndIf
  7828. Next
  7829. Return 0
  7830. EndFunc
  7831.  
  7832. Func getbuffbyindex($abuffnumber, $aheronumber = 0)
  7833. Local $lbuffstruct = DllStructCreate("long SkillId;byte unknown1[4];loITargetITargetITargetId")
  7834. Local $loffset[4]
  7835. $loffset[0] = 0
  7836. $loffset[1] = 24
  7837. $loffset[2] = 44
  7838. $loffset[3] = 1296
  7839. Local $lcount = memoryreadptr($mbasepointer, $loffset)
  7840. ReDim $loffset[5]
  7841. $loffset[3] = 1288
  7842. Local $lbuffer
  7843. For $i = 0 To $lcount[1] - 1
  7844. $loffset[4] = 36 * $i
  7845. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7846. If $lbuffer[1] == getheroid($aheronumber) Then
  7847. $loffset[4] = 4 + 36 * $i
  7848. ReDim $loffset[6]
  7849. $loffset[5] = 0 + 16 * ($abuffnumber - 1)
  7850. $lbutaddressaddress = memoryreadptr($mbasepointer, $loffset)
  7851. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lbutaddressaddress[0], "ptr", DllStructGetPtr($lbuffstruct), "int", DllStructGetSize($lbuffstruct), "int", "")
  7852. Return $lbuffstruct
  7853. EndIf
  7854. Next
  7855. Return 0
  7856. EndFunc
  7857.  
  7858. #EndRegion Buff
  7859. #Region Misc
  7860.  
  7861. Func getskillbar($aheronumber = 0)
  7862. Local $lskillbarstruct = DllStructCreate("long ;long AdrenalineA1;lineA1;long AdrenalineB1;dword Recharge1;dword Id1;dword Event1;long AdrenalineA2;long AdrenalineB2;dword Recharge2;dword Id2;dword Event2;long AdrenalineA3;long AdrenalineB3;dword Recharge3;dword Id3;dword Event3;long AdrenalineA4;long AdrenalineB4;dword Recharge4;dword Id4;dword Event4;long AdrenalineA5;long AdrenalineB5;dword Recharge5;dword Id5;dword Event5;long AdrenalineA6;long AdrenalineB6;dword Recharge6;dword Id6;dword Event6;long AdrenalineA7;long AdrenalineB7;dword Recharge7;dword Id7;dword Event7;long AdrenalineA8;long AdrenalineB8;dword Recharge8;dword Id8;dword Event8;dworded;byte u8 Casti8 Castin Castin Casting")
  7863. Local $loffset[5]
  7864. $loffset[0] = 0
  7865. $loffset[1] = 24
  7866. $loffset[2] = 44
  7867. $loffset[3] = 1776
  7868. For $i = 0 To getherocount()
  7869. $loffset[4] = $i * 188
  7870. Local $lskillbtaddressaddress = memoryreadptr($mbasepointer, $loffset)
  7871. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lskillbtaddressaddress[0], "ptr", DllStructGetPtr($lskillbarstruct), "int", DllStructGetSize($lskillbarstruct), "int", "")
  7872. If DllStructGetData($lskillbarstruct, "AgentId") == getheroid($aheronumber) Then Return $lskillbarstruct
  7873. Next
  7874. EndFunc
  7875.  
  7876. Func getskillbarskillid($askillslot, $aheronumber = 0)
  7877. Return DllStructGetData(getskillbar($aheronumber), "ID" & $askillslot)
  7878. EndFunc
  7879.  
  7880. Func getskillbarskilladrenaline($askillslot, $aheronumber = 0)
  7881. Return DllStructGetData(getskillbar($aheronumber), "AdrenalineA" & $askillslot)
  7882. EndFunc
  7883.  
  7884. Func getskillbarskillrecharge($askillslot, $aheronumber = 0)
  7885. Local $ltimestamp = DllStructGetData(getskillbar($aheronumber), "Recharge" & $askillslot)
  7886. If $ltimestamp == 0 Then Return 0
  7887. Return $ltimestamp - getskilltimer()
  7888. EndFunc
  7889.  
  7890. Func getskillbyid($askillid)
  7891. Local $lskillstruct = DllStructCreate("long Unknown1[4];long calong campaign;long Type;long Special;long ComboReq;long Effect1;long Condition;long Effect2;long WeaponReq;byte Profession;byte Attribute;byte Unknown2[2];long PvPID;byte Combo;byte Target;byte unknown3;byte EquipType;byte Unknown4[4];dword Adrenaline;float Activation;float Aftercast;long Duration0;long Duration15;long Recharge;byte Unknown5[12];long Scale0;long Scale15;long BonusScale0;long BonusScale15;float AoERaat ConstE ConstEyown6[4yown6[44own6[44]")
  7892. Local $lskitaddressaddress = $mskillbase + 160 * $askillid
  7893. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lskitaddressaddress, "ptr", DllStructGetPtr($lskillstruct), "int", DllStructGetSize($lskillstruct), "int", "")
  7894. Return $lskillstruct
  7895. EndFunc
  7896.  
  7897. Func getmorale($aheronumber = 0)
  7898. Local $lagentid = getheroid($aheronumber)
  7899. Local $loffset[4]
  7900. $loffset[0] = 0
  7901. $loffset[1] = 24
  7902. $loffset[2] = 44
  7903. $loffset[3] = 1592
  7904. Local $lindex = memoryreadptr($mbasepointer, $loffset)
  7905. ReDim $loffset[6]
  7906. $loffset[0] = 0
  7907. $loffset[1] = 24
  7908. $loffset[2] = 44
  7909. $loffset[3] = 1580
  7910. $loffset[4] = 8 + 12 * BitAND($lagentid, $lindex[1])
  7911. $loffset[5] = 24
  7912. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7913. Return $lreturn[1] - 100
  7914. EndFunc
  7915.  
  7916. Func geteffect($askillid = 0, $aheronumber = 0)
  7917. Local $leffectcount, $leffetaddressaddress
  7918. Local $lreturnarray[1] = [0]
  7919. Local $loffset[4]
  7920. $loffset[0] = 0
  7921. $loffset[1] = 24
  7922. $loffset[2] = 44
  7923. $loffset[3] = 1296
  7924. Local $lcount = memoryreadptr($mbasepointer, $loffset)
  7925. ReDim $loffset[5]
  7926. $loffset[3] = 1288
  7927. Local $lbuffer
  7928. For $i = 0 To $lcount[1] - 1
  7929. $loffset[4] = 36 * $i
  7930. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7931. If $lbuffer[1] == getheroid($aheronumber) Then
  7932. $loffset[4] = 28 + 36 * $i
  7933. $leffectcount = memoryreadptr($mbasepointer, $loffset)
  7934. ReDim $loffset[6]
  7935. $loffset[4] = 20 + 36 * $i
  7936. $loffset[5] = 0
  7937. $leffetaddressaddress = memoryreadptr($mbasepointer, $loffset)
  7938. If $askillid = 0 Then
  7939. ReDim $lreturnarray[$leffectcount[1] + 1]
  7940. $lreturnarray[0] = $leffectcount[1]
  7941. For $i = 0 To $leffectcount[1] - 1
  7942. $lreturnarray[$i + 1] = DllStructCreate("long ;long EffectType;lonype;long EffectId;lonId;float nimeStanimeStanimeStamimeStamp")
  7943. $leffetaddressaddress[1] = $leffetaddressaddress[0] + 24 * $i
  7944. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $leffetaddressaddress[1], "ptr", DllStructGetPtr($lreturnarray[$i + 1]), "int", 24, "int", "")
  7945. Next
  7946. ExitLoop
  7947. Else
  7948. Local $lreturn = DllStructCreate("long ;long EffectType;lonype;long EffectId;lonId;float nimeStanimeStanimeStamimeStamp")
  7949. For $i = 0 To $leffectcount[1] - 1
  7950. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $leffetaddressaddress[0] + 24 * $i, "ptr", DllStructGetPtr($lreturn), "int", 24, "int", "")
  7951. If DllStructGetData($lreturn, "SkillID") = $askillid Then Return $lreturn
  7952. Next
  7953. EndIf
  7954. EndIf
  7955. Next
  7956. Return $lreturnarray
  7957. EndFunc
  7958.  
  7959. Func geteffecttimeremaining($aeffect)
  7960. If NOT IsDllStruct($aeffect) Then $aeffect = geteffect($aeffect)
  7961. If IsArray($aeffect) Then Return 0
  7962. Return DllStructGetData($aeffect, "Duration") * 1000 - (getskilltimer() - DllStructGetData($aeffect, "TimeStamp"))
  7963. EndFunc
  7964.  
  7965. Func getskilltimer()
  7966. Return memoryread($mskilltimer, "long")
  7967. EndFunc
  7968.  
  7969. Func getattributebyid($aattributeid, $awithrunes = False, $aheronumber = 0)
  7970. Local $lagentid = getheroid($aheronumber)
  7971. Local $lbuffer
  7972. Local $loffset[5]
  7973. $loffset[0] = 0
  7974. $loffset[1] = 24
  7975. $loffset[2] = 44
  7976. $loffset[3] = 172
  7977. For $i = 0 To getherocount()
  7978. $loffset[4] = 984 * $i
  7979. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7980. If $lbuffer[1] == $lagentid Then
  7981. If $awithrunes Then
  7982. $loffset[4] = 984 * $i + 20 * $aattributeid + 12
  7983. Else
  7984. $loffset[4] = 984 * $i + 20 * $aattributeid + 8
  7985. EndIf
  7986. $lbuffer = memoryreadptr($mbasepointer, $loffset)
  7987. Return $lbuffer[1]
  7988. EndIf
  7989. Next
  7990. EndFunc
  7991.  
  7992. Func getexperience()
  7993. Local $loffset[4] = [0, 24, 44, 1856]
  7994. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  7995. Return $lreturn[1]
  7996. EndFunc
  7997.  
  7998. Func getareavanquished()
  7999. If getfoestokill() = 0 Then
  8000. Return True
  8001. Else
  8002. Return False
  8003. EndIf
  8004. EndFunc
  8005.  
  8006. Func getfoeskilled()
  8007. Local $loffset[4] = [0, 24, 44, 2124]
  8008. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  8009. Return $lreturn[1]
  8010. EndFunc
  8011.  
  8012. Func getfoestokill()
  8013. Local $loffset[4] = [0, 24, 44, 2128]
  8014. Local $lreturn = memoryreadptr($mbasepointer, $loffset)
  8015. Return $lreturn[1]
  8016. EndFunc
  8017.  
  8018. Func getmaxagents()
  8019. Return memoryread($mmaxagents)
  8020. EndFunc
  8021.  
  8022. Func getmyid()
  8023. Return memoryread($mmyid)
  8024. EndFunc
  8025.  
  8026. Func getcurrenttarget()
  8027. Return getagentbyid(getcurrenttargetid())
  8028. EndFunc
  8029.  
  8030. Func getcurrenttargetid()
  8031. Return memoryread($mcurrenttarget)
  8032. EndFunc
  8033.  
  8034. Func getping()
  8035. Return memoryread($mping)
  8036. EndFunc
  8037.  
  8038. Func getmapid()
  8039. Return memoryread($mmapid)
  8040. EndFunc
  8041.  
  8042. Func getmaploading()
  8043. Return memoryread($mmaploading)
  8044. EndFunc
  8045.  
  8046. Func getmapisloaded()
  8047. Return memoryread($mmapisloaded) AND getagentexists(-2)
  8048. EndFunc
  8049.  
  8050. Func getdistrict()
  8051. Local $loffset[4] = [0, 24, 68, 436]
  8052. Local $lresult = memoryreadptr($mbasepointer, $loffset)
  8053. Return $lresult[1]
  8054. EndFunc
  8055.  
  8056. Func getregion()
  8057. Return memoryread($mregion)
  8058. EndFunc
  8059.  
  8060. Func getlanguage()
  8061. Return memoryread($mlanguage)
  8062. EndFunc
  8063.  
  8064. Func waitmaploading($amapid = 0, $adeadlock = 45000)
  8065. Local $lmaploading
  8066. Local $ldeadlock = TimerInit()
  8067. initmapload()
  8068. Do
  8069. Sleep(200)
  8070. $lmaploading = getmaploading()
  8071. If $lmaploading == 2 Then $ldeadlock = TimerInit()
  8072. If TimerDiff($ldeadlock) > $adeadlock AND $adeadlock > 0 Then Return False
  8073. Until $lmaploading <> 2 AND getmapisloaded() AND (getmapid() = $amapid OR $amapid = 0)
  8074. rndsleep(5000)
  8075. Return True
  8076. EndFunc
  8077.  
  8078. Func getquestbyid($aquestid = 0)
  8079. Local $lqueststruct = DllStructCreate("long LogState;byte unknoe unknown1[12];long MapFrom;floaat Y;bytenngbytenng Mapnng MapTng MapTo")
  8080. Local $lquestptr, $lquestlogsize, $lquestid
  8081. Local $loffset[4] = [0, 24, 44, 1332]
  8082. $lquestlogsize = memoryreadptr($mbasepointer, $loffset)
  8083. If $aquestid = 0 Then
  8084. $loffset[1] = 24
  8085. $loffset[2] = 44
  8086. $loffset[3] = 1320
  8087. $lquestid = memoryreadptr($mbasepointer, $loffset)
  8088. $lquestid = $lquestid[1]
  8089. Else
  8090. $lquestid = $aquestid
  8091. EndIf
  8092. Local $loffset[5] = [0, 24, 44, 1324, 0]
  8093. For $i = 0 To $lquestlogsize[1]
  8094. $loffset[4] = 52 * $i
  8095. $lquestptr = memoryreadptr($mbasepointer, $loffset)
  8096. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $lquestptr[0], "ptr", DllStructGetPtr($lqueststruct), "int", DllStructGetSize($lqueststruct), "int", "")
  8097. If DllStructGetData($lqueststruct, "ID") = $lquestid Then Return $lqueststruct
  8098. Next
  8099. EndFunc
  8100.  
  8101. Func getcharname()
  8102. Return memoryread($mcharname, "wchar[30]")
  8103. EndFunc
  8104.  
  8105. Func getloggedin()
  8106. Return memoryread($mloggedin)
  8107. EndFunc
  8108.  
  8109. Func getdisplaylanguage()
  8110. Local $loffset[6] = [0, 24, 24, 404, 76, 64]
  8111. Local $lresult = memoryreadptr($mbasepointer, $loffset)
  8112. Return $lresult[1]
  8113. EndFunc
  8114.  
  8115. Func getinstanceuptime()
  8116. Local $loffset[4]
  8117. $loffset[0] = 0
  8118. $loffset[1] = 24
  8119. $loffset[2] = 8
  8120. $loffset[3] = 428
  8121. Local $ltimer = memoryreadptr($mbasepointer, $loffset)
  8122. Return $ltimer[1]
  8123. EndFunc
  8124.  
  8125. Func getbuildnumber()
  8126. Return $mbuildnumber
  8127. EndFunc
  8128.  
  8129. Func getprofprimaryattribute($aprofession)
  8130. Switch $aprofession
  8131. Case 1
  8132. Return 17
  8133. Case 2
  8134. Return 23
  8135. Case 3
  8136. Return 16
  8137. Case 4
  8138. Return 6
  8139. Case 5
  8140. Return 0
  8141. Case 6
  8142. Return 12
  8143. Case 7
  8144. Return 35
  8145. Case 8
  8146. Return 36
  8147. Case 9
  8148. Return 40
  8149. Case 10
  8150. Return 44
  8151. EndSwitch
  8152. EndFunc
  8153.  
  8154. #EndRegion Misc
  8155. #EndRegion Queries
  8156. #Region Other Functions
  8157. #Region Misc
  8158.  
  8159. Func rndsleep($aamount, $arandom = 0.05)
  8160. Local $lrandom = $aamount * $arandom
  8161. Sleep(Random($aamount - $lrandom, $aamount + $lrandom))
  8162. EndFunc
  8163.  
  8164. Func tolsleep($aamount = 150, $atolerance = 50)
  8165. Sleep(Random($aamount - $atolerance, $aamount + $atolerance))
  8166. EndFunc
  8167.  
  8168. Func getwindowhandle()
  8169. Return $mgwhwnd
  8170. EndFunc
  8171.  
  8172. Func computedistance($ax1, $ay1, $ax2, $ay2)
  8173. Return Sqrt(($ax1 - $ax2) ^ 2 + ($ay1 - $ay2) ^ 2)
  8174. EndFunc
  8175.  
  8176. Func getdistance($aagent1 = -1, $aagent2 = -2)
  8177. If IsDllStruct($aagent1) = 0 Then $aagent1 = getagentbyid($aagent1)
  8178. If IsDllStruct($aagent2) = 0 Then $aagent2 = getagentbyid($aagent2)
  8179. Return Sqrt((DllStructGetData($aagent1, "X") - DllStructGetData($aagent2, "X")) ^ 2 + (DllStructGetData($aagent1, "Y") - DllStructGetData($aagent2, "Y")) ^ 2)
  8180. EndFunc
  8181.  
  8182. Func getpseudodistance($aagent1, $aagent2)
  8183. Return (DllStructGetData($aagent1, "X") - DllStructGetData($aagent2, "X")) ^ 2 + (DllStructGetData($aagent1, "Y") - DllStructGetData($aagent2, "Y")) ^ 2
  8184. EndFunc
  8185.  
  8186. Func getispointinpolygon($aareacoords, $aposx = 0, $aposy = 0)
  8187. Local $lposition
  8188. Local $ledges = UBound($aareacoords)
  8189. Local $loddnodes = False
  8190. If $ledges < 3 Then Return False
  8191. If $aposx = 0 Then
  8192. Local $lagent = getagentbyid(-2)
  8193. $aposx = DllStructGetData($lagent, "X")
  8194. $aposy = DllStructGetData($lagent, "Y")
  8195. EndIf
  8196. $j = $ledges - 1
  8197. For $i = 0 To $ledges - 1
  8198. If (($aareacoords[$i][1] < $aposy AND $aareacoords[$j][1] >= $aposy) OR ($aareacoords[$j][1] < $aposy AND $aareacoords[$i][1] >= $aposy)) AND ($aareacoords[$i][0] <= $aposx OR $aareacoords[$j][0] <= $aposx) Then
  8199. If ($aareacoords[$i][0] + ($aposy - $aareacoords[$i][1]) / ($aareacoords[$j][1] - $aareacoords[$i][1]) * ($aareacoords[$j][0] - $aareacoords[$i][0]) < $aposx) Then
  8200. $loddnodes = NOT $loddnodes
  8201. EndIf
  8202. EndIf
  8203. $j = $i
  8204. Next
  8205. Return $loddnodes
  8206. EndFunc
  8207.  
  8208. Func convertid($aid)
  8209. If $aid = -2 Then
  8210. Return getmyid()
  8211. ElseIf $aid = -1 Then
  8212. Return getcurrenttargetid()
  8213. Else
  8214. Return $aid
  8215. EndIf
  8216. EndFunc
  8217.  
  8218. Func sendpacket($asize, $aheader, $aparam1 = 0, $aparam2 = 0, $aparam3 = 0, $aparam4 = 0, $aparam5 = 0, $aparam6 = 0, $aparam7 = 0, $aparam8 = 0, $aparam9 = 0, $aparam10 = 0)
  8219. If getagentexists(-2) Then
  8220. DllStructSetData($mpacket, 2, $asize)
  8221. DllStructSetData($mpacket, 3, $aheader + 1)
  8222. DllStructSetData($mpacket, 4, $aparam1)
  8223. DllStructSetData($mpacket, 5, $aparam2)
  8224. DllStructSetData($mpacket, 6, $aparam3)
  8225. DllStructSetData($mpacket, 7, $aparam4)
  8226. DllStructSetData($mpacket, 8, $aparam5)
  8227. DllStructSetData($mpacket, 9, $aparam6)
  8228. DllStructSetData($mpacket, 10, $aparam7)
  8229. DllStructSetData($mpacket, 11, $aparam8)
  8230. DllStructSetData($mpacket, 12, $aparam9)
  8231. DllStructSetData($mpacket, 13, $aparam10)
  8232. enqueue($mpacketptr, 52)
  8233. Return True
  8234. Else
  8235. Return False
  8236. EndIf
  8237. EndFunc
  8238.  
  8239. Func performaction($aaction, $aflag)
  8240. If getagentexists(-2) Then
  8241. DllStructSetData($maction, 2, $aaction)
  8242. DllStructSetData($maction, 3, $aflag)
  8243. enqueue($mactionptr, 12)
  8244. Return True
  8245. Else
  8246. Return False
  8247. EndIf
  8248. EndFunc
  8249.  
  8250. Func bin64todec($abinary)
  8251. Local $lreturn = 0
  8252. For $i = 1 To StringLen($abinary)
  8253. If StringMid($abinary, $i, 1) == 1 Then $lreturn += 2 ^ ($i - 1)
  8254. Next
  8255. Return $lreturn
  8256. EndFunc
  8257.  
  8258. Func base64tobin64($acharacter)
  8259. Select
  8260. Case $acharacter == "A"
  8261. Return "000000"
  8262. Case $acharacter == "B"
  8263. Return "100000"
  8264. Case $acharacter == "C"
  8265. Return "010000"
  8266. Case $acharacter == "D"
  8267. Return "110000"
  8268. Case $acharacter == "E"
  8269. Return "001000"
  8270. Case $acharacter == "F"
  8271. Return "101000"
  8272. Case $acharacter == "G"
  8273. Return "011000"
  8274. Case $acharacter == "H"
  8275. Return "111000"
  8276. Case $acharacter == "I"
  8277. Return "000100"
  8278. Case $acharacter == "J"
  8279. Return "100100"
  8280. Case $acharacter == "K"
  8281. Return "010100"
  8282. Case $acharacter == "L"
  8283. Return "110100"
  8284. Case $acharacter == "M"
  8285. Return "001100"
  8286. Case $acharacter == "N"
  8287. Return "101100"
  8288. Case $acharacter == "O"
  8289. Return "011100"
  8290. Case $acharacter == "P"
  8291. Return "111100"
  8292. Case $acharacter == "Q"
  8293. Return "000010"
  8294. Case $acharacter == "R"
  8295. Return "100010"
  8296. Case $acharacter == "S"
  8297. Return "010010"
  8298. Case $acharacter == "T"
  8299. Return "110010"
  8300. Case $acharacter == "U"
  8301. Return "001010"
  8302. Case $acharacter == "V"
  8303. Return "101010"
  8304. Case $acharacter == "W"
  8305. Return "011010"
  8306. Case $acharacter == "X"
  8307. Return "111010"
  8308. Case $acharacter == "Y"
  8309. Return "000110"
  8310. Case $acharacter == "Z"
  8311. Return "100110"
  8312. Case $acharacter == "a"
  8313. Return "010110"
  8314. Case $acharacter == "b"
  8315. Return "110110"
  8316. Case $acharacter == "c"
  8317. Return "001110"
  8318. Case $acharacter == "d"
  8319. Return "101110"
  8320. Case $acharacter == "e"
  8321. Return "011110"
  8322. Case $acharacter == "f"
  8323. Return "111110"
  8324. Case $acharacter == "g"
  8325. Return "000001"
  8326. Case $acharacter == "h"
  8327. Return "100001"
  8328. Case $acharacter == "i"
  8329. Return "010001"
  8330. Case $acharacter == "j"
  8331. Return "110001"
  8332. Case $acharacter == "k"
  8333. Return "001001"
  8334. Case $acharacter == "l"
  8335. Return "101001"
  8336. Case $acharacter == "m"
  8337. Return "011001"
  8338. Case $acharacter == "n"
  8339. Return "111001"
  8340. Case $acharacter == "o"
  8341. Return "000101"
  8342. Case $acharacter == "p"
  8343. Return "100101"
  8344. Case $acharacter == "q"
  8345. Return "010101"
  8346. Case $acharacter == "r"
  8347. Return "110101"
  8348. Case $acharacter == "s"
  8349. Return "001101"
  8350. Case $acharacter == "t"
  8351. Return "101101"
  8352. Case $acharacter == "u"
  8353. Return "011101"
  8354. Case $acharacter == "v"
  8355. Return "111101"
  8356. Case $acharacter == "w"
  8357. Return "000011"
  8358. Case $acharacter == "x"
  8359. Return "100011"
  8360. Case $acharacter == "y"
  8361. Return "010011"
  8362. Case $acharacter == "z"
  8363. Return "110011"
  8364. Case $acharacter == "0"
  8365. Return "001011"
  8366. Case $acharacter == "1"
  8367. Return "101011"
  8368. Case $acharacter == "2"
  8369. Return "011011"
  8370. Case $acharacter == "3"
  8371. Return "111011"
  8372. Case $acharacter == "4"
  8373. Return "000111"
  8374. Case $acharacter == "5"
  8375. Return "100111"
  8376. Case $acharacter == "6"
  8377. Return "010111"
  8378. Case $acharacter == "7"
  8379. Return "110111"
  8380. Case $acharacter == "8"
  8381. Return "001111"
  8382. Case $acharacter == "9"
  8383. Return "101111"
  8384. Case $acharacter == "+"
  8385. Return "011111"
  8386. Case $acharacter == "/"
  8387. Return "111111"
  8388. EndSelect
  8389. EndFunc
  8390.  
  8391. #EndRegion Misc
  8392. #Region Callback
  8393.  
  8394. Func setevent($askillactivate = "", $askillcancel = "", $askillcomplete = "", $achatreceive = "", $aloadfinished = "")
  8395. If NOT $museeventsystem Then Return
  8396. If $askillactivate <> "" Then
  8397. writedetour("SkillLogStart", "SkillLogProc")
  8398. Else
  8399. $masmstring = ""
  8400. _("inc eax")
  8401. _("mov dw+10],eax10],eax")
  8402. _("pop esi")
  8403. writebinary($masmstring, getvalue("SkillLogStart"))
  8404. EndIf
  8405. If $askillcancel <> "" Then
  8406. writedetour("SkilLogStartogStart", "SkilLogProcLogProc")
  8407. Else
  8408. $masmstring = ""
  8409. _("push 0")
  8410. _("push 42")
  8411. _("mov ecx,esi")
  8412. writebinary($masmstring, getvalue("SkilLogStartogStart"))
  8413. EndIf
  8414. If $askillcomplete <> "" Then
  8415. writedetour("SkillCLogStartogStart", "SkilleLogProcLogProc")
  8416. Else
  8417. $masmstring = ""
  8418. _("mov ed[edi+4][edi+4]")
  8419. _("test eax,eax")
  8420. writebinary($masmstring, getvalue("SkillCLogStartogStart"))
  8421. EndIf
  8422. If $achatreceive <> "" Then
  8423. writedetour("ChatLogStart", "ChatLogProc")
  8424. Else
  8425. $masmstring = ""
  8426. _("add edi,E")
  8427. _("cmp eax,B")
  8428. writebinary($masmstring, getvalue("ChatLogStart"))
  8429. EndIf
  8430. $mskillactivate = $askillactivate
  8431. $mskillcancel = $askillcancel
  8432. $mskillcomplete = $askillcomplete
  8433. $mchatreceive = $achatreceive
  8434. $mloadfinished = $aloadfinished
  8435. EndFunc
  8436.  
  8437. Func event($hwnd, $msg, $wparam, $lparam)
  8438. Switch $lparam
  8439. Case 1
  8440. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $wparam, "ptr", $msktructptrructptr, "int", 16, "int", "")
  8441. Call($mskillactivate, DllStructGetData($mskilllogstruct, 1), DllStructGetData($mskilllogstruct, 2), DllStructGetData($mskilllogstruct, 3), DllStructGetData($mskilllogstruct, 4))
  8442. Case 2
  8443. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $wparam, "ptr", $msktructptrructptr, "int", 16, "int", "")
  8444. Call($mskillcancel, DllStructGetData($mskilllogstruct, 1), DllStructGetData($mskilllogstruct, 2), DllStructGetData($mskilllogstruct, 3))
  8445. Case 3
  8446. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $wparam, "ptr", $msktructptrructptr, "int", 16, "int", "")
  8447. Call($mskillcomplete, DllStructGetData($mskilllogstruct, 1), DllStructGetData($mskilllogstruct, 2), DllStructGetData($mskilllogstruct, 3))
  8448. Case 4
  8449. DllCall($mkernelhandle, "int", "RessMemorysMemory", "int", $mgwprochandle, "int", $wparam, "ptr", $mctructptrructptr, "int", 512, "int", "")
  8450. Local $lmessage = DllStructGetData($mchatlogstruct, 2)
  8451. Local $lchannel
  8452. Local $lsender
  8453. Switch DllStructGetData($mchatlogstruct, 1)
  8454. Case 0
  8455. $lchannel = "Alliance"
  8456. $lsender = StringMid($lmessage, 6, StringInStr($lmessage, "</a>") - 6)
  8457. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8458. Case 3
  8459. $lchannel = "All"
  8460. $lsender = StringMid($lmessage, 6, StringInStr($lmessage, "</a>") - 6)
  8461. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8462. Case 9
  8463. $lchannel = "Guild"
  8464. $lsender = StringMid($lmessage, 6, StringInStr($lmessage, "</a>") - 6)
  8465. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8466. Case 11
  8467. $lchannel = "Team"
  8468. $lsender = StringMid($lmessage, 6, StringInStr($lmessage, "</a>") - 6)
  8469. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8470. Case 12
  8471. $lchannel = "Trade"
  8472. $lsender = StringMid($lmessage, 6, StringInStr($lmessage, "</a>") - 6)
  8473. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8474. Case 10
  8475. If StringLeft($lmessage, 3) == "-> " Then
  8476. $lchannel = "Sent"
  8477. $lsender = StringMid($lmessage, 10, StringInStr($lmessage, "</a>") - 10)
  8478. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8479. Else
  8480. $lchannel = "Global"
  8481. $lsender = "Guild Wars"
  8482. EndIf
  8483. Case 13
  8484. $lchannel = "Advisory"
  8485. $lsender = "Guild Wars"
  8486. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8487. Case 14
  8488. $lchannel = "Whisper"
  8489. $lsender = StringMid($lmessage, 7, StringInStr($lmessage, "</a>") - 7)
  8490. $lmessage = StringTrimLeft($lmessage, StringInStr($lmessage, "<quote>") + 6)
  8491. Case Else
  8492. $lchannel = "Other"
  8493. $lsender = "Other"
  8494. EndSwitch
  8495. Call($mchatreceive, $lchannel, $lsender, $lmessage)
  8496. Case 5
  8497. Call($mloadfinished)
  8498. EndSwitch
  8499. EndFunc
  8500.  
  8501. #EndRegion Callback
  8502. #Region Modification
  8503.  
  8504. Func modifymemory()
  8505. $masmsize = 0
  8506. $masmcodeoffset = 0
  8507. $masmstring = ""
  8508. createdata()
  8509. createmain()
  8510. createtargetlog()
  8511. createskilllog()
  8512. createskillcancellog()
  8513. createskillcompletelog()
  8514. createchatlog()
  8515. createtraderhook()
  8516. createloadfinished()
  8517. createstringlog()
  8518. createstringfilter1()
  8519. createstringfilter2()
  8520. createrenderingmod()
  8521. createcommands()
  8522. Local $lmodmemory = memoryread(memoryread($mbase), "ptr")
  8523. If $lmodmemory = 0 Then
  8524. $mmemory = DllCall($mkernelhandle, "ptr", "VirtualAllocEx", "handle", $mgwprochandle, "ptr", 0, "ulong_ptr", $masmsize, "dword", 4096, "dword", 64)
  8525. $mmemory = $mmemory[0]
  8526. memorywrite(memoryread($mbase), $mmemory)
  8527. Else
  8528. $mmemory = $lmodmemory
  8529. EndIf
  8530. completeasmcode()
  8531. If $lmodmemory = 0 Then
  8532. writebinary($masmstring, $mmemory + $masmcodeoffset)
  8533. writebinary("83F8009090", getvalue("ClickToMoveFix"))
  8534. memorywrite(getvalue("QueuePtr"), getvalue("QueueBase"))
  8535. memorywrite(getvalue("SkillLogPtr"), getvalue("SkillLogBase"))
  8536. memorywrite(getvalue("ChatLogPtr"), getvalue("ChatLogBase"))
  8537. memorywrite(getvalue("StringLogPtr"), getvalue("StringLogBase"))
  8538. EndIf
  8539. writedetour("MainStart", "MainProc")
  8540. writedetour("TargetLogStart", "TargetLogProc")
  8541. writedetour("TraderHookStart", "TraderHookProc")
  8542. writedetour("LohedStartedStart", "LoadFinishedProc")
  8543. writedetour("RenderingMod", "RenderingModProc")
  8544. If $musestringlog Then
  8545. writedetour("StringLogStart", "StringLogProc")
  8546. writedetour("Strer1Startr1Start", "Stter1Procer1Proc")
  8547. writedetour("Strer2Startr2Start", "Stter2Procer2Proc")
  8548. EndIf
  8549. EndFunc
  8550.  
  8551. Func writedetour($afrom, $ato)
  8552. writebinary("E9" & swapendian(Hex(getlabelinfo($ato) - getlabelinfo($afrom) - 5)), getlabelinfo($afrom))
  8553. EndFunc
  8554.  
  8555. Func createdata()
  8556. _("CallbackHandle/4")
  8557. _("QueueCounter/4")
  8558. _("Skounter/4unter/4")
  8559. _("ChatLogCounter/4")
  8560. _("ChatLogLastMsg/4")
  8561. _("MapIsLoaded/4")
  8562. _("NextStringType/4")
  8563. _("EnsureEnglish/4")
  8564. _("TraderQuoteID/4")
  8565. _("TraderCostID/4")
  8566. _("TrtValue/4Value/4")
  8567. _("Disdering/4ering/4")
  8568. _("QueueBase/" & 256 * getvalue("QueueSize"))
  8569. _("TargetLogBase/" & 4 * getvalue("TargetLogSize"))
  8570. _("SkillLogBase/" & 16 * getvalue("SkillLogSize"))
  8571. _("StringLogBase/" & 256 * getvalue("StringLogSize"))
  8572. _("ChatLogBase/" & 512 * getvalue("ChatLogSize"))
  8573. _("AgentCopyCount/4")
  8574. _("AgentCopyBase/" & 448 * 256)
  8575. EndFunc
  8576.  
  8577. Func createmain()
  8578. _("MainProc:")
  8579. _("pushad")
  8580. _("mov eax,dwordEnglishEnglish]")
  8581. _("test eax,eax")
  8582. _("jz MainMain")
  8583. _("mov ecx,dwoPointerPointer]")
  8584. _("mov ec[ecx+18]ecx+18]")
  8585. _("mov ec[ecx+18]ecx+18]")
  8586. _("mov ecxecx+194]cx+194]")
  8587. _("mov [ecx+4f]ecx+4f]")
  8588. _("cmp al,f")
  8589. _("ja MainMain")
  8590. _("mov ec[ecx+4c]ecx+4c]")
  8591. _("mov [ecx+3f]ecx+3f]")
  8592. _("cmp al,f")
  8593. _("ja MainMain")
  8594. _("mov ea[ecx+40]ecx+40]")
  8595. _("test eax,eax")
  8596. _("jz MainMain")
  8597. _("mov ecx,dwionBaseionBase]")
  8598. _("mov ecxecx+170]cx+170]")
  8599. _("mov ec[ecx+20]ecx+20]")
  8600. _("movord[ecx]rd[ecx]")
  8601. _("push 0")
  8602. _("push 0")
  8603. _("push bb")
  8604. _("mov edx,esp")
  8605. _("push 0")
  8606. _("push edx")
  8607. _("push 18")
  8608. _("callFunctionunction")
  8609. _("pop eax")
  8610. _("pop ebx")
  8611. _("pop ecx")
  8612. _("MainMain:")
  8613. _("mov eax,dworCounterCounter]")
  8614. _("mov ecx,eax")
  8615. _("shl eax,8")
  8616. _("adueueBaseeueBase")
  8617. _("movord[eax]rd[eax]")
  8618. _("test ebx,ebx")
  8619. _("jz MainExit")
  8620. _("push ecx")
  8621. _("mov dword[eax],0")
  8622. _("jmp ebx")
  8623. _("CommandReturn:")
  8624. _("pop eax")
  8625. _("inc eax")
  8626. _("cmueueSizeeueSize")
  8627. _("jnkipResetipReset")
  8628. _("xor eax,eax")
  8629. _("MainSkipReset:")
  8630. _("mov dword[Quter],eater],eax")
  8631. _("MainExit:")
  8632. _("popad")
  8633. _("mov ebp,esp")
  8634. _("sub esp,14")
  8635. _("ljmp MainReturn")
  8636. EndFunc
  8637.  
  8638. Func createtargetlog()
  8639. _("TargetLogProc:")
  8640. _("cmp ecx,4")
  8641. _("jz TargetLogMain")
  8642. _("cmp ecx,32")
  8643. _("jz TargetLogMain")
  8644. _("cmp ecx,3C")
  8645. _("jz TargetLogMain")
  8646. _("jmtLogExitLogExit")
  8647. _("TargetLogMain:")
  8648. _("pushad")
  8649. _("mov ed[ebp+8][ebp+8]")
  8650. _("test ecx,ecx")
  8651. _("jnzLogStoreogStore")
  8652. _("mov ecx,edx")
  8653. _("TargetLogStore:")
  8654. _("leword[edwo4LogBaseLogBase]ogBase]")
  8655. _("moveax],ecxax],ecx")
  8656. _("popad")
  8657. _("TargetLogExit:")
  8658. _("push ebx")
  8659. _("push esi")
  8660. _("push edi")
  8661. _("mov edi,edx")
  8662. _("ljmp ogReturngReturn")
  8663. EndFunc
  8664.  
  8665. Func createskilllog()
  8666. _("SkillLogProc:")
  8667. _("pushad")
  8668. _("mov eax,dword[SCounterCounter]")
  8669. _("push eax")
  8670. _("shl eax,4")
  8671. _("add elLogBaseLogBase")
  8672. _("movord[edi]rd[edi]")
  8673. _("moveax],ecxax],ecx")
  8674. _("moword[ecwo4LogBaseLogBase]ogBase]")
  8675. _("mov dx+4],ecx+4],ecx")
  8676. _("mov ed[edi+4][edi+4]")
  8677. _("mov dx+8],ecx+8],ecx")
  8678. _("mov ed[edi+8][edi+8]")
  8679. _("mov dx+c],ecx+c],ecx")
  8680. _("push 1")
  8681. _("push eax")
  8682. _("pusackEventckEvent")
  8683. _("push dword[kHandlekHandle]")
  8684. _("call dwoMessage]essage]")
  8685. _("pop eax")
  8686. _("inc eax")
  8687. _("cmp elLogSizeLogSize")
  8688. _("jnz SkkipResetipReset")
  8689. _("xor eax,eax")
  8690. _("SkiipReset:pReset:")
  8691. _("mov dword[Skillter],eater],eax")
  8692. _("popad")
  8693. _("inc eax")
  8694. _("mov dw+10],eax10],eax")
  8695. _("pop esi")
  8696. _("ljmpogReturngReturn")
  8697. EndFunc
  8698.  
  8699. Func createskillcancellog()
  8700. _("SkilLogProc:ogProc:")
  8701. _("pushad")
  8702. _("mov eax,dword[SCounterCounter]")
  8703. _("push eax")
  8704. _("shl eax,4")
  8705. _("add elLogBaseLogBase")
  8706. _("movord[edi]rd[edi]")
  8707. _("moveax],ecxax],ecx")
  8708. _("moword[ecwo4LogBaseLogBase]ogBase]")
  8709. _("mov dx+4],ecx+4],ecx")
  8710. _("mov ed[edi+4][edi+4]")
  8711. _("mov dx+8],ecx+8],ecx")
  8712. _("push 2")
  8713. _("push eax")
  8714. _("pusackEventckEvent")
  8715. _("push dword[kHandlekHandle]")
  8716. _("call dwoMessage]essage]")
  8717. _("pop eax")
  8718. _("inc eax")
  8719. _("cmp elLogSizeLogSize")
  8720. _("jnz SkillCankipResekipReset")
  8721. _("xor eax,eax")
  8722. _("SkillCancipResetipReset:")
  8723. _("mov dword[Skillter],eater],eax")
  8724. _("popad")
  8725. _("push 0")
  8726. _("push 42")
  8727. _("mov ecx,esi")
  8728. _("ljmp SkillogReturogReturn")
  8729. EndFunc
  8730.  
  8731. Func createskillcompletelog()
  8732. _("SkillCLogProc:ogProc:")
  8733. _("pushad")
  8734. _("mov eax,dword[SCounterCounter]")
  8735. _("push eax")
  8736. _("shl eax,4")
  8737. _("add elLogBaseLogBase")
  8738. _("movord[edi]rd[edi]")
  8739. _("moveax],ecxax],ecx")
  8740. _("moword[ecwo4LogBaseLogBase]ogBase]")
  8741. _("mov dx+4],ecx+4],ecx")
  8742. _("mov ed[edi+4][edi+4]")
  8743. _("mov dx+8],ecx+8],ecx")
  8744. _("push 3")
  8745. _("push eax")
  8746. _("pusackEventckEvent")
  8747. _("push dword[kHandlekHandle]")
  8748. _("call dwoMessage]essage]")
  8749. _("pop eax")
  8750. _("inc eax")
  8751. _("cmp elLogSizeLogSize")
  8752. _("jnz SkillComplkipResekipReset")
  8753. _("xor eax,eax")
  8754. _("SkillCompleipResetipReset:")
  8755. _("mov dword[Skillter],eater],eax")
  8756. _("popad")
  8757. _("mov ed[edi+4][edi+4]")
  8758. _("test eax,eax")
  8759. _("ljmp SkillCoogReturogReturn")
  8760. EndFunc
  8761.  
  8762. Func createchatlog()
  8763. _("ChatLogProc:")
  8764. _("pushad")
  8765. _("mov ecxesp+1F4]sp+1F4]")
  8766. _("mov ebx,eax")
  8767. _("mov eax,dword[CounterCounter]")
  8768. _("push eax")
  8769. _("shl eax,9")
  8770. _("add tLogBaseLogBase")
  8771. _("moveax],ebxax],ebx")
  8772. _("mov edi,eax")
  8773. _("add eax,4")
  8774. _("xor ebx,ebx")
  8775. _("ChatLogCopyLoop:")
  8776. _("mov dx,word[ecx]")
  8777. _("mov word[eax],dx")
  8778. _("add ecx,2")
  8779. _("add eax,2")
  8780. _("inc ebx")
  8781. _("cmp ebx,FF")
  8782. _("jz CopyExitopyExit")
  8783. _("test dx,dx")
  8784. _("jnz CopyLoopopyLoop")
  8785. _("ChatLogCopyExit:")
  8786. _("push 4")
  8787. _("push edi")
  8788. _("pusackEventckEvent")
  8789. _("push dword[kHandlekHandle]")
  8790. _("call dwoMessage]essage]")
  8791. _("pop eax")
  8792. _("inc eax")
  8793. _("cmp tLogSizeLogSize")
  8794. _("jnz CkipResetipReset")
  8795. _("xor eax,eax")
  8796. _("ChipReset:pReset:")
  8797. _("mov dword[Chatter],eater],eax")
  8798. _("popad")
  8799. _("ChatLogExit:")
  8800. _("add edi,E")
  8801. _("cmp eax,B")
  8802. _("ljmogReturngReturn")
  8803. EndFunc
  8804.  
  8805. Func createtraderhook()
  8806. _("TraderHookProc:")
  8807. _("mov dword[TrtID],ectID],ecx")
  8808. _("mov dword[Tradelue],edlue],edx")
  8809. _("push eax")
  8810. _("mov eax,dwordQuoteIDQuoteID]")
  8811. _("inc eax")
  8812. _("cmp eax,200")
  8813. _("jnz kipResetipReset")
  8814. _("xor eax,eax")
  8815. _("TraderSkipReset:")
  8816. _("mov dword[TraeID],eaeID],eax")
  8817. _("pop eax")
  8818. _("mov ebp,esp")
  8819. _("sub esp,8")
  8820. _("ljmp TokReturnkReturn")
  8821. EndFunc
  8822.  
  8823. Func createloadfinished()
  8824. _("LohedProc:edProc:")
  8825. _("pushad")
  8826. _("mov eax,1")
  8827. _("mov dword[Mded],eaded],eax")
  8828. _("xor ebx,ebx")
  8829. _("mov eagLogBaseLogBase")
  8830. _("LoadClngsLoop:gsLoop:")
  8831. _("mov dword[eax],0")
  8832. _("inc ebx")
  8833. _("add eax,100")
  8834. _("cmp ebgLogSizeLogSize")
  8835. _("jnz LoadCingsLooingsLoop")
  8836. _("xor ebx,ebx")
  8837. _("mov eatLogBaseLogBase")
  8838. _("LoadCletsLoop:tsLoop:")
  8839. _("mov dword[eax],0")
  8840. _("inc ebx")
  8841. _("add eax,4")
  8842. _("cmp ebtLogSizeLogSize")
  8843. _("jnz LoadCgetsLoogetsLoop")
  8844. _("push 5")
  8845. _("push 0")
  8846. _("pusackEventckEvent")
  8847. _("push dword[kHandlekHandle]")
  8848. _("call dwoMessage]essage]")
  8849. _("popad")
  8850. _("mov ed[esi+1C]esi+1C]")
  8851. _("mov ecx,edi")
  8852. _("ljmp LoaedReturndReturn")
  8853. EndFunc
  8854.  
  8855. Func createstringlog()
  8856. _("StringLogProc:")
  8857. _("pushad")
  8858. _("mov eax,dword[ingTypeingType]")
  8859. _("test eax,eax")
  8860. _("jz StringLogExit")
  8861. _("cmp eax,1")
  8862. _("jnz SgFilter2Filter2")
  8863. _("mov eaxebp+37c]bp+37c]")
  8864. _("jmp StringeCheckgeCheck")
  8865. _("StFilter2:ilter2:")
  8866. _("cmp eax,2")
  8867. _("jngLogExitLogExit")
  8868. _("mov eaxebp+338]bp+338]")
  8869. _("StringeCheck:eCheck:")
  8870. _("mov dword[NegType],gType],0")
  8871. _("cmp eax,0")
  8872. _("jbgLogExitLogExit")
  8873. _("cmp eagLogSizeLogSize")
  8874. _("jagLogExitLogExit")
  8875. _("shl eax,8")
  8876. _("add eagLogBaseLogBase")
  8877. _("xor ebx,ebx")
  8878. _("StropyLoop:pyLoop:")
  8879. _("mov dx,word[ecx]")
  8880. _("mov word[eax],dx")
  8881. _("add ecx,2")
  8882. _("add eax,2")
  8883. _("inc ebx")
  8884. _("cmp ebx,80")
  8885. _("jz StringLogExit")
  8886. _("test dx,dx")
  8887. _("jnz StCopyLoopopyLoop")
  8888. _("StringLogExit:")
  8889. _("popad")
  8890. _("mov esp,ebp")
  8891. _("pop ebp")
  8892. _("retn 10")
  8893. EndFunc
  8894.  
  8895. Func createstringfilter1()
  8896. _("Strer1Proc:r1Proc:")
  8897. _("mov dword[NegType],gType],1")
  8898. _("push ebp")
  8899. _("mov ebp,esp")
  8900. _("push ecx")
  8901. _("push esi")
  8902. _("ljmp Strir1Returr1Return")
  8903. EndFunc
  8904.  
  8905. Func createstringfilter2()
  8906. _("Strer2Proc:r2Proc:")
  8907. _("mov dword[NegType],gType],2")
  8908. _("push ebp")
  8909. _("mov ebp,esp")
  8910. _("push ecx")
  8911. _("push esi")
  8912. _("ljmp Strir2Returr2Return")
  8913. EndFunc
  8914.  
  8915. Func createrenderingmod()
  8916. _("ReModProc:odProc:")
  8917. _("cmp dword[Disaering],ering],1")
  8918. _("jz RenderinpComparpCompare")
  8919. _("cmp eax,ebx")
  8920. _("ljne RenodReturndReturn")
  8921. _("RenderingCompareCompare:")
  8922. $masmsize += 17
  8923. $masmstring &= StringTrimLeft(memoryread(getvalue("RenderingMod") + 4, "byte[17]"), 2)
  8924. _("cmp dword[Disaering],ering],1")
  8925. _("jz DisabringProcingProc")
  8926. _("retn")
  8927. _("DisablingProc:ngProc:")
  8928. _("push 1")
  8929. _("cad[Sleep][Sleep]")
  8930. _("retn")
  8931. EndFunc
  8932.  
  8933. Func createcommands()
  8934. _("CommandUseSkill:")
  8935. _("mov rd[MyID]d[MyID]")
  8936. _("mov ed[eax+C][eax+C]")
  8937. _("push edx")
  8938. _("mov ed[eax+4][eax+4]")
  8939. _("dec edx")
  8940. _("pud[eax+8][eax+8]")
  8941. _("call UFunctionunction")
  8942. _("ljmndReturndReturn")
  8943. _("CommandMove:")
  8944. _("lea ed[eax+4][eax+4]")
  8945. _("caFunctionunction")
  8946. _("ljmndReturndReturn")
  8947. _("CommaeTarget:Target:")
  8948. _("mov ed[eax+4][eax+4]")
  8949. _("xor edx,edx")
  8950. _("call ChangFunctioFunction")
  8951. _("ljmndReturndReturn")
  8952. _("ComketSend:etSend:")
  8953. _("mov ecx,dword[ocationocation]")
  8954. _("lea ed[eax+8][eax+8]")
  8955. _("push edx")
  8956. _("mov ed[eax+4][eax+4]")
  8957. _("mov eax,ecx")
  8958. _("call PacFunctionunction")
  8959. _("ljmndReturndReturn")
  8960. _("CoiteChat:teChat:")
  8961. _("add eax,4")
  8962. _("mov edx,eax")
  8963. _("xor ecx,ecx")
  8964. _("add eax,28")
  8965. _("push eax")
  8966. _("call WrFunctionunction")
  8967. _("ljmndReturndReturn")
  8968. _("CommandSellItem:")
  8969. _("push 0")
  8970. _("push 0")
  8971. _("push 0")
  8972. _("pud[eax+4][eax+4]")
  8973. _("push 0")
  8974. _("add eax,8")
  8975. _("push eax")
  8976. _("push 1")
  8977. _("mov ecx,b")
  8978. _("xor edx,edx")
  8979. _("call SFunctionunction")
  8980. _("ljmndReturndReturn")
  8981. _("CommandBuyItem:")
  8982. _("add eax,4")
  8983. _("push eax")
  8984. _("add eax,4")
  8985. _("push eax")
  8986. _("push 1")
  8987. _("push 0")
  8988. _("push 0")
  8989. _("push 0")
  8990. _("push 0")
  8991. _("mov ecx,1")
  8992. _("mov ed[eax+4][eax+4]")
  8993. _("call Functionunction")
  8994. _("ljmndReturndReturn")
  8995. _("CommandAction:")
  8996. _("mov ecx,dwionBaseionBase]")
  8997. _("mov ecxecx+250]cx+250]")
  8998. _("mov ec[ecx+10]ecx+10]")
  8999. _("movord[ecx]rd[ecx]")
  9000. _("push 0")
  9001. _("push 0")
  9002. _("pud[eax+4][eax+4]")
  9003. _("mov edx,esp")
  9004. _("push 0")
  9005. _("push edx")
  9006. _("pud[eax+8][eax+8]")
  9007. _("callFunctionunction")
  9008. _("pop eax")
  9009. _("pop ebx")
  9010. _("pop ecx")
  9011. _("ljmndReturndReturn")
  9012. _("Commandanguage:nguage:")
  9013. _("mov ecx,dwionBaseionBase]")
  9014. _("mov ecxecx+170]cx+170]")
  9015. _("mov ec[ecx+20]ecx+20]")
  9016. _("movord[ecx]rd[ecx]")
  9017. _("push 0")
  9018. _("push 0")
  9019. _("push bb")
  9020. _("mov edx,esp")
  9021. _("push 0")
  9022. _("push edx")
  9023. _("pud[eax+4][eax+4]")
  9024. _("callFunctionunction")
  9025. _("pop eax")
  9026. _("pop ebx")
  9027. _("pop ecx")
  9028. _("ljmndReturndReturn")
  9029. _("CommaroSkill:oSkill:")
  9030. _("mov ed[eax+4][eax+4]")
  9031. _("mov ed[eax+c][eax+c]")
  9032. _("mov ed[eax+8][eax+8]")
  9033. _("push eax")
  9034. _("call UseHeFunctioFunction")
  9035. _("ljmndReturndReturn")
  9036. _("CommandSendChat:")
  9037. _("mov ecx,dword[ocationocation]")
  9038. _("add eax,4")
  9039. _("push eax")
  9040. _("mov edx,11c")
  9041. _("mov eax,ecx")
  9042. _("call PacFunctionunction")
  9043. _("ljmndReturndReturn")
  9044. _("CommastQuote:tQuote:")
  9045. _("mov dword[ostID],ostID],0")
  9046. _("mov dword[TraValue],Value],0")
  9047. _("add eax,4")
  9048. _("push eax")
  9049. _("push 1")
  9050. _("push 0")
  9051. _("push 0")
  9052. _("push 0")
  9053. _("push 0")
  9054. _("mov ecx,c")
  9055. _("xor edx,edx")
  9056. _("call RequeFunctioFunction")
  9057. _("ljmndReturndReturn")
  9058. _("CommandReoteSelloteSell:")
  9059. _("mov dword[ostID],ostID],0")
  9060. _("mov dword[TraValue],Value],0")
  9061. _("push 0")
  9062. _("push 0")
  9063. _("push 0")
  9064. _("add eax,4")
  9065. _("push eax")
  9066. _("push 1")
  9067. _("push 0")
  9068. _("mov ecx,d")
  9069. _("xor edx,edx")
  9070. _("call RequeFunctioFunction")
  9071. _("ljmndReturndReturn")
  9072. _("CoaderBuy:derBuy:")
  9073. _("push 0")
  9074. _("puerCostIDrCostID")
  9075. _("push 1")
  9076. _("push 0")
  9077. _("push 0")
  9078. _("push 0")
  9079. _("push 0")
  9080. _("mov ecx,c")
  9081. _("mov edx,dword[TstValuestValue]")
  9082. _("callFunctionunction")
  9083. _("mov dword[ostID],ostID],0")
  9084. _("mov dword[TraValue],Value],0")
  9085. _("ljmndReturndReturn")
  9086. _("ComderSell:erSell:")
  9087. _("push 0")
  9088. _("push 0")
  9089. _("push 0")
  9090. _("push dword[TstValuestValue]")
  9091. _("push 0")
  9092. _("puerCostIDrCostID")
  9093. _("push 1")
  9094. _("mov ecx,d")
  9095. _("xor edx,edx")
  9096. _("callFunctionunction")
  9097. _("mov dword[ostID],ostID],0")
  9098. _("mov dword[TraValue],Value],0")
  9099. _("ljmndReturndReturn")
  9100. _("CommandSalvage:")
  9101. _("mov ebgeGlobaleGlobal")
  9102. _("mov ed[eax+4][eax+4]")
  9103. _("movebx],ecxbx],ecx")
  9104. _("push ecx")
  9105. _("mov ed[eax+8][eax+8]")
  9106. _("add ebx,4")
  9107. _("movebx],ecxbx],ecx")
  9108. _("mov ed[eax+c][eax+c]")
  9109. _("movebx],ecxbx],ecx")
  9110. _("call Functionunction")
  9111. _("ljmndReturndReturn")
  9112. _("CommandInctributetribute:")
  9113. _("mov ed[eax+4][eax+4]")
  9114. _("mov ed[eax+8][eax+8]")
  9115. _("call IncreaseAtFunctioFunction")
  9116. _("ljmndReturndReturn")
  9117. _("CommandDectributetribute:")
  9118. _("mov ed[eax+4][eax+4]")
  9119. _("mov ed[eax+8][eax+8]")
  9120. _("call DecreaseAtFunctioFunction")
  9121. _("ljmndReturndReturn")
  9122. _("CommandntArray:tArray:")
  9123. _("mov ed[eax+4][eax+4]")
  9124. _("xor ebx,ebx")
  9125. _("xor edx,edx")
  9126. _("mov edCopyBaseopyBase")
  9127. _("AgenopStart:pStart:")
  9128. _("inc ebx")
  9129. _("cmp ebx,dxAgentsxAgents]")
  9130. _("jge AgLoopExitoopExit")
  9131. _("mov esi,dentBaseentBase]")
  9132. _("lea esi,di+ebx*4i+ebx*4]")
  9133. _("movord[esi]rd[esi]")
  9134. _("test esi,esi")
  9135. _("jz AgeoopStartopStart")
  9136. _("cmp eax,0")
  9137. _("jz CopyAgent")
  9138. _("cmp ea[esi+9C]esi+9C]")
  9139. _("jnz AgeoopStartopStart")
  9140. _("CopyAgent:")
  9141. _("mov ecx,1C0")
  9142. _("clc")
  9143. _("repe movsb")
  9144. _("inc edx")
  9145. _("jmp AgeoopStartopStart")
  9146. _("AgeoopExit:opExit:")
  9147. _("mov dword[Agenunt],edunt],edx")
  9148. _("ljmndReturndReturn")
  9149. EndFunc
  9150.  
  9151. #EndRegion Modification
  9152. #Region Assembler
  9153.  
  9154. Func _($aasm)
  9155. Local $lbuffer
  9156. Select
  9157. Case StringRight($aasm, 1) = ":"
  9158. setvalue("Label_" & StringLeft($aasm, StringLen($aasm) - 1), $masmsize)
  9159. Case StringInStr($aasm, "/") > 0
  9160. setvalue("Label_" & StringLeft($aasm, StringInStr($aasm, "/") - 1), $masmsize)
  9161. Local $loffset = StringRight($aasm, StringLen($aasm) - StringInStr($aasm, "/"))
  9162. $masmsize += $loffset
  9163. $masmcodeoffset += $loffset
  9164. Case StringLeft($aasm, 5) = "nop x"
  9165. $lbuffer = Int(Number(StringTrimLeft($aasm, 5)))
  9166. $masmsize += $lbuffer
  9167. For $i = 1 To $lbuffer
  9168. $masmstring &= "90"
  9169. Next
  9170. Case StringLeft($aasm, 5) = "ljmp "
  9171. $masmsize += 5
  9172. $masmstring &= "E9{" & StringRight($aasm, StringLen($aasm) - 5) & "}"
  9173. Case StringLeft($aasm, 5) = "ljne "
  9174. $masmsize += 6
  9175. $masmstring &= "0F85{" & StringRight($aasm, StringLen($aasm) - 5) & "}"
  9176. Case StringLeft($aasm, 4) = "jmp " AND StringLen($aasm) > 7
  9177. $masmsize += 2
  9178. $masmstring &= "EB(" & StringRight($aasm, StringLen($aasm) - 4) & ")"
  9179. Case StringLeft($aasm, 4) = "jae "
  9180. $masmsize += 2
  9181. $masmstring &= "73(" & StringRight($aasm, StringLen($aasm) - 4) & ")"
  9182. Case StringLeft($aasm, 3) = "jz "
  9183. $masmsize += 2
  9184. $masmstring &= "74(" & StringRight($aasm, StringLen($aasm) - 3) & ")"
  9185. Case StringLeft($aasm, 4) = "jnz "
  9186. $masmsize += 2
  9187. $masmstring &= "75(" & StringRight($aasm, StringLen($aasm) - 4) & ")"
  9188. Case StringLeft($aasm, 4) = "jbe "
  9189. $masmsize += 2
  9190. $masmstring &= "76(" & StringRight($aasm, StringLen($aasm) - 4) & ")"
  9191. Case StringLeft($aasm, 3) = "ja "
  9192. $masmsize += 2
  9193. $masmstring &= "77(" & StringRight($aasm, StringLen($aasm) - 3) & ")"
  9194. Case StringLeft($aasm, 3) = "jl "
  9195. $masmsize += 2
  9196. $masmstring &= "7C(" & StringRight($aasm, StringLen($aasm) - 3) & ")"
  9197. Case StringLeft($aasm, 4) = "jge "
  9198. $masmsize += 2
  9199. $masmstring &= "7D(" & StringRight($aasm, StringLen($aasm) - 4) & ")"
  9200. Case StringLeft($aasm, 4) = "jle "
  9201. $masmsize += 2
  9202. $masmstring &= "7E(" & StringRight($aasm, StringLen($aasm) - 4) & ")"
  9203. Case StringRegExp($aasm, "mov eax,dword[[][]{4,}[]]{4,}[]]")
  9204. $masmsize += 5
  9205. $masmstring &= "A1[" & StringMid($aasm, 15, StringLen($aasm) - 15) & "]"
  9206. Case StringRegExp($aasm, "mov ebx,dword[[][]{4,}[]]{4,}[]]")
  9207. $masmsize += 6
  9208. $masmstring &= "8B1D[" & StringMid($aasm, 15, StringLen($aasm) - 15) & "]"
  9209. Case StringRegExp($aasm, "mov ecx,dword[[][]{4,}[]]{4,}[]]")
  9210. $masmsize += 6
  9211. $masmstring &= "8B0D[" & StringMid($aasm, 15, StringLen($aasm) - 15) & "]"
  9212. Case StringRegExp($aasm, "mov edx,dword[[][]{4,}[]]{4,}[]]")
  9213. $masmsize += 6
  9214. $masmstring &= "8B15[" & StringMid($aasm, 15, StringLen($aasm) - 15) & "]"
  9215. Case StringRegExp($aasm, "mov esi,dword[[][]{4,}[]]{4,}[]]")
  9216. $masmsize += 6
  9217. $masmstring &= "8B35[" & StringMid($aasm, 15, StringLen($aasm) - 15) & "]"
  9218. Case StringRegExp($aasm, "mov edi,dword[[][]{4,}[]]{4,}[]]")
  9219. $masmsize += 6
  9220. $masmstring &= "8B3D[" & StringMid($aasm, 15, StringLen($aasm) - 15) & "]"
  9221. Case StringRegExp($aasm, "cmp ebx,dword\[Z]{4,}\Z]{4,}\]")
  9222. $masmsize += 6
  9223. $masmstring &= "3B1D[" & StringMid($aasm, 15, StringLen($aasm) - 15) & "]"
  9224. Case StringRegExp($aasm, "lea eax,dword[[]ecx[]{4,}[]]{4,}[]]{4,}[]]")
  9225. $masmsize += 7
  9226. $masmstring &= "8D04CD[" & StringMid($aasm, 21, StringLen($aasm) - 21) & "]"
  9227. Case StringRegExp($aasm, "leaord\[ewor+Z]{4,}\Z]{4,}\]]{4,}\]")
  9228. $masmsize += 7
  9229. $masmstring &= "8D3C15[" & StringMid($aasm, 19, StringLen($aasm) - 19) & "]"
  9230. Case StringRegExp($aasm, "cmp dword[[][a-z,A-]digit:]digit:]digit:]]")
  9231. $lbuffer = StringInStr($aasm, ",")
  9232. $lbuffer = asmnumber(StringMid($aasm, $lbuffer + 1), True)
  9233. If @extended Then
  9234. $masmsize += 7
  9235. $masmstring &= "833D[" & StringMid($aasm, 11, StringInStr($aasm, ",") - 12) & "]" & $lbuffer
  9236. Else
  9237. $masmsize += 10
  9238. $masmstring &= "813D[" & StringMid($aasm, 11, StringInStr($aasm, ",") - 12) & "]" & $lbuffer
  9239. EndIf
  9240. Case StringRegExp($aasm, "cmp ecA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9241. $masmsize += 6
  9242. $masmstring &= "81F9[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9243. Case StringRegExp($aasm, "cmp ebA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9244. $masmsize += 6
  9245. $masmstring &= "81FB[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9246. Case StringRegExp($aasm, "cmp eaA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9247. $masmsize += 5
  9248. $masmstring &= "3D[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9249. Case StringRegExp($aasm, "add eaA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9250. $masmsize += 5
  9251. $masmstring &= "05[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9252. Case StringRegExp($aasm, "mov eaA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9253. $masmsize += 5
  9254. $masmstring &= "B8[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9255. Case StringRegExp($aasm, "mov ebA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9256. $masmsize += 5
  9257. $masmstring &= "BB[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9258. Case StringRegExp($aasm, "mov esA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9259. $masmsize += 5
  9260. $masmstring &= "BE[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9261. Case StringRegExp($aasm, "mov edA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9262. $masmsize += 5
  9263. $masmstring &= "BF[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9264. Case StringRegExp($aasm, "mov edA-Z]{4,}-Z]{4,}") AND StringInStr($aasm, ",dword") = 0
  9265. $masmsize += 5
  9266. $masmstring &= "BA[" & StringRight($aasm, StringLen($aasm) - 8) & "]"
  9267. Case StringRegExp($aasm, "mov dword[[][a-z,}[]],ec}[]],ecx")
  9268. $masmsize += 6
  9269. $masmstring &= "890D[" & StringMid($aasm, 11, StringLen($aasm) - 15) & "]"
  9270. Case StringRegExp($aasm, "fstp dword[[][]{4,}[]]{4,}[]]")
  9271. $masmsize += 6
  9272. $masmstring &= "D91D[" & StringMid($aasm, 12, StringLen($aasm) - 12) & "]"
  9273. Case StringRegExp($aasm, "mov dword[[][a-z,}[]],ed}[]],edx")
  9274. $masmsize += 6
  9275. $masmstring &= "8915[" & StringMid($aasm, 11, StringLen($aasm) - 15) & "]"
  9276. Case StringRegExp($aasm, "mov dword[[][a-z,}[]],ea}[]],eax")
  9277. $masmsize += 5
  9278. $masmstring &= "A3[" & StringMid($aasm, 11, StringLen($aasm) - 15) & "]"
  9279. Case StringRegExp($aasm, "lea eax,dword[[]edx[]{4,}[]]{4,}[]]{4,}[]]")
  9280. $masmsize += 7
  9281. $masmstring &= "8D0495[" & StringMid($aasm, 21, StringLen($aasm) - 21) & "]"
  9282. Case StringRegExp($aasm, "mov eax,dword[[]ecx[]{4,}[]]{4,}[]]{4,}[]]")
  9283. $masmsize += 7
  9284. $masmstring &= "8B048D[" & StringMid($aasm, 21, StringLen($aasm) - 21) & "]"
  9285. Case StringRegExp($aasm, "mov ecx,dword[[]ecx[]{4,}[]]{4,}[]]{4,}[]]")
  9286. $masmsize += 7
  9287. $masmstring &= "8B0C8D[" & StringMid($aasm, 21, StringLen($aasm) - 21) & "]"
  9288. Case StringRegExp($aasm, "push dword[[][]{4,}[]]{4,}[]]")
  9289. $masmsize += 6
  9290. $masmstring &= "FF35[" & StringMid($aasm, 12, StringLen($aasm) - 12) & "]"
  9291. Case StringRegExp($aasm, "push Z]{4,}\z]{4,}\z")
  9292. $masmsize += 5
  9293. $masmstring &= "68[" & StringMid($aasm, 6, StringLen($aasm) - 5) & "]"
  9294. Case StringRegExp($aasm, "call dword[[][]{4,}[]]{4,}[]]")
  9295. $masmsize += 6
  9296. $masmstring &= "FF15[" & StringMid($aasm, 12, StringLen($aasm) - 12) & "]"
  9297. Case StringLeft($aasm, 5) = "call " AND StringLen($aasm) > 8
  9298. $masmsize += 5
  9299. $masmstring &= "E8{" & StringMid($aasm, 6, StringLen($aasm) - 5) & "}"
  9300. Case StringRegExp($aasm, "mov dword\[[a-z,A-Z]{4,}x]{1,8}\]{1,8}\]{1,8}\z")
  9301. $lbuffer = StringInStr($aasm, ",")
  9302. $masmsize += 10
  9303. $masmstring &= "C705[" & StringMid($aasm, 11, $lbuffer - 12) & "]" & asmnumber(StringMid($aasm, $lbuffer + 1))
  9304. Case StringRegExp($aasm, "push [-[:x]{1,8}\]{1,8}\z")
  9305. $lbuffer = asmnumber(StringMid($aasm, 6), True)
  9306. If @extended Then
  9307. $masmsize += 2
  9308. $masmstring &= "6A" & $lbuffer
  9309. Else
  9310. $masmsize += 5
  9311. $masmstring &= "68" & $lbuffer
  9312. EndIf
  9313. Case StringRegExp($aasm, "mov eax,[-[:x]{1,8}\]{1,8}\z")
  9314. $masmsize += 5
  9315. $masmstring &= "B8" & asmnumber(StringMid($aasm, 9))
  9316. Case StringRegExp($aasm, "mov ebx,[-[:x]{1,8}\]{1,8}\z")
  9317. $masmsize += 5
  9318. $masmstring &= "BB" & asmnumber(StringMid($aasm, 9))
  9319. Case StringRegExp($aasm, "mov ecx,[-[:x]{1,8}\]{1,8}\z")
  9320. $masmsize += 5
  9321. $masmstring &= "B9" & asmnumber(StringMid($aasm, 9))
  9322. Case StringRegExp($aasm, "mov edx,[-[:x]{1,8}\]{1,8}\z")
  9323. $masmsize += 5
  9324. $masmstring &= "BA" & asmnumber(StringMid($aasm, 9))
  9325. Case StringRegExp($aasm, "add eax,[-[:x]{1,8}\]{1,8}\z")
  9326. $lbuffer = asmnumber(StringMid($aasm, 9), True)
  9327. If @extended Then
  9328. $masmsize += 3
  9329. $masmstring &= "83C0" & $lbuffer
  9330. Else
  9331. $masmsize += 5
  9332. $masmstring &= "05" & $lbuffer
  9333. EndIf
  9334. Case StringRegExp($aasm, "add ebx,[-[:x]{1,8}\]{1,8}\z")
  9335. $lbuffer = asmnumber(StringMid($aasm, 9), True)
  9336. If @extended Then
  9337. $masmsize += 3
  9338. $masmstring &= "83C3" & $lbuffer
  9339. Else
  9340. $masmsize += 6
  9341. $masmstring &= "81C3" & $lbuffer
  9342. EndIf
  9343. Case StringRegExp($aasm, "add ecx,[-[:x]{1,8}\]{1,8}\z")
  9344. $lbuffer = asmnumber(StringMid($aasm, 9), True)
  9345. If @extended Then
  9346. $masmsize += 3
  9347. $masmstring &= "83C1" & $lbuffer
  9348. Else
  9349. $masmsize += 6
  9350. $masmstring &= "81C1" & $lbuffer
  9351. EndIf
  9352. Case StringRegExp($aasm, "add edx,[-[:x]{1,8}\]{1,8}\z")
  9353. $lbuffer = asmnumber(StringMid($aasm, 9), True)
  9354. If @extended Then
  9355. $masmsize += 3
  9356. $masmstring &= "83C2" & $lbuffer
  9357. Else
  9358. $masmsize += 6
  9359. $masmstring &= "81C2" & $lbuffer
  9360. EndIf
  9361. Case StringRegExp($aasm, "add edi,[-[:x]{1,8}\]{1,8}\z")
  9362. $lbuffer = asmnumber(StringMid($aasm, 9), True)
  9363. If @extended Then
  9364. $masmsize += 3
  9365. $masmstring &= "83C7" & $lbuffer
  9366. Else
  9367. $masmsize += 6
  9368. $masmstring &= "81C7" & $lbuffer
  9369. EndIf
  9370. Case StringRegExp($aasm, "cmp ebx,[-[:x]{1,8}\]{1,8}\z")
  9371. $lbuffer = asmnumber(StringMid($aasm, 9), True)
  9372. If @extended Then
  9373. $masmsize += 3
  9374. $masmstring &= "83FB" & $lbuffer
  9375. Else
  9376. $masmsize += 6
  9377. $masmstring &= "81FB" & $lbuffer
  9378. EndIf
  9379. Case Else
  9380. Local $lopcode
  9381. Switch $aasm
  9382. Case "nop"
  9383. $lopcode = "90"
  9384. Case "pushad"
  9385. $lopcode = "60"
  9386. Case "popad"
  9387. $lopcode = "61"
  9388. Case "movord[eax]rd[eax]"
  9389. $lopcode = "8B18"
  9390. Case "test eax,eax"
  9391. $lopcode = "85C0"
  9392. Case "test ebx,ebx"
  9393. $lopcode = "85DB"
  9394. Case "test ecx,ecx"
  9395. $lopcode = "85C9"
  9396. Case "mov dword[eax],0"
  9397. $lopcode = "C70000000000"
  9398. Case "push eax"
  9399. $lopcode = "50"
  9400. Case "push ebx"
  9401. $lopcode = "53"
  9402. Case "push ecx"
  9403. $lopcode = "51"
  9404. Case "push edx"
  9405. $lopcode = "52"
  9406. Case "push ebp"
  9407. $lopcode = "55"
  9408. Case "push esi"
  9409. $lopcode = "56"
  9410. Case "push edi"
  9411. $lopcode = "57"
  9412. Case "jmp ebx"
  9413. $lopcode = "FFE3"
  9414. Case "pop eax"
  9415. $lopcode = "58"
  9416. Case "pop ebx"
  9417. $lopcode = "5B"
  9418. Case "pop edx"
  9419. $lopcode = "5A"
  9420. Case "pop ecx"
  9421. $lopcode = "59"
  9422. Case "pop esi"
  9423. $lopcode = "5E"
  9424. Case "inc eax"
  9425. $lopcode = "40"
  9426. Case "inc ecx"
  9427. $lopcode = "41"
  9428. Case "inc ebx"
  9429. $lopcode = "43"
  9430. Case "dec edx"
  9431. $lopcode = "4A"
  9432. Case "mov edi,edx"
  9433. $lopcode = "8BFA"
  9434. Case "mov ecx,esi"
  9435. $lopcode = "8BCE"
  9436. Case "mov ecx,edi"
  9437. $lopcode = "8BCF"
  9438. Case "xor eax,eax"
  9439. $lopcode = "33C0"
  9440. Case "xor ecx,ecx"
  9441. $lopcode = "33C9"
  9442. Case "xor edx,edx"
  9443. $lopcode = "33D2"
  9444. Case "xor ebx,ebx"
  9445. $lopcode = "33DB"
  9446. Case "mov edx,eax"
  9447. $lopcode = "8BD0"
  9448. Case "mov ebp,esp"
  9449. $lopcode = "8BEC"
  9450. Case "sub esp,8"
  9451. $lopcode = "83EC08"
  9452. Case "sub esp,14"
  9453. $lopcode = "83EC14"
  9454. Case "cmp ecx,4"
  9455. $lopcode = "83F904"
  9456. Case "cmp ecx,32"
  9457. $lopcode = "83F932"
  9458. Case "cmp ecx,3C"
  9459. $lopcode = "83F93C"
  9460. Case "mov ecx,edx"
  9461. $lopcode = "8BCA"
  9462. Case "mov eax,ecx"
  9463. $lopcode = "8BC1"
  9464. Case "mov ed[ebp+8][ebp+8]"
  9465. $lopcode = "8B4D08"
  9466. Case "mov ecxesp+1F4]sp+1F4]"
  9467. $lopcode = "8B8C24F4010000"
  9468. Case "mov ed[edi+4][edi+4]"
  9469. $lopcode = "8B4F04"
  9470. Case "mov ed[edi+8][edi+8]"
  9471. $lopcode = "8B4F08"
  9472. Case "mov ed[edi+4][edi+4]"
  9473. $lopcode = "8B4704"
  9474. Case "mov dx+4],ecx+4],ecx"
  9475. $lopcode = "894804"
  9476. Case "mov dx+8],ecx+8],ecx"
  9477. $lopcode = "894808"
  9478. Case "mov dx+C],ecx+C],ecx"
  9479. $lopcode = "89480C"
  9480. Case "mov dw+10],eax10],eax"
  9481. $lopcode = "894610"
  9482. Case "movord[edi]rd[edi]"
  9483. $lopcode = "8B0F"
  9484. Case "moveax],ecxax],ecx"
  9485. $lopcode = "8908"
  9486. Case "moveax],ebxax],ebx"
  9487. $lopcode = "8918"
  9488. Case "mov ed[eax+4][eax+4]"
  9489. $lopcode = "8B5004"
  9490. Case "mov ed[eax+c][eax+c]"
  9491. $lopcode = "8B500C"
  9492. Case "mov ed[esi+1c]esi+1c]"
  9493. $lopcode = "8B561C"
  9494. Case "pud[eax+8][eax+8]"
  9495. $lopcode = "FF7008"
  9496. Case "lea ea[eax+18]eax+18]"
  9497. $lopcode = "8D4018"
  9498. Case "lea ed[eax+4][eax+4]"
  9499. $lopcode = "8D4804"
  9500. Case "lea ed[eax+4][eax+4]"
  9501. $lopcode = "8D5004"
  9502. Case "lea ed[eax+8][eax+8]"
  9503. $lopcode = "8D5008"
  9504. Case "mov ed[eax+4][eax+4]"
  9505. $lopcode = "8B4804"
  9506. Case "mov ed[eax+8][eax+8]"
  9507. $lopcode = "8B4808"
  9508. Case "mov ed[eax+8][eax+8]"
  9509. $lopcode = "8B4008"
  9510. Case "mov ed[eax+4][eax+4]"
  9511. $lopcode = "8B4004"
  9512. Case "pud[eax+4][eax+4]"
  9513. $lopcode = "FF7004"
  9514. Case "pud[eax+c][eax+c]"
  9515. $lopcode = "FF700C"
  9516. Case "mov esp,ebp"
  9517. $lopcode = "8BE5"
  9518. Case "mov esp,ebp"
  9519. $lopcode = "8BE5"
  9520. Case "pop ebp"
  9521. $lopcode = "5D"
  9522. Case "retn 10"
  9523. $lopcode = "C21000"
  9524. Case "cmp eax,2"
  9525. $lopcode = "83F802"
  9526. Case "cmp eax,0"
  9527. $lopcode = "83F800"
  9528. Case "cmp eax,B"
  9529. $lopcode = "83F80B"
  9530. Case "cmp eax,200"
  9531. $lopcode = "3D00020000"
  9532. Case "shl eax,4"
  9533. $lopcode = "C1E004"
  9534. Case "shl eax,8"
  9535. $lopcode = "C1E008"
  9536. Case "shl eax,6"
  9537. $lopcode = "C1E006"
  9538. Case "shl eax,7"
  9539. $lopcode = "C1E007"
  9540. Case "shl eax,8"
  9541. $lopcode = "C1E008"
  9542. Case "shl eax,9"
  9543. $lopcode = "C1E009"
  9544. Case "mov edi,eax"
  9545. $lopcode = "8BF8"
  9546. Case "mov dx,word[ecx]"
  9547. $lopcode = "668B11"
  9548. Case "mov dx,word[edx]"
  9549. $lopcode = "668B12"
  9550. Case "mov word[eax],dx"
  9551. $lopcode = "668910"
  9552. Case "test dx,dx"
  9553. $lopcode = "6685D2"
  9554. Case "cmp word[edx],0"
  9555. $lopcode = "66833A00"
  9556. Case "cmp eax,ebx"
  9557. $lopcode = "3BC3"
  9558. Case "cmp eax,ecx"
  9559. $lopcode = "3BC1"
  9560. Case "mov ed[esi+8][esi+8]"
  9561. $lopcode = "8B4608"
  9562. Case "movord[eax]rd[eax]"
  9563. $lopcode = "8B08"
  9564. Case "mov ebx,edi"
  9565. $lopcode = "8BDF"
  9566. Case "mov ebx,eax"
  9567. $lopcode = "8BD8"
  9568. Case "mov eax,edi"
  9569. $lopcode = "8BC7"
  9570. Case "mov al,byte[ebx]"
  9571. $lopcode = "8A03"
  9572. Case "test al,al"
  9573. $lopcode = "84C0"
  9574. Case "movord[ecx]rd[ecx]"
  9575. $lopcode = "8B01"
  9576. Case "lea ecxeax+180]ax+180]"
  9577. $lopcode = "8D8880010000"
  9578. Case "mov eb[ecx+14]ecx+14]"
  9579. $lopcode = "8B5914"
  9580. Case "mov ed[ebx+c][ebx+c]"
  9581. $lopcode = "8B430C"
  9582. Case "mov ecx,eax"
  9583. $lopcode = "8BC8"
  9584. Case "cmp eax,-1"
  9585. $lopcode = "83F8FF"
  9586. Case "mov al,byte[ecx]"
  9587. $lopcode = "8A01"
  9588. Case "movord[edx]rd[edx]"
  9589. $lopcode = "8B1A"
  9590. Case "lea ediedx+ebx]dx+ebx]"
  9591. $lopcode = "8D3C1A"
  9592. Case "mov ah,byte[edi]"
  9593. $lopcode = "8A27"
  9594. Case "cmp al,ah"
  9595. $lopcode = "3AC4"
  9596. Case "mov dword[edx],0"
  9597. $lopcode = "C70200000000"
  9598. Case "movebx],ecxbx],ecx"
  9599. $lopcode = "890B"
  9600. Case "cmp edx,esi"
  9601. $lopcode = "3BD6"
  9602. Case "cmp ecx,900000"
  9603. $lopcode = "81F900009000"
  9604. Case "mov ed[edx+4][edx+4]"
  9605. $lopcode = "8B7A04"
  9606. Case "cmp ebx,edi"
  9607. $lopcode = "3BDF"
  9608. Case "movedx],ebxdx],ebx"
  9609. $lopcode = "891A"
  9610. Case "lea ed[edx+8][edx+8]"
  9611. $lopcode = "8D7A08"
  9612. Case "movedi],ecxdi],ecx"
  9613. $lopcode = "890F"
  9614. Case "retn"
  9615. $lopcode = "C3"
  9616. Case "mo[edx],-1edx],-1"
  9617. $lopcode = "C702FFFFFFFF"
  9618. Case "cmp eax,1"
  9619. $lopcode = "83F801"
  9620. Case "mov eaxebp+37c]bp+37c]"
  9621. $lopcode = "8B857C030000"
  9622. Case "mov eaxebp+338]bp+338]"
  9623. $lopcode = "8B8538030000"
  9624. Case "mov ecxebx+250]bx+250]"
  9625. $lopcode = "8B8B50020000"
  9626. Case "mov ecxebx+194]bx+194]"
  9627. $lopcode = "8B8B94010000"
  9628. Case "mov ec[ebx+18]ebx+18]"
  9629. $lopcode = "8B5918"
  9630. Case "mov ec[ebx+40]ebx+40]"
  9631. $lopcode = "8B5940"
  9632. Case "mov eb[ecx+10]ecx+10]"
  9633. $lopcode = "8B5910"
  9634. Case "mov eb[ecx+18]ecx+18]"
  9635. $lopcode = "8B5918"
  9636. Case "mov eb[ecx+4c]ecx+4c]"
  9637. $lopcode = "8B594C"
  9638. Case "movord[ebx]rd[ebx]"
  9639. $lopcode = "8B0B"
  9640. Case "mov edx,esp"
  9641. $lopcode = "8BD4"
  9642. Case "mov ecxebx+170]bx+170]"
  9643. $lopcode = "8B8B70010000"
  9644. Case "cmp ea[esi+9C]esi+9C]"
  9645. $lopcode = "3B869C000000"
  9646. Case "mov eb[ecx+20]ecx+20]"
  9647. $lopcode = "8B5920"
  9648. Case "movord[ecx]rd[ecx]"
  9649. $lopcode = "8B09"
  9650. Case "mov ea[ecx+40]ecx+40]"
  9651. $lopcode = "8B4140"
  9652. Case "mov ec[ecx+10]ecx+10]"
  9653. $lopcode = "8B4910"
  9654. Case "mov ec[ecx+18]ecx+18]"
  9655. $lopcode = "8B4918"
  9656. Case "mov ec[ecx+20]ecx+20]"
  9657. $lopcode = "8B4920"
  9658. Case "mov ec[ecx+4c]ecx+4c]"
  9659. $lopcode = "8B494C"
  9660. Case "mov ecxecx+170]cx+170]"
  9661. $lopcode = "8B8970010000"
  9662. Case "mov ecxecx+194]cx+194]"
  9663. $lopcode = "8B8994010000"
  9664. Case "mov ecxecx+250]cx+250]"
  9665. $lopcode = "8B8950020000"
  9666. Case "mov [ecx+4f]ecx+4f]"
  9667. $lopcode = "8A414F"
  9668. Case "mov [ecx+3f]ecx+3f]"
  9669. $lopcode = "8A413F"
  9670. Case "cmp al,f"
  9671. $lopcode = "3C0F"
  9672. Case "lea esi,di+ebx*4i+ebx*4]"
  9673. $lopcode = "8D349E"
  9674. Case "movord[esi]rd[esi]"
  9675. $lopcode = "8B36"
  9676. Case "test esi,esi"
  9677. $lopcode = "85F6"
  9678. Case "clc"
  9679. $lopcode = "F8"
  9680. Case "repe movsb"
  9681. $lopcode = "F3A4"
  9682. Case "inc edx"
  9683. $lopcode = "42"
  9684. Case Else
  9685. MsgBox(0, "ASM", "Couldsemble: emble: " & $aasm)
  9686. Exit
  9687. EndSwitch
  9688. $masmsize += 0.5 * StringLen($lopcode)
  9689. $masmstring &= $lopcode
  9690. EndSelect
  9691. EndFunc
  9692.  
  9693. Func completeasmcode()
  9694. Local $linexpression = False
  9695. Local $lexpression
  9696. Local $ltempasm = $masmstring
  9697. Local $lcurrentoffset = Dec(Hex($mmemory)) + $masmcodeoffset
  9698. Local $ltoken
  9699. For $i = 1 To $mlabels[0][0]
  9700. If StringLeft($mlabels[$i][0], 6) = "Label_" Then
  9701. $mlabels[$i][0] = StringTrimLeft($mlabels[$i][0], 6)
  9702. $mlabels[$i][1] = $mmemory + $mlabels[$i][1]
  9703. EndIf
  9704. Next
  9705. $masmstring = ""
  9706. For $i = 1 To StringLen($ltempasm)
  9707. $ltoken = StringMid($ltempasm, $i, 1)
  9708. Switch $ltoken
  9709. Case "(", "[", "{"
  9710. $linexpression = True
  9711. Case ")"
  9712. $masmstring &= Hex(getlabelinfo($lexpression) - Int($lcurrentoffset) - 1, 2)
  9713. $lcurrentoffset += 1
  9714. $linexpression = False
  9715. $lexpression = ""
  9716. Case "]"
  9717. $masmstring &= swapendian(Hex(getlabelinfo($lexpression), 8))
  9718. $lcurrentoffset += 4
  9719. $linexpression = False
  9720. $lexpression = ""
  9721. Case "}"
  9722. $masmstring &= swapendian(Hex(getlabelinfo($lexpression) - Int($lcurrentoffset) - 4, 8))
  9723. $lcurrentoffset += 4
  9724. $linexpression = False
  9725. $lexpression = ""
  9726. Case Else
  9727. If $linexpression Then
  9728. $lexpression &= $ltoken
  9729. Else
  9730. $masmstring &= $ltoken
  9731. $lcurrentoffset += 0.5
  9732. EndIf
  9733. EndSwitch
  9734. Next
  9735. EndFunc
  9736.  
  9737. Func getlabelinfo($alabel)
  9738. Local $lvalue = getvalue($alabel)
  9739. If $lvalue = -1 Then Exit MsgBox(0, "Label", "Label: " & $alabel & " not provided")
  9740. Return $lvalue
  9741. EndFunc
  9742.  
  9743. Func asmnumber($anumber, $asmall = False)
  9744. If $anumber >= 0 Then
  9745. $anumber = Dec($anumber)
  9746. EndIf
  9747. If $asmall AND $anumber <= 127 AND $anumber >= -128 Then
  9748. Return SetExtended(1, Hex($anumber, 2))
  9749. Else
  9750. Return SetExtended(0, swapendian(Hex($anumber, 8)))
  9751. EndIf
  9752. EndFunc
  9753.  
  9754. #EndRegion Assembler
  9755. #EndRegion Other Functions
  9756.  
  9757. Func __processgetname($i_pid)
  9758. If NOT ProcessExists($i_pid) Then Return SetError(1, 0, "")
  9759. If NOT @error Then
  9760. Local $a_processes = ProcessList()
  9761. For $i = 1 To $a_processes[0][0]
  9762. If $a_processes[$i][1] = $i_pid Then Return $a_processes[$i][0]
  9763. Next
  9764. EndIf
  9765. Return SetError(1, 0, "")
  9766. EndFunc
  9767.  
  9768. Func checkarea($ax, $ay)
  9769. $ret = False
  9770. $px = DllStructGetData(getagentbyid(-2), "X")
  9771. $py = DllStructGetData(getagentbyid(-2), "Y")
  9772. If ($px < $ax + 500) AND ($px > $ax - 500) AND ($py < $ay + 500) AND ($py > $ay - 500) Then
  9773. $ret = True
  9774. EndIf
  9775. Return $ret
  9776. EndFunc
  9777.  
  9778. Func countiteminbagsbymodelid($itemmodelid)
  9779. $count = 0
  9780. For $i = $bag_backpack To $bag_bag2
  9781. For $j = 1 To DllStructGetData(getbag($i), "Slots")
  9782. $liteminfo = getitembyslot($i, $j)
  9783. If DllStructGetData($liteminfo, "ModelID") = $itemmodelid Then $count += DllStructGetData($liteminfo, "quantity")
  9784. Next
  9785. Next
  9786. Return $count
  9787. EndFunc
  9788.  
  9789. Func moveitemfromstoragebymodelid($amodelid, $amount = 250)
  9790. Local $lbag
  9791. Local $lreturnarray[2]
  9792. Local $litem
  9793. Local $lempackslotackslot
  9794. Local $totalitems = 0
  9795. Local $sttemcountemcount = 0
  9796. Local $storagecount
  9797. Local $newstack
  9798. If countiteminbagsbymodelid($amodelid) >= $amount Then Return True
  9799. For $i = 8 To 16
  9800. $lbag = getbag($i)
  9801. For $j = 1 To DllStructGetData($lbag, "Slots")
  9802. $lempackslotackslot = findbackpackstack($amodelid)
  9803. If NOT IsArray($lempackslotackslot) Then
  9804. $lempackslotackslot = openbackpackslot()
  9805. If NOT IsArray($lempackslotackslot) Then Return False
  9806. Else
  9807. $litem = getitembyslot($lempackslotackslot[0], $lempackslotackslot[1])
  9808. $sttemcountemcount = DllStructGetData($litem, "Quantity")
  9809. EndIf
  9810. $litem = getitembyslot($lbag, $j)
  9811. $storagecount = DllStructGetData($litem, "Quantity")
  9812. If DllStructGetData($litem, "ModelID") == $amodelid Then
  9813. $totalitems += $storagecount
  9814. moveitem($litem, $lempackslotackslot[0], $lempackslotackslot[1])
  9815. Sleep(getping() + Random(100, 150, 1))
  9816. If $totalitems >= $amount Then Return True
  9817. EndIf
  9818. Next
  9819. Next
  9820. Return True
  9821. EndFunc
  9822.  
  9823. Func getitemfromstorageiflow($amodelid, $minimumamount = 250)
  9824. Local $totalbackpackackpack = countiteminbagsbymodelid($amodelid)
  9825. If $totalbackpackackpack < $minimumamount Then
  9826. moveitemfromstoragebymodelid($amodelid, $minimumamount)
  9827. EndIf
  9828. EndFunc
  9829.  
  9830. Opt("GUIOnEventMode", 1)
  9831. #Region *Declarations*
  9832. Global $iam = 0
  9833. Global $iamblue = 1
  9834. Global $iamred = 2
  9835. Global $ha = 330
  9836. Global $uw = 84
  9837. Global $fetid = 593
  9838. Global $burialmounds = 80
  9839. Global $unholytemples = 79
  9840. Global $forgottenshrines = 596
  9841. Global $goldengates = 126
  9842. Global $courtyard = 78
  9843. Global $antechamber = 598
  9844. Global $vault = 83
  9845. Global $hoh = 75
  9846. Global $iamwonuw
  9847. Global $iamwonfetid
  9848. Global $iamalmoundslmounds
  9849. Global $iamwytemplestemples
  9850. Global $iamwonfnshrinesshrines
  9851. Global $iadengatesengates
  9852. Global $iamwoncourtyard
  9853. Global $fameup
  9854. Global $savefame
  9855. Global $lastbag = 3
  9856. Global $offset = 900
  9857. Global $gwpid
  9858. Global $mzaishen
  9859. Global $munderworld
  9860. Global $mfetidriver
  9861. Global $mburialmounds
  9862. Global $munholytemples
  9863. Global $mfnshrinesshrines
  9864. Global $mgoldengates
  9865. Global $mcourtyard
  9866. Global $mantechamber
  9867. Global $mhallofhero
  9868. Global $intstarted = -1
  9869. Global $runs = 0
  9870. Global $lblwins = 0
  9871. Global $zk = 0
  9872. Global $itotalbalthazar = 0
  9873. Global $imaalthazarlthazar = 0
  9874. Global $mid_zkey = 28517
  9875. Global $mid_hero_boxes = 36666
  9876. Global $balthazarforval = "Zaishen Keys"
  9877. Global $distance = getdistance(getnearestenemytoagent(-2))
  9878. Global $ostats_fame = getherotitle()
  9879. Global $i = 1
  9880. Global $boolrun = False
  9881. Global $boolinit = False
  9882. Global $logfile = FileOpen("ChestLog.txt", 2)
  9883. Global $rendering = True
  9884. Global $chatstucktimer = TimerInit()
  9885. Global $permasf = 0
  9886. Global $usealchol = 0
  9887. Global $wearedead = 0
  9888. Global $error = 0
  9889. Global Enum $insta_outpostoutpost, $instanceplorablelorable, $insta_loadingloading
  9890. Global Enum $bag_backpack = 1, $bag_beltpouch, $bag_bag1, $bag_bag2, $bamentpackentpack, $bagmeditemseditems = 7, $bag_storage1, $bag_storage2, $bag_storage3, $bag_storage4, $bag_storage5, $bag_storage6, $bag_storage7, $bag_storage8, $bag_stoiversaryversary
  9891. #EndRegion Declarations
  9892. #Region GUI
  9893. GUICreate("Multi-Ha TeqatleTeqatle", 354, 234, 0, 0)
  9894. GUISetFont(-1, 9, 400, 0, "Arial")
  9895. GUICtrlCreateGroup("", 8, 0, 121, 170)
  9896. GUICtrlCreateLabel("Runs:", 16, 60, 55, 18)
  9897. GUICtrlSetFont(-1, 9, 500, 0)
  9898. GUICtrlSetColor(-1, 255)
  9899. GUICtrlCreateLabel("Fame:", 16, 76, 55, 18)
  9900. GUICtrlSetFont(-1, 9, 500, 0)
  9901. GUICtrlSetColor(-1, 255)
  9902. GUICtrlCreateLabel("Up:", 16, 92, 55, 18)
  9903. GUICtrlSetFont(-1, 9, 500, 0)
  9904. GUICtrlSetColor(-1, 255)
  9905. GUICtrlCreateLabel("Zk uped:", 16, 108, 55, 18)
  9906. GUICtrlSetFont(-1, 9, 500, 0)
  9907. GUICtrlSetColor(-1, 255)
  9908. GUICtrlCreateLabel("Zkeys:", 16, 124, 55, 18)
  9909. GUICtrlSetFont(-1, 9, 500, 0)
  9910. GUICtrlSetColor(-1, 255)
  9911. GUICtrlCreateLabel("Boxes:", 16, 140, 55, 18)
  9912. GUICtrlSetFont(-1, 9, 500, 0)
  9913. GUICtrlSetColor(-1, 255)
  9914. Global $nowinmap = GUICtrlCreateLabel("now in map", 10, 176, 120, 18, BitOR($ss_center, $ss_centerimage))
  9915. GUICtrlSetFont(-1, 10, 700, 0)
  9916. GUICtrlSetColor(-1, 16711680)
  9917. Global $myboxesinbag = GUICtrlCreateLabel("0", 72, 140, 51, 18, BitOR($ss_center, $ss_centerimage))
  9918. GUICtrlSetFont(-1, 9, 500, 0)
  9919. GUICtrlSetColor(-1, 255)
  9920. Global $myzkeysinbag = GUICtrlCreateLabel("0", 72, 124, 51, 18, BitOR($ss_center, $ss_centerimage))
  9921. GUICtrlSetFont(-1, 9, 500, 0)
  9922. GUICtrlSetColor(-1, 255)
  9923. Global $lblzk = GUICtrlCreateLabel("0", 72, 108, 51, 18, BitOR($ss_center, $ss_centerimage))
  9924. GUICtrlSetFont(-1, 9, 500, 0)
  9925. GUICtrlSetColor(-1, 255)
  9926. Global $lblwins = GUICtrlCreateLabel("0", 62, 92, 51, 18, BitOR($ss_center, $ss_centerimage))
  9927. GUICtrlSetFont(-1, 9, 500, 0)
  9928. GUICtrlSetColor(-1, 255)
  9929. GUICtrlCreateLabel("/300", 102, 92, 25, 18)
  9930. GUICtrlSetFont(-1, 9, 500, 0)
  9931. GUICtrlSetColor(-1, 255)
  9932. Global $lblfame = GUICtrlCreateLabel("0", 72, 76, 51, 18, BitOR($ss_center, $ss_centerimage))
  9933. GUICtrlSetFont(-1, 9, 500, 0)
  9934. GUICtrlSetColor(-1, 255)
  9935. Global $lblruns = GUICtrlCreateLabel("0", 72, 60, 51, 18, BitOR($ss_center, $ss_centerimage))
  9936. GUICtrlSetFont(-1, 9, 500, 0)
  9937. GUICtrlSetColor(-1, 255)
  9938. GUICtrlCreateGroup("", -99, -99, 1, 1)
  9939. Global $console = GUICtrlCreateEdit("", 136, 0, 209, 120, BitOR(64, 2097152, 8388608, 2048))
  9940. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  9941. GUICtrlSetColor(-1, 65535)
  9942. GUICtrlSetBkColor(-1, 0)
  9943. GUICtrlSetCursor(-1, 5)
  9944. GUICtrlCreateGroup("", 8, 190, 121, 33)
  9945. GUICtrlSetState(-1, $gui_checked)
  9946. Global $cbxhidegw = GUICtrlCreateCheckbox("Disable Graphics", 24, 200, 98, 17)
  9947. GUICtrlSetOnEvent($cbxhidegw, "Init")
  9948. Global $pause = GUICtrlCreateCheckbox("Pause", 70, 32, 50, 25)
  9949. GUICtrlSetOnEvent($pause, "Pause")
  9950. GUICtrlCreateGroup("", -99, -99, 1, 1)
  9951. GUICtrlCreateGroup("Was on maps", 136, 130, 209, 93, BitOR($gui_slt_groupt_group, $bs_center))
  9952. GUICtrlCreateLabel("Underworld:", 140, 145, 70, 18)
  9953. GUICtrlCreateLabel("Fetid River:", 140, 160, 70, 18)
  9954. GUICtrlCreateLabel("Burial Mounds:", 140, 175, 70, 18)
  9955. GUICtrlCreateLabel("Unholy Temples:", 140, 190, 100, 18)
  9956. GUICtrlCreateLabel("ForShrines:hrines:", 140, 205, 100, 18)
  9957. GUICtrlCreateLabel("Golden Gates:", 255, 150, 70, 18)
  9958. GUICtrlCreateLabel("Courtyard:", 255, 165, 70, 18)
  9959. GUICtrlCreateLabel("Antechamber:", 255, 180, 70, 18)
  9960. GUICtrlCreateLabel("Hall of Hero:", 255, 195, 70, 18)
  9961. Global $munderworld = GUICtrlCreateLabel("0", 225, 145, 30, 18, BitOR($ss_center, $ss_centerimage))
  9962. GUICtrlSetColor(-1, 65280)
  9963. Global $mfetidriver = GUICtrlCreateLabel("0", 225, 160, 30, 18, BitOR($ss_center, $ss_centerimage))
  9964. GUICtrlSetColor(-1, 65280)
  9965. Global $mburialmounds = GUICtrlCreateLabel("0", 225, 175, 30, 18, BitOR($ss_center, $ss_centerimage))
  9966. GUICtrlSetColor(-1, 65280)
  9967. Global $munholytemples = GUICtrlCreateLabel("0", 225, 190, 30, 18, BitOR($ss_center, $ss_centerimage))
  9968. GUICtrlSetColor(-1, 16711680)
  9969. Global $mfnshrinesshrines = GUICtrlCreateLabel("0", 225, 205, 30, 18, BitOR($ss_center, $ss_centerimage))
  9970. GUICtrlSetColor(-1, 16711680)
  9971. Global $mgoldengates = GUICtrlCreateLabel("0", 330, 150, 10, 18, BitOR($ss_center, $ss_centerimage))
  9972. GUICtrlSetColor(-1, 16711680)
  9973. Global $mcourtyard = GUICtrlCreateLabel("0", 330, 165, 10, 18, BitOR($ss_center, $ss_centerimage))
  9974. GUICtrlSetColor(-1, 16711680)
  9975. Global $mantechamber = GUICtrlCreateLabel("0", 330, 180, 10, 18, BitOR($ss_center, $ss_centerimage))
  9976. GUICtrlSetColor(-1, 16711680)
  9977. Global $mhallofhero = GUICtrlCreateLabel("0", 330, 195, 10, 18, BitOR($ss_center, $ss_centerimage))
  9978. GUICtrlSetColor(-1, 16711680)
  9979. Global $guistart = GUICtrlCreateButton("START", 8, 32, 60, 25)
  9980. GUICtrlSetFont(-1, 9, 700, 0, "Arial")
  9981. Global $guiname = GUICtrlCreateCombo("", 8, 8, 121, 25, BitOR($cbs_dropdown, $cbs_autohscroll))
  9982. GUICtrlSetData(-1, getloggedcharnames())
  9983. GUISetState(@SW_SHOW)
  9984. GUISetOnEvent($gui_event_close, "CloseHandler")
  9985. GUICtrlSetOnEvent($guistart, "Init")
  9986. #EndRegion GUI
  9987. setevent("SkillActivate", "", "", "", "")
  9988. While 1
  9989. Sleep(100)
  9990. If $boolrun Then
  9991. mainloop()
  9992. EndIf
  9993. WEnd
  9994. While 1
  9995. Sleep(100)
  9996. If $boolrun Then
  9997. $wearedead = 0
  9998. start()
  9999. If $wearedead = 0 Then zaishen()
  10000. If $wearedead = 0 Then uw()
  10001. If NOT $boolrun Then
  10002. out("Bot was paused")
  10003. EndIf
  10004. EndIf
  10005. WEnd
  10006.  
  10007. Func init()
  10008. Switch (@GUI_CtrlId)
  10009. Case $guistart
  10010. If $boolrun = False Then
  10011. GUICtrlSetData($guistart, "...")
  10012. GUICtrlSetState($guistart, $gui_enable)
  10013. GUICtrlSetState($guiname, $gui_disable)
  10014. initialize(GUICtrlRead($guiname), True, True)
  10015. GUICtrlSetData($guistart, "Don't both workin working")
  10016. $boolrun = True
  10017. famesave()
  10018. out("Bot started!")
  10019. Else
  10020. GUICtrlSetData($guistart, "You had k it -_- it -_-")
  10021. GUICtrlSetState($guistart, $gui_disable)
  10022. $boolrun = False
  10023. EndIf
  10024. Case $cbxhidegw
  10025. If GUICtrlRead($cbxhidegw) = 1 Then
  10026. disablerendering()
  10027. WinSetState(getwindowhandle(), "", @SW_HIDE)
  10028. Else
  10029. enablerendering()
  10030. WinSetState(getwindowhandle(), "", @SW_SHOW)
  10031. EndIf
  10032. Case $gui_event_close
  10033. Exit
  10034. EndSwitch
  10035. EndFunc
  10036.  
  10037. Func mainloop()
  10038. If getmaploading() == $insta_outpostoutpost Then start()
  10039. If getmaploading() == $instanceplorablelorable AND getmapid() == $ha Then zaishen()
  10040. If getmapid() == $uw Then uw()
  10041. If getmapid() == $fetid Then fetid()
  10042. If getmapid() == $burialmounds Then burialmounds()
  10043. If getmapid() == $unholytemples Then unholytemples()
  10044. If getmapid() == $forgottenshrines Then forgottenshrines()
  10045. If getmapid() == $goldengates Then goldengates()
  10046. If getmapid() == $courtyard Then courtyard()
  10047. If getmapid() == $antechamber Then antechamber()
  10048. If getmapid() == $vault Then vault()
  10049. If getmapid() == $hoh Then hoh()
  10050. EndFunc
  10051.  
  10052. Func start()
  10053. If getmaploading() == $insta_outpostoutpost AND getmapid() == $ha Then
  10054. If GUICtrlRead($pause) = 1 Then
  10055. out("Bot paused")
  10056. Sleep(2000)
  10057. Else
  10058. GUICtrlSetData($nowinmap, "Out post HA")
  10059. titlecheck()
  10060. zkeys()
  10061. GUICtrlSetData($myboxesinbag, countiteminbagsbymodelid($mid_hero_boxes))
  10062. GUICtrlSetData($myzkeysinbag, countiteminbagsbymodelid($mid_zkey))
  10063. If geteffecttimeremaining(2546) > 0 Then
  10064. out("Wait fonorable.orable.")
  10065. Sleep(geteffecttimeremaining(2546) + 2000)
  10066. EndIf
  10067. Do
  10068. If getmapid() <> $ha Then
  10069. out("Tr outpostoutpost")
  10070. waitmaploading()
  10071. EndIf
  10072. Until getmapid() = $ha
  10073. GUICtrlSetData($lblruns, GUICtrlRead($lblruns) + 1)
  10074. $runs += 1
  10075. out("Starting Run # " & $runs)
  10076. out("Add henchs")
  10077. addnpc(17)
  10078. addnpc(12)
  10079. addnpc(13)
  10080. addnpc(14)
  10081. addnpc(6)
  10082. addnpc(7)
  10083. addnpc(8)
  10084. enterchallenge()
  10085. waitmaploading()
  10086. EndIf
  10087. EndIf
  10088. EndFunc
  10089.  
  10090. Func zaishen()
  10091. GUICtrlSetData($nowinmap, "Zaishen Map")
  10092. While getmaploading() == $instanceplorablelorable AND getmapid() == $ha
  10093. If GUICtrlRead($pause) = 1 Then
  10094. out("Bot paused")
  10095. Sleep(2000)
  10096. Else
  10097. checkisteamwiped()
  10098. $agent = getnearestenemytoagent()
  10099. $distance = getdistance($agent, -2)
  10100. $besttarget = getbesttarget()
  10101. $elementalist = getagentbyname("Zaishentalistntalist")
  10102. If $distance > 1300 AND $distance < 8000 Then
  10103. If getmaploading() == $instanceplorablelorable AND getmapid() == $ha Then
  10104. attack($agent)
  10105. out("HPt enemy: enemy:")
  10106. calltarget($agent)
  10107. changetarget($agent)
  10108. Sleep(2000)
  10109. EndIf
  10110. EndIf
  10111. If $distance < 2000 Then
  10112. If getmaploading() == $instanceplorablelorable AND getmapid() == $ha Then
  10113. killenemy()
  10114. EndIf
  10115. EndIf
  10116. If getnearestenemytoagent() = 0 Then
  10117. If getmaploading() == $instanceplorablelorable AND getmapid() == $ha Then
  10118. out("Waitloading:oading:")
  10119. waitmaploading()
  10120. EndIf
  10121. EndIf
  10122. If getmaploading() == $insta_outpostoutpost AND getmapid() == $ha Then
  10123. Return mainloop()
  10124. EndIf
  10125. EndIf
  10126. WEnd
  10127. EndFunc
  10128.  
  10129. Func uw()
  10130. GUICtrlSetData($nowinmap, "Underworld")
  10131. $iamwonuw = getherotitle()
  10132. skipcinematic()
  10133. While getmaploading() == $instanceplorablelorable AND getmapid() == $uw
  10134. $agent = getnearestenemytoagent()
  10135. $distance = getdistance($agent, -2)
  10136. $besttarget = getbesttarget()
  10137. checkisteamwiped()
  10138. If $iamwonuw == getherotitle() Then
  10139. If getnearestenemytoagent() = 0 Then
  10140. If getisliving(getmyid()) Then
  10141. If getmapid() == $uw Then
  10142. out("fight in UW")
  10143. Sleep(1000)
  10144. move(67, -3341)
  10145. EndIf
  10146. EndIf
  10147. EndIf
  10148. EndIf
  10149. If $iamwonuw == getherotitle() Then
  10150. If $distance > 1250 AND $distance < 8000 Then
  10151. If getisliving(getmyid()) Then
  10152. If getmapid() == $uw Then
  10153. attack($agent)
  10154. Sleep(1500)
  10155. EndIf
  10156. EndIf
  10157. EndIf
  10158. EndIf
  10159. If $iamwonuw == getherotitle() Then
  10160. If $distance < 1250 Then
  10161. If getisliving(getmyid()) Then
  10162. If getmapid() == $uw Then
  10163. killenemy()
  10164. EndIf
  10165. EndIf
  10166. EndIf
  10167. EndIf
  10168. If $iamwonuw < getherotitle() Then
  10169. If getmapid() == $uw Then
  10170. out("won in UW")
  10171. fameup()
  10172. Sleep(5000)
  10173. waitmaploading()
  10174. EndIf
  10175. EndIf
  10176. WEnd
  10177. GUICtrlSetData($munderworld, GUICtrlRead($munderworld) + 1)
  10178. EndFunc
  10179.  
  10180. Func fetid()
  10181. GUICtrlSetData($nowinmap, "Fetid River")
  10182. skipcinematic()
  10183. titlecheck()
  10184. $iamwonfetid = getherotitle()
  10185. While getmaploading() == $instanceplorablelorable AND getmapid() == $fetid
  10186. $agent = getnearestenemytoagent()
  10187. $distance = getdistance($agent, -2)
  10188. $besttarget = getbesttarget()
  10189. checkisteamwiped()
  10190. If $iamwonfetid == getherotitle() Then
  10191. If $distance > 1250 AND $distance < 8000 Then
  10192. If getisliving(getmyid()) Then
  10193. If getmapid() == $fetid Then
  10194. out("fight in Fetid")
  10195. attack($agent)
  10196. Sleep(1500)
  10197. EndIf
  10198. EndIf
  10199. EndIf
  10200. EndIf
  10201. If $iamwonfetid == getherotitle() Then
  10202. If $distance < 1250 Then
  10203. If getisliving(getmyid()) Then
  10204. If getmapid() == $fetid Then
  10205. out("killing in Fetid")
  10206. killenemy()
  10207. EndIf
  10208. EndIf
  10209. EndIf
  10210. EndIf
  10211. If $iamwonfetid < getherotitle() Then
  10212. If getisliving(getmyid()) Then
  10213. If getmapid() == $fetid Then
  10214. out("won in Fetid")
  10215. fameup()
  10216. Sleep(5000)
  10217. waitmaploading()
  10218. EndIf
  10219. EndIf
  10220. EndIf
  10221. WEnd
  10222. GUICtrlSetData($mfetidriver, GUICtrlRead($mfetidriver) + 1)
  10223. EndFunc
  10224.  
  10225. Func burialmounds()
  10226. GUICtrlSetData($nowinmap, "Burial Mounds")
  10227. skipcinematic()
  10228. titlecheck()
  10229. $iamalmoundslmounds = getherotitle()
  10230. While getmaploading() == $instanceplorablelorable AND getmapid() == $burialmounds
  10231. $agent = getnearestenemytoagent()
  10232. $distance = getdistance($agent, -2)
  10233. $besttarget = getbesttarget()
  10234. checkisteamwiped()
  10235. If $iamalmoundslmounds == getherotitle() Then
  10236. If getnearestenemytoagent() = 0 Then
  10237. If getisliving(getmyid()) Then
  10238. If getmapid() == $burialmounds Then
  10239. out("lf enemes")
  10240. Sleep(1000)
  10241. move(-4214, 3251)
  10242. EndIf
  10243. EndIf
  10244. EndIf
  10245. EndIf
  10246. If $iamalmoundslmounds == getherotitle() Then
  10247. If $distance > 1250 AND $distance < 10000 Then
  10248. If getisliving(getmyid()) Then
  10249. If getmapid() == $burialmounds Then
  10250. out("fight in Byrial")
  10251. attack($agent)
  10252. Sleep(1500)
  10253. EndIf
  10254. EndIf
  10255. EndIf
  10256. EndIf
  10257. If $iamalmoundslmounds == getherotitle() Then
  10258. If $distance < 1250 Then
  10259. If getisliving(getmyid()) Then
  10260. If getmapid() == $burialmounds Then
  10261. out("Kin Byrial Byrial")
  10262. killenemy()
  10263. EndIf
  10264. EndIf
  10265. EndIf
  10266. EndIf
  10267. If $iamalmoundslmounds < getherotitle() Then
  10268. If getisliving(getmyid()) Then
  10269. If getmapid() == $burialmounds Then
  10270. out("won in Burial")
  10271. fameup()
  10272. Sleep(5000)
  10273. waitmaploading()
  10274. EndIf
  10275. EndIf
  10276. EndIf
  10277. WEnd
  10278. GUICtrlSetData($mburialmounds, GUICtrlRead($mburialmounds) + 1)
  10279. EndFunc
  10280.  
  10281. Func unholytemples()
  10282. GUICtrlSetData($nowinmap, "Unholy Temples")
  10283. skipcinematic()
  10284. titlecheck()
  10285. $iamwytemplestemples = getherotitle()
  10286. checkcolor()
  10287. While getmaploading() == $instanceplorablelorable AND getmapid() == $unholytemples
  10288. If $iam = $iamblue Then
  10289. unholyblue()
  10290. If $iamwytemplestemples < getherotitle() Then
  10291. If getisliving(getmyid()) Then
  10292. If getmapid() == $unholytemples Then
  10293. out("won in Unholy")
  10294. Sleep(5000)
  10295. waitmaploading()
  10296. EndIf
  10297. EndIf
  10298. EndIf
  10299. EndIf
  10300. If $iam = $iamred Then
  10301. unholyred()
  10302. If $iamwytemplestemples < getherotitle() Then
  10303. If getisliving(getmyid()) Then
  10304. If getmapid() == $unholytemples Then
  10305. out("won in Unholy")
  10306. fameup()
  10307. Sleep(5000)
  10308. waitmaploading()
  10309. EndIf
  10310. EndIf
  10311. EndIf
  10312. EndIf
  10313. WEnd
  10314. GUICtrlSetData($munholytemples, GUICtrlRead($munholytemples) + 1)
  10315. EndFunc
  10316.  
  10317. Func unholyblue()
  10318. $ghostly1 = getnearestnpctocoords(1883, 2328)
  10319. $iamwytemplestemples = getherotitle()
  10320. checkisteamwiped()
  10321. $nearestnps = getnearestagenttoagent()
  10322. If $iamwytemplestemples == getherotitle() Then
  10323. If getisliving(getmyid()) Then
  10324. If getmapid() == $unholytemples Then
  10325. out("run blue relicks")
  10326. moveto(-667, -331)
  10327. EndIf
  10328. EndIf
  10329. EndIf
  10330. If $iamwytemplestemples == getherotitle() AND checkarea(-667, -331) Then
  10331. If getisliving(getmyid()) Then
  10332. If getmapid() == $unholytemples Then
  10333. moveto(-2233, -2047)
  10334. EndIf
  10335. EndIf
  10336. EndIf
  10337. If $iamwytemplestemples == getherotitle() AND checkarea(-2233, -2047) Then
  10338. If getisliving(getmyid()) Then
  10339. If getmapid() == $unholytemples Then
  10340. pickuploot()
  10341. Sleep(1000)
  10342. moveto(-667, -331)
  10343. EndIf
  10344. EndIf
  10345. EndIf
  10346. If $iamwytemplestemples == getherotitle() AND checkarea(-667, -331) Then
  10347. If getisliving(getmyid()) Then
  10348. If getmapid() == $unholytemples Then
  10349. moveto(1549, 1519)
  10350. commandall(-3107, -2996)
  10351. gotonpc($ghostly1)
  10352. Sleep(2000)
  10353. EndIf
  10354. EndIf
  10355. EndIf
  10356. EndFunc
  10357.  
  10358. Func unholyred()
  10359. $ghostly2 = getnearestnpctocoords(-3052, -3041)
  10360. $iamwytemplestemples = getherotitle()
  10361. checkisteamwiped()
  10362. $nearestnps = getnearestagenttoagent()
  10363. If $iamwytemplestemples == getherotitle() Then
  10364. If getisliving(getmyid()) Then
  10365. If getmapid() == $unholytemples Then
  10366. out("run red relicks")
  10367. moveto(-667, -331)
  10368. EndIf
  10369. EndIf
  10370. EndIf
  10371. If $iamwytemplestemples == getherotitle() AND checkarea(-667, -331) Then
  10372. If getisliving(getmyid()) Then
  10373. If getmapid() == $unholytemples Then
  10374. moveto(868, 1666)
  10375. EndIf
  10376. EndIf
  10377. EndIf
  10378. If $iamwytemplestemples == getherotitle() AND checkarea(868, 1666) Then
  10379. If getisliving(getmyid()) Then
  10380. If getmapid() == $unholytemples Then
  10381. pickuploot()
  10382. Sleep(1000)
  10383. moveto(-667, -331)
  10384. EndIf
  10385. EndIf
  10386. EndIf
  10387. If $iamwytemplestemples == getherotitle() AND checkarea(-667, -331) Then
  10388. If getisliving(getmyid()) Then
  10389. If getmapid() == $unholytemples Then
  10390. moveto(-2855, -1646)
  10391. moveto(-3107, -2996)
  10392. commandall(1549, 1519)
  10393. gotonpc($ghostly2)
  10394. Sleep(2000)
  10395. EndIf
  10396. EndIf
  10397. EndIf
  10398. EndFunc
  10399.  
  10400. Func forgottenshrines()
  10401. GUICtrlSetData($nowinmap, "Fo ShrinesShrines")
  10402. skipcinematic()
  10403. titlecheck()
  10404. $iamwonfnshrinesshrines = getherotitle()
  10405. $ghostlyblue = getnearestnpctocoords(-1910, -3490)
  10406. $ghostlyred = getnearestnpctocoords(1950, -3435)
  10407. checkcolor()
  10408. If getmaploading() == $instanceplorablelorable AND getmapid() == $forgottenshrines Then
  10409. If $iam == $iamblue Then
  10410. gotonpc($ghostlyblue)
  10411. Sleep(1000)
  10412. EndIf
  10413. EndIf
  10414. If getmaploading() == $instanceplorablelorable AND getmapid() == $forgottenshrines Then
  10415. If $iam == $iamred Then
  10416. gotonpc($ghostlyred)
  10417. Sleep(1000)
  10418. EndIf
  10419. EndIf
  10420. Global $startblue = 0
  10421. Global $startred = 0
  10422. While getmaploading() == $instanceplorablelorable AND getmapid() == $forgottenshrines
  10423. If $iam == $iamblue Then
  10424. out("I am blue")
  10425. checkisteamwiped()
  10426. $agent = getnearestenemytoagent()
  10427. $distance = getdistance($agent, -2)
  10428. $besttarget = getbesttarget()
  10429. If $startblue = 0 Then
  10430. If $iamwonfnshrinesshrines == getherotitle() Then
  10431. If getisliving(getmyid()) Then
  10432. If getmapid() == $forgottenshrines Then
  10433. commandall(-949, 946)
  10434. Do
  10435. If getisdead(getmyid()) Then ExitLoop
  10436. If $iamwonfnshrinesshrines < getherotitle() Then ExitLoop
  10437. move(-2227, -1405)
  10438. Sleep(2000)
  10439. Until checkarea(-2227, -1405)
  10440. EndIf
  10441. EndIf
  10442. EndIf
  10443. EndIf
  10444. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(-2227, -1405) AND getmapid() == $forgottenshrines Then
  10445. If getisliving(getmyid()) Then
  10446. Sleep(15000)
  10447. moveto(-949, 946)
  10448. $startblue = 1
  10449. EndIf
  10450. EndIf
  10451. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(-949, 946) AND getmapid() == $forgottenshrines Then
  10452. If getisliving(getmyid()) Then
  10453. Sleep(15000)
  10454. commandall(11, 3664)
  10455. moveto(11, 3664)
  10456. EndIf
  10457. EndIf
  10458. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(11, 3664) AND getmapid() == $forgottenshrines Then
  10459. If getisliving(getmyid()) Then
  10460. Sleep(15000)
  10461. commandall(606, 928)
  10462. moveto(606, 928)
  10463. EndIf
  10464. EndIf
  10465. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(606, 928) AND getmapid() == $forgottenshrines Then
  10466. If getisliving(getmyid()) Then
  10467. Sleep(15000)
  10468. commandall(2063, -1375)
  10469. moveto(2063, -1375)
  10470. EndIf
  10471. EndIf
  10472. If $startblue = 1 Then
  10473. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10474. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(606, 928)
  10475. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10476. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(11, 3664)
  10477. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10478. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(-949, 946)
  10479. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10480. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(2063, -1375)
  10481. EndIf
  10482. If $iamwonfnshrinesshrines < getherotitle() AND getmapid() == $forgottenshrines Then
  10483. If getisliving(getmyid()) Then
  10484. If getmapid() == $forgottenshrines Then
  10485. out("won in FS")
  10486. Sleep(5000)
  10487. waitmaploading()
  10488. EndIf
  10489. EndIf
  10490. EndIf
  10491. EndIf
  10492. If $iam == $iamred Then
  10493. out("I am red")
  10494. checkisteamwiped()
  10495. $agent = getnearestenemytoagent()
  10496. $distance = getdistance($agent, -2)
  10497. $besttarget = getbesttarget()
  10498. If $startred = 0 Then
  10499. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then
  10500. If getisliving(getmyid()) Then
  10501. commandall(606, 928)
  10502. Do
  10503. If getmapid() <> $forgottenshrines Then ExitLoop
  10504. If getisdead(getmyid()) Then ExitLoop
  10505. If $iamwonfnshrinesshrines < getherotitle() Then ExitLoop
  10506. move(2063, -1375)
  10507. Sleep(2000)
  10508. Until checkarea(2063, -1375)
  10509. EndIf
  10510. EndIf
  10511. EndIf
  10512. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(2063, -1375) AND getmapid() == $forgottenshrines Then
  10513. If getisliving(getmyid()) Then
  10514. Sleep(15000)
  10515. moveto(606, 928)
  10516. $startred = 1
  10517. EndIf
  10518. EndIf
  10519. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(606, 928) AND getmapid() == $forgottenshrines Then
  10520. If getisliving(getmyid()) Then
  10521. Sleep(15000)
  10522. commandall(11, 3664)
  10523. moveto(11, 3664)
  10524. EndIf
  10525. EndIf
  10526. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(11, 3664) AND getmapid() == $forgottenshrines Then
  10527. If getisliving(getmyid()) Then
  10528. Sleep(15000)
  10529. commandall(-949, 946)
  10530. moveto(-949, 946)
  10531. Sleep(15000)
  10532. EndIf
  10533. EndIf
  10534. If $iamwonfnshrinesshrines == getherotitle() AND checkarea(-949, 946) AND getmapid() == $forgottenshrines Then
  10535. If getisliving(getmyid()) Then
  10536. Sleep(15000)
  10537. commandall(-2227, -1405)
  10538. moveto(-2227, -1405)
  10539. EndIf
  10540. EndIf
  10541. If $startred = 1 Then
  10542. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10543. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(-949, 946)
  10544. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10545. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(11, 3664)
  10546. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10547. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(606, 928)
  10548. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then Sleep(20000)
  10549. If $iamwonfnshrinesshrines == getherotitle() AND getmapid() == $forgottenshrines Then commandall(-2227, -1405)
  10550. EndIf
  10551. If $iamwonfnshrinesshrines < getherotitle() AND getmapid() == $forgottenshrines Then
  10552. If getisdead(getmyid()) Then ExitLoop
  10553. If getisliving(getmyid()) Then
  10554. If getmapid() == $forgottenshrines Then
  10555. out("won in FS")
  10556. fameup()
  10557. Sleep(5000)
  10558. waitmaploading()
  10559. EndIf
  10560. EndIf
  10561. EndIf
  10562. EndIf
  10563. WEnd
  10564. GUICtrlSetData($mfnshrinesshrines, GUICtrlRead($mfnshrinesshrines) + 1)
  10565. EndFunc
  10566.  
  10567. Func goldengates()
  10568. GUICtrlSetData($nowinmap, "Golden Gates")
  10569. skipcinematic()
  10570. cancelall()
  10571. titlecheck()
  10572. $iadengatesengates = getherotitle()
  10573. While getmaploading() == $instanceplorablelorable AND getmapid() == $goldengates
  10574. If getmapid() <> $goldengates Then ExitLoop
  10575. checkisteamwiped()
  10576. $agent = getnearestenemytoagent()
  10577. $distance = getdistance($agent, -2)
  10578. $besttarget = getbesttarget()
  10579. If $iadengatesengates == getherotitle() Then
  10580. If getnearestenemytoagent() = 0 Then
  10581. If getisdead(getmyid()) Then ExitLoop
  10582. If getisliving(getmyid()) Then
  10583. If getmapid() == $goldengates Then
  10584. out("lf enemes")
  10585. moveto(-308, -950)
  10586. Sleep(1000)
  10587. EndIf
  10588. EndIf
  10589. EndIf
  10590. EndIf
  10591. If $iadengatesengates == getherotitle() Then
  10592. If $distance > 1300 AND $distance < 5000 Then
  10593. If getisdead(getmyid()) Then ExitLoop
  10594. If getisliving(getmyid()) Then
  10595. If getmapid() == $goldengates Then
  10596. out("fight in GG")
  10597. gonpc($agent)
  10598. Sleep(500)
  10599. attack($agent)
  10600. Sleep(1500)
  10601. EndIf
  10602. EndIf
  10603. EndIf
  10604. EndIf
  10605. If $iadengatesengates == getherotitle() Then
  10606. If $distance < 1300 Then
  10607. If getisdead(getmyid()) Then ExitLoop
  10608. If getisliving(getmyid()) Then
  10609. If getmapid() == $goldengates Then
  10610. killenemy()
  10611. EndIf
  10612. EndIf
  10613. EndIf
  10614. EndIf
  10615. If $iadengatesengates < getherotitle() Then
  10616. If getisdead(getmyid()) Then ExitLoop
  10617. If getisliving(getmyid()) Then
  10618. If getmapid() == $goldengates Then
  10619. out("won in GG")
  10620. fameup()
  10621. Sleep(5000)
  10622. waitmaploading()
  10623. EndIf
  10624. EndIf
  10625. EndIf
  10626. WEnd
  10627. GUICtrlSetData($mgoldengates, GUICtrlRead($mgoldengates) + 1)
  10628. EndFunc
  10629.  
  10630. Func courtyard()
  10631. GUICtrlSetData($nowinmap, "Courtyard")
  10632. skipcinematic()
  10633. cancelall()
  10634. gotonpc(getagentbyname("Ghostly Hero"))
  10635. titlecheck()
  10636. $iamwoncourtyard = getherotitle()
  10637. While getmaploading() == $instanceplorablelorable AND getmapid() == $courtyard
  10638. If getmapid() <> $courtyard Then ExitLoop
  10639. out("Courtyard")
  10640. checkisteamwiped()
  10641. If $iamwoncourtyard == getherotitle() Then
  10642. If NOT checkarea(-75, 325) Then
  10643. If getisdead(getmyid()) Then ExitLoop
  10644. If getisliving(getmyid()) Then
  10645. If getmapid() == $courtyard Then
  10646. out("lf enemes")
  10647. Sleep(1000)
  10648. moveto(-75, 325)
  10649. EndIf
  10650. EndIf
  10651. EndIf
  10652. EndIf
  10653. If $iamwoncourtyard == getherotitle() Then
  10654. If $distance < 1300 Then
  10655. If getisdead(getmyid()) Then ExitLoop
  10656. If getisliving(getmyid()) Then
  10657. If getmapid() == $courtyard Then
  10658. killenemy()
  10659. EndIf
  10660. EndIf
  10661. EndIf
  10662. EndIf
  10663. If $iamwoncourtyard < getherotitle() Then
  10664. If getisdead(getmyid()) Then ExitLoop
  10665. If getisliving(getmyid()) Then
  10666. If getmapid() == $courtyard Then
  10667. out("won in Courtyard")
  10668. fameup()
  10669. Sleep(5000)
  10670. waitmaploading()
  10671. EndIf
  10672. EndIf
  10673. EndIf
  10674. WEnd
  10675. GUICtrlSetData($mcourtyard, GUICtrlRead($mcourtyard) + 1)
  10676. EndFunc
  10677.  
  10678. Func antechamber()
  10679. GUICtrlSetData($nowinmap, "Antechamber")
  10680. skipcinematic()
  10681. cancelall()
  10682. titlecheck()
  10683. $iaechamberchamber = getherotitle()
  10684. checkcolor()
  10685. While getmaploading() == $instanceplorablelorable AND getmapid() == $antechamber
  10686. If $iam == $iamblue Then
  10687. out("Antechamber")
  10688. checkisteamwiped()
  10689. If $iaechamberchamber == getherotitle() Then
  10690. If getisliving(getmyid()) Then
  10691. If getmapid() == $antechamber Then
  10692. commandall(-494, 4389)
  10693. Do
  10694. If getmapid() <> $antechamber Then ExitLoop
  10695. If getisdead(getmyid()) Then ExitLoop
  10696. If $iaechamberchamber < getherotitle() Then ExitLoop
  10697. move(-485, 2039)
  10698. Sleep(2000)
  10699. Until checkarea(-485, 2039)
  10700. EndIf
  10701. EndIf
  10702. EndIf
  10703. If checkarea(-485, 2039) Then
  10704. If $iaechamberchamber == getherotitle() Then
  10705. If getisliving(getmyid()) Then
  10706. If getmapid() == $antechamber Then
  10707. Sleep(15000)
  10708. commandall(-495, -18)
  10709. moveto(28, 1144)
  10710. Sleep(1000)
  10711. EndIf
  10712. EndIf
  10713. EndIf
  10714. EndIf
  10715. If checkarea(28, 1144) Then
  10716. If $iaechamberchamber == getherotitle() Then
  10717. If getisliving(getmyid()) Then
  10718. If getmapid() == $antechamber Then
  10719. moveto(-495, -18)
  10720. Sleep(5000)
  10721. cancelall()
  10722. EndIf
  10723. EndIf
  10724. EndIf
  10725. EndIf
  10726. If checkarea(-495, -18) Then
  10727. If $iaechamberchamber == getherotitle() Then
  10728. If getisliving(getmyid()) Then
  10729. If getmapid() == $antechamber Then
  10730. moveto(237, -9)
  10731. Sleep(1000)
  10732. EndIf
  10733. EndIf
  10734. EndIf
  10735. EndIf
  10736. If checkarea(237, -9) Then
  10737. If $iaechamberchamber == getherotitle() Then
  10738. If getisliving(getmyid()) Then
  10739. If getmapid() == $antechamber Then
  10740. moveto(-494, -2239)
  10741. EndIf
  10742. EndIf
  10743. EndIf
  10744. EndIf
  10745. If checkarea(-494, -2239) Then
  10746. If $iaechamberchamber == getherotitle() Then
  10747. If getisliving(getmyid()) Then
  10748. If getmapid() == $antechamber Then
  10749. Sleep(15000)
  10750. commandall(-467, -4608)
  10751. Sleep(15000)
  10752. cancelall()
  10753. EndIf
  10754. EndIf
  10755. EndIf
  10756. EndIf
  10757. If $iaechamberchamber < getherotitle() Then
  10758. If getisdead(getmyid()) Then ExitLoop
  10759. If getisliving(getmyid()) Then
  10760. If getmapid() == $antechamber Then
  10761. out("won in Ante")
  10762. Sleep(5000)
  10763. waitmaploading()
  10764. EndIf
  10765. EndIf
  10766. EndIf
  10767. EndIf
  10768. If $iam == $iamred Then
  10769. out("Antechamber")
  10770. checkisteamwiped()
  10771. If $iaechamberchamber == getherotitle() Then
  10772. If getisliving(getmyid()) Then
  10773. If getmapid() == $antechamber Then
  10774. commandall(-467, -4608)
  10775. Do
  10776. If getmapid() <> $antechamber Then ExitLoop
  10777. If getisdead(getmyid()) Then ExitLoop
  10778. If $iaechamberchamber < getherotitle() Then ExitLoop
  10779. move(-475, -2253)
  10780. Sleep(2000)
  10781. Until checkarea(-494, -2239)
  10782. EndIf
  10783. EndIf
  10784. EndIf
  10785. If checkarea(-494, -2239) Then
  10786. If $iaechamberchamber == getherotitle() Then
  10787. If getisliving(getmyid()) Then
  10788. If getmapid() == $antechamber Then
  10789. Sleep(15000)
  10790. moveto(-494, -2239)
  10791. EndIf
  10792. EndIf
  10793. EndIf
  10794. EndIf
  10795. If checkarea(-494, -2239) Then
  10796. If $iaechamberchamber == getherotitle() Then
  10797. If getisliving(getmyid()) Then
  10798. If getmapid() == $antechamber Then
  10799. Sleep(15000)
  10800. commandall(-495, -18)
  10801. moveto(-1030, -1250)
  10802. Sleep(1000)
  10803. EndIf
  10804. EndIf
  10805. EndIf
  10806. EndIf
  10807. If checkarea(-1030, -1250) Then
  10808. If $iaechamberchamber == getherotitle() Then
  10809. If getisliving(getmyid()) Then
  10810. If getmapid() == $antechamber Then
  10811. moveto(-495, -18)
  10812. Sleep(5000)
  10813. cancelall()
  10814. EndIf
  10815. EndIf
  10816. EndIf
  10817. EndIf
  10818. If checkarea(-495, -18) Then
  10819. If $iaechamberchamber == getherotitle() Then
  10820. If getisliving(getmyid()) Then
  10821. If getmapid() == $antechamber Then
  10822. moveto(237, -9)
  10823. Sleep(1000)
  10824. EndIf
  10825. EndIf
  10826. EndIf
  10827. EndIf
  10828. If checkarea(237, -9) Then
  10829. If $iaechamberchamber == getherotitle() Then
  10830. If getisliving(getmyid()) Then
  10831. If getmapid() == $antechamber Then
  10832. moveto(-485, 2039)
  10833. Sleep(15000)
  10834. EndIf
  10835. EndIf
  10836. EndIf
  10837. EndIf
  10838. If checkarea(-485, 2039) Then
  10839. If $iaechamberchamber == getherotitle() Then
  10840. If getisliving(getmyid()) Then
  10841. If getmapid() == $antechamber Then
  10842. commandall(-494, 4389)
  10843. Sleep(15000)
  10844. EndIf
  10845. EndIf
  10846. EndIf
  10847. EndIf
  10848. If $iaechamberchamber < getherotitle() Then
  10849. If getisdead(getmyid()) Then ExitLoop
  10850. If getisliving(getmyid()) Then
  10851. If getmapid() == $antechamber Then
  10852. out("won in Ante")
  10853. fameup()
  10854. Sleep(5000)
  10855. waitmaploading()
  10856. EndIf
  10857. EndIf
  10858. EndIf
  10859. EndIf
  10860. WEnd
  10861. GUICtrlSetData($mantechamber, GUICtrlRead($mantechamber) + 1)
  10862. EndFunc
  10863.  
  10864. Func vault()
  10865. GUICtrlSetData($nowinmap, "Vault")
  10866. skipcinematic()
  10867. If getmapid() == $vault Then
  10868. Sleep(5000)
  10869. out("Vault")
  10870. travelto($ha)
  10871. waitmaploading()
  10872. EndIf
  10873. EndFunc
  10874.  
  10875. Func hoh()
  10876. GUICtrlSetData($nowinmap, "Hall of Hero")
  10877. skipcinematic()
  10878. While getmapid() == $hoh
  10879. If GUICtrlRead($pause) = 1 Then
  10880. out("Bot paused")
  10881. Sleep(2000)
  10882. Else
  10883. out("HoH")
  10884. Sleep(10000)
  10885. resign()
  10886. waitmaploading()
  10887. EndIf
  10888. WEnd
  10889. GUICtrlSetData($mhallofhero, GUICtrlRead($mhallofhero) + 1)
  10890. EndFunc
  10891.  
  10892. Func killenemy()
  10893. If getmapid() == $uw Then
  10894. If $distance < 1250 Then
  10895. For $i = 1 To 7
  10896. If getisdead(getmyid()) Then ExitLoop
  10897. If getmaploading() == $insta_outpostoutpost Then ExitLoop
  10898. $agent = getnearestenemytoagent()
  10899. $besttarget = getbesttarget()
  10900. out("Kill Enemes")
  10901. attack($besttarget)
  10902. calltarget($besttarget)
  10903. Sleep(300)
  10904. skilluserange($i, $besttarget)
  10905. Sleep(300)
  10906. changetarget($besttarget)
  10907. Next
  10908. EndIf
  10909. EndIf
  10910. If getmapid() <> $uw Then
  10911. If $distance < 1250 Then
  10912. For $i = 1 To 7
  10913. If getisdead(getmyid()) Then ExitLoop
  10914. If getmaploading() == $insta_outpostoutpost Then ExitLoop
  10915. $agent = getnearestenemytoagent()
  10916. $besttarget = getbesttarget()
  10917. out("Kill Enemes")
  10918. attack($agent)
  10919. calltarget($agent)
  10920. Sleep(300)
  10921. skilluserange($i, $agent)
  10922. Sleep(300)
  10923. changetarget($agent)
  10924. Next
  10925. EndIf
  10926. EndIf
  10927. EndFunc
  10928.  
  10929. Func skilluserange($skillnumber, $agent)
  10930. $distance = getdistance($agent, -2)
  10931. If $distance < 1250 Then
  10932. While True
  10933. $skillslotid = getskillbarskillid($skillnumber)
  10934. $skillidstruct = getskillbyid($skillslotid)
  10935. useskill($skillnumber, -1)
  10936. $activatausgabeausgabe = DllStructGetData($skillidstruct, "Activation")
  10937. $aftertausgabeausgabe = DllStructGetData($skillidstruct, "Aftercast")
  10938. Sleep(1500)
  10939. ExitLoop
  10940. WEnd
  10941. EndIf
  10942. EndFunc
  10943.  
  10944. Func getbesttarget($arange = 1220)
  10945. Local $lbesttarget, $ldistance, $llowestsum = 100000000
  10946. Local $lagentarray = getagentarray(219)
  10947. For $i = 1 To $lagentarray[0]
  10948. Local $lsumdistances = 0
  10949. If DllStructGetData($lagentarray[$i], "Allegiance") <> 3 Then ContinueLoop
  10950. If DllStructGetData($lagentarray[$i], "HP") <= 0 Then ContinueLoop
  10951. If DllStructGetData($lagentarray[$i], "ID") = getmyid() Then ContinueLoop
  10952. If getdistance($lagentarray[$i]) > $arange Then ContinueLoop
  10953. For $j = 1 To $lagentarray[0]
  10954. If DllStructGetData($lagentarray[$j], "Allegiance") <> 3 Then ContinueLoop
  10955. If DllStructGetData($lagentarray[$j], "HP") <= 0 Then ContinueLoop
  10956. If DllStructGetData($lagentarray[$j], "ID") = getmyid() Then ContinueLoop
  10957. If getdistance($lagentarray[$j]) > $arange Then ContinueLoop
  10958. $ldistance = getdistance($lagentarray[$i], $lagentarray[$j])
  10959. $lsumdistances += $ldistance
  10960. Next
  10961. If $lsumdistances < $llowestsum Then
  10962. $llowestsum = $lsumdistances
  10963. $lbesttarget = $lagentarray[$i]
  10964. EndIf
  10965. Next
  10966. Return $lbesttarget
  10967. EndFunc
  10968.  
  10969. #EndRegion
Add Comment
Please, Sign In to add comment