Jump to content
Tuts 4 You

How to control CMD console?


LCF-AT

Recommended Posts

Posted (edited)

LCF: If you want to get into C a little from an assembler perspective you should consider buying Hacking: The Art of Exploitation since I know you speak German, here is a translated version: Hacking: Die Kunst des Exploits. Personally I like C++ more, but when you come from ASM learning C will have a far small learning curve :)

And yes, the book is not that cheap, but definitely worth it! Download the PDF somewhere and see for yourself (no German PDF available though). Oh and the C is learned from a Linux perspective, but in the end that doesn't change anything :)

Edited by Mr. eXoDia
Teddy Rogers
Posted

As REAP mentioned PureBasic! Some people will heckle and roll their eyes at me for suggesting this. Personally I find it a very nice language to work with, you would have been all done and dusted had you been using it and on to your next project. Sure it has some quirks but what language doesn't.


 


There is a demo version available for download that is a bit limited but it's not that much to buy if you find you like it, definitely worth the once off lifetime payment.


 


I'll have to find some time to blog more code examples...


 


Ted.


Posted (edited)

Hi,

 

nice video simple. :) So you mean I should give "pea©e" a chance. ;) Does it also mean that ASM is language which is limited and that I can't do or create some stuff what I have in my mind?Just a easy exsample,so I like the Tabs in my FF browser how they look and how they work if you move them etc so would you say that I could forget it when I wanna create almost the same tab stuff in any ASM code (not possible etc)?

 

Of course I think its not so easy to switch now to a other language where I have again to start from zero and I am already happy to got a halfway good entry with ASM so that I can use it now more or less successfully to write any codes.

 

 

It's like if u talk Spanish - you'll already understand a lot of Portuguese, Italian, etc & learning them is straightforward. It's NOT like starting from 0.

Same thing here, masm people can learn C (and vice versa) pretty quickly because they're already very similar.

 

For solid, professional looking GUI's (like tabs in FireFox) - forget about winapi. Yes it's possible, but...

 

Most pro GUIs are probably based in MFC, STL, boost, QT, GTK, (some) delphi, etc. Firefox looks like either Qt or GTK. Definately isnt winapi though.

 

devc++ download (free, small, easy to setup) - http://sourceforge.net/projects/orwelldevcpp/(good practical start to beginning C or C++ coding, many many youtube video tuts + text tuts)

 

Qt Creator (free, large) - https://www.qt.io/download-open-source/- Download this, then click on "samples", u can point/click compile some very high quality GUI samples

 

Edited by simple
Posted

Hi again,


 


thanks for your feedbacks so far.


 


Ok I tried to check this Dev C++ but I can't find any example apps inside this package just some template codes only.Where can I download any full app with GUI examples?I mean just for testing any clock app or whatever etc.Next problem I do have is with the color shemes so almost all using just same color all words what makes it hard for me,so in ASM I got for all other colors so is there a way to use same color sheme of ASM in this C++ too?See picture below.Next problem I see is that there is no autocompletion of API or messages etc which I do enter.Why this?You know what I mean right so in ASM if I enter invoke command then I get the entire API context to see which is very good & helpfully + right color change if you did wrote a message / API right or not.


 


Anyway,so I will check this out to see whether I can make friends with C++ which could also take a longer time again as for ASM too in the past.Maybe I try also to check PureBasic Demo too.


 


Thanks again


post-27695-0-06870600-1431638910_thumb.p

Posted

If you are developing for Windows why not use Visual Studio? You can do a lot more customization's to the IDE with it.


Posted (edited)

[Offtopic]

@atom0s

Can I get source codes of some of yours trainer templates with colors and other stuff?

Edited by Nucleus
Posted

Hi again,


 


no idea what I should use for C++ etc so there seems to be a lot tools (IDE etc) to get.Looks to complex for me at the moment.


 


So I try to work with ASM again to find a solution for this tab drag & drop thing.So I can use WM_LBUTTONDOWN & WM_LBUTTONUP in my tabcontrol to reconize the tabs + which I did hit at start & end so that means I can drag & drop them from A - B etc but the problem is that I can not show any moving process during the mousemove.So what can I do to show something during mousemove like any text or image or whatever?Maybe it would be ok to show any text (Name of pressed tab + Drag & Drop text) but how to show it right next at the mouse?Any ideas?


 


Thanks


Posted

 

 

no idea what I should use for C++ etc so there seems to be a lot tools (IDE etc) to get.Looks to complex for me at the moment.

 

Do u really think that u'll learn everything just in a blink ?!

It's a whole new programming language... means that 3 months at least :)

Posted

Hi again,

 

no idea what I should use for C++ etc so there seems to be a lot tools (IDE etc) to get.Looks to complex for me at the moment.

 

So I try to work with ASM again to find a solution for this tab drag & drop thing.So I can use WM_LBUTTONDOWN & WM_LBUTTONUP in my tabcontrol to reconize the tabs + which I did hit at start & end so that means I can drag & drop them from A - B etc but the problem is that I can not show any moving process during the mousemove.So what can I do to show something during mousemove like any text or image or whatever?Maybe it would be ok to show any text (Name of pressed tab + Drag & Drop text) but how to show it right next at the mouse?Any ideas?

 

Thanks

 

If your development is focused towards Windows, which so far all of your topics have seemed to be Windows related, I would really recommend using Visual Studio. It is made by Microsoft so their tools are obviously going to work the best on their own operating system. 

Teddy Rogers
Posted

no idea what I should use for C++

 

Make the programming pain go away, from PureBasic's helpfile...

 

Drag & Drop is a widely used technology today as it provides an easy and very intuitive way to move data around between windows and applications. This library provides crossplatform functions to add this functionality to gadgets and windows with just a few extra lines of code.

 

Furthermore this library provides some functions to extend its default possibilities through platform specific APIs, giving the experienced programmer all the freedom to work with custom formats while still taking advantage of the framework provided by this library.

 

Ted.

Posted

Hi again,


 


ohhhh so now I think I do undertsand what you mean guys.So you mean the other languages as PureBasic using already prefabricated own API codes for very much stuff as drag & drop for example so that I just need to use this short own API code without to write the entire stuff manually right? :) Maybe similar as would I use ASM macros who do the work for me.So this sounds nice now.


 


Thanks again for the info.


 


greetz


Posted

Hi again,


 


ok so now I got something working after endless testings for a tab drag & drop function. :) Below 2 pics I made.Ok maybe it would be better to show any image (need to find out how to show any image) or something instead to use text but for the moment I am happy to show anything during the mousemove. :) I also added a color change if it hits a not used tab.


 


PS: I also asked for help about this on a other "coder forum" before a few days and also got no answer till now.Really funny.


 


greetz


 


post-27695-0-90863900-1432067589_thumb.p

post-27695-0-07842300-1432067599_thumb.p

Posted

maybe a weird question, but why would you want to move the tabs anyway?

Posted

Hi,


 


why? :) Why not is the question.So in your browser you can also move the tabs to any other positions to the left or right side and this I just wanna do too also if I don't build any browser tool. :) I'd like to use tab register cards more than any dialog boxes to show new windows as settings etc.


 


greetz


  • Like 1
Posted

Hi,


 


question: So why I can't see all style's & ExStyles for all of the controls which I can choose?So on MSDN I find many more of them but WinASM does not show them all.I can find all in the windows.inc file of course so when I just edit the values manually in not visible mode and switch back and check the style window again then I can see it?!?Really strange or?Just check the pics below.Normaly I should get to see them all or not?Is there a way to get all directly chooseable in visualmode?



SS_OWNERDRAW equ 0Dh
SS_BITMAP equ 0Eh
SS_ENHMETAFILE equ 0Fh
SS_ETCHEDHORZ equ 10h
SS_ETCHEDVERT equ 11h
SS_ETCHEDFRAME equ 12h
SS_TYPEMASK equ 1Fh
SS_NOTIFY equ 100h
SS_CENTERIMAGE equ 200h
SS_RIGHTJUST equ 400h
SS_REALSIZEIMAGE equ 800h
SS_SUNKEN equ 1000h
SS_ENDELLIPSIS equ 4000h
SS_PATHELLIPSIS equ 8000h
SS_WORDELLIPSIS equ 0C000h
SS_ELLIPSISMASK equ 0C000h

post-27695-0-60274700-1432469325_thumb.p

post-27695-0-00201200-1432469333_thumb.p

  • Like 1
Posted

I think some don't apply to certain controls? (Especially the EXSTYLES)

  • 2 weeks later...
Posted

Hi,


 


I have a next question.So I still work around with tabs and now I got a other problem.So I see if I add many tabs then I get at the end a small scrollbar to see only a left & right arrow.Normaly its ok so but in the case that I have 100 tabs or 1000 for exsample then its bad to press the arrow keys or keep pressed till the desired tab comes around.Now I try to find a other solution to use H-scroll bar which I can just move with the mouse very quick.Problem here the Hscroll in tabcontrol styles isn't working alone so there is not autoscroll option for this control and also I would like to have the scroll bar above the tabcontrol.Now I thought I could use a extern Slider control but here I have some problems to make something working.Just wanna ask whether you have or know any little examples which I could check or something.


 


greetz


  • Like 1
Posted

Hi again,


 


so I was playing a little bit and got it working to create a extern Hscroll.Now I found a little problem with the scrolling.So I can check the WM_HSCROLL for SB_LINELEFT / SB_PAGELEFT & SB_THUMBTRACK (also same for right side) but the problem I got now is that I can't check the SB_THUMBTRACK together with a left or right paramter.The only thing what I can do is to check the HIWORD scroll position and compare it with lower or higher 50 (I have set the range to 100 as 100%).Now the scroller does just start to scroll from the middel of the scrollbar (scroll left if smaller than 50 or right if higher) but I would like to get a scroll move from any position but isn't working.Do you have a idea?Below a example code...



.if uMsg==WM_HSCROLL
invoke GetDlgItem,hWnd,IDC_HSCROLL
.if lParam==eax
mov edi, eax
mov HS_HANDLE, eax
invoke SetScrollRange,edi,SB_CTL,0,100,0 mov edi, wParam
LOWORD wParam
mov edi, eax
.if edi==SB_LINELEFT || edi==SB_PAGELEFT || edi==SB_THUMBTRACK
HIWORD wParam
.if eax < 50
jmp MOVE_TO_LEFT
.endif
.if eax > 50
jmp MOVE_TO_RIGHT
.endif
...etc
jmp MOVE_OUT

greetz


  • Like 1
Posted

Hi again,


 


got a new question about subclassing.So I do understand the idea so far why to subclass some controls as Listviews for exsample.If I do then I can catch the WM_MOUSEMOVE message directly in this subclass if I move the mouse on the control I have SC before.The problem what I got now is that I can't catch all message in this subclass and I don't know why....first I tried to check the WM_NOTIFY message to read then the NMHDR hwndFrom and to check it for my LV Handle but it never received the handle in this SC routine but why?I can only get it in my main routine.Also same with NM_CLICK!



LISTVIEWPROC proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM .if uMsg == WM_NOTIFY
nop
mov edi,lParam
assume edi:ptr NMHDR
mov eax,[edi].hwndFrom
.if eax==LISTVIEW
nop ; <-- never stops here.
.endif .else
invoke CallWindowProc,OLDLISTVIEWPROC,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
Ret
LISTVIEWPROC endp

So what I have to do to get them (xy messages too) into this routine?


 


greetz


Posted

Hi again,


 


guys I need some help please. :)


 


So I did play again with that SetWindowLong API but this works strange.First problem as I told before is that I don't get many xy message commands in the new procedere.


 


Example: So I have created a Tabcontrol via CreateWindowEx API and right after I did subclass it via SetWindowLong API and the problem now is that the tabcontrol can't switch between the tabs anymore.I have created 3 test tabs which I can select but only if I not subclass this tabcontrol!?!?!?!Why this?Also I can't get the message WM_CONTEXTMENU in the subclass procedere so whats going wrong now?No idea what it is with the subclassing problems.Ok I made a short test dialog + asm files etc where you can check it out if you want so maybe you can see what wrong is.



;;;;;;;;;;;;;;;;;; SUBCLASS the Trash ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; invoke SetWindowLong,edi,GWL_WNDPROC, addr TABPROC
mov OLDTABPROC, eax
invoke SetWindowLong,TABHANDLE,GWL_WNDPROC, addr TABPROC
mov OLDTABPROC, eax

So this is enabled in my test source and you see you can't switch the tabs anymore and you also don't get WM_CONTEXTMENU or WM_MOUSEMOVE etc in sub procedere but if you disable the subclassing then all is working again.How the question is how to get it work with subclassing + getting all WM_xy messages.Just have a look if you want.


 


Thanks


Subclass WM TEST.rar

Posted

Hi guys,


 


listen.Still workin on that subclassing problems.Problem is I can't get some same WM messages & NMHDR struct datas as I get in my main routine.Now I tried again and wrote this in my main procedere to send WM_NOTIFY + same NMHDR datas in my 2 subclass routines..



;;; First Main Routine
.elseif uMsg == WM_NOTIFY
invoke SendMessage,TABHANDLE,WM_NOTIFY,wParam,lParam
invoke SendMessage,LISTVIEW,WM_NOTIFY,wParam,lParam .endif
xor eax,eax
ret

...now it works and I can catch the message & NMHDR as NM_DBLCLK.



;;; Listview Subclass routine
.elseif uMsg == WM_NOTIFY
mov ebx,lParam
mov eax, (NM_LISTVIEW ptr [ebx]).hdr.code
.if eax == NM_DBLCLK
mov EDIT, 1h ; edit entry
invoke SendMessage,hWnd, LVM_GETNEXTITEM, -1, LVNI_SELECTED or LVNI_FOCUSED
.if eax!=-1
invoke DialogBoxParam,hInstance,1004,hWnd,addr AddDlgProc,TRUE
.endif
.endif
...................
.else
invoke CallWindowProc,OLDLISTVIEWPROC,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
Ret

All working so far on the first view but now I got a problem with my Listview so if I move the column line to left or right side then it will not updated anymore.See my pics below...So the question is how to prevent such problems and how to work correctly with subclassing and how to send messages etc.So can anybody of you coders tell me how to handle it on the right way?So it would be nice if you could so I don't get it work and also don't know what I am doing wrong in that case.Maybe you can help.


 


Thank you


post-27695-0-51194500-1433957194.png

post-27695-0-46456400-1433957206_thumb.p

  • 4 weeks later...
Posted

Hi again,


 


short new question.Does anybody know any simple way to read a text file line by line?Any API or command message or macro I could use instead to check each time manually for 0D0A hex bytes?


 


greetz


Posted

its asm. you have to write your own code for that :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...