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

  • Home
  • SEARCH
  • 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 959049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:57:46+00:00 2026-05-16T00:57:46+00:00

Before I get into to my question,let me explain what I am exactly doing.I

  • 0

Before I get into to my question,let me explain what I am exactly doing.I have a main Process say ProcessA,I have hooked ProcessA and also injected dll(say myDll.dll) into the process space of ProcessA.Now at one point ProcessA kicks on another process which is ProcessB.Both the process A and B are in totally different Process memory space.I want to share the myDll.dll(which is inserted in processA sapce) in ProcessB(actually ProcessB’s processSpace).Can it be done using pipe line method or any other suitable method.
thanks in advance.

  • 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-16T00:57:47+00:00Added an answer on May 16, 2026 at 12:57 am

    The code of DLL will be automatically shared by different processes. For optimization only you should choose a good base address of the DLL (see http://msdn.microsoft.com/en-US/library/f7f5138s.aspx).

    To share data between processes you can for example use Shared Memory objects or just place some variables which you need to share to a section which you mark as shared (see http://support.microsoft.com/kb/100634 and http://msdn.microsoft.com/en-us/library/h90dkhs0.aspx for details). To mark section “.SHAREDSECTIONNAME” as shared you can use

    #pragma comment(linker, "/section:.SHAREDSECTIONNAME,RWS")
    

    To have no conflicts in writing/reading from the shared memory you should use a named Event or Mutex exactly like in all other cases of multiprocess communication.

    UPDATED based on the comment: If you create the child process yourself you receive the handle to the child process with full rights. So you have enough rights to make DLL infection with respect of CreateRemoteThread API. Here is a working code in C which start CMD.EXE and inject a MyTest.dll in the address space:

    #include <Windows.h>
    
    int main()
    {
        STARTUPINFO si = { sizeof(STARTUPINFO) };
        PROCESS_INFORMATION pi = {0};
        TCHAR szCommandLine[4096] = TEXT("CMD.EXE");
        BOOL bIsSuccess;
        DWORD dwStatus;
        LPCTSTR pszLibFile = TEXT("C:\\Oleg\\MyTest\\Release\\MyTest.dll");
        PTSTR pszLibFileRemote = NULL;
        HANDLE hThread = NULL;
        int cb;
        HMODULE hModule = NULL;
    
        bIsSuccess = CreateProcess (NULL, szCommandLine, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi);
    
        // Calculate the number of bytes needed for the DLL's pathname
        cb  = (1 + lstrlen(pszLibFile)) * sizeof(TCHAR);
    
        __try {
            PTHREAD_START_ROUTINE pfnThreadRtn;
    
            // Allocate space in the remote process for the pathname
            pszLibFileRemote = (PTSTR) VirtualAllocEx (pi.hProcess, NULL, cb, MEM_COMMIT, PAGE_READWRITE);
            if (pszLibFileRemote == NULL) __leave;  // error
    
            // Copy the DLL's pathname to the remote process's address space
            if (!WriteProcessMemory (pi.hProcess, pszLibFileRemote, (PVOID) pszLibFile, cb, NULL)) __leave;
    
            // Get the real address of LoadLibraryW in Kernel32.dll
            // Real address of Kernel32.dll in dwProcessId and in our Process MUST be the same !!!
            // Remote Process MUST have Kernel32.dll loaded (SMSSS.EXE and System havn't)!!!
    #ifdef UNICODE
            pfnThreadRtn = (PTHREAD_START_ROUTINE) GetProcAddress (GetModuleHandle(TEXT("Kernel32")), "LoadLibraryW");
    #else
            pfnThreadRtn = (PTHREAD_START_ROUTINE) GetProcAddress (GetModuleHandle(TEXT("Kernel32")), "LoadLibraryA");
    #endif
            if (pfnThreadRtn == NULL) __leave;
    
            // Create a remote thread that calls LoadLibraryW(DLLPathname)
            hThread = CreateRemoteThread (pi.hProcess, NULL, 0, pfnThreadRtn, (LPVOID)pszLibFileRemote, 0, NULL);
            if (hThread == NULL) __leave;
    
            dwStatus = ResumeThread (pi.hThread);
    
            // Wait for the remote thread to terminate
            if (WaitForSingleObject (hThread, INFINITE) != WAIT_OBJECT_0) __leave;
    
            GetExitCodeThread (hThread, (PDWORD)&hModule);
    
            // hModule is the address in the destination process (CMD.EXE)
            // of the injected DLL
            // You can verify that it is really loaded for example with respect of 
            // Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)
        }
        __finally {
            // Free the remote memory that contained the DLL's pathname
            if (pszLibFileRemote != NULL)
                bIsSuccess = VirtualFreeEx (pi.hProcess, pszLibFileRemote, 0, MEM_RELEASE);
    
            if (hThread != NULL)
                bIsSuccess = CloseHandle (hThread);
    
            if (pi.hProcess != NULL)
                bIsSuccess = CloseHandle (pi.hProcess);
    
            if (pi.hThread != NULL)
                bIsSuccess = CloseHandle (pi.hThread);
        }
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before I start with the real question, let me just say that I might
Before I ask my question, let me just say that I know very little
Before I get into the details of this problem, I'd like to make the
I asked before about pixel-pushing, and have now managed to get far enough to
Let me provide a little detail to explain what I'm trying to accomplish before
Maybe I should back-up and widen the scope before diving into the title question...
I have asked a similar question before, but I didn't have a firm grasp
I posted this basic question before, but didn't get an answer I could work
So, if this question has been asked before, I'm sorry. I'm not exactly sure
First let me say I really sorry for asking a question about facebook. I'm

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.