Need a Win 7 user to test a small app

Everything else that doesn't fall into one of the other PB categories.
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Need a Win 7 user to test a small app

Post 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
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

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

Post 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. :|
"Have you tried turning it off and on again ?"
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

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

Post 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. :)
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

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

Post 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 :)
"Have you tried turning it off and on again ?"
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

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

Post 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.
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

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

Post 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.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

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

Post 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
"Have you tried turning it off and on again ?"
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

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

Post 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
"Have you tried turning it off and on again ?"
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

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

Post 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. :)
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

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

Post 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.
User avatar
em_uk
Enthusiast
Enthusiast
Posts: 366
Joined: Sun Aug 08, 2010 3:32 pm
Location: Manchester UK

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

Post 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.
----

R Tape loading error, 0:1
Zach
Addict
Addict
Posts: 1678
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

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

Post 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.
Post Reply