Jump to content

UAC confusion


martin
 Share

Recommended Posts

I have only just tried installing a couple of applications on a Vista PC. (I know, I'm years behind.)

One application ran for about 24 hours without needing to confirm that it really really was supposed to be running even though it wrote (believed it wrote) to the Programs File folder. I updated the script so that it now writes data to @AppDataCommonDir\Blah\subBlah. Fine for a few hours, (maybe a reboot?) and now it warns that an "unidentified program wants to access your computer". It reads HKCU to find out where the data folder is.

I have another application which reads and writes to a file in @AppDataCommonDir and also reads HKCU but so far it doesn't bring up the "unidentified program wants to access your computer".

I read that I will get the message if the program tries to access certain areas but I cannot find a list of what those areas are and I cannot see why one program is different to the other. I really need an idiots guide to writing applications for Vista. For me that would equate to a "Noddy goes to Vista land". I downloaded TopWave but it seems to link to things that link to TopWave and so far hasn't helped me.

I am th eonly user on the PC and I have administrative privileges.

Those 2 apps are written in AutoIt. I have a third program written in Delphi which does all the others do and more, is totally unaware of the existence of Vista so far and runs without any warning prompts at all. Since I don't understanding what is going on here I don't know how to proceed to fix the problem.

Any advice is welcome. The Delphi program does not have any manifest file but I don't understand what these do in Vista yet.

Most of my work is for machine controls and so far I haven't come across any machines controlled by Vista PCs, maybe I'm just lucky.

While I'm on the subject, how does SciTE mange to read and write files in a Program Files subdirectory in Vista and never initiate any warnings?

This reminds me of the problem of safety in machines. Some safety systems are so awkward for the users that they find ways to bypass them and end up with no security at all.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Ok, here's my tips/knowledge.

When you write applications for vista+ you need to make a decision. Is your program gonna be available for standard users. If so then behave. Don't write/read from HKLM, don't write ANYWHERE but to @AppDataDir, this will probably keep the warnings at a minimum (note that this is not universals truths, but only observations I've made). If you want it to do funky stuff, request admin rights. And this is where the manifest comes in. The manifest is simply an XML document embedded as a resource in an exe that tells windows what privileges you want. It's just like adding #RequireAdmin at the top of an script.

SciTe probably gets away with it because installed applications can pretty much do whatever they want in the directories where they are installed.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

@monoceres

Thanks for that monoceres.

It doesn't explain why one of my apps warns when it starts and another one doesn't. Neither writes to HKLM or reads from it.

I don't see that a script can write to it's own directory where it's installed if that is inside ProgramFiles. My Delphi app is written to do that but it is actually redirected to the virtual directory and the files are all saved to and written from well outside of ProgramFiles although the program is unaware of that. SciTE must do something different I assume.

I've only got 24hours of experience with Vista but it feels like a couple of weeks.

@Mobius

Thanks for the links, I'll look at them.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

martin,

Are all the apps running from a local drive, or are is the one you're having trouble with running from a network share?

All running from the same local drive which is also where the OS in installed.

I have noticed that the one that is causing a warning is using a folder in ProgramData, but the the one which is also an AutoIt script but not generating warnings is using UserName\AppData\Roaming\somefolder, and the Delphi one is using the ProgramFiles folder but virtualised by Vista. I'll try changing so that it isn't using ProgramData for, um, program data. I probably misunderstood what ProgramData is for.

Isn't there a nice simple guideline somewhere which says things like

ProgramData folder is for ---, don't store info in here which is changed by the program or you will get this or that problem.

ProgramFiles - only use for installation files which are never changed except for an update.

I notice that ProgramData is normally a hidden folder. So I will try using only folders which are not hidden.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I believe the file warnings are all based on permissions. So if you were to just take ownership of the entire drive you'd have no such warnings for any file operations. Programs aren't supposed to write to the Program Files directory. This is a way to enforce good program design.

Not sure why your scripts are accessing HKLM.

Link to comment
Share on other sites

I believe the file warnings are all based on permissions. So if you were to just take ownership of the entire drive you'd have no such warnings for any file operations. Programs aren't supposed to write to the Program Files directory. This is a way to enforce good program design.

Not sure why your scripts are accessing HKLM.

I am running with administrator rights and I am the only user. If I look at properties for C: I have all permissions ticked. Is that what you mean by "take ownership of the entire drive"?

What file warnings? I cannot start the program normally because I am told "An unidentified program...". Is tha a file warning?

I don't access HKLM and I specifically pointed that out.

I ran the uninstaller. It ran without any warnings about being an unidentifed program. It deleted the program, the folder it was in,the data, removed registry keys and added registry keys to runonce on reboot and on reboot yet another script ran which did a final clean up. No warnings. So what I am interested to know is why does Vista allow all that but not the application I wrote which does a lot less.

I've tried changing the foders to where I store data to all sorts of places but I still get the warnings, whereas the programs which are similar or worse as far as I understand it run without any problem. Does Vista remember programs which it has warned about so that even if you change it to remove the problem you still get warnings? Rebooting doesn't change anything.

One strange thing is that the program which won't run normally will run up to 4 other programs which it makes child windows. I can run any of thes 4 programs without warnings and they read the same registry keys and use the same data as the main program.

Another serious problem I have is that the child windows are no longer drawn correctly in the NC areas. When the program was first installed it ran without warnings and the child windows were drawn fine. Now that I get warnings the child windows are not drawn correctly. No borders and no icons and no buttons. The close button only becomes visible, ie gets drawn, when you move the mouse cursor over where you guess it should be. If you click where the caption bar should be and drag you can see that the borders are actually the background of the parent, and the background doesn't get repainted correctly. I can add some message to repaint when a child is moved but why should I need to do that and what has it got to do with how the program is run?

I would have thought that these sort of problems that a newby Vista user like me is experiencing must be very common, so I am surprised that I can't find quick straightforward answers by googling, but I haven't been able to so far.

EDIT

Fixed it. As I suspected, Vista remembers programs that need permissions to run and then you are stuffed.

I renamed the exe and now it runs fine and the child windows are drawn correctly again. Vista is a bit strange, even stupid at times IMO.

My experience of Vista so far is not good. I fully understand what the security features are for but they are half baked and don't do what they are intended to do as far as I can see.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

martin,

Did you find out where Vista hides the list of apps previously needing permissions and if it is possible to alter this data? I have run into the same problem and I do not want to have to rename the app unless I really have to.

I heartily concur that Vista is such a pain at times that many users are likely to turn off all the "security" features and be worse off than before!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

martin,

Did you find out where Vista hides the list of apps previously needing permissions and if it is possible to alter this data? I have run into the same problem and I do not want to have to rename the app unless I really have to.

..

M23

Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

In there was a key with a name which was the full path to the exe like this

C:\Program Files\Folder1\Folder2\Exename.exe

and the value of the key was "RUNASADMIN"

which was a bit of a give-away.

Note that the registry key has a space between "Progam" and "Files" whereas the actual folder used does not have the space.

I deleted that registry key, renamed my exe back to the original name, created a new shortcut and it works fine. End of problem it seems. (I'm hoping)

So when Vista says "An unidentified program .." it can really mean "A program that we have previously decided (possibly arbitarily) should not be run as standard and we are not open to discussion despite any updates or changes.."

I will try deleting that key in my installation/update program in future.

Also, to my backward way of thinking, RunAsAdmin doesn't mean "run as though you are the administrator" which is how I first interpreted it, but it means only run if you are the administrator so RUNBYADMIN would make more sense to me. No doubt when Microsoft reads this post they will immediately recall all the Vista PCs in the world and change them.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

martin,

Thanks a lot - worked a treat. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

"Unidentified" may be referring to the lack of digital signature.

Probably. I don't know, but my programs are not digitally signed and are never likely to be.

Vista has only complained about one of them so far and that was easily fixed. (Easily in retrospect.) Maybe the reason for the warning was the way I installed the program or the way I updated it. I haven't learnt much about Vista yet, but if I ran an installation or update as administrator would that mean that the app would be set for RUNASADMIN? I'll experiment and find out once I've sorted out an updater.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...