Jump to content

Skitty
 Share

Recommended Posts

Posted Image

This was made with the intention to mimic the well known unlocker.exe.

Credits to Yashied, monoceres, wraithdu, Manko, Trancexx, JScript, Larry, SmOke_N, mrRevoked, Melba23 & guinness.

Yashied for his winapiex udf which I took a function from that enumerates handles and an update to a function he made that I use that seems to have enabled operation on 64bit systems now.

monoceres and wraithdu for information and code I took from them in a previous thread they created where they were working on something very similar.

Manko for a post where he was doing something similar where as I got information for the named pipe handling area of the script.

guinness for helping me out when beginning this by pointing out particular functions that were needed to get object handle information.

Also thanks to JScript, Larry, SmOke_N and mrRevoked for _ProcessGetPath.

Trancexx for the code that I use to determin what Icon to use for the list view items (on 32bit systems only, probably something I did wrong).

Melba23 for the functions I use to re-size the gui, I think they come from him.

Unlocker Source.rar - [152] Previous Downloads

Alternately, download the exe from my site here, but sometimes my site is offline (a lot).

Some say taking and closing handles from a process can produce unwanted side effects in the targeted process, use with caution.

History

4/7/2012 - fixed an error I made when re-uploading that would cause the script to not unlock files.

4/7/2012 - Fixed other errors, removed rediming of arrays which seemed to have made this very noticeably faster and also commented out the micro sleep calls So now the list is populated very fast in comparison to before but will use more CPU.

4/18/12 - Added support for unlocking dlls using code by Smoke_N and removed useless additions.

5/26/12 - Added an update to support operation on 64bit systems thanks to Yashied

Edited by ApudAngelorum
Link to comment
Share on other sites

I keep getting the an error message saying 'Error Code: 1 Extended 13.' I'm using the latest version on Windows 7 x64.

Edit: Credits to me? What did I do?

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thanks for sharing!

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I'm getting the same error:

---------------------------

Error Code: 1 Extended: 13

---------------------------

The application has encounterd an error and will now close, sorry for the inconviniance.

---------------------------

OK

---------------------------

Also, don't limit the FileSelectFolder to the homedrive, because that's not allowing me to change drives to any other drive. My homedrive is set to a network share with only a few folders on it, none of which should be locked.

BTW, inconvenience is spelled wrong in that error message. ;)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I keep getting the an error message saying 'Error Code: 1 Extended 13.' I'm using the latest version on Windows 7 x64.

Edit: Credits to me? What did I do?

Well... I guess this would be a good time to post this...

Posted Image

But in all seriousness, I haven't tested this on any x64 bit systems and your post might prove it doesn't work on them, but aside from that I've tested this on windows xp sp3 x86 and windows 7 x86.

And the error you're getting means that the File and Process object handle types were not found, which is File = 28 and process = 5 on windows xp and windows 7 I believe.

And why not credits to you? If it weren't for your help there this probably wouldn't be here.

I'm getting the same error:

Also, don't limit the FileSelectFolder to the homedrive, because that's not allowing me to change drives to any other drive. My homedrive is set to a network share with only a few folders on it, none of which should be locked.

BTW, inconvenience is spelled wrong in that error message. :)

Thanks for pointing that out, I hadn't noticed and too bad scite doesn't spell check like my browser ;)

Ieme fix that..

Thanks for sharing!

You're welcome! :D Edited by ApudAngelorum
Link to comment
Share on other sites

Just a question, but the functions you used from WinAPIEx.au3 did you alter them in anyway, because the UDF has been tested on x64 thoroughly.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Just a question, but the functions you used from WinAPIEx.au3 did you alter them in anyway, because the UDF has been tested on x64 thoroughly.

If you notice, I only took the one function from that UDF and it's ZwQuerySystemInformation, and since you got to error level 13 returned in the extended macro, then this means the function taken from winapiex works flawlessly, I don't have an x64 bit machine handy but maybe you could try commenting out this line~

If DllStructGetData($tHandle, 1) <> @AutoItPID Then ContinueLoop; only search our process for now

What it's doing is making sure we're trying to look for the object handle types in our process only (I.e., File = 28 on win xp and file = 25 on vista), but I doubt it will work, there must be something else at play here..

For an object of type file, the value bObjectType in SYSTEM_HANDLE is 28 in Windows XP, Windows 2000, and Window 7; 25 in Windows Vista; and 26 in Windows 2000.

If you comment out that line then maybe it will work? give it a try.

Or else just populate the $FileObject array yourself with the valid object type values depending on your system, read the link above.

On windows vista this would probably be right.

$aObject[$Ready][0] = DllStructGetData($tHandle, 2);return it so we can use it to find them
$aObject[$Ready][1] = DllStructGetData($tString, 1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$aObject[$Ready][0] = 25
$aObject[$Ready][1] = "File"
Edited by ApudAngelorum
Link to comment
Share on other sites

I tried commenting out but to no avail. I'll have a look over the next week or so. Thanks.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

monoceres started a script like this a while back, and I did some work on it too. It proved tricky and ultimately incomplete. Maybe you can borrow something from it:

Thanks, I've actually already scavenged that post, hence the credits to monoceres, what I took from there that I needed was the part of the script that determines what drive label to use. If you downloaded the script, look closely and you'll recognize some of the code, I didn't change the variables.

Local $struct = DllStructCreate("char[255];")
Local $Temp = DriveGetDrive("ALL")
Local $drivesinfo[UBound($Temp) - 1][2]
For $I = 0 To UBound($drivesinfo) - 1
  $drivesinfo[$I][0] = $Temp[$I + 1]
  DllCall($hKERNEL32, "dword", "QueryDosDevice", "str", $drivesinfo[$I][0], "ptr", DllStructGetPtr($struct), "dword", 255)
  $drivesinfo[$I][1] = DllStructGetData($struct, 1)
Next
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    DllCall($hNTDLL, "ulong", "NtQueryObject", "ptr", $hObject, "int", 1, "ptr", DllStructGetPtr($poti), "ulong", DllStructGetSize($poti), "ulong*", "")
    $devicestr = DllStructCreate("wchar[" & Ceiling(DllStructGetData($poti, "Length") / 2) & "];", DllStructGetData($poti, "buffer"))
    $devicestr = DllStructGetData($devicestr, 1)

Edit: wow, after taking a closer look I noticed that code is actually by you, let me fix my first post ;)

Edited by ApudAngelorum
Link to comment
Share on other sites

I tried commenting out but to no avail. I'll have a look over the next week or so. Thanks.

Ok, so I hit up a friend with a 64bit system and I tried debugging the script for a few minutes and found out that it is in fact the function that I previously said executed flawlessly, it turns out that even in its original form (straight out of the winapiex UDF) it does not return the desired information.

The function in question is _WinAPI_EnumProcessHandles() which should return file handles in an array and is basically the heart of this script...

MSDN mentions nothing about incompatibility on any system so I'm guessing this is a bug in the function?

Anyway, with a little help from the community running 64bit OSs, this could turn out to be a pretty handy tool, I use it a lot to unlock directories locked by scite and other apps, but as for debugging this for 64bit systems, I just don't have the resources or the know how to do it.

Edited by ApudAngelorum
Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

i really liked unlocker back in the days on XP, but then i moved to windows 7/8, since then unlocker has never really worked well,

Now i saw this topic, yours dont work as i expected, i run it, select the folder then it gets stuck at 3/6, at last the windows ask if you want to end it since its not responding anymore.

So is there an update coming for windows 8?

Link to comment
Share on other sites

  • 7 months later...

3qjgv2.jpg

Ok so firstly I acknowledge that I am necrobumping this thread badly, and the OP probably wants it dead. But I came to offer some feedback and possibly a solution?

I have without knowing been using this small application for a while for various things. And for the most part is has been pretty good, however when some stubbon apps just don't want to die unlocker gives up and basically offers to remove it on reboot, to which it never does. Anyway that is not my point and I didn't come here to bitch and whinge and complain I came here with some info on what I discovered.

Second point I want to make here, is to the OP. Man you are a legend. I see so much of your stuff contributed to this forum. You are an incredible asset to this place. I have been a long long time lurker on here, and only recently become a member, mostly because up until now I am smart enough to use the search function, read the help and have felt that I have not got anything worth offering to this forum that others haven't already said done or tried. I guess I was a feeling a little unworthy around such greats? Sooo. I am here. I came on cause I wanted to request some things of the dev for ISN AutoIT Studio....so now I am a member I can post. Before now I am thinking 'Should I say something? Nah some admin with roast this n00b...I think I best go get some popcorn instead....plus I'm too lazy to sign up'

Ok so.....getting back on track.

My situation and god only knows why the hell this is happening? I am an Android developer/hacker/enthusiest (secretly an autoIT one too but shhhh). I use Android Debug Bridge and Android Asset Packaging Tool (aapt.exe) for a lot of stuff in Windows. On numerous occassions now I have duplicate processes running for aapt? I have to right click task manager and end each one. Some respawn even for some unknown reason? Sometimes this locks apks, and typically only apks that have been signed with a system certificate? Yeah try explaining that one? And more so these than others.....actually pretty much of late if I drop a system apk in a windows directory it is superglued there. So long as I do not select the apk in that directory and then unselect it and leave it....and come back hoping to move or delete or what ever (cause you can't....like ever!). Pretty much if I have selected an system apk for the first time I better do something with it, cut and paste it somewhere, cause I get no second bites at the cherry. I can even cut and paste it where it is and that is ok??? Yeah crazy eh?

So...using you app does absolutely nothing in nearly all causes. It doesn't remove the apk. It doesn't remove it on next boot. The only thing I can *sometimes* do is navigate to the directory and use my keyboard with arrow keys (not my mouse? It has something to do with my mouse?) press the first letter of the name of the apk, like a for android.apk and then press the delete button and hope to god that my delete got to it before aapt did?

Heres the cool part though....sorry for boring you here with all of the details, I just felt it necessary to explain to save future questioning. Anyway I got so freakin mad the other day because I was not able to change frameworks and apktool was ummm.....whats an analogy for this? Umm it was like stuck in first gear. Think of changing frameworks as like changing gears. I could not remove the existing framework cause I had clicked on it bla bla bla.

So I made a quick and dirty script.

I had your unlocker running and churning away at the file doing it's best (sometimes it works? so hey why not) but not really succeeding in doing anything. So I right click the apk in question and killed all the aapt processes (keep killing in a loop till there is none) and this worked! File deleted :)

I would imagine that you could essentially use the same "skeleton" of the kill script I use, but have all the fancy stuff like checking hwnd of the $CmdLineRaw.... I would create an array of all the listed processes keeping the selected file open and then just pass each and every one of those into the process kill loop function until they are all dead and then when once dead, offer to delete move or what ever the user wants to do with the file. Process first and then offer. At the moment the user is choosing an option and then never getting it or maybe sometimes? Clicking any of the buttons should first initiate the same function on all of them, then when move, or then delete. You can't actually do anything until all the processes are gone anyway right? 
But don't get me wrong all the fancy stuff you had going on in your script was great and when reading it, I was a little overwhelmed (how the hell do you think all of this up?)....nothing wrong with it, but sometimes simple works. I only know simple at the moment.....

Also on that note, I am not certain of this 100% but I think the issue with your script is not to do with your structure or anything, but I think that there maybe an issue with the Processclose functionality of AutoIT?
I am technically a n00b, but I have never found Processclose to be successful with much. It lacks rigor and consistency. However quick and dirty ol command line driven traditional Windows "taskkill" will nearly always get the job done! Even when your at the point of complete stackover load and loosing your sh!t taskkill (if you can move your slow motion mouse to the taskmanager window before BSOD) will save you. AutoIT Processclose though? I highly doubt it....actually I would call it game over and walk away knowing my PC is about flip leaving a nasty dmp file to remind me I am idiot :D

Oh umm here is my script....this will be my first contribution to the forums :D I feel special knowing that no one will probably ever use this haha

 

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\..\AppData\Icons\AndroidKilled.ico
#AutoIt3Wrapper_Outfile=AAPT-KILL.exe
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
    Name ..........: AAPT-Kill
    Description ...: Right click integrates to context menu Usage: This script is used to kill respawned
                     aapt processes that will not allow a user to move an apk file
    Syntax ........: NA
    Parameters ....: NA
    Return values .: User selected apk is killed from right click, stays in loop until the thing is f#*%ing dead dead
    Author ........: Jarmezrocks XDA Developers / Digitalfacade82 AutoIT forums
    Example .......: What? This is an example!
    Credits .......: MHz for his example to a n00b demonstrating right click functionality http://www.autoitscript.com/forum/topic/32788-right-click-context-menu-functionality/
    : guinness for his _Process Kill example in the AutoIT snippets http://www.autoitscript.com/wiki/Snippets_(_Windows_Settings_)
    AutoIt Version: 3.3.8.1

#ce ----------------------------------------------------------------------------

#region - Includes
#include <Constants.au3>
#endregion

#region - Global Variables
Global Const $REG_KEY = 'HKLM\SOFTWARE\Classes\.apk\shell\AAPT KILL'
#endregion

#region - CmdlineSwitch
Func _ContextIntegration()
    If $CMDLINE[0] Then
        For $i = 1 To $CMDLINE[0]
            Switch $CMDLINE[$i]
                Case '/?'
                    MsgBox(0x40000, StringTrimRight(@ScriptName, 4) & ' Help', _
                            'Switches are:' & @LF _
                             & @LF & '/extract' _
                             & @LF & @TAB & 'Extract files to current directory' _
                             & @LF & '/register' _
                             & @LF & @TAB & 'Add registration into context menu' _
                             & @LF & '/unregister' _
                             & @LF & @TAB & 'Remove registration from context menu')
                    Exit
                Case '/extract'
;~              FileInstall('?', @ScriptDir & '\')
                    Exit
                Case '/register'
                    RegWrite($REG_KEY, '', 'Reg_sz', 'AAPT-kill')
                    RegWrite($REG_KEY, 'Icon', 'Reg_sz', Chr(34) & @ScriptFullPath & Chr(34)); Adds an Icon to the app in the context menu
                    RegWrite($REG_KEY & '\Command', '', 'Reg_sz', '"' & @ScriptFullPath & '" "%1"')
                    MsgBox(0x40000, 'AAPT-kill', 'Registered')
                    Exit
                Case '/unregister'
                    RegDelete($REG_KEY)
                    MsgBox(0x40000, 'AAPT-kill', 'UnRegistered')
                    Exit
                Case Else
                    Const $FILE_PATH = $CMDLINE[$i]
                    If Not FileExists($FILE_PATH) Then
                        MsgBox(0x40030, 'AAPT-kill', 'File parameter is invalid')
                        Exit
                    EndIf
            EndSwitch
        Next
    Else
        If RegRead($REG_KEY, '') Then
            If MsgBox(0x40021, @ScriptName, 'Do you want to remove ' & @ScriptName & ' from the right click context menu?' & @CRLF & 'Press OK to continue') = $IDOK Then
                RegDelete($REG_KEY)
            EndIf
        Else
            If MsgBox(0x40021, @ScriptName, 'Do you want to add ' & @ScriptName & ' from the right click context menu?' & @CRLF & 'Press OK to continue') = $IDOK Then
                RegWrite($REG_KEY, '', 'Reg_sz', 'AAPT-kill')
                RegWrite($REG_KEY, 'Icon', 'Reg_sz', Chr(34) & @ScriptFullPath & Chr(34)); Adds an Icon to the app in the context menu
                RegWrite($REG_KEY & '\Command', '', 'Reg_sz', '"' & @ScriptFullPath & '" "%1"')
            EndIf
        EndIf
        Exit
    EndIf
EndFunc   ;==>_ContextIntegration
#endregion

Func _ProcessKill()
    Local $iTimeOut = 5, $iTimer
    Local $iPID = ('aapt.exe')

    $iTimeOut *= 1000
    $iTimer = TimerInit()
    While ProcessExists($iPID)
        If TimerDiff($iTimer) > $iTimeOut Then
            ExitLoop
        EndIf
        RunWait('TASKKILL /F /T /IM ' & $iPID, @SystemDir & "\", @SW_HIDE)
        Sleep(20)
    WEnd
    Return Number(ProcessExists($iPID) > 0)
EndFunc   ;==>_ProcessKill
_ContextIntegration()
_ProcessKill()
MsgBox(0, 'Congratulations!!',  'You probably just killed a bucket load of aapt.exes'  & @CRLF &'stopping you from moving or deleting:'& @CRLF & "" & @CRLF & $CmdLineRaw, 10)
Edited by DigitalFacade82
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...