You can't; well you can but the complications arising from such an activity would take years to get right. And as soon as the exe file is rebuilt all your addresses will be wrong. It seems to me you are trying to solve a problem that does not exist. You need to put all your text data in some file format that only your application can understand which is far less difficult than trying to hack the executable.
Can only conclude from your evasiveness you're trying to modify someone else's exe and you don't have the source code. Otherwise, you would make a large enough array to hold any "future" "patched" entries.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
I've got a Windows Forms (C#) project with a combobox that is populated when the form loads
The problem is that the loading of the combobox is slow, and since the loading is done when the form is trying to display the entire form isn't shown until the combobox have been populated. This can in some circumstances be 20+ seconds.
I've tried the code below, using async and await , but it not works....return error :
"This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread."
Any help will be appreciated....
privateasyncvoid Form1_Load(object sender, EventArgs e)
await Task.Run(() =>
OleDbConnection con = new OleDbConnection(conex);
string strSQL = "select * from Customers order by cust_name";
OleDbDataAdapter adapter = new OleDbDataAdapter(new OleDbCommand(strSQL, con));
DataSet ds = new DataSet();
mycombo.DataSource = ds.Tables;
mycombo.ValueMember = "code";
mycombo.DisplayMember = "cust_name";
catch (System.Exception erro)
MessageBox.Show("Error.... " + erro.Message);
Thanks for reply Holmes, but there are aprox. 34,000 records to load from the table 'Customers'.....and I can´t filter only 100 or 200 records, because the user needs to choose a customer from the list....
And there is your problem! That is sheer lunacy, think about the workflow from a users POV. He/she approaches you form, they MUST know something about the customer before they start, they are not going to pick a random customer from 34k.
You MUST allow them to enter some text (usually 3 characters) to filter the selection if the name is the criteria, THEN you populate the combo.
If the name is not known the they must have some other information to filter the list by - geographic, product, size, credit rating, there must be some knowledge about the customer they can use to filter the list.
Never underestimate the power of human stupidity -
I'm old. I know stuff - JSOP
This isn't a limitation of C#, but of how Windows and controls work.
The combobox control you drag over from the toolbox is just a wrapper for a standard Windows control from the Common Controls Library. The way these controls works requires sending messages to the controls to get them to do things, like add an item to a collection in your combobox.
Not working... as I mention previously, the MessageQueue.GET... methods show the Public and/or Private queues but not the OutGoing Queues...
I can "create" outgoing queue by send message with exact syntax of connection but can't get the list of current outgoing queues...
I have a dll created with delphi language (Borland Delphi 7) which thus contains functions in delphi which I would like to use in C# under Visual Studio 2017. It is a native dll.
I want to use for example the GENERATE_FILE function contained in test.dll.
Delphi code :
procedure GENERATE _FILE(Path, Input_File : AnsiString); stdcall;
procedure GENERATE _FILE(Path, Input_File : AnsiString); stdcall;
GENERATE_CALC(Path_And_File, CRC32, Total, err);
In C#, I want to use the function GENERATE_FILE contained in test.dll but what is the type of the parameters Path and Input_File in C# ?
Below is an example of C# code I made to use test.dll in delphi in C#. I setstringas a type for parameters of the function GENERATE_FILE.
Public class Program
[DllImport("test.dll", CharSet = CharSet.Ansi)]
publicstaticexternbool CREATE_FILE(string pathDirectory, string filename);
staticvoid Main(string args)
I added the test.dll in Visual Studio by right clicking on the project then add an existing element, then, in the properties of the test.dll, I put "Content"in Generation action and I put "Always copy "(output directory). When I run the solution, I have the test.dll in bin\Debug.
But when I test this program, I get the following error at the line that contains:
System.DllNotFoundException: 'Unable to load DLL' test.dll ': The specified module could not be found. (Exception from HRESULT: 0x8007007E) '
How to solve this problem ?
I think the issue is about the type of parameters in the function GENERATE_FILE. What are the type equivalents between delphi and C# for the function GENERATE_FILE ?
Thank you for your help.
I am planning a different approach - have written half of the code, but it is not ready for testing yet. In my case, it is one subsystem written in C++, others in C#.
Rather than messing around with P/invoke and all sorts of parameter transfer, synchronization and whathaveyou, I run it as two processes. The two subsystems have limited, and structurally very simple, data interchange. I find it far easier to exchange those data through a named pipe. The data format is application specific, but as these two subsystems belong to the same application, it is like an internal API with no more need to adhere to a standard than any other internal interface.
I like strong isolation between subsystems and modules. It gives greater freedom within each subsystem/module, and it keeps the architecture clean. And it makes the system flexible: If I later want to replace that C++ subsystem with one written in Cobol, say , I could do so without any effect on the C# part. Well, if I could access that Cobol code through the same P/invoke interface, it might be similar, but now I don't have to worry about that at all.
I am considering the same approach even when the subsystems are all in C#: Threads are fair enough, but do not provide the same isolation as separate processes. When different tasks really are independent (such as one monitoring external equipent/events, the other one interacting with the user; the only common data are the summary reports from the monitor process), they might as well be implemented and run as completely separate entities. Two simple entities are better than one complex.
and when i upload the file i test on, it creates the same sha256 as my code for the file does.
But when i read the data from the longblob and creates a sha256 it is different.
The strange part, is that if i use my website to download the same longblob and saves it as a file... FC cant find any diffeneces.
I'm not familiar with the MySql connector, and I tend not to store files in databases (it does not make much sense to me, it only inflates the DB size). However I noted what follows:
at the bottom of your code there is a while loop, wherein you call Sha256.ComputeHash.
That piece of code looks very suspicious: what remains is just the SHA256 of the last loop iteration, so either you only have one iteration (and the while should be an if), or your logic is wrong (you should collect all the data and then calculate SHA256 on the whole thing).
You could try with a small file, say less than 1KB. Or you could track the while loop behavior, either by adding an output statement, or by using a debugger...