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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:37:28+00:00 2026-05-27T18:37:28+00:00

I just tried the following code(windows xp sp3, vs2010) and LoadLibrary seems to be

  • 0

I just tried the following code(windows xp sp3, vs2010) and LoadLibrary seems to be returning Null.

#include "windows.h"
#include "stdio.h"

int main() {
    HMODULE hNtdll;
    hNtdll = LoadLibrary(LPCWSTR("ntdll.dll"));
    printf("%08x\n", hNtdll);
}

The output I get is 00000000. According to the docs, NULL is returned when the function fails. I tried using GetLastError and the error code is 126(0x7e, Error Mod Not Found).

How can I correct this issue?

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-27T18:37:28+00:00Added an answer on May 27, 2026 at 6:37 pm

    You have a string literal, which consists of narrow characters. Your LoadLibrary call apparently expects wide characters. Type-casting isn’t the way to convert from one to the other. Use the L prefix to get a wide string literal:

    LoadLibrary(L"ntdll.dll")
    

    Type-casting tells the compiler that your char const* is really a wchar_t const*, which isn’t true. The compiler trusts you and passes the pointer along to LoadLibrary anyway, but when interpreted as a wide string, the thing you passed is nonsense. It doesn’t represent the name of any file on your system, so the API correctly reports that it cannot find the module.

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

Sidebar

Related Questions

I just tried the following code, but the result seems a little strange. It
I just tried disassembling some shellcode using disasm and I found the following statement
Just to experiment assembly in C++, I tried the following, which is causing the
I tried to use dat.GUI in the following three.js example . I just did
Just tried some small graphics application of mine on Windows 7, and I'm getting
During the development of an windows mobile application we used the following code: const
The following code works fine in Windows: subprocess.Popen([PATH_TO_G++]/g++ file.cpp -o file.exe) However in Linux
I just tried to install git-flow, however, it does not seem to be integrated
I just tried to run my test app and I got this error: 2012-06-16
I just tried my first steps with grid . I would like to set

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.