Delphi code snippets

  1. [SNIPPET] Add PE Exports
  2. [SNIPPET] GetDNS
  3. [SRC] Aphex & Poke Sources
  4. [SNIPPET] uRunPE by steve2010 work in all os
  5. [SNIPPET] FixEOF by steve10120
  6. [SNIPPET] Read/Write in EOF by Xash
  7. [UNIT] Compress unit
  8. [SNIPPET] uReAlignPE by Steve10120  
  9. [SNIPPET] uStripRelocs by steve10120
  10. [SNIPPET] RC4 Encryption
  11. [SNIPPET] IsValidPe by Xash
  12. [SNIPPET] uEncryption (XOr, RC4, RCX)
  13. [SNIPPET] uDiffieHellman
  14. [UNIT] Generator for dynamic loading unit
  15. [SRC] Directory Cleaner
  16. [SNIPPET] Small CRC32 example
  17. [SRC] spy-net rat source
  18. [SRC]APSearch v0.2
  19. [SNIPPET] Firefox DLL Injector
  20. [SNIPPET] Using Windows Print Spooler To Run Your File
  21. [SNIPPET] [WARNING] Corrupt MBR
  22. [SNIPPET] FWB through modification of PEB
  23. [SRC] Cammy v2.0.0.4 Source
  24. [UNIT] uGenUtils - General Delphi Unit.
  25. [SNIPPET] FormatFileSize - Small Function
  26. [SRC] Web Downloader Generator (just an example to generate semi unique web dl)
  27. [SNIPPET] Anti Comodo Online SandBox (Ported from haZl0oh VB6 code)
  28. [SNIPPET] Anti Norman Online SandBox (Ported from haZl0oh VB6 code)
  29. [SRC] DDoSeR 3.0 Source
  30. [SRC] rSpy Source
  31. [SRC] Metus 2.8
  32. [SRC] Tree View File Manager by Protocol
  33. [SRC] Kims 0.1 Source
  34. [SNIPPET] Captcha Decrypt Example
  35. [SRC] Anti Nod32 via shellcode
  36. [SRC] Kims 1.2 Source
  37. [SRC] Multithreaded Client and Server
  38. [UNIT] uThread
  39. [UNIt] FileZilla Password Recovery Unit
  40. [UNTI] No-IP DUC Password Recovery Unit
  41. [UNIT] uList (TList and TThreadList)
  42. [UNIT] HTTP Flood Unit
  43. [SRC] rootkit example using ntquerysysteminformation and afxcodehook by sttwister
  44. [SNIPPET] storing settings in resources by sttwister
  45. [SNIPPET] Ancient Ciphers
  46. [SNIPPET] Revised - Self Injection Code
  47. [UNIT] Very Simple Startup Unit
  48. [SRC] Opensource Func-In Technique
  49. [SNIPPET] AntiVmWare
  50. [UNIT] Classes Win API Unit
  51. [SRC] Hide Process
  52. [SNIPPET] disable TerminateProcess in Task Manager
  53. [SNIPPET] how to get parent process name
  54. [SRC] Schwarze Sonne Undetecter
  55. [SNIPPET] DisableMsConfig
  56. [SRC] ExeLocker - Opensource PE Protector
  57. [SRC] Schwarze Sonne Code Cryper 0.3
  58. [SNIPPET] IsDebuggerPresent substitute
  59. [SNIPPET] Search & Search Wildcard
  60. [SNIPPET] Import Redirection
  61. [SNIPPET] VigenereExEncrypt
  62. [SRC] API GUI Encryptor
  63. [TUT] Create a chat application with indy
  64. [SRC] Import Rebuilder
  65. [SNIPPET] RandomString(With Options)
  66. [SRC] uAddNewSectionPE
  67. [SRC] uRunPeMod
  68. [SRC] Poison Ivy Crypter [1/16]
  69. [SCR]Drag and Drop Example
  70. [TUT] Edit Server Using Resources + Source Code
  71. [Snippet] NtCreateThreadEx
  72. [SRC] Simple Firewall
  73. [uProcessHelp]
  74. [SNIPPET] Armadillos Debug Blocker
  75. [SNIPPET] Another Server Building Technique
  76. [SNIPPET] Delphi Inline ASM GetProcAddress Api Replacement
  77. [SNIPPET] Delphi Torrent Seeder
  78. [SNIPPET] Melt File - Code Injection without CreateRemoteThread
  79. [SRC] Keylogger Source
  80. [SRC] Simple IrcBot Example
  81. [SNIPPET] Dirty example on how to change windows caption
  82. [SNIPPET] ] Blue screen of death
  83. [SNIPPET] pememexec
  84. [SRC] smokes crypter 1.2
  85. [UNIT] exe loader unit by spider
  86. [SNIPPET] StrLen short version
  87. [SNIPPET] Paltalk Decryption
  88. [SNIPPET] list pe exports
  89. [SNIPPET] Beyluxe Messenger Decryption
  90. [SRC] Thumbs.db Viewer
  91. [SNIPPET] Split Function
  92. [SNIPPET] uMultiMemPatch
  93. [SNIPPET] DLL Inject {CreateRemoteThread}
  94. [UNIT] ROT1 Encrypt Strings
  95. [SRC] Unknow Crypter
  96. [TUTORIAL] FakeProc Undetection by code
  97. [SNIPPET] Rename
  98. [SNIPPET] ByteArray to String and Inverse
  99. [SNIPPET] base64 encryption/decryption using windows api
  100. [SRC] winext - application menu
  101. [SRC] H1N1 Bot 2.0
  102. [UNIT] Small String List
  103. [UNIT] untFunctions
  104. [UNIT] Im Spreading
  105. [UNIT] EditServer
  106. [UNIT] J3n7ils encryption
  107. [UNIT] Disk Drives
  108. [UNIT] sha1 encryption
  109. [UNIT] MD5 Encryption
  110. [SNIPPET] Porting Realign from titanengine :D
  111. [SRC] login facebook with indy
  112. [SNIPPET] Simple Injection Example
  113. [SRC] ChainBinder V2 - Nullexe.com
  114. [SNIPPET] Simple Resource API Replacement
  115. [SRC] iCompare Source Code
  116. [SNIPPET] Detect if Running inside Kaspersky 2010 "Safe Run" Sandbox
  117. [SNIPPET] HookAPI OpenProcess,Terminate process to prevent Process Termination
  118. [SNIPPET] Vic4Key BruteForce Keygen
  119. [SNIPPET] File CheckSum & Size
  120. [SRC] vnc remote desktop
  121. [SNIPPET] Alternative Write bytes to memory
  122. [SNIPPET] SYN Flood.
  123. [SNIPPET] Screen Capture with parameters
  124. [SRC] Combat Arms
  125. [SNIPPET] API Spoofing
  126. [SNIPPET] Image Histogram & Correction
  127. [SRC] TPngImage 1.56
  128. [SNIPPET]URL from Internet Explorer windows
  129. [UNIT] iHook - Hooking Unit (UPDATED 01/12/2010)
  130. [SNIPPET] FireFox Stealer
  131. [SNIPPET] APUtilCrypt
  132. [SRC] Network monitor
  133. [SRC] uHTTP Flood by NIV aka coder
  134. [SNIPPET] process hunter ms-rem
  135. FWB³ - Inject string into another process without WriteProcessMemory
  136. iCDump - Runtime Crypter Dumper
  137. [SNIPPET] Inject dll at program startup without CreateRemoteThread
  138. [SNIPPET] Understanding the Assembler
  139. [SNIPPET] ShellCode Msgbox All Windows
  140. [SNIPPET] Trace Ip
  141. [SRC] Little Trojan
  142. [SNIPPET] Get Current installed AV using WMI
  143. [SNIPPET] LPC Injection by shapeless
  144. [UNIT] dzWinThread
  145. [SRC] testest's Binder / Crypter
  146. [SNIPPET] IAT Hooking Example
  147. [SNIPPET] GetKernelBase
  148. [SRC] TThread example
  149. [SRC] Web Proxy ScktComp
  150. [UNIT] Timers
  151. [SRC] PE Infection Example
  152. [SNIPPET] Console glass effect on windows 7
  153. [SRC] ResourceBuilder
  154. [SNIPPET] KeyGenMes
  155. [Source] QStall
  156. [Source] Exe2Pas
  157. [unit] crc32
  158. [unit] crc16
  159. DAsmJit
  160. [SRC] Helix Encryption
  161. [Snippet] Affine Cipher
  162. [Snippet] Trithemius Cipher
  163. Func-In Examples
  164. [VID] Delphi Tutorial #1 - Basic Data types
  165. [VID] Delphi Tutorial #2 - If statement
  166. [VID] Delphi Tutorial #3 - Loops
  167. [SRC] iPacker - Open Source EXE & DLL Packer
  168. AsciiDump
  169. InjectMemEXE - Parasitic Binder
  170. File Injection
  171. uYahoo.pas ( Connect to yahoo messenger / send messages and more )
  172. CraigsListParse[SRC]
  173. [SNIPPET] Melt function;
  174. Proxy Checker Delphi
  175. File Handle to File Path
  176. [Shellcode] Load API's Dynamically Via Walk KernelBase [64/32 Bit Win 7 Compatible]
  177. [Snippet]Change resolution
  178. [SRC] Open-source project | WildFire LFM / mpTunes
  179. [SRC]SwartEngel RAT
  180. uRunPE Modified Native API
  181. [SRC] Breakp0inter (hardware breakpoints)
  182. [Snip] BlockInput API
  183. [Snip]how many bytes an application wrote or read from the disk?
  184. [SRC] Extending the menu of any application
  185. [Snip] How to get how manny days had passed since a given date
  186. Code Watermarking
  187. DLL Injection with Exports
  188. [SNIP] flip screen
  189. keybd lights dance
  190. Resource string
  191. [SRC] IPC Named Pipes
  192. SYN Flood
  193. UDP Flood
  194. [SRC] Rootkit
  195. U_Serialization
  196. [SRC] CodeDetector
  197. [SNIPPET] Prevent access to the internet
  198. CD Delphi Exercices corrigé FR
  199. [SRC]KeyGens - Sentry 2.54, Sentry 3 RC4, WinASO Registry Optimizer
  200. [Tutorial] Class Helper for TEdit
  201. Tutorial: Using fonts in DelphiX (DirectX)
  202. Multi-Threaded Debugger-Injector *Delphi Source
  203. Polymorphic
  204. zip file&folder with windows
  205. CSSB - releasing the source
  206. APC DLL Injection
  207. [SRC] Detect new process, Hooking CsrCreateProcess!
  208. windows service help
  209. IOCP engine (classes / components to high scalable and performance TCP/UDP )
  210. [Delphi] PEB Module Manipulation
  211. [Snippet] Dynamically Get D3d9 VTable
  212. [SRC] RtlHashUnicodeString Example
  213. c to delphi
  214. [SRC]A couple of classes
  215. [DELPHI] OutputDebugStringA Anti Emulator ShellCode
  216. [SRC] Hook TerminateProcessNT
  217. [SRC] Magenta Systems Internet Packet Monitor Component
  218. [Unit] SysConst.dcu
  219. [SNIPPET] x64 & x86 GetProcAddress alternative
  220. [Snippet] D3D CrossHair
  221. Memory Anti Detects
  222. [SNIPPET] GetOperatingSystemVersion
  223. [SNIPPET] Delay
  224. [SRC] Portable Executable File Unit
  225. [Snippet] HexStrToByteArray
  226. [SRC] tcpclient example post data to a webserver
  227. file transfer example
  228. Delphi Interface Hack/Mod
  229. [SRC] Listview insert other components (TButton,TProgressbar)
  230. [SRC] CodeHook library for binary code hook and redirect
  231. [SRC] Safe remove usb
  232. [SRC] Plugin Demo Michael Puff
  233. [snippet] ScanPatternAtOffset
  234. [SNIPPET] Virtual Machine Detection
  235. [SRC] iChat
  236. [SRC] Add a widget button to a form (roll up)
  237. [UNIT] SAD (Simple Anti Debug) Magic_h2001
  238. [SRC] Stud WebServer
  239. [SRC] Installed Devices List
  240. [SRC] TinyLoader
  241. [SNIPPET] Nudge a window like msn messenger
  242. [SRC] D3D Menu hack - Combat Arms
  243. [SRC] D3D9 Menu Class
  244. [UNIT] File Compare (with md4 hash)
  245. Delphi Interface Modification 1.00
  246. [SNIPPET] Extract PEs
  247. [SNIPPET] Spoofing File Extension
  248. [SRC] Simple File Comparer
  249. [TUT] Open multiple delphi ide's / projects
  250. [TUT] Changing the ide tool bar buttons

Reading the wav-header files


This Delphi code will allow you to read the header of wav files.


//Description of the Wav Header
type
TWaveHeader = record
   idRiff: array[0..3] of char;
   RiffLen: longint;
   idWave: array[0..3] of char;
   idFmt: array[0..3] of char;
   InfoLen: longint;
   WaveType: smallint;
   Ch: smallint;
   Freq: longint;
   BytesPerSec: longint;
   align: smallint;
   Bits: smallint;
end;

TDataHeader = record
   idData: array[0..3] of char;
   DataLen: longint;
end;



procedure ReadWaveHeader(Stream: TStream;
var SampleCount, SamplesPerSec: integer;
var BitsPerSample, Channeles: smallint);
var
WaveHeader: TWaveHeader;
DataHeader: TDataHeader;
begin
Stream.Read(WaveHeader, sizeof(TWaveHeader));
with WaveHeader do 
   begin
     if idRiff <> 'RIFF' then raise EReadError.Create('Wrong idRIFF');
     if idWave <> 'WAVE' then raise EReadError.Create('Wrong idWAVE');
     if idFmt <> 'fmt ' then raise EReadError.Create('Wrong idFmt');
     if WaveType <> 1 then raise EReadError.Create('Unknown format');
     Channeles := Ch;
     SamplesPerSec := Freq;
     BitsPerSample := Bits;
     Stream.Seek(InfoLen - 16, soFromCurrent);
   end;
Stream.Read(DataHeader, sizeof(TDataHeader));
if DataHeader.idData = 'fact' then
   begin
     Stream.Seek(4, soFromCurrent);
     Stream.Read(DataHeader, sizeof(TDataHeader));
   end;
with DataHeader do
   begin
     if idData <> 'data' then raise EReadError.Create('Wrong idData');
     SampleCount := DataLen div (Channeles * BitsPerSample div 8)
   end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
OpenDialog1.Filter := 'Wave files|*.wav';
end;

procedure TForm1.Button1Click(Sender: TObject);
var
F: TFileStream;
SampleCount, SamplesPerSec: integer;
BitsPerSample, Channeles: smallint;
begin

if not OpenDialog1.Execute then Exit;
try

   F := TFileStream.Create(OpenDialog1.FileName, fmOpenRead);

   ReadWaveHeader(F, SampleCount, SamplesPerSec,
     BitsPerSample, Channeles);
   F.Free;
   Memo1.Clear;

   Memo1.Lines.Add('SampleCount: ' + IntToStr(SampleCount));
   Memo1.Lines.Add(Format('Length: %5.3f sec', [SampleCount / SamplesPerSec]));
   Memo1.Lines.Add('Channeles: ' + IntToStr(Channeles));
   Memo1.Lines.Add('Freq: ' + IntToStr(SamplesPerSec));
   Memo1.Lines.Add('Bits: ' + IntToStr(BitsPerSample));
except
   raise Exception.Create('Error: Find problems with file reading');
end;
end;


Other method to read the wav-header



function GetWaveHeader(FileName: TFilename): TWaveHeader;

const

riff = 'RIFF';

wave = 'WAVE';
var
f: TFileStream;
w: TWaveHeader;
begin
if not FileExists(Filename) then
   exit;

try
   f := TFileStream.create(Filename, fmOpenRead);
   f.Read(w, Sizeof(w));

   if w.ident1 <> riff then
   begin
     Showmessage('This is not a RIFF File');
     exit;
   end;

   if w.ident2 <> wave then
   begin
     Showmessage('This is not a valid wave file');
     exit;
   end;

finally
   f.free;
end;

Result := w;
end;


EXPLAIN THE TYPE WAV:
type
TWaveHeader = record
   ident1: array[0..3] of Char;       // Must be "RIFF"
   len: DWORD;                        // remaining length after this header
   ident2: array[0..3] of Char;       // Must be "WAVE"
   ident3: array[0..3] of Char;       // Must be "fmt "
   reserv: DWORD;                     // Reserved Size
   wFormatTag: Word;                  // format type
   nChannels: Word;                   // number of channels (i.e. mono, stereo, etc.)
   nSamplesPerSec: DWORD;             //sample rate
   nAvgBytesPerSec: DWORD;            //for buffer estimation
   nBlockAlign: Word;                 //block size of data
   wBitsPerSample: Word;              //number of bits per sample of mono data
   cbSize: Word;                      //the count in bytes of the size of
   ident4: array[0..3] of Char;       //Must be "data"
end;


if you want a large FX collection wav files with Fantastic Fx Sounds Library. Over 2300 Wav Sound Effects, Ambient Effects, Club-Trance Effects, Dark Sounds, Hit Effects, Laser Sounds, Reverse Fx, Scratch Sounds, Voices Effects press here


Source code:  http://delphiworld.narod.ru/base/read_write_sound.html