Archive for January, 2007

Temporary Email Address?

Have you:

  • Ever wanted to download a software only to be asked for your email address before downloading?
  • Ever shared your email address on a website, though it claims clean, then the next day new spam started appearing in your inbox?
  • Ever needed to create a fast and anonymous email address for temporary use only?

Well, ofcourse you’ve faced at least one of these demands. Hotmail, Yahoo, Gmail are not an option since they are not that anonymous as they seem and they take time to be created!

So what’s the solution you ask?
The solution lies in the what so called “Temporary Email Address” service providers.

One site that comes to mind is the mailinator website which gives you a random email address everytime you visit the website. Not only that, to check your messages you simply type the email address in question!

Other similar websites:

  • http://www.mytrashmail.com/
  • http://www.mailexpire.com/
  • http://www.spamhole.com/

Leave a Comment

Emulating CoCreateInstance()

Introduction

A while ago I wrote a small utility that converts DOT syntax into an image using
the WinGraphViz.DLL COM component.

However it is not very usual to have the user register this component before
running the tool, thus I started looking around for a way to use COM component
as if they were normal DLL.
The research yielded that there are many techniques to accomplish that:

  1. Registration-Free COM (for XP and above)
  2. Emulating the CoCreateInstance()

To learn more about the Registration-Free COM please check the references at
the end of this article.

Emulating CoCreateInstance()

Normally, to create an instance you would do something like:

  hr = CoCreateInstance(CLSID_DOT, NULL, CLSCTX_ALL,
  IID_IDOT, (LPVOID *)&pIDOT);

This will cause OLE to fetch the associated DLL from the registry and call its
DllGetClassObject() method to get a class factory then from the class factory
an instance of your required IID will be created.

For that reason we may emulate the CoCreateInstance() by the following code:

HRESULT __stdcall MyCoCreateInstance(
  LPCTSTR szDllName,
  IN REFCLSID rclsid,
  IUnknown* pUnkOuter,
  IN REFIID riid,
  OUT LPVOID FAR* ppv)
{
  HRESULT hr = REGDB_E_KEYMISSING;

  HMODULE hDll = ::LoadLibrary(szDllName);
  if (hDll == 0)
    return hr;

  typedef HRESULT (__stdcall *pDllGetClassObject)(IN REFCLSID rclsid, IN REFIID riid, OUT LPVOID FAR* ppv);

  pDllGetClassObject GetClassObject = (pDllGetClassObject)::GetProcAddress(hDll, "DllGetClassObject");
  if (GetClassObject == 0)
  {
    ::FreeLibrary(hDll);
    return hr;
  }

  IClassFactory *pIFactory;

  hr = GetClassObject(rclsid, IID_IClassFactory, (LPVOID *)&pIFactory);

  if (!SUCCEEDED(hr))
    return hr;

  hr = pIFactory->CreateInstance(pUnkOuter, riid, ppv);
  pIFactory->Release();

  return hr;
}

Notice that how this function takes a parameter holding the DLL’s name.

Using the code

You need your application to run first if the COM is registered, if not you
would resort to emulating the CoCreateInstance(). Your code could look like
this:

hr = CoCreateInstance(CLSID_DOT, NULL, CLSCTX_ALL,
  IID_IDOT, (LPVOID *)&pIDOT);

if (hr == REGDB_E_CLASSNOTREG)
{
  hr = MyCoCreateInstance(_T("WinGraphViz.dll"), CLSID_DOT, NULL, IID_IDOT, (LPVOID *)&pIDOT);
}

if (FAILED(hr))
{
  cout << "CoCreateInstance Failed: " << hr << "nn";
  return -1;
}

Reference

The following links were helpful during the building of this simple snippet:

Comments (3)

Sexual Art Links

These are nice sexual art links, if you know more post your comments!

Body Art site: http://www.h6.dion.ne.jp/%7Ejanbopai/sitemap_E.htm
Sex in Art: http://www.sexinart.net/

Leave a Comment