News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Coding a GUI for DLL's.

Started by Sean1337, August 13, 2007, 05:55:57 AM

Previous topic - Next topic

Sean1337

Hey guys,

I'm looking for a tutorial on coding a gui for my dll code.

Basically, right now I'm using hotkeys to call function's in my code.

I would like to be able to, upon injecting my dll into the program I coded the dll for, that a GUI (like buttons window) appears and I could click the buttons on this new window to call functions.

Is there any tutorials or code samples for dll's that have GUI's?

To make things easier for you guys to help me, This is an example source of a dll I would like to code a gui for:

.386
.MODEL FLAT, STDCALL

OPTION CASEMAP : NONE

INCLUDE WINAPI.inc
INCLUDE WINDOWS.inc
INCLUDE MASM32.inc

INCLUDELIB KERNEL32.lib
INCLUDELIB USER32.lib
INCLUDELIB MSVCRT.lib
INCLUDELIB MASM32.lib

.Data?

.Data
ThreadID           dd ?
dwZombieEnabled    dd 0

caption    db "Sean Sample App",0
text       db "Test App",0

.Code

Main proc Unused:DWORD, Unused2:DWORD, Unused3:DWORD

cmp [Unused2], DLL_PROCESS_ATTACH
jnz Return

push ThreadID
push 0
push 0
push Start
push 0
push 0
Call CreateThread

Return:
mov eax, TRUE
pop ebp
retn
Main endp 


Start proc near

push 0
push offset caption
push offset text
push 0
call MessageBoxA

MonitorHotkeys:

push VK_F1
call GetAsyncKeyState
cmp eax, 0
jnz EnableDisableZombie

push 150
call Sleep
jmp MonitorHotkeys

EnableDisableZombie:
cmp dwZombieEnabled, 0
jz AllowZombie
cmp dwZombieEnabled, 1
jz DisallowZombie

AllowZombie:
call EnableZombie
mov dwZombieEnabled, 1
jmp MonitorHotkeys

DisallowZombie:
call DisableZombie
mov dwZombieEnabled, 0
jmp MonitorHotkeys

Start endp
;-----------------------------------------------------------------------------------
EnableZombie proc near

mov eax, pointer
mov eax, [eax]
add eax, offset
mov dword ptr ds:[eax], 8
retn

EnableZombie endp
;-----------------------------------------------------------------------------------
DisableZombie proc near

mov eax, pointer
mov eax, [eax]
add eax, offset
mov dword ptr ds:[eax], 0
retn

DisableZombie endp
;-----------------------------------------------------------------------------------
End Main


I would like to code a GUI which has 2 buttons. One button to call the function "EnableZombie" and One button to call the function "DisableZombie." I would like this gui to appear when I have injected this dll.

Currently (as you can see), I use F1 to call enablezombie or disablezombie.

Any help you guys can give would be greatly appreciated,
-Sean

Draakie

Quote
I would like to be able to, upon injecting my dll into the program I coded the dll for, that a GUI (like buttons window) appears and I could click the buttons on this new window to call functions.

Although this might be a legitimate request - the subject of "DLL injection" is paramount to "Skating on thin ice".
I suggest request a response via PM from a forum moderator rather than in open forum. Sorry.....

Draakie
Does this code make me look bloated ? (wink)

MichaelW

This appears to me to be a violation of the forum rules, even if it wasn't intentional. The GUI question is OK, but not the code injection part. I'm locking this topic.
eschew obfuscation