Author |
Topic: Windows Constants Utility (Read 1916 times) |
|
Malcolm
Guest
|
 |
Re: Windows Constants Utility
« Reply #10 on: Oct 26th, 2010, 4:20pm » |
|
Is there a way of a program, such as a Utility, to detect the Admin status before trying to write to protected locations or is it a case of try to write and then test for a failure and prompt the user. I notice that Win 7 often pops up with a window asking for my (any admin) password but I have never been observant enough remember exactly under what circumstances that happens.
Regards, Malcolm
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Windows Constants Utility
« Reply #11 on: Oct 26th, 2010, 4:46pm » |
|
on Oct 26th, 2010, 4:20pm, Guest-Malcolm wrote:| Is there a way of a program, such as a Utility, to detect the Admin status before trying to write to protected locations or is it a case of try to write and then test for a failure and prompt the user. |
|
I can't think of a better way than doing an 'exploratory' write operation (an OPENOUT is sufficient; you don't actually need to write any data). If it succeeds you can just delete the (empty) file. But as you say in many cases you might just as well attempt to write the 'actual' file.
As far as prompting the user is concerned, it would be difficult to determine (reliably) that the reason for the failure was insufficient privileges, so really you can only issue a generic 'couldn't create file' type of message.
Hopefully this situation would only occur during installation (once installed, a utility ought not to be needing to write to a protected area anyway) so if it really bothers you a 'proper' installer could be used (e.g. created with Inno Setup) which will contain a manifest that activates Windows' 'installer detection' mechanism and therefore prompts for elevation at the start.
The next release of BB4W will make it a little easier to generate a BB4W executable with a 'non standard' (e.g. installer) manifest, but it will rarely be worth the effort.
Richard.
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Windows Constants Utility
« Reply #12 on: Apr 11th, 2011, 3:48pm » |
|
I have uploaded an improved Windows Constants utility here:
http://groups.yahoo.com/group/bb4w/files/Tools/Add_Ins/winconsts.exe
This version has the following enhancements:
Scans approximately five times faster than the previous version.
Database enlarged from about 50,000 to more than 75,000 constants.
Many database errors corrected.
Includes over 5,000 DirectX (DirectShow, Direct3D etc.) constants.
Includes over 6,000 Class and Interface IDs (CLSID_ IID_ etc.) for accessing COM objects. Note that a & or # suffix character is no longer accepted.
To update your copy download the file to a suitable place on your PC and execute it to run the integrated installer. If BB4W is open you will need to close and re-open it in order to recognise the change.
Alternatively you can replace the original winconsts.exe file (probably in your ADDINS folder). If you do that you won't need to run the installer, but on Windows Vista and 7 you will require administrator privileges to copy the file (and if you subsequently reinstall BB4W the original version of the utility will be reinstated).
Richard.
|
|
Logged
|
|
|
|
|