News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Re: How to create random window class names.

Started by mikeburr, June 26, 2019, 12:00:18 AM

Previous topic - Next topic

mikeburr

Try simply changing the classname to "tooltips_class32"
regards mikeb

jj2007


mikeburr

jj i ran it by altering the main window class in the emtree multiple windows with menus program .. which worked Exactly the same as before ??? including obfuscating its own main window [except of course that its dead easy to pick up the prog name ]  so it didnt seem to be a problem .. tooltips_class32 is a separate class from edit class in any case and i wouldnt have thought would be an issue in any event .. maybe you are using dialogs ?????
regards mike b

mikeburr

error should read toolbar not dialogs at the end
regards mikeb
anyway it was a suggestion as random naming stands out like a proverbial sore thumb

jj2007

Please post a working example of a window with classname "tooltips_class32" and an edit control. Should be easy, no?

mikeburr

yes ..here it is and it runs fine on Win 7 and XP here  ...but interestingly it wouldn't register the window in Wine .. so im guessing that Tedd wont be able to run it ..id like to know whether this runs on other peoples version of 7 [ mines win 7 pro  genuine licence  ive got duplexed machines so apart from running it on an old laptop with XP i cant extensively test it ]   and any other OS ...????
either way .. t
heres a section labeled ;;;;;; jj start ;;;;; and end in both the wndproc and mathsproc functions   so assuming you can run it .. edt the numbers in the main screen boxes [default 1 & 9 ] and press the buttons below and they will get.... and post them in the listbox below both in hex and normal decimal ... if you go to the menu [leftmost] and  select new this opens up a window with a series of listview 's  shove the screen to one side and press the buttons on the main screen again and the same info will appear in the ListView [incidentally the 00000 00064 in the listbox relate to the scrolling extent in the New Window .. .. the scrolling produces a Roy Lichtenstein/Brigit Reilly moment plus it only traverses in the neg direction .. DednDave seems to be an expert on this and i wouldnt mind some advice as its a tester for dumping stuff in a window thats larger than the current visible viewport ]

also
since somebody was doing something with primes i dumped the first 788,000 in a list .. assuming this uploads as its quite large i advise you use a binary chop [do not make a binary tree as this is only doing the same thing ] or an index every maybe  4k ... pps dont use debug symbols with this and use a cut down version first ... plus there are other ways to get components of very large numbers but these involve either reducing schemes [eg Draims algorithm is a nice simple one]  or  by targeting specific areas [this is a lot more complicated ]
ok .. ive just seen there is an understandable limit of 512K and the file is about 2.7Meg compressed so ill try and put it on the web somewhere and provide a link
  regards mikeb

jj2007

It works, surprisingly. In my tests the creation of the edit control failed.

mikeburr

jj its initcommoncontrols again   took a very small a bit of experimentation to see why  i use initcommoncontrols .. not ex
initcommoncontrolsex...
has a list of controls you can name specifically .. using this instead and specifically adding the two tooltips classes ... namely TABS and TREEVIEW[not toolbar as i erroneously stated before !!!]  causes the window registration to fail indicating that the non ex version allows overides [or just doesnt initialise anything !!! ]  but the ex version specifically initialises these classes and doesnt allow them to be overidden/or a new instance i would assume .. which seems contrary to the way classes work ???   ... this doesnt work by default in  wine which surprises me even more but is restrictive enough that its prob a very good tester .. i had a few problems writing files with it ,i know that too
any ideas what i can do to get the page scrolling to work ???? on the treeview window
regards mikeb   anyway it was an interesting if rather daft exercise in the end but thanks none the less as you learn something vaguely new every day .. then you get old and forget something vaguely every day ...

mikeburr

jj i think im beginning to understand why !!
this link is very informative   Geoff Chappel [obviously the Non Cricketing Brother of the former Australian Cricketing Geniuses {Geneii ??] ]  gives a really helpful insight into the seemingly confused world of Microsoft Class registration ..
https://www.geoffchappell.com/studies/windows/shell/comctl32/api/commctrl/initcommoncontrols.htm
whereby initcommoncontrols is just the placeholder we guessed at previously but brings in DLL "ensuring that COMCTL32 gets loaded"
using  initcommoncontrolsex is rather different  as youll see so if the tooltips_  class is registered the Window registration will fail ... even better if you are lazy and dont check for failure of registration the window is created contextually so my main window would then attempt to run as a treeview or tab control ..and this runs but hangs understandably as it has the Wrong funtionality
jj  whats really amusing is that if you have the treeview etc in but add ICC_STANDARD_CLASSES .. which adds 4000 then everything works again .. making me wonder whether it is now regarded as a User defined set of controls .. i havent tried including ICC_LINK_... which adds 8000 but i will report back when i get time  as this might be interesting
Theres bound to be someone CLEVER out there thinking "that bloke Mike is a right IDIOT..it obviously works like this...." in which case tell me .. i dont mind your insults as i bet im not the only person whos tried this
regards mike b

jj2007

Mike, I certainly didn't want to insult you in any way. I saw your suggestion to change the classname to "tooltips_class32", tested it in a standard Windows template, and CreateWindowEx failed for the edit control. That's why I flagged the issue.

Now you've proved me wrong, and that's absolutely fine for me, because I learned something new! This forum is such a good place precisely because we are teasing each other gently in order to provoke such little challenges. Keep up the good work :thup:

hutch--

One of the things that most have learnt over time is that the only consistent thing with Windows is that it gets rewritten every so often according to its own documentation and this is directly a problem for people who write code that they test on one version without ensuring it works according to the Microsoft documentation. Win32 brought many changes, then from Win9x to Win2000 broke a lot of code that was not written in the first place.

Those who disregarded the Intel ABI in one version came to grief in following versions but within the range of platform compatibility, those who got it right the first time in WinNT 4.0 (Actually 3.5) have software that still runs on Win 10 64 bit.

Now with the original post, the reason for the random string as the class name is so that even if an attacker isolated an app and extracted the class name, it would be different the next time the app was run. A classname only ever needs to be a string as per documentation and it is reliable across versions. Any technique in any context that strays from the documentation that may work on one version of Windows risks getting stung with a crash in another version and I have seen many that have died that way.