SeKaSoft Posted November 20 Share Posted November 20 Why can't we use some Autoit commands in C#? For example, dllstructgetdata, if there is a C# like this command, can you share it? Link to comment Share on other sites More sharing options...
argumentum Posted November 20 Share Posted November 20 1 hour ago, SeKaSoft said: can you share it? Talking to me ? Follow the link to see my signature's stuff.FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
SeKaSoft Posted November 20 Author Share Posted November 20 I have a code like this But I can't get the result I want, so I need a command like DllStructGetData. If I knew exactly what this command does, I could do it myself. Autoit Coding Quote Func _memorypointerwrite($address, $handle, $offset, $data, $type = "dword", $8byte = False) $pointercount = UBound($offset) - 1 If $8byte Then $buffer = DllStructCreate("LONG_PTR") Else $buffer = DllStructCreate("dword") EndIf For $i = 0 To $pointercount If ($i == $pointercount) Then $buffer = DllStructCreate($type) DllStructSetData($buffer, 1, $data) $address = "0x" & Hex(Int(($buffer_data) + $offset[$i])) <===== i need buffer_data because change memory address $pointerwrite = _winapi_writeprocessmemory($handle, $address, DllStructGetPtr($buffer), DllStructGetSize($buffer), $v_data) Return $address ElseIf ($i == 0) Then _winapi_readprocessmemory($handle, $address, DllStructGetPtr($buffer), DllStructGetSize($buffer), $v_data) $buffer_data = DllStructGetData($buffer, 1) <===== i need buffer_data Else $address = "0x" & Hex(Int(($buffer_data) + $offset[$i])) <===== i need buffer_data because change memory address _winapi_readprocessmemory($handle, $address, DllStructGetPtr($buffer), DllStructGetSize($buffer), $v_data) $buffer_data = DllStructGetData($buffer, 1) <===== i need buffer_data EndIf Next If @error Then Return -1 EndIf Return True EndFunc C# Coding Quote public string DecimalToHex(int Value) { return Value.ToString("x2").ToUpper(); } IntPtr GetIntPtr(Byte[] byteBuf) { IntPtr ptr = Marshal.AllocHGlobal(byteBuf.Length); for (int i = 0; i < byteBuf.Length; i++) { Marshal.WriteByte(ptr, i, byteBuf); } return ptr; } private void MemoryPointerWrite(Int32 adres, Int32[] offset_a, int nSize) { byte[] buffer = new byte[4]; string dectohex; int pointercount = Information.UBound(offset_ctrlf); for (int i = 0; i <= pointercount; i++) { if (i == pointercount) { dectohex = DecimalToHex((int)buffer_data + offset_a); adrr = new IntPtr(Convert.ToInt32(dectohex.Replace("0x", ""), 16)); //WriteProcessMemory(GameProcessHandle, adrr, buffer, 4, 0); MyAdres = adrr; listBox1.Items.Add("i equal to pointercount /" + adrr.ToString("X")); } else if (i == 0) { ReadProcessMemory(GameProcessHandle, (IntPtr)adres, buffer, nSize, 0); buffer_data=GetIntPtr(buffer); listBox1.Items.Add("if equal to zero " + adres.ToString("X") + " / " + buffer_data); } else { dectohex = DecimalToHex((int)buffer_data + offset_a); adrr = new IntPtr(Convert.ToInt32(dectohex.Replace("0x", ""), 16)); ReadProcessMemory(GameProcessHandle, adrr, buffer, nSize, 0); buffer_data = GetIntPtr(buffer); listBox1.Items.Add("if not equal to zero /" + adrr.ToString("X") + " / " + buffer_data); } } } Link to comment Share on other sites More sharing options...
argumentum Posted November 20 Share Posted November 20 ..I don't know the first thing about C# but maybe this may give you a clue ? https://stackoverflow.com/questions/17562295/if-i-allocate-some-memory-with-allochglobal-do-i-have-to-free-it-with-freehglob The next forum user coming to help is going to want to know what is that you need to get done due to forum rules Follow the link to see my signature's stuff.FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
SeKaSoft Posted November 21 Author Share Posted November 21 18 hours ago, argumentum said: ..C# hakkında pek bir şey bilmiyorum ama belki bu size bir ipucu verebilir? https://stackoverflow.com/questions/17562295/if-i-allocate-some-memory-with-allochglobal-do-i-have-to-free-it-with-freehglob Yardıma gelecek bir sonraki forum kullanıcısı , forum kuralları gereği ne yapmanız gerektiğini bilmek isteyecektir. First Thank you for the information you provided. But May I know what rule mistake I made? Link to comment Share on other sites More sharing options...
argumentum Posted November 21 Share Posted November 21 You made no mistake but those reading memory tend to use it for game cheat and that is a topic not allowed on this forum, hence the disclosure of your purpose. Knowing your use case may bring about a better solution too so, no mistake. Plus am not a moderator in this forum, just a user. 42 minutes ago, SeKaSoft said: First Thank you for the information you provided. Glad it was useful to you. Follow the link to see my signature's stuff.FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now