Jump to content

nicklad

Members
  • Posts

    7
  • Joined

  • Last visited

Reputation

0 Neutral

About nicklad

  • Birthday 21/08/1985

Profile Information

  • Location
    Nottingham, UK
  1. No offense but I really don't understand why you feel so threatened and are being so hostile and derisory towards me. I certainly don't feel that I am wasting my time. And how can somebody steal code that has been posted in the open? (Don't forget that this is Visual Basic - its simple to code in...) I am not after any recognition - or anything like that, I just want to see CCleaner get better. I don't see why you are intent on besmirching me. The ability to clean multiple profiles would, in my opinion, make this great program even better. I am not disputing anybody's ability to program. Why are you so against me attempting to contribute?
  2. Only offer all user cleaning if the user is logged on as a local administrator. Private Declare Function IsNTAdmin Lib "advpack.dll" (ByVal dwReserved As Long, ByRef lpdwReserved As Long) As LongPublic Function IsAdmin() as BooleanIsAdmin = CBool(IsNTAdmin(ByVal 0&, ByVal 0&))End Function If cleaning fails because of NTFS file permissions denying the local administrator rights, then so be it. But have some form of notification to say that it failed. Ok, I take your point about logged on users: Option ExplicitPrivate Const HKEY_LOCAL_MACHINE = &H80000002Private Protected() As StringPrivate NumProtected As IntegerPrivate Users() As StringPrivate NumUsers As IntegerPublic Function GetLoggedOnUsers() As BooleanOn Error GoTo ErrorOcc? ?Dim objWMIService, objSystemSet, System, iTemp As Integer, sTemp As String? ?NumUsers = 0? ?Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")? ?Set objSystemSet = objWMIService.InstancesOf("Win32_ComputerSystem")? ?For Each System In objSystemSet? ? ? ?sTemp = System.UserName? ? ? ?iTemp = InStrRev(sTemp, "\")? ? ? ?AddUser LCase$(Mid$(sTemp, iTemp + 1, Len(sTemp) - iTemp))? ?Next? ?GetLoggedOnUsers = True? ?Exit FunctionErrorOcc:? ?GetLoggedOnUsers = FalseEnd FunctionPrivate Sub AddUser(ByVal UserName As String)? ?If NumUsers = 0 Then? ? ? ?NumUsers = 1? ? ? ?ReDim Users(1 To NumUsers) As String? ?Else? ? ? ?NumUsers = NumUsers + 1? ? ? ?ReDim Preserve Users(1 To NumUsers) As String? ?End If? ?Users(NumUsers) = LCase$(UserName)End SubPrivate Function CheckUse(ByVal sValue As String) As Boolean? ?Dim Count As Integer? ?sValue = LCase$(sValue)? ?For Count = 1 To NumUsers? ? ? ?If sValue Like Users(Count) & ".*" Or sValue = Users(Count) Then? ? ? ? ? ?CheckUse = True? ? ? ? ? ?Exit For? ? ? ?End If? ?Next CountEnd FunctionPrivate Sub AddProtected(ByVal FolderName As String)? ?If NumProtected = 0 Then? ? ? ?NumProtected = 1? ? ? ?ReDim Protected(1 To NumProtected) As String? ?Else? ? ? ?NumProtected = NumProtected + 1? ? ? ?ReDim Preserve Protected(1 To NumProtected) As String? ?End If? ?Protected(NumProtected) = LCase$(FolderName)End SubPrivate Function IsProtected(ByVal FolderName As String) As Boolean? ?Dim Count As Integer? ?FolderName = LCase$(FolderName)? ?For Count = 1 To NumProtected? ? ? ?If Protected(Count) = FolderName Then? ? ? ? ? ?IsProtected = True? ? ? ? ? ?Exit For? ? ? ?End If? ?Next CountEnd FunctionPublic Function EnumProfiles(ByRef ProfilesDir As String) As BooleanOn Error GoTo ErrorOcc? ?Dim objRegistry, arrSubkeys, objSubkey, strKeyPath As String, strSubPath As String, strValue As String, iTemp As Integer, sUser As String? ?NumProtected = 0? ?Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")? ?strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"? ?If objRegistry.GetExpandedStringValue(HKEY_LOCAL_MACHINE, strKeyPath, "ProfilesDirectory", ProfilesDir) <> 0 Then GoTo ErrorOcc? ?If objRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, "AllUsersProfile", strValue) <> 0 Then GoTo ErrorOcc? ?AddProtected strValue? ?'AddProfilePath ProfilesDir & "\" & strValue? ?If objRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, "DefaultUserProfile", strValue) <> 0 Then GoTo ErrorOcc? ?AddProtected strValue? ?'AddProfilePath ProfilesDir & "\" & strValue? ?If objRegistry.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys) <> 0 Then GoTo ErrorOcc? ?? ?'This function should fail if we have not managed to read the above values.? ?? ?For Each objSubkey In arrSubkeys? ? ? ?'Get the right subkey.? ? ? ?strSubPath = strKeyPath & "\" & objSubkey? ? ? ?? ? ? ?If GetStrExVal(strSubPath, "ProfileImagePath", strValue) = True Then? ? ? ? ? ?'Get the user stub.? ? ? ? ? ?iTemp = InStrRev(strValue, "\")? ? ? ? ? ?sUser = Mid$(strValue, iTemp + 1, Len(strValue) - iTemp)? ? ? ? ? ?If CheckUse(sUser) = True Then? ? ? ? ? ? ? ?'AddProfilePath strValue? ? ? ? ? ? ? ?AddProtected sUser? ? ? ? ? ?End If? ? ? ?End If? ? ? ?? ?Next? ?EnumProfiles = True? ?Exit FunctionErrorOcc:? ?EnumProfiles = FalseEnd FunctionPrivate Function GetStrExVal(ByVal strKeyPath As String, ByVal strValueName As String, ByRef strReturn As String) As Boolean? ?On Error GoTo ErrorOcc? ?Dim objRegistry? ?Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")? ?If objRegistry.GetExpandedStringValue(HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strReturn) = 0 Then? ? ? ?GetStrExVal = True? ?Else? ? ? ?GetStrExVal = False? ?End If? ?Exit FunctionErrorOcc:? ?GetStrExVal = FalseEnd Function I'll also code a running processes check to enumerate all user contexts when I can get around to it... I'll have to think about the NTUSER.DAT and get back to you...
  3. Private Const HKEY_LOCAL_MACHINE = &H80000002Public Function EnumProfiles(ByRef ProfilesDir As String) As BooleanOn Error GoTo ErrorOcc? ?Dim objRegistry, arrSubkeys, objSubkey, strKeyPath As String, strSubPath As String, strValue As String? ?Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")? ?strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"? ?If objRegistry.GetExpandedStringValue(HKEY_LOCAL_MACHINE, strKeyPath, "ProfilesDirectory", ProfilesDir) <> 0 Then GoTo ErrorOcc? ?If objRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, "AllUsersProfile", strValue) <> 0 Then GoTo ErrorOcc? ?'AddProfilePath ProfilesDir & "\" & strValue? ?If objRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, "DefaultUserProfile", strValue) <> 0 Then GoTo ErrorOcc? ?'AddProfilePath ProfilesDir & "\" & strValue? ?If objRegistry.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys) <> 0 Then GoTo ErrorOcc? ?'This function should fail if we have not managed to read the above values as something is seriously wrong.? ?For Each objSubkey In arrSubkeys? ? ? ?strSubPath = strKeyPath & "\" & objSubkey? ? ? ?If GetStrExVal(strSubPath, "ProfileImagePath", strValue) = True Then? ? ? ? ? ?'AddProfilePath strValue? ? ? ?End If? ?Next? ?EnumProfiles = True? ?Exit FunctionErrorOcc:? ?EnumProfiles = FalseEnd FunctionPrivate Function GetStrExVal(ByVal strKeyPath As String, ByVal strValueName As String, ByRef strReturn As String) As Boolean? ?On Error GoTo ErrorOcc? ?Dim objRegistry? ?Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")? ?If objRegistry.GetExpandedStringValue(HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strReturn) = 0 Then? ? ? ?GetStrExVal = True? ?Else? ? ? ?GetStrExVal = False? ?End If? ?Exit FunctionErrorOcc:? ?GetStrExVal = FalseEnd Function Would allow you to enumerate the profile paths... Then just a case of applying the cleaning algorithms to the returned paths...
  4. This could be achieved with: Public Sub CleanPatchArchive() On Error Resume Next Dim fs, f, f1, fc Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder(Environ("windir")) Set fc = f.SubFolders For Each f1 In fc If f1.Name Like "$*$" Then fs.DeleteFolder Environ("windir") & "\" & f1.Name End If Next f1End Sub
  5. Still doesnt work Does it make a difference that these folders are, by default, hidden, read only and compressed? Or is it the $ character that is confusing CCleaner?
  6. Can anyone tell me what I have done wrong with this rule? - It doesnt seem to have any effect... [Windows Backups] LangSecRef=3025 Default=True FileKey1=%windir%\|$*|RECURSE
  7. The following two features would be exceptionally useful for me: 1. The ability to delete the remenance of any roaming profiles from a hard disk. (In the documents and settings folder.) 2. The ability to delete any folders in the windows directory that begin with a $. (Such as the $NTUninstall*$ directories and $NtServicePackUninstall$). Cheers and thanks for an awesome program!, Nick
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.