News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

I need a program called "FindLine"

Started by learn64bit, November 29, 2022, 04:41:33 AM

Previous topic - Next topic

learn64bit

thanks,

seems nothing better than
ReadFile,handleOfFile,addressOfMemory,4kb,BytesHaveRead,0

learn64bit

Idea update,
Now we use ReadFile loaded a.txt and b.txt in their memory,
  ...
  mov AddressOfMemoryA,eax
  mov FileSizeOfFileA,ebx
   ;FileSizeOfFileA is minimum 1 byte, maximum 1 giga bytes
  ...
  mov AddressOfMemoryB,eax
  mov FileSizeOfFileB,ebx
We use "invoke VirtualAlloc,400000h,MEM_COMMIT,PAGE_READWRITE" create a 4mb memory for LineMemory,
  (I think use VirtualAlloc or GlobleAlloc, it's no big different)
  mov addressOfLineMemory,eax

Next step,
How to load a noneEmptyLine from AddressOfMemoryA in addressOfLineMemory, then check if it is a line of AddressOfMemoryB or not?

hutch--

Use either HeapAlloc() or GlobalAlloc() as VirtualAlloc() tends to be for more specialised OS functions.


learn64bit

Idea update,

how to load a noneEmptyLine from AddressOfMemoryA in addressOfLineMemory, then check if it is a line of AddressOfMemoryB or not?
somebody suggest use "lodsb" to load, then use "cmpsb" to check.
I think It's a good idean to try, since I don't have an better one yet.

zedd151

First thing, do you have the Masm32 SDK installed on your computer? And I mean a proper, full installation without modifications. Masm32 has some nice libraries and macros that would make your described program much easier to write and receive assistance in writing it.
Have you started the assembly source code for your proposed program? If you have started it, post what you have so far.

learn64bit

no, nothing is new, just copy & past...
I will not post another unfinished and repeat source code
of course, I will post my working FindLine program
ideas are welcome, this is just beginning

zedd151

Quote from: learn64bit on December 08, 2022, 05:09:56 PM
no, nothing is new, just copy & past...
So, no source code?  :undecided:  I am eager to help you, but I can only help you if I see that you are really trying to write your own assembly program. Without a source code, I do not know that you are even trying.
Do you have the Masm32 SDK installed?

learn64bit

Thanks for everybody's ideas!

now we can go next steps

Ideas still are welcome, untill it is been finished.

zedd151


Still no source?
Quote from: learn64bit on December 10, 2022, 03:15:52 PM
...
now we can go next steps
...
Looking at the executable (that you attached) in ollydbg, seems like you are making a simple task a little over-complicated.  :thumbsup:
But I wish you the best of luck in your endevours. No souce code, I cannot assist.

learn64bit

OllyDbg's disassembly code is better than my source code?
Yes, it is true.

Every time I post source code, people say "not human readable!"

zedd151

#71
Quote from: learn64bit on December 10, 2022, 03:57:33 PM
Every time I post source code, people say "not human readable!"
Post the source code that you have, I won't complain about it.
Also, you never answered my question.. "Do you have the Masm32 SDK installed on your computer?"

If so, myself and other members may be able to help you better. :thumbsup:
Also, look at the examples in the 'examples' folder in Masm32. There you will see some nice examples of masm source code. Notice that most of them are easy to follow, uncluttered and only contain the data, code, includes and equates that are needed to assemble and link the example. (Plus compile .rc file (resources) where applicable and link it) Well some of the commenting is very verbose. That is done purposely to aid those just starting to use Masm32 to explain in detail what the functions do plus other descriptive remarks.

jj2007

Quote from: zedd151 on December 10, 2022, 04:39:30 PM
Also, you never answered my question.. "Do you have the Masm32 SDK installed on your computer?"

I can answer it for you :biggrin:

Address   Hex dump          Command                                  Comments
00402550  /$  6A F6         push -0A                                 ; /StdHandle = STD_INPUT_HANDLE
00402552  |.  E8 CB000000   call <jmp.&kernel32.GetStdHandle>        ; \KERNEL32.GetStdHandle
00402557  |.  50            push eax                                 ; /hConsole
00402558  |.  E8 CB000000   call <jmp.&kernel32.FlushConsoleInputBuf ; \KERNEL32.FlushConsoleInputBuffer
0040255D  |>  6A 01         /push 1                                  ; /Time = 1 ms
0040255F  |.  E8 CA000000   |call <jmp.&kernel32.Sleep>              ; \KERNEL32.Sleep
00402564  |.  FF15 6C304000 |call near [<&msvcrt._kbhit>]            ; [MSVCRT._kbhit
0040256A  |.  85C0          |test eax, eax
0040256C  |.^ 74 EF         \jz short 0040255D
0040256E  |.  FF15 68304000 call near [<&msvcrt._getch>]             ; [MSVCRT._getch
00402574  \.  C3            retn

wait_key proc

    invoke FlushConsoleInputBuffer, rv(GetStdHandle,STD_INPUT_HANDLE)

  @@:
    invoke Sleep, 1
    call crt__kbhit
    test eax, eax
    jz @B

    call crt__getch     ; recover the character in the keyboard
                        ; buffer and return it in EAX
    ret

wait_key endp

zedd151

Quote from: jjI can answer that for you
:tongue:
I rarely write console programs.  :toothy:


Still awaiting learn64bit's source to give some suggestions on Masm32.lib funcs or macros that might be useful for him to complete his project.

learn64bit

hope it's fast nough
1gb a and b will take a while