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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:28:05+00:00 2026-06-01T16:28:05+00:00

I want to call some Nt function from ntdll.dll, I’m doing that like this

  • 0

I want to call some Nt function from ntdll.dll, I’m doing that like this above.

For calling: NtTestAlert() , you need typical ntcall kernel routine, accessable via int 2Eh.
( from here I got Nt functions http://undocumented.ntinternals.net/ )

Code is also unfinished, I’m getting:

*error C2664: ‘_ntcall’ : cannot convert parameter 1 from ‘int’ to ‘MESS (_stdcall )’

#include <iostream>
#include <windows.h>
#include <Ntsecapi.h>

using namespace std;

typedef int(__stdcall MESS)(unsigned int);

void __ntcall(MESS *msg)
{
    __asm
    {
        int 2Eh;
    }
}

int main(void)
{
    MESS *me = 0;
    int result = 0;

    HINSTANCE__ *hModule= LoadLibrary(L"C:\\Windows\\System32\\ntdll.dll");

    if(hModule != 0)
    {
        me = (MESS*)GetProcAddress(hModule, "NtTestAlert");

        if(me != 0)
        {
            unsigned int type = 1;

            result = (__ntcall((*me)(type)));
        }
        else
        {
            cout << "Error Load function!" << endl;
        }

        FreeLibrary(hModule);
    }
    else
    {
        cout << "Error load Dll!" << endl;
    }

    return 0;
}
  • 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-01T16:28:06+00:00Added an answer on June 1, 2026 at 4:28 pm

    You simply call the function whose pointer you retrieve. The int 2Eh is an old (and since XP SP2 outdated) method of making system calls. When calling (just via the normal means) an NTDLL function that is what goes on underneath. You need not care about that.

    Side-note: you seem to confuse some more concepts. NtTestAlert doesn’t take a parameter.

    NTSYSAPI NTSTATUS NTAPI NtTestAlert();
    

    so that would translate to (your MESS type):

    typedef NTSTATUS(__stdcall *TFNNtTestAlert)();
    

    An example based on yours:

    #include <iostream>
    #include <windows.h>
    #include <tchar.h>
    #include <Ntsecapi.h>
    
    using namespace std;
    
    typedef NTSTATUS (__stdcall *TFNNtTestAlert)();
    // NTSTATUS is LONG, in case that isn't defined in the above headers
    
    int main(void)
    {
        HMODULE hModule=GetModuleHandle(TEXT("ntdll.dll"));
    
        if(hModule != 0)
        {
            TFNNtTestAlert pfnNtTestAlert = (TFNNtTestAlert)GetProcAddress(hModule, "NtTestAlert");
    
            if(pfnNtTestAlert != 0)
            {
                result = pfnNtTestAlert();
            }
            else
            {
                cout << "Error Load function!" << endl;
                return 1;
            }
        }
        else
        {
            cout << "Error load Dll!" << endl;
            return 2;
        }
    
        return 0;
    }
    

    System call mechanism:

    the syscall mechanism in Windows used int 2Eh at some point (and now sysenter) to pass the parameters on the user mode stack, the index of the syscall and then invoke the dispatcher. This then transitions the thread into kernel mode, where the parameters from the user mode stack are checked and then the handling proceeds. This is a very rough outline. I suggest you read Gary Nebbett’s book on the topic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually I have some MVC3 Applications and I want to call this applications from
So, I want to call a Python callback function from C. At some point,
When I want to call some Windows function, like MessageBox I can import it
I want to be able to call a function from a link (this function
I want to call subroutines in Perl like: sub temp { ---- some code
I want to create some kind of AJAX script or call that continuously will
I want to call a webservice from jQuery. How can I do that?
I'm calling a php function from my $.ajax call to add a new item
I want to call a c# function from my javascript function. I have a
I want to call a C classes main function from within another class (which

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.