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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:01:57+00:00 2026-05-19T17:01:57+00:00

The following is a part of a debugger class. I’ve got the following code

  • 0

The following is a part of a debugger class. I’ve got the following code for enumerating processes in debugee. First it enumerates and loads handles of the existing debugee’s processes into an array. Then I’m trying to get an address of particular function in particular module. In this case i’m trying to get address of printf() out of msvcr100.dll


def enumerate_module(self,pid):

    lphModule = (c_void_p * 1024)()
    lpcbNeeded = c_ulong(0)

    if psapi.EnumProcessModules(self.h_process,lphModule,sizeof(c_void_p)*1024, byref(lpcbNeeded)):
        print "[*] EnumProcessModules: %d modules detected" % int(lpcbNeeded.value / sizeof(c_void_p))
        for i in range(int(lpcbNeeded.value / sizeof(c_void_p))):
            FileName = ""
            ReadBuffer = create_string_buffer(MAX_PATH)
            psapi.GetModuleFileNameExA(self.h_process,lphModule[i],ReadBuffer,MAX_PATH)
            FileName += ReadBuffer.value
            print "[*] %d - 0x%08x - %s" % (i,lphModule[i],FileName)
        address = kernel32.GetProcAddress(lphModule[3],"printf")
        if address == False:
            error = GetLastError()
            print "[*] GetProcAddress() ERROR: %d - %s" % (error, FormatError(error))    
        print "[**] Getting printf() address is: 0x%008x" % address
        return True
    else:
        error = GetLastError()
        print "[*] GetModuleHandleA: %d - %s" % (error, FormatError(error))
        return False

For some odd reason I cannot get it to work. GetPorcAddress() returns:

ERROR: 126 - The specified module could not be found.

Any ideas???

PS. This might clarify my question a little: Script output

Enter the PID of the process to attach to: 2476 Opening process: 2476 [*] DebugActiveProcess: 0 - The operation completed successfully. [*] EnumProcessModules: 4 modules detected [*] 0 - 0x00400000 - printf.exe [*] 1 - 0x7c900000 - ntdll.dll [*] 2 - 0x7c800000 - kernel32.dll [*] 3 - 0x78aa0000 - MSVCR100.dll [*] GetProcAddress() ERROR: 126 - The specified module could not be found. [**] Getting printf() address is: 0x00000000 [*] Finished debugging. Exitng...

As you can see msvcr100.dll is loaded at 0x78aa0000. As far as I understand
it should have printf() within its address spaces, where I should be able to
get its address. Moreover, I loaded up printf.exe in OllyDbg and it showed the same
thing that you see on my script's output, and I was able to see printf() in
msvcr100.dll's exports list.

  • 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-19T17:01:58+00:00Added an answer on May 19, 2026 at 5:01 pm

    GetProcAddress gets the address of a function in a DLL loaded in your process, not in a different process. You should check out the Debug Help Library.

    Per your request about GetProcAddress, my references:

    GetProcAddress

    hModule [in]
    A handle to the DLL module that contains the function or variable. The LoadLibrary, LoadLibraryEx, or GetModuleHandle function returns this handle.

    LoadLibrary

    Loads the specified module into the address space of the calling process….

    LoadLibraryEx

    Loads the specified module into the address space of the calling process….

    GetModuleHandle

    Retrieves a module handle for the specified module. The module must have been loaded by the calling process.

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

Sidebar

Related Questions

I have the following class (part of it): class SearchViewModel : BaseViewModel<SearchResultItem> { private
Google optimizer includes the following snippet as part of their conversion code. Unfortunately, the
I am using the following code as part of an autocomplete script to avoid
i got following part of one of functions if(continiueSend) { $.ajax ({ type: POST,
I have the following part of a CSV File with 7 columns (see first
I have the following part of my form: <input type=checkbox class=hide id=additional-webinar name=additional-webinar-check value=additional-webinar-box>
I have the following part of a function that is driving me crazy. As
Following is part of service layer which is provided by WCF service : [Serializable]
I'm currently doing the following as part of my iPhone application NSArray *paths =
Thanks in advance for your assistance. I have the following exported part: [Export (typeof(INewComponent))]

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.