@@ -137,7 +137,6 @@ internal RamOptimizer(LogController logController)
137137 _logController = logController ?? throw new ArgumentNullException ( nameof ( logController ) ) ;
138138 }
139139
140-
141140 /// <summary>
142141 /// Clear the working sets of all processes that are available to the application
143142 /// </summary>
@@ -194,22 +193,22 @@ private bool Is64BitMode()
194193 /// <summary>
195194 /// Clear the FileSystem cache
196195 /// </summary>
197- /// <param name="clearStandbyCache">Set whether or not to clear cache that is in standby</param>
196+ /// <param name="clearStandbyCache">Set whether or not to clear the standby cache </param>
198197 internal void ClearFileSystemCache ( bool clearStandbyCache )
199198 {
200199 _logController . AddLog ( new RamLog ( "Clearing FileSystem cache" ) ) ;
201200
202201 try
203202 {
204- //Check if privilege can be increased
203+ // Check if privilege can be increased
205204 if ( SetIncreasePrivilege ( SeIncreaseQuotaName ) )
206205 {
207206 _logController . AddLog ( new RamLog ( "Privileges have successfully been increased" ) ) ;
208207
209208 uint ntSetSystemInformationRet ;
210209 int systemInfoLength ;
211210 GCHandle gcHandle ;
212- //Depending on the working set, call the right external function using the right parameters
211+ // Depending on the working set, call NtSetSystemInformation using the right parameters
213212 if ( ! Is64BitMode ( ) )
214213 {
215214 _logController . AddLog ( new RamLog ( "Clearing 32 bit FileSystem cache information" ) ) ;
@@ -248,7 +247,8 @@ internal void ClearFileSystemCache(bool clearStandbyCache)
248247 if ( ntSetSystemInformationRet != 0 ) throw new Exception ( "NtSetSystemInformation: " , new Win32Exception ( Marshal . GetLastWin32Error ( ) ) ) ;
249248 }
250249
251- // If we don't have to clear the standby cache or cannot increase privileges, don't hesitate to clear the standby cache, otherwise we can clear the standby cache
250+ // Clear the standby cache if we have to and if we can also increase the privileges
251+ // If we can't increase the privileges, it's pointless to even try
252252 if ( ! clearStandbyCache || ! SetIncreasePrivilege ( SeProfileSingleProcessName ) ) return ;
253253 {
254254 _logController . AddLog ( new RamLog ( "Clearing standby cache" ) ) ;
@@ -273,7 +273,7 @@ internal void ClearFileSystemCache(bool clearStandbyCache)
273273 /// Increase the Privilege using a provilege name
274274 /// </summary>
275275 /// <param name="privilegeName">The name of the privilege that needs to be increased</param>
276- /// <returns>A boolean value indicating whether or not the operation was successfull </returns>
276+ /// <returns>A boolean value indicating whether or not the operation was successful </returns>
277277 private bool SetIncreasePrivilege ( string privilegeName )
278278 {
279279 _logController . AddLog ( new RamLog ( "Increasing privilage: " + privilegeName ) ) ;
@@ -292,7 +292,7 @@ private bool SetIncreasePrivilege(string privilegeName)
292292
293293
294294 _logController . AddLog ( new RamLog ( "Adjusting token privilages" ) ) ;
295- //Enables or disables privileges in a specified access token
295+ // Enables or disables privileges in a specified access token
296296 int adjustTokenPrivilegesRet = AdjustTokenPrivileges ( current . Token , false , ref newst , 0 , IntPtr . Zero , IntPtr . Zero ) ? 1 : 0 ;
297297 _logController . AddLog ( new RamLog ( "Done adjusting token privilages" ) ) ;
298298 // Return value of zero indicates an error
0 commit comments