Author |
Topic: Windows Constants Utility (Read 1914 times) |
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Windows Constants Utility
« Thread started on: May 10th, 2009, 07:34am » |
|
http://tech.groups.yahoo.com/group/bb4w/files/Tools/Add_Ins/WINCONST%20Utility%20Installer.exe
Update History:
Version 1.8b - some dictionary definitions reported as being lowercase hexadecimal. 3 definitions fixed.
Version 1.8a - memory alignment with PAGE rather than LOMEM
Version 1.8 - fixed potential buffer non-null terminated problem with Win2000
Version 1.7 - fixed progress bar bug when user clicked on it
Version 1.6 - you only have to put an underscore in front of constants which start with some BB4W keywords cf the manual.
Version 1.5: - constants are accepted with or without a preceding underscore, but you will *have to* put an underscore in front of constants which start with all BB4W keywords.
- string constants must have a $ postfix.
- You can add a REM!WC directive in your program. Constants will be added just under this if one is present, if not, to the beginning of the program. (If there is more than one directive it will add them to the last one.)
- constants have now been simplified to a value. No more multiple definitions.. you might notice that some negative values are in hex format &F...... as the convertion was performed automatically. You can assume that these values are a mixture of different constants.
- there are still some ommissions in the database as some values (~1,500) did not convert, but scanning through this list most of them are fairly rare constants probably not much used by the BB4W community. However, if you find a constant missing you know the drill.
Michael
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: Windows Constants Utility
« Reply #1 on: Jul 9th, 2009, 11:26pm » |
|
There are of course omissions and errors in winconst. I am keeping a list of things I have found but if anyone else finds missing constants or mistakes please could they post here.
If anyone gets the urge to translate windows macros then please feel free!
Also, it could be possible to automatically enter a windows structure definition but as Richard has pointed out the winApi definitions are sometimes wrong. Are there any people willing to help add to this utility by typeing out a BB4W verions of (all the/some) structures in the core .ddls? Another way of doing it would be to automatically convert the .h files to a BB4W format. We could have a cenrtal repository for submitting structures.....
Michael
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: Windows Constants Utility
« Reply #2 on: Jul 10th, 2009, 12:25am » |
|
frinstance;
FILE_ATTRIBUTE_VIRTUAL = &10000 CB_SETCUEBANNER = &1703
are missing.
I'm sure there are more people would like.
1/3/2011: TBS_TRANSPARENTBKGND = &1000
Michael
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Windows Constants Utility
« Reply #3 on: Jul 10th, 2009, 08:56am » |
|
Quote:if anyone else finds missing constants or mistakes please could they post here |
|
As noted elsewhere on this forum, constants starting with 'TRUE' (e.g. TRUETYPE_FONTTYPE) are not recognised by the utility; you must prefix an (unnecessary) underscore. As I suggested in the other thread, you could use the function below to provide a 'foolproof' test of whether a constant name is valid or not:
Code: DEF FNvalid(var$)
LOCAL dummy%, token$
dummy% = EVAL("0:" + var$)
token$ = $(!332+2)
= (token$ = var$) Richard.
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: Windows Constants Utility
« Reply #4 on: Jul 13th, 2009, 1:59pm » |
|
FNvalid() is just the ticket but was wondering:
1. Is there a similar TRUE/FALSE function for machine code opcodes eg mov, movzx, etc...
2. Is there a base address for a pointer to a list of keywords? Rather than define my own string (or JR's really) for his FNdetokenise()
Michael
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Windows Constants Utility
« Reply #5 on: Jul 13th, 2009, 5:16pm » |
|
Quote:Is there a similar TRUE/FALSE function for machine code opcodes eg mov, movzx, etc... |
|
I'm not too sure what you mean by a "similar TRUE/FALSE function". The function I listed determines whether a 'variable' name is invalid, because of starting with (or being) a keyword that would be tokenised. Since assembler opcodes aren't tokenised, you can start variable names with them without causing any problems.
Quote:Is there a base address for a pointer to a list of keywords? |
|
No. Why does the Windows Constants utility need a list of keywords? It's worth noting that the 'cruncher' - which has to be able to detect all variables within a program so they can be crunched, does not use a list of keywords! It's a feature of BBC BASIC that you can very easily parse a (tokenised) BBC BASIC program to find the variables without needing a list of keywords.
(This assumes there is no assembler code; detecting variables in assembler code is a completely different kettle of fish).
Richard.
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: Windows Constants Utility
« Reply #6 on: Jul 28th, 2009, 3:03pm » |
|
I have updated winconst to fix the known bugs. I will keep it back until I have tested it a bit further, so expect it at the end of the week. I will also do a bit on the installer.
I have not yet updated the dictionary for the known missing constants. This will have to wait for a bit longer.
Michael
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: Windows Constants Utility
« Reply #8 on: Oct 25th, 2010, 4:44pm » |
|
Version 1.8b has just been posted. It corrects some database issues with the Windows Constants Utility. You can download it from the link in the first post.
Also, it has been bought to my attention that Windows Constants *may* have issues installing under Windows7 if you are not the administrator. I think I have got away with this one so far because most people who have installed this are tech savvy and are using an administrators account. Are there any other reports of this behaviour? Could people report if so?
Thanks
Michael
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Windows Constants Utility
« Reply #9 on: Oct 26th, 2010, 08:12am » |
|
on Oct 25th, 2010, 4:44pm, Michael Hutton wrote:Also, it has been bought to my attention that Windows Constants *may* have issues installing under Windows7 if you are not the administrator. |
|
Not too sure what you mean by "issues" but it's to be expected that you will need administrator privileges to install it (and all the other add-in utilities for that matter) - considering that it installs in the Program Files hierarchy it would be jolly worrying if you didn't! To install a utility right-click on its executable (e.g. in Windows Explorer) and select 'Run as administrator' from the context menu.
Richard.
|
|
Logged
|
|
|
|
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
|
|
|
|
|