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

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