Register for your free account! | Forgot your password?

You last visited: Today at 01:16

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



API Hook? C#

Discussion on API Hook? C# within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2013
Posts: 4
Received Thanks: 0
API Hook? C#

Hallo,

ich würde mir gerne die Elemente eines Fensters von einer Anwendung anzeigen lassen. Also zum Beispiel alle Buttons oder eine drop down box usw..
Ich habe schon viel in Google gesucht aber nie etwas gefunden, was mir weitergeholfen hat.

Kann ich durch Api hooking realisieren?

Über Hilfe würde ich mich sehr freuen ( auch über einen Link zu einem tutorial oder welche "Basics" ich dafür brauche).

LG,

tobischi
tobischi is offline  
Old 10/02/2013, 23:20   #2
 
elite*gold: 1000
Join Date: Apr 2012
Posts: 1,003
Received Thanks: 208
Und was willst du damit erreichen?
qkuh is offline  
Old 10/03/2013, 11:34   #3
 
elite*gold: 0
Join Date: Sep 2013
Posts: 4
Received Thanks: 0
Ich würde gerne lernen und verstehen wie das Funktioniert und dann zum Beispiel in meinem Programms die Buttons des GUI anklicken oder den Inhalt einer Listbox oder Textbox kopieren und verwenden
tobischi is offline  
Old 10/03/2013, 12:52   #4
 
tolio's Avatar
 
elite*gold: 2932
The Black Market: 169/1/0
Join Date: Oct 2009
Posts: 6,966
Received Thanks: 1,097
das für brauchst du keinen api hook sondern musst einfach die win api nutzen, ohne anspruch auf vollständigkeit mal ein paar hinweise:



tolio is offline  
Old 10/03/2013, 13:12   #5
 
elite*gold: 1000
Join Date: Apr 2012
Posts: 1,003
Received Thanks: 208
Ich hab vor 3 Tagen noch so ein Tool in C# geschrieben. Ist ein Manager für Bots. Kannst mich gerne mit deinem Skypenamen pm'en und ich zeig dir dann, wie das funktioniert.
qkuh is offline  
Old 10/03/2013, 19:25   #6
 
elite*gold: 0
Join Date: Sep 2013
Posts: 4
Received Thanks: 0
Hab mir jetzt ne kleine Konsolenanwendung geschrieben in der ich die GetWindowText Funktion benutze. Das klappt auch, aber so bekomme ich ja nur die Caption des Fenster. Kann ich mit den Send- uns Postmessage Funktionen auch den restlichen Fensterinhalt bekommen oder wie wäre das möglich?

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {
        [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        static extern int GetWindowTextLength (IntPtr hWnd);


        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);


       
        static void Main(string[] args)
        {
            Process[] procs = Process.GetProcessesByName("Spotify");
            Process proc = procs[0];
            IntPtr hwnd = proc.MainWindowHandle;
            int len = GetWindowTextLength(hwnd);
            StringBuilder lpString = new StringBuilder(len + 1);
            GetWindowText(hwnd, lpString, lpString.Capacity);
            Console.WriteLine(len);
            Console.WriteLine(lpString);
            Console.ReadKey();
        }
    }
}
tobischi is offline  
Old 10/03/2013, 19:31   #7
 
tolio's Avatar
 
elite*gold: 2932
The Black Market: 169/1/0
Join Date: Oct 2009
Posts: 6,966
Received Thanks: 1,097
wie gesagt das bsp funktionen ua zum ziel führen können, schau einfach mal durch die windows api was es da sonst noch gibt
tolio is offline  
Old 10/04/2013, 22:16   #8
 
elite*gold: 1000
Join Date: Apr 2012
Posts: 1,003
Received Thanks: 208
Du musst durch alle Windows des GUI's wandern und wenn du am Control angekommen bist, dann besorgst du dir mit SendMessage (WM_GETTEXT) den Inhalt des Controls.

Hinweiß: Ich seh gerade, dass du Spotify als Testobjekt benutzt. Du kannst dir nicht von jedem Programm unbedingt jedes beliebige Control besorgen. Bei Spotify geht das zum Beispiel nicht. Am besten verwendest du Spy++ und AutoItWindowInfo. Damit sieht man das direkt.
qkuh is offline  
Old 10/08/2013, 11:45   #9
 
elite*gold: 0
Join Date: Sep 2013
Posts: 4
Received Thanks: 0
Danke für die Hilfe. Habe jetzt etwas rumprobiert und kann mit dem Code den Inhalt der Drag Listbox von Control Spy auslesen. Das Handle habe ich aus dem Control Viewer und gebe es Manuell ein. Wenn ich das gleiche jetzt z.B. bei einer Listbox von spyxx oder Pokerstars probiere werden mit bei spyxx nur Fragezeichen angezeigt und bei Pokerstars Garnichts.

Weiß einer von euch woran das liegt und wie ich dieses Problem lösen könnte?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
        public static extern int RegisterWindowMessage(string lpString);

        [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = System.Runtime.InteropServices.CharSet.Auto)] //
        public static extern bool SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam);
        [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
        public static extern IntPtr SendMessage(int hWnd, int Msg, int wparam,
        int lparam);

        const int LB_GETTEXT = 0x0189;
        const int LB_GETTEXTLEN = 0x018A;

        static void Main(string[] args)
        {
            IntPtr hWnd = new IntPtr(0x1F04FC);
            StringBuilder title = new StringBuilder();

            // Get the size of the string required to hold the window title. 
            Int32 size = SendMessage((int)hWnd, LB_GETTEXTLEN, 0, 0).ToInt32();

            // If the return is 0, there is no title. 
            if (size > 0)
            {
                title = new StringBuilder(size + 1);

                SendMessage(hWnd, (int)LB_GETTEXT, 0, title);


            }
            Console.WriteLine(title);
            Console.ReadKey();
        }
    }
}
tobischi is offline  
Reply


Similar Threads Similar Threads
WarLord Public Hook (Client Hook) 01.03 Rleased Official Epvp Release by pastalov.
03/03/2012 - WarRock Hacks, Bots, Cheats & Exploits - 4 Replies
hi. Endlich hat WarLord seinen Public Hack mal geupdated :handsdown: Hier habt ihr Ihn: http://img715.imageshack.us/img715/7504/frecky.pn g Der Download befindet sich im anhang! Virus Check: https://www.virustotal.com/file/3792beba0863829ec 3e2b53f3b0c17d20bfc09c7d76f5f24967a79f1a82a4ddb/an alysis/1330708386/
<26.06.11> Chico™ Public Hook, //Invisible//Chams /Stamina/Mini Hook/NO CRASH VERSION
07/08/2011 - WarRock Hacks, Bots, Cheats & Exploits - 46 Replies
26.06.11 Hack Released 26.06.11 SuperNoSpread Problem Fixxen Status= Not in Hack Hej Com, leider hab ich eine schlechte nachricht xP^^ aus egendeinen Grund verursacht bei mir SuperNoSpread einen Direkten Crash sobald man in game ist, deshalb habe ich es entfernt O,o der Hack ist tortzdem nett und wird euch gefallen, sobald ich mehr addys habe kommen mehrere funktionen noch dazu ;) http://img4.fotos-hochladen.net/uploads/public24e lfvtrw1u.png STOP! VOR DEM DOWNLOAD! Mit Dem...



All times are GMT +1. The time now is 01:16.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.