Wednesday, April 27, 2016

Books I Read in 2015

Books I Read in 2015

In 2015, I read number of books. But, the most exciting titles I feel are as below.


TimeLine - Michael Crichton (Author)


In an Arizona desert a man wanders in a daze, speaking words that make no sense. Within twenty-four hours he is dead, his body swiftly cremated by his only known associates. Halfway around the world archaeologists make a shocking discovery at a medieval site. Suddenly they are swept off to the headquarters of a secretive multinational corporation that has developed an astounding technology. Now this group is about to get a chance not to study the past but to enter it. And with history opened to the present, the dead awakened to the living, these men and women will soon find themselves fighting for their very survival–six hundred years ago. . . .

The Lost World - Michael Crichton (Author)


"Harrowing thrills . . . fast-paced and engaging.”—People
“A very scary read.”—Entertainment Weekly
“Action-packed.”—New York Daily News
“An edge-of-the-seat tale.”—St. Petersburg Times

It is now six years since the secret disaster at Jurassic Park, six years since the extraordinary dream of science and imagination came to a crashing end—the dinosaurs destroyed, the park dismantled, and the island indefinitely closed to the public.

There are rumors that something has survived. . . .

Jurassic Park - Michael Crichton (Author)


“Wonderful . . . powerful.”—The Washington Post Book World

An astonishing technique for recovering and cloning dinosaur DNA has been discovered. Now humankind’s most thrilling fantasies have come true. Creatures extinct for eons roam Jurassic Park with their awesome presence and profound mystery, and all the world can visit them—for a price.

Until something goes wrong. . . .

In Jurassic Park, Michael Crichton taps all his mesmerizing talent and scientific brilliance to create his most electrifying technothriller.

“Frighteningly real . . . compelling . . . It’ll keep you riveted.”—The Detroit News
“Crichton’s dinosaurs are genuinely frightening.”—Chicago Sun-Times
“Full of suspense.”—The New York Times Book Review

Congo - Michael Crichton (Author)


Deep in the African rain forest, near the legendary ruins of the Lost City of Zinj, an expedition of eight American geologists are mysteriously and brutally killed in a matter of minutes.

Ten thousand miles away, Karen Ross, the Congo Project Supervisor, watches a gruesome video transmission of the aftermath: a camp destroyed, tents crushed and torn, equipment scattered in the mud alongside dead bodies—all motionless except for one moving image—a grainy, dark, man-shaped blur.

In San Francisco, primatologist Peter Elliot works with Amy, a gorilla with an extraordinary vocabulary of 620 "signs," the most ever learned by a primate, and she likes to finger paint. But recently her behavior has been erratic and her drawings match, with stunning accuracy, the brittle pages of a Portuguese print dating back to 1642 . . . a drawing of an ancient lost city. A new expedition—along with Amy—is sent into the Congo, where they enter a secret world, and the only way out may be through a horrifying death . . .

आर्य चाणक्यजनार्दन ओक (लेखक)


"सर्वसाधारण मनुष्याला जीवनापासून परावृत्त करणं अतिरिक्त अहिंसेचा अवलंब करणाऱ्या गोष्टीमुळे राष्ट्राचं अपरिमित नुकसान होते हे ध्यानी घेणं आवश्यक आहे. आम्हाला कुणावरही आक्रमण करण्याची कांक्षा नही. परंतु आमच्यावरती झालेलं आक्रमण आम्ही सहन करणार नही. नवनिर्माणाच्या नावाने होणारी असंथ मनाची भावना अव्यवस्था राष्ट्रास हानिकारक ठरते. सांप्रत संपूर्ण आर्यावर्तात हीच अवस्था निर्माण झाली आहे. हे सारं संपुष्टात यावं असा माझा आग्रह आहे. आपला हा उद्योग त्याप्रीत्यर्थ आहे. धर्म, वैभव, सद्भाव, साधर्म्य हे राष्ट्राचे सामर्थ्य आहे. या चार गोष्टी जिथे नांदतात ते राष्ट्र आदर्श मानलं जातं. माझा अट्टाहास अशा राष्ट्रांकारिता आहे. कुठल्याही एका विविक्षीत वर्गानं संपन्न असावं आणि इतरांनी त्यापासून वंचित असावं हा राज्यानिर्मितीचा उद्देश नाही. अधिक अधिक प्रजेनं सुखी असावं हा या निर्मितीचा मुळ उद्देश आहे."
                                                                                                                                                                                                                                                  - आर्य चाणक्य

Under the Hood of .NET Memory Management - Chris Farrell (Author), Nick Harrison (Author)


This book starts with an introduction to the core concepts of .NET memory management and garbage collection, and then quickly layers on additional details and intricacies. Once you're up to speed, you can dive into the guided troubleshooting tour, and tips for engineering your application to maximise performance. And to finish off, take a look at some more sophisticated considerations, and even a peek inside the Windows memory model.

Windows Internals, Part 1 and Part 2 (6th Edition) (Developer Reference)by Mark E. Russinovich (Author), David A. Solomon (Author), Alex Ionescu (Author) 

        Delve inside Windows architecture and internals—and see how core components work behind the scenes. Led by three renowned internals experts, this classic guide is fully updated for Windows 7 and Windows Server 2008 R2—and now presents its coverage in two volumes.

As always, you get critical insider perspectives on how Windows operates. And through hands-on experiments, you’ll experience its internal behavior firsthand—knowledge you can apply to improve application design, debugging, system performance, and support.


In Part 1, you will:




  • Understand how core system and management mechanisms work—including the object manager, synchronization, Wow64, Hyper-V, and the registry
  • Examine the data structures and activities behind processes, threads, and jobs
  • Go inside the Windows security model to see how it manages access, auditing, and authorization
  • Explore the Windows networking stack from top to bottom—including APIs, BranchCache, protocol and NDIS drivers, and layered services
  • Dig into internals hands-on using the kernel debugger, performance monitor, and other tools 

Delve inside Windows architecture and internals—and see how core components work behind the scenes. Led by three renowned internals experts, this classic guide is fully updated for Windows 7 and Windows Server 2008 R2—and now presents its coverage in two volumes.

As always, you get critical insider perspectives on how Windows operates. And through hands-on experiments, you’ll experience its internal behavior firsthand—knowledge you can apply to improve application design, debugging, system performance, and support.


In Part 2, you’ll examine:




  • Core subsystems for I/O, storage, memory management, cache manager, and file systems
  • Startup and shutdown processes
  • Crash-dump analysis, including troubleshooting tools and techniques

Saturday, July 12, 2014

Component Object Model (COM) using C++

Component Object Model


Syllabus

  • Component architecture
  • Component Object Model–COM
  • Interfaces
  • IUnknown 
  • Component life time
  • Components and servers
  • HRESULTS and GUIDS
  • COM registry entries 
  • COM library functions 
  • Class factories
  • Server activation and component creation 
  • COM servers in EXE 
  • Interface description language (IDL) 
  • MIDL 
  • Type libraries

Component Architecture

  • Monolithic Application
  • Component Application
  • Component Benefits
    • Application Evolve over time
    • Application Customization
    • Component Libraries
    • Distributed Components
  • Component Requirements
    • Dynamic Linking
    • Encapsulation
  • Encapsulation leads to following constraints
    • Components should have language independence
    • Components should be in binary form
    • Components must be up-gradable
    • Components must be transparently relocatable on the network

Component Object Model

  • Component Object Model (COM) is a specification for a way of creating components and building applications from these components
  • COM provides library of standard functions
  • COM components meets all the requirements of the component architecture
    • Language Independent
    • Binary Form
    • Upgradable
    • Relocatable

Interfaces

  • An interface provides connection between two different objects
  • Interface Features
    • Interfaces are immutable
    • Interfaces provide polymorphizm
  • Memory layout of an interface
    • vTable - Virtual Table
    • VTable pointer

IUnknown

  • Definition of IUnknown
    • QueryInterface
    • AddRef
    • Release
  • QueryInterface Rules
    • You always get the same IUnknown
    • You can always get an interface if you got it before
    • It is Symmetric
    • It is Transitive
    • It is Reflexive

Component Life Cycle

  • Component should take care of controlling its own lifetime
  • Reference Counting
  • Implementing AddRef and Release methods

Reference Counting Rules

  • Call AddRef before returning
  • Call Release when you are done
  • Call AddRef after assignment

Components and Servers

  • COM Component is a unit of functionality that implements one or more interfaces
  • COM Object server is either an executable or a DLL that hosts and create one or more COM components

COM Object Server in a DLL

  • COM DLL Server exports following five functions
    • DllMain
    • DllCanUnloadNow
    • DllGetClassObject
    • DllRegisterServer
    • DllUnregisterServer

HRESULTS and GUIDS

  • HRESULT
    • Facility(31-16) + Return Code(15 - 0)
  • GUID
    • UUID
    • IID
    • CLSID
    • GUID

COM Registry Entries

  • COM Components use registry to convey information about the location of their servers
  • A COM Dll Server is required to make these entries when the exported function DllRegisterServer is called
  • The COM library function CoGetClassObject takes the class id of the component and then looks into the registry to find the file name of the server in which component is hosted
  • Other COM Registry entires
    • PROGID or programmatic ID
    • AppID
    • Component Categories
    • Interface
    • TypeLib

COM Library Functions

  • The COM library is implemented in Ole32.dll
  • Some important COM library functions
    • CoInitialize/CoInitializeEx
    • CoUninitialize
    • CoGetClassObject
    • CoCreateInstance

Class Factories

  • A class factory is a COM component that creates other components that correspond only to a single, specific CLSID
  • The standard interface for creating components is IClassFactory or IClassFactory2

Server Activation and Component Creation

  • Client creating a component

COM Servers in EXE

  • Local Procedure call, Marshalling, and Proxy/Stub Dlls
  • Function call for out-of-proc components

Interface Description Language

  • Interface Description Language (IDL) is used to describe COM interfaces in a standard way
  • IDL is used to create proxy/stub Dlls and type libraries (TLB's)

MIDL

  • Microsoft IDL (MIDL) compiler is used to generate proxy and stub Dll's from IDL
  • MIDL also generates other helper files
  • Command Line: MIDL IX.idl
  • Files generated by MIDL compiler
    • IX.h
    • IX_P.c
    • IX_I.c
    • DLLDATA.c
    • makefile
    • IX.DEF

Type Libraries

  • Type libraries provides type information of components, interfaces, methods, properties, arguments and structures
  • Distributing Type Libraries
  • Using Type Libraries
    • LoadRegTypeLib
    • LoadTypeLib
    • RegisterTypeLib
    • UnRegisterTypeLib
  • Importing Type Library definitions in C++
    • #import "filename" [attributes]

Sample Code Snippets


Follow the steps mentioned in this walkthrough to create ATL based COM server and client in C++ using Visual Studio integrated development environment (IDE) and its wizards.

Server.idl

// Server.idl : IDL source for Server
//

// This file will be processed by the MIDL tool to
// produce the type library (Server.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";

[
    object,
    uuid(ABF4D15B-E5E5-42DF-9D6B-18E8DA308524),
    dual,
    nonextensible,
    pointer_default(unique)
]
interface IComServer : IDispatch {
    [id(1), helpstring("HelloWorld")] HRESULT HelloWorld([in] BSTR bstrString);
};
[
    uuid(AC45CE17-5C08-480C-A074-E02DB37DBE3F),
    version(1.0),
]
library ServerLib
{
    importlib("stdole2.tlb");
    [
        uuid(8C97F393-3695-4CD2-9DE0-6B42DF4F2071)
    ]
    coclass ComServer
    {
        [default] interface IComServer;
    };
};
      
 

ComServer.hpp

// ComServer.hpp : Declaration of the CComServer

#pragma once
#include "resource.h"       // main symbols

#include "Server_i.h"

#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif

using namespace ATL;

// CComServer

class ATL_NO_VTABLE CComServer :
    public CComObjectRootEx,
    public CComCoClass,
    public IDispatchImpl
{
public:
    CComServer()
    {
    }

    DECLARE_REGISTRY_RESOURCEID(IDR_COMSERVER)

    BEGIN_COM_MAP(CComServer)
        COM_INTERFACE_ENTRY(IComServer)
        COM_INTERFACE_ENTRY(IDispatch)
    END_COM_MAP()

    DECLARE_PROTECT_FINAL_CONSTRUCT()

    HRESULT FinalConstruct()
    {
        return S_OK;
    }

    void FinalRelease()
    {
    }

public:

    STDMETHOD(HelloWorld)(BSTR bstrString);
};

OBJECT_ENTRY_AUTO(__uuidof(ComServer), CComServer)
       
 

ComServer.cpp

// ComServer.cpp : Implementation of CComServer

#include "stdafx.h"
#include "ComServer.h"

// CComServer

STDMETHODIMP CComServer::HelloWorld(BSTR bstrString)
{
    // TODO: Add your implementation code here
    printf("%S \n\n", bstrString);

    return S_OK;
}
       
 

Cllient.cpp

// Client.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "atlbase.h"
#import "..\\Server\\\x64\\Release\\Server.tlb" no_namespace

int main()
{
    CoInitialize(nullptr);

    CComPtr pIComServer = nullptr;

    pIComServer.CoCreateInstance(__uuidof(ComServer));
    HRESULT hr = pIComServer->HelloWorld(L"Hello World! from client.");

    if (FAILED(hr))
    printf("Some error occured !\n");

    pIComServer.Release();
    pIComServer = nullptr;

    CoUninitialize();
    return 0;
}

Register/Un-register a Server Component

// Use below command to register the server
> regsvr32 Server.dll

// Use below command to un-register the server
> regsvr32 /u Server.dll

When you run the client program you should see the output printed by server component as below.


Recommended Book





 
biz.