home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / wincom / dllcom / public / dlltask.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 KB  |  68 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef __DllProcessData_H
  20. #define __DllProcessData_H
  21.  
  22. //  THIS HEADER IS NOT PUBLIC TO OTHER CODE EXCEPT THE
  23. //      CORE DLL IMPLEMENTATION.
  24.  
  25. //  Classes used to maintain a seperate instace list of
  26. //      Dll data for each different task utilizing the
  27. //      Dll.  The goal here is to transparently make
  28. //      win16 Dlls which share data, to act like win32
  29. //      Dlls, which do not share data.
  30.  
  31. //  This class is solely contained by the CComDll class
  32. //      constructor and destructor, but this class
  33. //      registers itself into a list such that a per
  34. //      process lookup can find a CComDll instance.
  35. class CProcessEntry  {
  36.     friend class CComDll;
  37.     friend class CProcess;
  38. private:
  39.     //  Used in conjunction with the CProcess list
  40.     //      to automatically manage it.
  41.     CProcessEntry(CComDll *pDll);
  42.     ~CProcessEntry();
  43.  
  44. private:
  45.     //  All needed state data to seperate out and
  46.     //      combine a single process with a single
  47.     //      set of instance data.
  48.     DWORD m_dwProcessID;
  49.     CComDll *m_pDllInstance;
  50.     CProcessEntry *m_pNext;
  51. };
  52.  
  53. //  This class is never actually allocated, but is used
  54. //      to logically seperate out the members and their
  55. //      purpose.
  56. class CProcess  {
  57.     friend class CProcessEntry;
  58. private:
  59.     //  A list of process IDs and Dll instance data.
  60.     static CProcessEntry *m_pProcessList;
  61.  
  62. public:
  63.     static CComDll *GetProcessDll();
  64.     static BOOL CanUnloadNow();
  65.     static DWORD GetProcessID();
  66. };
  67.  
  68. #endif // __DllProcessData_H