Programming and Coding
Programming and coding tips, help and solutions...
1,882 topics in this forum
-
Struct vs Union (C)
by amateur- 2 followers
- 2 replies
- 5k views
Good morning. What is the difference in practical level of Union compared to Struct? In what cases (examples) Union is/should be, used? -Thank you
-
- 0 replies
- 3.6k views
var module = ModuleDefMD.Load(@"C:\Temp\DemoDLL.dll"); var type = module.GetTypes().FirstOrDefault(t => t.Name == "Demo"); // Create the Main signature var main = new MethodDefUser("Main", MethodSig.CreateStatic(module.CorLibTypes.Void, new SZArraySig(module.CorLibTypes.String))) { Attributes = MethodAttributes.Static, ImplAttributes = MethodImplAttributes.IL | MethodImplAttributes.Managed }; // Add Main param main.ParamDefs.Add(new ParamDefUser("args", 1)); // Create Main body var mainBody = new CilBody(); main.Body…
-
Convert String to Int using sscanf (C)
by amateur- 2 followers
- 2 replies
- 8.9k views
Hello. During coding a keygen i have this issue. The keygenme calculates a SHA-256 which is stored in a string. After that it adds DWORD values of the SHA. Because my english is not so good to explain i put a simpler (similar) example to see whats going on. I have make some progress but i have stuck one this: Why sscanf doesnt put in eax the correct value starting from sha_256[0]. (Eax should contain the value 0x64ec88ca) How i can fix this? -Thank you
-
Createthread in x64
by ToMKoL- 1 follower
- 2 replies
- 4.4k views
Hi all I'm trying to compile simple c program with animated title bar (swapping letter case) but unfortunately I'm stuck with CreateThread in x64. Here is my sample code: DWORD WINAPI animate(HWND hWnd); HANDLE hthread; case WM_INITDIALOG: SendMessageA(hWnd, WM_SETICON, (WPARAM) 1, (LPARAM) LoadIconA(hInst, MAKEINTRESOURCE(IDI_ICON))); hthread = CreateThread(0, 0, animate, hWnd, 0, 0); DWORD WINAPI animate(HWND hWnd) { unsigned char wincaption[24]; unsigned int i; SendMessageA(hWnd, WM_GETTEXT, 24, (LPARAM)wincaption); do { for(i=0;i<19;i++) { if (((wincaption[i] >= 0x41) && (wincaption[i] <= 0x5A)) || ((wincaption[i] >= 0x61)…
-
capstone vcpkg package broken?
by deepzero- 1 follower
- 1 reply
- 4.9k views
I am porting some tools over to vcpkg package manager. Maybe it's just too late, but it seems to me the capstone package on vcpkg is broken. Installed with vcpkg install capstone:x64_windows. The following: cs_open(CS_ARCH_X86, CS_MODE_64, &handle); returns CS_ERR_ARCH, because the x86-init function in static cs_err (*cs_arch_init[MAX_ARCH])(cs_struct *) = { in cs.c is Null. Which would suggest that CAPSTONE_HAS_X86 was not defined during compilation of the package. Can someone confirm this?
-
- 1 follower
- 2 replies
- 5k views
I want to find a string from a process memory and change it through C#. My current code to modify the string via its address: [DllImport("kernel32.dll")] public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId); [DllImport("kernel32.dll", SetLastError = true)] static extern bool WriteProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesWritten); private void button1_Click(object sender, EventArgs e) { var process = Process.GetProcessesByName("ProcessName").FirstOrDefault(); IntPtr processHandle = OpenProcess(0x1F0FFF, false, process.Id); int bytesWritten = 0; byte[] buffer = En…
-
- 2 followers
- 1 reply
- 5.8k views
Hello, I'm working on a x64 Framework 4.7.2 application obfuscated with Crypto "x64 Crypto Obfuscator For .Net v7 (v2020)", I'm able to restore strings and mostly deobfuscate the app but I'm having difficulties with restore delegates. Here's an example public GForm4() { this.method_6(); Delegate108.smethod_0(Class0.smethod_0(6600) != 0); Delegate60.smethod_0(this, new EventHandler(this.method_0)); } Unfortunately most of @CodeExplorer / SnD's excellent tools give an "invalid assembly" error as it's x64? I'll be grateful for any tips or tools to restore delegates please. thanks in advance
-
TMG fade bitmap problem
by r0ger- 2 followers
- 2 replies
- 4.4k views
Hi all i was working on a crack template now and adding the fade bitmaps effect in the dialog. the thing is when i try to modify its width (adding greater than 122h), the template crashes. but when i normalize it to 122h (which was one of TMG's old bitmap's width value), the effect works without problems but the bmp isn't really complete. xor ebx,ebx invoke LoadBitmap,hInstance,201 mov dword_401EB0, eax mov LogoHeight, 7Ah jmp short loc_401AFD …
-
- 2 followers
- 8 replies
- 6.2k views
Hi folks, I hope you're doing well I made a simple dll injector in .net which appears to work just fine, tested using megadumper, when I dump process I find the injected dll in the folder called Dumps. this is the code that I used : Public Function inject() As Integer Dim targetProcess As Process For Each pro As Process In Process.GetProcesses If pro.MainWindowTitle = "test" Then targetProcess = pro Exit For End If Next Dim procHandle As IntPtr = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_QUERY_INFORMATION Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE Or PROCESS_VM_READ,…
-
2 quick questions about C
by amateur- 2 followers
- 6 replies
- 6k views
Hi. I was solving a keyfile me today, and most of the keymaker i made was with inline assembly, because straight in C i was getting wrong values. For now i have 2 questions. I'm not on my laptop right now so i'll try to remember as much close as possible the values 1) Is possible to achieve that with the (right) way, like i have it below? : DWORD eax; eax = 0xF96A872D; /* I want the result: eax = 0xF96A78D2. Even if i "fixed" little the data types/macros i will get either eax: 0xFFFF78D2 or eax: 0x000078D2 */ LOWORD(eax) = ~(WORD)eax; 2) As my comment says i'm getting ebx = 0x18de781b and not ebx = 0xf8de781b. How ca…
-
- 2 followers
- 35 replies
- 16.1k views
Hi guys, short question.I'am using a tool called "Everything" from voidtools to find files on my HDD etc.I see that this tool is using a simple edit control where you can enter text.If I now wanna get selected the whole edit control then I just need to click once on the outline of that edit control and I got all selected in edit control.Thats pretty cool and now I wanna know how to manage that = what kind of "Edit Control Notification Messages" I have to catch? https://docs.microsoft.com/en-us/windows/win32/controls/bumper-edit-control-reference-notifications Don't find any who does it.Do you know how?Below a example image... ....AND.... ...so if …
-
Delete Resource using UpdateResource ???
by CodeExplorer- 6 replies
- 8.7k views
Delete Resource using UpdateResource ??? reference: https://binaryworld.net/main/CodeDetail.aspx?CodeId=3778 Already tried: bool deleteExisting = IsDlgButtonChecked(handle, IDC_CHECK22)==0; HANDLE hUpdate = BeginUpdateResource(SecondFilename, deleteExisting); int result1 = UpdateResource(hUpdate, // update resource handle res_types2[i], // resource type MAKEINTRESOURCE(res_names2[i]), // resource id 0, // neutral language NULL, // ptr to resource info - NULL FOR DELETING 0); // size of resource info - 0 for deleting it always return int lasterror = GetLastError(); lasterror = 87 ER…
-
- 1 follower
- 0 replies
- 6.9k views
Hi there! I have some questions about the library, if anyone knows help with advice 😃 1) Is it possible to replace the icon of the build file of the program through the library? 2) Is it possible to replace the properties of the build file in Properties.AssemblyInfo.cs (AssemblyTitle, AssemblyVersion e.t.c) ?? 3) How do I replace (int)integer values? 4) Can I change the .NetFramework version using dnlib? Regarding the library itself, the information is not very enough to understand it well, I will be grateful for any information!
-
- 1 follower
- 2 replies
- 5k views
From an old topic: https://forum.tuts4you.com/topic/42934-c-dnlib-how-do-i-change-const-string/?tab=comments#comment-208456 Source Code Stub file: namespace DlibStub { using System; public static class ConstTester { public const string MYCONST = "1111"; public const string DNTEST = "2222"; public static void GetResult() { Console.WriteLine($"Result: {MYCONST}"); Console.WriteLine($"Result: {DNTEST}"); } } } IL Code: field: System.String DlibStub.ConstTester::DNTEST field: System.String DlibStub.ConstTester::MYCONST Instruction: IL_0000: ldstr "Dnlib Tester" Instruction: IL_000…
-
- 2 followers
- 24 replies
- 5.4k views
Hi guys, so yesterday I got an access violation exception in my app by calling the function StrStrA and it seems that the memory block I wanted to check for a string was gone already = AV crash.Somehow strange because I did check before whether a address is present to check = Yes but somehow the block must be freed by anything. .if MEMBLOCK != FALSE invoke StrStr,MEMBLOCK,chr$('Sting2Check') ; <---- AV inside ... .endif Ok, in this case I did just check whether in the variable MEMBLOCK is anything = normaly the memblock address.Now, the address was still present in variable but not present for real.Now I would like what kind of function/s I can use to ve…
-
Mobile flash tool written in .NET
by iceberg- 2 followers
- 4 replies
- 4.8k views
Hello guys , what are the prerequisites to code a mobile flash tool from scratch like (odin) for example, Should I learn about GSM ? I tried to search for any open source flash tool written in .Net but I didn't find anything till now. If you have any resources it will be great (VB.NET / C#) thank you.
-
- 1 follower
- 1 reply
- 3.9k views
Hi guys, I'am using those C functions above to read / write data to file and have that problem with the Macintosh CR (see notepate status bar).In normal case I write text fields like this... db "Some Info", 13,10 db "Here too", 13,10 db "Look not!",0 ....just 3 test lins with one line break between.Now if I do use the fwrite function with it then it does write the LBs in double LBs like this... db "Some Info", 13,10,13,10 db "Here too", 13,10,13,10 db "Look not!",0 ....and not in Unix style.How can I tell the function using Unix style instead of Macintosh? greetz
-
How to show a progressbar as tray icon?
by LCF-AT- 1 follower
- 19 replies
- 8.3k views
Hi guys, does anyone know a example / way how to set a progressbar into tray as icon to show the progress status?So you know like Taskmanager does it. Thank you
-
Listbox & Color questions
by LCF-AT- 2 followers
- 21 replies
- 6.1k views
Hi guys, just have a quick question about Listbox control and using some colors into them.Normaly I dont use OD for ListBox control but in this case it seems I have to use any.My goal is it just to color the background and specific text entrys I do send into the LB.All in all just 3 colors - Background, - TextColor Blue for normal logs / state (all ok) & TextColor Red for Error logs.So in normal case I color back / text at WM_CTLCOLORLISTBOX message but it seems I can not color the text entrys seperated... Info 1 <-- Blue Info 2 <-- Blue ErrorX <-- Red ....I get all blue or red only = Bad.Otherwise I dont wanna make any large Own…
-
Delphi to VB6 code conversion
by tarequl.hassan- 1 follower
- 14 replies
- 5.9k views
Hi Can anyone convert this delphi code to BV6? procedure TKeyGen.Button1Click(Sender: TObject); const Const_Array : array[0..7] of Char = ('e','n','c','r','y','w','e','b'); Var StrName, Part2, Code : string; i, AL, Last_Char : Integer; begin Code := '' ; StrName := Edit1.Text; If StrName = '' then Edit2.Text := 'Enter your Name !!!' else Begin For i := 0 to length(StrName) - 1 do begin AL := ((Ord(StrName[i + 1]) + (i) + Length(StrName) + Ord(Const_Array[(I and 80000007)])) mod 10) + 48; Code := Char (AL) + Code ; end; Last_Char := ((Length(StrName) + 112) mod 10) + 48; Edit2.Text := …
-
How to read from CLI till its finished 1 2
by LCF-AT- 1 follower
- 34 replies
- 14.3k views
Hi guys, I have again a small question about piping a CLI output to my buffer.So I just wanna start a CLI app with paramters and reading the output (content I also see in CMD window) so long till its finished.So the only problem I have so far is how to wait till its finished.Lets say the CLI app needs a while (a minute etc).My question is what function/s I need to use for that?I see I cant use WaitForSingleObject with INFINITE paramter so this dosent work because the CLI app dosent exit itself so long I didnt had reading the bytes.If I just read the bytes using PeekNamedPipe / ReadFile function then I dont get the whole content = it quits to early and the CLI app is …
-
How to generate random values?
by LCF-AT- 2 followers
- 12 replies
- 5.2k views
Hi again, short question.I wanna create random values (0 till -1h) and found 2 C++ function called rand and srand. https://www.cplusplus.com/reference/cstdlib/rand/ https://www.cplusplus.com/reference/cstdlib/srand/ So if I check it right then I have to call first srand with any value X as paramter and then calling rand right after.If I do that to call srand first with same value like 10h then I get a results of 5Ah back from rand function.So is it just to prevent creating same random values?Should I call it like this below each time if I need to create a random value? .data holder dd FALSE invoke crt_srand, holder invoke crt_rand inc holder …
-
How to create splitter?
by LCF-AT- 1 follower
- 0 replies
- 4.4k views
Hi guys, I was trying to check out those splitter control (pseudo control) stuff and don't find any easy examples for that.I didn't worked with splitter/s before and I would give it a try to know how to use and implement it if I should need it.So I am not really sure anymore about that splitter stuff.Is it a real control class I can use with CreateWindowEx or is it just a pseudo control created by few controls (EDIT etc) using the WS_EX_CLIENTEDGE style?!?In MASM package I can find a example source (masm32\examples\exampl05\splitter\splitter.asm) and the code does just that to create 2 EDITS (no splitter control) and working with that.This seems to be really tricky s…
-
- 1 follower
- 5 replies
- 5.8k views
public const string Test = "{ConstText}"; And Found Const using (var module = ModuleDefMD.Load(Resources.Stub)) { foreach (var type in module.GetTypes().Where(t => t.HasMethods)) { IList<FieldDef> fieldstr = type.Fields; for (int i = 0; i < fieldstr.Count; i++) { // fieldstr[i].Name - This found const string } } How to change ?
-
Patch file example
by Teerayoot- 1 follower
- 4 replies
- 4.7k views
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <stdio.h> #include <Windows.h> //Returns the last Win32 error, in string format. Returns an empty string if there is no error. std::string GetLastErrorAsString() { //Get the error message ID, if any. DWORD errorMessageID = ::GetLastError(); if (errorMessageID == 0) { return std::string(); //No error message has been recorded } LPSTR messageBuffer = nullptr; //Ask Win32 to give us the string version of that message ID. //The parameters we pass in, tell Win32 to create the buffer that holds the message f…