home *** CD-ROM | disk | FTP | other *** search
/ KeyGen Studio 2002 / KeyGen_Studio_2002.iso / Tutorials / CrackMesCbjNet / di_tut_dux.txt < prev    next >
Encoding:
Text File  |  2001-09-21  |  3.0 KB  |  100 lines

  1. SOLUTION FOR WIN32CM2.EXE
  2. by the_dux (8th July 2001)
  3.  
  4. The Solution
  5. ============
  6.  
  7. Well, fire up the program, this time we'll learn sth i've never
  8. heard to be used as a protection scheme.
  9. Let's fire up also our preferred disassembler and play with
  10. the executable.
  11. Now we can start to search the protection scheme. If you simply
  12. run the program you'll see a nice dialog box with an edit control
  13. with the string 'Unregistered' in it.
  14. Now we can look at the dead listing and search for a function that
  15. open a key file or sth similar but we soon fall into the section
  16. where strings 'I Am Registered' and 'Registered' are pushed to be
  17. used.
  18. Without going on with the code, i can say the protection is like
  19. this:
  20.  
  21. -) the crackme register a new code for a new and reserved windows
  22.    message (with a call to RegisterWindowMessage, see the msdn for
  23.    further details).
  24.  
  25. -) after this the crackme go to sleep and wait you for the message
  26.    with that ID and with the parameter (wParam) pointing to a ATOM
  27.    ID created with GlobalAddAtom that contain the string 'I Am 
  28.    Registered'.
  29.  
  30. -) if the program receive the message ID it call GlobalGetAtomName
  31.    to retrieve the atom pointed by wParam and compare it (with a
  32.    simple call to lstrcmpiA) with the above string ('I Am Registered').
  33.  
  34. -) if it match it will push to the edit box the string 'Registered'.
  35.  
  36. Nice protection...
  37. Now, how to send the message to the window?
  38. Nothing more easy. Compile and run this little baby:
  39.  
  40. ; ------------------- CUT HERE ----------------------
  41. ; call it sendmsg.asm or whatever you want
  42. ; this is to send a specific message to our crackme
  43. ; (not only to it as you can see below)
  44. ; compile with:
  45. ; tasm32 /ml sendmsg.asm
  46. ; tlink32 -Tpe -aa sendmsg,,,import32
  47.  
  48. .386p
  49. .model flat, stdcall
  50.  
  51. ; This is because i don't want to include a .inc file...
  52. extrn FindWindowA: PROC
  53. extrn SendMessageA: PROC
  54. extrn ExitProcess: PROC
  55. extrn GlobalAddAtomA: PROC
  56. extrn GlobalDeleteAtom: PROC
  57.  
  58. NULL equ 0
  59. HWND_BROADCAST equ -1
  60.  
  61. .data
  62. RegMsg db 'I Am Registered',0   ; the string to be sent
  63. AtomRef dd 0            ; atom ID to be sent
  64.  
  65. .code
  66. start:
  67.  push offset RegMsg
  68.  call GlobalAddAtomA
  69.  mov AtomRef, eax
  70.  
  71.  push NULL
  72.  push eax
  73.  ; here we push the ID of the new message registered by the
  74.  ; crackme. This is the one seen on my machine, maybe yours
  75.  ; will be different. To catch it simply put a breakpoint
  76.  ; on RegisterWindowMessage and see the result in eax. That
  77.  ; is the value to push here.
  78.  ; If you want you could also code a DLL or even a VxD to 
  79.  ; let our program know the value for each system.
  80.  push 0C903            
  81.  push HWND_BROADCAST            ; with this we send the msg
  82.                 ; to all the opened windows
  83.                 ; even the minimized and 
  84.                 ; hided ones.
  85.  call SendMessage        ; could be also call PostMessage
  86.  
  87.  push AtomRef
  88.  call GlobalDeleteAtom        ; just to free 15 bytes of mem
  89.  
  90.  push NULL
  91.  call ExitProcess        ; work done...
  92. end start
  93.  
  94. ; ------------------- CUT HERE ----------------------
  95.  
  96. Now you have seen a nice protection scheme. This could be a
  97. really interesting protection if improved...
  98.  
  99. the_dux (the_dux[AT]bigfoot[DOT]com )
  100.