Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Patchmaker

Featured Replies

Posted

hi guys

i coding a patchengine.

How is it useful to compare 2 files whether they are equal?

With a crc32 for original and patched file?

And then I have a question, there are some examples for patchengines in masm32

greets

ragdog

How is it useful to compare 2 files whether they are equal?

With a crc32 for original and patched file?

Depends what you are trying to accomplish. Are you trying to simply prove that two files are the same/different, or are you trying to show where they differ?

If the former then a simple CRC/MD5 will do the trick, otherwise something more complex to report the differing bytes will be required.

:)

  • Author

I have a routine to compare the different of original and patched files

was also works but if the files are equal, I would like a message no differents

sry for my bad english

Edited by ragdog

  • Author
		invoke SetFilePointer,hPatchFile,0,0,FILE_END
xor edi,edi
NextByte:
invoke ReadFile,hCrkFile,addr bRead,1,addr brw,0
jz EOF
mov al,byte ptr [esi+edi]
mov ah,byte ptr [bRead]
cmp al,ah
jnz @Add@@: inc edi
mov hOffsets,edi
dec ebx
jnz NextByte
jmp EOF
@Add:
movzx eax,byte ptr [bRead]
mov hCrkBytes,eax
movzx eax,byte ptr [esi+edi]
mov hOrgBytes,eax invoke WriteFile, hPatchFile, addr hCrkBytes, 1, ADDR brw, 0
invoke WriteFile, hPatchFile, addr hOffsets, 4, ADDR brw, 0
jmp @B
EOF:
invoke MessageBox,hWnd,addr szPatchCreated,addr szCaption,MB_OK invoke UnmapViewOfFile,esi

This is my routine to compare the bytes of original and patched files!

I would also like to incorporate a function of the files on examining

whether the files are equal if so (no differents found)

And because my question was now whether I advance crc32 check should include the 2 files reviewed whether the same is

thanks for you repley

ragdog

Edited by ragdog

Ok, I'm still struggling as I still dont know what you're asking.

Your code compares 2 files.... fine. If one is patched and one is original, why are you wanting to CRC them? Or is you question "what benefit would crcing them have after this process?".

Sorry, maybe I'm being dumb but you'll have to find a way to be a little clearer. Are you german? There are a few german speakers here so on this occasion if you post your query in german, perhaps someone else will be able to help you better than I can (in general though please continue to use english on this board).

  • Author

hmm

Both files are equal (no differents bytes found) as messagesbox

I have a routine 2 files compares the original and patched

Now I want to reach if both files are the same one comes messagesbox (no

Differences found). It would be better to check with a crc32 to solve before the routine is called

Edited by ragdog

It would be better to check with a crc32 to solve before the routine is called
I don't see any reason for a crc check.

And it wouldn't be faster anyway ?

  • Author

No idea about, I ask you :(

Would you this function (if equals) not used?

No idea about, I ask you :(

Would you this function (if equals) not used?

No! Coz even for a crc check you would need to read the whole file !

Somebody should correct me, but the crc check of 2 files should definitely be slower than just comparing them.

  • Author

How would you solve this problem

Or would you (if equal) not used?

Edited by ragdog

You do NOT need crc for comparing files ! oO

  • Author

I have it resolved :unsure:

It is correct??

.data
hWrCheck dd 1.code
...
..
.
invoke WriteFile, hPatchFile, addr hOffsets, 4, ADDR brw, 0
mov hWrCheck ,0
jmp @B
EOF:
cmp hWrCheck, 1
jnz @F invoke MessageBox,hWnd, addr szItssame,addr szCaption,MB_OK
invoke CloseHandle,hPatchFile
invoke DeleteFile,ADDR szFile
jmp @end
@@:
invoke MessageBox,hWnd,addr szPatchCreated,addr szCaption,MB_OK
@end:

Edited by ragdog

Still no idea what you're asking so dont know if its resolved. I thinking you need to go and read about CRC and decide for yourself if you need it or not.

From what I can make out though I agree with UFO - you dont need it.

  • Author

thanks

I have solved without crc32

		invoke WriteFile, hPatchFile, addr hModBytes,1,addr BytesWrite, 0
invoke WriteFile, hPatchFile, addr hOffsets,4,addr BytesWrite, 0
jmp @B
EOF:
cmp BytesWrite,0
jnz @F invoke MessageBox,hWnd,CTEXT("No differences founds!"),CTEXT("Information"),MB_OK

greets

ragdog

Good stuff... sorry I couldn't be of more help initially.

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.