Guest User

Untitled

a guest
Jul 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7. Dialogs, StdCtrls;
  8.  
  9. type
  10. TForm1 = class(TForm)
  11. Button1: TButton;
  12. procedure Button1Click(Sender: TObject);
  13. private
  14. { Private declarations }
  15. public
  16. { Public declarations }
  17. end;
  18.  
  19. var
  20. Form1: TForm1;
  21. WindowName: Integer;
  22. ProcessId: Integer;
  23. ThreadId: Integer;
  24. HandleWindow: Integer;
  25. Write: Cardinal;
  26.  
  27. implementation
  28.  
  29. {$R *.dfm}
  30. procedure WriteProcessBytes(hProcess: THandle; Address: Pointer; const Buffer;
  31. Count: Integer); overload;
  32. var
  33. NumberOfBytesWritten: DWORD;
  34. begin
  35. if not WriteProcessMemory(hProcess, Address, @Buffer, SizeOf(Buffer),
  36. NumberOfBytesWritten) then RaiseLastOSError;
  37. end;
  38.  
  39. procedure WriteProcessBytes(hProcess: THandle; Address: Pointer;
  40. const Buffer: Byte); overload;
  41. begin
  42. WriteProcessBytes(hProcess, Address, Buffer, SizeOf(Buffer));
  43. end;
  44.  
  45. procedure WriteProcessBytes(hProcess: THandle; Address: Pointer;
  46. const Buffer: Word); overload;
  47. begin
  48. WriteProcessBytes(hProcess, Address, Buffer, SizeOf(Buffer));
  49. end;
  50.  
  51. procedure WriteProcessBytes(hProcess: THandle; Address: Pointer;
  52. const Buffer: Cardinal); overload;
  53. begin
  54. WriteProcessBytes(hProcess, Address, Buffer, SizeOf(Buffer));
  55. end;
  56.  
  57.  
  58. procedure TForm1.Button1Click(Sender: TObject);
  59. begin
  60. WindowName := FindWindow(nil, 'Generic Property Editor Thingy');
  61. ThreadId := GetWindowThreadProcessId(WindowName, @ProcessId);
  62. HandleWindow := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId);
  63. WriteProcessBytes(HandleWindow, Pointer($449A17), Word(99));
  64. Closehandle(HandleWindow);
  65. end;
  66.  
  67. end.
Add Comment
Please, Sign In to add comment