flat assembler
Message board for the users of flat assembler.

Index > Windows > simple win64 program

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
tixvin



Joined: 13 Apr 2013
Posts: 12
tixvin 14 Apr 2013, 10:25
I have already fix this. The function createwindowex returns zero
that means the window failed to create but not to show
Post 14 Apr 2013, 10:25
View user's profile Send private message Send e-mail ICQ Number Reply with quote
tixvin



Joined: 13 Apr 2013
Posts: 12
tixvin 14 Apr 2013, 10:27
I have already fixed it see code.
the thing is that createwindowex returns zero that means that the window failed to create but not to show
Post 14 Apr 2013, 10:27
View user's profile Send private message Send e-mail ICQ Number Reply with quote
tixvin



Joined: 13 Apr 2013
Posts: 12
tixvin 14 Apr 2013, 10:28
try this code at your machine maybe you will success
Post 14 Apr 2013, 10:28
View user's profile Send private message Send e-mail ICQ Number Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP 14 Apr 2013, 10:30
HaHaAnonymous wrote:
Quote:

Program crashing is different than a run-away program.

Good! Then I can exit my program by intentionally crashing it.

Thank you!


If that is what you call professional programming then yes you can! Actually why use other Win API functions? There is theoretically no need to use IsDebuggerPresent() for example since you can access all memory structures required to duplicate the functionality directly from your ring 3 module. However if MS changes one pointer address it will fail. Also you will need to correct your code when switching from 32 to 64 bit app. That is another reason why using API "sometimes" is actually a benefit and not a drawback Wink
Post 14 Apr 2013, 10:30
View user's profile Send private message Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP 14 Apr 2013, 11:19


This is a sample code to illustrate how you should call CreateWindowEx() function and not the complete solution. Have you tried compiling provided C code? Probably note since it is incomplete. When porting from one language to another one you need to have complete code or be sure to setup environment proper way. Just my 2 cents...
Post 14 Apr 2013, 11:19
View user's profile Send private message Reply with quote
tixvin



Joined: 13 Apr 2013
Posts: 12
tixvin 14 Apr 2013, 11:28
see thie code on this link below there you read:

<Here is the complete code to create the window. Remember that WindowProc is still just a forward declaration of a function.>
Post 14 Apr 2013, 11:28
View user's profile Send private message Send e-mail ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 14 Apr 2013, 17:01
tixvin: The C-code you posted is not complete in any way. I suggest you look at the fasm example for 64-bit window creation. The fasm example works correctly. Don't bother with broken C-code you found somewhere, it is wasting your time.


Last edited by revolution on 14 Apr 2013, 18:15; edited 1 time in total
Post 14 Apr 2013, 17:01
View user's profile Send private message Visit poster's website Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 14 Apr 2013, 18:10
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 21:04; edited 1 time in total
Post 14 Apr 2013, 18:10
View user's profile Send private message Reply with quote
tixvin



Joined: 13 Apr 2013
Posts: 12
tixvin 26 Apr 2013, 16:17
and now it works. if you click a left button then you will hear a beep)

Code:
;10:32 AM 4/7/2013

  format PE64 GUI 5.0
  entry start

  include 'win64a.inc'

 section '.text' code readable executable
 ftoten:
    xor rcx, rcx
   call [PostQuitMessage]
 ret
  signal:
  mov rcx, 600
   mov rdx, 2000
   sub rsp, 20h
  call [Beep]
   add rsp, 20h
   ret

   fproz:
  sub rsp, 8

  cmp edx, 2h
   jne .weiter
  call ftoten

  .weiter:
  cmp edx, 513
  jne .alles
   call signal

  .alles:
  sub rsp, 20h
   call [DefWindowProcA]
  add rsp, 20h
  add rsp, 8
    ret

 start:
  sub rsp, 8

  mov [wc.style], CS_HREDRAW + CS_VREDRAW + CS_GLOBALCLASS
  mov  rax, fproz
  mov [wc.lpfnWndProc], rax
  xor rcx, rcx
 call [GetModuleHandleA]
  mov [wc.hInstance], rax
  mov [wc.cbClsExtra], 0
  mov [wc.cbWndExtra], 0
  xor rcx, rcx
  mov rdx, 32512
  call [LoadIconA]
  mov [wc.hIcon], rax
  xor rcx, rcx
  mov rdx, 32512
   call [LoadCursorA]
  mov [wc.hCursor], rax
  mov [wc.hbrBackground], COLOR_BTNFACE+1
  mov [wc.lpszMenuName], 0
  mov [wc.lpszClassName], kls
  mov rcx, wc
  sub rsp, 20h
   call [RegisterClassA]
  add rsp, 20h

   mov rcx, 0
   lea rdx, [kls]
   lea r8, [titel]
   mov r9,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU;
  push 0
  push [wc.hInstance]
  push 0
  push 0
  push 512
  push 512
  push 256
  push 256
   sub rsp, 8*4
   call [CreateWindowExA]
   add rsp, 8*12
   mov [fnstr], rax

  _zyklus:
  lea rcx, [nouvelle]
  mov rdx, 0
  mov r8, 0
  mov r9, 0
  sub rsp, 20h
   call [GetMessageA]
  add rsp, 20h
   or rax, rax
   jz _fertig
  mov rcx, nouvelle
   call [TranslateMessage]
  mov rcx, nouvelle
   call [DispatchMessageA]
  jmp _zyklus

  _fertig:
  mov rcx,  [nouvelle.wParam]
  call [ExitProcess]

  section '.data' data readable writeable
   fnstr dq 0
   wc WNDCLASS
  titel db ' fenster',0
    kls db 'klass', 0  
  nouvelle MSG

   section '.idata' import data readable writeable

  library kernel32,'KERNEL32.DLL',\
  user32,'USER32.DLL'

   include 'api\kernel32.inc'
  include 'api\user32.inc'
    
Post 26 Apr 2013, 16:17
View user's profile Send private message Send e-mail ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.