Guest User

AlphaSkins Cracked

a guest
Jan 4th, 2016
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.18 KB | None | 0 0
  1. program Project1;
  2.  
  3. {======== VANS-SOFT.RU ==========}
  4.  
  5. uses
  6.   Windows, Forms, Unit1;
  7.  
  8. var
  9.   OrigAddr: Pointer = nil;
  10.  
  11. {$R *.res}
  12.  
  13. function InterceptedMessageBoxA(Wnd: HWND; lpText, lpCaption: PAnsiChar; uType: UINT): Integer; stdcall;
  14. type
  15.   TOrigMessageBoxA = function(Wnd: HWND; lpText, lpCaption: PAnsiChar; uType: UINT): Integer; stdcall;
  16. begin
  17.   if lpCaption <> 'Unregistered skin' then
  18.     Result := TOrigMessageBoxA(OrigAddr)(Wnd, lpText, lpCaption, uType);
  19. end;
  20.  
  21. function Intercept(const OldProc, NewProc: FARPROC): Boolean;
  22. var
  23.   ImportEntry: PImageImportDescriptor;
  24.   Thunk: PImageThunkData;
  25.   Protect: DWORD;
  26.   ImageBase: Cardinal;
  27.   DOSHeader: PImageDosHeader;
  28.   NTHeader: PImageNtHeaders;
  29. begin
  30.   Result := False;
  31.   if OldProc = nil then Exit;
  32.   if NewProc = nil then Exit;
  33.   ImageBase := GetModuleHandle(nil);
  34.   DOSHeader := PImageDosHeader(ImageBase);
  35.   NTHeader := PImageNtHeaders(DWORD(DOSHeader) + DWORD(DOSHeader^._lfanew));
  36.   ImportEntry := PImageImportDescriptor(
  37.     DWORD(ImageBase)+
  38.     DWORD(NTHeader^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress)
  39.   );
  40.   while ImportEntry^.Name <> 0 do begin
  41.     Thunk := PImageThunkData(DWORD(ImageBase) + DWORD(ImportEntry^.FirstThunk));
  42.     while Pointer(Thunk^._function) <> nil do begin
  43.       if Pointer(Thunk^._function) = OldProc then begin
  44.         if VirtualProtect(@Thunk^._function, SizeOf(DWORD), PAGE_EXECUTE_READWRITE, Protect) then
  45.         try
  46.           InterlockedExchange(Integer(Thunk^._function), Integer(NewProc));
  47.           Result := True;
  48.         finally
  49.           VirtualProtect(@Thunk^._function, SizeOf(DWORD), Protect, Protect);
  50.           FlushInstructionCache(GetCurrentProcess, @Thunk^._function, SizeOf(DWORD));
  51.         end;
  52.       end else Inc(PAnsiChar(Thunk), SizeOf(TImageThunkData32));
  53.     end;
  54.     ImportEntry := Pointer(Integer(ImportEntry) + SizeOf(TImageImportDescriptor));
  55.   end;
  56. end;
  57.  
  58. begin
  59.   OrigAddr:=GetProcAddress(GetModuleHandle(user32), 'MessageBoxA');
  60.   Intercept(OrigAddr, @InterceptedMessageBoxA);
  61.  
  62.   Application.Initialize;
  63.   Application.MainFormOnTaskbar := True;
  64.   Application.CreateForm(TForm1, Form1);
  65.   Application.Run;
  66. end.
Add Comment
Please, Sign In to add comment