Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:10:50+00:00 2026-06-05T15:10:50+00:00

I got an old injector which was made by me in Delphi 7 and

  • 0

I got an old injector which was made by me in Delphi 7 and I tried to change him in that way, that it still works in XE2 but i failed-.- The new test dll works with my old injector without any problems so im quite sure that my injector got a bug.

here is the code I made:

procedure TForm1.InjectDLL(const ADLLName: String; targetproc: Cardinal);
var
  dllname: String;
  pDLLname, pStartAddr: Pointer;
  bw: NativeUInt;
  hProcess, hRemoteThread: THandle;
  TID: Cardinal;
begin
  hProcess := OpenProcess(PROCESS_ALL_ACCESS, false, targetproc);
  pDLLname := VirtualAllocEx(hProcess, 0, length(dllname) + 1,
    MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);

  WriteProcessMemory(hProcess, pDLLname, Pointer(dllname),
    length(dllname) + 1, bw);

  pStartAddr := GetProcAddress(GetModuleHandle('kernel32.dll'), 'LoadLibraryA');
  hRemoteThread := CreateRemoteThread(hProcess, nil, 0, pStartAddr,
    pDLLname, 0, TID);
  WaitForSingleObject(hRemoteThread, INFINITE);
  showmessage('Fehler ' + IntToStr(GetLastError) + ': ' +
    SysErrorMessage(GetLastError));
  CloseHandle(hProcess);
end;

I just needed to change hProcess and hRemoteThread to THandle and bw to NativeUInt. The showmessage just tells me that all works. There must be a small difference since the String type changed from d7 to XE2. I also tried to cast the dll name as PAnsiChar but it changed nothing to me.

Hope I posted enough information for you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:10:52+00:00Added an answer on June 5, 2026 at 3:10 pm

    The net result of your code, under Unicode Delphi, is to pass UTF-16 text to LoadLibraryA. And of course, that expects 8 bit ANSI text. You have two options to resolve the problem:

    1. Stick with ANSI text and simply replace string with AnsiString in your code snippet.
    2. Switch to Unicode text. Use LoadLibraryW and apply the change suggested by Arnaud to correctly handle the length of the 16 bit text.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an old wiki that I'm converting to a new wiki which uses
I have got an old site that has recently been displaying an error which
I've got an old project written in Delphi 4. I'm looking for a way
I've got an old script here, which's based on the functionality that it creates
I've got an old application that has user passwords stored in the database with
I've got an old RRD file that was only set up to track 1
I've got an ASP document that 5 years old. Actually I'm working with PHP
Recently, in company we got some MSSQL database from some old project which we
I got an old library which does some manipulation with files on floppy\ CD
I've got an old flex builder 3 project that I imported into Flash Builder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.