Page 1 of 1

Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 3:30 am
by MachineCode
Can someone with Win 7 and a limited user account, please test this setup.exe for me -> http://www.sendspace.com/file/5bmbhb

All it does is install an app called Admin.exe to C:\Admin, and if run, it just tells you if you're an admin or not. I need to know if running Setup.exe actually works and installs it to C:\Admin on Win 7 with a limited account. It was built with Inno Setup. It works for me, but a comment on StackOverflow says that limited users on Win 7 can't write to C: at all. I don't know whether to believe them or not.

I swear on my life it's safe to run, but feel free to run it in a VM if you don't trust me, or submit it to http://virusscan.jotti.org or http://www.virustotal.com first to check it out, or see the below scan results from Jotti. Don't worry, I'm not about to ruin my reputation here by spreading malware! Thanks!

Image

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 12:52 pm
by luis
Running your setup on a limited account on a windows 7 32bit machine popped out a request to enter an admin level password, so probably the setup is compiled to required it for some reason (not unusual with many setup programs).

I gave it the password, then it installed the app in the c:\Admin dir. The program when executed reported correctly the user running it is not an admin.

EDIT: tested as admin too, it doesn't ask for the admin password, but the program still says "You are a limited user."

Maybe it's its opinion on myself, and it's not talking about my user's credentials, I don't know. :|

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 1:41 pm
by MachineCode
Damn, so a limited user still needs to enter the admin password to install it... the guy on StackOverflow was right! :( This brings up the question: where can I tell Inno Setup to install my app for limited users? Anyone know?

Also, you said even as an admin, it reports that you're limited? Damn again. I was using the IsUserAdmin_() call to test for it. Obviously it's not reliable. :( But, did you try it in a VM, or a real PC?

Thanks luis, for your brave feedback. There were over 50 views before someone (you) decided to test it. :)

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 2:28 pm
by luis
MachineCode wrote:This brings up the question: where can I tell Inno Setup to install my app for limited users? Anyone know?
I don't have any experience with it so I don't know.
MachineCode wrote: Also, you said even as an admin, it reports that you're limited? Damn again. I was using the IsUserAdmin_() call to test for it. Obviously it's not reliable. :( But, did you try it in a VM, or a real PC?
In a VM but I'm sure it's irrelevant. Anyway I seem to remember something fishy about the Administrator account under Win7, something started with Vista. Something like users in the admin group aren't really local administrators... I would have to re-check to bring my memories back, try looking into that if you like, sorry but right now I have to go out and cannot check it.

Maybe someone else will reply with more useful infos in the meantime :)

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 8:42 pm
by Danilo
MachineCode wrote:Also, you said even as an admin, it reports that you're limited? Damn again. I was using the IsUserAdmin_() call to test for it. Obviously it's not reliable. :(
IsUserAdmin_() returns 1 with compiler option "[X] Request Administrator mode for Windows Vista".
In this mode even Administrator accounts need to enter a password or confirm the message
"Do you want to allow the following program from an unknown publisher to make changes to this computer?"
if UAC is enabled.

It is a good thing IMO. Why do you want to write to c:\ directly? If your app is not for administrators
who can change the system, it should only write to Documents, AppData etc. or folders that the user requests.

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 9:56 pm
by MachineCode
So, which DEFAULT folder should I present to the user for installation on a limited account? Bearing in mind that the average user will just click through the setup.exe and probably not change it. I need to have a flawless installation.

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 10:14 pm
by luis
To check for admin status looks quite messy, look here, and the comments too:

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 10, 2011 11:17 pm
by luis
MachineCode wrote:So, which DEFAULT folder should I present to the user for installation on a limited account?
What's wrong with the usual "program files" ?

Anyway you should always request the appropriate path to the OS

Code: Select all

Procedure.s GetSpecialFolderLocation (iCSIDL)

;/***P
;*
;* DESC
;* 	Return the path of the specified system special folder.
;*
;* IN
;* 	iCSIDL  ; CSIDL (constant special item ID list) value.
;*
;* RET
;*  The special folder path or "" if not found.
;*
;* NOTES
;*  For example if iCSIDL = #CSIDL_DESKTOPDIRECTORY it will return the path of the desktop.
;*
;* OS
;*  Windows
;***/ 

 Protected iPIDL
 Protected SpecialFolderLocation$
 
 If SHGetSpecialFolderLocation_(#Null, iCSIDL, @iPIDL) = #S_OK
    SpecialFolderLocation$ = Space(#MAX_PATH)
    If SHGetPathFromIDList_(iPIDL, @SpecialFolderLocation$) = #False
        SpecialFolderLocation$ = ""
    EndIf    
 EndIf
  
 If iPIDL: CoTaskMemFree_ (iPIDL) : EndIf
  
 ProcedureReturn SpecialFolderLocation$
     
EndProcedure

Debug GetSpecialFolderLocation(#CSIDL_APPDATA)
Debug GetSpecialFolderLocation(#CSIDL_PROGRAM_FILES)
Probably (?) would be better to rewrote the above proc using SHGetFolderLocation_ .

CSIDL list
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Maybe this can help to clarify some doubts (is for Vista but should be ok for Win 7 too, I hope)
http://msdn.microsoft.com/en-us/library/bb530410.aspx

Re: Need a Win 7 user to test a small app

Posted: Fri Nov 11, 2011 8:05 am
by MachineCode
luis wrote:What's wrong with the usual "program files" ?
Doesn't work on Win 7 with a limited user account. Hence the reason for this thread. :)

Re: Need a Win 7 user to test a small app

Posted: Fri Nov 11, 2011 8:47 am
by Danilo
MachineCode wrote:
luis wrote:What's wrong with the usual "program files" ?
Doesn't work on Win 7 with a limited user account. Hence the reason for this thread. :)
Users are not allowed to install applications, only use them, not?

Only the owner/administrator installs stuff. Most users are administrator/owner at
the same time and they have the admin password for install. If the user has no
admin PWD, he is not allowed to change the system.

This is how i understand it and it seems to work. It is secure.

The link from luis said:

Code: Select all

Procedure.s GetSpecialFolderLocation (iCSIDL)
    ;/***P
    ;*
    ;* DESC
    ;*    Return the path of the specified system special folder.
    ;*
    ;* IN
    ;*    iCSIDL  ; CSIDL (constant special item ID list) value.
    ;*
    ;* RET
    ;*  The special folder path or "" if not found.
    ;*
    ;* NOTES
    ;*  For example if iCSIDL = #CSIDL_DESKTOPDIRECTORY it will return the path of the desktop.
    ;*
    ;* OS
    ;*  Windows
    ;***/
    
    Protected iPIDL
    Protected SpecialFolderLocation$
    
    If SHGetSpecialFolderLocation_(#Null, iCSIDL, @iPIDL) = #S_OK
        SpecialFolderLocation$ = Space(#MAX_PATH)
        If SHGetPathFromIDList_(iPIDL, @SpecialFolderLocation$) = #False
            SpecialFolderLocation$ = ""
        EndIf   
    EndIf
     
    If iPIDL: CoTaskMemFree_ (iPIDL) : EndIf
     
    ProcedureReturn SpecialFolderLocation$
     
EndProcedure

common$ = GetSpecialFolderLocation(#CSIDL_COMMON_APPDATA)  ; common applications
user$   = GetSpecialFolderLocation(#CSIDL_PROFILE)         ; user folder

common$ + "\MachineCode"
user$   + "\MachineCode"

Debug common$
Debug user$

CreateDirectory(common$)
CreateDirectory(user$)
Works here.

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 17, 2011 11:06 am
by em_uk
Install it into the users appdata folder like Skype/Google do these days if you're not an admin.

Standard users can only bung stuff into their profile folders. Microsoft want programmers to get away from no admins being able to install where ever.

You can change this by amending the permissions for the primary drive, but this would be going against best practice.

Re: Need a Win 7 user to test a small app

Posted: Thu Nov 17, 2011 3:49 pm
by Zach
Microsoft want programmers to get away from no admins being able to install where ever.
Then they should start by locking down permissions and explicitly requiring Administrator Elevation to install -anything-. UAC or not.

Then we could avoid this entire headache.