Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

ProSysLib: Dissecting the Process

, 22 Nov 2010
Access detailed information about the current process the easiest way.
ProcessInfo32_bin.zip
ProcessInfo.exe
ProSysLib.dll
Interop.ProSysLib.dll
ProcessInfo64_bin.zip
Interop.ProSysLib.dll
ProcessInfo.exe
ProSysLib.dll
ProcessInfo_bin.zip
PSL64v0.9.dll
Interop.ProSysLib.dll
ProcessInfo.exe
PSL32v0.9.dll
ProSysLib_v0.9.zip
ProSysLib_v0.9
Bin
PSL32v0.9.dll
PSL64v0.9.dll
Help
Samples
C#2008
ProcessInfo
Properties
Settings.settings
ProcessViewer
Properties
Settings.settings
VB6
CPUInfo.exe
CPUInfo.frm
CPUInfo.frx
CPUInfo.vbp
CPUInfo.vbw
VC2008
Deployment
Src
mssccprj.scc
ProSysLib.def
ProSysLib.rgs
ProSysLib.vcproj.vspscc
ProSysLib.vssscc
PSLSystem.rgs
PSLv0.5Setup.zip
PSLv0.5Setup.exe
PSLv0.7Setup.zip
PSLv0.7Setup.exe
#include "stdafx.h"
#include "resource.h"
#include "ProSysLib_i.h"
#include "ProSysModule.h"
#include "dlldatax.h"
#include "AutoObject.h"

CProSysLibModule _Module;

CProSysLibModule::CProSysLibModule()
{
	::InitializeCriticalSection(&m_cs);

	m_hResInstance = NULL;

	m_bWinSockets = false;
	DWORD dwOSVersion = ::GetVersion();
	DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwOSVersion)));
    DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwOSVersion)));
	m_bWin2000 = (dwMajorVersion == 5 && !dwMinorVersion);
}

CProSysLibModule::~CProSysLibModule()
{
	::DeleteCriticalSection(&m_cs);
}

bool CProSysLibModule::IsWin2000()
{
	return m_bWin2000;
}

bool CProSysLibModule::InitWinSockets()
{
	CCritSecLock cs(m_cs);

	if(m_bWinSockets)
		return true; // Already initialized;

	// Initialize Windows Socket Support;
	WORD wVersionRequested = MAKEWORD(2, 2);
	WSADATA wsaData;
	m_bWinSockets =::WSAStartup(wVersionRequested, &wsaData)?false:true;

	return m_bWinSockets;
}

void CProSysLibModule::SetResourceInstance(HINSTANCE hInstance)
{
	m_hResInstance = hInstance;
}

HINSTANCE CProSysLibModule::GetResourceInstance()
{
	return m_hResInstance;
}

void CProSysLibModule::InitLibId()
{
	CAtlModule::m_libid = LIBID_ProSysLib;
}

void CProSysLibModule::OnModuleStart()
{
	// This is where we can initialize global objects;
}

void CProSysLibModule::OnModuleTerminate()
{
	// This is where we can uninitialize global objects;
	//

	// Shutting down WinSockets, if they were in use:
	CCritSecLock cs(m_cs);
	if(m_bWinSockets)
	{
		::WSACleanup();
		m_bWinSockets = false;
	}
	cs.Unlock();

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Vitaly Tomilov
Software Developer (Senior) Sibedge IT
Ireland Ireland
My online CV: cv.vitalytomilov.com

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 22 Nov 2010
Article Copyright 2008 by Vitaly Tomilov
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid