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 241019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:43:05+00:00 2026-05-11T20:43:05+00:00

I need to use a DLL (Hardware ID Extractor) made in Delphi 7 in

  • 0

I need to use a DLL (Hardware ID Extractor) made in Delphi 7 in my C# application.

The functions exported by this DLL are:

Exported functions:

// CPU
function GetCPUSpeed: Double;
function CPUFamily: ShortString; { Get cpu identifier from the windows registry }
function GetCpuTheoreticSpeed: Integer; { Get cpu speed (in MHz) }
function IsCPUIDAvailable: Boolean; Register;
function GetCPUID (CpuCore: byte): ShortString;
Function GetCPUVendor: ShortString;

// RAM
function MemoryStatus (MemType: Integer): cardinal; { in Bytes }
function MemoryStatus_MB (MemType: Integer): ShortString; { in MB }

// HDD
function GetPartitionID (Partition : PChar): ShortString; { Get the ID of the specified patition. Example of parameter: 'C:' }
function GetIDESerialNumber(DriveNumber: Byte ): PChar; { DriveNr is from 0 to 4 }

I know (obviously) that string in Delphi are not null terminated and are byte (ASCII). But I have no clue on how to map these Delphi string to C#.

Thanks.

  • 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-05-11T20:43:06+00:00Added an answer on May 11, 2026 at 8:43 pm

    Here’s an example of how you could declare the GetCPUSpeed function in C#:

    class Program
    {
        [DllImport("the_name_of_the_delphi_library.dll")]
        public static extern double GetCPUSpeed();
    
        static void Main(string[] args)
        {
            double cpuSpeed = GetCPUSpeed();
            Console.WriteLine("CPU speed: {0}", cpuSpeed);
        }
    }
    

    And there are the other declarations you could try:

    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern string CPUFamily();
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern int GetCpuTheoreticSpeed();
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern bool IsCPUIDAvailable();
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern string GetCPUID(byte cpuCore);
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern string GetCPUVendor();
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern uint MemoryStatus(int memType);
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern string MemoryStatus_MB(int memType);
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern string GetPartitionID(char partition);
    
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern string GetIDESerialNumber(byte driveNumber);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use a dll in my asp.net application. How do I load
I have a dll that was written in c++, I need to use this
I need to use an unmanaged VC++ dll. It has the following two functions
I have a 3rd party DLL that I need to use in my application.
I need to use a DLL coded in C++ in a C# application, there
I need to use a 3rd party dll in our main app. When I
I have a very old (VC++ 5.0) proprietary DLL which I need to use
i like import c++ dll in my c# application how can i Do this?,
I need to use a DLL file from qsBarcode http://www.qsbarcode.de/en/index.htm (here is the download
I need to use sed to convert all occurences of ##XXX## to ${XXX} .

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.