haijie1223 Posted June 5, 2019 Share Posted June 5, 2019 (edited) I want to delete the register key in windows 10,But failed with the code。 how to do it? #RequireAdmin #include <winapi.au3> #include <array.au3> #include <security.au3> $NULL = 0 $PROCESS_ALL_ACCESS = 0x001F0FFF SetTBCPrivileges() RegDelete('HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\shell\empty\MUIVerb') Func SetTBCPrivileges() $dwPID = @AutoItPID $hToken = 0 $hProcess = 0 $tpDebug = DllStructCreate($tagTOKEN_PRIVILEGES) $hProcess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $dwPID) If Not $hProcess Then Return False If Not _WinAPI_OpenProcessToken($hProcess, $TOKEN_ALL_ACCESS, $hToken) Then Return False $LUID = _Security__LookupPrivilegeValue("", $SE_DEBUG_NAME) If $LUID == 0 Then Return False DllStructSetData($tpDebug, "Count", 1) DllStructSetData($tpDebug, "LUID", $LUID, 1) DllStructSetData($tpDebug, "Attributes", $SE_PRIVILEGE_ENABLED, 1) If _Security__AdjustTokenPrivileges($hToken, False, DllStructGetPtr($tpDebug), DllStructGetSize($tpDebug), $NULL, $NULL) = False Then Return False ;~ if _WinAPI_GetLastError() <> $ERROR_SUCCESS Then Return False MsgBox(0, 0, _WinAPI_GetLastErrorMessage()) EndFunc ;==>SetTBCPrivileges Func _WinAPI_OpenProcessToken($pHandle, $iAccess, ByRef $hToken) Local $aResult = DllCall("advapi32.dll", "int", "OpenProcessToken", "hwnd", $pHandle, "int", $iAccess, "int*", 0) If @error Or $aResult[0] = 0 Then Return SetError(1, 0, 0) $hToken = $aResult[3] Return $aResult[0] EndFunc ;==>_WinAPI_OpenProcessToken Edited June 5, 2019 by haijie1223 Link to comment Share on other sites More sharing options...
faustf Posted June 5, 2019 Share Posted June 5, 2019 you run the script like administrator??? requireadmin Link to comment Share on other sites More sharing options...
haijie1223 Posted June 5, 2019 Author Share Posted June 5, 2019 @faustf that the all code, delete failed。 Link to comment Share on other sites More sharing options...
BrewManNH Posted June 5, 2019 Share Posted June 5, 2019 On my computer, Administrators only have read access to the key empty so you probably can't delete anything in it. 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 GudeHow 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 More sharing options...
Earthshine Posted June 5, 2019 Share Posted June 5, 2019 what makes you think you want to delete it? as mentioned above, not possible. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
haijie1223 Posted June 5, 2019 Author Share Posted June 5, 2019 @BrewManNH @Earthshine Because windows10's empty recycle bin does not have a shortcut B, I have to rewrite the relevant registry. Link to comment Share on other sites More sharing options...
Earthshine Posted June 5, 2019 Share Posted June 5, 2019 repair windows... lol My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
haijie1223 Posted June 5, 2019 Author Share Posted June 5, 2019 @Earthshine Windows 10 itself does not have this shortcut. Link to comment Share on other sites More sharing options...
Earthshine Posted June 5, 2019 Share Posted June 5, 2019 what are you talking about? Windows 10 has the recycle bin on the desktop. anyway, good luck I am out. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
haijie1223 Posted June 5, 2019 Author Share Posted June 5, 2019 @Earthshine Can you see the difference? Link to comment Share on other sites More sharing options...
Earthshine Posted June 5, 2019 Share Posted June 5, 2019 (edited) the difference in two completely different operating systems you mean?!? install windows 10 if that is what you want. or go back to 7, or use a shell utility. this was a complete waste of time. goodbye. you have no idea how windows works, that is apparent. there are icon packs you can install, and using windows you can change what the shortcuts look like. Edited June 5, 2019 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now