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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:26:52+00:00 2026-05-14T20:26:52+00:00

We’ve got an Enterprise system which has many processes (EXEs, services, DCOM servers, COM+

  • 0

We’ve got an Enterprise system which has many processes (EXEs, services, DCOM servers, COM+ apps, ISAPI, MMC snapins) all of which make use of many COM components. We’ve recently seen failures in some of the customer deployments, but are finding it hard to troubleshoot the cause.

In order to track down the problem, we’ve augmented the entire source with logging statements where errors occur.

In order to identify which logs came from what processes, the C++ logging code (compiled into all components) uses the EXE name to name the log. This is good for some cases, but not all – COM+ apps, ISAPI and MMC snapins all have system EXE names and the logs end up interleaved.

I saw this post about shared data sections which might help, but what I don’t understand is who decides what goes in the shared section. Is there any way I can guarantee that a particular piece of code writes into the shared section before anyone else reads it?

Or is there a better solution to this problem?

  • 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-14T20:26:53+00:00Added an answer on May 14, 2026 at 8:26 pm

    To synchronize multiple processes writing to the shared section you’d need some kind of IPC e.g. Windows events, mutexes, sockets. Each of your modules calls CreateMutex and passes a fixed name which all the modules share. Modules then call WaitForSingleObject to wait and claim the mutex – when one of them gets it, it can read/write the shared section while every other module waits. When its done it calls ReleaseMutex to let another module have a go.

    Having said all that personally I’d persevere with the log files. I’m guessing your problem is that for DLLs you’re basing your log file name on the parent process EXE name instead of the DLLs own name?

    You can get a DLLs own name by storing the DLL instance handle you get passed in DllMain, and then using it with GetModuleFileName. Note this works for EXEs as well if you leave the instance handle as NULL.

    // global variable to store DLL handle (or it stays NULL if this is an EXE)
    HINSTANCE hDllHandle=NULL;
    
    BOOLEAN WINAPI DllMain( IN HINSTANCE hInstance, 
         IN DWORD     nReason, 
         IN LPVOID    Reserved )
    {
      hDllHandle = hInstance;
      return TRUE;
    
    }
    
    <snip>
    
    void Log(LPSTR lpszMsg)
    {
        WCHAR szMyModuleName[MAX_PATH]={0};
    
        // if hDllHandle is still NULL (e.g. this is an EXE) it returns the process name
        // if non-NULL, it returns our DLL name
        GetModuleFileName(hDllHandle, szMyModuleName, MAX_PATH);
    
        fprintf(LOGFILE, "[%s] %s\n", szMyModuleName, lpszMsg);
    
         ....<snip>....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters

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.