-
Sep 9th, 2021, 07:16 AM
#1
Thread Starter
Member
Unable to Remove Directory [SOLVED]
I'm so confused.
My install program (running as Admin) can make a directory inside the Program Files (x86) directory.
The software I put inside (running as Admin) works fine.
Then while running my software (as Admin), I'm using the ShellExecute function with the "RunAs" operation to start my Uninstall. I do not get another User Account Control verification request because the software already has it.
But when I use the RMDIR I get Path/File Access Error when I delete the folder I initially created.
I've tried using a batch file (With Admin Rights), the Shell command, the ShellExecute command. and an ExecCmd routine I found online.
I currently have an example program that makes and deletes a "Testing" folder. Without Admin Rights, I get the error. With those Rights, it's working just fine.
I've never encountered this before, any ideas on what I'm missing?
Thanks for your time,
Joe
Last edited by Skittles; Sep 10th, 2021 at 06:38 PM.
Reason: [SOLVED]
-
Sep 9th, 2021, 07:27 AM
#2
Re: Unable to Remove Directory
Does the folder have files or sub folders in it?
-
Sep 9th, 2021, 07:38 AM
#3
Thread Starter
Member
Re: Unable to Remove Directory
No files or folders.
I remove all files from it. Then execute a Sleep 1000 before the RMDIR.
My only guess is the program that makes folder is the only one that can delete them?
Does VB6 have Permission capabilities?
-
Sep 9th, 2021, 07:46 AM
#4
Thread Starter
Member
Re: Unable to Remove Directory
I don't have a DoEvents command between the file removal and the folder removal... let me try that.
EDIT: Nope, that's not it.
Last edited by Skittles; Sep 9th, 2021 at 07:56 AM.
-
Sep 9th, 2021, 09:00 AM
#5
Re: Unable to Remove Directory
Originally Posted by Skittles
Then while running my software (as Admin), I'm using the ShellExecute function with the "RunAs" operation to start my Uninstall. I do not get another User Account Control verification request because the software already has it.
But when I use the RMDIR I get Path/File Access Error when I delete the folder I initially created.
I've tried using a batch file (With Admin Rights), the Shell command, the ShellExecute command. and an ExecCmd routine I found online.
I currently have an example program that makes and deletes a "Testing" folder. Without Admin Rights, I get the error. With those Rights, it's working just fine.
I've never encountered this before, any ideas on what I'm missing?
Thanks for your time,
Joe
So you're running your Software inside that folder to start an uninstall, which should end by removing the Folder.... Let's see if you catch my drift.
btw: Why not use SHFileOperation-API to nuke the whole folder incl. Files within?
If it's a "Sub-Folder" for database, config, whatever: Never use "Program Files".
Use AppData\Local of the User (User-Centric).
Or just install it to "c:\MyProgramName"
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Sep 9th, 2021, 09:16 AM
#6
Thread Starter
Member
Re: Unable to Remove Directory
Originally Posted by Zvoni
So you're running your Software inside that folder to start an uninstall, which should end by removing the Folder.... Let's see if you catch my drift.
btw: Why not use SHFileOperation-API to nuke the whole folder incl. Files within?
I'm not familiar with that. Besides, I like verification the files deleted.
If it's a "Sub-Folder" for database, config, whatever: Never use "Program Files".
No, it's not. It is a "File Manager" program located in C:\Program Files (x86)\LFM"
Use AppData\Local of the User (User-Centric).
Doesn't apply
Or just install it to "c:\MyProgramName"
Because this is being used on other peoples computers.
I think the problem is I have one program making the folders and another program (in a different folder) trying to delete a folder without "proper" permission.
I may have to put my uninstaller in the same "installation folder". The batch files have no problem deleting themselves AND the folder they are IN.
Thank you for your time, it's not wasted. I'll look into the "SHFileOperation-API" you mentioned.
-
Sep 10th, 2021, 06:42 PM
#7
Thread Starter
Member
Re: Unable to Remove Directory [SOLVED]
SOLUTION:
After two days of brain numbing troubleshooting, I figured it out.
There's a limitation of SHELL with Admin.
Running a program with Admin and then Shelling with Admin works.
I was attempting a three level SHELL. My Main software SHELLed to my Uninstall which Shelled to a batfile. That doesn't work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|