Modifying window style by editing binary? - executable

CyLog’s WildRename is a good program for performing batch-renames on files. The problem with it is that while the main window is resizable, it does not have the maximize box which makes it a little frustrating to size and use. Moreover, they have not made any updates in a long time, so the program is essentially discontinued.
I ran WildRename and used WinSpy++ to modify the style of its window to manually include the WS_MINIMIZEBOX style and bam!, it was now functioning as expected.
The question now is how to make this permanent.
My first instinct was to fire up ResHacker, but the problem is that the style that needs to be modified is that of the main window of a non-dialog application, so ResHacker has no way of doing this.
The next thing I tried was to open it in a hex-editor, to find the address(es) of the string corresponding to the titlebar. I then opened the file in W32Dasm and located the address of the code that references the address of the titlebar string. I did all this in an attempt to find the location of where the main dialog is created so that I can modify the style passed to CreateWindow(). Unfortunately, I cannot find a call to CreateWindow anywhere near the reference to the titelbar string and none of the calls to CreateWindowEx that I can find seem to be (obviously) the ones used to create the main window.
Is there an easy/automated way of modifying the style of the main window (assuming a non-dialog application)?

You could use a debugger like OllyDBG to dump the exe memory after the edit with WinSpy++, then use that exe or compare the files to see where the change is if you want to see what you've missed

There has to be a call to CreateWindow/Ex(), especially if it not a dialog from a resource. You just need to look harder. I would use IDA instead of WinDasm. It will decompile the assembly into more understandable code, and it has a built-in debugger. You can put a breakpoint on the title string and see in real-time which code actually touches it, and then follow it back to the accessing code.

Related

Hide\remove language from VB.Net form list

Is there a way to make the language property list shorter? Make it show only EN-US and PT-BR, for instance, so it's easier to find them?
You probably don't need to do it.. You can likely just make your life easier like:
Make a new form, lets say it's called LocalForm.vb
Drop a label on it, lets say called HelloLabel
Set form to de-DE, set the text of the label to Hallo
Set form to fr-FR, set the text of the label to Salut
Set the form back to (default) - you now have LocalForm.resx, LocalForm.de-DE.resx and LocalForm.fr-FR.resx and you can add controls
Add a Button, called StartButton
Double click the LocalForm.de-DE.resx file
Dismiss the "if you mess this up you'll have to fix it yourself" dialog
Add a line for StartButton.Text Starten
Repeat for other language files
Dropping a control named XyzButton on the form, and then visiting each LocalFor.*.resx in turn and adding the locale for it is a lot easier than back-and-forthing with the language setting, though I know why it's done the way MS chose to do it - you're supposed to lay your form out perfectly with all its hundreds of controls, and then switch to French and write all the French for all hundreds controls, and then switch to German and write it all in German.. In a use case like that there isn't a lot of work to do with that awkwardly huge Language dropdown. Incremental adds that way are a bit of a pain..
Perhaps raise a connect bug/feature asking them to put the "already used" languages (as determined by the presence of Form.*.resx files) at the top of the list, and wait many years for it to be implemented :)
Note: There's a bit of a nuisance with this "edit the resx" in that if you rename a control it doesn't always get picked up. Last time I was localizing I threw together an app that watched (FileSystemWatcher) files named *Form.resx and if it saw a change (load the current version, compare to the prev version) that was a rename, it made the same change in the other files (or maybe alerted if they weren't in sync.. can't quite remember now and I've no idea where the code has gone)
Maybe don't rename your controls after you first decide a sensible name for them/add them to the translated resx..

xcode 8.1 xib editing hang, text editor workaround?

So, since updating, the gui randomly hangs editing a xib file. The scenario goes like this:
click an object - i.e, array controller
expand a parameter, Filter Predicate here
Select target object in pull down
try to enter model key path - HANG
In different xib files, the hang comes when trying to enter the model key path textfield. I've also seen errors citing bogus fields like 'Hidden3' for some attribute bindings - only workaround was to remove them.
Has anyone ventured to editing the xml directly, but I guess I can do that in code :-(
Well, I know this is an old question, but I found an answer.
My situation was similar to the one described above: Xcode hanging whenever I edited the key path of any binding in Xcode 8.1. Nothing described here or elsewhere worked.
However, what did work was to edit the storyboard outside of the actual Xcode project: open the offending StoryBoard by itself, do not access it through the project.
This appears consistent with a Sample/Spindump through the Activity Monitor when Xcode hung that showed functions that appeared related to auto-completion/edition. Unchecking auto-completion did not work though (in Prefs).

Can I set a breakpoint condition over entire form?

When running a program I need to see every time a certain button is disabled and step through the code at that point.
If I set a breakpoint with a condition
(ex: only hit when button1.enabled=false) it will only hit in that specific place.
Is it possible to set a breakpoint on the entire program so that i can see when a condition changes across many forms and locations?
You can't set one breakpoint and have it apply to every line of the file, but you can set a breakpoint on the setter of Enabled and then filter it to a specific filter condition. That would give you the desired result. (Note, you might need to turn off "Just my code", see this question for more info)
Set a breakpoint using the "New Breakpoint At Function" as described here, though in Visual Studio 2013, I seem to need to use a slightly different notation:
Then set the breakpoint to funtion:
System.Windows.Forms.Control.Enabled
in C# or for VB.NET:
System.Windows.Forms.Control.set_Enabled(bool)
(You seem to need to use the class that actually defines the property, which in case of the Button class' Enabled property, is the Control class the Button inherits from.
Ignore the warning about it not being able to find the function (it does that for properties somehow), or uncheck the Intellisense lookup.
Now look up the breakpoint in the Breakpoints list and customize the condition so it breaks on the right button
Use the Name property (or any other filter that makes the breakpoint unique) to trigger when you need it to:
When it breaks, it will break in the sources of Control (if you have Framework Source Stepping enabled), which may be confusing. Use the Stack Trace window to find the location where the method was invoked exactly.
Another way of setting the breakpoint is through the Stacktrace window. Set a breakpoint on any line that has your property of interest on it. Launch the debugger and make it break on that line, now use "Step into Specific" to step into the property that you want to break on.
Use the "Stack" window to generate the breakpoint for you:
Since in your case you're looking to break on a function from the Microsoft .NET framework, there is another way. Enabled Framework Source Stepping.
Open the Visual Studio Debugger options and enable "Framework Source Stepping" and disable "Just My Code".
Then enable the Microsoft Symbol Servers in as instructed. Now load up your application under the debugger and wait for the symbol files to be downloaded.
set a break point anywhere in your code that is somehow related to System.Windows.Forms (The constructor of your MainForm for example) and rightclick any function from the "System.Windows.Forms" assembly to load the symbols for that assembly. This will allow you to step into the "Enabled" property and set a break point there.
A full tutorial can be found here:
http://blogs.msdn.com/b/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx

Make MonoDevelop respect smcs.rsp

It's possible to create global defines, by placing them in smcs.rsp, and when you hit play - you'll notice those parts of the code are hit and everything is acting as if it should.
However when editing the source in MonoDevelop, it does not recognize the constants that are set in that file.
Leaving you with text that looks like this:
This makes it hard to keep track of what the current constant values are and requires mentally tracking what is turned on and off despite the editor constantly telling you otherwise.
Is it possible to get monodevelop to respect that file?
The method of using smcs.rsp is pretty old and is not needed after unity3d 4.x. Before 4.0 there is not way of doing it without smcs.rsp file but things have changed, the constants can be added from game itslef.
Go to Edit->Project Settings->Player and in the inspector, choose other settings and u will see configuration title, in the box below specify your symbols one by one followed by ;

VB.net IO.Directory.CreateDirectory

When I use IO.Directory.CreateDirectory to create a directory it creates a read-only directory no matter where I make the directory. Am I missing something?
You are getting confused by the shell properties dialog:
The Read-only checkbox is a tristate checkbox. When it is filled solid like that, it means the state is "indeterminate'. Click it twice to turn it into a check mark. When you then hit the OK or Apply button, the shell sets the readonly attribute on all the files inside the folder.
Yes, this is not great UI design, you are not the first to be tripped up by this. The (only applies to files in folder) hint looks like a fairly desperate attempt to make it clearer. Without enough room to make it a grammatically correct phrase. Wonder what it looks like in German...