Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoTrayIcon
- Func _winapi_getlasterror($ierror = @error, $iextended = @extended)
- Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
- Return SetError($ierror, $iextended, $aresult[0])
- EndFunc
- Func _winapi_setlasterror($ierrorcode, $ierror = @error, $iextended = @extended)
- DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
- Return SetError($ierror, $iextended, NULL )
- EndFunc
- Global Const $fc_nooverwrite = 0
- Global Const $fc_overwrite = 1
- Global Const $fc_createpath = 8
- Global Const $ft_modified = 0
- Global Const $ft_created = 1
- Global Const $ft_accessed = 2
- Global Const $fo_read = 0
- Global Const $fo_append = 1
- Global Const $fo_overwrite = 2
- Global Const $fo_createpath = 8
- Global Const $fo_binary = 16
- Global Const $fo_unicode = 32
- Global Const $fo_utf16_le = 32
- Global Const $fo_utf16_be = 64
- Global Const $fo_utf8 = 128
- Global Const $fo_utf8_nobom = 256
- Global Const $fo_utf8_full = 16384
- Global Const $eof = -1
- Global Const $fd_filemustexist = 1
- Global Const $fd_pathmustexist = 2
- Global Const $fd_multiselect = 4
- Global Const $fd_promptcreatenew = 8
- Global Const $fd_promptoverwrite = 16
- Global Const $create_new = 1
- Global Const $create_always = 2
- Global Const $open_existing = 3
- Global Const $open_always = 4
- Global Const $truncate_existing = 5
- Global Const $invalid_set_file_pointer = -1
- Global Const $file_begin = 0
- Global Const $file_current = 1
- Global Const $file_end = 2
- Global Const $file_attribute_readonly = 1
- Global Const $file_attribute_hidden = 2
- Global Const $file_attribute_system = 4
- Global Const $file_attribute_directory = 16
- Global Const $file_attribute_archive = 32
- Global Const $file_attribute_device = 64
- Global Const $file_attribute_normal = 128
- Global Const $file_attribute_temporary = 256
- Global Const $file_attribute_sparse_file = 512
- Global Const $file_attribute_reparse_point = 1024
- Global Const $file_attribute_compressed = 2048
- Global Const $file_attribute_offline = 4096
- Global Const $file_attribute_not_content_indexed = 8192
- Global Const $file_attribute_encrypted = 16384
- Global Const $file_share_read = 1
- Global Const $file_share_write = 2
- Global Const $file_share_delete = 4
- Global Const $file_share_readwrite = BitOR($file_share_read, $file_share_write)
- Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete)
- Global Const $generic_all = 268435456
- Global Const $generic_execute = 536870912
- Global Const $generic_write = 1073741824
- Global Const $generic_read = -2147483648
- Global Const $generic_readwrite = BitOR($generic_read, $generic_write)
- Global Const $tagpoint = "struct;long X;long Y;endstruct"
- Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct"
- Global Const $tagsize = "struct;long X;long Y;endstruct"
- Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
- Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct"
- Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct"
- Global Const $tagtime_zone_information = "struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct"
- Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct"
- Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
- Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]"
- Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why"
- Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
- Global Const $tagdtprange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;" & "word MinSecond;word MinMSecond;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;" & "word MaxMinute;word MaxSecond;word MaxMSecond;bool MinValid;bool MaxValid"
- Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
- Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
- Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct"
- Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
- Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
- Global Const $tageventlogrecord = "dword Length;dword Reserved;dword RecordNumber;dword TimeGenerated;dword TimeWritten;dword EventID;" & "word EventType;word NumStrings;word EventCategory;word ReservedFlags;dword ClosingRecordNumber;dword StringOffset;" & "dword UserSidLength;dword UserSidOffset;dword DataLength;dword DataOffset"
- Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge"
- Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel"
- Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue"
- Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue"
- Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]"
- Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel"
- Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow"
- Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas"
- Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount"
- Global Const $taggdip_effectparams_tint = "int Hue; int Amount"
- Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
- Global Const $taggdipcolormatrix = "float m[25]"
- Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct"
- Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam
- Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct"
- Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
- Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
- Global Const $taggdipimagecodecinfo = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & "ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask"
- Global Const $taggdippencoderparams = "uint Count;byte Params[1]"
- Global Const $taghditem = "uint Mask;int XY;ptr Text;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;int Order;uint Type;ptr pFilter;uint State"
- Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
- Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
- Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
- Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
- Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
- Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct"
- Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup"
- Global Const $taglvitem = "struct;uint Mask;int Item;int SubItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;lparam Param;" & "int Indent;int GroupID;uint Columns;ptr pColumns;ptr piColFmt;int iGroup;endstruct"
- Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param"
- Global Const $tagnmlvcustomdraw = "struct;" & $tagnmhdr & ";dword dwDrawStage;handle hdc;" & $tagrect & ";dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam;endstruct" & ";dword clrText;dword clrTextBk;int iSubItem;dword dwItemType;dword clrFace;int iIconEffect;" & "int iIconPhase;int iPartId;int iStateId;struct;long TextLeft;long TextTop;long TextRight;long TextBottom;endstruct;uint uAlign"
- Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
- Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
- Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
- Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
- Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
- Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
- Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol"
- Global Const $tagmcmonthrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short Span"
- Global Const $tagmcrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short MinSet;short MaxSet"
- Global Const $tagmcselrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds"
- Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
- Global Const $tagnmselchange = $tagnmhdr & ";struct;word BegYear;word BegMonth;word BegDOW;word BegDay;word BegHour;word BegMinute;word BegSecond;word BegMSeconds;endstruct;" & "struct;word EndYear;word EndMonth;word EndDOW;word EndDay;word EndHour;word EndMinute;word EndSecond;word EndMSeconds;endstruct"
- Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags"
- Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
- Global Const $tagtvitem = "struct;uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param;endstruct"
- Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct"
- Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;" & "struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & "struct;long PointX;long PointY;endstruct"
- Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level"
- Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
- Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
- Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
- Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
- Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
- Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
- Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
- Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
- Global Const $tagmenuiteminfo = "uint Size;uint Mask;uint Type;uint State;uint ID;handle SubMenu;handle BmpChecked;handle BmpUnchecked;" & "ulong_ptr ItemData;ptr TypeData;uint CCH;handle BmpItem"
- Global Const $tagrebarbandinfo = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagrect & ";uint uChevronState")
- Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
- Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;" & "struct;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;endstruct;" & "struct;long ActualLeft;long ActualTop;long ActualRight;long ActualBottom;endstruct"
- Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam"
- Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
- Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;" & "struct;long CLeft;long CTop;long CRight;long CBottom;endstruct;" & "struct;long BLeft;long BTop;long BRight;long BBottom;endstruct"
- Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
- Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "struct;int iBitmap;int idCommand;byte fsState;byte fsStyle;dword_ptr dwData;int_ptr iString;endstruct" & ";int cchText;ptr pszText;" & $tagrect
- Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
- Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String"
- Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
- Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
- Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent"
- Global Const $tagopenfilename = "dword StructSize;hwnd hwndOwner;handle hInstance;ptr lpstrFilter;ptr lpstrCustomFilter;" & "dword nMaxCustFilter;dword nFilterIndex;ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;" & "ptr lpstrInitialDir;ptr lpstrTitle;dword Flags;word nFileOffset;word nFileExtension;ptr lpstrDefExt;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName;ptr pvReserved;dword dwReserved;dword FlagsEx"
- Global Const $tagbitmapinfoheader = "struct;dword biSize;long biWidth;long biHeight;word biPlanes;word biBitCount;" & "dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;endstruct"
- Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]"
- Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
- Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
- Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
- Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
- Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"
- Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
- Global Const $taglogfont = "struct;long Height;long Width;long Escapement;long Orientation;long Weight;byte Italic;byte Underline;" & "byte Strikeout;byte CharSet;byte OutPrecision;byte ClipPrecision;byte Quality;byte PitchAndFamily;wchar FaceName[32];endstruct"
- Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
- Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
- Global Const $tagstartupinfo = "dword Size;ptr Reserved1;ptr Desktop;ptr Title;dword X;dword Y;dword XSize;dword YSize;dword XCountChars;" & "dword YCountChars;dword FillAttribute;dword Flags;word ShowWindow;word Reserved2;ptr Reserved3;handle StdInput;" & "handle StdOutput;handle StdError"
- Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
- Global Const $tagwin32_find_data = "dword dwFileAttributes;dword ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFileName[260];wchar cAlternateFileName[14]"
- Global Const $tagtextmetric = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & "wchar tmFirstChar;wchar tmLastChar;wchar tmDefaultChar;wchar tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & "byte tmPitchAndFamily;byte tmCharSet"
- Global Const $gmem_fixed = 0
- Global Const $gmem_moveable = 2
- Global Const $gmem_nocompact = 16
- Global Const $gmem_nodiscard = 32
- Global Const $gmem_zeroinit = 64
- Global Const $gmem_modify = 128
- Global Const $gmem_discardable = 256
- Global Const $gmem_not_banked = 4096
- Global Const $gmem_share = 8192
- Global Const $gmem_ddeshare = 8192
- Global Const $gmem_notify = 16384
- Global Const $gmem_lower = 4096
- Global Const $gmem_valid_flags = 32626
- Global Const $gmem_invalid_handle = 32768
- Global Const $gptr = BitOR($gmem_fixed, $gmem_zeroinit)
- Global Const $ghnd = BitOR($gmem_moveable, $gmem_zeroinit)
- Global Const $mem_commit = 4096
- Global Const $mem_reserve = 8192
- Global Const $mem_top_down = 1048576
- Global Const $mem_shared = 134217728
- Global Const $page_noaccess = 1
- Global Const $page_readonly = 2
- Global Const $page_readwrite = 4
- Global Const $page_execute = 16
- Global Const $page_execute_read = 32
- Global Const $page_execute_readwrite = 64
- Global Const $page_execute_writecopy = 128
- Global Const $page_guard = 256
- Global Const $page_nocache = 512
- Global Const $page_writecombine = 1024
- Global Const $page_writecopy = 8
- Global Const $mem_decommit = 16384
- Global Const $mem_release = 32768
- Global Const $process_terminate = 1
- Global Const $process_create_thread = 2
- Global Const $process_set_sessionid = 4
- Global Const $process_vm_operation = 8
- Global Const $process_vm_read = 16
- Global Const $process_vm_write = 32
- Global Const $process_dup_handle = 64
- Global Const $process_create_process = 128
- Global Const $process_set_quota = 256
- Global Const $process_set_information = 512
- Global Const $process_query_information = 1024
- Global Const $process_query_limited_information = 4096
- Global Const $process_suspend_resume = 2048
- Global Const $process_all_access = 2035711
- Global Const $se_assignprimarytoken_name = "SeAssignPrimaryTokenPrivilege"
- Global Const $se_audit_name = "SeAuditPrivilege"
- Global Const $se_backup_name = "SeBackupPrivilege"
- Global Const $se_change_notify_name = "SeChangeNotifyPrivilege"
- Global Const $se_create_global_name = "SeCreateGlobalPrivilege"
- Global Const $se_create_pagefile_name = "SeCreatePagefilePrivilege"
- Global Const $se_create_permanent_name = "SeCreatePermanentPrivilege"
- Global Const $se_create_symbolic_link_name = "SeCreateSymbolicLinkPrivilege"
- Global Const $se_create_token_name = "SeCreateTokenPrivilege"
- Global Const $se_debug_name = "SeDebugPrivilege"
- Global Const $se_enable_delegation_name = "SeEnableDelegationPrivilege"
- Global Const $se_impersonate_name = "SeImpersonatePrivilege"
- Global Const $se_inc_base_priority_name = "SeIncreaseBasePriorityPrivilege"
- Global Const $se_inc_working_set_name = "SeIncreaseWorkingSetPrivilege"
- Global Const $se_increase_quota_name = "SeIncreaseQuotaPrivilege"
- Global Const $se_load_driver_name = "SeLoadDriverPrivilege"
- Global Const $se_lock_memory_name = "SeLockMemoryPrivilege"
- Global Const $se_machine_account_name = "SeMachineAccountPrivilege"
- Global Const $se_manage_volume_name = "SeManageVolumePrivilege"
- Global Const $se_prof_single_process_name = "SeProfileSingleProcessPrivilege"
- Global Const $se_relabel_name = "SeRelabelPrivilege"
- Global Const $se_remote_shutdown_name = "SeRemoteShutdownPrivilege"
- Global Const $se_restore_name = "SeRestorePrivilege"
- Global Const $se_security_name = "SeSecurityPrivilege"
- Global Const $se_shutdown_name = "SeShutdownPrivilege"
- Global Const $se_sync_agent_name = "SeSyncAgentPrivilege"
- Global Const $se_system_environment_name = "SeSystemEnvironmentPrivilege"
- Global Const $se_system_profile_name = "SeSystemProfilePrivilege"
- Global Const $se_systemtime_name = "SeSystemtimePrivilege"
- Global Const $se_take_ownership_name = "SeTakeOwnershipPrivilege"
- Global Const $se_tcb_name = "SeTcbPrivilege"
- Global Const $se_time_zone_name = "SeTimeZonePrivilege"
- Global Const $se_trusted_credman_access_name = "SeTrustedCredManAccessPrivilege"
- Global Const $se_unsolicited_input_name = "SeUnsolicitedInputPrivilege"
- Global Const $se_undock_name = "SeUndockPrivilege"
- Global Const $se_privilege_enabled_by_default = 1
- Global Const $se_privilege_enabled = 2
- Global Const $se_privilege_removed = 4
- Global Const $se_privilege_used_for_access = -2147483648
- Global Const $se_group_mandatory = 1
- Global Const $se_group_enabled_by_default = 2
- Global Const $se_group_enabled = 4
- Global Const $se_group_owner = 8
- Global Const $se_group_use_for_deny_only = 16
- Global Const $se_group_integrity = 32
- Global Const $se_group_integrity_enabled = 64
- Global Const $se_group_resource = 536870912
- Global Const $se_group_logon_id = -1073741824
- Global Enum $tokenprimary = 1, $tokenimpersonation
- Global Enum $securityanonymous = 0, $securityidentification, $securityimpersonation, $securitydelegation
- Global Enum $tokenuser = 1, $tokengroups, $tokenprivileges, $tokenowner, $tokenprimarygroup, $tokendefaultdacl, $tokensource, $tokentype, $tokenimpersonationlevel, $tokenstatistics, $tokenrestrictedsids, $tokensessionid, $tokengroupsandprivileges, $tokensessionreference, $tokensandboxinert, $tokenauditpolicy, $tokenorigin, $tokenelevationtype, $tokenlinkedtoken, $tokenelevation, $tokenhasrestrictions, $tokenaccessinformation, $tokenvirtualizationallowed, $tokenvirtualizationenabled, $tokenintegritylevel, $tokenuiaccess, $tokenmandatorypolicy, $tokenlogonsid
- Global Const $token_assign_primary = 1
- Global Const $token_duplicate = 2
- Global Const $token_impersonate = 4
- Global Const $token_query = 8
- Global Const $token_query_source = 16
- Global Const $token_adjust_privileges = 32
- Global Const $token_adjust_groups = 64
- Global Const $token_adjust_default = 128
- Global Const $token_adjust_sessionid = 256
- Global Const $token_all_access = 983551
- Global Const $token_read = 131080
- Global Const $token_write = 131296
- Global Const $token_execute = 131072
- Global Const $token_has_traverse_privilege = 1
- Global Const $token_has_backup_privilege = 2
- Global Const $token_has_restore_privilege = 4
- Global Const $token_has_admin_group = 8
- Global Const $token_is_restricted = 16
- Global Const $token_session_not_referenced = 32
- Global Const $token_sandbox_inert = 64
- Global Const $token_has_impersonate_privilege = 128
- Global Const $rights_delete = 65536
- Global Const $read_control = 131072
- Global Const $write_dac = 262144
- Global Const $write_owner = 524288
- Global Const $synchronize = 1048576
- Global Const $access_system_security = 16777216
- Global Const $standard_rights_required = 983040
- Global Const $standard_rights_read = $read_control
- Global Const $standard_rights_write = $read_control
- Global Const $standard_rights_execute = $read_control
- Global Const $standard_rights_all = 2031616
- Global Const $specific_rights_all = 65535
- Global Enum $not_used_access = 0, $grant_access, $set_access, $deny_access, $revoke_access, $set_audit_success, $set_audit_failure
- Global Enum $trustee_is_unknown = 0, $trustee_is_user, $trustee_is_group, $trustee_is_domain, $trustee_is_alias, $trustee_is_well_known_group, $trustee_is_deleted, $trustee_is_invalid, $trustee_is_computer
- Global Const $logon_with_profile = 1
- Global Const $logon_netcredentials_only = 2
- Global Enum $sidtypeuser = 1, $sidtypegroup, $sidtypedomain, $sidtypealias, $sidtypewellknowngroup, $sidtypedeletedaccount, $sidtypeinvalid, $sidtypeunknown, $sidtypecomputer, $sidtypelabel
- Global Const $sid_administrators = "S-1-5-32-544"
- Global Const $sid_users = "S-1-5-32-545"
- Global Const $sid_guests = "S-1-5-32-546"
- Global Const $sid_account_operators = "S-1-5-32-548"
- Global Const $sid_server_operators = "S-1-5-32-549"
- Global Const $sid_print_operators = "S-1-5-32-550"
- Global Const $sid_backup_operators = "S-1-5-32-551"
- Global Const $sid_replicator = "S-1-5-32-552"
- Global Const $sid_owner = "S-1-3-0"
- Global Const $sid_everyone = "S-1-1-0"
- Global Const $sid_network = "S-1-5-2"
- Global Const $sid_interactive = "S-1-5-4"
- Global Const $sid_system = "S-1-5-18"
- Global Const $sid_authenticated_users = "S-1-5-11"
- Global Const $sid_schannel_authentication = "S-1-5-64-14"
- Global Const $sid_digest_authentication = "S-1-5-64-21"
- Global Const $sid_nt_service = "S-1-5-80"
- Global Const $sid_untrusted_mandatory_level = "S-1-16-0"
- Global Const $sid_low_mandatory_level = "S-1-16-4096"
- Global Const $sid_medium_mandatory_level = "S-1-16-8192"
- Global Const $sid_medium_plus_mandatory_level = "S-1-16-8448"
- Global Const $sid_high_mandatory_level = "S-1-16-12288"
- Global Const $sid_system_mandatory_level = "S-1-16-16384"
- Global Const $sid_protected_process_mandatory_level = "S-1-16-20480"
- Global Const $sid_secure_process_mandatory_level = "S-1-16-28672"
- Global Const $sid_all_services = "S-1-5-80-0"
- Func _security__adjusttokenprivileges($htoken, $fdisableall, $pnewstate, $ibufferlen, $pprevstate = 0, $prequired = 0)
- Local $acall = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $fdisableall, "struct*", $pnewstate, "dword", $ibufferlen, "struct*", $pprevstate, "struct*", $prequired)
- If @error Then Return SetError(@error, @extended, False)
- Return NOT ($acall[0] = 0)
- EndFunc
- Func _security__createprocesswithtoken($htoken, $ilogonflags, $scommandline, $icreationflags, $scurdir, $tstartupinfo, $tprocess_information)
- Local $acall = DllCall("advapi32.dll", "bool", "CreateProcessWithTokenW", "handle", $htoken, "dword", $ilogonflags, "ptr", 0, "wstr", $scommandline, "dword", $icreationflags, "struct*", 0, "wstr", $scurdir, "struct*", $tstartupinfo, "struct*", $tprocess_information)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
- Return True
- EndFunc
- Func _security__duplicatetokenex($hexistingtoken, $idesiredaccess, $iimpersonationlevel, $itokentype)
- Local $acall = DllCall("advapi32.dll", "bool", "DuplicateTokenEx", "handle", $hexistingtoken, "dword", $idesiredaccess, "struct*", 0, "int", $iimpersonationlevel, "int", $itokentype, "handle*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Return $acall[6]
- EndFunc
- Func _security__getaccountsid($saccount, $ssystem = "")
- Local $aacct = _security__lookupaccountname($saccount, $ssystem)
- If @error Then Return SetError(@error, @extended, 0)
- If IsArray($aacct) Then Return _security__stringsidtosid($aacct[0])
- Return ""
- EndFunc
- Func _security__getlengthsid($psid)
- If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
- Local $acall = DllCall("advapi32.dll", "dword", "GetLengthSid", "struct*", $psid)
- If @error Then Return SetError(@error, @extended, 0)
- Return $acall[0]
- EndFunc
- Func _security__gettokeninformation($htoken, $iclass)
- Local $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", 0, "dword", 0, "dword*", 0)
- If @error OR NOT $acall[5] Then Return SetError(@error + 10, @extended, 0)
- Local $ilen = $acall[5]
- Local $tbuffer = DllStructCreate("byte[" & $ilen & "]")
- $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", $tbuffer, "dword", DllStructGetSize($tbuffer), "dword*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Return $tbuffer
- EndFunc
- Func _security__impersonateself($ilevel = $securityimpersonation)
- Local $acall = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
- If @error Then Return SetError(@error, @extended, False)
- Return NOT ($acall[0] = 0)
- EndFunc
- Func _security__isvalidsid($psid)
- Local $acall = DllCall("advapi32.dll", "bool", "IsValidSid", "struct*", $psid)
- If @error Then Return SetError(@error, @extended, False)
- Return NOT ($acall[0] = 0)
- EndFunc
- Func _security__lookupaccountname($saccount, $ssystem = "")
- Local $tdata = DllStructCreate("byte SID[256]")
- Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "struct*", $tdata, "dword*", DllStructGetSize($tdata), "wstr", "", "dword*", DllStructGetSize($tdata), "int*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Local $aacct[3]
- $aacct[0] = _security__sidtostringsid(DllStructGetPtr($tdata, "SID"))
- $aacct[1] = $acall[5]
- $aacct[2] = $acall[7]
- Return $aacct
- EndFunc
- Func _security__lookupaccountsid($vsid, $ssystem = "")
- Local $psid, $aacct[3]
- If IsString($vsid) Then
- $psid = _security__stringsidtosid($vsid)
- Else
- $psid = $vsid
- EndIf
- If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
- Local $typesystem = "ptr"
- If $ssystem Then $typesystem = "wstr"
- Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountSidW", $typesystem, $ssystem, "struct*", $psid, "wstr", "", "dword*", 65536, "wstr", "", "dword*", 65536, "int*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Local $aacct[3]
- $aacct[0] = $acall[3]
- $aacct[1] = $acall[5]
- $aacct[2] = $acall[7]
- Return $aacct
- EndFunc
- Func _security__lookupprivilegevalue($ssystem, $sname)
- Local $acall = DllCall("advapi32.dll", "bool", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Return $acall[3]
- EndFunc
- Func _security__openprocesstoken($hprocess, $iaccess)
- Local $acall = DllCall("advapi32.dll", "bool", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "handle*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Return $acall[3]
- EndFunc
- Func _security__openthreadtoken($iaccess, $hthread = 0, $fopenasself = False)
- If $hthread = 0 Then
- Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
- If @error Then Return SetError(@error + 10, @extended, 0)
- $hthread = $aresult[0]
- EndIf
- Local $acall = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread, "dword", $iaccess, "bool", $fopenasself, "handle*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Return $acall[4]
- EndFunc
- Func _security__openthreadtokenex($iaccess, $hthread = 0, $fopenasself = False)
- Local $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
- If $htoken = 0 Then
- Local Const $error_no_token = 1008
- If _winapi_getlasterror() <> $error_no_token Then Return SetError(20, _winapi_getlasterror(), 0)
- If NOT _security__impersonateself() Then Return SetError(@error + 10, _winapi_getlasterror(), 0)
- $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
- If $htoken = 0 Then Return SetError(@error, _winapi_getlasterror(), 0)
- EndIf
- Return $htoken
- EndFunc
- Func _security__setprivilege($htoken, $sprivilege, $fenable)
- Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
- If $iluid = 0 Then Return SetError(@error + 10, @extended, False)
- Local Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
- Local $tcurrstate = DllStructCreate($tagtoken_privileges)
- Local $icurrstate = DllStructGetSize($tcurrstate)
- Local $tprevstate = DllStructCreate($tagtoken_privileges)
- Local $iprevstate = DllStructGetSize($tprevstate)
- Local $trequired = DllStructCreate("int Data")
- DllStructSetData($tcurrstate, "Count", 1)
- DllStructSetData($tcurrstate, "LUID", $iluid)
- If NOT _security__adjusttokenprivileges($htoken, False, $tcurrstate, $icurrstate, $tprevstate, $trequired) Then Return SetError(2, @error, False)
- DllStructSetData($tprevstate, "Count", 1)
- DllStructSetData($tprevstate, "LUID", $iluid)
- Local $iattributes = DllStructGetData($tprevstate, "Attributes")
- If $fenable Then
- $iattributes = BitOR($iattributes, $se_privilege_enabled)
- Else
- $iattributes = BitAND($iattributes, BitNOT($se_privilege_enabled))
- EndIf
- DllStructSetData($tprevstate, "Attributes", $iattributes)
- If NOT _security__adjusttokenprivileges($htoken, False, $tprevstate, $iprevstate, $tcurrstate, $trequired) Then Return SetError(3, @error, False)
- Return True
- EndFunc
- Func _security__settokeninformation($htoken, $itokeninformation, $vtokeninformation, $itokeninformationlength)
- Local $acall = DllCall("advapi32.dll", "bool", "SetTokenInformation", "handle", $htoken, "int", $itokeninformation, "struct*", $vtokeninformation, "dword", $itokeninformationlength)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
- Return True
- EndFunc
- Func _security__sidtostringsid($psid)
- If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, 0, "")
- Local $acall = DllCall("advapi32.dll", "bool", "ConvertSidToStringSidW", "struct*", $psid, "ptr*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, "")
- Local $pstringsid = $acall[2]
- Local $alen = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $pstringsid)
- Local $ssid = DllStructGetData(DllStructCreate("wchar Text[" & $alen[0] + 1 & "]", $pstringsid), "Text")
- DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pstringsid)
- Return $ssid
- EndFunc
- Func _security__sidtypestr($itype)
- Switch $itype
- Case $sidtypeuser
- Return "User"
- Case $sidtypegroup
- Return "Group"
- Case $sidtypedomain
- Return "Domain"
- Case $sidtypealias
- Return "Alias"
- Case $sidtypewellknowngroup
- Return "Well Known Group"
- Case $sidtypedeletedaccount
- Return "Deleted Account"
- Case $sidtypeinvalid
- Return "Invalid"
- Case $sidtypeunknown
- Return "Unknown Type"
- Case $sidtypecomputer
- Return "Computer"
- Case $sidtypelabel
- Return "A mandatory integrity label SID"
- Case Else
- Return "Unknown SID Type"
- EndSwitch
- EndFunc
- Func _security__stringsidtosid($ssid)
- Local $acall = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0)
- If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
- Local $psid = $acall[2]
- Local $tbuffer = DllStructCreate("byte Data[" & _security__getlengthsid($psid) & "]", $psid)
- Local $tsid = DllStructCreate("byte Data[" & DllStructGetSize($tbuffer) & "]")
- DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
- DllCall("kernel32.dll", "handle", "LocalFree", "handle", $psid)
- Return $tsid
- EndFunc
- Global Const $tagmemmap = "handle hProc;ulong_ptr Size;ptr Mem"
- Func _memfree(ByRef $tmemmap)
- Local $pmemory = DllStructGetData($tmemmap, "Mem")
- Local $hprocess = DllStructGetData($tmemmap, "hProc")
- Local $bresult = _memvirtualfreeex($hprocess, $pmemory, 0, $mem_release)
- DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hprocess)
- If @error Then Return SetError(@error, @extended, False)
- Return $bresult
- EndFunc
- Func _memglobalalloc($ibytes, $iflags = 0)
- Local $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $iflags, "ulong_ptr", $ibytes)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _memglobalfree($hmem)
- Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hmem)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _memgloballock($hmem)
- Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hmem)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _memglobalsize($hmem)
- Local $aresult = DllCall("kernel32.dll", "ulong_ptr", "GlobalSize", "handle", $hmem)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _memglobalunlock($hmem)
- Local $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hmem)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _meminit($hwnd, $isize, ByRef $tmemmap)
- Local $aresult = DllCall("User32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
- If @error Then Return SetError(@error + 10, @extended, 0)
- Local $iprocessid = $aresult[2]
- If $iprocessid = 0 Then Return SetError(1, 0, 0)
- Local $iaccess = BitOR($process_vm_operation, $process_vm_read, $process_vm_write)
- Local $hprocess = __mem_openprocess($iaccess, False, $iprocessid, True)
- Local $ialloc = BitOR($mem_reserve, $mem_commit)
- Local $pmemory = _memvirtualallocex($hprocess, 0, $isize, $ialloc, $page_readwrite)
- If $pmemory = 0 Then Return SetError(2, 0, 0)
- $tmemmap = DllStructCreate($tagmemmap)
- DllStructSetData($tmemmap, "hProc", $hprocess)
- DllStructSetData($tmemmap, "Size", $isize)
- DllStructSetData($tmemmap, "Mem", $pmemory)
- Return $pmemory
- EndFunc
- Func _memmovememory($psource, $pdest, $ilength)
- DllCall("kernel32.dll", "none", "RtlMoveMemory", "struct*", $pdest, "struct*", $psource, "ulong_ptr", $ilength)
- If @error Then Return SetError(@error, @extended)
- EndFunc
- Func _memread(ByRef $tmemmap, $psrce, $pdest, $isize)
- Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $psrce, "struct*", $pdest, "ulong_ptr", $isize, "ulong_ptr*", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _memwrite(ByRef $tmemmap, $psrce, $pdest = 0, $isize = 0, $ssrce = "struct*")
- If $pdest = 0 Then $pdest = DllStructGetData($tmemmap, "Mem")
- If $isize = 0 Then $isize = DllStructGetData($tmemmap, "Size")
- Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $pdest, $ssrce, $psrce, "ulong_ptr", $isize, "ulong_ptr*", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _memvirtualalloc($paddress, $isize, $iallocation, $iprotect)
- Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _memvirtualallocex($hprocess, $paddress, $isize, $iallocation, $iprotect)
- Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _memvirtualfree($paddress, $isize, $ifreetype)
- Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _memvirtualfreeex($hprocess, $paddress, $isize, $ifreetype)
- Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func __mem_openprocess($iaccess, $finherit, $iprocessid, $fdebugpriv = False)
- Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
- If @error Then Return SetError(@error + 10, @extended, 0)
- If $aresult[0] Then Return $aresult[0]
- If NOT $fdebugpriv Then Return 0
- Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
- If @error Then Return SetError(@error + 20, @extended, 0)
- _security__setprivilege($htoken, "SeDebugPrivilege", True)
- Local $ierror = @error
- Local $ilasterror = @extended
- Local $iret = 0
- If NOT @error Then
- $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
- $ierror = @error
- $ilasterror = @extended
- If $aresult[0] Then $iret = $aresult[0]
- _security__setprivilege($htoken, "SeDebugPrivilege", False)
- If @error Then
- $ierror = @error + 30
- $ilasterror = @extended
- EndIf
- Else
- $ierror = @error + 40
- EndIf
- DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $htoken)
- Return SetError($ierror, $ilasterror, $iret)
- EndFunc
- Global Const $hgdi_error = Ptr(-1)
- Global Const $invalid_handle_value = Ptr(-1)
- Global Const $clr_invalid = -1
- Global Const $null_brush = 5
- Global Const $null_pen = 8
- Global Const $black_brush = 4
- Global Const $dkgray_brush = 3
- Global Const $dc_brush = 18
- Global Const $gray_brush = 2
- Global Const $hollow_brush = $null_brush
- Global Const $ltgray_brush = 1
- Global Const $white_brush = 0
- Global Const $black_pen = 7
- Global Const $dc_pen = 19
- Global Const $white_pen = 6
- Global Const $ansi_fixed_font = 11
- Global Const $ansi_var_font = 12
- Global Const $device_default_font = 14
- Global Const $default_gui_font = 17
- Global Const $oem_fixed_font = 10
- Global Const $system_font = 13
- Global Const $system_fixed_font = 16
- Global Const $default_palette = 15
- Global Const $mb_precomposed = 1
- Global Const $mb_composite = 2
- Global Const $mb_useglyphchars = 4
- Global Const $ulw_alpha = 2
- Global Const $ulw_colorkey = 1
- Global Const $ulw_opaque = 4
- Global Const $ulw_ex_noresize = 8
- Global Const $wh_callwndproc = 4
- Global Const $wh_callwndprocret = 12
- Global Const $wh_cbt = 5
- Global Const $wh_debug = 9
- Global Const $wh_foregroundidle = 11
- Global Const $wh_getmessage = 3
- Global Const $wh_journalplayback = 1
- Global Const $wh_journalrecord = 0
- Global Const $wh_keyboard = 2
- Global Const $wh_keyboard_ll = 13
- Global Const $wh_mouse = 7
- Global Const $wh_mouse_ll = 14
- Global Const $wh_msgfilter = -1
- Global Const $wh_shell = 10
- Global Const $wh_sysmsgfilter = 6
- Global Const $wpf_asyncwindowplacement = 4
- Global Const $wpf_restoretomaximized = 2
- Global Const $wpf_setminposition = 1
- Global Const $kf_extended = 256
- Global Const $kf_altdown = 8192
- Global Const $kf_up = 32768
- Global Const $llkhf_extended = BitShift($kf_extended, 8)
- Global Const $llkhf_injected = 16
- Global Const $llkhf_altdown = BitShift($kf_altdown, 8)
- Global Const $llkhf_up = BitShift($kf_up, 8)
- Global Const $ofn_allowmultiselect = 512
- Global Const $ofn_createprompt = 8192
- Global Const $ofn_dontaddtorecent = 33554432
- Global Const $ofn_enablehook = 32
- Global Const $ofn_enableincludenotify = 4194304
- Global Const $ofn_enablesizing = 8388608
- Global Const $ofn_enabletemplate = 64
- Global Const $ofn_enabletemplatehandle = 128
- Global Const $ofn_explorer = 524288
- Global Const $ofn_extensiondifferent = 1024
- Global Const $ofn_filemustexist = 4096
- Global Const $ofn_forceshowhidden = 268435456
- Global Const $ofn_hidereadonly = 4
- Global Const $ofn_longnames = 2097152
- Global Const $ofn_nochangedir = 8
- Global Const $ofn_nodereferencelinks = 1048576
- Global Const $ofn_nolongnames = 262144
- Global Const $ofn_nonetworkbutton = 131072
- Global Const $ofn_noreadonlyreturn = 32768
- Global Const $ofn_notestfilecreate = 65536
- Global Const $ofn_novalidate = 256
- Global Const $ofn_overwriteprompt = 2
- Global Const $ofn_pathmustexist = 2048
- Global Const $ofn_readonly = 1
- Global Const $ofn_shareaware = 16384
- Global Const $ofn_showhelp = 16
- Global Const $ofn_ex_noplacesbar = 1
- Global Const $tmpf_fixed_pitch = 1
- Global Const $tmpf_vector = 2
- Global Const $tmpf_truetype = 4
- Global Const $tmpf_device = 8
- Global Const $duplicate_close_source = 1
- Global Const $duplicate_same_access = 2
- Global Const $di_mask = 1
- Global Const $di_image = 2
- Global Const $di_normal = 3
- Global Const $di_compat = 4
- Global Const $di_defaultsize = 8
- Global Const $di_nomirror = 16
- Global Const $display_device_attached_to_desktop = 1
- Global Const $display_device_multi_driver = 2
- Global Const $display_device_primary_device = 4
- Global Const $display_device_mirroring_driver = 8
- Global Const $display_device_vga_compatible = 16
- Global Const $display_device_removable = 32
- Global Const $display_device_disconnect = 33554432
- Global Const $display_device_remote = 67108864
- Global Const $display_device_modespruned = 134217728
- Global Const $flashw_caption = 1
- Global Const $flashw_tray = 2
- Global Const $flashw_timer = 4
- Global Const $flashw_timernofg = 12
- Global Const $format_message_allocate_buffer = 256
- Global Const $format_message_ignore_inserts = 512
- Global Const $format_message_from_string = 1024
- Global Const $format_message_from_hmodule = 2048
- Global Const $format_message_from_system = 4096
- Global Const $format_message_argument_array = 8192
- Global Const $gw_hwndfirst = 0
- Global Const $gw_hwndlast = 1
- Global Const $gw_hwndnext = 2
- Global Const $gw_hwndprev = 3
- Global Const $gw_owner = 4
- Global Const $gw_child = 5
- Global Const $gwl_wndproc = -4
- Global Const $gwl_hinstance = -6
- Global Const $gwl_hwndparent = -8
- Global Const $gwl_id = -12
- Global Const $gwl_style = -16
- Global Const $gwl_exstyle = -20
- Global Const $gwl_userdata = -21
- Global Const $std_cut = 0
- Global Const $std_copy = 1
- Global Const $std_paste = 2
- Global Const $std_undo = 3
- Global Const $std_redow = 4
- Global Const $std_delete = 5
- Global Const $std_filenew = 6
- Global Const $std_fileopen = 7
- Global Const $std_filesave = 8
- Global Const $std_printpre = 9
- Global Const $std_properties = 10
- Global Const $std_help = 11
- Global Const $std_find = 12
- Global Const $std_replace = 13
- Global Const $std_print = 14
- Global Const $image_bitmap = 0
- Global Const $image_icon = 1
- Global Const $image_cursor = 2
- Global Const $image_enhmetafile = 3
- Global Const $kb_sendspecial = 0
- Global Const $kb_sendraw = 1
- Global Const $kb_capsoff = 0
- Global Const $kb_capson = 1
- Global Const $dont_resolve_dll_references = 1
- Global Const $load_library_as_datafile = 2
- Global Const $load_with_altered_search_path = 8
- Global Const $load_ignore_code_authz_level = 16
- Global Const $load_library_as_datafile_exclusive = 64
- Global Const $load_library_as_image_resource = 32
- Global Const $load_library_search_application_dir = 512
- Global Const $load_library_search_default_dirs = 4096
- Global Const $load_library_search_dll_load_dir = 256
- Global Const $load_library_search_system32 = 2048
- Global Const $load_library_search_user_dirs = 1024
- Global Const $s_ok = 0
- Global Const $e_abort = -2147467260
- Global Const $e_accessdenied = -2147024891
- Global Const $e_fail = -2147467259
- Global Const $e_handle = -2147024890
- Global Const $e_invalidarg = -2147024809
- Global Const $e_nointerface = -2147467262
- Global Const $e_notimpl = -2147467263
- Global Const $e_outofmemory = -2147024882
- Global Const $e_pointer = -2147467261
- Global Const $e_unexpected = -2147418113
- Global Const $lr_defaultcolor = 0
- Global Const $lr_monochrome = 1
- Global Const $lr_color = 2
- Global Const $lr_copyreturnorg = 4
- Global Const $lr_copydeleteorg = 8
- Global Const $lr_loadfromfile = 16
- Global Const $lr_loadtransparent = 32
- Global Const $lr_defaultsize = 64
- Global Const $lr_vgacolor = 128
- Global Const $lr_loadmap3dcolors = 4096
- Global Const $lr_createdibsection = 8192
- Global Const $lr_copyfromresource = 16384
- Global Const $lr_shared = 32768
- Global Const $obm_trtype = 32732
- Global Const $obm_lfarrowi = 32734
- Global Const $obm_rgarrowi = 32735
- Global Const $obm_dnarrowi = 32736
- Global Const $obm_uparrowi = 32737
- Global Const $obm_combo = 32738
- Global Const $obm_mnarrow = 32739
- Global Const $obm_lfarrowd = 32740
- Global Const $obm_rgarrowd = 32741
- Global Const $obm_dnarrowd = 32742
- Global Const $obm_uparrowd = 32743
- Global Const $obm_restored = 32744
- Global Const $obm_zoomd = 32745
- Global Const $obm_reduced = 32746
- Global Const $obm_restore = 32747
- Global Const $obm_zoom = 32748
- Global Const $obm_reduce = 32749
- Global Const $obm_lfarrow = 32750
- Global Const $obm_rgarrow = 32751
- Global Const $obm_dnarrow = 32752
- Global Const $obm_uparrow = 32753
- Global Const $obm_close = 32754
- Global Const $obm_old_restore = 32755
- Global Const $obm_old_zoom = 32756
- Global Const $obm_old_reduce = 32757
- Global Const $obm_btncorners = 32758
- Global Const $obm_checkboxes = 32759
- Global Const $obm_check = 32760
- Global Const $obm_btsize = 32761
- Global Const $obm_old_lfarrow = 32762
- Global Const $obm_old_rgarrow = 32763
- Global Const $obm_old_dnarrow = 32764
- Global Const $obm_old_uparrow = 32765
- Global Const $obm_size = 32766
- Global Const $obm_old_close = 32767
- Global Const $oic_sample = 32512
- Global Const $oic_hand = 32513
- Global Const $oic_ques = 32514
- Global Const $oic_bang = 32515
- Global Const $oic_note = 32516
- Global Const $oic_winlogo = 32517
- Global Const $oic_warning = $oic_bang
- Global Const $oic_error = $oic_hand
- Global Const $oic_information = $oic_note
- Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
- Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
- If @error Then Return SetError(@error, @extended, "")
- If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
- Return $aresult
- EndFunc
- Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
- Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
- If @error Then Return SetError(@error, @extended, "")
- If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
- Return $aresult
- EndFunc
- Global $__gainprocess_winapi[64][2] = [[0, 0]]
- Global $__gawinlist_winapi[64][2] = [[0, 0]]
- Global Const $__winapiconstant_wm_setfont = 48
- Global Const $__winapiconstant_fw_normal = 400
- Global Const $__winapiconstant_default_charset = 1
- Global Const $__winapiconstant_out_default_precis = 0
- Global Const $__winapiconstant_clip_default_precis = 0
- Global Const $__winapiconstant_default_quality = 0
- Global Const $__winapiconstant_logpixelsx = 88
- Global Const $__winapiconstant_logpixelsy = 90
- Global Const $tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & $tagpoint
- Global Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
- Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
- Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
- Global Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
- Func _winapi_attachconsole($iprocessid = -1)
- Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $iprocessid)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_attachthreadinput($iattach, $iattachto, $fattach)
- Local $aresult = DllCall("user32.dll", "bool", "AttachThreadInput", "dword", $iattach, "dword", $iattachto, "bool", $fattach)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_beep($ifreq = 500, $iduration = 1000)
- Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop)
- 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)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_callnexthookex($hhk, $icode, $wparam, $lparam)
- Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhk, "int", $icode, "wparam", $wparam, "lparam", $lparam)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_callwindowproc($lpprevwndfunc, $hwnd, $msg, $wparam, $lparam)
- Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $lpprevwndfunc, "hwnd", $hwnd, "uint", $msg, "wparam", $wparam, "lparam", $lparam)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
- Local $aret = DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "struct*", $tpoint)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $tpoint
- EndFunc
- Func _winapi_closehandle($hobject)
- Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode)
- Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_commdlgextendederror()
- Local Const $cderr_dialogfailure = 65535
- Local Const $cderr_findresfailure = 6
- Local Const $cderr_initialization = 2
- Local Const $cderr_loadresfailure = 7
- Local Const $cderr_loadstrfailure = 5
- Local Const $cderr_lockresfailure = 8
- Local Const $cderr_memallocfailure = 9
- Local Const $cderr_memlockfailure = 10
- Local Const $cderr_nohinstance = 4
- Local Const $cderr_nohook = 11
- Local Const $cderr_notemplate = 3
- Local Const $cderr_registermsgfail = 12
- Local Const $cderr_structsize = 1
- Local Const $fnerr_buffertoosmall = 12291
- Local Const $fnerr_invalidfilename = 12290
- Local Const $fnerr_subclassfailure = 12289
- Local $aresult = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError")
- If NOT @error Then
- Switch $aresult[0]
- Case $cderr_dialogfailure
- Return SetError($aresult[0], 0, "The dialog box could not be created." & @LF & "The common dialog box function's call to the DialogBox function failed." & @LF & "For example, this error occurs if the common dialog box call specifies an invalid window handle.")
- Case $cderr_findresfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to find a specified resource.")
- Case $cderr_initialization
- Return SetError($aresult[0], 0, "The common dialog box function failed during initialization." & @LF & "This error often occurs when sufficient memory is not available.")
- Case $cderr_loadresfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified resource.")
- Case $cderr_loadstrfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified string.")
- Case $cderr_lockresfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to lock a specified resource.")
- Case $cderr_memallocfailure
- Return SetError($aresult[0], 0, "The common dialog box function was unable to allocate memory for internal structures.")
- Case $cderr_memlockfailure
- Return SetError($aresult[0], 0, "The common dialog box function was unable to lock the memory associated with a handle.")
- Case $cderr_nohinstance
- Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding instance handle.")
- Case $cderr_nohook
- Return SetError($aresult[0], 0, "The ENABLEHOOK flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a pointer to a corresponding hook procedure.")
- Case $cderr_notemplate
- Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding template.")
- Case $cderr_registermsgfail
- Return SetError($aresult[0], 0, "The RegisterWindowMessage function returned an error code when it was called by the common dialog box function.")
- Case $cderr_structsize
- Return SetError($aresult[0], 0, "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid")
- Case $fnerr_buffertoosmall
- Return SetError($aresult[0], 0, "The buffer pointed to by the lpstrFile member of the OPENFILENAME structure is too small for the file name specified by the user." & @LF & "The first two bytes of the lpstrFile buffer contain an integer value specifying the size, in TCHARs, required to receive the full name.")
- Case $fnerr_invalidfilename
- Return SetError($aresult[0], 0, "A file name is invalid.")
- Case $fnerr_subclassfailure
- Return SetError($aresult[0], 0, "An attempt to subclass a list box failed because sufficient memory was not available.")
- EndSwitch
- EndIf
- Return SetError(@error, @extended, "0x" & Hex($aresult[0]))
- EndFunc
- Func _winapi_copyicon($hicon)
- Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "ptr", $pbits)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createcompatibledc($hdc)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createevent($pattributes = 0, $fmanualreset = True, $finitialstate = True, $sname = "")
- Local $snametype = "wstr"
- If $sname = "" Then
- $sname = 0
- $snametype = "ptr"
- EndIf
- Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "ptr", $pattributes, "bool", $fmanualreset, "bool", $finitialstate, $snametype, $sname)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $psecurity = 0)
- Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0
- If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute)
- If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read)
- If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write)
- If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $file_share_delete)
- If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read)
- If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write)
- Switch $icreation
- Case 0
- $icd = $create_new
- Case 1
- $icd = $create_always
- Case 2
- $icd = $open_existing
- Case 3
- $icd = $open_always
- Case 4
- $icd = $truncate_existing
- EndSwitch
- If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_attribute_archive)
- If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_attribute_hidden)
- If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attribute_readonly)
- If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_attribute_system)
- Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "ptr", $psecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
- If @error OR ($aresult[0] = $invalid_handle_value) Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createfont($nheight, $nwidth, $nescape = 0, $norientn = 0, $fnweight = $__winapiconstant_fw_normal, $bitalic = False, $bunderline = False, $bstrikeout = False, $ncharset = $__winapiconstant_default_charset, $noutputprec = $__winapiconstant_out_default_precis, $nclipprec = $__winapiconstant_clip_default_precis, $nquality = $__winapiconstant_default_quality, $npitch = 0, $szface = "Arial")
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $nheight, "int", $nwidth, "int", $nescape, "int", $norientn, "int", $fnweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $ncharset, "dword", $noutputprec, "dword", $nclipprec, "dword", $nquality, "dword", $npitch, "wstr", $szface)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createfontindirect($tlogfont)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "struct*", $tlogfont)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createpen($ipenstyle, $iwidth, $ncolor)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "INT", $ncolor)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createprocess($sappname, $scommand, $psecurity, $pthread, $finherit, $iflags, $penviron, $sdir, $pstartupinfo, $pprocess)
- Local $tcommand = 0
- Local $sappnametype = "wstr", $sdirtype = "wstr"
- If $sappname = "" Then
- $sappnametype = "ptr"
- $sappname = 0
- EndIf
- If $scommand <> "" Then
- $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]")
- DllStructSetData($tcommand, "Text", $scommand)
- EndIf
- If $sdir = "" Then
- $sdirtype = "ptr"
- $sdir = 0
- EndIf
- Local $aresult = DllCall("kernel32.dll", "bool", "CreateProcessW", $sappnametype, $sappname, "struct*", $tcommand, "ptr", $psecurity, "ptr", $pthread, "bool", $finherit, "dword", $iflags, "ptr", $penviron, $sdirtype, $sdir, "ptr", $pstartupinfo, "ptr", $pprocess)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1)
- Local $hdc = _winapi_getdc($hwnd)
- Local $hdestdc = _winapi_createcompatibledc($hdc)
- Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
- Local $hold = _winapi_selectobject($hdestdc, $hbitmap)
- Local $trect = DllStructCreate($tagrect)
- DllStructSetData($trect, 1, 0)
- DllStructSetData($trect, 2, 0)
- DllStructSetData($trect, 3, $iwidth)
- DllStructSetData($trect, 4, $iheight)
- If $brgb Then
- $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
- EndIf
- Local $hbrush = _winapi_createsolidbrush($icolor)
- If NOT _winapi_fillrect($hdestdc, $trect, $hbrush) Then
- _winapi_deleteobject($hbitmap)
- $hbitmap = 0
- EndIf
- _winapi_deleteobject($hbrush)
- _winapi_releasedc($hwnd, $hdc)
- _winapi_selectobject($hdestdc, $hold)
- _winapi_deletedc($hdestdc)
- If NOT $hbitmap Then Return SetError(1, 0, 0)
- Return $hbitmap
- EndFunc
- Func _winapi_createsolidbrush($ncolor)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "INT", $ncolor)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0)
- If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("")
- 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)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_defwindowproc($hwnd, $imsg, $iwparam, $ilparam)
- Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_deletedc($hdc)
- Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_deleteobject($hobject)
- Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_destroyicon($hicon)
- Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_destroywindow($hwnd)
- Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_drawedge($hdc, $ptrrect, $nedgetype, $grfflags)
- Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "ptr", $ptrrect, "uint", $nedgetype, "uint", $grfflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_drawframecontrol($hdc, $ptrrect, $ntype, $nstate)
- Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "ptr", $ptrrect, "uint", $ntype, "uint", $nstate)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_drawicon($hdc, $ix, $iy, $hicon)
- Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3)
- Local $ioptions
- Switch $iflags
- Case 1
- $ioptions = $di_mask
- Case 2
- $ioptions = $di_image
- Case 3
- $ioptions = $di_normal
- Case 4
- $ioptions = $di_compat
- Case 5
- $ioptions = $di_defaultsize
- Case Else
- $ioptions = $di_nomirror
- EndSwitch
- 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)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_drawline($hdc, $ix1, $iy1, $ix2, $iy2)
- _winapi_moveto($hdc, $ix1, $iy1)
- If @error Then Return SetError(@error, @extended, False)
- _winapi_lineto($hdc, $ix2, $iy2)
- If @error Then Return SetError(@error + 10, @extended, False)
- Return True
- EndFunc
- Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
- Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "struct*", $trect, "uint", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_duplicatehandle($hsourceprocesshandle, $hsourcehandle, $htargetprocesshandle, $idesiredaccess, $finherithandle, $ioptions)
- Local $aresult = DllCall("kernel32.dll", "bool", "DuplicateHandle", "handle", $hsourceprocesshandle, "handle", $hsourcehandle, "handle", $htargetprocesshandle, "handle*", 0, "dword", $idesiredaccess, "bool", $finherithandle, "dword", $ioptions)
- If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
- Return $aresult[4]
- EndFunc
- Func _winapi_enablewindow($hwnd, $fenable = True)
- Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $fenable)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_enumdisplaydevices($sdevice, $idevnum)
- Local $tname = 0, $iflags = 0, $adevice[5]
- If $sdevice <> "" Then
- $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
- DllStructSetData($tname, "Text", $sdevice)
- EndIf
- Local $tdevice = DllStructCreate($tagdisplay_device)
- Local $idevice = DllStructGetSize($tdevice)
- DllStructSetData($tdevice, "Size", $idevice)
- Local $aret = DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "struct*", $tname, "dword", $idevnum, "struct*", $tdevice, "dword", 1)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Local $in = DllStructGetData($tdevice, "Flags")
- If BitAND($in, $display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1)
- If BitAND($in, $display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2)
- If BitAND($in, $display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4)
- If BitAND($in, $display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8)
- If BitAND($in, $display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16)
- If BitAND($in, $display_device_modespruned) <> 0 Then $iflags = BitOR($iflags, 32)
- $adevice[0] = True
- $adevice[1] = DllStructGetData($tdevice, "Name")
- $adevice[2] = DllStructGetData($tdevice, "String")
- $adevice[3] = $iflags
- $adevice[4] = DllStructGetData($tdevice, "ID")
- Return $adevice
- EndFunc
- Func _winapi_enumwindows($fvisible = True, $hwnd = Default)
- __winapi_enumwindowsinit()
- If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
- __winapi_enumwindowschild($hwnd, $fvisible)
- Return $__gawinlist_winapi
- EndFunc
- Func __winapi_enumwindowsadd($hwnd, $sclass = "")
- If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
- $__gawinlist_winapi[0][0] += 1
- Local $icount = $__gawinlist_winapi[0][0]
- If $icount >= $__gawinlist_winapi[0][1] Then
- ReDim $__gawinlist_winapi[$icount + 64][2]
- $__gawinlist_winapi[0][1] += 64
- EndIf
- $__gawinlist_winapi[$icount][0] = $hwnd
- $__gawinlist_winapi[$icount][1] = $sclass
- EndFunc
- Func __winapi_enumwindowschild($hwnd, $fvisible = True)
- $hwnd = _winapi_getwindow($hwnd, $gw_child)
- While $hwnd <> 0
- If (NOT $fvisible) OR _winapi_iswindowvisible($hwnd) Then
- __winapi_enumwindowsadd($hwnd)
- __winapi_enumwindowschild($hwnd, $fvisible)
- EndIf
- $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
- WEnd
- EndFunc
- Func __winapi_enumwindowsinit()
- ReDim $__gawinlist_winapi[64][2]
- $__gawinlist_winapi[0][0] = 0
- $__gawinlist_winapi[0][1] = 64
- EndFunc
- Func _winapi_enumwindowspopup()
- __winapi_enumwindowsinit()
- Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
- Local $sclass
- While $hwnd <> 0
- If _winapi_iswindowvisible($hwnd) Then
- $sclass = _winapi_getclassname($hwnd)
- If $sclass = "#32768" Then
- __winapi_enumwindowsadd($hwnd)
- ElseIf $sclass = "ToolbarWindow32" Then
- __winapi_enumwindowsadd($hwnd)
- ElseIf $sclass = "ToolTips_Class32" Then
- __winapi_enumwindowsadd($hwnd)
- ElseIf $sclass = "BaseBar" Then
- __winapi_enumwindowschild($hwnd)
- EndIf
- EndIf
- $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
- WEnd
- Return $__gawinlist_winapi
- EndFunc
- Func _winapi_enumwindowstop()
- __winapi_enumwindowsinit()
- Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
- While $hwnd <> 0
- If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
- $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
- WEnd
- Return $__gawinlist_winapi
- EndFunc
- Func _winapi_expandenvironmentstrings($sstring)
- Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $sstring, "wstr", "", "dword", 4096)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
- Return $aresult[2]
- EndFunc
- Func _winapi_extracticonex($sfile, $iindex, $plarge, $psmall, $iicons)
- Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfile, "int", $iindex, "struct*", $plarge, "struct*", $psmall, "uint", $iicons)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_fatalappexit($smessage)
- DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage)
- If @error Then Return SetError(@error, @extended)
- EndFunc
- Func _winapi_fillrect($hdc, $ptrrect, $hbrush)
- Local $aresult
- If IsPtr($hbrush) Then
- $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $ptrrect, "handle", $hbrush)
- Else
- $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $ptrrect, "dword_ptr", $hbrush)
- EndIf
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_findexecutable($sfilename, $sdirectory = "")
- Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "")
- If @error Then Return SetError(@error, @extended, "")
- If $aresult[0] <= 32 Then Return SetError(10, $aresult[0], "")
- Return SetExtended($aresult[0], $aresult[3])
- EndFunc
- Func _winapi_findwindow($sclassname, $swindowname)
- Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_flashwindow($hwnd, $finvert = True)
- Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $finvert)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0)
- Local $tflash = DllStructCreate($tagflashwinfo)
- Local $iflash = DllStructGetSize($tflash)
- Local $imode = 0
- If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $flashw_caption)
- If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $flashw_tray)
- If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $flashw_timer)
- If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $flashw_timernofg)
- DllStructSetData($tflash, "Size", $iflash)
- DllStructSetData($tflash, "hWnd", $hwnd)
- DllStructSetData($tflash, "Flags", $imode)
- DllStructSetData($tflash, "Count", $icount)
- DllStructSetData($tflash, "Timeout", $itimeout)
- Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "struct*", $tflash)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_floattoint($nfloat)
- Local $tfloat = DllStructCreate("float")
- Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
- DllStructSetData($tfloat, 1, $nfloat)
- Return DllStructGetData($tint, 1)
- EndFunc
- Func _winapi_flushfilebuffers($hfile)
- Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
- Local $sbuffertype = "struct*"
- If IsString($pbuffer) Then $sbuffertype = "wstr"
- Local $aresult = DllCall("Kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "ptr", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
- If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
- Return $aresult[0]
- EndFunc
- Func _winapi_framerect($hdc, $ptrrect, $hbrush)
- Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "ptr", $ptrrect, "handle", $hbrush)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_freelibrary($hmodule)
- Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_getancestor($hwnd, $iflags = 1)
- Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getasynckeystate($ikey)
- Local $aresult = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", $ikey)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getbkmode($hdc)
- Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getclassname($hwnd)
- If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
- Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
- If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _winapi_getclientheight($hwnd)
- Local $trect = _winapi_getclientrect($hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
- EndFunc
- Func _winapi_getclientwidth($hwnd)
- Local $trect = _winapi_getclientrect($hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
- EndFunc
- Func _winapi_getclientrect($hwnd)
- Local $trect = DllStructCreate($tagrect)
- Local $aret = DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $trect
- EndFunc
- Func _winapi_getcurrentprocess()
- Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentProcess")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getcurrentprocessid()
- Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentProcessId")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getcurrentthread()
- Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getcurrentthreadid()
- Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentThreadId")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getcursorinfo()
- Local $tcursor = DllStructCreate($tagcursorinfo)
- Local $icursor = DllStructGetSize($tcursor)
- DllStructSetData($tcursor, "Size", $icursor)
- Local $aret = DllCall("user32.dll", "bool", "GetCursorInfo", "struct*", $tcursor)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Local $acursor[5]
- $acursor[0] = True
- $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0
- $acursor[2] = DllStructGetData($tcursor, "hCursor")
- $acursor[3] = DllStructGetData($tcursor, "X")
- $acursor[4] = DllStructGetData($tcursor, "Y")
- Return $acursor
- EndFunc
- Func _winapi_getdc($hwnd)
- Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getdesktopwindow()
- Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getdevicecaps($hdc, $iindex)
- Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbi, $iusage)
- Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbi, "uint", $iusage)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_getdlgctrlid($hwnd)
- Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getdlgitem($hwnd, $iitemid)
- Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getfilesizeex($hfile)
- Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0)
- If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, -1)
- Return $aresult[2]
- EndFunc
- Func _winapi_getfocus()
- Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getforegroundwindow()
- Local $aresult = DllCall("user32.dll", "hwnd", "GetForegroundWindow")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getguiresources($iflag = 0, $hprocess = -1)
- If $hprocess = -1 Then $hprocess = _winapi_getcurrentprocess()
- Local $aresult = DllCall("user32.dll", "dword", "GetGuiResources", "handle", $hprocess, "dword", $iflag)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_geticoninfo($hicon)
- Local $tinfo = DllStructCreate($tagiconinfo)
- Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $tinfo)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Local $aicon[6]
- $aicon[0] = True
- $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0
- $aicon[2] = DllStructGetData($tinfo, "XHotSpot")
- $aicon[3] = DllStructGetData($tinfo, "YHotSpot")
- $aicon[4] = DllStructGetData($tinfo, "hMask")
- $aicon[5] = DllStructGetData($tinfo, "hColor")
- Return $aicon
- EndFunc
- Func _winapi_getlasterrormessage()
- Local $ilasterror = _winapi_getlasterror()
- Local $tbufferptr = DllStructCreate("ptr")
- Local $ncount = _winapi_formatmessage(BitOR($format_message_allocate_buffer, $format_message_from_system), 0, $ilasterror, 0, $tbufferptr, 0, 0)
- If @error Then Return SetError(@error, 0, "")
- Local $stext = ""
- Local $pbuffer = DllStructGetData($tbufferptr, 1)
- If $pbuffer Then
- If $ncount > 0 Then
- Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
- $stext = DllStructGetData($tbuffer, 1)
- EndIf
- _winapi_localfree($pbuffer)
- EndIf
- Return $stext
- EndFunc
- Func _winapi_getlayeredwindowattributes($hwnd, ByRef $i_transcolor, ByRef $transparency, $ascolorref = False)
- $i_transcolor = -1
- $transparency = -1
- Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "INT*", $i_transcolor, "byte*", $transparency, "dword*", 0)
- If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
- If NOT $ascolorref Then
- $aresult[2] = Int(BinaryMid($aresult[2], 3, 1) & BinaryMid($aresult[2], 2, 1) & BinaryMid($aresult[2], 1, 1))
- EndIf
- $i_transcolor = $aresult[2]
- $transparency = $aresult[3]
- Return $aresult[4]
- EndFunc
- Func _winapi_getmodulehandle($smodulename)
- Local $smodulenametype = "wstr"
- If $smodulename = "" Then
- $smodulename = 0
- $smodulenametype = "ptr"
- EndIf
- Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getmousepos($ftoclient = False, $hwnd = 0)
- Local $imode = Opt("MouseCoordMode", 1)
- Local $apos = MouseGetPos()
- Opt("MouseCoordMode", $imode)
- Local $tpoint = DllStructCreate($tagpoint)
- DllStructSetData($tpoint, "X", $apos[0])
- DllStructSetData($tpoint, "Y", $apos[1])
- If $ftoclient AND NOT _winapi_screentoclient($hwnd, $tpoint) Then Return SetError(@error + 20, @extended, 0)
- Return $tpoint
- EndFunc
- Func _winapi_getmouseposx($ftoclient = False, $hwnd = 0)
- Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($tpoint, "X")
- EndFunc
- Func _winapi_getmouseposy($ftoclient = False, $hwnd = 0)
- Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($tpoint, "Y")
- EndFunc
- Func _winapi_getobject($hobject, $isize, $pobject)
- Local $aresult = DllCall("gdi32.dll", "int", "GetObjectW", "handle", $hobject, "int", $isize, "ptr", $pobject)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
- Local $ipathlen = 4096
- Local $inulls = 0
- Local $tofn = DllStructCreate($tagopenfilename)
- Local $afiles[1] = [0]
- Local $iflag = $iflags
- Local $asflines = StringSplit($sfilter, "|")
- Local $asfilter[$asflines[0] * 2 + 1]
- Local $istart, $ifinal, $stfilter
- $asfilter[0] = $asflines[0] * 2
- For $i = 1 To $asflines[0]
- $istart = StringInStr($asflines[$i], "(", 0, 1)
- $ifinal = StringInStr($asflines[$i], ")", 0, -1)
- $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
- $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
- $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
- Next
- Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
- Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
- Local $tfilter = DllStructCreate($stfilter & "wchar")
- Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
- Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
- For $i = 1 To $asfilter[0]
- DllStructSetData($tfilter, $i, $asfilter[$i])
- Next
- DllStructSetData($ttitle, "Title", $stitle)
- DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
- DllStructSetData($tpath, "Path", $sdefaultfile)
- DllStructSetData($textn, "Extension", $sdefaultext)
- DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
- DllStructSetData($tofn, "hwndOwner", $hwndowner)
- DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
- DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
- DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
- DllStructSetData($tofn, "nMaxFile", $ipathlen)
- DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
- DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
- DllStructSetData($tofn, "Flags", $iflag)
- DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
- DllStructSetData($tofn, "FlagsEx", $iflagsex)
- Local $ares = DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "struct*", $tofn)
- If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
- If BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then
- For $x = 1 To $ipathlen
- If DllStructGetData($tpath, "Path", $x) = Chr(0) Then
- DllStructSetData($tpath, "Path", "|", $x)
- $inulls += 1
- Else
- $inulls = 0
- EndIf
- If $inulls = 2 Then ExitLoop
- Next
- DllStructSetData($tpath, "Path", Chr(0), $x - 1)
- $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|")
- If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- Return StringSplit(DllStructGetData($tpath, "Path"), "|")
- ElseIf BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect Then
- $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ")
- If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|")
- Else
- Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- EndIf
- EndFunc
- Func _winapi_getoverlappedresult($hfile, $poverlapped, ByRef $ibytes, $fwait = False)
- Local $aresult = DllCall("kernel32.dll", "bool", "GetOverlappedResult", "handle", $hfile, "ptr", $poverlapped, "dword*", 0, "bool", $fwait)
- If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, False)
- $ibytes = $aresult[3]
- Return $aresult[0]
- EndFunc
- Func _winapi_getparent($hwnd)
- Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getprocaddress($hmodule, $vname)
- Local $stype = "str"
- If IsNumber($vname) Then $stype = "word"
- Local $aresult = DllCall("kernel32.dll", "ptr", "GetProcAddress", "handle", $hmodule, $stype, $vname)
- If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getprocessaffinitymask($hprocess)
- Local $aresult = DllCall("kernel32.dll", "bool", "GetProcessAffinityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
- Local $amask[3]
- $amask[0] = True
- $amask[1] = $aresult[2]
- $amask[2] = $aresult[3]
- Return $amask
- EndFunc
- Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
- Local $ipathlen = 4096
- Local $tofn = DllStructCreate($tagopenfilename)
- Local $afiles[1] = [0]
- Local $iflag = $iflags
- Local $asflines = StringSplit($sfilter, "|")
- Local $asfilter[$asflines[0] * 2 + 1]
- Local $istart, $ifinal, $stfilter
- $asfilter[0] = $asflines[0] * 2
- For $i = 1 To $asflines[0]
- $istart = StringInStr($asflines[$i], "(", 0, 1)
- $ifinal = StringInStr($asflines[$i], ")", 0, -1)
- $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
- $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
- $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
- Next
- Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
- Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
- Local $tfilter = DllStructCreate($stfilter & "wchar")
- Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
- Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
- For $i = 1 To $asfilter[0]
- DllStructSetData($tfilter, $i, $asfilter[$i])
- Next
- DllStructSetData($ttitle, "Title", $stitle)
- DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
- DllStructSetData($tpath, "Path", $sdefaultfile)
- DllStructSetData($textn, "Extension", $sdefaultext)
- DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
- DllStructSetData($tofn, "hwndOwner", $hwndowner)
- DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
- DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
- DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
- DllStructSetData($tofn, "nMaxFile", $ipathlen)
- DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
- DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
- DllStructSetData($tofn, "Flags", $iflag)
- DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
- DllStructSetData($tofn, "FlagsEx", $iflagsex)
- Local $ares = DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "struct*", $tofn)
- If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
- Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- EndFunc
- Func _winapi_getstockobject($iobject)
- Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getstdhandle($istdhandle)
- If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
- Local Const $ahandle[3] = [-10, -11, -12]
- Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_getsyscolor($iindex)
- Local $aresult = DllCall("user32.dll", "INT", "GetSysColor", "int", $iindex)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getsyscolorbrush($iindex)
- Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getsystemmetrics($iindex)
- Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_gettextextentpoint32($hdc, $stext)
- Local $tsize = DllStructCreate($tagsize)
- Local $isize = StringLen($stext)
- Local $aret = DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "struct*", $tsize)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $tsize
- EndFunc
- Func _winapi_gettextmetrics($hdc)
- Local $ttextmetric = DllStructCreate($tagtextmetric)
- Local $ret = DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $ttextmetric
- EndFunc
- Func _winapi_getwindow($hwnd, $icmd)
- Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getwindowdc($hwnd)
- Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getwindowheight($hwnd)
- Local $trect = _winapi_getwindowrect($hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
- EndFunc
- Func _winapi_getwindowlong($hwnd, $iindex)
- Local $sfuncname = "GetWindowLongW"
- If @AutoItX64 Then $sfuncname = "GetWindowLongPtrW"
- Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getwindowplacement($hwnd)
- Local $twindowplacement = DllStructCreate($tagwindowplacement)
- DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
- Local $aret = DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $twindowplacement
- EndFunc
- Func _winapi_getwindowrect($hwnd)
- Local $trect = DllStructCreate($tagrect)
- Local $aret = DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "struct*", $trect)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $trect
- EndFunc
- Func _winapi_getwindowrgn($hwnd, $hrgn)
- Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getwindowtext($hwnd)
- Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid)
- Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- $ipid = $aresult[2]
- Return $aresult[0]
- EndFunc
- Func _winapi_getwindowwidth($hwnd)
- Local $trect = _winapi_getwindowrect($hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
- EndFunc
- Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
- $ix = DllStructGetData($tpoint, "X")
- $iy = DllStructGetData($tpoint, "Y")
- EndFunc
- Func _winapi_globalmemorystatus()
- Local $tmem = DllStructCreate($tagmemorystatusex)
- DllStructSetData($tmem, 1, DllStructGetSize($tmem))
- Local $aret = DllCall("kernel32.dll", "bool", "GlobalMemoryStatusEx", "struct*", $tmem)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Local $amem[7]
- $amem[0] = DllStructGetData($tmem, 2)
- $amem[1] = DllStructGetData($tmem, 3)
- $amem[2] = DllStructGetData($tmem, 4)
- $amem[3] = DllStructGetData($tmem, 5)
- $amem[4] = DllStructGetData($tmem, 6)
- $amem[5] = DllStructGetData($tmem, 7)
- $amem[6] = DllStructGetData($tmem, 8)
- Return $amem
- EndFunc
- Func _winapi_guidfromstring($sguid)
- Local $tguid = DllStructCreate($tagguid)
- _winapi_guidfromstringex($sguid, $tguid)
- If @error Then Return SetError(@error + 10, @extended, 0)
- Return $tguid
- EndFunc
- Func _winapi_guidfromstringex($sguid, $pguid)
- Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $pguid)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_hiword($ilong)
- Return BitShift($ilong, 16)
- EndFunc
- Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
- If $hwnd = $hlastwnd Then Return True
- For $ii = $__gainprocess_winapi[0][0] To 1 Step -1
- If $hwnd = $__gainprocess_winapi[$ii][0] Then
- If $__gainprocess_winapi[$ii][1] Then
- $hlastwnd = $hwnd
- Return True
- Else
- Return False
- EndIf
- EndIf
- Next
- Local $iprocessid
- _winapi_getwindowthreadprocessid($hwnd, $iprocessid)
- Local $icount = $__gainprocess_winapi[0][0] + 1
- If $icount >= 64 Then $icount = 1
- $__gainprocess_winapi[0][0] = $icount
- $__gainprocess_winapi[$icount][0] = $hwnd
- $__gainprocess_winapi[$icount][1] = ($iprocessid = @AutoItPID)
- Return $__gainprocess_winapi[$icount][1]
- EndFunc
- Func _winapi_inttofloat($iint)
- Local $tint = DllStructCreate("int")
- Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint))
- DllStructSetData($tint, 1, $iint)
- Return DllStructGetData($tfloat, 1)
- EndFunc
- Func _winapi_isclassname($hwnd, $sclassname)
- Local $sseparator = Opt("GUIDataSeparatorChar")
- Local $aclassname = StringSplit($sclassname, $sseparator)
- If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
- Local $sclasscheck = _winapi_getclassname($hwnd)
- For $x = 1 To UBound($aclassname) - 1
- If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True
- Next
- Return False
- EndFunc
- Func _winapi_iswindow($hwnd)
- Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_iswindowvisible($hwnd)
- Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_invalidaterect($hwnd, $trect = 0, $ferase = True)
- Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $ferase)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_lineto($hdc, $ix, $iy)
- Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_loadbitmap($hinstance, $sbitmap)
- Local $sbitmaptype = "int"
- If IsString($sbitmap) Then $sbitmaptype = "wstr"
- Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload)
- Local $aresult, $simagetype = "int"
- If IsString($simage) Then $simagetype = "wstr"
- $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_loadlibrary($sfilename)
- Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_loadlibraryex($sfilename, $iflags = 0)
- Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_loadshell32icon($iiconid)
- Local $ticons = DllStructCreate("ptr Data")
- Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $ticons, 1)
- If @error Then Return SetError(@error, @extended, 0)
- If $iicons <= 0 Then Return SetError(10, 0, 0)
- Return DllStructGetData($ticons, "Data")
- EndFunc
- Func _winapi_loadstring($hinstance, $istringid)
- Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
- Return SetExtended($aresult[0], $aresult[3])
- EndFunc
- Func _winapi_localfree($hmem)
- Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmem)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_loword($ilong)
- Return BitAND($ilong, 65535)
- EndFunc
- Func _winapi_makelangid($lgidprimary, $lgidsub)
- Return BitOR(BitShift($lgidsub, -10), $lgidprimary)
- EndFunc
- Func _winapi_makelcid($lgid, $srtid)
- Return BitOR(BitShift($srtid, -16), $lgid)
- EndFunc
- Func _winapi_makelong($ilo, $ihi)
- Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
- EndFunc
- Func _winapi_makeqword($lodword, $hidword)
- Local $tint64 = DllStructCreate("uint64")
- Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
- DllStructSetData($tdwords, 1, $lodword)
- DllStructSetData($tdwords, 2, $hidword)
- Return DllStructGetData($tint64, 1)
- EndFunc
- Func _winapi_messagebeep($itype = 1)
- Local $isound
- Switch $itype
- Case 1
- $isound = 0
- Case 2
- $isound = 16
- Case 3
- $isound = 32
- Case 4
- $isound = 48
- Case 5
- $isound = 64
- Case Else
- $isound = -1
- EndSwitch
- Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_msgbox($iflags, $stitle, $stext)
- BlockInput(0)
- MsgBox($iflags, $stitle, $stext & " ")
- EndFunc
- Func _winapi_mouse_event($iflags, $ix = 0, $iy = 0, $idata = 0, $iextrainfo = 0)
- DllCall("user32.dll", "none", "mouse_event", "dword", $iflags, "dword", $ix, "dword", $iy, "dword", $idata, "ulong_ptr", $iextrainfo)
- If @error Then Return SetError(@error, @extended)
- EndFunc
- Func _winapi_moveto($hdc, $ix, $iy)
- Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $frepaint = True)
- Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $frepaint)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_muldiv($inumber, $inumerator, $idenominator)
- Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_multibytetowidechar($stext, $icodepage = 0, $iflags = 0, $bretstring = False)
- Local $stexttype = "str"
- If NOT IsString($stext) Then $stexttype = "struct*"
- Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "ptr", 0, "int", 0)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
- Local $iout = $aresult[0]
- Local $tout = DllStructCreate("wchar[" & $iout & "]")
- $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $stext, "int", -1, "struct*", $tout, "int", $iout)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, 0)
- If $bretstring Then Return DllStructGetData($tout, 1)
- Return $tout
- EndFunc
- Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0)
- Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "struct*", $ptext, "int", (StringLen($stext) + 1) * 2)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_openprocess($iaccess, $finherit, $iprocessid, $fdebugpriv = False)
- Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
- If @error Then Return SetError(@error, @extended, 0)
- If $aresult[0] Then Return $aresult[0]
- If NOT $fdebugpriv Then Return SetError(100, 0, 0)
- Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
- If @error Then Return SetError(@error + 10, @extended, 0)
- _security__setprivilege($htoken, "SeDebugPrivilege", True)
- Local $ierror = @error
- Local $iextended = @extended
- Local $iret = 0
- If NOT @error Then
- $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
- $ierror = @error
- $iextended = @extended
- If $aresult[0] Then $iret = $aresult[0]
- _security__setprivilege($htoken, "SeDebugPrivilege", False)
- If @error Then
- $ierror = @error + 20
- $iextended = @extended
- EndIf
- Else
- $ierror = @error + 30
- EndIf
- _winapi_closehandle($htoken)
- Return SetError($ierror, $iextended, $iret)
- EndFunc
- Func __winapi_parsefiledialogpath($spath)
- Local $afiles[3]
- $afiles[0] = 2
- Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1)
- $afiles[1] = $stemp
- $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1)
- Return $afiles
- EndFunc
- Func _winapi_pathfindonpath(Const $szfile, $aextrapaths = "", Const $szpathdelimiter = @LF)
- Local $iextracount = 0
- If IsString($aextrapaths) Then
- If StringLen($aextrapaths) Then
- $aextrapaths = StringSplit($aextrapaths, $szpathdelimiter, 1 + 2)
- $iextracount = UBound($aextrapaths, 1)
- EndIf
- ElseIf IsArray($aextrapaths) Then
- $iextracount = UBound($aextrapaths)
- EndIf
- Local $tpaths, $tpathptrs
- If $iextracount Then
- Local $szstruct = ""
- For $path In $aextrapaths
- $szstruct &= "wchar[" & StringLen($path) + 1 & "];"
- Next
- $tpaths = DllStructCreate($szstruct)
- $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
- For $i = 1 To $iextracount
- DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
- DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
- Next
- DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
- EndIf
- Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $szfile, "struct*", $tpathptrs)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, $szfile)
- Return $aresult[1]
- EndFunc
- Func _winapi_pointfromrect(ByRef $trect, $fcenter = True)
- Local $ix1 = DllStructGetData($trect, "Left")
- Local $iy1 = DllStructGetData($trect, "Top")
- Local $ix2 = DllStructGetData($trect, "Right")
- Local $iy2 = DllStructGetData($trect, "Bottom")
- If $fcenter Then
- $ix1 = $ix1 + (($ix2 - $ix1) / 2)
- $iy1 = $iy1 + (($iy2 - $iy1) / 2)
- EndIf
- Local $tpoint = DllStructCreate($tagpoint)
- DllStructSetData($tpoint, "X", $ix1)
- DllStructSetData($tpoint, "Y", $iy1)
- Return $tpoint
- EndFunc
- Func _winapi_postmessage($hwnd, $imsg, $iwparam, $ilparam)
- Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_primarylangid($lgid)
- Return BitAND($lgid, 1023)
- EndFunc
- Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
- Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $poverlapped = 0)
- Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itoread, "dword*", 0, "ptr", $poverlapped)
- If @error Then Return SetError(@error, @extended, False)
- $iread = $aresult[4]
- Return $aresult[0]
- EndFunc
- Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
- Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "ptr", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
- If @error Then Return SetError(@error, @extended, False)
- $iread = $aresult[5]
- Return $aresult[0]
- EndFunc
- Func _winapi_rectisempty(ByRef $trect)
- Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0)
- EndFunc
- Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
- Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "struct*", $trect, "handle", $hregion, "uint", $iflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_registerwindowmessage($smessage)
- Local $aresult = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smessage)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_releasecapture()
- Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture")
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_releasedc($hwnd, $hdc)
- Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_screentoclient($hwnd, ByRef $tpoint)
- Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "struct*", $tpoint)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_selectobject($hdc, $hgdiobj)
- Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setbkcolor($hdc, $icolor)
- Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "INT", $icolor)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_setbkmode($hdc, $ibkmode)
- Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_setcapture($hwnd)
- Local $aresult = DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_setcursor($hcursor)
- Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_setdefaultprinter($sprinter)
- Local $aresult = DllCall("winspool.drv", "bool", "SetDefaultPrinterW", "wstr", $sprinter)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbmi, $icoloruse = 0)
- Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbmi, "INT", $icoloruse)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setendoffile($hfile)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setevent($hevent)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetEvent", "handle", $hevent)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setfilepointer($hfile, $ipos, $imethod = 0)
- Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_setfocus($hwnd)
- Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_setfont($hwnd, $hfont, $fredraw = True)
- _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $fredraw, 0, "hwnd")
- EndFunc
- Func _winapi_sethandleinformation($hobject, $imask, $iflags)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetHandleInformation", "handle", $hobject, "dword", $imask, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setlayeredwindowattributes($hwnd, $i_transcolor, $transparency = 255, $dwflags = 3, $iscolorref = False)
- If $dwflags = Default OR $dwflags = "" OR $dwflags < 0 Then $dwflags = 3
- If NOT $iscolorref Then
- $i_transcolor = Int(BinaryMid($i_transcolor, 3, 1) & BinaryMid($i_transcolor, 2, 1) & BinaryMid($i_transcolor, 1, 1))
- EndIf
- Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "INT", $i_transcolor, "byte", $transparency, "dword", $dwflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setparent($hwndchild, $hwndparent)
- Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_setprocessaffinitymask($hprocess, $imask)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetProcessAffinityMask", "handle", $hprocess, "ulong_ptr", $imask)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setsyscolors($velements, $vcolors)
- Local $isearray = IsArray($velements), $iscarray = IsArray($vcolors)
- Local $ielementnum
- If NOT $iscarray AND NOT $isearray Then
- $ielementnum = 1
- ElseIf $iscarray OR $isearray Then
- If NOT $iscarray OR NOT $isearray Then Return SetError(-1, -1, False)
- If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
- $ielementnum = UBound($velements)
- EndIf
- Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
- Local $tcolors = DllStructCreate("INT NewColor[" & $ielementnum & "]")
- If NOT $isearray Then
- DllStructSetData($telements, "Element", $velements, 1)
- Else
- For $x = 0 To $ielementnum - 1
- DllStructSetData($telements, "Element", $velements[$x], $x + 1)
- Next
- EndIf
- If NOT $iscarray Then
- DllStructSetData($tcolors, "NewColor", $vcolors, 1)
- Else
- For $x = 0 To $ielementnum - 1
- DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
- Next
- EndIf
- Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "struct*", $telements, "struct*", $tcolors)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_settextcolor($hdc, $icolor)
- Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "INT", $icolor)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_setwindowlong($hwnd, $iindex, $ivalue)
- _winapi_setlasterror(0)
- Local $sfuncname = "SetWindowLongW"
- If @AutoItX64 Then $sfuncname = "SetWindowLongPtrW"
- Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_setwindowplacement($hwnd, $pwindowplacement)
- Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags)
- Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True)
- Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setwindowshookex($idhook, $lpfn, $hmod, $dwthreadid = 0)
- Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $idhook, "ptr", $lpfn, "handle", $hmod, "dword", $dwthreadid)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_setwindowtext($hwnd, $stext)
- Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_showcursor($fshow)
- Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $fshow)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_showerror($stext, $fexit = True)
- _winapi_msgbox(266256, "Error", $stext)
- If $fexit Then Exit
- EndFunc
- Func _winapi_showmsg($stext)
- _winapi_msgbox(64 + 4096, "Information", $stext)
- EndFunc
- Func _winapi_showwindow($hwnd, $icmdshow = 5)
- Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_stringfromguid($pguid)
- Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $pguid, "wstr", "", "int", 40)
- If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _winapi_stringlena($tstring)
- Local $aresult = DllCall("kernel32.dll", "int", "lstrlenA", "struct*", $tstring)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_stringlenw(Const ByRef $tstring)
- Local $aresult = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $tstring)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_sublangid($lgid)
- Return BitShift($lgid, 10)
- EndFunc
- Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0)
- Local $aresult = DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", $iaction, "uint", $iparam, "ptr", $vparam, "uint", $iwinini)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_twipsperpixelx()
- Local $lngdc, $twipsperpixelx
- $lngdc = _winapi_getdc(0)
- $twipsperpixelx = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsx)
- _winapi_releasedc(0, $lngdc)
- Return $twipsperpixelx
- EndFunc
- Func _winapi_twipsperpixely()
- Local $lngdc, $twipsperpixely
- $lngdc = _winapi_getdc(0)
- $twipsperpixely = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsy)
- _winapi_releasedc(0, $lngdc)
- Return $twipsperpixely
- EndFunc
- Func _winapi_unhookwindowshookex($hhk)
- Local $aresult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhk)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_updatelayeredwindow($hwnd, $hdcdest, $pptdest, $psize, $hdcsrce, $pptsrce, $irgb, $pblend, $iflags)
- Local $aresult = DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hwnd, "handle", $hdcdest, "ptr", $pptdest, "ptr", $psize, "handle", $hdcsrce, "ptr", $pptsrce, "dword", $irgb, "ptr", $pblend, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_updatewindow($hwnd)
- Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_waitforinputidle($hprocess, $itimeout = -1)
- Local $aresult = DllCall("user32.dll", "dword", "WaitForInputIdle", "handle", $hprocess, "dword", $itimeout)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_waitformultipleobjects($icount, $phandles, $fwaitall = False, $itimeout = -1)
- Local $aresult = DllCall("kernel32.dll", "INT", "WaitForMultipleObjects", "dword", $icount, "ptr", $phandles, "bool", $fwaitall, "dword", $itimeout)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_waitforsingleobject($hhandle, $itimeout = -1)
- Local $aresult = DllCall("kernel32.dll", "INT", "WaitForSingleObject", "handle", $hhandle, "dword", $itimeout)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_widechartomultibyte($punicode, $icodepage = 0, $bretstring = True)
- Local $sunicodetype = "wstr"
- If NOT IsString($punicode) Then $sunicodetype = "struct*"
- Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, "")
- Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]")
- $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
- If $bretstring Then Return DllStructGetData($tmultibyte, 1)
- Return $tmultibyte
- EndFunc
- Func _winapi_windowfrompoint(ByRef $tpoint)
- Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_writeconsole($hconsole, $stext)
- Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $poverlapped = 0)
- Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itowrite, "dword*", 0, "ptr", $poverlapped)
- If @error Then Return SetError(@error, @extended, False)
- $iwritten = $aresult[4]
- Return $aresult[0]
- EndFunc
- Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr")
- Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
- If @error Then Return SetError(@error, @extended, False)
- $iwritten = $aresult[5]
- Return $aresult[0]
- EndFunc
- Func _dateadd($stype, $ivaltoadd, $sdate)
- Local $astimepart[4]
- Local $asdatepart[4]
- Local $ijuliandate
- $stype = StringLeft($stype, 1)
- If StringInStr("D,M,Y,w,h,n,s", $stype) = 0 OR $stype = "" Then
- Return SetError(1, 0, 0)
- EndIf
- If NOT StringIsInt($ivaltoadd) Then
- Return SetError(2, 0, 0)
- EndIf
- If NOT _dateisvalid($sdate) Then
- Return SetError(3, 0, 0)
- EndIf
- _datetimesplit($sdate, $asdatepart, $astimepart)
- If $stype = "d" OR $stype = "w" Then
- If $stype = "w" Then $ivaltoadd = $ivaltoadd * 7
- $ijuliandate = _datetodayvalue($asdatepart[1], $asdatepart[2], $asdatepart[3]) + $ivaltoadd
- _dayvaluetodate($ijuliandate, $asdatepart[1], $asdatepart[2], $asdatepart[3])
- EndIf
- If $stype = "m" Then
- $asdatepart[2] = $asdatepart[2] + $ivaltoadd
- While $asdatepart[2] > 12
- $asdatepart[2] = $asdatepart[2] - 12
- $asdatepart[1] = $asdatepart[1] + 1
- WEnd
- While $asdatepart[2] < 1
- $asdatepart[2] = $asdatepart[2] + 12
- $asdatepart[1] = $asdatepart[1] - 1
- WEnd
- EndIf
- If $stype = "y" Then
- $asdatepart[1] = $asdatepart[1] + $ivaltoadd
- EndIf
- If $stype = "h" OR $stype = "n" OR $stype = "s" Then
- Local $itimeval = _timetoticks($astimepart[1], $astimepart[2], $astimepart[3]) / 1000
- If $stype = "h" Then $itimeval = $itimeval + $ivaltoadd * 3600
- If $stype = "n" Then $itimeval = $itimeval + $ivaltoadd * 60
- If $stype = "s" Then $itimeval = $itimeval + $ivaltoadd
- Local $day2add = Int($itimeval / (24 * 60 * 60))
- $itimeval = $itimeval - $day2add * 24 * 60 * 60
- If $itimeval < 0 Then
- $day2add = $day2add - 1
- $itimeval = $itimeval + 24 * 60 * 60
- EndIf
- $ijuliandate = _datetodayvalue($asdatepart[1], $asdatepart[2], $asdatepart[3]) + $day2add
- _dayvaluetodate($ijuliandate, $asdatepart[1], $asdatepart[2], $asdatepart[3])
- _tickstotime($itimeval * 1000, $astimepart[1], $astimepart[2], $astimepart[3])
- EndIf
- Local $inumdays = _daysinmonth($asdatepart[1])
- If $inumdays[$asdatepart[2]] < $asdatepart[3] Then $asdatepart[3] = $inumdays[$asdatepart[2]]
- $sdate = $asdatepart[1] & "/" & StringRight("0" & $asdatepart[2], 2) & "/" & StringRight("0" & $asdatepart[3], 2)
- If $astimepart[0] > 0 Then
- If $astimepart[0] > 2 Then
- $sdate = $sdate & " " & StringRight("0" & $astimepart[1], 2) & ":" & StringRight("0" & $astimepart[2], 2) & ":" & StringRight("0" & $astimepart[3], 2)
- Else
- $sdate = $sdate & " " & StringRight("0" & $astimepart[1], 2) & ":" & StringRight("0" & $astimepart[2], 2)
- EndIf
- EndIf
- Return ($sdate)
- EndFunc
- Func _datedayofweek($idaynum, $ishort = 0)
- Local Const $adayofweek[8] = ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
- Select
- Case NOT StringIsInt($idaynum) OR NOT StringIsInt($ishort)
- Return SetError(1, 0, "")
- Case $idaynum < 1 OR $idaynum > 7
- Return SetError(2, 0, "")
- Case Else
- Select
- Case $ishort = 0
- Return $adayofweek[$idaynum]
- Case $ishort = 1
- Return StringLeft($adayofweek[$idaynum], 3)
- Case Else
- Return SetError(3, 0, "")
- EndSelect
- EndSelect
- EndFunc
- Func _datedaysinmonth($iyear, $imonthnum)
- If __dateismonth($imonthnum) AND __dateisyear($iyear) Then
- Local $ainumdays = _daysinmonth($iyear)
- Return $ainumdays[$imonthnum]
- EndIf
- Return SetError(1, 0, 0)
- EndFunc
- Func _datediff($stype, $sstartdate, $senddate)
- $stype = StringLeft($stype, 1)
- If StringInStr("d,m,y,w,h,n,s", $stype) = 0 OR $stype = "" Then
- Return SetError(1, 0, 0)
- EndIf
- If NOT _dateisvalid($sstartdate) Then
- Return SetError(2, 0, 0)
- EndIf
- If NOT _dateisvalid($senddate) Then
- Return SetError(3, 0, 0)
- EndIf
- Local $asstartdatepart[4], $asstarttimepart[4], $asenddatepart[4], $asendtimepart[4]
- _datetimesplit($sstartdate, $asstartdatepart, $asstarttimepart)
- _datetimesplit($senddate, $asenddatepart, $asendtimepart)
- Local $adaysdiff = _datetodayvalue($asenddatepart[1], $asenddatepart[2], $asenddatepart[3]) - _datetodayvalue($asstartdatepart[1], $asstartdatepart[2], $asstartdatepart[3])
- Local $itimediff, $iyeardiff, $istarttimeinsecs, $iendtimeinsecs
- If $asstarttimepart[0] > 1 AND $asendtimepart[0] > 1 Then
- $istarttimeinsecs = $asstarttimepart[1] * 3600 + $asstarttimepart[2] * 60 + $asstarttimepart[3]
- $iendtimeinsecs = $asendtimepart[1] * 3600 + $asendtimepart[2] * 60 + $asendtimepart[3]
- $itimediff = $iendtimeinsecs - $istarttimeinsecs
- If $itimediff < 0 Then
- $adaysdiff = $adaysdiff - 1
- $itimediff = $itimediff + 24 * 60 * 60
- EndIf
- Else
- $itimediff = 0
- EndIf
- Select
- Case $stype = "d"
- Return ($adaysdiff)
- Case $stype = "m"
- $iyeardiff = $asenddatepart[1] - $asstartdatepart[1]
- Local $imonthdiff = $asenddatepart[2] - $asstartdatepart[2] + $iyeardiff * 12
- If $asenddatepart[3] < $asstartdatepart[3] Then $imonthdiff = $imonthdiff - 1
- $istarttimeinsecs = $asstarttimepart[1] * 3600 + $asstarttimepart[2] * 60 + $asstarttimepart[3]
- $iendtimeinsecs = $asendtimepart[1] * 3600 + $asendtimepart[2] * 60 + $asendtimepart[3]
- $itimediff = $iendtimeinsecs - $istarttimeinsecs
- If $asenddatepart[3] = $asstartdatepart[3] AND $itimediff < 0 Then $imonthdiff = $imonthdiff - 1
- Return ($imonthdiff)
- Case $stype = "y"
- $iyeardiff = $asenddatepart[1] - $asstartdatepart[1]
- If $asenddatepart[2] < $asstartdatepart[2] Then $iyeardiff = $iyeardiff - 1
- If $asenddatepart[2] = $asstartdatepart[2] AND $asenddatepart[3] < $asstartdatepart[3] Then $iyeardiff = $iyeardiff - 1
- $istarttimeinsecs = $asstarttimepart[1] * 3600 + $asstarttimepart[2] * 60 + $asstarttimepart[3]
- $iendtimeinsecs = $asendtimepart[1] * 3600 + $asendtimepart[2] * 60 + $asendtimepart[3]
- $itimediff = $iendtimeinsecs - $istarttimeinsecs
- If $asenddatepart[2] = $asstartdatepart[2] AND $asenddatepart[3] = $asstartdatepart[3] AND $itimediff < 0 Then $iyeardiff = $iyeardiff - 1
- Return ($iyeardiff)
- Case $stype = "w"
- Return (Int($adaysdiff / 7))
- Case $stype = "h"
- Return ($adaysdiff * 24 + Int($itimediff / 3600))
- Case $stype = "n"
- Return ($adaysdiff * 24 * 60 + Int($itimediff / 60))
- Case $stype = "s"
- Return ($adaysdiff * 24 * 60 * 60 + $itimediff)
- EndSelect
- EndFunc
- Func _dateisleapyear($iyear)
- If StringIsInt($iyear) Then
- Select
- Case Mod($iyear, 4) = 0 AND Mod($iyear, 100) <> 0
- Return 1
- Case Mod($iyear, 400) = 0
- Return 1
- Case Else
- Return 0
- EndSelect
- EndIf
- Return SetError(1, 0, 0)
- EndFunc
- Func __dateismonth($inumber)
- If StringIsInt($inumber) Then
- If $inumber >= 1 AND $inumber <= 12 Then
- Return 1
- Else
- Return 0
- EndIf
- EndIf
- Return 0
- EndFunc
- Func _dateisvalid($sdate)
- Local $asdatepart[4], $astimepart[4]
- Local $sdatetime = StringSplit($sdate, " T")
- If $sdatetime[0] > 0 Then $asdatepart = StringSplit($sdatetime[1], "/-.")
- If UBound($asdatepart) <> 4 Then Return (0)
- If $asdatepart[0] <> 3 Then Return (0)
- If NOT StringIsInt($asdatepart[1]) Then Return (0)
- If NOT StringIsInt($asdatepart[2]) Then Return (0)
- If NOT StringIsInt($asdatepart[3]) Then Return (0)
- $asdatepart[1] = Number($asdatepart[1])
- $asdatepart[2] = Number($asdatepart[2])
- $asdatepart[3] = Number($asdatepart[3])
- Local $inumdays = _daysinmonth($asdatepart[1])
- If $asdatepart[1] < 1000 OR $asdatepart[1] > 2999 Then Return (0)
- If $asdatepart[2] < 1 OR $asdatepart[2] > 12 Then Return (0)
- If $asdatepart[3] < 1 OR $asdatepart[3] > $inumdays[$asdatepart[2]] Then Return (0)
- If $sdatetime[0] > 1 Then
- $astimepart = StringSplit($sdatetime[2], ":")
- If UBound($astimepart) < 4 Then ReDim $astimepart[4]
- Else
- Dim $astimepart[4]
- EndIf
- If $astimepart[0] < 1 Then Return (1)
- If $astimepart[0] < 2 Then Return (0)
- If $astimepart[0] = 2 Then $astimepart[3] = "00"
- If NOT StringIsInt($astimepart[1]) Then Return (0)
- If NOT StringIsInt($astimepart[2]) Then Return (0)
- If NOT StringIsInt($astimepart[3]) Then Return (0)
- $astimepart[1] = Number($astimepart[1])
- $astimepart[2] = Number($astimepart[2])
- $astimepart[3] = Number($astimepart[3])
- If $astimepart[1] < 0 OR $astimepart[1] > 23 Then Return (0)
- If $astimepart[2] < 0 OR $astimepart[2] > 59 Then Return (0)
- If $astimepart[3] < 0 OR $astimepart[3] > 59 Then Return (0)
- Return 1
- EndFunc
- Func __dateisyear($inumber)
- If StringIsInt($inumber) Then
- If StringLen($inumber) = 4 Then
- Return 1
- Else
- Return 0
- EndIf
- EndIf
- Return 0
- EndFunc
- Func _datelastweekdaynum($iweekdaynum)
- Select
- Case NOT StringIsInt($iweekdaynum)
- Return SetError(1, 0, 0)
- Case $iweekdaynum < 1 OR $iweekdaynum > 7
- Return SetError(2, 0, 0)
- Case Else
- Local $ilastweekdaynum
- If $iweekdaynum = 1 Then
- $ilastweekdaynum = 7
- Else
- $ilastweekdaynum = $iweekdaynum - 1
- EndIf
- Return $ilastweekdaynum
- EndSelect
- EndFunc
- Func _datelastmonthnum($imonthnum)
- Select
- Case NOT StringIsInt($imonthnum)
- Return SetError(1, 0, 0)
- Case $imonthnum < 1 OR $imonthnum > 12
- Return SetError(2, 0, 0)
- Case Else
- Local $ilastmonthnum
- If $imonthnum = 1 Then
- $ilastmonthnum = 12
- Else
- $ilastmonthnum = $imonthnum - 1
- EndIf
- $ilastmonthnum = StringFormat("%02d", $ilastmonthnum)
- Return $ilastmonthnum
- EndSelect
- EndFunc
- Func _datelastmonthyear($imonthnum, $iyear)
- Select
- Case NOT StringIsInt($imonthnum) OR NOT StringIsInt($iyear)
- Return SetError(1, 0, 0)
- Case $imonthnum < 1 OR $imonthnum > 12
- Return SetError(2, 0, 0)
- Case Else
- Local $ilastyear
- If $imonthnum = 1 Then
- $ilastyear = $iyear - 1
- Else
- $ilastyear = $iyear
- EndIf
- $ilastyear = StringFormat("%04d", $ilastyear)
- Return $ilastyear
- EndSelect
- EndFunc
- Func _datenextweekdaynum($iweekdaynum)
- Select
- Case NOT StringIsInt($iweekdaynum)
- Return SetError(1, 0, 0)
- Case $iweekdaynum < 1 OR $iweekdaynum > 7
- Return SetError(2, 0, 0)
- Case Else
- Local $inextweekdaynum
- If $iweekdaynum = 7 Then
- $inextweekdaynum = 1
- Else
- $inextweekdaynum = $iweekdaynum + 1
- EndIf
- Return $inextweekdaynum
- EndSelect
- EndFunc
- Func _datenextmonthnum($imonthnum)
- Select
- Case NOT StringIsInt($imonthnum)
- Return SetError(1, 0, 0)
- Case $imonthnum < 1 OR $imonthnum > 12
- Return SetError(2, 0, 0)
- Case Else
- Local $inextmonthnum
- If $imonthnum = 12 Then
- $inextmonthnum = 1
- Else
- $inextmonthnum = $imonthnum + 1
- EndIf
- $inextmonthnum = StringFormat("%02d", $inextmonthnum)
- Return $inextmonthnum
- EndSelect
- EndFunc
- Func _datenextmonthyear($imonthnum, $iyear)
- Select
- Case NOT StringIsInt($imonthnum) OR NOT StringIsInt($iyear)
- Return SetError(1, 0, 0)
- Case $imonthnum < 1 OR $imonthnum > 12
- Return SetError(2, 0, 0)
- Case Else
- Local $inextyear
- If $imonthnum = 12 Then
- $inextyear = $iyear + 1
- Else
- $inextyear = $iyear
- EndIf
- $inextyear = StringFormat("%04d", $inextyear)
- Return $inextyear
- EndSelect
- EndFunc
- Func _datetimeformat($sdate, $stype)
- Local $asdatepart[4], $astimepart[4]
- Local $stempdate = "", $stemptime = ""
- Local $sam, $spm, $lngx
- If NOT _dateisvalid($sdate) Then
- Return SetError(1, 0, "")
- EndIf
- If $stype < 0 OR $stype > 5 OR NOT IsInt($stype) Then
- Return SetError(2, 0, "")
- EndIf
- _datetimesplit($sdate, $asdatepart, $astimepart)
- Switch $stype
- Case 0
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 31, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $stempdate = $lngx[3]
- Else
- $stempdate = "M/d/yyyy"
- EndIf
- If $astimepart[0] > 1 Then
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 4099, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $stemptime = $lngx[3]
- Else
- $stemptime = "h:mm:ss tt"
- EndIf
- EndIf
- Case 1
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 32, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $stempdate = $lngx[3]
- Else
- $stempdate = "dddd, MMMM dd, yyyy"
- EndIf
- Case 2
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 31, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $stempdate = $lngx[3]
- Else
- $stempdate = "M/d/yyyy"
- EndIf
- Case 3
- If $astimepart[0] > 1 Then
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 4099, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $stemptime = $lngx[3]
- Else
- $stemptime = "h:mm:ss tt"
- EndIf
- EndIf
- Case 4
- If $astimepart[0] > 1 Then
- $stemptime = "hh:mm"
- EndIf
- Case 5
- If $astimepart[0] > 1 Then
- $stemptime = "hh:mm:ss"
- EndIf
- EndSwitch
- If $stempdate <> "" Then
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 29, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $stempdate = StringReplace($stempdate, "/", $lngx[3])
- EndIf
- Local $iwday = _datetodayofweek($asdatepart[1], $asdatepart[2], $asdatepart[3])
- $asdatepart[3] = StringRight("0" & $asdatepart[3], 2)
- $asdatepart[2] = StringRight("0" & $asdatepart[2], 2)
- $stempdate = StringReplace($stempdate, "d", "@")
- $stempdate = StringReplace($stempdate, "m", "#")
- $stempdate = StringReplace($stempdate, "y", "&")
- $stempdate = StringReplace($stempdate, "@@@@", _datedayofweek($iwday, 0))
- $stempdate = StringReplace($stempdate, "@@@", _datedayofweek($iwday, 1))
- $stempdate = StringReplace($stempdate, "@@", $asdatepart[3])
- $stempdate = StringReplace($stempdate, "@", StringReplace(StringLeft($asdatepart[3], 1), "0", "") & StringRight($asdatepart[3], 1))
- $stempdate = StringReplace($stempdate, "####", _datetomonth($asdatepart[2], 0))
- $stempdate = StringReplace($stempdate, "###", _datetomonth($asdatepart[2], 1))
- $stempdate = StringReplace($stempdate, "##", $asdatepart[2])
- $stempdate = StringReplace($stempdate, "#", StringReplace(StringLeft($asdatepart[2], 1), "0", "") & StringRight($asdatepart[2], 1))
- $stempdate = StringReplace($stempdate, "&&&&", $asdatepart[1])
- $stempdate = StringReplace($stempdate, "&&", StringRight($asdatepart[1], 2))
- EndIf
- If $stemptime <> "" Then
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 40, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $sam = $lngx[3]
- Else
- $sam = "AM"
- EndIf
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 41, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $spm = $lngx[3]
- Else
- $spm = "PM"
- EndIf
- $lngx = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 30, "wstr", "", "int", 255)
- If NOT @error AND $lngx[0] <> 0 Then
- $stemptime = StringReplace($stemptime, ":", $lngx[3])
- EndIf
- If StringInStr($stemptime, "tt") Then
- If $astimepart[1] < 12 Then
- $stemptime = StringReplace($stemptime, "tt", $sam)
- If $astimepart[1] = 0 Then $astimepart[1] = 12
- Else
- $stemptime = StringReplace($stemptime, "tt", $spm)
- If $astimepart[1] > 12 Then $astimepart[1] = $astimepart[1] - 12
- EndIf
- EndIf
- $astimepart[1] = StringRight("0" & $astimepart[1], 2)
- $astimepart[2] = StringRight("0" & $astimepart[2], 2)
- $astimepart[3] = StringRight("0" & $astimepart[3], 2)
- $stemptime = StringReplace($stemptime, "hh", StringFormat("%02d", $astimepart[1]))
- $stemptime = StringReplace($stemptime, "h", StringReplace(StringLeft($astimepart[1], 1), "0", "") & StringRight($astimepart[1], 1))
- $stemptime = StringReplace($stemptime, "mm", StringFormat("%02d", $astimepart[2]))
- $stemptime = StringReplace($stemptime, "ss", StringFormat("%02d", $astimepart[3]))
- $stempdate = StringStripWS($stempdate & " " & $stemptime, 3)
- EndIf
- Return $stempdate
- EndFunc
- Func _datetimesplit($sdate, ByRef $asdatepart, ByRef $itimepart)
- Local $sdatetime = StringSplit($sdate, " T")
- If $sdatetime[0] > 0 Then $asdatepart = StringSplit($sdatetime[1], "/-.")
- If $sdatetime[0] > 1 Then
- $itimepart = StringSplit($sdatetime[2], ":")
- If UBound($itimepart) < 4 Then ReDim $itimepart[4]
- Else
- Dim $itimepart[4]
- EndIf
- If UBound($asdatepart) < 4 Then ReDim $asdatepart[4]
- For $x = 1 To 3
- If StringIsInt($asdatepart[$x]) Then
- $asdatepart[$x] = Number($asdatepart[$x])
- Else
- $asdatepart[$x] = -1
- EndIf
- If StringIsInt($itimepart[$x]) Then
- $itimepart[$x] = Number($itimepart[$x])
- Else
- $itimepart[$x] = 0
- EndIf
- Next
- Return 1
- EndFunc
- Func _datetodayofweek($iyear, $imonth, $iday)
- If NOT _dateisvalid($iyear & "/" & $imonth & "/" & $iday) Then
- Return SetError(1, 0, "")
- EndIf
- Local $i_afactor = Int((14 - $imonth) / 12)
- Local $i_yfactor = $iyear - $i_afactor
- Local $i_mfactor = $imonth + (12 * $i_afactor) - 2
- Local $i_dfactor = Mod($iday + $i_yfactor + Int($i_yfactor / 4) - Int($i_yfactor / 100) + Int($i_yfactor / 400) + Int((31 * $i_mfactor) / 12), 7)
- Return ($i_dfactor + 1)
- EndFunc
- Func _datetodayofweekiso($iyear, $imonth, $iday)
- Local $idow = _datetodayofweek($iyear, $imonth, $iday)
- If @error Then
- Return SetError(1, 0, "")
- EndIf
- If $idow >= 2 Then Return $idow - 1
- Return 7
- EndFunc
- Func _datetodayvalue($iyear, $imonth, $iday)
- If NOT _dateisvalid(StringFormat("%04d/%02d/%02d", $iyear, $imonth, $iday)) Then
- Return SetError(1, 0, "")
- EndIf
- If $imonth < 3 Then
- $imonth = $imonth + 12
- $iyear = $iyear - 1
- EndIf
- Local $i_afactor = Int($iyear / 100)
- Local $i_bfactor = Int($i_afactor / 4)
- Local $i_cfactor = 2 - $i_afactor + $i_bfactor
- Local $i_efactor = Int(1461 * ($iyear + 4716) / 4)
- Local $i_ffactor = Int(153 * ($imonth + 1) / 5)
- Local $ijuliandate = $i_cfactor + $iday + $i_efactor + $i_ffactor - 1524.5
- Return ($ijuliandate)
- EndFunc
- Func _datetomonth($imonth, $ishort = 0)
- Local $amonthnumber[13] = ["", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
- Local $amonthnumberabbrev[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"]
- Select
- Case NOT StringIsInt($imonth)
- Return SetError(1, 0, "")
- Case $imonth < 1 OR $imonth > 12
- Return SetError(2, 0, "")
- Case Else
- Select
- Case $ishort = 0
- Return $amonthnumber[$imonth]
- Case $ishort = 1
- Return $amonthnumberabbrev[$imonth]
- Case Else
- Return SetError(3, 0, "")
- EndSelect
- EndSelect
- EndFunc
- Func _dayvaluetodate($ijuliandate, ByRef $iyear, ByRef $imonth, ByRef $iday)
- If $ijuliandate < 0 OR NOT IsNumber($ijuliandate) Then
- Return SetError(1, 0, 0)
- EndIf
- Local $i_zfactor = Int($ijuliandate + 0.5)
- Local $i_wfactor = Int(($i_zfactor - 1867216.25) / 36524.25)
- Local $i_xfactor = Int($i_wfactor / 4)
- Local $i_afactor = $i_zfactor + 1 + $i_wfactor - $i_xfactor
- Local $i_bfactor = $i_afactor + 1524
- Local $i_cfactor = Int(($i_bfactor - 122.1) / 365.25)
- Local $i_dfactor = Int(365.25 * $i_cfactor)
- Local $i_efactor = Int(($i_bfactor - $i_dfactor) / 30.6001)
- Local $i_ffactor = Int(30.6001 * $i_efactor)
- $iday = $i_bfactor - $i_dfactor - $i_ffactor
- If $i_efactor - 1 < 13 Then
- $imonth = $i_efactor - 1
- Else
- $imonth = $i_efactor - 13
- EndIf
- If $imonth < 3 Then
- $iyear = $i_cfactor - 4715
- Else
- $iyear = $i_cfactor - 4716
- EndIf
- $iyear = StringFormat("%04d", $iyear)
- $imonth = StringFormat("%02d", $imonth)
- $iday = StringFormat("%02d", $iday)
- Return $iyear & "/" & $imonth & "/" & $iday
- EndFunc
- Func _date_juliandayno($iyear, $imonth, $iday)
- Local $sfulldate = StringFormat("%04d/%02d/%02d", $iyear, $imonth, $iday)
- If NOT _dateisvalid($sfulldate) Then
- Return SetError(1, 0, "")
- EndIf
- Local $ijday = 0
- Local $aidaysinmonth = _daysinmonth($iyear)
- For $icntr = 1 To $imonth - 1
- $ijday = $ijday + $aidaysinmonth[$icntr]
- Next
- $ijday = ($iyear * 1000) + ($ijday + $iday)
- Return $ijday
- EndFunc
- Func _juliantodate($ijday, $ssep = "/")
- Local $iyear = Int($ijday / 1000)
- Local $idays = Mod($ijday, 1000)
- Local $imaxdays = 365
- If _dateisleapyear($iyear) Then $imaxdays = 366
- If $idays > $imaxdays Then
- Return SetError(1, 0, "")
- EndIf
- Local $aidaysinmonth = _daysinmonth($iyear)
- Local $imonth = 1
- While $idays > $aidaysinmonth[$imonth]
- $idays = $idays - $aidaysinmonth[$imonth]
- $imonth = $imonth + 1
- WEnd
- Return StringFormat("%04d%s%02d%s%02d", $iyear, $ssep, $imonth, $ssep, $idays)
- EndFunc
- Func _now()
- Return (_datetimeformat(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC, 0))
- EndFunc
- Func _nowcalc()
- Return (@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
- EndFunc
- Func _nowcalcdate()
- Return (@YEAR & "/" & @MON & "/" & @MDAY)
- EndFunc
- Func _nowdate()
- Return (_datetimeformat(@YEAR & "/" & @MON & "/" & @MDAY, 0))
- EndFunc
- Func _nowtime($stype = 3)
- If $stype < 3 OR $stype > 5 Then $stype = 3
- Return (_datetimeformat(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC, $stype))
- EndFunc
- Func _setdate($iday, $imonth = 0, $iyear = 0)
- If $iyear = 0 Then $iyear = @YEAR
- If $imonth = 0 Then $imonth = @MON
- If NOT _dateisvalid($iyear & "/" & $imonth & "/" & $iday) Then Return 1
- Local $tsystemtime = DllStructCreate($tagsystemtime)
- DllCall("kernel32.dll", "none", "GetLocalTime", "struct*", $tsystemtime)
- If @error Then Return SetError(@error, @extended, 0)
- DllStructSetData($tsystemtime, 4, $iday)
- If $imonth > 0 Then DllStructSetData($tsystemtime, 2, $imonth)
- If $iyear > 0 Then DllStructSetData($tsystemtime, 1, $iyear)
- Local $iretval = _date_time_setlocaltime($tsystemtime)
- If @error Then Return SetError(@error + 10, @extended, 0)
- Return Int($iretval)
- EndFunc
- Func _settime($ihour, $iminute, $isecond = 0)
- If $ihour < 0 OR $ihour > 23 Then Return 1
- If $iminute < 0 OR $iminute > 59 Then Return 1
- If $isecond < 0 OR $isecond > 59 Then Return 1
- Local $tsystemtime = DllStructCreate($tagsystemtime)
- DllCall("kernel32.dll", "none", "GetLocalTime", "struct*", $tsystemtime)
- If @error Then Return SetError(@error, @extended, 0)
- DllStructSetData($tsystemtime, 5, $ihour)
- DllStructSetData($tsystemtime, 6, $iminute)
- If $isecond > 0 Then DllStructSetData($tsystemtime, 7, $isecond)
- Local $iretval = _date_time_setlocaltime($tsystemtime)
- If @error Then Return SetError(@error + 10, @extended, 0)
- Return Int($iretval)
- EndFunc
- Func _tickstotime($iticks, ByRef $ihours, ByRef $imins, ByRef $isecs)
- If Number($iticks) > 0 Then
- $iticks = Int($iticks / 1000)
- $ihours = Int($iticks / 3600)
- $iticks = Mod($iticks, 3600)
- $imins = Int($iticks / 60)
- $isecs = Mod($iticks, 60)
- Return 1
- ElseIf Number($iticks) = 0 Then
- $ihours = 0
- $iticks = 0
- $imins = 0
- $isecs = 0
- Return 1
- Else
- Return SetError(1, 0, 0)
- EndIf
- EndFunc
- Func _timetoticks($ihours = @HOUR, $imins = @MIN, $isecs = @SEC)
- If StringIsInt($ihours) AND StringIsInt($imins) AND StringIsInt($isecs) Then
- Local $iticks = 1000 * ((3600 * $ihours) + (60 * $imins) + $isecs)
- Return $iticks
- Else
- Return SetError(1, 0, 0)
- EndIf
- EndFunc
- Func _weeknumberiso($iyear = @YEAR, $imonth = @MON, $iday = @MDAY)
- If $iday > 31 OR $iday < 1 Then
- Return SetError(1, 0, -1)
- ElseIf $imonth > 12 OR $imonth < 1 Then
- Return SetError(2, 0, -1)
- ElseIf $iyear < 1 OR $iyear > 2999 Then
- Return SetError(3, 0, -1)
- EndIf
- Local $idow = _datetodayofweekiso($iyear, $imonth, $iday) - 1
- Local $idow0101 = _datetodayofweekiso($iyear, 1, 1) - 1
- If ($imonth = 1 AND 3 < $idow0101 AND $idow0101 < 7 - ($iday - 1)) Then
- $idow = $idow0101 - 1
- $idow0101 = _datetodayofweekiso($iyear - 1, 1, 1) - 1
- $imonth = 12
- $iday = 31
- $iyear = $iyear - 1
- ElseIf ($imonth = 12 AND 30 - ($iday - 1) < _datetodayofweekiso($iyear + 1, 1, 1) - 1 AND _datetodayofweekiso($iyear + 1, 1, 1) - 1 < 4) Then
- Return 1
- EndIf
- Return Int((_datetodayofweekiso($iyear, 1, 1) - 1 < 4) + 4 * ($imonth - 1) + (2 * ($imonth - 1) + ($iday - 1) + $idow0101 - $idow + 6) * 36 / 256)
- EndFunc
- Func _weeknumber($iyear = @YEAR, $imonth = @MON, $iday = @MDAY, $iweekstart = 1)
- If $iday > 31 OR $iday < 1 Then
- Return SetError(1, 0, -1)
- ElseIf $imonth > 12 OR $imonth < 1 Then
- Return SetError(3, 0, -1)
- ElseIf $iyear < 1 OR $iyear > 2999 Then
- Return SetError(4, 0, -1)
- ElseIf $iweekstart < 1 OR $iweekstart > 2 Then
- Return SetError(2, 0, -1)
- EndIf
- Local $istartweek1, $iendweek1
- Local $idow0101 = _datetodayofweekiso($iyear, 1, 1)
- Local $idate = $iyear & "/" & $imonth & "/" & $iday
- If $iweekstart = 1 Then
- If $idow0101 = 6 Then
- $istartweek1 = 0
- Else
- $istartweek1 = -1 * $idow0101 - 1
- EndIf
- $iendweek1 = $istartweek1 + 6
- Else
- $istartweek1 = $idow0101 * -1
- $iendweek1 = $istartweek1 + 6
- EndIf
- Local $istartweek1ny
- Local $iendweek1date = _dateadd("d", $iendweek1, $iyear & "/01/01")
- Local $idow0101ny = _datetodayofweekiso($iyear + 1, 1, 1)
- If $iweekstart = 1 Then
- If $idow0101ny = 6 Then
- $istartweek1ny = 0
- Else
- $istartweek1ny = -1 * $idow0101ny - 1
- EndIf
- Else
- $istartweek1ny = $idow0101ny * -1
- EndIf
- Local $istartweek1dateny = _dateadd("d", $istartweek1ny, $iyear + 1 & "/01/01")
- Local $icurrdatediff = _datediff("d", $iendweek1date, $idate) - 1
- Local $icurrdatediffny = _datediff("d", $istartweek1dateny, $idate)
- If $icurrdatediff >= 0 AND $icurrdatediffny < 0 Then Return 2 + Int($icurrdatediff / 7)
- If $icurrdatediff < 0 OR $icurrdatediffny >= 0 Then Return 1
- EndFunc
- Func _daysinmonth($iyear)
- Local $aidays[13] = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
- If _dateisleapyear($iyear) Then $aidays[2] = 29
- Return $aidays
- EndFunc
- Func __date_time_clonesystemtime($psystemtime)
- Local $tsystemtime1 = DllStructCreate($tagsystemtime, $psystemtime)
- Local $tsystemtime2 = DllStructCreate($tagsystemtime)
- DllStructSetData($tsystemtime2, "Month", DllStructGetData($tsystemtime1, "Month"))
- DllStructSetData($tsystemtime2, "Day", DllStructGetData($tsystemtime1, "Day"))
- DllStructSetData($tsystemtime2, "Year", DllStructGetData($tsystemtime1, "Year"))
- DllStructSetData($tsystemtime2, "Hour", DllStructGetData($tsystemtime1, "Hour"))
- DllStructSetData($tsystemtime2, "Minute", DllStructGetData($tsystemtime1, "Minute"))
- DllStructSetData($tsystemtime2, "Second", DllStructGetData($tsystemtime1, "Second"))
- DllStructSetData($tsystemtime2, "MSeconds", DllStructGetData($tsystemtime1, "MSeconds"))
- DllStructSetData($tsystemtime2, "DOW", DllStructGetData($tsystemtime1, "DOW"))
- Return $tsystemtime2
- EndFunc
- Func _date_time_comparefiletime($pfiletime1, $pfiletime2)
- Local $aresult = DllCall("kernel32.dll", "long", "CompareFileTime", "ptr", $pfiletime1, "ptr", $pfiletime2)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _date_time_dosdatetimetofiletime($ifatdate, $ifattime)
- Local $ttime = DllStructCreate($tagfiletime)
- Local $aresult = DllCall("kernel32.dll", "bool", "DosDateTimeToFileTime", "word", $ifatdate, "word", $ifattime, "struct*", $ttime)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $ttime)
- EndFunc
- Func _date_time_dosdatetoarray($idosdate)
- Local $adate[3]
- $adate[0] = BitAND($idosdate, 31)
- $adate[1] = BitAND(BitShift($idosdate, 5), 15)
- $adate[2] = BitAND(BitShift($idosdate, 9), 63) + 1980
- Return $adate
- EndFunc
- Func _date_time_dosdatetimetoarray($idosdate, $idostime)
- Local $adate[6]
- $adate[0] = BitAND($idosdate, 31)
- $adate[1] = BitAND(BitShift($idosdate, 5), 15)
- $adate[2] = BitAND(BitShift($idosdate, 9), 63) + 1980
- $adate[5] = BitAND($idostime, 31) * 2
- $adate[4] = BitAND(BitShift($idostime, 5), 63)
- $adate[3] = BitAND(BitShift($idostime, 11), 31)
- Return $adate
- EndFunc
- Func _date_time_dosdatetimetostr($idosdate, $idostime)
- Local $adate = _date_time_dosdatetimetoarray($idosdate, $idostime)
- Return StringFormat("%02d/%02d/%04d %02d:%02d:%02d", $adate[0], $adate[1], $adate[2], $adate[3], $adate[4], $adate[5])
- EndFunc
- Func _date_time_dosdatetostr($idosdate)
- Local $adate = _date_time_dosdatetoarray($idosdate)
- Return StringFormat("%02d/%02d/%04d", $adate[0], $adate[1], $adate[2])
- EndFunc
- Func _date_time_dostimetoarray($idostime)
- Local $atime[3]
- $atime[2] = BitAND($idostime, 31) * 2
- $atime[1] = BitAND(BitShift($idostime, 5), 63)
- $atime[0] = BitAND(BitShift($idostime, 11), 31)
- Return $atime
- EndFunc
- Func _date_time_dostimetostr($idostime)
- Local $atime = _date_time_dostimetoarray($idostime)
- Return StringFormat("%02d:%02d:%02d", $atime[0], $atime[1], $atime[2])
- EndFunc
- Func _date_time_encodefiletime($imonth, $iday, $iyear, $ihour = 0, $iminute = 0, $isecond = 0, $imseconds = 0)
- Local $tsystemtime = _date_time_encodesystemtime($imonth, $iday, $iyear, $ihour, $iminute, $isecond, $imseconds)
- Return _date_time_systemtimetofiletime($tsystemtime)
- EndFunc
- Func _date_time_encodesystemtime($imonth, $iday, $iyear, $ihour = 0, $iminute = 0, $isecond = 0, $imseconds = 0)
- Local $tsystemtime = DllStructCreate($tagsystemtime)
- DllStructSetData($tsystemtime, "Month", $imonth)
- DllStructSetData($tsystemtime, "Day", $iday)
- DllStructSetData($tsystemtime, "Year", $iyear)
- DllStructSetData($tsystemtime, "Hour", $ihour)
- DllStructSetData($tsystemtime, "Minute", $iminute)
- DllStructSetData($tsystemtime, "Second", $isecond)
- DllStructSetData($tsystemtime, "MSeconds", $imseconds)
- Return $tsystemtime
- EndFunc
- Func _date_time_filetimetoarray(ByRef $tfiletime)
- If ((DllStructGetData($tfiletime, 1) + DllStructGetData($tfiletime, 2)) = 0) Then Return SetError(10, 0, 0)
- Local $tsystemtime = _date_time_filetimetosystemtime($tfiletime)
- If @error Then Return SetError(@error, @extended, 0)
- Return _date_time_systemtimetoarray($tsystemtime)
- EndFunc
- Func _date_time_filetimetostr(ByRef $tfiletime, $bfmt = 0)
- Local $adate = _date_time_filetimetoarray($tfiletime)
- If @error Then Return SetError(@error, @extended, "")
- If $bfmt Then
- Return StringFormat("%04d/%02d/%02d %02d:%02d:%02d", $adate[2], $adate[0], $adate[1], $adate[3], $adate[4], $adate[5])
- Else
- Return StringFormat("%02d/%02d/%04d %02d:%02d:%02d", $adate[0], $adate[1], $adate[2], $adate[3], $adate[4], $adate[5])
- EndIf
- EndFunc
- Func _date_time_filetimetodosdatetime($pfiletime)
- Local $adate[2]
- Local $aresult = DllCall("kernel32.dll", "bool", "FileTimeToDosDateTime", "ptr", $pfiletime, "word*", 0, "word*", 0)
- If @error Then Return SetError(@error, @extended, $adate)
- $adate[0] = $aresult[2]
- $adate[1] = $aresult[3]
- Return SetExtended($aresult[0], $adate)
- EndFunc
- Func _date_time_filetimetolocalfiletime($pfiletime)
- Local $tlocal = DllStructCreate($tagfiletime)
- Local $aresult = DllCall("kernel32.dll", "bool", "FileTimeToLocalFileTime", "struct*", $pfiletime, "struct*", $tlocal)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tlocal)
- EndFunc
- Func _date_time_filetimetosystemtime($pfiletime)
- Local $tsysttime = DllStructCreate($tagsystemtime)
- Local $aresult = DllCall("kernel32.dll", "bool", "FileTimeToSystemTime", "struct*", $pfiletime, "struct*", $tsysttime)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tsysttime)
- EndFunc
- Func _date_time_getfiletime($hfile)
- Local $adate[3]
- $adate[0] = DllStructCreate($tagfiletime)
- $adate[1] = DllStructCreate($tagfiletime)
- $adate[2] = DllStructCreate($tagfiletime)
- Local $aresult = DllCall("Kernel32.dll", "bool", "GetFileTime", "handle", $hfile, "struct*", $adate[0], "struct*", $adate[1], "struct*", $adate[2])
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $adate)
- EndFunc
- Func _date_time_getlocaltime()
- Local $tsysttime = DllStructCreate($tagsystemtime)
- DllCall("kernel32.dll", "none", "GetLocalTime", "struct*", $tsysttime)
- If @error Then Return SetError(@error, @extended, 0)
- Return $tsysttime
- EndFunc
- Func _date_time_getsystemtime()
- Local $tsysttime = DllStructCreate($tagsystemtime)
- DllCall("kernel32.dll", "none", "GetSystemTime", "struct*", $tsysttime)
- If @error Then Return SetError(@error, @extended, 0)
- Return $tsysttime
- EndFunc
- Func _date_time_getsystemtimeadjustment()
- Local $ainfo[3]
- Local $aresult = DllCall("kernel32.dll", "bool", "GetSystemTimeAdjustment", "dword*", 0, "dword*", 0, "bool*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- $ainfo[0] = $aresult[1]
- $ainfo[1] = $aresult[2]
- $ainfo[2] = $aresult[3] <> 0
- Return SetExtended($aresult[0], $ainfo)
- EndFunc
- Func _date_time_getsystemtimeasfiletime()
- Local $tfiletime = DllStructCreate($tagfiletime)
- DllCall("kernel32.dll", "none", "GetSystemTimeAsFileTime", "struct*", $tfiletime)
- If @error Then Return SetError(@error, @extended, 0)
- Return $tfiletime
- EndFunc
- Func _date_time_getsystemtimes()
- Local $ainfo[3]
- $ainfo[0] = DllStructCreate($tagfiletime)
- $ainfo[1] = DllStructCreate($tagfiletime)
- $ainfo[2] = DllStructCreate($tagfiletime)
- Local $aresult = DllCall("kernel32.dll", "bool", "GetSystemTimes", "struct*", $ainfo[0], "struct*", $ainfo[1], "struct*", $ainfo[2])
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $ainfo)
- EndFunc
- Func _date_time_gettickcount()
- Local $aresult = DllCall("kernel32.dll", "dword", "GetTickCount")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _date_time_gettimezoneinformation()
- Local $ttimezone = DllStructCreate($tagtime_zone_information)
- Local $aresult = DllCall("kernel32.dll", "dword", "GetTimeZoneInformation", "struct*", $ttimezone)
- If @error OR $aresult[0] = -1 Then Return SetError(@error, @extended, 0)
- Local $ainfo[8]
- $ainfo[0] = $aresult[0]
- $ainfo[1] = DllStructGetData($ttimezone, "Bias")
- $ainfo[2] = _winapi_widechartomultibyte(DllStructGetPtr($ttimezone, "StdName"))
- $ainfo[3] = __date_time_clonesystemtime(DllStructGetPtr($ttimezone, "StdDate"))
- $ainfo[4] = DllStructGetData($ttimezone, "StdBias")
- $ainfo[5] = _winapi_widechartomultibyte(DllStructGetPtr($ttimezone, "DayName"))
- $ainfo[6] = __date_time_clonesystemtime(DllStructGetPtr($ttimezone, "DayDate"))
- $ainfo[7] = DllStructGetData($ttimezone, "DayBias")
- Return $ainfo
- EndFunc
- Func _date_time_localfiletimetofiletime($plocaltime)
- Local $tfiletime = DllStructCreate($tagfiletime)
- Local $aresult = DllCall("kernel32.dll", "bool", "LocalFileTimeToFileTime", "ptr", $plocaltime, "struct*", $tfiletime)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tfiletime)
- EndFunc
- Func _date_time_setfiletime($hfile, $pcreatetime, $plastaccess, $plastwrite)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetFileTime", "handle", $hfile, "ptr", $pcreatetime, "ptr", $plastaccess, "ptr", $plastwrite)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _date_time_setlocaltime($psystemtime)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetLocalTime", "struct*", $psystemtime)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, False)
- $aresult = DllCall("kernel32.dll", "bool", "SetLocalTime", "struct*", $psystemtime)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _date_time_setsystemtime($psystemtime)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetSystemTime", "ptr", $psystemtime)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _date_time_setsystemtimeadjustment($iadjustment, $fdisabled)
- Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
- If @error Then Return SetError(@error + 10, @extended, False)
- _security__setprivilege($htoken, "SeSystemtimePrivilege", True)
- Local $ierror = @error
- Local $ilasterror = @extended
- Local $iret = False
- If NOT @error Then
- Local $aresult = DllCall("kernel32.dll", "bool", "SetSystemTimeAdjustment", "dword", $iadjustment, "bool", $fdisabled)
- If @error Then
- $ierror = @error
- $ilasterror = @extended
- ElseIf $aresult[0] Then
- $iret = True
- Else
- $ierror = 20
- $ilasterror = _winapi_getlasterror()
- EndIf
- _security__setprivilege($htoken, "SeSystemtimePrivilege", False)
- If NOT $ierror AND @error Then $ierror = 22
- EndIf
- _winapi_closehandle($htoken)
- Return SetError($ierror, $ilasterror, $iret)
- EndFunc
- Func _date_time_settimezoneinformation($ibias, $sstdname, $tstddate, $istdbias, $sdayname, $tdaydate, $idaybias)
- Local $tstdname = _winapi_multibytetowidechar($sstdname)
- Local $tdayname = _winapi_multibytetowidechar($sdayname)
- Local $tzoneinfo = DllStructCreate($tagtime_zone_information)
- DllStructSetData($tzoneinfo, "Bias", $ibias)
- DllStructSetData($tzoneinfo, "StdName", DllStructGetData($tstdname, 1))
- _memmovememory($tstddate, DllStructGetPtr($tzoneinfo, "StdDate"), DllStructGetSize($tstddate))
- DllStructSetData($tzoneinfo, "StdBias", $istdbias)
- DllStructSetData($tzoneinfo, "DayName", DllStructGetData($tdayname, 1))
- _memmovememory($tdaydate, DllStructGetPtr($tzoneinfo, "DayDate"), DllStructGetSize($tdaydate))
- DllStructSetData($tzoneinfo, "DayBias", $idaybias)
- Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
- If @error Then Return SetError(@error + 10, @extended, False)
- _security__setprivilege($htoken, "SeSystemtimePrivilege", True)
- Local $ierror = @error
- Local $ilasterror = @extended
- Local $iret = False
- If NOT @error Then
- Local $aresult = DllCall("kernel32.dll", "bool", "SetTimeZoneInformation", "struct*", $tzoneinfo)
- If @error Then
- $ierror = @error
- $ilasterror = @extended
- ElseIf $aresult[0] Then
- $ilasterror = 0
- $iret = True
- Else
- $ierror = 20
- $ilasterror = _winapi_getlasterror()
- EndIf
- _security__setprivilege($htoken, "SeSystemtimePrivilege", False)
- If NOT $ierror AND @error Then $ierror = 22
- EndIf
- _winapi_closehandle($htoken)
- Return SetError($ierror, $ilasterror, $iret)
- EndFunc
- Func _date_time_systemtimetoarray(ByRef $tsystemtime)
- Local $ainfo[8]
- $ainfo[0] = DllStructGetData($tsystemtime, "Month")
- $ainfo[1] = DllStructGetData($tsystemtime, "Day")
- $ainfo[2] = DllStructGetData($tsystemtime, "Year")
- $ainfo[3] = DllStructGetData($tsystemtime, "Hour")
- $ainfo[4] = DllStructGetData($tsystemtime, "Minute")
- $ainfo[5] = DllStructGetData($tsystemtime, "Second")
- $ainfo[6] = DllStructGetData($tsystemtime, "MSeconds")
- $ainfo[7] = DllStructGetData($tsystemtime, "DOW")
- Return $ainfo
- EndFunc
- Func _date_time_systemtimetodatestr(ByRef $tsystemtime, $bfmt = 0)
- Local $ainfo = _date_time_systemtimetoarray($tsystemtime)
- If @error Then Return SetError(@error, @extended, "")
- If $bfmt Then
- Return StringFormat("%04d/%02d/%02d", $ainfo[2], $ainfo[0], $ainfo[1])
- Else
- Return StringFormat("%02d/%02d/%04d", $ainfo[0], $ainfo[1], $ainfo[2])
- EndIf
- EndFunc
- Func _date_time_systemtimetodatetimestr(ByRef $tsystemtime, $bfmt = 0)
- Local $ainfo = _date_time_systemtimetoarray($tsystemtime)
- If @error Then Return SetError(@error, @extended, "")
- If $bfmt Then
- Return StringFormat("%04d/%02d/%02d %02d:%02d:%02d", $ainfo[2], $ainfo[0], $ainfo[1], $ainfo[3], $ainfo[4], $ainfo[5])
- Else
- Return StringFormat("%02d/%02d/%04d %02d:%02d:%02d", $ainfo[0], $ainfo[1], $ainfo[2], $ainfo[3], $ainfo[4], $ainfo[5])
- EndIf
- EndFunc
- Func _date_time_systemtimetofiletime($psystemtime)
- Local $tfiletime = DllStructCreate($tagfiletime)
- Local $aresult = DllCall("kernel32.dll", "bool", "SystemTimeToFileTime", "struct*", $psystemtime, "struct*", $tfiletime)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tfiletime)
- EndFunc
- Func _date_time_systemtimetotimestr(ByRef $tsystemtime)
- Local $ainfo = _date_time_systemtimetoarray($tsystemtime)
- Return StringFormat("%02d:%02d:%02d", $ainfo[3], $ainfo[4], $ainfo[5])
- EndFunc
- Func _date_time_systemtimetotzspecificlocaltime($putc, $ptimezone = 0)
- Local $tlocaltime = DllStructCreate($tagsystemtime)
- Local $aresult = DllCall("kernel32.dll", "bool", "SystemTimeToTzSpecificLocalTime", "ptr", $ptimezone, "ptr", $putc, "struct*", $tlocaltime)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tlocaltime)
- EndFunc
- Func _date_time_tzspecificlocaltimetosystemtime($plocaltime, $ptimezone = 0)
- Local $tutc = DllStructCreate($tagsystemtime)
- Local $aresult = DllCall("kernel32.dll", "ptr", "TzSpecificLocalTimeToSystemTime", "ptr", $ptimezone, "ptr", $plocaltime, "struct*", $tutc)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tutc)
- EndFunc
- Global $__ghwininet_ftp = -1
- Global $__ghcallback_ftp, $__gbcallback_set = False
- Global Const $internet_open_type_direct = 1
- Global Const $internet_open_type_preconfig = 0
- Global Const $internet_open_type_preconfig_with_no_autoproxy = 4
- Global Const $internet_open_type_proxy = 3
- Global Const $ftp_transfer_type_unknown = 0
- Global Const $ftp_transfer_type_ascii = 1
- Global Const $ftp_transfer_type_binary = 2
- Global Const $internet_flag_passive = 134217728
- Global Const $internet_flag_transfer_ascii = $ftp_transfer_type_ascii
- Global Const $internet_flag_transfer_binary = $ftp_transfer_type_binary
- Global Const $internet_default_ftp_port = 21
- Global Const $internet_service_ftp = 1
- Global Const $internet_flag_hyperlink = 1024
- Global Const $internet_flag_need_file = 16
- Global Const $internet_flag_no_cache_write = 67108864
- Global Const $internet_flag_reload = -2147483648
- Global Const $internet_flag_resynchronize = 2048
- Global Const $internet_flag_async = 268435456
- Global Const $internet_flag_from_cache = 16777216
- Global Const $internet_flag_offline = $internet_flag_from_cache
- Global Const $internet_status_closing_connection = 50
- Global Const $internet_status_connection_closed = 51
- Global Const $internet_status_connecting_to_server = 20
- Global Const $internet_status_connected_to_server = 21
- Global Const $internet_status_ctl_response_received = 42
- Global Const $internet_status_intermediate_response = 120
- Global Const $internet_status_prefetch = 43
- Global Const $internet_status_redirect = 110
- Global Const $internet_status_request_complete = 100
- Global Const $internet_status_handle_created = 60
- Global Const $internet_status_handle_closing = 70
- Global Const $internet_status_sending_request = 30
- Global Const $internet_status_request_sent = 31
- Global Const $internet_status_receiving_response = 40
- Global Const $internet_status_response_received = 41
- Global Const $internet_status_state_change = 200
- Global Const $internet_status_resolving_name = 10
- Global Const $internet_status_name_resolved = 11
- Func _ftp_close($l_internetsession)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $l_internetsession)
- If @error OR $ai_internetclosehandle[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- If $__gbcallback_set = True Then DllCallbackFree($__ghcallback_ftp)
- Return $ai_internetclosehandle[0]
- EndFunc
- Func _ftp_command($l_ftpsession, $s_ftpcommand, $l_flags = $ftp_transfer_type_ascii, $l_expectresponse = 0, $l_context = 0)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpcommand = DllCall($__ghwininet_ftp, "bool", "FtpCommandW", "handle", $l_ftpsession, "bool", $l_expectresponse, "dword", $l_flags, "wstr", $s_ftpcommand, "dword_ptr", $l_context, "ptr*", 0)
- If @error OR $ai_ftpcommand[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return SetError(0, $ai_ftpcommand[6], $ai_ftpcommand[0])
- EndFunc
- Func _ftp_connect($l_internetsession, $s_servername, $s_username, $s_password, $i_passive = 0, $i_serverport = 0, $l_service = $internet_service_ftp, $l_flags = 0, $l_context = 0)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- If $i_passive == 1 Then $l_flags = BitOR($l_flags, $internet_flag_passive)
- Local $ai_internetconnect = DllCall($__ghwininet_ftp, "hwnd", "InternetConnectW", "handle", $l_internetsession, "wstr", $s_servername, "ushort", $i_serverport, "wstr", $s_username, "wstr", $s_password, "dword", $l_service, "dword", $l_flags, "dword_ptr", $l_context)
- If @error OR $ai_internetconnect[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_internetconnect[0]
- EndFunc
- Func _ftp_decodeinternetstatus($dwinternetstatus)
- Switch $dwinternetstatus
- Case $internet_status_closing_connection
- Return "Closing connection ..."
- Case $internet_status_connection_closed
- Return "Connection closed"
- Case $internet_status_connecting_to_server
- Return "Connecting to server ..."
- Case $internet_status_connected_to_server
- Return "Connected to server"
- Case $internet_status_ctl_response_received
- Return "CTL esponse received"
- Case $internet_status_intermediate_response
- Return "Intermediate response"
- Case $internet_status_prefetch
- Return "Prefetch"
- Case $internet_status_redirect
- Return "Redirect"
- Case $internet_status_request_complete
- Return "Request complete"
- Case $internet_status_handle_created
- Return "Handle created"
- Case $internet_status_handle_closing
- Return "Handle closing ..."
- Case $internet_status_sending_request
- Return "Sending request ..."
- Case $internet_status_request_sent
- Return "Request sent"
- Case $internet_status_receiving_response
- Return "Receiving response ..."
- Case $internet_status_response_received
- Return "Response received"
- Case $internet_status_state_change
- Return "State change"
- Case $internet_status_resolving_name
- Return "Resolving name ..."
- Case $internet_status_name_resolved
- Return "Name resolved"
- Case Else
- Return "UNKNOWN status = " & $dwinternetstatus
- EndSwitch
- EndFunc
- Func _ftp_dircreate($l_ftpsession, $s_remote)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpmakedir = DllCall($__ghwininet_ftp, "bool", "FtpCreateDirectoryW", "handle", $l_ftpsession, "wstr", $s_remote)
- If @error OR $ai_ftpmakedir[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpmakedir[0]
- EndFunc
- Func _ftp_dirdelete($l_ftpsession, $s_remote)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpdeldir = DllCall($__ghwininet_ftp, "bool", "FtpRemoveDirectoryW", "handle", $l_ftpsession, "wstr", $s_remote)
- If @error OR $ai_ftpdeldir[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpdeldir[0]
- EndFunc
- Func _ftp_dirgetcurrent($l_ftpsession)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpgetcurrentdir = DllCall($__ghwininet_ftp, "bool", "FtpGetCurrentDirectoryW", "handle", $l_ftpsession, "wstr", "", "dword*", 260)
- If @error OR $ai_ftpgetcurrentdir[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpgetcurrentdir[2]
- EndFunc
- Func _ftp_dirputcontents($l_internetsession, $s_localfolder, $s_remotefolder, $b_recursiveput, $l_context = 0)
- If StringRight($s_localfolder, 1) == "\" Then $s_localfolder = StringTrimRight($s_localfolder, 1)
- Local $search = FileFindFirstFile($s_localfolder & "\*.*")
- If $search = -1 Then Return SetError(1, 0, 0)
- Local $file
- While 1
- $file = FileFindNextFile($search)
- If @error Then ExitLoop
- If StringInStr(FileGetAttrib($s_localfolder & "\" & $file), "D") Then
- _ftp_dircreate($l_internetsession, $s_remotefolder & "/" & $file)
- If $b_recursiveput Then
- _ftp_dirputcontents($l_internetsession, $s_localfolder & "\" & $file, $s_remotefolder & "/" & $file, $b_recursiveput, $l_context)
- EndIf
- Else
- _ftp_fileput($l_internetsession, $s_localfolder & "\" & $file, $s_remotefolder & "/" & $file, 0, $l_context)
- EndIf
- WEnd
- FileClose($search)
- Return 1
- EndFunc
- Func _ftp_dirsetcurrent($l_ftpsession, $s_remote)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpsetcurrentdir = DllCall($__ghwininet_ftp, "bool", "FtpSetCurrentDirectoryW", "handle", $l_ftpsession, "wstr", $s_remote)
- If @error OR $ai_ftpsetcurrentdir[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpsetcurrentdir[0]
- EndFunc
- Func _ftp_fileclose($l_internetsession)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $l_internetsession)
- If @error OR $ai_internetclosehandle[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_internetclosehandle[0]
- EndFunc
- Func _ftp_filedelete($l_ftpsession, $s_remotefile)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpputfile = DllCall($__ghwininet_ftp, "bool", "FtpDeleteFileW", "handle", $l_ftpsession, "wstr", $s_remotefile)
- If @error OR $ai_ftpputfile[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpputfile[0]
- EndFunc
- Func _ftp_fileget($l_ftpsession, $s_remotefile, $s_localfile, $ffailifexists = False, $dwflagsandattributes = 0, $l_flags = $ftp_transfer_type_unknown, $l_context = 0)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpgetfile = DllCall($__ghwininet_ftp, "bool", "FtpGetFileW", "handle", $l_ftpsession, "wstr", $s_remotefile, "wstr", $s_localfile, "bool", $ffailifexists, "dword", $dwflagsandattributes, "dword", $l_flags, "dword_ptr", $l_context)
- If @error OR $ai_ftpgetfile[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpgetfile[0]
- EndFunc
- Func _ftp_filegetsize($l_ftpsession, $s_filename)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpgetsizehandle = DllCall($__ghwininet_ftp, "handle", "FtpOpenFileW", "handle", $l_ftpsession, "wstr", $s_filename, "dword", $generic_read, "dword", $internet_flag_no_cache_write + $internet_flag_transfer_binary, "dword_ptr", 0)
- If @error OR $ai_ftpgetsizehandle[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Local $ai_ftpgetfilesize = DllCall($__ghwininet_ftp, "dword", "FtpGetFileSize", "handle", $ai_ftpgetsizehandle[0], "dword*", 0)
- If @error OR $ai_ftpgetfilesize[0] = 0 Then
- Local $lasterror = _winapi_getlasterror()
- DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpgetsizehandle[0])
- Return SetError(-1, $lasterror, 0)
- EndIf
- DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpgetsizehandle[0])
- Return _winapi_makeqword($ai_ftpgetfilesize[0], $ai_ftpgetfilesize[2])
- EndFunc
- Func _ftp_fileopen($hconnect, $lpszfilename, $dwaccess = $generic_read, $dwflags = $internet_flag_transfer_binary, $dwcontext = 0)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpopenfile = DllCall($__ghwininet_ftp, "handle", "FtpOpenFileW", "handle", $hconnect, "wstr", $lpszfilename, "dword", $dwaccess, "dword", $dwflags, "dword_ptr", $dwcontext)
- If @error OR $ai_ftpopenfile[0] == 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpopenfile[0]
- EndFunc
- Func _ftp_fileput($l_ftpsession, $s_localfile, $s_remotefile, $l_flags = 0, $l_context = 0)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpputfile = DllCall($__ghwininet_ftp, "bool", "FtpPutFileW", "handle", $l_ftpsession, "wstr", $s_localfile, "wstr", $s_remotefile, "dword", $l_flags, "dword_ptr", $l_context)
- If @error OR $ai_ftpputfile[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftpputfile[0]
- EndFunc
- Func _ftp_fileread($h_file, $dwnumberofbytestoread)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $lpbuffer = DllStructCreate("byte[" & $dwnumberofbytestoread & "]")
- Local $ai_ftpreadfile = DllCall($__ghwininet_ftp, "bool", "InternetReadFile", "handle", $h_file, "struct*", $lpbuffer, "dword", $dwnumberofbytestoread, "dword*", 0)
- If @error Then Return SetError(1, _winapi_getlasterror(), 0)
- Local $lpdwnumberofbytesread = $ai_ftpreadfile[4]
- If $lpdwnumberofbytesread == 0 AND $ai_ftpreadfile[0] == 1 Then
- Return SetError(-1, 0, 0)
- ElseIf $ai_ftpreadfile[0] == 0 Then
- Return SetError(2, _winapi_getlasterror(), 0)
- EndIf
- Local $s_fileread
- If $dwnumberofbytestoread > $lpdwnumberofbytesread Then
- $s_fileread = BinaryMid(DllStructGetData($lpbuffer, 1), 1, $lpdwnumberofbytesread)
- Else
- $s_fileread = DllStructGetData($lpbuffer, 1)
- EndIf
- Return SetError(0, $lpdwnumberofbytesread, $s_fileread)
- EndFunc
- Func _ftp_filerename($l_ftpsession, $s_existing, $s_new)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftprenamefile = DllCall($__ghwininet_ftp, "bool", "FtpRenameFileW", "handle", $l_ftpsession, "wstr", $s_existing, "wstr", $s_new)
- If @error OR $ai_ftprenamefile[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_ftprenamefile[0]
- EndFunc
- Func _ftp_filetimelohitostr($lodword, $hidword, $bfmt = 0)
- Local $tfiletime = DllStructCreate($tagfiletime)
- If NOT $lodword AND NOT $hidword Then Return SetError(1, 0, "")
- DllStructSetData($tfiletime, 1, $lodword)
- DllStructSetData($tfiletime, 2, $hidword)
- Local $date = _date_time_filetimetostr($tfiletime, $bfmt)
- Return SetError(@error, @extended, $date)
- EndFunc
- Func _ftp_findfileclose($h_handle)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $ai_ftpputfile = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $h_handle)
- If @error OR $ai_ftpputfile[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), "")
- Return $ai_ftpputfile[0]
- EndFunc
- Func _ftp_findfilefirst($l_ftpsession, $s_remotepath, ByRef $h_handle, $l_flags = 0, $l_context = 0)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $l_dllstruct = DllStructCreate($tagwin32_find_data)
- If @error Then Return SetError(-3, 0, "")
- Local $a_ftpfilelist[1]
- $a_ftpfilelist[0] = 0
- Local $ai_ftpfirstfile = DllCall($__ghwininet_ftp, "handle", "FtpFindFirstFileW", "handle", $l_ftpsession, "wstr", $s_remotepath, "struct*", $l_dllstruct, "dword", $l_flags, "dword_ptr", $l_context)
- If @error OR $ai_ftpfirstfile[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), $ai_ftpfirstfile)
- $h_handle = $ai_ftpfirstfile[0]
- Local $a_ftpfilelist[12]
- $a_ftpfilelist[0] = 11
- $a_ftpfilelist[1] = DllStructGetData($l_dllstruct, "dwFileAttributes")
- $a_ftpfilelist[2] = DllStructGetData($l_dllstruct, "ftCreationTime", 1)
- $a_ftpfilelist[3] = DllStructGetData($l_dllstruct, "ftCreationTime", 2)
- $a_ftpfilelist[4] = DllStructGetData($l_dllstruct, "ftLastAccessTime", 1)
- $a_ftpfilelist[5] = DllStructGetData($l_dllstruct, "ftLastAccessTime", 2)
- $a_ftpfilelist[6] = DllStructGetData($l_dllstruct, "ftLastWriteTime", 1)
- $a_ftpfilelist[7] = DllStructGetData($l_dllstruct, "ftLastWriteTime", 2)
- $a_ftpfilelist[8] = DllStructGetData($l_dllstruct, "nFileSizeHigh")
- $a_ftpfilelist[9] = DllStructGetData($l_dllstruct, "nFileSizeLow")
- $a_ftpfilelist[10] = DllStructGetData($l_dllstruct, "cFileName")
- $a_ftpfilelist[11] = DllStructGetData($l_dllstruct, "cAlternateFileName")
- Return $a_ftpfilelist
- EndFunc
- Func _ftp_findfilenext($h_handle)
- Local $l_dllstruct = DllStructCreate($tagwin32_find_data)
- Local $a_ftpfilelist[1]
- $a_ftpfilelist[0] = 0
- Local $ai_ftpputfile = DllCall($__ghwininet_ftp, "bool", "InternetFindNextFileW", "handle", $h_handle, "struct*", $l_dllstruct)
- If @error OR $ai_ftpputfile[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), $a_ftpfilelist)
- Local $a_ftpfilelist[12]
- $a_ftpfilelist[0] = 11
- $a_ftpfilelist[1] = DllStructGetData($l_dllstruct, "dwFileAttributes")
- $a_ftpfilelist[2] = DllStructGetData($l_dllstruct, "ftCreationTime", 1)
- $a_ftpfilelist[3] = DllStructGetData($l_dllstruct, "ftCreationTime", 2)
- $a_ftpfilelist[4] = DllStructGetData($l_dllstruct, "ftLastAccessTime", 1)
- $a_ftpfilelist[5] = DllStructGetData($l_dllstruct, "ftLastAccessTime", 2)
- $a_ftpfilelist[6] = DllStructGetData($l_dllstruct, "ftLastWriteTime", 1)
- $a_ftpfilelist[7] = DllStructGetData($l_dllstruct, "ftLastWriteTime", 2)
- $a_ftpfilelist[8] = DllStructGetData($l_dllstruct, "nFileSizeHigh")
- $a_ftpfilelist[9] = DllStructGetData($l_dllstruct, "nFileSizeLow")
- $a_ftpfilelist[10] = DllStructGetData($l_dllstruct, "cFileName")
- $a_ftpfilelist[11] = DllStructGetData($l_dllstruct, "cAlternateFileName")
- Return $a_ftpfilelist
- EndFunc
- Func _ftp_getlastresponseinfo(ByRef $dwerror, ByRef $szmessage)
- Local $ai_lastresponseinfo = DllCall($__ghwininet_ftp, "bool", "InternetGetLastResponseInfoW", "dword*", 0, "wstr", "", "dword*", 4096)
- If @error OR $ai_lastresponseinfo[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- $dwerror = $ai_lastresponseinfo[1]
- $szmessage = $ai_lastresponseinfo[2]
- Return $ai_lastresponseinfo[0]
- EndFunc
- Func _ftp_listtoarray($l_ftpsession, $return_type = 0, $l_flags = $internet_flag_no_cache_write, $l_context = 0)
- Local $aarray[1]
- $aarray[0] = 0
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, $aarray)
- $aarray = __ftp_listtoarray($l_ftpsession, $return_type, $l_flags, 0, 1, $l_context)
- Return SetError(@error, @extended, $aarray)
- EndFunc
- Func _ftp_listtoarray2d($l_ftpsession, $return_type = 0, $l_flags = $internet_flag_no_cache_write, $l_context = 0)
- Local $aarray[1][1]
- $aarray[0][0] = 0
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, $aarray)
- $aarray = __ftp_listtoarray($l_ftpsession, $return_type, $l_flags, 0, 2, $l_context)
- Return SetError(@error, @extended, $aarray)
- EndFunc
- Func _ftp_listtoarrayex($l_ftpsession, $return_type = 0, $l_flags = $internet_flag_no_cache_write, $b_fmt = 1, $l_context = 0)
- Local $aarray[1][1]
- $aarray[0][0] = 0
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, $aarray)
- $aarray = __ftp_listtoarray($l_ftpsession, $return_type, $l_flags, $b_fmt, 6, $l_context)
- Return SetError(@error, @extended, $aarray)
- EndFunc
- Func _ftp_open($s_agent, $l_accesstype = $internet_open_type_direct, $s_proxyname = "", $s_proxybypass = "", $l_flags = 0)
- If $__ghwininet_ftp = -1 Then __ftp_init()
- Local $ai_internetopen = DllCall($__ghwininet_ftp, "handle", "InternetOpenW", "wstr", $s_agent, "dword", $l_accesstype, "wstr", $s_proxyname, "wstr", $s_proxybypass, "dword", $l_flags)
- If @error OR $ai_internetopen[0] = 0 Then Return SetError(-1, _winapi_getlasterror(), 0)
- Return $ai_internetopen[0]
- EndFunc
- Func _ftp_progressdownload($l_ftpsession, $s_localfile, $s_remotefile, $functiontocall = "")
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $fhandle = FileOpen($s_localfile, $fo_overwrite + $fo_binary)
- If $fhandle < 0 Then Return SetError(-1, 0, 0)
- Local $ai_ftpopenfile = DllCall($__ghwininet_ftp, "handle", "FtpOpenFileW", "handle", $l_ftpsession, "wstr", $s_remotefile, "dword", $generic_read, "dword", $ftp_transfer_type_binary, "dword_ptr", 0)
- If @error OR $ai_ftpopenfile[0] = 0 Then Return SetError(-3, _winapi_getlasterror(), 0)
- Local $ai_ftpgetfilesize = DllCall($__ghwininet_ftp, "dword", "FtpGetFileSize", "handle", $ai_ftpopenfile[0], "dword*", 0)
- If @error Then Return SetError(-2, _winapi_getlasterror(), 0)
- If $functiontocall = "" Then ProgressOn("FTP Download", "Downloading " & $s_localfile)
- Local $glen = _winapi_makeqword($ai_ftpgetfilesize[0], $ai_ftpgetfilesize[2])
- Local Const $chunksize = 256 * 1024
- Local $last = Mod($glen, $chunksize)
- Local $parts = Ceiling($glen / $chunksize)
- Local $buffer = DllStructCreate("byte[" & $chunksize & "]")
- Local $ai_internetclosehandle, $ai_ftpread, $out, $ret, $lasterror
- Local $x = $chunksize
- Local $done = 0
- For $i = 1 To $parts
- If $i = $parts AND $last > 0 Then
- $x = $last
- EndIf
- $ai_ftpread = DllCall($__ghwininet_ftp, "bool", "InternetReadFile", "handle", $ai_ftpopenfile[0], "struct*", $buffer, "dword", $x, "dword*", $out)
- If @error OR $ai_ftpread[0] = 0 Then
- $lasterror = _winapi_getlasterror()
- $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpopenfile[0])
- FileClose($fhandle)
- If $functiontocall = "" Then ProgressOff()
- Return SetError(-4, $lasterror, 0)
- EndIf
- $ret = FileWrite($fhandle, BinaryMid(DllStructGetData($buffer, 1), 1, $ai_ftpread[4]))
- If NOT $ret Then
- $lasterror = _winapi_getlasterror()
- $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpopenfile[0])
- FileClose($fhandle)
- FileDelete($s_localfile)
- If $functiontocall = "" Then ProgressOff()
- Return SetError(-7, $lasterror, 0)
- EndIf
- $done += $ai_ftpread[4]
- If $functiontocall = "" Then
- ProgressSet(($done / $glen) * 100)
- Else
- $ret = Call($functiontocall, ($done / $glen) * 100)
- If $ret <= 0 Then
- $lasterror = @error
- $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpopenfile[0])
- FileClose($fhandle)
- FileDelete($s_localfile)
- If $functiontocall = "" Then ProgressOff()
- Return SetError(-6, $lasterror, $ret)
- EndIf
- EndIf
- Sleep(10)
- Next
- FileClose($fhandle)
- If $functiontocall = "" Then ProgressOff()
- $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpopenfile[0])
- If @error OR $ai_internetclosehandle[0] = 0 Then
- Return SetError(-5, _winapi_getlasterror(), 0)
- EndIf
- Return 1
- EndFunc
- Func _ftp_progressupload($l_ftpsession, $s_localfile, $s_remotefile, $functiontocall = "")
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $fhandle = FileOpen($s_localfile, $fo_binary)
- If @error Then Return SetError(-1, _winapi_getlasterror(), 0)
- Local $ai_ftpopenfile = DllCall($__ghwininet_ftp, "handle", "FtpOpenFileW", "handle", $l_ftpsession, "wstr", $s_remotefile, "dword", $generic_write, "dword", $ftp_transfer_type_binary, "dword_ptr", 0)
- If @error OR $ai_ftpopenfile[0] = 0 Then Return SetError(-3, _winapi_getlasterror(), 0)
- If $functiontocall = "" Then ProgressOn("FTP Upload", "Uploading " & $s_localfile)
- Local $glen = FileGetSize($s_localfile)
- Local Const $chunksize = 256 * 1024
- Local $last = Mod($glen, $chunksize)
- Local $parts = Ceiling($glen / $chunksize)
- Local $buffer = DllStructCreate("byte[" & $chunksize & "]")
- Local $ai_internetclosehandle, $ai_ftpwrite, $out, $ret, $lasterror
- Local $x = $chunksize
- Local $done = 0
- For $i = 1 To $parts
- If $i = $parts AND $last > 0 Then
- $x = $last
- EndIf
- DllStructSetData($buffer, 1, FileRead($fhandle, $x))
- $ai_ftpwrite = DllCall($__ghwininet_ftp, "bool", "InternetWriteFile", "handle", $ai_ftpopenfile[0], "struct*", $buffer, "dword", $x, "dword*", $out)
- If @error OR $ai_ftpwrite[0] = 0 Then
- $lasterror = _winapi_getlasterror()
- $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpopenfile[0])
- FileClose($fhandle)
- If $functiontocall = "" Then ProgressOff()
- Return SetError(-4, $lasterror, 0)
- EndIf
- $done += $x
- If $functiontocall = "" Then
- ProgressSet(($done / $glen) * 100)
- Else
- $ret = Call($functiontocall, ($done / $glen) * 100)
- If $ret <= 0 Then
- $lasterror = @error
- $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpopenfile[0])
- DllCall($__ghwininet_ftp, "bool", "FtpDeleteFileW", "handle", $l_ftpsession, "wstr", $s_remotefile)
- FileClose($fhandle)
- If $functiontocall = "" Then ProgressOff()
- Return SetError(-6, $lasterror, $ret)
- EndIf
- EndIf
- Sleep(10)
- Next
- FileClose($fhandle)
- If $functiontocall = "" Then ProgressOff()
- $ai_internetclosehandle = DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $ai_ftpopenfile[0])
- If @error OR $ai_internetclosehandle[0] = 0 Then Return SetError(-5, _winapi_getlasterror(), 0)
- Return 1
- EndFunc
- Func _ftp_setstatuscallback($l_internetsession, $sfunctionname)
- If $__ghwininet_ftp = -1 Then Return SetError(-2, 0, 0)
- Local $callback_register = DllCallbackRegister($sfunctionname, "none", "ptr;ptr;dword;ptr;dword")
- If NOT $callback_register Then Return SetError(-1, 0, 0)
- Local $ah_callbackfunction = DllCall("wininet.dll", "ptr", "InternetSetStatusCallback", "ptr", $l_internetsession, "ulong_ptr", DllCallbackGetPtr($callback_register))
- If @error Then Return SetError(-3, 0, 0)
- If $ah_callbackfunction[0] = Ptr(-1) Then Return SetError(-4, 0, 0)
- $__gbcallback_set = True
- $__ghcallback_ftp = $callback_register
- Return $ah_callbackfunction[1]
- EndFunc
- Func __ftp_listtoarray($l_ftpsession, $return_type, $l_flags, $bfmt, $arraycount, $l_context)
- If $arraycount = 1 Then
- Local $filearray[1], $directoryarray[1]
- $filearray[0] = 0
- Else
- Local $filearray[1][$arraycount], $directoryarray[1][$arraycount]
- $filearray[0][0] = 0
- EndIf
- If $return_type < 0 OR $return_type > 2 Then Return SetError(3, 0, $filearray)
- Local $twin32_find_data = DllStructCreate($tagwin32_find_data)
- Local $lasterror
- Local $callfindfirst = DllCall($__ghwininet_ftp, "handle", "FtpFindFirstFileW", "handle", $l_ftpsession, "wstr", "", "struct*", $twin32_find_data, "dword", $l_flags, "dword_ptr", $l_context)
- If @error OR NOT $callfindfirst[0] Then
- $lasterror = _winapi_getlasterror()
- If $lasterror = 12003 Then
- Local $dwerror, $szmessage
- _ftp_getlastresponseinfo($dwerror, $szmessage)
- $lasterror = $dwerror
- EndIf
- Return SetError(1, $lasterror, $filearray)
- EndIf
- Local $directoryindex = 0, $fileindex = 0
- Local $tfiletime, $isdir, $callfindnext
- Do
- $isdir = BitAND(DllStructGetData($twin32_find_data, "dwFileAttributes"), $file_attribute_directory) = $file_attribute_directory
- If $isdir AND ($return_type <> 2) Then
- $directoryindex += 1
- If $arraycount = 1 Then
- If UBound($directoryarray) < $directoryindex + 1 Then ReDim $directoryarray[$directoryindex * 2]
- $directoryarray[$directoryindex] = DllStructGetData($twin32_find_data, "cFileName")
- Else
- If UBound($directoryarray) < $directoryindex + 1 Then ReDim $directoryarray[$directoryindex * 2][$arraycount]
- $directoryarray[$directoryindex][0] = DllStructGetData($twin32_find_data, "cFileName")
- $directoryarray[$directoryindex][1] = _winapi_makeqword(DllStructGetData($twin32_find_data, "nFileSizeLow"), DllStructGetData($twin32_find_data, "nFileSizeHigh"))
- If $arraycount = 6 Then
- $directoryarray[$directoryindex][2] = DllStructGetData($twin32_find_data, "dwFileAttributes")
- $tfiletime = DllStructCreate($tagfiletime, DllStructGetPtr($twin32_find_data, "ftLastWriteTime"))
- $directoryarray[$directoryindex][3] = _date_time_filetimetostr($tfiletime, $bfmt)
- $tfiletime = DllStructCreate($tagfiletime, DllStructGetPtr($twin32_find_data, "ftCreationTime"))
- $directoryarray[$directoryindex][4] = _date_time_filetimetostr($tfiletime, $bfmt)
- $tfiletime = DllStructCreate($tagfiletime, DllStructGetPtr($twin32_find_data, "ftLastAccessTime"))
- $directoryarray[$directoryindex][5] = _date_time_filetimetostr($tfiletime, $bfmt)
- EndIf
- EndIf
- ElseIf NOT $isdir AND $return_type <> 1 Then
- $fileindex += 1
- If $arraycount = 1 Then
- If UBound($filearray) < $fileindex + 1 Then ReDim $filearray[$fileindex * 2]
- $filearray[$fileindex] = DllStructGetData($twin32_find_data, "cFileName")
- Else
- If UBound($filearray) < $fileindex + 1 Then ReDim $filearray[$fileindex * 2][$arraycount]
- $filearray[$fileindex][0] = DllStructGetData($twin32_find_data, "cFileName")
- $filearray[$fileindex][1] = _winapi_makeqword(DllStructGetData($twin32_find_data, "nFileSizeLow"), DllStructGetData($twin32_find_data, "nFileSizeHigh"))
- If $arraycount = 6 Then
- $filearray[$fileindex][2] = DllStructGetData($twin32_find_data, "dwFileAttributes")
- $tfiletime = DllStructCreate($tagfiletime, DllStructGetPtr($twin32_find_data, "ftLastWriteTime"))
- $filearray[$fileindex][3] = _date_time_filetimetostr($tfiletime, $bfmt)
- $tfiletime = DllStructCreate($tagfiletime, DllStructGetPtr($twin32_find_data, "ftCreationTime"))
- $filearray[$fileindex][4] = _date_time_filetimetostr($tfiletime, $bfmt)
- $tfiletime = DllStructCreate($tagfiletime, DllStructGetPtr($twin32_find_data, "ftLastAccessTime"))
- $filearray[$fileindex][5] = _date_time_filetimetostr($tfiletime, $bfmt)
- EndIf
- EndIf
- EndIf
- $callfindnext = DllCall($__ghwininet_ftp, "bool", "InternetFindNextFileW", "handle", $callfindfirst[0], "struct*", $twin32_find_data)
- If @error Then
- $lasterror = _winapi_getlasterror()
- DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $callfindfirst[0])
- Return SetError(2, $lasterror, $filearray)
- EndIf
- Until NOT $callfindnext[0]
- DllCall($__ghwininet_ftp, "bool", "InternetCloseHandle", "handle", $callfindfirst[0])
- If $arraycount = 1 Then
- $directoryarray[0] = $directoryindex
- $filearray[0] = $fileindex
- Else
- $directoryarray[0][0] = $directoryindex
- $filearray[0][0] = $fileindex
- EndIf
- Switch $return_type
- Case 0
- If $arraycount = 1 Then
- ReDim $directoryarray[$directoryarray[0] + $filearray[0] + 1]
- For $i = 1 To $fileindex
- $directoryarray[$directoryarray[0] + $i] = $filearray[$i]
- Next
- $directoryarray[0] += $filearray[0]
- Else
- ReDim $directoryarray[$directoryarray[0][0] + $filearray[0][0] + 1][$arraycount]
- For $i = 1 To $fileindex
- For $j = 0 To $arraycount - 1
- $directoryarray[$directoryarray[0][0] + $i][$j] = $filearray[$i][$j]
- Next
- Next
- $directoryarray[0][0] += $filearray[0][0]
- EndIf
- Return $directoryarray
- Case 1
- If $arraycount = 1 Then
- ReDim $directoryarray[$directoryindex + 1]
- Else
- ReDim $directoryarray[$directoryindex + 1][$arraycount]
- EndIf
- Return $directoryarray
- Case 2
- If $arraycount = 1 Then
- ReDim $filearray[$fileindex + 1]
- Else
- ReDim $filearray[$fileindex + 1][$arraycount]
- EndIf
- Return $filearray
- EndSwitch
- EndFunc
- Func __ftp_init()
- $__ghwininet_ftp = DllOpen("wininet.dll")
- EndFunc
- Global Const $fw_dontcare = 0
- Global Const $fw_thin = 100
- Global Const $fw_extralight = 200
- Global Const $fw_ultralight = 200
- Global Const $fw_light = 300
- Global Const $fw_normal = 400
- Global Const $fw_regular = 400
- Global Const $fw_medium = 500
- Global Const $fw_semibold = 600
- Global Const $fw_demibold = 600
- Global Const $fw_bold = 700
- Global Const $fw_extrabold = 800
- Global Const $fw_ultrabold = 800
- Global Const $fw_heavy = 900
- Global Const $fw_black = 900
- Global Const $cf_effects = 256
- Global Const $cf_printerfonts = 2
- Global Const $cf_screenfonts = 1
- Global Const $cf_noscriptsel = 8388608
- Global Const $cf_inittologfontstruct = 64
- Global Const $logpixelsx = 88
- Global Const $logpixelsy = 90
- Global Const $ansi_charset = 0
- Global Const $arabic_charset = 178
- Global Const $baltic_charset = 186
- Global Const $chinesebig5_charset = 136
- Global Const $default_charset = 1
- Global Const $easteurope_charset = 238
- Global Const $gb2312_charset = 134
- Global Const $greek_charset = 161
- Global Const $hangeul_charset = 129
- Global Const $hebrew_charset = 177
- Global Const $johab_charset = 130
- Global Const $mac_charset = 77
- Global Const $oem_charset = 255
- Global Const $russian_charset = 204
- Global Const $shiftjis_charset = 128
- Global Const $symbol_charset = 2
- Global Const $thai_charset = 222
- Global Const $turkish_charset = 162
- Global Const $vietnamese_charset = 163
- Global Const $out_character_precis = 2
- Global Const $out_default_precis = 0
- Global Const $out_device_precis = 5
- Global Const $out_outline_precis = 8
- Global Const $out_ps_only_precis = 10
- Global Const $out_raster_precis = 6
- Global Const $out_string_precis = 1
- Global Const $out_stroke_precis = 3
- Global Const $out_tt_only_precis = 7
- Global Const $out_tt_precis = 4
- Global Const $clip_character_precis = 1
- Global Const $clip_default_precis = 0
- Global Const $clip_dfa_disable = 48
- Global Const $clip_embedded = 128
- Global Const $clip_lh_angles = 16
- Global Const $clip_mask = 15
- Global Const $clip_dfa_override = 64
- Global Const $clip_stroke_precis = 2
- Global Const $clip_tt_always = 32
- Global Const $antialiased_quality = 4
- Global Const $default_quality = 0
- Global Const $draft_quality = 1
- Global Const $nonantialiased_quality = 3
- Global Const $proof_quality = 2
- Global Const $cleartype_quality = 5
- Global Const $default_pitch = 0
- Global Const $fixed_pitch = 1
- Global Const $variable_pitch = 2
- Global Const $ff_decorative = 80
- Global Const $ff_dontcare = 0
- Global Const $ff_modern = 48
- Global Const $ff_roman = 16
- Global Const $ff_script = 64
- Global Const $ff_swiss = 32
- Global Const $fs_regular = 0
- Global Const $fs_bold = 1
- Global Const $fs_italic = 2
- Global Const $__miscconstant_cc_anycolor = 256
- Global Const $__miscconstant_cc_fullopen = 2
- Global Const $__miscconstant_cc_rgbinit = 1
- Global Const $tagchoosecolor = "dword Size;hwnd hWndOwnder;handle hInstance;dword rgbResult;ptr CustColors;dword Flags;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName"
- Global Const $tagchoosefont = "dword Size;hwnd hWndOwner;handle hDC;ptr LogFont;int PointSize;dword Flags;dword rgbColors;lparam CustData;" & "ptr fnHook;ptr TemplateName;handle hInstance;ptr szStyle;word FontType;int SizeMin;int SizeMax"
- Func _choosecolor($ireturntype = 0, $icolorref = 0, $ireftype = 0, $hwndownder = 0)
- Local $custcolors = "dword[16]"
- Local $tchoose = DllStructCreate($tagchoosecolor)
- Local $tcc = DllStructCreate($custcolors)
- If $ireftype = 1 Then
- $icolorref = Int($icolorref)
- ElseIf $ireftype = 2 Then
- $icolorref = Hex(String($icolorref), 6)
- $icolorref = "0x" & StringMid($icolorref, 5, 2) & StringMid($icolorref, 3, 2) & StringMid($icolorref, 1, 2)
- EndIf
- DllStructSetData($tchoose, "Size", DllStructGetSize($tchoose))
- DllStructSetData($tchoose, "hWndOwnder", $hwndownder)
- DllStructSetData($tchoose, "rgbResult", $icolorref)
- DllStructSetData($tchoose, "CustColors", DllStructGetPtr($tcc))
- DllStructSetData($tchoose, "Flags", BitOR($__miscconstant_cc_anycolor, $__miscconstant_cc_fullopen, $__miscconstant_cc_rgbinit))
- Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseColor", "struct*", $tchoose)
- If @error Then Return SetError(@error, @extended, -1)
- If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
- Local $color_picked = DllStructGetData($tchoose, "rgbResult")
- If $ireturntype = 1 Then
- Return "0x" & Hex(String($color_picked), 6)
- ElseIf $ireturntype = 2 Then
- $color_picked = Hex(String($color_picked), 6)
- Return "0x" & StringMid($color_picked, 5, 2) & StringMid($color_picked, 3, 2) & StringMid($color_picked, 1, 2)
- ElseIf $ireturntype = 0 Then
- Return $color_picked
- Else
- Return SetError(-4, -4, -1)
- EndIf
- EndFunc
- Func _choosefont($sfontname = "Courier New", $ipointsize = 10, $icolorref = 0, $ifontweight = 0, $iitalic = False, $iunderline = False, $istrikethru = False, $hwndowner = 0)
- Local $italic = 0, $underline = 0, $strikeout = 0
- Local $lngdc = __misc_getdc(0)
- Local $lfheight = Round(($ipointsize * __misc_getdevicecaps($lngdc, $logpixelsx)) / 72, 0)
- __misc_releasedc(0, $lngdc)
- Local $tchoosefont = DllStructCreate($tagchoosefont)
- Local $tlogfont = DllStructCreate($taglogfont)
- DllStructSetData($tchoosefont, "Size", DllStructGetSize($tchoosefont))
- DllStructSetData($tchoosefont, "hWndOwner", $hwndowner)
- DllStructSetData($tchoosefont, "LogFont", DllStructGetPtr($tlogfont))
- DllStructSetData($tchoosefont, "PointSize", $ipointsize)
- DllStructSetData($tchoosefont, "Flags", BitOR($cf_screenfonts, $cf_printerfonts, $cf_effects, $cf_inittologfontstruct, $cf_noscriptsel))
- DllStructSetData($tchoosefont, "rgbColors", $icolorref)
- DllStructSetData($tchoosefont, "FontType", 0)
- DllStructSetData($tlogfont, "Height", $lfheight)
- DllStructSetData($tlogfont, "Weight", $ifontweight)
- DllStructSetData($tlogfont, "Italic", $iitalic)
- DllStructSetData($tlogfont, "Underline", $iunderline)
- DllStructSetData($tlogfont, "Strikeout", $istrikethru)
- DllStructSetData($tlogfont, "FaceName", $sfontname)
- Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseFontW", "struct*", $tchoosefont)
- If @error Then Return SetError(@error, @extended, -1)
- If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
- Local $fontname = DllStructGetData($tlogfont, "FaceName")
- If StringLen($fontname) = 0 AND StringLen($sfontname) > 0 Then $fontname = $sfontname
- If DllStructGetData($tlogfont, "Italic") Then $italic = 2
- If DllStructGetData($tlogfont, "Underline") Then $underline = 4
- If DllStructGetData($tlogfont, "Strikeout") Then $strikeout = 8
- Local $attributes = BitOR($italic, $underline, $strikeout)
- Local $size = DllStructGetData($tchoosefont, "PointSize") / 10
- Local $colorref = DllStructGetData($tchoosefont, "rgbColors")
- Local $weight = DllStructGetData($tlogfont, "Weight")
- Local $color_picked = Hex(String($colorref), 6)
- Return StringSplit($attributes & "," & $fontname & "," & $size & "," & $weight & "," & $colorref & "," & "0x" & $color_picked & "," & "0x" & StringMid($color_picked, 5, 2) & StringMid($color_picked, 3, 2) & StringMid($color_picked, 1, 2), ",")
- EndFunc
- Func _clipputfile($sfile, $sseparator = "|")
- Local Const $gmem_moveable = 2, $cf_hdrop = 15
- $sfile &= $sseparator & $sseparator
- Local $nglobmemsize = 2 * (StringLen($sfile) + 20)
- Local $aresult = DllCall("user32.dll", "bool", "OpenClipboard", "hwnd", 0)
- If @error OR $aresult[0] = 0 Then Return SetError(1, _winapi_getlasterror(), False)
- Local $ierror = 0, $ilasterror = 0
- $aresult = DllCall("user32.dll", "bool", "EmptyClipboard")
- If @error OR NOT $aresult[0] Then
- $ierror = 2
- $ilasterror = _winapi_getlasterror()
- Else
- $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $gmem_moveable, "ulong_ptr", $nglobmemsize)
- If @error OR NOT $aresult[0] Then
- $ierror = 3
- $ilasterror = _winapi_getlasterror()
- Else
- Local $hglobal = $aresult[0]
- $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hglobal)
- If @error OR NOT $aresult[0] Then
- $ierror = 4
- $ilasterror = _winapi_getlasterror()
- Else
- Local $hlock = $aresult[0]
- Local $dropfiles = DllStructCreate("dword pFiles;" & $tagpoint & ";bool fNC;bool fWide;wchar[" & StringLen($sfile) + 1 & "]", $hlock)
- If @error Then Return SetError(5, 6, False)
- Local $tempstruct = DllStructCreate("dword;long;long;bool;bool")
- DllStructSetData($dropfiles, "pFiles", DllStructGetSize($tempstruct))
- DllStructSetData($dropfiles, "X", 0)
- DllStructSetData($dropfiles, "Y", 0)
- DllStructSetData($dropfiles, "fNC", 0)
- DllStructSetData($dropfiles, "fWide", 1)
- DllStructSetData($dropfiles, 6, $sfile)
- For $i = 1 To StringLen($sfile)
- If DllStructGetData($dropfiles, 6, $i) = $sseparator Then DllStructSetData($dropfiles, 6, Chr(0), $i)
- Next
- $aresult = DllCall("user32.dll", "handle", "SetClipboardData", "uint", $cf_hdrop, "handle", $hglobal)
- If @error OR NOT $aresult[0] Then
- $ierror = 6
- $ilasterror = _winapi_getlasterror()
- EndIf
- $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hglobal)
- If (@error OR NOT $aresult[0]) AND NOT $ierror AND _winapi_getlasterror() Then
- $ierror = 8
- $ilasterror = _winapi_getlasterror()
- EndIf
- EndIf
- $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hglobal)
- If (@error OR $aresult[0]) AND NOT $ierror Then
- $ierror = 9
- $ilasterror = _winapi_getlasterror()
- EndIf
- EndIf
- EndIf
- $aresult = DllCall("user32.dll", "bool", "CloseClipboard")
- If (@error OR NOT $aresult[0]) AND NOT $ierror Then Return SetError(7, _winapi_getlasterror(), False)
- If $ierror Then Return SetError($ierror, $ilasterror, False)
- Return True
- EndFunc
- Func _iif($ftest, $vtrueval, $vfalseval)
- Return $ftest ? $vtrueval : $vfalseval
- EndFunc
- Func _mousetrap($ileft = 0, $itop = 0, $iright = 0, $ibottom = 0)
- Local $areturn = 0
- If $ileft = Default Then $ileft = 0
- If $itop = Default Then $itop = 0
- If $iright = Default Then $iright = 0
- If $ibottom = Default Then $ibottom = 0
- If @NumParams = 0 Then
- $areturn = DllCall("user32.dll", "bool", "ClipCursor", "ptr", 0)
- If @error OR NOT $areturn[0] Then Return SetError(1, _winapi_getlasterror(), False)
- Else
- If @NumParams = 2 Then
- $iright = $ileft + 1
- $ibottom = $itop + 1
- EndIf
- Local $trect = DllStructCreate($tagrect)
- DllStructSetData($trect, "Left", $ileft)
- DllStructSetData($trect, "Top", $itop)
- DllStructSetData($trect, "Right", $iright)
- DllStructSetData($trect, "Bottom", $ibottom)
- $areturn = DllCall("user32.dll", "bool", "ClipCursor", "struct*", $trect)
- If @error OR NOT $areturn[0] Then Return SetError(2, _winapi_getlasterror(), False)
- EndIf
- Return True
- EndFunc
- Func _singleton($soccurencename, $iflag = 0)
- Local Const $error_already_exists = 183
- Local Const $security_descriptor_revision = 1
- Local $tsecurityattributes = 0
- If BitAND($iflag, 2) Then
- Local $tsecuritydescriptor = DllStructCreate("byte;byte;word;ptr[4]")
- Local $aret = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "struct*", $tsecuritydescriptor, "dword", $security_descriptor_revision)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then
- $aret = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "struct*", $tsecuritydescriptor, "bool", 1, "ptr", 0, "bool", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then
- $tsecurityattributes = DllStructCreate($tagsecurity_attributes)
- DllStructSetData($tsecurityattributes, 1, DllStructGetSize($tsecurityattributes))
- DllStructSetData($tsecurityattributes, 2, DllStructGetPtr($tsecuritydescriptor))
- DllStructSetData($tsecurityattributes, 3, 0)
- EndIf
- EndIf
- EndIf
- Local $handle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", $tsecurityattributes, "bool", 1, "wstr", $soccurencename)
- If @error Then Return SetError(@error, @extended, 0)
- Local $lasterror = DllCall("kernel32.dll", "dword", "GetLastError")
- If @error Then Return SetError(@error, @extended, 0)
- If $lasterror[0] = $error_already_exists Then
- If BitAND($iflag, 1) Then
- DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $handle[0])
- If @error Then Return SetError(@error, @extended, 0)
- Return SetError($lasterror[0], $lasterror[0], 0)
- Else
- Exit -1
- EndIf
- EndIf
- Return $handle[0]
- EndFunc
- Func _ispressed($shexkey, $vdll = "user32.dll")
- Local $a_r = DllCall($vdll, "short", "GetAsyncKeyState", "int", "0x" & $shexkey)
- If @error Then Return SetError(@error, @extended, False)
- Return BitAND($a_r[0], 32768) <> 0
- EndFunc
- Func _versioncompare($sversion1, $sversion2)
- If $sversion1 = $sversion2 Then Return 0
- Local $aversion1 = StringSplit($sversion1, ".,"), $aversion2 = StringSplit($sversion2, ".,")
- If UBound($aversion1) <> UBound($aversion2) OR UBound($aversion1) = 0 Then
- If $sversion1 > $sversion2 Then
- Return SetExtended(1, 1)
- ElseIf $sversion1 < $sversion2 Then
- Return SetExtended(1, -1)
- EndIf
- Else
- For $i = 1 To UBound($aversion1) - 1
- If StringIsDigit($aversion1[$i]) AND StringIsDigit($aversion2[$i]) Then
- If Number($aversion1[$i]) > Number($aversion2[$i]) Then
- Return SetExtended(2, 1)
- ElseIf Number($aversion1[$i]) < Number($aversion2[$i]) Then
- Return SetExtended(2, -1)
- EndIf
- Else
- If $aversion1[$i] > $aversion2[$i] Then
- Return SetExtended(1, 1)
- ElseIf $aversion1[$i] < $aversion2[$i] Then
- Return SetExtended(1, -1)
- EndIf
- EndIf
- Next
- EndIf
- Return SetError(2, 0, 0)
- EndFunc
- Func __misc_getdc($hwnd)
- Local $aresult = DllCall("User32.dll", "handle", "GetDC", "hwnd", $hwnd)
- If @error OR NOT $aresult[0] Then Return SetError(1, _winapi_getlasterror(), 0)
- Return $aresult[0]
- EndFunc
- Func __misc_getdevicecaps($hdc, $iindex)
- Local $aresult = DllCall("GDI32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func __misc_releasedc($hwnd, $hdc)
- Local $aresult = DllCall("User32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] <> 0
- EndFunc
- Global Const $__dlg_wm_user = 1024
- Global Const $bif_browsefilejunctions = 65536
- Global Const $bif_browseforcomputer = 4096
- Global Const $bif_browseforprinter = 8192
- Global Const $bif_browseincludefiles = 16384
- Global Const $bif_browseincludeurls = 128
- Global Const $bif_dontgobelowdomain = 2
- Global Const $bif_editbox = 16
- Global Const $bif_newdialogstyle = 64
- Global Const $bif_nonewfolderbutton = 512
- Global Const $bif_notranslatetargets = 1024
- Global Const $bif_returnfsancestors = 8
- Global Const $bif_returnonlyfsdirs = 1
- Global Const $bif_shareable = 32768
- Global Const $bif_statustext = 4
- Global Const $bif_usenewui = BitOR($bif_editbox, $bif_newdialogstyle)
- Global Const $bif_uahint = 256
- Global Const $bif_validate = 32
- Global Const $bffm_initialized = 1
- Global Const $bffm_iunknown = 5
- Global Const $bffm_selchanged = 2
- Global Const $bffm_validatefailed = 4
- Global Const $bffm_setstatustexta = $__dlg_wm_user + 100
- Global Const $bffm_enableok = $__dlg_wm_user + 101
- Global Const $bffm_setselectiona = $__dlg_wm_user + 102
- Global Const $bffm_setselectionw = $__dlg_wm_user + 103
- Global Const $bffm_setstatustextw = $__dlg_wm_user + 104
- Global Const $bffm_setoktext = $__dlg_wm_user + 105
- Global Const $bffm_setexpanded = $__dlg_wm_user + 106
- Global Const $cderr_dialogfailure = 65535
- Global Const $cderr_findresfailure = 6
- Global Const $cderr_initialization = 2
- Global Const $cderr_loadresfailure = 7
- Global Const $cderr_loadstrfailure = 5
- Global Const $cderr_lockresfailure = 8
- Global Const $cderr_memallocfailure = 9
- Global Const $cderr_memlockfailure = 10
- Global Const $cderr_nohinstance = 4
- Global Const $cderr_nohook = 11
- Global Const $cderr_notemplate = 3
- Global Const $cderr_registermsgfail = 12
- Global Const $cderr_structsize = 1
- Global Const $pderr_createicfailure = 4106
- Global Const $pderr_defaultdifferent = 4108
- Global Const $pderr_dndmmismatch = 4105
- Global Const $pderr_getdevmodefail = 4101
- Global Const $pderr_initfailure = 4102
- Global Const $pderr_loaddrvfailure = 4100
- Global Const $pderr_nodefaultprn = 4104
- Global Const $pderr_nodevices = 4103
- Global Const $pderr_parsefailure = 4098
- Global Const $pderr_printernotfound = 4107
- Global Const $pderr_retdeffailure = 4099
- Global Const $pderr_setupfailure = 4097
- Global Const $cferr_maxlessthanmin = 8194
- Global Const $cferr_nofonts = 8193
- Global Const $fnerr_buffertoosmall = 12291
- Global Const $fnerr_invalidfilename = 12290
- Global Const $fnerr_subclassfailure = 12289
- Global Const $frerr_bufferlengthzero = 16385
- Global Const $fr_dialogterm = 64
- Global Const $fr_down = 1
- Global Const $fr_enablehook = 256
- Global Const $fr_enabletemplate = 512
- Global Const $fr_enabletemplatehandle = 8192
- Global Const $fr_findnext = 8
- Global Const $fr_hideupdown = 16384
- Global Const $fr_hidematchcase = 32768
- Global Const $fr_hidewholeword = 65536
- Global Const $fr_matchcase = 4
- Global Const $fr_nomatchcase = 2048
- Global Const $fr_noupdown = 1024
- Global Const $fr_nowholeword = 4096
- Global Const $fr_replace = 16
- Global Const $fr_replaceall = 32
- Global Const $fr_showhelp = 128
- Global Const $fr_wholeword = 2
- Global Const $shfmt_id_default = 65535
- Global Const $shfmt_opt_full = 0
- Global Const $shfmt_opt_quickformat = 1
- Global Const $shfmt_opt_sysonly = 2
- Global Const $shfmt_error = -1
- Global Const $shfmt_cancel = -2
- Global Const $shfmt_noformat = -3
- Global Const $cdm_first = $__dlg_wm_user + 100
- Global Const $cdm_getspec = $cdm_first
- Global Const $cdm_getfilepath = $cdm_first + 1
- Global Const $cdm_getfolderpath = $cdm_first + 2
- Global Const $cdm_getfolderidlist = $cdm_first + 3
- Global Const $cdm_setcontroltext = $cdm_first + 4
- Global Const $cdm_hidecontrol = $cdm_first + 5
- Global Const $cdm_setdefext = $cdm_first + 6
- Global Const $cdm_last = $__dlg_wm_user + 200
- Global Const $cdn_first = -601
- Global Const $cdn_initdone = $cdn_first
- Global Const $cdn_selchange = $cdn_first - 1
- Global Const $cdn_folderchange = $cdn_first - 2
- Global Const $cdn_shareviolation = $cdn_first - 3
- Global Const $cdn_help = $cdn_first - 4
- Global Const $cdn_fileok = $cdn_first - 5
- Global Const $cdn_typechange = $cdn_first - 6
- Global Const $cdn_includeitem = $cdn_first - 7
- Global Const $cdn_last = -699
- Global Const $psd_defaultminmargins = 0
- Global Const $psd_disablemargins = 16
- Global Const $psd_disableorientation = 256
- Global Const $psd_disablepagepainting = 524288
- Global Const $psd_disablepaper = 512
- Global Const $psd_disableprinter = 32
- Global Const $psd_enablepagepainthook = 262144
- Global Const $psd_enablepagesetuphook = 8192
- Global Const $psd_enablepagesetuptemplate = 32768
- Global Const $psd_enablepagesetuptemplatehandle = 131072
- Global Const $psd_inhundredthsofmillimeters = 8
- Global Const $psd_inthousandthsofinches = 4
- Global Const $psd_margins = 2
- Global Const $psd_minmargins = 1
- Global Const $psd_nonetworkbutton = 2097152
- Global Const $psd_nowarning = 128
- Global Const $psd_returndefault = 1024
- Global Const $psd_showhelp = 2048
- Global Const $wm_psd_pagesetupdlg = $__dlg_wm_user
- Global Const $wm_psd_fullpagerect = $__dlg_wm_user + 1
- Global Const $wm_psd_minmarginrect = $__dlg_wm_user + 2
- Global Const $wm_psd_marginrect = $__dlg_wm_user + 3
- Global Const $wm_psd_greektextrect = $__dlg_wm_user + 4
- Global Const $wm_psd_envstamprect = $__dlg_wm_user + 5
- Global Const $wm_psd_yafullpagerect = $__dlg_wm_user + 6
- Global Const $pd_allpages = 0
- Global Const $pd_collate = 16
- Global Const $pd_currentpage = 4194304
- Global Const $pd_disableprinttofile = 524288
- Global Const $pd_enableprinthook = 4096
- Global Const $pd_enableprinttemplate = 16384
- Global Const $pd_enableprinttemplatehandle = 65536
- Global Const $pd_enablesetuphook = 8192
- Global Const $pd_enablesetuptemplate = 32768
- Global Const $pd_enablesetuptemplatehandle = 131072
- Global Const $pd_exclusionflags = 16777216
- Global Const $pd_hideprinttofile = 1048576
- Global Const $pd_nocurrentpage = 8388608
- Global Const $pd_nonetworkbutton = 2097152
- Global Const $pd_nopagenums = 8
- Global Const $pd_noselection = 4
- Global Const $pd_nowarning = 128
- Global Const $pd_pagenums = 2
- Global Const $pd_printsetup = 64
- Global Const $pd_printtofile = 32
- Global Const $pd_returndc = 256
- Global Const $pd_returndefault = 1024
- Global Const $pd_returnic = 512
- Global Const $pd_selection = 1
- Global Const $pd_showhelp = 2048
- Global Const $pd_usedevmodecopies = 262144
- Global Const $pd_usedevmodecopiesandcollate = $pd_usedevmodecopies
- Global Const $pd_uselargetemplate = 268435456
- Global Const $pd_result_apply = 2
- Global Const $pd_result_cancel = 0
- Global Const $pd_result_print = 1
- Global Const $ewx_logoff = 0
- Global Const $ewx_poweroff = 8
- Global Const $ewx_reboot = 2
- Global Const $ewx_shutdown = 1
- Global Const $ewx_force = 4
- Global Const $ewx_forceifhung = 16
- Global Const $oaif_allow_registration = 1
- Global Const $oaif_register_ext = 2
- Global Const $oaif_exec = 4
- Global Const $oaif_force_registration = 8
- Global Const $oaif_hide_registration = 32
- Global Const $oaif_url_protocol = 64
- Global Const $credui_flags_always_show_ui = 128
- Global Const $credui_flags_complete_username = 2048
- Global Const $credui_flags_do_not_persist = 2
- Global Const $credui_flags_exclude_certificates = 8
- Global Const $credui_flags_expect_confirmation = 131072
- Global Const $credui_flags_generic_credentials = 262144
- Global Const $credui_flags_incorrect_password = 1
- Global Const $credui_flags_keep_username = 1048576
- Global Const $credui_flags_password_only_ok = 512
- Global Const $credui_flags_persist = 4096
- Global Const $credui_flags_request_administrator = 4
- Global Const $credui_flags_require_certificate = 16
- Global Const $credui_flags_require_smartcard = 256
- Global Const $credui_flags_server_credential = 16384
- Global Const $credui_flags_show_save_check_box = 64
- Global Const $credui_flags_username_target_credentials = 524288
- Global Const $credui_flags_validate_username = 1024
- Global Const $creduiwin_authpackage_only = 16
- Global Const $creduiwin_checkbox = 2
- Global Const $creduiwin_enumerate_admins = 256
- Global Const $creduiwin_enumerate_current_user = 512
- Global Const $creduiwin_generic = 1
- Global Const $creduiwin_in_cred_only = 32
- Global Const $creduiwin_secure_prompt = 4096
- Global Const $creduiwin_pack_32_wow = 268435456
- Global Const $creduiwin_preprompting = 8192
- Global Const $dllver_platform_windows = 1
- Global Const $dllver_platform_nt = 2
- Global Const $shcne_allevents = 2147483647
- Global Const $shcne_assocchanged = 134217728
- Global Const $shcne_attributes = 2048
- Global Const $shcne_create = 2
- Global Const $shcne_delete = 4
- Global Const $shcne_driveadd = 256
- Global Const $shcne_driveaddgui = 65536
- Global Const $shcne_driveremoved = 128
- Global Const $shcne_extended_event = 67108864
- Global Const $shcne_freespace = 262144
- Global Const $shcne_mediainserted = 32
- Global Const $shcne_mediaremoved = 64
- Global Const $shcne_mkdir = 8
- Global Const $shcne_netshare = 512
- Global Const $shcne_netunshare = 1024
- Global Const $shcne_renamefolder = 131072
- Global Const $shcne_renameitem = 1
- Global Const $shcne_rmdir = 16
- Global Const $shcne_serverdisconnect = 16384
- Global Const $shcne_updatedir = 4096
- Global Const $shcne_updateimage = 32768
- Global Const $shcne_updateitem = 8192
- Global Const $shcne_diskevents = 145439
- Global Const $shcne_globalevents = 201687520
- Global Const $shcne_interrupt = -2147483648
- Global Const $shcnf_dword = 3
- Global Const $shcnf_idlist = 0
- Global Const $shcnf_path = 1
- Global Const $shcnf_printer = 2
- Global Const $shcnf_flush = 4096
- Global Const $shcnf_flushnowait = 8192
- Global Const $shcnf_notifyrecursive = 65536
- Global Const $shcnrf_interruptlevel = 1
- Global Const $shcnrf_shelllevel = 2
- Global Const $shcnrf_recursiveinterrupt = 4096
- Global Const $shcnrf_newdelivery = 32768
- Global Const $sherb_noconfirmation = 1
- Global Const $sherb_noprogressui = 2
- Global Const $sherb_nosound = 4
- Global Const $sherb_no_ui = BitOR($sherb_noconfirmation, $sherb_noprogressui, $sherb_nosound)
- Global Const $see_mask_default = 0
- Global Const $see_mask_classname = 1
- Global Const $see_mask_classkey = 3
- Global Const $see_mask_idlist = 4
- Global Const $see_mask_invokeidlist = 12
- Global Const $see_mask_icon = 16
- Global Const $see_mask_hotkey = 32
- Global Const $see_mask_nocloseprocess = 64
- Global Const $see_mask_connectnetdrv = 128
- Global Const $see_mask_noasync = 256
- Global Const $see_mask_flag_ddewait = $see_mask_noasync
- Global Const $see_mask_doenvsubst = 512
- Global Const $see_mask_flag_no_ui = 1024
- Global Const $see_mask_unicode = 16384
- Global Const $see_mask_no_console = 32768
- Global Const $see_mask_asyncok = 1048576
- Global Const $see_mask_noqueryclassstore = 16777216
- Global Const $see_mask_hmonitor = 2097152
- Global Const $see_mask_nozonechecks = 8388608
- Global Const $see_mask_waitforinputidle = 33554432
- Global Const $see_mask_flag_log_usage = 67108864
- Global Const $se_err_accessdenied = 5
- Global Const $se_err_associncomplete = 27
- Global Const $se_err_ddebusy = 30
- Global Const $se_err_ddefail = 29
- Global Const $se_err_ddetimeout = 28
- Global Const $se_err_dllnotfound = 32
- Global Const $se_err_fnf = 2
- Global Const $se_err_noassoc = 31
- Global Const $se_err_oom = 8
- Global Const $se_err_pnf = 3
- Global Const $se_err_share = 26
- Global Const $fo_copy = 2
- Global Const $fo_delete = 3
- Global Const $fo_move = 1
- Global Const $fo_rename = 4
- Global Const $fof_allowundo = 64
- Global Const $fof_confirmmouse = 2
- Global Const $fof_filesonly = 128
- Global Const $fof_multidestfiles = 1
- Global Const $fof_noconfirmation = 16
- Global Const $fof_noconfirmmkdir = 512
- Global Const $fof_no_connected_elements = 8192
- Global Const $fof_nocopysecurityattribs = 2048
- Global Const $fof_noerrorui = 1024
- Global Const $fof_norecursereparse = 32768
- Global Const $fof_norecursion = 4096
- Global Const $fof_renameoncollision = 8
- Global Const $fof_silent = 4
- Global Const $fof_simpleprogress = 256
- Global Const $fof_wantmappinghandle = 32
- Global Const $fof_wantnukewarning = 16384
- Global Const $fof_no_ui = BitOR($fof_noconfirmation, $fof_noconfirmmkdir, $fof_noerrorui, $fof_silent)
- Global Const $shgfi_addoverlays = 32
- Global Const $shgfi_attr_specified = 131072
- Global Const $shgfi_attributes = 2048
- Global Const $shgfi_displayname = 512
- Global Const $shgfi_exetype = 8192
- Global Const $shgfi_icon = 256
- Global Const $shgfi_iconlocation = 4096
- Global Const $shgfi_largeicon = 0
- Global Const $shgfi_linkoverlay = 32768
- Global Const $shgfi_openicon = 2
- Global Const $shgfi_overlayindex = 64
- Global Const $shgfi_pidl = 8
- Global Const $shgfi_selected = 65536
- Global Const $shgfi_shelliconsize = 4
- Global Const $shgfi_smallicon = 1
- Global Const $shgfi_sysiconindex = 16384
- Global Const $shgfi_typename = 1024
- Global Const $shgfi_usefileattributes = 16
- Global Const $sfgao_cancopy = 1
- Global Const $sfgao_canmove = 2
- Global Const $sfgao_canlink = 4
- Global Const $sfgao_storage = 8
- Global Const $sfgao_canrename = 16
- Global Const $sfgao_candelete = 32
- Global Const $sfgao_haspropsheet = 64
- Global Const $sfgao_droptarget = 256
- Global Const $sfgao_capabilitymask = BitOR($sfgao_cancopy, $sfgao_canmove, $sfgao_canlink, $sfgao_canrename, $sfgao_candelete, $sfgao_haspropsheet, $sfgao_droptarget)
- Global Const $sfgao_system = 4096
- Global Const $sfgao_encrypted = 8192
- Global Const $sfgao_isslow = 16384
- Global Const $sfgao_ghosted = 32768
- Global Const $sfgao_link = 65536
- Global Const $sfgao_share = 131072
- Global Const $sfgao_readonly = 262144
- Global Const $sfgao_hidden = 524288
- Global Const $sfgao_displayattrmask = BitOR($sfgao_isslow, $sfgao_ghosted, $sfgao_link, $sfgao_share, $sfgao_readonly, $sfgao_hidden)
- Global Const $sfgao_nonenumerated = 1048576
- Global Const $sfgao_newcontent = 2097152
- Global Const $sfgao_stream = 4194304
- Global Const $sfgao_storageancestor = 8388608
- Global Const $sfgao_validate = 16777216
- Global Const $sfgao_removable = 33554432
- Global Const $sfgao_compressed = 67108864
- Global Const $sfgao_browsable = 134217728
- Global Const $sfgao_filesysancestor = 268435456
- Global Const $sfgao_folder = 536870912
- Global Const $sfgao_filesystem = 1073741824
- Global Const $sfgao_storagecapmask = BitOR($sfgao_storage, $sfgao_link, $sfgao_readonly, $sfgao_stream, $sfgao_storageancestor, $sfgao_filesysancestor, $sfgao_folder, $sfgao_filesystem)
- Global Const $sfgao_hassubfolder = -2147483648
- Global Const $sfgao_contentsmask = $sfgao_hassubfolder
- Global Const $sfgao_pkeysfgaomask = BitOR($sfgao_isslow, $sfgao_readonly, $sfgao_hassubfolder, $sfgao_validate)
- Global Const $ido_shgioi_default = 268435452
- Global Const $ido_shgioi_link = 268435454
- Global Const $ido_shgioi_share = 268435455
- Global Const $ido_shgioi_slowfile = 268435453
- Global Const $fcsm_viewid = 1
- Global Const $fcsm_webviewtemplate = 2
- Global Const $fcsm_infotip = 4
- Global Const $fcsm_clsid = 8
- Global Const $fcsm_iconfile = 16
- Global Const $fcsm_logo = 32
- Global Const $fcsm_flags = 64
- Global Const $fcs_read = 1
- Global Const $fcs_forcewrite = 2
- Global Const $fcs_write = BitOR($fcs_read, $fcs_forcewrite)
- Global Const $ssf_autocheckselect = 8388608
- Global Const $ssf_desktophtml = 512
- Global Const $ssf_dontprettypath = 2048
- Global Const $ssf_doubleclickinwebview = 128
- Global Const $ssf_hideicons = 16384
- Global Const $ssf_iconsonly = 16777216
- Global Const $ssf_mapnetdrvbutton = 4096
- Global Const $ssf_noconfirmrecycle = 32768
- Global Const $ssf_nonetcrawling = 1048576
- Global Const $ssf_sepprocess = 524288
- Global Const $ssf_showallobjects = 1
- Global Const $ssf_showcompcolor = 8
- Global Const $ssf_showextensions = 2
- Global Const $ssf_showinfotip = 8192
- Global Const $ssf_showsuperhidden = 262144
- Global Const $ssf_showsysfiles = 32
- Global Const $ssf_showtypeoverlay = 33554432
- Global Const $ssf_startpanelon = 2097152
- Global Const $ssf_win95classic = 1024
- Global Const $ssf_webview = 131072
- Global Const $csidl_admintools = 48
- Global Const $csidl_altstartup = 29
- Global Const $csidl_appdata = 26
- Global Const $csidl_bitbucket = 10
- Global Const $csidl_cdburn_area = 59
- Global Const $csidl_common_admintools = 47
- Global Const $csidl_common_altstartup = 30
- Global Const $csidl_common_appdata = 35
- Global Const $csidl_common_desktopdirectory = 25
- Global Const $csidl_common_documents = 46
- Global Const $csidl_common_favorites = 31
- Global Const $csidl_common_music = 53
- Global Const $csidl_common_pictures = 54
- Global Const $csidl_common_programs = 23
- Global Const $csidl_common_startmenu = 22
- Global Const $csidl_common_startup = 24
- Global Const $csidl_common_templates = 45
- Global Const $csidl_common_video = 55
- Global Const $csidl_computersnearme = 61
- Global Const $csidl_connections = 49
- Global Const $csidl_controls = 3
- Global Const $csidl_cookies = 33
- Global Const $csidl_desktop = 0
- Global Const $csidl_desktopdirectory = 16
- Global Const $csidl_drives = 17
- Global Const $csidl_favorites = 6
- Global Const $csidl_fonts = 20
- Global Const $csidl_internet_cache = 32
- Global Const $csidl_history = 34
- Global Const $csidl_local_appdata = 28
- Global Const $csidl_mymusic = 13
- Global Const $csidl_mypictures = 39
- Global Const $csidl_myvideo = 14
- Global Const $csidl_nethood = 19
- Global Const $csidl_personal = 5
- Global Const $csidl_printers = 4
- Global Const $csidl_printhood = 27
- Global Const $csidl_profile = 40
- Global Const $csidl_program_files = 38
- Global Const $csidl_program_files_common = 43
- Global Const $csidl_program_files_commonx86 = 44
- Global Const $csidl_program_filesx86 = 42
- Global Const $csidl_programs = 2
- Global Const $csidl_recent = 8
- Global Const $csidl_sendto = 9
- Global Const $csidl_startmenu = 11
- Global Const $csidl_startup = 7
- Global Const $csidl_system = 37
- Global Const $csidl_systemx86 = 41
- Global Const $csidl_templates = 21
- Global Const $csidl_windows = 36
- Global Const $siid_docnoassoc = 0
- Global Const $siid_docassoc = 1
- Global Const $siid_application = 2
- Global Const $siid_folder = 3
- Global Const $siid_folderopen = 4
- Global Const $siid_drive525 = 5
- Global Const $siid_drive35 = 6
- Global Const $siid_driveremove = 7
- Global Const $siid_drivefixed = 8
- Global Const $siid_drivenet = 9
- Global Const $siid_drivenetdisabled = 10
- Global Const $siid_drivecd = 11
- Global Const $siid_driveram = 12
- Global Const $siid_world = 13
- Global Const $siid_server = 15
- Global Const $siid_printer = 16
- Global Const $siid_mynetwork = 17
- Global Const $siid_find = 22
- Global Const $siid_help = 23
- Global Const $siid_share = 28
- Global Const $siid_link = 29
- Global Const $siid_slowfile = 30
- Global Const $siid_recycler = 31
- Global Const $siid_recyclerfull = 32
- Global Const $siid_mediacdaudio = 40
- Global Const $siid_lock = 47
- Global Const $siid_autolist = 49
- Global Const $siid_printernet = 50
- Global Const $siid_servershare = 51
- Global Const $siid_printerfax = 52
- Global Const $siid_printerfaxnet = 53
- Global Const $siid_printerfile = 54
- Global Const $siid_stack = 55
- Global Const $siid_mediasvcd = 56
- Global Const $siid_stuffedfolder = 57
- Global Const $siid_driveunknown = 58
- Global Const $siid_drivedvd = 59
- Global Const $siid_mediadvd = 60
- Global Const $siid_mediadvdram = 61
- Global Const $siid_mediadvdrw = 62
- Global Const $siid_mediadvdr = 63
- Global Const $siid_mediadvdrom = 64
- Global Const $siid_mediacdaudioplus = 65
- Global Const $siid_mediacdrw = 66
- Global Const $siid_mediacdr = 67
- Global Const $siid_mediacdburn = 68
- Global Const $siid_mediablankcd = 69
- Global Const $siid_mediacdrom = 70
- Global Const $siid_audiofiles = 71
- Global Const $siid_imagefiles = 72
- Global Const $siid_videofiles = 73
- Global Const $siid_mixedfiles = 74
- Global Const $siid_folderback = 75
- Global Const $siid_folderfront = 76
- Global Const $siid_shield = 77
- Global Const $siid_warning = 78
- Global Const $siid_info = 79
- Global Const $siid_error = 80
- Global Const $siid_key = 81
- Global Const $siid_software = 82
- Global Const $siid_rename = 83
- Global Const $siid_delete = 84
- Global Const $siid_mediaaudiodvd = 85
- Global Const $siid_mediamoviedvd = 86
- Global Const $siid_mediaenhancedcd = 87
- Global Const $siid_mediaenhanceddvd = 88
- Global Const $siid_mediahddvd = 89
- Global Const $siid_mediabluray = 90
- Global Const $siid_mediavcd = 91
- Global Const $siid_mediadvdplusr = 92
- Global Const $siid_mediadvdplusrw = 93
- Global Const $siid_desktoppc = 94
- Global Const $siid_mobilepc = 95
- Global Const $siid_users = 96
- Global Const $siid_mediasmartmedia = 97
- Global Const $siid_mediacompactflash = 98
- Global Const $siid_devicecellphone = 99
- Global Const $siid_devicecamera = 100
- Global Const $siid_devicevideocamera = 101
- Global Const $siid_deviceaudioplayer = 102
- Global Const $siid_networkconnect = 103
- Global Const $siid_internet = 104
- Global Const $siid_zipfile = 105
- Global Const $siid_settings = 106
- Global Const $siid_drivehddvd = 132
- Global Const $siid_drivebd = 133
- Global Const $siid_mediahddvdrom = 134
- Global Const $siid_mediahddvdr = 135
- Global Const $siid_mediahddvdram = 136
- Global Const $siid_mediabdrom = 137
- Global Const $siid_mediabdr = 138
- Global Const $siid_mediabdre = 139
- Global Const $siid_clustereddrive = 140
- Global Const $siid_max_icons = 174
- Global Const $shgsi_iconlocation = 0
- Global Const $shgsi_icon = $shgfi_icon
- Global Const $shgsi_sysiconindex = $shgfi_sysiconindex
- Global Const $shgsi_linkoverlay = $shgfi_linkoverlay
- Global Const $shgsi_selected = $shgfi_selected
- Global Const $shgsi_largeicon = $shgfi_largeicon
- Global Const $shgsi_smallicon = $shgfi_smallicon
- Global Const $shgsi_shelliconsize = $shgfi_shelliconsize
- Global Const $nim_add = 0
- Global Const $nim_modify = 1
- Global Const $nim_delete = 2
- Global Const $nim_setfocus = 3
- Global Const $nim_setversion = 4
- Global Const $nif_message = 1
- Global Const $nif_icon = 2
- Global Const $nif_tip = 4
- Global Const $nif_state = 8
- Global Const $nif_info = 16
- Global Const $nif_guid = 32
- Global Const $nif_realtime = 64
- Global Const $nif_showtip = 128
- Global Const $nis_hidden = 1
- Global Const $nis_sharedicon = 2
- Global Const $niif_none = 0
- Global Const $niif_info = 1
- Global Const $niif_warning = 2
- Global Const $niif_error = 3
- Global Const $niif_user = 4
- Global Const $niif_nosound = 16
- Global Const $niif_large_icon = 16
- Global Const $niif_respect_quiet_time = 128
- Global Const $niif_icon_mask = 15
- Global Const $shop_printername = 1
- Global Const $shop_filepath = 2
- Global Const $shop_volumeguid = 4
- Global Const $ofasi_edit = 1
- Global Const $ofasi_opendesktop = 2
- Global Const $quns_not_present = 1
- Global Const $quns_busy = 2
- Global Const $quns_running_d3d_full_screen = 3
- Global Const $quns_presentation_mode = 4
- Global Const $quns_accepts_notifications = 5
- Global Const $quns_quiet_time = 6
- Global Const $rest_norun = 1
- Global Const $rest_noclose = 2
- Global Const $rest_nosaveset = 3
- Global Const $rest_nofilemenu = 4
- Global Const $rest_nosetfolders = 5
- Global Const $rest_nosettaskbar = 6
- Global Const $rest_nodesktop = 7
- Global Const $rest_nofind = 8
- Global Const $rest_nodrives = 9
- Global Const $rest_nodriveautorun = 10
- Global Const $rest_nodrivetypeautorun = 11
- Global Const $rest_nonethood = 12
- Global Const $rest_startbanner = 13
- Global Const $rest_restrictrun = 14
- Global Const $rest_noprintertabs = 15
- Global Const $rest_noprinterdelete = 16
- Global Const $rest_noprinteradd = 17
- Global Const $rest_nostartmenusubfolders = 18
- Global Const $rest_mydocsonnet = 19
- Global Const $rest_noexittodos = 20
- Global Const $rest_enforceshellextsecurity = 21
- Global Const $rest_linkresolveignorelinkinfo = 22
- Global Const $rest_nocommongroups = 23
- Global Const $rest_separatedesktopprocess = 24
- Global Const $rest_noweb = 25
- Global Const $rest_notraycontextmenu = 26
- Global Const $rest_noviewcontextmenu = 27
- Global Const $rest_nonetconnectdisconnect = 28
- Global Const $rest_startmenulogoff = 29
- Global Const $rest_nosettingsassist = 30
- Global Const $rest_nointerneticon = 31
- Global Const $rest_norecentdocshistory = 32
- Global Const $rest_norecentdocsmenu = 33
- Global Const $rest_noactivedesktop = 34
- Global Const $rest_noactivedesktopchanges = 35
- Global Const $rest_nofavoritesmenu = 36
- Global Const $rest_clearrecentdocsonexit = 37
- Global Const $rest_classicshell = 38
- Global Const $rest_nocustomizewebview = 39
- Global Const $rest_nohtmlwallpaper = 40
- Global Const $rest_nochangingwallpaper = 41
- Global Const $rest_nodeskcomp = 42
- Global Const $rest_noadddeskcomp = 43
- Global Const $rest_nodeldeskcomp = 44
- Global Const $rest_noclosedeskcomp = 45
- Global Const $rest_noclose_dragdropband = 46
- Global Const $rest_nomovingband = 47
- Global Const $rest_noeditdeskcomp = 48
- Global Const $rest_noresolvesearch = 49
- Global Const $rest_noresolvetrack = 50
- Global Const $rest_forcecopyaclwithfile = 51
- Global Const $rest_nologo3channelnotify = 52
- Global Const $rest_noforgetsoftwareupdate = 53
- Global Const $rest_nosetactivedesktop = 54
- Global Const $rest_noupdatewindows = 55
- Global Const $rest_nochangestarmenu = 56
- Global Const $rest_nofolderoptions = 57
- Global Const $rest_hasfindcomputers = 58
- Global Const $rest_intellimenus = 59
- Global Const $rest_rundlgmemcheckbox = 60
- Global Const $rest_arp_showpostsetup = 61
- Global Const $rest_nocsc = 62
- Global Const $rest_nocontrolpanel = 63
- Global Const $rest_enumworkgroup = 64
- Global Const $rest_arp_noarp = 65
- Global Const $rest_arp_noremovepage = 66
- Global Const $rest_arp_noaddpage = 67
- Global Const $rest_arp_nowinsetuppage = 68
- Global Const $rest_greymsiads = 69
- Global Const $rest_nochangemappeddrivelabel = 70
- Global Const $rest_nochangemappeddrivecomment = 71
- Global Const $rest_maxrecentdocs = 72
- Global Const $rest_nonetworkconnections = 73
- Global Const $rest_forcestartmenulogoff = 74
- Global Const $rest_nowebview = 75
- Global Const $rest_nocustomizethisfolder = 76
- Global Const $rest_noencryption = 77
- Global Const $rest_dontshowsuperhidden = 78
- Global Const $rest_noshellsearchbutton = 79
- Global Const $rest_nohardwaretab = 80
- Global Const $rest_norunasinstallprompt = 81
- Global Const $rest_promptrunasinstallnetpath = 82
- Global Const $rest_nomanagemycomputerverb = 83
- Global Const $rest_norecentdocsnethood = 84
- Global Const $rest_disallowrun = 85
- Global Const $rest_nowelcomescreen = 86
- Global Const $rest_restrictcpl = 87
- Global Const $rest_disallowcpl = 88
- Global Const $rest_nosmballoontip = 89
- Global Const $rest_nosmhelp = 90
- Global Const $rest_nowinkeys = 91
- Global Const $rest_noencryptonmove = 92
- Global Const $rest_nolocalmachinerun = 93
- Global Const $rest_nocurrentuserrun = 94
- Global Const $rest_nolocalmachinerunonce = 95
- Global Const $rest_nocurrentuserrunonce = 96
- Global Const $rest_forceactivedesktopon = 97
- Global Const $rest_nocomputersnearme = 98
- Global Const $rest_noviewondrive = 99
- Global Const $rest_nonetcrawl = 100
- Global Const $rest_noshareddocuments = 101
- Global Const $rest_nosmmydocs = 102
- Global Const $rest_nosmmypics = 103
- Global Const $rest_allowbitbuckdrives = 104
- Global Const $rest_nonlegacyshellmode = 105
- Global Const $rest_nocontrolpanelbarricade = 106
- Global Const $rest_nostartpage = 107
- Global Const $rest_noautotraynotify = 108
- Global Const $rest_notaskgrouping = 109
- Global Const $rest_nocdburning = 110
- Global Const $rest_mycompnoprop = 111
- Global Const $rest_mydocsnoprop = 112
- Global Const $rest_nostartpanel = 113
- Global Const $rest_nodisplayappearancepage = 114
- Global Const $rest_nothemestab = 115
- Global Const $rest_novisualstylechoice = 116
- Global Const $rest_nosizechoice = 117
- Global Const $rest_nocolorchoice = 118
- Global Const $rest_setvisualstyle = 119
- Global Const $rest_startrunnohomepath = 120
- Global Const $rest_nousernameinstartpanel = 121
- Global Const $rest_nomycomputericon = 122
- Global Const $rest_nosmnetworkplaces = 123
- Global Const $rest_nosmpinnedlist = 124
- Global Const $rest_nosmmymusic = 125
- Global Const $rest_nosmejectpc = 126
- Global Const $rest_nosmmoreprograms = 127
- Global Const $rest_nosmmfuprograms = 128
- Global Const $rest_notrayitemsdisplay = 129
- Global Const $rest_notoolbarsontaskbar = 130
- Global Const $rest_nosmconfigureprograms = 131
- Global Const $rest_hideclock = 132
- Global Const $rest_nolowdiskspacechecks = 133
- Global Const $rest_noentirenetwork = 134
- Global Const $rest_nodesktopcleanup = 135
- Global Const $rest_bitbucknukeondelete = 136
- Global Const $rest_bitbuckconfirmdelete = 137
- Global Const $rest_bitbucknoprop = 138
- Global Const $rest_nodispbackground = 139
- Global Const $rest_nodispscreensavepg = 140
- Global Const $rest_nodispsettingspg = 141
- Global Const $rest_nodispscreensavepreview = 142
- Global Const $rest_nodisplaycpl = 143
- Global Const $rest_hiderunasverb = 144
- Global Const $rest_nothumbnailcache = 145
- Global Const $rest_nostrcmplogical = 146
- Global Const $rest_nopublishwizard = 147
- Global Const $rest_noonlineprintswizard = 148
- Global Const $rest_nowebservices = 149
- Global Const $rest_allowunhashedwebview = 150
- Global Const $rest_allowlegacywebview = 151
- Global Const $rest_revertwebviewsecurity = 152
- Global Const $rest_inheritconsolehandles = 153
- Global Const $rest_sortmaxitemcount = 154
- Global Const $rest_noremoterecursiveevents = 155
- Global Const $rest_noremotechangenotify = 156
- Global Const $rest_nosimplenetidlist = 157
- Global Const $rest_noenumentirenetwork = 158
- Global Const $rest_nodetailsthumbnailonnetwork = 159
- Global Const $rest_nointernetopenwith = 160
- Global Const $rest_allowlegacylmzbehavior = 161
- Global Const $rest_dontretrybadnetname = 162
- Global Const $rest_allowfileclsidjunctions = 163
- Global Const $rest_noupnpinstall = 164
- Global Const $rest_arp_dontgrouppatches = 165
- Global Const $rest_arp_nochooseprogramspage = 166
- Global Const $rest_nodisconnect = 167
- Global Const $rest_nosecurity = 168
- Global Const $rest_nofileassociate = 169
- Global Const $rest_allowcommenttoggle = 170
- Global Const $rest_usedesktopinicache = 171
- Global Const $gil_dontcache = 16
- Global Const $gil_notfilename = 8
- Global Const $gil_perclass = 4
- Global Const $gil_perinstance = 2
- Global Const $gil_simulatedoc = 1
- Global Const $gil_shield = 512
- Global Const $gil_forcenoshield = 1024
- Global Const $folderid_addnewprograms = "{DE61D971-5EBC-4F02-A3A9-6C82895E5C04}"
- Global Const $folderid_admintools = "{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"
- Global Const $folderid_appupdates = "{A305CE99-F527-492B-8B1A-7E76FA98D6E4}"
- Global Const $folderid_cdburning = "{9E52AB10-F80D-49DF-ACB8-4330F5687855}"
- Global Const $folderid_changeremoveprograms = "{DF7266AC-9274-4867-8D55-3BD661DE872D}"
- Global Const $folderid_commonadmintools = "{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"
- Global Const $folderid_commonoemlinks = "{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"
- Global Const $folderid_commonprograms = "{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"
- Global Const $folderid_commonstartmenu = "{A4115719-D62E-491D-AA7C-E74B8BE3B067}"
- Global Const $folderid_commonstartup = "{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"
- Global Const $folderid_commontemplates = "{B94237E7-57AC-4347-9151-B08C6C32D1F7}"
- Global Const $folderid_computerfolder = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
- Global Const $folderid_conflictfolder = "{4BFEFB45-347D-4006-A5BE-AC0CB0567192}"
- Global Const $folderid_connectionsfolder = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"
- Global Const $folderid_contacts = "{56784854-C6CB-462B-8169-88E350ACB882}"
- Global Const $folderid_controlpanelfolder = "{82A74AEB-AEB4-465C-A014-D097EE346D63}"
- Global Const $folderid_cookies = "{2B0F765D-C0E9-4171-908E-08A611B84FF6}"
- Global Const $folderid_desktop = "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
- Global Const $folderid_devicemetadatastore = "{5CE4A5E9-E4EB-479D-B89F-130C02886155}"
- Global Const $folderid_documentslibrary = "{7B0DB17D-9CD2-4A93-9733-46CC89022E7C}"
- Global Const $folderid_downloads = "{374DE290-123F-4565-9164-39C4925E467B}"
- Global Const $folderid_favorites = "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
- Global Const $folderid_fonts = "{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"
- Global Const $folderid_games = "{CAC52C1A-B53D-4EDC-92D7-6B2E8AC19434}"
- Global Const $folderid_gametasks = "{054FAE61-4DD8-4787-80B6-090220C4B700}"
- Global Const $folderid_history = "{D9DC8A3B-B784-432E-A781-5A1130A75963}"
- Global Const $folderid_homegroup = "{52528A6B-B9E3-4ADD-B60D-588C2DBA842D}"
- Global Const $folderid_implicitappshortcuts = "{BCB5256F-79F6-4CEE-B725-DC34E402FD46}"
- Global Const $folderid_internetcache = "{352481E8-33BE-4251-BA85-6007CAEDCF9D}"
- Global Const $folderid_internetfolder = "{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"
- Global Const $folderid_libraries = "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"
- Global Const $folderid_links = "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}"
- Global Const $folderid_localappdata = "{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"
- Global Const $folderid_localappdatalow = "{A520A1A4-1780-4FF6-BD18-167343C5AF16}"
- Global Const $folderid_localizedresourcesdir = "{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"
- Global Const $folderid_music = "{4BD8D571-6D19-48D3-BE97-422220080E43}"
- Global Const $folderid_musiclibrary = "{2112AB0A-C86A-4FFE-A368-0DE96E47012E}"
- Global Const $folderid_nethood = "{C5ABBF53-E17F-4121-8900-86626FC2C973}"
- Global Const $folderid_networkfolder = "{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"
- Global Const $folderid_originalimages = "{2C36C0AA-5812-4B87-BFD0-4CD0DFB19B39}"
- Global Const $folderid_photoalbums = "{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}"
- Global Const $folderid_pictureslibrary = "{A990AE9F-A03B-4E80-94BC-9912D7504104}"
- Global Const $folderid_pictures = "{33E28130-4E1E-4676-835A-98395C3BC3BB}"
- Global Const $folderid_playlists = "{DE92C1C7-837F-4F69-A3BB-86E631204A23}"
- Global Const $folderid_printersfolder = "{76FC4E2D-D6AD-4519-A663-37BD56068185}"
- Global Const $folderid_printhood = "{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"
- Global Const $folderid_profile = "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
- Global Const $folderid_programdata = "{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"
- Global Const $folderid_programfiles = "{905E63B6-C1BF-494E-B29C-65B732D3D21A}"
- Global Const $folderid_programfilesx64 = "{6D809377-6AF0-444B-8957-A3773F02200E}"
- Global Const $folderid_programfilesx86 = "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
- Global Const $folderid_programfilescommon = "{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"
- Global Const $folderid_programfilescommonx64 = "{6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D}"
- Global Const $folderid_programfilescommonx86 = "{DE974D24-D9C6-4D3E-BF91-F4455120B917}"
- Global Const $folderid_programs = "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"
- Global Const $folderid_public = "{DFDF76A2-C82A-4D63-906A-5644AC457385}"
- Global Const $folderid_publicdesktop = "{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"
- Global Const $folderid_publicdocuments = "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
- Global Const $folderid_publicdownloads = "{3D644C9B-1FB8-4F30-9B45-F670235F79C0}"
- Global Const $folderid_publicgametasks = "{DEBF2536-E1A8-4C59-B6A2-414586476AEA}"
- Global Const $folderid_publiclibraries = "{48DAF80B-E6CF-4F4E-B800-0E69D84EE384}"
- Global Const $folderid_publicmusic = "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
- Global Const $folderid_publicpictures = "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
- Global Const $folderid_publicringtones = "{E555AB60-153B-4D17-9F04-A5FE99FC15EC}"
- Global Const $folderid_publicvideos = "{2400183A-6185-49FB-A2D8-4A392A602BA3}"
- Global Const $folderid_quicklaunch = "{52A4F021-7B75-48A9-9F6B-4B87A210BC8F}"
- Global Const $folderid_recent = "{AE50C081-EBD2-438A-8655-8A092E34987A}"
- Global Const $folderid_recordedtvlibrary = "{1A6FDBA2-F42D-4358-A798-B74D745926C5}"
- Global Const $folderid_recyclebinfolder = "{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"
- Global Const $folderid_resourcedir = "{8AD10C31-2ADB-4296-A8F7-E4701232C972}"
- Global Const $folderid_ringtones = "{C870044B-F49E-4126-A9C3-B52A1FF411E8}"
- Global Const $folderid_roamingappdata = "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"
- Global Const $folderid_samplemusic = "{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}"
- Global Const $folderid_samplepictures = "{C4900540-2379-4C75-844B-64E6FAF8716B}"
- Global Const $folderid_sampleplaylists = "{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}"
- Global Const $folderid_samplevideos = "{859EAD94-2E85-48AD-A71A-0969CB56A6CD}"
- Global Const $folderid_savedgames = "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}"
- Global Const $folderid_savedsearches = "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}"
- Global Const $folderid_search_csc = "{EE32E446-31CA-4ABA-814F-A5EBD2FD6D5E}"
- Global Const $folderid_search_mapi = "{98EC0E18-2098-4D44-8644-66979315A281}"
- Global Const $folderid_searchhome = "{190337D1-B8CA-4121-A639-6D472D16972A}"
- Global Const $folderid_sendto = "{8983036C-27C0-404B-8F08-102D10DCFD74}"
- Global Const $folderid_sidebardefaultparts = "{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}"
- Global Const $folderid_sidebarparts = "{A75D362E-50FC-4FB7-AC2C-A8BEAA314493}"
- Global Const $folderid_startmenu = "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"
- Global Const $folderid_startup = "{B97D20BB-F46A-4C97-BA10-5E3608430854}"
- Global Const $folderid_syncmanagerfolder = "{43668BF8-C14E-49B2-97C9-747784D784B7}"
- Global Const $folderid_syncresultsfolder = "{289A9A43-BE44-4057-A41B-587A76D7E7F9}"
- Global Const $folderid_syncsetupfolder = "{0F214138-B1D3-4A90-BBA9-27CBC0C5389A}"
- Global Const $folderid_system = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"
- Global Const $folderid_systemx86 = "{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"
- Global Const $folderid_templates = "{A63293E8-664E-48DB-A079-DF759E0509F7}"
- Global Const $folderid_userpinned = "{9E3995AB-1F9C-4F13-B827-48B24B6C7174}"
- Global Const $folderid_userprofiles = "{0762D272-C50A-4BB0-A382-697DCD729B80}"
- Global Const $folderid_userprogramfiles = "{5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}"
- Global Const $folderid_userprogramfilescommon = "{BCBD3057-CA5C-4622-B42D-BC56DB0AE516}"
- Global Const $folderid_usersfiles = "{F3CE0F7C-4901-4ACC-8648-D5D44B04EF8F}"
- Global Const $folderid_userslibraries = "{A302545D-DEFF-464B-ABE8-61C8648D939B}"
- Global Const $folderid_videos = "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
- Global Const $folderid_videoslibrary = "{491E922F-5643-4AF4-A7EB-4E7A138D8174}"
- Global Const $folderid_windows = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"
- Global Const $kf_flag_alias_only = -2147483648
- Global Const $kf_flag_create = 32768
- Global Const $kf_flag_dont_verify = 16384
- Global Const $kf_flag_dont_unexpand = 8192
- Global Const $kf_flag_no_alias = 4096
- Global Const $kf_flag_init = 2048
- Global Const $kf_flag_default_path = 1024
- Global Const $kf_flag_no_appcontainer_redirection = 65536
- Global Const $kf_flag_not_parent_relative = 512
- Global Const $kf_flag_simple_idlist = 256
- Global Const $coinit_apartmentthreaded = 2
- Global Const $coinit_disable_ole1dde = 4
- Global Const $coinit_multithreaded = 0
- Global Const $coinit_speed_over_memory = 8
- #Region Global Variables and Constants
- Global $__enum, $__ext = 0
- Global $__hheap = 0, $__irgbmode = 1
- Global Const $tagosversioninfo = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct"
- Global Const $__winver = __winver()
- Global Const $__udfver = 776
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_arraytostruct(Const ByRef $adata, $istart = 0, $iend = -1)
- If __checkerrorarraybounds($adata, $istart, $iend) Then Return SetError(@error + 10, @extended, 0)
- Local $struct = ""
- For $i = $istart To $iend
- $struct &= "wchar[" & (StringLen($adata[$i]) + 1) & "];"
- Next
- Local $tdata = DllStructCreate($struct & "wchar[1]")
- Local $count = 1
- For $i = $istart To $iend
- DllStructSetData($tdata, $count, $adata[$i])
- $count += 1
- Next
- DllStructSetData($tdata, $count, ChrW(0))
- Return $tdata
- EndFunc
- Func _winapi_createmargins($ileftwidth, $irightwidth, $itopheight, $ibottomheight)
- Local $tmargins = DllStructCreate($tagmargins)
- DllStructSetData($tmargins, 1, $ileftwidth)
- DllStructSetData($tmargins, 2, $irightwidth)
- DllStructSetData($tmargins, 3, $itopheight)
- DllStructSetData($tmargins, 4, $ibottomheight)
- Return $tmargins
- EndFunc
- Func _winapi_createpoint($ix, $iy)
- Local $tpoint = DllStructCreate($tagpoint)
- DllStructSetData($tpoint, 1, $ix)
- DllStructSetData($tpoint, 2, $iy)
- Return $tpoint
- EndFunc
- Func _winapi_createrect($ileft, $itop, $iright, $ibottom)
- Local $trect = DllStructCreate($tagrect)
- DllStructSetData($trect, 1, $ileft)
- DllStructSetData($trect, 2, $itop)
- DllStructSetData($trect, 3, $iright)
- DllStructSetData($trect, 4, $ibottom)
- Return $trect
- EndFunc
- Func _winapi_createrectex($ix, $iy, $iwidth, $iheight)
- Local $trect = DllStructCreate($tagrect)
- DllStructSetData($trect, 1, $ix)
- DllStructSetData($trect, 2, $iy)
- DllStructSetData($trect, 3, $ix + $iwidth)
- DllStructSetData($trect, 4, $iy + $iheight)
- Return $trect
- EndFunc
- Func _winapi_createsize($iwidth, $iheight)
- Local $tsize = DllStructCreate($tagsize)
- DllStructSetData($tsize, 1, $iwidth)
- DllStructSetData($tsize, 2, $iheight)
- Return $tsize
- EndFunc
- Func _winapi_fatalexit($icode)
- DllCall("kernel32.dll", "none", "FatalExit", "int", $icode)
- If @error Then Return SetError(@error, @extended)
- EndFunc
- Func _winapi_getbitmapdimension($hbitmap)
- Local Const $tagbitmap = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct"
- Local $tobj = DllStructCreate($tagbitmap)
- Local $ret = DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, 0)
- Return _winapi_createsize(DllStructGetData($tobj, "bmWidth"), DllStructGetData($tobj, "bmHeight"))
- EndFunc
- Func _winapi_getstring($pstring, $funicode = 1)
- Local $length = _winapi_strlen($pstring, $funicode)
- If @error OR NOT $length Then Return SetError(@error + 10, @extended, "")
- Local $tstring = DllStructCreate(__iif($funicode, "wchar", "char") & "[" & ($length + 1) & "]", $pstring)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($length, DllStructGetData($tstring, 1))
- EndFunc
- Func _winapi_isbadreadptr($paddress, $ilength)
- Local $ret = DllCall("kernel32.dll", "bool", "IsBadReadPtr", "ptr", $paddress, "uint_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_isbadwriteptr($paddress, $ilength)
- Local $ret = DllCall("kernel32.dll", "bool", "IsBadWritePtr", "ptr", $paddress, "uint_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_iswow64process($pid = 0)
- If NOT $pid Then $pid = @AutoItPID
- Local $hprocess = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", __iif($__winver < 1536, 1024, 4096), "bool", 0, "dword", $pid)
- If @error OR NOT $hprocess[0] Then Return SetError(@error + 20, @extended, False)
- Local $ret = DllCall("kernel32.dll", "bool", "IsWow64Process", "handle", $hprocess[0], "bool*", 0)
- If __checkerrorclosehandle($ret, $hprocess[0]) Then Return SetError(@error, @extended, False)
- Return $ret[2]
- EndFunc
- Func _winapi_movememory($pdestination, $psource, $ilength)
- If _winapi_isbadreadptr($psource, $ilength) Then Return SetError(10, @extended, 0)
- If _winapi_isbadwriteptr($pdestination, $ilength) Then Return SetError(11, @extended, 0)
- DllCall("ntdll.dll", "none", "RtlMoveMemory", "ptr", $pdestination, "ptr", $psource, "ulong_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_pathisdirectory($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsDirectoryW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_strlen($pstring, $funicode = 1)
- Local $w = ""
- If $funicode Then $w = "W"
- Local $ret = DllCall("kernel32.dll", "int", "lstrlen" & $w, "ptr", $pstring)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_structtoarray(ByRef $tstruct, $iitems = 0)
- Local $size = 2 * Floor(DllStructGetSize($tstruct) / 2)
- Local $pstruct = DllStructGetPtr($tstruct)
- If NOT $size OR NOT $pstruct Then Return SetError(1, 0, 0)
- Local $tdata, $length, $offset = 0
- Local $result[101] = [0]
- While 1
- $length = _winapi_strlen($pstruct + $offset)
- If NOT $length Then
- ExitLoop
- EndIf
- If 2 * (1 + $length) + $offset > $size Then Return SetError(3, 0, 0)
- $tdata = DllStructCreate("wchar[" & (1 + $length) & "]", $pstruct + $offset)
- If @error Then Return SetError(@error + 10, 0, 0)
- __inc($result)
- $result[$result[0]] = DllStructGetData($tdata, 1)
- If $result[0] = $iitems Then
- ExitLoop
- EndIf
- $offset += 2 * (1 + $length)
- If $offset >= $size Then Return SetError(3, 0, 0)
- WEnd
- If NOT $result[0] Then Return SetError(2, 0, 0)
- __inc($result, -1)
- Return $result
- EndFunc
- Func _winapi_switchcolor($icolor)
- If $icolor = -1 Then Return $icolor
- Return BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
- EndFunc
- Func _winapi_zeromemory($pmemory, $ilength)
- If _winapi_isbadwriteptr($pmemory, $ilength) Then Return SetError(11, @extended, 0)
- DllCall("ntdll.dll", "none", "RtlZeroMemory", "ptr", $pmemory, "ulong_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- #EndRegion Public Functions
- #Region Internal Functions
- Func __checkerrorarraybounds(Const ByRef $adata, ByRef $istart, ByRef $iend, $ndim = 1, $idim = 0)
- If NOT IsArray($adata) Then Return SetError(1, 0, 1)
- If UBound($adata, $idim) <> $ndim Then Return SetError(2, 0, 1)
- If $istart < 0 Then $istart = 0
- Local $iubound = UBound($adata) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart > $iend Then Return SetError(4, 0, 1)
- Return 0
- EndFunc
- Func __checkerrorclosehandle($aret, $hfile, $blasterror = 0, $curerr = @error, $curext = @extended)
- If NOT $curerr AND NOT $aret[0] Then $curerr = 10
- Local $ilasterror = _winapi_getlasterror()
- DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile)
- If $curerr Then _winapi_setlasterror($ilasterror)
- If $blasterror Then $curext = $ilasterror
- Return SetError($curerr, $curext, $curerr)
- EndFunc
- Func __dll($spath, $fpin = 0)
- Local $ret = DllCall("kernel32.dll", "bool", "GetModuleHandleExW", "dword", __iif($fpin, 1, 2), "wstr", $spath, "ptr*", 0)
- If NOT $ret[3] Then
- Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $spath)
- If NOT $aresult[0] Then Return 0
- EndIf
- Return 1
- EndFunc
- Func __enumwindowsproc($hwnd, $fvisible)
- Local $aresult
- If ($fvisible) Then
- $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
- If NOT $aresult[0] Then
- Return 1
- EndIf
- EndIf
- __inc($__enum)
- $__enum[$__enum[0][0]][0] = $hwnd
- $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
- $__enum[$__enum[0][0]][1] = $aresult[2]
- Return 1
- EndFunc
- Func __fatalexit($icode, $stext = "")
- If $stext Then MsgBox(262160, "AutoIt", $stext)
- _winapi_fatalexit($icode)
- EndFunc
- Func __heapalloc($isize, $fabort = 0)
- Local $ret
- If NOT $__hheap Then
- $ret = DllCall("kernel32.dll", "handle", "HeapCreate", "dword", 0, "ulong_ptr", 0, "ulong_ptr", 0)
- If @error OR NOT $ret[0] Then __fatalexit(1, "Error allocating memory.")
- $__hheap = $ret[0]
- EndIf
- $ret = DllCall("kernel32.dll", "ptr", "HeapAlloc", "handle", $__hheap, "dword", 8, "ulong_ptr", $isize)
- If @error OR NOT $ret[0] Then
- If $fabort Then __fatalexit(1, "Error allocating memory.")
- Return SetError(@error + 30, @extended, 0)
- EndIf
- Return $ret[0]
- EndFunc
- Func __heapfree(ByRef $pmemory, $fcheck = 0, $curerr = @error, $curext = @extended)
- If $fcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
- Local $ret = DllCall("kernel32.dll", "int", "HeapFree", "ptr", $__hheap, "dword", 0, "ptr", $pmemory)
- If @error OR NOT $ret[0] Then Return SetError(@error + 40, @extended, 0)
- $pmemory = 0
- Return SetError($curerr, $curext, 1)
- EndFunc
- Func __heaprealloc($pmemory, $isize, $famount = 0, $fabort = 0)
- Local $ret
- If __heapvalidate($pmemory) Then
- If $famount AND (__heapsize($pmemory) >= $isize) Then Return SetExtended(1, Ptr($pmemory))
- $ret = DllCall("kernel32.dll", "ptr", "HeapReAlloc", "handle", $__hheap, "dword", 8, "ptr", $pmemory, "ulong_ptr", $isize)
- If @error OR NOT $ret[0] Then
- If $fabort Then __fatalexit(1, "Error allocating memory.")
- Return SetError(@error + 20, @extended, Ptr($pmemory))
- EndIf
- $ret = $ret[0]
- Else
- $ret = __heapalloc($isize, $fabort)
- If @error Then Return SetError(@error, @extended, 0)
- EndIf
- Return $ret
- EndFunc
- Func __heapsize($pmemory, $fcheck = 0)
- If $fcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
- Local $ret = DllCall("kernel32.dll", "ulong_ptr", "HeapSize", "handle", $__hheap, "dword", 0, "ptr", $pmemory)
- If @error OR ($ret[0] = Ptr(-1)) Then Return SetError(@error + 50, @extended, 0)
- Return $ret[0]
- EndFunc
- Func __heapvalidate($pmemory)
- If (NOT $__hheap) OR (NOT Ptr($pmemory)) Then Return SetError(9, 0, False)
- Local $ret = DllCall("kernel32.dll", "int", "HeapValidate", "handle", $__hheap, "dword", 0, "ptr", $pmemory)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func __inc(ByRef $adata, $iincrement = 100)
- Select
- Case UBound($adata, 2)
- If $iincrement < 0 Then
- ReDim $adata[$adata[0][0] + 1][UBound($adata, 2)]
- Else
- $adata[0][0] += 1
- If $adata[0][0] > UBound($adata) - 1 Then
- ReDim $adata[$adata[0][0] + $iincrement][UBound($adata, 2)]
- EndIf
- EndIf
- Case UBound($adata, 1)
- If $iincrement < 0 Then
- ReDim $adata[$adata[0] + 1]
- Else
- $adata[0] += 1
- If $adata[0] > UBound($adata) - 1 Then
- ReDim $adata[$adata[0] + $iincrement]
- EndIf
- EndIf
- Case Else
- Return 0
- EndSelect
- Return 1
- EndFunc
- Func __iif($ftest, $vtrue, $vfalse)
- If $ftest Then
- Return $vtrue
- Else
- Return $vfalse
- EndIf
- EndFunc
- Func __init($bdata)
- Local $length = BinaryLen($bdata)
- Local $ret = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", $length, "dword", 4096, "dword", 64)
- If @error OR NOT $ret[0] Then __fatalexit(1, "Error allocating memory.")
- Local $tdata = DllStructCreate("byte[" & $length & "]", $ret[0])
- DllStructSetData($tdata, 1, $bdata)
- Return $ret[0]
- EndFunc
- Func __rgb($icolor)
- If $__irgbmode Then
- $icolor = _winapi_switchcolor($icolor)
- EndIf
- Return $icolor
- EndFunc
- Func __winver()
- Local $tosvi = DllStructCreate($tagosversioninfo)
- DllStructSetData($tosvi, 1, DllStructGetSize($tosvi))
- Local $ret = DllCall("kernel32.dll", "bool", "GetVersionExW", "struct*", $tosvi)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, 0)
- Return BitOR(BitShift(DllStructGetData($tosvi, 2), -8), DllStructGetData($tosvi, 3))
- EndFunc
- #EndRegion Internal Functions
- #Region Global Variables and Constants
- Global Const $__winapicom_tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
- #EndRegion Global Variables and Constants
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_clsidfromprogid($progid)
- Local $tguid = DllStructCreate($__winapicom_tagguid)
- Local $ret = DllCall("ole32.dll", "long", "CLSIDFromProgID", "wstr", $progid, "struct*", $tguid)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- $ret = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 39)
- If @error OR NOT $ret[0] Then Return SetError(@error + 20, @extended, "")
- Return $ret[2]
- EndFunc
- Func _winapi_coinitialize($iflags = 0)
- Local $ret = DllCall("ole32.dll", "long", "CoInitializeEx", "ptr", 0, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_cotaskmemalloc($isize)
- Local $ret = DllCall("ole32.dll", "ptr", "CoTaskMemAlloc", "uint_ptr", $isize)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_cotaskmemfree($pmemory)
- DllCall("ole32.dll", "none", "CoTaskMemFree", "ptr", $pmemory)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_cotaskmemrealloc($pmemory, $isize)
- Local $ret = DllCall("ole32.dll", "ptr", "CoTaskMemRealloc", "ptr", $pmemory, "ulong_ptr", $isize)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_couninitialize()
- DllCall("ole32.dll", "none", "CoUninitialize")
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_createguid()
- Local $tguid = DllStructCreate($__winapicom_tagguid)
- Local $ret = DllCall("ole32.dll", "long", "CoCreateGuid", "struct*", $tguid)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- $ret = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 65536)
- If @error OR NOT $ret[0] Then Return SetError(@error + 20, @extended, "")
- Return $ret[2]
- EndFunc
- Func _winapi_createstreamonhglobal($hglobal = 0, $fdeleteonrelease = 1)
- Local $ret = DllCall("ole32.dll", "long", "CreateStreamOnHGlobal", "handle", $hglobal, "bool", $fdeleteonrelease, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $ret[3]
- EndFunc
- Func _winapi_gethglobalfromstream($pstream)
- Local $ret = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $pstream, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $ret[2]
- EndFunc
- Func _winapi_progidfromclsid($clsid)
- Local $tguid = DllStructCreate($__winapicom_tagguid)
- Local $ret = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $clsid, "struct*", $tguid)
- If @error OR $ret[0] Then Return SetError(@error + 20, @extended, "")
- $ret = DllCall("ole32.dll", "uint", "ProgIDFromCLSID", "ptr", DllStructGetPtr($tguid), "ptr*", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Local $id = _winapi_getstring($ret[2])
- _winapi_cotaskmemfree($ret[2])
- Return $id
- EndFunc
- Func _winapi_releasestream($pstream)
- Local $ret = DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $pstream, "ulong_ptr", 8 * (1 + @AutoItX64), "uint", 4, "ushort", 23, "uint", 0, "ptr", 0, "ptr", 0, "str", "")
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- #EndRegion Public Functions
- Global Const $url_scheme_invalid = -1
- Global Const $url_scheme_unknown = 0
- Global Const $url_scheme_ftp = 1
- Global Const $url_scheme_http = 2
- Global Const $url_scheme_gopher = 3
- Global Const $url_scheme_mailto = 4
- Global Const $url_scheme_news = 5
- Global Const $url_scheme_nntp = 6
- Global Const $url_scheme_telnet = 7
- Global Const $url_scheme_wais = 8
- Global Const $url_scheme_file = 9
- Global Const $url_scheme_mk = 10
- Global Const $url_scheme_https = 11
- Global Const $url_scheme_shell = 12
- Global Const $url_scheme_snews = 13
- Global Const $url_scheme_local = 14
- Global Const $url_scheme_javascript = 15
- Global Const $url_scheme_vbscript = 16
- Global Const $url_scheme_about = 17
- Global Const $url_scheme_res = 18
- Global Const $url_scheme_msshellrooted = 19
- Global Const $url_scheme_msshellidlist = 20
- Global Const $url_scheme_mshelp = 21
- Global Const $url_scheme_msshelldevice = 22
- Global Const $url_scheme_wildcard = 23
- Global Const $url_scheme_search_ms = 24
- Global Const $url_scheme_search = 25
- Global Const $url_scheme_knownfolder = 26
- Global Const $gct_invalid = 0
- Global Const $gct_lfnchar = 1
- Global Const $gct_separator = 8
- Global Const $gct_shortchar = 2
- Global Const $gct_wild = 4
- Global Const $url_apply_default = 1
- Global Const $url_apply_guessscheme = 2
- Global Const $url_apply_guessfile = 4
- Global Const $url_apply_forceapply = 8
- Global Const $url_dont_simplify = 134217728
- Global Const $url_escape_as_utf8 = 262144
- Global Const $url_escape_percent = 4096
- Global Const $url_escape_spaces_only = 67108864
- Global Const $url_escape_unsafe = 536870912
- Global Const $url_no_meta = 134217728
- Global Const $url_pluggable_protocol = 1073741824
- Global Const $url_unescape = 268435456
- Global Const $url_part_hostname = 2
- Global Const $url_part_password = 4
- Global Const $url_part_port = 5
- Global Const $url_part_query = 6
- Global Const $url_part_scheme = 1
- Global Const $url_part_username = 3
- Global Const $urlis_appliable = 4
- Global Const $urlis_directory = 5
- Global Const $urlis_fileurl = 3
- Global Const $urlis_hasquery = 6
- Global Const $urlis_nohistory = 2
- Global Const $urlis_opaque = 1
- Global Const $urlis_url = 0
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_commandlinetoargv($scmd)
- Local $result[1] = [0]
- $scmd = StringStripWS($scmd, 3)
- If NOT $scmd Then
- Return $result
- EndIf
- Local $ret = DllCall("shell32.dll", "ptr", "CommandLineToArgvW", "wstr", $scmd, "int*", 0)
- If @error OR NOT $ret[0] OR (NOT $ret[2]) Then Return SetError(@error + 10, @extended, 0)
- Local $tptr = DllStructCreate("ptr[" & $ret[2] & "]", $ret[0])
- Dim $result[$ret[2] + 1] = [$ret[2]]
- For $i = 1 To $ret[2]
- $result[$i] = _winapi_getstring(DllStructGetData($tptr, 1, $i))
- Next
- DllCall("kernel32.dll", "handle", "LocalFree", "handle", $ret[0])
- Return $result
- EndFunc
- Func _winapi_isnameinexpression($sstring, $spattern, $fcasesensitive = 0)
- If NOT $fcasesensitive Then $spattern = StringUpper($spattern)
- Local $tus1 = __us($spattern)
- Local $tus2 = __us($sstring)
- Local $ret = DllCall("ntdll.dll", "boolean", "RtlIsNameInExpression", "struct*", $tus1, "struct*", $tus2, "boolean", NOT $fcasesensitive, "ptr", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_parseurl($surl)
- Local $tagparsedurl = "dword Size;ptr Protocol;uint cchProtocol;ptr Suffix;uint cchSuffix;uint Scheme"
- Local $tpurl = DllStructCreate($tagparsedurl)
- DllStructSetData($tpurl, 1, DllStructGetSize($tpurl))
- Local $turl = DllStructCreate("wchar[4096]")
- DllStructSetData($turl, 1, $surl)
- Local $ret = DllCall("shlwapi.dll", "long", "ParseURLW", "struct*", $turl, "struct*", $tpurl)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Local $result[3]
- $result[0] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 3) & "]", DllStructGetData($tpurl, 2)), 1)
- $result[1] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 5) & "]", DllStructGetData($tpurl, 4)), 1)
- $result[2] = DllStructGetData($tpurl, 6)
- Return $result
- EndFunc
- Func _winapi_parseusername($suser)
- If NOT __dll("credui.dll") Then Return SetError(103, 0, 0)
- Local $ret = DllCall("credui.dll", "dword", "CredUIParseUserNameW", "wstr", $suser, "wstr", "", "ulong", 4096, "wstr", "", "ulong", 4096)
- If @error Then Return SetError(@error, @extended, 0)
- Switch $ret[0]
- Case 0
- Case 1315
- If StringStripWS($suser, 3) Then
- $ret[2] = $suser
- $ret[4] = ""
- Else
- ContinueCase
- EndIf
- Case Else
- Return SetError(10, $ret[0], 0)
- EndSwitch
- Local $result[2]
- $result[0] = $ret[4]
- $result[1] = $ret[2]
- Return $result
- EndFunc
- Func _winapi_pathaddbackslash($spath)
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $spath)
- Local $ret = DllCall("shlwapi.dll", "ptr", "PathAddBackslashW", "struct*", $tpath)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return DllStructGetData($tpath, 1)
- EndFunc
- Func _winapi_pathaddextension($spath, $sext = "")
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $spath)
- Local $typeofext = "wstr"
- If NOT StringStripWS($sext, 3) Then
- $typeofext = "ptr"
- $sext = 0
- EndIf
- Local $ret = DllCall("shlwapi.dll", "bool", "PathAddExtensionW", "struct*", $tpath, $typeofext, $sext)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($ret[0], DllStructGetData($tpath, 1))
- EndFunc
- Func _winapi_pathappend($spath, $smore)
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathAppendW", "struct*", $tpath, "wstr", $smore)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return DllStructGetData($tpath, 1)
- EndFunc
- Func _winapi_pathbuildroot($idrive)
- Local $ret = DllCall("shlwapi.dll", "ptr", "PathBuildRootW", "wstr", "", "int", $idrive)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathcanonicalize($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathCanonicalizeW", "wstr", "", "wstr", $spath)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, $spath)
- Return $ret[1]
- EndFunc
- Func _winapi_pathcommonprefix($spath1, $spath2)
- Local $ret = DllCall("shlwapi.dll", "int", "PathCommonPrefixW", "wstr", $spath1, "wstr", $spath2, "wstr", "")
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($ret[0], $ret[3])
- EndFunc
- Func _winapi_pathcompactpath($hwnd, $spath, $iwidth = 0)
- If $iwidth < 1 Then
- Local $trect = DllStructCreate($tagrect)
- DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
- $iwidth += DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
- EndIf
- Local $ret = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
- If @error OR NOT $ret[0] Then Return SetError(@error + 20, @extended, $spath)
- Local $hdc = $ret[0]
- Local Const $wm_getfont = 49
- $ret = DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hwnd, "uint", $wm_getfont, "wparam", 0, "lparam", 0)
- Local $hback = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $ret[0])
- Local $ierror = 0
- $ret = DllCall("shlwapi.dll", "bool", "PathCompactPathW", "handle", $hdc, "wstr", $spath, "int", $iwidth)
- If @error OR NOT $ret[0] Then $ierror = @error + 10
- DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hback[0])
- DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
- If $ierror Then Return SetError($ierror, 0, $spath)
- Return $ret[2]
- EndFunc
- Func _winapi_pathcompactpathex($spath, $imax)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathCompactPathExW", "wstr", "", "wstr", $spath, "uint", $imax + 1, "dword", 0)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, $spath)
- Return $ret[1]
- EndFunc
- Func _winapi_pathcreatefromurl($surl)
- Local $ret = DllCall("shlwapi.dll", "long", "PathCreateFromUrlW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Return $ret[2]
- EndFunc
- Func _winapi_pathfindextension($spath)
- Local $ret = DllCall("shlwapi.dll", "wstr", "PathFindExtensionW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[0]
- EndFunc
- Func _winapi_pathfindfilename($spath)
- Local $ret = DllCall("shlwapi.dll", "wstr", "PathFindFileNameW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, $spath)
- Return $ret[0]
- EndFunc
- Func _winapi_pathfindnextcomponent($spath)
- Local $tpath = DllStructCreate("wchar[" & (StringLen($spath) + 1) & "]")
- DllStructSetData($tpath, 1, $spath)
- Local $ret = DllCall("shlwapi.dll", "ptr", "PathFindNextComponentW", "struct*", $tpath)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, "")
- Return _winapi_getstring($ret[0])
- EndFunc
- Func _winapi_pathgetargs($spath)
- Local $tpath = DllStructCreate("wchar[" & (StringLen($spath) + 1) & "]")
- DllStructSetData($tpath, 1, $spath)
- Local $ret = DllCall("shlwapi.dll", "ptr", "PathGetArgsW", "struct*", $tpath)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return _winapi_getstring($ret[0])
- EndFunc
- Func _winapi_pathgetchartype($schar)
- Local $ret = DllCall("shlwapi.dll", "uint", "PathGetCharTypeW", "word", AscW($schar))
- If @error Then Return SetError(@error, @extended, -1)
- Return $ret[0]
- EndFunc
- Func _winapi_pathgetdrivenumber($spath)
- Local $ret = DllCall("shlwapi.dll", "int", "PathGetDriveNumberW", "wstr", $spath)
- If @error OR ($ret[0] = -1) Then Return SetError(@error, @extended, "")
- Return Chr($ret[0] + 65) & ":"
- EndFunc
- Func _winapi_pathiscontenttype($spath, $stype)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsContentTypeW", "wstr", $spath, "wstr", $stype)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathisexe($spath)
- Local $ret = DllCall("shell32.dll", "bool", "PathIsExe", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathisfilespec($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsFileSpecW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathislfnfilespec($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsLFNFileSpecW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathisrelative($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsRelativeW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathisroot($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsRootW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathissameroot($spath1, $spath2)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsSameRootW", "wstr", $spath1, "wstr", $spath2)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathissystemfolder($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsSystemFolderW", "wstr", $spath, "dword", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathisunc($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsUNCW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathisuncserver($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathisuncservershare($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerShareW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathmakesystemfolder($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathMakeSystemFolderW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathmatchspec($spath, $sspec)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathMatchSpecW", "wstr", $spath, "wstr", $sspec)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathparseiconlocation($spath)
- Local $ret = DllCall("shlwapi.dll", "int", "PathParseIconLocationW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, 0)
- Local $result[2]
- $result[0] = $ret[1]
- $result[1] = $ret[0]
- Return $result
- EndFunc
- Func _winapi_pathrelativepathto($spathfrom, $fdirfrom, $spathto, $fdirto)
- If $fdirfrom Then
- $fdirfrom = 16
- EndIf
- If $fdirto Then
- $fdirto = 16
- EndIf
- Local $ret = DllCall("shlwapi.dll", "bool", "PathRelativePathToW", "wstr", "", "wstr", $spathfrom, "dword", $fdirfrom, "wstr", $spathto, "dword", $fdirto)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathremoveargs($spath)
- Local $ret = DllCall("shlwapi.dll", "none", "PathRemoveArgsW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathremovebackslash($spath)
- Local $ret = DllCall("shlwapi.dll", "ptr", "PathRemoveBackslashW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathremoveextension($spath)
- Local $ret = DllCall("shlwapi.dll", "none", "PathRemoveExtensionW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathremovefilespec($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathRemoveFileSpecW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($ret[0], $ret[1])
- EndFunc
- Func _winapi_pathrenameextension($spath, $sext)
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathRenameExtensionW", "struct*", $tpath, "wstr", $sext)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return DllStructGetData($tpath, 1)
- EndFunc
- Func _winapi_pathsearchandqualify($spath, $fexists = 0)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathSearchAndQualifyW", "wstr", $spath, "wstr", "", "int", 4096)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, "")
- If $fexists AND NOT FileExists($ret[2]) Then Return SetError(20, 0, "")
- Return $ret[2]
- EndFunc
- Func _winapi_pathskiproot($spath)
- Local $tpath = DllStructCreate("wchar[" & (StringLen($spath) + 1) & "]")
- DllStructSetData($tpath, 1, $spath)
- Local $ret = DllCall("shlwapi.dll", "ptr", "PathSkipRootW", "struct*", $tpath)
- If @error Then Return SetError(@error, @extended, "")
- If NOT $ret[0] Then Return $spath
- Return _winapi_getstring($ret[0])
- EndFunc
- Func _winapi_pathstrippath($spath)
- Local $ret = DllCall("shlwapi.dll", "none", "PathStripPathW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathstriptoroot($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathStripToRootW", "wstr", $spath)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathundecorate($spath)
- Local $ret = DllCall("shlwapi.dll", "none", "PathUndecorateW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathunexpandenvstrings($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathUnExpandEnvStringsW", "wstr", $spath, "wstr", "", "uint", 4096)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return $ret[2]
- EndFunc
- Func _winapi_pathunmakesystemfolder($spath)
- Local $ret = DllCall("shlwapi.dll", "bool", "PathUnmakeSystemFolderW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_pathunquotespaces($spath)
- Local $ret = DllCall("shlwapi.dll", "none", "PathUnquoteSpacesW", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_pathyetanothermakeuniquename($spath)
- Local $ret = DllCall("shell32.dll", "int", "PathYetAnotherMakeUniqueName", "wstr", "", "wstr", $spath, "ptr", 0, "ptr", 0)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_shellgetimagelist($fsmall = 0)
- Local $plarge, $psmall, $tptr = DllStructCreate("ptr")
- If $fsmall Then
- $plarge = 0
- $psmall = DllStructGetPtr($tptr)
- Else
- $plarge = DllStructGetPtr($tptr)
- $psmall = 0
- EndIf
- Local $ret = DllCall("shell32.dll", "int", "Shell_GetImageLists", "ptr", $plarge, "ptr", $psmall)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($tptr, 1)
- EndFunc
- Func _winapi_urlapplyscheme($surl, $iflags = 1)
- Local $ret = DllCall("shlwapi.dll", "long", "UrlApplySchemeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Return $ret[2]
- EndFunc
- Func _winapi_urlcanonicalize($surl, $iflags)
- Local $ret = DllCall("shlwapi.dll", "long", "UrlCanonicalizeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Return $ret[2]
- EndFunc
- Func _winapi_urlcombine($surl, $spart, $iflags = 0)
- Local $ret = DllCall("shlwapi.dll", "long", "UrlCombineW", "wstr", $surl, "wstr", $spart, "wstr", "", "dword*", 4096, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Return $ret[3]
- EndFunc
- Func _winapi_urlcompare($surl1, $surl2, $fignoreslash = 0)
- Local $ret = DllCall("shlwapi.dll", "int", "UrlCompareW", "wstr", $surl1, "wstr", $surl2, "bool", $fignoreslash)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_urlcreatefrompath($spath)
- Local $ret = DllCall("shlwapi.dll", "long", "UrlCreateFromPathW", "wstr", $spath, "wstr", "", "dword*", 4096, "dword", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] < 0 OR $ret[0] > 1 Then
- Return SetError(10, $ret[0], "")
- EndIf
- Return $ret[2]
- EndFunc
- Func _winapi_urlfixup($surl)
- Local $ret = DllCall("shlwapi.dll", "long", "UrlFixupW", "wstr", $surl, "wstr", "", "dword", 4096)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Return $ret[2]
- EndFunc
- Func _winapi_urlgetpart($surl, $ipart)
- Local $ret = DllCall("shlwapi.dll", "long", "UrlGetPartW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $ipart, "dword", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Return $ret[2]
- EndFunc
- Func _winapi_urlhash($surl, $ilength = 32)
- If $ilength <= 0 OR $ilength > 256 Then Return SetError(256, 0, 0)
- Local $tdata = DllStructCreate("byte[" & $ilength & "]")
- Local $ret = DllCall("shlwapi.dll", "long", "UrlHashW", "wstr", $surl, "struct*", $tdata, "dword", $ilength)
- If @error Then Return SetError(@error + 10, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return DllStructGetData($tdata, 1)
- EndFunc
- Func _winapi_urlis($surl, $itype = 0)
- Local $ret = DllCall("shlwapi.dll", "bool", "UrlIsW", "wstr", $surl, "uint", $itype)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- #EndRegion Public Functions
- #Region Internal Functions
- Func __us($sstring, $ilength = 0)
- If $ilength Then
- $sstring = StringLeft($sstring, $ilength)
- Else
- $ilength = StringLen($sstring)
- EndIf
- Local $tus = DllStructCreate("ushort;ushort;ptr;wchar[" & ($ilength + 1) & "]")
- DllStructSetData($tus, 1, 2 * StringLen($sstring))
- DllStructSetData($tus, 2, 2 * $ilength)
- DllStructSetData($tus, 3, DllStructGetPtr($tus, 4))
- DllStructSetData($tus, 4, $sstring)
- Return $tus
- EndFunc
- #EndRegion Internal Functions
- #Region Global Variables and Constants
- Global Const $tagnotifyicondata = "struct;dword Size;hwnd hWnd;uint ID;uint Flags;uint CallbackMessage;ptr hIcon;wchar Tip[128];dword State;dword StateMask;wchar Info[256];uint Version;wchar InfoTitle[64];dword InfoFlags;endstruct"
- Global Const $tagnotifyicondata_v3 = $tagnotifyicondata & ";" & $tagguid
- Global Const $tagnotifyicondata_v4 = $tagnotifyicondata_v3 & ";ptr hBalloonIcon;"
- Global Const $tagshellexecuteinfo = "dword Size;ulong Mask;hwnd hWnd;ptr Verb;ptr File;ptr Parameters;ptr Directory;int Show;ulong_ptr hInstApp;ptr IDList;ptr Class;ulong_ptr hKeyClass;dword HotKey;ptr hMonitor;ptr hProcess"
- Global Const $tagshfileinfo = "ptr hIcon;int iIcon;dword Attributes;wchar DisplayName[260];wchar TypeName[80]"
- Global Const $tagshfileopstruct = "hwnd hWnd;uint Func;ptr From;ptr To;dword Flags;int fAnyOperationsAborted;ptr hNameMappings;ptr ProgressTitle"
- Global Const $tagshfoldercustomsettings = "dword Size;dword Mask;ptr GUID;ptr WebViewTemplate;dword SizeWVT;ptr WebViewTemplateVersion;ptr InfoTip;dword SizeIT;ptr CLSID;dword Flags;ptr IconFile;dword SizeIF;int IconIndex;ptr Logo;dword SizeL"
- Global Const $tagshstockiconinfo = "dword Size;ptr hIcon;int SysImageIndex;int iIcon;wchar Path[260]"
- #EndRegion Global Variables and Constants
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_defsubclassproc($hwnd, $imsg, $wparam, $lparam)
- Local $ret = DllCall("comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_dllgetversion($spath)
- Local $tversion = DllStructCreate("dword[5]")
- DllStructSetData($tversion, 1, DllStructGetSize($tversion), 1)
- Local $ret = DllCall($spath, "uint", "DllGetVersion", "struct*", $tversion)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Local $result[4]
- For $i = 0 To 3
- $result[$i] = DllStructGetData($tversion, 1, $i + 2)
- Next
- Return $result
- EndFunc
- Func _winapi_getallusersprofiledirectory()
- Local $ret = DllCall("userenv.dll", "bool", "GetAllUsersProfileDirectoryW", "wstr", "", "dword*", 4096)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_getdefaultuserprofiledirectory()
- Local $ret = DllCall("userenv.dll", "bool", "GetDefaultUserProfileDirectoryW", "wstr", "", "dword*", 4096)
- If @error Then Return SetError(@error, @extended, "")
- Return $ret[1]
- EndFunc
- Func _winapi_getwindowsubclass($hwnd, $psubclassproc, $id)
- Local $ret = DllCall("comctl32.dll", "bool", "GetWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $id, "dword_ptr*", 0)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $ret[4]
- EndFunc
- Func _winapi_removewindowsubclass($hwnd, $psubclassproc, $id)
- Local $ret = DllCall("comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $id)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_setcurrentprocessexplicitappusermodelid($sappid)
- Local $ret = DllCall("shell32.dll", "long", "SetCurrentProcessExplicitAppUserModelID", "wstr", $sappid)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_setwindowsubclass($hwnd, $psubclassproc, $id, $pdata = 0)
- Local $ret = DllCall("comctl32.dll", "bool", "SetWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $id, "dword_ptr", $pdata)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_shelladdtorecentdocs($sfile)
- Local $typeoffile = "wstr"
- If StringStripWS($sfile, 3) Then
- $sfile = _winapi_pathsearchandqualify($sfile, 1)
- If NOT $sfile Then
- Return SetError(1, 0, 0)
- EndIf
- Else
- $typeoffile = "ptr"
- $sfile = 0
- EndIf
- DllCall("shell32.dll", "none", "SHAddToRecentDocs", "uint", 3, $typeoffile, $sfile)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellchangenotify($ievent, $iflags, $iitem1 = 0, $iitem2 = 0)
- Local $typeofitem1 = "dword_ptr", $typeofitem2 = "dword_ptr"
- If IsString($iitem1) Then
- $typeofitem1 = "wstr"
- EndIf
- If IsString($iitem2) Then
- $typeofitem2 = "wstr"
- EndIf
- DllCall("shell32.dll", "none", "SHChangeNotify", "long", $ievent, "uint", $iflags, $typeofitem1, $iitem1, $typeofitem2, $iitem2)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellchangenotifyderegister($id)
- Local $ret = DllCall("shell32.dll", "bool", "SHChangeNotifyDeregister", "ulong", $id)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_shellchangenotifyregister($hwnd, $imsg, $ievents, $isources, $apaths, $frecursive = 0)
- Local $path = $apaths, $struct = ""
- If IsArray($apaths) Then
- If UBound($apaths, 2) Then Return SetError(1, 0, 0)
- Else
- Dim $apaths[1] = [$path]
- EndIf
- For $i = 0 To UBound($apaths) - 1
- If NOT _winapi_pathisdirectory($apaths[$i]) Then Return SetError(2, 0, 0)
- Next
- For $i = 0 To UBound($apaths) - 1
- $struct &= "ptr;int;"
- Next
- Local $tentry = DllStructCreate($struct)
- For $i = 0 To UBound($apaths) - 1
- $apaths[$i] = _winapi_shellilcreatefrompath(_winapi_pathsearchandqualify($apaths[$i]))
- DllStructSetData($tentry, 2 * $i + 1, $apaths[$i])
- DllStructSetData($tentry, 2 * $i + 2, $frecursive)
- Next
- Local $error = 0
- Local $ret = DllCall("shell32.dll", "ulong", "SHChangeNotifyRegister", "hwnd", $hwnd, "int", $isources, "long", $ievents, "uint", $imsg, "int", UBound($apaths), "struct*", $tentry)
- If @error OR NOT $ret[0] Then $error = @error + 10
- For $i = 0 To UBound($apaths) - 1
- _winapi_cotaskmemfree($apaths[$i])
- Next
- Return SetError($error, 0, $ret[0])
- EndFunc
- Func _winapi_shellcreatedirectory($spath, $hparent = 0, $tsecurity = 0)
- Local $ret = DllCall("shell32.dll", "int", "SHCreateDirectoryExW", "hwnd", $hparent, "wstr", $spath, "struct*", $tsecurity)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellemptyrecyclebin($sroot = "", $iflags = 0, $hparent = 0)
- Local $ret = DllCall("shell32.dll", "long", "SHEmptyRecycleBinW", "hwnd", $hparent, "wstr", $sroot, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellexecute($sfile, $sargs = "", $sdir = "", $sverb = "", $ishow = 1, $hparent = 0)
- Local $typeofargs = "wstr", $typeofdir = "wstr", $typeofverb = "wstr"
- If NOT StringStripWS($sargs, 3) Then
- $typeofargs = "ptr"
- $sargs = 0
- EndIf
- If NOT StringStripWS($sdir, 3) Then
- $typeofdir = "ptr"
- $sdir = 0
- EndIf
- If NOT StringStripWS($sverb, 3) Then
- $typeofverb = "ptr"
- $sverb = 0
- EndIf
- Local $ret = DllCall("shell32.dll", "ULONG_PTR", "ShellExecuteW", "hwnd", $hparent, $typeofverb, $sverb, "wstr", $sfile, $typeofargs, $sargs, $typeofdir, $sdir, "int", $ishow)
- If @error Then Return SetError(@error, @extended, False)
- If $ret[0] <= 32 Then Return SetError(10, $ret[0], 0)
- Return $ret[0]
- EndFunc
- Func _winapi_shellexecuteex(ByRef $tshexinfo)
- Local $ret = DllCall("shell32.dll", "bool", "ShellExecuteExW", "struct*", $tshexinfo)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_shellextractassociatedicon($sfile, $fsmall = 0)
- Local $flags = 256
- If NOT _winapi_pathisdirectory($sfile) Then
- $flags = BitOR($flags, 16)
- EndIf
- If $fsmall Then
- $flags = BitOR($flags, 1)
- EndIf
- Local $tshfileinfo = DllStructCreate($tagshfileinfo)
- If NOT _winapi_shellgetfileinfo($sfile, $flags, 0, $tshfileinfo) Then Return SetError(@error + 10, @extended, 0)
- Return DllStructGetData($tshfileinfo, "hIcon")
- EndFunc
- Func _winapi_shellextracticon($sicon, $iindex, $iwidth, $iheight)
- Local $ret = DllCall("shell32.dll", "int", "SHExtractIconsW", "wstr", $sicon, "int", $iindex, "int", $iwidth, "int", $iheight, "ptr*", 0, "ptr*", 0, "int", 1, "int", 0)
- If @error OR NOT $ret[0] OR NOT $ret[5] Then Return SetError(@error, @extended, 0)
- Return $ret[5]
- EndFunc
- Func _winapi_shellfileoperation($sfrom, $sto, $ifunc, $iflags, $stitle = "", $hparent = 0)
- Local $data
- If NOT IsArray($sfrom) Then
- $data = $sfrom
- Dim $sfrom[1] = [$data]
- EndIf
- Local $tfrom = _winapi_arraytostruct($sfrom)
- If @error Then Return SetError(@error + 20, @extended, 0)
- If NOT IsArray($sto) Then
- $data = $sto
- Dim $sto[1] = [$data]
- EndIf
- Local $tto = _winapi_arraytostruct($sto)
- If @error Then Return SetError(@error + 30, @extended, 0)
- Local $tshfileopstruct = DllStructCreate($tagshfileopstruct)
- DllStructSetData($tshfileopstruct, "hWnd", $hparent)
- DllStructSetData($tshfileopstruct, "Func", $ifunc)
- DllStructSetData($tshfileopstruct, "From", DllStructGetPtr($tfrom))
- DllStructSetData($tshfileopstruct, "To", DllStructGetPtr($tto))
- DllStructSetData($tshfileopstruct, "Flags", $iflags)
- DllStructSetData($tshfileopstruct, "ProgressTitle", $stitle)
- Local $ret = DllCall("shell32.dll", "int", "SHFileOperationW", "struct*", $tshfileopstruct)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $tshfileopstruct
- EndFunc
- Func _winapi_shellflushsfcache()
- DllCall("shell32.dll", "none", "SHFlushSFCache")
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellgetfileinfo($spath, $iflags, $iattributes, ByRef $tshfileinfo)
- Local $ret = DllCall("shell32.dll", "dword_ptr", "SHGetFileInfoW", "wstr", $spath, "dword", $iattributes, "struct*", $tshfileinfo, "uint", DllStructGetSize($tshfileinfo), "uint", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_shellgeticonoverlayindex($sicon, $iindex)
- Local $typeoficon = "wstr"
- If NOT StringStripWS($sicon, 3) Then
- $typeoficon = "ptr"
- $sicon = 0
- EndIf
- Local $ret = DllCall("shell32.dll", "int", "SHGetIconOverlayIndexW", $typeoficon, $sicon, "int", $iindex)
- If @error OR ($ret[0] = -1) Then Return SetError(@error, @extended, -1)
- Return $ret[0]
- EndFunc
- Func _winapi_shellgetknownfolderidlist($guid, $iflags = 0, $htoken = 0)
- Local $tguid = DllStructCreate($tagguid)
- Local $ret = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $guid, "ptr", DllStructGetPtr($tguid))
- If @error OR $ret[0] Then Return SetError(@error + 20, @extended, 0)
- $ret = DllCall("shell32.dll", "uint", "SHGetKnownFolderIDList", "ptr", DllStructGetPtr($tguid), "dword", $iflags, "ptr", $htoken, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $ret[4]
- EndFunc
- Func _winapi_shellgetknownfolderpath($guid, $iflags = 0, $htoken = 0)
- Local $tguid = DllStructCreate($tagguid)
- Local $ret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $guid, "struct*", $tguid)
- If @error OR $ret[0] Then Return SetError(@error + 20, @extended, "")
- $ret = DllCall("shell32.dll", "long", "SHGetKnownFolderPath", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $ret[0] Then Return SetError(10, $ret[0], "")
- Local $path = _winapi_getstring($ret[4])
- _winapi_cotaskmemfree($ret[4])
- Return $path
- EndFunc
- Func _winapi_shellgetlocalizedname($spath)
- Local $ret = DllCall("shell32.dll", "long", "SHGetLocalizedName", "wstr", $spath, "wstr", "", "uint*", 0, "int*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Local $result[2]
- Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $ret[2], "wstr", "", "dword", 4096)
- $result[0] = $aresult[2]
- $result[1] = $ret[4]
- Return $result
- EndFunc
- Func _winapi_shellgetpathfromidlist($pidl)
- Local $ret = DllCall("shell32.dll", "bool", "SHGetPathFromIDListW", "ptr", $pidl, "wstr", "")
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- Return $ret[2]
- EndFunc
- Func _winapi_shellgetsetfoldercustomsettings($spath, $iflag, ByRef $tshfcs)
- Local $proc = "SHGetSetFolderCustomSettings"
- If $__winver < 1536 Then $proc &= "W"
- Local $ret = DllCall("shell32.dll", "long", $proc, "struct*", $tshfcs, "wstr", $spath, "dword", $iflag)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellgetsettings($iflags)
- Local $tshellstate = DllStructCreate("uint[8]")
- DllCall("shell32.dll", "none", "SHGetSetSettings", "struct*", $tshellstate, "dword", $iflags, "bool", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Local $val1 = DllStructGetData($tshellstate, 1, 1)
- Local $val2 = DllStructGetData($tshellstate, 1, 8)
- Local $result = 0
- Local $opt[20][2] = [[1, 1], [2, 2], [4, 32768], [8, 32], [16, 8], [32, 128], [64, 512], [128, 1024], [256, 2048], [1024, 4096], [2048, 8192], [4096, 16384], [8192, 131072], [32768, 262144], [65536, 1048576], [1, 524288], [2, 2097152], [8, 8388608], [16, 16777216], [32, 33554432]]
- For $i = 0 To 14
- If BitAND($val1, $opt[$i][0]) Then
- $result += $opt[$i][1]
- EndIf
- Next
- For $i = 15 To 19
- If BitAND($val2, $opt[$i][0]) Then
- $result += $opt[$i][1]
- EndIf
- Next
- Return $result
- EndFunc
- Func _winapi_shellgetspecialfolderlocation($csidl)
- Local $ret = DllCall("shell32.dll", "long", "SHGetSpecialFolderLocation", "hwnd", 0, "int", $csidl, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $ret[3]
- EndFunc
- Func _winapi_shellgetspecialfolderpath($csidl, $fcreate = 0)
- Local $ret = DllCall("shell32.dll", "bool", "SHGetSpecialFolderPathW", "hwnd", 0, "wstr", "", "int", $csidl, "bool", $fcreate)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, "")
- Return $ret[2]
- EndFunc
- Func _winapi_shellgetstockiconinfo($siid, $iflags)
- Local $tshstockiconinfo = DllStructCreate($tagshstockiconinfo)
- DllStructSetData($tshstockiconinfo, "Size", DllStructGetSize($tshstockiconinfo))
- Local $ret = DllCall("shell32.dll", "long", "SHGetStockIconInfo", "int", $siid, "uint", $iflags, "struct*", $tshstockiconinfo)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $tshstockiconinfo
- EndFunc
- Func _winapi_shellilcreatefrompath($spath)
- Local $ret = DllCall("shell32.dll", "long", "SHILCreateFromPath", "wstr", $spath, "ptr*", 0, "dword*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $ret[2]
- EndFunc
- Func _winapi_shellnotifyicon($imessage, ByRef $tnotifyicondata)
- Local $ret = DllCall("shell32.dll", "bool", "Shell_NotifyIconW", "dword", $imessage, "struct*", $tnotifyicondata)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_shellnotifyicongetrect($hwnd, $id, $tguid = 0)
- Local $tnii = DllStructCreate("dword;hwnd;uint;" & $tagguid)
- DllStructSetData($tnii, 1, DllStructGetSize($tnii))
- DllStructSetData($tnii, 2, $hwnd)
- DllStructSetData($tnii, 3, $id)
- If IsDllStruct($tguid) Then
- If NOT _winapi_movememory(DllStructGetPtr($tnii, 4), DllStructGetPtr($tguid), 16) Then Return SetError(@error + 10, @extended, 0)
- EndIf
- Local $trect = DllStructCreate($tagrect)
- Local $ret = DllCall("shell32.dll ", "long", "Shell_NotifyIconGetRect", "struct*", $tnii, "struct*", $trect)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $trect
- EndFunc
- Func _winapi_shellobjectproperties($spath, $itype = 2, $sproperty = "", $hparent = 0)
- Local $typeofproperty = "wstr"
- If NOT StringStripWS($sproperty, 3) Then
- $typeofproperty = "ptr"
- $sproperty = 0
- EndIf
- Local $ret = DllCall("shell32.dll", "bool", "SHObjectProperties", "hwnd", $hparent, "dword", $itype, "wstr", $spath, $typeofproperty, $sproperty)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_shellopenfolderandselectitems($spath, $anames = 0, $istart = 0, $iend = -1, $iflags = 0)
- Local $pidl, $ret, $tptr = 0, $count = 0, $obj = 0, $error = 0
- $spath = _winapi_pathremovebackslash(_winapi_pathsearchandqualify($spath))
- If IsArray($anames) Then
- If $spath AND NOT _winapi_pathisdirectory($spath) Then Return SetError(@error + 20, @extended, 0)
- EndIf
- $pidl = _winapi_shellilcreatefrompath($spath)
- If @error Then Return SetError(@error + 30, @extended, 0)
- If NOT __checkerrorarraybounds($anames, $istart, $iend) Then
- $tptr = DllStructCreate("ptr[" & ($iend - $istart + 1) & "]")
- For $i = $istart To $iend
- $count += 1
- If $anames[$i] Then
- DllStructSetData($tptr, 1, _winapi_shellilcreatefrompath($spath & "\" & $anames[$i]), $count)
- Else
- DllStructSetData($tptr, 1, 0, $count)
- EndIf
- Next
- EndIf
- If _winapi_coinitialize() Then $obj = 1
- $ret = DllCall("shell32.dll", "long", "SHOpenFolderAndSelectItems", "ptr", $pidl, "uint", $count, "struct*", $tptr, "dword", $iflags)
- If @error Then
- $error = @error + 10
- Else
- If $ret[0] Then $error = 10
- EndIf
- If $obj Then _winapi_couninitialize()
- _winapi_cotaskmemfree($pidl)
- For $i = 1 To $count
- $pidl = DllStructGetData($tptr, $i)
- If $pidl Then
- _winapi_cotaskmemfree($pidl)
- EndIf
- Next
- If $error = 10 Then Return SetError(10, $ret[0], 0)
- If $error Then Return SetError($error, 0, 0)
- Return 1
- EndFunc
- Func _winapi_shellqueryrecyclebin($sroot = "")
- Local $tshqrbi = DllStructCreate("align 4;dword_ptr;int64;int64")
- DllStructSetData($tshqrbi, 1, DllStructGetSize($tshqrbi))
- Local $ret = DllCall("shell32.dll", "long", "SHQueryRecycleBinW", "wstr", $sroot, "struct*", $tshqrbi)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Local $result[2]
- $result[0] = DllStructGetData($tshqrbi, 2)
- $result[1] = DllStructGetData($tshqrbi, 3)
- Return $result
- EndFunc
- Func _winapi_shellqueryusernotificationstate()
- Local $ret = DllCall("shell32.dll", "long", "SHQueryUserNotificationState", "uint*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return $ret[1]
- EndFunc
- Func _winapi_shellremovelocalizedname($spath)
- Local $ret = DllCall("shell32.dll", "long", "SHRemoveLocalizedName", "wstr", $spath)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellrestricted($irestriction)
- Local $ret = DllCall("shell32.dll", "dword", "SHRestricted", "uint", $irestriction)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_shellsetknownfolderpath($guid, $spath, $iflags = 0, $htoken = 0)
- Local $tguid = DllStructCreate($tagguid)
- Local $ret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $guid, "struct*", $tguid)
- If @error OR $ret[0] Then Return SetError(@error + 20, @extended, 0)
- $ret = DllCall("shell32.dll", "long", "SHSetKnownFolderPath", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "wstr", $spath)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellsetlocalizedname($spath, $smodule, $iresid)
- Local $ret = DllCall("shell32.dll", "long", "SHSetLocalizedName", "wstr", $spath, "wstr", $smodule, "int", $iresid)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellsetsettings($iflags, $fset)
- Local $val1 = 0, $val2 = 0
- Local $opt[20][2] = [[1, 1], [2, 2], [4, 32768], [8, 32], [16, 8], [32, 128], [64, 512], [128, 1024], [256, 2048], [1024, 4096], [2048, 8192], [4096, 16384], [8192, 131072], [32768, 262144], [65536, 1048576], [1, 524288], [2, 2097152], [8, 8388608], [16, 16777216], [32, 33554432]]
- If $fset Then
- For $i = 0 To 14
- If BitAND($iflags, $opt[$i][1]) Then
- $val1 += $opt[$i][0]
- EndIf
- Next
- For $i = 15 To 19
- If BitAND($iflags, $opt[$i][1]) Then
- $val2 += $opt[$i][0]
- EndIf
- Next
- EndIf
- Local $tshellstate = DllStructCreate("uint[8]")
- DllStructSetData($tshellstate, 1, $val1, 1)
- DllStructSetData($tshellstate, 1, $val2, 8)
- DllCall("shell32.dll", "none", "SHGetSetSettings", "struct*", $tshellstate, "dword", $iflags, "bool", 1)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellupdateimage($sicon, $iindex, $iimage, $iflags = 0)
- DllCall("shell32.dll", "none", "SHUpdateImageW", "wstr", $sicon, "int", $iindex, "uint", $iflags, "int", $iimage)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- #EndRegion Public Functions
- #Region Global Variables and Constants
- Global $__pfrbuffer = 0, $__ifrbuffersize = 16385
- Global Const $tagfindreplace = "dword Size;hwnd hOwner;ptr hInstance;dword Flags;ptr FindWhat;ptr ReplaceWith;ushort FindWhatLen;ushort ReplaceWithLen;lparam lParam;ptr Hook;ptr TemplateName"
- Global Const $tagmsgboxparams = "uint Size;hwnd hOwner;ptr hInstance;int_ptr Text;int_ptr Caption;dword Style;int_ptr Icon;dword_ptr ContextHelpId;ptr MsgBoxCallback;dword LanguageId"
- Global Const $tagpagesetupdlg = "dword Size;hwnd hOwner;ptr hDevMode;ptr hDevNames;dword Flags;long PaperWidth;long PaperHeight;long MarginMinLeft;long MarginMinTop;long MarginMinRight;long MarginMinBottom;long MarginLeft;long MarginTop;long MarginRight;long MarginBottom;ptr hInstance;lparam lParam;ptr PageSetupHook;ptr PagePaintHook;ptr PageSetupTemplateName;ptr hPageSetupTemplate"
- Global Const $tagprintdlg = __iif(@AutoItX64, "", "align 2;") & "dword Size;hwnd hOwner;handle hDevMode;handle hDevNames;handle hDC;dword Flags;word FromPage;word ToPage;word MinPage;word MaxPage;word Copies;handle hInstance;lparam lParam;ptr PrintHook;ptr SetupHook;ptr PrintTemplateName;ptr SetupTemplateName;handle hPrintTemplate;handle hSetupTemplate"
- Global Const $tagprintdlgex = "dword Size;hwnd hOwner;handle hDevMode;handle hDevNames;handle hDC;dword Flags;dword Flags2;dword ExclusionFlags;dword NumPageRanges;dword MaxPageRanges;ptr PageRanges;dword MinPage;dword MaxPage;dword Copies;handle hInstance;ptr PrintTemplateName;lparam lParam;dword NumPropertyPages;ptr hPropertyPages;dword StartPage;dword ResultAction"
- Global Const $tagprintpagerange = "dword FromPage;dword ToPage"
- #EndRegion Global Variables and Constants
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_browseforfolderdlg($sroot = "", $stext = "", $iflags = 0, $pbrowseproc = 0, $lparam = 0, $hparent = 0)
- Local Const $tagbrowseinfo = "hwnd hwndOwner;ptr pidlRoot;ptr pszDisplayName; ptr lpszTitle;uint ulFlags;ptr lpfn;lparam lParam;int iImage"
- Local $tbrowseinfo = DllStructCreate($tagbrowseinfo & ";wchar[" & (StringLen($stext) + 1) & "];wchar[260]")
- Local $pidl = 0, $result = ""
- If StringStripWS($sroot, 3) Then
- Local $path = _winapi_pathsearchandqualify($sroot, 1)
- If @error Then
- $path = $sroot
- EndIf
- $pidl = _winapi_shellilcreatefrompath($path)
- If @error Then
- EndIf
- EndIf
- DllStructSetData($tbrowseinfo, 1, $hparent)
- DllStructSetData($tbrowseinfo, 2, $pidl)
- DllStructSetData($tbrowseinfo, 3, DllStructGetPtr($tbrowseinfo, 10))
- DllStructSetData($tbrowseinfo, 4, DllStructGetPtr($tbrowseinfo, 9))
- DllStructSetData($tbrowseinfo, 5, $iflags)
- DllStructSetData($tbrowseinfo, 6, $pbrowseproc)
- DllStructSetData($tbrowseinfo, 7, $lparam)
- DllStructSetData($tbrowseinfo, 8, 0)
- DllStructSetData($tbrowseinfo, 9, $stext)
- Local $ret = DllCall("shell32.dll", "ptr", "SHBrowseForFolderW", "struct*", $tbrowseinfo)
- If @error OR NOT $ret[0] Then Return SetError(@error, @extended, "")
- $result = _winapi_shellgetpathfromidlist($ret[0])
- _winapi_cotaskmemfree($ret[0])
- If $pidl Then
- _winapi_cotaskmemfree($pidl)
- EndIf
- If NOT $result Then Return SetError(10, 0, "")
- Return $result
- EndFunc
- Func _winapi_commdlgextendederrorex()
- Local $ret = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError")
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_confirmcredentials($starget, $fconfirm)
- If NOT __dll("credui.dll") Then Return SetError(103, 0, 0)
- Local $ret = DllCall("credui.dll", "dword", "CredUIConfirmCredentialsW", "wstr", $starget, "bool", $fconfirm)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_findtextdlg($howner, $sfindwhat = "", $iflags = 0, $pfindproc = 0, $lparam = 0)
- $__pfrbuffer = __heaprealloc($__pfrbuffer, 2 * $__ifrbuffersize)
- If @error Then Return SetError(@error + 20, @extended, 0)
- DllStructSetData(DllStructCreate("wchar[" & $__ifrbuffersize & "]", $__pfrbuffer), 1, StringLeft($sfindwhat, $__ifrbuffersize - 1))
- Local $tfr = DllStructCreate($tagfindreplace)
- DllStructSetData($tfr, "Size", DllStructGetSize($tfr))
- DllStructSetData($tfr, "hOwner", $howner)
- DllStructSetData($tfr, "hInstance", 0)
- DllStructSetData($tfr, "Flags", $iflags)
- DllStructSetData($tfr, "FindWhat", $__pfrbuffer)
- DllStructSetData($tfr, "ReplaceWith", 0)
- DllStructSetData($tfr, "FindWhatLen", $__ifrbuffersize * 2)
- DllStructSetData($tfr, "ReplaceWithLen", 0)
- DllStructSetData($tfr, "lParam", $lparam)
- DllStructSetData($tfr, "Hook", $pfindproc)
- DllStructSetData($tfr, "TemplateName", 0)
- Local $ret = DllCall("comdlg32.dll", "hwnd", "FindTextW", "struct*", $tfr)
- If @error OR NOT $ret[0] Then
- Local $error = @error + 30
- __heapfree($__pfrbuffer)
- If IsArray($ret) Then
- Return SetError(10, _winapi_commdlgextendederrorex(), 0)
- Else
- Return SetError($error, @extended, 0)
- EndIf
- EndIf
- Return $ret[0]
- EndFunc
- Func _winapi_flushfrbuffer()
- If NOT __heapfree($__pfrbuffer, 1) Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_formatdrivedlg($sdrive, $ioption = 0, $hparent = 0)
- If NOT IsString($sdrive) Then Return SetError(10, 0, 0)
- $sdrive = StringLeft(StringUpper(StringStripWS($sdrive, 1)), 1)
- If NOT $sdrive Then Return SetError(11, 0, 0)
- $sdrive = Asc($sdrive) - 65
- If ($sdrive < 0) OR ($sdrive > 25) Then Return SetError(12, 0, 0)
- Local $ret = DllCall("shell32.dll", "dword", "SHFormatDrive", "hwnd", $hparent, "uint", $sdrive, "uint", 65535, "uint", $ioption)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] < 0 Then Return SetError($ret[0], 0, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_getconnecteddlg($idlg, $iflags = 0, $hparent = 0)
- If NOT __dll("connect.dll") Then Return SetError(103, 0, 0)
- Switch $idlg
- Case 0
- $idlg = "GetNetworkConnected"
- Case 1
- $idlg = "GetInternetConnected"
- Case 2
- $idlg = "GetVPNConnected"
- Case Else
- Return SetError(1, 0, 0)
- EndSwitch
- Local $str = ""
- If BitAND($iflags, 1) Then
- $str &= "-SkipInternetDetection "
- EndIf
- If BitAND($iflags, 2) Then
- $str &= "-SkipExistingConnections "
- EndIf
- If BitAND($iflags, 4) Then
- $str &= "-HideFinishPage "
- EndIf
- Local $ret = DllCall("connect.dll", "long", $idlg, "hwnd", $hparent, "dword", 0, "dword", 0, "dword", 0, "handle", 0, "wstr", StringStripWS($str, 2))
- If @error Then Return SetError(@error, @extended, 0)
- If NOT ($ret[0] = 0 OR $ret[0] = 1) Then Return SetError(10, $ret[0], 0)
- Return Number(NOT $ret[0])
- EndFunc
- Func _winapi_getfrbuffer()
- Return $__ifrbuffersize - 1
- EndFunc
- Func _winapi_messageboxcheck($itype, $stitle, $stext, $sregval, $idefault = -1, $hparent = 0)
- Local $ret = DllCall("shlwapi.dll", "int", "SHMessageBoxCheckW", "hwnd", $hparent, "wstr", $stext, "wstr", $stitle, "uint", $itype, "int", $idefault, "wstr", $sregval)
- If @error Then Return SetError(@error, @extended, -1)
- Return $ret[0]
- EndFunc
- Func _winapi_messageboxindirect($tmsgboxparams)
- Local $ret = DllCall("user32.dll", "int", "MessageBoxIndirectW", "struct*", $tmsgboxparams)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_openfiledlg($stitle = "", $sinitdir = "", $sfilters = "", $ideffilter = 0, $sdeffile = "", $sdefext = "", $iflags = 0, $iflagsex = 0, $pofnproc = 0, $pdata = 0, $hparent = 0)
- Local $result = __ofndlg(0, $stitle, $sinitdir, $sfilters, $ideffilter, $sdeffile, $sdefext, $iflags, $iflagsex, $pofnproc, $pdata, $hparent)
- If @error Then Return SetError(@error, @extended, "")
- Return $result
- EndFunc
- Func _winapi_pagesetupdlg(ByRef $tpagesetupdlg)
- Local $ret = DllCall("comdlg32.dll", "int", "PageSetupDlgW", "struct*", $tpagesetupdlg)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $ret[0] Then Return SetError(10, _winapi_commdlgextendederrorex(), 0)
- Return $ret[0]
- EndFunc
- Func _winapi_pickicondlg($sicon = "", $iindex = 0, $hparent = 0)
- Local $ret = DllCall("shell32.dll", "int", "PickIconDlg", "hwnd", $hparent, "wstr", $sicon, "int", 4096, "int*", $iindex)
- If @error OR NOT $ret[0] Then Return SetError(@error + 10, @extended, 0)
- Local $result[2]
- Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $ret[2], "wstr", "", "dword", 4096)
- $result[0] = $aresult[2]
- $result[1] = $ret[4]
- Return $result
- EndFunc
- Func _winapi_printdlg(ByRef $tprintdlg)
- Local $ret = DllCall("comdlg32.dll", "long", "PrintDlgW", "struct*", $tprintdlg)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $ret[0] Then Return SetError(10, _winapi_commdlgextendederrorex(), 0)
- Return $ret[0]
- EndFunc
- Func _winapi_printdlgex(ByRef $tprintdlgex)
- Local $tpdex = DllStructCreate($tagprintdlgex, DllStructGetPtr($tprintdlgex))
- Local $ret = DllCall("comdlg32.dll", "long", "PrintDlgExW", "struct*", $tpdex)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return SetExtended(DllStructGetData($tpdex, "ResultAction"), 1)
- EndFunc
- Func _winapi_replacetextdlg($howner, $sfindwhat = "", $sreplacewith = "", $iflags = 0, $preplaceproc = 0, $lparam = 0)
- $__pfrbuffer = __heaprealloc($__pfrbuffer, 4 * $__ifrbuffersize)
- If @error Then Return SetError(@error + 100, @extended, 0)
- Local $tbuff = DllStructCreate("wchar[" & $__ifrbuffersize & "];wchar[" & $__ifrbuffersize & "]", $__pfrbuffer)
- DllStructSetData($tbuff, 1, StringLeft($sfindwhat, $__ifrbuffersize - 1))
- DllStructSetData($tbuff, 2, StringLeft($sreplacewith, $__ifrbuffersize - 1))
- Local $tfr = DllStructCreate($tagfindreplace)
- DllStructSetData($tfr, "Size", DllStructGetSize($tfr))
- DllStructSetData($tfr, "hOwner", $howner)
- DllStructSetData($tfr, "hInstance", 0)
- DllStructSetData($tfr, "Flags", $iflags)
- DllStructSetData($tfr, "FindWhat", DllStructGetPtr($tbuff, 1))
- DllStructSetData($tfr, "ReplaceWith", DllStructGetPtr($tbuff, 2))
- DllStructSetData($tfr, "FindWhatLen", $__ifrbuffersize * 2)
- DllStructSetData($tfr, "ReplaceWithLen", $__ifrbuffersize * 2)
- DllStructSetData($tfr, "lParam", $lparam)
- DllStructSetData($tfr, "Hook", $preplaceproc)
- DllStructSetData($tfr, "TemplateName", 0)
- Local $ret = DllCall("comdlg32.dll", "hwnd", "ReplaceTextW", "struct*", $tfr)
- If @error OR NOT $ret[0] Then
- Local $error = @error
- __heapfree($__pfrbuffer)
- If IsArray($ret) Then
- Return SetError(10, _winapi_commdlgextendederrorex(), 0)
- Else
- Return SetError($error, 0, 0)
- EndIf
- EndIf
- Return $ret[0]
- EndFunc
- Func _winapi_restartdlg($stext = "", $iflags = 2, $hparent = 0)
- Local $ret = DllCall("shell32.dll", "int", "RestartDialog", "hwnd", $hparent, "wstr", $stext, "int", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $ret[0]
- EndFunc
- Func _winapi_savefiledlg($stitle = "", $sinitdir = "", $sfilters = "", $ideffilter = 0, $sdeffile = "", $sdefext = "", $iflags = 0, $iflagsex = 0, $pofnproc = 0, $pdata = 0, $hparent = 0)
- Local $result = __ofndlg(1, $stitle, $sinitdir, $sfilters, $ideffilter, $sdeffile, $sdefext, $iflags, $iflagsex, $pofnproc, $pdata, $hparent)
- If @error Then Return SetError(@error, @extended, "")
- Return $result
- EndFunc
- Func _winapi_setfrbuffer($ichars)
- $ichars = Number($ichars)
- If $ichars < 80 Then
- $ichars = 80
- EndIf
- $__ifrbuffersize = $ichars + 1
- Return 1
- EndFunc
- Func _winapi_shellaboutdlg($stitle, $sname, $stext, $hicon = 0, $hparent = 0)
- Local $ret = DllCall("shell32.dll", "int", "ShellAboutW", "hwnd", $hparent, "wstr", $stitle & "#" & $sname, "wstr", $stext, "handle", $hicon)
- If @error Then Return SetError(@error, @extended, False)
- Return $ret[0]
- EndFunc
- Func _winapi_shellopenwithdlg($sfile, $iflags = 0, $hparent = 0)
- Local $topenasinfo = DllStructCreate("ptr;ptr;dword;wchar[" & (StringLen($sfile) + 1) & "]")
- DllStructSetData($topenasinfo, 1, DllStructGetPtr($topenasinfo, 4))
- DllStructSetData($topenasinfo, 2, 0)
- DllStructSetData($topenasinfo, 3, $iflags)
- DllStructSetData($topenasinfo, 4, $sfile)
- Local $ret = DllCall("shell32.dll", "long", "SHOpenWithDialog", "hwnd", $hparent, "struct*", $topenasinfo)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellstartnetconnectiondlg($sremote = "", $iflags = 0, $hparent = 0)
- Local $typeofremote = "wstr"
- If NOT StringStripWS($sremote, 3) Then
- $typeofremote = "ptr"
- $sremote = 0
- EndIf
- DllCall("shell32.dll", "long", "SHStartNetConnectionDialogW", "hwnd", $hparent, $typeofremote, $sremote, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shelluserauthenticationdlg($scaption, $smessage, $suser, $spassword, $starget, $iflags = 0, $ierror = 0, $fsave = 0, $hbitmap = 0, $hparent = 0)
- If NOT __dll("credui.dll") Then Return SetError(103, 0, 0)
- Local $tinfo = DllStructCreate("dword;hwnd;ptr;ptr;ptr;wchar[" & (StringLen($smessage) + 1) & "];wchar[" & (StringLen($scaption) + 1) & "]")
- DllStructSetData($tinfo, 1, DllStructGetPtr($tinfo, 6) - DllStructGetPtr($tinfo))
- DllStructSetData($tinfo, 2, $hparent)
- DllStructSetData($tinfo, 3, DllStructGetPtr($tinfo, 6))
- DllStructSetData($tinfo, 4, DllStructGetPtr($tinfo, 7))
- DllStructSetData($tinfo, 5, $hbitmap)
- DllStructSetData($tinfo, 6, $smessage)
- DllStructSetData($tinfo, 7, $scaption)
- Local $ret = DllCall("credui.dll", "dword", "CredUIPromptForCredentialsW", "struct*", $tinfo, "wstr", $starget, "ptr", 0, "dword", $ierror, "wstr", $suser, "ulong", 4096, "wstr", $spassword, "ulong", 4096, "bool*", $fsave, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- If $ret[0] Then Return SetError(10, $ret[0], 0)
- Local $result[3]
- $result[0] = $ret[5]
- $result[1] = $ret[7]
- $result[2] = $ret[9]
- Return $result
- EndFunc
- Func _winapi_shelluserauthenticationdlgex($scaption, $smessage, $suser, $spassword, $iflags = 0, $ierror = 0, $fsave = 0, $ipackage = 0, $hparent = 0)
- If NOT __dll("credui.dll") Then Return SetError(103, 0, 0)
- Local $tblob = 0, $ret
- If StringLen($suser) Then
- $ret = DllCall("credui.dll", "bool", "CredPackAuthenticationBufferW", "dword", 1, "wstr", $suser, "wstr", $spassword, "ptr", 0, "dword*", 0)
- If @error OR NOT $ret[5] Then Return SetError(@error + 10, @extended, 0)
- $tblob = DllStructCreate("byte[" & $ret[5] & "]")
- $ret = DllCall("credui.dll", "bool", "CredPackAuthenticationBufferW", "dword", 1, "wstr", $suser, "wstr", $spassword, "struct*", $tblob, "dword*", $ret[5])
- If @error OR NOT $ret[0] Then Return SetError(@error + 20, @extended, 0)
- EndIf
- Local $tinfo = DllStructCreate("dword;hwnd;ptr;ptr;ptr;wchar[" & (StringLen($smessage) + 1) & "];wchar[" & (StringLen($scaption) + 1) & "]")
- DllStructSetData($tinfo, 1, DllStructGetPtr($tinfo, 6) - DllStructGetPtr($tinfo))
- DllStructSetData($tinfo, 2, $hparent)
- DllStructSetData($tinfo, 3, DllStructGetPtr($tinfo, 6))
- DllStructSetData($tinfo, 4, DllStructGetPtr($tinfo, 7))
- DllStructSetData($tinfo, 5, 0)
- DllStructSetData($tinfo, 6, $smessage)
- DllStructSetData($tinfo, 7, $scaption)
- $ret = DllCall("credui.dll", "dword", "CredUIPromptForWindowsCredentialsW", "struct*", $tinfo, "dword", $ierror, "ulong*", $ipackage, "struct*", $tblob, "ulong", DllStructGetSize($tblob), "ptr*", 0, "ulong*", 0, "bool*", $fsave, "dword", $iflags)
- If @error Then Return SetError(@error + 30, @extended, 0)
- If $ret[0] Then Return SetError(30, $ret[0], 0)
- Local $result[4]
- $result[2] = $ret[8]
- $result[3] = $ret[3]
- Local $pblob = $ret[6]
- Local $size = $ret[7]
- $ret = DllCall("credui.dll", "bool", "CredUnPackAuthenticationBufferW", "dword", 1, "ptr", $pblob, "dword", $size, "wstr", "", "dword*", 4096, "wstr", "", "dword*", 4096, "wstr", "", "dword*", 4096)
- If NOT @error AND $ret[0] Then
- $result[0] = $ret[4]
- $result[1] = $ret[8]
- Else
- $result = @error + 40
- EndIf
- If NOT _winapi_zeromemory($pblob, $size) Then
- EndIf
- _winapi_cotaskmemfree($pblob)
- If $result Then Return SetError($result, 0, 0)
- Return $result
- EndFunc
- #EndRegion Public Functions
- #Region Internal Functions
- Func __ofndlg($idlg, $stitle, $sinitdir, $sfilters, $ideffilter, $sdeffile, $sdefext, $iflags, $iflagsex, $pofnproc, $pdata, $hparent)
- Local $tbuffer = DllStructCreate("wchar[32768]")
- Local $tfilters = 0, $tdefext = 0, $tinitdir = 0, $ttitle = 0
- Local $tofn = DllStructCreate($tagopenfilename)
- DllStructSetData($tofn, 1, DllStructGetSize($tofn))
- DllStructSetData($tofn, 2, $hparent)
- DllStructSetData($tofn, 3, 0)
- Local $adata = StringSplit($sfilters, "|")
- Local $afilters[$adata[0] * 2]
- Local $count = 0
- For $i = 1 To $adata[0]
- $afilters[$count + 0] = StringStripWS($adata[$i], 3)
- $afilters[$count + 1] = StringStripWS(StringRegExpReplace($adata[$i], ".*\((.*)\)", "\1"), 8)
- If $afilters[$count + 1] Then
- $count += 2
- EndIf
- Next
- If $count Then
- $tfilters = _winapi_arraytostruct($afilters, 0, $count - 1)
- If @error Then
- EndIf
- EndIf
- DllStructSetData($tofn, 4, DllStructGetPtr($tfilters))
- DllStructSetData($tofn, 5, 0)
- DllStructSetData($tofn, 6, 0)
- DllStructSetData($tofn, 7, $ideffilter)
- $sdeffile = StringStripWS($sdeffile, 3)
- If $sdeffile Then
- DllStructSetData($tbuffer, 1, $sdeffile)
- EndIf
- DllStructSetData($tofn, 8, DllStructGetPtr($tbuffer))
- DllStructSetData($tofn, 9, 32768)
- DllStructSetData($tofn, 10, 0)
- DllStructSetData($tofn, 11, 0)
- $sinitdir = StringStripWS($sinitdir, 3)
- If $sinitdir Then
- $tinitdir = DllStructCreate("wchar[" & (StringLen($sinitdir) + 1) & "]")
- EndIf
- DllStructSetData($tinitdir, 1, $sinitdir)
- DllStructSetData($tofn, 12, DllStructGetPtr($tinitdir))
- $stitle = StringStripWS($stitle, 3)
- If $stitle Then
- $ttitle = DllStructCreate("wchar[" & (StringLen($stitle) + 1) & "]")
- EndIf
- DllStructSetData($ttitle, 1, $stitle)
- DllStructSetData($tofn, 13, DllStructGetPtr($ttitle))
- DllStructSetData($tofn, 14, $iflags)
- DllStructSetData($tofn, 15, 0)
- DllStructSetData($tofn, 16, 0)
- $sdefext = StringStripWS($sdefext, 3)
- If $sdefext Then
- $tdefext = DllStructCreate("wchar[" & (StringLen($tdefext) + 1) & "]")
- EndIf
- DllStructSetData($tdefext, 1, StringReplace($sdefext, ".", ""))
- DllStructSetData($tofn, 17, DllStructGetPtr($tdefext))
- DllStructSetData($tofn, 18, $pdata)
- DllStructSetData($tofn, 19, $pofnproc)
- DllStructSetData($tofn, 20, 0)
- DllStructSetData($tofn, 21, 0)
- DllStructSetData($tofn, 22, 0)
- DllStructSetData($tofn, 23, $iflagsex)
- Local $ret
- Switch $idlg
- Case 0
- $ret = DllCall("comdlg32.dll", "int", "GetOpenFileNameW", "struct*", $tofn)
- Case 1
- $ret = DllCall("comdlg32.dll", "int", "GetSaveFileNameW", "struct*", $tofn)
- Case Else
- EndSwitch
- If @error Then Return SetError(@error, @extended, "")
- If NOT $ret[0] Then Return SetError(10, _winapi_commdlgextendederrorex(), "")
- If BitAND($iflags, 512) Then
- If BitAND($iflags, 524288) Then
- $adata = _winapi_structtoarray($tbuffer)
- If @error Then
- Return SetError(11, 0, "")
- EndIf
- Else
- $adata = StringSplit(DllStructGetData($tbuffer, 1), " ")
- EndIf
- Switch $adata[0]
- Case 0
- Return SetError(12, 0, "")
- Case 1
- Case Else
- Local $path = $adata[1]
- For $i = 2 To $adata[0]
- $adata[$i - 1] = _winapi_pathappend($path, $adata[$i])
- Next
- ReDim $adata[$adata[0]]
- $adata[0] -= 1
- EndSwitch
- Else
- $adata = DllStructGetData($tbuffer, 1)
- EndIf
- $__ext = $tofn
- Return $adata
- EndFunc
- #EndRegion Internal Functions
- Global $i
- Global $check_on_off = 0
- Global $v = 0, $anti = 0, $ad = 0, $m = 0, $update, $s = 0
- Global $rest, $again, $tip
- Local $programname = "Zerux Beta 1.2"
- Local $tmp_v = "", $tmp_anti = "", $tmp_ad = "", $tmp_m = "", $tmp_s = ""
- Global $zeruxgui
- Opt("TrayOnEventMode", 1)
- Opt("TrayMenuMode", 1)
- If _singleton(@ScriptName, 1) = 0 Then
- Exit
- EndIf
- ProcessSetPriority(@ScriptName, 1)
- DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
- $runguard1000 = TrayCreateItem($programname)
- TrayItemSetOnEvent(-1, "start")
- $license = TrayCreateItem("라이센스")
- TrayItemSetOnEvent(-1, "license")
- TrayCreateItem("")
- $check = TrayCreateItem("실시간 감시 On/Off")
- TrayItemSetOnEvent(-1, "check")
- TrayCreateItem("")
- $setting_are = TrayCreateItem("환경설정")
- TrayItemSetOnEvent(-1, "setting_are")
- TrayCreateItem("")
- $exit = TrayCreateItem("종료")
- TrayItemSetOnEvent(-1, "_exit")
- TraySetState()
- TraySetToolTip($programname)
- Func start()
- Local $socket, $data
- If ProcessExists("zeruxgui.exe") Then
- UDPStartup()
- $socket = UDPOpen(@IPAddress1, 1000)
- $data = "exit"
- UDPSend($socket, $data)
- UDPCloseSocket($socket)
- UDPShutdown()
- $zeruxgui = 0
- Else
- Run(@ScriptDir & "\zeruxgui.exe")
- $zeruxgui = 1
- EndIf
- EndFunc
- Func license()
- _winapi_shellaboutdlg("Elkiesoft License", "Zerux AI Security", "개인 사용자 한에서만 무료로 사용 재배포가 가능하며 수정및 판매는 불가능합니다. 기업 ,단체, 공기관은 로열티나 사용료를 지불하여 계약에 따라 사용할수 있습니다.", _winapi_shellextracticon(@AutoItExe, 0, 32, 32))
- EndFunc
- Func check()
- If $check_on_off == 1 Then
- $check_on_off = 0
- TrayTip($programname, "실시간 감시 시작되었습니다!", 1, 5)
- ElseIf $check_on_off == 0 Then
- $check_on_off = 1
- TrayTip($programname, "실시간 감시 중지되었습니다!", 1, 5)
- EndIf
- EndFunc
- Func setting_are()
- Run(@ScriptDir & "\환경설정")
- EndFunc
- Func _exit()
- Local $socket, $data
- UDPStartup()
- $socket = UDPOpen(@IPAddress1, 1000)
- $data = "exit"
- UDPSend($socket, $data)
- UDPCloseSocket($socket)
- UDPShutdown()
- ClipPut(StringToBinary(@MDAY & @MON, 1))
- Do
- Sleep(500)
- Until ClipGet() == StringToBinary(@MON & @MDAY, 1)
- ClipPut("")
- Exit
- EndFunc
- If NOT FileExists(@ScriptDir & "\setting.ini") Then
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "virus", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "anticode", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "adware", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "melware", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "spyware", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "again", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_TWO", "tip", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_TWO", "start", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_TWO", "update", 1)
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "speed", 20)
- IniWrite(@ScriptDir & "\setting.ini", "SET_ONE", "ping", 1)
- EndIf
- Global $gver = IniRead(@ScriptDir & "\G-Engine.ini", "Ver", "Version", "")
- Global $tmp
- $update = IniRead(@ScriptDir & "\setting.ini", "SET_TWO", "update", "")
- If $update == 1 Then
- If Ping("210.216.176.19") Then
- TrayTip($programname, $gver & " : 서버 불안정으로 업데이트 연기합니다.", 1, 5)
- Else
- $tmp = BinaryToString(InetRead("http://zerux.co.kr/zerux/gver.txt"), 1)
- If $gver == $tmp Then
- TrayTip($programname, $gver & " : 최신 백신엔진 사용중", 1, 5)
- Else
- FileDelete(@ScriptDir & "\G-Engine.ini")
- FileWrite(@ScriptDir & "\G-Engine.ini", BinaryToString(InetRead("http://zerux.co.kr/zerux/gengine.txt"), 1))
- $gver = IniRead(@ScriptDir & "\G-Engine.ini", "Ver", "Version", "")
- TrayTip($programname, $gver & " : 백신엔진 업데이트완료!", 1, 5)
- EndIf
- EndIf
- EndIf
- TraySetToolTip($programname & ": " & $gver)
- $rest = IniRead(@ScriptDir & "\setting.ini", "SET_ONE", "speed", "")
- $again = IniRead(@ScriptDir & "\setting.ini", "SET_ONE", "again", "")
- $tip = IniRead(@ScriptDir & "\setting.ini", "SET_TWO", "tip", "")
- $zeruxgui = IniRead(@ScriptDir & "\setting.ini", "SET_TWO", "gui", "")
- _main()
- Func _main()
- While (1)
- If $check_on_off == 1 Then
- ContinueLoop
- EndIf
- DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
- If NOT ProcessExists("zerux.exe") Then
- If NOT ProcessExists("zerux.exe") Then
- Run(@ScriptDir & "\zerux.exe")
- EndIf
- EndIf
- If NOT ProcessExists("zeruxgui.exe") Then
- If $zeruxgui == 1 Then
- Run(@ScriptDir & "\zeruxgui.exe")
- EndIf
- EndIf
- If IniRead(@ScriptDir & "\setting.ini", "SET_ONE", "virus", "") == 1 Then
- $virus = IniReadSection(@ScriptDir & "\G-Engine.ini", "Virus")
- For $i = 1 To $virus[0][0]
- If ProcessExists($virus[$i][1]) Then
- If $again == 1 Then
- If StringCompare($tmp_v, $virus[$i][1]) == 0 Then
- $v += 1
- If $v <= 2 Then
- ProcessClose($virus[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $virus[$i][1] & "는 바이러스 임으로 종료합니다.", 1, 5)
- EndIf
- ElseIf $v == 3 Then
- If $tip == 1 Then
- ToolTip($virus[$i][1] & "를 종료하는데 실패함!", 0, 0, $programname)
- Sleep(3000)
- ToolTip("")
- EndIf
- EndIf
- Else
- ProcessClose($virus[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $virus[$i][1] & "는 바이러스 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- $tmp_v = $virus[$i][1]
- Else
- ProcessClose($virus[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $virus[$i][1] & "는 바이러스 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- EndIf
- Sleep($rest)
- Next
- EndIf
- If IniRead(@ScriptDir & "\setting.ini", "SET_ONE", "anticode", "") == 1 Then
- $anticode = IniReadSection(@ScriptDir & "\G-Engine.ini", "AntiCode")
- For $i = 1 To $anticode[0][0]
- If ProcessExists($anticode[$i][1]) Then
- If $again == 1 Then
- If StringCompare($tmp_anti, $anticode[$i][1]) == 0 Then
- $anti += 1
- If $anti <= 2 Then
- ProcessClose($anticode[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $anticode[$i][1] & "는 악성코드 임으로 종료합니다.", 1, 5)
- EndIf
- ElseIf $anti == 3 Then
- If $tip == 1 Then
- ToolTip($anticode[$i][1] & "를 종료하는데 실패함!", 0, 0, $programname)
- Sleep(3000)
- ToolTip("")
- EndIf
- EndIf
- Else
- ProcessClose($anticode[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $anticode[$i][1] & "는 악성코드 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- $tmp_anti = $anticode[$i][1]
- Else
- ProcessClose($anticode[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $anticode[$i][1] & "는 악성코드 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- EndIf
- Sleep($rest)
- Next
- EndIf
- If IniRead(@ScriptDir & "\setting.ini", "SET_ONE", "adware", "") == 1 Then
- $adware = IniReadSection(@ScriptDir & "\G-Engine.ini", "Adware")
- For $i = 1 To $adware[0][0]
- If ProcessExists($adware[$i][1]) Then
- If $again == 1 Then
- If StringCompare($tmp_ad, $adware[$i][1]) == 0 Then
- $ad += 1
- If NOT $ad <= 2 Then
- ProcessClose($adware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $adware[$i][1] & "는 애드웨어 임으로 종료합니다.", 1, 5)
- EndIf
- ElseIf $ad == 3 Then
- If $tip == 1 Then
- ToolTip($adware[$i][1] & "를 종료하는데 실패함!", 0, 0, $programname)
- Sleep(3000)
- ToolTip("")
- EndIf
- EndIf
- Else
- ProcessClose($adware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $adware[$i][1] & "는 애드웨어 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- $tmp_ad = $adware[$i][1]
- Else
- ProcessClose($adware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $adware[$i][1] & "는 애드웨어 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- EndIf
- Sleep($rest)
- Next
- EndIf
- If IniRead(@ScriptDir & "\setting.ini", "SET_ONE", "spyware", "") == 1 Then
- $spyware = IniReadSection(@ScriptDir & "\G-Engine.ini", "Spyware")
- For $i = 1 To $spyware[0][0]
- If ProcessExists($spyware[$i][1]) Then
- If $again == 1 Then
- If StringCompare($tmp_s, $spyware[$i][1]) == 0 Then
- $s += 1
- If $s <= 2 Then
- ProcessClose($spyware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $spyware[$i][1] & "는 스파이웨어 임으로 종료합니다.", 1, 5)
- EndIf
- ElseIf $s == 3 Then
- If $tip == 1 Then
- ToolTip($spyware[$i][1] & "를 종료하는데 실패함!", 0, 0, $programname)
- Sleep(3000)
- ToolTip("")
- EndIf
- EndIf
- Else
- ProcessClose($spyware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $spyware[$i][1] & "는 스파이웨어 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- $tmp_s = $spyware[$i][1]
- Else
- ProcessClose($spyware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $spyware[$i][1] & "는 스파이웨어 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- EndIf
- Sleep($rest)
- Next
- EndIf
- If IniRead(@ScriptDir & "\setting.ini", "SET_ONE", "melware", "") == 1 Then
- $melware = IniReadSection(@ScriptDir & "\G-Engine.ini", "Melware")
- For $i = 1 To $melware[0][0]
- If ProcessExists($melware[$i][1]) Then
- If $again == 1 Then
- If StringCompare($tmp_m, $melware[$i][1]) == 0 Then
- $m += 1
- If $m <= 2 Then
- ProcessClose($melware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $melware[$i][1] & "는 맬웨어 임으로 종료합니다.", 1, 5)
- EndIf
- ElseIf $m == 3 Then
- If $tip == 1 Then
- ToolTip($melware[$i][1] & "를 종료하는데 실패함!", 0, 0, $programname)
- Sleep(3000)
- ToolTip("")
- EndIf
- EndIf
- Else
- ProcessClose($melware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $melware[$i][1] & "는 맬웨어 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- $tmp_m = $melware[$i][1]
- Else
- ProcessClose($melware[$i][1])
- If $tip == 1 Then
- TrayTip($programname, $melware[$i][1] & "는 맬웨어 임으로 종료합니다.", 1, 5)
- EndIf
- EndIf
- EndIf
- Sleep($rest)
- Next
- EndIf
- Sleep(1000)
- WEnd
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement