home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / +Sandman / Htocrk92.txt < prev    next >
Text File  |  2000-05-25  |  33KB  |  638 lines

  1.                      HOW TO CRACK, by +ORC, A TUTORIAL
  2.  
  3. ---------------------------------------------------------------------------
  4.  
  5.                 Lesson 9 (2): How to crack Windows, Hands on
  6.  
  7. ---------------------------------------------------------------------------
  8.  
  9.                                [PaintShopPro]
  10.  
  11.                    --------------------------------------
  12.  
  13.  
  14.           LESSON 9 (2) -  How to Wincrack, Hands on
  15.      Nagscreens galore: The Paint Shop Pro crack (part A)
  16.  
  17. Merry Xmas. We'll learn, beginning with this lesson, how to
  18. eliminate the "nagscreens", i.e. the protection and or annoying
  19. schemes that many commercial and shareware windows programs use
  20. in order to annoy us and push lusers to buy them.
  21. In order to understand (simple) nag screen deprotection we'll
  22. crack following different approaches Paint Shop Pro, the de facto
  23. standard used to day for graphic manipulation. It's a good
  24. choice, I believe, because
  25. - it's a very widespread application:
  26.      you'll surely have some copies of it on your CD-ROMs, and
  27.      you'll find many copies on the Web (albeit not cracked ones
  28.      until now: the only cracks I am aware of are patches that
  29.      simulate the user clicking on the OK button of the
  30.      nagscreen, thus closing it, but not eliminating it).
  31. - this application has many older versions:
  32.      I want to teach you here also a "general" approach strategy
  33.      that you should often follow when (and if) you'll start
  34.      higher cracking: the *very* important study of the
  35.      "embryology" of the software you want to crack. The long
  36.      history trail of the "ancient" copies of your target will
  37.      help you a lot to understand its evolution and the parallel
  38.      evolution of its protection scheme ("Historia lux
  39.      veritatis... magistra vitae", hope you did not forget your
  40.      Cicero :=)
  41. The case of the nagscreen evolution of PSP is particularly
  42. evident:
  43. 1) static nagscreen      ;1993, Ver. 2.0, PSP.EXE = 525.520 bytes
  44. 2) daycount added        ;1994, Ver. 3.0, 861.856 bytes
  45. 3) delayed OK focus      ;1995, Ver. 3.2-32, 1.042.944 bytes
  46. 4) ported to Win95       ;1996, Ver. 4.1, 1.151.488 bytes
  47. In the meantime many functions have been added to the program
  48. whose size has broken all limits.
  49. Let's begin our crack with the oldest copy of Paint Shop Pro i
  50. could find: I want to stress that knowledge of history is very
  51. important (there should be a faculty of "software history" in all
  52. great universities, there will be of course one in my +HCU).
  53. I'll use the old SHAREWARE version 2.01, whose file PSP.EXE has
  54. a length of 525520 bytes and is dated 15 november 1993.
  55. Just to make a comparison, version 3.0 has a PSP.EXE file of
  56. 861856 bytes, and is dated 4 march 1995, version 3.12-32 (Win31)
  57. has a PSP.EXE length of 1.042.944 bytes, and is dated 27 december
  58. 1995 and version 4.1 for windows 95 has a PSP.EXE with much too
  59. many bytes which is dated 1 september 1996: a classical example
  60. of overbloated programming language involution.
  61. Version after version JASC incorporated added the "counter" that
  62. reminds you how many days you have been using this program,
  63. telling you to register it after 30 days. This nagscreen is by
  64. far and large not particularly annoying, JASC has been pretty
  65. correct (compared with other nagscreens used by less interesting
  66. but more preposterous software). Nevertheless we do not like
  67. nagscreens all the same, coz we want to enjoy all programs,
  68. commercial or not, without paying any money at all and without
  69. silly nagscreens or reminders of any sort (all sort of goods
  70. should be free in my opinion, not only software: I think I am a
  71. sort of "aristocratic communist": I believe that private property
  72. is a theft -of course- and that everybody should have -at least-
  73. a sail Yacht, good books, a lot of caviar and good Wodka-Martinis
  74. in crystal glasses without paying anything at all: all this
  75. should be completely free in order to allow each one to
  76. concentrate on interesting activities like wind watching, poetry,
  77. micro-ethology, study of the colours, cracking, ancient rhetoric
  78. et cetera).
  79. Anyway, in this old PSP, version 2.01, there was in the nagscreen
  80. no day counter yet ("you are on day xx of your 30 days..."), a
  81. "static" nagscreen, the whole program is still very "basic",
  82. nobody would have said, looking at this midget, that Jasc could
  83. have evolved this embryo of a program, in three years, in the de-
  84. facto standard graphic manipulation program that we know to day
  85. (december 1996).
  86. Let's crack: We fire our Winice (I will not explain any more why
  87. you should use Winice: buy (or codebar) a "real" copy of it or
  88. else find all three cracked copies, DOS, WIN31 and WIN95, on the
  89. Web. Then learn how to use it well: this tool is the alpha and
  90. omega of cracking... I am using for this lesson a Windows 3.1
  91. computer with my Winice for Windows 3.1, version 1.3, cracked by
  92. the ubiquitous Marquis de Soiree).
  93. We begin now, Winice lurks already behind Windows, Microsoft
  94. abomination has already been started, a cool breeze blows
  95. outside, I fire PSP 2.1.
  96. We'll use in this lesson a couple of different approaches to code
  97. pinpointing: you'll remember that we could have done our three
  98. steps basic approach, as usual (always working, but at times
  99. slower or more inaccurate than other approaches):
  100. 1)task
  101. 2)hwnd
  102. 3)bmsg relevant_window wm_gettext
  103. sequence of commands, as follows
  104. 1)
  105. :task
  106. TaskName    SS:SP   StTop StBot StLow TaskDB hQueue    Events
  107. PROGMAN   1727:200A 0936  2070  1426  066F   07F7      0000
  108. PSP     * 1D27:D826 9654  D9BE  D132  11EF   11D7      0000
  109.  
  110. 2)
  111. :hwnd psp
  112. Window Handle  hQueue    QOwner Class Name   Window Procedure
  113. 0EB4(0)        11D7      PSP    #32769       04A7:9E6B
  114.  25B8(1)       11D7      PSP    Histogram    1197:07E8
  115.  2090(1)       11D7      PSP    #32770       1D07:120E
  116.   20F0(2)      11D7      PSP    Static       1D07:38A6
  117.   2138(2)      11D7      PSP    Static       1D07:38A6
  118.   2180(2)      11D7      PSP    Static       1D07:38A6
  119.   21D8(2)      11D7      PSP    Static       1D07:38A6
  120.   2230(2)      11D7      PSP    Static       1D07:38A6
  121.   2298(2)      11D7      PSP    Static       1D07:38A6
  122.   22F0(2)      11D7      PSP    Button       1D07:2876
  123.   2344(2)      11D7      PSP    Button       1D07:2876
  124.   2398(2)      11D7      PSP    Static       1D07:38A6
  125.   23F0(2)      11D7      PSP    Static       1D07:38A6
  126.   2448(2)      11D7      PSP    Static       1D07:38A6
  127.   24A0(2)      11D7      PSP    Static       1D07:38A6
  128. ... (and more handles, the segment numbers may obviously differ
  129. from yours)
  130.  
  131. Since the two "buttons" are the OK and CANCEL buttons inside the
  132. nag screen, we can immediately pinpoint the code with a
  133. 3)
  134. :bmsg 22F0 wm_gettext
  135.  
  136. command, which would fire back winice as soon as we click the OK
  137. button. You'll please also notice from the hwnd list above that
  138. the window #32770 has 6 small "text" windows inside and two
  139. buttons, that the window procedure for the main nag window is at
  140. 1D07:120E, the procedures for text are at 1D07:38A6 and the
  141. procedures for the buttons are at 1D07:2876.
  142.  
  143. We'll come back on this approach later. It's the typical
  144. pinpointing used for password protection schemes, as we have seen
  145. in the password lessons, but this approach is NOT the best one
  146. for nagscreens.
  147. Let's follow now another approach: let's find the nagstrings in
  148. the parts of PSP that contains DATA (as opposed to CODE), the
  149. :heap command will help us: it's the standard command to
  150. understand the STRUCTURE in memory of your deployed applications,
  151. you'll use it a lot for nagscreen cracking and for time limits
  152. deprotections.
  153.  
  154. :heap psp           ; we know from :task that the name is "PSP"
  155. Han./Sel       Address   Length    Owner     Type      Seg/Rsrc
  156. 1C37           00027980  00000040  PSP       Alloc
  157. 0876           000279C0  00000020  PSP       Resource  IconGrp
  158. 1FFE           806EC760  000010A0  PSP       Code      03
  159. 1BA6 LH        806B2000  0000E9E0  PSP       Data      90
  160. 2016           807CC340  00003C60  PSP       Code      01
  161. 200E           80774780  00002940  PSP       Code      02
  162. ... (many more handles)
  163.  
  164. As you can see doing your listing, there is only one data block,
  165. E9E0 bytes long, at 806B2000. Have a look at the code blocks,
  166. though, many of them, as you'll see, have a little "D" after the
  167. type CODE, as you'll use often and often this :heap command to
  168. crack protection schemes in the future, you may as well learn
  169. right now that these are (most of the time) uninteresting for
  170. cracking purposes.
  171.  
  172. If we now pinpoint this code with a bpr RW on part of the text
  173. that the nagscreen displays, we'll land in the middle of the
  174. routine that copies this text in various memory locations, each
  175. time PSP runs:
  176.  
  177. :bpr 30:806B2150 30:806B2170 RW
  178.  
  179. Let's start PSP once more and we'll land here inside winice:
  180. 011F:00007A1B  D1E9           SHR CX,1
  181. 011F:00007A1D  F366A5         REPZ MOVSD ;this writes in 806B1250
  182. 011F:00007A20  8BC8           MOV CX,AX
  183. 011F:00007A22  83E103         AND CX,+03
  184. 011F:00007A25  F3A4           REPZ MOVSB
  185.  
  186. Hope that my readers DO remember that REPZ is repeat string
  187. manipulation until cx=0 and that MOVSD moves strings by
  188. doublewords, from ds:si to es:di, updating si and di.
  189. We are here in the piece of the main windows KERNEL module,
  190. responsible for setting up this part of PSP.
  191. Now things start getting interesting: if you make a search for
  192. the string 'freeware' (contained in the nagscreen of PSP) before
  193. loading psp you'll get as location only the echoes of your own
  194. search string:
  195. :s 30:0 lffffffff 'freeware'
  196. Pattern found at 0030:007DBA58
  197.                  0030:008E107F
  198.                  0030:008E1867
  199.                  0030:008E601A
  200. If you search the same string after the KERNEL's has finished
  201. copying around PSP code (as we saw above) you'll fetch quite a
  202. lot of locations:
  203. :s 30:0 lffffffff 'freeware'
  204. Pattern found at 0030:0066242D
  205.                  0030:007DBA58  ;echo
  206.                  0030:007DBFCA
  207.                  0030:008E107F  ;echo
  208.                  0030:008E12A8
  209.                  0030:008E1867  ;echo
  210.                  0030:008E601A  ;echo
  211.                  0030:009EDF4D
  212.                  0030:806A4F4D
  213.  
  214. The last one is the more interesting one, being above 80000000.
  215. But, hey, how comes that the 'freeware' text occurrence at
  216. 30:806B2170 (the one we breakpointed into) has not been found?
  217. It's an interesting point, and you could now obviously bpr RW all
  218. the relevant locations to trace backward to the "culprit" code
  219. section of PSP, the one setting up the nagscreen that we want to
  220. eliminate.
  221.  
  222. But we'll now leave even this second approach and follow a third
  223. and better one for nagscreen deprotection: the "stack_crack"
  224. technique (I want to show you the MANY possibilities that we have
  225. for cracking these programs.
  226.  
  227. As everybody (should) know, every time a child window (or a pop-
  228. up window) is created, the function that must be invoked is
  229. HWND CreateWindow, which is called by virtually all windows
  230. programs. This function specifies the window's class, title and
  231. style, and may also determine the window's initial screen
  232. location and size. This function returns the handle to the newly
  233. created window. It's a general purpose API function with this
  234. structure:
  235. HWND CreateWindow(LPCSTR lpszClassName, LPCSTR lpszWindowName,
  236.                   DWORD dwStyle, int iX, int iY, int iWidth,
  237.                   int iHeight, HWND hPArent, HMENU hMenu,
  238.                   HINSTANCE hINst, void FAR *lpvData)
  239. And, for those of you that do not know nothing, lpszClassNAme
  240. points to a character string naming the window's class and
  241. lpszWindowName points to a character string identifying the
  242. window by name, which is pretty useful for us little crackers...
  243. you should study a little this kind of stuff, just to make an
  244. example, do you know that EDIT Class control style ES_PASSWORD
  245. displays all typed characters as asterisk symbols? (Whereby
  246. setting EM_SETPASSWORDCHAR to zero will print the password echo
  247. on the display, but this is stuff for another lesson :=)
  248.  
  249. Let's work with the breakpoint on the CreateWindow function we
  250. have seen above, obviously, now that you know all the parameters,
  251. you could as well change the position of the nagscreen (iX, iY,
  252. iWidth...) instead of removing it.
  253. :bpx CreateWindow
  254. And now let's fire PSP, look at the screen! We pop in winice 5
  255. times before the relevant moment (i.e. just before the
  256. nagscreen). Therefore we change our breakpoint, setting the
  257. occurrence "6" for the counter:
  258. :bpx USER!CREATEWINDOW C=06
  259. Now we fire PSP once more and this time we look at the stack as
  260. soon as we pop inside Winice, because we know that the last
  261. CreateWindow has created the nagscreen and we want to know where
  262. is the "culprit" section of PSP code:
  263. :stack
  264. PSP(05) at 1EF7:00AF [?] through 1EF7:00AF
  265. PSP(05) at 1EF7:1094 [?] through 1EF7:1076
  266. PSP(01) at 1F3F:0598 [?] through 1F3F:0000
  267. PSP(8A) at 1F0F:0024 [?] through 1F0F:0000
  268. USER(19) at 073F:099B [?] through USER!DIALOGBOX
  269. USER(19) at 073F:0A31 [?] through 073F:09A3
  270. USER(19) at 073F:07FC [?] through 073F:0737
  271. PSP(01) at 1F3F:0BC0 [?] through 1F3F:0BC0
  272. PSP(02) at 1F2F:0DF7 [?] through 1F2F:0000
  273. => USER!CREATEWINDOW at 06B7:0F1B [?] through 1EBF:0052
  274.  
  275. That's nice music for us! Let's have a deep look at these pretty
  276. data: See! The last CreateWindow occurrence is called by Segment
  277. 02 of the PSP code (you remember the :heap PSP command listing,
  278. we made for the first approach, if not do it now: the heap
  279. listing will show you the complete structure in memory of your
  280. target)...
  281.  
  282. and yes, let's have a look at segment 2, the locations around
  283. DF7: here the relevant section of code:
  284. 1F2F:00000DEB  90             NOP
  285. 1F2F:00000DEC  687A70         PUSH 707A
  286. 1F2F:00000DEF  FF36068F       PUSH WORD PTR [8F06]
  287. 1F2F:00000DF3  FF36FC70       PUSH WORD PTR [70FC]
  288. 1F2F:00000DF7  9A5200BF1E     CALL 1EBF:0052 ;call the bazaar
  289.  
  290. Following this last call, we land in the USER(19) code section
  291. of windows USER module, which sets up a child window (in this
  292. case the nag screen) and then waits for user's mouse clicks.
  293.  
  294. 073F:0000083E  56             PUSH SI
  295. 073F:0000083F  6A01           PUSH 01
  296. 073F:00000841  9AF20BE706     CALL 06E7:0BF2 ;makes the nagframe
  297. 073F:00000846  56             PUSH SI
  298. 073F:00000847  9A0444A704     CALL 04A7:4404 ;writes the nagtext
  299. 073F:0000084C  3936E200       CMP  [00E2],SI
  300.  
  301. But USER should obviously not be cracked (well, you could, but
  302. not here... see the lesson about windows "guts": KERNEL, USER and
  303. GDI and the possibilities you get cracking them directly), but
  304. here our culprit protection scheme must of course dwell inside
  305. the PSP code... therefore let's now have another look at the task
  306. list we found breakpointing on CreateWindow.
  307. All the three user(19) codes are USER module's routines, let's
  308. see... where should we cut mustard with our crack? Obviously
  309. BEFORE the call to USER(19), also either in PSP(8A), or in
  310. PSP(01) or in PSP(05).
  311. Three possibilities:
  312. 1) Study a disassembled listing.
  313. A nice disassembly listing can be very helpful for our cracks
  314. (through good old WCB or through WDASM, cracked copies of all
  315. these nice disassemblers are on the Web). Useless an d tedious
  316. in this case.
  317. 2) Have a direct look.
  318. There are in this case only three sections of code, just have a
  319. look at them and find in which one triggers the protection.
  320. Useless an d tedious in this case.
  321.  
  322. 3) -Always better- use a little zen.
  323. Relax, sip a Martini-Wodka (be careful: only Moskowskaja will do,
  324. do not exceed the correct amount of Schweppes' indian tonic) and
  325. look once more at the :heap PSP listing. See? Segment 8A of PSP
  326. code is only A0 bytes long, therefore pretty unlikely to yield
  327. a protection scheme.
  328. That leaves segments 05 and 01.
  329. Segment 05 does not have enough "run" to hyde a protection scheme
  330. (yes, this is zen): as you can recall from our stack listing, the
  331. two occurrence of segment 05 have only a zero run (AF-AF) or a
  332. very short one (76-94).
  333. See? Out of the three sections we started with remains only one:
  334. code section 01, which is 3C60 bytes long, has sufficient "run"
  335. (0-598) and will therefore -for sure- hide inside the protection
  336. scheme. Well, 3C60 bytes is quite a long piece of code to examine
  337. (even if we started with more than half a million bytes in the
  338. first place)... but we do not need to look much around, the
  339. protection will be not far away from our call (for reasons I'll
  340. not delve inside here... remember lesson C3 ?). We'll have a look
  341. at fifty bytes, and having to sieve less than 100 bytes do not
  342. seem to me to represent an unreasonable amount of work in order
  343. to eliminate a nagscreen, nicht wahr?
  344. Let's have a look at the code in segment 1, examining -say- 50
  345. bytes around the locations at segment PSP(01), all info we found
  346. using Winice's :heap command:
  347.           ...
  348.           PSP(01) at 1F3F:0598 [?] through 1F97:0000
  349.           ...
  350. Here the code -through Winice- with my comments:
  351. 1F3F:0000056D  0BC0           OR   AX,AX      ;conditional
  352. 1F3F:0000056F  740D           JZ   057E       ;jump, if not
  353. 1F3F:00000571  9AA802BF10     CALL 10BF:02A8  ;this chooses
  354. 1F3F:00000576  50             PUSH AX         ;the hWnd which
  355. 1F3F:00000577  6A04           PUSH 04         ;04=activates
  356. 1F3F:00000579  9A3E10E706     CALL USER!SHOWWINDOW ;herein
  357. 1F3F:0000057E  A1FC70         MOV  AX, [70FC] ;now load AX
  358. 1F3F:00000581  A30C6F         MOV  [6F0C],AX  ;save a copy
  359. 1F3F:00000584  C706FC700000   MOV  WORD PTR [70FC],0000 ;clean
  360. 1F3F:0000058A  682711         PUSH 1127       ;and load the other
  361. 1F3F:0000058D  686601         PUSH 0166       ;parameters for the
  362. 1F3F:00000590  686B0A         PUSH 0A6B       ;call, which are
  363. 1F3F:00000593  FF36068F       PUSH WORD PTR [70FC] ;all pushed
  364. 1F3F:00000597  50             PUSH AX         ;on the stack for
  365. 1F3F:00000598  9A00005F11     CALL 115F:0000  ;this final call
  366. 1F3F:0000059D  83C40A         ADD  SP,+0A     ;Now it's
  367. 1F3F:000005A0  0BC0           OR   AX,AX      ;finished
  368.  
  369. Well, what do we have here? We have the whole nagscreen procedure
  370. at a glance: The call to USER!SHOWWINDOW is a BOOL ShowWindow
  371. (HWND hWnd, int iVisFlag) function, which determines the
  372. specified window's visibility state. hWnd is the handle of the
  373. window and iVisFlag determines how the window is shown.
  374. This function returns true if the window is already visible,
  375. false if the window was hidden. iVisFlag can be one of
  376. the SW_ constants, number 4 is activate and display.
  377. The program fetches at the previous call the AX parameter and
  378. then calls the routine that prepares the nagscreen.
  379. OK, we found it (was pretty easy, as you saw). Now, how do we
  380. crack this? There are one hundred thousand ways (an elegant one
  381. would be changing the iVisFlag option).
  382. I would suggest something rock solid: putting a JNZ 059D at line
  383. 1F3F:0000056D, replacing the JZ 057E on a "two for two" bytes
  384. basis, a clean crack.
  385. And loo! It works flawlessly: we fly over the nagscreen.
  386. Here is the crack with good old symdeb... you may use symdeb but
  387. you may obviously use more "modern" hexeditors, like PSedit (good
  388. old DOS) or Hexworkshop (bloated Windows), you'll find everything
  389. on the Web:
  390. *** cracking PSP 2.1 nagscreen *** by +ORC *** dec 1996 ***
  391. ren psp.exe psp.ded      ;need a "dead" copy for old symdeb
  392. symdeb psp.ded           ;good old symdeb launched
  393. - s (cs+0000):0 Lffff 0B C0 74 0D 9A ;search 1F3F:0000056D etc
  394. xxxx:yyyy                            ;result from debug
  395. - e xxxx:yyyy+2 75                   ;change JZ in JNZ
  396. - e xxxx:yyyy+3 2C                   ;jump after final call
  397. - w                                  ;write back our changes
  398. - q                                  ;bye symdeb
  399. ren psp.ded psp.exe                  ;ok, cracked, restore exe
  400. ***** see how easy? ******************************************
  401.  
  402. But we are not finished yet! Let's now come to the real content
  403. of this lesson: how you should apply what you have learned on an
  404. OLDER copy of the target software to the newer versions of it.
  405. We'll crack now PSP, version 3.0, where the psp.exe file is
  406. 861.856 bytes long, this copy dates 4 march 1995, 2 *YEARS* after
  407. the older one, it's a newer and improved program, with a lot of
  408. functionality.
  409. Now, you would think that we must start anew, breakpointing with
  410. a :bpx CreateWindow C=07 (in this case) command? No. They changed
  411. a little the routines (here you would be advised to use a :bpx
  412. ShowWindow breakpoint following the same approach). The new
  413. nagscreen has been coupled with a daycounter, that reminds your
  414. guilty as the days goes by, but the nagscreen schema has not
  415. changed much: it has been hidden this time in Segment PSP30(07),
  416. and you would find it -of course- following the abovementioned
  417. approach, but what's the point? there is a much quicker way!
  418. I'll never repeat it enough: PROTECTIONISTS ARE STUPID! As usual
  419. with people working for money instead than for pleasure, their
  420. capacity is severely limited, one of the ugly consequences of the
  421. abominable society we are coerced to live in. This overvbloated
  422. monstrosity, PSP30, is nagscreened with the SAME simple schema
  423. used in the older versions, therefore you just search and modify
  424. it using the SAME patterns (and in the same way) as before!
  425. We'll use now PSEDIT in order to modify this file, symdeb.com is
  426. a good tool, but has memory problems when the programs exceed
  427. 600.000 bytes (at the times symdeb was made people knew how to
  428. code in assembler and nobody would have ever thought that you
  429. needed so much to perform so little).
  430. **** Cracking PSP version 3.0, by +ORC *** December 1996
  431. ren psp.exe psp.ded ;always good, even if psedit does not care
  432. psedit psp.ded      ;fire your tool
  433. - use F8 (search) to search for hexstring 0BC0740D9A
  434. You'll find three occurrences of it. Looking at the code you'll
  435. immediately realize that the only good one is the third one. Just
  436. modify the JZ 0D sequence in a JNZ 2D sequence (yes one byte more
  437. than in the previous crack, look at the code) and you'll have
  438. done your crack.
  439. F2                  ;quit PSEDIT
  440. ren psp.ded psp.exe ;restore exe
  441. **************** pretty easy, wasn't it? ***********************
  442.  
  443. A little digression: Why do we search for the hexstring
  444.                           0BC0740D9A
  445. and not for a longer string? You may think that a longer search
  446. string would have immediatly given us the correct location, and
  447. you may see no point in using a shorter string, which may
  448. obviously give us many more useless hits. You would be dead
  449. wrong: one byte more (after 9A) and you would not fetch anything
  450. at all!
  451. The problem, for those of you that do not know nothing, is that
  452. same hexcodes are RELOCATED each time an EXE program compiles in
  453. memory (this was true for DOS, for windows there is a real
  454. relocation galore going on behind the scene, one wonders at times
  455. that windows get something accomplished at all, given the huge
  456. amount of relocations that this overbloated pseudo-OS pushes
  457. around.
  458. Choosing a search hexstring you must always be *very* careful:
  459. choose search patterns that DO NOT relocate in memory, like OR
  460. AX,AX, JZ fixed length, ADD SP,+0C, JL fixed length and so on.
  461. Your searches for hexstrings that do relocate will not harvest
  462. anything at all. Never. HAve a good look at the following code
  463. examples, you'll recognize immediately that only the third (and
  464. last) occurrence of our search string is the correct one: it is
  465. the only one that shows "later on" shows the correct instruction
  466. sequence (the later three moves and five PUSHES we have seen in
  467. the listing for PSP 2.1 above).
  468. Let's have a look at the three occurrences of our search string
  469. inside PSP30:
  470. Occurrence 1 of search string 0BC0740D9A inside PSP30:
  471. 1CEF:0000B8E3  0BC0           OR   AX,AX ;checks previous call
  472. 1CEF:0000B8E5  740D           JZ   B8F4  ;it's zero, forget show
  473. 1CEF:0000B8E7  9AE413671C     CALL 1C67:13E4 ;new call to fetch
  474. 1CEF:0000B8EC  50             PUSH AX    ;the hWnd for show
  475. 1CEF:0000B8ED  6A04           PUSH 04    ;activate
  476. 1CEF:0000B8EF  9A3E10E706     CALL USER!SHOWWINDOW ;herein
  477. 1CEF:0000B8F4  FF363E46       PUSH WORD PTR [46E3] ;fetch hWnd
  478. 1CEF:0000B8F8  9A2D19A704     CALL USER!ISICONIC   ;is iconic?
  479. 1CEF:0000B8FD  0BC0           OR   AX,AX     ;check if zero
  480. 1CEF:0000B8FF  7537           JNZ  B938      ;it's iconic!
  481. Here you see that after our search string "0BC0740D9A" follows
  482. a "E4" byte.
  483. The function "IsIconic" has nothing to do with our protection
  484. scheme. This function returns non zero if the specified windows
  485. (pointer at location 46E3) is displayed in its iconic form, zero
  486. if it is not. Well it's definitely NOT our protection scheme: we
  487. should find (at least) three MOV instructions and four PUSHES
  488. instructions (see PSP21) after our call to SHOWWINDOW, and our
  489. protection scheme has nothing to do with any call to ISICONIC.
  490.  
  491. Let's have a look at occurrence 2 of our search string inside the
  492. code of our PSP30 target:
  493. Occurrence 2 of search string 0BC0740D9A:
  494. 1CEF:0000B927  0BC0           OR   AX,AX ;checks previous call
  495. 1CEF:0000B929  740D           JZ   B938  ;it's zero, forget show
  496. 1CEF:0000B92B  9A5817A71C     CALL 1CA7:1754 ;new call to fetch
  497. 1CEF:0000B930  50             PUSH AX    ;the hWnd for show
  498. 1CEF:0000B931  6A04           PUSH 04    ;activate
  499. 1CEF:0000B933  9A3E10E706     CALL USER!SHOWWINDOW ;herein
  500. 1CEF:0000B938  FF363E46       PUSH WORD PTR [46E3] ;fetch hWnd
  501. 1CEF:0000B93C  9A2D19A704     CALL USER!ISICONIC   ;is iconic?
  502. 1CEF:0000B941  0BC0           OR   AX,AX     ;check if zero
  503. 1CEF:0000B943  7537           JNZ  B97C      ;it's iconic!
  504. Well, hey, no, we are not yet there... this is just a "mirror"
  505. of the previous occurrence one! That means a complete repetition
  506. of the same code of occurrence one... tehrefore the same as above
  507. yelds true: it is not yet our protection scheme. Here you see
  508. that after our search string "0BC0740D9A" follows a "58" byte.
  509.  
  510. Let's see the third (and last) occurrence of our search string:
  511. 1CEF:0000B96B  0BC0           OR   AX,AX ;checks previous call
  512. 1CEF:0000B96D  740D           JZ   B97C  ;it's zero, forget show
  513. 1CEF:0000B96F  9A1E958F1C     CALL 1C8F:951E ;new call to fetch
  514. 1CEF:0000B974  50             PUSH AX    ;the hWnd for show
  515. 1CEF:0000B975  6A04           PUSH 04    ;activate
  516. 1CEF:0000B977  9A3E10E706     CALL USER!SHOWWINDOW ;herein
  517. 1CEF:0000B97C  A13E46         MOV  AX,[463E]
  518. 1CEF:0000B97F  A33A3C         MOV  [3C3A],AX
  519. 1CEF:0000B982  C7063E460000   MOV  WORD PTR [46E3],0000
  520. 1CEF:0000B988  68EF1C         PUSH 1CEF
  521. 1CEF:0000B98B  687C21         PUSH 217C
  522. 1CEF:0000B98E  1E             PUSH DS
  523. 1CEF:0000B98F  680217         PUSH 1702
  524. 1CEF:0000B992  FF36105C       PUSH WORD PTR [5C10]
  525. 1CEF:0000B996  50             PUSH AX
  526. 1CEF:0000B997  9AA401271D     CALL 1D27:01A4 ;final call
  527. 1CEF:0000B99C  83C40C         ADD  SP, +0C ;resume
  528. Here we are! This is obviously our protection scheme, see the
  529. analogies (almost identities) with the older PSP21 nagscreen
  530. protection we found and cracked above! In this third occurrence
  531. you see that after our search string "0BC0740D9A" follows a "1E"
  532. byte.
  533. To defeat this protection along the same line of our previous
  534. PSP21 crack, we could jump -here- to the 1CEF:0000B99C (resume
  535. after final call) instruction, modifying the instruction at
  536. 1CEF:0000B96D (740D JZ B97C) -exactly as we did in PSP20- to a
  537. nice JNZ B99C 75 2D (that's the distance between the location of
  538. this very JNZ instruction and the location where you want to
  539. jump, coz b99C-(b96D+2) = 2D. This crack requires a byte more (2D
  540. instead of 2C) than in PSP21 to fly over the nagscreen calls, coz
  541. an extra PUSH DS has been added inside this version's nagscreen
  542. protection scheme (a reason more to be careful with "longer"
  543. search strings: if you fetch too many occurences with a short
  544. search string you just "cross check" the same occurrences with
  545. another short search string from a later prortion of the code you
  546. are trying to individuate: write a short program to do it
  547. automatically for you: the best cracking tools, remember, are the
  548. tools that you write yourself).
  549. A last word, should you be interested in the "final call" of this
  550. nagscreen scheme: it's a routine (here inside module PSP30(04)
  551. which calls the two functions KERNEL!MAKEPROCINSTANCE (which must
  552. be called for 16 bits Windows in order to effectuate a call to
  553. Dialogbox) and USER!DIALOGBOX, which is (de facto) the nagscreen
  554. itself.
  555.  
  556. Now let's go over to the last version of PAint Shop Pro for
  557. Windows 3.1 I know of: PSP.EXE version 3.12-32, length: 1.042.944
  558. bytes, 27 december 1995.
  559. Let's bpx on CreateWindow and let's see... We fire PSP and we pop
  560. inside Winice at the *only* occurrence of CreateWindow... MMM!
  561. Something fishy here? When you proceed as above you get only one
  562. break in Winice on bpx CreateWindow, and no stack at all, just
  563. the CreateWindow call! You do not get no heap segments for PSP32
  564. either... how comez?
  565. The fact is, that in order to crack Win32 applications like this
  566. one, we must move over to Winice95, coz Winice for Win3.1 has its
  567. limits. You'll of course find Winice 95 on the Web, there are
  568. always cracked copies roaming around, the best pages offer some
  569. links to them, you should learn HOW TO SEARCH. You'll find
  570. everything on the web for free, as a matter of fact. It's amazing
  571. HOW MUCH you can get from internet, and this could make the Web
  572. potentially dangerous from a "human-social" point of view... how
  573. will we keep social and human contacts if we roam around so much
  574. without ever touching each other? A good idea in order to
  575. re-establish somehow our "humanity" "contact" balance is to seek
  576. physical contact not only with your loved one (which is always
  577. very good) but also with many other human beings: I have for
  578. instance three massage sessions every week with my masseuse,
  579. which is half my age but strong enough to cure my rheumatisms...
  580. just to make another example, I enjoy very much all restaurants
  581. which have the so called "tables d'hote" i.e. where everybody
  582. sits together at a couple of long tables, me, my wife and my kids
  583. exchanging views and opinions with other people, people you never
  584. saw before and will probably never see again, drinking excellent
  585. wines, instead of sitting grimly on the petty, bourgeois, "4
  586. chairs" little tables for stupid greedy families that abound
  587. inside "normal" restaurants... (I'll not ever mention the "fast
  588. food" abominations: I am definitely in favour of "slow food" and
  589. believe McDonald should be hanged for what he has done -in the
  590. whole world- to 4000 years of gorgeous gastronomical
  591. traditions... what's the point of eating quickly (and badly),
  592. unless you are a slave of your time?)... enough: You could crack
  593. Win32 applications even using Winice for Windows 3.1 though,
  594. albeit slowly... you would have to go through Winice's VxD
  595. command, and need a little zen and a deep understanding of
  596. virtual memory management in Windows. Anyway, there is no point
  597. in using wrong tools. Should you however try to crack Win32
  598. applications with Winice 3.1, have a look first of all at the
  599. modules inside windows as soon as winice pops up, using Winice's
  600. command :mod...
  601. there you'll find the
  602. hmod=1C3F W32SCXXXX      D:\PSP\PSP.EXE
  603. Now :heap w32sxxxx in order to get the heap segments you need to
  604. start your crack with.
  605. However, as I said, we better crack applications like this one
  606. using Winice for Windows 95 and we'll see together -in the next
  607. lesson- that the nagscreen of the 3.12-32 version AND the one
  608. in the Windows 95 "4.1" version (the last one I know of) can both
  609. be cracked pretty quickly on the same line as the previous ones.
  610. We will also see that the nagscreen mechanism -believe it or not-
  611. is more or less always the same. The protectionists added a
  612. "delayed" OK button focus and mixed some "alien" (but useful)
  613. routines in-between. This said, it's still always the same soup,
  614. as usual with nagscreens and mercantile programmers.
  615.  
  616. Well, that's it for this lesson, reader. Not all lessons of my
  617. tutorial are or will be on the Web.
  618.      You 'll obtain the missing lessons IF AND ONLY IF you mail
  619. me back (via anon.penet.fi) with some tricks of the trade I may
  620. not know that YOU discovered. Mostly I'll actually know them
  621. already, but if they are really new you'll be given full credit,
  622. and even if they are not, should I judge that you "rediscovered"
  623. them with your work, or that you actually did good work on them,
  624. I'll send you the remaining lessons nevertheless. Your
  625. suggestions and critics on the whole crap I wrote are also
  626. welcomed. Do not annoy me with requests for warez, everything is
  627. on the Web, learn how to search, for goddam sake.
  628.  
  629.      "If you give a man a crack he'll be hungry again
  630.      tomorrow, but if you teach him how to crack, he'll
  631.      never be hungry again"
  632.  
  633.                                 E-mail +ORC
  634.  
  635.                         +ORC na526164@anon.penet.fi
  636.  
  637. 
  638.