home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Aptteam / cours / Api.txt < prev    next >
Text File  |  2000-05-25  |  7KB  |  253 lines

  1.  
  2.  
  3. /******************************************************\
  4.  
  5.   HCU NOTES: 
  6.  
  7.        Below is a nice handly little guide that answers the question:
  8.         'What can I breakpoint on in softice to find what I want?'
  9.  
  10.        It was originally a decent win32 guide, but I have modified it
  11.        quite alot since I originally received it.
  12.  
  13.        Credit goes to the original author for the easy to follow format
  14.        though it pains me to say i do not have a clue who it was who sent 
  15.        me the original listing.
  16.  
  17.   NEW USER NOTES: 
  18.  
  19.      (Yes I get these questions alot, so here I answer them)
  20.    
  21.      To use these api, just flip into SoftICE and BPX MessageBoxA
  22.      (or any other call you want to bpx on)
  23.  
  24.      THE ONES WITH 'A' AT THE END ARE 32-BIT CALLS, 
  25.      so you will need to make sure that your WINICE.DAT file has been 
  26.      modified to EXPORT the proper symbol files (in softice for '95 of course 
  27.      since NT-ice uses 32 bit rather than the 16 bit calls you will need for many apps)
  28.  
  29.      Being redundant in case this file has been separated from the website,
  30.      your winice.dat file is in your softice'95 directory with the executable
  31.      (look in your autoexec.bat file for the location of WINICE.EXE if you
  32.      have forgotten it's install location)
  33.  
  34.                    EDITING WINICE.DAT TO INCLUDE 32-BIT CALLS
  35.  
  36.      REMOVE THE SEMICOLONS to uncomment the particular ones you need,
  37.  
  38.           Use THESE for now:    (see ED!SON's tutorial for more info)
  39.  
  40.           gdi32.dll           
  41.           kernel32.dll 
  42.           user32.dll    
  43.  
  44.   WELL - without anymore boring taglines, here it is...
  45.  
  46.      +gthorne'97
  47.  
  48. \******************************************************/
  49.  
  50. The Cracker's Guide of Common Win32 API Calls
  51. ---------------------------------------------
  52.           
  53. Reading & Writing Files
  54. -----------------------
  55. These are generic calls to read/write to a file, usually binary in nature:
  56.  
  57. ReadFile
  58. WriteFile
  59.  
  60.      more on locating file accesses:
  61.  
  62. SetFilePointer
  63.  
  64. GetSystemDirectory
  65. GetSystemDirectoryA
  66.  
  67. These are the most common calls to read/write from/to a *.ini file
  68. or a file of similar format.
  69.  
  70.  for 16-bit win apps:
  71.  
  72. GetPrivateProfileString
  73. GetPrivateProfileInt
  74. WritePrivateProfileString
  75. WritePrivateProfileInt
  76.  
  77.   for 32-bit win apps:
  78.  
  79. GetPrivateProfileStringA
  80. GetPrivateProfileIntA
  81. WritePrivateProfileStringA   
  82. WritePrivateProfileIntA
  83.  
  84. Interrupt info:
  85. _____________
  86.  
  87. file accesses (A couple by YOSHi)
  88.  
  89.    bpint 21 if (ah==3d)
  90.    bpint 2f if (ah==01)
  91.  
  92. The Registry
  93. ------------
  94. Create or delete a new key in the registry:
  95.  
  96. RegCreateKey
  97. RegDeleteKey 
  98.  
  99. RegCreateKeyA
  100. RegDeleteKeyA 
  101.  
  102.  
  103.      Read a value from the currently open registry key:
  104.  
  105. RegQueryValue
  106. RegQueryValueA
  107.  
  108.  
  109.      Open or close a registry key:
  110.  
  111. RegCloseKey
  112. RegOpenKey
  113.  
  114. RegCloseKeyA
  115. RegOpenKeyA    
  116.  
  117.  
  118.  
  119. Dialog Boxes
  120. ------------
  121. Get text or integer from a dialog box edit:
  122.  
  123. GetWindowText
  124. GetDlgItemText
  125.  
  126. GetWindowTextA
  127. GetDlgItemTextA
  128.  
  129. GetDlgItemInt    
  130.  
  131.  
  132. Open a message box, usually one that says "invalid registration":
  133.  
  134. MessageBox
  135. MessageBoxA
  136. MessageBoxExA
  137. MessageBeep   
  138.  
  139. and other ways to display text...
  140.  
  141. SENDMESSAGE
  142. WSPRINTF
  143.  
  144. Time & Date
  145. -----------
  146. These get the time and date
  147.  
  148. GetSystemTime
  149. GetLocalTime 
  150.  
  151. SystemTimeToFileTime
  152.  
  153.  
  154.  
  155. Generating a Window
  156. ---------------------
  157.  
  158. createwindow
  159. createwindowexa
  160. showwindow
  161.  
  162. bitblt (a type of memory move, similar to hmemcpy)
  163.  
  164. CD-ROM Calls (Donated by: +-=Riddler=-+)
  165. ----------------
  166.  
  167. GetDriveType      (if eax=5 then it is a cdrom check)
  168. GetDriveTypeA
  169.  
  170.      GetDriveType Return Function codes:
  171.  
  172.      Value               Meaning
  173.      0                 Drive Cannot Be determined
  174.      1                 Root Dir Does not exist
  175.      2                 DriveRemoveable
  176.      3                 A Fixed Disk (HardDrive)  
  177.      4                 Remote Drive(Network)
  178.      5                 Cd-Rom Drive
  179.      6                 RamDisk
  180.  
  181. GetLogicalDrives
  182. GetLogicalDrivesA
  183.  
  184. GetLogicalDriveStrings
  185. GetLogicalDriveStringsA
  186.  
  187. OTHER CDROM INFORMATION
  188. -----------------------
  189.  
  190. interrupt 2f is the mscdex interrupt
  191.  
  192.      bpint 2f, al=0  ah=15 checks if mscdex installed  
  193.  
  194.      try breaking on file accesses as well
  195.  
  196. Window Numerical Inputs
  197. ----------------------------
  198.  
  199. GETWINDOWWORD
  200. GETWINDOWLONG
  201.  
  202. Some other nice breakpoints from the ORC
  203. -----------------------------------------------
  204.  
  205. BOZOSLIVEHERE
  206. HMEMCPY
  207. GLOBALGETATOMNAME
  208.  
  209. message breaks, not quite the same but completely useful
  210. -----------------------------------------------------------
  211.  
  212. BMSG xxxx WM_GETTEXT   (good for passwords)
  213. BMSG xxxx WM_COMMAND   (good fro OK buttons)
  214.  
  215. the xxxx is of course the hwnd value, but important info:
  216.  
  217. assuming you are using wm_command to try to locate the button push,
  218. you hwnd the result and see the hwnd of the button is 0324 and the 
  219. hwnd of the window is 0129
  220.  
  221. to find the button, use the window value, not the button value to bmsg on
  222. (the other just won't work)
  223.  
  224. so for the example here, to find our button push we would
  225.  
  226. BMSG 0129 WM_COMMAND
  227.  
  228. Note *from the original author*
  229. ------------------------------
  230. These aren't the only win32 api calls you need to know in order to crack windows.There are many many more that programs will use, many are derivatives of these calls.  
  231. Try substituting a W for the A at the end of some calls, or placingan Ex right before the A. Also, in SoftIce, typing 'EXP GETPRIVATEPROFILE'will give you a list of all of the procs to read from .ini files, and thereare more than the ones i have listed.  
  232.  
  233. - - -
  234.  
  235. The above statement referring to many many calls is actually an uderstatement
  236. Windows being as overbloated a mess of code as it is, the lists of calls is rather insane.
  237.  
  238. in one of my OrcPaks, i released a list of wm_* calls 
  239.    (shamelessly grep'ped from the windows header files)
  240. and if you have seen the DOS interrupt files as well, you have only seen the tip of the iceberg.
  241.  
  242. At one point I found it useful to go through the intlist and make a file full of all references
  243. to CD-ROM and MSCDEX calls alone (why do I mention these DOS interrupts in this file? SIMPLE:
  244. 16-bit windows - which many programs still are written in and use today use mostly DOS calls to
  245. handle protection schemes - like file times, etc... but that is another file ;)
  246.  
  247.    +gthorne'97
  248.  
  249. ps - anything you think I should have added but left out?
  250.  
  251.  let me know - i am always open to suggestions
  252.  
  253.