Jump to content

Weird HomeDrive/InetGet Issue


Recommended Posts

Hey everyone.

First off, brand new to AutoIT and the forums as well. I've been teaching myself as I go over the past few days. I absolutely love this platform so far, really enjoying it.

I'm pretty much done with my script and have compiled it into an .exe for local distribution, but I seem to have a problem I just can't figure out. When I run the script on my own computer, either via SCite Editor or the compiled .exe, the script works with no issues whatsoever. However, when I push the .exe to another computer (I've tried win 7, win 8.1 and win 10), my InetGet function for downloading a file to the C:\ drive does not work. I've determined that it's definitely a permission issue, but I don't know why. (I know this because I have another InetGet function that downloads to the TempDir, and it works fine.) 

I've also made sure that my script has the #RequireAdmin directive, and that my .exe is compiled with the administrator manifest. When I run the .exe on these other computers, I can also confirm UAC is automatically invoked and requires the .exe to be allowed. I can also confirm that the user accounts on the other computers are full local administrator accounts.

AutoIT is not installed on any of these other computers, but I imagine that is not required for a compiled .exe.

 

Any help or suggestions would be greatly appreciated. Thank you!

 

Link to comment
Share on other sites

Exit, thank you! And sure, here we go.

 

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <SFTPex.au3>
#include <_NTServices.au3>

FileInstall("C:\Users\Username\Desktop\splash.gif", @TempDir&"\", 1)

SplashImageOn("Installer", @TempDir&"\splash.gif", 615, 434, -1, -1, 19)

SecurityWarning()
SecurityCheck()
Global $un = InputBox( "Your Username", "Please enter your username." , "", "", 300, 150 )
SecurityCheck()

If Not FileExists(@HomeDrive & "\file.exe") Then
InetGet( "https://website.com/file.exe", @HomeDrive & "\file.exe", 2, 0 )
EndIf

_NetUser('boop-'&$un, $un)

 

Here is a snippet of the beginning of my script. The InetGet function for downloading "file.exe" is the issue in question. Thanks again!

Link to comment
Share on other sites

A small  update, I've also attempted moving the compiled .exe to the C drive and launching it from there as well. The entire script works fine except for that one InetGet function. I've also manually run the compiled exe as administrator through an elevated command prompt. I am more than confident at this point that the compiled .exe definitely has the permissions it needs to in order to save to the C drive, but it simply doesn't. Ugh.

Link to comment
Share on other sites

Alright, I'm completely lost at this point. I thought at first it was a permission issue, but that doesn't seem to be the problem. I changed the download destination in the InetGet function to the temp dir and it's still not working. So it's almost as if it's skipping over this function all together, for no apparent reason. I have another inetget function later on in the script that downloads a file to the TempDir without any problem, but the one in my code above doesn't work. The only difference between the two is that one is HTTPS while the other is HTTP, and the options are different because I obviously don't want to ignore SSL errors on a non https URL. 

I've put the file download URL from the function in my web browser, and it downloads fine that way, confirming the webserver, my internet, and the file itself are completely fine. What the hell else could it possibly be?

Link to comment
Share on other sites

It is not ideal really ever, to have your application write to the root of C:

you probably have to takeown, then icacls it to allow administrators the ability to write to the root of C:\ first, then try and save there.  Then undo all that on your way out.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

If you using Vista+ Windows won't allow just anything to write to the root of the C: drive, move your destination to another folder below the root and see if that helps.

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...