├── README.md
├── docs
└── BUILDING.TXT
└── src
├── Changelog.txt
├── NUtils.au3
├── NUtilsApi.au3
├── ReadMe.html
├── WinMurderer.ini
├── hotkeys.ini
├── include
├── Date.au3
├── FileConstants.au3
├── Inet.au3
├── Memory.au3
├── MemoryConstants.au3
├── ProcessConstants.au3
├── Security.au3
├── SecurityConstants.au3
├── SendMessage.au3
├── StructureConstants.au3
├── WinAPI.au3
└── WinAPIError.au3
├── lang
├── en.ini
├── es.ini
└── nl.ini
├── license.txt
└── settings.ini
/README.md:
--------------------------------------------------------------------------------
1 | # NUtils Readme
2 |
3 | NUtils is copyright© 2008-2010 Arbalon, Niko Carpenter, and Tyler Spivey.
4 | Web site: [http://www.arbalon.com].
5 |
6 | ## 1: Introduction
7 |
8 | ### 1.1: What is NUtils?
9 |
10 | NUtils is a hotkey-controled Window manager, to extend the functionality of Windows to increase productivity.
11 |
12 | ### 1.2: Features
13 |
14 | Below is a summary of NUtil's feature set:
15 |
16 | * Show/hide up to 10 windows with one keystroke
17 | * Create multiple "stacks" of windows--for those times when more than 10 windows need to be hidden). Switch between these stacks with a simple keystroke.
18 | * Change the title of any window--to easily sort through windows whose titles are the same by default.
19 | * Make a window transparent--to protect against nosy onlookers; to interact with the window, a screen reader must be used.
20 | * Forcefully kill the current window for non-responding applications.
21 | * Automatically close windows that exist in a list, or kill the process associated with them.
22 | * Get a list of all hidden windows in an organized tree.
23 |
24 | ### 1.3: Installing
25 |
26 | #### 1.3.1: Installing from the self-extracting archive
27 |
28 | To install NUtils from the self-extracting archive, Run NUtils-portible.exe and extract NUtils in the desired location. A folder called NUtils will be created. To run NUtils, go into the newly created folder and run NUtils.exe.
29 |
30 | #### 1.3.2: Installing NUtils with the installer
31 |
32 | To install NUtils using the installer, to get desktop and start menu shortcuts, run NUtils_Setup.exe and follow the instructions. To start NUtils, double click the NUtils shortcut that has been placed on your desktop, or in your start menu.
33 |
34 | #### 1.3.3: Configuring NUtils to run at startup.
35 |
36 | To configure NUtils to run at startup, if using the installed copy, right click the shortcut to NUtils on your desktop and click copy. Next, right click the start button and click open all users, or just open if you only wish for NUtils to start up under your user account. Double click Programs, and then double click Startup. Right click a blank area in this folder and click paste. If you are using the portible copy, make sure that it is not on a removeable drive as NUtils will not start if this drive is not plugged in when the computer is started. In the NUtils folder, right click NUtils.exe and click create shortcut. A shortcut will be created in the same folder. Right click this shortcut and click cut. Next, right click the start button and click open all users, or just open if you only wish for NUtils to start up under your user account. Double click Programs, and then double click Startup. Right click a blank area in this folder and click paste.
37 |
38 | ## 2: Using NUtils
39 |
40 | Note: This readme asumes that you are using the default hotkey assignments. If you have changed any hotkeys in hotkeys.ini, you will have to make a note of that when accessing those functions.
41 |
42 | ### 2.1: Hiding and unhiding windows using the number ro
43 |
44 | If there are several windows open, it can be useful to hide them, so that they aren't taking up room on your taskbar, or in your alt+tab order. This could be to hide a window that you wish to keep open but aren't really doing much with, such as a media player, or notepad with some notes that you wish to access later, or to hide a window so it can be easily recalled, like a document or web page.
45 |
46 | To hide a window, place your focus into the window you wish to hide, either by clicking your mouse into it, clicking its icon on the taskbar, or alt+tabbing to it. Next, hold down control and shift, and press any number on the number row. To try this, go to any window and press control+shift+1\. Notice that the window you were in is no longer visible. Now, go ahead and do some things on your computer. Whenever you want to get that window back, just press control+shift+1 again, and the window will reappear.
47 |
48 | In summary, if you remain on the same stack--stacks will be explained in the next section, pressing control+shift and any number will hide the active window, unless there is a window already hidden in that "slot," in which case that hidden window will be "unhidden" and will gain focus. Note that control+shift+0 is actually slot 10, not slot 0.
49 |
50 | At times, it is useful to be able to hide the active window without having to find a free slot to hide it in--sometimes, you don't care where a window is hidden; you just want it hidden. If you want to hide a window, but do not necessarily care which slot it goes into, press windows+shift+h, and NUtils will hide it in the first available slot. Note that the first available slot is calculated starting on your current stack, so if you're on stack 3 and you press windows+shift+h, NUtils will start searching at stack 3, slot 1, to find the first slot that is free. This may mean that your window will be hidden on the next stack, if the current stack is full.
51 |
52 | ### 2.2: Working with stacks
53 |
54 | If you want to work with more than ten windows, or you simply wish to be a little bit more organized with the way you hide your windows, you can create a new stack, giving you ten blank slots to hide windows in. A stack is a set of ten slots in which to hide and or unhide windows. By default, you are on stack 1\. To go to the next stack, press control+shift=. To go to the previous stack, press control+shift+-.
55 |
56 | A common use for stacks, other than for hiding more than ten windows, is to hide different types of applications on different stacks. For example, you might want to leave stack 1 open for things that you will frequently access like your media player, web pages, installations, etc. However, you have a bunch of Audio Repeaters open--Audio Repeater is a program used to pass audio from the input device of one soundcard and output it onto another sound card, and you wish to hide them. When you have five copies of Audio Repeater open, it is very handy to have them hidden, because you don't really need to do much with them besides leaving them open, but you don't want them in your way. However, you don't want them cluttering up your first stack, where you like to hide the windows that you actually need to do something with. So you switch to stack 2, hide your Audio Repeaters, and then switch back to stack 1.
57 |
58 | Just be aware that you cannot unhide a window that is on a different stack by pressing control+shift+its number; you will first need to switch back to that stack and then unhide it. By default, NUtils will inform you of what stack you are on when you switch to it by beeping x number of times, where x is the stack you've switched to. For example, when switching to stack 2, NUtils will beep twice. This behavior can be changed by editing settings.ini, and under the settings section, changing StackCounter=1 to StackCounter=0\. With this set, NUtills will use a number pack to announce which stack you are switching to. By default, NUtils comes with the DTMF number pack, but other number packs can be found on the download page for NUtils.
59 |
60 | ### 2.3: Hidden Window List
61 |
62 | NUtils provides a list of all hidden windows, organized in a tree structure. Press windows+shift+l to recall this list. Hidden windows are organized by stack. To unhide a window, click the window you wish to unhide, and then click the unhide button in the lower left-hand corner of the dialog. You will notice that NUtils will automatically give focus to the last window you hid, so an easy way to unhide the last hidden window is to press windows+shift+l and when the list comes up, press enter. A history of all of your hidden windows is kept, so you could for example, press windows+shift+h to hide several windows, and then press windows+shift+l, then enter, and each time you do that, your windows will be unhidden in reverse order. This history is not kept after NUtils is restarted.
63 |
64 | ### 2.4: Making windows transparent
65 |
66 | There are times where you might find yourself in a situation in which you wish to interact with a window, yet you don't want the window to be visible on the screen. To make a window transparent, press windows+shift+\. To make the window solid again, press windows+shift+/. To interact with this window, you will need a screen reader. The act of making a window transparent throws off some screen readers that use display hooking, so there are limits to the use of this feature.
67 |
68 | ### 2.5: Changing the Process Priority of the Active Window
69 |
70 | If, for whatever reason, you wish to change the process priority of the active window, press control+shift+f3-f8, where f3 is low, f4 is below normal, f5 is normal, f6 is above normal, f7 is high, and f8 is realtime. A beep, pitched higher for higher priorities, will be played to let you know that the priority has been changed. If it could not be changed, a low beep will play, indicating that the process priority could not be changed.
71 |
72 | ## 3: Other notes
73 |
74 | ### 3.1: Limitations
75 |
76 | NUtils cannot perform actions on windows that it doesn't have permission to act upon. As a consequence, if NUtils is running normally, it cannot hide, change the process priority, or make transparent windows that are running with elevated privileges.
77 |
78 | ### 3.2: Reducing the Size of NUtils
79 |
80 | If you want to make the NUtils package smaller, you can remove the sounds folder. NUtils will instead produce PC speaker beeps in place of the sounds that would have been played otherwise.
81 |
82 | ### 3.3: The NUtils API
83 |
84 | There is a basic API to control NUtils. This API will allow your application to pass the handle of a window to NUtils. NUtils will find the first available slot starting from stack 1, and hide that window in that slot. When your application calls the NUtils API with the same parameters, NUtils will unhide that window. An AutoIt include file, NUtilsApi.au3, can be found in the NUtils folder. To use the API in your application, just include NUtilsApi.au3, and call _NUtils_ShowHide($handle) where $handle is the handle of the window you wish to hide.
85 |
86 | ## 4: Contact us
87 |
88 | You may contact either Niko Carpenter or Tyler Spivey via email:
89 |
90 |
91 |
92 | - Niko Carpenter (primary contact)
93 |
94 | - nik62591@gmail.com
95 |
96 | - Tyler Spivey
97 |
98 | - tspivey@pcdesk.net
99 |
100 |
101 |
102 | ## 5: Credits
103 |
104 | While I, Niko Carpenter, am the original coder for NUtils, I need to give credit to a few people who've helped me a lot along the way.
105 |
106 | 1. I give credit to Tyler Spivey, who has done most of the coding of NUtils other than myself. And for coming up with a great idea for the NUtils API/coding the NUtils API. He is the co-author of this program.
107 | 2. Justin Thornton, for giving me and Tyler the idea for stacks; without him, NUtils would still be limited to only 10 Windows. And to him for the process priority idea.
108 | 3. Matt King for the idea of Win+Shift+h, giving you the ability to just hide a window anywhere, and win+shift+l, allowing you to see and unhide your windows from anywhere.
109 | 4. And for everyone's great suggestions and feedback, and most importantly, your continued thanks and want to use NUtils has inspired me to work so much further than just suiting my needs.
110 |
111 | Remember, NUtils was once just one of my many personal scripts to make my life that much easier, one of those scripts that I would never release.
112 |
113 | ## 6: License
114 |
115 | NUtils is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
116 |
117 | NUtils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
118 |
119 | You should have received a copy of the GNU General Public License along with NUtils. If not, see [http://www.gnu.org/licenses/].
--------------------------------------------------------------------------------
/docs/BUILDING.TXT:
--------------------------------------------------------------------------------
1 | Building NUtils:
2 |
3 | Note you must compile NUtils.exe for NUtils to work. You may not run NUtils uncompiled. However, running NUtils.exe will run NUtils.au3, so any updates to NUtils.au3 will take effect when running NUtils.exe.
4 |
5 | Building NUtils is very simple. To compile NUtils, you'll need to get AutoIt version 3.3.0.0 or later (AutoIt loves changing stuff around that breaks code written in earlier versions, so if things break, use AutoIt 3.3.0.0).
6 | AutoIt can be downloaded at http://www.autoitscript.com/autoit3
7 |
8 | Once AutoIt is installed, right click NUtils.au3 and compile script. If you are running on x64, choose compile script (x86).
9 |
10 | For sounds, download NUtils-sounds from http://arbalon-nutils.googlecode.com
11 | Get NUtils-sounds.zip from the downloads page. Extract that zip archive into the src folder (you should have a folder called src\sounds).
--------------------------------------------------------------------------------
/src/Changelog.txt:
--------------------------------------------------------------------------------
1 | 3.1.1:
2 | Reorganized the source to included Autoit user-defined functions instead of having them pasted directly in the source.
3 | Fixed a bug were the version was not fetched from the web site
4 | 3.1:
5 | Base modifyer keys for hiding and unhiding windows, and for increasing and decreasing the stack number are changed from Windows+shift to control+shift to prevent conflicting with Windows 7 and later's quick launch keys.
6 | The check for updates feature now runs when NUtils starts, so users will automatically be notified when updates are available.
7 | 3.0:
8 | Hidden windows are now saved to the temp folder.
9 | Bug fix: Sometimes unhide window would crash NUtils.
10 | Fixed unhide GUI (positioning)
11 | Check for updates feature added.
12 | Changed handling of slots; now goes from 1-10 rather than 0-9.
13 | Bug fix: Hidden windows that disappeared weren't removed from the hidden window list in all cases.
14 | You may no longer hide the desktop/system tray/start menu (Classes: Progman and Shell_TrayWnd.)
15 | PC speaker beeps now play when wave files don't exist (similar to old versions.)
16 | Changed frequency of transparent/solid PC speaker beeps.
17 | Made changes to sound files (to decrease size.)
18 | The current window's process priority can be set with hotkeys.
19 | A sound plays when a hidden window no longer exists.
20 | Selecting a stack number in the unhide dialog will unhide all windows in that stack.
21 | Bug fix: Hiding and unhiding a window in slot 0 using the unhide dialog didn't work.
22 | Bug fix: GUI event loop did not exit when closing the unhide window.
23 | Process Explorer hotkey removed.
24 | Added multilingual support.
25 | Reallowed old-style StackCounter beeps: You can now toggle between the two styles.
26 | Now comes with the DTMF numbers pack only; StackCounter notifications are enabled by default.
27 | No longer plays StackCounter sound on stack change with StackCounter set to 0.
28 | Reverts to old-style StackCounter setting if one or more numbers to play are missing.
29 | Hotkeys can now be redefined in a configuration file.
30 | 2.7:
31 | Stacks are now announced by numbers.
32 | 2.6:
33 | NUtils loader has been removed; It is now part of the actual source code.
34 | It is not necessary to recompile everytime it is modified, but it is recommended if you are planning to release it.
35 | NUtils is now licensed under the GPL
36 | 2.5:
37 | Added the ability to hide a window in the first available slot.
38 | Users can now see all of their hidden windows and unhide them from anywhere with one keystroke.
39 | 2.2:
40 | Windows can now be made transparent
41 | Useless PC speaker beeps removed; the volume of sound files has been decreased.
42 | 2.1:
43 | No longer crashes when running on a device that has been removed.
44 | R2:
45 | You may no longer have NUtils send normal close messages to a window; if the window would have come up with a dialog on window close, NUtils would try closing it and loop endlessly.
46 | NUtils hide function fixed; no longer tries hiding the active window.
47 | Array is resizeable; boosts performance and decreases the size of hiddenwindows.
48 | You may now unhide windows from the system tray.
--------------------------------------------------------------------------------
/src/NUtils.au3:
--------------------------------------------------------------------------------
1 | #cs
2 | NUtils is free software: you can redistribute it and/or modify
3 | it under the terms of the GNU General Public License as published by
4 | the Free Software Foundation, either version 3 of the License, or
5 | any later version.
6 |
7 | NUtils is distributed in the hope that it will be useful,
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 | GNU General Public License for more details.
11 |
12 | You should have received a copy of the GNU General Public License
13 | along with NUtils. If not, see http://www.gnu.org/licenses/.
14 | #ce
15 |
16 | #include "include\Inet.au3"
17 | FileChangeDir(@ScriptDir)
18 | $winname = "ArbalonNUtilsWND"
19 | if @Compiled Then NUtilsLoad()
20 | Global $lang = INIRead("settings.ini", "settings", "language", "eng")
21 | Global $StackCounter=INIRead("settings.ini", "settings", "StackCounter", "1")
22 |
23 | Const $Info_Version="3.1.1"
24 | Const $Info_Authors = "Niko Carpenter "&_t("and")&" Tyler Spivey"
25 | Const $Info_WebSite = "http://www.arbalon.com"
26 | if $cmdline[0] < 1 Then Exit
27 | if $cmdline[1] = "CheckForUpdatesQuiet" Then
28 | CheckForUpdates(true)
29 | Exit
30 | ElseIf $cmdline[1] = "CheckForUpdates" Then
31 | CheckForUpdates(false)
32 | ElseIf $cmdline[1] = "nutils" Then
33 | Else
34 | Exit
35 | EndIf
36 | global $hiddenwindows[1] = ["x"]
37 | Global Const $GUI_FOCUS = 256
38 | Global Const $GUI_EVENT_CLOSE = -3
39 | Global Const $GUI_DISABLE = 128
40 | AutoItSetOption("WinTitleMatchMode", 4)
41 | autoitSetOption("TrayAutoPause", 0)
42 | autoItSetOption("TrayOnEventMode", 1)
43 | autoitSETOption("trayMenuMode", 1)
44 | TraySetTooltip("NUtils")
45 | global $tid_exit = TrayCreateItem(_t("Exiticon"))
46 | global $tid_lng = trayCreateItem(_t("SelectLanguage") & " (Select Language)...")
47 | global $tid_Checkforupdates = trayCreateItem(_t("CheckForUpdates")&"...")
48 | global $tid_about = trayCreateItem(_t("About")&"...")
49 | TrayCreateItem("")
50 | trayItemSetOnEvent($tid_exit, "trayEvent")
51 | trayItemSetOnEvent($tid_lng, "trayEvent")
52 | trayItemSetOnEvent($tid_Checkforupdates, "trayEvent")
53 | trayItemSetOnEvent($tid_about, "trayEvent")
54 | global $shift = 0
55 | $hwFile = @TempDir & "\NUtils_Hiddenwindows"
56 | While WinExists($winname)
57 | WinKill($winname)
58 | Wend
59 | Global $hk_bass=INIRead("hotkeys.ini", "hotkeys", "bass", "^+")
60 | Global $hk_stackdown=INIRead("hotkeys.ini", "hotkeys", "stackdown", "^+-")
61 | Global $hk_stackup=INIRead("hotkeys.ini", "hotkeys", "stackup", "^+=")
62 | Global $hk_chtitle=INIRead("hotkeys.ini", "hotkeys", "chtitle", "#+t")
63 | Global $hk_transparent=INIRead("hotkeys.ini", "hotkeys", "transparent", "#+\")
64 | Global $hk_solid=INIRead("hotkeys.ini", "hotkeys", "solid", "#+/")
65 | Global $hk_firstavailhide=INIRead("hotkeys.ini", "hotkeys", "firstavailhide", "#+h")
66 | Global $hk_winls=INIRead("hotkeys.ini", "hotkeys", "winls", "#+l")
67 | Global $hk_winkill=INIRead("hotkeys.ini", "hotkeys", "winkill", "#{f4}")
68 | Global $hk_reload=INIRead("hotkeys.ini", "hotkeys", "reload", "#{esc}")
69 | Global $hk_edit=INIRead("hotkeys.ini", "hotkeys", "edit", "#+{esc}")
70 | Func NUtilsLoad()
71 | if WinExists($WinName) Then Exit
72 | If not FileExists(StringTrimRight(@ScriptFullPath, 3) & "au3") Then Exit
73 | if not FileExists(@ScriptFullPath) Then Exit
74 | Run(@ScriptFullPath&" /autoit3executescript """ & StringTrimRight(@ScriptFullPath, 3) & "au3"" nutils")
75 | Exit
76 | EndFunc
77 |
78 | func min($n1, $n2)
79 | if $n1 < $n2 then
80 | return $n1
81 | else
82 | return $n2
83 | endIf
84 | endFunc
85 | func max($n1, $n2)
86 | if $n1 > $n2 then
87 | return $n1
88 | else
89 | return $n2
90 | endIf
91 | endFunc
92 | AutoItWinSetTitle($winname)
93 | $win = FileRead($hwFile, FileGetSize($hwFile))
94 | $semiindex = StringInStr($Win, ";")
95 | if $semiindex > 0 Then
96 | $Sysup = StringLeft($Win, $Semiindex-1)
97 | Else
98 | $Sysup = ""
99 | EndIf
100 | $updiff = $sysup-GetUpEpoch()
101 | if not StringIsInt($Sysup) or $updiff > 10 or $updiff < -10 Then
102 | $Win = ""
103 | Else
104 | $Win = StringTrimLeft($Win, $Semiindex)
105 | EndIf
106 | $Windows2 = StringSplit($win,";")
107 | if $windows2[0] = 0 Then
108 | Global $windows[10] = [0,0,0,0,0,0,0,0,0,0]
109 | Else
110 | Global $windows[max($windows2[0], 10)]
111 | for $i = 1 to $windows2[0]
112 | $Windows[$i-1] = hwnd($windows2[$i])
113 | next
114 | for $i = 0 to ubound($windows)-1
115 | if $windows[$i] = "" then
116 | $windows[$i] = 0
117 | endIf
118 | Next
119 | $windows2 = ""
120 | EndIf
121 | for $i = 0 to ubound($windows)-1
122 | if $windows[$i] <> "" then
123 | historyAdd($i)
124 | endIf
125 | next
126 | global $trayids[ubound($windows)]
127 | createTrayItems()
128 | guiCreate($winname&"_api")
129 | guiRegisterMsg(0x0501, "api")
130 | If FileExists(StringTrimRight(@ScriptFullPath, 3) & "exe") and FileExists(@ScriptFullPath) Then
131 | Run(StringTrimRight(@ScriptFullPath, 3) &"exe /autoit3executescript """ & StringTrimRight(@ScriptFullPath, 3) & "au3"" CheckForUpdatesQuiet")
132 | EndIf
133 | While 1
134 | $ChangedWin = 0
135 | for $i = 0 to ubound($windows)-1
136 | if $windows[$i] <> hwnd(0) Then
137 | If WinExists($windows[$i]) = 0 or BitAnd(WinGetState($Windows[$i]), 2) Then
138 | $windows[$i] = hwnd(0)
139 | historyDel($i)
140 | If FileExists("Sounds\Disappear.wav") Then Soundplay("sounds\Disappear.wav")
141 | $ChangedWin = 1
142 | EndIf
143 | EndIf
144 | Next
145 | if $ChangedWin = 1 Then SaveHiddenWindowState()
146 | hotkeys(1)
147 | $WinMurderer = 0
148 | $WinMurderer = INIReadSectionNames("WinMurderer.ini")
149 | if not @Error Then
150 | for $i = 1 to $WinMurderer[0]
151 | if WinExists(INIRead("WinMurderer.ini", $WinMurderer[$i], "title", "Win_Error_PLZDontKillMe")) Then
152 | $Degree = INIRead("WinMurderer.ini",$WinMurderer[$i], "degree", 0)
153 | If $Degree = 1 Then
154 | WinKill(INIRead("WinMurderer.ini", $WinMurderer[$i], "title", "Win_Error_PLZDontKillMe"))
155 | ElseIf $Degree = 2 Then
156 | ProcessClose(WinGetProcess(INIRead("WinMurderer.ini", $WinMurderer[$i], "title", "Win_Error_PLZDontKillMe")))
157 | Else
158 | EndIf
159 | EndIf
160 | Next
161 | EndIf
162 | Sleep(1000)
163 | Wend
164 | Func Main()
165 | hotkeys(0)
166 | if @HotKeyPressed = $hk_chtitle Then
167 | SetT()
168 | ElseIf @HotKeyPressed = $hk_winkill Then
169 | end()
170 | EndIf
171 | hotkeys(1)
172 | EndFunc
173 | Func Slot2Human($Slot)
174 | $Slot += 1
175 | Return $Slot
176 | EndFunc
177 | Func Human2Slot($Human)
178 | if $human = 0 Then $Human = 10
179 | $Human -= 1
180 | Return $Human
181 | EndFunc
182 |
183 | Func End()
184 | ProcessClose(WinGetProcess("[ACTIVE]"))
185 | if FileExists("Sounds\kill.wav") Then
186 | Soundplay("sounds\kill.wav")
187 | Else
188 | Beep(60, 300)
189 | EndIf
190 | EndFunc
191 | Func SetT()
192 | hotkeys(0)
193 | AutoItSetOption("WinTitleMatchMode", 2)
194 | local $txt
195 | $ltitle = WinGetTitle("")
196 | Sleep(200)
197 | $txt = InputBox(_t("SetTitleTitle"),_t("SetTitleMessage"),$ltitle)
198 | if @Error or $txt = "" Then
199 | Else
200 | $time = TimerInit()
201 | $f = 0
202 | While TimerDiff($Time) < 3000
203 | if WinActive($lTitle) Then
204 | $f = 1
205 | ExitLoop
206 | EndIf
207 | Wend
208 | if $f = 1 Then
209 | WinSetTitle("","",$TXT)
210 | Else
211 | EndIf
212 | EndIf
213 | AutoItSetOption("WinTitleMatchMode", 4)
214 | hotkeys(1)
215 | EndFunc
216 | func WinShowHide()
217 | hotkeys(0)
218 | $num = Human2Slot(int(stringRight(@hotKeyPressed, 1)))+$shift
219 | $u = ubound($windows)
220 | if $u-1 < $num then
221 | redim $windows[$num+1]
222 | for $i = $u to ubound($windows)-1
223 | $windows[$i] = 0
224 | next
225 | endIf
226 | $Handle = HWND($windows[$num])
227 | if $Handle = "0x00000000" Then $Handle = Hwnd(WinGetHandle("[active]"))
228 | ShowHideWin($Handle, $num)
229 | hotkeys(1)
230 | endFunc
231 | Func Reload()
232 | if FileExists(@ScriptFullPath) and FileExists(StringTrimRight(@ScriptFullPath, 3) & "exe") Then
233 | if FileExists("Sounds\restart.wav") Then
234 | Soundplay("sounds\restart.wav", 1)
235 | Else
236 | Beep(400, 40)
237 | Beep(600, 40)
238 | Beep(2400, 80)
239 | EndIf
240 | Run(StringTrimRight(@ScriptFullPath, 3) & "exe /autoit3executescript """ & @ScriptFullPath & """ nutils")
241 | Exit
242 | EndIf
243 | EndFunc
244 | Func EditScript()
245 | if FileExists(@ScriptFullPath) and FileExists(@SystemDir&"\notepad.exe") Then
246 | Run(@SystemDir&"\notepad.exe "&@ScriptFullPath)
247 | EndIf
248 | EndFunc
249 | Func GetUpEpoch()
250 | local $systimeStruct = _date_Time_GetSystemTimeAsFileTime()
251 | $systime = 0
252 | $ret = DLLCall("ntdll.dll", "int", "RtlTimeToSecondsSince1970", "ptr", DLLStructGetPTR($SystimeStruct), "uint*", $systime)
253 | $systime = 0
254 | $systimeStruct = 0
255 | return $ret[2]-Floor(_date_Time_GetTickCount()/1000)
256 | EndFunc
257 |
258 | Func ShowHideWin($Handle, $num)
259 | $Handle = hwnd($Handle)
260 | if $windows[$num] = 0 then
261 | if $handle = WinGetHandle("[class:Progman]") or $handle = WinGetHandle("[class:Shell_TrayWnd]") Then
262 | If FileExists("Sounds\HideEr.wav") Then
263 | Soundplay("sounds\HideEr.wav")
264 | Else
265 | Beep(70, 100)
266 | EndIf
267 | Else
268 | if FileExists("Sounds\windown.wav") Then
269 | Soundplay("sounds\windown.wav")
270 | Else
271 | Beep(1500, 100)
272 | EndIf
273 | winSetState($Handle, "", @SW_Minimize)
274 | winSetState($Handle, "", @SW_HIDE)
275 | $windows[$num] = $Handle
276 | historyAdd($num)
277 | EndIf
278 | Else
279 | ;it exists, so show it and zero the value
280 | winSetState($handle, "", @SW_SHOW)
281 | winActivate($handle)
282 | $windows[$num] = 0
283 | historyDel($num)
284 | if FileExists("Sounds\winup.wav") Then
285 | Soundplay("sounds\winup.wav")
286 | Else
287 | Beep(1500, 50)
288 | Sleep(50)
289 | Beep(1500, 50)
290 | EndIf
291 | EndIf
292 | SaveHiddenWindowState()
293 | EndFunc
294 | Func SaveHiddenWindowState()
295 | cleanArray()
296 | $write = ""
297 | for $i = 0 to ubound($windows)-1
298 | $Write &= ";"&$windows[$i]
299 | Next
300 | $Write = GetUpEpoch()&$Write
301 | FileDelete($hwFile)
302 | FileWrite($hwFile, $Write)
303 | createTrayItems()
304 | EndFunc
305 | func api($hwnd, $msg, $wParam, $lParam)
306 | if $msg = 0x0501 Then
307 | $LParam = HWND($LParam)
308 | $num = -1
309 | ;show the window if it exists
310 | for $i = 0 to uBound($windows)-1
311 | if $windows[$i] = $lParam Then
312 | showHideWin($LParam, $i)
313 | return
314 | EndIf
315 | Next
316 | $Num = FindFirstAvailableSlot($Shift)
317 | if $num = -1 then
318 | redim $windows[ubound($windows)+1]
319 | $num = ubound($windows)-1
320 | endIf
321 | if $num > -1 and WinExists($lParam) and $num <= uBound($Windows)-1 then
322 | showHideWin($lparam, $num)
323 | endIf
324 | EndIf
325 | endFunc
326 | func shiftUp()
327 | hotkeys(0)
328 | $shift+=10
329 | StackNotify()
330 | hotkeys(1)
331 | endFunc
332 | func shiftDown()
333 | hotkeys(0)
334 | if $shift - 10 < 0 then
335 | $shift = 0
336 | else
337 | $shift-=10
338 | endIf
339 | StackNotify()
340 | hotkeys(1)
341 | endFunc
342 | func cleanArray()
343 | $lastElement = -1
344 | for $i = 0 to ubound($windows)-1
345 | if hwnd($windows[$i]) <> "0x00000000" then
346 | $lastElement = $i
347 | endIf
348 | next
349 | if $lastElement > 9 then
350 | reDim $windows[$lastelement+1]
351 | else
352 | redim $windows[10]
353 | endIf
354 | endFunc
355 | func createTrayItems()
356 | for $i = 0 to ubound($trayids)-1
357 | if $trayids[$i] <> 0 and $trayids[$i] <> "" then
358 | trayItemDelete($trayids[$i])
359 | endIf
360 | next
361 | dim $trayids[ubound($windows)]
362 | for $i = 0 to ubound($windows)-1
363 | if hwnd($windows[$i]) <> "0x00000000" then
364 | $trayids[$i] = trayCreateItem(Slot2Human($i)&": "&wingetTitle(hwnd($windows[$i])))
365 | TrayItemSetOnEvent($trayids[$i], "trayEvent")
366 | endIf
367 | next
368 | endFunc
369 | func trayEVENT()
370 | $item = 0
371 | select
372 | case @tray_id = $tid_lng
373 | SelectLanguage()
374 | case @tray_id = $tid_about
375 | HotKeys(0)
376 | msgbox(4096, _t("About")&" NUtils", "Arbalon NUtils "&$Info_Version&@CRLF&_t("WrittenBy")&" "&$Info_Authors&"."&@CRLF&_t("WebSite")&": "&$Info_Website)
377 | HotKeys(1)
378 | case @tray_id = $tid_exit
379 | exit
380 | case @tray_id = $tid_Checkforupdates
381 | If FileExists(StringTrimRight(@ScriptFullPath, 3) & "exe") and FileExists(@ScriptFullPath) Then
382 | Run(StringTrimRight(@ScriptFullPath, 3) &"exe /autoit3executescript """ & StringTrimRight(@ScriptFullPath, 3) & "au3"" CheckForUpdates")
383 | Else
384 | Hotkeys(0)
385 | MSGBox(16, "Check for Updates", "Cannot load update checker.")
386 | Hotkeys(1)
387 | EndIf
388 | case else
389 | for $i = 0 to ubound($trayids)-1
390 | if $trayids[$i] = @tray_id then
391 | $item = $i
392 | exitLoop
393 | endIf
394 | next
395 | showHideWin(hwnd($windows[$item]), $item)
396 | endSelect
397 | endFunc
398 | func transparent()
399 | hotkeys(0)
400 | WinSetTrans("[active]", "", 0)
401 | beep(1760, 50)
402 | hotkeys(1)
403 | endFunc
404 | func unTransparent()
405 | hotkeys(0)
406 | WinSetTrans("[active]", "", 255)
407 | beep(1760, 50)
408 | sleep(50)
409 | beep(1760, 50)
410 | hotkeys(1)
411 | endFunc
412 | Func FindFirstAvailableSlot($startpos)
413 | $aval = -1
414 | for $i = $startpos to UBound($windows)-1
415 | if HWND($Windows[$i]) = "0x00000000" Then
416 | $aval = $i
417 | ExitLoop
418 | EndIf
419 | Next
420 | if $aval = -1 Then
421 | SetError(1)
422 | Return -1
423 | EndIf
424 | Return $aval
425 | EndFunc
426 | Func HideInFirst()
427 | hotkeys(0)
428 | $Num = FindFirstAvailableSlot($Shift)
429 | if $num = -1 then
430 | redim $windows[ubound($windows)+1]
431 | $num = ubound($windows)-1
432 | endIf
433 | if $num > -1 and $num <= uBound($Windows)-1 then
434 | showHideWin(WinGetHandle("[active]"), $num)
435 | endIf
436 | hotkeys(1)
437 | EndFunc
438 | func gui()
439 | hotkeys(0)
440 | dim $treeids[ubound($windows)]
441 | $highestStack = ceiling(ubound($windows)/10)
442 | dim $treeStackIds[$highestStack]
443 | guiCreate("NUtils - "&_t("UnhideTitle"), 270, 530)
444 | GUICtrlCreateLabel(_t("UnhideMessage"), 40, 30, 230, 40)
445 | $tree = GuiCtrlCreateTreeView(30, 90, 220, 330)
446 | $btnUnhide = GuiCtrlCreateButton(_t("UnhideButton"), 30, 470, 90, 40, 0x01)
447 | $btnCancel = GuiCtrlCreateButton(_t("Cancel"), 160, 470, 90, 40)
448 | $fullStacks = 0
449 | for $i = 0 to ubound($treeStackIds)-1
450 | if not isStackEmpty($i) then
451 | $treeStackIds[$i] = GuiCtrlCreateTreeViewItem(_t("Stack") & " " & $i+1, $tree)
452 | $fullStacks += 1
453 | endIf
454 | next
455 | for $i = 0 to ubound($windows)-1
456 | if hwnd($windows[$i]) <> "0x00000000" then
457 | $stack = $treeStackIds[floor($i/10)]
458 | $s=floor($i/10)+1&"."&Slot2Human(mod($i,10))&": "&winGetTitle(hwnd($windows[$i]))
459 | $treeids[$i] = GuiCtrlCreateTreeViewItem($s, $stack)
460 | endIf ;valid window
461 | next
462 | if $fullStacks = 0 then
463 | guiCtrlSetState($btnUnhide, $GUI_DISABLE)
464 | endIf
465 | guiSetState()
466 | ;find the last item in history
467 | $h = -1
468 | for $i = ubound($hiddenwindows)-1 to 0 step -1
469 | ;=0 because 0 <> "x" returns false for some reason
470 | if string($hiddenwindows[$i]) <> "x" then
471 | If $hiddenwindows[$i] <= UBound($Treeids)-1 Then $h = $treeIds[$hiddenwindows[$i]]
472 | exitLoop
473 | endIf
474 | next
475 | if $h <> -1 then
476 | GuiCtrlSetState($h, $GUI_FOCUS)
477 | endIf
478 | While 1
479 | $msg = GUIGetMsg()
480 | If not $msg Then ContinueLoop
481 | Select
482 | Case $msg = $GUI_EVENT_CLOSE
483 | guiDelete()
484 | hotkeys(1)
485 | exitLoop
486 | Case $msg = $btnCancel
487 | guiDelete()
488 | hotkeys(1)
489 | exitLoop
490 | case $msg = $btnUnhide
491 | $selected = guiCtrlRead($tree)
492 | for $i = 0 to ubound($treeIds)-1
493 | if $treeIds[$i] = $selected then
494 | guiDelete()
495 | showHideWin($windows[$i], $i)
496 | hotkeys(1)
497 | return
498 | endIf
499 | next
500 | ;no item, probably a stack
501 | for $i = 0 to ubound($treeStackIds)-1
502 | if $treeStackIds[$i] <> $selected then
503 | continueLoop
504 | endIf
505 | $start = $i*10
506 | $end = min(($i*10)+9, ubound($windows)-1)
507 | for $j = $start to $end
508 | if hwnd($windows[$j]) <> "0x00000000" then
509 | ShowHideWin($windows[$j], $j)
510 | endIf ;valid?
511 | next
512 | next
513 | Hotkeys(1)
514 | guiDelete()
515 | endSelect
516 | wend
517 | hotkeys(1)
518 | endFunc
519 | Func HistoryClean()
520 | local $NewArray[1]
521 | $NewArray[0] = "x"
522 | for $i = 0 to UBound($HiddenWindows)-1
523 | if $HiddenWindows[$i] <> "x" Then
524 | $NewArray[UBound($NewArray)-1] = $HiddenWindows[$i]
525 | Redim $NewArray[UBound($NewArray)+1]
526 | EndIf
527 | Next
528 | ReDim $HiddenWindows[UBound($NewArray)]
529 | for $i = 0 to UBound($NewArray)-1
530 | $HiddenWindows[$i] = $NewArray[$i]
531 | Next
532 | EndFunc
533 | func HistoryAdd($num)
534 | reDim $hiddenwindows[uBound($hiddenwindows)+1]
535 | $hiddenWindows[uBound($hiddenwindows)-1] = $num
536 | endFunc
537 | func HistoryDel($num)
538 | for $i = 0 to ubound($hiddenwindows)-1
539 | if $hiddenwindows[$i] = $num then
540 | $hiddenwindows[$i] = "x"
541 | endIf
542 | next
543 | endFunc
544 | func hotkeys($x)
545 | if $x = 1 then
546 | HotKeySet($hk_edit, "EditScript")
547 | HotKeySet($hk_reload, "reload")
548 | HotKeySet($hk_solid, "unTransparent")
549 | HotKeySet($hk_transparent, "transparent")
550 | HotKeySet($hk_firstavailhide, "HideInFirst")
551 | HotKeySet($hk_winls, "gui")
552 | for $i = 0 to 9
553 | HotKeySet($hk_bass & $i, "WinShowHide")
554 | Next
555 | for $i = 0 to 5
556 | HotKeySet($hk_bass & "{f" & ($i+3) & "}", "SetPriority")
557 | Next
558 | HotKeySet($hk_winkill, "main")
559 | HotKeySet($hk_chtitle, "main")
560 | hotKeySet($hk_stackup, "shiftUp")
561 | hotkeySet($hk_stackdown, "shiftDown")
562 | else
563 | HotKeySet($hk_edit, "dummy")
564 | HotKeySet($hk_reload, "dummy")
565 | HotKeySet($hk_solid, "dummy")
566 | HotKeySet($hk_transparent, "dummy")
567 | HotKeySet($hk_firstavailhide, "dummy")
568 | HotKeySet($hk_winls, "dummy")
569 | for $i = 0 to 9
570 | HotKeySet($hk_bass & $i, "dummy")
571 | Next
572 | for $i = 0 to 5
573 | HotKeySet($hk_bass & "{f" & $i+3 & "}", "Dummy")
574 | Next
575 | HotKeySet($hk_winkill, "dummy")
576 | HotKeySet($hk_chtitle, "dummy")
577 | hotKeySet($hk_stackup, "dummy")
578 | hotkeySet($hk_stackdown, "dummy")
579 | endIf
580 | endFunc
581 | func IsStackEmpty($stack)
582 | $from = $stack*10
583 | $to = $from+9
584 | ;if there aren't enough elements, it's empty
585 | if ubound($windows)-1 < $from then
586 | return 1
587 | endIf
588 | if $to > ubound($windows)-1 then
589 | $to = ubound($windows)-1
590 | endIf
591 | for $i = $from to $to
592 | if hwnd($windows[$i]) <> "0x00000000" Then
593 | return 0
594 | endIf
595 | next
596 | return 1
597 | endFunc
598 | func dummy()
599 | endFunc
600 | Func StackNotify()
601 | If $StackCounter = 1 Then
602 | if fileExists("Sounds\stack.wav") then
603 | for $i = 1 to $shift/10+1
604 | Soundplay("sounds\stack.wav", 1)
605 | next
606 | Else
607 | for $i = 1 to $shift/10+1
608 | Beep(2000, 60)
609 | Sleep(50)
610 | next
611 | EndIf
612 | Else
613 | If Not PlayNum($Shift/10+1) Then
614 | if fileExists("Sounds\stack.wav") then
615 | for $i = 1 to $shift/10+1
616 | Soundplay("sounds\stack.wav", 1)
617 | next
618 | Else
619 | for $i = 1 to $shift/10+1
620 | Beep(2000, 60)
621 | Sleep(50)
622 | next
623 | EndIf
624 | EndIf
625 | EndIf
626 | EndFunc
627 | Func PlayNum($Num)
628 | $n = StringSplit($Num, "")
629 | if @Error Then
630 | SetError(1)
631 | Return
632 | EndIf
633 | $played = 1
634 | for $i = 1 to $n[0]
635 | If Not FileExists("Sounds\nums\" & $n[$i] & ".wav") Then
636 | $Played = 0
637 | ExitLoop
638 | EndIf
639 | Next
640 | If $Played Then
641 | for $i = 1 to $n[0]
642 | Soundplay("sounds\nums\" & $n[$i] & ".wav", 1)
643 | Next
644 | Return 1
645 | Else
646 | SetError(2)
647 | Return
648 | EndIf
649 | EndFunc
650 | func _t($msg)
651 | $out = INIRead("lang\" & $lang & ".ini", "str", $msg, "")
652 | if $out = "" Then $out = INIRead("lang\en.ini", "str", $msg, "Lang_Output_Error")
653 | $re = StringRegExp($out, "%([a-zA-Z0-9]+)%", 1)
654 | if not @Error Then
655 | for $i = 0 to UBound($re)-1
656 | $out = StringReplace($out, "%" & $re[$i] & "%", _t($re[$i]))
657 | Next
658 | EndIf
659 | Return $out
660 | EndFunc
661 | Func SetPriority()
662 | Hotkeys(0)
663 | $num = int(stringMid(@hotKeyPressed, StringLen($hk_bass)+3, 1))-3
664 | If ProcessSetPriority(WinGetProcess("[active]"), $num) Then
665 | If FileExists("Sounds\ProcessPrioritySounds\"&$num&".wav") Then
666 | Soundplay("sounds\ProcessPrioritySounds\"&$Num&".wav")
667 | Else
668 | Beep(Round(440*(2^(($num*2)/12))), 60)
669 | EndIf
670 | Else
671 | If FileExists("Sounds\ProcessPrioritySounds\er.wav") Then
672 | Soundplay("sounds\ProcessPrioritySounds\er.wav")
673 | Else
674 | Beep(80, 130)
675 | EndIf
676 | EndIf
677 | Hotkeys(1)
678 | EndFunc
679 |
680 | Func CheckForUpdates($quiet)
681 | $ver = _INetgetSource($Info_Website & "/nutils.ver")
682 | if @Error Then
683 | if not $quiet then
684 | MSGBox(16, _t("CheckForUpdates"), _t("CannotConnectTo") & " " & $Info_Website & ".")
685 | EndIf
686 | Else
687 | $ver = StringStripWs($ver, 8)
688 | if String($info_version) <> String($ver) Then
689 | $choice = MSGBox(36, _t("CheckForUpdates"), _t("YouAreRunningNUtils") & " " & $Info_version & ". " & _t("TheCurrentVersionOfNUtilsIs") & " " & $ver &". " & _t("WouldYouLikeToVisitTheWebsiteNow"))
690 | If $choice = 6 Then
691 | InetGet($info_website & "/downloads/files/NUtils_Setup.exe", @TempDir & "\NUtils_Setup.exe", 1)
692 | if not @error then
693 | ShellExecute(@Tempdir & "\NUtils_Setup.exe")
694 | EndIf
695 | EndIf
696 | Else
697 | if not $quiet Then
698 | MSGBox(64, _t("CheckForUpdates"), _t("YouAreRunningTheCurrentVersionOfNUtils") & " (" & $ver & ").")
699 | EndIf
700 | EndIf
701 | EndIf
702 | EndFunc
703 | Func GetLangs()
704 | local $w = @WorkingDir
705 | FileChangeDir(@ScriptDir & "\lang")
706 | if @Error Then
707 | SetError(1)
708 | Return
709 | EndIf
710 | local $file = FileFindFirstFile("*.ini")
711 | local $ar[1][4]
712 | local $Search
713 | local $ln
714 | local $Display
715 | local $Native
716 | local $Author
717 | local $Sub
718 | While 1
719 | $Search = FileFindNextFile($File)
720 | if @Error Then ExitLoop
721 | $ln = StringTrimRight($Search, 4)
722 | $Display = INIRead($Search, "Info", "Display", "")
723 | if $Display = "" Then ContinueLoop
724 | $Native = INIRead($Search, "Info", "Native", "")
725 | if $Native = "" Then ContinueLoop
726 | $Author = INIRead($Search, "Info", "Author", "")
727 | if $Author = "" Then ContinueLoop
728 | $sub = UBound($ar)
729 | redim $ar[$sub+1][4]
730 | $ar[$sub][0] = $ln
731 | $ar[$sub][1] = $Display
732 | $ar[$sub][2] = $Native
733 | $ar[$sub][3] = $Author
734 | Wend
735 | FileChangeDir($w)
736 | $ar[0][0] = UBound($ar)-1
737 | Return $Ar
738 | EndFunc
739 | Func SelectLanguage()
740 | Hotkeys(0)
741 | GUICreate(_t("SelectLanguage"), 400, 600)
742 | local $list = GUICtrlCreateListView(_t("Language") & " |" & _t("Author"), 30, 30, 340, 300)
743 | local $btnselect = GUICtrlCreateButton(_t("SelectLanguage"), 30, 330, 90, 40, 0x01)
744 | local $btncancel = GUICtrlCreateButton(_t("Cancel"), 280, 330, 90, 40)
745 | local $lng = GetLangs()
746 | local $ids[$lng[0][0]+1]
747 | for $i = 1 to $lng[0][0]
748 | $ids[$i] = GUICtrlCreateListViewItem($lng[$i][2] & " (" & $lng[$i][1] & ")|" & $lng[$i][3], $list)
749 | Next
750 | GUISetState()
751 | While 1
752 | local $msg = GUIGetMSG()
753 | If $msg = $GUI_Event_Close or $msg = $btncancel Then
754 | ExitLoop
755 | ElseIf $msg = $btnSelect Then
756 | $id = GUICtrlRead($List)
757 | local $choice = 0
758 | for $i = 1 to $lng[0][0]
759 | if $ID = $ids[$i] Then
760 | $Choice = $i
761 | ExitLoop
762 | EndIf
763 | Next
764 | If $Choice > 0 Then
765 | Global $lang = $lng[$choice][0]
766 | INIWrite("settings.ini", "settings", "Language", $lang)
767 | UpdateTrayItems()
768 | ExitLoop
769 | EndIf
770 | EndIf
771 | Wend
772 | GUIDelete()
773 | Hotkeys(0)
774 | EndFunc
775 | func updateTrayItems ()
776 | TrayItemSetText($tid_exit, _t("Exiticon"))
777 | trayItemSetText($tid_lng, _t("SelectLanguage") & " (Select Language)...")
778 | trayItemSetText($tid_checkforupdates, _t("CheckForUpdates")&"...")
779 | trayItemSetText($tid_about, _t("About")&"...")
780 | endFunc
--------------------------------------------------------------------------------
/src/NUtilsApi.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 | #include
3 | $nutilsAPIWindowName = "ArbalonNUtilsWND"
4 | func _nutils_ShowHide($handle)
5 | $wh = winGetHandle($nutilsAPIWindowName)
6 | if not @error then
7 | _sendMessage($wh, 0x0501, 0, $handle, 0)
8 | endIf
9 | endFunc
--------------------------------------------------------------------------------
/src/ReadMe.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NUtils Readme
5 |
6 |
7 | NUtils Readme
8 | NUtils is copyright© 2008-2010 Arbalon, Niko Carpenter, and Tyler Spivey.
9 | Web site: http://www.arbalon.com.
10 |
1: Introduction
11 | 1.1: What is NUtils?
12 |
NUtils is a hotkey-controled Window manager. Its purpose is to extend the functionality of Windows to increase productivity.
13 |
14 | 1.2: Features
15 | Below is a summary of NUtil's feature set:
16 |
17 | - Show/hide up to 10 windows with one keystroke
18 | - Create multiple "stacks" of windows--for those times when more than 10 windows need to be hidden). Switch between these stacks with a simple keystroke.
19 | - Change the title of any window--to easily sort through windows whose titles are the same by default.
20 | - Make a window transparent--to protect against nosy onlookers; to interact with the window, a screen reader must be used.
21 | - Forcefully kill the current window for non-responding applications.
22 | - Automatically close windows that exist in a list, or kill the process associated with them.
23 | - Get a list of all hidden windows in an organized tree.
24 |
25 | 1.3: Installing
26 | 1.3.1: Installing from the self-extracting archive
27 | To install NUtils from the self-extracting archive, Run NUtils-portible.exe and extract NUtils in the desired location. A folder called NUtils will be created. To run NUtils, go into the newly created folder and run NUtils.exe.
28 | 1.3.2: Installing NUtils with the installer
29 | To install NUtils using the installer, to get desktop and start menu shortcuts, run NUtils_Setup.exe and follow the instructions. To start NUtils, double click the NUtils shortcut that has been placed on your desktop, or in your start menu.
30 | 1.3.3: Configuring NUtils to run at startup.
31 | To configure NUtils to run at startup, if using the installed copy, right click the shortcut to NUtils on your desktop and click copy. Next, right click the start button and click open all users, or just open if you only wish for NUtils to start up under your user account. Double click Programs, and then double click Startup. Right click a blank area in this folder and click paste. If you are using the portible copy, make sure that it is not on a removeable drive as NUtils will not start if this drive is not plugged in when the computer is started. In the NUtils folder, right click NUtils.exe and click create shortcut. A shortcut will be created in the same folder. Right click this shortcut and click cut. Next, right click the start button and click open all users, or just open if you only wish for NUtils to start up under your user account. Double click Programs, and then double click Startup. Right click a blank area in this folder and click paste.
32 | 2: Using NUtils
33 | Note: This readme asumes that you are using the default hotkey assignments.
34 | If you have changed any hotkeys in hotkeys.ini, you will have to make a note of that when accessing those functions.
35 |
2.1: Hiding and unhiding windows using the number ro
36 | If there are several windows open, it can be useful to hide them, so that they aren't taking up room on your taskbar, or in your alt+tab order. This could be to hide a window that you wish to keep open but aren't really doing much with, such as a media player, or notepad with some notes that you wish to access later, or to hide a window so it can be easily recalled, like a document or web page.
37 | To hide a window, place your focus into the window you wish to hide, either by clicking your mouse into it, clicking its icon on the taskbar, or alt+tabbing to it. Next, hold down control and shift, and press any number on the number row. To try this, go to any window and press control+shift+1. Notice that the window you were in is no longer visible. Now, go ahead and do some things on your computer. Whenever you want to get that window back, just press control+shift+1 again, and the window will reappear.
38 | In summary, if you remain on the same stack--stacks will be explained in the next section, pressing control+shift and any number will hide the active window, unless there is a window already hidden in that "slot," in which case that hidden window will be "unhidden" and will gain focus. Note that control+shift+0 is actually slot 10, not slot 0.
39 | At times, it is useful to be able to hide the active window without having to find a free slot to hide it in--sometimes, you don't care where a window is hidden; you just want it hidden. If you want to hide a window, but do not necessarily care which slot it goes into, press windows+shift+h, and NUtils will hide it in the first available slot. Note that the first available slot is calculated starting on your current stack, so if you're on stack 3 and you press windows+shift+h, NUtils will start searching at stack 3, slot 1, to find the first slot that is free. This may mean that your window will be hidden on the next stack, if the current stack is full.
40 | 2.2: Working with stacks
41 | If you want to work with more than ten windows, or you simply wish to be a little bit more organized with the way you hide your windows, you can create a new stack, giving you ten blank slots to hide windows in. A stack is a set of ten slots in which to hide and or unhide windows. By default, you are on stack 1. To go to the next stack, press control+shift=. To go to the previous stack, press control+shift+-.
42 | A common use for stacks, other than for hiding more than ten windows, is to hide different types of applications on different stacks. For example, you might want to leave stack 1 open for things that you will frequently access like your media player, web pages, installations, etc. However, you have a bunch of Audio Repeaters open--Audio Repeater is a program used to pass audio from the input device of one soundcard and output it onto another sound card, and you wish to hide them. When you have five copies of Audio Repeater open, it is very handy to have them hidden, because you don't really need to do much with them besides leaving them open, but you don't want them in your way. However, you don't want them cluttering up your first stack, where you like to hide the windows that you actually need to do something with. So you switch to stack 2, hide your Audio Repeaters, and then switch back to stack 1.
43 | Just be aware that you cannot unhide a window that is on a different stack by pressing control+shift+its number; you will first need to switch back to that stack and then unhide it. By default, NUtils will inform you of what stack you are on when you switch to it by beeping x number of times, where x is the stack you've switched to. For example, when switching to stack 2, NUtils will beep twice. This behavior can be changed by editing settings.ini, and under the settings section, changing StackCounter=1 to StackCounter=0. With this set, NUtills will use a number pack to announce which stack you are switching to. By default, NUtils comes with the DTMF number pack, but other number packs can be found on the download page for NUtils.
44 | 2.3: Hidden Window List
45 | NUtils provides a list of all hidden windows, organized in a tree structure. Press windows+shift+l to recall this list. Hidden windows are organized by stack. To unhide a window, click the window you wish to unhide, and then click the unhide button in the lower left-hand corner of the dialog. You will notice that NUtils will automatically give focus to the last window you hid, so an easy way to unhide the last hidden window is to press windows+shift+l and when the list comes up, press enter. A history of all of your hidden windows is kept, so you could for example, press windows+shift+h to hide several windows, and then press windows+shift+l, then enter, and each time you do that, your windows will be unhidden in reverse order. This history is not kept after NUtils is restarted.
46 | 2.4: Making windows transparent
47 | There are times where you might find yourself in a situation in which you wish to interact with a window, yet you don't want the window to be visible on the screen. To make a window transparent, press windows+shift+\. To make the window solid again, press windows+shift+/. To interact with this window, you will need a screen reader. The act of making a window transparent throws off some screen readers that use display hooking, so there are limits to the use of this feature.
48 | 2.5: Changing the Process Priority of the Active Window
49 | If, for whatever reason, you wish to change the process priority of the active window, press control+shift+f3-f8, where f3 is low, f4 is below normal, f5 is normal, f6 is above normal, f7 is high, and f8 is realtime. A beep, pitched higher for higher priorities, will be played to let you know that the priority has been changed. If it could not be changed, a low beep will play, indicating that the process priority could not be changed.
50 | 3: Other notes
51 | 3.1: Limitations
52 | NUtils cannot perform actions on windows that it doesn't have permission to act upon. As a consequence, if NUtils is running normally, it cannot hide, change the process priority, or make transparent windows that are running with elevated privileges.
53 | 3.2: Reducing the Size of NUtils
54 | If you want to make the NUtils package smaller, you can remove the sounds folder. NUtils will instead produce PC speaker beeps in place of the sounds that would have been played otherwise.
55 | 3.3: The NUtils API
56 | There is a basic API to control NUtils. This API will allow your application to pass the handle of a window to NUtils. NUtils will find the first available slot starting from stack 1, and hide that window in that slot. When your application calls the NUtils API with the same parameters, NUtils will unhide that window. An AutoIt include file, NUtilsApi.au3, can be found in the NUtils folder. To use the API in your application, just include NUtilsApi.au3, and call _NUtils_ShowHide($handle) where $handle is the handle of the window you wish to hide.
57 | 4: Contact us
58 | You may contact either Niko Carpenter or Tyler Spivey via email:
59 |
60 | - Niko Carpenter (primary contact)
- nik62591@gmail.com
61 | - Tyler Spivey
- tspivey@pcdesk.net
62 |
63 | 5: Credits
64 | While I, Niko Carpenter, am the original coder for NUtils, I need to give credit to a few people who've helped me a lot along the way.
65 |
66 | - I give credit to Tyler Spivey, who has done most of the coding of NUtils other than myself.
67 | And for coming up with a great idea for the NUtils API/coding the NUtils API. He is the co-author of this program.
68 | - Justin Thornton, for giving me and Tyler the idea for stacks; without him, NUtils would still be limited to only 10 Windows. And to him for the process priority idea.
69 | - Matt King for the idea of Win+Shift+h, giving you the ability to just hide a window anywhere, and win+shift+l, allowing you to see and unhide your windows from anywhere.
70 | - And for everyone's great suggestions and feedback, and most importantly, your continued thanks and want to use NUtils has inspired me to work so much further than just suiting my needs.
71 |
72 | Remember, NUtils was once just one of my many personal scripts to make my life that much easier, one of those scripts that I would never release.
73 | 6: License
74 | NUtils is free software: you can redistribute it and/or modify
75 | it under the terms of the GNU General Public License as published by
76 | the Free Software Foundation, either version 3 of the License, or
77 | any later version.
78 | NUtils is distributed in the hope that it will be useful,
79 | but WITHOUT ANY WARRANTY; without even the implied warranty of
80 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81 | GNU General Public License for more details.
82 | You should have received a copy of the GNU General Public License
83 | along with NUtils. If not, see http://www.gnu.org/licenses/.
84 |
85 |
--------------------------------------------------------------------------------
/src/WinMurderer.ini:
--------------------------------------------------------------------------------
1 | ;[Name_This_Section_Anything]
2 | ;title=My Window Title
3 | ;degree=1
4 |
--------------------------------------------------------------------------------
/src/hotkeys.ini:
--------------------------------------------------------------------------------
1 | ; This file defines the hotkeys that NUtils will use to perform specific actions.
2 | [hotkeys]
3 | bass=^+
4 | ;bass= modifier keys user should hold down when pressing numbers 1-0. e.g. ^+ means that control shift 1 shows/hides a window in slot 1.
5 | stackdown=^+-
6 | ;stackdown= key to press to decrease the stack.
7 | stackup=^+=
8 | ;stackup= key to press to increase the stack.
9 | chtitle=#+t
10 | ;chtitle= Key to activate the change title box.
11 | transparent=#+\
12 | ;transparent= Make window transparent (invisible).
13 | solid=#+/
14 | ;solid=Make window solid (visible).
15 | firstavailhide=#+h
16 | ;firstavailhide= Hides window in first available slot.
17 | winls=#+l
18 | ;winls= Brings up window list.
19 | winkill=#{f4}
20 | ;winkill= Kills the process of the active window.
21 | reload=#{esc}
22 | ;reload=Reloads NUtils.
23 | edit=#+{esc}
24 | ;edit= Brings up a copy of the NUtils code for editing.
--------------------------------------------------------------------------------
/src/include/Date.au3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/n0ot/nutils/982a8c74dce08425d293882b429472e1315dd2ba/src/include/Date.au3
--------------------------------------------------------------------------------
/src/include/FileConstants.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | ; #INDEX# =======================================================================================================================
4 | ; Title .........: File_Constants
5 | ; AutoIt Version : 3.3
6 | ; Language ......: English
7 | ; Description ...: Constants to be included in an AutoIt v3 script when using File functions.
8 | ; Author(s) .....: Valik, Gary Frost, ...
9 | ; ===============================================================================================================================
10 |
11 | ; #CONSTANTS# ===================================================================================================================
12 | ; Indicates file copy and install options
13 | Global Const $FC_NOOVERWRITE = 0 ; Do not overwrite existing files (default)
14 | Global Const $FC_OVERWRITE = 1 ; Overwrite existing files
15 |
16 | ; Indicates file date and time options
17 | Global Const $FT_MODIFIED = 0 ; Date and time file was last modified (default)
18 | Global Const $FT_CREATED = 1 ; Date and time file was created
19 | Global Const $FT_ACCESSED = 2 ; Date and time file was last accessed
20 |
21 | ; Indicates the mode to open a file
22 | Global Const $FO_READ = 0 ; Read mode
23 | Global Const $FO_APPEND = 1 ; Write mode (append)
24 | Global Const $FO_OVERWRITE = 2 ; Write mode (erase previous contents)
25 | Global Const $FO_BINARY = 16 ; Read/Write mode binary
26 | Global Const $FO_UNICODE = 32 ; Write mode Unicode UTF16-LE
27 | Global Const $FO_UTF16_LE = 32 ; Write mode Unicode UTF16-LE
28 | Global Const $FO_UTF16_BE = 64 ; Write mode Unicode UTF16-BE
29 | Global Const $FO_UTF8 = 128 ; Read/Write mode UTF8 with BOM
30 | Global Const $FO_UTF8_NOBOM = 256 ; Read/Write mode UTF8 with no BOM
31 |
32 | ; Indicates file read options
33 | Global Const $EOF = -1 ; End-of-file reached
34 |
35 | ; Indicates file open and save dialog options
36 | Global Const $FD_FILEMUSTEXIST = 1 ; File must exist
37 | Global Const $FD_PATHMUSTEXIST = 2 ; Path must exist
38 | Global Const $FD_MULTISELECT = 4 ; Allow multi-select
39 | Global Const $FD_PROMPTCREATENEW = 8 ; Prompt to create new file
40 | Global Const $FD_PROMPTOVERWRITE = 16 ; Prompt to overWrite file
41 |
42 | Global Const $CREATE_NEW = 1
43 | Global Const $CREATE_ALWAYS = 2
44 | Global Const $OPEN_EXISTING = 3
45 | Global Const $OPEN_ALWAYS = 4
46 | Global Const $TRUNCATE_EXISTING = 5
47 |
48 | Global Const $INVALID_SET_FILE_POINTER = -1
49 |
50 | ; Indicates starting point for the file pointer move operations
51 | Global Const $FILE_BEGIN = 0
52 | Global Const $FILE_CURRENT = 1
53 | Global Const $FILE_END = 2
54 |
55 | Global Const $FILE_ATTRIBUTE_READONLY = 0x00000001
56 | Global Const $FILE_ATTRIBUTE_HIDDEN = 0x00000002
57 | Global Const $FILE_ATTRIBUTE_SYSTEM = 0x00000004
58 | Global Const $FILE_ATTRIBUTE_DIRECTORY = 0x00000010
59 | Global Const $FILE_ATTRIBUTE_ARCHIVE = 0x00000020
60 | Global Const $FILE_ATTRIBUTE_DEVICE = 0x00000040
61 | Global Const $FILE_ATTRIBUTE_NORMAL = 0x00000080
62 | Global Const $FILE_ATTRIBUTE_TEMPORARY = 0x00000100
63 | Global Const $FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200
64 | Global Const $FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
65 | Global Const $FILE_ATTRIBUTE_COMPRESSED = 0x00000800
66 | Global Const $FILE_ATTRIBUTE_OFFLINE = 0x00001000
67 | Global Const $FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000
68 | Global Const $FILE_ATTRIBUTE_ENCRYPTED = 0x00004000
69 |
70 | Global Const $FILE_SHARE_READ = 0x00000001
71 | Global Const $FILE_SHARE_WRITE = 0x00000002
72 | Global Const $FILE_SHARE_DELETE = 0x00000004
73 |
74 | Global Const $GENERIC_ALL = 0x10000000
75 | Global Const $GENERIC_EXECUTE = 0x20000000
76 | Global Const $GENERIC_WRITE = 0x40000000
77 | Global Const $GENERIC_READ = 0x80000000
78 | ; ===============================================================================================================================
79 |
--------------------------------------------------------------------------------
/src/include/Inet.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | #include "Date.au3"
4 |
5 | ; #INDEX# =======================================================================================================================
6 | ; Title .........: Edit Constants
7 | ; AutoIt Version : 3.0
8 | ; Language ......: English
9 | ; Description ...: Functions that assist with Internet.
10 | ; Author(s) .....: Larry, Ezzetabi, Jarvis Stubblefield, Wes Wolfe-Wolvereness, Wouter, Walkabout, Florian Fida
11 | ; Dll ...........: wininet.dll, ws2_32.dll, msvcrt.dll
12 | ; ===============================================================================================================================
13 |
14 | ; #FUNCTION# =========================================================================================================
15 | ; Name...........: _GetIP
16 | ; Description ...: Retrieves the Public IP Address of a Network/Computer.
17 | ; Syntax.........: _GetIP()
18 | ; Parameters ....: None
19 | ; Requirement(s).: v3.3.2.0 or higher
20 | ; Return values .: Success - Returns Public IP Address.
21 | ; Failure - Returns -1 & sets @error = 1
22 | ; Author ........: guinness
23 | ; Example........; Yes
24 | ;=====================================================================================================================
25 | Func _GetIP()
26 | Local $aReturn, $bRead, $sRead
27 | $bRead = InetRead("http://checkip.dyndns.org/")
28 | $sRead = BinaryToString($bRead)
29 | $aReturn = StringRegExp($sRead, '(?s)(?i)Current IP Address: (.*?)', 3)
30 | If @error = 0 Then
31 | Return $aReturn[0]
32 | EndIf
33 |
34 | $bRead = InetRead("http://automation.whatismyip.com/n09230945.asp") ; http://forum.whatismyip.com/f14/our-automation-rules-t241/
35 | $sRead = BinaryToString($bRead)
36 | If @error Then
37 | Return SetError(1, 0, -1)
38 | EndIf
39 | Return $sRead
40 | EndFunc ;==>_GetIP
41 |
42 | ; #FUNCTION# ====================================================================================================================
43 | ; Name...........: _INetExplorerCapable
44 | ; Description ...: Convert a string to IE capable line
45 | ; Parameters ....: $s_IEString - String to convert to a capable IExplorer line
46 | ; Return values .: On Success - Returns the converted string
47 | ; On Failure - Blank String and @error = 1
48 | ; Author ........: Wes Wolfe-Wolvereness
49 | ; ===============================================================================================================================
50 | Func _INetExplorerCapable($s_IEString)
51 | If StringLen($s_IEString) <= 0 Then Return SetError(1, 0, '')
52 | Local $s_IEReturn
53 | Local $n_IEChar
54 | For $i_IECount = 1 To StringLen($s_IEString)
55 | $n_IEChar = '0x' & Hex(Asc(StringMid($s_IEString, $i_IECount, 1)), 2)
56 | If $n_IEChar < 0x21 Or $n_IEChar = 0x25 Or $n_IEChar = 0x2f Or $n_IEChar > 0x7f Then
57 | $s_IEReturn = $s_IEReturn & '%' & StringRight($n_IEChar, 2)
58 | Else
59 | $s_IEReturn = $s_IEReturn & Chr($n_IEChar)
60 | EndIf
61 | Next
62 | Return $s_IEReturn
63 | EndFunc ;==>_INetExplorerCapable
64 |
65 | ; #FUNCTION# ====================================================================================================================
66 | ; Name...........: _INetGetSource
67 | ; Description ...: Gets the source from an URL without writing a temp file.
68 | ; Parameters ....: $s_URL - The URL of the site.
69 | ; $bString - If True the data is returned in string format, otherwise binary format.
70 | ; Return values .: Success - The read string and sets @extended to the number of bytes returned.
71 | ; Failure - An empty string and and sets @error to non-zero.
72 | ; Author ........: Wouter van Kesteren.
73 | ; ===============================================================================================================================
74 | Func _INetGetSource($s_URL, $bString = True)
75 | Local $sString = InetRead($s_URL, 1)
76 | Local $nError = @error, $nExtended = @extended
77 | If $bString Then $sString = BinaryToString($sString)
78 | Return SetError($nError, $nExtended, $sString)
79 | EndFunc ;==>_INetGetSource
80 |
81 | ; #FUNCTION# ====================================================================================================================
82 | ; Name...........: _INetMail
83 | ; Description ...: Open default mail client with given Address/Subject/Body
84 | ; Parameters ....: $s_MailTo - Address for E-Mail
85 | ; $s_Subject - Subject of E-Mail
86 | ; $s_MailBody - Body of E-Mail
87 | ; Return values .: On Success - Process ID of e-mail client
88 | ; On Failure - Returns 0 and sets @error to non-zero.
89 | ; Author ........: Wes Wolfe-Wolvereness , modified by Emiel Wieldraaijer
90 | ; ===============================================================================================================================
91 | Func _INetMail($s_MailTo, $s_MailSubject, $s_MailBody)
92 | Local $prev = Opt("ExpandEnvStrings", 1)
93 | Local $var, $dflt = RegRead('HKCU\Software\Clients\Mail', "")
94 | If $dflt = "Windows Live Mail" Then
95 | $var = RegRead('HKCR\WLMail.Url.Mailto\Shell\open\command', "")
96 | Else
97 | $var = RegRead('HKCR\mailto\shell\open\command', "")
98 | EndIf
99 | Local $ret = Run(StringReplace($var, '%1', _INetExplorerCapable('mailto:' & $s_MailTo & '?subject=' & $s_MailSubject & '&body=' & $s_MailBody)))
100 | Local $nError = @error, $nExtended = @extended
101 | Opt("ExpandEnvStrings", $prev)
102 | Return SetError($nError, $nExtended, $ret)
103 | EndFunc ;==>_INetMail
104 |
105 | ; #FUNCTION# ====================================================================================================================
106 | ; Name...........: _INetSmtpMail
107 | ; Description ...: Sends an email using SMTP over TCP IP.
108 | ; Parameters ....: $s_SmtpServer - SMTP server to be used for sending email
109 | ; $s_FromName - Name of sender
110 | ; $s_FromAddress - eMail address of sender
111 | ; $s_ToAddress - Address that email is to be sent to
112 | ; $s_Subject - Subject of eMail
113 | ; $as_Body - Single dimension array containing the body of eMail as strings
114 | ; $s_helo - Helo identifier (default @COMPUTERNAME) sometime needed by smtp server
115 | ; $s_first - send before Helo identifier (default @CRLF) sometime needed by smtp server
116 | ; $b_trace - trace on a splash window (default 0 = no trace)
117 | ; Return values .: On Success - Returns 1
118 | ; On Failure - 0 and sets
119 | ; @ERROR = 1 - Invalid Parameters
120 | ; @ERROR = 2 - Unable to start TCP
121 | ; @ERROR = 3 - Unable to resolve IP
122 | ; @ERROR = 4 - Unable to create socket
123 | ; @ERROR = 5x - Cannot open SMTP session
124 | ; @ERROR = 50x - Cannot send body
125 | ; @ERROR = 5000 - Cannot close SMTP session
126 | ; Author ........: Asimzameer, Walkabout
127 | ; Modified.......: Jpm
128 | ; ===============================================================================================================================
129 | Func _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_helo = "", $s_first = " ", $b_trace = 0)
130 | If $s_SmtpServer = "" Or $s_FromAddress = "" Or $s_ToAddress = "" Or $s_FromName = "" Or StringLen($s_FromName) > 256 Then Return SetError(1, 0, 0)
131 | If $s_helo = "" Then $s_helo = @ComputerName
132 |
133 | If TCPStartup() = 0 Then Return SetError(2, 0, 0)
134 |
135 | Local $s_IPAddress, $i_Count
136 | StringRegExp($s_SmtpServer, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
137 | If @extended Then
138 | $s_IPAddress = $s_SmtpServer
139 | Else
140 | $s_IPAddress = TCPNameToIP($s_SmtpServer)
141 | EndIf
142 | If $s_IPAddress = "" Then
143 | TCPShutdown()
144 | Return SetError(3, 0, 0)
145 | EndIf
146 | Local $v_Socket = TCPConnect($s_IPAddress, 25)
147 | If $v_Socket = -1 Then
148 | TCPShutdown()
149 | Return SetError(4, 0, 0)
150 | EndIf
151 |
152 | Local $s_Send[6], $s_ReplyCode[6] ; Return code from SMTP server indicating success
153 | $s_Send[0] = "HELO " & $s_helo & @CRLF
154 | If StringLeft($s_helo, 5) = "EHLO " Then $s_Send[0] = $s_helo & @CRLF
155 | $s_ReplyCode[0] = "250"
156 |
157 | $s_Send[1] = "MAIL FROM: <" & $s_FromAddress & ">" & @CRLF
158 | $s_ReplyCode[1] = "250"
159 | $s_Send[2] = "RCPT TO: <" & $s_ToAddress & ">" & @CRLF
160 | $s_ReplyCode[2] = "250"
161 | $s_Send[3] = "DATA" & @CRLF
162 | $s_ReplyCode[3] = "354"
163 |
164 | Local $aResult = _Date_Time_GetTimeZoneInformation()
165 | Local $bias = -$aResult[1] / 60
166 | Local $biasH = Int($bias)
167 | Local $biasM = 0
168 | If $biasH <> $bias Then $biasM = Abs($bias - $biasH) * 60
169 | $bias = StringFormat(" (%+.2d%.2d)", $biasH, $biasM)
170 |
171 | $s_Send[4] = "From:" & $s_FromName & "<" & $s_FromAddress & ">" & @CRLF & _
172 | "To:" & "<" & $s_ToAddress & ">" & @CRLF & _
173 | "Subject:" & $s_Subject & @CRLF & _
174 | "Mime-Version: 1.0" & @CRLF & _
175 | "Date: " & _DateDayOfWeek(@WDAY, 1) & ", " & @MDAY & " " & _DateToMonth(@MON, 1) & " " & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & $bias & @CRLF & _
176 | "Content-Type: text/plain; charset=US-ASCII" & @CRLF & _
177 | @CRLF
178 | $s_ReplyCode[4] = ""
179 |
180 | $s_Send[5] = @CRLF & "." & @CRLF
181 | $s_ReplyCode[5] = "250"
182 |
183 | ; open stmp session
184 | If __SmtpSend($v_Socket, $s_Send[0], $s_ReplyCode[0], $b_trace, "220", $s_first) Then Return SetError(50, 0, 0)
185 |
186 | ; send header
187 | For $i_Count = 1 To UBound($s_Send) - 2
188 | If __SmtpSend($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then Return SetError(50 + $i_Count, 0, 0)
189 | Next
190 |
191 | ; send body records (a record can be multiline : take care of a subline beginning with a dot should be ..)
192 | For $i_Count = 0 To UBound($as_Body) - 1
193 | ; correct line beginning with a dot
194 | If StringLeft($as_Body[$i_Count], 1) = "." Then $as_Body[$i_Count] = "." & $as_Body[$i_Count]
195 |
196 | If __SmtpSend($v_Socket, $as_Body[$i_Count] & @CRLF, "", $b_trace) Then Return SetError(500 + $i_Count, 0, 0)
197 | Next
198 |
199 | ; close the smtp session
200 | $i_Count = UBound($s_Send) - 1
201 | If __SmtpSend($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then Return SetError(5000, 0, 0)
202 |
203 | TCPCloseSocket($v_Socket)
204 | TCPShutdown()
205 | Return 1
206 | EndFunc ;==>_INetSmtpMail
207 |
208 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
209 | ; Name...........: __SmtpTrace
210 | ; Description ...: Used internally within this file, not for general use
211 | ; Syntax.........: __SmtpTrace($str[, $timeout = 0])
212 | ; Author ........: Asimzameer, Walkabout
213 | ; Modified.......: Jpm
214 | ; ===============================================================================================================================
215 | Func __SmtpTrace($str, $timeout = 0)
216 | Local $W_TITLE = "SMTP trace"
217 | Local $s_SmtpTrace = ControlGetText($W_TITLE, "", "Static1")
218 | $str = StringLeft(StringReplace($str, @CRLF, ""), 70)
219 | $s_SmtpTrace &= @HOUR & ":" & @MIN & ":" & @SEC & " " & $str & @LF
220 | If WinExists($W_TITLE) Then
221 | ControlSetText($W_TITLE, "", "Static1", $s_SmtpTrace)
222 | Else
223 | SplashTextOn($W_TITLE, $s_SmtpTrace, 400, 500, 500, 100, 4 + 16, "", 8)
224 | EndIf
225 | If $timeout Then Sleep($timeout * 1000)
226 | EndFunc ;==>__SmtpTrace
227 |
228 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
229 | ; Name...........: __SmtpSend
230 | ; Description ...: Used internally within this file, not for general use
231 | ; Syntax.........: __SmtpSend($v_Socket, $s_Send, $s_ReplyCode, $b_trace[, $s_IntReply=""[, $s_first=""]])
232 | ; Author ........: Asimzameer, Walkabout
233 | ; Modified.......: Jpm
234 | ; ===============================================================================================================================
235 | Func __SmtpSend($v_Socket, $s_Send, $s_ReplyCode, $b_trace, $s_IntReply = "", $s_first = "")
236 | Local $s_Receive, $i, $timer
237 | If $b_trace Then __SmtpTrace($s_Send)
238 |
239 | If $s_IntReply <> "" Then
240 |
241 | ; Send special first char to awake smtp server
242 | If $s_first <> -1 Then
243 | If TCPSend($v_Socket, $s_first) = 0 Then
244 | TCPCloseSocket($v_Socket)
245 | TCPShutdown()
246 | Return 1; cannot send
247 | EndIf
248 | EndIf
249 |
250 | ; Check intermediate reply before HELO acceptation
251 | $s_Receive = ""
252 | $timer = TimerInit()
253 | While StringLeft($s_Receive, StringLen($s_IntReply)) <> $s_IntReply And TimerDiff($timer) < 45000
254 | $s_Receive = TCPRecv($v_Socket, 1000)
255 | If $b_trace And $s_Receive <> "" Then __SmtpTrace("intermediate->" & $s_Receive)
256 | WEnd
257 | EndIf
258 |
259 | ; Send string.
260 | If TCPSend($v_Socket, $s_Send) = 0 Then
261 | TCPCloseSocket($v_Socket)
262 | TCPShutdown()
263 | Return 1; cannot send
264 | EndIf
265 |
266 | $timer = TimerInit()
267 |
268 | $s_Receive = ""
269 | While $s_Receive = "" And TimerDiff($timer) < 45000
270 | $i += 1
271 | $s_Receive = TCPRecv($v_Socket, 1000)
272 | If $s_ReplyCode = "" Then ExitLoop
273 | WEnd
274 |
275 | If $s_ReplyCode <> "" Then
276 | ; Check replycode
277 | If $b_trace Then __SmtpTrace($i & " <- " & $s_Receive)
278 |
279 | If StringLeft($s_Receive, StringLen($s_ReplyCode)) <> $s_ReplyCode Then
280 | TCPCloseSocket($v_Socket)
281 | TCPShutdown()
282 | If $b_trace Then __SmtpTrace("<-> " & $s_ReplyCode, 5)
283 | Return 2; bad receive code
284 | EndIf
285 | EndIf
286 |
287 | Return 0
288 | EndFunc ;==>__SmtpSend
289 |
290 | ; #FUNCTION# ====================================================================================================================
291 | ; Name...........: _TCPIpToName
292 | ; Description ...: Resolves IP adress to Hostname
293 | ; Syntax ........: _TCPIpToName($sIp, [[$iOption = 0], $hDll_Ws2_32 = "ws2_32.dll"]])
294 | ; Parameters ....: $sIp - Ip Adress in dotted (v4) Format
295 | ; $iOption - Optional, Default = 0
296 | ; 0 = Return String Hostname
297 | ; 1 = Return Array (see Notes)
298 | ; $hDll_Ws2_32 - Optional, Handle to ws2_32.dll
299 | ; Return values .: On Success - Hostname or Array (see Notes)
300 | ; On Failure - "" and Set
301 | ; @ERROR to: 1 - inet_addr DllCall Failed
302 | ; 2 - inet_addr Failed
303 | ; 3 - gethostbyaddr DllCall Failed
304 | ; 4 - gethostbyaddr Failed, WSAGetLastError = @Extended
305 | ; 5 - gethostbyaddr Failed, WSAGetLastError Failed
306 | ; 6 - strlen/sZStringRead Failed
307 | ; 7 - Error reading Aliases Array
308 | ; Author ........: Florian Fida
309 | ; Remarks .......: A successfull WSAStartup (Done by TCPStartup) is required.
310 | ; if $iOption = 1 then the returned Array looks Like this:
311 | ; $aResult[0] = Number of elemets
312 | ; $aResult[1] = "Hostname"
313 | ; $aResult[2] = "Alias 1"
314 | ; $aResult[3] = "Alias 2"
315 | ; ...
316 | ; ===============================================================================================================================
317 | Func _TCPIpToName($sIp, $iOption = Default, $hDll_Ws2_32 = Default)
318 | Local $INADDR_NONE = 0xffffffff, $AF_INET = 2, $sSeparator = @CR
319 | If $iOption = Default Then $iOption = 0
320 | If $hDll_Ws2_32 = Default Then $hDll_Ws2_32 = "ws2_32.dll"
321 | Local $vaDllCall = DllCall($hDll_Ws2_32, "ulong", "inet_addr", "STR", $sIp)
322 | If @error Then Return SetError(1, 0, "") ; inet_addr DllCall Failed
323 | Local $vbinIP = $vaDllCall[0]
324 | If $vbinIP = $INADDR_NONE Then Return SetError(2, 0, "") ; inet_addr Failed
325 | $vaDllCall = DllCall($hDll_Ws2_32, "ptr", "gethostbyaddr", "ptr*", $vbinIP, "int", 4, "int", $AF_INET)
326 | If @error Then Return SetError(3, 0, "") ; gethostbyaddr DllCall Failed
327 | Local $vptrHostent = $vaDllCall[0]
328 | If $vptrHostent = 0 Then
329 | $vaDllCall = DllCall($hDll_Ws2_32, "int", "WSAGetLastError")
330 | If @error Then Return SetError(5, 0, "") ; gethostbyaddr Failed, WSAGetLastError Failed
331 | Return SetError(4, $vaDllCall[0], "") ; gethostbyaddr Failed, WSAGetLastError = @Extended
332 | EndIf
333 | Local $vHostent = DllStructCreate("ptr;ptr;short;short;ptr", $vptrHostent)
334 | Local $sHostnames = __TCPIpToName_szStringRead(DllStructGetData($vHostent, 1))
335 | If @error Then Return SetError(6, 0, $sHostnames) ; strlen/sZStringRead Failed
336 | If $iOption = 1 Then
337 | Local $vh_aliases
338 | $sHostnames &= $sSeparator
339 | For $i = 0 To 63 ; up to 64 Aliases
340 | $vh_aliases = DllStructCreate("ptr", DllStructGetData($vHostent, 2) + ($i * 4))
341 | If DllStructGetData($vh_aliases, 1) = 0 Then ExitLoop ; Null Pointer
342 | $sHostnames &= __TCPIpToName_szStringRead(DllStructGetData($vh_aliases, 1))
343 | If @error Then
344 | SetError(7) ; Error reading array
345 | ExitLoop
346 | EndIf
347 | Next
348 | Return StringSplit(StringStripWS($sHostnames, 2), @CR)
349 | Else
350 | Return $sHostnames
351 | EndIf
352 | EndFunc ;==>_TCPIpToName
353 |
354 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
355 | ; Name...........: __TCPIpToName_szStringRead
356 | ; Description ...: Used internally within this file, not for general use
357 | ; Syntax.........: __TCPIpToName_szStringRead($iszPtr[, $iLen = -1])
358 | ; Author ........: Florian Fida
359 | ; ===============================================================================================================================
360 | Func __TCPIpToName_szStringRead($iszPtr, $iLen = -1)
361 | Local $aStrLen, $vszString
362 | If $iszPtr < 1 Then Return "" ; Null Pointer
363 | If $iLen < 0 Then
364 | $aStrLen = DllCall("msvcrt.dll", "ulong_ptr:cdecl", "strlen", "ptr", $iszPtr)
365 | If @error Then Return SetError(1, 0, "") ; strlen Failed
366 | $iLen = $aStrLen[0] + 1
367 | EndIf
368 | $vszString = DllStructCreate("char[" & $iLen & "]", $iszPtr)
369 | If @error Then Return SetError(2, 0, "")
370 | Return SetExtended($iLen, DllStructGetData($vszString, 1))
371 | EndFunc ;==>__TCPIpToName_szStringRead
372 |
--------------------------------------------------------------------------------
/src/include/Memory.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | #include "MemoryConstants.au3"
4 | #include "StructureConstants.au3"
5 | #include "ProcessConstants.au3"
6 | #include "Security.au3"
7 |
8 | ; #INDEX# =======================================================================================================================
9 | ; Title .........: Memory
10 | ; AutoIt Version : 3.3.7.20++
11 | ; Description ...: Functions that assist with Memory management.
12 | ; The memory manager implements virtual memory, provides a core set of services such as memory mapped files,
13 | ; copy-on-write memory, large memory support, and underlying support for the cache manager.
14 | ; Author(s) .....: Paul Campbell (PaulIA)
15 | ; Dll(s) ........: kernel32.dll
16 | ; ===============================================================================================================================
17 |
18 | ; #CURRENT# =====================================================================================================================
19 | ;_MemGlobalAlloc
20 | ;_MemGlobalFree
21 | ;_MemGlobalLock
22 | ;_MemGlobalSize
23 | ;_MemGlobalUnlock
24 | ;_MemMoveMemory
25 | ;_MemVirtualAlloc
26 | ;_MemVirtualAllocEx
27 | ;_MemVirtualFree
28 | ;_MemVirtualFreeEx
29 | ; ===============================================================================================================================
30 |
31 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
32 | ;$tagMEMMAP
33 | ;_MemFree
34 | ;_MemInit
35 | ;_MemRead
36 | ;_MemWrite
37 | ;__Mem_OpenProcess
38 | ; ===============================================================================================================================
39 |
40 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
41 | ; Name...........: $tagMEMMAP
42 | ; Description ...: Contains information about the memory
43 | ; Fields ........: hProc - Handle to the external process
44 | ; Size - Size, in bytes, of the memory block allocated
45 | ; Mem - Pointer to the memory block
46 | ; Author ........: Paul Campbell (PaulIA)
47 | ; Remarks .......:
48 | ; ===============================================================================================================================
49 | Global Const $tagMEMMAP = "handle hProc;ulong_ptr Size;ptr Mem"
50 |
51 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
52 | ; Name...........: _MemFree
53 | ; Description ...: Releases a memory map structure for a control
54 | ; Syntax.........: _MemFree(ByRef $tMemMap)
55 | ; Parameters ....: $tMemMap - tagMEMMAP structure
56 | ; Return values .: Success - True
57 | ; Failure - False
58 | ; Author ........: Paul Campbell (PaulIA)
59 | ; Modified.......:
60 | ; Remarks .......: This function is used internally by Auto3Lib and should not normally be called
61 | ; Related .......: _MemInit
62 | ; Link ..........:
63 | ; Example .......:
64 | ; ===============================================================================================================================
65 | Func _MemFree(ByRef $tMemMap)
66 | Local $pMemory = DllStructGetData($tMemMap, "Mem")
67 | Local $hProcess = DllStructGetData($tMemMap, "hProc")
68 | Local $bResult = _MemVirtualFreeEx($hProcess, $pMemory, 0, $MEM_RELEASE)
69 | DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hProcess)
70 | If @error Then Return SetError(@error, @extended, False)
71 | Return $bResult
72 | EndFunc ;==>_MemFree
73 |
74 | ; #FUNCTION# ====================================================================================================================
75 | ; Name...........: _MemGlobalAlloc
76 | ; Description ...: Allocates the specified number of bytes from the heap
77 | ; Syntax.........: _MemGlobalAlloc($iBytes[, $iFlags = 0])
78 | ; Parameters ....: $iBytes - The number of bytes to allocate. If this parameter is zero and the $iFlags parameter specifies
79 | ; +$GMEM_MOVEABLE, the function returns a handle to a memory object that is marked as discarded.
80 | ; $iFlags - The memory allocation attributes:
81 | ; |$GMEM_FIXED - Allocates fixed memory. The return value is a pointer.
82 | ; |$GMEM_MOVEABLE - Allocates movable memory. Memory blocks are never moved in physical memory, but
83 | ; +they can be moved within the default heap. The return value is a handle to the memory object.
84 | ; +To translate the handle into a pointer, use the _MemGlobalLock function. This value cannot be
85 | ; +combined with $GMEM_FIXED.
86 | ; |$GMEM_ZEROINIT - Initializes memory contents to zero
87 | ; |$GHND - Combines $GMEM_MOVEABLE and $GMEM_ZEROINIT
88 | ; |$GPTR - Combines $GMEM_FIXED and $GMEM_ZEROINIT
89 | ; Return values .: Success - Handle to the newly allocated memory object
90 | ; Failure - 0
91 | ; Author ........: Paul Campbell (PaulIA)
92 | ; Modified.......:
93 | ; Remarks .......: Windows memory management does not provide a separate local heap and global heap. If this function succeeds,
94 | ; it allocates at least the amount of memory requested. If the actual amount allocated is greater than the
95 | ; amount requested, the process can use the entire amount. To determine the actual number of bytes allocated,
96 | ; use the _MemGlobalSize function. If the heap does not contain sufficient free space to satisfy the request,
97 | ; this function returns NULL. Memory allocated with this function is guaranteed to be aligned on an 8 byte
98 | ; boundary. To execute dynamically generated code, use the _MemVirtualAlloc function to allocate memory and the
99 | ; _Mem_VirtualProtect function to grant $PAGE_EXECUTE access. To free the memory, use the _MemGlobalFree
100 | ; function. It is not safe to free memory allocated with _MemGlobalAlloc using _Mem_LocalFree.
101 | ; Related .......: _MemGlobalLock, _MemGlobalSize, _MemVirtualAlloc, _MemGlobalFree
102 | ; Link ..........: @@MsdnLink@@ GlobalAlloc
103 | ; Example .......:
104 | ; ===============================================================================================================================
105 | Func _MemGlobalAlloc($iBytes, $iFlags = 0)
106 | Local $aResult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $iFlags, "ulong_ptr", $iBytes)
107 | If @error Then Return SetError(@error, @extended, 0)
108 | Return $aResult[0]
109 | EndFunc ;==>_MemGlobalAlloc
110 |
111 | ; #FUNCTION# ====================================================================================================================
112 | ; Name...........: _MemGlobalFree
113 | ; Description ...: Frees the specified global memory object and invalidates its handle
114 | ; Syntax.........: _MemGlobalFree($hMem)
115 | ; Parameters ....: $hMem - Handle to the global memory object
116 | ; Return values .: Success - 0
117 | ; Failure - $hMem
118 | ; Author ........: Paul Campbell (PaulIA)
119 | ; Modified.......:
120 | ; Remarks .......:
121 | ; Related .......: _MemGlobalAlloc
122 | ; Link ..........: @@MsdnLink@@ GlobalFree
123 | ; Example .......:
124 | ; ===============================================================================================================================
125 | Func _MemGlobalFree($hMem)
126 | Local $aResult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hMem)
127 | If @error Then Return SetError(@error, @extended, False)
128 | Return $aResult[0]
129 | EndFunc ;==>_MemGlobalFree
130 |
131 | ; #FUNCTION# ====================================================================================================================
132 | ; Name...........: _MemGlobalLock
133 | ; Description ...: Locks a global memory object and returns a pointer to the first byte of the object's memory block
134 | ; Syntax.........: _MemGlobalLock($hMem)
135 | ; Parameters ....: $hMem - Handle to the global memory object
136 | ; Return values .: Success - Pointer to the first byte of the memory block
137 | ; Failure - 0
138 | ; Author ........: Paul Campbell (PaulIA)
139 | ; Modified.......:
140 | ; Remarks .......:
141 | ; Related .......: _MemGlobalUnlock
142 | ; Link ..........: @@MsdnLink@@ GlobalLock
143 | ; Example .......:
144 | ; ===============================================================================================================================
145 | Func _MemGlobalLock($hMem)
146 | Local $aResult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hMem)
147 | If @error Then Return SetError(@error, @extended, 0)
148 | Return $aResult[0]
149 | EndFunc ;==>_MemGlobalLock
150 |
151 | ; #FUNCTION# ====================================================================================================================
152 | ; Name...........: _MemGlobalSize
153 | ; Description ...: Retrieves the current size of the specified global memory object
154 | ; Syntax.........: _MemGlobalSize($hMem)
155 | ; Parameters ....: $hMem - Handle to the global memory object
156 | ; Return values .: Success - size of the specified global memory object, in bytes
157 | ; Failure - 0
158 | ; Author ........: Paul Campbell (PaulIA)
159 | ; Modified.......:
160 | ; Remarks .......:
161 | ; Related .......: _MemGlobalAlloc, _MemGlobalAlloc
162 | ; Link ..........: @@MsdnLink@@ GlobalSize
163 | ; Example .......:
164 | ; ===============================================================================================================================
165 | Func _MemGlobalSize($hMem)
166 | Local $aResult = DllCall("kernel32.dll", "ulong_ptr", "GlobalSize", "handle", $hMem)
167 | If @error Then Return SetError(@error, @extended, 0)
168 | Return $aResult[0]
169 | EndFunc ;==>_MemGlobalSize
170 |
171 | ; #FUNCTION# ====================================================================================================================
172 | ; Name...........: _MemGlobalUnlock
173 | ; Description ...: Decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE
174 | ; Syntax.........: _MemGlobalUnlock($hMem)
175 | ; Parameters ....: $hMem - Handle to the global memory object
176 | ; Return values .:
177 | ; Author ........: Paul Campbell (PaulIA)
178 | ; Modified.......:
179 | ; Remarks .......:
180 | ; Related .......: _MemGlobalLock
181 | ; Link ..........: @@MsdnLink@@ GlobalUnlock
182 | ; Example .......:
183 | ; ===============================================================================================================================
184 | Func _MemGlobalUnlock($hMem)
185 | Local $aResult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hMem)
186 | If @error Then Return SetError(@error, @extended, 0)
187 | Return $aResult[0]
188 | EndFunc ;==>_MemGlobalUnlock
189 |
190 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
191 | ; Name...........: _MemInit
192 | ; Description ...: Initializes a tagMEMMAP structure for a control
193 | ; Syntax.........: _MemInit($hWnd, $iSize, ByRef $tMemMap)
194 | ; Parameters ....: $hWnd - Window handle of the process where memory will be mapped
195 | ; $iSize - Size, in bytes, of memory space to map
196 | ; $tMemMap - tagMEMMAP structure that will be initialized
197 | ; Return values .: Success - Pointer to reserved memory block
198 | ; Failure - 0
199 | ; Author ........: Paul Campbell (PaulIA)
200 | ; Modified.......:
201 | ; Remarks .......: This function is used internally by Auto3Lib and should not normally be called
202 | ; Related .......: _MemFree
203 | ; Link ..........:
204 | ; Example .......:
205 | ; ===============================================================================================================================
206 | Func _MemInit($hWnd, $iSize, ByRef $tMemMap)
207 | Local $aResult = DllCall("User32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hWnd, "dword*", 0)
208 | If @error Then Return SetError(@error, @extended, 0)
209 | Local $iProcessID = $aResult[2]
210 | If $iProcessID = 0 Then Return SetError(1, 0, 0) ; Invalid window handle
211 |
212 | Local $iAccess = BitOR($PROCESS_VM_OPERATION, $PROCESS_VM_READ, $PROCESS_VM_WRITE)
213 | Local $hProcess = __Mem_OpenProcess($iAccess, False, $iProcessID, True)
214 | Local $iAlloc = BitOR($MEM_RESERVE, $MEM_COMMIT)
215 | Local $pMemory = _MemVirtualAllocEx($hProcess, 0, $iSize, $iAlloc, $PAGE_READWRITE)
216 |
217 | If $pMemory = 0 Then Return SetError(2, 0, 0) ; Unable to allocate memory
218 |
219 | $tMemMap = DllStructCreate($tagMEMMAP)
220 | DllStructSetData($tMemMap, "hProc", $hProcess)
221 | DllStructSetData($tMemMap, "Size", $iSize)
222 | DllStructSetData($tMemMap, "Mem", $pMemory)
223 | Return $pMemory
224 | EndFunc ;==>_MemInit
225 |
226 | ; #FUNCTION# ====================================================================================================================
227 | ; Name...........: _MemMoveMemory
228 | ; Description ...: Moves memory either forward or backward, aligned or unaligned
229 | ; Syntax.........: _MemMoveMemory($pSource, $pDest, $iLength)
230 | ; Parameters ....: $pSource - Pointer to the source of the move
231 | ; $pDest - Pointer to the destination of the move
232 | ; $iLength - Specifies the number of bytes to be copied
233 | ; Return values .:
234 | ; Author ........: Paul Campbell (PaulIA)
235 | ; Modified.......:
236 | ; Remarks .......:
237 | ; Related .......:
238 | ; Link ..........: @@MsdnLink@@ RtlMoveMemory
239 | ; Example .......:
240 | ; ===============================================================================================================================
241 | Func _MemMoveMemory($pSource, $pDest, $iLength)
242 | DllCall("kernel32.dll", "none", "RtlMoveMemory", "struct*", $pDest, "struct*", $pSource, "ulong_ptr", $iLength)
243 | If @error Then Return SetError(@error, @extended)
244 | EndFunc ;==>_MemMoveMemory
245 |
246 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
247 | ; Name...........: _MemRead
248 | ; Description ...: Transfer memory from external address space to internal address space
249 | ; Syntax.........: _MemRead(ByRef $tMemMap, $pSrce, $pDest, $iSize)
250 | ; Parameters ....: $tMemMap - tagMEMMAP structure
251 | ; $pSrce - Pointer to external memory
252 | ; $pDest - Pointer to internal memory
253 | ; $iSize - Size in bytes of memory to read
254 | ; Return values .: Success - True
255 | ; Failure - False
256 | ; Author ........: Paul Campbell (PaulIA)
257 | ; Modified.......:
258 | ; Remarks .......: This function is used internally by Auto3Lib and should not normally be called
259 | ; Related .......: _MemWrite
260 | ; Link ..........:
261 | ; Example .......:
262 | ; ===============================================================================================================================
263 | Func _MemRead(ByRef $tMemMap, $pSrce, $pDest, $iSize)
264 | Local $aResult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", DllStructGetData($tMemMap, "hProc"), _
265 | "ptr", $pSrce, "struct*", $pDest, "ulong_ptr", $iSize, "ulong_ptr*", 0)
266 | If @error Then Return SetError(@error, @extended, False)
267 | Return $aResult[0]
268 | EndFunc ;==>_MemRead
269 |
270 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
271 | ; Name...........: _MemWrite
272 | ; Description ...: Transfer memory to external address space from internal address space
273 | ; Syntax.........: _MemWrite(ByRef $tMemMap, $pSrce[, $pDest = 0[, $iSize = 0[, $sSrce = "ptr"]]])
274 | ; Parameters ....: $tMemMap - tagMEMMAP structure
275 | ; $pSrce - Pointer to internal memory
276 | ; $pDest - Pointer to external memory
277 | ; $iSize - Size in bytes of memory to write
278 | ; $sSrce - Contains the data type for $pSrce
279 | ; Return values .: Success - True
280 | ; Failure - False
281 | ; Author ........: Paul Campbell (PaulIA)
282 | ; Modified.......:
283 | ; Remarks .......: This function is used internally by Auto3Lib and should not normally be called
284 | ; Related .......: _MemRead
285 | ; Link ..........:
286 | ; Example .......:
287 | ; ===============================================================================================================================
288 | Func _MemWrite(ByRef $tMemMap, $pSrce, $pDest = 0, $iSize = 0, $sSrce = "struct*")
289 | If $pDest = 0 Then $pDest = DllStructGetData($tMemMap, "Mem")
290 | If $iSize = 0 Then $iSize = DllStructGetData($tMemMap, "Size")
291 | Local $aResult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", DllStructGetData($tMemMap, "hProc"), _
292 | "ptr", $pDest, $sSrce, $pSrce, "ulong_ptr", $iSize, "ulong_ptr*", 0)
293 | If @error Then Return SetError(@error, @extended, False)
294 | Return $aResult[0]
295 | EndFunc ;==>_MemWrite
296 |
297 | ; #FUNCTION# ====================================================================================================================
298 | ; Name...........: _MemVirtualAlloc
299 | ; Description ...: Reserves or commits a region of pages in the virtual address space of the calling process
300 | ; Syntax.........: _MemVirtualAlloc($pAddress, $iSize, $iAllocation, $iProtect)
301 | ; Parameters ....: $pAddress - Specifies the desired starting address of the region to allocate
302 | ; $iSize - Specifies the size, in bytes, of th region
303 | ; $iAllocation - Specifies the type of allocation:
304 | ; |$MEM_COMMIT - Allocates physical storage in memory or in the paging file on disk for the specified region
305 | ; +of pages.
306 | ; |$MEM_RESERVE - Reserves a range of the process's virtual address space without allocating any physical
307 | ; +storage.
308 | ; |$MEM_TOP_DOWN - Allocates memory at the highest possible address
309 | ; $iProtect - Type of access protection:
310 | ; |$PAGE_READONLY - Enables read access to the committed region of pages
311 | ; |$PAGE_READWRITE - Enables read and write access to the committed region
312 | ; |$PAGE_EXECUTE - Enables execute access to the committed region
313 | ; |$PAGE_EXECUTE_READ - Enables execute and read access to the committed region
314 | ; |$PAGE_EXECUTE_READWRITE - Enables execute, read, and write access to the committed region of pages
315 | ; |$PAGE_GUARD - Pages in the region become guard pages
316 | ; |$PAGE_NOACCESS - Disables all access to the committed region of pages
317 | ; |$PAGE_NOCACHE - Allows no caching of the committed regions of pages
318 | ; Return values .: Success - Memory address pointer
319 | ; Failure - 0
320 | ; Author ........: Paul Campbell (PaulIA)
321 | ; Modified.......:
322 | ; Remarks .......:
323 | ; Related .......: _MemVirtualFree, _MemGlobalAlloc
324 | ; Link ..........: @@MsdnLink@@ VirtualAlloc
325 | ; Example .......:
326 | ; ===============================================================================================================================
327 | Func _MemVirtualAlloc($pAddress, $iSize, $iAllocation, $iProtect)
328 | Local $aResult = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", $pAddress, "ulong_ptr", $iSize, "dword", $iAllocation, "dword", $iProtect)
329 | If @error Then Return SetError(@error, @extended, 0)
330 | Return $aResult[0]
331 | EndFunc ;==>_MemVirtualAlloc
332 |
333 | ; #FUNCTION# ====================================================================================================================
334 | ; Name...........: _MemVirtualAllocEx
335 | ; Description ...: Reserves a region of memory within the virtual address space of a specified process
336 | ; Syntax.........: _MemVirtualAllocEx($hProcess, $pAddress, $iSize, $iAllocation, $iProtect)
337 | ; Parameters ....: $hProcess - Handle to process
338 | ; $pAddress - Specifies the desired starting address of the region to allocate
339 | ; $iSize - Specifies the size, in bytes, of th region
340 | ; $iAllocation - Specifies the type of allocation:
341 | ; |$MEM_COMMIT - Allocates physical storage in memory or in the paging file on disk for the specified region
342 | ; +of pages.
343 | ; |$MEM_RESERVE - Reserves a range of the process's virtual address space without allocating any physical
344 | ; +storage.
345 | ; |$MEM_TOP_DOWN - Allocates memory at the highest possible address
346 | ; $iProtect - Type of access protection:
347 | ; |$PAGE_READONLY - Enables read access to the committed region of pages
348 | ; |$PAGE_READWRITE - Enables read and write access to the committed region
349 | ; |$PAGE_EXECUTE - Enables execute access to the committed region
350 | ; |$PAGE_EXECUTE_READ - Enables execute and read access to the committed region
351 | ; |$PAGE_EXECUTE_READWRITE - Enables execute, read, and write access to the committed region of pages
352 | ; |$PAGE_GUARD - Pages in the region become guard pages
353 | ; |$PAGE_NOACCESS - Disables all access to the committed region of pages
354 | ; |$PAGE_NOCACHE - Allows no caching of the committed regions of pages
355 | ; Return values .: Success - Memory address pointer
356 | ; Author ........: Paul Campbell (PaulIA)
357 | ; Modified.......:
358 | ; Remarks .......:
359 | ; Related .......: _MemVirtualFreeEx
360 | ; Link ..........: @@MsdnLink@@ VirtualAllocEx
361 | ; Example .......:
362 | ; ===============================================================================================================================
363 | Func _MemVirtualAllocEx($hProcess, $pAddress, $iSize, $iAllocation, $iProtect)
364 | Local $aResult = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $hProcess, "ptr", $pAddress, "ulong_ptr", $iSize, "dword", $iAllocation, "dword", $iProtect)
365 | If @error Then Return SetError(@error, @extended, 0)
366 | Return $aResult[0]
367 | EndFunc ;==>_MemVirtualAllocEx
368 |
369 | ; #FUNCTION# ====================================================================================================================
370 | ; Name...........: _MemVirtualFree
371 | ; Description ...: Releases a region of pages within the virtual address space of a process
372 | ; Syntax.........: _MemVirtualFree($pAddress, $iSize, $iFreeType)
373 | ; Parameters ....: $pAddress - Points to the base address of the region of pages to be freed
374 | ; $iSize - Specifies the size, in bytes, of the region to be freed
375 | ; $iFreeType - Specifies the type of free operation:
376 | ; |$MEM_DECOMMIT - Decommits the specified region of committed pages
377 | ; |$MEM_RELEASE - Releases the specified region of reserved pages
378 | ; Return values .: Success - True
379 | ; Failure - False
380 | ; Author ........: Paul Campbell (PaulIA)
381 | ; Modified.......:
382 | ; Remarks .......:
383 | ; Related .......: _MemVirtualAlloc
384 | ; Link ..........: @@MsdnLink@@ VirtualFree
385 | ; Example .......:
386 | ; ===============================================================================================================================
387 | Func _MemVirtualFree($pAddress, $iSize, $iFreeType)
388 | Local $aResult = DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $pAddress, "ulong_ptr", $iSize, "dword", $iFreeType)
389 | If @error Then Return SetError(@error, @extended, False)
390 | Return $aResult[0]
391 | EndFunc ;==>_MemVirtualFree
392 |
393 | ; #FUNCTION# ====================================================================================================================
394 | ; Name...........: _MemVirtualFreeEx
395 | ; Description ...: Releases a region of pages within the virtual address space of a process
396 | ; Syntax.........: _MemVirtualFreeEx($hProcess, $pAddress, $iSize, $iFreeType)
397 | ; Parameters ....: $hProcess - Handle to a process
398 | ; $pAddress - A pointer to the starting address of the region of memory to be freed
399 | ; $iSize - The size of the region of memory to free, in bytes
400 | ; $iFreeType - Specifies the type of free operation:
401 | ; |$MEM_DECOMMIT - Decommits the specified region of committed pages
402 | ; |$MEM_RELEASE - Releases the specified region of reserved pages
403 | ; Return values .: Success - True
404 | ; Failure - False
405 | ; Author ........: Paul Campbell (PaulIA)
406 | ; Modified.......:
407 | ; Remarks .......:
408 | ; Related .......: _MemVirtualAllocEx
409 | ; Link ..........: @@MsdnLink@@ VirtualFreeEx
410 | ; Example .......:
411 | ; ===============================================================================================================================
412 | Func _MemVirtualFreeEx($hProcess, $pAddress, $iSize, $iFreeType)
413 | Local $aResult = DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $hProcess, "ptr", $pAddress, "ulong_ptr", $iSize, "dword", $iFreeType)
414 | If @error Then Return SetError(@error, @extended, False)
415 | Return $aResult[0]
416 | EndFunc ;==>_MemVirtualFreeEx
417 |
418 | ; #INTERNAL_USE_ONLY# ===========================================================================================================
419 | ; Name...........: __Mem_OpenProcess
420 | ; Description ...: Returns a handle of an existing process object
421 | ; Syntax.........: _WinAPI_OpenProcess($iAccess, $fInherit, $iProcessID[, $fDebugPriv = False])
422 | ; Parameters ....: $iAccess - Specifies the access to the process object
423 | ; $fInherit - Specifies whether the returned handle can be inherited
424 | ; $iProcessID - Specifies the process identifier of the process to open
425 | ; $fDebugPriv - Certain system processes can not be opened unless you have the debug security privilege. If
426 | ; +True, this function will attempt to open the process with debug priviliges if the process can not be opened
427 | ; +with standard access privileges.
428 | ; Return values .: Success - Process handle to the object
429 | ; Author ........: Paul Campbell (PaulIA)
430 | ; Modified.......: jpm
431 | ; Remarks .......:
432 | ; Related .......:
433 | ; Link ..........: @@MsdnLink@@ OpenProcess
434 | ; Example .......:
435 | ; ===============================================================================================================================
436 | Func __Mem_OpenProcess($iAccess, $fInherit, $iProcessID, $fDebugPriv = False)
437 | ; Attempt to open process with standard security priviliges
438 | Local $aResult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iAccess, "bool", $fInherit, "dword", $iProcessID)
439 | If @error Then Return SetError(@error, @extended, 0)
440 | If $aResult[0] Then Return $aResult[0]
441 | If Not $fDebugPriv Then Return 0
442 |
443 | ; Enable debug privileged mode
444 | Local $hToken = _Security__OpenThreadTokenEx(BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY))
445 | If @error Then Return SetError(@error, @extended, 0)
446 | _Security__SetPrivilege($hToken, "SeDebugPrivilege", True)
447 | Local $iError = @error
448 | Local $iLastError = @extended
449 | Local $iRet = 0
450 | If Not @error Then
451 | ; Attempt to open process with debug privileges
452 | $aResult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iAccess, "bool", $fInherit, "dword", $iProcessID)
453 | $iError = @error
454 | $iLastError = @extended
455 | If $aResult[0] Then $iRet = $aResult[0]
456 |
457 | ; Disable debug privileged mode
458 | _Security__SetPrivilege($hToken, "SeDebugPrivilege", False)
459 | If @error Then
460 | $iError = @error
461 | $iLastError = @extended
462 | EndIf
463 | EndIf
464 | DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hToken)
465 | ; No need to test @error.
466 |
467 | Return SetError($iError, $iLastError, $iRet)
468 | EndFunc ;==>__Mem_OpenProcess
469 |
470 |
--------------------------------------------------------------------------------
/src/include/MemoryConstants.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | ; #INDEX# =======================================================================================================================
4 | ; Title .........: Memory_Constants
5 | ; AutoIt Version : 3.2
6 | ; Language ......: English
7 | ; Description ...: Constants for Memory functions.
8 | ; Author(s) .....: Paul Campbell (PaulIA)
9 | ; ===============================================================================================================================
10 |
11 | ; #CONSTANTS# ===================================================================================================================
12 | Global Const $GMEM_FIXED = 0x0000
13 | Global Const $GMEM_MOVEABLE = 0x0002
14 | Global Const $GMEM_NOCOMPACT = 0x0010
15 | Global Const $GMEM_NODISCARD = 0x0020
16 | Global Const $GMEM_ZEROINIT = 0x0040
17 | Global Const $GMEM_MODIFY = 0x0080
18 | Global Const $GMEM_DISCARDABLE = 0x0100
19 | Global Const $GMEM_NOT_BANKED = 0x1000
20 | Global Const $GMEM_SHARE = 0x2000
21 | Global Const $GMEM_DDESHARE = 0x2000
22 | Global Const $GMEM_NOTIFY = 0x4000
23 | Global Const $GMEM_LOWER = 0x1000
24 | Global Const $GMEM_VALID_FLAGS = 0x7F72
25 | Global Const $GMEM_INVALID_HANDLE = 0x8000
26 |
27 | Global Const $GPTR = $GMEM_FIXED + $GMEM_ZEROINIT ; in fact equal $GMEM_ZEROINIT
28 | Global Const $GHND = $GMEM_MOVEABLE + $GMEM_ZEROINIT
29 |
30 | ; VirtualAlloc Allocation Type Constants
31 |
32 | Global Const $MEM_COMMIT = 0x00001000
33 | Global Const $MEM_RESERVE = 0x00002000
34 | Global Const $MEM_TOP_DOWN = 0x00100000
35 | Global Const $MEM_SHARED = 0x08000000
36 |
37 | ; VirtualAlloc Protection Constants
38 |
39 | Global Const $PAGE_NOACCESS = 0x00000001
40 | Global Const $PAGE_READONLY = 0x00000002
41 | Global Const $PAGE_READWRITE = 0x00000004
42 | Global Const $PAGE_EXECUTE = 0x00000010
43 | Global Const $PAGE_EXECUTE_READ = 0x00000020
44 | Global Const $PAGE_EXECUTE_READWRITE = 0x00000040
45 | Global Const $PAGE_GUARD = 0x00000100
46 | Global Const $PAGE_NOCACHE = 0x00000200
47 |
48 | ; VirtualFree FreeType Constants
49 |
50 | Global Const $MEM_DECOMMIT = 0x00004000
51 | Global Const $MEM_RELEASE = 0x00008000
52 | ; ===============================================================================================================================
53 |
--------------------------------------------------------------------------------
/src/include/ProcessConstants.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | ; #INDEX# =======================================================================================================================
4 | ; Title .........: Process_Constants
5 | ; AutoIt Version : 3.3
6 | ; Language ......: English
7 | ; Description ...: Constants to be included in an AutoIt v3 script when using Process functions.
8 | ; Author(s) .....: Valik, Gary Frost, ...
9 | ; ===============================================================================================================================
10 |
11 | ; #CONSTANTS# ===================================================================================================================
12 | Global Const $PROCESS_TERMINATE = 0x00000001
13 | Global Const $PROCESS_CREATE_THREAD = 0x00000002
14 | Global Const $PROCESS_SET_SESSIONID = 0x00000004
15 | Global Const $PROCESS_VM_OPERATION = 0x00000008
16 | Global Const $PROCESS_VM_READ = 0x00000010
17 | Global Const $PROCESS_VM_WRITE = 0x00000020
18 | Global Const $PROCESS_DUP_HANDLE = 0x00000040
19 | Global Const $PROCESS_CREATE_PROCESS = 0x00000080
20 | Global Const $PROCESS_SET_QUOTA = 0x00000100
21 | Global Const $PROCESS_SET_INFORMATION = 0x00000200
22 | Global Const $PROCESS_QUERY_INFORMATION = 0x00000400
23 | Global Const $PROCESS_SUSPEND_RESUME = 0x00000800
24 | Global Const $PROCESS_ALL_ACCESS = 0x001F0FFF
25 | ; ===============================================================================================================================
26 |
--------------------------------------------------------------------------------
/src/include/Security.au3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/n0ot/nutils/982a8c74dce08425d293882b429472e1315dd2ba/src/include/Security.au3
--------------------------------------------------------------------------------
/src/include/SecurityConstants.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | ; #INDEX# =======================================================================================================================
4 | ; Title .........: Security_Constants
5 | ; AutoIt Version : 3.2
6 | ; Language ......: English
7 | ; Description ...: Constants for Security functions.
8 | ; Author(s) .....: Paul Campbell (PaulIA), trancexx
9 | ; ===============================================================================================================================
10 |
11 | ; #CONSTANTS# ===================================================================================================================
12 | Global Const $ERROR_NO_TOKEN = 1008
13 |
14 | Global Const $SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
15 | Global Const $SE_AUDIT_NAME = "SeAuditPrivilege"
16 | Global Const $SE_BACKUP_NAME = "SeBackupPrivilege"
17 | Global Const $SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
18 | Global Const $SE_CREATE_GLOBAL_NAME = "SeCreateGlobalPrivilege"
19 | Global Const $SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
20 | Global Const $SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
21 | Global Const $SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
22 | Global Const $SE_DEBUG_NAME = "SeDebugPrivilege"
23 | Global Const $SE_ENABLE_DELEGATION_NAME = "SeEnableDelegationPrivilege"
24 | Global Const $SE_IMPERSONATE_NAME = "SeImpersonatePrivilege"
25 | Global Const $SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
26 | Global Const $SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
27 | Global Const $SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
28 | Global Const $SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
29 | Global Const $SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
30 | Global Const $SE_MANAGE_VOLUME_NAME = "SeManageVolumePrivilege"
31 | Global Const $SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
32 | Global Const $SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
33 | Global Const $SE_RESTORE_NAME = "SeRestorePrivilege"
34 | Global Const $SE_SECURITY_NAME = "SeSecurityPrivilege"
35 | Global Const $SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
36 | Global Const $SE_SYNC_AGENT_NAME = "SeSyncAgentPrivilege"
37 | Global Const $SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
38 | Global Const $SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
39 | Global Const $SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
40 | Global Const $SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
41 | Global Const $SE_TCB_NAME = "SeTcbPrivilege"
42 | Global Const $SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"
43 | Global Const $SE_UNDOCK_NAME = "SeUndockPrivilege"
44 |
45 | Global Const $SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001
46 | Global Const $SE_PRIVILEGE_ENABLED = 0x00000002
47 | Global Const $SE_PRIVILEGE_REMOVED = 0x00000004
48 | Global Const $SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000
49 |
50 | Global Const $SE_GROUP_MANDATORY = 0x00000001
51 | Global Const $SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002
52 | Global Const $SE_GROUP_ENABLED = 0x00000004
53 | Global Const $SE_GROUP_OWNER = 0x00000008
54 | Global Const $SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010
55 | Global Const $SE_GROUP_INTEGRITY = 0x00000020
56 | Global Const $SE_GROUP_INTEGRITY_ENABLED = 0x00000040
57 | Global Const $SE_GROUP_RESOURCE = 0x20000000
58 | Global Const $SE_GROUP_LOGON_ID = 0xC0000000
59 |
60 | Global Enum $TOKENPRIMARY = 1, $TOKENIMPERSONATION
61 | Global Enum $SECURITYANONYMOUS = 0, $SECURITYIDENTIFICATION, $SECURITYIMPERSONATION, $SECURITYDELEGATION
62 | 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
63 |
64 | Global Const $TOKEN_ASSIGN_PRIMARY = 0x00000001
65 | Global Const $TOKEN_DUPLICATE = 0x00000002
66 | Global Const $TOKEN_IMPERSONATE = 0x00000004
67 | Global Const $TOKEN_QUERY = 0x00000008
68 | Global Const $TOKEN_QUERY_SOURCE = 0x00000010
69 | Global Const $TOKEN_ADJUST_PRIVILEGES = 0x00000020
70 | Global Const $TOKEN_ADJUST_GROUPS = 0x00000040
71 | Global Const $TOKEN_ADJUST_DEFAULT = 0x00000080
72 | Global Const $TOKEN_ADJUST_SESSIONID = 0x00000100
73 | Global Const $TOKEN_ALL_ACCESS = 0x000F01FF
74 |
75 | Global Const $TOKEN_READ = 0x00020008
76 | Global Const $TOKEN_WRITE = 0x000200E0
77 | Global Const $TOKEN_EXECUTE = 0x00020000
78 |
79 | Global Const $TOKEN_HAS_TRAVERSE_PRIVILEGE = 0x00000001
80 | Global Const $TOKEN_HAS_BACKUP_PRIVILEGE = 0x00000002
81 | Global Const $TOKEN_HAS_RESTORE_PRIVILEGE = 0x00000004
82 | Global Const $TOKEN_HAS_ADMIN_GROUP = 0x00000008
83 | Global Const $TOKEN_IS_RESTRICTED = 0x00000010
84 | Global Const $TOKEN_SESSION_NOT_REFERENCED = 0x00000020
85 | Global Const $TOKEN_SANDBOX_INERT = 0x00000040
86 | Global Const $TOKEN_HAS_IMPERSONATE_PRIVILEGE = 0x00000080
87 |
88 | Global Const $RIGHTS_DELETE = 0x00010000
89 | Global Const $READ_CONTROL = 0x00020000
90 | Global Const $WRITE_DAC = 0x00040000
91 | Global Const $WRITE_OWNER = 0x00080000
92 | Global Const $SYNCHRONIZE = 0x00100000
93 | Global Const $STANDARD_RIGHTS_REQUIRED = 0x000f0000
94 | Global Const $STANDARD_RIGHTS_READ = $READ_CONTROL
95 | Global Const $STANDARD_RIGHTS_WRITE = $READ_CONTROL
96 | Global Const $STANDARD_RIGHTS_EXECUTE = $READ_CONTROL
97 | Global Const $STANDARD_RIGHTS_ALL = 0x001F0000
98 | Global Const $SPECIFIC_RIGHTS_ALL = 0x0000FFFF
99 |
100 | Global Enum $NOT_USED_ACCESS = 0, $GRANT_ACCESS, $SET_ACCESS, $DENY_ACCESS, $REVOKE_ACCESS, $SET_AUDIT_SUCCESS, $SET_AUDIT_FAILURE
101 | 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
102 |
103 | Global Const $LOGON_WITH_PROFILE = 0x00000001
104 | Global Const $LOGON_NETCREDENTIALS_ONLY = 0x00000002
105 |
106 | Global Enum $SIDTYPEUSER = 1, $SIDTYPEGROUP, $SIDTYPEDOMAIN, $SIDTYPEALIAS, $SIDTYPEWELLKNOWNGROUP, $SIDTYPEDELETEDACCOUNT, $SIDTYPEINVALID, $SIDTYPEUNKNOWN, $SIDTYPECOMPUTER, $SIDTYPELABEL
107 |
108 | Global Const $SID_ADMINISTRATORS = "S-1-5-32-544"
109 | Global Const $SID_USERS = "S-1-5-32-545"
110 | Global Const $SID_GUESTS = "S-1-5-32-546"
111 | Global Const $SID_ACCOUNT_OPERATORS = "S-1-5-32-548"
112 | Global Const $SID_SERVER_OPERATORS = "S-1-5-32-549"
113 | Global Const $SID_PRINT_OPERATORS = "S-1-5-32-550"
114 | Global Const $SID_BACKUP_OPERATORS = "S-1-5-32-551"
115 | Global Const $SID_REPLICATOR = "S-1-5-32-552"
116 |
117 | Global Const $SID_OWNER = "S-1-3-0"
118 | Global Const $SID_EVERYONE = "S-1-1-0"
119 | Global Const $SID_NETWORK = "S-1-5-2"
120 | Global Const $SID_INTERACTIVE = "S-1-5-4"
121 | Global Const $SID_SYSTEM = "S-1-5-18"
122 | Global Const $SID_AUTHENTICATED_USERS = "S-1-5-11"
123 |
124 | Global Const $SID_SCHANNEL_AUTHENTICATION = "S-1-5-64-14"
125 | Global Const $SID_DIGEST_AUTHENTICATION = "S-1-5-64-21"
126 | Global Const $SID_NT_SERVICE = "S-1-5-80"
127 | Global Const $SID_UNTRUSTED_MANDATORY_LEVEL = "S-1-16-0"
128 |
129 | Global Const $SID_LOW_MANDATORY_LEVEL = "S-1-16-4096"
130 | Global Const $SID_MEDIUM_MANDATORY_LEVEL = "S-1-16-8192"
131 | Global Const $SID_MEDIUM_PLUS_MANDATORY_LEVEL = "S-1-16-8448"
132 | Global Const $SID_HIGH_MANDATORY_LEVEL = "S-1-16-12288"
133 | Global Const $SID_SYSTEM_MANDATORY_LEVEL = "S-1-16-16384"
134 | Global Const $SID_PROTECTED_PROCESS_MANDATORY_LEVEL = "S-1-16-20480"
135 | Global Const $SID_SECURE_PROCESS_MANDATORY_LEVEL = "S-1-16-28672"
136 | Global Const $SID_ALL_SERVICES = "S-1-5-80-0"
137 |
138 | ; ===============================================================================================================================
139 |
--------------------------------------------------------------------------------
/src/include/SendMessage.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | ; #INDEX# =======================================================================================================================
4 | ; Title .........: SendMessage
5 | ; AutoIt Version : 3.1.1++
6 | ; Language ......: English
7 | ; Description ...: Functions that assist SendMessage calls.
8 | ; Author(s) .....: Valik, Gary Frost
9 | ; Dll(s) ........: user32.dll
10 | ; ===============================================================================================================================
11 |
12 | ; #CURRENT# =====================================================================================================================
13 | ;_SendMessage
14 | ;_SendMessageA
15 | ; ===============================================================================================================================
16 |
17 | ; #FUNCTION# ====================================================================================================================
18 | ; Name...........: _SendMessage
19 | ; Description ...: Wrapper for commonly used Dll Call
20 | ; Syntax.........: _SendMessage($hWnd, $iMsg[, $wParam = 0[, $lParam = 0[, $iReturn = 0[, $wParamType = "wparam"[, $lParamType = "lparam"[, $sReturnType = "lresult"]]]]]])
21 | ; Parameters ....: $hWnd - Window/control handle
22 | ; $iMsg - Message to send to control (number)
23 | ; $wParam - Specifies additional message-specific information
24 | ; $lParam - Specifies additional message-specific information
25 | ; $iReturn - What to return:
26 | ; |0 - Return value from dll call
27 | ; |1 - $ihWnd
28 | ; |2 - $iMsg
29 | ; |3 - $wParam
30 | ; |4 - $lParam
31 | ; |<0 or > 4 - array same as dllcall
32 | ; $wParamType - See DllCall in Related
33 | ; $lParamType - See DllCall in Related
34 | ; $sReturnType - See DllCall in Related
35 | ; Return values .: Success - User selected value from the DllCall() result
36 | ; Failure - @error is set
37 | ; Author ........: Valik
38 | ; Modified.......: Gary Frost (GaryFrost) aka gafrost
39 | ; Remarks .......:
40 | ; Related .......: _SendMessage, DllCall
41 | ; Link ..........:
42 | ; Example .......: Yes
43 | ; ===============================================================================================================================
44 | Func _SendMessage($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lresult")
45 | Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessageW", "hwnd", $hWnd, "uint", $iMsg, $wParamType, $wParam, $lParamType, $lParam)
46 | If @error Then Return SetError(@error, @extended, "")
47 | If $iReturn >= 0 And $iReturn <= 4 Then Return $aResult[$iReturn]
48 | Return $aResult
49 | EndFunc ;==>_SendMessage
50 |
51 | ; #FUNCTION# ====================================================================================================================
52 | ; Name...........: _SendMessageA
53 | ; Description ...: Wrapper for commonly used Dll Call (Force Ansi Call)
54 | ; Syntax.........: _SendMessageA($hWnd, $iMsg[, $wParam = 0[, $lParam = 0[, $iReturn = 0[, $wParamType = "wparam"[, $lParamType = "lparam"[, $sReturnType = "lresult"]]]]]])
55 | ; Parameters ....: $hWnd - Window/control handle
56 | ; $iMsg - Message to send to control (number)
57 | ; $wParam - Specifies additional message-specific information
58 | ; $lParam - Specifies additional message-specific information
59 | ; $iReturn - What to return:
60 | ; |0 - Return value from dll call
61 | ; |1 - $ihWnd
62 | ; |2 - $iMsg
63 | ; |3 - $wParam
64 | ; |4 - $lParam
65 | ; |<0 or > 4 - array same as dllcall
66 | ; $wParamType - See DllCall in Related
67 | ; $lParamType - See DllCall in Related
68 | ; $sReturnType - See DllCall in Related
69 | ; Return values .: Success - User selected value from the DllCall() result
70 | ; Failure - @error is set
71 | ; Author ........: Valik
72 | ; Modified.......: Gary Frost (GaryFrost) aka gafrost
73 | ; Remarks .......:
74 | ; Related .......: _SendMessage, DllCall
75 | ; Link ..........:
76 | ; Example .......:
77 | ; ===============================================================================================================================
78 | Func _SendMessageA($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lresult")
79 | Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessageA", "hwnd", $hWnd, "uint", $iMsg, $wParamType, $wParam, $lParamType, $lParam)
80 | If @error Then Return SetError(@error, @extended, "")
81 | If $iReturn >= 0 And $iReturn <= 4 Then Return $aResult[$iReturn]
82 | Return $aResult
83 | EndFunc ;==>_SendMessageA
84 |
--------------------------------------------------------------------------------
/src/include/StructureConstants.au3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/n0ot/nutils/982a8c74dce08425d293882b429472e1315dd2ba/src/include/StructureConstants.au3
--------------------------------------------------------------------------------
/src/include/WinAPIError.au3:
--------------------------------------------------------------------------------
1 | #include-once
2 |
3 | ; #INDEX# =======================================================================================================================
4 | ; Title .........: Windows API
5 | ; AutoIt Version : 3.2
6 | ; Description ...: Windows API calls that have been translated to AutoIt functions.
7 | ; Author(s) .....: Paul Campbell (PaulIA)
8 | ; Dll ...........: kernel32.dll
9 | ; ===============================================================================================================================
10 |
11 | ; #CURRENT# =====================================================================================================================
12 | ;_WinAPI_GetLastError
13 | ;_WinAPI_SetLastError
14 | ; ===============================================================================================================================
15 |
16 | ; #FUNCTION# ====================================================================================================================
17 | ; Name...........: _WinAPI_GetLastError
18 | ; Description ...: Returns the calling thread's lasterror code value
19 | ; Syntax.........: _WinAPI_GetLastError()
20 | ; Parameters ....:
21 | ; Return values .: Success - Last error code
22 | ; Author ........: Paul Campbell (PaulIA)
23 | ; Modified.......:
24 | ; Remarks .......:
25 | ; Related .......: _WinAPI_GetLastErrorMessage
26 | ; Link ..........: @@MsdnLink@@ GetLastError
27 | ; Example .......:
28 | ; ===============================================================================================================================
29 | Func _WinAPI_GetLastError($curErr = @error, $curExt = @extended)
30 | Local $aResult = DllCall("kernel32.dll", "dword", "GetLastError")
31 | Return SetError($curErr, $curExt, $aResult[0])
32 | EndFunc ;==>_WinAPI_GetLastError
33 |
34 | ; #FUNCTION# ====================================================================================================================
35 | ; Name...........: _WinAPI_SetLastError
36 | ; Description ...: Sets the last-error code for the calling thread
37 | ; Syntax.........: _WinAPI_SetLastError($iErrCode)
38 | ; Parameters ....: $iErrCode - The last error code for the thread
39 | ; Return values .:
40 | ; Author ........: Paul Campbell (PaulIA)
41 | ; Modified.......:
42 | ; Remarks .......: The last error code is kept in thread local storage so that multiple threads do not overwrite each other's
43 | ; values.
44 | ; Related .......:
45 | ; Link ..........: @@MsdnLink@@ SetLastError
46 | ; Example .......:
47 | ; ===============================================================================================================================
48 | Func _WinAPI_SetLastError($iErrCode, $curErr = @error, $curExt = @extended)
49 | DllCall("kernel32.dll", "none", "SetLastError", "dword", $iErrCode)
50 | Return SetError($curErr, $curExt)
51 | EndFunc ;==>_WinAPI_SetLastError
52 |
--------------------------------------------------------------------------------
/src/lang/en.ini:
--------------------------------------------------------------------------------
1 | [info]
2 | Display=English
3 | Native=English
4 | Author=Niko Carpenter
5 | [str]
6 | ExitIcon=Exit
7 | About=About
8 | CheckforUpdates=Check for Updates
9 | CannotConnectTo=Cannot connect to
10 | YouAreRunningNUtils=You are running NUtils
11 | TheCurrentVersionOfNUtilsIs=The current version of NUtils is
12 | WouldYouLikeToVisitTheWebsiteNow=Would you like to visit the website now?
13 | YouAreRunningTheCurrentVersionOfNUtils=You are running the current version of NUtils
14 | WrittenBy=Written by
15 | and=and
16 | WebSite=Web site
17 | UnhideTitle=Unhide Window
18 | UnhideButton=Unhide
19 | UnhideMessage=Select the window you wish to unhide and then click "%UnhideButton%"
20 | Cancel=Cancel
21 | Stack=Stack
22 | SetTitleTitle=Set Title
23 | SetTitleMessage=Enter the new title for this window
24 | SelectLanguage=Select language
25 | Language=Language
26 | Author=Author
--------------------------------------------------------------------------------
/src/lang/es.ini:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/n0ot/nutils/982a8c74dce08425d293882b429472e1315dd2ba/src/lang/es.ini
--------------------------------------------------------------------------------
/src/lang/nl.ini:
--------------------------------------------------------------------------------
1 | [info]
2 | Display=Dutch
3 | Native=Nederlands
4 | Author=Marinda Wijnen
5 | [str]
6 | ExitIcon=Afsluiten
7 | About=Over
8 | CheckforUpdates=Controleer op updates
9 | CannotConnectTo=Kan geen verbinding maken met
10 | YouAreRunningNUtils=u runt nu NUtils
11 | TheCurrentVersionOfNUtilsIs=De meest recente versie van NUtils is
12 | WouldYouLikeToVisitTheWebsiteNow=Wilt u de website nu bezoeken?
13 | YouAreRunningTheCurrentVersionOfNUtils=U runt nu de meest recente versie van NUtils
14 | WrittenBy=Geschreven door
15 | and=En
16 | WebSite=Website
17 | UnhideTitle=Laat het venster zien
18 | UnhideButton=Zichtbaar maken
19 | UnhideMessage=Selecteer het venster dat u wilt laten verschijnen en klik op "%UnhideButton%"
20 | Cancel=Annuleren
21 | Stack=Stapel
22 | SetTitleTitle=Wijzig titel
23 | SetTitleMessaGe=Geef een nieuwe titel voor dit venster op
24 | SelectLanguage=Selecteer taal
25 | Language=Taal
26 | Author=Auteur
--------------------------------------------------------------------------------
/src/license.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/src/settings.ini:
--------------------------------------------------------------------------------
1 | [settings]
2 | ;language= NUtils will display all messages in this language if supported.
3 | language=en
4 | ;Set to 0 uses number pack; 1 (default) beeps n number of times; n = stack you are switching too.
5 | StackCounter=1
6 |
--------------------------------------------------------------------------------